Skip to content

Commit

Permalink
Initial commit with work in progress on wav file functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcielo Bell committed Aug 31, 2020
1 parent d1c1a31 commit bc95356
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 13 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "0BAA5F49-EB7C-469B-8F0C-4C6C4FC881F8"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6538DC84-A579-4E83-A7FE-4BDF1B39235A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Xylophone/ViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1"
endingLineNumber = "1"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1CB15122-A290-4A7E-B9ED-728B4CE995CC"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Xylophone/ViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "5"
endingLineNumber = "5"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Xylophone.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
23 changes: 10 additions & 13 deletions Xylophone/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,26 @@ class ViewController: UIViewController {

//Pre-built Apple APIs manual
@IBAction func keyPressed(_ sender: UIButton) {

print("Red got pressed")
// print("Red got pressed")
playSound()
}

@IBAction func keyPressedOrange(_ sender: UIButton) {
print("Orange pressed")
}

//adding Sound functionality
func playSound() {
guard let url = Bundle.main.url(forResource: "C", withExtension: "wav") else {
return
}
guard let url = Bundle.main.url(forResource: "C", withExtension: "wav") else {return}
do {
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
try AVAudioSession.sharedInstance().setActive(true)
player = try AVAudioPlayer(contentsOf: <#T##URL#>, fileTypeHint: AVFileType.wav.rawValue)
guard let player = player else {return}
player = try AVAudioPlayer(contentsOf: url, fileTypeHint: AVFileType.wav.rawValue)

guard let player = player else { return }
player.play()
}
catch let error {
print(error.localizedDescription)
}
}
// @IBAction func keyPressedOrange(_ sender: UIButton) {
// print("Orange pressed")
// }

}

0 comments on commit bc95356

Please sign in to comment.