public void Open() { Logger.Debug("AlphaSynth", "Initializing webworker worker"); _worker = Lib.Global; _worker.AddEventListener("message", (Action <MessageEvent>)HandleMessage); Ready(); }
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; } })); }
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 }); }
public AlphaTabWebWorker(DedicatedWorkerGlobalScope main) { _main = main; _main.AddEventListener("message", (Action <Event>)HandleMessage, false); }