本文整理汇总了C++中fmod::System::getDSPHead方法的典型用法代码示例。如果您正苦于以下问题:C++ System::getDSPHead方法的具体用法?C++ System::getDSPHead怎么用?C++ System::getDSPHead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::getDSPHead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel;
FMOD::DSP *dsplowpass, *dspchorus, *dsphead, *dspchannelmixer;
FMOD::DSPConnection *dsplowpassconnection, *dspchorusconnection;
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("DSP effect per speaker example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("===============================================================================\n");
printf("Press 'L' to toggle lowpass on/off on left speaker only\n");
printf("Press 'R' to toggle chorus on/off on right speaker only\n");
printf("Press '[' to pan sound left\n");
printf("Press ']' to pan sound right\n");
printf("Press 'Esc' to quit\n");
printf("\n");
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Create the DSP effects.
*/
result = system->createDSPByType(FMOD_DSP_TYPE_LOWPASS, &dsplowpass);
ERRCHECK(result);
result = system->createDSPByType(FMOD_DSP_TYPE_CHORUS, &dspchorus);
ERRCHECK(result);
/*
Connect up the DSP network
*/
/*
When a sound is played, a subnetwork is set up in the DSP network which looks like this.
Wavetable is the drumloop sound, and it feeds its data from right to left.
[DSPHEAD]<------------[DSPCHANNELMIXER]
*/
result = system->getDSPHead(&dsphead);
ERRCHECK(result);
result = dsphead->getInput(0, &dspchannelmixer, 0);
ERRCHECK(result);
/*
Now disconnect channeldsp head from wavetable to look like this.
[DSPHEAD] [DSPCHANNELMIXER]
*/
result = dsphead->disconnectFrom(dspchannelmixer);
ERRCHECK(result);
/*
Now connect the 2 effects to channeldsp head.
Store the 2 connections this makes so we can set their speakerlevels later.
[DSPLOWPASS]
/x
[DSPHEAD] [DSPCHANNELMIXER]
\y
[DSPCHORUS]
*/
result = dsphead->addInput(dsplowpass, &dsplowpassconnection); /* x = dsplowpassconnection */
ERRCHECK(result);
result = dsphead->addInput(dspchorus, &dspchorusconnection); /* y = dspchorusconnection */
ERRCHECK(result);
/*
Now connect the wavetable to the 2 effects
[DSPLOWPASS]
/x \
[DSPHEAD] [DSPCHANNELMIXER]
//.........这里部分代码省略.........