0
0

Just wanted to know if there was anything wrong with this code.

The sound seemed to load, but it just wouldn’t play for some reason or rather. I did a bit of experimentation and decided to try using one file “PianoC3.ogg”. So far things were looking good, but I can’t get any sound out of it. If anyone knows what I’m doing wrong I’d really appreciate it. Thanks. Ben. PS: I’ve hilighted the FMOD function calls in bold.

PS: Here I’ve added my variable declarations in the same code file:

HWND MyWindow;
const char *sFileName;
void *sPointer;
void *sResource;
void *SampleTable;
signed char sSuccessInit;
int sLength;
int sStart;
int pStart;
int lStart;
int sStop;
int PrevIndex;
[b:3gr8ae49]FSOUND_SAMPLE[/b:3gr8ae49] *Sample;
signed char iVol;

Here is my init/load/play code:

iVol = [b:3gr8ae49]FSOUND_SetOutput/b:3gr8ae49;
sSuccessInit = [b:3gr8ae49]FSOUND_Init[/b:3gr8ae49] (22050, 36, NULL);
LPCTSTR String1;
LPCTSTR String2;
String1 = TEXT(“Successfully initialised FSOUND_Init!”);
String2 = TEXT(“Success”);
//let’s check to see if it was successful
if (sSuccessInit = 1)
//successful
{
String1 = TEXT(“Successfully initialised FSOUND_Init :-)”);
String2 = TEXT(“Success”);
MessageBox (MyWindow,String1,String2,MB_OK);
}
else
//failed
{
String1 = TEXT(“Failed to initialise FSOUND_Init :-(“);
String2 = TEXT(“Failure”);
MessageBox (MyWindow,String1,String2,MB_OK);
};

// load a sample, grab the pointer
sFileName = “PianoC3.ogg”;
Sample = [b:3gr8ae49]FSOUND_Sample_Load[/b:3gr8ae49] (-1, sFileName, FSOUND_16BITS | FSOUND_SIGNED | FSOUND_LOOP_OFF | FSOUND_MPEGACCURATE, 0, 0);

[b:3gr8ae49]FSOUND_SetSFXMasterVolume/b:3gr8ae49;
iVol = [b:3gr8ae49]FSOUND_SetVolumeAbsolute[/b:3gr8ae49](FSOUND_ALL, 255);

sStart = [b:3gr8ae49]FSOUND_PlaySound [/b:3gr8ae49](FSOUND_FREE, Sample);

[b:3gr8ae49]FSOUND_Sample_Free[/b:3gr8ae49] (Sample);

  • You must to post comments
0
0

Hi,

There was no delay. I think that might be why it wasn’t working. My guess is that I’ll have to use a callback function to determine when the sound has stopped/started playing. Maybe even use a stream.

Thanks for the tip.

  • You must to post comments
0
0

I just tried adding a delay but it didn’t work. I think there’s something else wrong. I’m not quite sure what it is, but whatever it is it isn’t playing any sound. Maybe I’m just not code it right, but so far not good. I have no idea what I’m doing wrong.

For specific information I use the iPAQ 1940 and I develop with eVC4++. I tried both loading PianoC3.wav and PianoC3.ogg but neither of these files would play. I’ve tried both files in a PocketPC music player and they play fine so there’s nthing wrong with the sounds.

Whatever it is, it just plain will not work. Any help would be appreciated. It looks like I’ve been having nothing but bad luck with trying to write my little chord palette for PocketPC. I’m hoping that someone can help me through this.

Thanks
Ben

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.