Autor Beitrag
Tomac
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 113

Win XP
D6 Ent
BeitragVerfasst: Do 20.03.03 19:18 
Hi!

Ich benutze für meinen MP3 Player eine Combobox als Playlist. Nun möchte ich, dass ein Zufallsgenerator immer zufällig ein Lied auswählt, aber ein Lied erst dann zum zweiten Mal lädt, wenn vorher jedes andere schon mal ausgewählt wurde.
Nur leider hab ich keinen Plan wie ich das auf die Reihe kriegen soll.

THX
Tomac
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Do 20.03.03 19:23 
Mein Vorschlag:
Schreib doch in einer Procedure alle Items der Combobox in eine Stringlist. Die mischt du dann ein wenig (move) und spielst die Titel der Reihe nach ab. Am Ende wieder mixen und neu anfangen.

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Do 20.03.03 23:19 
huhu,

noch einfacher als "Mixen" währe es so:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  Songs: TStringList;

function GetRandomSong: String;
var
  x: Integer;
begin
  x:=Random(Songs.Count);
  Result:=Songs.Strings[x];
  Songs.Delete(x);
  if Songs.Count=0 then
    Songs.Assign(ListBox1.Items);
end;


So würde ich das denke ich mal machen... ;)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
hitstec
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 295



BeitragVerfasst: Fr 21.03.03 00:09 
Natürlich nicht vergessen

ausblenden Quelltext
1:
Randomize;					

aufzurufen.

Aber nicht in der Funktion!
Tomac Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 113

Win XP
D6 Ent
BeitragVerfasst: Fr 21.03.03 14:01 
Stimmt, danke, auf die Idee bin ich noch gar nicht gekommen, die Einträge in einer Stringlist nach dem Abspielen zu löschen.