Re: Switching between Input-devices using OpenAL

keghn <[email protected]> Fri, 28 Jun 2013 11:34:16 -0700 (PDT)
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
 Hello,
 Dose openAL detect everything, even the usb microphone?



/*
Compile with: 

g++ openal_detect.cpp -lalut -lopenal -o openal_detect

 This program detects sound devices that openal can use.
*/

#include <AL/al.h>    // OpenAL header files
#include <AL/alc.h>
#include <cstring>
#include <iostream>


/*
//for windows ?
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <windows.h>
#include <al.h>
#include <alc.h>
*/

using namespace std;
int main()
  {      
	const             ALCchar *szDefaultCaptureDevice;

    ALCdevice *pCaptureDevice[2];
    ALCcontext *ctx;

    pCaptureDevice[0] = alcOpenDevice(NULL);
    ctx = alcCreateContext(pCaptureDevice[0], NULL);
    alcMakeContextCurrent(ctx);

	alGetError();

      // Get list of available Capture Devices
      const ALchar *pDeviceList = alcGetString(NULL,
ALC_CAPTURE_DEVICE_SPECIFIER);
      if (pDeviceList)
      {///

		cout<<"\n Available Capture Devices are:\n";

            while (*pDeviceList)
            {
			  cout<<"\n"<< pDeviceList;
              pDeviceList += strlen(pDeviceList) + 1;
			 }
        }///

	szDefaultCaptureDevice =
alcGetString(NULL,ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
	cout<<"\n\n  Default Capture Device is:\n"<<
szDefaultCaptureDevice<<"\n\n";

	alcCaptureStop(pCaptureDevice[1]);
	alcCaptureCloseDevice(pCaptureDevice[0]);
	alcCaptureCloseDevice(pCaptureDevice[1]);
	alcCaptureCloseDevice(pCaptureDevice[2]);

    alcMakeContextCurrent(NULL);
    alcDestroyContext(ctx);
    alcCloseDevice(pCaptureDevice[0]);

	return 0;

}



--
View this message in context: http://openal.996291.n3.nabble.com/Switching-between-Input-devices-using-OpenAL-tp5517p5523.html
Sent from the OpenAL - User mailing list archive at Nabble.com.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal