0
0

Hello all,

I have trouble understanding how the Sound->lock() function works. At least, I thought I understood it, but reading this forum post confused me again: [url:1jr9kcu3]http://www.fmod.org/forum/viewtopic.php?t=13230[/url:1jr9kcu3] 😀

The example does not work for me — after the lock(), my buffer is always empty.

In particular, in the linked post I don’t know why 0 is passed as the second parameter of lock()! As far as I understand this function, the second parameter says how many bytes to lock in the buffer. So I really don’t see how passing 0 would help you get the waveform for the whole song.

Can anyone please explain how lock() could be used to get the whole waveform? Thanks!
–Cristina.

  • You must to post comments
0
0

the code you saw in that thread is wrong.
There should be a Sound::getLength call there with FMOD_TIMEUNIT_PCMBYTES as the timeunit, to get how long the sound is in bytes.

(after the lengthbytes declaration, and before the call to lock)

  • You must to post comments
0
0

Thank you for the clarification, it’s good to see one’s first assumption was right :-)

In the meantime, I had implemented it the way you describe here, with getLength, but did not use the correct timeunit — so thanks for mentioning that!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.