0
0

Here’s my situation. I have a function that is data and decodes it to pcm on a buffer. After my buffer is filled, I lock the sample, memcpy my data and start playing it. However on rare occasions, while it is playing, my function is called(it is a dll) and data is streamed in while it is playing. The effect that is supposed to occur is that the sample is changed while playing to get a streaming sample. So my question is when I lock my sample, can i actually set the data in the locked part to reference my current data? Or would I have to lock it each time I wanted to change the data? example:

FSOUND_Sample_Lock(lpMySample, lpMyBuffer, nbytes, &lpvWrite1, &lpvWrite2, &length1, &length2);
for (int i=0;i<length1;i++)
lpvWrite1[i] = *(lpMySample+i);
FSOUND_Sample_Unlock(lpMySample, lpvWrite1, lpvWrite2, length1, length2);

  • You must to post comments
0
0

the code at the bottom got all botched up for some reason. here’s what it was meant to be:

FSOUND_Sample_Lock(lpMySample, lpMyBuffer, nbytes, &lpvWrite1, &lpvWrite2, &length1, &length2);
for (int i=0;i<length1;i++)
lpvWrite1[i] = *(lpMySample+i);
FSOUND_Sample_Unlock(lpMySample, lpvWrite1, lpvWrite2, length1, length2);

  • You must to post comments
0
0

guess it cant handle less than signs. the lines between the lock and unlock is meant to stand for:
for all i’s up to length1,
lpvWrite1[i] = *(lpMySample+i);

  • You must to post comments
0
0

Homer>i m very interested with your code : i must fill a buffer of 5762 pcm samples (char buf[5762])while playing a stream, how to do it so ?? you will be very helfull telling me how or by sending me a piece of code :smile:))

Thanx in advanced.

  • You must to post comments
0
0

I’m not sure I understand your question. Are you creating a stream or a sample?

  • You must to post comments
0
0

I am play a stream normally with FSOUND_Stream_Play and during this process i must retrieve samples going to the soundcard and then send the result to a buffer of 576 pcm char (or bytes). It s the way winamp work s(ok : i m doing an input winamp plugin using fmod =) If you don t undersand (sorry for my poor english), the best thing is to see the NSDK from http://www.winamp.com/nsdn/;$sessionid$ … 5YAAAARC0I or by downloading the input sdk here : http://ftp.winamp.com/winamp/nsdn/in_minisdk.zip. It s the only feature the plugin doesn t have (for a beta realease).

Thanx in advance :smile:

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.