Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi NewAC MP3 von Stream speichern (https://www.delphipraxis.net/162946-newac-mp3-von-stream-speichern.html)

Horst0815 10. Sep 2011 10:39

Delphi-Version: 2007

NewAC MP3 von Stream speichern
 
des WMA speichern klappt ohne Probleme nur MP3 will irgendwie gar nicht
Lame_enc.dll und Bass.dll sind vorhanden. Oder ist das nicht vorgesehen und ich muss erst die WMA erzeugen und davon dann die MP3?

die Datei wird übrigens erzeugt ist aber dann leer

Delphi-Quellcode:
procedure TfrmMain.btnRecordClick(Sender: TObject);
var
  sName: String;
begin
  Case btnRecord.Tag of
    0:
      begin
        if (DXAudioOut.Status = tosIdle) and (DSAudioOut.Status = tosIdle) then
          Exit;
        if (WMATap1.Status = tosIdle) and (MP3Out1.Status = tosIdle) then
        begin
          sName := ExtractFilePath(ParamStr(0)) + CBsender.Text +
            ' - ' + FormatDateTime('hh-nn-ss - dd.mm.yyyy', Now);
          WMATap1.FileName := sName + '.wma';
          MP3Out1.FileName := sName + '.mp3';
          btnRecord.Caption := 'Record Stop';
          mbtnRecord.Caption := 'Record Stop';
          if not cbOut.Checked then
          begin
            WMATap1.Id3v2Tags.Title := WMStreamedIn1.Id3v2Tags.Title;
            WMATap1.Id3v2Tags.Artist := WMStreamedIn1.Id3v2Tags.Artist;
            WMATap1.Id3v2Tags.Genre := WMStreamedIn1.Id3v2Tags.Genre;
            WMATap1.Id3v2Tags.Year := WMStreamedIn1.Id3v2Tags.Year;
            WMATap1.Id3v2Tags.Album := WMStreamedIn1.Id3v2Tags.Album;
            WMATap1.Id3v2Tags.Track := WMStreamedIn1.Id3v2Tags.Track;
            WMATap1.Id3v2Tags.Comment := WMStreamedIn1.Id3v2Tags.Comment;
            WMATap1.Id3v2Tags.Composer := WMStreamedIn1.Id3v2Tags.Composer;
            WMATap1.Id3v2Tags.Encoder := WMStreamedIn1.Id3v2Tags.Encoder;
            WMATap1.Id3v2Tags.Copyright := WMStreamedIn1.Id3v2Tags.Copyright;
            WMATap1.Id3v2Tags.Language := WMStreamedIn1.Id3v2Tags.Language;
            WMATap1.DesiredBitrate := 128;
            WMATap1.StartRecord;
          end
          else
          begin
            MP3Out1.Id3v2Tags.Title := WMStreamedIn1.Id3v2Tags.Title;
            MP3Out1.Id3v2Tags.Artist := WMStreamedIn1.Id3v2Tags.Artist;
            MP3Out1.Id3v2Tags.Genre := WMStreamedIn1.Id3v2Tags.Genre;
            MP3Out1.Id3v2Tags.Year := WMStreamedIn1.Id3v2Tags.Year;
            MP3Out1.Id3v2Tags.Album := WMStreamedIn1.Id3v2Tags.Album;
            MP3Out1.Id3v2Tags.Track := WMStreamedIn1.Id3v2Tags.Track;
            MP3Out1.Id3v2Tags.Comment := WMStreamedIn1.Id3v2Tags.Comment;
            MP3Out1.Id3v2Tags.Composer := WMStreamedIn1.Id3v2Tags.Composer;
            MP3Out1.Id3v2Tags.Encoder := WMStreamedIn1.Id3v2Tags.Encoder;
            MP3Out1.Id3v2Tags.Copyright := WMStreamedIn1.Id3v2Tags.Copyright;
            MP3Out1.Id3v2Tags.Language := WMStreamedIn1.Id3v2Tags.Language;
            MP3Out1.AverageBitrate := mbr128;
            MP3Out1.Run;
          end;
          StatusBar1.Panels[1].Text := ('Recording');
          Timer1.Enabled := True;
          StartTime := Time;
          StatusBar1.Panels[2].Text := '';
          btnRecord.Tag := 1;
        end;
      end;
    1:
      begin
        if not cbOut.Checked then
        begin
          WMATap1.StopRecord;
          ShowMessage('Saved to - ' + WMATap1.FileName);
        end
        else
        begin
          MP3Out1.Stop(False);
          ShowMessage('Saved to - ' + MP3Out1.FileName);
        end;
        btnRecord.Caption := 'Record';
        mbtnRecord.Caption := 'Record';
        Timer1.Enabled := False;
        if (WMATap1.Status = tosIdle) and (MP3Out1.Status = tosIdle) then
        begin
          BitRate := InttoStr(WMStreamedIn1.BitRate div 1000) + ' kbps';
          SampleRate := InttoStr(WMStreamedIn1.SampleRate) + ' Hz';
          StatusBar1.Panels[1].Text := SampleRate + ' @ ' + BitRate;
          if WMStreamedIn1.Channels = 1 then
            StatusBar1.Panels[2].Text := 'Mono'
          else
            StatusBar1.Panels[2].Text := 'Stereo';
        end;
        btnRecord.Tag := 0;
      end;
  End;
end;
hat jemand ne Idee


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:18 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz