Skip to main content

OdinAudio

public class OdinAudio

Class to help managing the core audio functionality.

The AVAudioEngine instance manages audio nodes, controls playback and configures rendering constraints.

Properties​

engine​

public let engine: AVAudioEngine

The underlying AVAudioEngine instance.

devices​

@Published public private(set) var devices: [String: OdinAudioDevice] = [:]

A list of audio devices available.

inputDevices​

public var inputDevices: [String: OdinAudioDevice]

An list of audio input devices.

outputDevices​

public var outputDevices: [String: OdinAudioDevice]

An list of audio output devices.

isRunning​

public var isRunning: Bool

Indicates the status of the underlying AVAudioEngine instance.

Methods​

deinit​

deinit

Destroys room and closes the connection to the server if needed.

start()​

public func start() throws

Starts the underlying AVAudioEngine instance.

stop()​

public func stop()

Stops the underlying AVAudioEngine instance.

connect(_:)​

public func connect(_ room: OdinRoom) throws

Attaches the specified room to the underlying AVAudioEngine instance and connects it.

disconnect(_:)​

public func disconnect(_ room: OdinRoom) throws

Detaches the specified room from the underlying AVAudioEngine instance.

connect(_:)​

public func connect(_ media: OdinMedia) throws

Attaches the specified media to the underlying AVAudioEngine instance and connects it.

disconnect(_:)​

public func disconnect(_ media: OdinMedia) throws

Detaches the specified media from the underlying AVAudioEngine instance.

sharedInstance()​

public class func sharedInstance() -> OdinAudio

Returns a shared instance of the audio engine.