package bass;
import java.text.MessageFormat;

import com.sun.jna.Callback;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;

import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.BA.ShortName;

/**
 * Bass Library
 * @author rdkartono
 *
 */
public interface BassLibrary extends Library {
	
	BassLibrary BASS = (BassLibrary)Native.load("bass", BassLibrary.class);
	
	public interface Constant{
		public static final int BASSVERSION = 0x204;	// API version
		public static final String BASSVERSIONTEXT = "2.4";
		// Error codes returned by BASS_ErrorGetCode
		public static final int BASS_OK = 0;	// all is OK
		public static final int BASS_ERROR_MEM = 1;	// memory error
		public static final int BASS_ERROR_FILEOPEN = 2;	// can't open the file
		public static final int BASS_ERROR_DRIVER = 3;	// can't find a free/valid driver
		public static final int BASS_ERROR_BUFLOST = 4;	// the sample buffer was lost
		public static final int BASS_ERROR_HANDLE = 5;	// invalid handle
		public static final int BASS_ERROR_FORMAT = 6;	// unsupported sample format
		public static final int BASS_ERROR_POSITION = 7;	// invalid position
		public static final int BASS_ERROR_INIT = 8;	// BASS_Init has not been successfully called
		public static final int BASS_ERROR_START = 9;	// BASS_Start has not been successfully called
		public static final int BASS_ERROR_SSL = 10;	// SSL/HTTPS support isn't available
		public static final int BASS_ERROR_REINIT = 11;	// device needs to be reinitialized
		public static final int BASS_ERROR_ALREADY = 14;	// already initialized/paused/whatever
		public static final int BASS_ERROR_NOTAUDIO = 17;	// file does not contain audio
		public static final int BASS_ERROR_NOCHAN = 18;	// can't get a free channel
		public static final int BASS_ERROR_ILLTYPE = 19;	// an illegal type was specified
		public static final int BASS_ERROR_ILLPARAM = 20;	// an illegal parameter was specified
		public static final int BASS_ERROR_NO3D = 21;	// no 3D support
		public static final int BASS_ERROR_NOEAX = 22;	// no EAX support
		public static final int BASS_ERROR_DEVICE = 23;	// illegal device number
		public static final int BASS_ERROR_NOPLAY = 24;	// not playing
		public static final int BASS_ERROR_FREQ = 25;	// illegal sample rate
		public static final int BASS_ERROR_NOTFILE = 27;	// the stream is not a file stream
		public static final int BASS_ERROR_NOHW = 29;	// no hardware voices available
		public static final int BASS_ERROR_EMPTY = 31;	// the file has no sample data
		public static final int BASS_ERROR_NONET = 32;	// no internet connection could be opened
		public static final int BASS_ERROR_CREATE = 33;	// couldn't create the file
		public static final int BASS_ERROR_NOFX = 34;	// effects are not available
		public static final int BASS_ERROR_NOTAVAIL = 37;	// requested data/action is not available
		public static final int BASS_ERROR_DECODE = 38;	// the channel is a "decoding channel"
		public static final int BASS_ERROR_DX = 39;	// a sufficient DirectX version is not installed
		public static final int BASS_ERROR_TIMEOUT = 40;	// connection timedout
		public static final int BASS_ERROR_FILEFORM = 41;	// unsupported file format
		public static final int BASS_ERROR_SPEAKER = 42;	// unavailable speaker
		public static final int BASS_ERROR_VERSION = 43;	// invalid BASS version (used by add-ons)
		public static final int BASS_ERROR_CODEC = 44;	// codec is not available/supported
		public static final int BASS_ERROR_ENDED = 45;	// the channel/file has ended
		public static final int BASS_ERROR_BUSY = 46;	// the device is busy
		public static final int BASS_ERROR_UNSTREAMABLE = 47; // unstreamable file
		public static final int BASS_ERROR_PROTOCOL = 48;	// unsupported protocol
		public static final int BASS_ERROR_DENIED = 49;		// access denied
		public static final int BASS_ERROR_UNKNOWN = -1;	// some other mystery problem

		public static final int BASS_ERROR_JAVA_CLASS = 500;	// object class problem
		
		// BASS_RecordSetInput flags
		public static final int BASS_INPUT_OFF=0x10000;
		public static final int BASS_INPUT_ON=0x20000;

		public static final int BASS_INPUT_TYPE_MASK=0xff000000;
		public static final int BASS_INPUT_TYPE_UNDEF=0x00000000;
		public static final int BASS_INPUT_TYPE_DIGITAL	=0x01000000;
		public static final int BASS_INPUT_TYPE_LINE=0x02000000;
		public static final int BASS_INPUT_TYPE_MIC	=0x03000000;
		public static final int BASS_INPUT_TYPE_SYNTH=0x04000000;
		public static final int BASS_INPUT_TYPE_CD=0x05000000;
		public static final int BASS_INPUT_TYPE_PHONE=0x06000000;
		public static final int BASS_INPUT_TYPE_SPEAKER=0x07000000;
		public static final int BASS_INPUT_TYPE_WAVE=0x08000000;
		public static final int BASS_INPUT_TYPE_AUX=0x09000000;
		public static final int BASS_INPUT_TYPE_ANALOG=0x0a000000;
		
		// BASS_SetConfig options
		public static final int BASS_CONFIG_BUFFER = 0;
		public static final int BASS_CONFIG_UPDATEPERIOD = 1;
		public static final int BASS_CONFIG_GVOL_SAMPLE = 4;
		public static final int BASS_CONFIG_GVOL_STREAM = 5;
		public static final int BASS_CONFIG_GVOL_MUSIC = 6;
		public static final int BASS_CONFIG_CURVE_VOL = 7;
		public static final int BASS_CONFIG_CURVE_PAN = 8;
		public static final int BASS_CONFIG_FLOATDSP = 9;
		public static final int BASS_CONFIG_3DALGORITHM = 10;
		public static final int BASS_CONFIG_NET_TIMEOUT = 11;
		public static final int BASS_CONFIG_NET_BUFFER = 12;
		public static final int BASS_CONFIG_PAUSE_NOPLAY = 13;
		public static final int BASS_CONFIG_NET_PREBUF = 15;
		public static final int BASS_CONFIG_NET_PASSIVE = 18;
		public static final int BASS_CONFIG_REC_BUFFER = 19;
		public static final int BASS_CONFIG_NET_PLAYLIST = 21;
		public static final int BASS_CONFIG_MUSIC_VIRTUAL = 22;
		public static final int BASS_CONFIG_VERIFY = 23;
		public static final int BASS_CONFIG_UPDATETHREADS = 24;
		public static final int BASS_CONFIG_DEV_BUFFER = 27;
		public static final int BASS_CONFIG_DEV_DEFAULT = 36;
		public static final int BASS_CONFIG_NET_READTIMEOUT = 37;
		public static final int BASS_CONFIG_HANDLES = 41;
		public static final int BASS_CONFIG_SRC = 43;
		public static final int BASS_CONFIG_SRC_SAMPLE = 44;
		public static final int BASS_CONFIG_ASYNCFILE_BUFFER = 45;
		public static final int BASS_CONFIG_OGG_PRESCAN = 47;
		public static final int BASS_CONFIG_DEV_NONSTOP = 50;
		public static final int BASS_CONFIG_VERIFY_NET = 52;
		public static final int BASS_CONFIG_DEV_PERIOD = 53;
		public static final int BASS_CONFIG_FLOAT = 54;
		public static final int BASS_CONFIG_NET_SEEK = 56;
		public static final int BASS_CONFIG_AM_DISABLE = 58;
		public static final int BASS_CONFIG_NET_PLAYLIST_DEPTH = 59;
		public static final int BASS_CONFIG_NET_PREBUF_WAIT = 60;
		public static final int BASS_CONFIG_ANDROID_SESSIONID = 62;
		public static final int BASS_CONFIG_ANDROID_AAUDIO = 67;
		public static final int BASS_CONFIG_SAMPLE_ONEHANDLE = 69;
		public static final int BASS_CONFIG_DEV_TIMEOUT = 70;
		public static final int BASS_CONFIG_NET_META = 71;
		public static final int BASS_CONFIG_NET_RESTRATE = 72;
		public static final int BASS_CONFIG_REC_DEFAULT = 73;
		public static final int BASS_CONFIG_NORAMP = 74;
		
		// BASS_SetConfigPtr options
		public static final int BASS_CONFIG_NET_AGENT = 16;
		public static final int BASS_CONFIG_NET_PROXY = 17;
		public static final int BASS_CONFIG_LIBSSL = 64;
		public static final int BASS_CONFIG_FILENAME = 75;

		public static final int BASS_CONFIG_THREAD = 0x40000000; // flag: thread-specific setting

		// BASS_Init flags
		public static final int BASS_DEVICE_8BITS = 1;	// unused
		public static final int BASS_DEVICE_MONO = 2;	// mono
		public static final int BASS_DEVICE_3D = 4;	// unused
		public static final int BASS_DEVICE_16BITS = 8;		// limit output to 16-bit
		public static final int BASS_DEVICE_REINIT = 128;		// reinitialize
		public static final int BASS_DEVICE_LATENCY = 0x100;	// unused
		public static final int BASS_DEVICE_SPEAKERS = 0x800; // force enabling of speaker assignment
		public static final int BASS_DEVICE_NOSPEAKER = 0x1000; // ignore speaker arrangement
		public static final int BASS_DEVICE_FREQ = 0x4000; // set device sample rate
		public static final int BASS_DEVICE_AUDIOTRACK = 0x20000; // use AudioTrack output
		public static final int BASS_DEVICE_SOFTWARE	= 0x80000;	// disable hardware/fastpath output

		// BASS_DEVICEINFO flags
				public static final int BASS_DEVICE_ENABLED = 1;
				public static final int BASS_DEVICE_DEFAULT = 2;
				public static final int BASS_DEVICE_INIT = 4;
		
				public static final int BASS_SAMPLE_8BITS = 1;		// 8 bit
				public static final int BASS_SAMPLE_FLOAT = 256;	// 32-bit floating-point
				public static final int BASS_SAMPLE_MONO = 2;		// mono
				public static final int BASS_SAMPLE_LOOP = 4;		// looped
				public static final int BASS_SAMPLE_3D = 8;			// 3D functionality
				public static final int BASS_SAMPLE_SOFTWARE = 16;	// unused
				public static final int BASS_SAMPLE_MUTEMAX = 32;	// mute at max distance (3D only)
				public static final int BASS_SAMPLE_VAM = 64;		// unused
				public static final int BASS_SAMPLE_FX = 128;		// unused
				public static final int BASS_SAMPLE_OVER_VOL = 0x10000;	// override lowest volume
				public static final int BASS_SAMPLE_OVER_POS = 0x20000;	// override longest playing
				public static final int BASS_SAMPLE_OVER_DIST = 0x30000; // override furthest from listener (3D only)

				public static final int BASS_STREAM_PRESCAN = 0x20000;	// scan file for accurate seeking and length
				public static final int BASS_STREAM_AUTOFREE = 0x40000;	// automatically free the stream when it stops/ends
				public static final int BASS_STREAM_RESTRATE = 0x80000;	// restrict the download rate of internet file streams
				public static final int BASS_STREAM_BLOCK = 0x100000;	// download/play internet file stream in small blocks
				public static final int BASS_STREAM_DECODE = 0x200000;	// don't play the stream, only decode (BASS_ChannelGetData)
				public static final int BASS_STREAM_STATUS = 0x800000;	// give server status info (HTTP/ICY tags) in DOWNLOADPROC

				public static final int BASS_MP3_IGNOREDELAY = 0x200;	// ignore LAME/Xing/VBRI/iTunes delay & padding info
				public static final int BASS_MP3_SETPOS = BASS_STREAM_PRESCAN;

				public static final int BASS_MUSIC_FLOAT = BASS_SAMPLE_FLOAT;
				public static final int BASS_MUSIC_MONO = BASS_SAMPLE_MONO;
				public static final int BASS_MUSIC_LOOP = BASS_SAMPLE_LOOP;
				public static final int BASS_MUSIC_3D = BASS_SAMPLE_3D;
				public static final int BASS_MUSIC_FX = BASS_SAMPLE_FX;
				public static final int BASS_MUSIC_AUTOFREE = BASS_STREAM_AUTOFREE;
				public static final int BASS_MUSIC_DECODE = BASS_STREAM_DECODE;
				public static final int BASS_MUSIC_PRESCAN = BASS_STREAM_PRESCAN;	// calculate playback length
				public static final int BASS_MUSIC_CALCLEN = BASS_MUSIC_PRESCAN;
				public static final int BASS_MUSIC_RAMP = 0x200;	// normal ramping
				public static final int BASS_MUSIC_RAMPS = 0x400;	// sensitive ramping
				public static final int BASS_MUSIC_SURROUND = 0x800;	// surround sound
				public static final int BASS_MUSIC_SURROUND2 = 0x1000;	// surround sound (mode 2)
				public static final int BASS_MUSIC_FT2PAN = 0x2000; // apply FastTracker 2 panning to XM files
				public static final int BASS_MUSIC_FT2MOD = 0x2000;	// play .MOD as FastTracker 2 does
				public static final int BASS_MUSIC_PT1MOD = 0x4000;	// play .MOD as ProTracker 1 does
				public static final int BASS_MUSIC_NONINTER = 0x10000;	// non-interpolated sample mixing
				public static final int BASS_MUSIC_SINCINTER = 0x800000; // sinc interpolated sample mixing
				public static final int BASS_MUSIC_POSRESET = 0x8000;	// stop all notes when moving position
				public static final int BASS_MUSIC_POSRESETEX = 0x400000; // stop all notes and reset bmp/etc when moving position
				public static final int BASS_MUSIC_STOPBACK = 0x80000;	// stop the music on a backwards jump effect
				public static final int BASS_MUSIC_NOSAMPLE = 0x100000; // don't load the samples
				
				// Speaker assignment flags
				public static final int BASS_SPEAKER_FRONT = 0x1000000;	// front speakers
				public static final int BASS_SPEAKER_REAR = 0x2000000;	// rear speakers
				public static final int BASS_SPEAKER_CENLFE = 0x3000000;	// center & LFE speakers (5.1)
				public static final int BASS_SPEAKER_SIDE = 0x4000000;	// side speakers (7.1)
				public static int BASS_SPEAKER_N(int n) { return n<<24; }	// n'th pair of speakers (max 15)
				public static final int BASS_SPEAKER_LEFT = 0x10000000;	// modifier: left
				public static final int BASS_SPEAKER_RIGHT = 0x20000000;	// modifier: right
				public static final int BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT | BASS_SPEAKER_LEFT;
				public static final int BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT | BASS_SPEAKER_RIGHT;
				public static final int BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR | BASS_SPEAKER_LEFT;
				public static final int BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR | BASS_SPEAKER_RIGHT;
				public static final int BASS_SPEAKER_CENTER = BASS_SPEAKER_CENLFE | BASS_SPEAKER_LEFT;
				public static final int BASS_SPEAKER_LFE = BASS_SPEAKER_CENLFE | BASS_SPEAKER_RIGHT;
				public static final int BASS_SPEAKER_SIDELEFT = BASS_SPEAKER_SIDE | BASS_SPEAKER_LEFT;
				public static final int BASS_SPEAKER_SIDERIGHT = BASS_SPEAKER_SIDE | BASS_SPEAKER_RIGHT;
				public static final int BASS_SPEAKER_REAR2 = BASS_SPEAKER_SIDE;
				public static final int BASS_SPEAKER_REAR2LEFT = BASS_SPEAKER_SIDELEFT;
				public static final int BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_SIDERIGHT;

				public static final int BASS_ASYNCFILE = 0x40000000;	// read file asynchronously

				public static final int BASS_RECORD_PAUSE = 0x8000;	// start recording paused

				// BASS_CHANNELINFO types
				public static final int BASS_CTYPE_SAMPLE = 1;
				public static final int BASS_CTYPE_RECORD = 2;
				public static final int BASS_CTYPE_STREAM = 0x10000;
				public static final int BASS_CTYPE_STREAM_VORBIS = 0x10002;
				public static final int BASS_CTYPE_STREAM_OGG = 0x10002;
				public static final int BASS_CTYPE_STREAM_MP1 = 0x10003;
				public static final int BASS_CTYPE_STREAM_MP2 = 0x10004;
				public static final int BASS_CTYPE_STREAM_MP3 = 0x10005;
				public static final int BASS_CTYPE_STREAM_AIFF = 0x10006;
				public static final int BASS_CTYPE_STREAM_CA = 0x10007;
				public static final int BASS_CTYPE_STREAM_MF = 0x10008;
				public static final int BASS_CTYPE_STREAM_AM = 0x10009;
				public static final int BASS_CTYPE_STREAM_SAMPLE = 0x1000a;
				public static final int BASS_CTYPE_STREAM_DUMMY = 0x18000;
				public static final int BASS_CTYPE_STREAM_DEVICE = 0x18001;
				public static final int BASS_CTYPE_STREAM_WAV = 0x40000; // WAVE flag (LOWORD=codec)
				public static final int BASS_CTYPE_STREAM_WAV_PCM = 0x50001;
				public static final int BASS_CTYPE_STREAM_WAV_FLOAT = 0x50003;
				public static final int BASS_CTYPE_MUSIC_MOD = 0x20000;
				public static final int BASS_CTYPE_MUSIC_MTM = 0x20001;
				public static final int BASS_CTYPE_MUSIC_S3M = 0x20002;
				public static final int BASS_CTYPE_MUSIC_XM = 0x20003;
				public static final int BASS_CTYPE_MUSIC_IT = 0x20004;
				public static final int BASS_CTYPE_MUSIC_MO3 = 0x00100; // MO3 flag
				
				public static final int BASS_ORIGRES_FLOAT = 0x10000;

				// 3D channel modes
				public static final int BASS_3DMODE_NORMAL = 0;	// normal 3D processing
				public static final int BASS_3DMODE_RELATIVE = 1;	// position is relative to the listener
				public static final int BASS_3DMODE_OFF = 2;	// no 3D processing

				// software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM)
				public static final int BASS_3DALG_DEFAULT = 0;
				public static final int BASS_3DALG_OFF = 1;
				public static final int BASS_3DALG_FULL = 2;
				public static final int BASS_3DALG_LIGHT = 3;

				// BASS_SampleGetChannel flags
				public static final int BASS_SAMCHAN_NEW = 1;	    // get a new playback channel
				public static final int BASS_SAMCHAN_STREAM = 2;	// create a stream
				
				// Special STREAMPROCs
				public static final int STREAMPROC_DUMMY = 0;		// "dummy" stream
				public static final int STREAMPROC_PUSH = -1;		// push stream
				public static final int STREAMPROC_DEVICE = -2;		// device mix stream
				public static final int STREAMPROC_DEVICE_3D = -3;	// device 3D mix stream

				// BASS_StreamCreateFileUser file systems
				public static final int STREAMFILE_NOBUFFER = 0;
				public static final int STREAMFILE_BUFFER = 1;
				public static final int STREAMFILE_BUFFERPUSH = 2;

				public static final int BASS_STREAMPROC_END = 0x80000000;	// end of user stream flag
				public static final int BASS_STREAMPROC_DEVICE = -2;		// device mix stream
				public static final int BASS_STREAMPROC_DUMMY = 0;			// "dummy" stream
				public static final int BASS_STREAMPROC_PUSH = -1;			// push stream
				public static final int BASS_STREAMPROC_DEVICE_3D = -3;			// device 3D mix stream
				
				// BASS_StreamPutFileData options
				public static final int BASS_FILEDATA_END = 0;	// end & close the file

				// BASS_StreamGetFilePosition modes
				public static final int BASS_FILEPOS_CURRENT = 0;
				public static final int BASS_FILEPOS_DECODE = BASS_FILEPOS_CURRENT;
				public static final int BASS_FILEPOS_DOWNLOAD = 1;
				public static final int BASS_FILEPOS_END = 2;
				public static final int BASS_FILEPOS_START = 3;
				public static final int BASS_FILEPOS_CONNECTED = 4;
				public static final int BASS_FILEPOS_BUFFER = 5;
				public static final int BASS_FILEPOS_SOCKET = 6;
				public static final int BASS_FILEPOS_ASYNCBUF = 7;
				public static final int BASS_FILEPOS_SIZE = 8;
				public static final int BASS_FILEPOS_BUFFERING = 9;
				public static final int BASS_FILEPOS_AVAILABLE = 10;
				
				// BASS_ChannelSetSync types
				public static final int BASS_SYNC_POS = 0;
				public static final int BASS_SYNC_END = 2;
				public static final int BASS_SYNC_META = 4;
				public static final int BASS_SYNC_SLIDE = 5;
				public static final int BASS_SYNC_STALL = 6;
				public static final int BASS_SYNC_DOWNLOAD = 7;
				public static final int BASS_SYNC_FREE = 8;
				public static final int BASS_SYNC_SETPOS = 11;
				public static final int BASS_SYNC_MUSICPOS = 10;
				public static final int BASS_SYNC_MUSICINST = 1;
				public static final int BASS_SYNC_MUSICFX = 3;
				public static final int BASS_SYNC_OGG_CHANGE = 12;
				public static final int BASS_SYNC_DEV_FAIL = 14;
				public static final int BASS_SYNC_DEV_FORMAT = 15;
				public static final int BASS_SYNC_THREAD = 0x20000000;	// flag: call sync in other thread
				public static final int BASS_SYNC_MIXTIME = 0x40000000;	// flag: sync at mixtime, else at playtime
				public static final int BASS_SYNC_ONETIME = 0x80000000;	// flag: sync only once, else continuously

				// BASS_ChannelIsActive return values
				public static final int BASS_ACTIVE_STOPPED = 0;
				public static final int BASS_ACTIVE_PLAYING =1;
				public static final int BASS_ACTIVE_STALLED = 2;
				public static final int BASS_ACTIVE_PAUSED = 3;
				public static final int BASS_ACTIVE_PAUSED_DEVICE = 4;

				// Channel attributes
				public static final int BASS_ATTRIB_FREQ = 1;
				public static final int BASS_ATTRIB_VOL = 2;
				public static final int BASS_ATTRIB_PAN = 3;
				public static final int BASS_ATTRIB_EAXMIX = 4;
				public static final int BASS_ATTRIB_NOBUFFER = 5;
				public static final int BASS_ATTRIB_VBR = 6;
				public static final int BASS_ATTRIB_CPU = 7;
				public static final int BASS_ATTRIB_SRC = 8;
				public static final int BASS_ATTRIB_NET_RESUME = 9;
				public static final int BASS_ATTRIB_SCANINFO = 10;
				public static final int BASS_ATTRIB_NORAMP = 11;
				public static final int BASS_ATTRIB_BITRATE = 12;
				public static final int BASS_ATTRIB_BUFFER = 13;
				public static final int BASS_ATTRIB_GRANULE = 14;
				public static final int BASS_ATTRIB_USER = 15;
				public static final int BASS_ATTRIB_TAIL = 16;
				public static final int BASS_ATTRIB_PUSH_LIMIT = 17;
				public static final int BASS_ATTRIB_DOWNLOADPROC = 18;
				public static final int BASS_ATTRIB_VOLDSP = 19;
				public static final int BASS_ATTRIB_VOLDSP_PRIORITY = 20;
				public static final int BASS_ATTRIB_MUSIC_AMPLIFY = 0x100;
				public static final int BASS_ATTRIB_MUSIC_PANSEP = 0x101;
				public static final int BASS_ATTRIB_MUSIC_PSCALER = 0x102;
				public static final int BASS_ATTRIB_MUSIC_BPM = 0x103;
				public static final int BASS_ATTRIB_MUSIC_SPEED = 0x104;
				public static final int BASS_ATTRIB_MUSIC_VOL_GLOBAL = 0x105;
				public static final int BASS_ATTRIB_MUSIC_VOL_CHAN = 0x200; // + channel #
				public static final int BASS_ATTRIB_MUSIC_VOL_INST = 0x300; // + instrument #

				// BASS_ChannelSlideAttribute flags
				public static final int BASS_SLIDE_LOG = 0x1000000;

				// BASS_ChannelGetData flags
				public static final int BASS_DATA_AVAILABLE = 0;			// query how much data is buffered
				public static final int BASS_DATA_NOREMOVE = 0x10000000;	// flag: don't remove data from recording buffer
				public static final int BASS_DATA_FIXED = 0x20000000;	// unused
				public static final int BASS_DATA_FLOAT = 0x40000000;	// flag: return floating-point sample data
				public static final int BASS_DATA_FFT256 = 0x80000000;	// 256 sample FFT
				public static final int BASS_DATA_FFT512 = 0x80000001;	// 512 FFT
				public static final int BASS_DATA_FFT1024 = 0x80000002;	// 1024 FFT
				public static final int BASS_DATA_FFT2048 = 0x80000003;	// 2048 FFT
				public static final int BASS_DATA_FFT4096 = 0x80000004;	// 4096 FFT
				public static final int BASS_DATA_FFT8192 = 0x80000005;	// 8192 FFT
				public static final int BASS_DATA_FFT16384 = 0x80000006;	// 16384 FFT
				public static final int BASS_DATA_FFT32768 = 0x80000007;	// 32768 FFT
				public static final int BASS_DATA_FFT_INDIVIDUAL = 0x10;	// FFT flag: FFT for each channel, else all combined
				public static final int BASS_DATA_FFT_NOWINDOW = 0x20;	// FFT flag: no Hanning window
				public static final int BASS_DATA_FFT_REMOVEDC = 0x40;	// FFT flag: pre-remove DC bias
				public static final int BASS_DATA_FFT_COMPLEX = 0x80;	// FFT flag: return complex data
				public static final int BASS_DATA_FFT_NYQUIST = 0x100;	// FFT flag: return extra Nyquist value

				// BASS_ChannelGetLevelEx flags
				public static final int BASS_LEVEL_MONO = 1;	    // get mono level
				public static final int BASS_LEVEL_STEREO = 2;	    // get stereo level
				public static final int BASS_LEVEL_RMS = 4;	        // get RMS levels
				public static final int BASS_LEVEL_VOLPAN = 8;	    // apply VOL/PAN attributes to the levels
				public static final int BASS_LEVEL_NOREMOVE = 16;	// don't remove data from recording buffer

				// BASS_ChannelGetTags types : what's returned
				public static final int BASS_TAG_ID3 = 0;	// ID3v1 tags : TAG_ID3
				public static final int BASS_TAG_ID3V2 = 1;	// ID3v2 tags : ByteBuffer
				public static final int BASS_TAG_OGG = 2;	// OGG comments : String array
				public static final int BASS_TAG_HTTP = 3;	// HTTP headers : String array
				public static final int BASS_TAG_ICY = 4;	// ICY headers : String array
				public static final int BASS_TAG_META = 5;	// ICY metadata : String
				public static final int BASS_TAG_APE = 6;	// APE tags : String array
				public static final int BASS_TAG_MP4 = 7;	// MP4/iTunes metadata : String array
				public static final int BASS_TAG_VENDOR = 9;	// OGG encoder : String
				public static final int BASS_TAG_LYRICS3 = 10;	// Lyric3v2 tag : String
				public static final int BASS_TAG_WAVEFORMAT = 14;	// WAVE format : ByteBuffer containing WAVEFORMATEEX structure
				public static final int BASS_TAG_AM_NAME = 16;	// Android Media codec name : String
				public static final int BASS_TAG_ID3V2_2 = 17;	// ID3v2 tags (2nd block) : ByteBuffer
				public static final int BASS_TAG_AM_MIME = 18;	// Android Media MIME type : String
				public static final int BASS_TAG_LOCATION = 19;	// redirected URL : String
				public static final int BASS_TAG_RIFF_INFO = 0x100; // RIFF "INFO" tags : String array
				public static final int BASS_TAG_RIFF_BEXT = 0x101; // RIFF/BWF "bext" tags : TAG_BEXT
				public static final int BASS_TAG_RIFF_CART = 0x102; // RIFF/BWF "cart" tags : TAG_CART
				public static final int BASS_TAG_RIFF_DISP = 0x103; // RIFF "DISP" text tag : String
				public static final int BASS_TAG_RIFF_CUE = 0x104; // RIFF "cue " chunk : TAG_CUE structure
				public static final int BASS_TAG_RIFF_SMPL = 0x105; // RIFF "smpl" chunk : TAG_SMPL structure
				public static final int BASS_TAG_APE_BINARY = 0x1000;	// + index #, binary APE tag : TAG_APE_BINARY
				public static final int BASS_TAG_MUSIC_NAME = 0x10000;	// MOD music name : String
				public static final int BASS_TAG_MUSIC_MESSAGE = 0x10001;	// MOD message : String
				public static final int BASS_TAG_MUSIC_ORDERS = 0x10002;	// MOD order list : ByteBuffer
				public static final int BASS_TAG_MUSIC_AUTH = 0x10003;	// MOD author : UTF-8 string
				public static final int BASS_TAG_MUSIC_INST = 0x10100;	// + instrument #, MOD instrument name : String
				public static final int BASS_TAG_MUSIC_CHAN = 0x10200;	// + channel #, MOD channel name : String
				public static final int BASS_TAG_MUSIC_SAMPLE = 0x10300;	// + sample #, MOD sample name : String
				public static final int BASS_TAG_BYTEBUFFER = 0x10000000;	// flag: return a ByteBuffer instead of a String or TAG_ID3

				// BASS_ChannelGetLength/GetPosition/SetPosition modes
				public static final int BASS_POS_BYTE = 0;		// byte position
				public static final int BASS_POS_MUSIC_ORDER = 1;		// order.row position, MAKELONG(order,row)
				public static final int BASS_POS_OGG = 3;		// OGG bitstream number
				public static final int BASS_POS_END = 0x10;	// trimmed end position
				public static final int BASS_POS_LOOP = 0x11;	// loop start positiom
				public static final int BASS_POS_FLUSH = 0x1000000; // flag: flush decoder/FX buffers
				public static final int BASS_POS_RESET = 0x2000000; // flag: reset user file buffers
				public static final int BASS_POS_RELATIVE = 0x4000000; // flag: seek relative to the current position
				public static final int BASS_POS_INEXACT = 0x8000000; // flag: allow seeking to inexact position
				public static final int BASS_POS_DECODE = 0x10000000; // flag: get the decoding (not playing) position
				public static final int BASS_POS_DECODETO = 0x20000000; // flag: decode to the position instead of seeking
				public static final int BASS_POS_SCAN = 0x40000000; // flag: scan to the position

				// BASS_ChannelSetDevice/GetDevice option
				public static final int BASS_NODEVICE = 0x20000;

				// DX8 effect types, use with BASS_ChannelSetFX
				public static final int BASS_FX_DX8_CHORUS = 0;
				public static final int BASS_FX_DX8_COMPRESSOR = 1;
				public static final int BASS_FX_DX8_DISTORTION = 2;
				public static final int BASS_FX_DX8_ECHO = 3;
				public static final int BASS_FX_DX8_FLANGER = 4;
				public static final int BASS_FX_DX8_GARGLE = 5;
				public static final int BASS_FX_DX8_I3DL2REVERB = 6;
				public static final int BASS_FX_DX8_PARAMEQ = 7;
				public static final int BASS_FX_DX8_REVERB = 8;
				public static final int BASS_FX_VOLUME = 9;
				
				public static final int BASS_DX8_PHASE_NEG_180 = 0;
				public static final int BASS_DX8_PHASE_NEG_90 = 1;
				public static final int BASS_DX8_PHASE_ZERO = 2;
				public static final int BASS_DX8_PHASE_90 = 3;
				public static final int BASS_DX8_PHASE_180 = 4;
	}
	
	
		// Device info structure
		@ShortName("BASS_DEVICEINFO")
		@Structure.FieldOrder({"name","driver","flags"})
		public static class BASS_DEVICEINFO extends Structure{
			public String name;	// description
			public String driver;	// driver
			public int flags;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
			
			@Override
			public String toString() {
				return MessageFormat.format("Name={0}, Driver={1}, Flags={2}", name, driver, Integer.toHexString(flags));
			}
			
			/**
			 * Check if Device is enabled
			 * @return true if enabled
			 */
			public boolean getIsEnabled() {
				return (flags & Constant.BASS_DEVICE_ENABLED)>0;
			}
			
			/**
			 * Check if Device is Initialized
			 * @return true if inited
			 */
			public boolean getIsInitialized() {
				return (flags & Constant.BASS_DEVICE_INIT)>0;
			}
			
			/**
			 * Check if Device is System Default
			 * @return true if system default
			 */
			public boolean getIsDefault() {
				return (flags & Constant.BASS_DEVICE_DEFAULT)>0;
			}
			
			
		}

		
		@BA.ShortName("BASS_INFO")
		@Structure.FieldOrder({"flags","hwsize","hwfree","freesam","free3d","minrate","maxrate","eax","minbuf","dsver","latency","initflags","speakers","freq"})
		public static class BASS_INFO extends Structure {
			public int flags;	// device capabilities (DSCAPS_xxx flags)
			public int hwsize;	// unused
			public int hwfree;	// unused
			public int freesam;	// unused
			public int free3d;	// unused
			public int minrate;	// unused
			public int maxrate;	// unused
			public int eax;	// unused
			public int minbuf;	// recommended minimum buffer length in ms
			public int dsver;	// DirectSound version
			public int latency;	// average delay (in ms) before start of playback
			public int initflags; // BASS_Init "flags" parameter
			public int speakers; // number of speakers available
			public int freq;		// current output rate		
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}
		
		// Recording device info structure
		@BA.ShortName("BASS_RECORDINFO")
		@Structure.FieldOrder({"flags","formats","inputs","singlein","freq"})
		public static class BASS_RECORDINFO extends Structure {
			public int flags;	// device capabilities (DSCCAPS_xxx flags)
			public int formats;	// supported standard formats (WAVE_FORMAT_xxx flags)
			public int inputs;	// number of inputs
			public boolean singlein;	// TRUE = only 1 input can be set at a time
			public int freq;		// current input rate
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		// Sample info structure
		@Structure.FieldOrder({"freq","volume","pan","flags","length","max","origres","chans"
			,"mingap","mode3d","mindist","maxdist","iangle","oangle","outvol","vam","priority"})
		public static class BASS_SAMPLE extends Structure{
			public int freq;		// default playback rate
			public float volume;	// default volume (0-1)
			public float pan;		// default pan (-1=left, 0=middle, 1=right)
			public int flags;	// BASS_SAMPLE_xxx flags
			public int length;	// length (in bytes)
			public int max;		// maximum simultaneous playbacks
			public int origres;	// original resolution bits
			public int chans;	// number of channels
			public int mingap;	// minimum gap (ms) between creating channels
			public int mode3d;	// BASS_3DMODE_xxx mode
			public float mindist;	// minimum distance
			public float maxdist;	// maximum distance
			public int iangle;	// angle of inside projection cone
			public int oangle;	// angle of outside projection cone
			public float outvol;	// delta-volume outside the projection cone
			public int vam;		// unused
			public int priority;	// unused
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		
		// Channel info structure
		@BA.ShortName("BASS_CHANNELINFO")
		@Structure.FieldOrder({"freq","chans","flags","ctype","origres","plugin","sample","filename"})
		public static class BASS_CHANNELINFO extends Structure{
			public int freq;		// default playback rate
			public int chans;	// channels
			public int flags;
			public int ctype;	// type of channel
			public int origres;	// original resolution
			public int plugin;
			public int sample;
			public String filename;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}
		
		
		
		
		@Structure.FieldOrder({"ctype","name","exts"})
		public static class BASS_PLUGINFORM extends Structure{
			public int ctype;		// channel type
			public String name;	// format description
			public String exts;	// file extension filter (*.ext1;*.ext2;etc...)
		
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}
		
		@Structure.FieldOrder({"version","formatc","formats"})
		public static class BASS_PLUGININFO extends Structure{
			public int version;					// version (same form as BASS_GetVersion)
			public int formatc;					// number of formats
			public BASS_PLUGINFORM[] formats = new BASS_PLUGINFORM[formatc];	// the array of formats
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {
				super.autoRead();
				}
		}

		// 3D vector (for 3D positions/velocities/orientations)
		@Structure.FieldOrder({"x","y","z"})
		public static class BASS_3DVECTOR extends Structure{
			public BASS_3DVECTOR() {}
			public BASS_3DVECTOR(float _x, float _y, float _z) { x=_x; y=_y; z=_z; }
			public float x;	// +=right, -=left
			public float y;	// +=up, -=down
			public float z;	// +=front, -=behind
		
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		

		public interface STREAMPROC extends Callback
		{
			int STREAMPROC(int handle, Pointer buffer, int length, Pointer user);
			/* User stream callback function.
			handle : The stream that needs writing
			buffer : Buffer to write the samples in
			length : Number of bytes to write
			user   : The 'user' parameter value given when calling BASS_StreamCreate
			RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
					 the stream. */
		}

		public interface FILECLOSEPROC extends Callback{
			void FILECLOSEPROC(Pointer user);
		}
		public interface FILELENPROC extends Callback{
			long FILELENPROC(Pointer user);
		}
		public interface FILEREADPROC extends Callback{
			int FILEREADPROC(Pointer buffer, int length, Pointer user);
		}
		public interface FILESEEKPROC extends Callback{
			boolean FILESEEKPROC(long offset, Pointer user);
		}
		
		@Structure.FieldOrder({"FILECLOSEPROC","FILELENPROC","FILEREADPROC","FILESEEKPROC"})
		public static class BASS_FILEPROCS extends Structure
		{
			public FILECLOSEPROC FILECLOSEPROC;
			public FILELENPROC FILELENPROC;
			public FILEREADPROC FILEREADPROC;
			public FILESEEKPROC FILESEEKPROC;
			public BASS_FILEPROCS() {
				this.FILECLOSEPROC = null;
				this.FILELENPROC = null;
				this.FILEREADPROC = null;
				this.FILESEEKPROC = null;
			}
			public BASS_FILEPROCS(FILECLOSEPROC fc, FILELENPROC fl, FILEREADPROC fr, FILESEEKPROC fs) {
				this.FILECLOSEPROC = fc;
				this.FILELENPROC = fl;
				this.FILEREADPROC = fr;
				this.FILESEEKPROC = fs;
			}
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		

		public interface DOWNLOADPROC extends Callback
		{
			void DOWNLOADPROC(Pointer buffer, int length, Pointer user);
			/* Internet stream download callback function.
			buffer : Buffer containing the downloaded data... NULL=end of download
			length : Number of bytes in the buffer
			user   : The 'user' parameter value given when calling BASS_StreamCreateURL */
		}

		
		public interface SYNCPROC extends Callback
		{
			void SYNCPROC(int handle, int channel, int data, Pointer user);
			/* Sync callback function.
			handle : The sync that has occured
			channel: Channel that the sync occured in
			data   : Additional data associated with the sync's occurance
			user   : The 'user' parameter given when calling BASS_ChannelSetSync */
		}

		public interface DSPPROC extends Callback
		{
			void DSPPROC(int handle, int channel, Pointer buffer, int length, Pointer user);
			/* DSP callback function.
			handle : The DSP handle
			channel: Channel that the DSP is being applied to
			buffer : Buffer to apply the DSP to
			length : Number of bytes in the buffer
			user   : The 'user' parameter given when calling BASS_ChannelSetDSP */
		}

		public interface RECORDPROC extends Callback
		{
			boolean RECORDPROC(int handle, Pointer buffer, int length, Pointer user);
			/* Recording callback function.
			handle : The recording handle
			buffer : Buffer containing the recorded sample data
			length : Number of bytes
			user   : The 'user' parameter value given when calling BASS_RecordStart
			RETURN : true = continue recording, false = stop */
		}

		
		// ID3v1 tag structure
		@Structure.FieldOrder({"id","title","artist","album","year","comment","genre","track"})
		public static class TAG_ID3 extends Structure {
			public String id;
			public String title;
			public String artist;
			public String album;
			public String year;
			public String comment;
			public byte genre;
			public byte track;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		// Binary APE tag structure
		@Structure.FieldOrder({"key","data","length"})
		public static class TAG_APE_BINARY extends Structure{
			public String key;
			public Pointer data;
			public int length;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		
		
		@Structure.FieldOrder({"fWetDryMix","fDepth","fFeedback","fFrequency","lWaveform","fDelay","lPhase"})
		public static class BASS_DX8_CHORUS extends Structure {
			public float fWetDryMix;
			public float fDepth;
			public float fFeedback;
			public float fFrequency;
			public int lWaveform;	// 0=triangle, 1=sine
			public float fDelay;
			public int lPhase;		// BASS_DX8_PHASE_xxx
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		@Structure.FieldOrder({"fGain","fEdge","fPostEQCenterFrequency","fPostEQBandwidth","fPreLowpassCutoff"})
		public static class BASS_DX8_DISTORTION extends Structure {
			public float fGain;
			public float fEdge;
			public float fPostEQCenterFrequency;
			public float fPostEQBandwidth;
			public float fPreLowpassCutoff;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}
		
		@Structure.FieldOrder({"fWetDryMix","fFeedback","fLeftDelay","fRightDelay","lPanDelay"})
		public static class BASS_DX8_ECHO extends Structure {
			public float fWetDryMix;
			public float fFeedback;
			public float fLeftDelay;
			public float fRightDelay;
			public boolean lPanDelay;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}
		
		@Structure.FieldOrder({"fWetDryMix","fDepth","fFeedback","fFrequency","lWaveform","fDelay","lPhase"})
		public static class BASS_DX8_FLANGER extends Structure {
			public float fWetDryMix;
			public float fDepth;
			public float fFeedback;
			public float fFrequency;
			public int lWaveform;	// 0=triangle, 1=sine
			public float fDelay;
			public int lPhase;		// BASS_DX8_PHASE_xxx
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		@Structure.FieldOrder({"fCenter","fBandwidth","fGain"})
		public static class BASS_DX8_PARAMEQ extends Structure {
			public float fCenter;
			public float fBandwidth;
			public float fGain;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		@Structure.FieldOrder({"fInGain","fReverbMix","fReverbTime","fHighFreqRTRatio"})
		public static class BASS_DX8_REVERB extends Structure {
			public float fInGain;
			public float fReverbMix;
			public float fReverbTime;
			public float fHighFreqRTRatio;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		
		@Structure.FieldOrder({"fTarget","fCurrent","fTime","lCurve"})
		public static class BASS_FX_VOLUME_PARAM extends Structure {
			public float fTarget;
			public float fCurrent;
			public float fTime;
			public int lCurve;
			
			@Override
			@Hide
			public void autoWrite() {super.autoWrite();}
			
			@Override
			@Hide
			public void autoRead() {super.autoRead();}
		}

		@Structure.FieldOrder({"value"})
		public static class FloatValue {
			public float value;
		}

		public  boolean BASS_SetConfig(int option, int value);
		public  int BASS_GetConfig(int option);
		public  boolean BASS_SetConfigPtr(int option, Object value);
		public  Object BASS_GetConfigPtr(int option);
		public  int BASS_GetVersion();
		public  int BASS_ErrorGetCode();
		public  boolean BASS_GetDeviceInfo(int device, BASS_DEVICEINFO info);
		public  boolean BASS_Init(int device, int freq, int flags);
		public  boolean BASS_Free();
		public  boolean BASS_SetDevice(int device);
		public  int BASS_GetDevice();
		public  boolean BASS_GetInfo(BASS_INFO info);
		public  boolean BASS_Start();
		public  boolean BASS_Stop();
		public  boolean BASS_Pause();
		public  int BASS_IsStarted();
		public  boolean BASS_Update(int length);
		public  float BASS_GetCPU();
		public  boolean BASS_SetVolume(float volume);
		public  float BASS_GetVolume();

		public  boolean BASS_Set3DFactors(float distf, float rollf, float doppf);
		public  boolean BASS_Get3DFactors(FloatValue distf, FloatValue rollf, FloatValue doppf);
		public  boolean BASS_Set3DPosition(BASS_3DVECTOR pos, BASS_3DVECTOR vel, BASS_3DVECTOR front, BASS_3DVECTOR top);
		public  boolean BASS_Get3DPosition(BASS_3DVECTOR pos, BASS_3DVECTOR vel, BASS_3DVECTOR front, BASS_3DVECTOR top);
		public  void BASS_Apply3D();

		public  int BASS_PluginLoad(String file, int flags);
		public  boolean BASS_PluginFree(int handle);
		public  boolean BASS_PluginEnable(int handle, boolean enable);
		public  BASS_PLUGININFO BASS_PluginGetInfo(int handle);

		public  int BASS_SampleLoad(String file, long offset, int length, int max, int flags);
		public  int BASS_SampleLoad(Pointer file, long offset, int length, int max, int flags);
		public  int BASS_SampleCreate(int length, int freq, int chans, int max, int flags);
		public  boolean BASS_SampleFree(int handle);
		public  boolean BASS_SampleSetData(int handle, Pointer buffer);
		public  boolean BASS_SampleGetData(int handle, Pointer buffer);
		public  boolean BASS_SampleGetInfo(int handle, BASS_SAMPLE info);
		public  boolean BASS_SampleSetInfo(int handle, BASS_SAMPLE info);
		public  int BASS_SampleGetChannel(int handle, boolean onlynew);
		public  int BASS_SampleGetChannels(int handle, int[] channels);
		public  boolean BASS_SampleStop(int handle);
		public  int BASS_StreamCreate(int freq, int chans, int flags, STREAMPROC proc, Pointer user);
		public  int BASS_StreamCreateFile(boolean mem, String file, long offset, long length, int flags);
		public  int BASS_StreamCreateFile(String file, long offset, long length, int flags);
		public  int BASS_StreamCreateFile(Pointer file, long offset, long length, int flags);
		public  int BASS_StreamCreateURL(String url, int offset, int flags, DOWNLOADPROC proc, Pointer user);
		public  int BASS_StreamCreateFileUser(int system, int flags, BASS_FILEPROCS procs, Pointer user);
		public  boolean BASS_StreamFree(int handle);
		public  long BASS_StreamGetFilePosition(int handle, int mode);
		public  int BASS_StreamPutData(int handle, Pointer buffer, int length);
		public  int BASS_StreamPutFileData(int handle, Pointer buffer, int length);

		public  int BASS_MusicLoad(String file, long offset, int length, int flags, int freq);
		public  int BASS_MusicLoad(Pointer file, long offset, int length, int flags, int freq);
		public  boolean BASS_MusicFree(int handle);

		public  boolean BASS_RecordGetDeviceInfo(int device, BASS_DEVICEINFO info);
		public  boolean BASS_RecordInit(int device);
		public  boolean BASS_RecordFree();
		public  boolean BASS_RecordSetDevice(int device);
		public  int BASS_RecordGetDevice();
		public  boolean BASS_RecordGetInfo(BASS_RECORDINFO info);
		public  String BASS_RecordGetInputName(int input);
		public  boolean BASS_RecordSetInput(int input, int flags, float volume);
		public  int BASS_RecordGetInput(int input, FloatValue volume);
		public  int BASS_RecordStart(int freq, int chans, int flags, RECORDPROC proc, Pointer user);

		public  double BASS_ChannelBytes2Seconds(int handle, long pos);
		public  long BASS_ChannelSeconds2Bytes(int handle, double pos);
		public  int BASS_ChannelGetDevice(int handle);
		public  boolean BASS_ChannelSetDevice(int handle, int device);
		public  int BASS_ChannelIsActive(int handle);
		public  boolean BASS_ChannelGetInfo(int handle, BASS_CHANNELINFO info);
		public  Object BASS_ChannelGetTags(int handle, int tags);
		public  long BASS_ChannelFlags(int handle, int flags, int mask);
		public  boolean BASS_ChannelLock(int handle, boolean lock);
		public  boolean BASS_ChannelFree(int handle);
		public  boolean BASS_ChannelPlay(int handle, boolean restart);
		public  boolean BASS_ChannelStart(int handle);
		public  boolean BASS_ChannelStop(int handle);
		public  boolean BASS_ChannelPause(int handle);
		public  boolean BASS_ChannelUpdate(int handle, int length);
		public  boolean BASS_ChannelSetAttribute(int handle, int attrib, float value);
		public  boolean BASS_ChannelGetAttribute(int handle, int attrib, FloatValue value);
		public  boolean BASS_ChannelSlideAttribute(int handle, int attrib, float value, int time);
		public  boolean BASS_ChannelIsSliding(int handle, int attrib);
		public  boolean BASS_ChannelSetAttributeEx(int handle, int attrib, Pointer value, int size);
		public  boolean BASS_ChannelSetAttributeDOWNLOADPROC(int handle, DOWNLOADPROC proc, Pointer user);
		public  int BASS_ChannelGetAttributeEx(int handle, int attrib, Pointer value, int size);
		public  boolean BASS_ChannelSet3DAttributes(int handle, int mode, float min, float max, int iangle, int oangle, float outvol);
		public  boolean BASS_ChannelGet3DAttributes(int handle, Integer mode, FloatValue min, FloatValue max, Integer iangle, Integer oangle, FloatValue outvol);
		public  boolean BASS_ChannelSet3DPosition(int handle, BASS_3DVECTOR pos, BASS_3DVECTOR orient, BASS_3DVECTOR vel);
		public  boolean BASS_ChannelGet3DPosition(int handle, BASS_3DVECTOR pos, BASS_3DVECTOR orient, BASS_3DVECTOR vel);
		public  long BASS_ChannelGetLength(int handle, int mode);
		public  boolean BASS_ChannelSetPosition(int handle, long pos, int mode);
		public  long BASS_ChannelGetPosition(int handle, int mode);
		public  int BASS_ChannelGetLevel(int handle);
		public  boolean BASS_ChannelGetLevelEx(int handle, float[] levels, float length, int flags);
		public  int BASS_ChannelGetData(int handle, Pointer buffer, int length);
		public  int BASS_ChannelSetSync(int handle, int type, long param, SYNCPROC proc, Pointer user);
		public  boolean BASS_ChannelRemoveSync(int handle, int sync);
		public  boolean BASS_ChannelSetLink(int handle, int chan);
		public  boolean BASS_ChannelRemoveLink(int handle, int chan);
		public  int BASS_ChannelSetDSP(int handle, DSPPROC proc, Pointer user, int priority);
		public  boolean BASS_ChannelRemoveDSP(int handle, int dsp);
		public  int BASS_ChannelSetFX(int handle, int type, int priority);
		public  boolean BASS_ChannelRemoveFX(int handle, int fx);

		public  boolean BASS_FXSetParameters(int handle, Object params);
		public  boolean BASS_FXGetParameters(int handle, Object params);
		public  boolean BASS_FXSetPriority(int handle, int priority);
		public  boolean BASS_FXReset(int handle);

		//public int BASS_StreamCreateConst(int freq, int chans, int flags, int proc, Pointer user);
		
//		public default int BASS_StreamCreate(int freq, int chans, int flags, int proc, Pointer user) {
//			return BASS_StreamCreateConst(freq, chans, flags, proc, user);
//		}
		
		public int BASS_StreamCreate(int freq, int chans, int flags, int proc, Pointer user);
		
		public static class Utils {
			public static int LOBYTE(int n) { return n&0xff; }
			public static int HIBYTE(int n) { return (n>>8)&0xff; }
			public static int LOWORD(int n) { return n&0xffff; }
			public static int HIWORD(int n) { return (n>>16)&0xffff; }
			public static int MAKEWORD(int a, int b) { return (a&0xff)|((b&0xff)<<8); }
			public static int MAKELONG(int a, int b) { return (a&0xffff)|(b<<16); }
		}
		
		/**
		 * Get Bass Error in String
		 * @param function function name
		 * @param err error code from BASS_ErrorGetCode
		 * @return reason of error in string
		 */
		public default String GetBassError(String function, int err) {
			if (err==0)
				return function+": SUCCESS";
			else if (err==Constant.BASS_ERROR_DEVICE)
				return function+": Device Is Invalid";
			else if (err==Constant.BASS_ERROR_INIT)
				return function+": BASS_Init/BASS_RecordInit has not been called";
			else if (err==Constant.BASS_ERROR_MEM)
				return function+": Insufficient Memory";
			else if (err==Constant.BASS_ERROR_HANDLE)
				return function+": Invalid Handle";
			else if (err==Constant.BASS_ERROR_NO3D) 
				return function+": Couldnt initialize 3D support";
			else if (err==Constant.BASS_ERROR_SPEAKER)	
				return function+": Specified SPEAKERS flags are invalid";
			else if (err==Constant.BASS_ERROR_UNKNOWN) {
				return function+": Unknown Error ";
			}
			else {
				StringBuilder str = new StringBuilder();
				str.append(function).append(": ");
				String funct = function.trim().toLowerCase();
				switch(funct) {
				case "bass_free":
					switch(err) {
					case Constant.BASS_ERROR_BUSY:
						return str.append("Device curently being reinitialized").toString();
					default :
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_init":
				case "bass_recordinit":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL : 
						str.append("BASS_DEVICE_REINIT cannot be used when Device is -1. Use Real Device Number instead");
						return str.toString();
					case Constant.BASS_ERROR_ALREADY : 
						str.append("Device already Initialized");
						return str.toString();
					case Constant.BASS_ERROR_DRIVER :
						str.append("Device Driver not available");
						return str.toString();
					case Constant.BASS_ERROR_BUSY :
						str.append("Device has exclusive use from other");
						return str.toString();
					case Constant.BASS_ERROR_FORMAT :
						str.append("Format invalid, Try changing Frequency parameter");
						return str.toString();
					default : 
						str.append("Unknown error code="+err);
						return str.toString();

					}
				case "bass_streamcreate":
				case "bass_streamcreateconst":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL :
						str.append("BASS_STREAM_FREE cannot be combined with BASS_STREAM_DECODE");
						return str.toString();
					case Constant.BASS_ERROR_FORMAT :
						str.append("Sample format is not supported");
						return str.toString();
					case Constant.BASS_ERROR_SPEAKER:
						str.append("Specified Speaker Flag are invalid");
						return str.toString();
					default :
						str.append("Unknown error code="+err);
						return str.toString();
					}
				case "bass_streamcreatefile" :
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL :
						str.append("BASS_STREAM_AUTOFREE cannot be combined with BASS_STREAM_DECODE");
						return str.toString();
					case Constant.BASS_ERROR_ILLPARAM :
						str.append("Length must be specified when streaming from memory");
						return str.toString();
					case Constant.BASS_ERROR_FILEOPEN:
						str.append("File Cant be opened");
						return str.toString();
					case Constant.BASS_ERROR_FILEFORM:
						str.append("File Format not recognized");
						return str.toString();
					case Constant.BASS_ERROR_NOTAUDIO:
						str.append("File doesnt contain audio, or contain video but video is disabled");
						return str.toString();
					case Constant.BASS_ERROR_CODEC:
						str.append("File use a codec that is not supported");
						return str.toString();
					case Constant.BASS_ERROR_FORMAT:
						str.append("Sample Format is not supported");
						return str.toString();
					case Constant.BASS_ERROR_SPEAKER:
						str.append("Specified SPEAKER flag is invalid");
						return str.toString();
					default:
						str.append("Unknown error code="+err);
						return str.toString();
					}
				case "bass_channelgetdata":
					switch(err) {
					case Constant.BASS_ERROR_ENDED :
						return str.append("Channel has reached the end").toString();
						
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("BASS_DATA_AVAILABLE cant be use with decoding channel, or Not Possible to get Data from final output mix stream using STREAMPROC_DEVICE").toString();
						
					case Constant.BASS_ERROR_ILLPARAM:
						return str.append("invalid flags were used").toString();
						
					default:
						return str.append("Unknown error code="+err).toString();
						
					}
				case "bass_mixer_streamcreate":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("BASS_STREAM_AUTOFREE cannot be combined with BASS_STREAM_DECODE").toString();
						
					case Constant.BASS_ERROR_FORMAT:
						return str.append("Sample format is not supported").toString();
						
					default:
						return str.append("Unknown error code="+err).toString();
						
					}
				case "bass_mixer_streamaddchannel":
					switch(err) {
					case Constant.BASS_ERROR_DECODE:
						return str.append("Source is not decoding channel").toString();
						
					case Constant.BASS_ERROR_ALREADY:
						return str.append("Source already added to a mixer").toString();
						
					default:
						return str.append("Unknown error code="+err).toString();
						
					}
				case "bass_streamfree":
				case "bass_channelfree":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("Device Streams STREAMPROC_DEVICE cannot be freed").toString();
						
					default:
						return str.append("Unknown error code="+err).toString();
						
							
					}
				case "bass_channelstart":
				case "bass_channelplay":
					switch(err) {
					case Constant.BASS_ERROR_DECODE:
						return str.append("Handle is Decoding Channel, cant be played").toString();
						
					case Constant.BASS_ERROR_START:
						return str.append("Output is paused/stopped").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_channelsetdsp":
					switch(err) {
					case Constant.BASS_ERROR_ILLPARAM:
						return str.append("DSPPROC cant NULL").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_channelsetattribute":
					switch(err) {
					case Constant.BASS_ERROR_ILLTYPE:
						return str.append("Attribute Not Valid").toString();
					case Constant.BASS_ERROR_ILLPARAM :
						return str.append("Valud not valid").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_channelgetattribute":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("Attribute Not Available").toString();
					case Constant.BASS_ERROR_ILLTYPE:
						return str.append("Attribute Not Valid").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_setvolume":
				case "bass_getvolume":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("No Volume Control for No-Sound device").toString();
					case Constant.BASS_ERROR_ILLPARAM:
						return str.append("Volume is invalid").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_recordgetdeviceinfo":
					switch(err) {
					case Constant.BASS_ERROR_DX:
						return str.append("DirectX not installed").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_recordgetinputname":
					switch(err) {
					case Constant.BASS_ERROR_ILLPARAM:
						return str.append("Input is Invalid").toString();
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("Master Input is not available").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_recordstart":
					switch(err) {
					case Constant.BASS_ERROR_BUSY:
						return str.append("Device is Busy. Another Recording need to be stopped before starting another one").toString();
					case Constant.BASS_ERROR_DENIED:
						return str.append("Recording permission denied").toString();
					case Constant.BASS_ERROR_FORMAT:
						return str.append("Sample format is not supported").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_recordsetinput":
				case "bass_recordgetinput":
					switch(err) {
					case Constant.BASS_ERROR_ILLPARAM : 
						return str.append("Input or Volume is invalid").toString();
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("Input doesnt have volume control").toString();
					default:
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_pluginload":
					switch(err) {
					case Constant.BASS_ERROR_FILEOPEN:
						return str.append("Plugin could not be opened").toString();
					case Constant.BASS_ERROR_FILEFORM:
						return str.append("File is not plugin").toString();
					case Constant.BASS_ERROR_VERSION:
						return str.append("Plugin version mismatch").toString();
					case Constant.BASS_ERROR_ALREADY:
						return str.append("Plugin already loaded").toString();
					}
				case "bass_encode_aac_start":
				case "bass_encode_mp3_start":
				case "bass_encode_ogg_start":
				case "bass_encode_flac_start":
				case "bass_encode_aac_startfile":
				case "bass_encode_mp3_startfile":
				case "bass_encode_ogg_startfile":
				case "bass_encode_flac_startfile":
					switch(err) {
					case Constant.BASS_ERROR_FORMAT:
						return str.append("Format not supported").toString();
					case Constant.BASS_ERROR_ILLPARAM:
						return str.append("options contains invalid setting").toString();
					case Constant.BASS_ERROR_FILEOPEN:
						return str.append("File could not be opened").toString();
					case Constant.BASS_ERROR_FILEFORM:
						return str.append("File Format invalid").toString();
					case Constant.BASS_ERROR_NOTAVAIL:
						return str.append("Function not available without FPU").toString();
					case Constant.BASS_ERROR_CREATE:
						return str.append("Target file could not be created").toString();
					default :
						return str.append("Unknown error code="+err).toString();
					}
				case "bass_streamputdata":
					switch(err) {
					case Constant.BASS_ERROR_NOTAVAIL :
						str.append("Stream is not using push system");
						return str.toString();
					case Constant.BASS_ERROR_ILLPARAM:
						str.append("Length is not valid");
						return str.toString();
					case Constant.BASS_ERROR_ENDED:
						str.append("Stream has ended");
						return str.toString();
					default:
						str.append("Unknown error code = "+err);
						return str.toString();
					}
				default : 
					return "GetBassError not implemented at "+function;
				}	
			}
		}
		
		/**
		 * Get Bass error in String
		 * @param function function name
		 * @return reason of error in string
		 */
		public default String GetBassError(String function) {
			return GetBassError(function, BASS.BASS_ErrorGetCode());
			
		}
}
