0
0

When reading FMOD examples, I noticed that there’re many positions where a custom DSP effect is used, the following code appears:

[code:2td26ibu]
for (count=0; count<length; count++)
{
for (count2=0; count2<channels; count2++)
{
outbuffer[(countchannels)+count2]=inbuffer[(countchannels)+count2]*SOMETHING;
}
}
[/code:2td26ibu]

So I’m wondering how extactly is the data structure in the inbuffer and outbuffer in such a context.

I can guess that in these buffers the sound samples are stored in a channel-time order, e.g. buffer[0] is channel0 at time 0, buffer[1] is channel 1 at time 0 and buffer[n] is channel (n mod channelCount) at time (n % channelCount).

But I didn’t find any documentation on this isuuse in the delivered HTML help file. Maybe I missed it somewhere…..err, anyway, I need to somehow manipulate this buffer myself and write some customized transform on it, so I’ll be appreciating if anyone here could provide a more complete explaination on this data structure.

Consider the specific case of myself, some points are especially important for me:

1) Was the DSP_READ handler called before the sound is actually played and the full size of sound was feed into these buffers,
or it is called repeatly when playing, each time just feed a part of sound buffer into it,
or there’re some mechanism to switch between the above two methods?

2) What will happen if a custom DSP function take a long time to calculate, or eventually got dead-looped? Is all channel will be broken or only the one using that custom DSP would stop?

3) Is there any thing special that needs attention when using these buffers myself?

FMOD’s custom DSP architecture is really a good tool to build a custom sound rendering system. I’m doing a lot of mathematical works out of FMOD but now I need to transfer these work into it to actually let them show effects on sounds.

Thanks for your kindly help.

  • You must to post comments
0
0

[quote="AzureLuna":1cljgua5]When reading FMOD examples, I noticed that there’re many positions where a custom DSP effect is used, the following code appears:

[code:1cljgua5]
for (count=0; count<length; count++)
{
for (count2=0; count2<channels; count2++)
{
outbuffer[(countchannels)+count2]=inbuffer[(countchannels)+count2]*SOMETHING;
}
}
[/code:1cljgua5]

So I’m wondering how extactly is the data structure in the inbuffer and outbuffer in such a context.

I can guess that in these buffers the sound samples are stored in a channel-time order, e.g. buffer[0] is channel0 at time 0, buffer[1] is channel 1 at time 0 and buffer[n] is channel (n mod channelCount) at time (n % channelCount).

But I didn’t find any documentation on this isuuse in the delivered HTML help file. Maybe I missed it somewhere…..err, anyway, I need to somehow manipulate this buffer myself and write some customized transform on it, so I’ll be appreciating if anyone here could provide a more complete explaination on this data structure.
[/quote:1cljgua5]

Actually this information is in the very first tutorial ‘Terminiology / Basic concepts’

[quote:1cljgua5]
Consider the specific case of myself, some points are especially important for me:

1) Was the DSP_READ handler called before the sound is actually played and the full size of sound was feed into these buffers,
or it is called repeatly when playing, each time just feed a part of sound buffer into it,
or there’re some mechanism to switch between the above two methods?
[/quote:1cljgua5]

It’s called repeatedly when playing. There is no way to change this, although if you switched to a ‘cusom stream’ which is a different system altogether (if you were just wanting to generate data) it would work this way. It would prebuffer data, then you call play to play it, then it requests more data later.

[quote:1cljgua5]
2) What will happen if a custom DSP function take a long time to calculate, or eventually got dead-looped? Is all channel will be broken or only the one using that custom DSP would stop?
[/quote:1cljgua5]

DSP is very senstive, if you lock up a callback, the whole mixer thread will hang and you will get stuttering output. same with taking too long, it will cause skipping/stuttering audio.

[quote:1cljgua5]
3) Is there any thing special that needs attention when using these buffers myself?
[/quote:1cljgua5]

You just have to make sure outbuffer is filled. You can use inbuffer if you want to use it like a filter to transform the input to the output.

[quote:1cljgua5]
FMOD’s custom DSP architecture is really a good tool to build a custom sound rendering system. I’m doing a lot of mathematical works out of FMOD but now I need to transfer these work into it to actually let them show effects on sounds.

Thanks for your kindly help.[/quote:1cljgua5]

  • You must to post comments
0
0

oh,
I didn’t realized the first chapter is actually explain the custom DSP buffer.

[color=violet:y3i2pw3o]
Thank you very much.[/color:y3i2pw3o] 😀

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.