Skip to content

Commit 63299b8

Browse files
committed
added reset playback button, stability improvements, fixed preset import
1 parent 277007c commit 63299b8

10 files changed

Lines changed: 44 additions & 31 deletions

File tree

native/app/Source/Application.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ class Application {
265265
Driver.device!.setVirtualMasterVolume(volume > 1 ? 1 : Float32(volume), direction: .playback)
266266
Driver.latency = selectedDevice.latency(direction: .playback) ?? 0 // Set driver latency to mimic device
267267
Driver.safetyOffset = selectedDevice.safetyOffset(direction: .playback) ?? 0 // Set driver latency to mimic device
268+
let outputSampleRate = selectedDevice.actualSampleRate()!
269+
let driverSampleRates = Driver.sampleRates
270+
let closestSampleRate = driverSampleRates.min( by: { abs($0 - outputSampleRate) < abs($1 - outputSampleRate) } )!
271+
Driver.device!.setNominalSampleRate(closestSampleRate)
272+
273+
Console.log("Driver new Latency: \(Driver.latency)")
274+
Console.log("Driver new Safety Offset: \(Driver.safetyOffset)")
275+
Console.log("Driver new Sample Rate: \(Driver.device!.actualSampleRate())")
268276

269277
AudioDevice.currentOutputDevice = Driver.device!
270278
// TODO: Figure out a better way
@@ -274,12 +282,7 @@ class Application {
274282
}
275283

276284
private static func createAudioPipeline () {
277-
Sources() { sources in
278-
let outputSampleRate = selectedDevice.actualSampleRate()!
279-
let driverSampleRates = Driver.sampleRates
280-
let closestSampleRate = driverSampleRates.min( by: { abs($0 - outputSampleRate) < abs($1 - outputSampleRate) } )!
281-
Driver.device!.setNominalSampleRate(closestSampleRate)
282-
285+
_ = Sources() { sources in
283286
self.sources = sources
284287
effects = Effects()
285288
volume = Volume()

native/app/Source/Audio/Effects/Equalizers/Advanced/AdvancedEqualizerDataBus.swift

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,30 @@ class AdvancedEqualizerDataBus: DataBus {
127127
}
128128

129129
if let json = try? String(contentsOf: file!) {
130-
let presets = JSON(parseJSON: json).arrayObject as! [[String: Any]]
131-
for var preset in presets {
132-
let bands = preset["gains"] as? [Double]
133-
let name = preset["name"] as? String
134-
135-
if (bands == nil || bands?.count != 10 || name == nil) {
136-
res.error("Invalid import file. Must be an array of objects of type { gains: Double[10], name: String }")
137-
return
130+
let presets = JSON(parseJSON: json).arrayValue
131+
for preset in presets {
132+
if let gains = preset["gains"].dictionary, let name = preset["name"].string {
133+
let global = gains["global"]?.double
134+
if let bands = gains["bands"]?.arrayObject as? [Double] {
135+
if preset["id"].string == "manual" {
136+
AdvancedEqualizer.updatePreset(id: "manual", gains: AdvancedEqualizerPresetGains(
137+
global: global ?? 0, bands: bands
138+
))
139+
} else {
140+
_ = AdvancedEqualizer.createPreset(name: name, gains: AdvancedEqualizerPresetGains(
141+
global: global ?? 0, bands: bands
142+
))
143+
}
144+
145+
}
138146
}
139-
140-
_ = AdvancedEqualizer.createPreset(name: name!, gains: AdvancedEqualizerPresetGains(
141-
global: 0, bands: bands!
142-
))
143147
}
144-
145148
res.send("Presets imported.")
146149
} else {
147150
res.error("File is not readable format.")
148151
}
149152

150-
153+
151154
}
152155
return nil
153156
}

native/app/Source/Audio/Outputs/OutputsDataBus.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ class OutputsDataBus: DataBus {
2727
self.on(.POST, "/selected") { data, _ in
2828
if let id = data["id"] as? AudioDeviceID {
2929
if let device = AudioDevice.lookup(by: id) {
30-
if (device.id != Outputs.current) {
3130
Application.selectOutput(device: device)
3231
return "Output Selected"
33-
}
34-
throw "This device is already playing"
3532
}
3633
throw "Device with such ID doesn't exist"
3734
}

native/driver/Driver.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@
634634
COMBINE_HIDPI_IMAGES = YES;
635635
DEBUG_INFORMATION_FORMAT = dwarf;
636636
DEVELOPMENT_TEAM = JZA6C97KJA;
637-
GCC_C_LANGUAGE_STANDARD = "compiler-default";
637+
GCC_C_LANGUAGE_STANDARD = c11;
638638
GCC_DYNAMIC_NO_PIC = NO;
639639
GCC_ENABLE_CPP_RTTI = NO;
640640
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -673,7 +673,7 @@
673673
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
674674
DEVELOPMENT_TEAM = JZA6C97KJA;
675675
ENABLE_NS_ASSERTIONS = NO;
676-
GCC_C_LANGUAGE_STANDARD = "compiler-default";
676+
GCC_C_LANGUAGE_STANDARD = c11;
677677
GCC_ENABLE_CPP_RTTI = NO;
678678
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
679679
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Lines changed: 7 additions & 0 deletions
Loading

ui/src/app/modules/eqmac-components/components/dropdown/dropdown.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export class DropdownComponent implements OnInit {
4545
async ngOnInit () {
4646
if (!this.items) this.items = []
4747
if (!this.selectedItem && this.items.length > 0) {
48-
this.selectItem(this.items[0])
48+
this.selectedItem = this.items[0]
49+
this.label = null
4950
}
5051
this.setDimensions()
5152
this.calculateYCoordinate()

ui/src/app/modules/eqmac-components/components/knob/knob.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ export class KnobComponent implements OnInit {
152152
this.dragStartDegr = degrees
153153
const multiplier = (() => {
154154
switch (this.size) {
155-
case 'large': return 110
155+
case 'large': return 250
156156
case 'medium': return 220
157-
case 'small': return 400
157+
case 'small': return 600
158158
default: return 220
159159
}
160160
})()

ui/src/app/modules/eqmac-components/components/tooltip/tooltip.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TooltipPositionSide } from './tooltip.component'
77
})
88
export class TooltipDirective implements OnDestroy {
99
@Input() eqmTooltip = ''
10-
@Input() eqmTooltipDelay = 1000
10+
@Input() eqmTooltipDelay = 100
1111
@Input() eqmTooltipPositionSide: TooltipPositionSide = 'top'
1212
@Input() eqmTooltipShowArrow: boolean = true
1313
private id: string

ui/src/app/sections/effects/equalizers/advanced-equalizer/advanced-equalizer.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
142142
protected setupEvents () {
143143
this.service.onPresetsChanged(presets => {
144144
if (!presets) return
145+
console.log('new presets', presets)
145146
this.presets = presets
146147
})
147148
this.service.onSelectedPresetChanged(preset => {

ui/src/app/sections/outputs/outputs.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<div fxFill class="outputs" fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="10px">
2-
<eqm-vent fxFlex="20"></eqm-vent>
2+
<!-- <eqm-vent fxFlex="20"></eqm-vent> -->
3+
<eqm-icon (click)="select(selected)" name="reset" color="#4f8d71" eqmTooltip="Reset playback" eqmTooltipPositionSide="top"></eqm-icon>
34
<eqm-dropdown
4-
fxFlex="55" labelParam="name" noItemsPlaceholder="No Outputs" placeholder="Select Output"
5+
labelParam="name" noItemsPlaceholder="No Outputs" placeholder="Select Output"
56
[items]="outputs" [(selectedItem)]="selected" (itemSelected)="select($event)"
67
></eqm-dropdown>
78
<eqm-vent fxFlex="20"></eqm-vent>

0 commit comments

Comments
 (0)