您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AudioHardwareGetProperty函数代码示例

51自学网 2021-06-01 19:48:21
  C++
这篇教程C++ AudioHardwareGetProperty函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中AudioHardwareGetProperty函数的典型用法代码示例。如果您正苦于以下问题:C++ AudioHardwareGetProperty函数的具体用法?C++ AudioHardwareGetProperty怎么用?C++ AudioHardwareGetProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AudioHardwareGetProperty函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: get_default_device

static OSStatus get_default_device(AudioDeviceID * id){    OSStatus res;    UInt32 theSize = sizeof(UInt32);	AudioDeviceID inDefault;	AudioDeviceID outDefault;  	if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, 					&theSize, &inDefault)) != noErr)		return res;		if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, 					&theSize, &outDefault)) != noErr)		return res;			JCALog("get_default_device: input %ld output %ld/n", inDefault, outDefault);		// Get the device only if default input and ouput are the same	if (inDefault == outDefault) {		*id = inDefault;		return noErr;	} else {		jack_error("Default input and output devices are not the same !!");		return kAudioHardwareBadDeviceError;	}}
开发者ID:Llefjord,项目名称:jack1,代码行数:26,


示例2: sizeof

void	SHP_PlugIn::Teardown(){	//  first figure out if this is being done as part of the process being torn down	UInt32 isInitingOrExiting = 0;	UInt32 theSize = sizeof(UInt32);	AudioHardwareGetProperty(kAudioHardwarePropertyIsInitingOrExiting, &theSize, &isInitingOrExiting);	//  next figure out if this is the master process	UInt32 isMaster = 0;	theSize = sizeof(UInt32);	AudioHardwareGetProperty(kAudioHardwarePropertyProcessIsMaster, &theSize, &isMaster);	//  do the full teardown if this is outside of the process being torn down or this is the master process	if((isInitingOrExiting == 0) || (isMaster != 0))	{		//	stop all IO on the device		mDevice->Do_StopAllIOProcs();				//	send the necessary IsAlive notifications		CAPropertyAddress theIsAliveAddress(kAudioDevicePropertyDeviceIsAlive);		mDevice->PropertiesChanged(1, &theIsAliveAddress);				//	save it's settings if necessary		if(isMaster != 0)		{			HP_DeviceSettings::SaveToPrefs(*mDevice, HP_DeviceSettings::sStandardControlsToSave, HP_DeviceSettings::kStandardNumberControlsToSave);		}		//	tell the HAL that the device has gone away		AudioObjectID theObjectID = mDevice->GetObjectID();#if	(MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)		OSStatus theError = AudioHardwareDevicesDied(GetInterface(), 1, &theObjectID);#else		OSStatus theError = AudioObjectsPublishedAndDied(GetInterface(), kAudioObjectSystemObject, 0, NULL, 1, &theObjectID);#endif		AssertNoError(theError, "SHP_PlugIn::Teardown: got an error telling the HAL a device died");				//	remove the object state mutex		HP_Object::SetObjectStateMutexForID(theObjectID, NULL);		//  toss it		mDevice->Teardown();		delete mDevice;		mDevice = NULL;		//	teardown the super class		HP_HardwarePlugIn::Teardown();	}	else	{		//  otherwise, only stop the IOProcs		mDevice->Do_StopAllIOProcs();				//	finalize (rather than tear down) the devices		mDevice->Finalize();				//	and leave the rest to die with the process	}}
开发者ID:fruitsamples,项目名称:HAL,代码行数:59,


示例3: InitializeDeviceInfos

static PaError InitializeDeviceInfos( PaMacCoreHostApiRepresentation *macCoreHostApi, PaHostApiIndex hostApiIndex ){    PaError result = paNoError;    PaUtilHostApiRepresentation *hostApi;    PaMacCoreDeviceInfo *deviceInfoArray;    // initialise device counts and default devices under the assumption that there are no devices. These values are incremented below if and when devices are successfully initialized.    hostApi = &macCoreHostApi->inheritedHostApiRep;    hostApi->info.deviceCount = 0;    hostApi->info.defaultInputDevice = paNoDevice;    hostApi->info.defaultOutputDevice = paNoDevice;        UInt32 propsize;    AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propsize, NULL);    int numDevices = propsize / sizeof(AudioDeviceID);    hostApi->info.deviceCount = numDevices;    if (numDevices > 0) {        hostApi->deviceInfos = (PaDeviceInfo**)PaUtil_GroupAllocateMemory(                                            macCoreHostApi->allocations, sizeof(PaDeviceInfo*) * numDevices );        if( !hostApi->deviceInfos )        {            return paInsufficientMemory;        }        // allocate all device info structs in a contiguous block        deviceInfoArray = (PaMacCoreDeviceInfo*)PaUtil_GroupAllocateMemory(                                macCoreHostApi->allocations, sizeof(PaMacCoreDeviceInfo) * numDevices );        if( !deviceInfoArray )        {            return paInsufficientMemory;        }                macCoreHostApi->macCoreDeviceIds = PaUtil_GroupAllocateMemory(macCoreHostApi->allocations, propsize);        AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propsize, macCoreHostApi->macCoreDeviceIds);        AudioDeviceID defaultInputDevice, defaultOutputDevice;        propsize = sizeof(AudioDeviceID);        AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propsize, &defaultInputDevice);        AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propsize, &defaultOutputDevice);                UInt32 i;        for (i = 0; i < numDevices; ++i) {            if (macCoreHostApi->macCoreDeviceIds[i] == defaultInputDevice) {                hostApi->info.defaultInputDevice = i;            }            if (macCoreHostApi->macCoreDeviceIds[i] == defaultOutputDevice) {                hostApi->info.defaultOutputDevice = i;            }            InitializeDeviceInfo(&deviceInfoArray[i], macCoreHostApi->macCoreDeviceIds[i], hostApiIndex);            hostApi->deviceInfos[i] = &(deviceInfoArray[i].inheritedDeviceInfo);              }    }    return result;}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:55,


示例4: scanDevices

static bool scanDevices(unsigned index){    OSStatus err = noErr;    UInt32 size;    AudioDeviceID *id;    unsigned i;    if(!devlist) {        if(AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, NULL) != noErr)            return false;        devcount = size / sizeof(AudioDeviceID);        devlist = (AudioDeviceID *)malloc(size);        if(AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, (void *) devlist) != noErr) {            free(devlist);            return false;        }        size = sizeof(AudioDeviceID);        if(AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size, &id) == noErr) {            for(i = 0; i < devcount; ++i)            {                if(!memcmp(&devlist[i], &id, sizeof(AudioDeviceID))) {                    devinput = &devlist[i];                    break;                }            }        }        size = sizeof(AudioDeviceID);        if(AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &id) == noErr) {            for(i = 0; i < devcount; ++i)            {                if(!memcmp(&devlist[i], &id, sizeof(AudioDeviceID))) {                    devoutput = &devlist[i];                    break;                }            }        }    }    if(!devcount)        return false;    if(index > devcount)        return false;    return true;}
开发者ID:dyfet,项目名称:ccaudio2,代码行数:49,


示例5: GetDefaultOutputDevice

AudioDeviceID CCoreAudioHardware::FindAudioDevice(const std::string &searchName){  AudioDeviceID deviceId = 0;  if (!searchName.length())    return deviceId;  std::string searchNameLowerCase = searchName;  std::transform(searchNameLowerCase.begin(), searchNameLowerCase.end(), searchNameLowerCase.begin(), ::tolower );  if (searchNameLowerCase.compare("default") == 0)  {    AudioDeviceID defaultDevice = GetDefaultOutputDevice();    CLog::Log(LOGDEBUG, "CCoreAudioHardware::FindAudioDevice: "      "Returning default device [0x%04x].", (uint)defaultDevice);    return defaultDevice;  }  CLog::Log(LOGDEBUG, "CCoreAudioHardware::FindAudioDevice: "    "Searching for device - %s.", searchName.c_str());  // Obtain a list of all available audio devices  UInt32 size = 0;  AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, NULL);  size_t deviceCount = size / sizeof(AudioDeviceID);  AudioDeviceID* pDevices = new AudioDeviceID[deviceCount];  OSStatus ret = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, pDevices);  if (ret)  {    CLog::Log(LOGERROR, "CCoreAudioHardware::FindAudioDevice: "      "Unable to retrieve the list of available devices. Error = %s", GetError(ret).c_str());    delete[] pDevices;    return 0;  }  // Attempt to locate the requested device  std::string deviceName;  for (size_t dev = 0; dev < deviceCount; dev++)  {    CCoreAudioDevice device;    device.Open((pDevices[dev]));    deviceName = device.GetName();    UInt32 totalChannels = device.GetTotalOutputChannels();    CLog::Log(LOGDEBUG, "CCoreAudioHardware::FindAudioDevice: "#if __LP64__      "Device[0x%04x]"#else      "Device[0x%04lx]"#endif      " - Name: '%s', Total Ouput Channels: %u. ",      pDevices[dev], deviceName.c_str(), (uint)totalChannels);    std::transform( deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower );    if (searchNameLowerCase.compare(deviceName) == 0)      deviceId = pDevices[dev];    if (deviceId)      break;  }  delete[] pDevices;  return deviceId;}
开发者ID:Foozle303,项目名称:xbmc,代码行数:60,


示例6: showAllDevices

void showAllDevices(ASDeviceType typeRequested) {	UInt32 propertySize;	AudioDeviceID dev_array[64];	int numberOfDevices = 0;	ASDeviceType device_type;	char deviceName[256];		AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propertySize, NULL);		AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propertySize, dev_array);	numberOfDevices = (propertySize / sizeof(AudioDeviceID));		for(int i = 0; i < numberOfDevices; ++i) {		device_type = getDeviceType(dev_array[i]);		switch(typeRequested) {			case kAudioTypeInput:			case kAudioTypeOutput:				if (device_type != typeRequested) continue;				break;			case kAudioTypeSystemOutput:				if (device_type != kAudioTypeOutput) continue;				break;		}				getDeviceName(dev_array[i], deviceName);		printf("%s (%s)/n",deviceName,deviceTypeName(device_type));	}}
开发者ID:razum2um,项目名称:switchaudio-osx,代码行数:28,


示例7: getRequestedDeviceID

AudioDeviceID getRequestedDeviceID(char * requestedDeviceName, ASDeviceType typeRequested) {	UInt32 propertySize;	AudioDeviceID dev_array[64];	int numberOfDevices = 0;	char deviceName[256];		AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propertySize, NULL);	// printf("propertySize=%d/n",propertySize);		AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propertySize, dev_array);	numberOfDevices = (propertySize / sizeof(AudioDeviceID));	// printf("numberOfDevices=%d/n",numberOfDevices);		for(int i = 0; i < numberOfDevices; ++i) {		switch(typeRequested) {			case kAudioTypeInput:			case kAudioTypeOutput:				if (getDeviceType(dev_array[i]) != typeRequested) continue;				break;			case kAudioTypeSystemOutput:				if (getDeviceType(dev_array[i]) != kAudioTypeOutput) continue;				break;		}				getDeviceName(dev_array[i], deviceName);		// printf("For device %d, id = %d and name is %s/n",i,dev_array[i],deviceName);		if (strcmp(requestedDeviceName, deviceName) == 0) {			return dev_array[i];		}	}		return kAudioDeviceUnknown;}
开发者ID:razum2um,项目名称:switchaudio-osx,代码行数:33,


示例8: audio_cap_ca_help

static void audio_cap_ca_help(const char *driver_name){        UNUSED(driver_name);        OSErr ret;        AudioDeviceID *dev_ids;        int dev_items;        int i;        UInt32 size;        printf("/tcoreaudio : default CoreAudio input/n");        ret = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, NULL);        if(ret) goto error;        dev_ids = malloc(size);        dev_items = size / sizeof(AudioDeviceID);        ret = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, dev_ids);        if(ret) goto error;        for(i = 0; i < dev_items; ++i)        {                char name[128];                                size = sizeof(name);                ret = AudioDeviceGetProperty(dev_ids[i], 0, 0, kAudioDevicePropertyDeviceName, &size, name);                fprintf(stderr,"/tcoreaudio:%d : %s/n", (int) dev_ids[i], name);        }        free(dev_ids);        return;error:        fprintf(stderr, "[CoreAudio] error obtaining device list./n");}
开发者ID:k4rtik,项目名称:ultragrid,代码行数:32,


示例9: AUDIO_Init_Driver

// ------------------------------------------------------// Name: AUDIO_Init_Driver()// Desc: Init the audio driverint AUDIO_Init_Driver(void (*Mixer)(Uint8 *, Uint32)){    AUDIO_Mixer = Mixer;    AUDIO_Device = kAudioDeviceUnknown;    Amount = sizeof(AudioDeviceID);    if(AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,                                &Amount,                                (void *) &AUDIO_Device) == noErr)    {        if(AudioDeviceAddIOProc(AUDIO_Device,                                AUDIO_Callback,                                NULL) == noErr)        {            return(AUDIO_Create_Sound_Buffer(AUDIO_Milliseconds));        }#if !defined(__STAND_ALONE__) && !defined(__WINAMP__)        else        {            Message_Error("Error while calling AudioDeviceAddIOProc()");        }#endif    }#if !defined(__STAND_ALONE__) && !defined(__WINAMP__)    else    {        Message_Error("Error while calling AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice)");    }#endif    return(FALSE);}
开发者ID:Phil974m,项目名称:protrekkr,代码行数:38,


示例10: gst_osx_audio_src_select_device

static voidgst_osx_audio_src_select_device (GstOsxAudioSrc * osxsrc){  OSStatus status;  UInt32 propertySize;  if (osxsrc->device_id == kAudioDeviceUnknown) {    /* If no specific device has been selected by the user, then pick the     * default device */    GST_DEBUG_OBJECT (osxsrc, "Selecting device for OSXAudioSrc");    propertySize = sizeof (osxsrc->device_id);    status = AudioHardwareGetProperty (kAudioHardwarePropertyDefaultInputDevice,        &propertySize, &osxsrc->device_id);    if (status) {      GST_WARNING_OBJECT (osxsrc,          "AudioHardwareGetProperty returned %d", (int) status);    } else {      GST_DEBUG_OBJECT (osxsrc, "AudioHardwareGetProperty returned 0");    }    if (osxsrc->device_id == kAudioDeviceUnknown) {      GST_WARNING_OBJECT (osxsrc,          "AudioHardwareGetProperty: device_id is kAudioDeviceUnknown");    }    GST_DEBUG_OBJECT (osxsrc, "AudioHardwareGetProperty: device_id is %lu",        (long) osxsrc->device_id);  }}
开发者ID:eta-im-dev,项目名称:media,代码行数:30,


示例11: AudioHardwareGetPropertyInfo

const std::vector<InputDeviceRef>& InputImplAudioUnit::getDevices( bool forceRefresh ){	if( forceRefresh || ! sDevicesEnumerated ) {		sDevices.clear();				UInt32 propSize;		AudioHardwareGetPropertyInfo( kAudioHardwarePropertyDevices, &propSize, NULL );		uint32_t deviceCount = ( propSize / sizeof(AudioDeviceID) );		AudioDeviceID deviceIds[deviceCount];		AudioHardwareGetProperty( kAudioHardwarePropertyDevices, &propSize, &deviceIds );				for( uint32_t i = 0; i < deviceCount; i++ ) {			try {				InputDeviceRef aDevice = InputDeviceRef( new Device( deviceIds[i] ) );				sDevices.push_back( aDevice );			} catch( InvalidDeviceInputExc ) {				continue;			}		}				sDevicesEnumerated = true;	}		return sDevices;}
开发者ID:AaronMeyers,项目名称:Cinder,代码行数:25,


示例12: sizeof

OSStatus CAPlayThrough::SetInputDeviceAsCurrent(AudioDeviceID in){    UInt32 size = sizeof(AudioDeviceID);    OSStatus err = noErr;		if(in == kAudioDeviceUnknown) //get the default input device if device is unknown	{  		err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,									   &size,  									   &in);		checkErr(err);	}		mInputDevice.Init(in, true);		//Set the Current Device to the AUHAL.	//this should be done only after IO has been enabled on the AUHAL.    err = AudioUnitSetProperty(mInputUnit,							  kAudioOutputUnitProperty_CurrentDevice, 							  kAudioUnitScope_Global, 							  0, 							  &mInputDevice.mID, 							  sizeof(mInputDevice.mID));	checkErr(err);	return err;}
开发者ID:aranm,项目名称:CAPlayThrough,代码行数:26,


示例13: AudioHardwareGetPropertyInfo

UInt32 CCoreAudioHardware::GetOutputDevices(CoreAudioDeviceList* pList){  if (!pList)    return 0;    // Obtain a list of all available audio devices  UInt32 found = 0;  UInt32 size = 0;  AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, NULL);  UInt32 deviceCount = size / sizeof(AudioDeviceID);  AudioDeviceID* pDevices = new AudioDeviceID[deviceCount];  OSStatus ret = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, pDevices);  if (ret)    CLog::Log(LOGERROR, "CCoreAudioHardware::GetOutputDevices: Unable to retrieve the list of available devices. Error = 0x%08x (%4.4s)", ret, CONVERT_OSSTATUS(ret));  else  {    for (UInt32 dev = 0; dev < deviceCount; dev++)    {      if (CCoreAudioDevice::GetTotalOutputChannels(pDevices[dev]) == 0)        continue;      found++;      pList->push_back(pDevices[dev]);    }  }  delete[] pDevices;  return found;}
开发者ID:flyingtime,项目名称:boxee,代码行数:27,


示例14: deviceIDsArraySize

QList<AudioDeviceID> UBAudioQueueRecorder::inputDeviceIDs(){    QList<AudioDeviceID> inputDeviceIDs;    UInt32 deviceIDsArraySize(0);    AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &deviceIDsArraySize, 0);    AudioDeviceID deviceIDs[deviceIDsArraySize / sizeof(AudioDeviceID)];    AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &deviceIDsArraySize, deviceIDs);    int deviceIDsCount = deviceIDsArraySize / sizeof(AudioDeviceID);    for (int i = 0; i < deviceIDsCount; i ++)    {        AudioStreamBasicDescription sf;        UInt32 size = sizeof(AudioStreamBasicDescription);        if (noErr == AudioDeviceGetProperty(deviceIDs[i], 0, true, kAudioDevicePropertyStreamFormat,  &size, &sf))        {                inputDeviceIDs << deviceIDs[i];        }    }    /*    foreach(AudioDeviceID id, inputDeviceIDs)    {            qDebug() << "Device" << id <<  deviceNameFromDeviceID(id) << deviceUIDFromDeviceID(id);    }    */    return inputDeviceIDs;}
开发者ID:coachal,项目名称:Sankore-3.1,代码行数:33,


示例15: getDefaultDevice

static int getDefaultDevice(AudioDeviceID *id, int direction){  UInt32 sz= sizeof(*id);  return (!checkError(AudioHardwareGetProperty((direction						? kAudioHardwarePropertyDefaultInputDevice						: kAudioHardwarePropertyDefaultOutputDevice),					       &sz, (void *)id),		      "GetProperty", (direction ? "DefaultInput" : "DefaultOutput")));}
开发者ID:lsehub,项目名称:Handle,代码行数:9,


示例16: coreaudio_get_voice

static OSStatus coreaudio_get_voice(AudioDeviceID *id){    UInt32 size = sizeof(*id);    return AudioHardwareGetProperty(        kAudioHardwarePropertyDefaultOutputDevice,        &size,        id);}
开发者ID:MaddTheSane,项目名称:qemu,代码行数:9,


示例17: m_bIsRunning

CoreAudioDriver::CoreAudioDriver( audioProcessCallback processCallback )		: H2Core::AudioOutput( __class_name )		, m_bIsRunning( false )		, mProcessCallback( processCallback )		, m_pOut_L( NULL )		, m_pOut_R( NULL ){	//INFOLOG( "INIT" );	m_nSampleRate = Preferences::get_instance()->m_nSampleRate;	//  m_nBufferSize = Preferences::get_instance()->m_nBufferSize;	//  BufferSize is currently set to match the default audio device.	OSStatus err;	UInt32 size = sizeof( AudioDeviceID );	err = AudioHardwareGetProperty(			  kAudioHardwarePropertyDefaultOutputDevice,			  &size,			  &m_outputDevice		  );	if ( err != noErr ) {		ERRORLOG( "Could not get Default Output Device" );	}	UInt32 dataSize = sizeof( m_nBufferSize );	err = AudioDeviceGetProperty(			  m_outputDevice,			  0,			  false,			  kAudioDevicePropertyBufferFrameSize,			  &dataSize,			  ( void * )&m_nBufferSize		  );	if ( err != noErr ) {		ERRORLOG( "get BufferSize error" );	}	INFOLOG( QString( "Buffersize: %1" ).arg( m_nBufferSize ) );	// print some info	AudioStreamBasicDescription outputStreamBasicDescription;	UInt32 propertySize = sizeof( outputStreamBasicDescription );	err = AudioDeviceGetProperty( m_outputDevice, 0, 0, kAudioDevicePropertyStreamFormat, &propertySize, &outputStreamBasicDescription );	if ( err ) {		printf( "AudioDeviceGetProperty: returned %d when getting kAudioDevicePropertyStreamFormat", err );	}	INFOLOG( QString("SampleRate: %1").arg( outputStreamBasicDescription.mSampleRate ) );	INFOLOG( QString("BytesPerPacket: %1").arg( outputStreamBasicDescription.mBytesPerPacket ) );	INFOLOG( QString("FramesPerPacket: %1").arg( outputStreamBasicDescription.mFramesPerPacket ) );	INFOLOG( QString("BytesPerFrame: %1").arg( outputStreamBasicDescription.mBytesPerFrame ) );	INFOLOG( QString("ChannelsPerFrame: %1").arg( outputStreamBasicDescription.mChannelsPerFrame ) );	INFOLOG( QString("BitsPerChannel: %1").arg( outputStreamBasicDescription.mBitsPerChannel ) );}
开发者ID:Cesmith2,项目名称:hydrogen,代码行数:55,


示例18: sizeof

AudioDeviceID CCoreAudioHardware::GetDefaultOutputDevice(){  UInt32 size = sizeof(AudioDeviceID);  AudioDeviceID deviceId = 0;  OSStatus ret = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &deviceId);  if (ret || !deviceId) // outputDevice is set to 0 if there is no audio device available, or if the default device is set to an encoded format  {    CLog::Log(LOGERROR, "CCoreAudioHardware::GetDefaultOutputDevice: Unable to identify default output device. Error = 0x%08x (%4.4s).", ret, CONVERT_OSSTATUS(ret));    return 0;  }  return deviceId;}
开发者ID:vanegithub,项目名称:xbmc,代码行数:12,


示例19: getCurrentlySelectedDeviceID

AudioDeviceID getCurrentlySelectedDeviceID(ASDeviceType typeRequested) {	UInt32 propertySize;	AudioDeviceID deviceID = kAudioDeviceUnknown;		// get the default output device	propertySize = sizeof(deviceID);	switch(typeRequested) {		case kAudioTypeInput: 			AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propertySize, &deviceID);			break;		case kAudioTypeOutput:			AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propertySize, &deviceID);			break;		case kAudioTypeSystemOutput:			AudioHardwareGetProperty(kAudioHardwarePropertyDefaultSystemOutputDevice, &propertySize, &deviceID);			break;				}		return deviceID;}
开发者ID:razum2um,项目名称:switchaudio-osx,代码行数:21,


示例20: calloc

static au_instance_t *audiounits_create_recorder(SEXP source, float rate, int chs, int flags) {	UInt32 propsize=0;	OSStatus err;		au_instance_t *ap = (au_instance_t*) calloc(sizeof(au_instance_t), 1);	ap->source = source;	ap->sample_rate = rate;	ap->done = NO;	ap->position = 0;	ap->length = LENGTH(source);	ap->stereo = (chs == 2) ? YES : NO;		propsize = sizeof(ap->inDev);	err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propsize, &ap->inDev);	if (err) {		free(ap);		Rf_error("unable to find default audio input (%08x)", err);	}		propsize = sizeof(ap->fmtIn);	err = AudioDeviceGetProperty(ap->inDev, 0, YES, kAudioDevicePropertyStreamFormat, &propsize, &ap->fmtIn);	if (err) {		free(ap);		Rf_error("unable to retrieve audio input format (%08x)", err);	}		/* Rprintf(" recording format: %f, chs: %d, fpp: %d, bpp: %d, bpf: %d, flags: %x/n", ap->fmtIn.mSampleRate, ap->fmtIn.mChannelsPerFrame, ap->fmtIn.mFramesPerPacket, ap->fmtIn.mBytesPerPacket, ap->fmtIn.mBytesPerFrame, ap->fmtIn.mFormatFlags); */		ap->srFrac = 1.0;	if (ap->fmtIn.mSampleRate != ap->sample_rate) ap->srFrac = ap->sample_rate / ap->fmtIn.mSampleRate;	ap->srRun = 0.0;	#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED>=MAC_OS_X_VERSION_10_5)	err = AudioDeviceCreateIOProcID(ap->inDev, inputRenderProc, ap, &ap->inIOProcID );#else	err = AudioDeviceAddIOProc(ap->inDev, inputRenderProc, ap);#endif	if (err) {		free(ap);		Rf_error("unable to register recording callback (%08x)", err);	}	R_PreserveObject(ap->source);	Rf_setAttrib(ap->source, Rf_install("rate"), Rf_ScalarInteger(rate)); /* we adjust the rate */	Rf_setAttrib(ap->source, Rf_install("bits"), Rf_ScalarInteger(16)); /* we say it's 16 because we don't know - float is always 32-bit */	Rf_setAttrib(ap->source, Rf_install("class"), Rf_mkString("audioSample"));	if (ap->stereo) {		SEXP dim = Rf_allocVector(INTSXP, 2);		INTEGER(dim)[0] = 2;		INTEGER(dim)[1] = LENGTH(ap->source) / 2;		Rf_setAttrib(ap->source, R_DimSymbol, dim);	}	return ap;}
开发者ID:brezniczky,项目名称:audio,代码行数:53,


示例21: sizeof

InputDeviceRef InputImplAudioUnit::getDefaultDevice(){		AudioDeviceID aDeviceId;	UInt32 param = sizeof( AudioDeviceID );	OSStatus err = AudioHardwareGetProperty( kAudioHardwarePropertyDefaultInputDevice, &param, &aDeviceId );	if( err != noErr ) {		//TODO		std::cout << "Error getting default device" << std::endl;		throw;	}	return InputDeviceRef( new InputImplAudioUnit::Device( aDeviceId ) );}
开发者ID:AaronMeyers,项目名称:Cinder,代码行数:12,


示例22: sizeof

bool CCoreAudioHardware::GetAutoHogMode(){  UInt32 val = 0;  UInt32 size = sizeof(val);  OSStatus ret = AudioHardwareGetProperty(kAudioHardwarePropertyHogModeIsAllowed, &size, &val);  if (ret)  {    CLog::Log(LOGERROR, "CCoreAudioHardware::GetAutoHogMode: Unable to get auto 'hog' mode. Error = 0x%08x (%4.4s).", ret, CONVERT_OSSTATUS(ret));    return false;  }  return (val == 1);}
开发者ID:flyingtime,项目名称:boxee,代码行数:12,


示例23: get_device_id_from_uid

static OSStatus get_device_id_from_uid(char* UID, AudioDeviceID* id){	UInt32 size = sizeof(AudioValueTranslation);	CFStringRef inIUD = CFStringCreateWithCString(NULL, UID, CFStringGetSystemEncoding());	AudioValueTranslation value = { &inIUD, sizeof(CFStringRef), id, sizeof(AudioDeviceID) };	if (inIUD == NULL) {		return kAudioHardwareUnspecifiedError;	} else {		OSStatus res = AudioHardwareGetProperty(kAudioHardwarePropertyDeviceForUID, &size, &value);		CFRelease(inIUD);		return res;	}}
开发者ID:Llefjord,项目名称:jack1,代码行数:13,


示例24: get_default_output_device

static OSStatus get_default_output_device(AudioDeviceID* id){    OSStatus res;    UInt32 theSize = sizeof(UInt32);    AudioDeviceID outDefault;    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,                                        &theSize, &outDefault)) != noErr)        return res;    JCALog("get_default_output_device: output = %ld/n", outDefault);	*id = outDefault;	return noErr;}
开发者ID:Llefjord,项目名称:jack1,代码行数:14,


示例25: sizeof

AudioDeviceID UBAudioQueueRecorder::defaultInputDeviceID(){    AudioDeviceID deviceID;    UInt32 size = sizeof(deviceID);    if (noErr == AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size, &deviceID))    {        return deviceID;    }    else    {        return 0;    }}
开发者ID:coachal,项目名称:Sankore-3.1,代码行数:14,


示例26: sizeof

PlexAudioDevicePtr PlexAudioDevices::FindDefault(){  PlexAudioDevice* ret = 0;  AudioDeviceID    defaultDeviceID = 0;  UInt32           paramSize = 0;  OSStatus         err = noErr;  // Find the ID of the default Device.  paramSize = sizeof(AudioDeviceID);  SAFELY(AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &paramSize, &defaultDeviceID));  if (err == noErr)    ret = new PlexAudioDevice(defaultDeviceID);  return PlexAudioDevicePtr(ret);}
开发者ID:Castlecard,项目名称:plex,代码行数:15,



注:本文中的AudioHardwareGetProperty函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ AudioObjectGetPropertyDataSize函数代码示例
C++ AudioDeviceGetProperty函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。