Skip to content

Commit

Permalink
Merge branch 'master' into remove-nodejs-support
Browse files Browse the repository at this point in the history
* master:
  Fixes gh-252: Regularizes synth evaluation. Removes pseudo-modelism. Removes remaining uses of .input(); renames Synth.gen to generate.
  gh-252: Updates tests for synth restructuring and removal of input(). Renames Synth.genFn to generate().
  gh-252: Moves synth-related grades into separate files.
  • Loading branch information
colinbdclark committed Nov 27, 2018
2 parents f6c9ae6 + 4577823 commit 4def575
Show file tree
Hide file tree
Showing 56 changed files with 311 additions and 316 deletions.
5 changes: 1 addition & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ module.exports = function(grunt) {
"src/core.js",
"src/node-list.js",
"src/evaluators.js",
"src/synths/model.js",
"src/synths/group.js",
"src/synths/polyphonic.js",
"src/synths/band.js",
"src/synths/*.js",
"src/buffers.js",
"src/parser.js",
"src/audiofile.js",
Expand Down
3 changes: 2 additions & 1 deletion demos/audio-file/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<script src="../../src/core.js"></script>
<script src="../../src/node-list.js"></script>
<script src="../../src/synths/synth.js"></script>
<script src="../../src/evaluators.js"></script>
<script src="../../src/scheduler.js"></script>
<script src="../../src/buffers.js"></script>
Expand Down Expand Up @@ -117,7 +118,7 @@ <h1>Audio File Decoding Demo</h1>

// Dynamically change the playback speed of the playBuffer ugen based on changes to the slider.
document.querySelector("#playbackSpeed").addEventListener("change", function (e) {
synth.input("player.speed", Number(e.target.value));
synth.set("player.speed", Number(e.target.value));
e.preventDefault();
e.stopPropagation();
}, false);
Expand Down
1 change: 1 addition & 0 deletions demos/audio-input/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<script src="../../src/core.js"></script>
<script src="../../src/node-list.js"></script>
<script src="../../src/evaluators.js"></script>
<script src="../../src/synths/synth.js"></script>
<script src="../../src/scheduler.js"></script>
<script src="../../src/buffers.js"></script>
<script src="../../src/audiofile.js"></script>
Expand Down
1 change: 1 addition & 0 deletions demos/media-element-input/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<script src="../../src/core.js"></script>
<script src="../../src/node-list.js"></script>
<script src="../../src/evaluators.js"></script>
<script src="../../src/synths/synth.js"></script>
<script src="../../src/synths/band.js"></script>
<script src="../../src/scheduler.js"></script>
<script src="../../src/buffers.js"></script>
Expand Down
1 change: 1 addition & 0 deletions demos/midi/receive/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<script src="../../../src/core.js"></script>
<script src="../../../src/node-list.js"></script>
<script src="../../../src/evaluators.js"></script>
<script src="../../../src/synths/synth.js"></script>
<script src="../../../src/synths/model.js"></script>
<script src="../../../src/synths/group.js"></script>
<script src="../../../src/synths/polyphonic.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion demos/playground/demos/multiple-synths.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ var fundamental = 440,
clock.repeat(1, function () {
var intervalSynth = flock.choose(synths),
newInterval = flock.choose(weightedIntervals);
intervalSynth.input("carrier.freq", fundamental * newInterval);
intervalSynth.set("carrier.freq", fundamental * newInterval);
});
2 changes: 2 additions & 0 deletions demos/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<script src="../../src/core.js"></script>
<script src="../../src/node-list.js"></script>
<script src="../../src/evaluators.js"></script>
<script src="../../src/synths/synth.js"></script>
<script src="../../src/synths/value.js"></script>
<script src="../../src/synths/model.js"></script>
<script src="../../src/synths/group.js"></script>
<script src="../../src/synths/polyphonic.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions demos/playground/live/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
<script src="../../../src/core.js"></script>
<script src="../../../src/node-list.js"></script>
<script src="../../../src/evaluators.js"></script>
<script src="../../../src/synths/synth.js"></script>
<script src="../../../src/synths/value.js"></script>
<script src="../../../src/synths/model.js"></script>
<script src="../../../src/synths/group.js"></script>
<script src="../../../src/synths/polyphonic.js"></script>
Expand Down
44 changes: 22 additions & 22 deletions demos/shared/js/demo-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,45 @@ var fluid = fluid || require("infusion"),
demo = fluid.registerNamespace("demo");

(function () {

"use strict";

demo.toggleButtonView = function(synth, options) {
var that = {
model: {
isPlaying: false
},

synth: synth,
button: document.querySelector(typeof (options) === "string" ? options : options.selectors.button),
onPlay: options.onPlay,
onPause: options.onPause
};
that.buttonBaseClass = that.button.className; // TODO: ummm... library, anyone?

that.play = function () {
if (that.onPlay) {
that.onPlay(that.button);
}

that.button.innerHTML = "Pause";
that.button.className = that.buttonBaseClass + " " + "playing";
that.synth.play();
that.model.isPlaying = true;
};

that.pause = function () {
if (that.onPause) {
that.onPause(that.button);
}

that.button.innerHTML = "Play";
that.button.className = that.buttonBaseClass + " " + "paused";
that.synth.pause();

that.model.isPlaying = false;
};

// Wire it up to a button on the page.
that.button.addEventListener("click", function () {
if (!that.model.isPlaying) {
Expand All @@ -58,29 +58,29 @@ var fluid = fluid || require("infusion"),
that.pause();
}
}, false);

that.pause();
return that;
};

demo.fileSelectorView = function(synth, options) {
var that = {
input: document.querySelector(options.selectors.input),
button: document.querySelector(options.selectors.button),
fileName: document.querySelector(options.selectors.fileName)
};

that.input.addEventListener("change", function () {
if (that.fileName) {
that.fileName.innerHTML = that.input.files[0].name;
}

var players = fluid.makeArray(options.playerId);
fluid.each(players, function (id) {
synth.input(id).onInputChanged("buffer");
synth.get(id).onInputChanged("buffer");
});
});

// On Firefox, bind a click event to the browse button, which delegates to the hidden (ugly) file input element.
if (window.navigator.userAgent.indexOf("Firefox") !== -1) {
that.button.addEventListener("click", function (e) {
Expand All @@ -96,24 +96,24 @@ var fluid = fluid || require("infusion"),
}
}
};

demo.dataUrlSelectorView = function (synth, options) {
var that = {
field: document.querySelector(options.selectors.field)
};

that.field.addEventListener("change", function () {
that.dataUrl = that.field.value;

var players = fluid.makeArray(options.playerId);
fluid.each(players, function (id) {
var player = synth.input(id),
bufDef = player.input("buffer");
var player = synth.get(id),
bufDef = player.get("buffer");

bufDef.url = that.dataUrl;
player.onInputChanged("buffer");
});
});
};
})();

})();
Loading

0 comments on commit 4def575

Please sign in to comment.