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 public 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. |