- Fixed Sound Issues

- Fixed Screen Zooming Issues
This commit is contained in:
tudnai
2021-11-12 19:25:18 -08:00
parent 09af65f863
commit e750244355
6 changed files with 129 additions and 71 deletions
+6
View File
@@ -62,6 +62,8 @@
326B56E724AD906D009BA0AC /* doc.text.viewfinder.png in Copy Image Files */ = {isa = PBXBuildFile; fileRef = 326B56E624AD906D009BA0AC /* doc.text.viewfinder.png */; };
3277D779273AE0DA00749544 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
3277D783273AE0DC00749544 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
3277D7A3273C603600749544 /* DisplayScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3277D7A2273C603600749544 /* DisplayScrollView.swift */; };
3277D7A4273C603600749544 /* DisplayScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3277D7A2273C603600749544 /* DisplayScrollView.swift */; };
32799F7A264B1A5700255669 /* DisplayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32544194264A6C1600B7E3ED /* DisplayView.swift */; };
32799F7B264B1A5700255669 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
32799F7C264B1A5700255669 /* ToolBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32E3126C24AC033A00E61891 /* ToolBarController.swift */; };
@@ -630,6 +632,7 @@
326B56E424AD8E89009BA0AC /* gobackward.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gobackward.png; sourceTree = "<group>"; };
326B56E624AD906D009BA0AC /* doc.text.viewfinder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = doc.text.viewfinder.png; sourceTree = "<group>"; };
326ED2EE232D7A0000A41337 /* 6502_functional_test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = 6502_functional_test.bin; path = Resources/rom/6502_functional_test.bin; sourceTree = SOURCE_ROOT; };
3277D7A2273C603600749544 /* DisplayScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayScrollView.swift; sourceTree = "<group>"; };
32799FDA264B1A5700255669 /* Steve ][ Debug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Steve ][ Debug.app"; sourceTree = BUILT_PRODUCTS_DIR; };
32799FDB264B1A5700255669 /* Steve ][ copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Steve ][ copy-Info.plist"; path = "/Users/trudnai/Dropbox/Projects/A2Mac/Steve ][ copy-Info.plist"; sourceTree = "<absolute>"; };
32877F8C24ADA6AF003A940D /* joystick.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = joystick.png; sourceTree = "<group>"; };
@@ -1117,6 +1120,7 @@
32439F7222ECD8AC0077AAE0 /* A2Mac-Bridging-Header.h */,
32E3126C24AC033A00E61891 /* ToolBarController.swift */,
3267641724BCC9A5000BEA11 /* COPYING */,
3277D7A2273C603600749544 /* DisplayScrollView.swift */,
);
path = A2Mac;
sourceTree = "<group>";
@@ -1566,6 +1570,7 @@
32799F88264B1A5700255669 /* RepeatingTimer.swift in Sources */,
32A6AAFA266AEDF50023257A /* mmio.c in Sources */,
32799F8A264B1A5700255669 /* MonitorView.swift in Sources */,
3277D7A4273C603600749544 /* DisplayScrollView.swift in Sources */,
32A6AB25266B19680023257A /* hires.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1592,6 +1597,7 @@
32C45306232E3EEF0000EBA1 /* RepeatingTimer.swift in Sources */,
32A6AAF0266AEDF40023257A /* mmio.c in Sources */,
32C4532E233345430000EBA1 /* MonitorView.swift in Sources */,
3277D7A3273C603600749544 /* DisplayScrollView.swift in Sources */,
32A6AB1B266B19680023257A /* hires.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -638,20 +638,20 @@
<ContextState
contextName = "spkr_toggle:speaker.c">
<PersistentStrings>
<PersistentString
value = "( (spkr_clk + m6502.clkfrm) / ( default_MHz_6502 * 1000 * 1000 / spkr_sample_rate)) * 2">
</PersistentString>
<PersistentString
value = "(int16_t)28000 + (int16_t)-32768">
</PersistentString>
<PersistentString
value = "spkr_level">
value = "default_MHz_6502 * 1000 * 1000 / spkr_sample_rate">
</PersistentString>
<PersistentString
value = "( (spkr_clk + m6502.clkfrm) / ( 1024000 / spkr_sample_rate ) ) * 2">
</PersistentString>
<PersistentString
value = "spkr_sample_idx">
</PersistentString>
<PersistentString
value = "28000 + fadeLevel">
value = "(spkr_clk + m6502.clkfrm)">
</PersistentString>
<PersistentString
value = "spkr_samples[spkr_sample_last_idx]">
@@ -883,6 +883,14 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "MonitorView.adjustTextDisplaySize():MonitorView.swift">
<PersistentStrings>
<PersistentString
value = "frame.size">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "read_rom:6502.c">
<PersistentStrings>
+23 -23
View File
@@ -1686,8 +1686,8 @@
<rect key="frame" x="0.0" y="0.0" width="1288" height="800"/>
<subviews>
<textField identifier="Display Background" focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" mirrorLayoutDirectionWhenInternationalizing="never" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iIF-Q5-Onc">
<rect key="frame" x="0.0" y="0.0" width="1168" height="800"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" refusesFirstResponder="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" focusRingType="none" baseWritingDirection="leftToRight" title="Display Background" drawsBackground="YES" id="cIa-Sd-4OZ">
<rect key="frame" x="0.0" y="0.0" width="1152" height="800"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" refusesFirstResponder="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" focusRingType="none" baseWritingDirection="leftToRight" drawsBackground="YES" id="cIa-Sd-4OZ">
<font key="font" metaFont="system"/>
<color key="textColor" red="0.078431372549019607" green="0.10980392156862745" blue="0.078431372549019607" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.078431372549019607" green="0.10980392156862745" blue="0.078431372549019607" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -1697,17 +1697,17 @@
</textFieldCell>
</textField>
<scrollView hidden="YES" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" borderType="none" horizontalLineScroll="0.0" horizontalPageScroll="0.0" verticalLineScroll="0.0" verticalPageScroll="0.0" hasHorizontalScroller="NO" hasVerticalScroller="NO" minMagnification="1" translatesAutoresizingMaskIntoConstraints="NO" id="ss1-M1-nGn" userLabel="Scroll View - Display View" customClass="DisplayScrollView" customModule="Steve___" customModuleProvider="target">
<rect key="frame" x="11" y="16" width="1146" height="768"/>
<rect key="frame" x="11" y="16" width="1130" height="768"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="1wa-ZE-lex">
<rect key="frame" x="0.0" y="0.0" width="1146" height="768"/>
<rect key="frame" x="0.0" y="0.0" width="1130" height="768"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="ccC-Wu-3za" userLabel="Display" customClass="DisplayView" customModule="Steve___" customModuleProvider="target">
<rect key="frame" x="0.0" y="-224" width="1146" height="768"/>
<rect key="frame" x="0.0" y="-224" width="1130" height="768"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="1146" height="768"/>
<size key="minSize" width="1130" height="768"/>
<size key="maxSize" width="3840" height="2160"/>
<attributedString key="textStorage">
<fragment>
@@ -1766,21 +1766,21 @@
</scroller>
</scrollView>
<customView hidden="YES" focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Gqh-qw-fjy" userLabel="LoRes" customClass="LoRes" customModule="Steve___" customModuleProvider="target">
<rect key="frame" x="16" y="16" width="1136" height="768"/>
<rect key="frame" x="16" y="16" width="1120" height="768"/>
</customView>
<customView hidden="YES" focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="LlM-EV-ruZ" userLabel="HiRes" customClass="HiRes" customModule="Steve___" customModuleProvider="target">
<rect key="frame" x="16" y="16" width="1136" height="768"/>
<rect key="frame" x="16" y="16" width="1120" height="768"/>
</customView>
<imageView hidden="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="dGn-a4-c1t" userLabel="ScanLines">
<rect key="frame" x="16" y="16" width="1136" height="768"/>
<rect key="frame" x="16" y="16" width="1120" height="768"/>
<imageCell key="cell" refusesFirstResponder="YES" focusRingType="none" alignment="left" imageScaling="axesIndependently" image="scanlines" id="jJ6-qt-oZe"/>
</imageView>
<imageView hidden="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" alphaValue="0.0" translatesAutoresizingMaskIntoConstraints="NO" id="Ghs-c1-ZkA" userLabel="DotmatrixEffect">
<rect key="frame" x="16" y="16" width="1136" height="768"/>
<rect key="frame" x="16" y="16" width="1120" height="768"/>
<imageCell key="cell" refusesFirstResponder="YES" focusRingType="none" alignment="left" imageScaling="axesIndependently" image="dotmatrix_effect" id="nPr-Un-zjz"/>
</imageView>
<customView focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="D0w-YC-YlJ" userLabel="Splash Screen">
<rect key="frame" x="16" y="16" width="1136" height="768"/>
<rect key="frame" x="16" y="16" width="1120" height="768"/>
<subviews>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9jr-eX-yOC">
<rect key="frame" x="14" y="711" width="291" height="41"/>
@@ -1823,7 +1823,7 @@
</textFieldCell>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bUo-E1-CYC">
<rect key="frame" x="876" y="16" width="246" height="13"/>
<rect key="frame" x="860" y="16" width="246" height="13"/>
<textFieldCell key="cell" lineBreakMode="clipping" refusesFirstResponder="YES" focusRingType="none" title="© by Tamas Rudnai, 2020" id="tm6-Cq-r7H">
<font key="font" size="12" name="PrintChar21"/>
<color key="textColor" red="0.18823529411764706" green="0.83529411764705885" blue="0.84705882352941175" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -1831,7 +1831,7 @@
</textFieldCell>
</textField>
<imageView focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="M1E-lz-4q8" userLabel="Splash Logo">
<rect key="frame" x="421" y="199" width="384" height="308"/>
<rect key="frame" x="413" y="199" width="384" height="308"/>
<imageCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" focusRingType="none" alignment="left" imageScaling="proportionallyUpOrDown" image="imageCell:Zax-kI-rxd:image" id="Zax-kI-rxd"/>
</imageView>
</subviews>
@@ -1861,13 +1861,13 @@
</constraints>
</customView>
<customView identifier="Side Panel" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="Fdf-pv-iEw" userLabel="Side Panel">
<rect key="frame" x="1176" y="8" width="104" height="784"/>
<rect key="frame" x="1160" y="8" width="120" height="784"/>
<subviews>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" spacing="-20" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5gO-h7-NcU" userLabel="Prefipheries">
<rect key="frame" x="0.0" y="598" width="104" height="186"/>
<rect key="frame" x="0.0" y="598" width="120" height="186"/>
<subviews>
<popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="49f-8R-QCc">
<rect key="frame" x="0.0" y="83" width="104" height="103"/>
<rect key="frame" x="0.0" y="83" width="120" height="103"/>
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:CNs-lh-urM:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" id="CNs-lh-urM">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -1901,8 +1901,8 @@
</connections>
</popUpButton>
<popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="QDr-Cp-9QQ">
<rect key="frame" x="0.0" y="0.0" width="104" height="103"/>
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:CNs-lh-urM:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" selectedItem="vmR-CG-qdv" id="8FA-1D-k8p">
<rect key="frame" x="0.0" y="0.0" width="120" height="103"/>
<popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" image="popUpButtonCell:CNs-lh-urM:image" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" inset="2" pullsDown="YES" arrowPosition="noArrow" altersStateOfSelectedItem="NO" selectedItem="28N-X8-n7Q" id="8FA-1D-k8p">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="8He-mk-LVI">
@@ -1935,8 +1935,8 @@
</connections>
</popUpButton>
<button hidden="YES" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="T0r-xy-OJF">
<rect key="frame" x="0.0" y="87" width="104" height="99"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="Disk 2" imagePosition="only" alignment="center" refusesFirstResponder="YES" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="z4y-xq-1UN">
<rect key="frame" x="0.0" y="87" width="120" height="99"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="Disk 2" imagePosition="only" alignment="center" enabled="NO" refusesFirstResponder="YES" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="z4y-xq-1UN">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@@ -1958,7 +1958,7 @@
</customSpacing>
</stackView>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lVP-FP-u6x" userLabel="CPU Speed Selection">
<rect key="frame" x="8" y="8" width="88" height="292"/>
<rect key="frame" x="8" y="8" width="104" height="292"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Kym-qZ-Ch2">
<rect key="frame" x="-2" y="276" width="56" height="18"/>
@@ -2043,7 +2043,7 @@
</textField>
<slider focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="64O-qO-cQV">
<rect key="frame" x="-2" y="32" width="92" height="19"/>
<sliderCell key="cell" continuous="YES" refusesFirstResponder="YES" state="on" focusRingType="none" alignment="left" maxValue="64" tickMarkPosition="above" sliderType="linear" id="hxk-WO-tJf"/>
<sliderCell key="cell" continuous="YES" refusesFirstResponder="YES" state="on" focusRingType="none" alignment="left" minValue="-64" maxValue="64" tickMarkPosition="above" sliderType="linear" id="hxk-WO-tJf"/>
<connections>
<action selector="extraBuf:" target="XfG-lQ-9wD" id="gEu-yg-udY"/>
</connections>
@@ -2131,7 +2131,7 @@
<constraint firstItem="dGn-a4-c1t" firstAttribute="trailing" secondItem="ss1-M1-nGn" secondAttribute="trailing" constant="-5" id="XM9-i5-GOP"/>
<constraint firstItem="Fdf-pv-iEw" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="8" id="Xbh-Ub-1Ng"/>
<constraint firstAttribute="bottom" secondItem="iIF-Q5-Onc" secondAttribute="bottom" identifier="Display Background Bottom" id="acb-Dy-fu5"/>
<constraint firstAttribute="trailing" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="120" identifier="Display Background Trailing" id="dO5-Md-6fz"/>
<constraint firstAttribute="trailing" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="136" identifier="Display Background Trailing" id="dO5-Md-6fz"/>
<constraint firstItem="LlM-EV-ruZ" firstAttribute="top" secondItem="ss1-M1-nGn" secondAttribute="top" id="lDs-jy-edU"/>
<constraint firstItem="LlM-EV-ruZ" firstAttribute="bottom" secondItem="ss1-M1-nGn" secondAttribute="bottom" id="ltj-Ea-Vtb"/>
<constraint firstItem="iIF-Q5-Onc" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" identifier="Display Background Top" id="m3e-ww-N7S"/>
+21 -5
View File
@@ -27,23 +27,39 @@ class MonitorView: NSView {
@IBOutlet var textDisplay: DisplayView!
let textViewBounds = NSSize(width: 1130, height: 768)
var textDisplay_boundsSize = NSSize()
var textDisplay_width_diff : CGFloat?
var textDisplay_height_diff : CGFloat?
@objc func frameDidChange(notification: NSNotification) {
override func viewDidMoveToWindow() {
print("Added to NEW window")
}
func adjustTextDisplaySize() {
var textFrameSize = frame.size
textFrameSize.width += 1
if textDisplay_width_diff == nil {
textDisplay_width_diff = textFrameSize.width - textDisplay.frame.width
textDisplay_height_diff = textFrameSize.height - textDisplay.frame.height
textDisplay_boundsSize = textDisplay.bounds.size
}
textFrameSize.width -= textDisplay_width_diff!
textFrameSize.height -= textDisplay_height_diff!
textDisplay.setFrameSize(textFrameSize)
textDisplay.setBoundsSize(textDisplay_boundsSize)
// BUGFIX: I am not sure why but if I do not adjust the frame and bounds size
// couple of times, Cocoa miscalculates them
for _ in 0...5 {
textDisplay.setFrameSize(textFrameSize)
textDisplay.setBoundsSize(textViewBounds)
}
}
@objc func frameDidChange(notification: NSNotification) {
adjustTextDisplaySize()
}
required init?(coder: NSCoder) {
+50 -30
View File
@@ -32,21 +32,29 @@ class ToolBarController: NSWindowController, NSWindowDelegate {
}
var sideBarWidth = CGFloat()
func windowWillEnterFullScreen(_ notification: Notification) {
func setDisplaySize(
leading: CGFloat,
trailing: CGFloat,
top: CGFloat,
bottom: CGFloat,
sidePanelSize: CGFloat,
sidePanelHidden: Bool
) {
if let view = window?.contentView {
for constraint in view.constraints {
switch constraint.identifier {
case "Display Background Trailing":
constraint.constant = 0
constraint.constant = sidePanelSize
case "Display Margin Leading":
constraint.constant = 0
constraint.constant = leading
case "Display Margin Trailing":
constraint.constant = 0
constraint.constant = trailing
case "Display Margin Top":
constraint.constant = 0
constraint.constant = top
case "Display Margin Bottom":
constraint.constant = 0
constraint.constant = bottom
default:
continue
}
@@ -54,36 +62,48 @@ class ToolBarController: NSWindowController, NSWindowDelegate {
for subview in view.subviews {
if subview.identifier?.rawValue == "Side Panel" {
subview.isHidden = true
subview.isHidden = sidePanelHidden
}
}
}
}
func setDisplayFullscreen() {
print("setDisplayFullscreen")
setDisplaySize(
leading: 0,
trailing: 0,
top: 0,
bottom: 0,
sidePanelSize: 0,
sidePanelHidden: true
)
}
func setDisplayWindowed() {
print("setDisplayWindowed")
setDisplaySize(
leading: 11,
trailing: 11,
top: 16,
bottom: -16,
sidePanelSize: 136,
sidePanelHidden: false
)
}
func windowWillEnterFullScreen(_ notification: Notification) {
setDisplayFullscreen()
}
func windowWillExitFullScreen(_ notification: Notification) {
if let view = window?.contentView {
for constraint in view.constraints {
switch constraint.identifier {
case "Display Background Trailing":
constraint.constant = 120
case "Display Margin Leading":
constraint.constant = 11
case "Display Margin Trailing":
constraint.constant = 11
case "Display Margin Top":
constraint.constant = 16
case "Display Margin Bottom":
constraint.constant = -16
default:
continue
}
}
for subview in view.subviews {
if subview.identifier?.rawValue == "Side Panel" {
subview.isHidden = false
}
}
setDisplayWindowed()
}
override func windowDidLoad() {
let isWindowFullscreen = window?.styleMask.contains(.fullSizeContentView) ?? false
if isWindowFullscreen {
window?.toggleFullScreen(self)
}
}
+16 -8
View File
@@ -375,9 +375,9 @@ void spkr_toggle_edge ( int level_max, const float initial_edge, const float fad
float ema_len = 7;
if ( idx_diff <= SPKR_SAMPLE_PWM_THRESHOLD ) {
ema_len = 21;
ema_len = 120;
}
spkr_level = spkr_samples[ spkr_sample_idx ];
while ( fabsf(dumping) > 1 ) {
@@ -396,8 +396,8 @@ void spkr_toggle_edge ( int level_max, const float initial_edge, const float fad
}
float SPKR_FADE_LEADING_EDGE = 0.90;
float SPKR_FADE_TRAILING_EDGE = 0.90;
float SPKR_FADE_LEADING_EDGE = 0.92;
float SPKR_FADE_TRAILING_EDGE = 0.92;
float SPKR_INITIAL_LEADING_EDGE = 0.64; // leading edge should be pretty steep to get sharp sound plus to avoid Wavy Navy high pitch sound
float SPKR_INITIAL_TRAILING_EDGE = 0.64; // need a bit of slope to get Xonix sound good
@@ -420,6 +420,7 @@ void spkr_toggle() {
// push a click into the speaker buffer
// (we will play the entire buffer at the end of the frame)
spkr_sample_idx = ( (spkr_clk + m6502.clkfrm) / ( MHZ(default_MHz_6502) / spkr_sample_rate)) * SPKR_CHANNELS;
spkr_sample_idx &= UINTMAX_MAX - 1;
unsigned spkr_sample_idx_diff = spkr_sample_idx - spkr_sample_last_idx;
if ( (int)spkr_sample_idx_diff < 0 ) {
// printf("m:%u\n", spkr_sample_idx_diff);
@@ -488,7 +489,7 @@ void spkr_update() {
//spkr_samples[sample_idx] = spkr_level;
memset(spkr_samples + spkr_sample_idx, 0, spkr_extra_buf * sizeof(spkr_sample_t));
freeBuffers--;
alBufferData(spkr_buffers[freeBuffers], AL_FORMAT_STEREO16, spkr_samples, spkr_sample_idx * sizeof(spkr_sample_t), spkr_sample_rate);
al_check_error();
@@ -554,7 +555,8 @@ void spkr_update() {
break;
}
int src = spkr_buf_size + spkr_extra_buf;
int size = spkr_buf_size + spkr_extra_buf;
int src = size;
int dst = 0;
// copy the buffer leftover -- needed to finish wave form
@@ -563,11 +565,17 @@ void spkr_update() {
}
// clear the slack buffer, so we can fill it up by new data
while( dst < spkr_buf_size + spkr_extra_buf ) {
while( dst < size ) {
spkr_samples[dst++] = spkr_level;
}
spkr_sample_last_idx = 0;
if ( spkr_sample_idx >= size ) {
spkr_sample_idx -= size;
}
else {
spkr_sample_idx = 0;
}
spkr_sample_last_idx = spkr_sample_idx;
// spkr_samples[0] = 10000;