31
Programming using the Ultra Hal Brain Editor / Adding functions to XTF Brain (attn: vonsmith)
« on: March 15, 2004, 11:49:21 pm »
[^]
I found the problem myself. I am tired, but I just couldn't let it go. I kept on trying. I noticed that the same songs could be played over each time I asked for them, and some never played at all.
Then I looked to see if I could find the difference. What I found was songs that I had more then one of, by the same artist, could play, but those that I only had one song per artist would not.
Then I made this little change to the code. Apparently it was finding a song for that artist and trying to play the song in the position after the first song. If there was only one song, it pointed to an empty space and crashed the VBasic program. Maybe it is only because I'm using WMP 9, and it might work diferently. All I know is that it seems to work now.
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If oWMP.mediaCollection.getByAuthor(searchBand).Count > 0 Then
GetResponse = "I will play some " & searchBand
Priority = 1
Set songsList = oWMP.mediaCollection.getByAuthor(searchBand)
numSong = Int(Rnd * songsList.Count) ' + 1 I REMOVED THIS +1 TO FIX THE PROBLEM I WAS HAVING PLAYING AN ARTIST THAT i ONLY OWNED ONE SONG AND NOT A WHOLE SELECTION OF SONGS.
oWMP.openPlayer (songsList.Item(numSong).sourceURL)
Else
GetResponse = "I could not find any songs by the band " & searchBand & " in your Media Library."
Priority = 1
End If
End If
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is that "+1" in there for a particular reason that I missed. It all seems to work fine now. That's for all the help everyone.
[]
[]
I found the problem myself. I am tired, but I just couldn't let it go. I kept on trying. I noticed that the same songs could be played over each time I asked for them, and some never played at all.
Then I looked to see if I could find the difference. What I found was songs that I had more then one of, by the same artist, could play, but those that I only had one song per artist would not.
Then I made this little change to the code. Apparently it was finding a song for that artist and trying to play the song in the position after the first song. If there was only one song, it pointed to an empty space and crashed the VBasic program. Maybe it is only because I'm using WMP 9, and it might work diferently. All I know is that it seems to work now.
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If oWMP.mediaCollection.getByAuthor(searchBand).Count > 0 Then
GetResponse = "I will play some " & searchBand
Priority = 1
Set songsList = oWMP.mediaCollection.getByAuthor(searchBand)
numSong = Int(Rnd * songsList.Count) ' + 1 I REMOVED THIS +1 TO FIX THE PROBLEM I WAS HAVING PLAYING AN ARTIST THAT i ONLY OWNED ONE SONG AND NOT A WHOLE SELECTION OF SONGS.
oWMP.openPlayer (songsList.Item(numSong).sourceURL)
Else
GetResponse = "I could not find any songs by the band " & searchBand & " in your Media Library."
Priority = 1
End If
End If
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is that "+1" in there for a particular reason that I missed. It all seems to work fine now. That's for all the help everyone.
[]
[]