0
0

Hi,

I have a very simple VB form which plays a mp3 file passed to it throuhg a main form. The user shuts the form manually, and can then reopen the form again witha new mp3 file. This works fine exactly 7 times (!), then I get an “FMOD Error! (31) An invalid object handle was used”. Why is this?

It is when trying to pause (se below) the error is generated, but any operation on the channle causes the same thing to happen. If I shut down teh project it works fine another 7 times and then the same error!!!

‘ Play…
Result = FMOD_System_PlaySound(SystemPlay, FMOD_CHANNEL_REUSE, SoundPlay, 0, channelPlay)
ERRCHECK (Result)

Result = FMOD_Channel_SetPaused(channelPlay, True) ' ERROR!!!
ERRCHECK (Result)

'at StartPos...
Result = FMOD_Channel_SetPosition(channelPlay, (10 * 1000), FMOD_TIMEUNIT_MS)
ERRCHECK (Result)

' at volume
PlayVolume = 1
Result = FMOD_Channel_SetVolume(channelPlay, PlayVolume)
ERRCHECK (Result)

Result = FMOD_Channel_SetPaused(channelPlay, False)
ERRCHECK (Result)

Here is the unload section of the form, it seem to execute correctly:
Private Sub Form_Unload(Cancel As Integer)
Dim Result As FMOD_RESULT

' Shut down
If SoundPlay Then
    Result = FMOD_Sound_Release(SoundPlay)
    ERRCHECK (Result)
End If

If SystemPlay Then
    Result = FMOD_System_Close(SystemPlay)
    ERRCHECK (Result)

    Result = FMOD_System_Release(SystemPlay)
    ERRCHECK (Result)
End If

End Sub

Here is the call from the main form:
Form1.MusicFile = FileToPlay
Form1.show vbModal, Soundman
Unload Form1
Set Form1 = Nothing

  • You must to post comments
0
0

Are you reallocating the System object after you Close and Release it?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.