home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD2762172000.psc / Form1.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  2000-01-07  |  5.7 KB  |  164 lines

  1. VERSION 5.00
  2. Object = "{5E379E14-C4AF-11D3-94B2-DCF27482A336}#3.0#0"; "Sound Engine.ocx"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "3D sound engine sample"
  6.    ClientHeight    =   3690
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   5100
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3690
  14.    ScaleWidth      =   5100
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.CommandButton Command3 
  18.       Caption         =   "Exit"
  19.       Height          =   375
  20.       Left            =   4080
  21.       TabIndex        =   7
  22.       Top             =   1080
  23.       Width           =   855
  24.    End
  25.    Begin VB.CommandButton Command2 
  26.       Caption         =   "Sound2"
  27.       Height          =   375
  28.       Left            =   4080
  29.       TabIndex        =   6
  30.       Top             =   600
  31.       Width           =   855
  32.    End
  33.    Begin VB.CommandButton Command1 
  34.       Caption         =   "Sound1"
  35.       Height          =   375
  36.       Left            =   4080
  37.       TabIndex        =   5
  38.       Top             =   120
  39.       Width           =   855
  40.    End
  41.    Begin VB.PictureBox Picture1 
  42.       BackColor       =   &H00000000&
  43.       Height          =   2895
  44.       Left            =   120
  45.       ScaleHeight     =   189
  46.       ScaleMode       =   3  'Pixel
  47.       ScaleWidth      =   245
  48.       TabIndex        =   1
  49.       Top             =   120
  50.       Width           =   3735
  51.       Begin VB.Label Label3 
  52.          AutoSize        =   -1  'True
  53.          BackColor       =   &H000000FF&
  54.          Caption         =   "Sound1"
  55.          Height          =   195
  56.          Left            =   840
  57.          TabIndex        =   4
  58.          Top             =   960
  59.          Width           =   555
  60.       End
  61.       Begin VB.Label Label2 
  62.          AutoSize        =   -1  'True
  63.          BackColor       =   &H000000FF&
  64.          Caption         =   "Sound2"
  65.          Height          =   195
  66.          Left            =   2280
  67.          TabIndex        =   3
  68.          Top             =   1560
  69.          Width           =   555
  70.       End
  71.       Begin VB.Label Label1 
  72.          AutoSize        =   -1  'True
  73.          BackColor       =   &H0080FFFF&
  74.          Caption         =   "Listener"
  75.          Height          =   195
  76.          Left            =   1440
  77.          TabIndex        =   2
  78.          Top             =   1320
  79.          Width           =   555
  80.       End
  81.    End
  82.    Begin Sound.SoundEngine SoundEngine1 
  83.       Height          =   255
  84.       Left            =   0
  85.       TabIndex        =   0
  86.       Top             =   120
  87.       Width           =   255
  88.       _ExtentX        =   450
  89.       _ExtentY        =   450
  90.    End
  91.    Begin VB.Label Label5 
  92.       BackStyle       =   0  'Transparent
  93.       Caption         =   "Move the red labels by the mouse to set its position from the listiner,the click its button"
  94.       Height          =   1695
  95.       Left            =   3960
  96.       TabIndex        =   9
  97.       Top             =   1560
  98.       Width           =   975
  99.    End
  100.    Begin VB.Label Label4 
  101.       Alignment       =   2  'Center
  102.       Caption         =   "For more samples and links and controls visit my site at http://go.to/mostafa"
  103.       Height          =   495
  104.       Left            =   120
  105.       TabIndex        =   8
  106.       Top             =   3120
  107.       Width           =   4935
  108.    End
  109. Attribute VB_Name = "Form1"
  110. Attribute VB_GlobalNameSpace = False
  111. Attribute VB_Creatable = False
  112. Attribute VB_PredeclaredId = True
  113. Attribute VB_Exposed = False
  114. Dim s1 As Integer
  115. Dim s2 As Integer
  116. Dim MouseStartx As Single
  117. Dim MouseStarty As Single
  118. Private Sub Command1_Click()
  119. SoundEngine1.Setlistenerpos Label1.Left, 0, Label1.Top 'set the listener position to label1
  120. SoundEngine1.Playwave s1, Label3.Left, 0, Label3.Top 'play  the wave and set its  position
  121. End Sub
  122. Private Sub Command2_Click()
  123. SoundEngine1.Setlistenerpos Label1.Left, 0, Label1.Top 'set the listener position to label1
  124. SoundEngine1.Playwave s2, Label2.Left, 0, Label2.Top 'play  the wave and set its  position
  125. End Sub
  126. Private Sub Command3_Click()
  127. SoundEngine1.EndEngine 'end the engine
  128. End Sub
  129. Private Sub Form_Load()
  130. SoundEngine1.Setform (Me.hWnd) 'intalize the engine
  131. s1 = SoundEngine1.Addwave(App.Path & "\bump1.wav") 'load the first wave
  132. s2 = SoundEngine1.Addwave(App.Path & "\death1.wav") 'load the second
  133. 's1 and s2 are the pointer to the wave channel
  134. End Sub
  135. Private Sub Form_Unload(Cancel As Integer)
  136. SoundEngine1.EndEngine 'end the engine
  137. End Sub
  138. Private Sub Label3_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  139. MouseStartx = Picture1.ScaleX(x, 1, 3)
  140. MouseStarty = Picture1.ScaleY(y, 1, 3)
  141. End Sub
  142. Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  143.     On Error Resume Next
  144.   If Button = vbLeftButton Then
  145.           x = Picture1.ScaleX(x, 1, 3)
  146.     y = Picture1.ScaleY(y, 1, 3)
  147.          Label3.Left = Label3.Left - (MouseStartx - x)
  148.  Label3.Top = Label3.Top - (MouseStarty - y)
  149.     End If
  150. End Sub
  151. Private Sub Label2_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  152. MouseStartx = Picture1.ScaleX(x, 1, 3)
  153. MouseStarty = Picture1.ScaleY(y, 1, 3)
  154. End Sub
  155. Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  156.     On Error Resume Next
  157.   If Button = vbLeftButton Then
  158.      x = Picture1.ScaleX(x, 1, 3)
  159.     y = Picture1.ScaleY(y, 1, 3)
  160.          Label2.Left = Label2.Left - (MouseStartx - x)
  161.  Label2.Top = Label2.Top - (MouseStarty - y)
  162.     End If
  163. End Sub
  164.