@@ -623,7 +623,7 @@ - (void) ensureDeviceList {
623623 kAudioObjectPropertyElementMaster },
624624 setCallback = { kAudioStreamPropertyAvailablePhysicalFormats ,
625625 kAudioObjectPropertyScopeGlobal ,
626- 0 },
626+ kAudioObjectPropertyElementMaster },
627627 setRunLoop = { kAudioHardwarePropertyRunLoop ,
628628 kAudioObjectPropertyScopeGlobal ,
629629 kAudioObjectPropertyElementMaster };
@@ -649,7 +649,7 @@ - (void) ensureDeviceList {
649649 // First get the device IDs and compute numDevices
650650 UInt32 datasize = 0 ;
651651 if (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject ,
652- &getDevices, 0 , 0 , &datasize))
652+ &getDevices, 0 , nil , &datasize))
653653 return ;
654654 numDevices = datasize / sizeof (AudioDeviceID);
655655 if (numDevices == 0
@@ -658,7 +658,7 @@ - (void) ensureDeviceList {
658658 return ;
659659 }
660660 if (AudioObjectGetPropertyData (kAudioObjectSystemObject , &getDevices,
661- 0 , 0 , &datasize, (AudioDeviceID *)deviceIDs)
661+ 0 , nil , &datasize, (AudioDeviceID *)deviceIDs)
662662
663663 || !(deviceNames = calloc (numDevices, sizeof (char *)))
664664 || !(deviceTypes = calloc (numDevices, sizeof (char )))) {
@@ -676,9 +676,9 @@ - (void) ensureDeviceList {
676676 CFStringRef nameRef;
677677
678678 if (AudioObjectGetPropertyDataSize (deviceIDs[i], &getName,
679- 0 , 0 , &datasize)
679+ 0 , nil , &datasize)
680680 || AudioObjectGetPropertyData (deviceIDs[i], &getName,
681- 0 , 0 , &datasize, &nameRef))
681+ 0 , nil , &datasize, &nameRef))
682682 error (" could not get sound device name" );
683683
684684 CFIndex length = CFStringGetLength (nameRef) + 1 ;
@@ -687,6 +687,7 @@ - (void) ensureDeviceList {
687687 if (AudioObjectGetPropertyDataSize (deviceIDs[i], &getInputStreams,
688688 0 , NULL , &datasize))
689689 error (" could not get sound device Input stream info" );
690+ deviceNames[i][length - 1 ] = 0 ;
690691 if (datasize > 0 )
691692 deviceTypes[i] = IsInput;
692693
@@ -697,11 +698,11 @@ - (void) ensureDeviceList {
697698 deviceTypes[i] |= IsOutput;
698699
699700 // The claim on the internet is that each callback must have its own
700- // run loop for the calbacks to be called reliably.
701+ // run loop for the callbacks to be called reliably.
701702 // If these error what can we do? Simply ignore errors for now.
702703 CFRunLoopRef runLoop = 0 ;
703704 (void )AudioObjectSetPropertyData (kAudioObjectSystemObject , &setRunLoop,
704- 0 , 0 , sizeof (runLoop), &runLoop);
705+ 0 , nil , sizeof (runLoop), &runLoop);
705706 (void )AudioObjectAddPropertyListener (deviceIDs[i], &setCallback,
706707 MyAudioDevicesListener, (void *)0 );
707708 }
0 commit comments