Einzelnen Beitrag anzeigen

AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#34

Re: Fehler: Undefinierter Bezeichner! Wo liegt das Problem?

  Alt 1. Jun 2009, 13:20
Hab die Aufnahme soweit fertig, es wird aber nicht auf nen Knopfdruck aufgenommen, sondern sofort wenn ein Sender abgespielt wird. Hat jemand eine Idee wie ich die Aufnahme mit einem Knopfdruck starte und stoppe?

Delphi-Quellcode:
  private
    { Private declarations }
    procedure StopRec;


procedure TForm1.StopRec;
var
  Root, CCRDir, ChannelDir, FileName : String;
begin
  Root:=GetSpecialFolderForMP3(Handle, CSIDL_PERSONAL);
  CCRDir:='CCRadio Recordings';
  ChannelDir:=Label4.Caption;
  //FileName:='my.mp3';
  FileName:=FormatDateTime('dd.mm.yy', date) + ' - ' + FormatDateTime('hh.nn.ss', time) + '.mp3';

  ChannelDir:=StringReplace(ChannelDir, '\', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '/', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, ':', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '*', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '?', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '"', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '<', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '>', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '|', ' ', [rfReplaceAll]);
  ChannelDir:=StringReplace(ChannelDir, '.', '', [rfReplaceAll]);

  if DirectoryExists(Root + '\' + CCRDir) then
  begin
       if DirectoryExists(Root + '\' + CCRDir + '\' + ChannelDir) then
       begin
       //showmessage(Root + '\' + CCRDir + '\' + ChannelDir);
       Filestream:=TFileStream.Create(Root + '\' + CCRDir + '\' + ChannelDir + '\' + FileName, fmCreate);
       end else if (not CreateDir(Root + '\' + CCRDir + '\' + ChannelDir)) then
                begin
                SaveDialog1.FileName:=FileName;
                if SaveDialog1.Execute then //WaveStream.SaveToFile(SaveDialog1.FileName);
                end else
                    begin
                    CreateDir(Root + '\' + CCRDir + '\' + ChannelDir);
                    Filestream:=TFileStream.Create(Root + '\' + CCRDir + '\' + ChannelDir + '\' + FileName, fmCreate);
                    end;
  end else if (not CreateDir(Root + '\' + CCRDir)) then
           begin
           SaveDialog1.FileName:=FileName;
           if SaveDialog1.Execute then //WaveStream.SaveToFile(SaveDialog1.FileName);
           end else
               begin
               CreateDir(Root + '\' + CCRDir);
                   if DirectoryExists(Root + '\' + CCRDir + '\' + ChannelDir) then
                   begin
                   Filestream:=TFileStream.Create(Root + '\' + CCRDir + '\' + ChannelDir + '\' + FileName, fmCreate);
                   end else if (not CreateDir(Root + '\' + CCRDir + '\' + ChannelDir)) then
                            begin
                            SaveDialog1.FileName:=FileName;
                            if SaveDialog1.Execute then //WaveStream.SaveToFile(SaveDialog1.FileName);
                            end else
                                begin
                                CreateDir(Root + '\' + CCRDir + '\' + ChannelDir);
                                Filestream:=TFileStream.Create(Root + '\' + CCRDir + '\' + ChannelDir + '\' + FileName, fmCreate);
                                end;
               end;
  //RecordStatus:=False;
end;


procedure StatusProc(buffer: Pointer; len, user: DWORD); stdcall;
begin
  if (buffer <> nil) and (len = 0) then
    SendMessage(win, WM_INFO_UPDATE, 8, DWORD(PChar(buffer)));


  if (FileStream = nil) then
      Form1.StopRec;
  if (buffer = nil) then
      FileStream.Free // finished downloading
   else
      FileStream.Write(buffer^, len);
end;
  Mit Zitat antworten Zitat