Jump to content
Fórum Script Brasil
  • 0

VB6 FMOD crash FSOUND_STREAM


LordLuc

Question

o VB6 da crash após eu executar o sub abaixo 509 vezes, ou seja, na 510° vez ele da crash e não avisa nada apenas fica escrito enviar /não enviar relatorios...

Public Sub Play_Sound(ByVal sound As String)

Dim i As Long

Dim result As FMOD_ERRORS

If Not bInit_Sound Then Exit Sub

' exit out early if we have the system turned off

If Options.sound = 0 Then Exit Sub

' does it exist?

If Not FileExist(App.path & SOUND_PATH & sound) Then Exit Sub

' find the extension

Select Case Right$(sound, 4)

Case ".mid", ".s3m", ".mod"

' open the stream

SoundHandle = FSOUND_Stream_Open(App.path & SOUND_PATH & sound, FSOUND_LOOP_OFF, 0, 0)

' play it

For i = 1 To 31

If FSOUND_IsPlaying(i) = 0 Then

FSOUND_Stream_Play i, SoundHandle

FSOUND_SetVolume SoundHandle, 150

SoundCount = SoundCount + 1

Exit For

End If

Next i

Case ".wav", ".mp3", ".ogg", ".wma"

' open the stream

SoundHandle = FSOUND_Stream_Open(App.path & SOUND_PATH & sound, FSOUND_LOOP_OFF, 0, 0)

' play it

For i = 1 To 31

If FSOUND_IsPlaying(i) = 0 Then

FSOUND_Stream_Play i, SoundHandle

FSOUND_SetVolume SoundHandle, 150

SoundCount = SoundCount + 1

Exit For

End If

Next i

Case Else

Exit Sub

End Select

End Sub

DUVIDO super que alguém possa me ajudar...

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Olá Lord, tudo bem?

Duvidou boubiou vei.. rsrs

Nunca usei o FSound_Stream, mas talvez, você esteja abrindo o arquivo, tocando e não esteja fechando o mesmo, e em um certo ponto, ele encontra um limite de alça aberta.

Para tocar sons eu uso a dll PlaySound, acho mais prático, não se preocupe com o volume, se o usuário quiser ouvir o som, ele aumenta na saída de som do pc.

Um abraço.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...