Autor Beitrag
JJ
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 100

Windows XP 64 bit!
delphi 5
BeitragVerfasst: Do 30.03.06 20:02 
Also... ich habe ein kleines Tool geschrieben ,was den Waveoutmix aufnimmt und dann per lame.exe direkt in mp3format konvertiert. Daie Aufnahme wird also erst mit den klassischen Befehlen in WAVE aufgenommen, abgespeichert und dann in MP3format konvertiert. das funktioniert auch in dem Ordner wo ihc PRogrammeire ganz gut aber wenn ich das Programm über eine Verknüpfung starte funktioniert irgendwas nicht. Habe das Programm mal so geschrieben ,dass es sich auch nach dem Windowsstart automatisch öffnet. Anscheinend findet es aber dann was bestimmtes nicht. Lame wird zwar kurz gestartet aber sofort wieder geschlossen! Es wird also nichts konvertiert und die Aufnahme funktioniert nicht! Ich shcicke mal den meiner meinung nach für das problem relevanten Programmtext mit...
Der Name unter dem das Mp3 gespeichert werden soll steht in edit1.text...
Es scheint irgendetwas mit dem aktuellen Ordner zutun zu haben ,den man im HIntergrund offen hat. Denn wie gesagt, beim Programmieren klappt es ja...
Ich dachte schon mal daran ,dass LAme vielleihct zu früh versuchen könnte die Wavedatei zu konvertieren. Deswegen habe ich einfach mal ein ShellexecuteandWait eingebaut. Aber das Ergebnis war das Selbe. Bis auf den Verlust ,dass sich Lame.exe mit diesem Befehl hier wohl nicht mehr ganz minimiert starten lässt!
Aber jeh nach länge der Aufnahmen gibt es sicher Probleme wenn Lame versucht zuzugreifen und das Wave noch nicht wollständig abgespeichert ist. Glaube aber ehrlichgesagt nicht ,dass das der Grund ist , da es ja in meinem Delphiordner geht *ggg* :)
Hoffe ihr könnt helfen!
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
unit Unit5;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, mmsystem, shellapi,
  jpeg, ExtCtrls, StdCtrls;

implementation

uses Unit3;

{$R *.DFM}

//Programm wartet bis Lame wieder geschlossen ist.
procedure ShellExecute_AndWait(FileName: string; Params: string);
var
  exInfo: TShellExecuteInfo;
  Ph: DWORD;
begin
  FillChar(exInfo, SizeOf(exInfo), 0);
  with exInfo do
  begin
    cbSize := SizeOf(exInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
    Wnd := GetActiveWindow();
    ExInfo.lpVerb := 'open';
    ExInfo.lpParameters := PChar(Params);
    lpFile := PChar(FileName);
    nShow := SW_SHOWNORMAL;
  end;
  if ShellExecuteEx(@exInfo) then
    Ph := exInfo.HProcess
  else
  begin
    ShowMessage(SysErrorMessage(GetLastError));
    Exit;
  end;
  while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do
    Application.ProcessMessages;
  CloseHandle(Ph);
end;


procedure TForm5.Image5Click(Sender: TObject);
begin
mciSendString('STOP mysound', nil, 0, Handle);
mciSendString(pChar('SAVE mySound "'+extractfilepath(application.exename)+edit1.text+'"'),nil,0,Handle);
mciSendString('CLOSE mysound', nil, 0, Handle);
ShellExecute_AndWait(extractfilepath(application.exename)+'Lame.exe',edit1.text);
deletefile(extractfilepath(application.exename)+edit1.text);
form5.label1.caption:='Aufnahme wurde gespeichert';
form5.label1.left:=(form5.width-form5.label1.width) div 2;
end;

procedure TForm5.Image3Click(Sender: TObject);
begin
mcisendstring('open new type waveaudio alias mysound', nil, 0, handle);
mcisendstring('set mysound time format ms '+'bitspersample 16 '+'Channels 2 '+'samplespersec 44100', nil, 0, handle);
mciSendString('RECORD mySound',nil,0,Handle);
edit1.visible:=true;
form5.label1.caption:='Aufnahme läuft!';

_________________
Hallo!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 31.03.06 18:31 
hört sich so an, als ob das mit dem "Arbeitspfad" oder "Arbeitsverzeichnis" zusammenhängen würde.
Schau dir mal die Eigenschaften der Verknüpfung an, und setzte das Arbietsverzeichnis mal richitg.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
JJ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 100

Windows XP 64 bit!
delphi 5
BeitragVerfasst: Fr 31.03.06 18:40 
Geht das vielleicht auch im Programm?
Ich biete das Ja zum Download mit ner Exe an die mit Innosetup erstellt wurde.
Also würden dann alle verknüpfungen nicht funktionieren. Kann ich irgendwie den Arbeitspfad auf das Verzeichnis setzen?

_________________
Hallo!
JJ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 100

Windows XP 64 bit!
delphi 5
BeitragVerfasst: Sa 01.04.06 20:42 
ok .. hab mich informiert ... mit chdir hats gefunzt :) danke ... plz close

_________________
Hallo!