home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{6F271947-6849-11D2-B62A-00201853CFCC}#9.0#0"; "NotePlayerControl.ocx"
- Begin VB.Form Form1
- Caption = "THEMA NotePlayerControl Example"
- ClientHeight = 4125
- ClientLeft = 60
- ClientTop = 330
- ClientWidth = 4680
- KeyPreview = -1 'True
- LinkTopic = "Form1"
- ScaleHeight = 275
- ScaleMode = 3 'Pixel
- ScaleWidth = 312
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Use Selected Instrument"
- Default = -1 'True
- BeginProperty Font
- Name = "Arial"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 480
- Left = 270
- TabIndex = 3
- Top = 3495
- Width = 4140
- End
- Begin NotePlayerControl.NPCtrl NPCtrl1
- Left = 300
- Top = 1110
- _ExtentX = 7170
- _ExtentY = 3466
- End
- Begin VB.ListBox List1
- BeginProperty Font
- Name = "Arial"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2580
- Left = 270
- Sorted = -1 'True
- TabIndex = 2
- Top = 870
- Width = 4140
- End
- Begin VB.Label Label2
- Caption = "Available Instruments:"
- BeginProperty Font
- Name = "Arial"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 225
- Left = 255
- TabIndex = 1
- Top = 615
- Width = 3855
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- Caption = "Press a valid key on your keyboard"
- BeginProperty Font
- Name = "Arial"
- Size = 11.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 330
- Left = 420
- TabIndex = 0
- Top = 150
- Width = 3855
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- 'set the instrument of channel 1 to the selected one.
- NPCtrl1.SetInstrument 1, List1.List(List1.ListIndex)
- End Sub
- Private Sub Form_KeyPress(KeyAscii As Integer)
- Dim p As Integer
- Dim s As String
- 'look what key is pressed (C,D,E,F,G,A,B)
- s = Chr(KeyAscii)
- 'convert key that is pressed (String) to a Pitch value (Integer) using GetNote
- p = NPCtrl1.GetNote(s, 1)
- 'play the note
- NPCtrl1.PlayNote 1, p, 0.25, 100
- End Sub
- Private Sub Form_Load()
- Dim i As Integer
- 'Initialize the Control, very important!
- NPCtrl1.Initialize
- 'Load all available instruments in the List
- List1.Clear
- For i = 1 To NPCtrl1.GetInstrumentCount
- List1.AddItem NPCtrl1.GetInstrument(i)
- Next i
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- 'DeActivate the Control, very important!
- NPCtrl1.Deactivate
- End Sub
-