예제 #1
0
        public static RtMidiApi [] GetAvailableApis()
        {
            int    enumSize = RtMidi.rtmidi_sizeof_rtmidi_api();
            IntPtr ptr      = IntPtr.Zero;
            int    size     = RtMidi.rtmidi_get_compiled_api(ref ptr);

            ptr = Marshal.AllocHGlobal(size * enumSize);
            RtMidi.rtmidi_get_compiled_api(ref ptr);
            RtMidiApi [] ret = new RtMidiApi [size];
            switch (enumSize)
            {
            case 1:
                byte [] bytes = new byte [size];
                Marshal.Copy(ptr, bytes, 0, bytes.Length);
                for (int i = 0; i < bytes.Length; i++)
                {
                    ret [i] = (RtMidiApi)bytes [i];
                }
                break;

            case 2:
                short [] shorts = new short [size];
                Marshal.Copy(ptr, shorts, 0, shorts.Length);
                for (int i = 0; i < shorts.Length; i++)
                {
                    ret [i] = (RtMidiApi)shorts [i];
                }
                break;

            case 4:
                int [] ints = new int [size];
                Marshal.Copy(ptr, ints, 0, ints.Length);
                for (int i = 0; i < ints.Length; i++)
                {
                    ret [i] = (RtMidiApi)ints [i];
                }
                break;

            case 8:
                long [] longs = new long [size];
                Marshal.Copy(ptr, longs, 0, longs.Length);
                for (int i = 0; i < longs.Length; i++)
                {
                    ret [i] = (RtMidiApi)longs [i];
                }
                break;

            default:
                throw new NotSupportedException("sizeof RtMidiApi is unexpected: " + enumSize);
            }
            return(ret);
        }
예제 #2
0
 /// <summary>
 /// Create a RtMidiOutPtr value, with given and clientName.
 /// </summary>
 /// <param name="api">An optional API id can be specified.</param>
 /// <param name="clientName">An optional client name can be specified. This
 /// will be used to group the ports that are created by the application.</param>
 internal static RtMidiOutPtr Create(RtMidiApi api, string clientName) => Is64Bit
     ? RtMidiC64.Output.Create(api, clientName)
     : RtMidiC32.Output.Create(api, clientName);
예제 #3
0
 /// <summary>
 /// Create a  RtMidiInPtr value, with given api, clientName and queueSizeLimit.
 /// </summary>
 /// <param name="api">An optional API id can be specified.</param>
 /// <param name="clientName">
 /// An optional client name can be specified. This will be used to group the ports that
 /// are created by the application.
 /// </param>
 /// <param name="queueSizeLimit">An optional size of the MIDI input queue can be specified.</param>
 internal static RtMidiInPtr Create(RtMidiApi api, string clientName, uint queueSizeLimit) => Is64Bit
     ? RtMidiC64.Input.Create(api, clientName, queueSizeLimit)
     : RtMidiC32.Input.Create(api, clientName, queueSizeLimit);
예제 #4
0
 static extern internal RtMidiInPtr rtmidi_in_create(RtMidiApi api, string clientName, uint queueSizeLimit);
예제 #5
0
 public RtMidiOutputDevice(RtMidiApi api, string clientName)
     : base(RtMidi.rtmidi_out_create(api, clientName))
 {
 }
예제 #6
0
 public RtMidiInputDevice(RtMidiApi api, string clientName, int queueSizeLimit = 100)
     : base(RtMidi.rtmidi_in_create(api, clientName, (uint)queueSizeLimit))
 {
 }
예제 #7
0
 internal static extern IntPtr Create(RtMidiApi api, string clientName);
예제 #8
0
 static extern internal RtMidiOutPtr rtmidi_out_create(RtMidiApi api, string clientName);
예제 #9
0
 public static extern IntPtr rtmidi_in_create(RtMidiApi api, string clientName, uint queueSizeLimit);
예제 #10
0
 internal static extern IntPtr Create(RtMidiApi api, string clientName, uint queueSizeLimit);
예제 #11
0
 public RtMidiOutputDevice(RtMidiApi api, string clientName)
     : base(RtMidi.rtmidi_out_create (api, clientName))
 {
 }
예제 #12
0
 public RtMidiInputDevice(RtMidiApi api, string clientName, int queueSizeLimit = 100)
     : base(RtMidi.rtmidi_in_create (api, clientName, (uint) queueSizeLimit))
 {
 }
예제 #13
0
 public static RtMidiApi[] GetAvailableApis()
 {
     int enumSize = RtMidi.rtmidi_sizeof_rtmidi_api ();
     IntPtr ptr = IntPtr.Zero;
     int size = RtMidi.rtmidi_get_compiled_api (ref ptr);
     ptr = Marshal.AllocHGlobal (size * enumSize);
     RtMidi.rtmidi_get_compiled_api (ref ptr);
     RtMidiApi [] ret = new RtMidiApi [size];
     switch (enumSize) {
     case 1:
         byte [] bytes = new byte [size];
         Marshal.Copy (ptr, bytes, 0, bytes.Length);
         for (int i = 0; i < bytes.Length; i++)
             ret [i] = (RtMidiApi) bytes [i];
         break;
     case 2:
         short [] shorts = new short [size];
         Marshal.Copy (ptr, shorts, 0, shorts.Length);
         for (int i = 0; i < shorts.Length; i++)
             ret [i] = (RtMidiApi) shorts [i];
         break;
     case 4:
         int [] ints = new int [size];
         Marshal.Copy (ptr, ints, 0, ints.Length);
         for (int i = 0; i < ints.Length; i++)
             ret [i] = (RtMidiApi) ints [i];
         break;
     case 8:
         long [] longs = new long [size];
         Marshal.Copy (ptr, longs, 0, longs.Length);
         for (int i = 0; i < longs.Length; i++)
             ret [i] = (RtMidiApi) longs [i];
         break;
     default:
         throw new NotSupportedException ("sizeof RtMidiApi is unexpected: " + enumSize);
     }
     return ret;
 }
예제 #14
0
 internal static extern RtMidiOutPtr rtmidi_out_create(RtMidiApi api, string clientName);
예제 #15
0
 internal static extern RtMidiInPtr rtmidi_in_create(RtMidiApi api, string clientName, uint queueSizeLimit);