using System;
using System.Runtime.InteropServices;

namespace DMX2
{
	public static partial class AlsaSeqLib
	{
		
		public static class Invoke
		{

			const string ASOUND_LIB_NAME = "libasound.so.2";

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_open (out IntPtr handle, string name, int streams, int mode);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_close (IntPtr seq);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_client_id (IntPtr seq);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_set_client_name (IntPtr seq, string name);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_create_simple_port (IntPtr seq, string name, uint caps, uint type);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_event_input (IntPtr seq, out IntPtr ev);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_event_input_pending (IntPtr seq, int fetch_sequencer);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_free_event (IntPtr ev);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_event_output (IntPtr seq, IntPtr ev);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_drain_output (IntPtr seq);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_info_get_client (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_next_client (IntPtr seq, IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_client_info_get_client (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_client_info_set_client (IntPtr info, int client);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_info_set_client (IntPtr info, int client);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_query_subscribe_set_client (IntPtr info, int client);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_info_set_port (IntPtr info, int val);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_query_subscribe_set_port (IntPtr info, int val);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_query_subscribe_set_index (IntPtr info, int _index);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_next_port (IntPtr seq, IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern IntPtr snd_seq_client_info_get_name (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_client_info_get_type (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern IntPtr snd_seq_port_info_get_name (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_get_any_client_info (IntPtr seq, int client, IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_get_any_port_info (IntPtr seq, int client, int port, IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern IntPtr snd_seq_port_info_get_addr (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_client_info_sizeof ();

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_port_info_sizeof ();

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_port_subscribe_sizeof ();
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_sizeof ();

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_client (IntPtr info);
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_port (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_queue (IntPtr info);
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_time_real (IntPtr info);
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_time_update (IntPtr info);
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_exclusive (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern uint snd_seq_port_info_get_capability (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern uint snd_seq_port_info_get_type (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_port_info_get_port (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_port_info_get_client (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_query_subscribe_set_root (IntPtr info, IntPtr addr);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_query_subscribe_set_type (IntPtr info, int type);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_subscribe_get_index (IntPtr info);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_query_port_subscribers (IntPtr seq, IntPtr subs);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern IntPtr snd_seq_query_subscribe_get_addr (IntPtr subs);
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern IntPtr snd_seq_query_subscribe_get_root (IntPtr subs);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_subscribe_set_sender (IntPtr info, IntPtr addr);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_subscribe_set_dest (IntPtr info, IntPtr addr);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_subscribe_set_exclusive (IntPtr info, int val);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_subscribe_set_queue (IntPtr info, int q);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_subscribe_set_time_update (IntPtr info, int val);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern void snd_seq_port_subscribe_set_time_real (IntPtr info, int val);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_subscribe_port (IntPtr handle, IntPtr sub);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_unsubscribe_port (IntPtr handle, IntPtr sub);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern IntPtr snd_strerror (int errno);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_connect_from (IntPtr handle, int myport, int src_client, int src_port);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_connect_to (IntPtr handle, int myport, int dest_client, int dest_port);
			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_disconnect_from (IntPtr handle, int myport, int src_client, int src_port);

			[DllImport(ASOUND_LIB_NAME, CallingConvention = CallingConvention.Cdecl)]
			public static extern int snd_seq_disconnect_to (IntPtr handle, int myport, int dest_client, int dest_port);

		}



	}
}
