我正在使用MIDI.js库,我想停止播放所有使用以下代码激活的音符。
// Get Screen Dimensions //
let screenHeight : Float = Float(view.bounds.height)
let screenWidth : Float = Float(view.bounds.width)
// Set Button View Height //
let buttonHeight : Float = 50.0
// Check Returned Screen Size //
if screenHeight == 667 {
let login = UIView(frame: CGRectMake(0, CGFloat(screenHeight - (216.0 + buttonHeight)), CGFloat(screenWidth), CGFloat(buttonHeight)))
login.backgroundColor = UIColor.orangeColor()
view.addSubview(login)
} else if screenHeight == 736 {
let login = UIView(frame: CGRectMake(0, CGFloat(screenHeight - (226.0 + buttonHeight)), CGFloat(screenWidth), CGFloat(buttonHeight)))
login.backgroundColor = UIColor.orangeColor()
view.addSubview(login)
}
我尝试使用 function myPlayer(myMid){
var delay = 0; // play one note every quarter second
var start = 0;
var note = 36; // the MIDI note
var velocity = 127; // how hard the note hits
var currentIds = [];
MIDI.setVolume(0, 127);
for(j=0; j<myMid.length; j++){
delay = parseFloat(myMid[j][0])/8;
for(i=2; i<myMid[j].length; i++){
note = mIn[parseInt(myMid[j][i])-1];
MIDI.noteOn(0, note, velocity, start);
MIDI.noteOff(0, note, start + delay);
}
start += delay;
}
}
和MIDI.stop()
,但没有工作......