📄 biquadconfig.frm
字号:
Form2.Parity.Text = "Odd"
Case "s"
Form2.Parity.Text = "Space"
End Select
Select Case form3.MSComm1.Handshaking
Case 0
Form2.Flowcontrol.Text = "0 - comNone"
Case 1
Form2.Flowcontrol.Text = "1 - comXonXoff"
Case 2
Form2.Flowcontrol.Text = "2 - comRTS"
Case 3
Form2.Flowcontrol.Text = "3 - comRTSXonXoff"
End Select
Form2.Visible = True
End Sub
Private Sub readflash_Click()
On Error GoTo 1
Dim bytrec() As Byte
Dim i As Long
MousePointer = vbHourglass
Form_Load1
For i = 0 To flashsize
workingbuf(i) = 0
Next i
MSComm1.InBufferCount = 0 'clear buffer
For i = 0 To 7
bb(0) = &H9D 'write to flash
MSComm1.Output = bb
Next i
wbptr = 0 'receive pointer
readfromflashbtn = True
Timer1.Interval = 1500
Timer1.Enabled = True
writetoflash.Enabled = False
readflash.Enabled = False
FlashCopy.Enabled = False
Exit Sub
1 MsgBox ("The serial port is already in use, Please set to the other port")
End Sub
Private Sub RoomCDT1_Click()
roomcdt.Show
End Sub
Private Sub Saveas_Click()
On Error Resume Next
Dim i As Integer
Dim j As Integer
Dim data As Integer
Dim s As String
pointer = 1
With dlgopen: .FileName = ""
.DialogTitle = "Select a file to save"
.CancelError = False
.Filter = "biquad(*.flash)|*.flash"
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
s = .FileName
End With
Open s For Binary As #1
For i = 1 To 7
'If ((i Mod 7) <> 0) Then
For j = 1 To 5 'EQ
If j = 1 Then
Filt_type = eqconfig.TextMatrix(i, j)
returnfiltertype (Filt_type)
data = A(0)
Else
data = eqconfig.TextMatrix(i, j)
End If
Put #1, pointer, data
pointer = pointer + 2
Next
'End If
Next
intworkingbuf(ucMaxVulumeAndStep) = maxvolume.Text
intworkingbuf(inputgain_pointer) = inputgain.Text
intworkingbuf(ucMaxVulumeAndStep + 1) = volumestep.Text
intworkingbuf(system_mode) = Sys_User.Value
intworkingbuf(autothreshold_pointer) = autothreshold.Text
For j = compression_pointer To compression_pointer + 12 + 3
Put #1, pointer, intworkingbuf(j)
pointer = pointer + 2
Next j
Close #1
End Sub
Private Sub step_Click()
On Error Resume Next
volume.TextMatrix(volume.RowSel, volume.ColSel) = step.Text
step.Visible = False
End Sub
Private Sub suport_Click()
Image1_Click
End Sub
Private Sub SystemSelection_Click(Index As Integer)
compressionform.AutoRedraw = True
End Sub
Private Sub tempedit1_Change()
On Error Resume Next
filertype.Visible = False
eqconfig.TextMatrix(eqconfig.RowSel, eqconfig.ColSel) = tempedit1.Text
End Sub
Private Sub tempedit1_DblClick()
On Error Resume Next
tempedit1.Visible = False
End Sub
Private Sub tempedit2_Change()
On Error Resume Next
feedforward.TextMatrix(feedforward.RowSel, feedforward.ColSel) = tempedit2.Text
End Sub
Private Sub tempedit2_DblClick()
On Error Resume Next
tempedit1.Visible = False
End Sub
Private Sub tempedit3_Change()
On Error Resume Next
centrefrequency.TextMatrix(centrefrequency.RowSel, centrefrequency.ColSel) = tempedit3.Text
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Timer1.Enabled = False
writetoflash.Enabled = True
readflash.Enabled = True
FlashCopy.Enabled = True
If MSComm1.InBufferCount > 400 Then
MsgBox ("Transmit finished")
Else
MsgBox ("Transmit failed! Turn the power off. Try again!")
End If
MousePointer = 1
Form_Unload1 (0)
If readfromflashbtn = True Then
loadfromworkfile
readfromflashbtn = False
End If
If readsamplewavebtn = True Then
sameplewaveform.Show
End If
End Sub
Private Sub Form_Unload1(Cancel As Integer)
On Error Resume Next
If (MSComm1.PortOpen) Then
MSComm1.PortOpen = False
End If
End Sub
Private Sub volume_Click()
On Error Resume Next
If volume.ColSel <> 2 Then
volumeSlider.Top = Frame4.Top + volume.CellTop + volume.Top + volume.CellHeight
volumeSlider.Left = Frame4.Left + volume.CellLeft + 100
If volume.Text = "" Then volume.Text = "0"
volumeSlider.Value = Int(volume.Text)
volumeSlider.Visible = True
Else
step.Top = volume.CellTop + Frame4.Top + volume.CellHeight
step.Left = volume.CellLeft + Frame4.Left
step.Text = volume.TextMatrix(volume.RowSel, volume.ColSel)
step.Visible = True
End If
End Sub
Private Sub volume_LostFocus()
On Error Resume Next
'volumeSlider.Visible = False
step.Visible = False
End Sub
Private Sub volumeSlider_Change()
On Error Resume Next
volume.TextMatrix(volume.RowSel, volume.ColSel) = volumeSlider.Value
volumeSlider.Visible = False
End Sub
Private Sub volumeSlider_Scroll()
On Error Resume Next
volume.TextMatrix(volume.RowSel, volume.ColSel) = volumeSlider.Value
End Sub
Private Sub writetoflash_Click()
'On Error GoTo 1
Dim bytrec() As Byte
Dim i As Long
Dim j As Integer
MousePointer = vbHourglass
Form_Load1 'open com port
For i = 0 To 5
bb(0) = &H62 'write to flash
MSComm1.Output = bb
Next i
bb(0) = flashsize And &HFF 'send data size
MSComm1.Output = bb
bb(0) = ((flashsize And &HFF00) / 256)
MSComm1.Output = bb
'Command1_Click 'write data to file
'Loadworkingbuf 'read data from file
LoadworkingbufForVersion3
'For i = 0 To 80950
'Next i
Timer1.Interval = 7000
Timer1.Enabled = True
writetoflash.Enabled = False
readflash.Enabled = False
FlashCopy.Enabled = False
Dim MySecond, MySecond1
MySecond = Second(Time)
t:
MySecond1 = Second(Time)
If Abs(MySecond1 - MySecond) < 4 Then GoTo t
checksum = 0
For i = 0 To flashsize 'Len(configurationData1) '4095
bb(0) = workingbuf(i) '(i) And &HFF
MSComm1.Output = bb
checksum = (checksum + bb(0))
For k = 0 To 1400
Next
Next i
Exit Sub
1 MsgBox ("The serial port is already in use, Please set to the other port")
End Sub
Private Sub LoadworkingbufForVersion3()
On Error Resume Next
Dim BQtype As Byte
Dim fc As Double
Dim fh As Double
Dim fs As Double
Dim width As Double
Dim gain As Double
Dim p(0 To 14) As Byte
'For i = 1 To 2
'fc = 30
For i = 1 To 7 '21 BIQUAD '+ 1 LOUDNESS
Filt_type = eqconfig.TextMatrix(i, 1)
returnfiltertype (Filt_type)
BQtype = A(0)
fc = eqconfig.TextMatrix(i, 2)
fh = eqconfig.TextMatrix(i, 3)
fs = 48000
width = eqconfig.TextMatrix(i, 4)
gain = eqconfig.TextMatrix(i, 5)
'width = fc / 6: gain = -6 + (i - 1): BQtype = 2: fh = 1
B = CalcFilterCoeffsT(BQtype, fc, fh, fs, width, gain, p(0))
If (BQtype = 20) Then
p(0) = 16
For l = 1 To 14: p(l) = 0: Next
End If
For k = 0 To 14
workingbuf(((i - 1) * 15) + k) = p(k)
' eqconfig.TextMatrix(1, 2) = p(k)
'Debug.Print (((i - 1) * 15) + k), Hex(workingbuf(((i - 1) * 15) + k))
Next k
' For l = 0 To 14: Debug.Print " 0x"; Hex(p(l)); Chr$(44);: Next
' Debug.Print 'gain, " "
'
' If gain = 6 Then
' Stop
' fc = fc + 10
' Exit Sub
' End If
Next i
'21*15=315
i = biquadnumber * 15 'COMPRESSION
workingbuf(i) = compressionform_2ohm.rationa.ListIndex * 8
If compressionform_2ohm.rationa.ListIndex = 0 Then workingbuf(i) = 2
workingbuf(i + 1) = compressionform_2ohm.rationb.ListIndex * 8 + 2
If compressionform_2ohm.rationa.ListIndex = 0 Then workingbuf(i + 1) = 2
workingbuf(i + 2) = compressionform_2ohm.Slider1.Value / 3.7657
workingbuf(i + 3) = compressionform_2ohm.CompressionC1.ListIndex * 16 + 64
workingbuf(i + 4) = compressionform_2ohm.CompressionC2.ListIndex * 16 + 64
workingbuf(i + 5) = compressionform_2ohm.CompressionC3.ListIndex * 16 + 64
workingbuf(i + 6) = compressionform_2ohm.Compression_Active.Value
' workingbuf(i) = compressionform.rationa.ListIndex * 8
' If compressionform.rationa.ListIndex = 0 Then workingbuf(i) = 2
' workingbuf(i + 1) = compressionform.rationb.ListIndex * 8 + 2
' If compressionform.rationa.ListIndex = 0 Then workingbuf(i + 1) = 2
'
' workingbuf(i + 2) = compressionform.Slider1.Value / 3.7657
' workingbuf(i + 3) = compressionform.CompressionC1.ListIndex * 16 + 64
' workingbuf(i + 4) = compressionform.CompressionC2.ListIndex * 16 + 64
' workingbuf(i + 5) = compressionform.CompressionC3.ListIndex * 16 + 64
'
'-----------------max volume
'-----------------input gain
temp = maxvolume.Text + 70
If temp < 0 Then temp = 0
If temp > 88 Then temp = 88
workingbuf(i + 7) = temp 'maxvolume
workingbuf(i + 8) = volumestep.Text 'step
temp = -inputgain.Text
If temp < 0 Then temp = 0
If temp > 15 Then temp = 15
workingbuf(i + 9) = temp 'inputgain
workingbuf(i + 10) = Sys_User.Value
temp = autothreshold.Text
workingbuf(i + 11) = temp * 2.44141 '2500mv/1024
End Sub
Private Sub Loadworkingbuf()
On Error Resume Next
Open App.Path + "\parameter.flash" For Binary As #1
Dim j As Integer
Dim temp As String
temp = ""
Dim int1 As Integer
' For j = 0 To flashsize * 2 + 1 '4096
'
' Get #1, j + 1, int1 'workingbuf(j)
' Debug.Print int1; ",";
' j = j + 1
' If ((j + 1) Mod 10) = 0 Then Debug.Print
' temp = temp + Hex(workingbuf(j)) + " "
' If ((j + 1) And 7) = 0 Then
' List1.AddItem temp
'
' temp = Hex(j + 1) + "----"
' End If
' Next j
For j = 0 To flashsize '4096
Get #1, j + 1, workingbuf(j)
' Debug.Print j, workingbuf(j)
Next j
Close #1
End Sub
Private Sub Form_Load1()
On Error GoTo 1
' If (MSComm1.PortOpen) Then
' MSComm1.PortOpen = False
' End If
' volume.TextMatrix(1, 0) = MSComm1.CommPort
' volume.TextMatrix(1, 1) = Form2.COMt.Text
Form2.Command2_Click
' MSComm1.CommPort = Mid$(Form2.COMt.Text, 1, 1)
' MSComm1.Handshaking = Mid$(Form2.Flowcontrol.Text, 1, 1)
' MSComm1.Settings = Form2.baud.Text + "," + Mid$(Form2.Parity.Text, 1, 1) + "," + Form2.DataBit.Text + "," + Form2.StopBit.Text
' MSComm1.PortOpen = True
Form2.Visible = False
wbptr = 0
Dim i As Double
For i = 1 To 39990000
wbptr = 0 'delay
Next i
Exit Sub
1 MsgBox ("The serial port is already in use, Please set to the other port")
End Sub
Private Sub loadfromworkfile()
On Error Resume Next
Open App.Path + "\parameter.flash" For Binary As #1
For j = 0 To flashsize '14095 'wbptr
i = i + 1
Put #1, i, workingbuf(j)
Next j
Close #1
Open App.Path + "\parameter.flash" For Binary As #1 ' Open file.
Call loadparameter
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -