1

したがって、次のようなものがあります。

      //...
// 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)
{//...

ただし、ここではデフォルトのデバイスのみを使用します。ユーザーに1つを選択させて使用させる方法は?

4

1 に答える 1

1

すべてのキャプチャデバイスを一覧表示すると、それらをコンボボックスに表示し、ユーザーが必要なデバイスを選択して、alcCaptureOpenDeviceでその名前を使用できるようにすることができます。

于 2010-12-31T13:14:54.397 に答える