本文整理汇总了C++中Pa_GetHostApiInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ Pa_GetHostApiInfo函数的具体用法?C++ Pa_GetHostApiInfo怎么用?C++ Pa_GetHostApiInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Pa_GetHostApiInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: displayOption
void displayOption()
{
Pa_Initialize();
fprintf(stderr, "--------------------------------------------------\n");
fprintf(stderr, "Input Devices\n");
fprintf(stderr, "--------------------------------------------------\n");
for (int i = 0; i < Pa_GetDeviceCount(); i++) {
const PaDeviceInfo *deviceInfo;
deviceInfo = Pa_GetDeviceInfo(i);
if (deviceInfo->maxInputChannels > 0) {
const PaHostApiInfo *apiInfo;
apiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
fprintf(stderr, "%2d %s(%s)\n", i, deviceInfo->name, apiInfo->name);
}
}
fprintf(stderr, "\n--------------------------------------------------\n");
fprintf(stderr, "Output Devices\n");
fprintf(stderr, "--------------------------------------------------\n");
for (int i = 0; i < Pa_GetDeviceCount(); i++) {
const PaDeviceInfo *deviceInfo;
deviceInfo = Pa_GetDeviceInfo(i);
if (deviceInfo->maxOutputChannels > 0) {
const PaHostApiInfo *apiInfo;
apiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
fprintf(stderr, "%2d %s(%s)\n", i, deviceInfo->name, apiInfo->name);
}
}
Pa_Terminate();
}
开发者ID:DMPinc,项目名称:portaudio,代码行数:30,代码来源:portaudio-test.cpp
示例2: pa_printdevinfo
// print info about the audio device to stdout
void pa_printdevinfo()
{
mexPrintf("Printing audio devices...\n");
Pa_Initialize();
int dev_type_indx = -1;
const PaHostApiInfo* Api_Info;
int num_APIs = (int )Pa_GetHostApiCount();
for (int i=0; i<num_APIs; i++) {
Api_Info = Pa_GetHostApiInfo(i);
if (strcmp(Api_Info->name,API_NAME)==0)
dev_type_indx = i;
}
if (dev_type_indx == -1) {
return;
}
Api_Info = Pa_GetHostApiInfo(dev_type_indx);
for( int d = 0; d < Api_Info->deviceCount; d++) {
//PaDeviceIndex dev_indx = Pa_HostApiDeviceIndexToDeviceIndex(dev_type_indx, d);
//printdevice((int )dev_indx);
printdevice(dev_type_indx, d);
}
Pa_Terminate();
}
开发者ID:ignaciodsimon,项目名称:AAT9,代码行数:29,代码来源:pawavplay_wasapi.cpp
示例3: qDebug
/* Returns true on success, false on failure */
bool PortAudioStreamer::Start(const PaStreamParameters *inputParams,
const PaStreamParameters *outputParams,
double sampleRate)
{
PaError error;
qDebug("Trying Pa_OpenStream() with sampleRate %g inputLatency %g outputLatency %g innch %d outnch %d",
sampleRate,
inputParams->suggestedLatency,
outputParams->suggestedLatency,
inputParams->channelCount,
outputParams->channelCount);
const PaDeviceInfo *deviceInfo = Pa_GetDeviceInfo(inputParams->device);
if (deviceInfo) {
const PaHostApiInfo *hostApiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
qDebug("Input device: %s (%s)", deviceInfo->name,
hostApiInfo ? hostApiInfo->name : "<invalid host api>");
}
deviceInfo = Pa_GetDeviceInfo(outputParams->device);
if (deviceInfo) {
const PaHostApiInfo *hostApiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
qDebug("Output device: %s (%s)", deviceInfo->name,
hostApiInfo ? hostApiInfo->name : "<invalid host api>");
}
error = Pa_OpenStream(&stream, inputParams, outputParams,
sampleRate, paFramesPerBufferUnspecified,
paPrimeOutputBuffersUsingStreamCallback,
streamCallbackTrampoline, this);
if (error != paNoError) {
logPortAudioError("Pa_OpenStream() failed", error);
stream = NULL;
return false;
}
m_srate = sampleRate;
m_innch = inputParams->channelCount;
m_outnch = outputParams->channelCount;
m_bps = 32;
error = Pa_StartStream(stream);
if (error != paNoError) {
logPortAudioError("Pa_StartStream() failed", error);
Pa_CloseStream(stream);
stream = NULL;
return false;
}
const PaStreamInfo *streamInfo = Pa_GetStreamInfo(stream);
if (streamInfo) {
qDebug("Stream started with sampleRate %g inputLatency %g outputLatency %g",
streamInfo->sampleRate,
streamInfo->inputLatency,
streamInfo->outputLatency);
}
return true;
}
开发者ID:akinsgre,项目名称:wahjam,代码行数:59,代码来源:audiostream_pa.cpp
示例4: pa_get_default_output_dev
/* Internal: Get PortAudio default output device ID */
static int pa_get_default_output_dev(int channel_count)
{
int i, count;
/* Special for Windows - try to use the DirectSound implementation
* first since it provides better latency.
*/
#if PJMEDIA_PREFER_DIRECT_SOUND
if (Pa_HostApiTypeIdToHostApiIndex(paDirectSound) >= 0) {
const PaHostApiInfo *pHI;
int index = Pa_HostApiTypeIdToHostApiIndex(paDirectSound);
pHI = Pa_GetHostApiInfo(index);
if (pHI) {
const PaDeviceInfo *paDevInfo = NULL;
paDevInfo = Pa_GetDeviceInfo(pHI->defaultOutputDevice);
if (paDevInfo && paDevInfo->maxOutputChannels >= channel_count)
return pHI->defaultOutputDevice;
}
}
#endif
/* Enumerate the host api's for the default devices, and return
* the device with suitable channels.
*/
count = Pa_GetHostApiCount();
for (i=0; i < count; ++i) {
const PaHostApiInfo *pHAInfo;
pHAInfo = Pa_GetHostApiInfo(i);
if (!pHAInfo)
continue;
if (pHAInfo->defaultOutputDevice >= 0) {
const PaDeviceInfo *paDevInfo;
paDevInfo = Pa_GetDeviceInfo(pHAInfo->defaultOutputDevice);
if (paDevInfo->maxOutputChannels >= channel_count)
return pHAInfo->defaultOutputDevice;
}
}
/* If still no device is found, enumerate all devices */
count = Pa_GetDeviceCount();
for (i=0; i<count; ++i) {
const PaDeviceInfo *paDevInfo;
paDevInfo = Pa_GetDeviceInfo(i);
if (paDevInfo->maxOutputChannels >= channel_count)
return i;
}
return -1;
}
开发者ID:avble,项目名称:natClientEx,代码行数:55,代码来源:pa_dev.c
示例5: Pa_GetDeviceCount
void
CPaCommon::Enumerate(vector < string > &choices, vector < string > &descriptions)
{
vector < string > tmp;
names.clear();
descriptions.clear();
names.push_back(""); /* default device */
descriptions.push_back("");
int numDevices = Pa_GetDeviceCount();
if (numDevices < 0)
throw string("PortAudio error: ") + Pa_GetErrorText(numDevices);
PaHostApiIndex nApis = Pa_GetHostApiCount();
for (int i = 0; i < numDevices; i++)
{
const PaDeviceInfo *deviceInfo = Pa_GetDeviceInfo(i);
if (( is_capture && deviceInfo->maxInputChannels > 1)
|| ( (!is_capture) && deviceInfo->maxOutputChannels > 1))
{
string api="";
if (nApis>1)
{
const PaHostApiInfo* info = Pa_GetHostApiInfo(deviceInfo->hostApi);
if (info)
api = string(info->name)+":";
}
names.push_back(api+deviceInfo->name);
devices.push_back(i);
}
}
choices = names;
}
开发者ID:castrouk,项目名称:LinDrm,代码行数:34,代码来源:drm_portaudio.cpp
示例6: audioBase
audioSink::audioSink (int16_t latency,
QComboBox *s,
RingBuffer<int16_t> *b): audioBase (b) {
int32_t i;
this -> latency = latency;
this -> streamSelector = s;
this -> CardRate = 48000;
this -> latency = latency;
_O_Buffer = new RingBuffer<float>(2 * 32768);
portAudio = false;
writerRunning = false;
if (Pa_Initialize () != paNoError) {
fprintf (stderr, "Initializing Pa for output failed\n");
return;
}
portAudio = true;
qDebug ("Hostapis: %d\n", Pa_GetHostApiCount ());
for (i = 0; i < Pa_GetHostApiCount (); i ++)
qDebug ("Api %d is %s\n", i, Pa_GetHostApiInfo (i) -> name);
numofDevices = Pa_GetDeviceCount ();
outTable = new int16_t [numofDevices + 1];
for (i = 0; i < numofDevices; i ++)
outTable [i] = -1;
ostream = NULL;
setupChannels (streamSelector);
connect (streamSelector, SIGNAL (activated (int)),
this, SLOT (set_streamSelector (int)));
streamSelector -> show ();
selectDefaultDevice ();
}
开发者ID:JvanKatwijk,项目名称:wfm-rpi,代码行数:35,代码来源:audiosink.cpp
示例7: list_devices
void list_devices(void) {
PaError err;
int i;
if ((err = Pa_Initialize()) != paNoError) {
LOG_WARN("error initialising port audio: %s", Pa_GetErrorText(err));
return;
}
printf("Output devices:\n");
#ifndef PA18API
for (i = 0; i < Pa_GetDeviceCount(); ++i) {
if (Pa_GetDeviceInfo(i)->maxOutputChannels) {
printf(" %i - %s [%s]\n", i, Pa_GetDeviceInfo(i)->name, Pa_GetHostApiInfo(Pa_GetDeviceInfo(i)->hostApi)->name);
}
#else
for (i = 0; i < Pa_CountDevices(); ++i) {
printf(" %i - %s\n", i, Pa_GetDeviceInfo(i)->name);
#endif
}
printf("\n");
if ((err = Pa_Terminate()) != paNoError) {
LOG_WARN("error closing port audio: %s", Pa_GetErrorText(err));
}
}
void set_volume(unsigned left, unsigned right) {
LOG_DEBUG("setting internal gain left: %u right: %u", left, right);
LOCK;
output.gainL = left;
output.gainR = right;
UNLOCK;
}
开发者ID:astephanh,项目名称:squeezelite,代码行数:34,代码来源:output_pa.c
示例8: Java_org_jpab_PortAudio_getHostAPIsDevicesAsBuffer
JNIEXPORT jobject JNICALL Java_org_jpab_PortAudio_getHostAPIsDevicesAsBuffer(JNIEnv *env, jclass paClass, jint host_api_index) {
Device * device;
const PaDeviceInfo * device_info;
const UINT8 count = Pa_GetHostApiInfo((PaHostApiIndex) host_api_index)->deviceCount;
UINT16 index, size = DEVICE_SIZE * count, offset = 0, temp;
char * buffer = (char *)malloc(size);
for (index = 0; index < count; index ++) {
device_info = Pa_GetDeviceInfo(index);
device = (Device *) (buffer + offset);
device->default_high_input_latency = device_info->defaultHighInputLatency;
device->default_high_output_latency = device_info->defaultHighOutputLatency;
device->default_low_input_latency = device_info->defaultLowInputLatency;
device->default_low_output_latency = device_info->defaultLowOutputLatency;
device->default_sample_rate = device_info->defaultSampleRate;
device->index = index;
device->host_api = host_api_index;
device->max_input_channels = device_info->maxInputChannels;
device->max_output_channels = device_info->maxOutputChannels;
temp = strlen(device_info->name);
device->name_length = temp;
size += temp;
buffer = (char *) realloc(buffer, size);
offset += DEVICE_SIZE;
memcpy(buffer + offset, device_info->name, temp);
offset += temp;
}
return env->NewDirectByteBuffer(buffer, (jint) size);
}
开发者ID:jenia,项目名称:milestone4,代码行数:28,代码来源:PortAudioJNI.cpp
示例9: Java_org_jpab_PortAudio_getHostAPIsAsBuffer
JNIEXPORT jobject JNICALL Java_org_jpab_PortAudio_getHostAPIsAsBuffer(JNIEnv *env, jclass paClass) {
HostAPI * host_api;
const PaHostApiInfo * host_api_info;
const UINT8 count = Pa_GetHostApiCount();
UINT16 index, size = HOST_API_SIZE * count, offset = 0, temp;
char * buffer = (char *)malloc(size);
for (index = 0; index < count; index ++) {
host_api_info = Pa_GetHostApiInfo(index);
host_api = (HostAPI *) (buffer + offset);
host_api->default_input_device = host_api_info->defaultInputDevice == -1 ? -1 : Pa_HostApiDeviceIndexToDeviceIndex(index, host_api_info->defaultInputDevice);
host_api->default_output_device = host_api_info->defaultOutputDevice == -1 ? -1 : Pa_HostApiDeviceIndexToDeviceIndex(index, host_api_info->defaultOutputDevice);
if (host_api->default_input_device < -1) host_api->default_input_device = -1;
if (host_api->default_output_device < -1) host_api->default_output_device = -1;
host_api->device_count = host_api_info->deviceCount;
host_api->type = host_api_info->type;
host_api->index = index;
temp = strlen(host_api_info->name);
host_api->name_length = temp;
size += temp;
buffer = (char *) realloc(buffer, size);
offset += HOST_API_SIZE;
memcpy(buffer + offset, host_api_info->name, temp);
offset += temp;
}
return env->NewDirectByteBuffer(buffer, (jint) size);
}
开发者ID:jenia,项目名称:milestone4,代码行数:26,代码来源:PortAudioJNI.cpp
示例10: get_device_list
// Get device list
// If first argument is NULL, return the maximum number of devices
int
get_device_list(int *devidlist, char **namelist, int maxstrlen, int maxnum)
{
PaDeviceIndex numDevice = Pa_GetDeviceCount(), i;
const PaDeviceInfo *deviceInfo;
const PaHostApiInfo *apiInfo;
static char buf[256];
int n;
n = 0;
for(i=0;i<numDevice;i++) {
deviceInfo = Pa_GetDeviceInfo(i);
if (!deviceInfo) continue;
if (deviceInfo->maxInputChannels <= 0) continue;
apiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
if (!apiInfo) continue;
if (devidlist != NULL) {
if ( n >= maxnum ) break;
snprintf(buf, 255, "%s: %s", apiInfo->name, deviceInfo->name);
buf[255] = '\0';
devidlist[n] = i;
strncpy(namelist[n], buf, maxstrlen);
}
n++;
}
return n;
}
开发者ID:0K7mGXj9thSA,项目名称:testrepositoryforjulius,代码行数:30,代码来源:adin_portaudio.c
示例11: fprintf
/*
* The class is the sink for the data generated.
* It will send the data to the soundcard
*/
paWriter::paWriter (int32_t cardRate,
uint8_t Latency) {
int32_t i;
CardRate = cardRate;
this -> Latency = Latency;
this -> Latency = LOWLATENCY;
_O_Buffer = new RingBuffer<float>(4 * 16384);
portAudio = false;
writerRunning = false;
if (Pa_Initialize () != paNoError) {
fprintf (stderr, "Initializing Pa for output failed\n");
return;
}
portAudio = true;
qDebug ("Hostapis: %d\n", Pa_GetHostApiCount ());
for (i = 0; i < Pa_GetHostApiCount (); i ++)
qDebug ("Api %d is %s\n", i, Pa_GetHostApiInfo (i) -> name);
numofDevices = Pa_GetDeviceCount ();
ostream = NULL;
}
开发者ID:JvanKatwijk,项目名称:sdr-j-sw,代码行数:29,代码来源:pa-writer.cpp
示例12: Pa_GetDeviceInfo
const char* PA_AudioIO::getApi(){
PaDeviceIndex DevInd = m_PaParams.device;
const PaDeviceInfo* DevInf = Pa_GetDeviceInfo(DevInd);
PaHostApiIndex ApiInd = DevInf->hostApi;
const PaHostApiInfo* ApiInf = Pa_GetHostApiInfo(ApiInd);
return ApiInf->name;
}
开发者ID:andrewreeman,项目名称:Simple-soundfile-player,代码行数:7,代码来源:AudioIO.cpp
示例13: paqaVerifySuggestedLatency
static int paqaVerifySuggestedLatency( void )
{
PaDeviceIndex id;
int result = 0;
const PaDeviceInfo *pdi;
int numDevices = Pa_GetDeviceCount();
printf("\n ------------------------ paqaVerifySuggestedLatency\n");
for( id=0; id<numDevices; id++ ) /* Iterate through all devices. */
{
pdi = Pa_GetDeviceInfo( id );
printf("\nUsing device #%d: '%s' (%s)\n", id, pdi->name, Pa_GetHostApiInfo(pdi->hostApi)->name);
if( pdi->maxOutputChannels > 0 )
{
if( paqaCheckMultipleSuggested( id, 0 ) < 0 )
{
printf("OUTPUT CHECK FAILED !!! #%d: '%s'\n", id, pdi->name);
result -= 1;
}
}
if( pdi->maxInputChannels > 0 )
{
if( paqaCheckMultipleSuggested( id, 1 ) < 0 )
{
printf("INPUT CHECK FAILED !!! #%d: '%s'\n", id, pdi->name);
result -= 1;
}
}
}
return result;
}
开发者ID:Excalibur201010,项目名称:sharpsdr,代码行数:31,代码来源:paqa_latency.c
示例14: Pa_GetHostApiInfo
static const PaDeviceInfo *findDeviceInfo(PaHostApiIndex hostAPI, const char *name,
PaDeviceIndex *index)
{
const PaHostApiInfo *hostAPIInfo = Pa_GetHostApiInfo(hostAPI);
if (!hostAPIInfo) {
return NULL;
}
const PaDeviceInfo *deviceInfo;
PaDeviceIndex deviceIndex;
int i;
for (i = 0; i < hostAPIInfo->deviceCount; i++) {
deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(hostAPI, i);
if (deviceIndex < 0) {
continue;
}
deviceInfo = Pa_GetDeviceInfo(deviceIndex);
if (deviceInfo && strcmp(name, deviceInfo->name) == 0) {
break;
}
}
if (i >= hostAPIInfo->deviceCount) {
deviceIndex = hostAPIInfo->defaultInputDevice;
deviceInfo = Pa_GetDeviceInfo(deviceIndex);
}
if (index) {
*index = deviceIndex;
}
return deviceInfo;
}
开发者ID:akinsgre,项目名称:wahjam,代码行数:32,代码来源:audiostream_pa.cpp
示例15: GetDefaultInputDevice
/*
* Try to intelligently fetch a default audio input device
*/
static PaDeviceIndex
GetDefaultInputDevice()
{
int i, n;
PaDeviceIndex def;
const PaDeviceInfo *deviceInfo;
n = Pa_GetDeviceCount();
if (n < 0) {
return paNoDevice;
}
/* Try default input */
if ((def = Pa_GetDefaultInputDevice()) != paNoDevice) {
return def;
}
/* No luck, iterate and check for API specific input device */
for (i = 0; i < n; i++) {
deviceInfo = Pa_GetDeviceInfo(i);
if (i == Pa_GetHostApiInfo(deviceInfo->hostApi)->defaultInputDevice) {
return i;
}
}
/* No device :( */
return paNoDevice;
}
开发者ID:1981khj,项目名称:rainbow,代码行数:30,代码来源:AudioSourceMac.cpp
示例16: Pa_Initialize
void AudioPortAudioSetupUtil::updateDevices()
{
PaError err = Pa_Initialize();
if( err != paNoError ) {
printf( "Couldn't initialize PortAudio: %s\n", Pa_GetErrorText( err ) );
return;
}
// get active backend
const QString& backend = m_backendModel.currentText();
int hostApi = 0;
const PaHostApiInfo * hi;
for( int i = 0; i < Pa_GetHostApiCount(); ++i )
{
hi = Pa_GetHostApiInfo( i );
if( backend == hi->name )
{
hostApi = i;
break;
}
}
// get devices for selected backend
m_deviceModel.clear();
const PaDeviceInfo * di;
for( int i = 0; i < Pa_GetDeviceCount(); ++i )
{
di = Pa_GetDeviceInfo( i );
if( di->hostApi == hostApi )
{
m_deviceModel.addItem( di->name );
}
}
Pa_Terminate();
}
开发者ID:BaraMGB,项目名称:lmms,代码行数:35,代码来源:AudioPortAudio.cpp
示例17: GetAudioInfo
void GetAudioInfo()
{
PaHostApiIndex ApiCount = Pa_GetHostApiCount();
Log::Logf("AUDIO: The default API is %d\n", Pa_GetDefaultHostApi());
for (PaHostApiIndex i = 0; i < ApiCount; i++)
{
const PaHostApiInfo* Index = Pa_GetHostApiInfo(i);
Log::Logf("(%d) %s: %d (%d)\n", i, Index->name, Index->defaultOutputDevice, Index->type);
#ifdef WIN32
if (Index->type == paWASAPI)
DefaultWasapiDevice = Index->defaultOutputDevice;
else if (Index->type == paDirectSound)
DefaultDSDevice = Index->defaultOutputDevice;
#endif
}
Log::Logf("\nAUDIO: The audio devices are\n");
PaDeviceIndex DevCount = Pa_GetDeviceCount();
for (PaDeviceIndex i = 0; i < DevCount; i++)
{
const PaDeviceInfo *Info = Pa_GetDeviceInfo(i);
Log::Logf("(%d): %s\n", i, Info->name);
Log::Logf("\thighLat: %f, lowLat: %f\n", Info->defaultHighOutputLatency, Info->defaultLowOutputLatency);
Log::Logf("\tsampleRate: %f, hostApi: %d\n", Info->defaultSampleRate, Info->hostApi);
Log::Logf("\tmaxchannels: %d\n", Info->maxOutputChannels);
}
}
开发者ID:Sp3ct3r2k11,项目名称:raindrop,代码行数:31,代码来源:Audio.cpp
示例18: Pa_GetHostApiInfo
void PortAudioSettingsPage::autoselectDevice()
{
int index = hostAPIList->currentIndex();
if (index < 0) {
return;
}
PaHostApiIndex apiIndex = hostAPIList->itemData(index).toInt(NULL);
const PaHostApiInfo *hostAPIInfo = Pa_GetHostApiInfo(apiIndex);
if (!hostAPIInfo) {
return;
}
int i;
for (i = 0; i < inputDeviceList->count(); i++) {
if (hostAPIInfo->defaultInputDevice ==
inputDeviceList->itemData(i).toInt(NULL)) {
inputDeviceList->setCurrentIndex(i);
break;
}
}
for (i = 0; i < outputDeviceList->count(); i++) {
if (hostAPIInfo->defaultOutputDevice ==
outputDeviceList->itemData(i).toInt(NULL)) {
outputDeviceList->setCurrentIndex(i);
break;
}
}
}
开发者ID:anthonypdawson,项目名称:wahjam,代码行数:29,代码来源:PortAudioSettingsPage.cpp
示例19: pa_hostapiinfo
static int pa_hostapiinfo(lua_State *L)
{
int narg = lua_gettop(L);
PaHostApiIndex apiidx = 0;
const PaHostApiInfo *info;
if(narg == 1 && lua_isnumber(L, 1))
apiidx = (PaHostApiIndex)lua_tonumber(L, 1)-1;
else
luaL_error(L, "expected arguments: number");
info = Pa_GetHostApiInfo(apiidx);
if(info)
{
lua_newtable(L);
lua_pushstring(L, info->name);
lua_setfield(L, -2, "name");
lua_pushnumber(L, info->deviceCount);
lua_setfield(L, -2, "devicecount");
lua_pushnumber(L, info->defaultInputDevice+1);
lua_setfield(L, -2, "defaultinputdevice");
lua_pushnumber(L, info->defaultOutputDevice+1);
lua_setfield(L, -2, "defaultoutputdevice");
return 1;
}
return 0;
}
开发者ID:andresy,项目名称:lua---pa,代码行数:28,代码来源:init.c
示例20: getHostApis
std::vector<ApiInfo> getHostApis(){
// Returns information about available host apis. Currently uses portaudio.
if( Pa_Initialize() != paNoError ) throw std::runtime_error("Portaudio could not be initialized during 'getHostApis'.");
PaHostApiIndex apiCount = Pa_GetHostApiCount();
PaDeviceIndex devCount = 0;
PaDeviceIndex devNum = 0;
std::vector<DevInfo> devInf;
const PaHostApiInfo* p_ApiInf;
const PaDeviceInfo* p_DevInf;
std::vector<ApiInfo> vApiInf(apiCount);
for(int api=0; api<apiCount; ++api){
p_ApiInf = Pa_GetHostApiInfo(api);
vApiInf[api].apiName = p_ApiInf->name;
devCount = p_ApiInf->deviceCount;
devInf.resize(devCount);
for(int dev=0; dev<devCount; ++dev){
devNum = Pa_HostApiDeviceIndexToDeviceIndex(api, dev);
p_DevInf = Pa_GetDeviceInfo(devNum);
devInf[dev].devName = p_DevInf->name;
devInf[dev].numInputs = p_DevInf->maxInputChannels;
devInf[dev].numOutputs= p_DevInf->maxOutputChannels;
vApiInf[api].devices = devInf;
}
}
if( Pa_Terminate() != paNoError ) throw std::runtime_error("Error terminating portaudio during 'getHostApis'.");
return vApiInf;
}
开发者ID:andrewreeman,项目名称:Simple-soundfile-player,代码行数:29,代码来源:AudioIO.cpp
注:本文中的Pa_GetHostApiInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论