home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / Free / Prg / noteplayercontrol.exe / tst.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-21  |  3.9 KB  |  124 lines

  1. VERSION 5.00
  2. Object = "{6F271947-6849-11D2-B62A-00201853CFCC}#9.0#0"; "NotePlayerControl.ocx"
  3. Begin VB.Form Form1 
  4.    Caption         =   "THEMA NotePlayerControl Example"
  5.    ClientHeight    =   4125
  6.    ClientLeft      =   60
  7.    ClientTop       =   330
  8.    ClientWidth     =   4680
  9.    KeyPreview      =   -1  'True
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   275
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   312
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "Use Selected Instrument"
  17.       Default         =   -1  'True
  18.       BeginProperty Font 
  19.          Name            =   "Arial"
  20.          Size            =   8.25
  21.          Charset         =   0
  22.          Weight          =   700
  23.          Underline       =   0   'False
  24.          Italic          =   0   'False
  25.          Strikethrough   =   0   'False
  26.       EndProperty
  27.       Height          =   480
  28.       Left            =   270
  29.       TabIndex        =   3
  30.       Top             =   3495
  31.       Width           =   4140
  32.    End
  33.    Begin NotePlayerControl.NPCtrl NPCtrl1 
  34.       Left            =   300
  35.       Top             =   1110
  36.       _ExtentX        =   7170
  37.       _ExtentY        =   3466
  38.    End
  39.    Begin VB.ListBox List1 
  40.       BeginProperty Font 
  41.          Name            =   "Arial"
  42.          Size            =   8.25
  43.          Charset         =   0
  44.          Weight          =   700
  45.          Underline       =   0   'False
  46.          Italic          =   0   'False
  47.          Strikethrough   =   0   'False
  48.       EndProperty
  49.       Height          =   2580
  50.       Left            =   270
  51.       Sorted          =   -1  'True
  52.       TabIndex        =   2
  53.       Top             =   870
  54.       Width           =   4140
  55.    End
  56.    Begin VB.Label Label2 
  57.       Caption         =   "Available Instruments:"
  58.       BeginProperty Font 
  59.          Name            =   "Arial"
  60.          Size            =   8.25
  61.          Charset         =   0
  62.          Weight          =   700
  63.          Underline       =   0   'False
  64.          Italic          =   0   'False
  65.          Strikethrough   =   0   'False
  66.       EndProperty
  67.       Height          =   225
  68.       Left            =   255
  69.       TabIndex        =   1
  70.       Top             =   615
  71.       Width           =   3855
  72.    End
  73.    Begin VB.Label Label1 
  74.       Alignment       =   2  'Center
  75.       Caption         =   "Press a valid key on your keyboard"
  76.       BeginProperty Font 
  77.          Name            =   "Arial"
  78.          Size            =   11.25
  79.          Charset         =   0
  80.          Weight          =   700
  81.          Underline       =   0   'False
  82.          Italic          =   0   'False
  83.          Strikethrough   =   0   'False
  84.       EndProperty
  85.       Height          =   330
  86.       Left            =   420
  87.       TabIndex        =   0
  88.       Top             =   150
  89.       Width           =   3855
  90.    End
  91. Attribute VB_Name = "Form1"
  92. Attribute VB_GlobalNameSpace = False
  93. Attribute VB_Creatable = False
  94. Attribute VB_PredeclaredId = True
  95. Attribute VB_Exposed = False
  96. Private Sub Command1_Click()
  97. 'set the instrument of channel 1 to the selected one.
  98. NPCtrl1.SetInstrument 1, List1.List(List1.ListIndex)
  99. End Sub
  100. Private Sub Form_KeyPress(KeyAscii As Integer)
  101. Dim p As Integer
  102. Dim s As String
  103. 'look what key is pressed (C,D,E,F,G,A,B)
  104. s = Chr(KeyAscii)
  105. 'convert key that is pressed (String) to a Pitch value (Integer) using GetNote
  106. p = NPCtrl1.GetNote(s, 1)
  107. 'play the note
  108. NPCtrl1.PlayNote 1, p, 0.25, 100
  109. End Sub
  110. Private Sub Form_Load()
  111. Dim i As Integer
  112. 'Initialize the Control, very important!
  113. NPCtrl1.Initialize
  114. 'Load all available instruments in the List
  115. List1.Clear
  116. For i = 1 To NPCtrl1.GetInstrumentCount
  117.  List1.AddItem NPCtrl1.GetInstrument(i)
  118. Next i
  119. End Sub
  120. Private Sub Form_Unload(Cancel As Integer)
  121. 'DeActivate the Control, very important!
  122. NPCtrl1.Deactivate
  123. End Sub
  124.