[Openal] ALC_Capture -Getting Started

Alex Russell alex at clubvarie.com
Sun Jun 25 10:08:49 PDT 2006


Hi,

This is my first mailing to the list. Hope it's active.

I have used OpenAL for playing and streaming audio before, I am now
trying to implement an application that records audio from a
microphone and either saves it to a file or sends it to a speech
recognition API for processing.

I couldn't find any examples in the 1.1 SDK, and the documentation
lacked examples (correct me if I'm wrong). I really don't know how the
capture feature is supposed to work. Does anyone have a working
example?

Here is my attempt so far:

In the constructor:

        pDefaultCaptureDevice = alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);


        //Open device for input
        inputDevice = alcCaptureOpenDevice(pDefaultCaptureDevice, 44100,AL_FORMAT_STEREO16, 1024);


        if(inputDevice == NULL)
        {
                printf("¥nOh crap, input device not opened successfully");
        }
        
        
        ....
        
        
Capture method:
        
void OpenALWrap::recordMicInput()
{
        printf("¥nStart recording¥n");

        alcCaptureStart(inputDevice);

        do
        {
      alcGetIntegerv(inputDevice, ALC_CAPTURE_SAMPLES, 1,&lSamplesAvailable);
      
          cout << lSamplesAvailable << endl;
        }
        while(lSamplesAvailable < 1024);

        cout << "Finished agregating" << endl;


        alcCaptureSamples(inputDevice, buf, samps );

}

This runs, but I have no idea how to get any audio from it. Is the
audio data stored in buf? Also, how can you make it record
continuously?

A working example would be greatly appreciated.

-- 
Best regards,
 Alex                          mailto:alex at clubvarie.com





More information about the Openal mailing list