コード例 #1
0
 public void Open()
 {
     Logger.Debug("AlphaSynth", "Initializing webworker worker");
     _worker = Lib.Global;
     _worker.AddEventListener("message", (Action <MessageEvent>)HandleMessage);
     Ready();
 }
コード例 #2
0
        public static void Init()
        {
            DedicatedWorkerGlobalScope main = Lib.Global;

            main.AddEventListener("message", (Action <MessageEvent>)(e =>
            {
                var data   = e.Data;
                string cmd = data.cmd;
                switch (cmd)
                {
                case CmdInitialize:
                    AlphaSynthWorkerSynthOutput.PreferredSampleRate = data.sampleRate;
                    Logger.LogLevel = data.logLevel;
                    new AlphaSynthWebWorker(main, data.id);
                    break;
                }
            }));
        }
コード例 #3
0
        public AlphaSynthWebWorker(DedicatedWorkerGlobalScope main, string id)
        {
            _main = main;
            _main.AddEventListener("message", (Action <MessageEvent>)HandleMessage);

            _player = new Audio.Synth.AlphaSynth(new AlphaSynthWorkerSynthOutput());
            _player.PositionChanged     += OnPositionChanged;
            _player.PlayerStateChanged  += OnPlayerStateChanged;
            _player.Finished            += OnFinished;
            _player.SoundFontLoaded     += OnSoundFontLoaded;
            _player.SoundFontLoadFailed += OnSoundFontLoadFailed;
            _player.SoundFontLoadFailed += OnSoundFontLoadFailed;
            _player.MidiLoaded          += OnMidiLoaded;
            _player.MidiLoadFailed      += OnMidiLoadFailed;
            _player.ReadyForPlayback    += OnReadyForPlayback;

            _main.PostMessage(new { cmd = CmdReady });
        }
コード例 #4
0
 public AlphaTabWebWorker(DedicatedWorkerGlobalScope main)
 {
     _main = main;
     _main.AddEventListener("message", (Action <Event>)HandleMessage, false);
 }