From c4e4f1214a89bbb1f4946fa41b9e3df6652e550a Mon Sep 17 00:00:00 2001 From: guru Date: Sat, 3 Apr 2021 14:35:07 +0300 Subject: [PATCH] in order to get more information about errors, result codes now printed to console --- .../AggregateVolumeControl.swift | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/AggregateVolumeMenu/AggregateVolumeControl.swift b/AggregateVolumeMenu/AggregateVolumeControl.swift index 39e7dc7..f37f865 100644 --- a/AggregateVolumeMenu/AggregateVolumeControl.swift +++ b/AggregateVolumeMenu/AggregateVolumeControl.swift @@ -30,7 +30,7 @@ class AggregateVolumeControl { result = AudioObjectGetPropertyData(AudioDeviceID(kAudioObjectSystemObject), &address, 0, nil, &propsize, &audioDeviceID) if (result != 0) { - print("kAudioHardwarePropertyDefaultOutputDevice") + print("kAudioHardwarePropertyDefaultOutputDevice result:\(result)") exit(-1) } @@ -45,7 +45,7 @@ class AggregateVolumeControl { result = AudioObjectGetPropertyData(audioDeviceID, &address, 0, nil, &propsize, &audioDeviceUID) if (result != 0) { - print("kAudioDevicePropertyDeviceUID") + print("kAudioDevicePropertyDeviceUID result:\(result)") exit(-1) } @@ -59,14 +59,14 @@ class AggregateVolumeControl { result = AudioObjectGetPropertyData(audioDeviceID, &address, 0, nil, &propsize, &transportType) if (result != 0) { - print("kAudioDevicePropertyTransportType") + print("kAudioDevicePropertyTransportType result:\(result)") exit(-1) } // if transportType is not Aggregate then exit the tool if (transportType != kAudioDeviceTransportTypeAggregate) { print("audioDeviceID: \(audioDeviceID) uid: \(audioDeviceUID as String? ?? "") transportType: \(transportType == kAudioDeviceTransportTypeAggregate)") - print("this tool only works with a kAudioDeviceTransportTypeAggregate") + print("this tool only works with a kAudioDeviceTransportTypeAggregate result:\(result)") exit(1) } @@ -82,7 +82,7 @@ class AggregateVolumeControl { result = AudioObjectGetPropertyData(audioDeviceID, &address, 0, nil, &propsize, &subDevicesID) if (result != 0) { - print("kAudioAggregateDevicePropertyActiveSubDeviceList") + print("kAudioAggregateDevicePropertyActiveSubDeviceList result:\(result)") exit(-1) } @@ -105,7 +105,7 @@ class AggregateVolumeControl { result = AudioObjectGetPropertyData(subDevice, &address, 0, nil, &propsize, &volLeft) if (result != 0) { - print("kAudioDevicePropertyVolumeScalar volLeft") + print("kAudioDevicePropertyVolumeScalar volLeft result:\(result)") exit(-1) } @@ -116,7 +116,7 @@ class AggregateVolumeControl { propsize = UInt32(MemoryLayout.size) result = AudioObjectGetPropertyData(subDevice, &address, 0, nil, &propsize, &volRight) if (result != 0) { - print("kAudioDevicePropertyVolumeScalar volRight") + print("kAudioDevicePropertyVolumeScalar volRight result:\(result)") exit(-1) } @@ -149,7 +149,7 @@ class AggregateVolumeControl { result = AudioObjectSetPropertyData(subDevice, &address, 0, nil, propsize, &vol) if (result != 0) { - print("kAudioDevicePropertyVolumeScalar volLeft") + print("kAudioDevicePropertyVolumeScalar volLeft result:\(result)") exit(-1) } @@ -160,7 +160,7 @@ class AggregateVolumeControl { propsize = UInt32(MemoryLayout.size) result = AudioObjectSetPropertyData(subDevice, &address, 0, nil, propsize, &vol) if (result != 0) { - print("kAudioDevicePropertyVolumeScalar volRight") + print("kAudioDevicePropertyVolumeScalar volRight result:\(result)") exit(-1) } } @@ -180,7 +180,7 @@ class AggregateVolumeControl { result = AudioObjectGetPropertyData(subDevice, &address, 0, nil, &propsize, &mute) if (result != 0) { - print("kAudioDevicePropertyVolumeScalar volLeft") + print("kAudioDevicePropertyVolumeScalar volLeft result:\(result)") exit(-1) } if (mute == 1) { @@ -194,7 +194,7 @@ class AggregateVolumeControl { propsize = UInt32(MemoryLayout.size) result = AudioObjectGetPropertyData(subDevice, &address, 0, nil, &propsize, &mute) if (result != 0) { - print("kAudioDevicePropertyVolumeScalar volRight") + print("kAudioDevicePropertyVolumeScalar volRight result:\(result)") exit(-1) } if (mute == 1) { @@ -219,7 +219,7 @@ class AggregateVolumeControl { result = AudioObjectSetPropertyData(subDevice, &address, 0, nil, propsize, &mut) if (result != 0) { - print("kAudioDevicePropertyMute volLeft") + print("kAudioDevicePropertyMute volLeft result:\(result)") exit(-1) } @@ -230,7 +230,7 @@ class AggregateVolumeControl { propsize = UInt32(MemoryLayout.size) result = AudioObjectSetPropertyData(subDevice, &address, 0, nil, propsize, &mut) if (result != 0) { - print("kAudioDevicePropertyMute volRight") + print("kAudioDevicePropertyMute volRight result:\(result)") exit(-1) } }