Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » al_create_voice() fails

This thread is locked; no one can reply to it. rss feed Print
al_create_voice() fails
Bruce Pascoe
Member #15,931
April 2015
avatar

Is al_create_voice() supposed to fail if you pass unsupported (by the hardware) parameters? I've found that to be the case when attempting to create, e.g. 96000Hz/24bit voices on systems where that isn't supported. The documentation for the function is vague, but it seems to imply the values can be modified under the hood ("it may be the native format of the sound hardware"), so in that case I would expect most requests to succeed even if they have to create a lower-quality voice.

Elias
Member #358
May 2000

It depends mostly on the driver I think - e.g. PulseAudio will allow everything, others will be picky. Voices are a big mis-feature of Allegro 5 anyway as far as I'm concerned.

--
"Either help out or stop whining" - Evert

SiegeLord
Member #7,827
October 2006
avatar

I'd prefer it to fail for unsupported formats (and adjust the documentation accordingly).

As for voices in general, I think everything would become better if we added an internal mixer for each voice (alternatively, adding an optional voice for each mixer, the implementation strategy is irrelevant), making it acceptable to pass voices to al_*_mixer functions (as first parameter only) and deprecating the al_*_voice functions (just making them forward to al_*_mixer functions).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Elias
Member #358
May 2000

I'd be very much in favor of that - it would simplify the actual audio drivers a lot (currently there is two separate update paths in each, one for mixers and one for without).

--
"Either help out or stop whining" - Evert

Bruce Pascoe
Member #15,931
April 2015
avatar

Interesting. For minisphere's Audialis API, I actually abstracted away the distinction--the Mixer object encapsulates both a mixer and voice. The voice/mixer dichotomy confused the hell out of me for the longest time, and until very recently I just stuck to using the default mixer.

The only thing that concerns me if voices and mixers are combined, is that you won't be able to create, e.g. float mixers if the driver in use doesn't support them. This issue actually bit me with the feature mentioned above. DSound doesn't allow float voices, and Allegro balks if you try to create an 8-bit mixer (for good reason!). In order to support these, I had to create the voice and mixer with different parameters. So on reflection, the distinction does have its benefits.

SiegeLord
Member #7,827
October 2006
avatar

you won't be able to create, e.g. float mixers if the driver in use doesn't support them.

It's just a matter of adding a function that takes separate formats for the mixer and voice.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: