| 1 |
/* |
| 2 |
|
| 3 |
InstrumentEditorViewController.swift |
| 4 |
|
| 5 |
Nikhil Singh, Dr. Richard Boulanger |
| 6 |
Adapted from the Csound iOS Examples by Steven Yi and Victor Lazzarini |
| 7 |
|
| 8 |
This file is part of Csound iOS SwiftExamples. |
| 9 |
|
| 10 |
The Csound for iOS Library is free software; you can redistribute it |
| 11 |
and/or modify it under the terms of the GNU Lesser General Public |
| 12 |
License as published by the Free Software Foundation; either |
| 13 |
version 2.1 of the License, or (at your option) any later version. |
| 14 |
|
| 15 |
Csound is distributed in the hope that it will be useful, |
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
GNU Lesser General Public License for more details. |
| 19 |
|
| 20 |
You should have received a copy of the GNU Lesser General Public |
| 21 |
License along with Csound; if not, write to the Free Software |
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 23 |
02111-1307 USA |
| 24 |
|
| 25 |
*/ |
| 26 |
|
| 27 |
import UIKit |
| 28 |
|
| 29 |
class InstrumentEditorViewController: BaseCsoundViewController { |
| 30 |
|
| 31 |
@IBOutlet var orchestraTextView: UITextView! |
| 32 |
|
| 33 |
override func viewDidLoad() { |
| 34 |
title = "08, Instrument Tweaker" |
| 35 |
super.viewDidLoad() |
| 36 |
|
| 37 |
let csdFile = Bundle.main.path(forResource: "instrumentEditor", ofType: "csd") |
| 38 |
csound.stop() |
| 39 |
csound.play(csdFile) |
| 40 |
} |
| 41 |
|
| 42 |
// Trigger an instance of the instrument |
| 43 |
@IBAction func trigger(_ sender: UIButton) { |
| 44 |
csound.updateOrchestra(orchestraTextView.text) |
| 45 |
csound.sendScore("i1 0 1") |
| 46 |
} |
| 47 |
|
| 48 |
override func didReceiveMemoryWarning() { |
| 49 |
super.didReceiveMemoryWarning() |
| 50 |
// Dispose of any resources that can be recreated. |
| 51 |
} |
| 52 |
|
| 53 |
@IBAction func showInfo(_ sender: UIButton) { |
| 54 |
infoVC.preferredContentSize = CGSize(width: 300, height: 120) |
| 55 |
infoText = "This example allows the user to modify the contents of the .csd on-the-fly using the updateOrchestra method from CsoundObj." |
| 56 |
displayInfo(sender) |
| 57 |
} |
| 58 |
|
| 59 |
} |