Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes OpenAL support 5.1 output on Mac OS X?
    text
    copied!<p>I'm in the process of porting an application from Windows to Mac OS X. It is using OpenAL for handling the sound, but I'm getting a strange behavior in the initialization of the sound engine on Mac OS X (the code is running on a MacBook Pro).</p> <p>Here is the code:</p> <pre><code>int InitSoundEngine(void* data[NB_BUFFERS], size_t data_size[NB_BUFFERS]) { ALCdevice *device; ALCcontext *context; ALenum format; ALuint buffers[NB_BUFFERS]; device = alcOpenDevice(NULL); if (device == NULL) goto failed; context = alcCreateContext(device, NULL); if (context == NULL) goto failed; alcMakeContextCurrent(context); format = alGetEnumValue("AL_FORMAT_51CHN16"); if (format == 0) goto failed; alGenBuffers(NB_BUFFERS, buffers); if (alGetError() != AL_NO_ERROR) goto failed; for (int i = 0; i &lt; NB_BUFFERS; ++ i) { alBufferData(buffers[i], format, data[i], data_size[i], 48000); if (alGetError() != AL_NO_ERROR) goto failed; } return NO_ERROR; failed: /* Cleanup omitted for brievety */ return INITIALIZATION_FAILED; } </code></pre> <p>This fails when during the call to <code>alBufferData</code>, with an error of <code>AL_INVALID_VALUE</code>. While tracing the code, we discovered that <code>alGetEnumValue("AL_FORMAT_51CHN16")</code> is returning <code>0xfffffffful</code>, and we suspect this is the root of the issue.</p> <p>The <code>alGetEnumValue</code> says:</p> <blockquote> <p><code>ALuint alGetEnumValue(const ALchar *enumName);</code></p> <p>Returns <code>0</code> if the enumeration can not be found, and sets an <code>AL_INVALID_VALUE</code> error condition. The presence of an enum value does not guarantee the applicability of an extension to the current context. A non-zero return indicates merely that the implementation is aware of the existence of this extension.</p> </blockquote> <p>I think I use the function correctly. Is there a bug in the Mac OS X implementation of OpenAL ? Is 5.1 output supported via OpenAL on Mac OS X ? Is it supported via Core Audio (porting to Core Audio could be an option if this is true) ? Should I convert my audio from 5.1 to another format (3.1, stereo, ...) ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload