如何设置带低音的歌曲/文件结尾的回调?

时间:2010-02-14 22:40:07

标签: c# .net bass

我正在使用Bass。我想设置一个回调,所以当歌曲到达结束时我可以直接播放另一首歌。

1 个答案:

答案 0 :(得分:3)

它不是C#,但是这里有一些你应该能够轻松转换的VB.Net代码:

设置回调

' 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)

BASS将在曲目结束时调用的代理子

' 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