I’m trying to get to the data for a sound file so that I can render it to the screen. With C# I fond the function is called @lock for the sound object. I believe I’m doing everything right, but the Result value is: ERR_BADCOMMAND

Here is my code snippet:

[code:3ma8pmqn] Result = _tracks.System.createSound(Filename, (FMOD.MODE._2D | FMOD.MODE.SOFTWARE | FMOD.MODE.CREATESTREAM), ref _sound);

        if (Result == FMOD.RESULT.OK && _sound != null)
            uint length = 0;
            Result = _sound.getLength(ref length, FMOD.TIMEUNIT.RAWBYTES);

            System.IntPtr ptr1 = new IntPtr();
            System.IntPtr ptr2 = new IntPtr();
            uint length1 = 0;
            uint length2 = 0;

            Result = _sound.@lock(0, length, ref ptr1, ref ptr2, ref length1, ref length2);

            _sound.unlock(ptr1, ptr2, length1, length2);[/code:3ma8pmqn]

2nd Question… When locking a compressed file, will the data still be compressed?


  • You must to post comments

First answer:

Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound).

Looking for 2nd answer.

  • You must to post comments

Using Sound::lock will give you the compressed bytes if you opened the file as FMOD_CREATECOMPRESSEDSAMPLE which is probably not what you want.
Try using the Sound::ReadData function for reading out the bytes of a file instead.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.