Beispiel #1
0
 /// <summary>
 /// Creates a new <see cref="MidiDevice"/> initialized from the specified <see cref="API.MidiOutputDeviceCapabilities"/>.
 /// </summary>
 /// <param name="deviceID">An <see cref="int"/> representing the ID of the device.</param>
 /// <param name="capabilities">An <see cref="API.MidiOutputDeviceCapabilities"/> containing the MIDI device's capabilities.</param>
 internal protected MidiDevice(int deviceID, API.MidiOutputDeviceCapabilities capabilities)
 {
     this.ID     = deviceID;
     this.Name   = capabilities.DeviceName;
     this.Type   = capabilities.DeviceType;
     this.Handle = IntPtr.Zero;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes the internal list of installed MIDI output devices.
        /// </summary>
        /// <exception cref="MidiOutputDeviceException">Raises error #2: MULTIMEDIA_SYSTEM_ERROR_BAD_DEVICE_ID, the specified device ID is out of range.</exception>
        /// <exception cref="MidiOutputDeviceException">Raises error #6: MULTIMEDIA_SYSTEM_ERROR_NO_DRIVER, the driver is not installed.</exception>
        /// <exception cref="MidiOutputDeviceException">Raises error #7: MULTIMEDIA_SYSTEM_ERROR_NO_MEM, the system is unable to allocate or lock memory.</exception>
        /// <exception cref="MidiOutputDeviceException">Raises error #11: MULTIMEDIA_SYSTEM_ERROR_INVALID_PARAMETER, the specified pointer or structure is invalid.</exception>
        private static void InitializeMidiOutputDeviceList()
        {
            _MidiOutputDevices = new MidiOutputDevice[API.MidiOutputDeviceCount()];

            for (int deviceID = 0; deviceID < _MidiOutputDevices.Length; deviceID++)
            {
                API.MidiOutputDeviceCapabilities capabilities = new API.MidiOutputDeviceCapabilities();

                MidiOutputDevice.InvalidateResult(API.GetMidiOutputDeviceCapabilities(deviceID, ref capabilities));

                _MidiOutputDevices[deviceID] = new MidiOutputDevice(deviceID, capabilities);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Private contstructor to create and initialize a new <see cref="MidiOutputDevice"/>, only invoked by the <see cref="InitializeDeviceList"/> method.
 /// </summary>
 /// <param name="deviceID">An <see cref="int"/> representing the unique indexed <see cref="MidiOutputDevice"/>'s ID.</param>
 /// <param name="capabilities">An <see cref="API.MidiOutputDeviceCapabilities"/> structure to store the <see cref="MidiOutputDevice"/>'s capabilities.</param>
 internal MidiOutputDevice(int deviceID, API.MidiOutputDeviceCapabilities capabilities) : base(deviceID, capabilities)
 {
     _Capabilities = capabilities;
     _Callback     = Callback;
 }