Autor Beitrag
Massiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: Mo 04.05.09 14:00 
Hallo

ich habe folgendes problem:
ihc arbeite mit bassdllplayer und einer listbox, aus dem der bassdllplayer die songs ladet!
Der code lautet so:
ausblenden Delphi-Quelltext
1:
bassdllplayer1.LoadFromFile(listbox1.Items.Strings[listbox1.itemindex])					

nur dann hab ich folgendes problem gehabt und zwar das wenn ich die musik pausiere und anschliessend die musik wieder abspielen möchte,ladte der bassdllplayer die musik von neu!
also hab ich folgendem code versucht:
ausblenden Delphi-Quelltext
1:
2:
if bassdllplayer1.status = sndstopped then
  bassdllplayer1.LoadFromFile(listbox1.Items.Strings[listbox1.itemindex])

so nun hatte ich das problem mit pause nicht mher!
DOch jetzt hab ich ein anderes problem, und zwar immer wenn ich play drücke ohne das eine musik in der listbox ist, dann kommt immer dieser fehler:
www.pic-upload.de/vi...6599/fehelr.jpg.html
Dieser fehler liegt bestimmt an dem code:
ausblenden Delphi-Quelltext
1:
2:
if bassdllplayer1.status = sndstopped then
  bassdllplayer1.LoadFromFile(listbox1.Items.Strings[listbox1.itemindex])

deshalb wollt ich fragne wie man bassdllplayer fragen kann ob er eine musik geladen hat und nicht ob die musik gestoppt wurde wie den code oben!

ps: ich hoffe ich hab mich klar ausgedrückt^^
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mo 04.05.09 14:14 
Liegt wohl daran das du auf einen Index in einer Liste zuweist der garnicht da ist.
d.h.
Als ob du einer Liste mit Zeile 1-3 sagen würdest lade zeile 4 ^^ so und den rest solltest du von alleine schaffen.
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: Mo 04.05.09 14:20 
Du willst mir also sagen ich soll den bassdllplayer nicht sagen lad von itemindex?
Ehrlich gesagt ich schaffs nit von allein!pls help^^
zuma
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 660
Erhaltene Danke: 21

Win XP, Win7, Win 8
D7 Enterprise, Delphi XE, Interbase (5 - XE)
BeitragVerfasst: Mo 04.05.09 14:24 
doch, von itemindex laden, aber nur wenn der itemindex auch einen gültigen wert hat !
wenn keine Datei in der Liste ist, ist der itemindex nicht im gültigen bereich, weil ...

jetzt noch rausfinden, welcher bereich gültig ist, und du kommst alleine auf die Lösung ;)

_________________
Ich habe nichts gegen Fremde. Aber diese Fremden sind nicht von hier! (Methusalix)
Warum sich Sorgen ums Leben machen? Keiner überlebts!
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 04.05.09 14:24 
Ich bin mal nicht so. ;-)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if (bassdllplayer1.status = sndstopped)
  and (listbox1.itemindex > 0)
  and (listbox1.itemindex < listbox1.count)
then
  bassdllplayer1.LoadFromFile(listbox1.Items.Strings[listbox1.itemindex])

_________________
We are, we were and will not be.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 04.05.09 14:27 
user profile iconGausi hat folgendes geschrieben Zum zitierten Posting springen:
Ich bin mal nicht so. ;-)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if (bassdllplayer1.status = sndstopped)
  and (listbox1.itemindex >= 0)
  and (listbox1.itemindex < listbox1.count)
then
  bassdllplayer1.LoadFromFile(listbox1.Items.Strings[listbox1.itemindex])

Dann gehts auch, wenn man den ersten Eintrag markiert hat ;)

_________________
PROGRAMMER: A device for converting coffee into software.
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: Mo 04.05.09 14:29 
Danke gausi aber jetzt spielt die musik nicht mehr!
komisch^^
ich hab den code in den play button eingefügt, hängt das vllt damit zusammen?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 04.05.09 14:30 
user profile iconXentar hat folgendes geschrieben Zum zitierten Posting springen:
Dann gehts auch, wenn man den ersten Eintrag markiert hat ;)
Wieso sollte man denn soetwas tun? :P

Der Fehler war natürlich pure Absicht. :angel:

_________________
We are, we were and will not be.
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: Mo 04.05.09 14:35 
Und wiedereinmal habt ihr mich geretttet^^
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mo 04.05.09 14:37 
Und wieder mal wurde alles vorgekaut. :D
Aber du fragst anscheinend so nett das dir einfach keiner wiederstehen kann. ;)