Seems to crash with error 36 if there is no channel playing.
how can I seek before playing, in order to start at the seek point?
Private Sub Command21_Click()
Dim result As FMOD_RESULT Dim Sms As Long Dim NSms As Long Dim Slenms If Sound Then result = FMOD_Channel_GetPosition(channel, Sms, FMOD_TIMEUNIT_MS) If ((result <> FMOD_OK) And (result <> FMOD_ERR_INVALID_HANDLE) And (result <> FMOD_ERR_CHANNEL_STOLEN)) Then ERRCHECK (result) End If result = FMOD_Sound_GetLength(Sound, Slenms, FMOD_TIMEUNIT_MS) If ((result <> FMOD_OK) And (result <> FMOD_ERR_INVALID_HANDLE) And (result <> FMOD_ERR_CHANNEL_STOLEN)) Then ERRCHECK (result) End If
NSms = Sms + 1500
If NSms > Slenms Then
result = FMOD_Channel_SetPosition(channel, NSms, FMOD_TIMEUNIT_MS)
- jayDC asked 9 years ago
You can read data from an FMOD sound, either load the whole thing into memory with createSound (and FMOD_CREATESAMPLE) then access the pcm data with Sound::lock/unlock.
If that is too much memory, just open it with createStream (and FMOD_OPENONLY) so that it doesnt read any data, then you can use Sound::readData to read the data into your own pointer.
The sound must be playing on a channel for you to seek. What you need to do is play the sound first but pass in true for the paused parameter. Now you can set your position and then unpause the sound.
The VB code will be similar to this:
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, true, &channel);
FMOD_Channel_SetPosition(channel, position, FMOD_TIMEUNIT_MS);
thanks, I’m trying a similar method to the one above, and it’s working.
So it’s not possible to read data from a "Sound".
If you notice my screen capture below I have a wave reader. This is a control, and it uses it’s own file loading system. I was going to try to incorporate the wave draw functions to be based off the FMOD engine, but I guess this is not possible?
Please login first to submit.