1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-11-27 02:02:15 +03:00

commit before trying to move volume to Output class

This commit is contained in:
Nodeful 2021-06-15 01:02:17 +03:00
parent 59990df83b
commit 2711dc8d3e
4 changed files with 13 additions and 12 deletions

View File

@ -39,3 +39,5 @@ player.scheduleBuffer(buffer, at: AVAudioTime(hostTime: 0), options:.loops, comp
DispatchQueue.main.asyncAfter(deadline: .now() + 5, execute: {
mixer.pan = -1
})
let unit = mixer.auAudioUnit.component

View File

@ -3,7 +3,7 @@
version = "3.0">
<TimelineItems>
<LoggerValueHistoryTimelineItem
documentLocation = "file:///Users/nodeful/Programming/Bitgapp/eqMac/native/app/Sandbox.playground#CharacterRangeLen=57&amp;CharacterRangeLoc=494&amp;EndingColumnNumber=0&amp;EndingLineNumber=19&amp;StartingColumnNumber=32&amp;StartingLineNumber=16&amp;Timestamp=645295599.40888"
documentLocation = "file:///Users/nodeful/Programming/Bitgapp/eqMac/native/app/Sandbox.playground#CharacterRangeLen=57&amp;CharacterRangeLoc=494&amp;EndingColumnNumber=0&amp;EndingLineNumber=19&amp;StartingColumnNumber=32&amp;StartingLineNumber=16&amp;Timestamp=645400816.412694"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>

View File

@ -115,12 +115,12 @@ class Engine {
}
private func chainVolumeToSink () {
engine.connect(volume.output, to: engine.mainMixerNode, format: format)
engine.connect(volume.booster, to: engine.mainMixerNode, format: format)
}
private func setupRenderCallback () {
Console.log("Setting up Input Render Callback")
let lastAVUnit = effects.equalizers.active.eq as AVAudioUnit
let lastAVUnit = volume.booster as AVAudioUnit
if let err = checkErr(AudioUnitAddRenderNotify(lastAVUnit.audioUnit,
renderCallback,
UnsafeMutableRawPointer(Unmanaged<Engine>.passUnretained(self).toOpaque()))) {

View File

@ -20,8 +20,8 @@ class Volume: StoreSubscriber {
var engine: AVAudioEngine?
var booster = AVAudioUnitEQ()
var mixer = AVAudioMixerNode()
var output = AVAudioUnitEQ()
// MARK: - Properties
var gain: Double = 1 {
@ -33,9 +33,9 @@ class Volume: StoreSubscriber {
if (gain <= 1) {
if (volumeSupported) {
device.setVirtualMasterVolume(Float32(gain), direction: .playback)
output.globalGain = 0
booster.globalGain = 0
} else {
output.globalGain = Float(Utilities.mapValue(value: gain, inMin: 0, inMax: 1, outMin: -96, outMax: 0))
booster.globalGain = Float(Utilities.mapValue(value: gain, inMin: 0, inMax: 1, outMin: -96, outMax: 0))
}
if (balanceSupported) {
@ -47,11 +47,11 @@ class Volume: StoreSubscriber {
Driver.device!.setVirtualMasterVolume(Float32(gain), direction: .playback)
} else {
} else { // gain > 1
if (volumeSupported) {
device.setVirtualMasterVolume(1.0, direction: .playback)
}
output.globalGain = Float(Utilities.mapValue(value: gain, inMin: 1, inMax: 2, outMin: 0, outMax: 12))
booster.globalGain = Float(Utilities.mapValue(value: gain, inMin: 1, inMax: 2, outMin: 0, outMax: 12))
if (balanceSupported) {
device.setVirtualMasterBalance(Float32(Utilities.mapValue(value: balance, inMin: -1, inMax: 1, outMin: 0, outMax: 1)), direction: .playback)
@ -78,8 +78,7 @@ class Volume: StoreSubscriber {
Application.ignoreNextVolumeEvent = false
Application.ignoreNextDriverMuteEvent = false
mixer.pan = Float(gain)
Console.log(mixer.pan)
Console.log("Boost: \(booster.globalGain) Mix: \(mixer.pan)")
}
}
@ -172,10 +171,10 @@ class Volume: StoreSubscriber {
self.engine = engine
let format = engine.inputNode.inputFormat(forBus: 0)
engine.attach(booster)
engine.attach(mixer)
engine.attach(output)
engine.connect(mixer, to: output, format: format)
engine.connect(mixer, to: booster, format: format)
}
func postSetup () {