Develop and Download Open Source Software

Browse Subversion Repository

Diff of /Unit1.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3 by yamat0jp, Tue Jul 28 12:15:19 2015 UTC revision 4 by yamat0jp, Fri Jul 31 23:39:46 2015 UTC
# Line 46  type Line 46  type
46      procedure Action4Execute(Sender: TObject);      procedure Action4Execute(Sender: TObject);
47      procedure Action6Execute(Sender: TObject);      procedure Action6Execute(Sender: TObject);
48      procedure Action5Execute(Sender: TObject);      procedure Action5Execute(Sender: TObject);
49        procedure TrackBar2Change(Sender: TObject);
50    private    private
51      { private 宣言 }      { private 宣言 }
52    public    public
53      { public 宣言 }      { public 宣言 }
54      th: TThread;      th: TThread;
55        procedure PlayMusic(Number: integer);
56    end;    end;
57    
58  var  var
# Line 122  begin Line 124  begin
124      MediaPlayer1.Stop;      MediaPlayer1.Stop;
125      Action4.Text := 'Play';      Action4.Text := 'Play';
126    end    end
127    else    else if ListView1.ItemCount > 0 then
128    begin    begin
129      if (ListView1.ItemCount > 0) and (ListView1.ItemIndex = -1) then      if ListView1.ItemIndex = -1 then
130          PlayMusic(0)
131        else
132      begin      begin
133        ListView1.ItemIndex := 0;        MediaPlayer1.FileName := ListView1.Items[ListView1.ItemIndex].Detail;
       MediaPlayer1.FileName := ListView1.Items[0].Detail;  
134        TrackBar2.Max := MediaPlayer1.Duration;        TrackBar2.Max := MediaPlayer1.Duration;
135        TrackBar2.Value := 0;        MediaPlayer1.CurrentTime := Trunc(TrackBar2.Value);
136          MediaPlayer1.Play;
137      end;      end;
138      MediaPlayer1.Play;      MediaPlayer1.Play;
139      Action4.Text := 'Stop';      Action4.Text := 'Stop';
# Line 138  end; Line 142  end;
142    
143  procedure TForm1.Action5Execute(Sender: TObject);  procedure TForm1.Action5Execute(Sender: TObject);
144  begin  begin
145    MediaPlayer1.CurrentTime := MediaPlayer1.CurrentTime -    if MediaPlayer1.CurrentTime < MediaTimeScale div 10000 then
146      MediaTimeScale div 1000;      if ListView1.ItemCount > 0 then
147    TrackBar2.Value := MediaPlayer1.CurrentTime;        PlayMusic(ListView1.ItemIndex - 1)
148        else
149        begin
150          MediaPlayer1.Stop;
151          MediaPlayer1.CurrentTime := 0;
152          TrackBar2.Value := 0;
153          Action4.Text := 'Play';
154        end;
155  end;  end;
156    
157  procedure TForm1.Action6Execute(Sender: TObject);  procedure TForm1.Action6Execute(Sender: TObject);
158    var
159      i: integer;
160  begin  begin
161    MediaPlayer1.CurrentTime := MediaPlayer1.CurrentTime +    if ListView1.ItemIndex < ListView1.ItemCount - 1 then
162      MediaTimeScale div 1000;    begin
163    TrackBar2.Value := MediaPlayer1.CurrentTime;      i := ListView1.ItemIndex + 1;
164        ListView1.ItemIndex := i;
165        PlayMusic(i);
166      end;
167  end;  end;
168    
169  procedure TForm1.FormDestroy(Sender: TObject);  procedure TForm1.FormDestroy(Sender: TObject);
# Line 185  begin Line 201  begin
201        Action1Execute(Sender);        Action1Execute(Sender);
202        Exit;        Exit;
203      end;      end;
204      Volume := TrackBar1.Value;      PlayMusic(ListView1.ItemIndex);
     TrackBar2.Max := Duration;  
     TrackBar2.Value := 0;  
     Play;  
205    end;    end;
206  end;  end;
207    
208    procedure TForm1.PlayMusic(Number: integer);
209    begin
210      ListView1.ItemIndex := Number;
211      MediaPlayer1.FileName := ListView1.Items[Number].Detail;
212      TrackBar2.Max := MediaPlayer1.Duration;
213      TrackBar2.Value := 0;
214      Action4.Text := 'Stop';
215      MediaPlayer1.Play;
216    end;
217    
218  procedure TForm1.SpeedButton1Click(Sender: TObject);  procedure TForm1.SpeedButton1Click(Sender: TObject);
219  begin  begin
220    Form2.Show;    Form2.Show;
# Line 210  begin Line 233  begin
233        begin        begin
234          Stop;          Stop;
235          Clear;          Clear;
236          FileName := ListView1.Items.Item[ListView1.ItemIndex].Detail;          FileName := ListView1.Items[ListView1.ItemIndex].Detail;
237          Volume := TrackBar1.Value;          Volume := TrackBar1.Value;
238          Play;          Play;
239        end;        end;
# Line 225  begin Line 248  begin
248    MediaPlayer1.Volume := TrackBar1.Value;    MediaPlayer1.Volume := TrackBar1.Value;
249  end;  end;
250    
251    procedure TForm1.TrackBar2Change(Sender: TObject);
252    begin
253      if (TrackBar2.Value < MediaPlayer1.CurrentTime) or
254        (TrackBar2.Value > MediaPlayer1.CurrentTime + MediaTimeScale div 800) then
255        MediaPlayer1.CurrentTime := Trunc(TrackBar2.Value);
256    end;
257    
258  end.  end.

Legend:
Removed from v.3  
changed lines
  Added in v.4

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26