RE: [AD] Sound Streaming

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


> sorry for this OT but I'm not subscibed to other Allegro lists.

You've got away with it - this time - because your e-mail amounts to a
suggestion for a new feature. Read on...

> I wanted to know if it is a good idea to base music-software on Allegros
> streaming-functions. Are there any quality drawbacks when using
> this feature
> or can I use 48 kHz, 16 bit, stereo and it sounds like the output of
> professional music software?

Nope. I wish Allegro sounded like ModPlug Tracker :-)

> What happens to my audiostream after I pass it to Allegro?

An audio stream is really just a sample. Its length is two times what you
pass to play_audio_stream() when you create it. It is initialised to silence
and played with forward looping. While the first half is playing,
get_audio_stream_buffer() will return a pointer to the second half - once.
When the second half is playing, you'll get a pointer to the first half. And
so on. BTW free_audio_stream_buffer() *is* required - I haven't tried to
work out why, but it's something to do with locking/unlocking voices uhm.

After that, the sample is mixed into the output buffer like any other
sample. Unless you choose the frequency to match that of the sound card, it
will suffer from resampling. It will not be full volume - even
set_volume_per_voice(0) will only cause it to play at half volume in each
channel, or full volume in one channel (left or right). Playing two copies
of the sample is not a good idea (it's inefficient and cannot be
synchronised), and anyway it's impossible with audio streams without doing
some serious hackery.

> Is it possible to tell Allegro to just pass the
> signal on to the sound-hardware?

A suggestion for a new feature...

There was talk of providing custom mixers for the user. This would come
under that category. AFAIK all sound drivers (except maybe Micro$41t DirectX
mixer) use two buffers in the same way as audio streams, so this could be
the protocol.

Opinions?

> I am wondering, because I want to use the multi-platformity of Allegro for
> this software...

Good for you :-)

Ben Davis



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