0
0

Hi, I’m trying to get Fmod to work. It seems like everything is going ok, except for the fact that I don’t hear anything. No errors or whatsoever. Basicaly I just do an Init, load a sample, set some parameters, play. I use win2k. What could I be doing wrong?

  • You must to post comments
0
0

hmm, seems to be a hardware thingy. i reinstalled my SB live and i get error 17 when trying to play a sound. other sound programs work on the other hand.

  • You must to post comments
0
0

i tested it on another machine, and there it worked. on mine however i got a error 17 when trying to play the sample. other soundprograms do work though…

include <fmod.h>

include <stdio.h>

include <stdlib.h>

define MIXRATE 22050

define NUM_FMOD_BUFFERS 32

define NUM_FMOD_CHANNELS 16

define BUFFER 0

void get_error(){
int error;
error = FSOUND_GetError();
printf(“errornumber is: %dn”, error);
}

int main(int argc, char* argv[]){
int ch;
int maxchannels, numdrivers, output, outputrate, mixer;
FSOUND_SAMPLE* m_buffers[NUM_FMOD_BUFFERS];
float lispos[3] = {0,0,0};
float lisvel[3] = {0,0,0};
float lisori[6] = {0,1,0,0,0,1};
float obpos[3] = {1,0,0};
float obvel[3] = {1,0,0};

if (FSOUND_Init(MIXRATE, NUM_FMOD_CHANNELS, 0)) {
get_error();
maxchannels = FSOUND_GetMaxChannels();
numdrivers = FSOUND_GetNumDrivers();
output = FSOUND_GetOutput();
outputrate = FSOUND_GetOutputRate();
mixer = FSOUND_GetMixer();
printf(“maxchannels is: %dn”, maxchannels);
printf(“numdrivers is: %dn”, numdrivers);
printf(“output is: %dn”, output);
printf(“oputputrate is: %dn”, oputputrate);
printf(“mixer is: %dn”, mixer);
m_buffers[BUFFER] = FSOUND_Sample_Load(BUFFER, “003.wav”, FSOUND_HW3D | FSOUND_LOOP_NORMAL, 0);

get_error();
if (m_buffers[BUFFER] != NULL){
FSOUND_3D_Listener_SetAttributes(lispos, lisvel, 0, 1, 0, 0, 0, 1);
FSOUND_3D_Listener_SetDopplerFactor(1);
FSOUND_SetSFXMasterVolume(255);
FSOUND_SetFrequency(BUFFER, 44100);
FSOUND_SetVolume(BUFFER, 255);
//FSOUND_SetLoopMode(BUFFER, FSOUND_LOOP_NORMAL);
//FSOUND_SetLoopMode(BUFFER, FSOUND_LOOP_OFF);
FSOUND_3D_SetAttributes(BUFFER, obpos, obvel);
do{
ch = getchar();
ch = toupper(ch);
switch (ch){
case ‘1’:{
printf(“playn”);
FSOUND_PlaySound(BUFFER, m_buffers[BUFFER]);
get_error();
break;
}
case ‘2’:{
printf(“stopn”);
FSOUND_StopSound(BUFFER); get_error();
break;
}
default:{
break;
}
}
FSOUND_3D_Update();
get_error();
} while (ch != ‘Q’);
}
else{
for (ch = 0; ch < 1000; ch++)
printf(“loading sample failedn”);
}
}
else{
for (ch = 0; ch < 1000; ch++)
printf(“init failedn”);
}
FSOUND_Close();
return 0;
}

  • You must to post comments
0
0

Thanx, it now works!

  • You must to post comments
0
0

Ha! That might just be why I got no sound for some people in my racesim. :smile: Hope that’s it, no it MUST be that. Cool. That brings the # problems down to 0.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.