本文整理汇总了C++中fmod::DSP::setParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ DSP::setParameter方法的具体用法?C++ DSP::setParameter怎么用?C++ DSP::setParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::DSP
的用法示例。
在下文中一共展示了DSP::setParameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addEffect
void FMOD_Sound::addEffect(int module_id, int type, float value)
{
float normalized_value = value / 100.0f;
switch(type)
{
case Reverb:
FMOD::DSP * reverb;
system->createDSPByType(FMOD_DSP_TYPE_REVERB, &reverb);
channelMap[module_id]->addDSP(reverb, 0);
reverb->setParameter(FMOD_DSP_REVERB_ROOMSIZE, normalized_value);
reverbMap[module_id] = reverb;
break;
case Pitch:
FMOD::DSP * pitch;
system->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &pitch);
channelMap[module_id]->addDSP(pitch, 0);
pitch->setParameter(0, normalized_value);
pitchMap[module_id] = pitch;
break;
case Distortion:
FMOD::DSP * distortion;
system->createDSPByType(FMOD_DSP_TYPE_DISTORTION, &distortion);
channelMap[module_id]->addDSP(distortion, 0);
distortion->setParameter(0, normalized_value);
distortionMap[module_id] = distortion;
break;
case Echo:
FMOD::DSP * echo;
system->createDSPByType(FMOD_DSP_TYPE_ECHO, &echo);
channelMap[module_id]->addDSP(echo, 0);
echo->setParameter(0, normalized_value);
echoMap[module_id] = echo;
break;
case Flange:
FMOD::DSP * flange;
system->createDSPByType(FMOD_DSP_TYPE_FLANGE, &flange);
channelMap[module_id]->addDSP(flange, 0);
flange->setParameter(0, normalized_value);
flangeMap[module_id] = flange;
break;
default:
break;
}
}
示例2: main
//.........这里部分代码省略.........
paused = !paused;
result = channel[0]->setPaused(paused);
ERRCHECK(result);
lineCount++;
//printf("Line Count: %d \n", lineCount);
break;
}
if (line.compare("iVol") == 0){
channel[0]->getVolume(&volume);
channel[0]->setVolume(1.0f);
lineCount++;
//printf("Line Count: %d \n", lineCount);
break;
}
if (line.compare("dVol") == 0){
channel[0]->getVolume(&volume);
channel[0]->setVolume(.1);
lineCount++;
//printf("Line Count: %d \n", lineCount);
break;
}
if (line.compare("iPitch") == 0){
result = dsppitch->remove();
ERRCHECK(result);
result = system->addDSP(dsppitch, 0);
ERRCHECK(result);
inc++;
pitch = pow(1.059f,inc);
result = dsppitch->setParameter(FMOD_DSP_PITCHSHIFT_PITCH, pitch);
ERRCHECK(result);
lineCount++;
//printf("Line Count: %d \n", lineCount);
break;
}
if (line.compare("dPitch") == 0){
result = dsppitch->remove();
ERRCHECK(result);
result = system->addDSP(dsppitch, 0);
ERRCHECK(result);
inc--;
pitch = pow(1.059,inc);
result = dsppitch->setParameter(FMOD_DSP_PITCHSHIFT_PITCH, pitch);
ERRCHECK(result);
lineCount++;
//printf("Line Count: %d \n", lineCount);
break;
}
if (line.compare("left") == 0){
result = channel[0]->setSpeakerMix(1.0f, 0, 0, 0, 0, 0, 0, 0);
ERRCHECK(result);
lineCount++;
//printf("Line Count: %d \n", lineCount);
break;
}
if (line.compare("right") == 0){
示例3: main
//.........这里部分代码省略.........
result = dsphighpass->getActive(&active);
ERRCHECK(result);
if (active)
{
result = dsphighpass->remove();
ERRCHECK(result);
}
else
{
result = system->addDSP(dsphighpass, 0);
ERRCHECK(result);
}
break;
}
case '3' :
{
bool active;
result = dspecho->getActive(&active);
ERRCHECK(result);
if (active)
{
result = dspecho->remove();
ERRCHECK(result);
}
else
{
result = system->addDSP(dspecho, 0);
ERRCHECK(result);
result = dspecho->setParameter(FMOD_DSP_ECHO_DELAY, 50.0f);
ERRCHECK(result);
}
break;
}
case '4' :
{
bool active;
result = dspflange->getActive(&active);
ERRCHECK(result);
if (active)
{
result = dspflange->remove();
ERRCHECK(result);
}
else
{
result = system->addDSP(dspflange, 0);
ERRCHECK(result);
}
break;
}
case '5' :
{
bool active;
result = dspdistortion->getActive(&active);
ERRCHECK(result);
if (active)
{
示例4: main
//.........这里部分代码省略.........
exinfo.defaultfrequency = RECORDRATE;
exinfo.length = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 5; /* 5 second buffer, doesnt really matter how big this is, but not too small of course. */
result = system->createSound(0, FMOD_2D | FMOD_SOFTWARE | FMOD_LOOP_NORMAL | FMOD_OPENUSER, &exinfo, &sound);
ERRCHECK(result);
printf("========================================================================\n");
printf("Record with realtime playback example.\n");
printf("Copyright (c) Firelight Technologies 2004-2014.\n");
printf("\n");
printf("Try #define LOWLATENCY to reduce latency for more modern machines!\n");
printf("========================================================================\n");
printf("\n");
printf("Press a key to start recording. Playback will start %d samples (%d ms) later.\n", LATENCY, LATENCY * 1000 / RECORDRATE);
printf("\n");
_getch();
printf("Press 'E' to toggle an effect on/off.\n");
printf("Press 'Esc' to quit\n");
printf("\n");
result = system->recordStart(0, sound, true);
ERRCHECK(result);
result = sound->getLength(&soundlength, FMOD_TIMEUNIT_PCM);
ERRCHECK(result);
/*
Create a DSP effect to play with.
*/
result = system->createDSPByType(FMOD_DSP_TYPE_FLANGE, &dsp);
ERRCHECK(result);
result = dsp->setParameter(FMOD_DSP_FLANGE_RATE, 4.0f);
ERRCHECK(result);
result = dsp->setBypass(true);
ERRCHECK(result);
adjustedlatency = LATENCY; /* This might change depending on record block size. */
/*
Main loop.
*/
do
{
static unsigned int lastrecordpos = 0, samplesrecorded = 0;
unsigned int recordpos = 0, recorddelta;
key = 0;
if (_kbhit())
{
key = _getch();
}
if (key == 'e' || key == 'E')
{
bool bypass;
dsp->getBypass(&bypass);
dsp->setBypass(!bypass);
if (bypass)
{
FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_CONCERTHALL;
system->setReverbProperties(&prop);
}
else
{
示例5: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Channel *channel = 0;
FMOD::DSP *dsp = 0;
FMOD_RESULT result;
int key;
unsigned int version;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
getch();
return 0;
}
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
/*
Create an oscillator DSP unit for the tone.
*/
result = system->createDSPByType(FMOD_DSP_TYPE_OSCILLATOR, &dsp);
ERRCHECK(result);
result = dsp->setParameter(FMOD_DSP_OSCILLATOR_RATE, 440.0f);
ERRCHECK(result);
printf("======================================================================\n");
printf("GenerateTone Example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("======================================================================\n\n");
printf("\n");
printf("Press '1' to play a sine wave\n");
printf("Press '2' to play a square wave\n");
printf("Press '3' to play a triangle wave\n");
printf("Press '4' to play a saw wave\n");
printf("Press '5' to play a white noise\n");
printf("Press 's' to stop channel\n");
printf("\n");
printf("Press 'v'/'V' to change channel volume\n");
printf("Press 'f'/'F' to change channel frequency\n");
printf("Press '['/']' to change channel pan\n");
printf("Press 'Esc' to quit\n");
printf("\n");
/*
Main loop
*/
do
{
if (kbhit())
{
key = getch();
switch (key)
{
case '1' :
{
result = system->playDSP(FMOD_CHANNEL_REUSE, dsp, true, &channel);
channel->setVolume(0.5f);
result = dsp->setParameter(FMOD_DSP_OSCILLATOR_TYPE, 0);
ERRCHECK(result);
channel->setPaused(false);
break;
}
case '2' :
{
result = system->playDSP(FMOD_CHANNEL_REUSE, dsp, true, &channel);
channel->setVolume(0.125f);
result = dsp->setParameter(FMOD_DSP_OSCILLATOR_TYPE, 1);
ERRCHECK(result);
channel->setPaused(false);
break;
}
case '3' :
{
result = system->playDSP(FMOD_CHANNEL_REUSE, dsp, true, &channel);
channel->setVolume(0.5f);
result = dsp->setParameter(FMOD_DSP_OSCILLATOR_TYPE, 2);
ERRCHECK(result);
channel->setPaused(false);
break;
}
case '4' :
{
result = system->playDSP(FMOD_CHANNEL_REUSE, dsp, true, &channel);
channel->setVolume(0.125f);
result = dsp->setParameter(FMOD_DSP_OSCILLATOR_TYPE, 4);
//.........这里部分代码省略.........