public void Open() { Logger.Debug("Initializing webworker worker"); _workerSelf = JsContext.JsCode("self").As <WorkerContext>(); _workerSelf.addEventListener("message", HandleMessage, false); OnReadyChanged(true); }
public void Open() { Logger.Debug("Initializing webworker worker"); _workerSelf = JsContext.JsCode("self").As<WorkerContext>(); _workerSelf.addEventListener("message", HandleMessage, false); OnReadyChanged(true); }
public JsWorker(SharpKit.Html.workers.WorkerContext main, object options) { _main = main; _main.addEventListener("message", HandleMessage, false); Settings settings = Settings.FromJson(options); _renderer = new ScoreRenderer(settings); _renderer.PartialRenderFinished += result => PostMessage(new { cmd = "partialRenderFinished", result = result }); _renderer.RenderFinished += result => PostMessage(new { cmd = "renderFinished", result = result }); _renderer.PostRenderFinished += () => PostMessage(new { cmd = "postRenderFinished", boundsLookup = _renderer.BoundsLookup.ToJson() }); _renderer.PreRender += result => PostMessage(new { cmd = "preRender", result = result }); }
public JsWorker(SharpKit.Html.workers.WorkerContext main, object options) { _main = main; _main.addEventListener("message", HandleMessage, false); Settings settings = Settings.FromJson(options); _renderer = new ScoreRenderer(settings); _renderer.PartialRenderFinished += result => PostMessage(new { cmd = "partialRenderFinished", result = result }); _renderer.RenderFinished += result => PostMessage(new { cmd = "renderFinished", result = result }); _renderer.PostRenderFinished += () => PostMessage(new { cmd = "postRenderFinished", boundsLookup = _renderer.BoundsLookup.ToJson() }); _renderer.PreRender += result => PostMessage(new { cmd = "preRender", result = result }); }
public JsWorker(SharpKit.Html.workers.WorkerContext main, object options) { _main = main; _includeScoreInLoadedEvent = options.Member("scoreInLoadedEvent").As <bool>(); _main.addEventListener("message", HandleMessage, false); Settings settings = Settings.FromJson(options); _renderer = new ScoreRenderer(settings, null); _renderer.PartialRenderFinished += result => PostMessage(new { cmd = "partialRenderFinished", result = result }); _renderer.RenderFinished += result => PostMessage(new { cmd = "renderFinished", result = result }); _renderer.PostRenderFinished += () => PostMessage(new { cmd = "postRenderFinished" }); _renderer.PreRender += () => PostMessage(new { cmd = "preRender" }); }
public AlphaSynthWebWorker(SharpKit.Html.workers.WorkerContext main) { _main = main; _main.addEventListener("message", HandleMessage, false); _player = new SynthPlayer(); _player.PositionChanged += OnPositionChanged; _player.PlayerStateChanged += OnPlayerStateChanged; _player.Finished += OnFinished; _player.SoundFontLoad += OnSoundFontLoad; _player.SoundFontLoaded += OnSoundFontLoaded; _player.SoundFontLoadFailed += OnSoundFontLoadFailed; _player.MidiLoad += OnMidiLoad; _player.MidiLoaded += OnMidiLoaded; _player.MidiLoadFailed += OnMidiLoadFailed; _player.ReadyForPlay += OnReadyForPlay; OnReady(); }
public AlphaSynthWebWorker(SharpKit.Html.workers.WorkerContext main) { _main = main; _main.addEventListener("message", HandleMessage, false); _player = new SynthPlayer(); _player.PositionChanged += OnPositionChanged; _player.PlayerStateChanged += OnPlayerStateChanged; _player.Finished += OnFinished; _player.SoundFontLoad += OnSoundFontLoad; _player.SoundFontLoaded += OnSoundFontLoaded; _player.SoundFontLoadFailed += OnSoundFontLoadFailed; _player.MidiLoad += OnMidiLoad; _player.MidiLoaded += OnMidiLoaded; _player.MidiLoadFailed += OnMidiLoadFailed; _player.ReadyForPlay += OnReadyForPlay; OnReady(); }
public JsWorker(SharpKit.Html.workers.WorkerContext main, object options) { _main = main; _includeScoreInLoadedEvent = options.Member("scoreInLoadedEvent").As<bool>(); _main.addEventListener("message", HandleMessage, false); Settings settings = Settings.FromJson(options); _renderer = new ScoreRenderer(settings, null); _renderer.PartialRenderFinished += result => PostMessage(new { cmd = "partialRenderFinished", result = result }); _renderer.RenderFinished += result => PostMessage(new { cmd = "renderFinished", result = result }); _renderer.PostRenderFinished += () => PostMessage(new { cmd = "postRenderFinished" }); _renderer.PreRender += () => PostMessage(new {cmd = "preRender"}); }
public JsWorker(SharpKit.Html.workers.WorkerContext main) { _main = main; _main.addEventListener("message", HandleMessage, false); }