本文整理汇总了C++中fmod::DSP::setParameterData方法的典型用法代码示例。如果您正苦于以下问题:C++ DSP::setParameterData方法的具体用法?C++ DSP::setParameterData怎么用?C++ DSP::setParameterData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::DSP
的用法示例。
在下文中一共展示了DSP::setParameterData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FMOD_Main
int FMOD_Main()
{
void *extradriverdata = 0;
Common_Init(&extradriverdata);
/*
Create a System object and initialize
*/
FMOD_RESULT result;
FMOD::System* system;
result = FMOD::System_Create(&system);
ERRCHECK(result);
unsigned int version;
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
Common_Fatal("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
}
result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);
ERRCHECK(result);
/*
Create a new channel group to hold the convolution DSP unit
*/
FMOD::ChannelGroup* reverbGroup;
result = system->createChannelGroup("reverb", &reverbGroup);
ERRCHECK(result);
/*
Create a new channel group to hold all the channels and process the dry path
*/
FMOD::ChannelGroup* mainGroup;
result = system->createChannelGroup("main", &mainGroup);
ERRCHECK(result);
/*
Create the convultion DSP unit and set it as the tail of the channel group
*/
FMOD::DSP* reverbUnit;
result = system->createDSPByType(FMOD_DSP_TYPE_CONVOLUTIONREVERB, &reverbUnit);
ERRCHECK(result);
result = reverbGroup->addDSP(FMOD_CHANNELCONTROL_DSP_TAIL, reverbUnit);
ERRCHECK(result);
/*
Open the impulse response wav file, but use FMOD_OPENONLY as we want
to read the data into a seperate buffer
*/
FMOD::Sound* irSound;
result = system->createSound(Common_MediaPath("standrews.wav"), FMOD_DEFAULT | FMOD_OPENONLY, NULL, &irSound);
ERRCHECK(result);
/*
Retrieve the sound information for the Impulse Response input file
*/
FMOD_SOUND_FORMAT irSoundFormat;
FMOD_SOUND_TYPE irSoundType;
int irSoundBits, irSoundChannels;
result = irSound->getFormat(&irSoundType, &irSoundFormat, &irSoundChannels, &irSoundBits);
ERRCHECK(result);
unsigned int irSoundLength;
result = irSound->getLength(&irSoundLength, FMOD_TIMEUNIT_PCM);
ERRCHECK(result);
if (irSoundFormat != FMOD_SOUND_FORMAT_PCM16)
{
/*
For simplicity of the example, if the impulse response is the wrong format just display an error
*/
Common_Fatal("Impulse Response file is the wrong audio format");
}
/*
The reverb unit expects a block of data containing a single 16 bit int containing
the number of channels in the impulse response, followed by PCM 16 data
*/
unsigned int irDataLength = sizeof(short) * (irSoundLength * irSoundChannels + 1);
short* irData = (short*)malloc(irDataLength);
irData[0] = irSoundChannels;
unsigned int irDataRead;
result = irSound->readData(&irData[1], irDataLength - sizeof(short), &irDataRead);
ERRCHECK(result);
result = reverbUnit->setParameterData(FMOD_DSP_CONVOLUTION_REVERB_PARAM_IR, irData, irDataLength);
ERRCHECK(result);
/*
Don't pass any dry signal from the reverb unit, instead take the dry part
of the mix from the main signal path
*/
result = reverbUnit->setParameterFloat(FMOD_DSP_CONVOLUTION_REVERB_PARAM_DRY, -80.0f);
ERRCHECK(result);
/*
//.........这里部分代码省略.........