home *** CD-ROM | disk | FTP | other *** search
/ Multimédia la Compil' 2 / Sybex_Multimedia_La_Compil_2.iso / cooltool / midimixr / mixer.bas < prev   
BASIC Source File  |  1995-04-20  |  3KB  |  97 lines

  1. Global Const Modal = 1
  2.  
  3. Global lVolume As Integer
  4. Global rVolume As Integer
  5.  
  6. ' MousePointer
  7. Global Const DEFAULT = 0        ' 0 - Default
  8. Global Const ARROW = 1          ' 1 - Arrow
  9. Global Const CROSSHAIR = 2      ' 2 - Cross
  10. Global Const IBEAM = 3          ' 3 - I-Beam
  11. Global Const ICON_POINTER = 4   ' 4 - Icon
  12. Global Const SIZE_POINTER = 5   ' 5 - Size
  13. Global Const SIZE_NE_SW = 6     ' 6 - Size NE SW
  14. Global Const SIZE_N_S = 7       ' 7 - Size N S
  15. Global Const SIZE_NW_SE = 8     ' 8 - Size NW SE
  16. Global Const SIZE_W_E = 9       ' 9 - Size W E
  17. Global Const UP_ARROW = 10      ' 10 - Up Arrow
  18. Global Const HOURGLASS = 11     ' 11 - Hourglass
  19. Global Const NO_DROP = 12       ' 12 - No drop
  20.  
  21.  
  22.  
  23.  
  24.  
  25. Sub MIDIInOpen ()
  26.     If FormMidiMixr.MIDIInput1.State >= MIDISTATE_OPEN Then
  27.         ' Close midiin port
  28.         FormMidiMixr.MIDIInput1.Action = MIDIIN_CLOSE
  29.     End If
  30.  
  31.     
  32.     ' Get selected device id
  33.     FormMidiMixr.MIDIInput1.DeviceID = MIDISetupForm.ComboMidiIn.ListIndex
  34.     
  35.     ' Open and display handle
  36.     FormMidiMixr.MIDIInput1.Action = MIDIIN_OPEN
  37.  
  38.     ' Start midi input
  39.     FormMidiMixr.MIDIInput1.Action = MIDIIN_START
  40.     
  41. End Sub
  42.  
  43. Sub MIDIOutOpen ()
  44.  
  45.     If FormMidiMixr.MIDIOutput1.State >= MIDISTATE_OPEN Or FormMidiMixr.MIDIOutput1.DeviceID = -1 Then
  46.         ' Restore volume before closing
  47.         If (FormMidiMixr.MIDIOutput1.HasLRVolume) Then
  48.             FormMidiMixr.MIDIOutput1.VolumeLeft = lVolume
  49.             FormMidiMixr.MIDIOutput1.VolumeRight = rVolume
  50.         ElseIf (FormMidiMixr.MIDIOutput1.HasVolume) Then
  51.             FormMidiMixr.MIDIOutput1.VolumeLeft = lVolume
  52.         End If
  53.     
  54.         ' Close
  55.         FormMidiMixr.MIDIOutput1.Action = MIDIOUT_CLOSE
  56.     
  57.         ' Restore defaults
  58.         FormMidiMixr.Knob1.Enabled = False
  59.         FormMidiMixr.Knob1.Value = 0
  60.     End If
  61.     
  62.  
  63.     ' Open selected device
  64.     FormMidiMixr.MIDIOutput1.DeviceID = MIDISetupForm.ComboMidiOut.ListIndex - 1
  65.     FormMidiMixr.MIDIOutput1.Action = MIDIOUT_OPEN
  66.     ' Display device handle
  67.  
  68.     If (FormMidiMixr.MIDIOutput1.HMidiDevice <> 0) Then
  69.         
  70.         ' If device supports volume, save starting volume
  71.         If (FormMidiMixr.MIDIOutput1.HasLRVolume) Then
  72.             FormMidiMixr.Knob1.Enabled = True
  73.             FormMidiMixr.Knob1.Value = FormMidiMixr.MIDIOutput1.VolumeLeft
  74.             FormMidiMixr.MIDIOutput1.VolumeRight = FormMidiMixr.Knob1.Value
  75.             lVolume = FormMidiMixr.Knob1.Value
  76.             rVolume = FormMidiMixr.Knob1.Value
  77.         ElseIf (FormMidiMixr.MIDIOutput1.HasVolume) Then
  78.             FormMidiMixr.Knob1.Enabled = True
  79.             FormMidiMixr.Knob1.Value = FormMidiMixr.MIDIOutput1.VolumeLeft
  80.             lVolume = FormMidiMixr.Knob1.Value
  81.         End If
  82.     End If
  83.  
  84. End Sub
  85.  
  86. Sub MidiOutputSend (Message As Integer, Data1 As Integer, Data2 As Integer, TimeVal As Long)
  87.     FormMidiMixr.MIDIOutput1.Message = Message
  88.     FormMidiMixr.MIDIOutput1.Data1 = Data1
  89.     FormMidiMixr.MIDIOutput1.Data2 = Data2
  90.     FormMidiMixr.MIDIOutput1.Time = TimeVal
  91.         
  92.     'Tell MIDIOutput1 to send the MIDI data
  93.     FormMidiMixr.MIDIOutput1.Action = MIDIOUT_SEND
  94.  
  95. End Sub
  96.  
  97.