0
0

When I create a buffer to load a stereo sample into FMOD using FSOUND_FORCEMONO (last of the 4 cases in the code below), the playback of the sample is twice as slow as it’s supposed to be. It is ok in any other combination of numofchannels and 2d/3d sound (I get the info about the sample from the WAVEFORMATEX structure).

// We test if wa want a 2D or 3D Sound
if( type == BACKGROUND)
{
    f_mode |= FSOUND_2D;
    if (wf->nChannels == 1)
        f_mode |= FSOUND_MONO;
    else
        f_mode |= FSOUND_STEREO;
    f_freq = wf->nSamplesPerSec; 
}
else
{
    f_mode |= FSOUND_HW3D;
    if (wf->nChannels == 1)
        f_mode |= FSOUND_MONO;
    else
        f_mode |= FSOUND_FORCEMONO;
    f_freq = wf->nSamplesPerSec; }

switch( wf->wBitsPerSample ) {
case 8 : f_mode |= FSOUND_8BITS ;
    break ;
case 16 : f_mode |= FSOUND_16BITS ;
    break ;
}


f_sample = FSOUND_Sample_Alloc( 
    FSOUND_FREE,
    (unsigned long) bytes / wf->wBitsPerSample * 8 ,
    f_mode,
    f_freq , 
    FMOD_DEF_VOL, 
    FMOD_DEF_PAN, 
    FMOD_DEF_PRIORITY ); 

What is causing this?_____________________________________________

  • You must to post comments
0
0

Thank you for clearing that up…
Another question – is it possible to convert data in an existing software stereo sample to a hardware 3D (mono) sample. Here is what I tried to do but it didn’t work.

f_newmode |= FSOUND_16BITS | FSOUND_HW3D | FSOUND_FORCEMONO;

FSOUND_SAMPLE * newsample = FSOUND_Sample_Alloc(
FSOUND_FREE,
f_length, //equal to length of the source sample
f_newmode,
f_deffreq,
f_defvol,
f_defpan,
f_defpri);

FSOUND_Sample_Lock( m_Source->sample, 0, f_length_bytes, &f_ptr1, &f_ptr2, &f_len1, &f_len2);

FSOUND_Sample_Upload( (FSOUND_SAMPLE *) newsample, f_ptr1, f_mode ); //f_mode is FSOUND_16BITS | FSOUND_STEREO;

FSOUND_Sample_Unlock( m_Source->sample, f_ptr1, f_ptr2, f_len1, f_len2);


doesn’t work – it doesn’t complain about uploading, but fails when i try to play it…any suggestions?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.