i have a wave editor but i cant do a cut and paste...could someone help me....
Printable View
i have a wave editor but i cant do a cut and paste...could someone help me....
All you have on this form is a dialog box and some menus.
VB Code:
'WavEditor 'by: Paul Bryan in 2002 'Allows for graphical isolation of sample ranges 'will Paste Selected Data Into New Files ' I hope this helps, feel free to re-use this code. Private Sub mnuAbout_Click() frmAbout.Show , Me End Sub Private Sub mnuOpenItem_Click() CommonDialog1.Filter = "Wave Files (*.wav)|*.wav" CommonDialog1.CancelError = True On Error GoTo Errhandler CommonDialog1.ShowOpen If CommonDialog1.FileName <> "" Then MousePointer = 11 'hourglass LoadNewFile (CommonDialog1.FileName) MousePointer = 0 Exit Sub End If Errhandler: Exit Sub End Sub Private Sub mnuExitItem_Click() End End Sub
What is anyone supposed to do with this?! What do you mean you want to cut & paste? Can we get some elaboration?
im sorry this is the complete file. my prob is this...i want the user to select a certain part and then cut and paste it into the same file. just like the nero wave editor...please help...thanks shawn
Use a temporary file...
Get the selection (in samples) not in bytes, and calculate the starting position in the file, and the end position. Using a temporary file copy the data into it.
Then you have to make another temporary file but this time a real wav file, copy the data in front of where you wanna paste, then copy the data from the first temporary file, then copy the data after the pasted data... then you can delete the first temp file and the original file (or you can keep it as an undo).
Also, as a sugestion, take a look at this thread I posted in the CodeBank:
VB - DirectXSound - An app that plays large WAV files
I see you want to add effects to the file, using DirectXSound, you can, and also you can play the file appliying the cut and paste information without actually doing it, you just read from the file randomly. You can do it as a preview before you actually make changes to the file.
For example, lets say you want to delete a part of the file, you can store the positions somwhere from where to where you don't want to play (the deleted part). When you play the file, when you get to the starting position, just jump in the file to the end of the deleted part, to the user it sounds as if that part was actually deleted.
There are a lot of things you can do dinamically, by playing the file the way I did in that thread, you can amplify the waveform data, add echo, all in the temporary buffer, just before you play it without actually changing the original file.
i have here a code to paste a selection intoa new file my problem is how will i paste it to the same file..could you help me in my codes?
Private Sub Command5_Click() ' Paste as New File
Dim FTemp As String
Dim InData As Long, LenData As Long
Dim InDataSel As Long, LenDataSel As Long
Dim SampIni As Long, BytInic As Long
Dim Nbits As Integer, StMo As String
Dim ydiv As Integer, SampFreq As Long
If MMCPart = False Or Label8.Caption = "" Then
Picture2.SetFocus
Exit Sub
End If
If Label16(4).Caption = "" Then
msg = "No Selection Made!"
MsgBox msg, vbOKOnly
Exit Sub
End If
MousePointer = vbHourglass ' Busy
Picture2.SetFocus
FTemp = App.Path & "\Untitled" & SCount + 1 & ".wav"
InData = Label11.Caption
SampIni = Label16(4).Caption ' Selection Begins
ydiv = Label12.Caption ' FileSize in Bytes
BytInic = SampIni * ydiv ' Location in the Wav of the Visible Selection
InDataSel = InData + BytInic
LenDataSel = Label16(6).Caption 'Selection Length in Samples
SampFreq = Label8.Caption ' Sampling Frequency
StMo = Label9.Caption ' Stereo Mono
Nbits = Val(Label10.Caption) ' Sampling Bits
Open CurFile For Binary Access Read As #1
Call SaveWave(FTemp, InDataSel, LenDataSel, SampFreq, Nbits, StMo)
Close #1
LoadNewFile (FTemp)
MousePointer = 0 ' Arrow
End Sub
thanks....
Use [ vbcode ] [ /vbcode ] (without spaces) to format the code properly, now you have it all aligned to left...
About pasting into the same file... did you read my previous post ?