Skip to content

Commit

Permalink
build v0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mohayonao committed Dec 26, 2013
1 parent 24c44a0 commit c13a9ae
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 88 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coffee-collider",
"version": "0.2.5",
"version": "0.2.6",
"authors": [
"Nao Yonamine <mohayonao@gmail.com>"
],
Expand Down
83 changes: 41 additions & 42 deletions build/coffee-collider-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ define('cc/loader', function(require, exports, module) {
define('cc/cc', function(require, exports, module) {

module.exports = {
version: "0.2.5",
version: "0.2.6",
global : {},
Object : function() {},
ugen : {specs:{}},
Expand Down Expand Up @@ -439,6 +439,8 @@ define('cc/client/client', function(require, exports, module) {
strm = this.strmList[this.strmListReadIndex & 7];
this.strmListReadIndex += 1;
this.strm.set(strm);
} else {
this.strm.set(this.clear);
}
this.syncItemsUInt32[1] = ++this.syncCount;
this.sendToLang(this.syncItems);
Expand Down Expand Up @@ -789,17 +791,23 @@ define('cc/common/audioapi-webaudio', function(require, exports, module) {
this.channels = 2;
this.type = "Web Audio API";
this.delegate = !!opts.AudioContext;
this.jsNode = null;
}
WebAudioAPI.prototype.init = function() {
var sys = this.sys;
var onaudioprocess;
};
WebAudioAPI.prototype.play = function() {
var sys = this.sys;
var strm = sys.strm;
var strmLength = sys.strmLength;
var strmLength4 = strmLength * 4;
var strmL = new Float32Array(strm.buffer, 0, strmLength);
var strmR = new Float32Array(strm.buffer, strmLength4);
if (this.sys.speaker) {
if (this.sys.sampleRate === this.sampleRate) {
var onaudioprocess, jsNode;

jsNode = this.context.createScriptProcessor(strmLength, 2, this.channels);

if (sys.speaker) {
if (sys.sampleRate === this.sampleRate) {
onaudioprocess = function(e) {
var outs = e.outputBuffer;
sys.process();
Expand All @@ -812,56 +820,47 @@ define('cc/common/audioapi-webaudio', function(require, exports, module) {
sys.process();
};
}
this.bufSrc = this.context.createBufferSource();
if (this.context.createScriptProcessor) {
this.jsNode = this.context.createScriptProcessor(strmLength, 2, this.channels);
} else {
this.jsNode = this.context.createJavaScriptNode(strmLength, 2, this.channels);
}
this.jsNode.onaudioprocess = onaudioprocess;
};
WebAudioAPI.prototype.play = function() {
if (!this.bufSrc) {
return; // TODO: throw an error
}
if (this.bufSrc.noteOn) {
this.bufSrc.noteOn(0);
this.bufSrc.connect(this.jsNode);
}
jsNode.onaudioprocess = onaudioprocess;

if (!this.delegate) {
this.jsNode.connect(this.context.destination);
jsNode.connect(this.context.destination);
}
this.jsNode = jsNode;
};
WebAudioAPI.prototype.pause = function() {
if (!this.bufSrc) {
if (!this.jsNode) {
return; // TODO: throw an error
}
this.bufSrc.disconnect();
if (!this.delegate) {
this.jsNode.disconnect();
}
this.jsNode.onaudioprocess = null;
this.jsNode = null;
};
WebAudioAPI.prototype.decodeAudioFile = function(buffer, callback) {
buffer = this.context.createBuffer(buffer, false);
var bufLength = buffer.length;
var numChannels = buffer.numberOfChannels;
var numSamples = bufLength * numChannels;
var samples = new Float32Array(numSamples);
var i, j, k = 0;
var channelData = new Array(numChannels);
for (j = 0; j < numChannels; ++j) {
channelData[j] = buffer.getChannelData(j);
}
for (i = 0; i < bufLength; ++i) {
this.context.decodeAudioData(buffer, function(buffer) {
var bufLength = buffer.length;
var numChannels = buffer.numberOfChannels;
var numSamples = bufLength * numChannels;
var samples = new Float32Array(numSamples);
var i, j, k = 0;
var channelData = new Array(numChannels);
for (j = 0; j < numChannels; ++j) {
samples[k++] = channelData[j][i];
channelData[j] = buffer.getChannelData(j);
}
}
callback(null, {
sampleRate : buffer.sampleRate,
numChannels: buffer.numberOfChannels,
numFrames : buffer.length,
samples : samples
for (i = 0; i < bufLength; ++i) {
for (j = 0; j < numChannels; ++j) {
samples[k++] = channelData[j][i];
}
}
callback(null, {
sampleRate : buffer.sampleRate,
numChannels: buffer.numberOfChannels,
numFrames : buffer.length,
samples : samples
});
}, function(err) {
callback(err);
});
};
return WebAudioAPI;
Expand Down
4 changes: 2 additions & 2 deletions build/coffee-collider.js

Large diffs are not rendered by default.

83 changes: 41 additions & 42 deletions extras/edge/coffee-collider.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ define('cc/loader', function(require, exports, module) {
define('cc/cc', function(require, exports, module) {

module.exports = {
version: "0.2.5+20131224221100",
version: "0.2.6+20131226193500",
global : {},
Object : function() {},
ugen : {specs:{}},
Expand Down Expand Up @@ -439,6 +439,8 @@ define('cc/client/client', function(require, exports, module) {
strm = this.strmList[this.strmListReadIndex & 7];
this.strmListReadIndex += 1;
this.strm.set(strm);
} else {
this.strm.set(this.clear);
}
this.syncItemsUInt32[1] = ++this.syncCount;
this.sendToLang(this.syncItems);
Expand Down Expand Up @@ -789,17 +791,23 @@ define('cc/common/audioapi-webaudio', function(require, exports, module) {
this.channels = 2;
this.type = "Web Audio API";
this.delegate = !!opts.AudioContext;
this.jsNode = null;
}
WebAudioAPI.prototype.init = function() {
var sys = this.sys;
var onaudioprocess;
};
WebAudioAPI.prototype.play = function() {
var sys = this.sys;
var strm = sys.strm;
var strmLength = sys.strmLength;
var strmLength4 = strmLength * 4;
var strmL = new Float32Array(strm.buffer, 0, strmLength);
var strmR = new Float32Array(strm.buffer, strmLength4);
if (this.sys.speaker) {
if (this.sys.sampleRate === this.sampleRate) {
var onaudioprocess, jsNode;

jsNode = this.context.createScriptProcessor(strmLength, 2, this.channels);

if (sys.speaker) {
if (sys.sampleRate === this.sampleRate) {
onaudioprocess = function(e) {
var outs = e.outputBuffer;
sys.process();
Expand All @@ -812,56 +820,47 @@ define('cc/common/audioapi-webaudio', function(require, exports, module) {
sys.process();
};
}
this.bufSrc = this.context.createBufferSource();
if (this.context.createScriptProcessor) {
this.jsNode = this.context.createScriptProcessor(strmLength, 2, this.channels);
} else {
this.jsNode = this.context.createJavaScriptNode(strmLength, 2, this.channels);
}
this.jsNode.onaudioprocess = onaudioprocess;
};
WebAudioAPI.prototype.play = function() {
if (!this.bufSrc) {
return; // TODO: throw an error
}
if (this.bufSrc.noteOn) {
this.bufSrc.noteOn(0);
this.bufSrc.connect(this.jsNode);
}
jsNode.onaudioprocess = onaudioprocess;

if (!this.delegate) {
this.jsNode.connect(this.context.destination);
jsNode.connect(this.context.destination);
}
this.jsNode = jsNode;
};
WebAudioAPI.prototype.pause = function() {
if (!this.bufSrc) {
if (!this.jsNode) {
return; // TODO: throw an error
}
this.bufSrc.disconnect();
if (!this.delegate) {
this.jsNode.disconnect();
}
this.jsNode.onaudioprocess = null;
this.jsNode = null;
};
WebAudioAPI.prototype.decodeAudioFile = function(buffer, callback) {
buffer = this.context.createBuffer(buffer, false);
var bufLength = buffer.length;
var numChannels = buffer.numberOfChannels;
var numSamples = bufLength * numChannels;
var samples = new Float32Array(numSamples);
var i, j, k = 0;
var channelData = new Array(numChannels);
for (j = 0; j < numChannels; ++j) {
channelData[j] = buffer.getChannelData(j);
}
for (i = 0; i < bufLength; ++i) {
this.context.decodeAudioData(buffer, function(buffer) {
var bufLength = buffer.length;
var numChannels = buffer.numberOfChannels;
var numSamples = bufLength * numChannels;
var samples = new Float32Array(numSamples);
var i, j, k = 0;
var channelData = new Array(numChannels);
for (j = 0; j < numChannels; ++j) {
samples[k++] = channelData[j][i];
channelData[j] = buffer.getChannelData(j);
}
}
callback(null, {
sampleRate : buffer.sampleRate,
numChannels: buffer.numberOfChannels,
numFrames : buffer.length,
samples : samples
for (i = 0; i < bufLength; ++i) {
for (j = 0; j < numChannels; ++j) {
samples[k++] = channelData[j][i];
}
}
callback(null, {
sampleRate : buffer.sampleRate,
numChannels: buffer.numberOfChannels,
numFrames : buffer.length,
samples : samples
});
}, function(err) {
callback(err);
});
};
return WebAudioAPI;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coffee-collider",
"version": "0.2.5",
"version": "0.2.6",
"description": "Sound Processing Language for Web Audio",
"keywords": [
"language",
Expand Down

0 comments on commit c13a9ae

Please sign in to comment.