read the tutorial but didn't find a good way around this...
sound.cpp
sound.h
so when I call sound.stopbackmusic(1); it just doesnt work, gives me "access violation reading..." and points to "al_stop_sample(bkgid);"
what am I doing wrong here ? 
The only work around I can find is to destroy the sample directly.
PS:
simple code in main.cpp
ALLEGRO_SAMPLE_ID * bkgid; ALLEGRO_SAMPLE *bkg; bkg=al_load_sample("data/bkg.wav"); al_play_sample(bkg,1.0,0,1.0,ALLEGRO_PLAYMODE_LOOP,bkgid); Sleep(1500); al_stop_sample(bkgid);
tells me that bkgid is not initialized
If I'm not mistaken then you should be passing already allocated ALLEGRO_SAMPLE_IDs. You could change them from pointers to regular variables and pass the address.
that....worked !
But how could one know about those default sample_id's ?
anyway this is the correct way to stop a sample ? make it an ID and pass it's address ?
Yes it is.
The problem was using a pointer that didn't point to valid memory - it was uninitialized. That's why using an ALLEGRO_SAMPLE_ID on the stack and passing it's address worked.
Yea sorry but I'm stupid again...
I want to make a simple thing... no loops needed in my opinion:
Display text. If the user presses any keys, clear and display some other text...
I can't make it work
If you have a timer registered to your event queue, then you won't ever get your ALLEGRO_EVENT_KEY_DOWN event, and it will just skip past those checks. You need to wait in a loop until the event is an ALLEGRO_EVENT_KEY_DOWN event.
void WaitForKeyPress(ALLEGRO_EVENT_QUEUE* queue) { while (1) { ALLEGRO_EVENT ev; al_wait_for_event(queue , &ev); if (ev.type == ALLEGRO_EVENT_KEY_DOWN) {break;} } }
done it ! thanks for the tip !