![]() |
|
Creating Voice, Mixer and Sample Instance |
AMCerasoli
Member #11,955
May 2010
![]() |
Hi guys, I'm having some problems when creating my own voice, mixer and sample instance. I remember I did it once, but I can't do it now 1 ALLEGRO_VOICE *voice = al_create_voice(44100,
2 ALLEGRO_AUDIO_DEPTH_INT16,
3 ALLEGRO_CHANNEL_CONF_2);
4
5 ALLEGRO_MIXER *mixer = al_create_mixer(44100,
6 ALLEGRO_AUDIO_DEPTH_FLOAT32,
7 ALLEGRO_CHANNEL_CONF_2);
8
9 al_attach_mixer_to_voice(mixer, voice);
10 ALLEGRO_SAMPLE *sam = al_load_sample("sam.ogg");
11 ALLEGRO_SAMPLE_INSTANCE *sam_ins = al_create_sample_instance(sam);
12
13 if(!al_play_sample_instance(sam_ins))
14 std::cout<<"error";
15
16 al_rest(1);
I always get an error in that last step, the rest don't have error checking but I have already check them and they work fine. Thanks. Edit: I got it, I was missing al_attach_sample_instance_to_mixer(), this is like in a real studio when you need to connect all those wires...
|
|