TestUnit.pas
上传用户:wanyu_2000
上传日期:2021-02-21
资源大小:527k
文件大小:3k
源码类别:

DVD

开发平台:

Delphi

  1. unit TestUnit;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils,WaveUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls,AudioImage, MP3Convert,ComCtrls;
  6. type
  7.   TForm1 = class(TForm)
  8.     Button1: TButton;
  9.     OpenDialog1: TOpenDialog;
  10.     Button2: TButton;
  11.     SaveDialog1: TSaveDialog;
  12.     TrackListBox: TListBox;
  13.     Button3: TButton;
  14.     Button4: TButton;
  15.     Button5: TButton;
  16.     Button6: TButton;
  17.     procedure Button1Click(Sender: TObject);
  18.     procedure FormCreate(Sender: TObject);
  19.     procedure FormDestroy(Sender: TObject);
  20.     procedure Button2Click(Sender: TObject);
  21.     procedure Button3Click(Sender: TObject);
  22.     procedure Button4Click(Sender: TObject);
  23.     procedure Button5Click(Sender: TObject);
  24.     procedure Button6Click(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.     AudioImage : TAudioImage;
  30.     MP3Converter : TMP3Convertor;
  31.     Procedure ListTracks;
  32.   end;
  33. var
  34.   Form1: TForm1;
  35. implementation
  36. {$R *.dfm}
  37. Procedure TForm1.ListTracks;
  38. Var
  39.  Index : Integer;
  40. begin
  41.   TrackListBox.Items.Clear;
  42.   For Index := 0 to AudioImage.TrackCount -1 do
  43.   begin
  44.     TrackListBox.Items.Add(AudioImage.Tracks[index].CDTrack.TrackName + ' : '+ AudioImage.Tracks[index].DisplayName);
  45.   end;
  46. end;
  47. procedure TForm1.Button1Click(Sender: TObject);
  48. Var
  49.     Track : TCDTrackItem;
  50. begin
  51. if Opendialog1.execute then
  52. begin
  53.    Track := AudioImage.Add;
  54.    Track.LoadWaveFile(Opendialog1.FileName);
  55.    Track.CDTrack.ConvertToPCM(Stereo16bit44100Hz);
  56.    ListTracks;
  57. end;
  58. end;
  59. procedure TForm1.FormCreate(Sender: TObject);
  60. begin
  61.    AudioImage := TAudioImage.Create;
  62. end;
  63. procedure TForm1.FormDestroy(Sender: TObject);
  64. begin
  65.    AudioImage.Free;
  66. end;
  67. procedure TForm1.Button2Click(Sender: TObject);
  68. begin
  69. if savedialog1.Execute then
  70.    AudioImage.Tracks[0].SaveWaveFile(Savedialog1.FileName);
  71. end;
  72. procedure TForm1.Button3Click(Sender: TObject);
  73. begin
  74.    ListTracks;
  75. end;
  76. procedure TForm1.Button4Click(Sender: TObject);
  77. Var
  78.     Track : TCDTrackItem;
  79. begin
  80. if Opendialog1.execute then
  81. begin
  82.    Track := AudioImage.Add;
  83.    Track.LoadWaveFile(Opendialog1.FileName);
  84.    Track.CDTrack.ConvertToMP3(Stereo16bit44100Hz);
  85.    ListTracks;
  86. end;
  87. end;
  88. procedure TForm1.Button5Click(Sender: TObject);
  89. begin
  90. if savedialog1.Execute then
  91. begin
  92.    AudioImage.Tracks[0].CDTrack.ConvertFromMP3(Stereo16bit44100Hz);
  93.    AudioImage.Tracks[0].SaveWaveFile(Savedialog1.FileName);
  94. end;
  95. end;
  96. procedure TForm1.Button6Click(Sender: TObject);
  97. Var
  98.     Track : TCDTrackItem;
  99. begin
  100. if Opendialog1.execute then
  101. begin
  102.   { Track := AudioImage.Add;
  103.    Track.LoadWaveFile(Opendialog1.FileName);
  104.    Track.CDTrack.ConvertToMP3(Stereo16bit44100Hz);
  105.    ListTracks;}
  106. end;
  107. end;
  108. end.