0
0

Hi

Brett, could you write an example that load an file type RAW format but unknown (ie ext .PCM, .SND .SMP, etc…) that explain as to load and to play file not supported by FMOD Ex ?

thanks and bye :)

  • You must to post comments
0
0

Hi

Yes, but to me it doesn’t interest, the example creates a personalized sound, I have a file (.PCM very similar to the format RAW) mono, 8 bits at 11025hz, this file doesn’t have header, only have sound data.

What interests me is to load this sound in memory and play it.

bye :)

  • You must to post comments
0
0

this is my code actually:

[code:24o1007w]
FMOD_SOUND *LoadPCMSound(const char *name, int loop) {
FILE *f;
int len;
unsigned char *data;
FMOD_SOUND *snd;

FMOD_MODE mode;
FMOD_CREATEUSEREXINFO cuexinf = { 0 };

// the fname = "sound.pcm"
f = fopen(fname, "r");
if(f == NULL)
return NULL;

fseek(f, 0, SEEK_END);
len = ftell(f);
fseek(f, 0, SEEK_SET);

data = (unsigned char *)malloc(len);
if(data == NULL) {
fclose(f);
return NULL;
}

fread(data, 1, len, f);
fclose(f);

mode = FMOD_OPENMEMORY | FMOD_2D | FMOD_SOFTWARE;
mode |= (loop) ? (FMOD_LOOP_NORMAL) : (FMOD_LOOP_OFF);

cuexinf.cbsize = sizeof(FMOD_CREATEUSEREXINFO);
cuexinf.length = len;
cuexinf.defaultfrequency = 11025;
cuexinf.format = FMOD_SOUND_FORMAT_PCM8;

res = FMOD_System_CreateSound(snd_system, data, &cseinf, snd);
if(res != FMOD_OK) {
put_debug_error(res);
return NULL;
}

return snd;
}
[/code:24o1007w]

do I believe que this is wrong no? the error returned by put_debug_error is: ” ERROR 22: Unsupported file or audio format. “

my idea is to load the whole file in memory (it is very small) and play it with FMOD_System_PlaySound

  • You must to post comments
0
0

ok i have loaded the file but the playing is ugly, I send you the zip with the example, into this have 2 files 1 is a PCM (used from older program) and other is the same sound converted into WAV (from the older program that uses a PCM)

if you could see this and to illuminate me on what wrong is

thanks

  • You must to post comments
0
0

excuse me but I don’t have understands

could you modify the zip so that functions correctly and send this on my email? if it doesn’t spend too much yourself time

thanks

  • You must to post comments
0
0

ok I understand the *ptr++ ^= 128 at final
this work on pcmreadcallback rutine in loop for(count = 0; count < datalen; count++)

now the only thing is that LASER.PCM in comparison to LASER.WAV feels him taller as volume (the double) in comparison to the WAV

  • You must to post comments
0
0

the is not double is that LASER.PCM play twice contemporarily.

how can I correct this?

  • You must to post comments
0
0

ok resolved, work correctly now 😉

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.