Re: [AD] proposed changes to sound API

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-12-17, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> On Tue, Dec 16, 2008 at 4:39 PM, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> > Before I submit any smaller patches, I'd like to propose some bigger
> > changes to the sound API.
> >
> 
> I've made most of the changes and updated the examples to work. I'm
> still not quite sure of the best way to handle the default mixer.
> 
> ex_saw now looks something like:
> 
> --
> al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT);
> al_reserve_samples(8);
> stream = al_create_stream(8, SAMPLES_PER_BUFFER, 22050,
> ALLEGRO_AUDIO_DEPTH_UINT8, ALLEGRO_CHANNEL_CONF_1);
> al_attach_stream_to_mixer(al_get_default_mixer(), stream);
> --
> 
> It uses a stream to play some noise. Like most Allegro apps, it can
> get by quite easily with the api formerly known as simple. In fact, it
> doesn't ever use al_play_sample(), and thus doesn't really need to
> reserve any samples. However, it does need to use the default mixer
> (to prevent creating its own), thus a call to al_reserve_samples() is
> needed, and that bugs me a little bit.

I think it's not worth optimising the API for this example.  Using a
non-default mixer isn't much harder here, so it should just do that.

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/