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 }); }
static Native() { //at ScriptCoreLib.JavaScript.Native.__Uint8ClampedArray() in x:\jsc.svn\core\ScriptCoreLib\JavaScript\WebGL\Uint8ClampedArray.cs:line 19 //at ScriptCoreLib.JavaScript.Native..cctor() in x:\jsc.svn\core\ScriptCoreLib\JavaScript\Native.cs:line 185 __Uint8ClampedArray(); __RTCPeerConnection(); // what is it? if (Expando.InternalIsMember(self, "document") && Expando.InternalIsMember(self, "screen")) { // should be a window with a document window = (IWindow)self; document = window.document; screen = window.screen; // were ApplicationWebserviceFields decrypted befoe this point? __ToBase64String(); // https:// !!! __initialize_identity(); return; } // are all browsers reporting it as the same type? // what if it could have multiple names? Native.serviceworker = self as ServiceWorkerGlobalScope; // X:\jsc.svn\examples\javascript\Test\TestServiceWorkerRegistrations\TestServiceWorkerRegistrations\Application.cs if (Native.serviceworker == null) { // ok detect other modes... if (Expando.InternalIsMember(self, "importScripts")) { if (Expando.InternalIsMember(self, "postMessage")) { // now what. are we running as a web worker? // WorkerGlobalScope // DedicatedWorkerGlobalScope // DedicatedWorkerContext worker = (DedicatedWorkerGlobalScope)self; return; } // now what. are we running as a web worker? // WorkerGlobalScope // DedicatedWorkerGlobalScope // DedicatedWorkerContext sharedworker = (SharedWorkerGlobalScope)self; } } }
public AlphaTabWebWorker(DedicatedWorkerGlobalScope main) { _main = main; _main.AddEventListener("message", (Action <Event>)HandleMessage, false); }