Here I have a simple part of a code:
On my laptop it works perfectly. The music plays and stops when it should, but on my PC the game crashes on al_play_sample(). When I delete the sample_id part(or turn off the music by the game menu) it works fine, but i can't stop the music ><".
ALLEGRO_SAMPLE_ID SWITCH; al_play_sample(song, 0.8, 0, 1, ALLEGRO_PLAYMODE_LOOP, &SWITCH);
Thank you. And can you explain me shortly why it's this way?
Allegro assumes you have already reserved the space for the sample id, so you need to pass it a pointer that points to a valid block of memory.
ALLEGRO_SAMPLE_ID foo; // reserves space ALLEGRO_SAMPLE_ID *fooptr; // points to some arbitrary location