Skip to content

Commit

Permalink
Minor updates (#126, #133).
Browse files Browse the repository at this point in the history
  • Loading branch information
gogins committed Apr 14, 2020
1 parent d84ccf0 commit 227a1da
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 49 deletions.
4 changes: 2 additions & 2 deletions WebAssembly/examples/cmask.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<html>
<head>
<title>CMask Demo</title>
</head>
<body style="background-color:LightGrey;">
<!-- This script loads the entire Csound library compiled for WebAssembly
and based on AudioWorklet. -->
<script src="CsoundAudioNode.js"></script>
Expand All @@ -10,8 +12,6 @@
CsoundQt oe Android, then csound.node, then Csound for WebAssembly. -->
<script src="csound_loader.js"></script>
<script src="cmask.js"></script>
</head>
<body style="background-color:LightGrey;">
<script>
var csd = null;
var cmask = cmask_module();
Expand Down
3 changes: 0 additions & 3 deletions WebAssembly/examples/csound_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,14 @@ var get_csound = function(csound_message_callback_) {
}
if (csound_injected != null) {
csound = csound_injected;
csound_message_callback_("Using injected csound...\n");
return csound_injected;
} else if (csound_node != null) {
csound = csound_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using csound.node..\n");
return csound_node;
} else if (csound_audio_node != null) {
csound = csound_audio_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using CsoundAudioNode (WebAssembly AudioWorklet)...\n");
return csound_audio_node;
} else {
csound_message_callback_("Csound is still loading, wait a bit...\n");
Expand Down
4 changes: 2 additions & 2 deletions WebAssembly/examples/duplex.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<html>
<head>
<title>Duplex Audio</title>
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
<style type="text/css">
input[type='range'] {
-webkit-appearance: none;
Expand Down Expand Up @@ -87,6 +85,8 @@
</script>
</head>
<body style="background-color:CadetBlue">
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
</script>
<h1>Duplex Audio</h1>
<p>Use headphones and a microphone. Listen for modulation of the input audio.
Expand Down
16 changes: 8 additions & 8 deletions WebAssembly/examples/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,24 +258,24 @@ <h3>Adapted for Csound with HTML5 by Michael Gogins, from "Message from Another
$('input').on('input', function(event) {
let csound = get_csound(csound_message_callback);
var slider_value = parseFloat(event.target.value);
csound.setControlChannel(event.target.id, slider_value);
csound.SetControlChannel(event.target.id, slider_value);
var output_selector = '#' + event.target.id + '_output';
$(output_selector).val(slider_value);
});
$('#play').on('click', async function() {
let csound = get_csound(csound_message_callback);
document.getElementById("csound_console").value = "";
var csd = document.getElementById('csd').value;
await csound.compileCsdText(csd);
await csound.CompileCsdText(csd);
$('#restore').trigger('click');
await csound.start();
csound.perform();
await csound.Start();
csound.Perform();
});
$('#stop').on('click', async function() {
let csound = get_csound(csound_message_callback);
await csound.stop();
await csound.cleanup();
csound.reset();
await csound.Stop();
await csound.Cleanup();
csound.Reset();
});
$('#save').on('click', function() {
$('.persistent-element').each(function() {
Expand All @@ -286,7 +286,7 @@ <h3>Adapted for Csound with HTML5 by Michael Gogins, from "Message from Another
let csound = get_csound(csound_message_callback);
$('.persistent-element').each(function() {
this.value = localStorage.getItem(this.id);
csound.setControlChannel(this.id, parseFloat(this.value));
csound.SetControlChannel(this.id, parseFloat(this.value));
var output_selector = '#' + this.id + '_output';
$(output_selector).val(this.value);
});
Expand Down
4 changes: 2 additions & 2 deletions WebAssembly/examples/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html>
<head>
<title>Minimal Example using Csound for WebAssembly</title>
<!-- This script loads the entire Csound library. -->
<script src="CsoundAudioNode.js"></script>
</head>
<body>
<!-- This script loads the entire Csound library. -->
<script src="CsoundAudioNode.js"></script>
<script>
// Csound is globally declared as null to indicate that the Csound library
// should be loaded.
Expand Down
2 changes: 1 addition & 1 deletion WebAssembly/examples/player.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<title>Csound Player</title>
<body style="background-color:LightGrey;">
<!-- This script loads the entire Csound library compiled for WebAssembly
and based on AudioWorklet. -->
<script src="CsoundAudioNode.js"></script>
Expand All @@ -10,7 +11,6 @@
CsoundQt oe Android, then csound.node, then Csound for WebAssembly. -->
<script src="csound_loader.js"></script>
</head>
<body style="background-color:LightGrey;">
<script>
var csd = null;
var csound_message_callback = function(message) {
Expand Down
4 changes: 2 additions & 2 deletions WebAssembly/examples/scrims.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sprintf/1.1.1/sprintf.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/91/three.js"></script>
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
<style>
::-webkit-scrollbar
{
Expand All @@ -33,6 +31,8 @@
</style>
</head>
<body style="background:black;">
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
<div id = 'webgl_cell' class='canvas' style="width:98vw;height:98vh;"/>
<table id = 'statistics' style="table-layout:fixed;position:absolute;left:1vw;color:#eee;top:1vw;font-family:Monaco, sans-serif;font-size:8pt;">
<col width=400px>
Expand Down
3 changes: 0 additions & 3 deletions WebAssembly/src/csound_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,14 @@ var get_csound = function(csound_message_callback_) {
}
if (csound_injected != null) {
csound = csound_injected;
csound_message_callback_("Using injected csound...\n");
return csound_injected;
} else if (csound_node != null) {
csound = csound_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using csound.node..\n");
return csound_node;
} else if (csound_audio_node != null) {
csound = csound_audio_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using CsoundAudioNode (WebAssembly AudioWorklet)...\n");
return csound_audio_node;
} else {
csound_message_callback_("Csound is still loading, wait a bit...\n");
Expand Down
4 changes: 2 additions & 2 deletions docs/cmask.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<html>
<head>
<title>CMask Demo</title>
</head>
<body style="background-color:LightGrey;">
<!-- This script loads the entire Csound library compiled for WebAssembly
and based on AudioWorklet. -->
<script src="CsoundAudioNode.js"></script>
Expand All @@ -10,8 +12,6 @@
CsoundQt oe Android, then csound.node, then Csound for WebAssembly. -->
<script src="csound_loader.js"></script>
<script src="cmask.js"></script>
</head>
<body style="background-color:LightGrey;">
<script>
var csd = null;
var cmask = cmask_module();
Expand Down
3 changes: 0 additions & 3 deletions docs/csound_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,14 @@ var get_csound = function(csound_message_callback_) {
}
if (csound_injected != null) {
csound = csound_injected;
csound_message_callback_("Using injected csound...\n");
return csound_injected;
} else if (csound_node != null) {
csound = csound_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using csound.node..\n");
return csound_node;
} else if (csound_audio_node != null) {
csound = csound_audio_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using CsoundAudioNode (WebAssembly AudioWorklet)...\n");
return csound_audio_node;
} else {
csound_message_callback_("Csound is still loading, wait a bit...\n");
Expand Down
7 changes: 4 additions & 3 deletions docs/duplex.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<html>
<head>
<title>Duplex Audio</title>
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
<style type="text/css">
input[type='range'] {
-webkit-appearance: none;
Expand Down Expand Up @@ -87,6 +85,8 @@
</script>
</head>
<body style="background-color:CadetBlue">
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
</script>
<h1>Duplex Audio</h1>
<p>Use headphones and a microphone. Listen for modulation of the input audio.
Expand Down Expand Up @@ -148,7 +148,8 @@ <h1>Duplex Audio</h1>
<textarea id='csd' cols=80 rows=25">
<CsoundSynthesizer>
<CsOptions>
-m195 -odac:plughw:1,0 -iadc:plughw:1,0 -f -+rtaudio=alsa
; Needed to work with csound.node:
-d -f -m195 -+rtaudio=alsa -odac:plughw:1,0 -iadc:plughw:1,0
</CsOptions>
<CsInstruments>
sr = 48000
Expand Down
19 changes: 10 additions & 9 deletions docs/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ <h3>Adapted for Csound with HTML5 by Michael Gogins, from "Message from Another
https://setiathome.berkeley.edu/
</CsLicense>
<CsOptions>
-m195 -f -+rtaudio=alsa -odac:plughw:1,0 -iadc:plughw:1,0
; Needed to work with csound.node:
-d -f -m195 -+rtaudio=alsa -odac:plughw:1,0 -iadc:plughw:1,0
</CsOptions>
<CsInstruments>
sr = 48000
Expand Down Expand Up @@ -257,24 +258,24 @@ <h3>Adapted for Csound with HTML5 by Michael Gogins, from "Message from Another
$('input').on('input', function(event) {
let csound = get_csound(csound_message_callback);
var slider_value = parseFloat(event.target.value);
csound.setControlChannel(event.target.id, slider_value);
csound.SetControlChannel(event.target.id, slider_value);
var output_selector = '#' + event.target.id + '_output';
$(output_selector).val(slider_value);
});
$('#play').on('click', async function() {
let csound = get_csound(csound_message_callback);
document.getElementById("csound_console").value = "";
var csd = document.getElementById('csd').value;
await csound.compileCsdText(csd);
await csound.CompileCsdText(csd);
$('#restore').trigger('click');
await csound.start();
csound.perform();
await csound.Start();
csound.Perform();
});
$('#stop').on('click', async function() {
let csound = get_csound(csound_message_callback);
await csound.stop();
await csound.cleanup();
csound.reset();
await csound.Stop();
await csound.Cleanup();
csound.Reset();
});
$('#save').on('click', function() {
$('.persistent-element').each(function() {
Expand All @@ -285,7 +286,7 @@ <h3>Adapted for Csound with HTML5 by Michael Gogins, from "Message from Another
let csound = get_csound(csound_message_callback);
$('.persistent-element').each(function() {
this.value = localStorage.getItem(this.id);
csound.setControlChannel(this.id, parseFloat(this.value));
csound.SetControlChannel(this.id, parseFloat(this.value));
var output_selector = '#' + this.id + '_output';
$(output_selector).val(this.value);
});
Expand Down
4 changes: 2 additions & 2 deletions docs/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html>
<head>
<title>Minimal Example using Csound for WebAssembly</title>
<!-- This script loads the entire Csound library. -->
<script src="CsoundAudioNode.js"></script>
</head>
<body>
<!-- This script loads the entire Csound library. -->
<script src="CsoundAudioNode.js"></script>
<script>
// Csound is globally declared as null to indicate that the Csound library
// should be loaded.
Expand Down
2 changes: 1 addition & 1 deletion docs/player.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<title>Csound Player</title>
<body style="background-color:LightGrey;">
<!-- This script loads the entire Csound library compiled for WebAssembly
and based on AudioWorklet. -->
<script src="CsoundAudioNode.js"></script>
Expand All @@ -10,7 +11,6 @@
CsoundQt oe Android, then csound.node, then Csound for WebAssembly. -->
<script src="csound_loader.js"></script>
</head>
<body style="background-color:LightGrey;">
<script>
var csd = null;
var csound_message_callback = function(message) {
Expand Down
7 changes: 4 additions & 3 deletions docs/scrims.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sprintf/1.1.1/sprintf.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/91/three.js"></script>
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
<style>
::-webkit-scrollbar
{
Expand All @@ -33,6 +31,8 @@
</style>
</head>
<body style="background:black;">
<script src="CsoundAudioNode.js"></script>
<script src="csound_loader.js"></script>
<div id = 'webgl_cell' class='canvas' style="width:98vw;height:98vh;"/>
<table id = 'statistics' style="table-layout:fixed;position:absolute;left:1vw;color:#eee;top:1vw;font-family:Monaco, sans-serif;font-size:8pt;">
<col width=400px>
Expand Down Expand Up @@ -81,7 +81,8 @@
<textarea class="code" id="csd" hidden rows=24 cols=80>
<CsoundSynthesizer>
<CsOptions>
-d -f -m195 -+rtaudio=alsa -odac:plughw:1,0 -iadc:plughw:1,0
; Needed to work with csound.node:
-d -f -m195 -+rtaudio=alsa -odac:plughw:1,0 -iadc:plughw:1,0
</CsOptions>
<CsInstruments>

Expand Down
3 changes: 0 additions & 3 deletions silencio/js/csound_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,14 @@ var get_csound = function(csound_message_callback_) {
}
if (csound_injected != null) {
csound = csound_injected;
csound_message_callback_("Using injected csound...\n");
return csound_injected;
} else if (csound_node != null) {
csound = csound_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using csound.node..\n");
return csound_node;
} else if (csound_audio_node != null) {
csound = csound_audio_node;
csound.SetMessageCallback(csound_message_callback_);
csound_message_callback_("Using CsoundAudioNode (WebAssembly AudioWorklet)...\n");
return csound_audio_node;
} else {
csound_message_callback_("Csound is still loading, wait a bit...\n");
Expand Down

0 comments on commit 227a1da

Please sign in to comment.