SiON練習その3 2種類MML同時再生
以下コードを参考にさせてもらいました
sion遊び
http://wonderfl.net/c/pCTZ
/**
* Copyright siouxcitizen ( http://wonderfl.net/user/siouxcitizen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/dwhE
*/
// forked from siouxcitizen's SiON練習その2
//以下コードを参考にさせてもらいました
//sion遊び
//http://wonderfl.net/c/pCTZ
package {
import flash.display.Sprite;
import org.si.sion.*;
import org.si.sion.utils.SiONPresetVoice;
import com.bit101.components.*;
import flash.events.MouseEvent;
public class SiONRensyu extends Sprite {
public var driver:SiONDriver = new SiONDriver();
public var presetVoice:SiONPresetVoice = new SiONPresetVoice();
public var mainMelody:SiONData;
public var voice:SiONVoice;
function SiONRensyu() {
var mml:String = "t100;";
mml += "l8 [cdefgab<c r c>bagfedc]1;";
mml += "l8 grrrrrrr r grrrrrrr;";
mainMelody = driver.compile(mml);
voice = presetVoice["valsound.piano8"];
new PushButton(this, 10, 20, "play", mml_play);
new PushButton(this, 150, 20, "stop", mml_stop);
driver.play();
}
private function mml_play(e:MouseEvent):void{
driver.sequenceOn(mainMelody,voice);
}
private function mml_stop(e:MouseEvent):void{
driver.sequenceOff(0, 0, 0);
}
}
}