0
0

int main(int argc, char* argv[])
{
char buffer[1024];
if(!FSOUND_Init(44100,8,0))
{
sprintf(buffer,”Unable to initialize soundsystem:\n%s”,
FMOD_ErrorString(FSOUND_GetError()));
std::cerr << buffer << std::endl;
std::cin.get();
return 1;
}

char drive = 'J';
int n = FSOUND_CD_GetNumTracks(drive);

for(int i = 1;i &lt;= n;++ i)
{
    int len = FSOUND_CD_GetTrackLength(drive,i);
    if(!len)
    {
        sprintf(buffer,"Error:\n%s",FMOD_ErrorString(FSOUND_GetError()));
        std::cerr &lt;&lt; buffer &lt;&lt; std::endl;
    }
    else
        std::cout &lt;&lt; i &lt;&lt; " Len:" &lt;&lt; len &lt;&lt; std::endl;
}

FSOUND_CD_Play(drive,1);

std::cin.get();
FSOUND_Close();

return 0;

}

When I insert a CD, this program computes the correct number of Tracks and starts playing the first one, but it displays zero length and the errormessage: “An invalid parameter was passed to this function”. If I set drive to 0 then everything works fine. But J: is my default cd-drive(and the system plays the right song and displays the correct number of Tracks)

  • You must to post comments
0
0

The drive parameter is a zero-based index of CD drives in your machine. That’s why it works with zero and not with ‘J’. By passing ‘J’ as the drive parameter, you are trying to tell FMOD to use the 75th (‘J’ = 74) CD drive in your machine.

  • You must to post comments
0
0

The documentation of FSOUND_CD_GetTrackLength says:

drive…the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.