我是个初学者,我在网上下载了《QQ语音伴侣》这个软件,由于它老出现注册信息,而且出现之后,就出现程序错误并关闭,所以我想自己做一个,可我不知道怎么做的
我看它的声音文件就一个,我如何才能从声音文件取出一段声音用呀

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, MPlayer, ExtCtrls;type
      TForm1 = class(TForm)
        SysMplTest: TMediaPlayer;
        StdBtnFirst: TButton;
        StdBtnSecond: TButton;
        StdBtnThird: TButton;
        SysTmrTimer: TTimer;
        procedure FormCreate(Sender: TObject);
        procedure StdBtnFirstClick(Sender: TObject);
        procedure StdBtnSecondClick(Sender: TObject);
        procedure StdBtnThirdClick(Sender: TObject);
        procedure SysTmrTimerTimer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      SysMplTest.TimeFormat:=tfMilliseconds;
    end;procedure TForm1.StdBtnFirstClick(Sender: TObject);
    begin
      SysTmrTimer.Tag:=0;
      SysTmrTimer.Enabled :=True;
    end;procedure TForm1.StdBtnSecondClick(Sender: TObject);
    begin
      SysTmrTimer.Tag:=1;
      SysTmrTimer.Enabled :=True;
    end;procedure TForm1.StdBtnThirdClick(Sender: TObject);
    begin
      SysTmrTimer.Tag:=2;
      SysTmrTimer.Enabled :=True;
    end;procedure TForm1.SysTmrTimerTimer(Sender: TObject);
    begin
      SysMplTest.Play;  Case SysTmrTimer.Tag Of
        0:If SysMplTest.Position>=5000 Then SysMplTest.Pause;
        1:If SysMplTest.Position>=30000 Then SysMplTest.Pause;
        2:If SysMplTest.Position>=1000 Then SysMplTest.Pause;
      End;
    end;end.
      

  2.   

    0:If SysMplTest.Position>=5000 Then SysMplTest.Pause;
    1:If SysMplTest.Position>=10000 Then SysMplTest.Pause;
    2:If SysMplTest.Position>=15000 Then SysMplTest.Pause;//这里的数字是时间,单位微秒
    //单位是在SysMplTest.TimeFormat里定义的。
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, MPlayer, ExtCtrls;type
      TForm1 = class(TForm)
        SysMplTest: TMediaPlayer;
        StdBtnFirst: TButton;
        StdBtnSecond: TButton;
        StdBtnThird: TButton;
        SysTmrTimer: TTimer;
        procedure FormCreate(Sender: TObject);
        procedure StdBtnFirstClick(Sender: TObject);
        procedure StdBtnSecondClick(Sender: TObject);
        procedure StdBtnThirdClick(Sender: TObject);
        procedure SysTmrTimerTimer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      SysMplTest.TimeFormat:=tfMilliseconds;
    end;procedure TForm1.StdBtnFirstClick(Sender: TObject);
    begin
      SysTmrTimer.Tag:=0;
      SysTmrTimer.Enabled :=True;
    end;procedure TForm1.StdBtnSecondClick(Sender: TObject);
    begin
      SysTmrTimer.Tag:=1;
      SysTmrTimer.Enabled :=True;
    end;procedure TForm1.StdBtnThirdClick(Sender: TObject);
    begin
      SysTmrTimer.Tag:=2;
      SysTmrTimer.Enabled :=True;
    end;procedure TForm1.SysTmrTimerTimer(Sender: TObject);
    begin
      SysMplTest.Play;  Case SysTmrTimer.Tag Of
        0:If SysMplTest.Position>=5000 Then SysMplTest.Stop;
        1:If SysMplTest.Position>=10000 Then SysMplTest.Stop;
        2:If SysMplTest.Position>=15000 Then SysMplTest.Stop;
      End;
    end;end.