0
0

Hi,

I am trying to use events (and their related effects) to modify sounds played by the standard FMOD::System::playSound() function.

My goal is to design DSPs in designer and apply them generically to streamed sound assets or assets loaded in memory at run-time.

Is this sort of thing possible? I tried — somewhat naively — a solution like the one below:

[code:3mj8bbxv]
result = m_pPrimaryEvent->getChannelGroup( &m_pPrimaryChannelGroup );
ERRCHECK(result);

     result = m_pSoundSystem->playSound(FMOD_CHANNEL_FREE, (*m_pSoundLibrary)[soundID], paused, &soundChannel);
        ERRCHECK(result);

        result = soundChannel->setChannelGroup( m_pPrimaryChannelGroup );
        ERRCHECK(result);

        FMOD::DSP* pDSP = NULL;

        result = m_pPrimaryChannelGroup->getDSPHead( &pDSP );
        ERRCHECK(result);

        result = soundChannel->addDSP( pDSP, NULL );
        ERRCHECK(result);

        m_pPrimaryEvent->start();

[/code:3mj8bbxv]

m_pPrimaryEvent is the FMOD::Event I set up in the designer (*this particular event has no sound attached to it in the designer). The effect is a simple low pass filter, I modify the parameter value every time I call FMOD::EventSystem::update()

The results were not encouraging. The sound plays but not with the effect. I definitely am not well in DSPs or the system that FMOD uses to apply them. Is there something simple I’m missing here?

Thanks in advance.

P.S. One final experiment revealed that if I use an event with a similar effect that [i:3mj8bbxv]has[/i:3mj8bbxv] a sound attached, trying to add the dsp to the new sound channel causes the already playing event to stop (or go silent anyway) and the new sound does not seem to start.

  • You must to post comments
0
0

So in case anyone was following this I found the solution.

It was really pretty simple and mostly covered in the documentation (titled "FMOD Ex Advanced DSP Engine")

If you get the channelGroup "A" of the effect ( Effect::getChannelGroup() ) and get that channelGroups child "B"* ( ChannelGroup::getGroup() ), if you add a channelGroup "C" to be ( ChannelGroup::addGroup() ), by adding any arbitrary sound you play ( System::playSound() ) to channelGroup "C" ( Channel::setChannelGroup() ), all effects within the event will affect the played sounds — I think this may assume that the effect has started ( Effect::start() ).

  • Getting the child of "A" was the one part that seemed unintuitive to me. I only understood that this was necessary after looking at the DSP profiler at runtime — which by the way is an awesome too, thanks fmod for making it so easy. Making sure you get the right child seems sort of like a drawing straws to me, I hope that the the index you should use in ChannelGroup::getGroup() is always 0 but I don’t really have any evidence to support that.

Anyone else have a cleaner solution? Please share. Anyone know why you have to use channelGroup "A’s" child "B" and not just "A" itself? I’d be interested in knowing that as well.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.