Como faço para definir um retorno de chamada para o final da música/arquivo com baixo?

StackOverflow https://stackoverflow.com/questions/2263127

  •  20-09-2019
  •  | 
  •  

Pergunta

estou usando Graves. Eu gostaria de definir um retorno de chamada, então, quando a música chegar ao fim, eu posso tocar outra música logo depois.

Foi útil?

Solução

Não é C#, mas aqui está algum código VB.NET que você poderá converter com bastante facilidade:

Configure o retorno de chamada

' Mixer handle to the bass synch callback when the current track in the mixer ends
Private m_MixerSynchProc As Un4seen.Bass.SYNCPROC
Private m_MixerSyncHandle As Int32 = 0

' Create a new callback for when the current track in the mixer has ended
m_MixerSynchProc = New Un4seen.Bass.SYNCPROC(AddressOf CurrentTrackEnded)

m_MixerSyncHandle = Bass.BASS_ChannelSetSync(m_MixerHandle, Un4seen.Bass.BASSSync.BASS_SYNC_END Or Un4seen.Bass.BASSSync.BASS_SYNC_MIXTIME, 0, m_MixerSynchProc, 0)

Um sub -delegado que o baixo ligará quando a faixa terminar

' Mixer sync proc callback for when the current track has ended
Private Sub CurrentTrackEnded(ByVal MixerHandle As Int32, ByVal Channel As Int32, ByVal Data As Int32, ByVal User As IntPtr)
    ' Do stuff here when the track ends
End Sub
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top