Skip to content

Commit 37e0fb8

Browse files
authored
Use non-deprecated constants (#269)
* Use non-deprecated constants * Add deprecation
1 parent 51dfafe commit 37e0fb8

10 files changed

+24
-14
lines changed

Device/AudioAggregateDevice.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,15 @@ extension AudioAggregateDevice {
6262
return try getProperty(PropertyAddress(kAudioAggregateDevicePropertyComposition), type: CFDictionary.self) as! [AnyHashable: Any]
6363
}
6464

65+
/// Returns the main subdevice
66+
/// - remark: This corresponds to the property `kAudioAggregateDevicePropertyMainSubDevice`
67+
public func mainSubdevice() throws -> AudioDevice {
68+
return AudioObject.make(try getProperty(PropertyAddress(kAudioAggregateDevicePropertyMainSubDevice), type: AudioObjectID.self)) as! AudioDevice
69+
}
70+
6571
/// Returns the master subdevice
6672
/// - remark: This corresponds to the property `kAudioAggregateDevicePropertyMasterSubDevice`
73+
@available(macOS, introduced: 10.0, deprecated: 12.0, renamed: "mainSubdevice")
6774
public func masterSubdevice() throws -> AudioDevice {
6875
return AudioObject.make(try getProperty(PropertyAddress(kAudioAggregateDevicePropertyMasterSubDevice), type: AudioObjectID.self)) as! AudioDevice
6976
}
@@ -132,7 +139,10 @@ extension AudioObjectSelector where T == AudioAggregateDevice {
132139
public static let activeSubDeviceList = AudioObjectSelector(kAudioAggregateDevicePropertyActiveSubDeviceList)
133140
/// The property selector `kAudioAggregateDevicePropertyComposition`
134141
public static let composition = AudioObjectSelector(kAudioAggregateDevicePropertyComposition)
142+
/// The property selector `kAudioAggregateDevicePropertyMainSubDevice`
143+
public static let mainSubDevice = AudioObjectSelector(kAudioAggregateDevicePropertyMainSubDevice)
135144
/// The property selector `kAudioAggregateDevicePropertyMasterSubDevice`
145+
@available(macOS, introduced: 10.0, deprecated: 12.0, renamed: "mainSubDevice")
136146
public static let masterSubDevice = AudioObjectSelector(kAudioAggregateDevicePropertyMasterSubDevice)
137147
/// The property selector `kAudioAggregateDevicePropertyClockDevice`
138148
public static let clockDevice = AudioObjectSelector(kAudioAggregateDevicePropertyClockDevice)

Device/AudioBox.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// A HAL audio box object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMaster`)
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMain`)
1313
/// - remark: This class correponds to objects with base class `kAudioBoxClassID`
1414
public class AudioBox: AudioObject {
1515
/// Returns the available audio boxes

Device/AudioClockDevice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2020 - 2021 Stephen F. Booth <me@sbooth.org>
2+
// Copyright (c) 2020 - 2023 Stephen F. Booth <me@sbooth.org>
33
// Part of https://github.com/sbooth/SFBAudioEngine
44
// MIT license
55
//
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// A HAL audio clock device object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMaster`)
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMain`)
1313
/// - remark: This class correponds to objects with base class `kAudioClockDeviceClassID`
1414
public class AudioClockDevice: AudioObject {
1515
/// Returns the available audio clock devices

Device/AudioControl.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2020 - 2022 Stephen F. Booth <me@sbooth.org>
2+
// Copyright (c) 2020 - 2023 Stephen F. Booth <me@sbooth.org>
33
// Part of https://github.com/sbooth/SFBAudioEngine
44
// MIT license
55
//
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// A HAL audio control object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMaster`)
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMain`)
1313
/// - remark: This class correponds to objects with base class `kAudioControlClassID`
1414
public class AudioControl: AudioObject {
1515
// A textual representation of this instance, suitable for debugging.

Device/AudioDevice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import os.log
1010

1111
/// A HAL audio device object
1212
///
13-
/// This class has four scopes (`kAudioObjectPropertyScopeGlobal`, `kAudioObjectPropertyScopeInput`, `kAudioObjectPropertyScopeOutput`, and `kAudioObjectPropertyScopePlayThrough`), a master element (`kAudioObjectPropertyElementMaster`), and an element for each channel in each stream
13+
/// This class has four scopes (`kAudioObjectPropertyScopeGlobal`, `kAudioObjectPropertyScopeInput`, `kAudioObjectPropertyScopeOutput`, and `kAudioObjectPropertyScopePlayThrough`), a main element (`kAudioObjectPropertyElementMain`), and an element for each channel in each stream
1414
/// - remark: This class correponds to objects with base class `kAudioDeviceClassID`
1515
public class AudioDevice: AudioObject {
1616
/// Returns the available audio devices

Device/AudioObjectProperty.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public struct PropertyAddress: RawRepresentable {
138138
/// - parameter selector: The desired raw selector value
139139
/// - parameter scope: The desired raw scope value
140140
/// - parameter element: The desired raw element value
141-
public init(_ selector: AudioObjectPropertySelector, scope: AudioObjectPropertyScope = kAudioObjectPropertyScopeGlobal, element: AudioObjectPropertyElement = kAudioObjectPropertyElementMaster) {
141+
public init(_ selector: AudioObjectPropertySelector, scope: AudioObjectPropertyScope = kAudioObjectPropertyScopeGlobal, element: AudioObjectPropertyElement = kAudioObjectPropertyElementMain) {
142142
self.rawValue = AudioObjectPropertyAddress(mSelector: selector, mScope: scope, mElement: element)
143143
}
144144

Device/AudioPlugIn.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2020 - 2022 Stephen F. Booth <me@sbooth.org>
2+
// Copyright (c) 2020 - 2023 Stephen F. Booth <me@sbooth.org>
33
// Part of https://github.com/sbooth/SFBAudioEngine
44
// MIT license
55
//
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// A HAL audio plug-in object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMaster`)
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMain`)
1313
/// - remark: This class correponds to objects of type `kAudioPlugInClassID`
1414
public class AudioPlugIn: AudioObject {
1515
/// Returns the available audio plug-ins

Device/AudioStream.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2020 - 2022 Stephen F. Booth <me@sbooth.org>
2+
// Copyright (c) 2020 - 2023 Stephen F. Booth <me@sbooth.org>
33
// Part of https://github.com/sbooth/SFBAudioEngine
44
// MIT license
55
//
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// A HAL audio stream object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`), a master element (`kAudioObjectPropertyElementMaster`), and an element for each channel
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`), a main element (`kAudioObjectPropertyElementMain`), and an element for each channel
1313
/// - remark: This class correponds to objects with base class `kAudioStreamClassID`
1414
public class AudioStream: AudioObject {
1515
// A textual representation of this instance, suitable for debugging.

Device/AudioSystemObject.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// The HAL audio system object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMaster`)
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMain`)
1313
/// - remark: This class correponds to the object with id `kAudioObjectSystemObject` and class `kAudioSystemObjectClassID`
1414
public class AudioSystemObject: AudioObject {
1515
/// The singleton audio system object

Device/AudioTransportManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2020 - 2022 Stephen F. Booth <me@sbooth.org>
2+
// Copyright (c) 2020 - 2023 Stephen F. Booth <me@sbooth.org>
33
// Part of https://github.com/sbooth/SFBAudioEngine
44
// MIT license
55
//
@@ -9,7 +9,7 @@ import CoreAudio
99

1010
/// A HAL audio transport manager object
1111
///
12-
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMaster`)
12+
/// This class has a single scope (`kAudioObjectPropertyScopeGlobal`) and a single element (`kAudioObjectPropertyElementMain`)
1313
/// - remark: This class correponds to objects with base class `kAudioTransportManagerClassID`
1414
public class AudioTransportManager: AudioPlugIn {
1515
/// Returns the available audio transport managers

0 commit comments

Comments
 (0)