also ich arbeite mit der bass.dll und will einen Musikplayer erstellen. Derzeit arbeite ich an einem Autocrossfading. Dazu will ich meine Play Procedur erweitern von:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83:
| procedure TForm1.Play (weiter: Boolean); var f: PChar; len: Integer; time: Tdatetime; begin try if weiter then begin timer2.Enabled := false; bass_channelstop(p);
pos := pos + 1;
f := PChar(list[pos].datei);
p := BASS_StreamCreateFile(False, f, 0, 0, 0);
if pos >= 0 then if not BASS_ChannelPlay(p, False) then Error('Error playing stream!'); mediaplayer1.FileName := list[pos].datei; mediaplayer1.Open;
title.Caption := list[pos].Title;
length.caption := inttostr((mediaplayer1.TrackLength[0] div 1000) div 60) +':'+ inttostr((mediaplayer1.TrackLength[0] div 1000) mod 60 );
currentl := mediaplayer1.TrackLength[0]; position.Max := bass_channelGetLength(p);
tpassd := 0; position.Position := 0;
timer2.Enabled := true;
mediaplayer1.Close; end else begin bass_channelstop(p); timer2.Enabled := false; title.Caption := list[form3.playlist.itemindex].Title; pos := form3.playlist.ItemIndex;
f := PChar(list[pos].datei); p := BASS_StreamCreateFile(False, f, 0, 0, 0);
if pos >= 0 then if not BASS_ChannelPlay(p, False) then Error('Error playing stream!');
mediaplayer1.FileName := list[pos].datei; mediaplayer1.Open;
title.Caption := list[pos].Title; currentl := mediaplayer1.TrackLength[0];
length.caption := inttostr((mediaplayer1.TrackLength[0] div 1000) div 60) +':'+ inttostr((mediaplayer1.TrackLength[0] div 1000) mod 60 );
position.Max := bass_channelGetLength(p);
tpassd := 0; position.Position := 0;
timer2.Enabled := true;
mediaplayer1.Close; end; except end; end; |
Um jetzt das autocrossfading zu realisieren will ich diese Procedur so erweitern:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81:
| procedure TForm1.Play (weiter: Boolean; ch: HSTREAM); var f: PChar; len: Integer; time: Tdatetime; begin try if weiter then begin timer2.Enabled := false; bass_channelstop(ch);
pos := pos + 1;
f := PChar(list[pos].datei);
ch := BASS_StreamCreateFile(False, f, 0, 0, 0);
if pos >= 0 then if not BASS_ChannelPlay(ch, False) then Error('Error playing stream!'); mediaplayer1.FileName := list[pos].datei; mediaplayer1.Open;
title.Caption := list[pos].Title;
length.caption := inttostr((mediaplayer1.TrackLength[0] div 1000) div 60) +':'+ inttostr((mediaplayer1.TrackLength[0] div 1000) mod 60 );
currentl := mediaplayer1.TrackLength[0]; position.Max := bass_channelGetLength(ch);
tpassd := 0; position.Position := 0;
timer2.Enabled := true;
mediaplayer1.Close; end else begin bass_channelstop(ch); timer2.Enabled := false; title.Caption := list[form3.playlist.itemindex].Title; pos := form3.playlist.ItemIndex;
f := PChar(list[pos].datei); ch := BASS_StreamCreateFile(False, f, 0, 0, 0);
if pos >= 0 then if not BASS_ChannelPlay(ch, False) then Error('Error playing stream!');
mediaplayer1.FileName := list[pos].datei; mediaplayer1.Open;
title.Caption := list[pos].Title; currentl := mediaplayer1.TrackLength[0];
length.caption := inttostr((mediaplayer1.TrackLength[0] div 1000) div 60) +':'+ inttostr((mediaplayer1.TrackLength[0] div 1000) mod 60 );
position.Max := bass_channelGetLength(ch);
tpassd := 0; position.Position := 0;
timer2.Enabled := true;
mediaplayer1.Close; end; except end; end; |
so wenn ich das jetzt mit
Delphi-Quelltext
aufrufe wird der Track der gerade abgespielt wird nicht angehalten!
Wieso?