(buf)loudness - class definition and basic help file skeleton
parent
dddc41c139
commit
b8cbf8767c
@ -0,0 +1,21 @@
|
|||||||
|
FluidBufLoudness{
|
||||||
|
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, winSize = 1024, hopSize = 512, action;
|
||||||
|
|
||||||
|
var maxWinSize = winSize.nextPowerOfTwo;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
forkIfNeeded{
|
||||||
|
server.sendMsg(\cmd, \BufLoudness, source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, winSize, hopSize, maxWinSize);
|
||||||
|
server.sync;
|
||||||
|
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||||
|
action.value(features);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
FluidLoudness : MultiOutUGen {
|
||||||
|
*kr { arg in = 0, kWeighting = 1, truePeak = 1, winSize = 1024, hopSize = 512, maxWinSize = 16384;
|
||||||
|
^this.multiNew('control', in.asAudioRateInput(this), kWeighting, truePeak, winSize, hopSize, maxWinSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
init {arg ...theInputs;
|
||||||
|
inputs = theInputs;
|
||||||
|
^this.initOutputs(2,rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkInputs {
|
||||||
|
if(inputs.at(5).rate != 'scalar') {
|
||||||
|
^(": maxWinSize cannot be modulated.");
|
||||||
|
};
|
||||||
|
^this.checkValidInputs;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue