PlayListExecOrderTableGet returns wrong values

Started by PatrickVossen, February 22, 2021, 04:00:00 PM

Previous topic - Next topic

PatrickVossen

Hi,

Retrieving the shuffled playlist order does not seem to work.

I have a playlist that's loaded from .pdj file containing 3 files (using PlayListLoadSync, PlayListLoad does not seem to work at all).
The PlaylistSetShuffle option is set to true (was already set before loading the pdj-file).
On the PlayListLoadDone-event, I do a call to PlayListExecOrderTableGet to retrieve the PlayOrder.
Result for this is    2 - 1 - 0
The playlist starts playing and on the PlaylistSoundLoaded-event I log the indexes that are played.
The result for this is    2 - 0 - 1

Grtz
Patrick Vossen

Administrator

Hello Patrick,

we will try to replicate the issue and will let you know our findings at the soonest.

Kind Regards

Severino Delaurenti
MultiMedia Soft

Administrator

Hello Patrick,

could you be so kind to tell me which method are you currently using for starting execution of the playlist?

Kind regards

Severino Delaurenti
MultiMedia Soft

Administrator

Hello again,

with regards to the other fact you mentioned, that the PlayListLoad method doesn't seem to work, please, be advised that, accordingly to the documentation, the PlayListLoadDone event is only generated when using the PlayListLoadSync method so in case you should perform coding inside the event handler, this code won't be reachable due to the fact that the PlayListLoadDone event is not generated by the PlayListLoad method: you should transfer the handler's code immediately after invoking the PlayListLoad method.

Kind Regards

Severino Delaurenti
MultiMedia Soft

PatrickVossen

Hi Severino,

For starting the playlist, I have tried :
        AudioDjStudio1.PlayListExecute(Player_1, True)
        AudioDjStudio1.PlayListExecute(Player_1, False)
        AudioDjStudio1.PlayListExecAt(Player_1, IndexOrder(0))
        AudioDjStudio1.PlayListExecAt(Player_1, 0)

I have added my vb code and the playlist (.pdj) I have used


Imports AudioDjStudio

Public Class Form1
    Private Const Player_1 As Short = 0

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog With {
            .Filter = "Playlist formats (*.m3u;*.pls;*.wpl;*.pdj)|*.m3u;*.pls;*.wpl;*.pdj|M3U PlayList (*.m3u)|*.m3u|PLS PlayList (*.pls)|*.pls|WPL PlayList (*.wpl)|*.wpl|PDJ PlayList (*.pdj)|*.pdj|All files (*.*)|*.*",
            .InitialDirectory = AudioDjStudio1.SoundsDirectory
        }
        If ofd.ShowDialog() <> DialogResult.OK Then Return

        If AudioDjStudio1.PlayListLoadSync(Player_1, ofd.FileName, enumPlayListModes.PLAYLIST_AUTOMATION_MODE) <> enumErrorCodes.NOERROR Then
            MessageBox.Show("Error loading playlist")
            Return
        End If
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        AudioDjStudio1.InitSoundSystem(1, 0, 0, 0, 0, -1)

        AudioDjStudio1.PlayListSetLoop(Player_1, False)
        AudioDjStudio1.PlayListSetShuffle(Player_1, True)
    End Sub

    Private Sub AudioDjStudio1_PlayListLoadDone(sender As Object, e As PlayListLoadDoneEventArgs) Handles AudioDjStudio1.PlayListLoadDone
        Debug.WriteLine($"AudioDjStudio1_PlayListLoadDone   nPlayerIndex={e.nPlayerIndex}   bSuccess={e.bSuccess}")

        Dim Quantity As Short = AudioDjStudio1.PlayListGetCount(Player_1)
        Dim IndexOrder() As Short
        If Quantity > 0 Then
            ReDim IndexOrder(Quantity - 1)
            Debug.WriteLine(AudioDjStudio1.PlayListExecOrderTableGet(Player_1, IndexOrder, Quantity).ToString)
            Debug.WriteLine("+++++++++++++++++++++++++++++++")
            For index As Integer = 0 To IndexOrder.Length - 1
                Debug.WriteLine(IndexOrder(index))
            Next
            Debug.WriteLine("+++++++++++++++++++++++++++++++")
        End If
        AudioDjStudio1.PlayListExecute(Player_1, True)
        'AudioDjStudio1.PlayListExecute(Player_1, False)
        'AudioDjStudio1.PlayListExecAt(Player_1, IndexOrder(0))
        'AudioDjStudio1.PlayListExecAt(Player_1, 0)

    End Sub

    Private Sub AudioDjStudio1_PlayListLoadPerc(sender As Object, e As PlayListLoadPercEventArgs) Handles AudioDjStudio1.PlayListLoadPerc
        Debug.WriteLine($"AudioDjStudio1_PlayListLoadPerc   nPlayerIndex={e.nPlayerIndex}   nPercentage={e.nPercentage}")
    End Sub

    Private Sub AudioDjStudio1_PlayListLoadStart(sender As Object, e As PlayerEventArgs) Handles AudioDjStudio1.PlayListLoadStart
        Debug.WriteLine($"AudioDjStudio1_PlayListLoadStart   nPlayerIndex={e.nPlayerIndex}")
    End Sub

    Private Sub AudioDjStudio1_PlayListDone(sender As Object, e As PlayerEventArgs) Handles AudioDjStudio1.PlayListDone
        Debug.WriteLine($"AudioDjStudio1_PlayListDone   nPlayerIndex={e.nPlayerIndex}")
    End Sub

    Private Sub AudioDjStudio1_PlaylistSoundLoaded(sender As Object, e As PlaylistSoundLoadedEventArgs) Handles AudioDjStudio1.PlaylistSoundLoaded
        Debug.WriteLine($"AudioDjStudio1_PlaylistSoundLoaded   nPlayerIndex={e.nPlayerIndex}   nItemIndex={e.nItemIndex}   strTag={e.strTag}")
    End Sub

    Private Sub AudioDjStudio1_PlayListSoundLoadFailure(sender As Object, e As SoundLoadedEventArgs) Handles AudioDjStudio1.PlayListSoundLoadFailure
        Debug.WriteLine($"AudioDjStudio1_PlayListSoundLoadFailure   nPlayerIndex={e.nPlayerIndex}   nItemIndex={e.nItemIndex}")
    End Sub
End Class

Administrator

Hello Patrick,

unfortunately this is not well explained inside the documentation but, by design, both the PlayListExecute and PlayListExecAt methods will cause a new shuffle of the loaded playlist so you should invoke the PlayListExecOrderTableGet method again after their call: differently from meniotned methods, using the PlayListExecNext method will not request a new shuffle.

Hope this helps

Kind Regards

Severino Delaurenti
MultiMedia Soft