Autor Beitrag
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mi 20.04.05 10:15 
hallo! ich habe mal ein kleines Tool geschrieben, um waves aufzunehmen, und zum abspielen, jedoch komme ich net wirklich weiter, bisherige funktionen:



    X Aufnahme einer Wave Datei mit verschiedenen Einstellungen
    (siehe optionen (screenshot)

    X Anzeige der bisherigen Aufnahme
    (Progressbar/Label)

    X Max Aufnahmezeit von 1min
    (kann etwas ungenau sein (timer))

    X Speichern der Wave
    (opendialog)

    X Wiedergabe einer Wave
    (Mediaplayer)


ich würde aber gerne noch folgende funktionen einbauen, weiß aber net wie:


    O Bei der Aufnahme den Pitch einstellen

    O Bei der Wiedergabe soll der blaue balken der Trackbar die aktuelle Position anzeigen und wenn der pfeil erreicht ist soll die wiedergabe stoppen, wenn der pfeil ganz link ist, soll alles gespielt werden, wenn er rechts ist auch

    O einstellung von balance und volume

    O anzeige der aktuellen position in einem Label (00:00:00)


Bisheriger Code:

UMain
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:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
unit UMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, xstyleform, ComCtrls, StdCtrls, ExtCtrls, Menus, MPlayer, mmsystem;

type
  TForm1 = class(TXStyleForm)
    XStyleControl1: TXStyleControl;
    ProgressBar1: TProgressBar;
    Shape1: TShape;
    ButtonStop: TButton;
    GroupBox1: TGroupBox;
    ButtonStart: TButton;
    MainMenu1: TMainMenu;
    GroupBox2: TGroupBox;
    MediaPlayer1: TMediaPlayer;
    Aufnahme1: TMenuItem;
    Neu1: TMenuItem;
    Wiedergabe1: TMenuItem;
    ffnen1: TMenuItem;
    About1: TMenuItem;
    Timer1: TTimer;
    Optionen1: TMenuItem;
    SaveDialog1: TSaveDialog;
    Label1: TLabel;
    OpenDialog1: TOpenDialog;
    TrackBar1: TTrackBar;
    Label2: TLabel;
    Timer2: TTimer;
    ScrollBar1: TScrollBar;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    ScrollBar2: TScrollBar;
    Label6: TLabel;
    ScrollBar3: TScrollBar;
    Label7: TLabel;
    Label8: TLabel;
    procedure Neu1Click(Sender: TObject);
    procedure ButtonStartClick(Sender: TObject);
    procedure About1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure ButtonStopClick(Sender: TObject);
    procedure Optionen1Click(Sender: TObject);
    procedure ffnen1Click(Sender: TObject);
    procedure MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
      var DoDefault: Boolean);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  s: boolean = true;
  t: integer = 0;

implementation

uses AboutBox, optionwindow;

{$R *.dfm}
{$R VoiceSave_manifest.res}

procedure TForm1.Neu1Click(Sender: TObject);
begin
  buttonstart.enabled:= true;
  Shape1.Brush.Color:= clgreen;
end;

procedure TForm1.ButtonStartClick(Sender: TObject);
begin
  buttonstop.Enabled:= true;
  Shape1.Brush.Color:= clred;
  t:= 0;
  timer1.Enabled:= true;
  mciSendString('OPEN NEW TYPE WAVEAUDIO ALIAS newsound', nil, 0, Handle);
  mciSendString(pchar('SET newsound TIME FORMAT MS ' + 'BITSPERSAMPLE ' + Bitrate + ' ' + 'CHANNELS ' + Channels + ' ' + 'SAMPLESPERSEC ' + SampleRate + ' ' + 'BYTESPERSEC' + BPS), nil, 0, Handle);
  mciSendString('RECORD newsound', nil, 0, Handle)
end;

procedure TForm1.About1Click(Sender: TObject);
begin
  form2.showmodal;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  s:= not s;
  inc(t);
  label1.Caption:= 'Zeit: ' + inttostr(t) + ' Sekunden';
  if (s) then
    Shape1.Brush.Color:= clred else
      Shape1.Brush.Color:= clmaroon;
  progressbar1.Position:= progressbar1.Position + 1;
  if progressbar1.Position = progressbar1.Max then
    ButtonStopClick(Self);
end;

procedure TForm1.ButtonStopClick(Sender: TObject);
begin
  t:= 0;
  timer1.Enabled:= false;
  label1.caption:= 'Zeit: 0 Sekunden';
  Shape1.Brush.Color:= clsilver;
  progressbar1.position:= 0;
  mciSendString('STOP newsound', nil, 0, Handle);
  if MessageBox(Handle, 'Möchten Sie die Aufnahme speichern?', 'Aufnahme', MB_YESNO) = IDYES then
    if SaveDialog1.execute then
      mciSendString(PChar('SAVE newsound ' + savedialog1.filename), nil, 0, Handle);
  mciSendString('CLOSE newsound', nil, 0, Handle);
  ButtonStart.enabled:= false;
  ButtonStop.enabled:= false;
end;

procedure TForm1.Optionen1Click(Sender: TObject);
begin
  Form3.showmodal;
end;

procedure TForm1.ffnen1Click(Sender: TObject);
begin
  if opendialog1.Execute then
    begin
      mediaplayer1.filename:= opendialog1.FileName;
      mediaplayer1.Open;
    end;  
end;

procedure TForm1.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
  var DoDefault: Boolean);
begin
  if Button = btplay then
    timer2.enabled:= true;
  if Button = btStop then
    timer2.enabled:= false;
end;

end.


Optionwindow
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:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
unit optionwindow;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm3 = class(TForm)
    ComboBox1: TComboBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    procedure ComboBox1Change(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form3: TForm3;
  BitRate: string = '8';
  Channels: string = '1';
  SampleRate: string = '8000';
  BPS: string = '8000';

implementation

{$R *.dfm}

procedure TForm3.ComboBox1Change(Sender: TObject);
begin
  if combobox1.itemindex = 0 then BitRate:= '8';
  if combobox1.itemindex = 1 then BitRate:= '16';
  if combobox1.itemindex = 2 then BitRate:= '24';
  if combobox1.itemindex = 3 then BitRate:= '32';
end;

procedure TForm3.ComboBox2Change(Sender: TObject);
begin
  if combobox2.itemindex = 0 then BitRate:= '8000';
  if combobox2.itemindex = 1 then BitRate:= '16000';
  if combobox2.itemindex = 2 then BitRate:= '24000';
  if combobox2.itemindex = 3 then BitRate:= '32000';
end;

procedure TForm3.ComboBox3Change(Sender: TObject);
begin
  if combobox3.itemindex = 0 then BitRate:= '2000';
  if combobox3.itemindex = 1 then BitRate:= '4000';
  if combobox3.itemindex = 2 then BitRate:= '8000';
  if combobox3.itemindex = 3 then BitRate:= '16000';
end;

procedure TForm3.RadioButton1Click(Sender: TObject);
begin
  if radiobutton1.checked = true then Channels:= '1';
end;

procedure TForm3.RadioButton2Click(Sender: TObject);
begin
  if radiobutton2.checked = true then Channels:= '2';
end;

end.


Für Hilfe wäre ich sehr dankbar und würde denjenigen auch in der About Box erwähnen.
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mi 20.04.05 10:39 
Hi FearOfTheDark,

bitte erstell zu jeder Deiner Fragen ein separates Topic, da die Diskussion von mehreren Fragen in einem Topic gewöhnlich für ein gewisses Durcheinander sorgt.

Daher geschlossen.

Gruß,
raziel

_________________
JSXGraph
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.