0
0

Hi

I am trying to route multiple channels via a fixed set of multiple DSP effects and control the gain independently per channel.

           Control Gain --- DSP 1 ---

Channel 1 ——- / \
Channel 2 ——-| |—- Final Output
Channel 3 ——- \ /
Control Gain — DSP 2 —

Since each channel can only be added to one DSP or Channel group I cannot see how this can be achieved. I can see that a channel can have multiple DSP effects by chaining channel groups but this will not give independent gain per channel per DSP.

Ideally I would like to have a setup similar to the submixers with the XAudio on the Xenon where this level of control is achievable.

Any ideas?

Thanks

Andrew

  • You must to post comments
0
0

This is quite possible if virtual voices are active. When a channel goes virtual it is still playing but is not connected to a dsp unit.

  • You must to post comments
0
0

Hi Brett

Yes that was the problem – thanks.

To cater for this event I am checking the channel->IsVirtual() and not attempting to update the dsp connections if True.

Otherwise I set the dsp connections checking for errors and reconnecting if needed.

This seems fine – would be nice however if a virtual channel remembered its conections – :)

Thanks

Andrew

  • You must to post comments
0
0

Sorry my ascii diagram makes little sense after the spaces were removed :(

Please view this 😮

[color=#276F87:3nqfftkc]_______________[/color:3nqfftkc]Control Gain — DSP 1 —
Channel 1 ——- /[color=#276F87:3nqfftkc]______________________[/color:3nqfftkc]\
Channel 2 ——-|[color=#276F87:3nqfftkc]_______________________[/color:3nqfftkc]|—- Final Output
Channel 3 ——- [color=#276F87:3nqfftkc]______________________[/color:3nqfftkc]/
[color=#276F87:3nqfftkc]_______________[/color:3nqfftkc]Control Gain — DSP 2 —

  • You must to post comments
0
0

it does remember connections added with Channel::addDSP, because they are predictable.

using the dsp api could mean you are doing all sorts of crazy stuff, like connecting the output of one channel into another, therfore if the subtree of a channel was pruned and stored in a virtual voice (which is what we do for adddsp) it could really screw up other stuff, by pruning other channels.

Its just because the dsp connections could be really unpredictable and low level its really hard to move them around without the user’s consent.

  • You must to post comments
0
0

Hi,
That structure isnt very hard, you just have to create 2 dsp units, then add them to the final output with DSP::addInput.

You then, every time you play a sound, add the channel dsp head to each of those inputs. This would leave the main master channelgroup still connected so there would be 3 outputs per channel, but I dont think that matters. You could treat that as the ‘dry’ path.

So at setup you would do (rough pseudocode)

system->getDSPHead(&systemdsphead);
systemdsphead->addInput(dsp1);
systemdsphead->addInput(dsp2);

then at playsound do

channel->getDSPHead(&channeldsphead);
dsp1->addInput(channeldsphead);
dsp2->addInput(channeldsphead);

To control gain, then use channeldsphead->setOutputMix. Because the channelhead’s dry output will always be index 0, your dsp1 and dsp2 will be index 1 and 2 based on the order you added them.

This is pretty much the way reverb works internally in fmod, and the ‘Room’ value on Channel::setReverbProperties.

Note that if reverb is actually activated, there will actually be 2 outputs existing from each channel dsp head, so your indicies will be 2 and 3 not 1 and 2.

  • You must to post comments
0
0

Hi

Ok thanks – just to clarify what I am doing:

On Sound Creation:

pFmodChannel->getDSPHead(&pChannelDsp);
pDsp->addInput(pChannelDsp);
pDsp->getNumInputs(&NumInputs);
pDsp->setInputLevels(NumInputs-1,FMOD_SPEAKER_MONO,….);
pChannelDsp->setOutputMix(1,gain);

Where pDsp is an effect I route multiple channels to – there are also other Dsp submixers that I connect to in a similar way.

During Sound Update:

if pFmodChannel->isVirtual() – don’t try if virtual
Error = pChannelDsp->setOutputMix(1,gain);
if Error then – fail reconnect to dsp submixers
pDsp->addInput(pChannelDsp);
pDsp->getNumInputs(&NumInputs);
pDsp->setInputLevels(NumInputs-1,FMOD_SPEAKER_MONO,….);
pChannelDsp->setOutputMix(1,gain);

Cheers

Andrew

  • You must to post comments
0
0

Hi Brett

Thanks for that, I have this working now that I figured out to set the DSP to active :)

The problem I have now is that the DSP effect starts panned to the left. The odd thing is that the panning becomes correct if the channel is stopped or another channel is started?

If I run the DSP connected to a channelgroup or channel the panning is correct.

I have tried this with a Reverb & SFXReverb DSP created with createDSPByType.

Any ideas?

Thanks

Andrew

  • You must to post comments
0
0

We have found that such manual dsp connections can be severed by FMOD if the Channel goes virtual. When it goes actual again (unvirtual?), the index order for setOutputMix seems to get arbitrarily re-assigned.

Are we perhaps doing something wrong? Is there a recommended method for tracking indices without resorting to getOutputs or getInputs, which can stall the main update thread?

  • You must to post comments
0
0

[quote="AndrewHutchings":1lcz0vm3]Hi Brett

Thanks for that, I have this working now that I figured out to set the DSP to active :)

The problem I have now is that the DSP effect starts panned to the left. The odd thing is that the panning becomes correct if the channel is stopped or another channel is started?

If I run the DSP connected to a channelgroup or channel the panning is correct.

I have tried this with a Reverb & SFXReverb DSP created with createDSPByType.

Any ideas?

Thanks

Andrew[/quote:1lcz0vm3]

I dont know what your speaker mode is, but to make sure speaker levels are correct use DSP::setInput/OutputLevels

  • You must to post comments
0
0

[quote="sgugler":2oqycsnu]We have found that such manual dsp connections can be severed by FMOD if the Channel goes virtual. When it goes actual again (unvirtual?), the index order for setOutputMix seems to get arbitrarily re-assigned.

Are we perhaps doing something wrong? Is there a recommended method for tracking indices without resorting to getOutputs or getInputs, which can stall the main update thread?[/quote:2oqycsnu]

The virtual voice system knows about addDSP and ChannelGroups.
It can’t just fix every manual DSP network modification you would make, and it makes sense that they are severed when they go virtual, because they are just that. Virtual.

Virtual voices are supposed to do nothing but increment a channel pointer, and the real voice, that is in the DSP network, is supposed to be replaced by a more important sound.

If you want to maintain dsp connections in a virtual voice environment, use channelgroups only for DSP, or Channel::addDSP only, so that fmod can clean up and reset the chain of dsp effects it knows were added to a Channel.
You could also try resetting your connections when a "FMOD_CHANNEL_CALLBACKTYPE_VIRTUALVOICE" callback happens.

The DSP api is the lowest level you can get and the FMOD channel system uses it. So if you disconnect things under fmod it willl possibly fall over on it.

The other option is just don’t use virtual voices.

  • You must to post comments
0
0

Hi

I have added DSP::setInput/OutputLevels as suggested and this has fixed the problem and I can now do what I wanted – thanks Brett.

But … one thing I am unsure about is when I dsp->setInputLevels() for the DSP effect – this needs a index which refers to the channel which I have just added to the chain with dsp->addInput(NewChannel). How do I know what this index should be? At the moment I use dsp->getNumInputs()-1 – is this ok?

Thanks

Andrew

  • You must to post comments
0
0

Hi,
Yes at the moment you just have to assume it is the last one added.
There isnt a good way right now to handle that situation. We could return the index in addInput but that index could change depending on connections/disconnections that happen after it.

I’m hesitant to add a whole extra class just for this which would be the ‘nice’ way to do it (addinput returns a handle, then you call handle->setVolume, handle->setLevels etc).

  • You must to post comments
0
0

Hi

I am having problems with my DSP inputs disconnecting after a while – this is happening with looping sounds that will work happily for a while then fail on pChannelDsp->setOutputMix() – the channel is still playing and has not been stopped.

Here is what I am doing – after setting up the channel I want to dynamically change its gain to the Dsp effects connected. I do this as follows:

pChannel->getDSPHead(pChannelDsp)
pChannelDsp->setOutputMix(index,volume) – This fails with invalid param. Both index & volume should be valid.

It seems that after a while the “oldest” channel will appear to be disconnect – this will happen even if I limit the total number of channels to be connected.

In a attempt to workaround this problem I have reconnected these problem channels using dsp->addInput(pChannnelDsp) – whilst this works in keeping the effect running its not ideal and it seems to create other problems with other channels getting unexpected Dsp volumes.

Any ideas?

Thanks

Andrew

  • You must to post comments
Showing 13 results
Your Answer

Please first to submit.