#include "Sound.h" NAMESPACE_UPP; SoundDevice::SoundDevice(int n):index(n){ if(n==paNoDevice){ index=Null; name="Null"; return; } const PaDeviceInfo* dev=Pa_GetDeviceInfo(index); name=dev->name; API=dev->hostApi; InputChannels=dev->maxInputChannels; OutputChannels=dev->maxOutputChannels; LowInputLatency=dev->defaultLowInputLatency; LowOutputLatency=dev->defaultLowOutputLatency; HighInputLatency=dev->defaultHighInputLatency; HighOutputLatency=dev->defaultHighOutputLatency; SampleRate=dev->defaultSampleRate; } String SoundDevice::ToString()const{ return Format("%s (index= %d, in/out= %d/%d, API= %d",name,index,InputChannels,OutputChannels,API); } SoundAPI::SoundAPI(int n):index(n){ const PaHostApiInfo* a=Pa_GetHostApiInfo(index); name=a->name; type=a->type; deviceCount=a->deviceCount; defaultInputDevice=a->defaultInputDevice; defaultOutputDevice=a->defaultOutputDevice; } String SoundAPI::ToString()const{ return String().Cat() << name; } /* SoundSystem */ bool SoundSystem::exists = false; GLOBAL_VAR(SoundSystem,SoundSys); SoundSystem::SoundSystem(){ ASSERT_(!exists,"SoundSystem already instantiated!"); err=Pa_Initialize(); CHECK_ERR; exists=true; } SoundSystem::~SoundSystem(){ err=Pa_Terminate(); CHECK_ERR; exists=false; } int SoundSystem::GetCount()const{ err=Pa_GetDeviceCount(); CHECK_ERR; return err; } int SoundSystem::GetAPICount()const{ err=Pa_GetHostApiCount(); CHECK_ERR; return err; } const Vector SoundSystem::GetDevices()const{ Vector v; for(int i=0;i SoundSystem::GetAPIs()const{ Vector v; for(int i=0;i=0&&n=0&&n #endif INITBLOCK{ #ifdef LOG_SOUND_ERRORS LOG("PortAudio was compiled with support for: "< does not match your platform"); }