本文整理汇总了C++中fmod::System::addDSP方法的典型用法代码示例。如果您正苦于以下问题:C++ System::addDSP方法的具体用法?C++ System::addDSP怎么用?C++ System::addDSP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::addDSP方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (line.compare("start") == 0){
bool paused;
channel[0]->getPaused(&paused);
ERRCHECK(result);
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);
示例2: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel;
FMOD::DSP *mydsp;
FMOD_RESULT result;
int key;
unsigned int version;
float pan = 0;
/*
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);
return 0;
}
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->createSound("../media/drumloop.wav", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound);
ERRCHECK(result);
printf("===============================================================================\n");
printf("Custom DSP example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("===============================================================================\n");
printf("Press 'f' to activate, deactivate user filter\n");
printf("Press 'Esc' to quit\n");
printf("\n");
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Create the DSP effects.
*/
{
FMOD_DSP_DESCRIPTION dspdesc;
memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION));
strcpy(dspdesc.name, "My first DSP unit");
dspdesc.channels = 0; // 0 = whatever comes in, else specify.
dspdesc.read = myDSPCallback;
dspdesc.userdata = (void *)0x12345678;
result = system->createDSP(&dspdesc, &mydsp);
ERRCHECK(result);
}
/*
Inactive by default.
*/
mydsp->setBypass(true);
/*
Main loop.
*/
result = system->addDSP(mydsp, 0);
/*
Main loop.
*/
do
{
if (kbhit())
{
key = getch();
switch (key)
{
case 'f' :
case 'F' :
{
static bool active = false;
mydsp->setBypass(active);
active = !active;
break;
}
}
}
system->update();
Sleep(10);
} while (key != 27);
//.........这里部分代码省略.........
示例3: main
//.........这里部分代码省略.........
if (kbhit())
{
key = getch();
switch (key)
{
case ' ' :
{
bool paused;
channel->getPaused(&paused);
ERRCHECK(result);
paused = !paused;
result = channel->setPaused(paused);
ERRCHECK(result);
break;
}
case '1' :
{
bool active;
result = dsplowpass->getActive(&active);
ERRCHECK(result);
if (active)
{
result = dsplowpass->remove();
ERRCHECK(result);
}
else
{
result = system->addDSP(dsplowpass, 0);
ERRCHECK(result);
}
break;
}
case '2' :
{
bool active;
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)
{