Skip to content
This repository was archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
fix setControlChannel, new release for csound 6.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hlolli committed Oct 28, 2018
1 parent aa9bbe9 commit dde1d3e
Show file tree
Hide file tree
Showing 10 changed files with 896 additions and 886 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "csound-wasm",
"version": "6.12.0-0",
"version": "6.12.0-1",
"author": "Hlödver Sigurdsson <[email protected]>",
"license": "GPL-3.0",
"keywords": [
Expand All @@ -25,14 +25,14 @@
},
"dependencies": {
"bufferutil": "^4.0.0",
"libcsound": "^6.11.0-2",
"libcsound": "^6.12.0-0",
"midi": "^0.9.5",
"speaker": "^0.4.1",
"utf-8-validate": "^5.0.1"
},
"devDependencies": {
"nan": "^2.11.0",
"shadow-cljs": "^2.6.6",
"nan": "^2.11.1",
"shadow-cljs": "^2.6.19",
"source-map-support": "^0.5.9"
}
}
812 changes: 407 additions & 405 deletions release/browser/csound-wasm-browser.js

Large diffs are not rendered by default.

814 changes: 408 additions & 406 deletions release/browser/csound-wasm-worklet-processor.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion release/browser/example3.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
<button id="play" style="margin-top:310px; height:40px;margin-left:20px">Play</button>
<div id="tester" style="margin-top:0px;width:600px;height:250px;"></div>

<script>window["csound_worklet_processor_url"] = "./csound-wasm-worklet-processor.js"</script>
<!-- <script>window["csound_worklet_processor_url"] = "./csound-wasm-worklet-processor.js"</script> -->
<script>window["csound_worklet_processor_url"] = "http://localhost:8080/csound-wasm-worklet-processor.js"</script>

<script src="./csound-wasm-browser.js"></script>

Expand All @@ -54,6 +55,7 @@
editor.setBehavioursEnabled(false);
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/csound_orchestra");
csound.setControlChannel("freq", 200);
csound.startRealtime({ksmps: 1});

document.getElementById('play').onclick = ()=>{
Expand Down
2 changes: 1 addition & 1 deletion release/browser/main.js.map

Large diffs are not rendered by default.

104 changes: 52 additions & 52 deletions release/node/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/node/index.js.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/csound_wasm/browser.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
(if (exists? ^js js/window.csound_worklet_processor_url)
^js js/window.csound_worklet_processor_url
(str "https://s3.amazonaws.com/hlolli/csound-wasm/"
"6.12.0-0"
"6.12.0-1"
"/csound-wasm-worklet-processor.js")))
(.then
(fn []
Expand Down Expand Up @@ -138,22 +138,22 @@
"falling back to WebAudio's script processor.\n")
err)
(reset! public/audio-worklet-node nil)
(vreset! public/start-audio-fn
(fn [config]
(when-not @public/audio-started?
(reset! public/audio-started? true))
(start-audio config)))
(reset! public/start-audio-fn
(fn [config]
(when-not @public/audio-started?
(reset! public/audio-started? true))
(start-audio config)))
(let [libcsound (public/activate-init-callback Libcsound)]
(reset! public/libcsound libcsound))))))
(do
(.warn js/console
(str "No AudioWorklet support found"))
(reset! public/audio-worklet-node false)
(vreset! public/start-audio-fn
(fn [config]
(when-not @public/audio-started?
(reset! public/audio-started? true))
(start-audio config)))
(reset! public/start-audio-fn
(fn [config]
(when-not @public/audio-started?
(reset! public/audio-started? true))
(start-audio config)))
(let [libcsound (public/activate-init-callback Libcsound)]
(reset! public/libcsound libcsound))))

Expand Down
4 changes: 2 additions & 2 deletions src/csound_wasm/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@

(defn- log-event [log]
(if (exists? js/window)
(.log js/console "%c%s" "font-size: 13px;" log)
(.log js/console log))
(.log js/console "%c%s" "font-size: 13px;" (str log))
(.log js/console (str log)))
#_(when (or (not worker-threads)
(.-isMainThread worker-threads))
(dispatch-event "csoundLog" log)))
Expand Down
10 changes: 7 additions & 3 deletions src/csound_wasm/worklet_processor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@
#js ["promise" promise-id return-val])))

(defn processor-event-handler [event]
(let [data (.-data event)
key (aget data 0)]
(let [data (.-data event)
key (aget data 0)
params (aget data 1)]
(case key
"promise"
(handle-promise data)
Expand All @@ -119,7 +120,10 @@
(case (aget data 1)
"startRealtime" #(public/start-realtime (aget data 2))))
(when @public/wasm-initialized? (@public/startup-fn)))
(apply (get public-functions key) (rest data))
(apply (get public-functions key)
(let [rest-data (if (vector? params)
params (js->clj params))]
params))
;;(.error js/console "Error unhandled key in processor: " key)
)))

Expand Down

0 comments on commit dde1d3e

Please sign in to comment.