Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading docs on al_create_voice #966

dos1 opened this Issue Dec 6, 2018 · 1 comment


None yet
2 participants
Copy link

dos1 commented Dec 6, 2018

Docs say:

The passed frequency (in Hz), sample format and channel configuration are used as a hint to what kind of data will be sent to the voice. However, the underlying sound driver is free to use non-matching values. For example, it may be the native format of the sound hardware.

From something documented this way, I would expect it to not fail when passing wrong parameters. However, in order to reliably initialize audio on every platform in my engine, I had to do something like:

	game->audio.v = al_create_voice(44100, depth, ALLEGRO_CHANNEL_CONF_2);
	if (!game->audio.v) {
		// fallback
		game->audio.v = al_create_voice(44100, depth, ALLEGRO_CHANNEL_CONF_2);

I've seen voice creation with ALLEGRO_AUDIO_DEPTH_FLOAT32 failing on Windows and macOS, and resulting in distortion on Android (will have to check this one out again and report if it still happens). It works well with this fallback code. Although it's not explicitly stated in the docs, from how it's worded I'd expect passed "hint" to be ignored when there's possibility to create a voice with other configuration.

Actually, what would be the most bullet-proof, Allegro-idiomatic and performant (no unnecessary conversions) way to reliably create a voice on every platform?


This comment has been minimized.

Copy link

fatcerberus commented Dec 6, 2018

I’d probably just ask for what I want, and if that fails use something generic like 44.1khz 16-bit stereo (i.e. CD quality) that is highly unlikely to fail. It’s probably impossible to cover all the bases in practice, but this would get you pretty close.

I agree the “hint” wording in the documentation implies that it shouldn’t fail due to unsupported parameters, as long as they’re sane. I wonder if this is actually a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.