home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / avidem / mmpform1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  8.3 KB  |  294 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "MultiMedia Demo in Visual Basic"
  4.    ClientHeight    =   4950
  5.    ClientLeft      =   435
  6.    ClientTop       =   2250
  7.    ClientWidth     =   7800
  8.    Height          =   5640
  9.    Left            =   375
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4950
  13.    ScaleWidth      =   7800
  14.    Top             =   1620
  15.    Width           =   7920
  16.    Begin TextBox Text1 
  17.       BorderStyle     =   0  'None
  18.       FontBold        =   -1  'True
  19.       FontItalic      =   0   'False
  20.       FontName        =   "MS Sans Serif"
  21.       FontSize        =   12
  22.       FontStrikethru  =   0   'False
  23.       FontUnderline   =   0   'False
  24.       Height          =   405
  25.       Left            =   3000
  26.       TabIndex        =   0
  27.       TabStop         =   0   'False
  28.       Text            =   "Text1"
  29.       Top             =   4440
  30.       Width           =   4215
  31.    End
  32.    Begin CommandButton Command6 
  33.       Caption         =   "EXIT"
  34.       Height          =   375
  35.       Left            =   1320
  36.       TabIndex        =   9
  37.       Top             =   4440
  38.       Width           =   735
  39.    End
  40.    Begin Timer Timer2 
  41.       Left            =   5760
  42.       Top             =   3840
  43.    End
  44.    Begin Timer Timer1 
  45.       Enabled         =   0   'False
  46.       Left            =   5040
  47.       Top             =   3840
  48.    End
  49.    Begin CommandButton Command5 
  50.       Caption         =   "Resume"
  51.       Height          =   375
  52.       Left            =   1800
  53.       TabIndex        =   8
  54.       Top             =   3840
  55.       Width           =   855
  56.    End
  57.    Begin CommandButton Command4 
  58.       Caption         =   "Pause"
  59.       Height          =   375
  60.       Left            =   720
  61.       TabIndex        =   7
  62.       Top             =   3840
  63.       Width           =   855
  64.    End
  65.    Begin CommandButton Command3 
  66.       Caption         =   "Close MMP File"
  67.       Height          =   735
  68.       Left            =   840
  69.       TabIndex        =   6
  70.       Top             =   2640
  71.       Width           =   1695
  72.    End
  73.    Begin CommandButton Command8 
  74.       Caption         =   "Stop Recorder"
  75.       Height          =   735
  76.       Left            =   1920
  77.       TabIndex        =   10
  78.       Top             =   1800
  79.       Width           =   1695
  80.    End
  81.    Begin CommandButton Command7 
  82.       Caption         =   "Start Recorder"
  83.       Height          =   735
  84.       Left            =   0
  85.       TabIndex        =   11
  86.       Top             =   1800
  87.       Width           =   1695
  88.    End
  89.    Begin CommandButton Command2 
  90.       Caption         =   "Play MMP File"
  91.       Height          =   735
  92.       Left            =   840
  93.       TabIndex        =   5
  94.       Top             =   960
  95.       Width           =   1695
  96.    End
  97.    Begin FileListBox File1 
  98.       Height          =   2565
  99.       Left            =   5520
  100.       Pattern         =   "*.mid;*.wav;*.mmm;*.avi"
  101.       TabIndex        =   3
  102.       Top             =   720
  103.       Width           =   1695
  104.    End
  105.    Begin DirListBox Dir1 
  106.       Height          =   2535
  107.       Left            =   3720
  108.       TabIndex        =   1
  109.       Top             =   720
  110.       Width           =   1695
  111.    End
  112.    Begin DriveListBox Drive1 
  113.       Height          =   315
  114.       Left            =   3720
  115.       TabIndex        =   2
  116.       Top             =   120
  117.       Width           =   1695
  118.    End
  119.    Begin CommandButton Command1 
  120.       Caption         =   "Open MMP File"
  121.       Height          =   735
  122.       Left            =   840
  123.       TabIndex        =   4
  124.       Top             =   120
  125.       Width           =   1695
  126.    End
  127.    Begin Menu About 
  128.       Caption         =   "&About"
  129.       Begin Menu About1 
  130.          Caption         =   "About &MultiMedia Demo"
  131.       End
  132.    End
  133. Sub About1_Click ()
  134.     CRLF$ = Chr$(13) + Chr$(10)
  135. Msg$ = "Written by Jerry Turpin" + CRLF$ + "Bedford, VA" + CRLF$ + "(800) 456-7775"
  136. MsgBox (Msg$)
  137. End Sub
  138. Sub Command1_Click ()
  139. Command2.Enabled = 0
  140. Command3.Enabled = 0
  141. Command4.Enabled = 0
  142. Command5.Enabled = 0
  143. Dim i As Integer
  144. A$ = ""
  145. If InStr(TheFile, ".mid") > 0 Then FileType$ = "MUSIC"
  146. If InStr(TheFile, ".wav") > 0 Then FileType$ = "TALK"
  147. If InStr(TheFile, ".mmm") > 0 Then FileType$ = "MOVIE"
  148. If InStr(TheFile, ".avi") > 0 Then FileType$ = "VID"
  149.  If FileType$ = "MOVIE" Then
  150.     Action$ = "Open " + TheFile + " Type MMMOVIE alias MOVIE"
  151.  Else
  152.     Action$ = "Open " + TheFile + " alias " + FileType$
  153.  End If
  154. i = mciExecute(Action$)
  155. Command2.Enabled = -1
  156. Command3.Enabled = -1
  157. End Sub
  158. Sub Command2_Click ()
  159. Command1.Enabled = Not Command1.Enabled
  160. Dim i As Integer
  161. A$ = ""
  162. If InStr(TheFile, ".mid") > 0 Then FileType$ = "MUSIC"
  163. If InStr(TheFile, ".wav") > 0 Then FileType$ = "TALK"
  164. If InStr(TheFile, ".mmm") > 0 Then FileType$ = "MOVIE"
  165. If InStr(TheFile, ".avi") > 0 Then FileType$ = "VID"
  166. Action$ = "Play " + FileType$
  167.            
  168. If InStr(TheFile, ".wav") > 0 Then
  169.            Open TheFile For Random Shared As #1
  170.            Timer2.Enabled = -1
  171.            Timer2.Interval = LOF(1) / 11
  172.          Rem assumes 11K/sec. .WAV files
  173.            Close 1
  174. End If
  175. i = mciExecute(Action$)
  176. Command2.Enabled = 0
  177. Command4.Enabled = -1
  178.                     
  179. End Sub
  180. Sub Command3_Click ()
  181. Dim i As Integer
  182. If InStr(TheFile, ".mid") > 0 Then FileType$ = "MUSIC"
  183. If InStr(TheFile, ".wav") > 0 Then FileType$ = "TALK"
  184. If InStr(TheFile, ".mmm") > 0 Then FileType$ = "MOVIE"
  185. If InStr(TheFile, ".avi") > 0 Then FileType$ = "VID"
  186. Action$ = "Close " + FileType$
  187. i = mciExecute(Action$)
  188. Command2.Enabled = 0
  189. Command3.Enabled = 0
  190. Command4.Enabled = 0
  191. Command5.Enabled = 0
  192. Command1.Enabled = -1
  193. End Sub
  194. Sub Command4_Click ()
  195. Dim i As Integer
  196. If InStr(TheFile, ".mid") > 0 Then FileType$ = "MUSIC"
  197. If InStr(TheFile, ".wav") > 0 Then FileType$ = "TALK"
  198. If InStr(TheFile, ".mmm") > 0 Then FileType$ = "MOVIE"
  199. If InStr(TheFile, ".avi") > 0 Then FileType$ = "VID"
  200. Action$ = "Pause " + FileType$
  201. i = mciExecute(Action$)
  202. If i = 1 Then
  203.   Command5.Enabled = -1
  204.   Command4.Enabled = 0
  205. End If
  206. End Sub
  207. Sub Command5_Click ()
  208. Dim i As Integer
  209. If InStr(TheFile, ".mid") > 0 Then FileType$ = "MUSIC"
  210. If InStr(TheFile, ".wav") > 0 Then FileType$ = "TALK"
  211. If InStr(TheFile, ".mmm") > 0 Then FileType$ = "MOVIE"
  212. If InStr(TheFile, ".avi") > 0 Then FileType$ = "VID"
  213. Action$ = "Play " + FileType$
  214. i = mciExecute(Action$)
  215. If i = 1 Then
  216.   Command4.Enabled = -1
  217.   Command5.Enabled = 0
  218. End If
  219. End Sub
  220. Sub Command6_Click ()
  221. Action$ = "Close all"
  222. i = mciExecute(Action$)
  223. End Sub
  224. Sub Command7_Click ()
  225. Command1.Enabled = Not Command1.Enabled
  226. Dim i As Integer
  227. Action$ = "Close All"
  228. i = mciExecute(Action$)
  229. Action$ = "Open NEW type waveaudio alias TALK"
  230. i = mciExecute(Action$)
  231. Action$ = "Record Talk"
  232. Timer1.Enabled = -1
  233. Timer1.Interval = 1000
  234. i = mciExecute(Action$)
  235. Command1.Enabled = 0
  236. Command2.Enabled = 0
  237. Command4.Enabled = -1
  238.                     
  239. End Sub
  240. Sub Command8_Click ()
  241. Command1.Enabled = Not Command1.Enabled
  242. Dim i As Integer
  243. Action$ = "Stop Talk"
  244. i = mciExecute(Action$)
  245. Action$ = "SAVE TALK MyDemo.WAV"
  246. i = mciExecute(Action$)
  247.  Action$ = "Close Talk"
  248. i = mciExecute(Action$)
  249. Call Dir1_Change
  250. TheFile = "MyDemo.WAV"
  251. Text1.Text = "Recorded File Name is MyDemo.WAV"
  252. Command2.Enabled = 0
  253. Command4.Enabled = -1
  254.                     
  255. End Sub
  256. Sub Dir1_Change ()
  257. ChDir Form1.Dir1.List(Form1.Dir1.ListIndex)
  258.  File1.Path = CurDir$
  259.  File1.Refresh
  260. End Sub
  261. Sub Drive1_Change ()
  262. ChDrive Form1.Drive1.List(Form1.Drive1.ListIndex)
  263. Dir1.Path = CurDir$
  264. Dir1.Refresh
  265. End Sub
  266. Sub File1_Click ()
  267. TheFile = File1.List(File1.ListIndex)
  268.  Command1.Enabled = -1
  269.  Text1.Text = TheFile
  270.  Action$ = "Close All"
  271.  i = mciExecute(Action$)
  272. End Sub
  273. Sub Form_Click ()
  274. Dim i As Integer
  275. A$ = ""
  276. While A$ = ""
  277. A$ = InputBox$("command:", "MCI Input", "close all                         ")
  278. i = mciExecute(A$)
  279. End Sub
  280. Sub Form_Load ()
  281. Command1.Enabled = 0
  282. Command2.Enabled = 0
  283. Command3.Enabled = 0
  284. Command4.Enabled = 0
  285. Command5.Enabled = 0
  286. End Sub
  287. Sub Timer1_Timer ()
  288. Timer1.Enabled = 0
  289. End Sub
  290. Sub Timer2_Timer ()
  291. Timer2.Enabled = 0
  292. Call Command3_Click
  293. End Sub
  294.