Hola de nuevo,
He conseguido reproducir tal y como lo quieres y parece que no se producen cortes.
Lo primero es crear una clase para soportar la reproducción en bucle (sacado de la documentación de NAudio).
Código vb:
Ver originalImports NAudio.Wave
Public Class LoopStream
Inherits WaveStream
Private sourceStream As WaveStream
''' <summary>
''' Creates a new Loop stream
''' </summary>
''' <param name="sourceStream">The stream to read from. Note: the Read method of this stream should return 0 when it reaches the end
''' or else we will not loop to the start again.</param>
Public Sub New(sourceStream As WaveStream)
Me.sourceStream = sourceStream
Me.EnableLooping = True
End Sub
''' <summary>
''' Use this to turn looping on or off
''' </summary>
Public Property EnableLooping() As Boolean
Get
Return m_EnableLooping
End Get
Set(value As Boolean)
m_EnableLooping = value
End Set
End Property
Private m_EnableLooping As Boolean
''' <summary>
''' Return source stream's wave format
''' </summary>
Public Overrides ReadOnly Property WaveFormat() As WaveFormat
Get
Return sourceStream.WaveFormat
End Get
End Property
''' <summary>
''' LoopStream simply returns
''' </summary>
Public Overrides ReadOnly Property Length() As Long
Get
Return sourceStream.Length
End Get
End Property
''' <summary>
''' LoopStream simply passes on positioning to source stream
''' </summary>
Public Overrides Property Position() As Long
Get
Return sourceStream.Position
End Get
Set(value As Long)
sourceStream.Position = value
End Set
End Property
Public Overrides Function Read(buffer As Byte(), offset As Integer, count As Integer) As Integer
Dim totalBytesRead As Integer = 0
While totalBytesRead < count
Dim bytesRead As Integer = sourceStream.Read(buffer, offset + totalBytesRead, count - totalBytesRead)
If bytesRead = 0 Then
If sourceStream.Position = 0 OrElse Not EnableLooping Then
' something wrong with the source stream
Exit While
End If
' loop
sourceStream.Position = 0
End If
totalBytesRead += bytesRead
End While
Return totalBytesRead
End Function
End Class
Lo segundo es usar el código que reproduce los dos archivos.
Código vb:
Ver originalImports NAudio.Wave
Public Class Form1
Private sound1 As WaveOut
Private sound2 As WaveOut
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button2.Click
If sound1 Is Nothing Then
Dim reader As New WaveFileReader("media/test.wav")
Dim looping As New LoopStream(reader)
sound1 = New WaveOut()
sound1.Init(looping)
sound1.Play()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button3.Click
If sound2 Is Nothing Then
Dim reader As New WaveFileReader("media/test1.wav")
Dim looping As New LoopStream(reader)
sound2 = New WaveOut()
sound2.Init(looping)
sound2.Play()
End Sub
End Class
Espero que te sirva.
Un saludo.