potential split between CLI and core library
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import AudioTeeCore
|
||||
import CoreAudio
|
||||
import Foundation
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import AudioTeeCore
|
||||
import AudioToolbox
|
||||
import Foundation
|
||||
|
||||
@@ -10,7 +10,7 @@ public class AudioRecorder {
|
||||
private var outputHandler: AudioOutputHandler
|
||||
private var converter: AudioFormatConverter?
|
||||
|
||||
init(
|
||||
public init(
|
||||
deviceID: AudioObjectID, outputHandler: AudioOutputHandler, convertToSampleRate: Double? = nil,
|
||||
chunkDuration: Double = 0.2
|
||||
) {
|
||||
@@ -51,7 +51,7 @@ public class AudioRecorder {
|
||||
}
|
||||
}
|
||||
|
||||
func startRecording() {
|
||||
public func startRecording() {
|
||||
Logger.debug("Starting audio recording")
|
||||
|
||||
// Log format info and send metadata for final format
|
||||
@@ -112,7 +112,7 @@ public class AudioRecorder {
|
||||
return noErr
|
||||
}
|
||||
|
||||
func stopRecording() {
|
||||
public func stopRecording() {
|
||||
processAudioBuffer()
|
||||
outputHandler.handleStreamStop()
|
||||
cleanupIOProc()
|
||||
+5
-3
@@ -3,10 +3,12 @@ import AudioToolbox
|
||||
import CoreAudio
|
||||
import Foundation
|
||||
|
||||
class AudioTapManager {
|
||||
public class AudioTapManager {
|
||||
private var tapID: AudioObjectID?
|
||||
private var deviceID: AudioObjectID?
|
||||
|
||||
public init() {}
|
||||
|
||||
deinit {
|
||||
Logger.debug("Cleaning up audio tap manager")
|
||||
|
||||
@@ -22,7 +24,7 @@ class AudioTapManager {
|
||||
}
|
||||
|
||||
/// Sets up the audio tap and aggregate device
|
||||
func setupAudioTap(with config: TapConfiguration) throws {
|
||||
public func setupAudioTap(with config: TapConfiguration) throws {
|
||||
Logger.debug("Setting up audio tap manager")
|
||||
|
||||
tapID = try createSystemAudioTap(with: config)
|
||||
@@ -38,7 +40,7 @@ class AudioTapManager {
|
||||
}
|
||||
|
||||
/// Returns the aggregate device ID for recording
|
||||
func getDeviceID() -> AudioObjectID? {
|
||||
public func getDeviceID() -> AudioObjectID? {
|
||||
return deviceID
|
||||
}
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
import Foundation
|
||||
|
||||
public class BinaryAudioOutputHandler: AudioOutputHandler {
|
||||
public init() {}
|
||||
|
||||
public func handleAudioPacket(_ packet: AudioPacket) {
|
||||
// TODO: should we use a DispatchQueue instead of writing directly?
|
||||
// Write raw binary audio data directly to stdout
|
||||
Reference in New Issue
Block a user