diff --git a/A2Mac/Base.lproj/Main.storyboard b/A2Mac/Base.lproj/Main.storyboard
index a30356d..0e3c53e 100644
--- a/A2Mac/Base.lproj/Main.storyboard
+++ b/A2Mac/Base.lproj/Main.storyboard
@@ -1466,10 +1466,11 @@
-
-
-
-
+
+
+
+
+
@@ -1661,7 +1662,7 @@
-
+
@@ -2132,13 +2133,18 @@
-
+
+
+
+
+
+
diff --git a/A2Mac/ToolBarController.swift b/A2Mac/ToolBarController.swift
index d18f84d..c43a3ca 100644
--- a/A2Mac/ToolBarController.swift
+++ b/A2Mac/ToolBarController.swift
@@ -80,7 +80,7 @@ class ToolBarController: NSWindowController {
@IBOutlet weak var SpeedSelector: NSToolbarItem!
- @IBAction func SpeedSelect(_ slider: NSSlider) {
+ @IBAction func SpeedSelected(_ slider: NSSliderCell) {
switch slider.intValue {
case 2:
ViewController.current?.setCPUClockSpeed(freq: 2)
@@ -103,7 +103,7 @@ class ToolBarController: NSWindowController {
SpeedSelector.label = "MAX Speed"
default:
- ViewController.current?.setCPUClockSpeed(freq: 1.023)
+ ViewController.current?.setCPUClockSpeed(freq: 14.31818 / 14.0)
SpeedSelector.label = "1.023 MHz"
}
}
diff --git a/A2Mac/ViewController.swift b/A2Mac/ViewController.swift
index 8d66a84..fbec9a1 100644
--- a/A2Mac/ViewController.swift
+++ b/A2Mac/ViewController.swift
@@ -1047,6 +1047,18 @@ class ViewController: NSViewController {
newUpdateTimer( timeInterval: 1 / Double(fps) )
// #endif
+
+ soundGapSlider.integerValue = Int(spkr_extra_buf)
+ ledingInitEdgeLabel.title = "ILE: " + String( SPKR_INITIAL_LEADING_EDGE )
+ initialLeadEdgeSlider.floatValue = SPKR_INITIAL_LEADING_EDGE
+ leadingEdgeLabel.title = "LE: " + String( SPKR_FADE_LEADING_EDGE )
+ leadEdgeSlider.floatValue = SPKR_FADE_LEADING_EDGE
+ trailingInitEdgeLabel.title = "ITE: " + String( SPKR_INITIAL_TRAILING_EDGE )
+ initialTailEdgeSlider.floatValue = SPKR_INITIAL_TRAILING_EDGE
+ trailingEdgeLabel.title = "TE: " + String( SPKR_FADE_TRAILING_EDGE )
+ tailEdgeSlider.floatValue = SPKR_FADE_TRAILING_EDGE
+
+
}
override func viewDidAppear() {
@@ -1061,49 +1073,40 @@ class ViewController: NSViewController {
MHz_6502 = freq
clk_6502_per_frm = UInt64( MHz_6502 * M / Double(fps) )
clk_6502_per_frm_set = clk_6502_per_frm
- }
-
- @IBAction func speedSelected(_ sender: NSButton) {
- if ( sender.title == "MAX" ) {
- setCPUClockSpeed(freq: 2000)
- }
- else if let freq = Double( sender.title ) {
- setCPUClockSpeed(freq: freq)
+
+ // TODO: Probably this is not the best way to deal with the problem: To make sound continous independent of FPS and Freq
-
- // TODO: Probably this is not the best way to deal with the problem: To make sound continous independent of FPS and Freq
-
// spkr_extra_buf = Int32( 780 / fps )
- spkr_extra_buf = 26
-
- switch freq {
- case 2.0:
+ spkr_extra_buf = 0 // 26
+
+ switch freq {
+ case 2.0:
// spkr_extra_buf = Int32( Double(spkr_extra_buf) * 2.961538461538462 ) // normally it should come up as 77, but this way it is calculated with FPS
// spkr_extra_buf = 20
- spkr_extra_buf = 88
- break
-
- case 4.0:
+ spkr_extra_buf = 88
+ break
+
+ case 4.0:
// spkr_extra_buf = Int32( Double(spkr_extra_buf) * 1.346153846153846 ) // normally it should come up as 35, but this way it is calculated with FPS
// spkr_extra_buf = 45
- spkr_extra_buf = 20
- break
-
- default:
+ spkr_extra_buf = 20
+ break
+
+ default:
// spkr_extra_buf = Int32( 780 / fps ) // normally it should come up as 26, but this way it is calculated with FPS
- spkr_extra_buf = 26
- break
- }
-
- SoundGap.integerValue = Int(spkr_extra_buf)
+ spkr_extra_buf = 0 // 26
+ break
}
-
+
+ soundGapLabel.title = String( spkr_extra_buf )
+ soundGapSlider.integerValue = Int(spkr_extra_buf)
}
+
- @IBOutlet weak var lab: NSTextFieldCell!
+ @IBOutlet weak var soundGapLabel: NSTextFieldCell!
@IBAction func extraBuf(_ sender: NSSlider) {
spkr_extra_buf = sender.intValue
- lab.title = String( spkr_extra_buf )
+ soundGapLabel.title = String( spkr_extra_buf )
}
@IBOutlet weak var ledingInitEdgeLabel: NSTextFieldCell!
@@ -1172,12 +1175,18 @@ class ViewController: NSViewController {
setSimulationMode(mode: sender.selectedItem?.title ?? "Normal" )
}
- @IBOutlet weak var SoundGap: NSTextFieldCell!
-
- @IBAction func SoundGapChanged(_ sender: NSStepper) {
- SoundGap.integerValue = sender.integerValue
- spkr_extra_buf = Int32( sender.integerValue )
- }
+ @IBOutlet weak var initialLeadEdgeSlider: NSSlider!
+ @IBOutlet weak var leadEdgeSlider: NSSlider!
+ @IBOutlet weak var initialTailEdgeSlider: NSSlider!
+ @IBOutlet weak var tailEdgeSlider: NSSlider!
+ @IBOutlet weak var soundGapSlider: NSSlider!
+
+// @IBOutlet weak var soundGap: NSTextFieldCell!
+//
+// @IBAction func SoundGapChanged(_ sender: NSStepper) {
+// SoundGap.integerValue = sender.integerValue
+// spkr_extra_buf = Int32( sender.integerValue )
+// }
@IBAction func CRTMonitorOnOff(_ sender: NSButton) {
CRTMonitor = sender.state == .on
diff --git a/src/dev/audio/speaker.h b/src/dev/audio/speaker.h
index 553ce9b..f175379 100644
--- a/src/dev/audio/speaker.h
+++ b/src/dev/audio/speaker.h
@@ -61,7 +61,7 @@ extern float SPKR_INITIAL_LEADING_EDGE; // leading edge should be pretty steep t
extern float SPKR_INITIAL_TRAILING_EDGE; // need a bit of slope to get Xonix sound good
-#define SPKR_SAMPLE_PWM_THRESHOLD 12 // to detect PWM controlled speaker control like in Wavy Navy or Xonix
+#define SPKR_SAMPLE_PWM_THRESHOLD 8 // to detect PWM controlled speaker control like in Wavy Navy or Xonix