home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4609 / wavplus / mciwav.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-28  |  27.0 KB  |  869 lines

  1. VERSION 2.00
  2. Begin Form MCIwav 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "MCI WAV Player"
  6.    ClientHeight    =   6225
  7.    ClientLeft      =   1200
  8.    ClientTop       =   795
  9.    ClientWidth     =   4470
  10.    ControlBox      =   0   'False
  11.    Height          =   6630
  12.    Left            =   1140
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   6225
  17.    ScaleWidth      =   4470
  18.    Top             =   450
  19.    Width           =   4590
  20.    Begin CommandButton CmdEraseToEnd 
  21.       BackColor       =   &H00C0C0C0&
  22.       Caption         =   "Erase ->"
  23.       Height          =   375
  24.       Left            =   240
  25.       TabIndex        =   9
  26.       Top             =   5640
  27.       Width           =   1335
  28.    End
  29.    Begin CommandButton CmdEraseToStart 
  30.       BackColor       =   &H00C0C0C0&
  31.       Caption         =   "<- Erase"
  32.       Height          =   375
  33.       Left            =   240
  34.       TabIndex        =   8
  35.       Top             =   5280
  36.       Width           =   1335
  37.    End
  38.    Begin CommandButton CmdEraseAll 
  39.       BackColor       =   &H00C0C0C0&
  40.       Caption         =   "Erase All"
  41.       Height          =   375
  42.       Left            =   240
  43.       TabIndex        =   7
  44.       Top             =   4920
  45.       Width           =   1335
  46.    End
  47.    Begin CommandButton CmdUndo 
  48.       BackColor       =   &H00C0C0C0&
  49.       Caption         =   "Undo"
  50.       Height          =   375
  51.       Left            =   2880
  52.       TabIndex        =   13
  53.       Top             =   4920
  54.       Width           =   1335
  55.    End
  56.    Begin CommandButton CmdSave 
  57.       BackColor       =   &H00C0C0C0&
  58.       Caption         =   "Save Wav"
  59.       Height          =   375
  60.       Left            =   2880
  61.       TabIndex        =   15
  62.       Top             =   5640
  63.       Width           =   1335
  64.    End
  65.    Begin CommandButton CmdAddToStart 
  66.       BackColor       =   &H00C0C0C0&
  67.       Caption         =   "Add To Start"
  68.       Height          =   375
  69.       Left            =   1560
  70.       TabIndex        =   11
  71.       Top             =   5280
  72.       Width           =   1335
  73.    End
  74.    Begin CommandButton CmdNewWav 
  75.       BackColor       =   &H00C0C0C0&
  76.       Caption         =   "Begin New"
  77.       Height          =   375
  78.       Left            =   2880
  79.       TabIndex        =   14
  80.       Top             =   5280
  81.       Width           =   1335
  82.    End
  83.    Begin CommandButton CmdAddToEnd 
  84.       BackColor       =   &H00C0C0C0&
  85.       Caption         =   "Add To End"
  86.       Height          =   375
  87.       Left            =   1560
  88.       TabIndex        =   12
  89.       Top             =   5640
  90.       Width           =   1335
  91.    End
  92.    Begin CommandButton CmdInsertAt 
  93.       BackColor       =   &H00C0C0C0&
  94.       Caption         =   "Insert At"
  95.       Height          =   375
  96.       Left            =   1560
  97.       TabIndex        =   10
  98.       Top             =   4920
  99.       Width           =   1335
  100.    End
  101.    Begin Timer Timer1 
  102.       Interval        =   50
  103.       Left            =   120
  104.       Top             =   960
  105.    End
  106.    Begin CommandButton CmdStop 
  107.       BackColor       =   &H00C0C0C0&
  108.       Caption         =   "&Stop"
  109.       Height          =   375
  110.       Left            =   2880
  111.       TabIndex        =   4
  112.       Top             =   3480
  113.       Width           =   1335
  114.    End
  115.    Begin CommandButton CmdToEnd 
  116.       BackColor       =   &H00C0C0C0&
  117.       Caption         =   "To &End"
  118.       Height          =   375
  119.       Left            =   1560
  120.       TabIndex        =   3
  121.       Top             =   3840
  122.       Width           =   1335
  123.    End
  124.    Begin CommandButton CmdToStart 
  125.       BackColor       =   &H00C0C0C0&
  126.       Caption         =   "To S&tart"
  127.       Height          =   375
  128.       Left            =   1560
  129.       TabIndex        =   2
  130.       Top             =   3480
  131.       Width           =   1335
  132.    End
  133.    Begin CommandButton CmdPause 
  134.       BackColor       =   &H00C0C0C0&
  135.       Caption         =   "P&ause"
  136.       Height          =   375
  137.       Left            =   240
  138.       TabIndex        =   1
  139.       Top             =   3840
  140.       Width           =   1335
  141.    End
  142.    Begin CommandButton CmdPlay 
  143.       BackColor       =   &H00C0C0C0&
  144.       Caption         =   "&Play"
  145.       Height          =   375
  146.       Left            =   240
  147.       TabIndex        =   0
  148.       Top             =   3480
  149.       Width           =   1335
  150.    End
  151.    Begin HScrollBar HScroll1 
  152.       Height          =   255
  153.       LargeChange     =   10
  154.       Left            =   240
  155.       TabIndex        =   6
  156.       Top             =   3000
  157.       Width           =   3975
  158.    End
  159.    Begin CommandButton CmdOkay 
  160.       BackColor       =   &H00C0C0C0&
  161.       Cancel          =   -1  'True
  162.       Caption         =   "O &K A Y"
  163.       Height          =   375
  164.       Left            =   2880
  165.       TabIndex        =   5
  166.       Top             =   3840
  167.       Width           =   1335
  168.    End
  169.    Begin Label Label4 
  170.       Alignment       =   2  'Center
  171.       BackColor       =   &H00C0C0C0&
  172.       Caption         =   "WAV Record Options:"
  173.       Height          =   200
  174.       Left            =   240
  175.       TabIndex        =   33
  176.       Top             =   4560
  177.       Width           =   3975
  178.    End
  179.    Begin Line Line1 
  180.       BorderWidth     =   2
  181.       X1              =   240
  182.       X2              =   4200
  183.       Y1              =   4440
  184.       Y2              =   4440
  185.    End
  186.    Begin Label Label7 
  187.       BackColor       =   &H00C0C0C0&
  188.       Caption         =   "Label7"
  189.       Height          =   195
  190.       Index           =   6
  191.       Left            =   2400
  192.       TabIndex        =   32
  193.       Top             =   1680
  194.       Width           =   1815
  195.    End
  196.    Begin Label Label6 
  197.       Alignment       =   1  'Right Justify
  198.       BackColor       =   &H00C0C0C0&
  199.       Caption         =   "WAV Length (bytes):"
  200.       Height          =   195
  201.       Index           =   6
  202.       Left            =   240
  203.       TabIndex        =   31
  204.       Top             =   1680
  205.       Width           =   1935
  206.    End
  207.    Begin Label Label7 
  208.       BackColor       =   &H00C0C0C0&
  209.       Caption         =   "Label7"
  210.       ForeColor       =   &H00000080&
  211.       Height          =   195
  212.       Index           =   5
  213.       Left            =   2400
  214.       TabIndex        =   30
  215.       Top             =   2520
  216.       Width           =   1815
  217.    End
  218.    Begin Label Label6 
  219.       Alignment       =   1  'Right Justify
  220.       BackColor       =   &H00C0C0C0&
  221.       Caption         =   "Percent Played:"
  222.       ForeColor       =   &H00000080&
  223.       Height          =   195
  224.       Index           =   5
  225.       Left            =   240
  226.       TabIndex        =   29
  227.       Top             =   2520
  228.       Width           =   1935
  229.    End
  230.    Begin Label Label7 
  231.       BackColor       =   &H00C0C0C0&
  232.       Caption         =   "Label7"
  233.       ForeColor       =   &H00000080&
  234.       Height          =   195
  235.       Index           =   4
  236.       Left            =   2400
  237.       TabIndex        =   19
  238.       Top             =   2280
  239.       Width           =   1815
  240.    End
  241.    Begin Label Label7 
  242.       BackColor       =   &H00C0C0C0&
  243.       Caption         =   "Label7"
  244.       Height          =   195
  245.       Index           =   3
  246.       Left            =   2400
  247.       TabIndex        =   20
  248.       Top             =   1920
  249.       Width           =   1815
  250.    End
  251.    Begin Label Label7 
  252.       BackColor       =   &H00C0C0C0&
  253.       BackStyle       =   0  'Transparent
  254.       Caption         =   "Label7"
  255.       Height          =   195
  256.       Index           =   2
  257.       Left            =   2400
  258.       TabIndex        =   28
  259.       Top             =   1440
  260.       Width           =   1815
  261.    End
  262.    Begin Label Label7 
  263.       BackColor       =   &H00C0C0C0&
  264.       BackStyle       =   0  'Transparent
  265.       Caption         =   "Label7"
  266.       Height          =   195
  267.       Index           =   1
  268.       Left            =   2400
  269.       TabIndex        =   27
  270.       Top             =   1200
  271.       Width           =   1815
  272.    End
  273.    Begin Label Label7 
  274.       BackColor       =   &H00C0C0C0&
  275.       BackStyle       =   0  'Transparent
  276.       Caption         =   "Label7"
  277.       Height          =   195
  278.       Index           =   0
  279.       Left            =   2400
  280.       TabIndex        =   26
  281.       Top             =   960
  282.       Width           =   1815
  283.    End
  284.    Begin Label Label6 
  285.       Alignment       =   1  'Right Justify
  286.       BackColor       =   &H00C0C0C0&
  287.       Caption         =   "Current Position (ms):"
  288.       ForeColor       =   &H00000080&
  289.       Height          =   195
  290.       Index           =   4
  291.       Left            =   240
  292.       TabIndex        =   25
  293.       Top             =   2280
  294.       Width           =   1935
  295.    End
  296.    Begin Label Label6 
  297.       Alignment       =   1  'Right Justify
  298.       BackColor       =   &H00C0C0C0&
  299.       Caption         =   "WAV Length (ms):"
  300.       Height          =   195
  301.       Index           =   3
  302.       Left            =   240
  303.       TabIndex        =   24
  304.       Top             =   1920
  305.       Width           =   1935
  306.    End
  307.    Begin Label Label6 
  308.       Alignment       =   1  'Right Justify
  309.       BackStyle       =   0  'Transparent
  310.       Caption         =   "Sample Rate:"
  311.       Height          =   195
  312.       Index           =   2
  313.       Left            =   240
  314.       TabIndex        =   23
  315.       Top             =   1440
  316.       Width           =   1935
  317.    End
  318.    Begin Label Label6 
  319.       Alignment       =   1  'Right Justify
  320.       BackStyle       =   0  'Transparent
  321.       Caption         =   "Channels:"
  322.       Height          =   195
  323.       Index           =   1
  324.       Left            =   240
  325.       TabIndex        =   22
  326.       Top             =   1200
  327.       Width           =   1935
  328.    End
  329.    Begin Label Label6 
  330.       Alignment       =   1  'Right Justify
  331.       BackStyle       =   0  'Transparent
  332.       Caption         =   "Bit Size:"
  333.       Height          =   195
  334.       Index           =   0
  335.       Left            =   240
  336.       TabIndex        =   21
  337.       Top             =   960
  338.       Width           =   1935
  339.    End
  340.    Begin Label Label3 
  341.       BackColor       =   &H00C0C0C0&
  342.       Caption         =   "Label3"
  343.       ForeColor       =   &H00800000&
  344.       Height          =   195
  345.       Left            =   2400
  346.       TabIndex        =   18
  347.       Top             =   600
  348.       Width           =   1815
  349.    End
  350.    Begin Label Label2 
  351.       Alignment       =   1  'Right Justify
  352.       BackColor       =   &H00C0C0C0&
  353.       Caption         =   "WAV mode:"
  354.       ForeColor       =   &H00800000&
  355.       Height          =   195
  356.       Left            =   240
  357.       TabIndex        =   17
  358.       Top             =   600
  359.       Width           =   1935
  360.    End
  361.    Begin Label Label1 
  362.       Alignment       =   2  'Center
  363.       BackColor       =   &H00C0C0C0&
  364.       Caption         =   "Label1"
  365.       Height          =   195
  366.       Left            =   240
  367.       TabIndex        =   16
  368.       Top             =   240
  369.       Width           =   3975
  370.    End
  371. Dim nl As String
  372. Dim Recorded As Integer
  373. Dim FirstNew As Integer
  374. Dim FirstTime As Integer
  375. Sub CmdAddToEnd_Click ()
  376.     If HowManyWavRecordDevices() = 0 Then
  377.         MsgBox "Sound card can not record!", 16, "Device Error"
  378.         Exit Sub
  379.         End If
  380.     msg$ = "This option will begin inserting the" + nl
  381.     msg$ = msg$ + "recording at the END of the file!"
  382.     response = MsgBox(msg$, 33, "Record Add To End")
  383.     If response = 2 Then Exit Sub
  384.     CmdToEnd_Click
  385.     CmdAddToEnd.Enabled = False
  386.     CmdInsertAt.Enabled = False
  387.     CmdNewWav.Enabled = False
  388.     CmdOkay.Enabled = False
  389.     CmdPause.Enabled = False
  390.     CmdPlay.Enabled = False
  391.     CmdAddToStart.Enabled = False
  392.     CmdSave.Enabled = False
  393.     CmdToEnd.Enabled = False
  394.     CmdToStart.Enabled = False
  395.     CmdEraseAll.Enabled = False
  396.     CmdEraseToEnd.Enabled = False
  397.     CmdEraseToStart.Enabled = False
  398.     CmdUndo.Enabled = False
  399.     HScroll1.Enabled = False
  400.     Label6(4).Visible = False
  401.     Label7(4).Visible = False
  402.     Label6(5).Visible = False
  403.     Label7(5).Visible = False
  404.     Label6(3).ForeColor = QBColor(4)
  405.     Label7(3).ForeColor = QBColor(4)
  406.     Label6(6).ForeColor = QBColor(4)
  407.     Label7(6).ForeColor = QBColor(4)
  408.     Recorded = True
  409.     Answer$ = Space$(255)
  410.     WavRecord Answer$
  411.     If Left$(Answer$, 1) <> Chr$(0) Then
  412.         MsgBox "Incompatible file format!", 16, "File Error"
  413.         Recorded = False
  414.         CmdStop_Click
  415.         End If
  416. End Sub
  417. Sub CmdAddToStart_Click ()
  418.     If HowManyWavRecordDevices() = 0 Then
  419.         MsgBox "Sound card can not record!", 16, "Device Error"
  420.         Exit Sub
  421.         End If
  422.     msg$ = "This option will begin inserting the" + nl
  423.     msg$ = msg$ + "recording at the START of the file!"
  424.     response = MsgBox(msg$, 33, "Record Add To Start")
  425.     If response = 2 Then Exit Sub
  426.     CmdToStart_Click
  427.     CmdAddToEnd.Enabled = False
  428.     CmdInsertAt.Enabled = False
  429.     CmdNewWav.Enabled = False
  430.     CmdOkay.Enabled = False
  431.     CmdPause.Enabled = False
  432.     CmdPlay.Enabled = False
  433.     CmdAddToStart.Enabled = False
  434.     CmdSave.Enabled = False
  435.     CmdToEnd.Enabled = False
  436.     CmdToStart.Enabled = False
  437.     CmdEraseAll.Enabled = False
  438.     CmdEraseToEnd.Enabled = False
  439.     CmdEraseToStart.Enabled = False
  440.     CmdUndo.Enabled = False
  441.     HScroll1.Enabled = False
  442.     Label6(4).Visible = False
  443.     Label7(4).Visible = False
  444.     Label6(5).Visible = False
  445.     Label7(5).Visible = False
  446.     Label6(3).ForeColor = QBColor(4)
  447.     Label7(3).ForeColor = QBColor(4)
  448.     Label6(6).ForeColor = QBColor(4)
  449.     Label7(6).ForeColor = QBColor(4)
  450.     Recorded = True
  451.     Answer$ = Space$(255)
  452.     WavRecord Answer$
  453.     If Left$(Answer$, 1) <> Chr$(0) Then
  454.         MsgBox "Incompatible file format!", 16, "File Error"
  455.         Recorded = False
  456.         CmdStop_Click
  457.         End If
  458. End Sub
  459. Sub CmdEraseAll_Click ()
  460.     If HowManyWavRecordDevices() = 0 Then
  461.         MsgBox "Sound card can not record!", 16, "Device Error"
  462.         Exit Sub
  463.         End If
  464.     msg$ = "This option will ERASE the" + nl
  465.     msg$ = msg$ + "entire Wav file contents!"
  466.     response = MsgBox(msg$, 33, "Erase All")
  467.     If response = 2 Then Exit Sub
  468.     Recorded = True
  469.     Screen.MousePointer = 11
  470.     Answer$ = Space$(255)
  471.     WavEraseAll Answer$
  472.     CmdStop_Click
  473.     Screen.MousePointer = 0
  474. End Sub
  475. Sub CmdEraseToEnd_Click ()
  476.     If HowManyWavRecordDevices() = 0 Then
  477.         MsgBox "Sound card can not record!", 16, "Device Error"
  478.         Exit Sub
  479.         End If
  480.     msg$ = "This option will ERASE the Wav file from" + nl
  481.     msg$ = msg$ + "the current position to the END of the file!"
  482.     response = MsgBox(msg$, 33, "Erase To End")
  483.     If response = 2 Then Exit Sub
  484.     Recorded = True
  485.     Screen.MousePointer = 11
  486.     Answer$ = Space$(255)
  487.     WavStatusPosition Answer$
  488.     SecStart$ = Trim$(Str$(Val(Answer$)))
  489.     Answer$ = Space$(255)
  490.     WavStatusLengthMS Answer$
  491.     SecEnd$ = Trim$(Str$(Val(Answer$)))
  492.     Answer$ = Space$(255)
  493.     WavEraseSection SecStart$, SecEnd$, Answer$
  494.     CmdStop_Click
  495.     Screen.MousePointer = 0
  496. End Sub
  497. Sub CmdEraseToStart_Click ()
  498.     If HowManyWavRecordDevices() = 0 Then
  499.         MsgBox "Sound card can not record!", 16, "Device Error"
  500.         Exit Sub
  501.         End If
  502.     msg$ = "This option will ERASE the Wav file from" + nl
  503.     msg$ = msg$ + "the current position to the START of the file!"
  504.     response = MsgBox(msg$, 33, "Erase To Start")
  505.     If response = 2 Then Exit Sub
  506.     Recorded = True
  507.     Screen.MousePointer = 11
  508.     SecStart$ = "0"
  509.     Answer$ = Space$(255)
  510.     WavStatusPosition Answer$
  511.     SecEnd$ = Trim$(Str$(Val(Answer$)))
  512.     Answer$ = Space$(255)
  513.     WavEraseSection SecStart$, SecEnd$, Answer$
  514.     CmdStop_Click
  515.     Screen.MousePointer = 0
  516. End Sub
  517. Sub CmdInsertAt_Click ()
  518.     If HowManyWavRecordDevices() = 0 Then
  519.         MsgBox "Sound card can not record!", 16, "Device Error"
  520.         Exit Sub
  521.         End If
  522.     msg$ = "This option will begin inserting the" + nl
  523.     msg$ = msg$ + "recording at the CURRENT POSITION!"
  524.     response = MsgBox(msg$, 33, "Record Insert At")
  525.     If response = 2 Then Exit Sub
  526.     CmdAddToEnd.Enabled = False
  527.     CmdInsertAt.Enabled = False
  528.     CmdNewWav.Enabled = False
  529.     CmdOkay.Enabled = False
  530.     CmdPause.Enabled = False
  531.     CmdPlay.Enabled = False
  532.     CmdAddToStart.Enabled = False
  533.     CmdSave.Enabled = False
  534.     CmdToEnd.Enabled = False
  535.     CmdToStart.Enabled = False
  536.     CmdEraseAll.Enabled = False
  537.     CmdEraseToEnd.Enabled = False
  538.     CmdEraseToStart.Enabled = False
  539.     CmdUndo.Enabled = False
  540.     HScroll1.Enabled = False
  541.     Label6(4).Visible = False
  542.     Label7(4).Visible = False
  543.     Label6(5).Visible = False
  544.     Label7(5).Visible = False
  545.     Label6(3).ForeColor = QBColor(4)
  546.     Label7(3).ForeColor = QBColor(4)
  547.     Label6(6).ForeColor = QBColor(4)
  548.     Label7(6).ForeColor = QBColor(4)
  549.     Recorded = True
  550.     Answer$ = Space$(255)
  551.     WavRecord Answer$
  552.     If Left$(Answer$, 1) <> Chr$(0) Then
  553.         MsgBox "Incompatible file format!", 16, "File Error"
  554.         Recorded = False
  555.         CmdStop_Click
  556.         End If
  557. End Sub
  558. Sub CmdNewWav_Click ()
  559.     If HowManyWavRecordDevices() = 0 Then
  560.         MsgBox "Sound card can not record!", 16, "Device Error"
  561.         Exit Sub
  562.         End If
  563.     If Recorded = True Then
  564.         msg$ = "The Wav file changes have not been" + nl
  565.         msg$ = msg$ + "saved.  Do you want to save now?"
  566.         response = MsgBox(msg$, 36, "Exit WAV Storage Warning")
  567.         If response = 6 Then Exit Sub
  568.         End If
  569.     msg$ = "This option will create a new Wav file." + nl
  570.     msg$ = msg$ + "You may record after entering a name."
  571.     response = MsgBox(msg$, 33, "Begin New")
  572.     If response = 2 Then Exit Sub
  573.     Screen.MousePointer = 11
  574.     WavName.Show 1
  575.     If FormPassString2 = "" Then Exit Sub
  576.     Screen.MousePointer = 11
  577.     Me.Refresh
  578.     FormPassString = FormPassString2
  579.     Answer$ = Space$(255)
  580.     WavClose Answer$
  581.     Answer$ = Space$(255)
  582.     WavOpenNew Answer$
  583.     Answer$ = Space$(255)
  584.     lpValue$ = "8"
  585.     WavSetBitSize lpValue$, Answer$
  586.     Answer$ = Space$(255)
  587.     lpValue$ = "1"
  588.     WavSetChannels lpValue$, Answer$
  589.     Answer$ = Space$(255)
  590.     lpValue$ = "11025"
  591.     WavSetSampleRate lpValue$, Answer$
  592.     Answer$ = Space$(255)
  593.     WavStatusBitSize Answer$
  594.     Label7(0).Caption = Answer$
  595.     Answer$ = Space$(255)
  596.     WavStatusChannels Answer$
  597.     If Val(Answer$) = 1 Then
  598.         Answer$ = "mono"
  599.         Else
  600.         Answer$ = "stereo"
  601.         End If
  602.     Label7(1).Caption = Answer$
  603.     Answer$ = Space$(255)
  604.     WavStatusSampleRate Answer$
  605.     Label7(2).Caption = Format$(Val(Answer$), "###,##0") + " Hz"
  606.     Answer$ = Space$(255)
  607.     WavStatusLengthMS Answer$
  608.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  609.     Answer$ = Space$(255)
  610.     WavStatusLengthBytes Answer$
  611.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  612.     TempName$ = FormPassString
  613.     RevString TempName$
  614.     pos% = InStr(TempName$, "\")
  615.     TempName$ = Left$(TempName$, pos% - 1)
  616.     RevString TempName$
  617.     Label1.Caption = UCase$(TempName$)
  618.     CmdStop_Click
  619.     Screen.MousePointer = 0
  620.     Recorded = True
  621.     FirstNew = True
  622. End Sub
  623. Sub CmdOkay_Click ()
  624.     Answer$ = Space$(255)
  625.     WavClose Answer$
  626.     Unload Me
  627. End Sub
  628. Sub CmdPause_Click ()
  629.     Answer$ = Space$(255)
  630.     WavPause Answer$
  631. End Sub
  632. Sub CmdPlay_Click ()
  633.     Answer$ = Space$(255)
  634.     WavStatusLengthMS Answer$
  635.     MSlength% = Val(Answer$)
  636.     If MSlength% = 0 Then
  637.         MsgBox "The Wav file is empty!", 16, "User Error"
  638.         Exit Sub
  639.         End If
  640.     Answer$ = Space$(255)
  641.     WavStart Answer$
  642.     If Left$(Answer$, 1) <> Chr$(0) Then
  643.         MsgBox "Incompatible file format!", 16, "File Error"
  644.         End If
  645. End Sub
  646. Sub CmdSave_Click ()
  647.     If HowManyWavRecordDevices() = 0 Then
  648.         MsgBox "Sound card can not record!", 16, "Device Error"
  649.         Exit Sub
  650.         End If
  651.     If Recorded = False Then
  652.         MsgBox "No changes to save!", 16, "User Error"
  653.         Exit Sub
  654.         End If
  655.     Answer$ = Space$(255)
  656.     WavStatusLengthMS Answer$
  657.     MSlength% = Val(Answer$)
  658.     If MSlength% = 0 Then
  659.         MsgBox "Can not save an empty file!", 16, "User Error"
  660.         Exit Sub
  661.         End If
  662.     Screen.MousePointer = 11
  663.     Answer$ = Space$(255)
  664.     WavSave FormPassString, Answer$
  665.     If FirstNew = True Then
  666.         FirstNew = False
  667.         Else
  668.         Answer$ = Space$(255)
  669.         WavSave FormPassString, Answer$
  670.         End If
  671.     Recorded = False
  672.     WavPlay.File1.Pattern = "abcdefgh.zyx"
  673.     WavPlay.File1.Pattern = "*.WAV"
  674.     Screen.MousePointer = 0
  675. End Sub
  676. Sub CmdStop_Click ()
  677.     Answer$ = Space$(255)
  678.     WavStop Answer$
  679.     Answer$ = Space$(255)
  680.     WavStatusLengthMS Answer$
  681.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  682.     HScroll1.Max = Val(Answer$)
  683.     Answer$ = Space$(255)
  684.     WavStatusLengthBytes Answer$
  685.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  686.     CmdAddToEnd.Enabled = True
  687.     CmdInsertAt.Enabled = True
  688.     CmdNewWav.Enabled = True
  689.     CmdOkay.Enabled = True
  690.     CmdPause.Enabled = True
  691.     CmdPlay.Enabled = True
  692.     CmdAddToStart.Enabled = True
  693.     CmdSave.Enabled = True
  694.     CmdToEnd.Enabled = True
  695.     CmdToStart.Enabled = True
  696.     CmdEraseAll.Enabled = True
  697.     CmdEraseToEnd.Enabled = True
  698.     CmdEraseToStart.Enabled = True
  699.     CmdUndo.Enabled = True
  700.     HScroll1.Enabled = True
  701.     Label6(4).Visible = True
  702.     Label7(4).Visible = True
  703.     Label6(5).Visible = True
  704.     Label7(5).Visible = True
  705.     Label6(3).ForeColor = QBColor(0)
  706.     Label7(3).ForeColor = QBColor(0)
  707.     Label6(6).ForeColor = QBColor(0)
  708.     Label7(6).ForeColor = QBColor(0)
  709.     Answer$ = Space$(255)
  710.     WavSeekStart Answer$
  711.     Answer$ = Space$(255)
  712.     WavStatusPosition Answer$
  713.     position% = Val(Answer$)
  714.     Label7(4).Caption = Format$(position%, "###,##0") + " ms"
  715.     DoPercent
  716.     HScroll1.Value = position%
  717. End Sub
  718. Sub CmdToEnd_Click ()
  719.     Answer$ = Space$(255)
  720.     WavSeekEnd Answer$
  721.     HScroll1.Value = HScroll1.Max
  722. End Sub
  723. Sub CmdToStart_Click ()
  724.     Answer$ = Space$(255)
  725.     WavSeekStart Answer$
  726.     HScroll1.Value = 0
  727. End Sub
  728. Sub CmdUndo_Click ()
  729.     If HowManyWavRecordDevices() = 0 Then
  730.         MsgBox "Sound card can not record!", 16, "Device Error"
  731.         Exit Sub
  732.         End If
  733.     If Recorded = False Then
  734.         MsgBox "No changes to undo!", 16, "User Error"
  735.         Exit Sub
  736.         End If
  737.     response = MsgBox("Really undo changes?", 36, "Undo Warning")
  738.     If response = 7 Then Exit Sub
  739.     Screen.MousePointer = 11
  740.     Answer$ = Space$(255)
  741.     WavClose Answer$
  742.     Answer$ = Space$(255)
  743.     WavOpen FormPassString, Answer$
  744.     Answer$ = Space$(255)
  745.     WavStatusLengthMS Answer$
  746.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  747.     Answer$ = Space$(255)
  748.     WavStatusLengthBytes Answer$
  749.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  750.     Recorded = False
  751.     CmdStop_Click
  752.     Screen.MousePointer = 0
  753. End Sub
  754. Sub DoPercent ()
  755.     If HScroll1.Max = 0 Then
  756.         Percent$ = "0%"
  757.         Else
  758.         Answer$ = Space$(255)
  759.         WavStatusPosition Answer$
  760.         position% = Val(Answer$)
  761.         Percent$ = Format$(Int((position% / HScroll1.Max) * 100), "##0") + "%"
  762.         End If
  763.     Label7(5).Caption = Percent$
  764. End Sub
  765. Sub Form_Load ()
  766.     FormCenterForm Me, WavPlay
  767.     nl = Chr$(13) + Chr$(10)
  768.     Recorded = False
  769.     FirstNew = False
  770.     FirstTime = True
  771.     TempName$ = FormPassString
  772.     RevString TempName$
  773.     pos% = InStr(TempName$, "\")
  774.     TempName$ = Left$(TempName$, pos% - 1)
  775.     RevString TempName$
  776.     Label1.Caption = UCase$(TempName$)
  777.     Answer$ = Space$(255)
  778.     WavOpen FormPassString, Answer$
  779.     Answer$ = Space$(255)
  780.     WavStatusMode Answer$
  781.     Label3.Caption = UCase$(Answer$)
  782.     Answer$ = Space$(255)
  783.     WavStatusBitSize Answer$
  784.     Label7(0).Caption = Answer$
  785.     Answer$ = Space$(255)
  786.     WavStatusChannels Answer$
  787.     If Val(Answer$) = 1 Then
  788.         Answer$ = "mono"
  789.         Else
  790.         Answer$ = "stereo"
  791.         End If
  792.     Label7(1).Caption = Answer$
  793.     Answer$ = Space$(255)
  794.     WavStatusSampleRate Answer$
  795.     Label7(2).Caption = Format$(Val(Answer$), "###,##0") + " Hz"
  796.     Answer$ = Space$(255)
  797.     WavStatusLengthMS Answer$
  798.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  799.     HScroll1.Max = Val(Answer$)
  800.     Answer$ = Space$(255)
  801.     WavStatusLengthBytes Answer$
  802.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  803.     Answer$ = Space$(255)
  804.     WavStatusPosition Answer$
  805.     Label7(4).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  806.     HScroll1.Value = Val(Answer$)
  807.     DoPercent
  808.     Screen.MousePointer = 0
  809. End Sub
  810. Sub Form_Paint ()
  811.     DoForm3D Me, sunken, 3, 0
  812.     DoForm3D Me, raised, 1, 3
  813.     DoForm3D Me, sunken, 3, 0
  814.     DoForm3D Me, raised, 1, 3
  815.     DoControl3D Label1, sunken, 1
  816.     DoControl3D Label2, sunken, 1
  817.     DoControl3D Label3, sunken, 1
  818.     DoControl3D Label4, sunken, 1
  819.     For i = 3 To 6
  820.         DoControl3D Label6(i), sunken, 1
  821.         DoControl3D Label7(i), sunken, 1
  822.         Next
  823. End Sub
  824. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  825.     If Recorded = True Then
  826.         msg$ = "The Wav file changes have not been" + nl
  827.         msg$ = msg$ + "saved.  Do you want to save now?"
  828.         response = MsgBox(msg$, 36, "Exit WAV Storage Warning")
  829.         If response = 6 Then Cancel = True
  830.         End If
  831. End Sub
  832. Sub HScroll1_Change ()
  833.     Answer$ = Space$(255)
  834.     WavStatusMode Answer$
  835.     If Left$(Answer$, 7) <> "playing" Then
  836.         Answer$ = Space$(255)
  837.         NewValue$ = Trim$(Str$(HScroll1.Value))
  838.         WavSeekPosition NewValue$, Answer$
  839.         Answer$ = Space$(255)
  840.         WavStatusPosition Answer$
  841.         position% = Val(Answer$)
  842.         Label7(4).Caption = Format$(position%, "###,##0") + " ms"
  843.         DoPercent
  844.         End If
  845. End Sub
  846. Sub Timer1_Timer ()
  847.     Answer$ = Space$(255)
  848.     WavStatusMode Answer$
  849.     Label3.Caption = UCase$(Answer$)
  850.         If Left$(Answer$, 7) = "playing" Then
  851.             Answer$ = Space$(255)
  852.             WavStatusPosition Answer$
  853.             position% = Val(Answer$)
  854.             Label7(4).Caption = Format$(position%, "###,##0") + " ms"
  855.             DoPercent
  856.             HScroll1.Value = position%
  857.             End If
  858.         If Left$(Answer$, 9) = "recording" Then
  859.             Answer$ = Space$(255)
  860.             WavStatusLengthMS Answer$
  861.             MSlength% = Val(Answer$)
  862.             Label7(3).Caption = Format$(MSlength%, "###,##0") + " ms"
  863.             Answer$ = Space$(255)
  864.             WavStatusLengthBytes Answer$
  865.             Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  866.             If MSlength% = 60000 Then CmdStop_Click
  867.             End If
  868. End Sub
  869.