Autor Beitrag
smepal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win XP, Linux Mandbrake,SUSE 10.1, SUSE 9 PE, DEBIAN, Win 2000 Pro, Win XP Pro
Delphi
BeitragVerfasst: Do 03.08.06 20:26 
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:
ausblenden volle Höhe Delphi-Quelltext
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
//Automatisch nächstes Lied abspielen
timer2.Enabled := false;
bass_channelstop(p);

//Der nächste Track wird ausgewählt und an den Mediaplayer übergeben
//Die Infos´werden angezeigt
pos := pos + 1;

  // Play the stream (continuing from current position)
  f := PChar(list[pos].datei);

  p := BASS_StreamCreateFile(False, f, 000);

  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[0div 1000div 60) +':'+ inttostr((mediaplayer1.TrackLength[0div 1000mod 60 );

//Die Positionsanzeige wird eingerichtet
currentl := mediaplayer1.TrackLength[0];
position.Max := bass_channelGetLength(p);

//Start des Abspielvorgangs
tpassd := 0;
position.Position := 0;

timer2.Enabled := true;

mediaplayer1.Close;
end
else
begin
//Ausgewähltes Lied abspielen
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, 000);

  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[0div 1000div 60) +':'+ inttostr((mediaplayer1.TrackLength[0div 1000mod 60 );

//Die Positionsanzeige wird eingerichtet

position.Max := bass_channelGetLength(p);

//Start des Abspielvorgangs
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:
ausblenden volle Höhe Delphi-Quelltext
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);

//Der nächste Track wird ausgewählt und an den Mediaplayer übergeben
//Die Infos´werden angezeigt
pos := pos + 1;

  // Play the stream (continuing from current position)
  f := PChar(list[pos].datei);

  ch := BASS_StreamCreateFile(False, f, 000);

  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[0div 1000div 60) +':'+ inttostr((mediaplayer1.TrackLength[0div 1000mod 60 );

//Die Positionsanzeige wird eingerichtet
currentl := mediaplayer1.TrackLength[0];
position.Max := bass_channelGetLength(ch);

//Start des Abspielvorgangs
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, 000);

  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[0div 1000div 60) +':'+ inttostr((mediaplayer1.TrackLength[0div 1000mod 60 );

//Die Positionsanzeige wird eingerichtet

position.Max := bass_channelGetLength(ch);

//Start des Abspielvorgangs
tpassd := 0;
position.Position := 0;

timer2.Enabled := true;

mediaplayer1.Close;
    end;
except
end;
end;


so wenn ich das jetzt mit
ausblenden Delphi-Quelltext
1:
form1.play(true, p);					

aufrufe wird der Track der gerade abgespielt wird nicht angehalten!
Wieso?