0
0

When I want to add a DSP to a whole channelgroup (mastergroup in this case), I use:
[code:15vrmjxd]
pMasterGroup->addDSP(dspTest);
[/code:15vrmjxd]
That works, it will add a echo effect on the whole group.
But lets say I want to remove the DSP on the whole group, how do I proceed?
Because I want to reuse dspTest so I don’t want to release it (then I need to re-initialize) and remove() doesn’t work, it give me "FMOD error! (14) DSP connection error. Connection possibly caused a cyclic dependancy."

So how would I do to remove a DSP effect from a whole group? for a single channel I got it to work, but only beacuse I created a new DSP that points to the original DSP and then release it when not needed anymore, and I hope that isn’t needed for a group aswell?

Because if I use that tactics, I need a extra vector for every channelgroup I have, which I don’t want or am I totally wrong here?

Thanks in advance
Christer

  • You must to post comments
0
0

createDSP does allocs and all sorts of stuff. I wouldnt be creating these and destroying them all of the time, I would do them once somewhere up front.

Adding an existing unit or setActive doesnt cost anything.

  • You must to post comments
0
0

alright, thank you very much

Christer

  • You must to post comments
0
0

Ohh, slaps forehead, solved it…

  • You must to post comments
0
0

Hmm, what am I doing wrong?

I have two different groups (Music, Sound) and if I add the same effect to them both and it works, but when I want to remove the DSP effect only from Sound it will remove all sound coming from that group.

Add looks like this:
[code:hzhginun]result = pSoundGroup->addDSP(m_DSP_Effects[nType]->GetDSP());[/code:hzhginun]

[code:hzhginun]FMOD::DSP *dspTest;

switch(iGroup)
{
case SOUND_GROUP:
    result = pSoundGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
case MUSIC_GROUP:
    result = pMusicGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
}[/code:hzhginun]

And then I use the dspTest to remove the DSP effect from the group[code:hzhginun] result = m_DSP_Effects[nType]->GetDSP()->disconnectFrom(dspTest);
ErrorCheck(result);[/code:hzhginun]
nType is a int to define which effect to remove isn’t this the right way to do it?
Or should I "Init" (createDSPByType) the DSP to a vector when needed or isn’t it better to have it created at cache-stage of the game then during actual ingame?

Anyone must have some experience about this, please enlighten me.

Thanks for reply
Christer

  • You must to post comments
0
0

Inefficent documentation about this, I add a DSP effect to ChannelGroup and when I release/remove the DSP effect I loose all sound from the channel that is playing within that Group. If I have echo on a sound, I want only to remove the echo, but I loose it all when I only release the DSP, what am I doing wrong?

Brett, please, I’m reaching deadline soon, and I spent many hours on different ways to fix this and to understand your documentation about DSP, but with no success.

Help needed
//Christer

  • You must to post comments
0
0

Are you reconnecting the tree back up after removing your DSP?

In the DSP help:

Remarks

Note that when you disconnect a unit, it is up to you to reconnect the network so that data flow can continue.

  • You must to post comments
0
0

this is the complete remove-function I have:
(Both nGroup and nType are defines for which group/effect to remove from, and remove from where)
[code:2u3aokq3]FMOD_RESULT LSound::RemoveDSP_EffectFromChannelGroup(int nGroup, int nType)
{
FMOD::DSP *dspTest = 0;

switch(nGroup)
{
case MASTER_GROUP:
    result = pMasterGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
case SOUND_GROUP:
    result = pSoundGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
case MUSIC_GROUP:
    result = pMusicGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
case EFFECT_GROUP:
    result = pEffectGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
case MENU_GROUP:
    result = pMenuGroup->getDSPHead(&dspTest);
    ErrorCheck(result);
    break;
default:
    cout << "Remove DSP From ChannelGroup problem, can't find group" << endl;
    break;
}
int input = 0, output = 0;
cout << "input: " << dspTest->getNumInputs(&input) << endl;
cout << "output: " << dspTest->getNumOutputs(&output) << endl;

if(nType >= 0)
{
    result = m_DSP_Effects[nType]->GetDSP()->disconnectFrom(dspTest);
    //result = m_DSP_Effects[nType]->GetDSP()->remove();
    ErrorCheck(result);
}
else
{
    cout << "Can't Remove DSP_Effect, wrong Type!" << endl;
}

return result;

}[/code:2u3aokq3]
And I tried different ways to do things, to "re-add" the orginal sound to the DSPHead of the ChannelGroup

Called with from main:
[code:2u3aokq3]LS->RemoveDSP_EffectFromChannelGroup(MUSIC_GROUP, DSP_TYPE_ECHO);[/code:2u3aokq3]
From FMOD documentation about AddDSP I found:
[quote:2u3aokq3]int numinputs;
channel->getDSPHead(&dsphead);
dsphead->getNumInputs(&numinputs);
if (numinputs > 1)
{return FMOD_ERR_DSP_TOOMANYCONNECTIONS;
}
dsphead->getInput(0, &next);
dsphead->disconnectFrom(next);
dsphead->addInput(dsp);
dsp->addInput(next);
dsp->setActive(true);
[/quote:2u3aokq3]
I tried this variant, and I printed out number of Inputs/Outputs and they both are always 0, isn’t it supposed to count up to 1 when I add a DSP, that I have another input connected to the DSPhead?
I got one combination of the quote to work with my code, but it only re-added the sound that I had before I tried to remove the DSP. The sound still had it’s echo DSP, so it didn’t do any good.

You got any ideas/suggestions how I should re-add it to the flow and only get the orginal sound?

Thanks for reply
Christer

  • You must to post comments
0
0

dont do any of that, just use DSP::remove.

  • You must to post comments
0
0

Okay, when I only use
[code:1uz31g71] result = m_DSP_Effects[nType]->GetDSP()->remove();
ErrorCheck(result);[/code:1uz31g71]
Then I get
[quote:1uz31g71]FMOD error! (14) DSP connection error. Connection possibly caused a cyclic dependancy.[/quote:1uz31g71]

But it works, but not when I have the same effect on 2 different ChannelGroups, so with other words I need a list of the initilized DSPs, I need one for each ChannelGroup, instead of one global that I use right now, so my final question is, is it a bad move to init a DSP when it’s needed? (that I do it ingame, instead of the startup of the game, that’s what I have now). Does it create a heavy cpu-loss and not recommended?

Thanks
Christer

  • You must to post comments
0
0

‘have the same effect on 2 different channelgroups’ – You mean the same dsp unit? You cannot do that, so if you want a dsp effect on 2 different channelgroups you have to create 2 dsp units and have 1 per channel group.

  • You must to post comments
0
0

Okay, is it recommended to init a dsp unit at startup of a game, or is there no significant loss to just init the unit when activated?
I can try my way which I will do, but it would be nice to hear some professional coders view on it.

Thanks
Christer

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.