Commit ced57668 authored by Daniel Clarke's avatar Daniel Clarke

renamed SVF, kick, hats and snare classes. Exposed some variables for maxiClock

parent 8c8ea9ab
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -335,6 +335,9 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("isTick", &maxiClock::isTick)
.property("tick", &maxiClock::getTick, &maxiClock::setTick)
.property("playHead", &maxiClock::getPlayHead, &maxiClock::setPlayHead)
.property("currentCount", &maxiClock::getCurrentCount, &maxiClock::setCurrentCount)
;
......
......@@ -878,14 +878,6 @@ public:
void setTicksPerBeat(int ticksPerBeat);
bool isTick();
void setTick(int tick){
this->tick = tick;
}
int getTick() const{
return tick;
}
maxiOsc timer;
int currentCount;
int lastCount;
......@@ -894,7 +886,33 @@ public:
double bpm;
int ticks;
bool tick;
void setTick(int tick){
this->tick = tick;
}
void setPlayHead(int n){
this->playHead = n;
}
void setCurrentCount(int n){
this->currentCount = n;
}
int getTick() const{
return tick;
}
int getPlayHead() const{
return playHead;
}
int getCurrentCount() const{
return currentCount;
}
};
......
......@@ -25,7 +25,14 @@ maximJs.maxiDistortion = Module.maxiDistortion;
maximJs.maxiFlanger = Module.maxiFlanger;
maximJs.maxiChorus = Module.maxiChorus;
maximJs.maxiDCBlocker = Module.maxiDCBlocker;
maximJs.maxiSVF = Module.maxiSVF;
maximJs.maxiEnvelopeFollower = Module.maxiEnvelopeFollower;
maximJs.maxiKick = Module.maxiKick;
maximJs.maxiSnare = Module.maxiSnare;
maximJs.maxiHats = Module.maxiHats;
maximJs.maxiClock = Module.maxiClock;
// LIBS
......@@ -293,94 +300,4 @@ this.init = function() {
};
return this;
}());
/*
maximJs.maxiAudio = function(){};
maximJs.maxiAudio.output = 0;
maximJs.maxiAudio.numChannels = 2; // should be private
maximJs.maxiAudio.context = null;
maximJs.maxiAudio.source = null;
maximJs.maxiAudio.analyser = null;
maximJs.maxiAudio.jsProcessor = null;
maximJs.maxiAudio.play = function(){};
// don't really need setup??
maximJs.maxiAudio.setup = function(){
console.log("non-overrided setup");
};
// isArray should be second param really
// set num channels and set output as an array
// use this if you want to change number of channels
maximJs.maxiAudio.setNumChannels = function(isArray, numChannels_){
this.numChannels = numChannels_;
this.outputIsArray(isArray, numChannels_);
this.resetAudio();
};
// use this if you want to keep num of outputs but change
// method e.g. array or not
maximJs.maxiAudio.outputIsArray = function(isArray, numChannels_){
if(isArray){
maximJs.maxiAudio.output = new Array(numChannels_);
for(var i = 0; i < numChannels_; i++){
maximJs.maxiAudio.output[i] = 0;
}
} else {
maximJs.maxiAudio.output = 0;
}
};
// function handling audio processing
// called byjsProcessor
maximJs.maxiAudio.process = function(event) {
var numChannels = event.outputBuffer.numberOfChannels;
var outputLength = event.outputBuffer.getChannelData(0).length;
for (var i = 0; i < outputLength; ++i) {
maximJs.maxiAudio.play();
if(maximJs.maxiAudio.output instanceof Array){
for (var channel = 0; channel < numChannels; channel++) {
event.outputBuffer.getChannelData(channel)[i] = maximJs.maxiAudio.output[channel];
}
}
else
{
for (var channel = 0; channel < numChannels; channel++) {
event.outputBuffer.getChannelData(channel)[i] = maximJs.maxiAudio.output;
}
}
}
};
maximJs.maxiAudio.resetAudio = function(){
this.source.disconnect();
this.jsProcessor.disconnect();
this.analyser.disconnect();
this.init();
};
maximJs.maxiAudio.init = function() {
// Temporary patch until all browsers support unprefixed context.
this.context = new (window.AudioContext || window.webkitAudioContext)();
this.source = this.context.createBufferSource();
this.jsProcessor = this.context.createScriptProcessor(4096, this.numChannels, this.numChannels);
this.jsProcessor.onaudioprocess = this.process;
this.analyser = this.context.createAnalyser();
this.analyser.fftSize = 2048;
// Connect the processing graph: source -> jsProcessor -> analyser -> destination
this.source.connect(this.jsProcessor);
this.jsProcessor.connect(this.analyser);
this.analyser.connect(this.context.destination);
};
*/
\ No newline at end of file
}());
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment