So i've never done anything with music before... samples/voices/mixers... mean nothing to me I'm dumb!...
so by alot of reading the api and other things i came up with this
al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT); ALLEGRO_SAMPLE *test = al_load_sample_wav("music/simple.wav"); if(!test) cout<<"couldnt load music"<<endl; else al_play_sample(test,255, 128, 1000, 0,NULL);
but it doesnt work...
1. it says undefined reference to al_install_audio. (i've got allegro5/acodec.h included and liba5_acodec-4.9.12.dll.a linked... am i mission something?
2. al_play_sample gives me the same error... undefined reference...
i looked for other files to link to and include in the project but didnt find anything that looked like it would help.
You'll want to link to kcm_audio as well. acodec just provides audio decoders for popular formats. At some point I'll probably be renamed to better fit the current naming scheme.
perfect, now it compiles and i dont get any errors, but i dont hear anything 
EDIT:
after more reading i've changed it to this;
al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT); if(!al_reserve_samples(5)) cout<<"couldnt reserve samples"<<endl; ALLEGRO_SAMPLE *test = al_load_sample("music/simple.wav"); ALLEGRO_SAMPLE_ID testid; if(!test) cout<<"couldnt load music"<<endl; al_play_sample(test,1, ALLEGRO_AUDIO_PAN_NONE, 1, 1, &testid);
but still no sound...
if(!al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT)) cout<<"Apparently can't find a driver"<<endl;
Maybe? I don't know about a5 error messages...
Post a test case. What you have should work unless there's something else wrong in your code.
Secondly, you're better of streaming your music than loading it all into memory. A 1 minute sample is going to take huge amounts of memory.
Use ALLEGRO_PLAYMODE_ONCE or ALLEGRO_PLAYMODE_LOOP for the fifth argument. I don't think either of them are defined to 1.
The last parameter can be NULL if you never need to explicitly stop it.
Also, some wav files won't load in 4.9.12 if they have extended information embedded in them. But most should work.
ok here is what i got now.
if(!al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT)) cout<<"couldnt install audio"<<endl; if(!al_reserve_samples(2048)) cout<<"couldnt reserve samples"<<endl; ALLEGRO_SAMPLE *test = al_load_sample("music/simple.wav"); ALLEGRO_SAMPLE_ID testid; if(!test) cout<<"couldnt load music"<<endl; al_play_sample(test,1.0, ALLEGRO_AUDIO_PAN_NONE, 1.0, ALLEGRO_PLAYMODE_ONCE , &testid);
and it works now!... kinda. after adding ALLEGRO_PLAYMODE_ONCE... but it sounds really jacked up... then crashes haha.
how do i stream it instead of loading it all?
al_stream_from_file
did that and now i dont get any noise, or any errors... bad .wav? it works in itunes...
btw: what do i put in al_reserve_samples() (or do i even need that anymore?)
and what should i put for the first two args to al_stream_from_file()?
Did you attach the stream to a mixer? Check out ex_stream_file.c.
al_reserve_samples() sets up a default voice and mixer and is required for al_play_sample().
If you set up your own voice and mixer and don't use al_play_sample(), then you don't need it.
nope didnt attach the stream to a mixer... (stream, mixer, sample, voice, they all still mean very little to me, but they're starting to come together.)
EDIT: I now have this
but still no sound or errors... i copied ex_stream_file.c as best i could.
EDIT: EDIT: is there someway to change the volume or something?? and for al_stream_from_file, how do i know what to put for the first two arguments?
EDIT: EDIT: EDIT: Just found out the wav file was junk
voice => a direct line to hardware
mixer => takes multiple audio sources, mixes them together, and sends it to a voice
stream => produces audio via a small memory buffer that must be filled in real time
sample => an audio clip that can be played directly via al_play_sample()
sample instance => a "copy" of a sample that can be controlled and played back with more flexibility
http://alleg.sourceforge.net/a5docs/refman/kcm_audio.html#al_set_stream_gain, etc
When you call al_reserve_samples(), a stereo (2 channel) voice and mixer are created for you. You can use al_get_default_mixer() to retrieve it.
4.9.13 has better support for loading wav files.
perfect thanks! Just what i needed to know!
4.9.13 has better support for loading wav files.
Technically its worse. While Elias added support for skipping unknown data in the wav, Peter decided it was ok to remove support for libsndfile, which is what supported encoded wav files (ADPCM etc). So now all we're going to get is plain old un encoded wav support (back to how it was in A4).
I won't be including libsndfile in any Allegro.cc binary distributions, so I don't care either way.
I don't think we need an official sndfile addon. ADPCM wave files would be the strongest reason, but in a game you can pick which file formats you want to use, and I can't see why you'd use ADPCM wave files over FLAC or Ogg Vorbis, if you are concerned about the size of uncompressed PCM. The sizes of the FLAC and sndfile libraries are nearly the same, and Ogg Vorbis is smaller than either:
-rwxr-xr-x 1 root root 328704 2008-09-11 09:28 libFLAC.so.8.2.0
-rwxr-xr-x 1 root root 16404 2007-02-16 17:19 libogg.so.0.5.3
-rwxr-xr-x 1 root root 369228 2009-03-19 14:17 libsndfile.so.1.0.18
-rwxr-xr-x 1 root root 165380 2007-09-24 05:04 libvorbis.so.0.4.0
-rwxr-xr-x 1 root root 30600 2007-09-24 05:04 libvorbisfile.so.3.2.0
Not to mention ADPCM sounds crap.
(edit: in my experience, which might be due to the implementations, plus it's been a long time)
Yeah, I can't say why someone would pick ADPCM or other encoded wav formats over plain old Ogg, flac, or mp3 for that matter. And heck, one of these days someone should add a Speex loader as well.