Forked from: 1031no's flash on 2010-3-7 diff:36 forked from: flash on 2010-3-7 1031no forked:2favorite:2lines:29license : MIT License modified : 2010-03-07 17:59:15 Embed Tweet // forked from 1031no's flash on 2010-3-7 package { import flash.display.Sprite; import flash.events.*; import com.bit101.components.*; import org.si.sion.*; import org.si.sion.utils.SiONPresetVoice; [SWF(width = "300", height = "150", backgroundColor = "#FFFFFF")] public class PlayWithPreseVoicet extends Sprite { // SiONDriverクラスのインスタンスを生成 public var driver:SiONDriver = new SiONDriver(); // SiONPresetVoiceクラスのインスタンスを生成 public var presetVoice:SiONPresetVoice = new SiONPresetVoice(); // SiONVoice型変数を宣言 public var voice1:SiONVoice; public var voice2:SiONVoice; // SiONData型変数を宣言 public var mainMelody:SiONData; function PlayWithPreseVoicet() { //MMLをSiONData型にコンパイル mainMelody = driver.compile("t200 I1 [c1]") //SiONVoice型変数にプリセットボイスを設定 voice1 = presetVoice["valsound.bell16"]; voice2 = presetVoice["valsound.wind1"]; //ボタンコンポーネント(ボタン1、2) new PushButton(this, 20, 50, "Button1-piano8", _play_preset1); new PushButton(this, 170, 50, "Button2-wind1", _play_preset2); driver.play(); } // ボタン1のアクション private function _play_preset1(e:MouseEvent) : void { // 第一引数にSiONData、第二引数にSiONVoice、第三引数以降は、length=0(play all of sequence), delay=0(no delay), quantize=2(8th beat) driver.sequenceOn(mainMelody, voice1, 0, 0, 2); } // ボタン2のアクション private function _play_preset2(e:MouseEvent) : void { // ボタン1と同じでプリセットボイスのみ違う driver.sequenceOn(mainMelody, voice2, 0, 0, 2); } } } Code Fullscreen Preview Fullscreen tjoen omari : noiseSiON SiON noise MouseEvent Sprite sort new page view favorite forked pv101 forked from: forked from: flas.. takashi08 forked:0 favorite:0lines:29 (diff:1) pv103 forked from: forked from: flas.. rev8shot forked:0 favorite:0lines:29 (diff:7)