本文整理汇总了C++中AudioBuffer::setSample方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioBuffer::setSample方法的具体用法?C++ AudioBuffer::setSample怎么用?C++ AudioBuffer::setSample使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioBuffer
的用法示例。
在下文中一共展示了AudioBuffer::setSample方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processFifo
//.........这里部分代码省略.........
changeLevel = jmax (2, changeLevel);
currentInfo.sourceType = SourceType::sourceAudioFile;
currentInfo.fileImpulseResponse = newFile;
currentInfo.sourceData = nullptr;
currentInfo.sourceDataSize = 0;
}
else if (newSourceType == SourceType::sourceAudioBuffer)
{
double bufferSampleRate (arrayParameters->getUnchecked (1));
changeLevel = jmax (2, changeLevel);
currentInfo.sourceType = SourceType::sourceAudioBuffer;
currentInfo.bufferSampleRate = bufferSampleRate;
currentInfo.fileImpulseResponse = File();
currentInfo.sourceData = nullptr;
currentInfo.sourceDataSize = 0;
}
}
break;
case ChangeRequest::changeImpulseResponseSize:
{
int64 newSize = requestParameters[n];
if (currentInfo.impulseResponseSize != (size_t) newSize)
changeLevel = jmax (1, changeLevel);
currentInfo.impulseResponseSize = (size_t) newSize;
}
break;
case ChangeRequest::changeStereo:
{
bool newWantsStereo = requestParameters[n];
if (currentInfo.wantsStereo != newWantsStereo)
changeLevel = jmax (1, changeLevel);
currentInfo.wantsStereo = newWantsStereo;
}
break;
case ChangeRequest::changeTrimming:
{
bool newWantsTrimming = requestParameters[n];
if (currentInfo.wantsTrimming != newWantsTrimming)
changeLevel = jmax(1, changeLevel);
currentInfo.wantsTrimming = newWantsTrimming;
}
break;
default:
jassertfalse;
break;
}
}
if (currentInfo.sourceType == SourceType::sourceNone)
{
currentInfo.sourceType = SourceType::sourceAudioBuffer;
if (currentInfo.sampleRate == 0)
currentInfo.sampleRate = 44100;
if (currentInfo.maximumBufferSize == 0)
currentInfo.maximumBufferSize = 128;
currentInfo.bufferSampleRate = currentInfo.sampleRate;
currentInfo.impulseResponseSize = 1;
currentInfo.fileImpulseResponse = File();
currentInfo.sourceData = nullptr;
currentInfo.sourceDataSize = 0;
AudioBuffer<float> newBuffer;
newBuffer.setSize (1, 1);
newBuffer.setSample (0, 0, 1.f);
copyBufferToTemporaryLocation (newBuffer);
}
// action depending on the change level
if (changeLevel == 3)
{
interpolationBuffer.setSize (2, static_cast<int> (currentInfo.maximumBufferSize));
processImpulseResponse();
initializeConvolutionEngines();
}
else if (changeLevel == 2)
{
startThread();
}
else if (changeLevel == 1)
{
startThread();
}
}