0
0

Here’s my problem:

When I try to play more samples than the number of hardware 3D channels I have, the samples will not play. I am using DLL version 374, surround speaker setup, c++ 6, Audio Codec: CMI9739A , Audio Controller: Intel 82801EB

Here is my sample load function:

int AStarSound::LoadSample(LPCSTR szFile, bool Looping, float MinDistance, bool LoadWith3D)
{
int NextSample = GetNextUnusedSampleSlot(); //Store the next unused sample slot.

if(LoadWith3D == true){
    Sample[NextSample] = FSOUND_Sample_Load(FSOUND_FREE, szFile, FSOUND_HW3D|FSOUND_FORCEMONO, 0, 0);
}else{
    Sample[NextSample] = FSOUND_Sample_Load(FSOUND_FREE, szFile, FSOUND_HW2D|FSOUND_FORCEMONO, 0, 0);
}

if (!Sample[NextSample])
{
    throw "FMOD Load Sample Failed";
}

SampleSlotUsed[NextSample] = true; //Set the sample slot to used.

// increasing mindistnace makes it louder in 3d space
FSOUND_Sample_SetMinMaxDistance(Sample[NextSample], 5.0f, 10000.0f);    
if(Looping == true)
{
    FSOUND_Sample_SetMode(Sample[NextSample], FSOUND_LOOP_NORMAL);
}else{
    FSOUND_Sample_SetMode(Sample[NextSample], FSOUND_LOOP_OFF);
}

return NextSample;

}

The samples are always loaded with 3D enabled.
and the function I use to play the samples…

int AStarSound::Spawn(int SoundNum, int Volume, D3DXVECTOR3 SoundPos, bool Syicky)
{
int NextChannel = GetNextUnusedChannel();

ChannelNewPos[NextChannel][0] = SoundPos.x;
ChannelNewPos[NextChannel][1] = SoundPos.y;
ChannelNewPos[NextChannel][2] = SoundPos.z;

FSOUND_SetVolumeAbsolute(NextChannel, Volume);

Channel[NextChannel] = FSOUND_PlaySoundEx(FSOUND_FREE, Sample[SoundNum], NULL, TRUE);
FSOUND_3D_SetAttributes(Channel[NextChannel], &ChannelNewPos[NextChannel][0], (0,0,0));

FSOUND_SetPaused(Channel[NextChannel], FALSE);

ChannelSticky[NextChannel] = Syicky;

return NextChannel;

}

What am I doing wrong?

  • You must to post comments
0
0

That is correct, it returns -1 after all of the 3D hardware channels have been used up. Is there a way to use software 3D surround instead?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.