这篇教程C++ AudioObjectGetPropertyDataSize函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AudioObjectGetPropertyDataSize函数的典型用法代码示例。如果您正苦于以下问题:C++ AudioObjectGetPropertyDataSize函数的具体用法?C++ AudioObjectGetPropertyDataSize怎么用?C++ AudioObjectGetPropertyDataSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AudioObjectGetPropertyDataSize函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AudioObjectGetPropertyDataSizeArray AudioDriverCoreAudio::_get_device_list(bool capture) { Array list; list.push_back("Default"); AudioObjectPropertyAddress prop; prop.mSelector = kAudioHardwarePropertyDevices; prop.mScope = kAudioObjectPropertyScopeGlobal; prop.mElement = kAudioObjectPropertyElementMaster; UInt32 size = 0; AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &size); AudioDeviceID *audioDevices = (AudioDeviceID *)malloc(size); AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &size, audioDevices); UInt32 deviceCount = size / sizeof(AudioDeviceID); for (UInt32 i = 0; i < deviceCount; i++) { prop.mScope = capture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; prop.mSelector = kAudioDevicePropertyStreamConfiguration; AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, NULL, &size); AudioBufferList *bufferList = (AudioBufferList *)malloc(size); AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, bufferList); UInt32 channelCount = 0; for (UInt32 j = 0; j < bufferList->mNumberBuffers; j++) channelCount += bufferList->mBuffers[j].mNumberChannels; free(bufferList); if (channelCount >= 1) { CFStringRef cfname; size = sizeof(CFStringRef); prop.mSelector = kAudioObjectPropertyName; AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, &cfname); CFIndex length = CFStringGetLength(cfname); CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1; char *buffer = (char *)malloc(maxSize); if (CFStringGetCString(cfname, buffer, maxSize, kCFStringEncodingUTF8)) { // Append the ID to the name in case we have devices with duplicate name list.push_back(String(buffer) + " (" + itos(audioDevices[i]) + ")"); } free(buffer); } } free(audioDevices); return list;}
开发者ID:DSeanLaw,项目名称:godot,代码行数:56,
示例2: AudioObjectGetPropertyDataSizebool CCoreAudioDevice::GetStreams(AudioStreamIdList* pList){ if (!pList || !m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyStreams; UInt32 propertySize = 0; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return false; UInt32 streamCount = propertySize / sizeof(AudioStreamID); AudioStreamID* pStreamList = new AudioStreamID[streamCount]; ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pStreamList); if (ret == noErr) { for (UInt32 stream = 0; stream < streamCount; stream++) pList->push_back(pStreamList[stream]); } delete[] pStreamList; return ret == noErr;}
开发者ID:0xheart0,项目名称:xbmc,代码行数:27,
示例3: AudioObjectGetPropertyDataSizeint AudioDevice::CountChannels(){ OSStatus err; UInt32 propSize; int result = 0; AudioObjectPropertyScope theScope = mIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; AudioObjectPropertyAddress theAddress = { kAudioDevicePropertyStreamConfiguration, theScope, 0 }; // channel err = AudioObjectGetPropertyDataSize(mID, &theAddress, 0, NULL, &propSize); if (err) return 0; AudioBufferList *buflist = (AudioBufferList *)malloc(propSize); err = AudioObjectGetPropertyData(mID, &theAddress, 0, NULL, &propSize, buflist); if (!err) { for (UInt32 i = 0; i < buflist->mNumberBuffers; ++i) { result += buflist->mBuffers[i].mNumberChannels; } } free(buflist); return result;}
开发者ID:Leykion,项目名称:CocoaSampleCode,代码行数:25,
示例4: GetAudioPropertyArraystatic UInt32 GetAudioPropertyArray(AudioObjectID id, AudioObjectPropertySelector selector, AudioObjectPropertyScope scope, void **outData){ OSStatus err; AudioObjectPropertyAddress property_address; UInt32 i_param_size; property_address.mSelector = selector; property_address.mScope = scope; property_address.mElement = kAudioObjectPropertyElementMaster; err = AudioObjectGetPropertyDataSize(id, &property_address, 0, NULL, &i_param_size); if (err != noErr) return 0; *outData = malloc(i_param_size); err = AudioObjectGetPropertyData(id, &property_address, 0, NULL, &i_param_size, *outData); if (err != noErr) { free(*outData); return 0; } return i_param_size;}
开发者ID:DanielGit,项目名称:Intrisit8000,代码行数:30,
示例5: verify_noerrvoid AudioDeviceList::BuildList(){ mDevices.clear(); UInt32 propsize; AudioObjectPropertyAddress aopa; aopa.mSelector = kAudioHardwarePropertyDevices; aopa.mScope = kAudioObjectPropertyScopeGlobal; aopa.mElement = kAudioObjectPropertyElementMaster; verify_noerr(AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &aopa, 0, NULL, &propsize)); int nDevices = propsize / sizeof(AudioDeviceID); AudioDeviceID *devids = new AudioDeviceID[nDevices]; verify_noerr(AudioObjectGetPropertyData(kAudioObjectSystemObject, &aopa, 0, NULL, &propsize, devids)); for (int i = 0; i < nDevices; ++i) { AudioDevice dev(devids[i], mInputs); if (dev.CountChannels() > 0) { Device d; d.mID = devids[i]; dev.GetName(d.mName, sizeof(d.mName)); mDevices.push_back(d); } } delete[] devids;}
开发者ID:jdberry,项目名称:CAPlayThrough,代码行数:27,
示例6: getNumChannels static int getNumChannels (AudioDeviceID deviceID, bool input) { int total = 0; UInt32 size; AudioObjectPropertyAddress pa; pa.mSelector = kAudioDevicePropertyStreamConfiguration; pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; pa.mElement = kAudioObjectPropertyElementMaster; if (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size) == noErr) { HeapBlock <AudioBufferList> bufList; bufList.calloc (size, 1); if (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, bufList) == noErr) { const int numStreams = bufList->mNumberBuffers; for (int i = 0; i < numStreams; ++i) { const AudioBuffer& b = bufList->mBuffers[i]; total += b.mNumberChannels; } } } return total; }
开发者ID:owenvallis,项目名称:Nomestate,代码行数:29,
示例7: _audio_system_get_devicesstatic inline AudioDeviceID *_audio_system_get_devices (gint * ndevices){ OSStatus status = noErr; UInt32 propertySize = 0; AudioDeviceID *devices = NULL; AudioObjectPropertyAddress audioDevicesAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; status = AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &audioDevicesAddress, 0, NULL, &propertySize); if (status != noErr) { GST_WARNING ("failed getting number of devices: %d", (int) status); return NULL; } *ndevices = propertySize / sizeof (AudioDeviceID); devices = (AudioDeviceID *) g_malloc (propertySize); if (devices) { status = AudioObjectGetPropertyData (kAudioObjectSystemObject, &audioDevicesAddress, 0, NULL, &propertySize, devices); if (status != noErr) { GST_WARNING ("failed getting the list of devices: %d", (int) status); g_free (devices); *ndevices = 0; return NULL; } } return devices;}
开发者ID:Distrotech,项目名称:gst-plugins-good,代码行数:35,
示例8: fluid_core_audio_driver_settingsvoidfluid_core_audio_driver_settings(fluid_settings_t* settings){ int i; UInt32 size; AudioObjectPropertyAddress pa; pa.mSelector = kAudioHardwarePropertyDevices; pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mElement = kAudioObjectPropertyElementMaster; fluid_settings_register_str (settings, "audio.coreaudio.device", "default", 0, NULL, NULL); fluid_settings_add_option (settings, "audio.coreaudio.device", "default"); if (OK (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, 0, &size))) { int num = size / (int) sizeof (AudioDeviceID); AudioDeviceID devs [num]; if (OK (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, 0, &size, devs))) { for (i = 0; i < num; ++i) { char name [1024]; size = sizeof (name); pa.mSelector = kAudioDevicePropertyDeviceName; if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name))) { if ( get_num_outputs (devs[i]) > 0) { fluid_settings_add_option (settings, "audio.coreaudio.device", name); } } } } }}
开发者ID:RangelReale,项目名称:fluidsynth-fromsvn,代码行数:29,
示例9: AudioObjectGetPropertyDataSizeUInt32 CCoreAudioDevice::GetTotalOutputChannels(){ UInt32 channels = 0; if (!m_DeviceId) return channels; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration; UInt32 size = 0; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &size); if (ret != noErr) return channels; AudioBufferList* pList = (AudioBufferList*)malloc(size); ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &size, pList); if (ret == noErr) { for(UInt32 buffer = 0; buffer < pList->mNumberBuffers; ++buffer) channels += pList->mBuffers[buffer].mNumberChannels; } else { CLog::Log(LOGERROR, "CCoreAudioDevice::GetTotalOutputChannels: " "Unable to get total device output channels - id: 0x%04x. Error = %s", (uint)m_DeviceId, GetError(ret).c_str()); } free(pList); return channels;}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:35,
示例10: ca_query_layoutstatic AudioChannelLayout* ca_query_layout(struct ao *ao, AudioDeviceID device, void *talloc_ctx){ OSStatus err; uint32_t psize; AudioChannelLayout *r = NULL; AudioObjectPropertyAddress p_addr = (AudioObjectPropertyAddress) { .mSelector = kAudioDevicePropertyPreferredChannelLayout, .mScope = kAudioDevicePropertyScopeOutput, .mElement = kAudioObjectPropertyElementWildcard, }; err = AudioObjectGetPropertyDataSize(device, &p_addr, 0, NULL, &psize); CHECK_CA_ERROR("could not get device preferred layout (size)"); r = talloc_size(talloc_ctx, psize); err = AudioObjectGetPropertyData(device, &p_addr, 0, NULL, &psize, r); CHECK_CA_ERROR("could not get device preferred layout (get)");coreaudio_error: return r;}
开发者ID:AppleNuts,项目名称:mpv,代码行数:25,
示例11: verify_noerrvoid AudioDeviceList::BuildList(){ mDeviceList.clear(); mDeviceDict.clear(); UInt32 propsize; AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; verify_noerr(AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize)); int nDevices = propsize / sizeof(AudioDeviceID); AudioDeviceID *devids = new AudioDeviceID[nDevices]; verify_noerr(AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize, devids)); for (int i = 0; i < nDevices; ++i) { AudioDevice dev(devids[i], true, mForInput); if (dev.CountChannels() > 0) { Device d; d.mID = devids[i]; dev.GetName(d.mName, sizeof(d.mName)); mDeviceList.push_back(d); QString name = QString::fromUtf8(d.mName); if (!mDeviceDict.contains(name)) { mDeviceDict[name] = d.mID; } } } delete[] devids;}
开发者ID:arthurzam,项目名称:QMPlay2,代码行数:33,
示例12: AudioObjectGetPropertyDataSizebool CCoreAudioStream::GetAvailablePhysicalFormats(AudioStreamID id, StreamFormatList* pList){ if (!pList || !id) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; propertyAddress.mSelector = kAudioStreamPropertyAvailablePhysicalFormats; UInt32 propertySize = 0; OSStatus ret = AudioObjectGetPropertyDataSize(id, &propertyAddress, 0, NULL, &propertySize); if (ret) return false; UInt32 formatCount = propertySize / sizeof(AudioStreamRangedDescription); AudioStreamRangedDescription *pFormatList = new AudioStreamRangedDescription[formatCount]; ret = AudioObjectGetPropertyData(id, &propertyAddress, 0, NULL, &propertySize, pFormatList); if (!ret) { for (UInt32 format = 0; format < formatCount; format++) pList->push_back(pFormatList[format]); } delete[] pFormatList; return (ret == noErr);}
开发者ID:CEikermann,项目名称:xbmc,代码行数:26,
示例13: AudioObjectGetPropertyDataSizeUInt32 CAHALAudioObject::GetPropertyDataSize(AudioObjectPropertyAddress& inAddress, UInt32 inQualifierDataSize, const void* inQualifierData) const{ UInt32 theDataSize = 0; OSStatus theError = AudioObjectGetPropertyDataSize(mObjectID, &inAddress, inQualifierDataSize, inQualifierData, &theDataSize); ThrowIfError(theError, CAException(theError), "CAHALAudioObject::GetPropertyDataSize: got an error getting the property data size"); return theDataSize;}
开发者ID:NikolaiUgelvik,项目名称:sooperlooper,代码行数:7,
示例14: coreaudio_enum_devicesstatic void coreaudio_enum_devices(struct device_list *list, bool input){ AudioObjectPropertyAddress addr = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; UInt32 size = 0; UInt32 count; OSStatus stat; AudioDeviceID *ids; stat = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &addr, 0, NULL, &size); if (!enum_success(stat, "get kAudioObjectSystemObject data size")) return; ids = bmalloc(size); count = size / sizeof(AudioDeviceID); stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, 0, NULL, &size, ids); if (enum_success(stat, "get kAudioObjectSystemObject data")) for (UInt32 i = 0; i < count; i++) coreaudio_enum_add_device(list, ids[i], input); bfree(ids);}
开发者ID:gameroast,项目名称:obs-studio,代码行数:30,
示例15: scanForDevices //============================================================================== void scanForDevices() { hasScanned = true; inputDeviceNames.clear(); outputDeviceNames.clear(); inputIds.clear(); outputIds.clear(); UInt32 size; AudioObjectPropertyAddress pa; pa.mSelector = kAudioHardwarePropertyDevices; pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mElement = kAudioObjectPropertyElementMaster; if (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, 0, &size) == noErr) { HeapBlock <AudioDeviceID> devs; devs.calloc (size, 1); if (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, 0, &size, devs) == noErr) { const int num = size / (int) sizeof (AudioDeviceID); for (int i = 0; i < num; ++i) { char name [1024]; size = sizeof (name); pa.mSelector = kAudioDevicePropertyDeviceName; if (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name) == noErr) { const String nameString (String::fromUTF8 (name, (int) strlen (name))); const int numIns = getNumChannels (devs[i], true); const int numOuts = getNumChannels (devs[i], false); if (numIns > 0) { inputDeviceNames.add (nameString); inputIds.add (devs[i]); } if (numOuts > 0) { outputDeviceNames.add (nameString); outputIds.add (devs[i]); } } } } } inputDeviceNames.appendNumbersToDuplicates (false, true); outputDeviceNames.appendNumbersToDuplicates (false, true); }
开发者ID:owenvallis,项目名称:Nomestate,代码行数:56,
示例16: choose_output_devicestatic void choose_output_device(coreaudio_t *dev, const char* device){ unsigned i; UInt32 deviceCount; AudioObjectPropertyAddress propaddr; AudioDeviceID *devices = NULL; UInt32 size = 0; propaddr.mSelector = kAudioHardwarePropertyDevices;#if MAC_OS_X_VERSION_10_12 propaddr.mScope = kAudioObjectPropertyScopeOutput;#else propaddr.mScope = kAudioObjectPropertyScopeGlobal;#endif propaddr.mElement = kAudioObjectPropertyElementMaster; if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propaddr, 0, 0, &size) != noErr) return; deviceCount = size / sizeof(AudioDeviceID); devices = (AudioDeviceID*)malloc(size); if (!devices || AudioObjectGetPropertyData(kAudioObjectSystemObject, &propaddr, 0, 0, &size, devices) != noErr) goto done;#if MAC_OS_X_VERSION_10_12#else propaddr.mScope = kAudioDevicePropertyScopeOutput;#endif propaddr.mSelector = kAudioDevicePropertyDeviceName; for (i = 0; i < deviceCount; i ++) { char device_name[1024]; device_name[0] = 0; size = 1024; if (AudioObjectGetPropertyData(devices[i], &propaddr, 0, 0, &size, device_name) == noErr && string_is_equal(device_name, device)) { AudioUnitSetProperty(dev->dev, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &devices[i], sizeof(AudioDeviceID)); goto done; } }done: free(devices);}
开发者ID:dankcushions,项目名称:RetroArch,代码行数:52,
示例17: AudioObjectGetPropertyDataSizeuint32_t audio::orchestra::api::Core::getDeviceCount() { // Find out how many audio devices there are, if any. uint32_t dataSize; AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; OSStatus result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &dataSize); if (result != noErr) { ATA_ERROR("OS-X error getting device info!"); return 0; } return (dataSize / sizeof(AudioDeviceID)) * 2;}
开发者ID:musicdsp,项目名称:audio-orchestra,代码行数:15,
示例18: coreaudio_find_devicestatic AudioDeviceID coreaudio_find_device(const char *dev_name){ AudioObjectPropertyAddress aopa = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeOutput, kAudioObjectPropertyElementMaster }; UInt32 property_size = 0; OSStatus err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &aopa, 0, NULL, &property_size); if (err != noErr) return kAudioDeviceUnknown; aopa.mSelector = kAudioHardwarePropertyDevices; int device_count = property_size / sizeof(AudioDeviceID); AudioDeviceID devices[device_count]; property_size = sizeof(devices); err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &aopa, 0, NULL, &property_size, devices); if (err != noErr) return kAudioDeviceUnknown; aopa.mSelector = kAudioDevicePropertyDeviceName; for (int i = 0; i < device_count; i++) { char name[256] = {0}; property_size = sizeof(name); err = AudioObjectGetPropertyData(devices[i], &aopa, 0, NULL, &property_size, name); if (err == noErr && strcmp(name, dev_name) == 0) { return devices[i]; } } return kAudioDeviceUnknown;}
开发者ID:jolange,项目名称:cmus,代码行数:48,
示例19: _audio_device_set_mixingstatic inline gboolean_audio_device_set_mixing (AudioDeviceID device_id, gboolean enable_mix){ OSStatus status = noErr; UInt32 propertySize = 0, can_mix = enable_mix; Boolean writable = FALSE; gboolean res = FALSE; AudioObjectPropertyAddress audioDeviceSupportsMixingAddress = { kAudioDevicePropertySupportsMixing, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; if (AudioObjectHasProperty (device_id, &audioDeviceSupportsMixingAddress)) { /* Set mixable to false if we are allowed to */ status = AudioObjectIsPropertySettable (device_id, &audioDeviceSupportsMixingAddress, &writable); if (status) { GST_DEBUG ("AudioObjectIsPropertySettable: %d", (int) status); } status = AudioObjectGetPropertyDataSize (device_id, &audioDeviceSupportsMixingAddress, 0, NULL, &propertySize); if (status) { GST_DEBUG ("AudioObjectGetPropertyDataSize: %d", (int) status); } status = AudioObjectGetPropertyData (device_id, &audioDeviceSupportsMixingAddress, 0, NULL, &propertySize, &can_mix); if (status) { GST_DEBUG ("AudioObjectGetPropertyData: %d", (int) status); } if (status == noErr && writable) { can_mix = enable_mix; status = AudioObjectSetPropertyData (device_id, &audioDeviceSupportsMixingAddress, 0, NULL, propertySize, &can_mix); res = TRUE; } if (status != noErr) { GST_ERROR ("failed to set mixmode: %d", (int) status); } } else { GST_DEBUG ("property not found, mixing coudln't be changed"); } return res;}
开发者ID:Distrotech,项目名称:gst-plugins-good,代码行数:48,
示例20: coreaudio_enum_add_devicestatic void coreaudio_enum_add_device(struct device_list *list, AudioDeviceID id, bool input){ OSStatus stat; UInt32 size = 0; CFStringRef cf_name = NULL; CFStringRef cf_value = NULL; struct device_item item; AudioObjectPropertyAddress addr = { kAudioDevicePropertyStreams, kAudioDevicePropertyScopeInput, kAudioObjectPropertyElementMaster }; memset(&item, 0, sizeof(item)); /* check to see if it's a mac input device */ AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size); if (!size) return; size = sizeof(CFStringRef); addr.mSelector = kAudioDevicePropertyDeviceUID; stat = AudioObjectGetPropertyData(id, &addr, 0, NULL, &size, &cf_value); if (!enum_success(stat, "get audio device UID")) return; addr.mSelector = kAudioDevicePropertyDeviceNameCFString; stat = AudioObjectGetPropertyData(id, &addr, 0, NULL, &size, &cf_name); if (!enum_success(stat, "get audio device name")) goto fail; if (!cf_to_dstr(cf_name, &item.name)) goto fail; if (!cf_to_dstr(cf_value, &item.value)) goto fail; if (input || !device_is_input(item.value.array)) device_list_add(list, &item);fail: device_item_free(&item); CFRelease(cf_name); CFRelease(cf_value);}
开发者ID:gameroast,项目名称:obs-studio,代码行数:47,
示例21: coreaudio_init_bufferstatic bool coreaudio_init_buffer(struct coreaudio_data *ca){ UInt32 buf_size = 0; UInt32 size = 0; UInt32 frames = 0; OSStatus stat; AudioObjectPropertyAddress addr = { kAudioDevicePropertyStreamConfiguration, kAudioDevicePropertyScopeInput, kAudioObjectPropertyElementMaster }; stat = AudioObjectGetPropertyDataSize(ca->device_id, &addr, 0, NULL, &buf_size); if (!ca_success(stat, ca, "coreaudio_init_buffer", "get list size")) return false; size = sizeof(frames); stat = get_property(ca->unit, kAudioDevicePropertyBufferFrameSize, SCOPE_GLOBAL, 0, &frames, &size); if (!ca_success(stat, ca, "coreaudio_init_buffer", "get frame size")) return false; /* ---------------------- */ ca->buf_list = bmalloc(buf_size); stat = AudioObjectGetPropertyData(ca->device_id, &addr, 0, NULL, &buf_size, ca->buf_list); if (!ca_success(stat, ca, "coreaudio_init_buffer", "allocate")) { bfree(ca->buf_list); ca->buf_list = NULL; return false; } for (UInt32 i = 0; i < ca->buf_list->mNumberBuffers; i++) { size = ca->buf_list->mBuffers[i].mDataByteSize; ca->buf_list->mBuffers[i].mData = bmalloc(size); } return true;}
开发者ID:CuylarStudios,项目名称:obs-studio,代码行数:43,
示例22: getAllDataSourcesForDevice //============================================================================== static int getAllDataSourcesForDevice (AudioDeviceID deviceID, HeapBlock <OSType>& types) { AudioObjectPropertyAddress pa; pa.mSelector = kAudioDevicePropertyDataSources; pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mElement = kAudioObjectPropertyElementMaster; UInt32 size = 0; if (deviceID != 0 && AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size) == noErr) { types.calloc (size, 1); if (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, types) == noErr) return size / (int) sizeof (OSType); } return 0; }
开发者ID:owenvallis,项目名称:Nomestate,代码行数:20,
示例23: AudioObjectGetPropertyDataSizevoid CCoreAudioHardware::ResetAudioDevices(){ // Reset any devices with an AC3 stream back to a Linear PCM // so that they can become a default output device AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; propertyAddress.mSelector = kAudioHardwarePropertyDevices; UInt32 size; OSStatus ret = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioHardware::ResetAudioDevices: ResetAudioDevices - unknown size"); return; } AudioDeviceID *devices = (AudioDeviceID*)malloc(size); if (!devices) { CLog::Log(LOGERROR, "CCoreAudioHardware::ResetAudioDevices: ResetAudioDevices - out of memory?"); return; } int numDevices = size / sizeof(AudioDeviceID); ret = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size, devices); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioHardware::ResetAudioDevices: ResetAudioDevices - cannot get device list"); return; } for (int i = 0; i < numDevices; i++) { AudioStreamID *streams = StreamsList(devices[i]); if (streams) { for (int j = 0; streams[j] != kAudioHardwareBadStreamError; j++) ResetStream(streams[j]); free(streams); } } free(devices);}
开发者ID:2BReality,项目名称:xbmc,代码行数:43,
示例24: audio_listenerOSStatus audio_listener(AudioObjectID id, UInt32 size, const AudioObjectPropertyAddress addresses[], void *data){ OSStatus result; UInt32 propDataSize; closure_t closure = data; result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, addresses, 0, NULL, &propDataSize); int count = -1; if (result == noErr) { count = propDataSize / sizeof(AudioDeviceID); } closure->function(closure->data); return noErr;}
开发者ID:patrikohlsson,项目名称:faudio,代码行数:20,
示例25: sizeofbool CCoreAudioStream::GetVirtualFormat(AudioStreamBasicDescription* pDesc){ if (!pDesc || !m_StreamId) return false; UInt32 size = sizeof(AudioStreamBasicDescription); AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; propertyAddress.mSelector = kAudioStreamPropertyVirtualFormat; OSStatus ret = AudioObjectGetPropertyDataSize(m_StreamId, &propertyAddress, 0, NULL, &size); if (ret) return false; ret = AudioObjectGetPropertyData(m_StreamId, &propertyAddress, 0, NULL, &size, pDesc); if (ret) return false; return true;}
开发者ID:CEikermann,项目名称:xbmc,代码行数:20,
注:本文中的AudioObjectGetPropertyDataSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AudioObjectSetPropertyData函数代码示例 C++ AudioHardwareGetProperty函数代码示例 |