Hi ThaKilla23,
Also erstmal deine Code in Form_load ist der selbe wie in Command1_Click. Das ist überflüssig.
Ich hab es mir erlaub mal deinen Code ein bisschen übersichtlcher zu gestallten.
Wenn du jetzt eine neue Aufnahme machen möchtest musst du nur Command1_Cllick aufruffen und einen Anderen DateiNamen verwenden.
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" ( _
ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal _
uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Declare Function PlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal _
lpszSoundName As String, ByVal uFlags As Long) As Long
Const path$ = "C:\Test.wav"
Dim RS$, CB&
Private Sub Form_Load()
Command1_Click
End Sub
Private Sub Command1_Click()
Dim bits As Long
Dim samples As Long
Dim c As Byte
Dim bytes As Long
If Dir$(path, vbNormal) <> "" Then Kill path
RS = Space$(128)
bits = 16
samples = 44100
c = 2
bytes = (bits * samples * c) / 8
Me.Left = (Screen.Width - Me.Width) / 8
Me.Top = (Screen.Height - Me.Height) / 1
mciSendString "open new type waveaudio alias capture", RS, 128, CB
mciSendString "SET CAPTURE TIME FORMAT MILLISECONDS BITSPERSAMPLE " & bits & "" & _
"SAMPLESPERSEC " & samples & " CHANNELS " & c & " BYTESPERSEC " & bytes & "" & _
"ALIGNMENT 4", RS, 128, CB
mciSendString "record capture", RS, 128, CB
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
End Sub
Private Sub Command2_Click()
If Command2.Caption = "Aufnahme Pause" Then
Call mciSendString("pause capture", RS, 128, CB)
Command2.Caption = "Aufnahme Weiter"
Command1.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Else
Call mciSendString("record capture", RS, 128, CB)
Command2.Caption = "Aufnahme Pause"
Command1.Enabled = False
Command3.Enabled = True
Command4.Enabled = False
End If
End Sub
Private Sub Command3_Click()
RS = Space$(128)
Call mciSendString("stop capture", RS, 128, CB)
Call mciSendString("save capture " & path, RS, 128, CB)
Call mciSendString("close capture", RS, 128, CB)
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = True
End Sub
Private Sub Command4_Click()
Dim Winamp As Long
Winamp = Shell("C:\Programme\Winamp\Winamp.exe c:\test.wav")
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub Soweit dein Code. Jetzt hab ich dir noch ein kleines Sample das dir den nächsten freien Dateinamen zurückliefert.
Public Function DateiNamenermitteln(Pfad as String) as string
Dim i As Long
If right(pfad,1)<>"\" then pfad=pfad+"\"
Do
i = i + 1
DateiNamenermitteln = "Aufnahme" + Format(i, "00") '+ ".wav"
If Dir(pfad+Dateinamenermitteln) = "" Then Exit Do
Loop
End Sub Sorry das ich?s nicht verlinken oder hervorheben kann, aber ich benutz Opera und da funktionieren diese Funktionen anscheinend nicht.
--------------------------------------------------------
Ich hoffe, ich konnte helfen/ihr k?nnt mir helfen.
Simon |