home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / mabry / wave10 / sample / wsample1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-01-01  |  4.2 KB  |  153 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Wave VBX Action Sample"
  6.    ClientHeight    =   2550
  7.    ClientLeft      =   1650
  8.    ClientTop       =   1920
  9.    ClientWidth     =   4095
  10.    Height          =   2955
  11.    Left            =   1590
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   2550
  14.    ScaleWidth      =   4095
  15.    Top             =   1575
  16.    Width           =   4215
  17.    Begin TextBox txtFileLength 
  18.       Height          =   285
  19.       Left            =   240
  20.       TabIndex        =   6
  21.       Top             =   1200
  22.       Width           =   3615
  23.    End
  24.    Begin MabryWave Wave1 
  25.       Exclusive       =   0   'False
  26.       FileLength      =   -1
  27.       Filename        =   ""
  28.       Left            =   3480
  29.       Loop            =   0   'False
  30.       Loop            =   0   'False
  31.       PlayEnd         =   -1
  32.       PlayStart       =   -1
  33.       Top             =   0
  34.    End
  35.    Begin TextBox txtFilename 
  36.       Height          =   285
  37.       Left            =   240
  38.       TabIndex        =   3
  39.       Text            =   "C:\WINDOWS\RINGOUT.WAV"
  40.       Top             =   480
  41.       Width           =   3615
  42.    End
  43.    Begin CommandButton btnStop 
  44.       Caption         =   "Stop"
  45.       Height          =   615
  46.       Left            =   2640
  47.       TabIndex        =   2
  48.       Top             =   1680
  49.       Width           =   1215
  50.    End
  51.    Begin CommandButton btnPause 
  52.       Caption         =   "Resume"
  53.       Height          =   615
  54.       Left            =   1440
  55.       TabIndex        =   1
  56.       Top             =   1680
  57.       Width           =   1215
  58.    End
  59.    Begin CommandButton btnPlay 
  60.       Caption         =   "Play"
  61.       Height          =   615
  62.       Left            =   240
  63.       TabIndex        =   0
  64.       Top             =   1680
  65.       Width           =   1215
  66.    End
  67.    Begin Label Label2 
  68.       BackColor       =   &H00C0C0C0&
  69.       Caption         =   "File Length:"
  70.       Height          =   255
  71.       Left            =   240
  72.       TabIndex        =   5
  73.       Top             =   960
  74.       Width           =   2415
  75.    End
  76.    Begin Label Label1 
  77.       BackColor       =   &H00C0C0C0&
  78.       Caption         =   "Filename:"
  79.       Height          =   255
  80.       Left            =   240
  81.       TabIndex        =   4
  82.       Top             =   240
  83.       Width           =   1935
  84.    End
  85. Option Explicit
  86. Dim fChanged As Integer ' flag: has filename changed?
  87. Sub btnPause_Click ()
  88.     ' if the user wants to pause
  89.     If btnPause.Caption = "Pause" Then
  90.         ' pause
  91.         Wave1.Action = 2
  92.     Else
  93.         ' resume
  94.         Wave1.Action = 3
  95.     End If
  96.     EnableButtons
  97. End Sub
  98. Sub btnPlay_Click ()
  99.     ' make sure the filename is up to date
  100.     SetFilename
  101.     ' play the file
  102.     Wave1.Action = 1
  103.     EnableButtons
  104. End Sub
  105. Sub btnStop_Click ()
  106.     ' stop playing
  107.     Wave1.Action = 4
  108.     ' update buttons
  109.     EnableButtons
  110. End Sub
  111. Sub EnableButtons ()
  112.     Select Case Wave1.Status
  113.         Case 1: ' playing
  114.             If btnPause.Caption <> "Pause" Then
  115.                 btnPause.Caption = "Pause"
  116.             End If
  117.             btnStop.Enabled = True
  118.             btnPause.Enabled = True
  119.         Case 2: ' paused
  120.             If btnPause.Caption <> "Resume" Then
  121.                 btnPause.Caption = "Resume"
  122.             End If
  123.             btnStop.Enabled = True
  124.             btnPause.Enabled = True
  125.         Case 4: ' stopped
  126.             If btnPause.Caption <> "Pause" Then
  127.                 btnPause.Caption = "Pause"
  128.             End If
  129.             btnStop.Enabled = False
  130.             btnPause.Enabled = False
  131.     End Select
  132. End Sub
  133. Sub Form_Load ()
  134.     fChanged = True
  135.     EnableButtons
  136. End Sub
  137. Sub SetFilename ()
  138.     ' if the filename has changed, tell Wave VBX
  139.     If fChanged Then
  140.         ' changed no more
  141.         fChanged = False
  142.         Wave1.Filename = txtFilename
  143.         ' set the file length field
  144.         txtFileLength = Format(Wave1.FileLength / 1000, "0.000") & " seconds"
  145.     End If
  146. End Sub
  147. Sub txtFilename_Change ()
  148.     fChanged = True
  149. End Sub
  150. Sub Wave1_PlayDone ()
  151.     EnableButtons
  152. End Sub
  153.