0
0

i want to access the data held in memory for a FSOUND_Sample… is the Sample just a sequence of bytes representing the recording (its a new sample on which i have recorded) or does it contain extra information? If i try to save it to a file byte after byte will i also save other info (like sample length, sampling rate etc?)
In general, can what i’m trying to do work? ๐Ÿ˜ฎ

thanks,

Aris

  • You must to post comments
0
0

thanx… i’m going to sleep i’m gonna try those things when i get up
so, i’ll see you later ๐Ÿ˜‰

Aris

  • You must to post comments
0
0

You can get wathever Fmod can handle (except for midi) in a dsp callback and then, yes, you must write to a fill with some informations depending of the file format … or without ! You will get a raw pcm data file (must be 44100/16/stereo).

  • You must to post comments
0
0

unless i got the byte count wrong (Sample_GetLength*16/8) then i’m sure everything else is as it should be. the strange thing is that the fault i’m getting is trying to write to memory location 0x00000000 which might be something although i don’t know what, maybe you’ve seen this before.
i’ve got windows 2000 btw

Aris

  • You must to post comments
0
0

thanks for the above
i’ll try to use FSOUND_Sample_Lock to access the data but i’m not sure how to fill in the parameters… can you show me an example? especially about the void ** bit, i don’t get that ๐Ÿ˜†

Aris

  • You must to post comments
0
0

what exactly is trivial? maybe it is but i guess i’m standing too close to see it… anyway, what i want to ask you now is this:

can I use Stream_OpenFile to play a sample I have just recorded or not? and if I can, what would the reasons be if it failed?

thank you

Aris

  • You must to post comments
0
0

yoooooohooo got the Sample_Lock thing to work! amazing…
i was doing:

FSOUND_Sample_Lock(recSample, offset, 10000, &buf1, &buf2, &length1, 0);

and that last parameter was making it crash
i changed it to &length2 and everything works fine.
took me a while ๐Ÿ˜‰

anyway, i’m still interested in the answer of my previous question

Aris

  • You must to post comments
0
0

hey… i checked out the code you gave me and i think its kind of advanced for me at the moment. Still, i tried to understand how
Sample_Lock works and this is my code:

int samplescount = FSOUND_Sample_GetLength(recSample);
int numBytes = (samplescount*16)/8;

void *buf1, *buf2;
unsigned int length1 = (unsigned int) numBytes;
if(FSOUND_Sample_Lock(recSample, 0, numBytes, &buf1, NULL, &length1 , 0))
{
cout << “Lock successfull.” << endl;
}

when i run my program i get a (windows 2000) error message saying memory at blah blah could not be written. can you see any problems with the code?

thanx

  • You must to post comments
0
0

listen… i used Lock to lock a sample and then I flushed it to a file… a pcm file. Then when I play the file I can hear the recording but there is a large amount of noise in it. What do you suppose can be causing that? The sample sounds perfectly fine when I play it right after recording it. The code I use to flush it is this:

FSOUND_Sample_Lock(recSample, offset, numBytes, &buf1, &buf2, &length1, &length2);

cout << “sample in bytes: ” << (samplescount*16)/8 << endl;
ofstream outfile(“sample.raw”);

char * myPointer = (char *) buf1;
int counter = 0;
while(counter < numBytes)
{
//cout << “Counter: ” << counter << endl;
outfile << *myPointer;
myPointer++;
counter++;
outfile.flush();
}

outfile.close();
FSOUND_Sample_Unlock(recSample, &buf1, &buf2, length1, length2);

thanx,

Aris

  • You must to post comments
0
0

[code:2ep25t2n]
void *buf1; // buffer of the first part of the buffer
void *buf2; // buffer of the second part of the buffer, FMOD will return NULL if the data hasn’t wrapped the end of the buffer (remember : audio data are circular buffers)

/*
unsigned int length1 = (unsigned int) numBytes; // no !! this job is for fmod, it will return you how much bytes was locked for the first part of the buffer, so don’t initialise it
*/
unsigned int length1, length2;
int offset;

 offset  = 0;

if(FSOUND_Sample_Lock(recSample, offset, numBytes, &buf1, &buf2, &length1 , 0))
{
cout << "Lock successfull." << endl;
offset += numBytes;
}
[/code:2ep25t2n]

  • You must to post comments
0
0

I’m killing you with my questions but here is another one (you could probably take all these q&a and put them in a FAQ or something) :

what would a STREAMCALLBACK function would have to contain in order to be considered complete?

thanks

Aris

  • You must to post comments
0
0

hi again ๐Ÿ˜‰ sorry for too many questions
maybe you can explain briefly what sample_lock is supposed to be doing cause i don’t get it ๐Ÿ˜ก

thanx again

PS: i’m still getting that memory can’t be written thing… i even added void * buf1 = new void*; but nothing

  • You must to post comments
0
0

i am specifying the FSOUND_SIGNED flag when I allocate the sample. Then i record it, lock it and flush it. Do I need to specify whether its signed/unsigned elsewhere along the way?

Aris

  • You must to post comments
0
0

sample_lock is (i think) supposed to fill a block of data to a buffer. Though, Fmod need to know how much data you want and then, fmod will return exactly how much data has been written to this buffer.
Concerning your segfault, do you use the sample_unlock function just after writing the data to your file ? You MUST use it (Fmod will know it can release/free the buffer).

  • You must to post comments
0
0

The buffer passed on to the DSP chain, is that the size set by SetBufferSize() or is it something else?

Aris

  • You must to post comments
0
0

hmm, the thing is i get the segmentation fault before even i get in the if… like there is a problem with the Sample_Lock call line…
i don’t know, i’ll keep looking

thanx

  • You must to post comments
0
0

I have a problem… once I call DSP_Create(&MyCallback, 0, 0); the program goes into the callback and won’t ever come out. What is the problem, why doesn’t the rest of the code execute normally?

Aris

  • You must to post comments
0
0

so then if lock does not do anything to memory why am i getting a “memory could not be written” fault? i can show u my code if you want and maybe u can figure it out… but what i do is very simple, i just record a sample and then i try to lock it and i get the fault

Aris

PS: Iron Maiden – Fear of the dark

  • You must to post comments
0
0

[quote:14bbh45n]
lock doesnt fill the pointer with anything, you are just getting a pointer back that points to the raw data. If you want to know the format you would use FSOUND_Sample_GetMode and FSOUND_Sample_GetDefaults.
[/quote:14bbh45n]

Ah ok ๐Ÿ˜ณ

  • You must to post comments
Showing 19 results
Your Answer

Please first to submit.