0
0

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?

[code:2lkqo6t0]
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
Else
result = FMOD_Channel_SetPosition(channel, NSms, FMOD_TIMEUNIT_MS)
ERRCHECK (result)
End If
End If
End Sub
[/code:2lkqo6t0]

  • You must to post comments
0
0

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:
[code:3sp8f5ba]
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, true, &channel);
FMOD_Channel_SetPosition(channel, position, FMOD_TIMEUNIT_MS);
FMOD_Channel_SetPaused(channel, false);
[/code:3sp8f5ba]

  • You must to post comments
0
0

yeah, I was thinking along those lines. Would it be possible to access the sound data for seeking, as opposed to using the channel?

  • You must to post comments
0
0

No because a sound can play on multiple channels.

  • You must to post comments
0
0

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?

[img:d1t1u6bj]http://i53.photobucket.com/albums/g71/moderndc/lathcontrol.jpg[/img:d1t1u6bj]

  • You must to post comments
0
0

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.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.