home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / omegavol / sample.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-06-28  |  12.6 KB  |  426 lines

  1. VERSION 5.00
  2. Object = "{A7127494-0AF9-11D2-ABBA-444553540000}#2.0#0"; "OVOL.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  4. Begin VB.Form frmOVolSample 
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "OVol V2.0 Example Program"
  7.    ClientHeight    =   5595
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   6480
  11.    Icon            =   "Sample.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5595
  16.    ScaleWidth      =   6480
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   3  'Windows Default
  19.    Begin VB.Timer Timer1 
  20.       Interval        =   200
  21.       Left            =   2640
  22.       Top             =   2580
  23.    End
  24.    Begin ComctlLib.Slider Slider1 
  25.       Height          =   450
  26.       Index           =   0
  27.       Left            =   2340
  28.       TabIndex        =   0
  29.       Top             =   240
  30.       Width           =   2955
  31.       _ExtentX        =   5212
  32.       _ExtentY        =   794
  33.       _Version        =   327682
  34.       LargeChange     =   20
  35.       Max             =   100
  36.       TickFrequency   =   5
  37.    End
  38.    Begin prjOVol.OVol OVol1 
  39.       Left            =   3000
  40.       Top             =   2460
  41.       _ExtentX        =   847
  42.       _ExtentY        =   847
  43.       Bass            =   50.001
  44.       Treble          =   100
  45.       VolumeCd        =   29.804
  46.       VolumeLineIn    =   50.001
  47.       VolumeMaster    =   32.941
  48.       VolumeMicrophone=   50.001
  49.       VolumeMidiOut   =   49.804
  50.       VolumePcSpeaker =   50.001
  51.       VolumeWaveOut   =   49.804
  52.       DeviceNameBass  =   "Master Bass Level"
  53.       DeviceNameTreble=   "Master Treble Level"
  54.       DeviceNameCd    =   "CD Audio Volume Level"
  55.       DeviceNameLineIn=   "Line-In Volume Level"
  56.       DeviceNameMaster=   "Master Volume Level"
  57.       DeviceNameMicrophone=   "Microphone Volume Level"
  58.       DeviceNameMidiOut=   "MIDI Volume Level"
  59.       DeviceNamePcSpeaker=   "PC Speaker Volume Level"
  60.       DeviceNameWaveOut=   "Wave Output Volume Level"
  61.    End
  62.    Begin VB.CheckBox chkMuted 
  63.       Caption         =   "Muted"
  64.       Height          =   195
  65.       Index           =   0
  66.       Left            =   5460
  67.       TabIndex        =   1
  68.       Top             =   240
  69.       Width           =   855
  70.    End
  71.    Begin VB.CommandButton cmdExit 
  72.       Caption         =   "Close"
  73.       Height          =   315
  74.       Left            =   5580
  75.       TabIndex        =   16
  76.       Top             =   5160
  77.       Width           =   795
  78.    End
  79.    Begin VB.CheckBox chkMuted 
  80.       Caption         =   "Muted"
  81.       Height          =   195
  82.       Index           =   1
  83.       Left            =   5460
  84.       TabIndex        =   5
  85.       Top             =   1860
  86.       Width           =   855
  87.    End
  88.    Begin VB.CheckBox chkMuted 
  89.       Caption         =   "Muted"
  90.       Height          =   195
  91.       Index           =   2
  92.       Left            =   5460
  93.       TabIndex        =   7
  94.       Top             =   2400
  95.       Width           =   855
  96.    End
  97.    Begin VB.CheckBox chkMuted 
  98.       Caption         =   "Muted"
  99.       Height          =   195
  100.       Index           =   3
  101.       Left            =   5460
  102.       TabIndex        =   9
  103.       Top             =   2940
  104.       Width           =   855
  105.    End
  106.    Begin VB.CheckBox chkMuted 
  107.       Caption         =   "Muted"
  108.       Height          =   195
  109.       Index           =   4
  110.       Left            =   5460
  111.       TabIndex        =   11
  112.       Top             =   3480
  113.       Width           =   855
  114.    End
  115.    Begin VB.CheckBox chkMuted 
  116.       Caption         =   "Muted"
  117.       Height          =   195
  118.       Index           =   5
  119.       Left            =   5460
  120.       TabIndex        =   13
  121.       Top             =   4020
  122.       Width           =   855
  123.    End
  124.    Begin VB.CheckBox chkMuted 
  125.       Caption         =   "Muted"
  126.       Height          =   195
  127.       Index           =   6
  128.       Left            =   5460
  129.       TabIndex        =   15
  130.       Top             =   4560
  131.       Width           =   855
  132.    End
  133.    Begin ComctlLib.Slider Slider1 
  134.       Height          =   450
  135.       Index           =   1
  136.       Left            =   2340
  137.       TabIndex        =   2
  138.       Top             =   780
  139.       Width           =   2955
  140.       _ExtentX        =   5212
  141.       _ExtentY        =   794
  142.       _Version        =   327682
  143.       LargeChange     =   20
  144.       Max             =   100
  145.       TickFrequency   =   5
  146.    End
  147.    Begin ComctlLib.Slider Slider1 
  148.       Height          =   450
  149.       Index           =   2
  150.       Left            =   2340
  151.       TabIndex        =   3
  152.       Top             =   1320
  153.       Width           =   2955
  154.       _ExtentX        =   5212
  155.       _ExtentY        =   794
  156.       _Version        =   327682
  157.       LargeChange     =   20
  158.       Max             =   100
  159.       TickFrequency   =   5
  160.    End
  161.    Begin ComctlLib.Slider Slider1 
  162.       Height          =   450
  163.       Index           =   3
  164.       Left            =   2340
  165.       TabIndex        =   4
  166.       Top             =   1860
  167.       Width           =   2955
  168.       _ExtentX        =   5212
  169.       _ExtentY        =   794
  170.       _Version        =   327682
  171.       LargeChange     =   20
  172.       Max             =   100
  173.       TickFrequency   =   5
  174.    End
  175.    Begin ComctlLib.Slider Slider1 
  176.       Height          =   450
  177.       Index           =   4
  178.       Left            =   2340
  179.       TabIndex        =   6
  180.       Top             =   2400
  181.       Width           =   2955
  182.       _ExtentX        =   5212
  183.       _ExtentY        =   794
  184.       _Version        =   327682
  185.       LargeChange     =   20
  186.       Max             =   100
  187.       TickFrequency   =   5
  188.    End
  189.    Begin ComctlLib.Slider Slider1 
  190.       Height          =   450
  191.       Index           =   5
  192.       Left            =   2340
  193.       TabIndex        =   8
  194.       Top             =   2940
  195.       Width           =   2955
  196.       _ExtentX        =   5212
  197.       _ExtentY        =   794
  198.       _Version        =   327682
  199.       LargeChange     =   20
  200.       Max             =   100
  201.       TickFrequency   =   5
  202.    End
  203.    Begin ComctlLib.Slider Slider1 
  204.       Height          =   450
  205.       Index           =   6
  206.       Left            =   2340
  207.       TabIndex        =   10
  208.       Top             =   3480
  209.       Width           =   2955
  210.       _ExtentX        =   5212
  211.       _ExtentY        =   794
  212.       _Version        =   327682
  213.       LargeChange     =   20
  214.       Max             =   100
  215.       TickFrequency   =   5
  216.    End
  217.    Begin ComctlLib.Slider Slider1 
  218.       Height          =   450
  219.       Index           =   7
  220.       Left            =   2340
  221.       TabIndex        =   12
  222.       Top             =   4020
  223.       Width           =   2955
  224.       _ExtentX        =   5212
  225.       _ExtentY        =   794
  226.       _Version        =   327682
  227.       LargeChange     =   20
  228.       Max             =   100
  229.       TickFrequency   =   5
  230.    End
  231.    Begin ComctlLib.Slider Slider1 
  232.       Height          =   450
  233.       Index           =   8
  234.       Left            =   2340
  235.       TabIndex        =   14
  236.       Top             =   4560
  237.       Width           =   2955
  238.       _ExtentX        =   5212
  239.       _ExtentY        =   794
  240.       _Version        =   327682
  241.       LargeChange     =   20
  242.       Max             =   100
  243.       TickFrequency   =   5
  244.    End
  245.    Begin VB.Label Label1 
  246.       Height          =   255
  247.       Index           =   0
  248.       Left            =   120
  249.       TabIndex        =   25
  250.       Top             =   240
  251.       Width           =   2145
  252.    End
  253.    Begin VB.Label Label1 
  254.       Height          =   255
  255.       Index           =   1
  256.       Left            =   120
  257.       TabIndex        =   24
  258.       Top             =   780
  259.       Width           =   2145
  260.    End
  261.    Begin VB.Label Label1 
  262.       Height          =   255
  263.       Index           =   2
  264.       Left            =   120
  265.       TabIndex        =   23
  266.       Top             =   1320
  267.       Width           =   2145
  268.    End
  269.    Begin VB.Label Label1 
  270.       Height          =   255
  271.       Index           =   3
  272.       Left            =   120
  273.       TabIndex        =   22
  274.       Top             =   1860
  275.       Width           =   2145
  276.    End
  277.    Begin VB.Label Label1 
  278.       Height          =   255
  279.       Index           =   4
  280.       Left            =   120
  281.       TabIndex        =   21
  282.       Top             =   2400
  283.       Width           =   2145
  284.    End
  285.    Begin VB.Label Label1 
  286.       Height          =   255
  287.       Index           =   5
  288.       Left            =   120
  289.       TabIndex        =   20
  290.       Top             =   2940
  291.       Width           =   2145
  292.    End
  293.    Begin VB.Label Label1 
  294.       Height          =   255
  295.       Index           =   6
  296.       Left            =   120
  297.       TabIndex        =   19
  298.       Top             =   3480
  299.       Width           =   2145
  300.    End
  301.    Begin VB.Label Label1 
  302.       Height          =   255
  303.       Index           =   7
  304.       Left            =   120
  305.       TabIndex        =   18
  306.       Top             =   4020
  307.       Width           =   2145
  308.    End
  309.    Begin VB.Label Label1 
  310.       Height          =   255
  311.       Index           =   8
  312.       Left            =   120
  313.       TabIndex        =   17
  314.       Top             =   4560
  315.       Width           =   2145
  316.    End
  317. Attribute VB_Name = "frmOVolSample"
  318. Attribute VB_GlobalNameSpace = False
  319. Attribute VB_Creatable = False
  320. Attribute VB_PredeclaredId = True
  321. Attribute VB_Exposed = False
  322. Private Sub chkMuted_Click(Index As Integer)
  323.     'set the mute state to the checkbox value
  324.     Dim Temp As Boolean
  325.     Temp = CBool(chkMuted(Index).Value)
  326.     Select Case Index
  327.     Case 0  'master
  328.         OVol1.MutedMaster = Temp
  329.     Case 1  'wave
  330.         OVol1.MutedWaveOut = Temp
  331.     Case 2  'midi
  332.         OVol1.MutedMidiOut = Temp
  333.     Case 3  'cd
  334.         OVol1.MutedCd = Temp
  335.     Case 4  'line in
  336.         OVol1.MutedLineIn = Temp
  337.     Case 5  'microphone
  338.         OVol1.MutedMicrophone = Temp
  339.     Case 6  'pc speaker
  340.         OVol1.MutedPcSpeaker = Temp
  341.     End Select
  342. End Sub
  343. Private Sub cmdExit_Click()
  344.     'Never use that evil END command!
  345.     Unload Me
  346. End Sub
  347. Private Sub Form_Load()
  348.     'show the intial values
  349.     ShowNames
  350.     ShowLevels
  351.     ShowMute
  352. End Sub
  353. Public Sub ShowNames()
  354.     'show the names of the devices according to Windows
  355.     Label1(0) = OVol1.DeviceNameMaster
  356.     Label1(1) = OVol1.DeviceNameBass
  357.     Label1(2) = OVol1.DeviceNameTreble
  358.     Label1(3) = OVol1.DeviceNameWaveOut
  359.     Label1(4) = OVol1.DeviceNameMidiOut
  360.     Label1(5) = OVol1.DeviceNameCd
  361.     Label1(6) = OVol1.DeviceNameLineIn
  362.     Label1(7) = OVol1.DeviceNameMicrophone
  363.     Label1(8) = OVol1.DeviceNamePcSpeaker
  364. End Sub
  365. Public Sub ShowLevels()
  366.     'set the sliders to the various sound/tone levels
  367.     Slider1(0) = OVol1.VolumeMaster
  368.     Slider1(1) = OVol1.Bass
  369.     Slider1(2) = OVol1.Treble
  370.     Slider1(3) = OVol1.VolumeWaveOut
  371.     Slider1(4) = OVol1.VolumeMidiOut
  372.     Slider1(5) = OVol1.VolumeCd
  373.     Slider1(6) = OVol1.VolumeLineIn
  374.     Slider1(7) = OVol1.VolumeMicrophone
  375.     Slider1(8) = OVol1.VolumePcSpeaker
  376. End Sub
  377. Public Sub ShowMute()
  378.     'show the state of the mute checkbox on the mixer
  379.     chkMuted(0).Value = Abs(CInt(OVol1.MutedMaster))
  380.     chkMuted(1).Value = Abs(CInt(OVol1.MutedWaveOut))
  381.     chkMuted(2).Value = Abs(CInt(OVol1.MutedMidiOut))
  382.     chkMuted(3).Value = Abs(CInt(OVol1.MutedCd))
  383.     chkMuted(4).Value = Abs(CInt(OVol1.MutedLineIn))
  384.     chkMuted(5).Value = Abs(CInt(OVol1.MutedMicrophone))
  385.     chkMuted(6).Value = Abs(CInt(OVol1.MutedPcSpeaker))
  386. End Sub
  387. Private Sub Form_Unload(Cancel As Integer)
  388.     'release memory back to the system
  389.     Set frmOVolSample = Nothing
  390. End Sub
  391. Private Sub Slider1_Click(Index As Integer)
  392.     'set the volume/tone to the slider's value
  393.     Dim Temp As Single
  394.     Temp = CSng(Slider1(Index).Value)
  395.     Select Case Index
  396.     Case 0
  397.         OVol1.VolumeMaster = Temp
  398.     Case 1
  399.         OVol1.Bass = Temp
  400.     Case 2
  401.         OVol1.Treble = Temp
  402.     Case 3
  403.         OVol1.VolumeWaveOut = Temp
  404.     Case 4
  405.         OVol1.VolumeMidiOut = Temp
  406.     Case 5
  407.         OVol1.VolumeCd = Temp
  408.     Case 6
  409.         OVol1.VolumeLineIn = Temp
  410.     Case 7
  411.         OVol1.VolumeMicrophone = Temp
  412.     Case 8
  413.         OVol1.VolumePcSpeaker = Temp
  414.     End Select
  415. End Sub
  416. Private Sub Timer1_Timer()
  417.     'update the display every 1/5 of a second
  418.     'NOTE:Making too many consecutive reads too quickly
  419.     'can cause the OCX to cease to work. The reason is that
  420.     'the OCX doesn't have the time to update itself before
  421.     'the next call, causing a stack overflow. This is
  422.     'normal behavior, not a bug.
  423.     ShowLevels
  424.     ShowMute
  425. End Sub
  426.