0
0

Hey,
Im currently working with FMOD and Pocket Pc’s to create a 3D environment. Im using a DSP callback to do this. Ive implemented a panning algorithm which works fine with stereo samples but with mono samples I havnt been able to alter the left or right channels (I know thats because its a mono sample) Is there a way I could do this even though the stream is set to be mono?

Tony

  • You must to post comments
0
0

Hey,

No I havnt yet, its actually a research project Im working on with my University, and the main idea is to research and test different algorithms for 3D sound, comparing the trade off between accuracy and optimality. Have been away for the week, hence the late reply and so havnt yet fixed my problem with mono samples, any advice is appreciated,
cheers

  • You must to post comments
0
0

Okay,

Currently I am attaching a DSP to each individual stream using:

FSOUND_Stream_CreateDSP

and setting it to active. The reason for this is so that the DSP callback can alter each stream individually, depending on the position of this sound. I had assumed that if I initialised the DSP callback with FSOUND_DSP_Create then the callback would not be able to distinguish between the individual sounds in the buffer it receives, is that correct? So each stream has this callback attached to it (simplified to illustrate my problem):

[code:1igy5b01]
void * mbMediaEngine::fmodDirectional(void * originalbuffer, void * newbuffer, int length, int param)
{
int i=0,stereo = 2,mode;
float pan,scale_val;

mbAudioRecordrec = (mbAudioRecord)param;

pan = rec->panning;
scale_val = rec->scale_value;

int mixertype = FSOUND_GetMixer();

if (mixertype == FSOUND_MIXER_BLENDMODE || mixertype == FSOUND_MIXER_QUALITY_FPU)
{
return newbuffer;
}

mode = FSOUND_Stream_GetMode(rec->stream);

if(mode & FSOUND_MONO)
{
stereo = 1;
}

signed short * src = (signed short *) newbuffer;

for(i=0;i<length * stereo ;i++)
{
if(i%2==0) //the left channel
{
src[i] = 0;
}
}
return src;
}

[/code:1igy5b01]

If the stream is a stereo stream then this code mutes the left channel, but if the stream is mono then both channels are muted (if its changed so that the right channel is muted then the mono sample is full of noise.) btw added the ‘stereo’ value since the mono buffer seemed to over flow and crash. Im sure its a simple fix and Im just reading the buffer wrong or something stupid like that.

Thanks in advance for your help

  • You must to post comments
0
0

[code:26goir5t] for(i=0;i<length * stereo ;i++)
{
if(i%2==0) //the left channel
{
src[i] = 0;
}
}
return src;
}[/code:26goir5t]This code isnt very specific to the channel and muting, here, this should work whether right or left…

[code:26goir5t]
for(i=0;i<length * stereo;i++)
{
if((i%2==0 && stereo==2) || (stereo==1))
{
src[i]=0;
}
}
[/code:26goir5t]

  • You must to post comments
0
0

Okay sure, but I still have the same problem that:

[quote:3qhhhxhd]
works fine with stereo samples but with mono samples I havnt been able to alter the left or right channels
[/quote:3qhhhxhd]

So this code works if the stream is stereo, but with mono streams the code does not alter the left or right channel.

  • You must to post comments
0
0

Okay, thats kind of what I expected.

If I use the global DSP chain, is there a way I can get a handle on the different ‘sounds’ being streamed at any given time so that each sound can be altered individually? And if so where would this be done in the DSP chain,

thanks for your time

  • You must to post comments
0
0

Thanks for sorting that out, will have to find a way around it….

cheers, Tony

  • You must to post comments
0
0

If I want to convert a mono stream into a stereo stream what is the best method, as this would be the solution to my problem.

It seems that a call to FSOUND_Stream_Open() assumes the native file format, and havnt been able to over-ride this, and cant find any way to do this (I need to use streams as discussed previously so I can attach a DSP unit to the stream.)

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.