Hi, I am new to FMOD and this is the first crack at the bat for me.

What I have: a pointer to a C++ container (vector) of shorts

What I want: to create a stream and play it as paw PCM.

from reading through recent posts, I got the impression that a good starting point might be the ‘stream’ example and create a pointer to a C array from my vector and create the stream using …..
[code:r2b2a20q]#define SOUND_DATA_SIZE 1000
short* data = new short[SOUND_DATA_SIZE];
// add elements to data from vector here
stream = FSOUND_Stream_Open(data, FSOUND_LOADMEMORY, 0, SOUND_DATA_SIZE);[/code:r2b2a20q]

As I am sure you have already figured out, I am not using that function properly because it only takes a char* as the first argument, not a pointer to data like I am trying to use. I read this from the help that came with fmod…..

[code:r2b2a20q]name_or_data Name of the file to open, or pointer to data if FSOUND_LOADMEMORY is used.

Am I missing something? Obviously I am, but any idea what?

  • You must to post comments

oops, hehe, yea, that’s supposed to be ‘raw’ not ‘paw’.

thanks for the reply brett, here’s what I changed it to,

[code:26gn865m]stream = FSOUND_Stream_Open(data, FSOUND_LOADMEMORY | FSOUND_LOADRAW | FSOUND_16BITS | FSOUND_MONO | FSOUND_UNSIGNED , 0, SOUND_DATA_SIZE);[/code:26gn865m]

I still don’t know what the variable “data” is supposed to be. I am trying it with a pointer to an array of shorts, but the compile error is …..

[code:26gn865m]c:\Homestar\Utilities\FmodSink.cpp(71): error C2664: ‘FSOUND_Stream_Open’ : cannot convert parameter 1 from ‘short *’ to ‘const char *’

I also tried [code:26gn865m](char*)data[/code:26gn865m] in place of [code:26gn865m]data[/code:26gn865m]

but I’m assuming the function doesn’t know whether or not its a filename or my data so it thinks its a filename and crashes at runtime.

did I read the help wrong?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.