本文整理汇总了C++中TTAudioSignalArrayPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TTAudioSignalArrayPtr类的具体用法?C++ TTAudioSignalArrayPtr怎么用?C++ TTAudioSignalArrayPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTAudioSignalArrayPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TTErr Slinky3D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTUInt16 numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 3) {
TTValue v = 3;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTSampleValuePtr outSampleZ = out.mSampleVectors[2];
TTFloat64 phi, temp;
for (int i=0; i<vs; i++) {
phi = inSampleX[i] * kTTTwoPi - kTTTwoPi; // -2Pi .. 2Pi
temp = mB + mA*cos(phi);
outSampleX[i] = temp*cos(phi);
outSampleY[i] = temp*sin(phi);
outSampleZ[i] = mC*(inSampleX[i]-1.0) + mA*sin(phi);
}
return kTTErrNone;
}
示例2: processAudio
// TODO: this unit requires 1 input and 2 outputs -- it does not yet configure itself for other arrangements!
TTErr TTZerocross::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTAudioSignal& out = outputs->getSignal(0);
TTUInt16 vs = in.getVectorSizeAsInt();
TTSampleValue* inSample;
TTSampleValue* out1Sample;
TTSampleValue* out2Sample;
TTBoolean thisSampleIsOverZero;
TTBoolean zeroxOccured;
inSample = in.mSampleVectors[0];
out1Sample = out.mSampleVectors[0];
out2Sample = out.mSampleVectors[1];
while (vs--) {
thisSampleIsOverZero = (0 < (*inSample++));
zeroxOccured = lastSampleWasOverZero != thisSampleIsOverZero;
lastSampleWasOverZero = thisSampleIsOverZero;
counter += zeroxOccured;
analysisLocation++;
if (analysisLocation >= mSize) {
finalCount = ((sr * counter) * rSize) * srInv;
analysisLocation = 0;
counter = 0;
}
*out1Sample++ = finalCount;
*out2Sample++ = zeroxOccured;
}
return kTTErrNone;
}
示例3: pow
TTErr Bean2D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 2) {
TTValue v = 2;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTFloat64 phi, r;
for (int i=0; i<vs; i++) {
phi = inSampleX[i] * kTTPi; // 0 .. 2Pi
r = pow(sin(phi),3.0) + pow(cos(phi), 3.0);
outSampleX[i] = sin(phi) * r;
outSampleY[i] = cos(phi) * r;
}
return kTTErrNone;
}
示例4: cos
TTErr Hypocycloid2D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 2) {
TTValue v = 2;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTFloat64 phi;
for (int i=0; i<vs; i++) {
phi = inSampleX[i] * kTTPi; // 0 .. 2Pi
outSampleX[i] = aMinusOne * cos(phi) + cos(aMinusOne * phi);
outSampleY[i] = aMinusOne * sin(phi) + sin(aMinusOne * phi);
}
return kTTErrNone;
}
示例5: sin
TTErr CircularHelix3D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 3) {
TTValue v = 3;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTSampleValuePtr outSampleZ = out.mSampleVectors[2];
TTFloat64 phi;
for (int i=0; i<vs; i++) {
phi = inSampleX[i] * kTTPi; // 0 .. 2Pi
outSampleX[i] = sin(phi);
outSampleY[i] = cos(phi);
outSampleZ[i] = mA * (inSampleX[i]-1.0); //scaling 0 ..2 to -1.. 1
}
return kTTErrNone;
}
示例6: processAudio
TTErr TTDegrade::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTAudioSignal& out = outputs->getSignal(0);
TTUInt16 vs;
TTSampleValue *inSample,
*outSample;
TTUInt16 numchannels = TTAudioSignal::getMinChannelCount(in, out);
TTUInt16 channel;
long l;
for (channel=0; channel<numchannels; channel++) {
inSample = in.mSampleVectors[channel];
outSample = out.mSampleVectors[channel];
vs = in.getVectorSizeAsInt();
while (vs--) {
// SampeRate Reduction
mAccumulator[channel] += mSrRatio;
if (mAccumulator[channel] >= 1.0) {
mOutput[channel] = *inSample++;
mAccumulator[channel] -= 1.0;
}
// BitDepth Reduction
l = (long)(mOutput[channel] * BIG_INT); // change float to long int
l >>= mBitShift; // shift away the least-significant bits
l <<= mBitShift; // shift back to the correct registers
*outSample++ = (float) l * ONE_OVER_BIG_INT; // back to float
}
}
return kTTErrNone;
}
示例7:
TTErr Linear3D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 3) {
TTValue v = 3;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTSampleValuePtr outSampleZ = out.mSampleVectors[2];
for (int i=0; i<vs; i++) {
outSampleX[i] = inSampleX[i]-1.0;
outSampleY[i] = mA * outSampleX[i];
outSampleZ[i] = mB * outSampleX[i];
}
return kTTErrNone;
}
示例8: processUpsample
TTErr TTStaircase::processUpsample(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTAudioSignal& out = outputs->getSignal(0);
TTSampleValue* inSample;
TTSampleValue* outSample;
TTUInt16 numchannels = TTAudioSignal::getMinChannelCount(in, out);
TTPtrSizedInt channel;
TTUInt16 targetVectorSize = in.getVectorSizeAsInt() * 2;
TTErr err;
err = out.changeVectorSize(targetVectorSize);
if (!err) {
out.setSampleRate(in.getSampleRate() * 2);
for (channel=0; channel<numchannels; channel++) {
TTUInt16 n = in.getVectorSizeAsInt();
TTSampleValue x;
inSample = in.mSampleVectors[channel];
outSample = out.mSampleVectors[channel];
while (n--) {
x = *inSample++;
*outSample++ = x;
*outSample++ = x;
}
}
}
return kTTErrNone;
}
示例9: sin
TTErr Butterfly2D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTUInt16 numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 2) {
TTValue v = 2;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTFloat64 phi, r, temp;
for (int i=0; i<vs; i++) {
phi = inSampleX[i] * kTTPi; // 0 .. 2Pi
temp = sin(1/24*(2*phi-kTTPi));
r = exp(sin(phi)) - 2*cos(4*phi)+pow(temp,5);
outSampleX[i] = sin(phi) * r;
outSampleY[i] = cos(phi) * r;
}
return kTTErrNone;
}
示例10: sin
TTErr Lissajous2D::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& out = outputs->getSignal(0);
TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
if (numOutputChannels != 2) {
TTValue v = 2;
out.setMaxNumChannels(v);
out.setNumChannels(v);
}
TTAudioSignal& in0 = inputs->getSignal(0);
TTUInt16 vs = in0.getVectorSizeAsInt();
TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
TTSampleValuePtr outSampleX = out.mSampleVectors[0];
TTSampleValuePtr outSampleY = out.mSampleVectors[1];
TTFloat64 omega;
for (int i=0; i<vs; i++) {
omega = inSampleX[i] * kTTPi;
outSampleX[i] = sin(omega * mAa + mDeltaX);
outSampleY[i] = sin(omega * mAb);
}
return kTTErrNone;
}
示例11: processAudio
TTErr TTBalance::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTAudioSignal& out = outputs->getSignal(0);
TTUInt16 vs;
TTSampleValue *inSampleA,
*inSampleB,
*outSample;
TTFloat64 tempxA,
absTempxA,
tempxB,
absTempxB,
tempyA,
tempyB;
TTUInt16 channel;
TTUInt16 numChannels;
// Twice as many input channels are expected as output channels
numChannels = TTAudioSignal::getNumChannels(in) / 2;
if (TTAudioSignal::getNumChannels(out) < numChannels)
numChannels = TTAudioSignal::getNumChannels(out);
// This outside loop works through each channel one at a time
for (channel=0; channel<numChannels; channel++) {
// We first expect all channels of inputSignalA, then all channels of inputSignalB
inSampleA = in.mSampleVectors[channel];
inSampleB = in.mSampleVectors[channel+numChannels];
outSample = out.mSampleVectors[channel];
vs = in.getVectorSizeAsInt();
// This inner loop works through each sample within the channel one at a time
while (vs--) {
tempxA = *inSampleA++;
absTempxA = fabs(tempxA);
tempxB = *inSampleB++;
absTempxB = fabs(tempxB);
// Lopass filter left and right signals
tempyA = a0*absTempxA + a1*xm1A[channel] + a2*xm2A[channel] - b1*ym1A[channel] - b2*ym2A[channel];
TTZeroDenormal(tempyA);
tempyB = a0*absTempxB + a1*xm1B[channel] + a2*xm2B[channel] - b1*ym1B[channel] - b2*ym2B[channel];
TTZeroDenormal(tempyB);
// Scale left input to produce output, avoid dividing by zero
if (tempyA)
*outSample++ = tempxA * (tempyB/tempyA);
else
*outSample++ = 0.;
// Update filter values
xm2A[channel] = xm1A[channel];
xm1A[channel] = absTempxA;
ym2A[channel] = ym1A[channel];
ym1A[channel] = tempyA;
xm2B[channel] = xm1B[channel];
xm1B[channel] = absTempxB;
ym2B[channel] = ym1B[channel];
ym1B[channel] = tempyB;
}
}
return kTTErrNone;
}
示例12: processAudio
TTErr TTThru::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTAudioSignal& out = outputs->getSignal(0);
// We can't reliably simply reference in the case of jcom.unpack≈ because of crashes
// not sure what is going wrong with that yet...
//return TTAudioSignal::reference(in, out);
return TTAudioSignal::copy(in, out);
}
示例13: processAudio
TTErr TTSpatBaseRenderer::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTAudioSignal& out = outputs->getSignal(0);
TTUInt16 vs = in.getVectorSizeAsInt();
TTSampleValuePtr inSample;
TTSampleValuePtr outSample;
TTChannelCount numInputChannels = in.getNumChannelsAsInt();
TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
TTChannelCount outChannel;
TTChannelCount inChannel;
TTSampleValue gainValue;
TTInt16 sourceCount = mMixerMatrixCoefficients->getRowCount();
TTInt16 sinkCount = mMixerMatrixCoefficients->getColumnCount();
// If the input signal has more channels than we have sources, the additional channels are ignored.
if (numInputChannels > sourceCount) {
numInputChannels = sourceCount;
}
// Force the right number of sinks
if ( numOutputChannels != sinkCount ) {
TTValue v = sinkCount;
out.setMaxNumChannels(v);
out.setNumChannels(v);
numOutputChannels = sinkCount;
}
// Setting all output signals to zero.
out.clear();
// TODO: Make sure that when we iterate over the matrix, this is done in an efficient way.
for (outChannel=0; outChannel<numOutputChannels; outChannel++) {
outSample = out.mSampleVectors[outChannel];
for (inChannel=0; inChannel<numInputChannels; inChannel++) {
mMixerMatrixCoefficients->get2d(inChannel, outChannel, gainValue);
if (gainValue != 0.0){
inSample = in.mSampleVectors[inChannel];
for (int i=0; i<vs; i++) {
outSample[i] += inSample[i] * gainValue;
}
}
}
}
return kTTErrNone;
}
示例14: bypassProcess
TTErr TTAudioObjectBase::bypassProcess(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
for (TTChannelCount i=0; i<outputs->numAudioSignals; i++) {
TTAudioSignal& out = outputs->getSignal(i);
if (i<inputs->numAudioSignals) {
TTAudioSignal& in = inputs->getSignal(i);
TTAudioSignal::copy(in, out);
}
else
out.clear();
}
return kTTErrNone;
}
示例15: processAudio
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
TTAudioSignal& in = inputs->getSignal(0);
TTUInt16 channelOffset = 0;
for (TTUInt16 i=0; i < outputs->numAudioSignals; i++) {
TTAudioSignal& out = outputs->getSignal(i);
TTUInt16 numChannels = mSplitChannels[i];
// TODO: we don't really want to alloc this memory every time!
out.setMaxNumChannels(numChannels);
out.setNumChannels(numChannels);
TTAudioSignal::copySubset(in, out, channelOffset, channelOffset+numChannels-1);
channelOffset += numChannels;
}
return kTTErrNone;
}