Skip to content

Commit

Permalink
Merge branch '0.1.x'
Browse files Browse the repository at this point in the history
* 0.1.x:
  Updates release version to 0.1.2.
  Fixes gh-107: Adds support for receiving clicks from multiple elements.
  Fixes gh-109: Adds flock.enviro.start() method; deprecates play().
  • Loading branch information
colinbdclark committed May 4, 2015
2 parents d1ad461 + 254fed4 commit 2f26906
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 45 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Documentation and Demos
Getting Started
---------------

The latest stable release of Flocking is version 0.1.1. It can be downloaded from the [Flocking releases](https://github.com/colinbdclark/Flocking/releases) page.
The latest stable release of Flocking is version 0.1.2. It can be downloaded from the [Flocking releases](https://github.com/colinbdclark/Flocking/releases) page.

Concatenated and minified Flocking builds, suitable for development and production respectively,
are included in the [dist directory](dist/). Flocking can also be built manually using Grunt.
Expand Down Expand Up @@ -223,15 +223,16 @@ control of a scheduler instead of the sample output clock.
An Environment represents a whole "audio system" or "context" in Flocking.
It is responsible for evaluating all Synths instances and outputting their samples to the
current audio output strategy. An environment manages a list of Synth instances and evaluates them in order.
You should instantiate only one <code>flock.enviro</code> for your entire application.

The Flocking _shared environment_ is created by calling <code>flock.init()</code>:

var enviro = flock.init();

Before you'll hear any sound, the environment needs to be started.
This is done using the <code>play()</code> method:
Before you'll hear any sound, the environment needs to be started. You only need to start the environment once.
This is done using the <code>start()</code> method:

enviro.play();
enviro.start();

To stop the environment from generating samples, use the <code>stop()</code> method:

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flocking",
"version": "0.1.1",
"version": "0.1.2",
"main": "dist/flocking-all.min.js",
"ignore": [
"build-support",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

demo.playBuffer = function (bufferDesc) {
var enviro = flock.enviro.shared;
enviro.play();
enviro.start();

var s = flock.synth({
synthDef: {
Expand Down
25 changes: 19 additions & 6 deletions dist/flocking-all.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Flocking 0.1.1 (May 4, 2015), Copyright 2015 Colin Clark | flockingjs.org */
/*! Flocking 0.1.2 (May 4, 2015), Copyright 2015 Colin Clark | flockingjs.org */

/*!
* jQuery JavaScript Library v2.1.3
Expand Down Expand Up @@ -21035,15 +21035,28 @@ var fluid = fluid || require("infusion"),
/**
* Starts generating samples from all synths.
*/
that.play = function () {
that.start = function () {
if (that.model.isPlaying) {
return;
}

that.audioStrategy.start();
that.model.isPlaying = true;
};

/**
* Deprecated. Use start() instead.
*/
that.play = that.start;

/**
* Stops generating samples from all synths.
*/
that.stop = function () {
if (!that.model.isPlaying) {
return;
}

that.audioStrategy.stop();
that.model.isPlaying = false;
};
Expand Down Expand Up @@ -30422,10 +30435,10 @@ var fluid = fluid || require("infusion"),

that.init = function () {
var m = that.model;
m.target = typeof (that.options.target) === "string" ?
document.querySelector(that.options.target) : that.options.target || window;
m.target.addEventListener("mousedown", that.mouseDownListener, false);
m.target.addEventListener("mouseup", that.mouseUpListener, false);
m.target = !that.options.target ? $(window) : $(that.options.target);

m.target.mousedown(that.mouseDownListener);
m.target.mouseup(that.mouseUpListener);

that.onInputChanged();
};
Expand Down
9 changes: 4 additions & 5 deletions dist/flocking-all.min.js

Large diffs are not rendered by default.

25 changes: 19 additions & 6 deletions dist/flocking-no-jquery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Flocking 0.1.1 (May 4, 2015), Copyright 2015 Colin Clark | flockingjs.org */
/*! Flocking 0.1.2 (May 4, 2015), Copyright 2015 Colin Clark | flockingjs.org */

(function (root, factory) {
if (typeof exports === "object") {
Expand Down Expand Up @@ -11849,15 +11849,28 @@ var fluid = fluid || require("infusion"),
/**
* Starts generating samples from all synths.
*/
that.play = function () {
that.start = function () {
if (that.model.isPlaying) {
return;
}

that.audioStrategy.start();
that.model.isPlaying = true;
};

/**
* Deprecated. Use start() instead.
*/
that.play = that.start;

/**
* Stops generating samples from all synths.
*/
that.stop = function () {
if (!that.model.isPlaying) {
return;
}

that.audioStrategy.stop();
that.model.isPlaying = false;
};
Expand Down Expand Up @@ -21236,10 +21249,10 @@ var fluid = fluid || require("infusion"),

that.init = function () {
var m = that.model;
m.target = typeof (that.options.target) === "string" ?
document.querySelector(that.options.target) : that.options.target || window;
m.target.addEventListener("mousedown", that.mouseDownListener, false);
m.target.addEventListener("mouseup", that.mouseUpListener, false);
m.target = !that.options.target ? $(window) : $(that.options.target);

m.target.mousedown(that.mouseDownListener);
m.target.mouseup(that.mouseUpListener);

that.onInputChanged();
};
Expand Down
11 changes: 5 additions & 6 deletions dist/flocking-no-jquery.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ And an example JavaScript file:
// If you're on iOS, you will need to call in a listener for
// some kind of user input action, such a button click or touch handler.
// This is because iOS will only play sound if the user initiated it.
enviro.play();
enviro.start();
};

}());
Expand Down Expand Up @@ -254,7 +254,7 @@ Fluid components are created by defining JSON "component trees", which are manag
listeners: {
onCreate: [
{
func: "{that}.enviro.play"
func: "{that}.enviro.start"
},
{
funcName: "{clock}.schedule",
Expand Down
2 changes: 1 addition & 1 deletion docs/nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ In app.js (or whatever files you want to use), you'll define your Flocking code:
listeners: {
onCreate: [
{
funcName: "{that}.enviro.play"
funcName: "{that}.enviro.start"
},
{
funcName: "{scheduler}.schedule",
Expand Down
2 changes: 1 addition & 1 deletion docs/responding-to-user-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ To do so, we will bind a one-time click handler on our button. It will start the

$(container).one("click", function () {
var enviro = flock.init();
enviro.play();
enviro.start();
});

Next, we'll register a click handler on the button that will randomly change the frequency of the modulator every time the user clicks the button. We'll use jQuery again for this, and call `Synth.set()` to change the _modulator.freq_ input:
Expand Down
15 changes: 14 additions & 1 deletion flocking/flocking-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,15 +1017,28 @@ var fluid = fluid || require("infusion"),
/**
* Starts generating samples from all synths.
*/
that.play = function () {
that.start = function () {
if (that.model.isPlaying) {
return;
}

that.audioStrategy.start();
that.model.isPlaying = true;
};

/**
* Deprecated. Use start() instead.
*/
that.play = that.start;

/**
* Stops generating samples from all synths.
*/
that.stop = function () {
if (!that.model.isPlaying) {
return;
}

that.audioStrategy.stop();
that.model.isPlaying = false;
};
Expand Down
8 changes: 4 additions & 4 deletions flocking/flocking-ugens-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ var fluid = fluid || require("infusion"),

that.init = function () {
var m = that.model;
m.target = typeof (that.options.target) === "string" ?
document.querySelector(that.options.target) : that.options.target || window;
m.target.addEventListener("mousedown", that.mouseDownListener, false);
m.target.addEventListener("mouseup", that.mouseUpListener, false);
m.target = !that.options.target ? $(window) : $(that.options.target);

m.target.mousedown(that.mouseDownListener);
m.target.mouseup(that.mouseUpListener);

that.onInputChanged();
};
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ <h2>What is Flocking?</h2>
(2014).</p>

<p>The latest stable release of Flocking is
<a href="https://github.com/colinbdclark/Flocking/releases/tag/0.1.1">version 0.1.1</a>.
<a href="https://github.com/colinbdclark/Flocking/releases/tag/0.1.2">version 0.1.2</a>.
It is distributed under both the MIT and GPL licenses.</p>

<ul class="nav-menu cf">
<li>
<a href="demos/interactive/html/playground.html">Try Flocking</a>
</li>
<li>
<a href="https://github.com/colinbdclark/Flocking/releases/tag/0.1.1">Download v0.1.1</a>
<a href="https://github.com/colinbdclark/Flocking/releases/tag/0.1.2">Download v0.1.2</a>
</li>
<li>
<a href="https://github.com/colinbdclark/flocking">Source Code</a>
Expand Down
2 changes: 1 addition & 1 deletion nodejs/demos/audio-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ flock.synth({
}
});

enviro.play();
enviro.start();
2 changes: 1 addition & 1 deletion nodejs/demos/fast-scheduling.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ flock.demo.nodeTest = function () {
};

flock.demo.nodeTest();
enviro.play();
enviro.start();
console.log("Playing...");
2 changes: 1 addition & 1 deletion nodejs/demos/filtered-noise-and-sine.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var synth = flock.synth({
}
});

enviro.play();
enviro.start();
console.log("Playing...");

var clock = flock.scheduler.async();
Expand Down
2 changes: 1 addition & 1 deletion nodejs/demos/four-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ flock.synth({
]
});

enviro.play();
enviro.start();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flocking",
"version": "0.1.1",
"version": "0.1.2",
"description": "Creative audio synthesis for the Web and Node.js",
"author": "Colin Clark",
"homepage": "http://flockingjs.org/",
Expand Down

0 comments on commit 2f26906

Please sign in to comment.