home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / sound / wave / wsample3.frm < prev    next >
Text File  |  1995-01-01  |  5KB  |  193 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Wave VBX Start/End Sample"
  6.    ClientHeight    =   3135
  7.    ClientLeft      =   1650
  8.    ClientTop       =   1920
  9.    ClientWidth     =   4095
  10.    Height          =   3540
  11.    Left            =   1590
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3135
  14.    ScaleWidth      =   4095
  15.    Top             =   1575
  16.    Width           =   4215
  17.    Begin Timer Timer1 
  18.       Interval        =   50
  19.       Left            =   3000
  20.       Top             =   0
  21.    End
  22.    Begin TextBox txtPosition 
  23.       Height          =   285
  24.       Left            =   240
  25.       TabIndex        =   9
  26.       Top             =   1200
  27.       Width           =   3615
  28.    End
  29.    Begin TextBox txtEnd 
  30.       Height          =   285
  31.       Left            =   2160
  32.       TabIndex        =   7
  33.       Top             =   1800
  34.       Width           =   1695
  35.    End
  36.    Begin TextBox txtStart 
  37.       Height          =   285
  38.       Left            =   240
  39.       TabIndex        =   5
  40.       Top             =   1800
  41.       Width           =   1695
  42.    End
  43.    Begin MabryWave Wave1 
  44.       Exclusive       =   0   'False
  45.       FileLength      =   -1
  46.       Filename        =   ""
  47.       Left            =   3480
  48.       Loop            =   0   'False
  49.       LoopCount       =   0   'False
  50.       PlayEnd         =   -1
  51.       PlayStart       =   -1
  52.       Top             =   0
  53.    End
  54.    Begin TextBox txtFilename 
  55.       Height          =   285
  56.       Left            =   240
  57.       TabIndex        =   2
  58.       Text            =   "C:\WINDOWS\RINGOUT.WAV"
  59.       Top             =   480
  60.       Width           =   3615
  61.    End
  62.    Begin CommandButton btnStop 
  63.       Caption         =   "Stop"
  64.       Height          =   615
  65.       Left            =   2040
  66.       TabIndex        =   1
  67.       Top             =   2280
  68.       Width           =   1815
  69.    End
  70.    Begin CommandButton btnPlay 
  71.       Caption         =   "Play"
  72.       Height          =   615
  73.       Left            =   240
  74.       TabIndex        =   0
  75.       Top             =   2280
  76.       Width           =   1815
  77.    End
  78.    Begin Label Label4 
  79.       BackColor       =   &H00C0C0C0&
  80.       Caption         =   "Position:"
  81.       Height          =   255
  82.       Left            =   240
  83.       TabIndex        =   8
  84.       Top             =   960
  85.       Width           =   1215
  86.    End
  87.    Begin Label Label3 
  88.       BackColor       =   &H00C0C0C0&
  89.       Caption         =   "End:"
  90.       Height          =   255
  91.       Left            =   2160
  92.       TabIndex        =   6
  93.       Top             =   1560
  94.       Width           =   1215
  95.    End
  96.    Begin Label Label2 
  97.       BackColor       =   &H00C0C0C0&
  98.       Caption         =   "Start:"
  99.       Height          =   255
  100.       Left            =   240
  101.       TabIndex        =   4
  102.       Top             =   1560
  103.       Width           =   1215
  104.    End
  105.    Begin Label Label1 
  106.       BackColor       =   &H00C0C0C0&
  107.       Caption         =   "Filename:"
  108.       Height          =   255
  109.       Left            =   240
  110.       TabIndex        =   3
  111.       Top             =   240
  112.       Width           =   1935
  113.    End
  114. End
  115. Option Explicit
  116.  
  117. Dim fChanged As Integer ' flag: has filename changed?
  118.  
  119. Sub btnPlay_Click ()
  120.     ' make sure the filename is up to date
  121.     SetFilename
  122.  
  123.     ' check for start field
  124.     If Trim(txtStart) <> "" Then
  125.         Wave1.PlayStart = Val(txtStart)
  126.     Else
  127.         Wave1.PlayStart = -1
  128.     End If
  129.  
  130.     ' check for end field
  131.     If Trim(txtEnd) <> "" Then
  132.         Wave1.PlayEnd = Val(txtEnd)
  133.     Else
  134.         Wave1.PlayEnd = -1
  135.     End If
  136.  
  137.     ' play the file
  138.     Wave1.Action = 1
  139.     EnableButtons
  140. End Sub
  141.  
  142. Sub btnStop_Click ()
  143.     ' stop playing
  144.     Wave1.Action = 4
  145.  
  146.     ' update buttons
  147.     EnableButtons
  148. End Sub
  149.  
  150. Sub EnableButtons ()
  151.     Select Case Wave1.Status
  152.         Case 1: ' playing
  153.             btnStop.Enabled = True
  154.  
  155.         Case 2: ' paused
  156.             btnStop.Enabled = True
  157.  
  158.         Case 4: ' stopped
  159.             btnStop.Enabled = False
  160.     End Select
  161. End Sub
  162.  
  163. Sub Form_Load ()
  164.     fChanged = True
  165.     EnableButtons
  166. End Sub
  167.  
  168. Sub SetFilename ()
  169.     ' if the filename has changed, tell Wave VBX
  170.     If fChanged Then
  171.         ' changed no more
  172.         fChanged = False
  173.         Wave1.Filename = txtFilename
  174.     End If
  175. End Sub
  176.  
  177. Sub Timer1_Timer ()
  178.     If Wave1.Position = -1 Then
  179.         txtPosition = ""
  180.     Else
  181.         txtPosition = Format(Wave1.Position / 1000, "0.000") & " seconds"
  182.     End If
  183. End Sub
  184.  
  185. Sub txtFilename_Change ()
  186.     fChanged = True
  187. End Sub
  188.  
  189. Sub Wave1_PlayDone ()
  190.     EnableButtons
  191. End Sub
  192.  
  193.