Changes to the other objects to make them thready
* .cpp stub references threaded template, changes name to full name of SC class * SC class gets kr method, process wraps thisnix
parent
d628c90433
commit
7277a5e41d
@ -1,21 +1,51 @@
|
|||||||
FluidBufLoudness{
|
FluidBufLoudness : UGen{
|
||||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, action;
|
|
||||||
|
|
||||||
var maxwindowSize = windowSize.nextPowerOfTwo;
|
var <>server, <>synth;
|
||||||
|
|
||||||
source = source.asUGenInput;
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, doneAction = 0|
|
||||||
features = features.asUGenInput;
|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
var maxwindowSize = windowSize.nextPowerOfTwo;
|
||||||
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
|
||||||
|
|
||||||
server = server ? Server.default;
|
source = source.asUGenInput;
|
||||||
|
features = features.asUGenInput;
|
||||||
|
|
||||||
forkIfNeeded{
|
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
||||||
server.sendMsg(\cmd, \BufLoudness, source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize);
|
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
||||||
server.sync;
|
|
||||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
^this.multiNew('control', source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize, doneAction);
|
||||||
action.value(features);
|
}
|
||||||
};
|
|
||||||
}
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, action|
|
||||||
|
|
||||||
|
var synth, instance;
|
||||||
|
source = source.asUGenInput;
|
||||||
|
features = features.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
||||||
|
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
||||||
|
|
||||||
|
server = server ? Server.default;
|
||||||
|
server.ifNotRunning({
|
||||||
|
"WARNING: Server not running".postln;
|
||||||
|
^nil;
|
||||||
|
});
|
||||||
|
synth = {instance = FluidBufLoudness.kr(source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, doneAction:Done.freeSelf)}.play(server);
|
||||||
|
|
||||||
|
forkIfNeeded{
|
||||||
|
synth.waitForFree;
|
||||||
|
server.sync;
|
||||||
|
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||||
|
action.value(features);
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.server = server;
|
||||||
|
instance.synth = synth;
|
||||||
|
^instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cancel{
|
||||||
|
if(this.server.notNil)
|
||||||
|
{this.server.sendMsg("/u_cmd", this.synth.nodeID, this.synthIndex, "cancel")};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,51 @@
|
|||||||
FluidBufMFCC{
|
FluidBufMFCC : UGen{
|
||||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, action;
|
var <>server, <>synth;
|
||||||
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, doneAction = 0|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
source = source.asUGenInput;
|
||||||
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
features = features.asUGenInput;
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||||
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||||
|
// same goes to maxNumCoeffs, which is passed numCoeffs in this case
|
||||||
|
|
||||||
server = server ? Server.default;
|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, numCoeffs, windowSize, hopSize, fftSize, maxFFTSize, doneAction);
|
||||||
|
}
|
||||||
|
|
||||||
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||||
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
var synth, instance;
|
||||||
// same goes to maxNumCoeffs, which is passed numCoeffs in this case
|
|
||||||
|
|
||||||
forkIfNeeded{
|
source = source.asUGenInput;
|
||||||
server.sendMsg(\cmd, \BufMFCC, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, numCoeffs, windowSize, hopSize, fftSize, maxFFTSize);
|
features = features.asUGenInput;
|
||||||
server.sync;
|
|
||||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
action.value(features);
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
};
|
|
||||||
}
|
server = server ? Server.default;
|
||||||
|
server.ifNotRunning({
|
||||||
|
"WARNING: Server not running".postln;
|
||||||
|
^nil;
|
||||||
|
});
|
||||||
|
synth = { instance = FluidBufMFCC.kr(source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize, doneAction:Done.freeSelf)}.play(server);
|
||||||
|
|
||||||
|
forkIfNeeded{
|
||||||
|
synth.waitForFree;
|
||||||
|
server.sync;
|
||||||
|
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||||
|
action.value(features);
|
||||||
|
};
|
||||||
|
|
||||||
|
instance.synth = synth;
|
||||||
|
instance.server = server;
|
||||||
|
^instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel{
|
||||||
|
if(this.server.notNil)
|
||||||
|
{this.server.sendMsg("/u_cmd", this.synth.nodeID, this.synthIndex, "cancel")};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue