home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / volume1a / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-12-02  |  3.7 KB  |  115 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Mixer API Test"
  4.    ClientHeight    =   1785
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1785
  10.    ScaleWidth      =   4680
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.TextBox Text2 
  13.       Height          =   375
  14.       Left            =   1320
  15.       TabIndex        =   3
  16.       Text            =   "0"
  17.       Top             =   840
  18.       Width           =   1335
  19.    End
  20.    Begin VB.TextBox Text1 
  21.       Height          =   375
  22.       Left            =   1320
  23.       TabIndex        =   2
  24.       Text            =   "0"
  25.       Top             =   120
  26.       Width           =   1335
  27.    End
  28.    Begin VB.CommandButton Command2 
  29.       Caption         =   "Mic Vol"
  30.       Height          =   375
  31.       Left            =   120
  32.       TabIndex        =   1
  33.       Top             =   840
  34.       Width           =   975
  35.    End
  36.    Begin VB.CommandButton Command1 
  37.       Caption         =   "Out Volume"
  38.       Height          =   375
  39.       Left            =   120
  40.       TabIndex        =   0
  41.       Top             =   120
  42.       Width           =   975
  43.    End
  44.    Begin VB.Label Label2 
  45.       Height          =   375
  46.       Left            =   2760
  47.       TabIndex        =   5
  48.       Top             =   840
  49.       Width           =   1815
  50.    End
  51.    Begin VB.Label Label1 
  52.       Height          =   375
  53.       Left            =   2760
  54.       TabIndex        =   4
  55.       Top             =   120
  56.       Width           =   1815
  57.    End
  58. Attribute VB_Name = "Form1"
  59. Attribute VB_GlobalNameSpace = False
  60. Attribute VB_Creatable = False
  61. Attribute VB_PredeclaredId = True
  62. Attribute VB_Exposed = False
  63.       Option Explicit
  64.       
  65.       Dim hmixer As Long          ' mixer handle
  66.       Dim volCtrl As MIXERCONTROL ' waveout volume control
  67.       Dim micCtrl As MIXERCONTROL ' microphone volume control
  68.       Dim rc As Long              ' return code
  69.       Dim ok As Boolean           ' boolean return code
  70.       
  71.       Private Sub Form_Load()
  72.       ' Open the mixer with deviceID 0.
  73.          rc = mixerOpen(hmixer, 0, 0, 0, 0)
  74.          If ((MMSYSERR_NOERROR <> rc)) Then
  75.              MsgBox "Couldn't open the mixer."
  76.              Exit Sub
  77.              End If
  78.              
  79.          ' Get the waveout volume control
  80.          ok = GetVolumeControl(hmixer, _
  81.                               MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, _
  82.                               MIXERCONTROL_CONTROLTYPE_VOLUME, _
  83.                               volCtrl)
  84.          If (ok = True) Then
  85.              ' If the function successfully gets the volume control,
  86.              ' the maximum and minimum values are specified by
  87.              ' lMaximum and lMinimum
  88.              Label1.Caption = volCtrl.lMinimum _
  89.                               & " to " _
  90.                               & volCtrl.lMaximum
  91.              End If
  92.              
  93.          ' Get the microphone volume control
  94.          ok = GetVolumeControl(hmixer, _
  95.                               MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, _
  96.                               MIXERCONTROL_CONTROLTYPE_VOLUME, _
  97.                               micCtrl)
  98.          If (ok = True) Then
  99.              Label2.Caption = micCtrl.lMinimum _
  100.                               & " to " _
  101.                               & micCtrl.lMaximum
  102.              End If
  103.       End Sub
  104.       
  105.       Private Sub Command1_Click()
  106.          vol = CLng(Text1.Text)
  107.          SetVolumeControl hmixer, volCtrl, vol
  108.       End Sub
  109.       
  110.       Private Sub Command2_Click()
  111.          vol = CLng(Text2.Text)
  112.          SetVolumeControl hmixer, micCtrl, vol
  113.       End Sub
  114.       
  115.