Results 1 to 18 of 18

Thread: best way to work with playlist

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131

    best way to work with playlist

    Ok, I have created a playlist for my programe. But I don't know of the best way to use it. Like how to creat a randum num generator and then make it choose that song..

    Any suggestions?

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    This will generate a random number. You can then use it to select a track number on a CD, or a certain file in a playlist etc
    VB Code:
    1. Dim UpperBound As Long
    2. Dim LowerBound As Long
    3.  
    4. UpperBound = 100
    5. LowerBound = 10
    6.  
    7. Randomize
    8. MsgBox Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    That Should help me..

    Another question. Would it be a good idea to parse the playlist as it is loaded into and array containing all the songs, and then using that generater to pick random songs?

  4. #4
    As opposed to...?

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Yes, I would do it that way

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    I didn't know how everyone else did it.. I didn't know if they just opened the file, and pciked a random line or something else..

  7. #7
    To pick a random line, you'd still have to go through the whole file.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    Yea, but I would only have to do it once. Then save it as a variable..

    I guess the array is the best idea..

  9. #9
    I'm inclined to agree. BTW, we are talking about a playlist in the WiMP/Winamp sense, right?

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    Yes, except for my Incar mp3 player, LCD driver..

  11. #11
    *drool* Give me that code/hardware when you're done.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    If I can ever get it done. I seem to be having brain lapses today.. Why is THIS code not working..

    VB Code:
    1. Public Sub FileSort(Path As String, Filename As String)
    2. Dim mp3 As String
    3. mp3 = mp3
    4.  
    5.     If InStr(0, Filename, mp3, 0) > 0 Then
    6.             NAAAS.lstScand.AddItem Path & Filename
    7.             'Add db code here
    8.  
    9.     Else
    10.             NAAAS.cmbChoose.AddItem Filename
    11.     End If
    12.    
    13. End Sub

    I want to search the filename for mp3, and if it finds it, then to send it thelstScand, else to cmbChoose. But no matter what it is sending to cmbChoose..

  13. #13
    VB Code:
    1. mp3 = mp3
    Could that interesting little tidbit be the problem?

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    With that code it adds the mp3's to noth list.. Strange..

  15. #15
    DaoK
    Guest
    mp3 = mp3
    What is this constant Turtle ?

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    Originally posted by DaoK


    What is this constant Turtle ?
    What about Turtles? Must be an insider joke..

  17. #17
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    yeah, not very inside though

    Turtle = filburt = charcter on Rocko's Modern Life (apparantly)

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    131
    Oh, I thought you were drunk for a second.

    Anyway, switching the keyword from mp3 to m3u seemed to work. A bug in VB maybe? Using the InStr with a number ending the search string? Thanks for all the help though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width