【问题标题】:How to let user select a audio recording device with openAL?如何让用户使用 openAL 选择录音设备?
【发布时间】:2010-11-25 21:46:19
【问题描述】:

所以我们有类似的东西:

      //...
// Get list of available Capture Devices
const ALchar *pDeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
if (pDeviceList)
{
    ALFWprintf("\nAvailable Capture Devices are:-\n");

    while (*pDeviceList)
    {
        ALFWprintf("%s\n", pDeviceList);
        pDeviceList += strlen(pDeviceList) + 1;
    }
}

// Get the name of the 'default' capture device
szDefaultCaptureDevice = alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
ALFWprintf("\nDefault Capture Device is '%s'\n\n", szDefaultCaptureDevice);

alGenSources(1, &source);
alGenBuffers(3, buffers);

/* Setup some initial silent data to play out of the source */
alBufferData(buffers[0], AL_FORMAT_MONO16, data, sizeof(data), 22050);
alBufferData(buffers[1], AL_FORMAT_MONO16, data, sizeof(data), 22050);
alBufferData(buffers[2], AL_FORMAT_MONO16, data, sizeof(data), 22050);
alSourceQueueBuffers(source, 3, buffers);

/* If you don't need 3D spatialization, this should help processing time */
alDistanceModel(AL_NONE); 


// Open the default Capture device to record a 22050Hz 16bit Mono Stream using an internal buffer
// of BUFFERSIZE Samples (== BUFFERSIZE * 2 bytes)
pCaptureDevice = alcCaptureOpenDevice(szDefaultCaptureDevice, 22050, AL_FORMAT_MONO16, BUFFERSIZE);
if (pCaptureDevice)
{//...

但这里我们只使用默认设备。如何让用户选择一个而不是使用它?

【问题讨论】:

    标签: c++ c list device openal


    【解决方案1】:

    当您列出所有捕获设备时,您可以将它们显示在组合框上,让用户拿起他想要的设备并在 alcCaptureOpenDevice 上使用其名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-15
      • 2016-03-27
      • 1970-01-01
      • 2011-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多