I have another question.When I Load a DSP Plugin like “fmod_noise.dll” which given by fmod examples, play a song,but there is no voice at all.My code in below, I really do not know what’s wrong with it.
unsigned int baseHandle;
unsigned int handle;
for (int index = 0; index getNestedPlugin(baseHandle, index, &handle);
system->getPluginInfo(handle, &type, 0, 0, 0);
// we have an output plugin, a dsp plugin, or a codec plugin here …
result = system->createDSPByPlugin(handle, &mydsp);
result = system->getMasterChannelGroup(&mastergroup);
result = mastergroup->addDSP(0, mydsp);
system->playSound(sound1, 0, false, &channel);
For a generator dsp like fmod_noise, you will want to use System::playDSP, this will add it to the tail of the channelGroup provided (masterChannel group if not specified) so you don’t want to be calling masterGroup->addDSP() manually.
You are right, Thanks Very much.But in this method,how can I change the DSP Index?Can I Use the Channels’s method “setDSPIndex”?
It isn’t possible to change the index of a dsp when it is used with playDSP. This is because playDSP is for playing ‘generator’ DSP’s which have no input and only output.
If you want to make your own DSP that works the same as fmod_noise but takes in signal and mixes it with the DSP’s generated signal, you would then use it as a normal DSP and not need to use playDSP.
As you say,that’s a complete contradiction.If I use it as a normal DSP, and call masterGroup->addDSP(),it plays no sound.But if I use playDSP,I cna’t chnage tje index.Am I right?
The reason you cannot use it as a normal DSP is because it does not use an input signal, it is used to generate signal. DSP’s used for generating signal require the use of playDSP, and no you cannot change the index when using playDSP.