Skip to content

Commit

Permalink
Revert "Adds support for button release sounds"
Browse files Browse the repository at this point in the history
This reverts commit 6c76a2a.
  • Loading branch information
LitRitt committed Sep 30, 2023
1 parent 6c76a2a commit 3008c79
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 65 deletions.
2 changes: 1 addition & 1 deletion Cores/DeltaCore
8 changes: 0 additions & 8 deletions Delta.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
AC56DDF22A35F3F2007C8372 /* N64GraphicsOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC56DDF12A35F3F2007C8372 /* N64GraphicsOptions.swift */; };
AC5B25232A4F4E4B00591511 /* ExternalDisplaySceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC5B25222A4F4E4B00591511 /* ExternalDisplaySceneDelegate.swift */; };
AC60D84429D88C5400881F0B /* GridCollectionViewGameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC60D84329D88C5400881F0B /* GridCollectionViewGameCell.swift */; };
AC63E59D2AA425D5003FBBB8 /* button1-release.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = AC63E59B2AA425D5003FBBB8 /* button1-release.mp3 */; };
AC63E59E2AA425D5003FBBB8 /* button1.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = AC63E59C2AA425D5003FBBB8 /* button1.mp3 */; };
AC650A772A314DC600B3405C /* Bundle+AppIconImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC650A762A314DC600B3405C /* Bundle+AppIconImage.swift */; };
AC6DC54C2A7E8D00001B5004 /* UIApplication+TopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC6DC54B2A7E8D00001B5004 /* UIApplication+TopViewController.swift */; };
AC720C0D29FDC0C700483B47 /* libFeatures.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AC8C211F29FDAD970044748D /* libFeatures.a */; };
Expand Down Expand Up @@ -341,8 +339,6 @@
AC56DDF12A35F3F2007C8372 /* N64GraphicsOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = N64GraphicsOptions.swift; sourceTree = "<group>"; };
AC5B25222A4F4E4B00591511 /* ExternalDisplaySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalDisplaySceneDelegate.swift; sourceTree = "<group>"; };
AC60D84329D88C5400881F0B /* GridCollectionViewGameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridCollectionViewGameCell.swift; sourceTree = "<group>"; };
AC63E59B2AA425D5003FBBB8 /* button1-release.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "button1-release.mp3"; sourceTree = "<group>"; };
AC63E59C2AA425D5003FBBB8 /* button1.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = button1.mp3; sourceTree = "<group>"; };
AC650A762A314DC600B3405C /* Bundle+AppIconImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+AppIconImage.swift"; sourceTree = "<group>"; };
AC6DC54B2A7E8D00001B5004 /* UIApplication+TopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+TopViewController.swift"; sourceTree = "<group>"; };
AC7D556F2A07F7A900B66BF1 /* ImageFormat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageFormat.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -696,8 +692,6 @@
AC53406029E32139009EDF08 /* Button Sounds */ = {
isa = PBXGroup;
children = (
AC63E59B2AA425D5003FBBB8 /* button1-release.mp3 */,
AC63E59C2AA425D5003FBBB8 /* button1.mp3 */,
ACCDD48A2A63864E0034A6C0 /* tock.mp3 */,
ACCDD4842A6386020034A6C0 /* beep.mp3 */,
ACCDD4832A6386020034A6C0 /* click.mp3 */,
Expand Down Expand Up @@ -1545,7 +1539,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AC63E59D2AA425D5003FBBB8 /* button1-release.mp3 in Resources */,
D5D797E9298DCC7300738869 /* cheatbase.zip in Resources */,
B57FE4F12A98930B00C5E989 /* Build.xcconfig in Resources */,
BFFA71E21AAC406100EE9DD1 /* Main.storyboard in Resources */,
Expand All @@ -1557,7 +1550,6 @@
BF02D5DA1DDEBB3000A5E131 /* openvgdb.sqlite in Resources */,
ACCDD4862A6386020034A6C0 /* snap.mp3 in Resources */,
AC503F6329B2C709005B27DD /* Updates.plist in Resources */,
AC63E59E2AA425D5003FBBB8 /* button1.mp3 in Resources */,
ACCDD48B2A63864E0034A6C0 /* tock.mp3 in Resources */,
ACCDD4872A6386020034A6C0 /* click.mp3 in Resources */,
D53415A7298C78BC00FD67B1 /* Contributors.plist in Resources */,
Expand Down
39 changes: 0 additions & 39 deletions Delta/Emulation/GameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ class GameViewController: DeltaCore.GameViewController

private var buttonSoundFile: AVAudioFile?
private var buttonSoundPlayer: AVAudioPlayer?
private var buttonSoundReleasedFile: AVAudioFile?
private var buttonSoundReleasedPlayer: AVAudioPlayer?

private var isGyroActive = false
private var presentedGyroAlert = false
Expand Down Expand Up @@ -939,23 +937,6 @@ private extension GameViewController
try self.buttonSoundFile = AVAudioFile(forReading: buttonSoundURL)
try self.buttonSoundPlayer = AVAudioPlayer(contentsOf: buttonSoundURL)

if TouchFeedbackFeatures.shared.touchAudio.playOnRelease,
sound.hasReleaseSound
{
guard let buttonSoundReleasedURL = Bundle.main.url(forResource: sound.fileName + "-release", withExtension: sound.fileExtension) else
{
fatalError("Audio file not found")
}

try self.buttonSoundReleasedFile = AVAudioFile(forReading: buttonSoundReleasedURL)
try self.buttonSoundReleasedPlayer = AVAudioPlayer(contentsOf: buttonSoundReleasedURL)
}
else
{
self.buttonSoundReleasedFile = nil
self.buttonSoundReleasedPlayer = nil
}

self.buttonSoundPlayer?.volume = Float(TouchFeedbackFeatures.shared.touchAudio.buttonVolume)
}
catch
Expand All @@ -973,16 +954,6 @@ private extension GameViewController
core.audioManager.playButtonSound(buttonSoundFile)
}
}

self.controllerView.buttonReleasedHandler = { [weak self] () in
if TouchFeedbackFeatures.shared.touchAudio.isEnabled,
TouchFeedbackFeatures.shared.touchAudio.playOnRelease,
let core = self?.emulatorCore,
let buttonSoundReleasedFile = self?.buttonSoundReleasedFile
{
core.audioManager.playButtonSound(buttonSoundReleasedFile)
}
}
}
else
{
Expand All @@ -994,16 +965,6 @@ private extension GameViewController
buttonSoundPlayer.play()
}
}

self.controllerView.buttonReleasedHandler = { [weak self] () in
if TouchFeedbackFeatures.shared.touchAudio.isEnabled,
TouchFeedbackFeatures.shared.touchAudio.playOnRelease,
let core = self?.emulatorCore,
let buttonSoundReleasedPlayer = self?.buttonSoundReleasedPlayer
{
buttonSoundReleasedPlayer.play()
}
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion Delta/Features/Advanced/PowerUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ extension PowerUserOptions
TouchFeedbackFeatures.shared.touchVibration.releaseEnabled = true

case .touchAudio:
TouchFeedbackFeatures.shared.touchAudio.sound = .button1
TouchFeedbackFeatures.shared.touchAudio.sound = .tock
TouchFeedbackFeatures.shared.touchAudio.useGameVolume = true
TouchFeedbackFeatures.shared.touchAudio.buttonVolume = 1.0

Expand Down
18 changes: 2 additions & 16 deletions Delta/Features/TouchFeedback/TouchFeedbackAudio.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ enum TouchFeedbackSound: String, CaseIterable, CustomStringConvertible
case snap = "Snap"
case click = "Click"
case beep = "Beep"
case button1 = "Button 1"

var description: String
{
Expand All @@ -34,24 +33,14 @@ extension TouchFeedbackSound
case .snap: return "snap"
case .click: return "click"
case .beep: return "beep"
case .button1: return "button1"
}
}

var hasReleaseSound: Bool
{
switch self
{
case .tock, .snap, .click, .beep: return false
case .button1: return true
}
}

var fileExtension: String
{
switch self
{
case .tock, .snap, .click, .beep, .button1: return "mp3"
case .tock, .snap, .click, .beep: return "mp3"
}
}
}
Expand All @@ -66,10 +55,7 @@ extension TouchFeedbackSound: LocalizedOptionValue
struct TouchFeedbackAudioOptions
{
@Option(name: "Sound", description: "Choose the sound to play.", values: TouchFeedbackSound.allCases)
var sound: TouchFeedbackSound = .button1

@Option(name: "Play on Button Release", description: "Play a sound on button release as well as button press. Some sounds have different press and release sounds and some don't.")
var playOnRelease: Bool = true
var sound: TouchFeedbackSound = .tock

@Option(name: "Use Game Volume", description: "When enabled, sounds will play at the same volume as gameplay. When disabled, sounds will play at the volume specified below.")
var useGameVolume: Bool = true
Expand Down
Binary file removed Resources/Button Sounds/button1-release.mp3
Binary file not shown.
Binary file removed Resources/Button Sounds/button1.mp3
Binary file not shown.

0 comments on commit 3008c79

Please sign in to comment.