[SCM] Debian packaging for jack-audio-connection-kit branch, upstream, updated. upstream/0.118+svn3796-1-g5632b4c

js at users.alioth.debian.org js at users.alioth.debian.org
Mon Apr 5 14:07:58 UTC 2010


The following commit has been merged in the upstream branch:
commit 5632b4c09540a4142b80f15444c710c7c037b349
Author: dr at jones.dk <dr at jones.dk>
Date:   Sun Apr 4 17:07:11 2010 +0200

    Imported Upstream version 1.9.5~dfsg

diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index 48f2e53..0000000
--- a/.cvsignore
+++ /dev/null
@@ -1,21 +0,0 @@
-*.desc
-*.pc
-*.tar.gz
-*diff
-*diffs
-.deps
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-config.cache
-config.h
-config.h.in
-config.log
-config.status
-configure
-jack.spec
-libtool
-stamp-h
-stamp-h.in
-stamp-h1
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 8a72f3f..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,67 +0,0 @@
-/*.desc
-/*.pc
-/*.tar.gz
-/*diff
-/*diffs
-/.deps
-/Makefile
-/Makefile.in
-/aclocal.m4
-/autom4te.cache
-/config.cache
-/config.h
-/config.h.in
-/config.log
-/config.status
-/configure
-/jack-audio-connection-kit-*
-/jack.spec
-/libtool
-/stamp-h
-/stamp-h.in
-/stamp-h1
-/TAGS
-*.o
-*.lo
-Makefile
-Makefile.in
-.libs
-.deps
-*.la
-config/compile
-config/config.guess
-config/config.sub
-config/depcomp
-config/install-sh
-config/ltmain.sh
-config/missing
-doc/doxygen-build.stamp
-doc/reference.doxygen
-doc/reference/
-example-clients/jack_impulse_grabber
-example-clients/jack_metro
-example-clients/jack_midiseq
-example-clients/jack_midisine
-example-clients/jack_showtime
-example-clients/jack_simple_client
-example-clients/jack_transport_client
-jack/version.h
-jackd/jack_md5.h
-jackd/jackd
-jackd/jackd.1
-tags
-tools/alsa_in
-tools/alsa_out
-tools/jack_alias
-tools/jack_connect
-tools/jack_disconnect
-tools/jack_evmon
-tools/jack_freewheel
-tools/jack_load
-tools/jack_lsp
-tools/jack_monitor_client
-tools/jack_netsource
-tools/jack_thread_wait
-tools/jack_transport
-tools/jack_unload
-tools/jackrec
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Build.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Build.py
new file mode 100644
index 0000000..df93caa
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Build.py
@@ -0,0 +1,525 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import os,sys,cPickle,types,imp,errno,re,glob,gc,time,shutil
+import Runner,TaskGen,Node,Scripting,Utils,Environment,Task,Logs,Options
+from Logs import debug,error,info
+from Constants import*
+SAVED_ATTRS='root srcnode bldnode node_sigs node_deps raw_deps task_sigs id_nodes'.split()
+g_modcache={}
+bld=None
+class BuildError(Utils.WafError):
+	def __init__(self,b=None,t=[]):
+		self.bld=b
+		self.tasks=t
+		self.ret=1
+		Utils.WafError.__init__(self,self.format_error())
+	def format_error(self):
+		lst=['Build failed']
+		for tsk in self.tasks:
+			txt=tsk.format_error()
+			if txt:lst.append(txt)
+		return'\n'.join(lst)
+class BuildContext(object):
+	def __init__(self):
+		global bld
+		bld=self
+		self.task_manager=Task.TaskManager()
+		self.id_nodes=0
+		self.all_envs={}
+		self.bdir=''
+		self.path=None
+		self.cache_node_abspath={}
+		self.cache_scanned_folders={}
+		self.uninstall=[]
+		for v in'cache_node_abspath task_sigs node_deps raw_deps node_sigs'.split():
+			var={}
+			setattr(self,v,var)
+		self.cache_dir_contents={}
+		self.all_task_gen=[]
+		self.task_gen_cache_names={}
+		self.cache_sig_vars={}
+		self.log=None
+		self.root=None
+		self.srcnode=None
+		self.bldnode=None
+		class node_class(Node.Node):
+			pass
+		self.node_class=node_class
+		self.node_class.__module__="Node"
+		self.node_class.__name__="Nodu"
+		self.node_class.bld=self
+	def load(self):
+		try:
+			env=Environment.Environment(os.path.join(self.cachedir,'build.config.py'))
+		except(IOError,OSError):
+			pass
+		else:
+			if env['version']<HEXVERSION:
+				raise Utils.WafError('Version mismatch! reconfigure the project')
+			for t in env['tools']:
+				self.setup(**t)
+		try:
+			gc.disable()
+			f=data=None
+			Node.Nodu=self.node_class
+			try:
+				f=open(os.path.join(self.bdir,DBFILE),'rb')
+			except(IOError,EOFError):
+				pass
+			try:
+				if f:data=cPickle.load(f)
+			except AttributeError:
+				if Logs.verbose>1:raise
+			if data:
+				for x in SAVED_ATTRS:setattr(self,x,data[x])
+			else:
+				debug('build: Build cache loading failed')
+		finally:
+			if f:f.close()
+			gc.enable()
+	def save(self):
+		gc.disable()
+		self.root.__class__.bld=None
+		Node.Nodu=self.node_class
+		file=open(os.path.join(self.bdir,DBFILE),'wb')
+		data={}
+		for x in SAVED_ATTRS:data[x]=getattr(self,x)
+		cPickle.dump(data,file,-1)
+		file.close()
+		self.root.__class__.bld=self
+		gc.enable()
+	def clean(self):
+		debug('build: clean called')
+		def clean_rec(node):
+			for x in node.childs.keys():
+				nd=node.childs[x]
+				tp=nd.id&3
+				if tp==Node.DIR:
+					clean_rec(nd)
+				elif tp==Node.BUILD:
+					for env in self.all_envs.values():
+						pt=nd.abspath(env)
+						if pt in env['waf_config_files']:continue
+						try:os.remove(pt)
+						except OSError:pass
+					node.childs.__delitem__(x)
+		node=self.srcnode
+		clean_rec(node)
+		if node==self.srcnode:
+			for v in'node_sigs node_deps task_sigs raw_deps cache_node_abspath'.split():
+				var={}
+				setattr(self,v,var)
+	def compile(self):
+		debug('build: compile called')
+		os.chdir(self.bdir)
+		self.flush()
+		self.generator=Runner.Parallel(self,Options.options.jobs)
+		def dw(on=True):
+			if Options.options.progress_bar:
+				if on:sys.stdout.write(Logs.colors.cursor_on)
+				else:sys.stdout.write(Logs.colors.cursor_off)
+		debug('build: executor starting')
+		try:
+			dw(on=False)
+			self.generator.start()
+		except KeyboardInterrupt:
+			dw()
+			os.chdir(self.srcnode.abspath())
+			self.save()
+			Utils.pprint('RED','Build interrupted')
+			if Logs.verbose>1:raise
+			else:sys.exit(68)
+		except Exception:
+			dw()
+			raise
+		else:
+			dw()
+			self.save()
+		if self.generator.error:
+			os.chdir(self.srcnode.abspath())
+			raise BuildError(self,self.task_manager.tasks_done)
+		os.chdir(self.srcnode.abspath())
+	def install(self):
+		debug('build: install called')
+		self.flush()
+		if Options.commands['uninstall']:
+			lst=[]
+			for x in self.uninstall:
+				dir=os.path.dirname(x)
+				if not dir in lst:lst.append(dir)
+			lst.sort()
+			lst.reverse()
+			nlst=[]
+			for y in lst:
+				x=y
+				while len(x)>4:
+					if not x in nlst:nlst.append(x)
+					x=os.path.dirname(x)
+			nlst.sort()
+			nlst.reverse()
+			for x in nlst:
+				try:os.rmdir(x)
+				except OSError:pass
+	def add_subdirs(self,dirs):
+		for dir in Utils.to_list(dirs):
+			if dir:Scripting.add_subdir(dir,self)
+	def new_task_gen(self,*k,**kw):
+		kw['bld']=self
+		if len(k)==0:return TaskGen.task_gen(*k,**kw)
+		cls_name=k[0]
+		try:cls=TaskGen.task_gen.classes[cls_name]
+		except KeyError:raise Utils.WscriptError('%s is not a valid task generator -> %s'%(cls_name,[x for x in TaskGen.task_gen.classes]))
+		else:return cls(*k,**kw)
+	def load_envs(self):
+		try:
+			lst=Utils.listdir(self.cachedir)
+		except OSError,e:
+			if e.errno==errno.ENOENT:
+				raise Utils.WafError('The project was not configured: run "waf configure" first!')
+			else:
+				raise
+		if not lst:
+			raise Utils.WafError('The cache directory is empty: reconfigure the project')
+		for file in lst:
+			if file.endswith(CACHE_SUFFIX):
+				env=Environment.Environment(os.path.join(self.cachedir,file))
+				name=file.split('.')[0]
+				self.all_envs[name]=env
+		self.init_variants()
+		for env in self.all_envs.values():
+			for f in env['dep_files']:
+				newnode=self.srcnode.find_or_declare(f)
+				try:
+					hash=Utils.h_file(newnode.abspath(env))
+				except(IOError,AttributeError):
+					error("cannot find "+f)
+					hash=SIG_NIL
+				self.node_sigs[env.variant()][newnode.id]=hash
+	def setup(self,tool,tooldir=None,funs=None):
+		if type(tool)is types.ListType:
+			for i in tool:self.setup(i,tooldir)
+			return
+		if not tooldir:tooldir=Options.tooldir
+		file=None
+		key=str((tool,tooldir))
+		module=g_modcache.get(key,None)
+		if not module:
+			file,name,desc=imp.find_module(tool,tooldir)
+			module=imp.load_module(tool,file,name,desc)
+			g_modcache[key]=module
+		if hasattr(module,"setup"):module.setup(self)
+		if file:file.close()
+	def init_variants(self):
+		debug('build: init variants')
+		lstvariants=[]
+		for env in self.all_envs.values():
+			if not env.variant()in lstvariants:
+				lstvariants.append(env.variant())
+		self.lst_variants=lstvariants
+		debug('build: list of variants is %s'%str(lstvariants))
+		for name in lstvariants+[0]:
+			for v in'node_sigs cache_node_abspath'.split():
+				var=getattr(self,v)
+				if not name in var:
+					var[name]={}
+	def load_dirs(self,srcdir,blddir,load_cache=1):
+		assert(os.path.isabs(srcdir))
+		assert(os.path.isabs(blddir))
+		self.cachedir=os.path.join(blddir,CACHE_DIR)
+		if srcdir==blddir:
+			raise Utils.WafError("build dir must be different from srcdir: %s <-> %s "%(srcdir,blddir))
+		self.bdir=blddir
+		if load_cache:self.load()
+		if not self.root:
+			Node.Nodu=self.node_class
+			self.root=Node.Nodu('',None,Node.DIR)
+		if not self.srcnode:
+			self.srcnode=self.root.ensure_dir_node_from_path(srcdir)
+		debug('build: srcnode is %s and srcdir %s'%(str(self.srcnode.name),srcdir))
+		self.path=self.srcnode
+		try:os.makedirs(blddir)
+		except OSError:pass
+		if not self.bldnode:
+			self.bldnode=self.root.ensure_dir_node_from_path(blddir)
+		self.init_variants()
+	def rescan(self,src_dir_node):
+		if self.cache_scanned_folders.get(src_dir_node.id,None):return
+		self.cache_scanned_folders[src_dir_node.id]=1
+		if hasattr(self,'repository'):self.repository(src_dir_node)
+		if sys.platform=="win32"and not src_dir_node.name:
+			return
+		self.listdir_src(src_dir_node,src_dir_node.abspath())
+		h1=self.srcnode.height()
+		h2=src_dir_node.height()
+		lst=[]
+		child=src_dir_node
+		while h2>h1:
+			lst.append(child.name)
+			child=child.parent
+			h2-=1
+		lst.reverse()
+		for variant in self.lst_variants:
+			sub_path=os.path.join(self.bldnode.abspath(),variant,*lst)
+			try:
+				self.listdir_bld(src_dir_node,sub_path,variant)
+			except OSError:
+				dict=self.node_sigs[variant]
+				for node in src_dir_node.childs.values():
+					if node.id in dict:
+						dict.__delitem__(node.id)
+					if node.id!=self.bldnode.id:
+						src_dir_node.childs.__delitem__(node.name)
+				os.makedirs(sub_path)
+	def listdir_src(self,parent_node,path):
+		listed_files=set(Utils.listdir(path))
+		self.cache_dir_contents[parent_node.id]=listed_files
+		debug('build: folder contents '+str(listed_files))
+		node_names=set([x.name for x in parent_node.childs.values()if x.id&3==Node.FILE])
+		cache=self.node_sigs[0]
+		to_keep=listed_files&node_names
+		for x in to_keep:
+			node=parent_node.childs[x]
+			try:
+				cache[node.id]=Utils.h_file(path+os.sep+node.name)
+			except IOError:
+				raise Utils.WafError("The file %s is not readable or has become a dir"%node.abspath())
+		to_remove=node_names-listed_files
+		if to_remove:
+			cache=self.node_sigs[0]
+			for name in to_remove:
+				nd=parent_node.childs[name]
+				if nd.id in cache:
+					cache.__delitem__(nd.id)
+				parent_node.childs.__delitem__(name)
+	def listdir_bld(self,parent_node,path,variant):
+		i_existing_nodes=[x for x in parent_node.childs.values()if x.id&3==Node.BUILD]
+		listed_files=set(Utils.listdir(path))
+		node_names=set([x.name for x in i_existing_nodes])
+		remove_names=node_names-listed_files
+		ids_to_remove=[x.id for x in i_existing_nodes if x.name in remove_names]
+		cache=self.node_sigs[variant]
+		for nid in ids_to_remove:
+			if nid in cache:
+				cache.__delitem__(nid)
+	def get_env(self):
+		return self.env_of_name('default')
+	def set_env(self,name,val):
+		self.all_envs[name]=val
+	env=property(get_env,set_env)
+	def add_manual_dependency(self,path,value):
+		h=getattr(self,'deps_man',{})
+		if isinstance(path,Node.Node):
+			node=path
+		elif os.path.isabs(path):
+			node=self.root.find_resource(path)
+		else:
+			node=self.path.find_resource(path)
+		try:h[node.id].append(value)
+		except KeyError:h[node.id]=[value]
+		self.deps_man=h
+	def launch_node(self):
+		try:
+			return self.p_ln
+		except AttributeError:
+			self.p_ln=self.root.find_dir(Options.launch_dir)
+			return self.p_ln
+	def glob(self,pattern,relative=True):
+		path=self.path.abspath()
+		files=[self.root.find_resource(x)for x in glob.glob(path+os.sep+pattern)]
+		if relative:
+			files=[x.path_to_parent(self.path)for x in files if x]
+		else:
+			files=[x.abspath()for x in files if x]
+		return files
+	def add_group(self):
+		self.flush(all=0)
+		self.task_manager.add_group()
+	def hash_env_vars(self,env,vars_lst):
+		idx=str(id(env))+str(vars_lst)
+		try:return self.cache_sig_vars[idx]
+		except KeyError:pass
+		lst=[env.get_flat(a)for a in vars_lst]
+		ret=Utils.h_list(lst)
+		debug("envhash: %s %s"%(ret.encode('hex'),str(lst)))
+		self.cache_sig_vars[idx]=ret
+		return ret
+	def name_to_obj(self,name,env):
+		cache=self.task_gen_cache_names
+		if not cache:
+			for x in self.all_task_gen:
+				vt=x.env.variant()+'_'
+				if x.name:
+					cache[vt+x.name]=x
+				else:
+					v=vt+x.target
+					if not cache.get(v,None):
+						cache[v]=x
+		return cache.get(env.variant()+'_'+name,None)
+	def flush(self,all=1):
+		self.ini=time.time()
+		self.task_gen_cache_names={}
+		self.name_to_obj('',self.env)
+		debug('build: delayed operation TaskGen.flush() called')
+		if Options.options.compile_targets:
+			debug('task_gen: posting objects listed in compile_targets')
+			target_objects={}
+			for target_name in Options.options.compile_targets.split(','):
+				target_name=target_name.strip()
+				for env in self.all_envs.values():
+					obj=self.name_to_obj(target_name,env)
+					if obj:
+						try:
+							target_objects[target_name].append(obj)
+						except KeyError:
+							target_objects[target_name]=[obj]
+				if not target_name in target_objects and all:
+					raise Utils.WafError("target '%s' does not exist"%target_name)
+			for target_obj in target_objects.values():
+				for x in target_obj:
+					x.post()
+		else:
+			debug('task_gen: posting objects (normal)')
+			ln=self.launch_node()
+			if ln.is_child_of(self.bldnode)or not ln.is_child_of(self.srcnode):
+				ln=self.srcnode
+			for obj in self.all_task_gen:
+				if not obj.path.is_child_of(ln):continue
+				obj.post()
+	def env_of_name(self,name):
+		if not name:
+			error('env_of_name called with no name!')
+			return None
+		try:
+			return self.all_envs[name]
+		except KeyError:
+			error('no such environment: '+name)
+			return None
+	def progress_line(self,state,total,col1,col2):
+		n=len(str(total))
+		Utils.rot_idx+=1
+		ind=Utils.rot_chr[Utils.rot_idx%4]
+		ini=self.ini
+		pc=(100.*state)/total
+		eta=time.strftime('%H:%M:%S',time.gmtime(time.time()-ini))
+		fs="[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s]["%(n,n,ind)
+		left=fs%(state,total,col1,pc,col2)
+		right='][%s%s%s]'%(col1,eta,col2)
+		cols=Utils.get_term_cols()-len(left)-len(right)+2*len(col1)+2*len(col2)
+		if cols<7:cols=7
+		ratio=int((cols*state)/total)-1
+		bar=('='*ratio+'>').ljust(cols)
+		msg=Utils.indicator%(left,bar,right)
+		return msg
+	def do_install(self,src,tgt,chmod=0644):
+		if Options.commands['install']:
+			if not Options.options.force:
+				try:
+					t1=os.stat(tgt).st_mtime
+					t2=os.stat(src).st_mtime
+				except OSError:
+					pass
+				else:
+					if t1>=t2:
+						return False
+			srclbl=src.replace(self.srcnode.abspath(None)+os.sep,'')
+			info("* installing %s as %s"%(srclbl,tgt))
+			try:os.remove(tgt)
+			except OSError:pass
+			try:
+				shutil.copy2(src,tgt)
+				os.chmod(tgt,chmod)
+			except IOError:
+				try:
+					os.stat(src)
+				except IOError:
+					error('File %r does not exist'%src)
+				raise Utils.WafError('Could not install the file %r'%tgt)
+			return True
+		elif Options.commands['uninstall']:
+			info("* uninstalling %s"%tgt)
+			self.uninstall.append(tgt)
+			try:os.remove(tgt)
+			except OSError:pass
+			return True
+	def get_install_path(self,path,env=None):
+		if not env:env=self.env
+		destdir=env.get_destdir()
+		destpath=Utils.subst_vars(path,env)
+		if destdir:
+			destpath=os.path.join(destdir,destpath.lstrip(os.sep))
+		return destpath
+	def install_files(self,path,files,env=None,chmod=0644,relative_trick=False):
+		if not Options.is_install:return[]
+		if not path:return[]
+		node=self.path
+		if type(files)is types.StringType and'*'in files:
+			gl=node.abspath()+os.sep+files
+			lst=glob.glob(gl)
+		else:
+			lst=Utils.to_list(files)
+		env=env or self.env
+		destpath=self.get_install_path(path,env)
+		Utils.check_dir(destpath)
+		installed_files=[]
+		for filename in lst:
+			if not os.path.isabs(filename):
+				nd=node.find_resource(filename)
+				if not nd:
+					raise Utils.WafError("Unable to install the file `%s': not found in %s"%(filename,node))
+				if relative_trick:
+					destfile=os.path.join(destpath,filename)
+					Utils.check_dir(os.path.dirname(destfile))
+				else:
+					destfile=os.path.join(destpath,nd.name)
+				filename=nd.abspath(env)
+			else:
+				alst=Utils.split_path(filename)
+				destfile=os.path.join(destpath,alst[-1])
+			if self.do_install(filename,destfile,chmod):
+				installed_files.append(destfile)
+		return installed_files
+	def install_as(self,path,srcfile,env=None,chmod=0644):
+		if not Options.is_install:return False
+		if not path:return False
+		if not env:env=self.env
+		node=self.path
+		destpath=self.get_install_path(path,env)
+		dir,name=os.path.split(destpath)
+		Utils.check_dir(dir)
+		if not os.path.isabs(srcfile):
+			filenode=node.find_resource(srcfile)
+			src=filenode.abspath(env)
+		else:
+			src=srcfile
+		return self.do_install(src,destpath,chmod)
+	def symlink_as(self,path,src,env=None):
+		if not Options.is_install:return
+		if not path:return
+		tgt=self.get_install_path(path,env)
+		dir,name=os.path.split(tgt)
+		Utils.check_dir(dir)
+		if Options.commands['install']:
+			try:
+				if not os.path.islink(tgt)or os.readlink(tgt)!=src:
+					info("* symlink %s (-> %s)"%(tgt,src))
+					os.symlink(src,tgt)
+				return 0
+			except OSError:
+				return 1
+		elif Options.commands['uninstall']:
+			try:
+				info("* removing %s"%(tgt))
+				os.remove(tgt)
+				return 0
+			except OSError:
+				return 1
+	def exec_command(self,cmd,shell=1):
+		debug('runner: system command -> %s'%cmd)
+		return Utils.exec_command(cmd,shell=shell,log=self.log)
+	def printout(self,s):
+		f=self.log or sys.stdout
+		f.write(s)
+		f.flush()
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Configure.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Configure.py
new file mode 100644
index 0000000..4c1a9e6
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Configure.py
@@ -0,0 +1,179 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,types,imp,cPickle
+import Environment,Utils,Options
+from Logs import warn
+from Constants import*
+class ConfigurationError(Utils.WscriptError):
+	pass
+autoconfig=False
+def find_file(filename,path_list):
+	if type(path_list)is types.StringType:
+		lst=path_list.split()
+	else:
+		lst=path_list
+	for directory in lst:
+		if os.path.exists(os.path.join(directory,filename)):
+			return directory
+	return''
+def find_program_impl(env,filename,path_list=[],var=None):
+	try:path_list=path_list.split()
+	except AttributeError:pass
+	if var:
+		if var in os.environ:env[var]=os.environ[var]
+		if env[var]:return env[var]
+	if not path_list:path_list=os.environ['PATH'].split(os.pathsep)
+	ext=(Options.platform=='win32')and'.exe,.com,.bat,.cmd'or''
+	for y in[filename+x for x in ext.split(',')]:
+		for directory in path_list:
+			x=os.path.join(directory,y)
+			if os.path.isfile(x):
+				x=Utils.quote_whitespace(x)
+				if var:env[var]=x
+				return x
+	return''
+class ConfigurationContext(object):
+	tests={}
+	error_handlers=[]
+	def __init__(self,env=None,blddir='',srcdir=''):
+		self.env=None
+		self.envname=''
+		self.line_just=40
+		self.blddir=blddir
+		self.srcdir=srcdir
+		self.cachedir=os.path.join(blddir,CACHE_DIR)
+		self.all_envs={}
+		self.defines={}
+		self.cwd=os.getcwd()
+		self.tools=[]
+		self.setenv(DEFAULT)
+		self.lastprog=''
+		self.hash=0
+		self.files=[]
+		path=os.path.join(self.blddir,WAF_CONFIG_LOG)
+		try:os.unlink(path)
+		except(OSError,IOError):pass
+		self.log=open(path,'wb')
+	def __del__(self):
+		if hasattr(self,'log')and self.log:
+			self.log.close()
+	def fatal(self,msg):
+		raise ConfigurationError(msg)
+	def check_tool(self,input,tooldir=None,funs=None):
+		tools=Utils.to_list(input)
+		if tooldir:tooldir=Utils.to_list(tooldir)
+		for tool in tools:
+			try:
+				file,name,desc=imp.find_module(tool,tooldir)
+			except ImportError:
+				self.fatal("no tool named '%s' found."%tool)
+			module=imp.load_module(tool,file,name,desc)
+			func=getattr(module,'detect',None)
+			if func:
+				if type(func)is types.FunctionType:func(self)
+				else:self.eval_rules(funs or func)
+			self.tools.append({'tool':tool,'tooldir':tooldir,'funs':funs})
+	def sub_config(self,dir):
+		current=self.cwd
+		self.cwd=os.path.join(self.cwd,dir)
+		cur=os.path.join(self.cwd,WSCRIPT_FILE)
+		mod=Utils.load_module(cur)
+		if not hasattr(mod,'configure'):
+			self.fatal('the module %s has no configure function; make sure such a function is defined'%cur)
+		ret=mod.configure(self)
+		global autoconfig
+		if autoconfig:
+			self.hash=Utils.hash_function_with_globals(self.hash,mod.configure)
+			self.files.append(os.path.abspath(cur))
+		self.cwd=current
+		return ret
+	def store(self,file=''):
+		if not os.path.isdir(self.cachedir):
+			os.makedirs(self.cachedir)
+		file=open(os.path.join(self.cachedir,'build.config.py'),'w')
+		file.write('version = 0x%x\n'%HEXVERSION)
+		file.write('tools = %r\n'%self.tools)
+		file.close()
+		if not self.all_envs:
+			self.fatal('nothing to store in the configuration context!')
+		for key in self.all_envs:
+			tmpenv=self.all_envs[key]
+			tmpenv.store(os.path.join(self.cachedir,key+CACHE_SUFFIX))
+	def set_env_name(self,name,env):
+		self.all_envs[name]=env
+		return env
+	def retrieve(self,name,fromenv=None):
+		try:
+			env=self.all_envs[name]
+		except KeyError:
+			env=Environment.Environment()
+			self.all_envs[name]=env
+		else:
+			if fromenv:warn("The environment %s may have been configured already"%name)
+		return env
+	def setenv(self,name):
+		self.env=self.retrieve(name)
+		self.envname=name
+	def add_os_flags(self,var,dest=None):
+		if not dest:dest=var
+		try:self.env[dest]=os.environ[var]
+		except KeyError:pass
+	def check_message_1(self,sr):
+		self.line_just=max(self.line_just,len(sr))
+		self.log.write(sr+'\n\n')
+		print"%s :"%sr.ljust(self.line_just),
+	def check_message_2(self,sr,color='GREEN'):
+		Utils.pprint(color,sr)
+	def check_message(self,th,msg,state,option=''):
+		sr='Checking for %s %s'%(th,msg)
+		self.check_message_1(sr)
+		p=self.check_message_2
+		if state:p('ok '+option)
+		else:p('not found','YELLOW')
+	def check_message_custom(self,th,msg,custom,option='',color='PINK'):
+		sr='Checking for %s %s'%(th,msg)
+		self.check_message_1(sr)
+		self.check_message_2(custom,color)
+	def find_program(self,filename,path_list=[],var=None):
+		ret=find_program_impl(self.env,filename,path_list,var)
+		self.check_message('program',filename,ret,ret)
+		return ret
+	def __getattr__(self,name):
+		r=self.__class__.__dict__.get(name,None)
+		if r:return r
+		if name and name.startswith('require_'):
+			for k in['check_','find_']:
+				n=name.replace('require_',k)
+				ret=self.__class__.__dict__.get(n,None)
+				if ret:
+					def run(*k,**kw):
+						r=ret(self,*k,**kw)
+						if not r:
+							self.fatal('requirement failure')
+						return r
+					return run
+		self.fatal('No such method %r'%name)
+	def eval_rules(self,rules):
+		self.rules=Utils.to_list(rules)
+		for x in self.rules:
+			f=getattr(self,x)
+			try:
+				f()
+			except Exception,e:
+				ret=self.err_handler(x,e)
+				if ret==BREAK:
+					break
+				elif ret==CONTINUE:
+					continue
+				else:
+					raise
+	def err_handler(self,fun,error):
+		pass
+def conf(f):
+	setattr(ConfigurationContext,f.__name__,f)
+	return f
+def conftest(f):
+	ConfigurationContext.tests[f.__name__]=f
+	return conf(f)
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Constants.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Constants.py
new file mode 100644
index 0000000..f9d05c2
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Constants.py
@@ -0,0 +1,41 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+HEXVERSION=0x10500
+WAFVERSION="1.5.0"
+ABI=6
+CACHE_DIR='c4che'
+CACHE_SUFFIX='.cache.py'
+DBFILE='.wafpickle-%d'%ABI
+WSCRIPT_FILE='wscript'
+WSCRIPT_BUILD_FILE='wscript_build'
+WAF_CONFIG_LOG='config.log'
+WAF_CONFIG_H='config.h'
+COMMON_INCLUDES='COMMON_INCLUDES'
+SIG_NIL='iluvcuteoverload'
+VARIANT='_VARIANT_'
+DEFAULT='default'
+SRCDIR='srcdir'
+BLDDIR='blddir'
+APPNAME='APPNAME'
+VERSION='VERSION'
+DEFINES='defines'
+UNDEFINED='#undefined#variable#for#defines#'
+BREAK="break"
+CONTINUE="continue"
+JOBCONTROL="JOBCONTROL"
+MAXPARALLEL="MAXPARALLEL"
+NORMAL="NORMAL"
+NOT_RUN=0
+MISSING=1
+CRASHED=2
+EXCEPTION=3
+SKIPPED=8
+SUCCESS=9
+ASK_LATER=-1
+SKIP_ME=-2
+RUN_ME=-3
+LOG_FORMAT="%(asctime)s %(c1)s%(zone)s%(c2)s %(message)s"
+HOUR_FORMAT="%H:%M:%S"
+TEST_OK=True
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Environment.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Environment.py
new file mode 100644
index 0000000..fd2fa22
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Environment.py
@@ -0,0 +1,128 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import os,copy,re
+import Logs,Options
+from Constants import*
+re_imp=re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$',re.M)
+class Environment(object):
+	__slots__=("table","parent")
+	def __init__(self,filename=None):
+		self.table={}
+		if Options.commands['configure']:
+			self.table['PREFIX']=os.path.abspath(os.path.expanduser(Options.options.prefix))
+		if filename:
+			self.load(filename)
+	def __contains__(self,key):
+		if key in self.table:return True
+		try:return self.parent.__contains__(key)
+		except AttributeError:return False
+	def __str__(self):
+		keys=set()
+		cur=self
+		while cur:
+			keys.update(cur.table.keys())
+			cur=getattr(cur,'parent',None)
+		keys=list(keys)
+		keys.sort()
+		return"\n".join(["%r %r"%(x,self.__getitem__(x))for x in keys])
+	def set_variant(self,name):
+		self.table[VARIANT]=name
+	def variant(self):
+		env=self
+		while 1:
+			try:
+				return env.table[VARIANT]
+			except KeyError:
+				try:env=env.parent
+				except AttributeError:return DEFAULT
+	def copy(self):
+		newenv=Environment()
+		if Options.commands['configure']:
+			if self['PREFIX']:del newenv.table['PREFIX']
+		newenv.parent=self
+		return newenv
+	def __getitem__(self,key):
+		x=self.table.get(key,None)
+		if not x is None:return x
+		try:
+			u=self.parent
+		except AttributeError:
+			return[]
+		else:
+			return u[key]
+	def __setitem__(self,key,value):
+		self.table[key]=value
+	def get_flat(self,key):
+		s=self[key]
+		if not s:return''
+		elif isinstance(s,list):return' '.join(s)
+		else:return s
+	def _get_list_value_for_modification(self,key):
+		try:
+			value=self.table[key]
+		except KeyError:
+			try:value=self.parent[key]
+			except AttributeError:value=[]
+			if isinstance(value,list):
+				value=copy.copy(value)
+			else:
+				value=[value]
+			self.table[key]=value
+			return value
+		else:
+			if not isinstance(value,list):
+				value=[value]
+				self.table[key]=value
+			return value
+	def append_value(self,var,value):
+		current_value=self._get_list_value_for_modification(var)
+		if isinstance(value,list):
+			current_value.extend(value)
+		else:
+			current_value.append(value)
+	def prepend_value(self,var,value):
+		current_value=self._get_list_value_for_modification(var)
+		if isinstance(value,list):
+			current_value=value+current_value
+			self.table[var]=current_value
+		else:
+			current_value.insert(0,value)
+	def append_unique(self,var,value):
+		current_value=self._get_list_value_for_modification(var)
+		if isinstance(value,list):
+			for value_item in value:
+				if value_item not in current_value:
+					current_value.append(value_item)
+		else:
+			if value not in current_value:
+				current_value.append(value)
+	def store(self,filename):
+		file=open(filename,'w')
+		table_list=[]
+		env=self
+		while 1:
+			table_list.insert(0,env.table)
+			try:env=env.parent
+			except AttributeError:break
+		merged_table={}
+		for table in table_list:
+			merged_table.update(table)
+		keys=merged_table.keys()
+		keys.sort()
+		for k in keys:file.write('%s = %r\n'%(k,merged_table[k]))
+		file.close()
+	def load(self,filename):
+		tbl=self.table
+		file=open(filename,'r')
+		code=file.read()
+		file.close()
+		for m in re_imp.finditer(code):
+			g=m.group
+			tbl[g(2)]=eval(g(3))
+		Logs.debug('env: %s'%str(self.table))
+	def get_destdir(self):
+		if self.__getitem__('NOINSTALL'):return''
+		return Options.options.destdir
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Logs.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Logs.py
new file mode 100644
index 0000000..9ead328
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Logs.py
@@ -0,0 +1,80 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,re,logging,traceback,sys,Utils
+from Constants import*
+zones=''
+verbose=0
+colors_lst={'USE':True,'BOLD':'\x1b[01;1m','RED':'\x1b[01;91m','GREEN':'\x1b[32m','YELLOW':'\x1b[33m','PINK':'\x1b[35m','BLUE':'\x1b[01;34m','CYAN':'\x1b[36m','NORMAL':'\x1b[0m','cursor_on':'\x1b[?25h','cursor_off':'\x1b[?25l',}
+if(sys.platform=='win32')or('NOCOLOR'in os.environ)or(os.environ.get('TERM','dumb')in['dumb','emacs'])or(not sys.stdout.isatty()):
+	colors_lst['USE']=False
+def get_color(cl):
+	if not colors_lst['USE']:return''
+	return colors_lst.get(cl,'')
+class foo(object):
+	def __getattr__(self,a):
+		return get_color(a)
+	def __call__(self,a):
+		return get_color(a)
+colors=foo()
+re_log=re.compile(r'(\w+): (.*)',re.M)
+class log_filter(logging.Filter):
+	def __init__(self,name=None):
+		pass
+	def filter(self,rec):
+		rec.c1=colors.PINK
+		rec.c2=colors.NORMAL
+		rec.zone=rec.module
+		if rec.levelno>=logging.INFO:
+			if rec.levelno>=logging.ERROR:
+				rec.c1=colors.RED
+			else:
+				rec.c1=colors.GREEN
+			return True
+		zone=''
+		m=re_log.match(rec.msg)
+		if m:
+			zone=rec.zone=m.group(1)
+			rec.msg=m.group(2)
+		if zones:
+			return getattr(rec,'zone','')in zones or'*'in zones
+		elif not verbose>2:
+			return False
+		return True
+class formatter(logging.Formatter):
+	def __init__(self):
+		logging.Formatter.__init__(self,LOG_FORMAT,HOUR_FORMAT)
+	def format(self,rec):
+		if rec.levelno>=logging.WARNING or rec.levelno==logging.INFO:
+			return'%s%s%s'%(rec.c1,rec.msg,rec.c2)
+		return logging.Formatter.format(self,rec)
+def debug(msg):
+	msg=msg.replace('\n',' ')
+	if verbose:
+		logging.debug(msg)
+def error(msg):
+	logging.error(msg)
+	if verbose:
+		if isinstance(msg,Utils.WafError):
+			st=msg.stack
+		else:
+			st=traceback.extract_stack()
+		if st:
+			st=st[:-1]
+			buf=[]
+			for filename,lineno,name,line in st:
+				buf.append('  File "%s", line %d, in %s'%(filename,lineno,name))
+				if line:
+					buf.append('	%s'%line.strip())
+			if buf:logging.error("\n".join(buf))
+warn=logging.warn
+info=logging.info
+def init_log():
+	log=logging.getLogger()
+	log.handlers=[]
+	hdlr=logging.StreamHandler()
+	hdlr.setFormatter(formatter())
+	log.addHandler(hdlr)
+	log.addFilter(log_filter())
+	log.setLevel(logging.DEBUG)
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Node.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Node.py
new file mode 100644
index 0000000..663848e
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Node.py
@@ -0,0 +1,338 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,types
+import Utils,Build
+UNDEFINED=0
+DIR=1
+FILE=2
+BUILD=3
+type_to_string={UNDEFINED:"unk",DIR:"dir",FILE:"src",BUILD:"bld"}
+class Node(object):
+	__slots__=("name","parent","id","childs")
+	def __init__(self,name,parent,node_type=UNDEFINED):
+		self.name=name
+		self.parent=parent
+		self.__class__.bld.id_nodes+=4
+		self.id=self.__class__.bld.id_nodes+node_type
+		if node_type==DIR:self.childs={}
+		if Utils.split_path(name)[0]!=name:
+			raise Utils.WafError('name forbidden '+name)
+		if parent and name in parent.childs:
+			raise Utils.WafError('node %s exists in the parent files %s already'%(name,str(parent)))
+		if parent:parent.childs[name]=self
+	def __str__(self):
+		if not self.parent:return''
+		return"%s://%s"%(type_to_string[self.id&3],self.abspath())
+	def __repr__(self):
+		return self.__str__()
+	def __hash__(self):
+		raise Utils.WafError('nodes, you are doing it wrong')
+	def get_type(self):
+		return self.id&3
+	def set_type(self,t):
+		self.id=self.id+t-self.id&3
+	def dirs(self):
+		return[x for x in self.childs.values()if x.id&3==DIR]
+	def files(self):
+		return[x for x in self.childs.values()if x.id&3==FILE]
+	def get_dir(self,name,default=None):
+		node=self.childs.get(name,None)
+		if not node or node.id&3!=DIR:return default
+		return node
+	def get_file(self,name,default=None):
+		node=self.childs.get(name,None)
+		if not node or node.id&3!=FILE:return default
+		return node
+	def get_build(self,name,default=None):
+		node=self.childs.get(name,None)
+		if not node or node.id&3!=BUILD:return default
+		return node
+	def find_resource(self,lst):
+		if type(lst)is types.StringType:
+			lst=Utils.split_path(lst)
+		if not lst[:-1]:
+			parent=self
+		else:
+			parent=self.find_dir(lst[:-1])
+			if not parent:return None
+		self.__class__.bld.rescan(parent)
+		name=lst[-1]
+		node=parent.childs.get(name,None)
+		if node:
+			tp=node.id&3
+			if tp==FILE or tp==BUILD:
+				return node
+		tree=self.__class__.bld
+		if not name in tree.cache_dir_contents[parent.id]:
+			return None
+		path=parent.abspath()+os.sep+name
+		try:
+			st=Utils.h_file(path)
+		except IOError:
+			return None
+		child=self.__class__(name,parent,FILE)
+		tree.node_sigs[0][child.id]=st
+		return child
+	def find_or_declare(self,lst):
+		if type(lst)is types.StringType:
+			lst=Utils.split_path(lst)
+		if not lst[:-1]:
+			parent=self
+		else:
+			parent=self.find_dir(lst[:-1])
+			if not parent:return None
+		self.__class__.bld.rescan(parent)
+		name=lst[-1]
+		node=parent.childs.get(name,None)
+		if node:
+			tp=node.id&3
+			if tp!=BUILD:
+				raise Utils.WafError("find_or_declare returns a build node, not a source nor a directory"+str(lst))
+			return node
+		node=self.__class__(name,parent,BUILD)
+		return node
+	def find_dir(self,lst):
+		if type(lst)is types.StringType:
+			lst=Utils.split_path(lst)
+		current=self
+		for name in lst:
+			self.__class__.bld.rescan(current)
+			prev=current
+			if not current.parent and name==current.name:
+				continue
+			elif not name:
+				continue
+			elif name=='.':
+				continue
+			elif name=='..':
+				current=current.parent or current
+			else:
+				current=prev.childs.get(name,None)
+				if current is None:
+					dir_cont=self.__class__.bld.cache_dir_contents
+					if prev.id in dir_cont and name in dir_cont[prev.id]:
+						current=self.__class__(name,prev,DIR)
+					else:
+						return None
+		return current
+	def ensure_dir_node_from_path(self,lst):
+		if type(lst)is types.StringType:
+			lst=Utils.split_path(lst)
+		current=self
+		for name in lst:
+			if not name:
+				continue
+			elif name=='.':
+				continue
+			elif name=='..':
+				current=current.parent or current
+			else:
+				prev=current
+				current=prev.childs.get(name,None)
+				if current is None:
+					current=self.__class__(name,prev,DIR)
+		return current
+	def exclusive_build_node(self,path):
+		lst=Utils.split_path(path)
+		name=lst[-1]
+		if len(lst)>1:
+			parent=None
+			try:
+				parent=self.find_dir(lst[:-1])
+			except OSError:
+				pass
+			if not parent:
+				parent=self.ensure_dir_node_from_path(lst[:-1])
+				self.__class__.bld.cache_scanned_folders[parent.id]=1
+			else:
+				try:
+					self.__class__.bld.rescan(parent)
+				except OSError:
+					pass
+		else:
+			parent=self
+		node=parent.childs.get(name,None)
+		if not node:
+			node=self.__class__(name,parent,BUILD)
+		return node
+	def path_to_parent(self,parent):
+		lst=[]
+		p=self
+		h1=parent.height()
+		h2=p.height()
+		while h2>h1:
+			h2-=1
+			lst.append(p.name)
+			p=p.parent
+		if lst:
+			lst.reverse()
+			ret=os.path.join(*lst)
+		else:
+			ret=''
+		return ret
+	def find_ancestor(self,node):
+		dist=self.height()-node.height()
+		if dist<0:return node.find_ancestor(self)
+		cand=self
+		while dist>0:
+			cand=cand.parent
+			dist-=1
+		if cand==node:return cand
+		cursor=node
+		while cand.parent:
+			cand=cand.parent
+			cursor=cursor.parent
+			if cand==cursor:return cand
+	def relpath_gen(self,going_to):
+		if self==going_to:return'.'
+		if going_to.parent==self:return'..'
+		ancestor=self.find_ancestor(going_to)
+		lst=[]
+		cand=self
+		while not cand.id==ancestor.id:
+			lst.append(cand.name)
+			cand=cand.parent
+		cand=going_to
+		while not cand.id==ancestor.id:
+			lst.append('..')
+			cand=cand.parent
+		lst.reverse()
+		return os.sep.join(lst)
+	def nice_path(self,env=None):
+		tree=self.__class__.bld
+		ln=tree.launch_node()
+		name=self.name
+		if self.id&3==FILE:return self.relpath_gen(ln)
+		else:return os.path.join(tree.bldnode.relpath_gen(ln),env.variant(),self.relpath_gen(tree.srcnode))
+	def is_child_of(self,node):
+		p=self
+		diff=self.height()-node.height()
+		while diff>0:
+			diff-=1
+			p=p.parent
+		return p.id==node.id
+	def variant(self,env):
+		if not env:return 0
+		elif self.id&3==FILE:return 0
+		else:return env.variant()
+	def height(self):
+		d=self
+		val=-1
+		while d:
+			d=d.parent
+			val+=1
+		return val
+	def abspath(self,env=None):
+		if not self.name:
+			return'/'
+		variant=self.variant(env)
+		ret=self.__class__.bld.cache_node_abspath[variant].get(self.id,None)
+		if ret:return ret
+		if not variant:
+			if not self.parent:
+				val=os.sep
+			elif not self.parent.name:
+				val=os.sep+self.name
+			else:
+				val=self.parent.abspath()+os.sep+self.name
+		else:
+			val=os.sep.join((self.__class__.bld.bldnode.abspath(),env.variant(),self.path_to_parent(self.__class__.bld.srcnode)))
+		self.__class__.bld.cache_node_abspath[variant][self.id]=val
+		return val
+	def change_ext(self,ext):
+		name=self.name
+		k=name.rfind('.')
+		if k>=0:
+			name=name[:k]+ext
+		else:
+			name=name+ext
+		node=self.parent.childs.get(name,None)
+		if not node:
+			node=self.__class__(name,self.parent,BUILD)
+		return node
+	def src_dir(self,env):
+		return self.parent.srcpath(env)
+	def bld_dir(self,env):
+		return self.parent.bldpath(env)
+	def bld_base(self,env):
+		s=self.name
+		s=s[:s.rfind('.')]
+		return os.path.join(self.bld_dir(env),s)
+	def bldpath(self,env=None):
+		if self.id&3==FILE:
+			return self.relpath_gen(self.__class__.bld.bldnode)
+		if self.path_to_parent(self.__class__.bld.srcnode)is not'':
+			return os.path.join(env.variant(),self.path_to_parent(self.__class__.bld.srcnode))
+		return env.variant()
+	def srcpath(self,env=None):
+		if self.id&3==BUILD:
+			return self.bldpath(env)
+		return self.relpath_gen(self.__class__.bld.bldnode)
+	def read(self,env):
+		try:
+			file=open(self.abspath(env),'rb')
+			return file.read()
+		finally:
+			if file:file.close()
+	def dir(self,env):
+		return self.parent.abspath(env)
+	def file(self):
+		return self.name
+	def file_base(self):
+		s=self.name
+		if s.rfind('.')<0:
+			return s
+		return s[:s.rfind('.')]
+	def suffix(self):
+		s=self.name
+		if s.rfind('.')<0:
+			return s
+		return s[s.rfind('.'):]
+if sys.platform=="win32":
+	def find_dir_win32(self,lst):
+		if type(lst)is types.StringType:
+			lst=Utils.split_path(lst)
+		current=self
+		for name in lst:
+			self.__class__.bld.rescan(current)
+			prev=current
+			if not current.parent and name==current.name:
+				continue
+			if not name:
+				continue
+			elif name=='.':
+				continue
+			elif name=='..':
+				current=current.parent or current
+			else:
+				current=prev.childs.get(name,None)
+				if current is None:
+					if(name in self.__class__.bld.cache_dir_contents[prev.id]or(not prev.parent and name[1]==":")):
+						current=self.__class__(name,prev,DIR)
+					else:
+						return None
+		return current
+	Node.find_dir=find_dir_win32
+	def abspath_win32(self,env=None):
+		variant=self.variant(env)
+		ret=self.__class__.bld.cache_node_abspath[variant].get(self.id,None)
+		if ret:return ret
+		if not variant:
+			cur=self
+			lst=[]
+			while cur:
+				lst.append(cur.name)
+				cur=cur.parent
+			lst.reverse()
+			val=os.sep.join(lst)
+		else:
+			val=os.sep.join((self.__class__.bld.bldnode.abspath(),env.variant(),self.path_to_parent(self.__class__.bld.srcnode)))
+		if val.startswith("\\"):val=val[1:]
+		if val.startswith("\\"):val=val[1:]
+		self.__class__.bld.cache_node_abspath[variant][self.id]=val
+		return val
+	Node.abspath=abspath_win32
+class Nodu(Node):
+	pass
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Options.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Options.py
new file mode 100644
index 0000000..73d5a27
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Options.py
@@ -0,0 +1,126 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,imp,types,tempfile
+from optparse import OptionParser
+import Logs,Utils
+from Constants import*
+cmds='dist configure clean distclean build install uninstall check distcheck'.split()
+options={}
+commands={}
+launch_dir=''
+tooldir=''
+lockfile=os.environ.get('WAFLOCK','.lock-wscript')
+try:cache_global=os.path.abspath(os.environ['WAFCACHE'])
+except KeyError:cache_global=''
+platform=Utils.detect_platform()
+conf_file='conf-runs-%s-%d.pickle'%(platform,ABI)
+is_install=False
+default_prefix=os.environ.get('PREFIX')
+if not default_prefix:
+	if platform=='win32':default_prefix=tempfile.gettempdir()
+	else:default_prefix='/usr/local/'
+default_jobs=os.environ.get('JOBS',-1)
+if default_jobs<1:
+	try:
+		default_jobs=os.sysconf('SC_NPROCESSORS_ONLN')
+	except:
+		default_jobs=int(os.environ.get('NUMBER_OF_PROCESSORS',1))
+default_destdir=os.environ.get('DESTDIR','')
+def create_parser():
+	Logs.debug('options: create_parser is called')
+	parser=OptionParser(conflict_handler="resolve",usage="""waf [options] [commands ...]
+
+* Main commands: configure build install clean dist distclean uninstall distcheck
+* Example: ./waf build -j4""",version='waf %s'%WAFVERSION)
+	parser.formatter.width=Utils.get_term_cols()
+	p=parser.add_option
+	p('-j','--jobs',type='int',default=default_jobs,help="amount of parallel jobs [Default: %s]"%default_jobs,dest='jobs')
+	p('-f','--force',action='store_true',default=False,help='force file installation',dest='force')
+	p('-k','--keep',action='store_true',default=False,help='keep running happily on independent task groups',dest='keep')
+	p('-p','--progress',action='count',default=0,help='-p: progress bar; -pp: ide output',dest='progress_bar')
+	p('-v','--verbose',action='count',default=0,help='verbosity level -v -vv or -vvv [Default: 0]',dest='verbose')
+	p('--destdir',help="installation root [Default: '%s']"%default_destdir,default=default_destdir,dest='destdir')
+	p('--nocache',action='store_true',default=False,help='compile everything, even if WAFCACHE is set',dest='nocache')
+	if'configure'in sys.argv:
+		p('-b','--blddir',action='store',default='',help='build dir for the project (configuration)',dest='blddir')
+		p('-s','--srcdir',action='store',default='',help='src dir for the project (configuration)',dest='srcdir')
+		p('--prefix',help="installation prefix (configuration only) [Default: '%s']"%default_prefix,default=default_prefix,dest='prefix')
+	p('--zones',action='store',default='',help='debugging zones (task_gen, deps, tasks, etc)',dest='zones')
+	p('--targets',action='store',default='',help='compile the targets given only [targets in CSV format, e.g. "target1,target2"]',dest='compile_targets')
+	return parser
+def parse_args_impl(parser,_args=None):
+	global options,commands
+	(options,args)=parser.parse_args(args=_args)
+	commands={}
+	for var in cmds:commands[var]=0
+	if len(args)==0:commands['build']=1
+	for arg in args:
+		arg=arg.strip()
+		if arg in cmds:
+			commands[arg]=True
+		else:
+			print'Error: Invalid command specified ',arg
+			parser.print_help()
+			sys.exit(1)
+	if commands['check']:
+		commands['build']=True
+	if commands['install']or commands['uninstall']:
+		global is_install
+		is_install=True
+	if options.keep:options.jobs=1
+	if options.jobs<1:options.jobs=1
+	Logs.verbose=options.verbose
+	Logs.init_log()
+	if options.zones:
+		Logs.zones=options.zones.split(',')
+		if not Logs.verbose:Logs.verbose=1
+	elif Logs.verbose==1:
+		Logs.zones=['runner']
+class Handler(object):
+	parser=None
+	def __init__(self):
+		self.parser=create_parser()
+		self.cwd=os.getcwd()
+		Handler.parser=self
+	def add_option(self,*kw,**kwargs):
+		self.parser.add_option(*kw,**kwargs)
+	def add_option_group(self,*args,**kwargs):
+		return self.parser.add_option_group(*args,**kwargs)
+	def get_option_group(self,opt_str):
+		return self.parser.get_option_group(opt_str)
+	def sub_options(self,dir,option_group=None):
+		try:
+			current=self.cwd
+			self.cwd=os.path.join(self.cwd,dir)
+			cur=os.path.join(self.cwd,WSCRIPT_FILE)
+			mod=Utils.load_module(cur)
+			if not hasattr(mod,'set_options'):
+				msg="the module %s has no set_options function;\n* make sure such a function is defined\n* run configure from the root of the project"%cur
+				raise Utils.WscriptError(msg)
+			else:
+				fun=mod.set_options
+			fun(option_group or self)
+		finally:
+			self.cwd=current
+	def tool_options(self,tool,tdir=None,option_group=None):
+		
+		if type(tool)is types.ListType:
+			for i in tool:self.tool_options(i,tdir,option_group)
+			return
+		if not tdir:tdir=tooldir
+		tdir=Utils.to_list(tdir)
+		try:
+			file,name,desc=imp.find_module(tool,tdir)
+		except ImportError:
+			raise Utils.WscriptError("no tool named '%s' found"%tool)
+		module=imp.load_module(tool,file,name,desc)
+		try:
+			fun=module.set_options
+		except AttributeError:
+			pass
+		else:
+			fun(option_group or self)
+	def parse_args(self,args=None):
+		parse_args_impl(self.parser,args)
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Runner.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Runner.py
new file mode 100644
index 0000000..923492e
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Runner.py
@@ -0,0 +1,145 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import sys,random,time,threading,Queue,traceback
+import Build,Utils,Logs,Options
+import pproc
+from Logs import debug,error
+from Constants import*
+GAP=15
+run_old=threading.Thread.run
+def run(*args,**kwargs):
+	try:
+		run_old(*args,**kwargs)
+	except(KeyboardInterrupt,SystemExit):
+		raise
+	except:
+		sys.excepthook(*sys.exc_info())
+threading.Thread.run=run
+class TaskConsumer(threading.Thread):
+	def __init__(self,m):
+		threading.Thread.__init__(self)
+		self.setDaemon(1)
+		self.master=m
+		self.start()
+	def run(self):
+		try:
+			self.loop()
+		except:
+			pass
+	def loop(self):
+		m=self.master
+		while 1:
+			tsk=m.ready.get()
+			if m.stop:
+				m.out.put(tsk)
+				continue
+			try:
+				tsk.generator.bld.printout(tsk.display())
+				if tsk.__class__.stat:ret=tsk.__class__.stat(tsk)
+				else:ret=tsk.call_run()
+			except Exception,e:
+				tsk.err_msg=Utils.ex_stack()
+				tsk.hasrun=EXCEPTION
+				m.error_handler(tsk)
+				m.out.put(tsk)
+				continue
+			if ret:
+				tsk.err_code=ret
+				tsk.hasrun=CRASHED
+			else:
+				try:
+					tsk.post_run()
+				except OSError:
+					tsk.hasrun=MISSING
+				else:
+					tsk.hasrun=SUCCESS
+			if tsk.hasrun!=SUCCESS:
+				m.error_handler(tsk)
+			m.out.put(tsk)
+class Parallel(object):
+	def __init__(self,bld,j=2):
+		self.numjobs=j
+		self.manager=bld.task_manager
+		self.total=self.manager.total()
+		self.outstanding=[]
+		self.maxjobs=sys.maxint
+		self.frozen=[]
+		self.ready=Queue.Queue(0)
+		self.out=Queue.Queue(0)
+		self.count=0
+		self.stuck=0
+		self.processed=1
+		self.consumers=None
+		self.stop=False
+		self.error=False
+	def get_next(self):
+		if not self.outstanding:
+			return None
+		return self.outstanding.pop(0)
+	def postpone(self,tsk):
+		if random.randint(0,1):
+			self.frozen.insert(0,tsk)
+		else:
+			self.frozen.append(tsk)
+	def refill_task_list(self):
+		while self.count>self.numjobs+GAP or self.count>self.maxjobs:
+			self.get_out()
+		while not self.outstanding:
+			if self.count:
+				self.get_out()
+			if self.frozen:
+				self.outstanding+=self.frozen
+				self.frozen=[]
+			elif not self.count:
+				(self.maxjobs,tmp)=self.manager.get_next_set()
+				if tmp:self.outstanding+=tmp
+				break
+	def get_out(self):
+		ret=self.out.get()
+		self.manager.add_finished(ret)
+		if not self.stop and getattr(ret,'more_tasks',None):
+			self.outstanding+=ret.more_tasks
+			self.total+=len(ret.more_tasks)
+		self.count-=1
+	def error_handler(self,tsk):
+		if not Options.options.keep:
+			self.stop=True
+		self.error=True
+	def start(self):
+		while not self.stop:
+			self.refill_task_list()
+			tsk=self.get_next()
+			if not tsk:
+				if self.count:
+					continue
+				else:
+					break
+			if tsk.hasrun:
+				self.processed+=1
+				self.manager.add_finished(tsk)
+			try:
+				st=tsk.runnable_status()
+			except Exception,e:
+				tsk.err_msg=Utils.ex_stack()
+				tsk.hasrun=EXCEPTION
+				self.processed+=1
+				self.error_handler(tsk)
+				self.manager.add_finished(tsk)
+				continue
+			if st==ASK_LATER:
+				self.postpone(tsk)
+			elif st==SKIP_ME:
+				self.processed+=1
+				tsk.hasrun=SKIPPED
+				self.manager.add_finished(tsk)
+			else:
+				tsk.position=(self.processed,self.total)
+				self.count+=1
+				self.ready.put(tsk)
+				self.processed+=1
+				if not self.consumers:
+					self.consumers=[TaskConsumer(self)for i in xrange(self.numjobs)]
+		assert(self.count==0 or self.stop)
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Scripting.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Scripting.py
new file mode 100644
index 0000000..bfb9cb7
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Scripting.py
@@ -0,0 +1,294 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,shutil,traceback,time
+import Utils,Configure,Build,Logs,Options,Environment
+from Logs import error,warn,info
+from Constants import*
+g_gz='bz2'
+def add_subdir(dir,bld):
+	try:bld.rescan(bld.path)
+	except OSError:raise Utils.WscriptError("No such directory "+bld.path.abspath())
+	old=bld.path
+	new=bld.path.find_dir(dir)
+	if new is None:
+		raise Utils.WscriptError("subdir not found (%s), restore is %s"%(dir,bld.path))
+	bld.path=new
+	try:
+		file_path=os.path.join(new.abspath(),WSCRIPT_BUILD_FILE)
+		file=open(file_path,'r')
+		exec file
+		if file:file.close()
+	except IOError:
+		file_path=os.path.join(new.abspath(),WSCRIPT_FILE)
+		module=Utils.load_module(file_path)
+		module.build(bld)
+	bld.path=old
+def configure():
+	tree=Build.BuildContext()
+	err='The %s is not given in %s:\n * define a top level attribute named "%s"\n * run waf configure --%s=xxx'
+	src=getattr(Options.options,SRCDIR,None)
+	if not src:src=getattr(Utils.g_module,SRCDIR,None)
+	if not src:raise Utils.WscriptError(err%(SRCDIR,os.path.abspath('.'),SRCDIR,SRCDIR))
+	src=os.path.abspath(src)
+	bld=getattr(Options.options,BLDDIR,None)
+	if not bld:bld=getattr(Utils.g_module,BLDDIR,None)
+	if not bld:raise Utils.WscriptError(err%(BLDDIR,os.path.abspath('.'),BLDDIR,BLDDIR))
+	bld=os.path.abspath(bld)
+	tree.load_dirs(src,bld,False)
+	conf=Configure.ConfigurationContext(srcdir=src,blddir=bld)
+	conf.sub_config('')
+	conf.store(tree)
+	env=Environment.Environment()
+	env[BLDDIR]=bld
+	env[SRCDIR]=src
+	env['argv']=sys.argv
+	env['hash']=conf.hash
+	env['files']=conf.files
+	env['commands']=Options.commands
+	env['options']=Options.options.__dict__
+	env.store(Options.lockfile)
+def prepare_impl(t,cwd,ver,wafdir):
+	Options.tooldir=[t]
+	Options.launch_dir=cwd
+	if'--version'in sys.argv:
+		opt_obj=Options.Handler()
+		opt_obj.parse_args()
+		sys.exit(0)
+	msg1='Waf: *** Nothing to do! Please run waf from a directory containing a file named "%s"'%WSCRIPT_FILE
+	build_dir_override=None
+	candidate=None
+	cwd=Options.launch_dir
+	lst=os.listdir(cwd)
+	search_for_candidate=True
+	if WSCRIPT_FILE in lst:
+		candidate=cwd
+	elif'configure'in sys.argv and not WSCRIPT_BUILD_FILE in lst:
+		calldir=os.path.abspath(os.path.dirname(sys.argv[0]))
+		if WSCRIPT_FILE in os.listdir(calldir):
+			candidate=calldir
+			search_for_candidate=False
+		else:
+			error("arg[0] directory does not contain a wscript file")
+			sys.exit(1)
+		build_dir_override=cwd
+	while search_for_candidate:
+		if len(cwd)<=3:
+			break
+		dirlst=os.listdir(cwd)
+		if WSCRIPT_FILE in dirlst:
+			candidate=cwd
+		if'configure'in sys.argv and candidate:
+			break
+		if Options.lockfile in dirlst:
+			break
+		cwd=cwd[:cwd.rfind(os.sep)]
+	if not candidate:
+		if'-h'in sys.argv or'--help'in sys.argv:
+			warn('No wscript file found: the help message may be incomplete')
+			opt_obj=Options.Handler()
+			opt_obj.parse_args()
+		else:
+			error(msg1)
+		sys.exit(0)
+	os.chdir(candidate)
+	Utils.set_main_module(os.path.join(candidate,WSCRIPT_FILE))
+	if build_dir_override:
+		d=getattr(Utils.g_module,BLDDIR,None)
+		if d:
+			msg=' Overriding build directory %s with %s'%(d,build_dir_override)
+			warn(msg)
+		Utils.g_module.blddir=build_dir_override
+	opt_obj=Options.Handler()
+	opt_obj.sub_options('')
+	opt_obj.parse_args()
+	fun=getattr(Utils.g_module,'init',None)
+	if fun:fun()
+	for x in['dist','distclean','distcheck']:
+		if Options.commands[x]:
+			fun=getattr(Utils.g_module,x,None)
+			if fun:
+				fun()
+			else:
+				eval(x+'()')
+			sys.exit(0)
+	main()
+def prepare(t,cwd,ver,wafdir):
+	if WAFVERSION!=ver:
+		msg='Version mismatch: waf %s <> wafadmin %s (wafdir %s)'%(ver,WAFVERSION,wafdir)
+		print'\033[91mError: %s\033[0m'%msg
+		sys.exit(1)
+	try:
+		prepare_impl(t,cwd,ver,wafdir)
+	except Utils.WafError,e:
+		error(e)
+		sys.exit(1)
+def main():
+	if Options.commands['configure']:
+		ini=time.time()
+		configure()
+		ela=''
+		if not Options.options.progress_bar:ela=time.strftime(' (%H:%M:%S)',time.gmtime(time.time()-ini))
+		info('Configuration finished successfully%s; project is now ready to build.'%ela)
+		sys.exit(0)
+	bld=Build.BuildContext()
+	try:
+		proj=Environment.Environment(Options.lockfile)
+	except IOError:
+		if Options.commands['clean']:
+			raise Utils.WafError("Nothing to clean (project not configured)")
+		else:
+			if Configure.autoconfig:
+				warn("Reconfiguring the project")
+				configure()
+				bld=Build.BuildContext()
+				proj=Environment.Environment(Options.lockfile)
+			else:
+				raise Utils.WafError("Project not configured (run 'waf configure' first)")
+	if Configure.autoconfig:
+		if not Options.commands['clean']and not Options.commands['uninstall']:
+			reconf=0
+			h=0
+			try:
+				for file in proj['files']:
+					mod=Utils.load_module(file)
+					h=Utils.hash_function_with_globals(h,mod.configure)
+				reconf=(h!=proj['hash'])
+			except Exception,ex:
+				warn("Reconfiguring the project (an exception occurred: %s)"%(str(ex),))
+				reconf=1
+			if reconf:
+				warn("Reconfiguring the project (the configuration has changed)")
+				back=(Options.commands,Options.options,Logs.zones,Logs.verbose)
+				Options.commands=proj['commands']
+				Options.options.__dict__=proj['options']
+				configure()
+				(Options.commands,Options.options,Logs.zones,Logs.verbose)=back
+				bld=Build.BuildContext()
+				proj=Environment.Environment(Options.lockfile)
+	bld.load_dirs(proj[SRCDIR],proj[BLDDIR])
+	bld.load_envs()
+	f=getattr(Utils.g_module,'build',None)
+	if f:
+		f(bld)
+	else:
+		main_wscript=None
+		for(file_path,module)in Utils.g_loaded_modules.items():
+			if module.__name__=='wscript_main':
+				main_wscript=file_path
+				break
+		raise Utils.WscriptError("Could not find the function 'def build(bld).'",main_wscript)
+	pre_build=getattr(Utils.g_module,'pre_build',None)
+	if pre_build:pre_build()
+	if Options.commands['build']or Options.is_install:
+		if Options.commands['uninstall']:
+			import Task
+			def runnable_status(self):
+				return SKIP_ME
+			setattr(Task.Task,'runnable_status',runnable_status)
+		ini=time.time()
+		bld.compile()
+		if Options.options.progress_bar:print''
+		if Options.is_install:
+			bld.install()
+		ela=''
+		if not Options.options.progress_bar:
+			ela=time.strftime(' (%H:%M:%S)',time.gmtime(time.time()-ini))
+		if Options.commands['install']:msg='Compilation and installation finished successfully%s'%ela
+		elif Options.commands['uninstall']:msg='Uninstallation finished successfully%s'%ela
+		else:msg='Compilation finished successfully%s'%ela
+		info(msg)
+	if Options.commands['clean']:
+		try:
+			bld.clean()
+			info('Cleaning finished successfully')
+		finally:
+			bld.save()
+	fun=getattr(Utils.g_module,'shutdown',None)
+	if fun:fun()
+excludes='.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg Makefile Makefile.in config.log'.split()
+dist_exts='~ .rej .orig .pyc .pyo .bak .tar.bz2 tar.gz .zip'.split()
+def dont_dist(name,src,build_dir):
+	global excludes,dist_exts
+	if(name.startswith(',,')or name.startswith('++')or(src=='.'and name==Options.lockfile)or name in excludes or name==build_dir):
+		return True
+	for ext in dist_exts:
+		if name.endswith(ext):
+			return True
+	return False
+def copytree(src,dst,build_dir):
+	names=os.listdir(src)
+	os.makedirs(dst)
+	for name in names:
+		srcname=os.path.join(src,name)
+		dstname=os.path.join(dst,name)
+		if dont_dist(name,src,build_dir):
+			continue
+		if os.path.isdir(srcname):
+			copytree(srcname,dstname,build_dir)
+		else:
+			shutil.copy2(srcname,dstname)
+def distclean():
+	lst=os.listdir('.')
+	for f in lst:
+		if f==Options.lockfile:
+			try:
+				proj=Environment.Environment(f)
+				shutil.rmtree(proj[BLDDIR])
+			except(OSError,IOError):
+				pass
+			try:
+				os.remove(f)
+			except(OSError,IOError):
+				pass
+		if f.startswith('.waf-'):
+			shutil.rmtree(f,ignore_errors=True)
+	info('distclean finished successfully')
+def dist(appname='',version=''):
+	import tarfile
+	if not appname:appname=getattr(Utils.g_module,APPNAME,'noname')
+	if not version:version=getattr(Utils.g_module,VERSION,'1.0')
+	tmp_folder=appname+'-'+version
+	arch_name=tmp_folder+'.tar.'+g_gz
+	try:
+		shutil.rmtree(tmp_folder)
+	except(OSError,IOError):
+		pass
+	try:
+		os.remove(arch_name)
+	except(OSError,IOError):
+		pass
+	copytree('.',tmp_folder,getattr(Utils.g_module,BLDDIR,None))
+	dist_hook=getattr(Utils.g_module,'dist_hook',None)
+	if dist_hook:
+		os.chdir(tmp_folder)
+		try:
+			dist_hook()
+		finally:
+			os.chdir('..')
+	tar=tarfile.open(arch_name,'w:'+g_gz)
+	tar.add(tmp_folder)
+	tar.close()
+	info('Your archive is ready -> %s'%arch_name)
+	if os.path.exists(tmp_folder):shutil.rmtree(tmp_folder)
+	return arch_name
+def distcheck(appname='',version=''):
+	import tempfile,tarfile
+	import pproc
+	if not appname:appname=getattr(Utils.g_module,APPNAME,'noname')
+	if not version:version=getattr(Utils.g_module,VERSION,'1.0')
+	waf=os.path.abspath(sys.argv[0])
+	tarball=dist(appname,version)
+	t=tarfile.open(tarball)
+	for x in t:t.extract(x)
+	t.close()
+	instdir=tempfile.mkdtemp('.inst','%s-%s'%(appname,version))
+	cwd_before=os.getcwd()
+	retval=pproc.Popen('%(waf)s configure && %(waf)s ''&& %(waf)s check && %(waf)s install --destdir=%(instdir)s'' && %(waf)s uninstall --destdir=%(instdir)s'%vars(),shell=True).wait()
+	if retval:
+		raise Utils.WafError('distcheck failed with code %i'%(retval))
+	if os.path.exists(instdir):
+		raise Utils.WafError("distcheck succeeded, but files were left in %s"%(instdir))
+	else:
+		info('distcheck finished successfully')
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Task.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Task.py
new file mode 100644
index 0000000..3ff4bb1
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Task.py
@@ -0,0 +1,539 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import os,types,shutil,sys,re,new,random,time
+from Utils import md5
+import Build,Runner,Utils,Node,Logs,Options
+from Logs import debug,error,warn
+from Constants import*
+algotype=NORMAL
+class TaskManager(object):
+	def __init__(self):
+		self.groups=[]
+		self.tasks_done=[]
+		self.current_group=0
+	def get_next_set(self):
+		ret=None
+		while not ret and self.current_group<len(self.groups):
+			ret=self.groups[self.current_group].get_next_set()
+			if ret:return ret
+			else:self.current_group+=1
+		return(None,None)
+	def add_group(self):
+		if self.groups and not self.groups[0].tasks:
+			warn('add_group: an empty group is already present')
+		self.groups.append(TaskGroup())
+	def add_task(self,task):
+		if not self.groups:self.add_group()
+		self.groups[-1].add_task(task)
+	def total(self):
+		total=0
+		if not self.groups:return 0
+		for group in self.groups:
+			total+=len(group.tasks)
+		return total
+	def add_finished(self,tsk):
+		self.tasks_done.append(tsk)
+		bld=tsk.generator.bld
+		if Options.is_install:
+			f=None
+			if'install'in tsk.__dict__:
+				f=tsk.__dict__['install']
+				f(tsk)
+			else:
+				tsk.install()
+class TaskGroup(object):
+	def __init__(self):
+		self.tasks=[]
+		self.cstr_groups={}
+		self.cstr_order={}
+		self.temp_tasks=[]
+		self.ready=0
+	def reset(self):
+		for x in self.cstr_groups:
+			self.tasks+=self.cstr_groups[x]
+		self.tasks=self.temp_tasks+self.tasks
+		self.temp_tasks=[]
+		self.cstr_groups=[]
+		self.cstr_order={}
+		self.ready=0
+	def prepare(self):
+		self.ready=1
+		self.make_cstr_groups()
+		self.extract_constraints()
+	def get_next_set(self):
+		global algotype
+		if algotype==NORMAL:
+			tasks=self.tasks_in_parallel()
+			maxj=sys.maxint
+		elif algotype==JOBCONTROL:
+			(maxj,tasks)=self.tasks_by_max_jobs()
+		elif algotype==MAXPARALLEL:
+			tasks=self.tasks_with_inner_constraints()
+			maxj=sys.maxint
+		else:
+			raise Utils.WafError("unknown algorithm type %s"%(algotype))
+		if not tasks:return()
+		return(maxj,tasks)
+	def make_cstr_groups(self):
+		self.cstr_groups={}
+		for x in self.tasks:
+			h=x.hash_constraints()
+			try:self.cstr_groups[h].append(x)
+			except KeyError:self.cstr_groups[h]=[x]
+	def add_task(self,task):
+		try:self.tasks.append(task)
+		except KeyError:self.tasks=[task]
+	def set_order(self,a,b):
+		try:self.cstr_order[a].add(b)
+		except KeyError:self.cstr_order[a]=set([b,])
+	def compare_exts(self,t1,t2):
+		x="ext_in"
+		y="ext_out"
+		in_=t1.attr(x,())
+		out_=t2.attr(y,())
+		for k in in_:
+			if k in out_:
+				return-1
+		in_=t2.attr(x,())
+		out_=t1.attr(y,())
+		for k in in_:
+			if k in out_:
+				return 1
+		return 0
+	def compare_partial(self,t1,t2):
+		m="after"
+		n="before"
+		name=t2.__class__.__name__
+		if name in t1.attr(m,()):return-1
+		elif name in t1.attr(n,()):return 1
+		name=t1.__class__.__name__
+		if name in t2.attr(m,()):return 1
+		elif name in t2.attr(n,()):return-1
+		return 0
+	def extract_constraints(self):
+		keys=self.cstr_groups.keys()
+		max=len(keys)
+		for i in xrange(max):
+			t1=self.cstr_groups[keys[i]][0]
+			for j in xrange(i+1,max):
+				t2=self.cstr_groups[keys[j]][0]
+				val=(self.compare_exts(t1,t2)or self.compare_partial(t1,t2))
+				if val>0:
+					self.set_order(keys[i],keys[j])
+				elif val<0:
+					self.set_order(keys[j],keys[i])
+	def tasks_in_parallel(self):
+		if not self.ready:self.prepare()
+		keys=self.cstr_groups.keys()
+		unconnected=[]
+		remainder=[]
+		for u in keys:
+			for k in self.cstr_order.values():
+				if u in k:
+					remainder.append(u)
+					break
+			else:
+				unconnected.append(u)
+		toreturn=[]
+		for y in unconnected:
+			toreturn.extend(self.cstr_groups[y])
+		for y in unconnected:
+			try:self.cstr_order.__delitem__(y)
+			except KeyError:pass
+			self.cstr_groups.__delitem__(y)
+		if not toreturn and remainder:
+			raise Utils.WafError("circular order constraint detected %r"%remainder)
+		return toreturn
+	def tasks_by_max_jobs(self):
+		if not self.ready:self.prepare()
+		if not self.temp_tasks:self.temp_tasks=self.tasks_in_parallel()
+		if not self.temp_tasks:return(None,None)
+		maxjobs=sys.maxint
+		ret=[]
+		remaining=[]
+		for t in self.temp_tasks:
+			m=getattr(t,"maxjobs",getattr(self.__class__,"maxjobs",sys.maxint))
+			if m>maxjobs:
+				remaining.append(t)
+			elif m<maxjobs:
+				remaining+=ret
+				ret=[t]
+				maxjobs=m
+			else:
+				ret.append(t)
+		self.temp_tasks=remaining
+		return(maxjobs,ret)
+	def tasks_with_inner_constraints(self):
+		if not self.ready:self.prepare()
+		if getattr(self,"done",None):return None
+		for p in self.cstr_order:
+			for v in self.cstr_order[p]:
+				for m in self.cstr_groups[p]:
+					for n in self.cstr_groups[v]:
+						n.set_run_after(m)
+		self.cstr_order={}
+		self.cstr_groups={}
+		self.done=1
+		return self.tasks[:]
+class store_task_type(type):
+	def __init__(cls,name,bases,dict):
+		super(store_task_type,cls).__init__(name,bases,dict)
+		name=cls.__name__
+		if name.endswith('_task'):
+			name=name.replace('_task','')
+			TaskBase.classes[name]=cls
+class TaskBase(object):
+	__metaclass__=store_task_type
+	color="GREEN"
+	maxjobs=sys.maxint
+	classes={}
+	stat=None
+	def __init__(self,*k,**kw):
+		self.hasrun=NOT_RUN
+		try:
+			self.generator=kw['generator']
+		except KeyError:
+			self.generator=self
+			self.bld=Build.bld
+		if kw.get('normal',1):
+			self.generator.bld.task_manager.add_task(self)
+	def __repr__(self):
+		return'\n\t{task: %s %s}'%(self.__class__.__name__,str(getattr(self,"fun","")))
+	def __str__(self):
+		try:self.fun
+		except AttributeError:return self.__class__.__name__+'\n'
+		else:return'executing: %s\n'%self.fun.__name__
+	def runnable_status(self):
+		return RUN_ME
+	def can_retrieve_cache(self):
+		return False
+	def call_run(self):
+		if self.can_retrieve_cache():
+			return 0
+		return self.run()
+	def run(self):
+		try:fun=self.fun
+		except:return 0
+		return fun(self)
+	def post_run(self):
+		pass
+	def display(self):
+		col1=Logs.colors(self.color)
+		col2=Logs.colors.NORMAL
+		if Options.options.progress_bar==1:
+			return self.generator.bld.progress_line(self.position[0],self.position[1],col1,col2)
+		if Options.options.progress_bar==2:
+			try:ini=self.generator.bld.ini
+			except AttributeError:ini=self.generator.bld.ini=time.time()
+			ela=time.strftime('%H:%M:%S',time.gmtime(time.time()-ini))
+			ins=','.join([n.name for n in self.inputs])
+			outs=','.join([n.name for n in self.outputs])
+			return'|Total %s|Current %s|Inputs %s|Outputs %s|Time %s|\n'%(self.position[1],self.position[0],ins,outs,ela)
+		total=self.position[1]
+		n=len(str(total))
+		fs='[%%%dd/%%%dd] %%s%%s%%s'%(n,n)
+		return fs%(self.position[0],self.position[1],col1,str(self),col2)
+	def attr(self,att,default=None):
+		return getattr(self,att,getattr(self.__class__,att,default))
+	def hash_constraints(self):
+		sum=0
+		names=('before','after','ext_in','ext_out')
+		sum=hash((sum,self.__class__.__name__,))
+		for x in names:
+			sum=hash((sum,str(self.attr(x,sys.maxint)),))
+		sum=hash((sum,self.__class__.maxjobs))
+		return sum
+	def format_error(self):
+		if getattr(self,"error_msg",None):
+			return self.error_msg
+		elif self.hasrun==CRASHED:
+			try:
+				return" -> task failed (err #%d): %r"%(self.err_code,self)
+			except AttributeError:
+				return" -> task failed: %r"%self
+		elif self.hasrun==EXCEPTION:
+			return self.err_msg
+		elif self.hasrun==MISSING:
+			return" -> missing files: %r"%self
+		else:
+			return''
+	def install(self):
+		bld=self.generator.bld
+		d=self.attr('install')
+		if self.attr('install_path'):
+			lst=[a.relpath_gen(bld.srcnode)for a in self.outputs]
+			perm=self.attr('chmod',0644)
+			if self.attr('src'):
+				lst+=[a.relpath_gen(bld.srcnode)for a in self.inputs]
+			if self.attr('filename'):
+				dir=self.install_path+self.attr('filename')
+				bld.install_as(self.install_path,lst[0],self.env,perm)
+			else:
+				bld.install_files(self.install_path,lst,self.env,perm)
+class Task(TaskBase):
+	vars=[]
+	def __init__(self,env,**kw):
+		TaskBase.__init__(self,**kw)
+		self.env=env
+		self.inputs=[]
+		self.outputs=[]
+		self.deps_nodes=[]
+		self.run_after=[]
+	def __str__(self):
+		env=self.env
+		src_str=' '.join([a.nice_path(env)for a in self.inputs])
+		tgt_str=' '.join([a.nice_path(env)for a in self.outputs])
+		return'%s: %s -> %s\n'%(self.__class__.__name__,src_str,tgt_str)
+	def __repr__(self):
+		return"".join(['\n\t{task: ',self.__class__.__name__," ",",".join([x.name for x in self.inputs])," -> ",",".join([x.name for x in self.outputs]),'}'])
+	def unique_id(self):
+		try:
+			return self.uid
+		except AttributeError:
+			m=md5()
+			up=m.update
+			up(self.env.variant())
+			for x in self.inputs+self.outputs:
+				up(x.abspath())
+			up(self.__class__.__name__)
+			up(Utils.h_fun(self.run))
+			self.uid=m.digest()
+			return self.uid
+	def set_inputs(self,inp):
+		if type(inp)is types.ListType:self.inputs+=inp
+		else:self.inputs.append(inp)
+	def set_outputs(self,out):
+		if type(out)is types.ListType:self.outputs+=out
+		else:self.outputs.append(out)
+	def set_run_after(self,task):
+		assert isinstance(task,TaskBase)
+		self.run_after.append(task)
+	def add_file_dependency(self,filename):
+		node=self.generator.bld.current.find_resource(filename)
+		self.deps_nodes.append(node)
+	def signature(self):
+		try:return self.cache_sig[0]
+		except AttributeError:pass
+		m=md5()
+		exp_sig=self.sig_explicit_deps()
+		m.update(exp_sig)
+		imp_sig=self.scan and self.sig_implicit_deps()or SIG_NIL
+		m.update(imp_sig)
+		var_sig=self.sig_vars()
+		m.update(var_sig)
+		ret=m.digest()
+		self.cache_sig=(ret,exp_sig,imp_sig,var_sig)
+		return ret
+	def runnable_status(self):
+		if self.inputs and(not self.outputs):
+			if not getattr(self.__class__,'quiet',None):
+				error("task is invalid : no inputs or outputs (override in a Task subclass?) %r"%self)
+		for t in self.run_after:
+			if not t.hasrun:
+				return ASK_LATER
+		env=self.env
+		bld=self.generator.bld
+		time=None
+		for node in self.outputs:
+			variant=node.variant(env)
+			try:
+				time=bld.node_sigs[variant][node.id]
+			except KeyError:
+				debug("task: task %r must run as the first node does not exist"%self)
+				time=None
+				break
+		if time is None:
+			try:
+				new_sig=self.signature()
+			except KeyError:
+				debug("task: something is wrong, computing the task signature failed")
+				return RUN_ME
+			return RUN_ME
+		key=self.unique_id()
+		try:
+			prev_sig=bld.task_sigs[key][0]
+		except KeyError:
+			debug("task: task %r must run as it was never run before or the task code changed"%self)
+			return RUN_ME
+		new_sig=self.signature()
+		if Logs.verbose:self.debug_why(bld.task_sigs[key])
+		if new_sig!=prev_sig:
+			return RUN_ME
+		return SKIP_ME
+	def post_run(self):
+		bld=self.generator.bld
+		env=self.env
+		sig=self.signature()
+		cnt=0
+		for node in self.outputs:
+			variant=node.variant(env)
+			os.stat(node.abspath(env))
+			bld.node_sigs[variant][node.id]=sig
+			if Options.cache_global:
+				ssig=sig.encode('hex')
+				dest=os.path.join(Options.cache_global,ssig+'-'+str(cnt))
+				try:shutil.copy2(node.abspath(env),dest)
+				except IOError:warn('Could not write the file to the cache')
+				cnt+=1
+		bld.task_sigs[self.unique_id()]=self.cache_sig
+		self.executed=1
+	def can_retrieve_cache(self):
+		if not Options.cache_global:return None
+		if Options.options.nocache:return None
+		env=self.env
+		sig=self.signature()
+		cnt=0
+		for node in self.outputs:
+			variant=node.variant(env)
+			ssig=sig.encode('hex')
+			orig=os.path.join(Options.cache_global,ssig+'-'+str(cnt))
+			try:
+				shutil.copy2(orig,node.abspath(env))
+				os.utime(orig,None)
+			except(OSError,IOError):
+				debug('task: failed retrieving file')
+				return None
+			else:
+				cnt+=1
+				self.generator.bld.node_sigs[variant][node.id]=sig
+				self.generator.bld.printout('restoring from cache %r\n'%node.bldpath(env))
+		return 1
+	def debug_why(self,old_sigs):
+		new_sigs=self.cache_sig
+		def v(x):
+			return x.encode('hex')
+		debug("Task %r"%self)
+		msgs=['Task must run','* Source file or manual dependency','* Implicit dependency','* Environment variable']
+		tmp='task: -> %s: %s %s'
+		for x in xrange(len(msgs)):
+			if(new_sigs[x]!=old_sigs[x]):
+				debug(tmp%(msgs[x],v(old_sigs[x]),v(new_sigs[x])))
+	def sig_explicit_deps(self):
+		bld=self.generator.bld
+		m=md5()
+		for x in self.inputs:
+			variant=x.variant(self.env)
+			m.update(bld.node_sigs[variant][x.id])
+		for x in getattr(self,'dep_nodes',[]):
+			variant=x.variant(self.env)
+			v=bld.node_sigs[variant][x.id]
+			m.update(v)
+		try:
+			additional_deps=bld.deps_man
+		except AttributeError:
+			pass
+		else:
+			for x in self.inputs+self.outputs:
+				try:
+					d=additional_deps[x.id]
+				except KeyError:
+					continue
+				if callable(d):
+					d=d()
+				for v in d:
+					if isinstance(v,Node.Node):
+						bld.rescan(v.parent)
+						variant=v.variant(self.env)
+						try:
+							v=bld.node_sigs[variant][v.id]
+						except KeyError:
+							v=''
+					m.update(v)
+		return m.digest()
+	def sig_vars(self):
+		m=md5()
+		bld=self.generator.bld
+		env=self.env
+		act_sig=bld.hash_env_vars(env,self.__class__.vars)
+		m.update(act_sig)
+		var_sig=SIG_NIL
+		dep_vars=getattr(self,'dep_vars',None)
+		if dep_vars:
+			var_sig=bld.hash_env_vars(env,dep_vars)
+			m.update(var_sig)
+		for x in getattr(self.__class__,'vars',()):
+			k=env[x]
+			if k:
+				m.update(str(k))
+				vars_sig=hash((var_sig,str(k)))
+		return m.digest()
+	scan=None
+	def sig_implicit_deps(self):
+		bld=self.generator.bld
+		key=self.unique_id()
+		prev_sigs=bld.task_sigs.get(key,())
+		if prev_sigs:
+			try:
+				if prev_sigs[2]==self.compute_sig_implicit_deps():
+					return prev_sigs[2]
+			except KeyError:
+				pass
+		(nodes,names)=self.scan()
+		if Logs.verbose and Logs.zones:
+			debug('deps: scanner for %s returned %s %s'%(str(self),str(nodes),str(names)))
+		bld.node_deps[self.unique_id()]=nodes
+		bld.raw_deps[self.unique_id()]=names
+		sig=self.compute_sig_implicit_deps()
+		return sig
+	def compute_sig_implicit_deps(self):
+		m=md5()
+		upd=m.update
+		bld=self.generator.bld
+		tstamp=bld.node_sigs
+		env=self.env
+		for k in bld.node_deps.get(self.unique_id(),())+self.inputs:
+			if not k.parent.id in bld.cache_scanned_folders:
+				bld.rescan(k.parent)
+			if k.id&3==Node.FILE:
+				upd(tstamp[0][k.id])
+			else:
+				upd(tstamp[env.variant()][k.id])
+		return m.digest()
+def funex(c):
+	exec(c)
+	return f
+reg_act=re.compile(r"(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})",re.M)
+def compile_fun(name,line):
+	extr=[]
+	def repl(match):
+		g=match.group
+		if g('dollar'):return"$"
+		elif g('subst'):extr.append((g('var'),g('code')));return"%s"
+		return None
+	line=reg_act.sub(repl,line)
+	parm=[]
+	dvars=[]
+	app=parm.append
+	for(var,meth)in extr:
+		if var=='SRC':
+			if meth:app('task.inputs%s'%meth)
+			else:app('" ".join([a.srcpath(env) for a in task.inputs])')
+		elif var=='TGT':
+			if meth:app('task.outputs%s'%meth)
+			else:app('" ".join([a.bldpath(env) for a in task.outputs])')
+		else:
+			if not var in dvars:dvars.append(var)
+			app("p('%s')"%var)
+	if parm:parm="%% (%s) "%(',\n\t\t'.join(parm))
+	else:parm=''
+	c='''
+def f(task):
+	env = task.env
+	p = env.get_flat
+	cmd = "%s" %s
+	return task.generator.bld.exec_command(cmd)
+'''%(line,parm)
+	debug('action: %s'%c)
+	return(funex(c),dvars)
+def simple_task_type(name,line,color='GREEN',vars=[],ext_in=[],ext_out=[],before=[],after=[]):
+	(fun,dvars)=compile_fun(name,line)
+	fun.code=line
+	return task_type_from_func(name,fun,vars or dvars,color,ext_in,ext_out,before,after)
+def task_type_from_func(name,func,vars=[],color='GREEN',ext_in=[],ext_out=[],before=[],after=[]):
+	params={'run':func,'vars':vars,'color':color,'name':name,'ext_in':Utils.to_list(ext_in),'ext_out':Utils.to_list(ext_out),'before':Utils.to_list(before),'after':Utils.to_list(after),}
+	cls=new.classobj(name,(Task,),params)
+	TaskBase.classes[name]=cls
+	return cls
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/TaskGen.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/TaskGen.py
new file mode 100644
index 0000000..9d35de1
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/TaskGen.py
@@ -0,0 +1,288 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import os,types,traceback,copy
+import Build,Task,Utils,Logs,Options
+from Logs import debug,error,warn
+from Constants import*
+typos={'sources':'source','targets':'target','include':'includes','define':'defines','importpath':'importpaths','install_var':'install_path','install_subdir':'install_path','inst_var':'install_path','inst_dir':'install_path',}
+class register_obj(type):
+	def __init__(cls,name,bases,dict):
+		super(register_obj,cls).__init__(name,bases,dict)
+		name=cls.__name__
+		suffix='_taskgen'
+		if name.endswith(suffix):
+			task_gen.classes[name.replace(suffix,'')]=cls
+class task_gen(object):
+	__metaclass__=register_obj
+	mappings={}
+	mapped={}
+	prec={}
+	traits={}
+	classes={}
+	idx={}
+	def __init__(self,*kw,**kwargs):
+		self.prec={}
+		self.source=''
+		self.target=''
+		self.meths=[]
+		self.mappings={}
+		self.features=list(kw)
+		self.tasks=[]
+		self.default_chmod=0644
+		self.default_install_path=None
+		if Options.is_install:
+			self.inst_files=[]
+		self.allnodes=[]
+		self.bld=kwargs.get('bld',Build.bld)
+		self.env=self.bld.env.copy()
+		self.path=self.bld.path
+		self.name=''
+		self.bld.all_task_gen.append(self)
+		self.idx=task_gen.idx[self.path.id]=task_gen.idx.get(self.path.id,0)+1
+		for key,val in kwargs.iteritems():
+			setattr(self,key,val)
+	def __str__(self):
+		return("<task_gen '%s' of type %s defined in %s>"%(self.name or self.target,self.__class__.__name__,str(self.path)))
+	def __setattr__(self,name,attr):
+		real=typos.get(name,name)
+		if real!=name:
+			warn('typo %s -> %s'%(name,real))
+			if Logs.verbose>0:
+				traceback.print_stack()
+		object.__setattr__(self,real,attr)
+	def to_list(self,value):
+		if type(value)is types.StringType:return value.split()
+		else:return value
+	def apply_core(self):
+		find_resource=self.path.find_resource
+		for filename in self.to_list(self.source):
+			x=self.get_hook(filename)
+			if x:
+				x(self,filename)
+			else:
+				node=find_resource(filename)
+				if not node:raise Utils.WafError("source not found: '%s' in '%s'"%(filename,str(self.path)))
+				self.allnodes.append(node)
+		for node in self.allnodes:
+			filename=node.name
+			k=max(0,filename.rfind('.'))
+			x=self.get_hook(filename[k:])
+			if not x:
+				raise Utils.WafError("Do not know how to process %s in %s, mappings are %s"%(str(node),str(self.__class__),str(self.__class__.mappings)))
+			x(self,node)
+	def apply(self):
+		keys=set(self.meths)
+		self.features=Utils.to_list(self.features)
+		for x in self.features+['*']:
+			keys.update(task_gen.traits.get(x,()))
+		prec={}
+		prec_tbl=self.prec or task_gen.prec
+		for x in prec_tbl:
+			if x in keys:
+				prec[x]=prec_tbl[x]
+		tmp=[]
+		for a in keys:
+			for x in prec.values():
+				if a in x:break
+			else:
+				tmp.append(a)
+		out=[]
+		while tmp:
+			e=tmp.pop()
+			if e in keys:out.append(e)
+			try:
+				nlst=prec[e]
+			except KeyError:
+				pass
+			else:
+				del prec[e]
+				for x in nlst:
+					for y in prec:
+						if x in prec[y]:
+							break
+					else:
+						tmp.append(x)
+		if prec:raise Utils.WafError("graph has a cycle %s"%str(prec))
+		out.reverse()
+		self.meths=out
+		if not out:out.append(self.apply_core.__name__)
+		debug('task_gen: posting %s %d'%(self,id(self)))
+		for x in out:
+			try:
+				v=getattr(self,x)
+			except AttributeError:
+				raise Utils.WafError("tried to retrieve %s which is not a valid method"%x)
+			debug('task_gen: -> %s (%d)'%(x,id(self)))
+			v()
+	def post(self):
+		if not self.name:self.name=self.target
+		if getattr(self,'posted',None):
+			return
+		self.apply()
+		debug('task_gen: posted %s'%self.name)
+		self.posted=True
+	def get_hook(self,ext):
+		try:return self.mappings[ext]
+		except KeyError:
+			try:return task_gen.mappings[ext]
+			except KeyError:return None
+	def create_task(self,name,env=None):
+		task=Task.TaskBase.classes[name](env or self.env,generator=self)
+		self.tasks.append(task)
+		return task
+	def name_to_obj(self,name):
+		return self.bld.name_to_obj(name,self.env)
+	def find_sources_in_dirs(self,dirnames,excludes=[],exts=[]):
+		lst=[]
+		err_msg="'%s' attribute must be a list.\n""Directories should be given either as a string separated by spaces, or as a list."
+		not_a_list=lambda x:x and type(x)is not types.ListType
+		if not_a_list(excludes):
+			raise Utils.WscriptError(err_msg%'excludes')
+		if not_a_list(exts):
+			raise Utils.WscriptError(err_msg%'exts')
+		dirnames=self.to_list(dirnames)
+		ext_lst=exts or self.mappings.keys()+task_gen.mappings.keys()
+		for name in dirnames:
+			anode=self.path.find_dir(name)
+			if not anode or not anode.is_child_of(self.bld.srcnode):
+				raise Utils.WscriptError("Unable to use '%s' - either because it's not a relative path"", or it's not child of '%s'."%(name,self.bld.srcnode))
+			self.bld.rescan(anode)
+			for name in self.bld.cache_dir_contents[anode.id]:
+				(base,ext)=os.path.splitext(name)
+				if ext in ext_lst and not name in lst and not name in excludes:
+					lst.append((anode.relpath_gen(self.path)or'.')+os.path.sep+name)
+		lst.sort()
+		self.source=self.to_list(self.source)
+		if not self.source:self.source=lst
+		else:self.source+=lst
+	def clone(self,env):
+		newobj=task_gen(bld=self.bld)
+		for x in self.__dict__:
+			if x in["env"]:
+				continue
+			elif x in["path","features"]:
+				setattr(newobj,x,getattr(self,x))
+			else:
+				setattr(newobj,x,copy.copy(getattr(self,x)))
+		newobj.__class__=self.__class__
+		if type(env)is types.StringType:
+			newobj.env=self.bld.all_envs[env].copy()
+		else:
+			newobj.env=env.copy()
+		self.bld.all_task_gen.append(newobj)
+		return newobj
+	def get_inst_path(self):
+		return getattr(self,'_install_path',getattr(self,'default_install_path',''))
+	def set_inst_path(self,val):
+		self._install_path=val
+	install_path=property(get_inst_path,set_inst_path)
+	def get_chmod(self):
+		return getattr(self,'_chmod',getattr(self,'default_chmod',0644))
+	def set_chmod(self,val):
+		self._chmod=val
+	chmod=property(get_chmod,set_chmod)
+def declare_extension(var,func):
+	try:
+		for x in var:
+			task_gen.mappings[x]=func
+	except:
+		raise Utils.WscriptError('declare extension takes either a list or a string %s'%str(var))
+	task_gen.mapped[func.__name__]=func
+def declare_order(*k):
+	assert(len(k)>1)
+	n=len(k)-1
+	for i in xrange(n):
+		f1=k[i]
+		f2=k[i+1]
+		try:
+			if not f1 in task_gen.prec[f2]:task_gen.prec[f2].append(f1)
+		except:
+			task_gen.prec[f2]=[f1]
+def declare_chain(name='',action='',ext_in='',ext_out='',reentrant=1,color='BLUE',install=0,before=[],after=[],decider=None):
+	if type(action)is types.StringType:
+		act=Task.simple_task_type(name,action,color=color)
+	else:
+		act=Task.task_type_from_func(name,action,color=color)
+	act.ext_in=tuple(Utils.to_list(ext_in))
+	act.ext_out=tuple(Utils.to_list(ext_out))
+	act.before=Utils.to_list(before)
+	act.after=Utils.to_list(after)
+	def x_file(self,node):
+		if decider:
+			ext=decider(self,node)
+		elif type(ext_out)is types.StringType:
+			ext=ext_out
+		if type(ext)is types.StringType:
+			out_source=node.change_ext(ext)
+			if reentrant:
+				self.allnodes.append(out_source)
+		elif type(ext)==types.ListType:
+			out_source=[node.change_ext(x)for x in ext]
+			if reentrant:
+				for i in xrange(reentrant):
+					self.allnodes.append(out_source[i])
+		else:
+			raise Utils.WafError("do not know how to process %s"%str(ext))
+		tsk=self.create_task(name)
+		tsk.set_inputs(node)
+		tsk.set_outputs(out_source)
+		if Options.is_install and install:
+			tsk.install=install
+	declare_extension(act.ext_in,x_file)
+def bind_feature(name,methods):
+	lst=Utils.to_list(methods)
+	try:
+		l=task_gen.traits[name]
+	except KeyError:
+		l=set()
+		task_gen.traits[name]=l
+	l.update(lst)
+def taskgen(func):
+	setattr(task_gen,func.__name__,func)
+def feature(*k):
+	def deco(func):
+		setattr(task_gen,func.__name__,func)
+		for name in k:
+			try:
+				l=task_gen.traits[name]
+			except KeyError:
+				l=set()
+				task_gen.traits[name]=l
+			l.update([func.__name__])
+		return func
+	return deco
+def before(*k):
+	def deco(func):
+		for fun_name in k:
+			try:
+				if not func.__name__ in task_gen.prec[fun_name]:task_gen.prec[fun_name].append(func.__name__)
+			except KeyError:
+				task_gen.prec[fun_name]=[func.__name__]
+		return func
+	return deco
+def after(*k):
+	def deco(func):
+		for fun_name in k:
+			try:
+				if not fun_name in task_gen.prec[func.__name__]:task_gen.prec[func.__name__].append(fun_name)
+			except KeyError:
+				task_gen.prec[func.__name__]=[fun_name]
+		return func
+	return deco
+def extension(var):
+	if type(var)is types.ListType:
+		pass
+	elif type(var)is types.StringType:
+		var=[var]
+	else:
+		raise Utils.WafError('declare extension takes either a list or a string %s'%str(var))
+	def deco(func):
+		setattr(task_gen,func.__name__,func)
+		for x in var:
+			task_gen.mappings[x]=func
+		task_gen.mapped[func.__name__]=func
+		return func
+	return deco
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/UnitTest.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/UnitTest.py
new file mode 100644
index 0000000..9baa1d0
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/UnitTest.py
@@ -0,0 +1,116 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys
+import Build,TaskGen,Utils,Options,Logs
+import pproc
+class unit_test(object):
+	def __init__(self):
+		self.returncode_ok=0
+		self.num_tests_ok=0
+		self.num_tests_failed=0
+		self.num_tests_err=0
+		self.total_num_tests=0
+		self.max_label_length=0
+		self.unit_tests={}
+		self.unit_test_results={}
+		self.unit_test_erroneous={}
+		self.change_to_testfile_dir=False
+		self.want_to_see_test_output=False
+		self.want_to_see_test_error=False
+		self.run_if_waf_does='check'
+	def run(self):
+		self.num_tests_ok=0
+		self.num_tests_failed=0
+		self.num_tests_err=0
+		self.total_num_tests=0
+		self.max_label_length=0
+		self.unit_tests={}
+		self.unit_test_results={}
+		self.unit_test_erroneous={}
+		if not Options.commands[self.run_if_waf_does]:return
+		for obj in Build.bld.all_task_gen:
+			if not hasattr(obj,'unit_test'):continue
+			unit_test=getattr(obj,'unit_test')
+			if not unit_test:continue
+			try:
+				if'program'in obj.features:
+					output=obj.path
+					filename=os.path.join(output.abspath(obj.env),obj.target)
+					srcdir=output.abspath()
+					label=os.path.join(output.bldpath(obj.env),obj.target)
+					self.max_label_length=max(self.max_label_length,len(label))
+					self.unit_tests[label]=(filename,srcdir)
+			except KeyError:
+				pass
+		self.total_num_tests=len(self.unit_tests)
+		Utils.pprint('GREEN','Running the unit tests')
+		count=0
+		result=1
+		for label,file_and_src in self.unit_tests.iteritems():
+			filename=file_and_src[0]
+			srcdir=file_and_src[1]
+			count+=1
+			line=Build.bld.progress_line(count,self.total_num_tests,Logs.colors.GREEN,Logs.colors.NORMAL)
+			if Options.options.progress_bar and line:
+				sys.stdout.write(line)
+				sys.stdout.flush()
+			try:
+				kwargs={}
+				if self.change_to_testfile_dir:
+					kwargs['cwd']=srcdir
+				if not self.want_to_see_test_output:
+					kwargs['stdout']=pproc.PIPE
+				if not self.want_to_see_test_error:
+					kwargs['stderr']=pproc.PIPE
+				pp=pproc.Popen(filename,**kwargs)
+				pp.wait()
+				result=int(pp.returncode==self.returncode_ok)
+				if result:
+					self.num_tests_ok+=1
+				else:
+					self.num_tests_failed+=1
+				self.unit_test_results[label]=result
+				self.unit_test_erroneous[label]=0
+			except OSError:
+				self.unit_test_erroneous[label]=1
+				self.num_tests_err+=1
+			except KeyboardInterrupt:
+				pass
+		if Options.options.progress_bar:sys.stdout.write(Logs.colors.cursor_on)
+	def print_results(self):
+		if not Options.commands[self.run_if_waf_does]:return
+		p=Utils.pprint
+		if self.total_num_tests==0:
+			p('YELLOW','No unit tests present')
+			return
+		p('GREEN','Running unit tests')
+		print
+		for label,filename in self.unit_tests.iteritems():
+			err=0
+			result=0
+			try:err=self.unit_test_erroneous[label]
+			except KeyError:pass
+			try:result=self.unit_test_results[label]
+			except KeyError:pass
+			n=self.max_label_length-len(label)
+			if err:n+=4
+			elif result:n+=7
+			else:n+=3
+			line='%s %s'%(label,'.'*n)
+			print line,
+			if err:p('RED','ERROR')
+			elif result:p('GREEN','OK')
+			else:p('YELLOW','FAILED')
+		percentage_ok=float(self.num_tests_ok)/float(self.total_num_tests)*100.0
+		percentage_failed=float(self.num_tests_failed)/float(self.total_num_tests)*100.0
+		percentage_erroneous=float(self.num_tests_err)/float(self.total_num_tests)*100.0
+		print'''
+Successful tests:      %i (%.1f%%)
+Failed tests:          %i (%.1f%%)
+Erroneous tests:       %i (%.1f%%)
+
+Total number of tests: %i
+'''%(self.num_tests_ok,percentage_ok,self.num_tests_failed,percentage_failed,self.num_tests_err,percentage_erroneous,self.total_num_tests)
+		p('GREEN','Unit tests finished')
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/__init__.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/__init__.py
new file mode 100644
index 0000000..cbc8406
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/__init__.py
@@ -0,0 +1,4 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ar.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ar.py
new file mode 100644
index 0000000..8572d5d
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ar.py
@@ -0,0 +1,53 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys
+import Task
+from Configure import conftest
+ar_str='${AR} ${ARFLAGS} ${TGT} ${SRC} && ${RANLIB} ${RANLIBFLAGS} ${TGT}'
+if sys.platform=="win32":
+	ar_str='${AR} s${ARFLAGS} ${TGT} ${SRC}'
+cls=Task.simple_task_type('ar_link_static',ar_str,color='YELLOW',ext_in='.o')
+cls.maxjobs=1
+def detect(conf):
+	comp=conf.find_program('ar',var='AR')
+	if not comp:return
+	ranlib=conf.find_program('ranlib',var='RANLIB')
+	if not ranlib:return
+	v=conf.env
+	v['AR']=comp
+	v['ARFLAGS']='rc'
+	v['RANLIB']=ranlib
+	v['RANLIBFLAGS']=''
+def find_ar(conf):
+	v=conf.env
+	conf.check_tool('ar')
+	if not v['AR']:conf.fatal('ar is required for static libraries - not found')
+def find_cpp(conf):
+	v=conf.env
+	cpp=None
+	if v['CPP']:cpp=v['CPP']
+	elif'CPP'in os.environ:cpp=os.environ['CPP']
+	if not cpp:cpp=conf.find_program('cpp',var='CPP')
+	if not cpp:cpp=v['CC']
+	if not cpp:cpp=v['CXX']
+	v['CPP']=cpp
+def cc_add_flags(conf):
+	conf.add_os_flags('CFLAGS','CCFLAGS')
+	conf.add_os_flags('CPPFLAGS')
+	conf.add_os_flags('LINKFLAGS')
+def cxx_add_flags(conf):
+	conf.add_os_flags('CXXFLAGS')
+	conf.add_os_flags('CPPFLAGS')
+	conf.add_os_flags('LINKFLAGS')
+def cc_load_tools(conf):
+	conf.check_tool('cc')
+def cxx_load_tools(conf):
+	conf.check_tool('cxx')
+
+conftest(find_ar)
+conftest(find_cpp)
+conftest(cc_add_flags)
+conftest(cxx_add_flags)
+conftest(cc_load_tools)
+conftest(cxx_load_tools)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/bison.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/bison.py
new file mode 100644
index 0000000..0c7e294
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/bison.py
@@ -0,0 +1,18 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import TaskGen
+def decide_ext(self,node):
+	c_ext='.tab.c'
+	if node.name.endswith('.yc'):c_ext='.tab.cc'
+	if'-d'in self.env['BISONFLAGS']:
+		return[c_ext,c_ext.replace('c','h')]
+	else:
+		return c_ext
+TaskGen.declare_chain(name='bison',action='cd ${SRC[0].bld_dir(env)} && ${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}',ext_in='.y .yc .yy',decider=decide_ext,before='cc cxx',)
+def detect(conf):
+	bison=conf.find_program('bison',var='BISON')
+	if not bison:conf.fatal("bison was not found")
+	v=conf.env
+	v['BISONFLAGS']='-d'
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cc.py
new file mode 100644
index 0000000..f318b30
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cc.py
@@ -0,0 +1,71 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import TaskGen,Build,Utils,Task
+from Logs import debug
+import ccroot
+from TaskGen import feature,before,extension,after
+g_cc_flag_vars=['CCDEPS','FRAMEWORK','FRAMEWORKPATH','STATICLIB','LIB','LIBPATH','LINKFLAGS','RPATH','CCFLAGS','CPPPATH','CPPFLAGS','CCDEFINES']
+EXT_CC=['.c']
+TaskGen.bind_feature('cc',['apply_core'])
+g_cc_type_vars=['CCFLAGS','LINKFLAGS']
+class cc_taskgen(ccroot.ccroot_abstract):
+	pass
+def init_cc(self):
+	self.p_flag_vars=set(self.p_flag_vars).union(g_cc_flag_vars)
+	self.p_type_vars=set(self.p_type_vars).union(g_cc_type_vars)
+	if not self.env['CC_NAME']:
+		raise Utils.WafError("At least one compiler (gcc, ..) must be selected")
+def apply_obj_vars_cc(self):
+	env=self.env
+	app=env.append_unique
+	cpppath_st=env['CPPPATH_ST']
+	for i in env['INC_PATHS']:
+		app('_CCINCFLAGS',cpppath_st%i.bldpath(env))
+		app('_CCINCFLAGS',cpppath_st%i.srcpath(env))
+	for i in env['CPPPATH']:
+		app('_CCINCFLAGS',cpppath_st%i)
+	app('_CCINCFLAGS',cpppath_st%'.')
+	app('_CCINCFLAGS',cpppath_st%env.variant())
+	tmpnode=self.path
+	app('_CCINCFLAGS',cpppath_st%tmpnode.bldpath(env))
+	app('_CCINCFLAGS',cpppath_st%tmpnode.srcpath(env))
+def apply_defines_cc(self):
+	tree=Build.bld
+	self.defines=getattr(self,'defines',[])
+	lst=self.to_list(self.defines)+self.to_list(self.env['CCDEFINES'])
+	milst=[]
+	for defi in lst:
+		if not defi in milst:
+			milst.append(defi)
+	libs=self.to_list(self.uselib)
+	for l in libs:
+		val=self.env['CCDEFINES_'+l]
+		if val:milst+=val
+	self.env['DEFLINES']=["%s %s"%(x[0],Utils.trimquotes('='.join(x[1:])))for x in[y.split('=')for y in milst]]
+	y=self.env['CCDEFINES_ST']
+	self.env['_CCDEFFLAGS']=[y%x for x in milst]
+def c_hook(self,node):
+	task=self.create_task('cc')
+	try:obj_ext=self.obj_ext
+	except AttributeError:obj_ext='_%d.o'%self.idx
+	task.defines=self.scanner_defines
+	task.inputs=[node]
+	task.outputs=[node.change_ext(obj_ext)]
+	self.compiled_tasks.append(task)
+cc_str='${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}'
+link_str='${LINK_CC} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT} ${LINKFLAGS} ${_LIBDIRFLAGS} ${_LIBFLAGS}'
+cls=Task.simple_task_type('cc',cc_str,'GREEN',ext_out='.o',ext_in='.c')
+cls.scan=ccroot.scan
+cls.vars.append('CCDEPS')
+cls=Task.simple_task_type('cc_link',link_str,color='YELLOW',ext_in='.o')
+cls.maxjobs=1
+TaskGen.declare_order('apply_incpaths','apply_defines_cc','apply_core','apply_lib_vars','apply_obj_vars_cc','apply_obj_vars')
+
+feature('cc')(init_cc)
+before('apply_type_vars')(init_cc)
+after('default_cc')(init_cc)
+feature('cc')(apply_obj_vars_cc)
+feature('cc')(apply_defines_cc)
+extension(EXT_CC)(c_hook)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ccroot.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ccroot.py
new file mode 100644
index 0000000..ba61ec9
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ccroot.py
@@ -0,0 +1,300 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,re
+import TaskGen,Utils,preproc,Logs,Build,Options
+from Logs import error,debug,warn
+from Utils import md5
+from TaskGen import taskgen,after,before,feature
+from Constants import*
+import config_c
+get_version_re=re.compile('\d+\.\d+(\.?\d+)*')
+def get_cc_version(conf,cc,version_var):
+	v=conf.env
+	output=Utils.cmd_output('%s -dumpversion'%cc)
+	if output:
+		match=get_version_re.search(output)
+		if match:
+			v[version_var]=match.group(0)
+			conf.check_message('compiler','version',1,v[version_var])
+			return v[version_var]
+	warn('could not determine the compiler version')
+class DEBUG_LEVELS:
+	ULTRADEBUG="ultradebug"
+	DEBUG="debug"
+	RELEASE="release"
+	OPTIMIZED="optimized"
+	CUSTOM="custom"
+	ALL=[ULTRADEBUG,DEBUG,RELEASE,OPTIMIZED,CUSTOM]
+def scan(self):
+	debug('ccroot: _scan_preprocessor(self, node, env, path_lst)')
+	all_nodes=[]
+	all_names=[]
+	seen=[]
+	for node in self.inputs:
+		gruik=preproc.c_parser(nodepaths=self.env['INC_PATHS'],defines=self.defines)
+		gruik.start(node,self.env)
+		if Logs.verbose:
+			debug('deps: nodes found for %s: %s %s'%(str(node),str(gruik.nodes),str(gruik.names)))
+			debug('deps: deps found for %s: %s'%(str(node),str(gruik.deps)))
+		for x in gruik.nodes:
+			if id(x)in seen:continue
+			seen.append(id(x))
+			all_nodes.append(x)
+		for x in gruik.names:
+			if not x in all_names:
+				all_names.append(x)
+	return(all_nodes,gruik.names)
+class ccroot_abstract(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+		if len(k)>1:
+			self.features.append('c'+k[1])
+def default_cc(self):
+	Utils.def_attrs(self,includes='',defines='',rpaths='',uselib='',uselib_local='',add_objects='',p_flag_vars=[],p_type_vars=[],scanner_defines={},compiled_tasks=[],link_task=None)
+def get_target_name(self):
+	tp='program'
+	for x in self.features:
+		if x in['cshlib','cstaticlib']:
+			tp=x.lstrip('c')
+	pattern=self.env[tp+'_PATTERN']
+	if not pattern:pattern='%s'
+	name=self.target
+	k=name.rfind('/')
+	return name[0:k+1]+pattern%name[k+1:]
+def apply_verif(self):
+	if not'objects'in self.features:
+		if not self.source:
+			raise Utils.WafError('no source files specified for %s'%self)
+		if not self.target:
+			raise Utils.WafError('no target for %s'%self)
+def install_shlib(self):
+	nums=self.vnum.split('.')
+	path=self.install_path
+	libname=self.outputs[0].name
+	name3=libname+'.'+self.vnum
+	name2=libname+'.'+nums[0]
+	name1=libname
+	filename=self.outputs[0].abspath(self.env)
+	bld=Build.bld
+	bld.install_as(os.path.join(path,name3),filename,env=self.env)
+	bld.symlink_as(os.path.join(path,name2),name3)
+	bld.symlink_as(os.path.join(path,name1),name3)
+def vars_target_cprogram(self):
+	self.default_install_path='${PREFIX}/bin'
+	self.default_chmod=0755
+def vars_target_cstaticlib(self):
+	self.default_install_path='${PREFIX}/lib'
+def install_target_cstaticlib(self):
+	if not Options.is_install:return
+	self.link_task.install_path=self.install_path
+def install_target_cshlib(self):
+	if getattr(self,'vnum','')and sys.platform!='win32':
+		tsk=self.link_task
+		tsk.vnum=self.vnum
+		tsk.install=install_shlib
+def apply_incpaths(self):
+	lst=[]
+	for lib in self.to_list(self.uselib):
+		for path in self.env['CPPPATH_'+lib]:
+			if not path in lst:
+				lst.append(path)
+	if preproc.go_absolute:
+		for path in preproc.standard_includes:
+			if not path in lst:
+				lst.append(path)
+	for path in self.to_list(self.includes):
+		if not path in lst:
+			lst.append(path)
+			if(not preproc.go_absolute)and os.path.isabs(path):
+				self.env.prepend_value('CPPPATH',path)
+	tree=Build.bld
+	inc_lst=[]
+	for path in lst:
+		node=None
+		if os.path.isabs(path):
+			if preproc.go_absolute:
+				node=Build.bld.root.find_dir(path)
+		else:
+			node=self.path.find_dir(path)
+		if node:
+			inc_lst.append(node)
+	self.env['INC_PATHS']+=inc_lst
+def apply_type_vars(self):
+	for x in self.features:
+		if not x in['cprogram','cstaticlib','cshlib']:
+			continue
+		x=x.lstrip('c')
+		st=self.env[x+'_USELIB']
+		if st:self.uselib=self.uselib+' '+st
+		for var in self.p_type_vars:
+			compvar='%s_%s'%(x,var)
+			value=self.env[compvar]
+			if value:self.env.append_value(var,value)
+def apply_link(self):
+	link=getattr(self,'link',None)
+	if not link:
+		if'cstaticlib'in self.features:link='ar_link_static'
+		elif'cxx'in self.features:link='cxx_link'
+		else:link='cc_link'
+	linktask=self.create_task(link)
+	outputs=[t.outputs[0]for t in self.compiled_tasks]
+	linktask.set_inputs(outputs)
+	linktask.set_outputs(self.path.find_or_declare(get_target_name(self)))
+	linktask.chmod=self.chmod
+	self.link_task=linktask
+def apply_lib_vars(self):
+	env=self.env
+	uselib=self.to_list(self.uselib)
+	seen=[]
+	names=self.to_list(self.uselib_local)[:]
+	while names:
+		x=names.pop(0)
+		if x in seen:
+			continue
+		y=self.name_to_obj(x)
+		if not y:
+			raise Utils.WafError("object '%s' was not found in uselib_local (required by '%s')"%(x,self.name))
+		if getattr(y,'uselib_local',None):
+			lst=y.to_list(y.uselib_local)
+			for u in lst:
+				if not u in seen:
+					names.append(u)
+		y.post()
+		seen.append(x)
+		if'cshlib'in y.features or'cprogram'in y.features:
+			env.append_value('LIB',y.target)
+		elif'cstaticlib'in y.features:
+			env.append_value('STATICLIB',y.target)
+		tmp_path=y.path.bldpath(self.env)
+		if not tmp_path in env['LIBPATH']:env.prepend_value('LIBPATH',tmp_path)
+		if y.link_task is not None:
+			self.link_task.set_run_after(y.link_task)
+			dep_nodes=getattr(self.link_task,'dep_nodes',[])
+			self.link_task.dep_nodes=dep_nodes+y.link_task.outputs
+		morelibs=y.to_list(y.uselib)
+		for v in morelibs:
+			if v in uselib:continue
+			uselib=[v]+uselib
+		if getattr(y,'export_incdirs',None):
+			cpppath_st=self.env['CPPPATH_ST']
+			for x in self.to_list(y.export_incdirs):
+				node=y.path.find_dir(x)
+				if not node:raise Utils.WafError('object %s: invalid folder %s in export_incdirs'%(y.target,x))
+				self.env.append_unique('INC_PATHS',node)
+	for x in uselib:
+		for v in self.p_flag_vars:
+			val=self.env[v+'_'+x]
+			if val:self.env.append_value(v,val)
+def apply_objdeps(self):
+	seen=[]
+	names=self.to_list(self.add_objects)
+	while names:
+		x=names[0]
+		if x in seen:
+			names=names[1:]
+			continue
+		y=self.name_to_obj(x)
+		if not y:
+			raise Utils.WafError("object '%s' was not found in uselib_local (required by add_objects '%s')"%(x,self.name))
+		if y.add_objects:
+			added=0
+			lst=y.to_list(y.add_objects)
+			lst.reverse()
+			for u in lst:
+				if u in seen:continue
+				added=1
+				names=[u]+names
+			if added:continue
+		y.post()
+		seen.append(x)
+		self.link_task.inputs+=y.out_nodes
+def apply_obj_vars(self):
+	v=self.env
+	lib_st=v['LIB_ST']
+	staticlib_st=v['STATICLIB_ST']
+	libpath_st=v['LIBPATH_ST']
+	staticlibpath_st=v['STATICLIBPATH_ST']
+	rpath_st=v['RPATH_ST']
+	app=v.append_unique
+	if v['FULLSTATIC']:
+		v.append_value('LINKFLAGS',v['FULLSTATIC_MARKER'])
+	for i in v['RPATH']:
+		if i and rpath_st:
+			app('LINKFLAGS',rpath_st%i)
+	for i in v['LIBPATH']:
+		app('LINKFLAGS',libpath_st%i)
+		app('LINKFLAGS',staticlibpath_st%i)
+	if v['STATICLIB']:
+		v.append_value('LINKFLAGS',v['STATICLIB_MARKER'])
+		k=[(staticlib_st%i)for i in v['STATICLIB']]
+		app('LINKFLAGS',k)
+	if not v['FULLSTATIC']:
+		if v['STATICLIB']or v['LIB']:
+			v.append_value('LINKFLAGS',v['SHLIB_MARKER'])
+	app('LINKFLAGS',[lib_st%i for i in v['LIB']])
+def apply_vnum(self):
+	if sys.platform!='darwin'and sys.platform!='win32':
+		try:
+			nums=self.vnum.split('.')
+		except AttributeError:
+			pass
+		else:
+			try:name3=self.soname
+			except AttributeError:name3=self.link_task.outputs[0].name+'.'+nums[0]
+			self.env.append_value('LINKFLAGS','-Wl,-h,'+name3)
+def process_obj_files(self):
+	if not hasattr(self,'obj_files'):return
+	for x in self.obj_files:
+		node=self.path.find_resource(x)
+		self.link_task.inputs.append(node)
+def add_obj_file(self,file):
+	if not hasattr(self,'obj_files'):self.obj_files=[]
+	if not'process_obj_files'in self.meths:self.meths.append('process_obj_files')
+	self.obj_files.append(file)
+def make_objects_available(self):
+	self.out_nodes=[]
+	app=self.out_nodes.append
+	for t in self.compiled_tasks:app(t.outputs[0])
+c_attrs={'cxxflag':'CXXFLAGS','cflag':'CCFLAGS','ccflag':'CCFLAGS','linkflag':'LINKFLAGS','ldflag':'LINKFLAGS','lib':'LIB','libpath':'LIBPATH','staticlib':'STATICLIB','staticlibpath':'STATICLIBPATH','rpath':'RPATH',}
+def add_extra_flags(self):
+	for x in self.__dict__.keys():
+		y=x.lower()
+		if y[-1]=='s':
+			y=y[:-1]
+		if c_attrs.get(y,None):
+			self.env.append_unique(c_attrs[y],getattr(self,x))
+
+feature('cc','cxx')(default_cc)
+before('init_cc','init_cxx')(default_cc)
+feature('cprogram','dprogram','cstaticlib','dstaticlib','cshlib','dshlib')(apply_verif)
+feature('cprogram','dprogram')(vars_target_cprogram)
+before('apply_core')(vars_target_cprogram)
+feature('cstaticlib','dstaticlib','cshlib','dshlib')(vars_target_cstaticlib)
+before('apply_core')(vars_target_cstaticlib)
+feature('cprogram','dprogram','cstaticlib','dstaticlib','cshlib','dshlib')(install_target_cstaticlib)
+after('apply_objdeps','apply_link')(install_target_cstaticlib)
+feature('cshlib','dshlib')(install_target_cshlib)
+after('apply_objdeps','apply_link')(install_target_cshlib)
+feature('cc','cxx')(apply_incpaths)
+after('apply_type_vars')(apply_incpaths)
+feature('cc','cxx')(apply_type_vars)
+taskgen(apply_link)
+feature('cprogram','cshlib','cstaticlib')(apply_link)
+after('apply_core')(apply_link)
+feature('cc','cxx')(apply_lib_vars)
+after('apply_vnum')(apply_lib_vars)
+feature('objects')(apply_objdeps)
+after('apply_obj_vars','apply_vnum')(apply_objdeps)
+feature('cprogram','cshlib','cstaticlib')(apply_obj_vars)
+after('apply_lib_vars')(apply_obj_vars)
+feature('cprogram','cshlib','cstaticlib')(apply_vnum)
+after('apply_link')(apply_vnum)
+taskgen(process_obj_files)
+after('apply_link')(process_obj_files)
+taskgen(add_obj_file)
+feature('objects')(make_objects_available)
+after('apply_core')(make_objects_available)
+taskgen(add_extra_flags)
+feature('cc','cxx')(add_extra_flags)
+before('init_cxx','init_cc')(add_extra_flags)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_cc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_cc.py
new file mode 100644
index 0000000..1a8852c
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_cc.py
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,imp,types,ccroot
+import optparse
+import Utils,Configure,Options
+c_compiler={'win32':['msvc','gcc'],'cygwin':['gcc'],'darwin':['gcc'],'aix5':['gcc'],'linux':['gcc','suncc'],'sunos':['suncc','gcc'],'irix':['gcc'],'hpux':['gcc'],'default':['gcc']}
+def __list_possible_compiler(platform):
+	try:
+		return c_compiler[platform]
+	except KeyError:
+		return c_compiler["default"]
+def detect(conf):
+	try:test_for_compiler=Options.options.check_c_compiler
+	except AttributeError:raise Configure.ConfigurationError("Add set_options(opt): opt.tool_options('compiler_cc')")
+	for c_compiler in test_for_compiler.split():
+		conf.check_tool(c_compiler)
+		if conf.env['CC']:
+			conf.check_message("%s"%c_compiler,'',True)
+			conf.env["COMPILER_CC"]="%s"%c_compiler
+			return
+		conf.check_message("%s"%c_compiler,'',False)
+	conf.env["COMPILER_CC"]=None
+def set_options(opt):
+	detected_platform=Options.platform
+	possible_compiler_list=__list_possible_compiler(detected_platform)
+	test_for_compiler=str(" ").join(possible_compiler_list)
+	cc_compiler_opts=opt.add_option_group("C Compiler Options")
+	cc_compiler_opts.add_option('--check-c-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C-Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_c_compiler")
+	for c_compiler in test_for_compiler.split():
+		opt.tool_options('%s'%c_compiler,option_group=cc_compiler_opts)
+	opt.add_option('-d','--debug-level',action='store',default=ccroot.DEBUG_LEVELS.RELEASE,help="Specify the debug level, does nothing if CFLAGS is set in the environment. [Allowed Values: '%s']"%"', '".join(ccroot.DEBUG_LEVELS.ALL),choices=ccroot.DEBUG_LEVELS.ALL,dest='debug_level')
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_cxx.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_cxx.py
new file mode 100644
index 0000000..f0aec5e
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_cxx.py
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,imp,types,ccroot
+import optparse
+import Utils,Configure,Options
+cxx_compiler={'win32':['msvc','g++'],'cygwin':['g++'],'darwin':['g++'],'aix5':['g++'],'linux':['g++','sunc++'],'sunos':['sunc++','g++'],'irix':['g++'],'hpux':['g++'],'default':['g++']}
+def __list_possible_compiler(platform):
+	try:
+		return(cxx_compiler[platform])
+	except KeyError:
+		return(cxx_compiler["default"])
+def detect(conf):
+	try:test_for_compiler=Options.options.check_cxx_compiler
+	except AttributeError:raise Configure.ConfigurationError("Add set_options(opt): opt.tool_options('compiler_cxx')")
+	for cxx_compiler in test_for_compiler.split():
+		conf.check_tool(cxx_compiler)
+		if conf.env['CXX']:
+			conf.check_message("%s"%cxx_compiler,'',True)
+			conf.env["COMPILER_CXX"]="%s"%cxx_compiler
+			return
+		conf.check_message("%s"%cxx_compiler,'',False)
+	conf.env["COMPILER_CXX"]=None
+def set_options(opt):
+	detected_platform=Options.platform
+	possible_compiler_list=__list_possible_compiler(detected_platform)
+	test_for_compiler=str(" ").join(possible_compiler_list)
+	cxx_compiler_opts=opt.add_option_group("C++ Compiler Options")
+	cxx_compiler_opts.add_option('--check-cxx-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C++ Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_cxx_compiler")
+	for cxx_compiler in test_for_compiler.split():
+		opt.tool_options('%s'%cxx_compiler,option_group=cxx_compiler_opts)
+	opt.add_option('-d','--debug-level',action='store',default=ccroot.DEBUG_LEVELS.RELEASE,help="Specify the debug level, does nothing if CXXFLAGS is set in the environment. [Allowed Values: '%s']"%"', '".join(ccroot.DEBUG_LEVELS.ALL),choices=ccroot.DEBUG_LEVELS.ALL,dest='debug_level')
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_d.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_d.py
new file mode 100644
index 0000000..7126134
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/compiler_d.py
@@ -0,0 +1,23 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,imp,types
+import Utils,Configure,Options
+def detect(conf):
+	if getattr(Options.options,'check_dmd_first',None):
+		test_for_compiler=['dmd','gdc']
+	else:
+		test_for_compiler=['gdc','dmd']
+	for d_compiler in test_for_compiler:
+		conf.check_tool(d_compiler)
+		if conf.env['D_COMPILER']:
+			conf.check_message("%s"%d_compiler,'',True)
+			conf.env["COMPILER_D"]=d_compiler
+			return
+		conf.check_message("%s"%d_compiler,'',False)
+def set_options(opt):
+	d_compiler_opts=opt.add_option_group("D Compiler Options")
+	d_compiler_opts.add_option('--check-dmd-first',action="store_true",help='checks for the gdc compiler before dmd (default is the other way round)',dest='check_dmd_first',default=False)
+	for d_compiler in['gdc','dmd']:
+		opt.tool_options('%s'%d_compiler,option_group=d_compiler_opts)
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/config_c.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/config_c.py
new file mode 100644
index 0000000..512bb03
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/config_c.py
@@ -0,0 +1,421 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import os,types,imp,cPickle,sys,shlex,shutil
+from Utils import md5
+import Build,Utils,Configure,Task,Options,Logs
+from Constants import*
+from Configure import conf,conftest
+stdincpath=['/usr/include/','/usr/local/include/']
+stdlibpath=['/usr/lib/','/usr/local/lib/','/lib']
+cfg_ver={'atleast-version':'>=','exact-version':'==','max-version':'<=',}
+def parse_flags(line,uselib,env):
+	lst=shlex.split(line)
+	while lst:
+		x=lst.pop(0)
+		st=x[:2]
+		ot=x[2:]
+		if st=='-I'or st=='/I':
+			if not ot:ot=lst.pop(0)
+			env.append_unique('CPPPATH_'+uselib,ot)
+		elif st=='-D':
+			if not ot:ot=lst.pop(0)
+			env.append_unique('CXXDEFINES_'+uselib,ot)
+			env.append_unique('CCDEFINES_'+uselib,ot)
+		elif st=='-l':
+			if not ot:ot=lst.pop(0)
+			env.append_unique('LIB_'+uselib,ot)
+		elif st=='-L':
+			if not ot:ot=lst.pop(0)
+			env.append_unique('LIBPATH_'+uselib,ot)
+		elif x=='-pthread'or x.startswith('+'):
+			env.append_unique('CCFLAGS_'+uselib,x)
+			env.append_unique('CXXFLAGS_'+uselib,x)
+			env.append_unique('LINKFLAGS_'+uselib,x)
+		elif x.startswith('-std'):
+			env.append_unique('CCFLAGS_'+uselib,x)
+			env.append_unique('LINKFLAGS_'+uselib,x)
+def validate_cfg(self,kw):
+	if not'path'in kw:
+		kw['path']='pkg-config --silence-errors'
+	if'atleast_pkgconfig_version'in kw:
+		if not'msg'in kw:
+			kw['msg']='Checking for pkg-config version >= %s'%kw['atleast_pkgconfig_version']
+		return
+	if'modversion'in kw:
+		return
+	for x in cfg_ver.keys():
+		y=x.replace('-','_')
+		if y in kw:
+			if not'package'in kw:
+				raise ValueError,'%s requires a package'%x
+			if not'msg'in kw:
+				kw['msg']='Checking for %s %s %s'%(kw['package'],cfg_ver[x],kw[y])
+			return
+	if not'msg'in kw:
+		kw['msg']='Checking for %s flags'%kw['package']
+	if not'okmsg'in kw:
+		kw['okmsg']='ok'
+	if not'errmsg'in kw:
+		kw['errmsg']='not found'
+def exec_cfg(self,kw):
+	if'atleast_pkgconfig_version'in kw:
+		try:
+			Utils.cmd_output('%s --atleast-pkgconfig-version=%s'%(kw['path'],kw['atleast_pkgconfig_version']))
+		except:
+			if not'errmsg'in kw:
+				kw['errmsg']='"pkg-config" could not be found or the version found is too old.'
+			raise Configure.ConfigurationError,kw['errmsg']
+		if not'okmsg'in kw:
+			kw['okmsg']='ok'
+		return
+	for x in cfg_ver:
+		y=x.replace('-','_')
+		if y in kw:
+			try:
+				Utils.cmd_output('%s --%s=%s %s'%(kw['path'],x,kw[y],kw['package']))
+			except:
+				if not'errmsg'in kw:
+					kw['errmsg']='Package "%s (%s %s)" could not be found or the found version is too old.'%(kw['package'],cfg_ver[x],kw[y])
+				raise Configure.ConfigurationError,kw['errmsg']
+			if not'okmsg'in kw:
+				kw['okmsg']='ok'
+			self.define('HAVE_%s'%Utils.quote_define_name(kw.get('uselib_store',kw['package'])),1,0)
+			break
+	if'modversion'in kw:
+		try:
+			version=Utils.cmd_output('%s --modversion %s'%(kw['path'],kw['modversion'])).strip()
+		except ValueError:
+			return''
+		self.define('%s_VERSION'%Utils.quote_define_name(kw.get('uselib_store',kw['modversion'])),version)
+		return version
+	lst=[kw['path']]
+	for key,val in kw.get('define_variable',{}).iteritems():
+		lst.append('--define-variable=%s=%s'%(key,val))
+	lst.append(kw.get('args',''))
+	lst.append(kw['package'])
+	cmd=' '.join(lst)
+	try:
+		ret=Utils.cmd_output(cmd)
+	except:
+		raise Configure.ConfigurationError,"no such package"
+	if not'okmsg'in kw:
+		kw['okmsg']='ok'
+	parse_flags(ret,kw.get('uselib_store',kw['package'].upper()),kw.get('env',self.env))
+	return ret
+def check_cfg(self,*k,**kw):
+	self.validate_cfg(kw)
+	if'msg'in kw:
+		self.check_message_1(kw['msg'])
+	ret=None
+	try:
+		ret=self.exec_cfg(kw)
+	except Configure.ConfigurationError,e:
+		if'errmsg'in kw:
+			self.check_message_2(kw['errmsg'],'YELLOW')
+		if'mandatory'in kw:
+			if Logs.verbose>1:
+				raise
+			else:
+				self.fatal('the configuration failed (see config.log)')
+	else:
+		if'okmsg'in kw:
+			self.check_message_2(kw['okmsg'])
+	return ret
+simple_c_code='int main() {return 0;}\n'
+code_with_headers=''
+def validate_c(self,kw):
+	if not'env'in kw:
+		kw['env']=self.env.copy()
+	env=kw['env']
+	if not'compiler'in kw:
+		kw['compiler']='cc'
+		if env['CXX_NAME']and Task.TaskBase.classes.get('cxx',None):
+			kw['compiler']='cxx'
+	if not'type'in kw:
+		kw['type']='program'
+	assert not(kw['type']!='program'and kw.get('execute',0)),'can only execute programs'
+	def to_header(dct):
+		if'header_name'in dct:
+			dct=Utils.to_list(dct['header_name'])
+			return''.join(['#include <%s>\n'%x for x in dct])
+		return''
+	if'framework_name'in kw:
+		if not kw.get('header_name'):
+			kw['header_name']=[]
+	if'function_name'in kw:
+		fu=kw['function_name']
+		if not'msg'in kw:
+			kw['msg']='Checking for function %s'%fu
+		kw['code']=to_header(kw)+'int main(){\nvoid *p;\np=(void*)(%s);\nreturn 0;\n}\n'%fu
+		if not'uselib_store'in kw:
+			kw['uselib_store']=fu.upper()
+		if not'define_name'in kw:
+			kw['define_name']=self.have_define(fu)
+	elif'header_name'in kw:
+		if not'msg'in kw:
+			kw['msg']='Checking for header %s'%kw['header_name']
+		if'framework_name'in kw:
+			fwkname=kw['framework_name']
+			fwk='%s/%s.h'%(fwkname,fwkname)
+			if kw.get('remove_dot_h',None):
+				fwk=fwk[:-2]
+			kw['header_name']=Utils.to_list(kw['header_name'])+[fwk]
+			kw['msg']='Checking for framework %s'%fwkname
+			kw['framework']=fwkname
+		l=Utils.to_list(kw['header_name'])
+		assert len(l)>0,'list of headers in header_name is empty'
+		kw['code']=to_header(kw)+'int main(){return 0;}\n'
+		if not'uselib_store'in kw:
+			kw['uselib_store']=l[0].upper()
+		if not'define_name'in kw:
+			kw['define_name']=self.have_define(l[0])
+	if'lib'in kw:
+		if not'msg'in kw:
+			kw['msg']='Checking for library %s'%kw['lib']
+		if not'uselib_store'in kw:
+			kw['uselib_store']=kw['lib'].upper()
+	if'staticlib'in kw:
+		if not'msg'in kw:
+			kw['msg']='Checking for static library %s'%kw['staticlib']
+		if not'uselib_store'in kw:
+			kw['uselib_store']=kw['staticlib'].upper()
+	if'fragment'in kw:
+		kw['code']=kw['fragment']
+		if not'msg'in kw:
+			kw['msg']='Checking for custom code'
+		if not'errmsg'in kw:
+			kw['errmsg']='fail'
+	for(flagsname,flagstype)in[('cxxflags','compiler'),('cflags','compiler'),('linkflags','linker')]:
+		if flagsname in kw:
+			if not'msg'in kw:
+				kw['msg']='Checking for %s flags %s'%(flagstype,kw[flagsname])
+			if not'errmsg'in kw:
+				kw['errmsg']='fail'
+	if not'execute'in kw:
+		kw['execute']=False
+	if not'errmsg'in kw:
+		kw['errmsg']='not found'
+	if not'okmsg'in kw:
+		kw['okmsg']='ok'
+	if not'code'in kw:
+		kw['code']=simple_c_code
+	assert('msg'in kw)
+def post_check(self,*k,**kw):
+	def define_or_stuff():
+		nm=kw['define_name']
+		if not kw['execute']and not kw.get('define_ret',None):
+			self.define_cond(kw['define_name'],kw['success']is not None)
+		else:
+			self.define(kw['define_name'],kw['success'])
+	if'header_name'in kw:
+		define_or_stuff()
+	elif'function_name'in kw:
+		define_or_stuff()
+	elif'fragment'in kw:
+		if'define_name'in kw:
+			define_or_stuff()
+	if kw['execute']:
+		is_success=kw['success']is not None
+	else:
+		is_success=kw['success']==0
+	if is_success and'uselib_store'in kw:
+		import cc,cxx
+		for k in set(cc.g_cc_flag_vars).union(cxx.g_cxx_flag_vars):
+			lk=k.lower()
+			if k=='CPPPATH':lk='includes'
+			if k=='CXXDEFINES':lk='defines'
+			if k=='CCDEFINES':lk='defines'
+			if lk in kw:
+				self.env.append_value(k+'_'+kw['uselib_store'],kw[lk])
+def check(self,*k,**kw):
+	self.validate_c(kw)
+	self.check_message_1(kw['msg'])
+	ret=None
+	try:
+		ret=self.run_c_code(*k,**kw)
+	except Configure.ConfigurationError,e:
+		self.check_message_2(kw['errmsg'],'YELLOW')
+		if'mandatory'in kw:
+			if Logs.verbose>1:
+				raise
+			else:
+				self.fatal('the configuration failed (see config.log)')
+	else:
+		self.check_message_2(kw['okmsg'])
+	kw['success']=ret
+	self.post_check(*k,**kw)
+	return ret
+def run_c_code(self,*k,**kw):
+	if kw['compiler']=='cxx':
+		tp='cxx'
+		test_f_name='test.cpp'
+	else:
+		tp='cc'
+		test_f_name='test.c'
+	dir=os.path.join(self.blddir,'.wscript-trybuild')
+	try:
+		shutil.rmtree(dir)
+	except OSError:
+		pass
+	os.makedirs(dir)
+	bdir=os.path.join(dir,'testbuild')
+	if not os.path.exists(bdir):
+		os.makedirs(bdir)
+	env=kw['env']
+	dest=open(os.path.join(dir,test_f_name),'w')
+	dest.write(kw['code'])
+	dest.close()
+	back=os.path.abspath('.')
+	bld=Build.BuildContext()
+	bld.log=self.log
+	bld.all_envs.update(self.all_envs)
+	bld.all_envs['default']=env
+	bld.lst_variants=bld.all_envs.keys()
+	bld.load_dirs(dir,bdir)
+	os.chdir(dir)
+	bld.rescan(bld.srcnode)
+	o=bld.new_task_gen(tp,kw['type'])
+	o.source=test_f_name
+	o.target='testprog'
+	for k,v in kw.iteritems():
+		setattr(o,k,v)
+	self.log.write("==>\n%s\n<==\n"%kw['code'])
+	try:
+		bld.compile()
+	except:
+		ret=Utils.ex_stack()
+	else:
+		ret=0
+	os.chdir(back)
+	if ret:
+		raise Configure.ConfigurationError,str(ret)
+	if kw['execute']:
+		lastprog=o.link_task.outputs[0].abspath(env)
+	if kw['execute']:
+		data=Utils.cmd_output('"%s"'%lastprog).strip()
+		ret=data
+	return ret
+def check_cxx(self,*k,**kw):
+	kw['compiler']='cxx'
+	return self.check(*k,**kw)
+def check_cc(self,*k,**kw):
+	kw['compiler']='cc'
+	return self.check(*k,**kw)
+def define(self,define,value,quote=1):
+	assert define and isinstance(define,str)
+	tbl=self.env[DEFINES]or Utils.ordered_dict()
+	if isinstance(value,str):
+		if quote==1:
+			tbl[define]='"%s"'%str(value)
+		else:
+			tbl[define]=value
+	elif isinstance(value,int):
+		tbl[define]=value
+	else:
+		raise TypeError,'define %r -> %r must be a string or an int'%(define,value)
+	self.env[DEFINES]=tbl
+	self.env[define]=value
+def undefine(self,define):
+	assert define and isinstance(define,str)
+	tbl=self.env[DEFINES]or Utils.ordered_dict()
+	value=UNDEFINED
+	tbl[define]=value
+	self.env[DEFINES]=tbl
+	self.env[define]=value
+def define_cond(self,name,value):
+	if value:
+		self.define(name,1)
+	else:
+		self.undefine(name)
+def is_defined(self,key):
+	defines=self.env[DEFINES]
+	if not defines:
+		return False
+	try:
+		value=defines[key]
+	except KeyError:
+		return False
+	else:
+		return value!=UNDEFINED
+def get_define(self,define):
+	try:return self.env[DEFINES][define]
+	except KeyError:return None
+def have_define(self,name):
+	return"HAVE_%s"%Utils.quote_define_name(name)
+def write_config_header(self,configfile='',env=''):
+	if not configfile:configfile=WAF_CONFIG_H
+	lst=Utils.split_path(configfile)
+	base=lst[:-1]
+	if not env:env=self.env
+	base=[self.blddir,env.variant()]+base
+	dir=os.path.join(*base)
+	if not os.path.exists(dir):
+		os.makedirs(dir)
+	dir=os.path.join(dir,lst[-1])
+	self.env.append_value('waf_config_files',os.path.abspath(dir))
+	waf_guard='_%s_WAF'%Utils.quote_define_name(configfile)
+	dest=open(dir,'w')
+	dest.write('/* Configuration header created by Waf - do not edit */\n')
+	dest.write('#ifndef %s\n#define %s\n\n'%(waf_guard,waf_guard))
+	if not configfile in self.env['dep_files']:
+		self.env['dep_files']+=[configfile]
+	tbl=env[DEFINES]or Utils.ordered_dict()
+	for key in tbl.allkeys:
+		value=tbl[key]
+		if value is None:
+			dest.write('#define %s\n'%key)
+		elif value is UNDEFINED:
+			dest.write('/* #undef %s */\n'%key)
+		else:
+			dest.write('#define %s %s\n'%(key,value))
+	dest.write('\n#endif /* %s */\n'%waf_guard)
+	dest.close()
+def cc_check_features(self,kind='cc'):
+	v=self.env
+	test=Configure.check_data()
+	test.code='int main() {return 0;}\n'
+	test.env=v
+	test.execute=1
+	test.force_compiler=kind
+	ret=self.run_check(test)
+	self.check_message('compiler could create','programs',not(ret is False))
+	if not ret:self.fatal("no programs")
+	lib_obj=Configure.check_data()
+	lib_obj.code="int k = 3;\n"
+	lib_obj.env=v
+	lib_obj.build_type="shlib"
+	lib_obj.force_compiler=kind
+	ret=self.run_check(lib_obj)
+	self.check_message('compiler could create','shared libs',not(ret is False))
+	if not ret:self.fatal("no shared libs")
+	lib_obj=Configure.check_data()
+	lib_obj.code="int k = 3;\n"
+	lib_obj.env=v
+	lib_obj.build_type="staticlib"
+	lib_obj.force_compiler=kind
+	ret=self.run_check(lib_obj)
+	self.check_message('compiler could create','static libs',not(ret is False))
+	if not ret:self.fatal("no static libs")
+def cxx_check_features(self):
+	return cc_check_features(self,kind='cpp')
+
+conf(validate_cfg)
+conf(exec_cfg)
+conf(check_cfg)
+conf(validate_c)
+conf(post_check)
+conf(check)
+conf(run_c_code)
+conf(check_cxx)
+conf(check_cc)
+conf(define)
+conf(undefine)
+conf(define_cond)
+conf(is_defined)
+conf(get_define)
+conf(have_define)
+conf(write_config_header)
+conftest(cc_check_features)
+conftest(cxx_check_features)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cs.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cs.py
new file mode 100644
index 0000000..a728db4
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cs.py
@@ -0,0 +1,45 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import TaskGen,Utils,Task
+from Logs import error
+from TaskGen import before,after,taskgen,feature
+flag_vars=['FLAGS','ASSEMBLIES']
+def init_cs(self):
+	Utils.def_attrs(self,flags='',assemblies='',resources='',uselib='')
+def apply_uselib_cs(self):
+	if not self.uselib:
+		return
+	global flag_vars
+	for var in self.to_list(self.uselib):
+		for v in self.flag_vars:
+			val=self.env[v+'_'+var]
+			if val:self.env.append_value(v,val)
+def apply_cs(self):
+	assemblies_flags=[]
+	for i in self.to_list(self.assemblies)+self.env['ASSEMBLIES']:
+		assemblies_flags+='/r:'+i
+	self.env['_ASSEMBLIES']+=assemblies_flags
+	for i in self.to_list(self.resources):
+		self.env['_RESOURCES'].append('/resource:'+i)
+	self.env['_FLAGS']+=self.to_list(self.flags)+self.env['FLAGS']
+	curnode=self.path
+	nodes=[]
+	for i in self.to_list(self.source):
+		nodes.append(curnode.find_resource(i))
+	task=self.create_task('mcs')
+	task.inputs=nodes
+	task.set_outputs(self.path.find_or_declare(self.target))
+Task.simple_task_type('mcs','${MCS} ${SRC} /out:${TGT} ${_FLAGS} ${_ASSEMBLIES} ${_RESOURCES}',color='YELLOW')
+def detect(conf):
+	mcs=conf.find_program('mcs',var='MCS')
+	if not mcs:mcs=conf.find_program('gmcs',var='MCS')
+
+taskgen(init_cs)
+feature('cs')(init_cs)
+taskgen(apply_uselib_cs)
+feature('cs')(apply_uselib_cs)
+after('init_cs')(apply_uselib_cs)
+taskgen(apply_cs)
+feature('cs')(apply_cs)
+after('apply_uselib_cs')(apply_cs)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cxx.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cxx.py
new file mode 100644
index 0000000..83b2d32
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/cxx.py
@@ -0,0 +1,72 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import TaskGen,Task,Utils
+from Logs import debug
+import ccroot
+from TaskGen import feature,before,extension,after
+g_cxx_flag_vars=['CXXDEPS','FRAMEWORK','FRAMEWORKPATH','STATICLIB','LIB','LIBPATH','LINKFLAGS','RPATH','CXXFLAGS','CCFLAGS','CPPPATH','CPPFLAGS','CXXDEFINES']
+EXT_CXX=['.cpp','.cc','.cxx','.C','.c++']
+TaskGen.bind_feature('cxx',['apply_core'])
+g_cxx_type_vars=['CXXFLAGS','LINKFLAGS']
+class cxx_taskgen(ccroot.ccroot_abstract):
+	pass
+def init_cxx(self):
+	if not'cc'in self.features:
+		self.mappings['.c']=TaskGen.task_gen.mappings['.cxx']
+	self.p_flag_vars=set(self.p_flag_vars).union(g_cxx_flag_vars)
+	self.p_type_vars=set(self.p_type_vars).union(g_cxx_type_vars)
+	if not self.env['CXX_NAME']:
+		raise Utils.WafError("At least one compiler (g++, ..) must be selected")
+def apply_obj_vars_cxx(self):
+	env=self.env
+	app=env.append_unique
+	cxxpath_st=env['CPPPATH_ST']
+	for i in env['INC_PATHS']:
+		app('_CXXINCFLAGS',cxxpath_st%i.bldpath(env))
+		app('_CXXINCFLAGS',cxxpath_st%i.srcpath(env))
+	for i in env['CPPPATH']:
+		app('_CXXINCFLAGS',cxxpath_st%i)
+	app('_CXXINCFLAGS',cxxpath_st%'.')
+	app('_CXXINCFLAGS',cxxpath_st%self.env.variant())
+	tmpnode=self.path
+	app('_CXXINCFLAGS',cxxpath_st%tmpnode.bldpath(env))
+	app('_CXXINCFLAGS',cxxpath_st%tmpnode.srcpath(env))
+def apply_defines_cxx(self):
+	self.defines=getattr(self,'defines',[])
+	lst=self.to_list(self.defines)+self.to_list(self.env['CXXDEFINES'])
+	milst=[]
+	for defi in lst:
+		if not defi in milst:
+			milst.append(defi)
+	libs=self.to_list(self.uselib)
+	for l in libs:
+		val=self.env['CXXDEFINES_'+l]
+		if val:milst+=self.to_list(val)
+	self.env['DEFLINES']=["%s %s"%(x[0],Utils.trimquotes('='.join(x[1:])))for x in[y.split('=')for y in milst]]
+	y=self.env['CXXDEFINES_ST']
+	self.env['_CXXDEFFLAGS']=[y%x for x in milst]
+def cxx_hook(self,node):
+	task=self.create_task('cxx')
+	try:obj_ext=self.obj_ext
+	except AttributeError:obj_ext='_%d.o'%self.idx
+	task.defines=self.scanner_defines
+	task.inputs=[node]
+	task.outputs=[node.change_ext(obj_ext)]
+	self.compiled_tasks.append(task)
+cxx_str='${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXINCFLAGS} ${_CXXDEFFLAGS} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT}'
+link_str='${LINK_CXX} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT} ${LINKFLAGS} ${_LIBDIRFLAGS} ${_LIBFLAGS}'
+cls=Task.simple_task_type('cxx',cxx_str,color='GREEN',ext_out='.o',ext_in='.cxx')
+cls.scan=ccroot.scan
+cls.vars.append('CXXDEPS')
+cls=Task.simple_task_type('cxx_link',link_str,color='YELLOW',ext_in='.o')
+cls.maxjobs=1
+TaskGen.declare_order('apply_incpaths','apply_defines_cxx','apply_core','apply_lib_vars','apply_obj_vars_cxx','apply_obj_vars')
+
+feature('cxx')(init_cxx)
+before('apply_type_vars')(init_cxx)
+after('default_cc')(init_cxx)
+feature('cxx')(apply_obj_vars_cxx)
+feature('cxx')(apply_defines_cxx)
+extension(EXT_CXX)(cxx_hook)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/d.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/d.py
new file mode 100644
index 0000000..b0b720a
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/d.py
@@ -0,0 +1,346 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,re,optparse
+import ccroot
+import TaskGen,Utils,Task,Configure,Logs,Build
+from Logs import debug,error
+from TaskGen import taskgen,feature,after,before,extension
+EXT_D=['.d','.di','.D']
+D_METHS=['apply_core','apply_vnum','apply_objdeps']
+def filter_comments(filename):
+	f=open(filename,'r')
+	txt=f.read()
+	f.close()
+	buf=[]
+	i=0
+	max=len(txt)
+	while i<max:
+		c=txt[i]
+		if c=='"':
+			i+=1
+			c=''
+			while i<max:
+				p=c
+				c=txt[i]
+				i+=1
+				if i==max:return buf
+				if c=='"':
+					cnt=0
+					while i<cnt and i<max:
+						if txt[i-2-cnt]=='\\':cnt+=1
+						else:break
+					if(cnt%2)==0:break
+		elif c=="'":
+			i+=1
+			if i==max:return buf
+			c=txt[i]
+			if c=='\\':
+				i+=1
+				if i==max:return buf
+				c=txt[i]
+				if c=='x':
+					i+=2
+				elif c=='u':
+					i+=4
+			i+=1
+			if i==max:return buf
+			c=txt[i]
+			if c!='\'':error("uh-oh, invalid character")
+		elif c=='/':
+			if i==max:break
+			c=txt[i+1]
+			if c=='+':
+				i+=1
+				nesting=1
+				prev=0
+				while i<max:
+					c=txt[i]
+					if c=='+':
+						prev=1
+					elif c=='/':
+						if prev:
+							nesting-=1
+							if nesting==0:break
+						else:
+							if i<max:
+								i+=1
+								c=txt[i]
+								if c=='+':
+									nesting+=1
+							else:
+								return buf
+					else:
+						prev=0
+					i+=1
+			elif c=='*':
+				i+=1
+				while i<max:
+					c=txt[i]
+					if c=='*':
+						prev=1
+					elif c=='/':
+						if prev:break
+					else:
+						prev=0
+					i+=1
+			elif c=='/':
+				i+=1
+				c=txt[i]
+				while i<max and c!='\n':
+					i+=1
+					c=txt[i]
+		else:
+			buf.append(c)
+		i+=1
+	return buf
+class d_parser(object):
+	def __init__(self,env,incpaths):
+		self.allnames=[]
+		self.re_module=re.compile("module\s+([^;]+)")
+		self.re_import=re.compile("import\s+([^;]+)")
+		self.re_import_bindings=re.compile("([^:]+):(.*)")
+		self.re_import_alias=re.compile("[^=]+=(.+)")
+		self.env=env
+		self.nodes=[]
+		self.names=[]
+		self.incpaths=incpaths
+	def tryfind(self,filename):
+		found=0
+		for n in self.incpaths:
+			found=n.find_resource(filename.replace('.','/')+'.d')
+			if found:
+				self.nodes.append(found)
+				self.waiting.append(found)
+				break
+		if not found:
+			if not filename in self.names:
+				self.names.append(filename)
+	def get_strings(self,code):
+		self.module=''
+		lst=[]
+		mod_name=self.re_module.search(code)
+		if mod_name:
+			self.module=re.sub('\s+','',mod_name.group(1))
+		import_iterator=self.re_import.finditer(code)
+		if import_iterator:
+			for import_match in import_iterator:
+				import_match_str=re.sub('\s+','',import_match.group(1))
+				bindings_match=self.re_import_bindings.match(import_match_str)
+				if bindings_match:
+					import_match_str=bindings_match.group(1)
+				matches=import_match_str.split(',')
+				for match in matches:
+					alias_match=self.re_import_alias.match(match)
+					if alias_match:
+						match=alias_match.group(1)
+					lst.append(match)
+		return lst
+	def start(self,node):
+		self.waiting=[node]
+		while self.waiting:
+			nd=self.waiting.pop(0)
+			self.iter(nd)
+	def iter(self,node):
+		path=node.abspath(self.env)
+		code="".join(filter_comments(path))
+		names=self.get_strings(code)
+		for x in names:
+			if x in self.allnames:continue
+			self.allnames.append(x)
+			self.tryfind(x)
+def scan(self):
+	env=self.env
+	gruik=d_parser(env,env['INC_PATHS'])
+	gruik.start(self.inputs[0])
+	if Logs.verbose:
+		debug('deps: nodes found for %s: %s %s'%(str(self.inputs[0]),str(gruik.nodes),str(gruik.names)))
+	return(gruik.nodes,gruik.names)
+def get_target_name(self):
+	v=self.env
+	tp='program'
+	for x in self.features:
+		if x in['dshlib','dstaticlib']:
+			tp=x.lstrip('d')
+	return v['D_%s_PATTERN'%tp]%self.target
+d_params={'dflags':{'gdc':'','dmd':''},'importpaths':'','libs':'','libpaths':'','generate_headers':False,}
+def init_d(self):
+	for x in d_params:
+		setattr(self,x,getattr(self,x,d_params[x]))
+class d_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+		if len(k)>1:
+			self.features.append('d'+k[1])
+TaskGen.bind_feature('d',D_METHS)
+def init_d(self):
+	Utils.def_attrs(self,dflags={'gdc':'','dmd':''},importpaths='',libs='',libpaths='',uselib='',uselib_local='',generate_headers=False,compiled_tasks=[],add_objects=[],link_task=None)
+def apply_d_libs(self):
+	uselib=self.to_list(self.uselib)
+	seen=[]
+	local_libs=self.to_list(self.uselib_local)
+	libs=[]
+	libpaths=[]
+	env=self.env
+	while local_libs:
+		x=local_libs.pop()
+		if x in seen:
+			continue
+		else:
+			seen.append(x)
+		y=self.name_to_obj(x)
+		if not y:
+			raise Utils.WafError('object not found in uselib_local: obj %s uselib %s'%(self.name,x))
+		if y.uselib_local:
+			added=0
+			lst=y.to_list(y.uselib_local)
+			lst.reverse()
+			for u in lst:
+				if u in seen:continue
+				added=1
+				local_libs=[u]+local_libs
+			if added:continue
+		y.post()
+		seen.append(x)
+		if'dshlib'in y.features or'dstaticlib'in y.features:
+			libs.append(y.target)
+		tmp_path=y.path.bldpath(env)
+		if not tmp_path in libpaths:libpaths=[tmp_path]+libpaths
+		if y.link_task is not None:
+			self.link_task.set_run_after(y.link_task)
+			dep_nodes=getattr(self.link_task,'dep_nodes',[])
+			self.link_task.dep_nodes=dep_nodes+y.link_task.outputs
+		morelibs=y.to_list(y.uselib)
+		for v in morelibs:
+			if v in uselib:continue
+			uselib=[v]+uselib
+	self.uselib=uselib
+def apply_d_link(self):
+	link=getattr(self,'link',None)
+	if not link:
+		if'dstaticlib'in self.features:link='ar_link_static'
+		else:link='d_link'
+	linktask=self.create_task(link)
+	outputs=[t.outputs[0]for t in self.compiled_tasks]
+	linktask.set_inputs(outputs)
+	linktask.set_outputs(self.path.find_or_declare(get_target_name(self)))
+	self.link_task=linktask
+def apply_d_vars(self):
+	env=self.env
+	dpath_st=env['DPATH_ST']
+	lib_st=env['DLIB_ST']
+	libpath_st=env['DLIBPATH_ST']
+	dflags={'gdc':[],'dmd':[]}
+	importpaths=self.to_list(self.importpaths)
+	libpaths=[]
+	libs=[]
+	uselib=self.to_list(self.uselib)
+	for i in uselib:
+		if env['DFLAGS_'+i]:
+			for dflag in self.to_list(env['DFLAGS_'+i][env['COMPILER_D']]):
+				if not dflag in dflags[env['COMPILER_D']]:
+					dflags[env['COMPILER_D']]+=[dflag]
+	dflags[env['COMPILER_D']]=self.to_list(self.dflags[env['COMPILER_D']])+dflags[env['COMPILER_D']]
+	for dflag in dflags[env['COMPILER_D']]:
+		if not dflag in env['DFLAGS'][env['COMPILER_D']]:
+			env['DFLAGS'][env['COMPILER_D']]+=[dflag]
+	for x in self.features:
+		if not x in['dprogram','dstaticlib','dshlib']:
+			continue
+		x.lstrip('d')
+		d_shlib_dflags=env['D_'+x+'_DFLAGS']
+		if d_shlib_dflags:
+			for dflag in d_shlib_dflags:
+				if not dflag in env['DFLAGS'][env['COMPILER_D']]:
+					env['DFLAGS'][env['COMPILER_D']]+=[dflag]
+	env['_DFLAGS']=env['DFLAGS'][env['COMPILER_D']]
+	for i in uselib:
+		if env['DPATH_'+i]:
+			for entry in self.to_list(env['DPATH_'+i]):
+				if not entry in importpaths:
+					importpaths.append(entry)
+	for path in importpaths:
+		if os.path.isabs(path):
+			env.append_unique('_DIMPORTFLAGS',dpath_st%path)
+		else:
+			node=self.path.find_dir(path)
+			self.env.append_unique('INC_PATHS',node)
+			env.append_unique('_DIMPORTFLAGS',dpath_st%node.srcpath(env))
+			env.append_unique('_DIMPORTFLAGS',dpath_st%node.bldpath(env))
+	for i in uselib:
+		if env['LIBPATH_'+i]:
+			for entry in self.to_list(env['LIBPATH_'+i]):
+				if not entry in libpaths:
+					libpaths+=[entry]
+	libpaths=self.to_list(self.libpaths)+libpaths
+	for path in libpaths:
+		env.append_unique('_DLIBDIRFLAGS',libpath_st%path)
+	for i in uselib:
+		if env['LIB_'+i]:
+			for entry in self.to_list(env['LIB_'+i]):
+				if not entry in libs:
+					libs+=[entry]
+	libs=libs+self.to_list(self.libs)
+	for lib in libs:
+		env.append_unique('_DLIBFLAGS',lib_st%lib)
+	for i in uselib:
+		dlinkflags=env['DLINKFLAGS_'+i]
+		if dlinkflags:
+			for linkflag in dlinkflags:
+				env.append_unique('DLINKFLAGS',linkflag)
+def add_shlib_d_flags(self):
+	for linkflag in self.env['D_shlib_LINKFLAGS']:
+		self.env.append_unique('DLINKFLAGS',linkflag)
+def d_hook(self,node):
+	task=self.create_task(self.generate_headers and'd_with_header'or'd')
+	try:obj_ext=self.obj_ext
+	except AttributeError:obj_ext='_%d.o'%self.idx
+	task.inputs=[node]
+	task.outputs=[node.change_ext(obj_ext)]
+	self.compiled_tasks.append(task)
+	if self.generate_headers:
+		header_node=node.change_ext(self.env['DHEADER_ext'])
+		task.outputs+=[header_node]
+d_str='${D_COMPILER} ${_DFLAGS} ${_DIMPORTFLAGS} ${D_SRC_F}${SRC} ${D_TGT_F}${TGT}'
+d_with_header_str='${D_COMPILER} ${_DFLAGS} ${_DIMPORTFLAGS} \
+${D_HDR_F}${TGT[1].bldpath(env)} \
+${D_SRC_F}${SRC} \
+${D_TGT_F}${TGT[0].bldpath(env)}'
+link_str='${D_LINKER} ${DLNK_SRC_F}${SRC} ${DLNK_TGT_F}${TGT} ${DLINKFLAGS} ${_DLIBDIRFLAGS} ${_DLIBFLAGS}'
+cls=Task.simple_task_type('d',d_str,'GREEN')
+cls.scan=scan
+Task.simple_task_type('d_with_header',d_with_header_str,'GREEN')
+Task.simple_task_type('d_link',link_str,color='YELLOW')
+def generate_header(self,filename,install_path):
+	if not hasattr(self,'header_lst'):self.header_lst=[]
+	self.meths.append('process_header')
+	self.header_lst.append([filename,install_path])
+def process_header(self):
+	env=self.env
+	for i in getattr(self,'header_lst',[]):
+		node=self.path.find_resource(i[0])
+		if not node:
+			raise Utils.WafError('file not found on d obj '+i[0])
+		task=self.create_task('d_header')
+		task.set_inputs(node)
+		task.set_outputs(node.change_ext('.di'))
+d_header_str='${D_COMPILER} ${D_HEADER} ${SRC}'
+Task.simple_task_type('d_header',d_header_str,color='BLUE')
+
+feature('d')(init_d)
+before('apply_type_vars')(init_d)
+feature('d')(init_d)
+before('apply_d_libs')(init_d)
+feature('d')(apply_d_libs)
+after('apply_d_link')(apply_d_libs)
+before('apply_vnum')(apply_d_libs)
+feature('dprogram','dshlib','dstaticlib')(apply_d_link)
+after('apply_core')(apply_d_link)
+feature('d')(apply_d_vars)
+after('apply_core')(apply_d_vars)
+feature('dshlib')(add_shlib_d_flags)
+after('apply_d_vars')(add_shlib_d_flags)
+extension(EXT_D)(d_hook)
+taskgen(generate_header)
+taskgen(process_header)
+before('apply_core')(process_header)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/dbus.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/dbus.py
new file mode 100644
index 0000000..cabd122
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/dbus.py
@@ -0,0 +1,28 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import Task,Utils
+from TaskGen import taskgen,before,after,feature
+def add_dbus_file(self,filename,prefix,mode):
+	if not hasattr(self,'dbus_lst'):
+		self.dbus_lst=[]
+	self.meths.append('process_dbus')
+	self.dbus_lst.append([filename,prefix,mode])
+def process_dbus(self):
+	for filename,prefix,mode in getattr(self,'dbus_lst',[]):
+		env=self.env.copy()
+		node=self.path.find_resource(filename)
+		if not node:
+			raise Utils.WafError('file not found '+filename)
+		env['DBUS_BINDING_TOOL_PREFIX']=prefix
+		env['DBUS_BINDING_TOOL_MODE']=mode
+		task=self.create_task('dbus_binding_tool',env)
+		task.set_inputs(node)
+		task.set_outputs(node.change_ext('.h'))
+Task.simple_task_type('dbus_binding_tool','${DBUS_BINDING_TOOL} --prefix=${DBUS_BINDING_TOOL_PREFIX} --mode=${DBUS_BINDING_TOOL_MODE} --output=${TGT} ${SRC}',color='BLUE',before='cc')
+def detect(conf):
+	dbus_binding_tool=conf.find_program('dbus-binding-tool',var='DBUS_BINDING_TOOL')
+
+taskgen(add_dbus_file)
+taskgen(process_dbus)
+before('apply_core')(process_dbus)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/dmd.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/dmd.py
new file mode 100644
index 0000000..fb5ea68
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/dmd.py
@@ -0,0 +1,49 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import sys
+import ar
+def find_dmd(conf):
+	v=conf.env
+	d_compiler=None
+	if v['D_COMPILER']:
+		d_compiler=v['D_COMPILER']
+	if not d_compiler:d_compiler=conf.find_program('dmd',var='D_COMPILER')
+	if not d_compiler:return 0
+	v['D_COMPILER']=d_compiler
+def common_flags(conf):
+	v=conf.env
+	v['DFLAGS']={'gdc':[],'dmd':['-version=Posix']}
+	v['D_SRC_F']=''
+	v['D_TGT_F']='-c -of'
+	v['DPATH_ST']='-I%s'
+	v['D_LINKER']=v['D_COMPILER']
+	v['DLNK_SRC_F']=''
+	v['DLNK_TGT_F']='-of'
+	v['DLIB_ST']='-L-l%s'
+	v['DLIBPATH_ST']='-L-L%s'
+	v['DFLAGS_OPTIMIZED']=['-O']
+	v['DFLAGS_DEBUG']=['-g','-debug']
+	v['DFLAGS_ULTRADEBUG']=['-g','-debug']
+	v['DLINKFLAGS']=['-quiet']
+	v['D_shlib_DFLAGS']=['-fPIC']
+	v['D_shlib_LINKFLAGS']=['-L-shared']
+	v['DHEADER_ext']='.di'
+	v['D_HDR_F']='-H -Hf'
+	if sys.platform=="win32":
+		v['D_program_PATTERN']='%s.exe'
+		v['D_shlib_PATTERN']='lib%s.dll'
+		v['D_staticlib_PATTERN']='lib%s.a'
+	else:
+		v['D_program_PATTERN']='%s'
+		v['D_shlib_PATTERN']='lib%s.so'
+		v['D_staticlib_PATTERN']='lib%s.a'
+def detect(conf):
+	v=conf.env
+	find_dmd(conf)
+	ar.find_ar(conf)
+	conf.check_tool('d')
+	common_flags(conf)
+def set_options(opt):
+	pass
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/flex.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/flex.py
new file mode 100644
index 0000000..98bc4dd
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/flex.py
@@ -0,0 +1,14 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import TaskGen
+def decide_ext(self,node):
+	if'cxx'in self.features:return'.lex.cc'
+	else:return'.lex.c'
+TaskGen.declare_chain(name='flex',action='${FLEX} -o${TGT} ${FLEXFLAGS} ${SRC}',ext_in='.l',decider=decide_ext,before='cc cxx',)
+def detect(conf):
+	flex=conf.find_program('flex',var='FLEX')
+	if not flex:conf.fatal("flex was not found")
+	v=conf.env
+	v['FLEXFLAGS']=''
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/g++.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/g++.py
new file mode 100644
index 0000000..5eaf11d
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/g++.py
@@ -0,0 +1,118 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,optparse,sys,re
+import Configure,Options,Utils
+import ccroot,ar
+from Configure import conftest
+def find_gxx(conf):
+	v=conf.env
+	cxx=None
+	if v['CXX']:cxx=v['CXX']
+	elif'CXX'in os.environ:cxx=os.environ['CXX']
+	if not cxx:cxx=conf.find_program('g++',var='CXX')
+	if not cxx:cxx=conf.find_program('c++',var='CXX')
+	if not cxx:conf.fatal('g++ was not found')
+	try:
+		if Utils.cmd_output('%s --version'%cxx).find('g++')<0:
+			conf.fatal('g++ was not found, see the result of g++ --version')
+	except ValueError:
+		conf.fatal('g++ --version could not be executed')
+	v['CXX']=cxx
+	v['CXX_NAME']='gcc'
+	ccroot.get_cc_version(conf,cxx,'CXX_VERSION')
+def gxx_common_flags(conf):
+	v=conf.env
+	v['CXX_SRC_F']=''
+	v['CXX_TGT_F']='-c -o '
+	v['CPPPATH_ST']='-I%s'
+	if not v['LINK_CXX']:v['LINK_CXX']=v['CXX']
+	v['CXXLNK_SRC_F']=''
+	v['CXXLNK_TGT_F']='-o '
+	v['LIB_ST']='-l%s'
+	v['LIBPATH_ST']='-L%s'
+	v['STATICLIB_ST']='-l%s'
+	v['STATICLIBPATH_ST']='-L%s'
+	v['RPATH_ST']='-Wl,-rpath %s'
+	v['CXXDEFINES_ST']='-D%s'
+	v['SHLIB_MARKER']='-Wl,-Bdynamic'
+	v['STATICLIB_MARKER']='-Wl,-Bstatic'
+	v['FULLSTATIC_MARKER']='-static'
+	v['program_PATTERN']='%s'
+	v['shlib_CXXFLAGS']=['-fPIC','-DPIC']
+	v['shlib_LINKFLAGS']=['-shared']
+	v['shlib_PATTERN']='lib%s.so'
+	v['staticlib_LINKFLAGS']=['-Wl,-Bstatic']
+	v['staticlib_PATTERN']='lib%s.a'
+	v['MACBUNDLE_LINKFLAGS']=['-bundle','-undefined dynamic_lookup']
+	v['MACBUNDLE_CCFLAGS']=['-fPIC']
+	v['MACBUNDLE_PATTERN']='%s.bundle'
+def gxx_modifier_win32(conf):
+	if sys.platform!='win32':return
+	v=conf.env
+	v['program_PATTERN']='%s.exe'
+	v['shlib_PATTERN']='lib%s.dll'
+	v['shlib_CXXFLAGS']=['']
+	v['staticlib_LINKFLAGS']=['']
+def gxx_modifier_cygwin(conf):
+	if sys.platform!='cygwin':return
+	v=conf.env
+	v['program_PATTERN']='%s.exe'
+	v['shlib_PATTERN']='lib%s.dll'
+	v['shlib_CXXFLAGS']=['']
+	v['staticlib_LINKFLAGS']=['']
+def gxx_modifier_darwin(conf):
+	if sys.platform!='darwin':return
+	v=conf.env
+	v['shlib_CXXFLAGS']=['-fPIC','-compatibility_version 1','-current_version 1']
+	v['shlib_LINKFLAGS']=['-dynamiclib']
+	v['shlib_PATTERN']='lib%s.dylib'
+	v['staticlib_LINKFLAGS']=['']
+	v['SHLIB_MARKER']=''
+	v['STATICLIB_MARKER']=''
+def gxx_modifier_aix5(conf):
+	if sys.platform!='aix5':return
+	v=conf.env
+	v['program_LINKFLAGS']=['-Wl,-brtl']
+	v['shlib_LINKFLAGS']=['-shared','-Wl,-brtl,-bexpfull']
+	v['SHLIB_MARKER']=''
+def gxx_modifier_debug(conf):
+	v=conf.env
+	f='cxx'
+	if conf.check_flags('-O2 -DNDEBUG',kind=f):
+		v['CXXFLAGS_OPTIMIZED']=['-O2','-DNDEBUG']
+		v['CXXFLAGS_RELEASE']=['-O2','-DNDEBUG']
+	if conf.check_flags('-g -DDEBUG',kind=f):
+		v['CXXFLAGS_DEBUG']=['-g','-DDEBUG']
+		v['LINKFLAGS_DEBUG']=['-g']
+	if conf.check_flags('-g3 -O0 -DDEBUG',kind=f):
+		v['CXXFLAGS_ULTRADEBUG']=['-g3','-O0','-DDEBUG']
+		v['LINKFLAGS_ULTRADEBUG']=['-g']
+	if conf.check_flags('-Wall',kind=f):
+		for x in'OPTIMIZED RELEASE DEBUG ULTRADEBUG'.split():v.append_unique('CXXFLAGS_'+x,'-Wall')
+	try:
+		debug_level=Options.options.debug_level.upper()
+	except AttributeError:
+		debug_level=ccroot.DEBUG_LEVELS.CUSTOM
+	v.append_value('CXXFLAGS',v['CXXFLAGS_'+debug_level])
+	v.append_value('LINKFLAGS',v['LINKFLAGS_'+debug_level])
+detect='''
+find_gxx
+find_cpp
+find_ar
+gxx_common_flags
+gxx_modifier_win32
+gxx_modifier_cygwin
+gxx_modifier_darwin
+gxx_modifier_aix5
+cxx_load_tools
+cxx_add_flags
+'''
+
+conftest(find_gxx)
+conftest(gxx_common_flags)
+conftest(gxx_modifier_win32)
+conftest(gxx_modifier_cygwin)
+conftest(gxx_modifier_darwin)
+conftest(gxx_modifier_aix5)
+conftest(gxx_modifier_debug)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gas.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gas.py
new file mode 100644
index 0000000..efd5676
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gas.py
@@ -0,0 +1,35 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys
+import Task
+from TaskGen import extension,taskgen,after,before
+EXT_ASM=['.s','.S','.asm','.ASM','.spp','.SPP']
+as_str='${AS} ${ASFLAGS} ${_ASINCFLAGS} ${SRC} -o ${TGT}'
+Task.simple_task_type('asm',as_str,'PINK',ext_out='.o')
+def asm_hook(self,node):
+	task=self.create_task('asm')
+	try:obj_ext=self.obj_ext
+	except AttributeError:obj_ext='_%d.o'%self.idx
+	task.inputs=[node]
+	task.outputs=[node.change_ext(obj_ext)]
+	self.compiled_tasks.append(task)
+	self.meths.append('asm_incflags')
+def asm_incflags(self):
+	if self.env['ASINCFLAGS']:self.env['_ASINCFLAGS']=self.env['ASINCFLAGS']
+	if'cxx'in self.features:self.env['_ASINCFLAGS']=self.env['_CXXINCFLAGS']
+	else:self.env['_ASINCFLAGS']=self.env['_CCINCFLAGS']
+def detect(conf):
+	comp=os.environ.get('AS','')
+	if not comp:comp=conf.find_program('as',var='AS')
+	if not comp:comp=conf.find_program('gas',var='AS')
+	if not comp:comp=conf.env['CC']
+	if not comp:return
+	v=conf.env
+	v['ASFLAGS']=''
+
+extension(EXT_ASM)(asm_hook)
+taskgen(asm_incflags)
+after('apply_obj_vars_cc')(asm_incflags)
+after('apply_obj_vars_cxx')(asm_incflags)
+before('apply_link')(asm_incflags)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gcc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gcc.py
new file mode 100644
index 0000000..a9df2ec
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gcc.py
@@ -0,0 +1,116 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys
+import Configure,Options,Utils
+import ccroot,ar
+from Configure import conftest
+def find_gcc(conf):
+	v=conf.env
+	cc=None
+	if v['CC']:cc=v['CC']
+	elif'CC'in os.environ:cc=os.environ['CC']
+	if not cc:cc=conf.find_program('gcc',var='CC')
+	if not cc:cc=conf.find_program('cc',var='CC')
+	if not cc:conf.fatal('gcc was not found')
+	try:
+		if Utils.cmd_output('%s --version'%cc).find('gcc')<0:
+			conf.fatal('gcc was not found, see the result of gcc --version')
+	except ValueError:
+		conf.fatal('gcc --version could not be executed')
+	v['CC']=cc
+	v['CC_NAME']='gcc'
+	ccroot.get_cc_version(conf,cc,'CC_VERSION')
+def gcc_common_flags(conf):
+	v=conf.env
+	v['CC_SRC_F']=''
+	v['CC_TGT_F']='-c -o '
+	v['CPPPATH_ST']='-I%s'
+	if not v['LINK_CC']:v['LINK_CC']=v['CC']
+	v['CCLNK_SRC_F']=''
+	v['CCLNK_TGT_F']='-o '
+	v['LIB_ST']='-l%s'
+	v['LIBPATH_ST']='-L%s'
+	v['STATICLIB_ST']='-l%s'
+	v['STATICLIBPATH_ST']='-L%s'
+	v['RPATH_ST']='-Wl,-rpath %s'
+	v['CCDEFINES_ST']='-D%s'
+	v['SHLIB_MARKER']='-Wl,-Bdynamic'
+	v['STATICLIB_MARKER']='-Wl,-Bstatic'
+	v['program_PATTERN']='%s'
+	v['shlib_CCFLAGS']=['-fPIC','-DPIC']
+	v['shlib_LINKFLAGS']=['-shared']
+	v['shlib_PATTERN']='lib%s.so'
+	v['staticlib_LINKFLAGS']=['-Wl,-Bstatic']
+	v['staticlib_PATTERN']='lib%s.a'
+	v['MACBUNDLE_LINKFLAGS']=['-bundle','-undefined dynamic_lookup']
+	v['MACBUNDLE_CCFLAGS']=['-fPIC']
+	v['MACBUNDLE_PATTERN']='%s.bundle'
+def gcc_modifier_win32(conf):
+	v=conf.env
+	if sys.platform!='win32':return
+	v['program_PATTERN']='%s.exe'
+	v['shlib_PATTERN']='lib%s.dll'
+	v['shlib_CCFLAGS']=[]
+	v['staticlib_LINKFLAGS']=[]
+def gcc_modifier_cygwin(conf):
+	v=conf.env
+	if sys.platform!='cygwin':return
+	v['program_PATTERN']='%s.exe'
+	v['shlib_PATTERN']='lib%s.dll'
+	v['shlib_CCFLAGS']=[]
+	v['staticlib_LINKFLAGS']=[]
+def gcc_modifier_darwin(conf):
+	v=conf.env
+	if sys.platform!='darwin':return
+	v['shlib_CCFLAGS']=['-fPIC','-compatibility_version 1','-current_version 1']
+	v['shlib_LINKFLAGS']=['-dynamiclib']
+	v['shlib_PATTERN']='lib%s.dylib'
+	v['staticlib_LINKFLAGS']=[]
+	v['SHLIB_MARKER']=''
+	v['STATICLIB_MARKER']=''
+def gcc_modifier_aix5(conf):
+	v=conf.env
+	if sys.platform!='aix5':return
+	v['program_LINKFLAGS']=['-Wl,-brtl']
+	v['shlib_LINKFLAGS']=['-shared','-Wl,-brtl,-bexpfull']
+	v['SHLIB_MARKER']=''
+def gcc_modifier_debug(conf):
+	v=conf.env
+	if conf.check_flags('-O2'):
+		v['CCFLAGS_OPTIMIZED']=['-O2']
+		v['CCFLAGS_RELEASE']=['-O2']
+	if conf.check_flags('-g -DDEBUG'):
+		v['CCFLAGS_DEBUG']=['-g','-DDEBUG']
+		v['LINKFLAGS_DEBUG']=['-g']
+	if conf.check_flags('-g3 -O0 -DDEBUG'):
+		v['CCFLAGS_ULTRADEBUG']=['-g3','-O0','-DDEBUG']
+		v['LINKFLAGS_ULTRADEBUG']=['-g']
+	if conf.check_flags('-Wall'):
+		for x in'OPTIMIZED RELEASE DEBUG ULTRADEBUG'.split():v.append_unique('CCFLAGS_'+x,'-Wall')
+	try:
+		debug_level=Options.options.debug_level.upper()
+	except AttributeError:
+		debug_level=ccroot.DEBUG_LEVELS.CUSTOM
+	v.append_value('CCFLAGS',v['CCFLAGS_'+debug_level])
+	v.append_value('LINKFLAGS',v['LINKFLAGS_'+debug_level])
+detect='''
+find_gcc
+find_cpp
+find_ar
+gcc_common_flags
+gcc_modifier_win32
+gcc_modifier_cygwin
+gcc_modifier_darwin
+gcc_modifier_aix5
+cc_load_tools
+cc_add_flags
+'''
+
+conftest(find_gcc)
+conftest(gcc_common_flags)
+conftest(gcc_modifier_win32)
+conftest(gcc_modifier_cygwin)
+conftest(gcc_modifier_darwin)
+conftest(gcc_modifier_aix5)
+conftest(gcc_modifier_debug)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gdc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gdc.py
new file mode 100644
index 0000000..451efc3
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gdc.py
@@ -0,0 +1,49 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import sys
+import ar
+def find_gdc(conf):
+	v=conf.env
+	d_compiler=None
+	if v['D_COMPILER']:
+		d_compiler=v['D_COMPILER']
+	if not d_compiler:d_compiler=conf.find_program('gdc',var='D_COMPILER')
+	if not d_compiler:return 0
+	v['D_COMPILER']=d_compiler
+def common_flags(conf):
+	v=conf.env
+	v['DFLAGS']={'gdc':[],'dmd':[]}
+	v['D_SRC_F']=''
+	v['D_TGT_F']='-c -o '
+	v['DPATH_ST']='-I%s'
+	v['D_LINKER']=v['D_COMPILER']
+	v['DLNK_SRC_F']=''
+	v['DLNK_TGT_F']='-o '
+	v['DLIB_ST']='-l%s'
+	v['DLIBPATH_ST']='-L%s'
+	v['DLINKFLAGS']=[]
+	v['DFLAGS_OPTIMIZED']=['-O3']
+	v['DFLAGS_DEBUG']=['-O0']
+	v['DFLAGS_ULTRADEBUG']=['-O0']
+	v['D_shlib_DFLAGS']=[]
+	v['D_shlib_LINKFLAGS']=['-shared']
+	v['DHEADER_ext']='.di'
+	v['D_HDR_F']='-fintfc -fintfc-file='
+	if sys.platform=="win32":
+		v['D_program_PATTERN']='%s.exe'
+		v['D_shlib_PATTERN']='lib%s.dll'
+		v['D_staticlib_PATTERN']='lib%s.a'
+	else:
+		v['D_program_PATTERN']='%s'
+		v['D_shlib_PATTERN']='lib%s.so'
+		v['D_staticlib_PATTERN']='lib%s.a'
+def detect(conf):
+	v=conf.env
+	find_gdc(conf)
+	ar.find_ar(conf)
+	conf.check_tool('d')
+	common_flags(conf)
+def set_options(opt):
+	pass
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/glib2.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/glib2.py
new file mode 100644
index 0000000..a788a10
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/glib2.py
@@ -0,0 +1,81 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import Task,Utils
+from TaskGen import taskgen,before,after,feature
+def add_marshal_file(self,filename,prefix):
+	if not hasattr(self,'marshal_list'):
+		self.marshal_list=[]
+	self.meths.append('process_marshal')
+	self.marshal_list.append((filename,prefix))
+def process_marshal(self):
+	for filename,prefix in getattr(self,'marshal_list',[]):
+		node=self.path.find_resource(filename)
+		if not node:
+			raise Utils.WafError('file not found '+filename)
+		header_env=self.env.copy()
+		header_env['GLIB_GENMARSHAL_PREFIX']=prefix
+		header_env['GLIB_GENMARSHAL_MODE']='--header'
+		task=self.create_task('glib_genmarshal',header_env)
+		task.set_inputs(node)
+		task.set_outputs(node.change_ext('.h'))
+		body_env=self.env.copy()
+		body_env['GLIB_GENMARSHAL_PREFIX']=prefix
+		body_env['GLIB_GENMARSHAL_MODE']='--body'
+		task=self.create_task('glib_genmarshal',body_env)
+		task.set_inputs(node)
+		task.set_outputs(node.change_ext('.c'))
+		outnode=node.change_ext('.c')
+		self.allnodes.append(outnode)
+def add_enums_from_template(self,source='',target='',template='',comments=''):
+	if not hasattr(self,'enums_list'):
+		self.enums_list=[]
+	self.meths.append('process_enums')
+	self.enums_list.append({'source':source,'target':target,'template':template,'file-head':'','file-prod':'','file-tail':'','enum-prod':'','value-head':'','value-prod':'','value-tail':'','comments':comments})
+def add_enums(self,source='',target='',file_head='',file_prod='',file_tail='',enum_prod='',value_head='',value_prod='',value_tail='',comments=''):
+	if not hasattr(self,'enums_list'):
+		self.enums_list=[]
+	self.meths.append('process_enums')
+	self.enums_list.append({'source':source,'template':'','target':target,'file-head':file_head,'file-prod':file_prod,'file-tail':file_tail,'enum-prod':enum_prod,'value-head':value_head,'value-prod':value_prod,'value-tail':value_tail,'comments':comments})
+def process_enums(self):
+	for enum in getattr(self,'enums_list',[]):
+		env=self.env.copy()
+		task=self.create_task('glib_mkenums',env)
+		inputs=[]
+		source_list=self.to_list(enum['source'])
+		if not source_list:
+			raise Utils.WafError('missing source '+str(enum))
+		source_list=[self.path.find_resource(k)for k in source_list]
+		inputs+=source_list
+		env['GLIB_MKENUMS_SOURCE']=[k.abspath(env)for k in source_list]
+		if not enum['target']:
+			raise Utils.WafError('missing target '+str(enum))
+		tgt_node=self.path.find_or_declare(enum['target'])
+		if tgt_node.name.endswith('.c'):
+			self.allnodes.append(tgt_node)
+		env['GLIB_MKENUMS_TARGET']=tgt_node.abspath(env)
+		options=[]
+		if enum['template']:
+			template_node=self.path.find_resource(enum['template'])
+			options.append('--template %s'%(template_node.abspath(env)))
+			inputs.append(template_node)
+		params={'file-head':'--fhead','file-prod':'--fprod','file-tail':'--ftail','enum-prod':'--eprod','value-head':'--vhead','value-prod':'--vprod','value-tail':'--vtail','comments':'--comments'}
+		for param,option in params.iteritems():
+			if enum[param]:
+				options.append('%s %r'%(option,enum[param]))
+		env['GLIB_MKENUMS_OPTIONS']=' '.join(options)
+		task.set_inputs(inputs)
+		task.set_outputs(tgt_node)
+Task.simple_task_type('glib_genmarshal','${GLIB_GENMARSHAL} ${SRC} --prefix=${GLIB_GENMARSHAL_PREFIX} ${GLIB_GENMARSHAL_MODE} > ${TGT}',color='BLUE',before='cc')
+Task.simple_task_type('glib_mkenums','${GLIB_MKENUMS} ${GLIB_MKENUMS_OPTIONS} ${GLIB_MKENUMS_SOURCE} > ${GLIB_MKENUMS_TARGET}',color='PINK',before='cc')
+def detect(conf):
+	glib_genmarshal=conf.find_program('glib-genmarshal',var='GLIB_GENMARSHAL')
+	mk_enums_tool=conf.find_program('glib-mkenums',var='GLIB_MKENUMS')
+
+taskgen(add_marshal_file)
+taskgen(process_marshal)
+before('apply_core')(process_marshal)
+taskgen(add_enums_from_template)
+taskgen(add_enums)
+taskgen(process_enums)
+before('apply_core')(process_enums)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gnome.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gnome.py
new file mode 100644
index 0000000..1356a54
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gnome.py
@@ -0,0 +1,200 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,re
+import TaskGen,Utils,Runner,Task,Build,Options,Logs
+import cc
+from Logs import error
+from TaskGen import taskgen,before,after,feature
+n1_regexp=re.compile('<refentrytitle>(.*)</refentrytitle>',re.M)
+n2_regexp=re.compile('<manvolnum>(.*)</manvolnum>',re.M)
+def postinstall_schemas(prog_name):
+	if Options.commands['install']:
+		dir=Build.bld.get_install_path('${PREFIX}/etc/gconf/schemas/%s.schemas'%prog_name)
+		if not Options.options.destdir:
+			Utils.pprint('YELLOW','Installing GConf schema')
+			command='gconftool-2 --install-schema-file=%s 1> /dev/null'%dir
+			ret=Utils.exec_command(command)
+		else:
+			Utils.pprint('YELLOW','GConf schema not installed. After install, run this:')
+			Utils.pprint('YELLOW','gconftool-2 --install-schema-file=%s'%dir)
+def postinstall_icons():
+	dir=Build.bld.get_install_path('${DATADIR}/icons/hicolor')
+	if Options.commands['install']:
+		if not Options.options.destdir:
+			Utils.pprint('YELLOW',"Updating Gtk icon cache.")
+			command='gtk-update-icon-cache -q -f -t %s'%dir
+			ret=Utils.exec_command(command)
+		else:
+			Utils.pprint('YELLOW','Icon cache not updated. After install, run this:')
+			Utils.pprint('YELLOW','gtk-update-icon-cache -q -f -t %s'%dir)
+def postinstall_scrollkeeper(prog_name):
+	if Options.commands['install']:
+		if os.path.iswriteable('/var/log/scrollkeeper.log'):
+			dir1=Build.bld.get_install_path('${PREFIX}/var/scrollkeeper')
+			dir2=Build.bld.get_install_path('${DATADIR}/omf/%s'%prog_name)
+			command='scrollkeeper-update -q -p %s -o %s'%(dir1,dir2)
+			ret=Utils.exec_command(command)
+def postinstall(prog_name='myapp',schemas=1,icons=1,scrollkeeper=1):
+	if schemas:postinstall_schemas(prog_name)
+	if icons:postinstall_icons()
+	if scrollkeeper:postinstall_scrollkeeper(prog_name)
+class gnome_doc_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def init_gnome_doc(self):
+	self.default_install_path='${PREFIX}/share'
+def apply_gnome_doc(self):
+	self.env['APPNAME']=self.doc_module
+	lst=self.to_list(self.doc_linguas)
+	for x in lst:
+		tsk=self.create_task('xml2po')
+		node=self.path.find_resource(x+'/'+x+'.po')
+		src=self.path.find_resource('C/%s.xml'%self.doc_module)
+		out=self.path.find_or_declare('%s/%s.xml'%(x,self.doc_module))
+		tsk.set_inputs([node,src])
+		tsk.set_outputs(out)
+		tsk2=self.create_task('xsltproc2po')
+		out2=self.path.find_or_declare('%s/%s-%s.omf'%(x,self.doc_module,x))
+		tsk2.set_outputs(out2)
+		node=self.path.find_resource(self.doc_module+".omf.in")
+		tsk2.inputs=[node,out]
+		tsk2.run_after.append(tsk)
+		if Options.is_install:
+			path=self.install_path+'gnome/help/%s/%s'%(self.doc_module,x)
+			Build.bld.install_files(self.install_path+'omf',out2.abspath(self.env))
+			for y in self.to_list(self.doc_figures):
+				try:
+					os.stat(self.path.abspath()+'/'+x+'/'+y)
+					Common.install_as(path+'/'+y,self.path.abspath()+'/'+x+'/'+y)
+				except:
+					Common.install_as(path+'/'+y,self.path.abspath()+'/C/'+y)
+			Common.install_as(path+'/%s.xml'%self.doc_module,out.abspath(self.env))
+class xml_to_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def init_xml_to(self):
+	Utils.def_attrs(self,source='xmlfile',xslt='xlsltfile',target='hey',default_install_path='${PREFIX}',task_created=None)
+def apply_xml_to(self):
+	tree=Build.bld
+	xmlfile=self.path.find_resource(self.source)
+	xsltfile=self.path.find_resource(self.xslt)
+	tsk=self.create_task('xmlto')
+	tsk.set_inputs([xmlfile,xsltfile])
+	tsk.set_outputs(xmlfile.change_ext('html'))
+	tsk.install_path=self.install_path
+def sgml_scan(self):
+	node=self.inputs[0]
+	env=self.env
+	variant=node.variant(env)
+	fi=open(node.abspath(env),'r')
+	content=fi.read()
+	fi.close()
+	name=n1_regexp.findall(content)[0]
+	num=n2_regexp.findall(content)[0]
+	doc_name=name+'.'+num
+	return([],[doc_name])
+def sig_implicit_deps(self):
+	def sgml_outputs():
+		dps=Build.bld.raw_deps[self.unique_id()]
+		name=dps[0]
+		self.set_outputs(self.task_generator.path.find_or_declare(name))
+	tree=Build.bld
+	key=self.unique_id()
+	prev_sigs=tree.task_sigs.get(key,())
+	if prev_sigs and prev_sigs[2]==self.compute_sig_implicit_deps():
+		sgml_outputs()
+		return prev_sigs[2]
+	(nodes,names)=self.scan()
+	if Logs.verbose and Logs.zones:
+		debug('deps: scanner for %s returned %s %s'%(str(self),str(nodes),str(names)))
+	tree=Build.bld
+	tree.node_deps[self.unique_id()]=nodes
+	tree.raw_deps[self.unique_id()]=names
+	sgml_outputs()
+	sig=self.compute_sig_implicit_deps()
+	return sig
+class gnome_sgml2man_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def apply_gnome_sgml2man(self):
+	assert(getattr(self,'appname',None))
+	def install_result(task):
+		out=task.outputs[0]
+		name=out.name
+		ext=name[-1]
+		env=task.env
+		Build.bld.install_files('DATADIR','man/man%s/'%ext,out.abspath(env),env)
+	tree=Build.bld
+	tree.rescan(self.path)
+	for name in Build.bld.cache_dir_contents[self.path.id]:
+		base,ext=os.path.splitext(name)
+		if ext!='.sgml':continue
+		task=self.create_task('sgml2man')
+		task.set_inputs(self.path.find_resource(name))
+		task.task_generator=self
+		if Options.is_install:task.install=install_result
+		task.scan()
+cls=Task.simple_task_type('sgml2man','${SGML2MAN} -o ${TGT[0].bld_dir(env)} ${SRC}  > /dev/null',color='BLUE')
+cls.scan=sgml_scan
+cls.sig_implicit_deps=sig_implicit_deps
+old_runnable_status=Task.Task.runnable_status
+def runnable_status(self):
+	old_runnable_status(self)
+	return old_runnable_status(self)
+cls.runnable_status=runnable_status
+cls.quiet=1
+Task.simple_task_type('xmlto','${XMLTO} html -m ${SRC[1].abspath(env)} ${SRC[0].abspath(env)}')
+Task.simple_task_type('xml2po','${XML2PO} ${XML2POFLAGS} ${SRC} > ${TGT}',color='BLUE')
+xslt_magic="""${XSLTPROC2PO} -o ${TGT[0].abspath(env)} \
+--stringparam db2omf.basename ${APPNAME} \
+--stringparam db2omf.format docbook \
+--stringparam db2omf.lang C \
+--stringparam db2omf.dtd '-//OASIS//DTD DocBook XML V4.3//EN' \
+--stringparam db2omf.omf_dir ${PREFIX}/share/omf \
+--stringparam db2omf.help_dir ${PREFIX}/share/gnome/help \
+--stringparam db2omf.omf_in ${SRC[0].abspath(env)} \
+--stringparam db2omf.scrollkeeper_cl ${SCROLLKEEPER_DATADIR}/Templates/C/scrollkeeper_cl.xml \
+${DB2OMF} ${SRC[1].abspath(env)}"""
+Task.simple_task_type('xsltproc2po',xslt_magic,color='BLUE')
+def detect(conf):
+	conf.check_tool('gnu_dirs glib2 dbus')
+	sgml2man=conf.find_program('docbook2man',var='SGML2MAN')
+	def getstr(varname):
+		return getattr(Options.options,varname,'')
+	conf.define('GNOMELOCALEDIR',os.path.join(conf.env['DATADIR'],'locale'))
+	xml2po=conf.find_program('xml2po',var='XML2PO')
+	xsltproc2po=conf.find_program('xsltproc',var='XSLTPROC2PO')
+	conf.env['XML2POFLAGS']='-e -p'
+	conf.env['SCROLLKEEPER_DATADIR']=Utils.cmd_output("scrollkeeper-config --pkgdatadir",silent=1).strip()
+	conf.env['DB2OMF']=Utils.cmd_output("/usr/bin/pkg-config --variable db2omf gnome-doc-utils",silent=1).strip()
+	conf.define('ENABLE_NLS',1)
+	conf.define('HAVE_BIND_TEXTDOMAIN_CODESET',1)
+	conf.define('HAVE_DCGETTEXT',1)
+	conf.check(header_name='dlfcn.h',define_name='HAVE_DLFCN_H')
+	conf.define('HAVE_GETTEXT',1)
+	conf.check(header_name='inttypes.h',define_name='HAVE_INTTYPES_H')
+	conf.check(header_name='locale.h',define_name='HAVE_LOCALE_H')
+	conf.check(header_name='memory.h',define_name='HAVE_MEMORY_H')
+	conf.check(header_name='stdint.h',define_name='HAVE_STDINT_H')
+	conf.check(header_name='stdlib.h',define_name='HAVE_STDLIB_H')
+	conf.check(header_name='strings.h',define_name='HAVE_STRINGS_H')
+	conf.check(header_name='string.h',define_name='HAVE_STRING_H')
+	conf.check(header_name='sys/stat.h',define_name='HAVE_SYS_STAT_H')
+	conf.check(header_name='sys/types.h',define_name='HAVE_SYS_TYPES_H')
+	conf.check(header_name='unistd.h',define_name='HAVE_UNISTD_H')
+def set_options(opt):
+	opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]')
+
+taskgen(init_gnome_doc)
+feature('gmome_doc')(init_gnome_doc)
+taskgen(apply_gnome_doc)
+feature('gnome_doc')(apply_gnome_doc)
+after('init_gnome_doc')(apply_gnome_doc)
+taskgen(init_xml_to)
+feature('xml_to')(init_xml_to)
+taskgen(apply_xml_to)
+feature('xml_to')(apply_xml_to)
+after('init_xml_to')(apply_xml_to)
+taskgen(apply_gnome_sgml2man)
+feature('gnome_sgml2man')(apply_gnome_sgml2man)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gnu_dirs.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gnu_dirs.py
new file mode 100644
index 0000000..68e3969
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gnu_dirs.py
@@ -0,0 +1,70 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import re
+import Utils,Options
+_options=[x.split(', ')for x in'''
+bindir, user executables, $(EXEC_PREFIX)/bin
+sbindir, system admin executables, $(EXEC_PREFIX)/sbin
+libexecdir, program executables, $(EXEC_PREFIX)/libexec
+sysconfdir, read-only single-machine data, $(PREFIX)/etc
+sharedstatedir, modifiable architecture-independent data, $(PREFIX)/com
+localstatedir, modifiable single-machine data, $(PREFIX)/var
+libdir, object code libraries, $(EXEC_PREFIX)/lib
+includedir, C header files, $(PREFIX)/include
+oldincludedir, C header files for non-gcc, /usr/include
+datarootdir, read-only arch.-independent data root, $(PREFIX)/share
+datadir, read-only architecture-independent data, $(DATAROOTDIR)
+infodir, info documentation, $(DATAROOTDIR)/info
+localedir, locale-dependent data, $(DATAROOTDIR)/locale
+mandir, man documentation, $(DATAROOTDIR)/man
+docdir, documentation root, $(DATAROOTDIR)/doc/$(PACKAGE)
+htmldir, html documentation, $(DOCDIR)
+dvidir, dvi documentation, $(DOCDIR)
+pdfdir, pdf documentation, $(DOCDIR)
+psdir, ps documentation, $(DOCDIR)
+'''.split('\n')if x]
+re_var=re.compile(r'\$\(([a-zA-Z0-9_]+)\)')
+def subst_vars(foo,vars):
+	def repl(m):
+		s=m.group(1)
+		return s and''+vars[s]or''
+	return re_var.sub(repl,foo)
+def detect(conf):
+	def get_param(varname,default):
+		return getattr(Options.options,varname,'')or default
+	env=conf.env
+	env['EXEC_PREFIX']=get_param('EXEC_PREFIX',env['PREFIX'])
+	env['PACKAGE']=Utils.g_module.APPNAME or env['PACKAGE']
+	complete=False
+	iter=0
+	while not complete and iter<len(_options)+1:
+		iter+=1
+		complete=True
+		for name,help,default in _options:
+			name=name.upper()
+			if not env[name]:
+				try:
+					env[name]=subst_vars(get_param(name,default),env)
+				except TypeError:
+					complete=False
+	if not complete:
+		lst=[name for name,_,_ in _options if not env[name.upper()]]
+		raise Utils.WafError('Variable substitution failure %r'%lst)
+def set_options(opt):
+	inst_dir=opt.add_option_group('Installation directories','By default, "waf install" will put the files in\
+ "/usr/local/bin", "/usr/local/lib" etc. An installation prefix other\
+ than "/usr/local" can be given using "--prefix", for example "--prefix=$HOME"')
+	for k in('--prefix','--destdir'):
+		option=opt.parser.get_option(k)
+		if option:
+			opt.parser.remove_option(k)
+			inst_dir.add_option(option)
+	inst_dir.add_option('--exec-prefix',help='installation prefix [Default: $(PREFIX)]',default='',dest='EXEC_PREFIX')
+	dirs_options=opt.add_option_group('Pre-defined installation directories','')
+	for name,help,default in _options:
+		option_name='--'+name
+		str_default=default
+		str_help='%s [Default: %s]'%(help,str_default)
+		dirs_options.add_option(option_name,help=str_help,default='',dest=name.upper())
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gob2.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gob2.py
new file mode 100644
index 0000000..3f82b99
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/gob2.py
@@ -0,0 +1,11 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import TaskGen
+TaskGen.declare_chain(name='gob2',action='${GOB2} -o ${TGT[0].bld_dir(env)} ${GOB2FLAGS} ${SRC}',ext_in='.gob',ext_out='.c')
+def detect(conf):
+	gob2=conf.find_program('gob2',var='GOB2')
+	if not gob2:conf.fatal('could not find the gob2 compiler')
+	conf.env['GOB2']=gob2
+	conf.env['GOB2FLAGS']=''
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/icc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/icc.py
new file mode 100644
index 0000000..8f4094f
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/icc.py
@@ -0,0 +1,70 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys
+import Configure,Options,Utils
+import ccroot,ar
+from Configure import conftest
+def find_icc(conf):
+	if sys.platform=='win32':
+		conf.find_icc_win32()
+	else:
+		conf.find_icc_other()
+def find_icc_win32(conf):
+	v=conf.env
+	cc=None
+	if v['CC']:cc=v['CC']
+	elif'CC'in os.environ:cc=os.environ['CC']
+	if not cc:cc=conf.find_program('ICL',var='CC')
+	if not cc:conf.fatal('Intel C Compiler (icl.exe) was not found')
+	v['CC']=Utils.quote_whitespace(cc)
+	v['CC_NAME']='icc'
+	v['CXX']=v['CC']
+def find_icc_other(conf):
+	v=conf.env
+	cc=None
+	if v['CC']:cc=v['CC']
+	elif'CC'in os.environ:cc=os.environ['CC']
+	if not cc:cc=conf.find_program('icc',var='CC')
+	if not cc:conf.fatal('Intel C Compiler (icc) was not found')
+	try:
+		if Utils.cmd_output('%s --version'%cc).find('icc')<0:
+			conf.fatal('icc was not found, see the result of icc --version')
+	except ValueError:
+		conf.fatal('icc --version could not be executed')
+	v['CC']=cc
+	v['CC_NAME']='icc'
+	ccroot.get_cc_version(conf,cc,'CC_VERSION')
+def icc_modifier_win32(conf):
+	if sys.platform!='win32':return
+	v=conf.env
+	try:
+		v['CC_NAME']='icc'
+		v['CPPFLAGS'].remove('/errorReport:prompt')
+	except ValueError:
+		pass
+if sys.platform=='win32':
+	detect='''
+find_icc
+find_msvc
+msvc_common_flags
+icc_modifier_win32
+cc_load_tools
+cc_add_flags
+'''
+elif sys.platform=='cygwin':
+	conf.fatal("ICC module is not supported for cygwin. Try under native Win32")
+else:
+	detect='''
+find_icc
+find_ar
+gcc_common_flags
+gcc_modifier_darwin
+cc_load_tools
+cc_add_flags
+'''
+
+conftest(find_icc)
+conftest(find_icc_win32)
+conftest(find_icc_other)
+conftest(icc_modifier_win32)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/intltool.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/intltool.py
new file mode 100644
index 0000000..bbb9429
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/intltool.py
@@ -0,0 +1,79 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,re
+import TaskGen,Task,Utils,Runner,Options,Build
+import cc
+from Logs import error
+class intltool_in_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+		self.source=''
+		self.flags=''
+		self.podir='po'
+		self.intlcache='.intlcache'
+		self.tasks=[]
+	def apply(self):
+		self.env=self.env.copy()
+		tree=Build.bld
+		for i in self.to_list(self.source):
+			node=self.path.find_resource(i)
+			podirnode=self.path.find_dir(self.podir)
+			self.env['INTLCACHE']=os.path.join(self.path.bldpath(self.env),self.podir,self.intlcache)
+			self.env['INTLPODIR']=podirnode.srcpath(self.env)
+			self.env['INTLFLAGS']=self.flags
+			task=self.create_task('intltool')
+			task.set_inputs(node)
+			task.set_outputs(node.change_ext(''))
+			task.install_path=self.install_path
+class intltool_po_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+		self.default_install_path='${LOCALEDIR}'
+		self.appname=kw.get('appname','set_your_app_name')
+		self.podir=''
+		self.tasks=[]
+	def apply(self):
+		def install_translation(task):
+			out=task.outputs[0]
+			filename=out.name
+			(langname,ext)=os.path.splitext(filename)
+			inst_file=langname+os.sep+'LC_MESSAGES'+os.sep+self.appname+'.mo'
+			Build.bld.install_as(os.path.join(self.install_path,inst_file),out.abspath(self.env),chmod=self.chmod)
+		linguas=self.path.find_resource(os.path.join(self.podir,'LINGUAS'))
+		if linguas:
+			file=open(linguas.abspath())
+			langs=[]
+			for line in file.readlines():
+				if not line.startswith('#'):
+					langs+=line.split()
+			file.close()
+			re_linguas=re.compile('[-a-zA-Z_ at .]+')
+			for lang in langs:
+				if re_linguas.match(lang):
+					node=self.path.find_resource(os.path.join(self.podir,re_linguas.match(lang).group()+'.po'))
+					task=self.create_task('po')
+					task.set_inputs(node)
+					task.set_outputs(node.change_ext('.mo'))
+					if Options.is_install:task.install=install_translation
+		else:
+			Utils.pprint('RED',"Error no LINGUAS file found in po directory")
+Task.simple_task_type('po','${POCOM} -o ${TGT} ${SRC}',color='BLUE')
+Task.simple_task_type('intltool','${INTLTOOL} ${INTLFLAGS} -q -u -c ${INTLCACHE} ${INTLPODIR} ${SRC} ${TGT}',color='BLUE',after="cc_link cxx_link")
+def detect(conf):
+	pocom=conf.find_program('msgfmt')
+	conf.env['POCOM']=pocom
+	intltool=conf.find_program('intltool-merge')
+	conf.env['INTLTOOL']=intltool
+	def getstr(varname):
+		return getattr(Options.options,varname,'')
+	prefix=conf.env['PREFIX']
+	datadir=getstr('datadir')
+	if not datadir:datadir=os.path.join(prefix,'share')
+	conf.define('LOCALEDIR',os.path.join(datadir,'locale'))
+	conf.define('DATADIR',datadir)
+	conf.check(header_name='locale.h')
+def set_options(opt):
+	opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]')
+	opt.add_option('--datadir',type='string',default='',dest='datadir',help='read-only application data')
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/java.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/java.py
new file mode 100644
index 0000000..b3db0b8
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/java.py
@@ -0,0 +1,107 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,re
+from Configure import conf
+import TaskGen,Task,Utils
+from TaskGen import feature,taskgen
+class java_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def apply_java(self):
+	Utils.def_attrs(self,jarname='',jaropts='',classpath='',source_root='.',jar_mf_attributes={},jar_mf_classpath=[])
+	nodes_lst=[]
+	if not self.classpath:
+		if not self.env['CLASSPATH']:
+			self.env['CLASSPATH']='..'+os.pathsep+'.'
+	else:
+		self.env['CLASSPATH']=self.classpath
+	re_foo=re.compile(self.source)
+	source_root_node=self.path.find_dir(self.source_root)
+	src_nodes=[]
+	bld_nodes=[]
+	prefix_path=source_root_node.abspath()
+	for(root,dirs,filenames)in os.walk(source_root_node.abspath()):
+		for x in filenames:
+			file=root+'/'+x
+			file=file.replace(prefix_path,'')
+			if file.startswith('/'):
+				file=file[1:]
+			if re_foo.search(file)>-1:
+				node=source_root_node.find_resource(file)
+				src_nodes.append(node)
+				node2=node.change_ext(".class")
+				bld_nodes.append(node2)
+	self.env['OUTDIR']=source_root_node.abspath(self.env)
+	tsk=self.create_task('javac')
+	tsk.set_inputs(src_nodes)
+	tsk.set_outputs(bld_nodes)
+	if self.jarname:
+		tsk=self.create_task('jar_create')
+		tsk.set_inputs(bld_nodes)
+		tsk.set_outputs(self.path.find_or_declare(self.jarname))
+		if not self.env['JAROPTS']:
+			if self.jaropts:
+				self.env['JAROPTS']=self.jaropts
+			else:
+				dirs='.'
+				self.env['JAROPTS']='-C %s %s'%(self.env['OUTDIR'],dirs)
+Task.simple_task_type('javac','${JAVAC} -classpath ${CLASSPATH} -d ${OUTDIR} ${SRC}',color='BLUE',before='jar_create')
+Task.simple_task_type('jar_create','${JAR} ${JARCREATE} ${TGT} ${JAROPTS}',color='GREEN')
+def detect(conf):
+	java_path=os.environ['PATH'].split(os.pathsep)
+	v=conf.env
+	if os.environ.has_key('JAVA_HOME'):
+		java_path=[os.path.join(os.environ['JAVA_HOME'],'bin')]+java_path
+		conf.env['JAVA_HOME']=os.environ['JAVA_HOME']
+	conf.find_program('javac',var='JAVAC',path_list=java_path)
+	conf.find_program('java',var='JAVA',path_list=java_path)
+	conf.find_program('jar',var='JAR',path_list=java_path)
+	v['JAVA_EXT']=['.java']
+	if os.environ.has_key('CLASSPATH'):
+		v['CLASSPATH']=os.environ['CLASSPATH']
+	if not v['JAR']:conf.fatal('jar is required for making java packages')
+	if not v['JAVAC']:conf.fatal('javac is required for compiling java classes')
+	v['JARCREATE']='cf'
+def check_java_class(conf,classname,with_classpath=None):
+	class_check_source="""
+public class Test {
+	public static void main(String[] argv) {
+		Class lib;
+		if (argv.length < 1) {
+			System.err.println("Missing argument");
+			System.exit(77);
+		}
+		try {
+			lib = Class.forName(argv[0]);
+		} catch (ClassNotFoundException e) {
+			System.err.println("ClassNotFoundException");
+			System.exit(1);
+		}
+		lib = null;
+		System.exit(0);
+	}
+}
+"""
+	import shutil
+	javatestdir='.waf-javatest'
+	classpath=javatestdir
+	if conf.env['CLASSPATH']:
+		classpath+=os.pathsep+conf.env['CLASSPATH']
+	if isinstance(with_classpath,str):
+		classpath+=os.pathsep+with_classpath
+	shutil.rmtree(javatestdir,True)
+	os.mkdir(javatestdir)
+	java_file=open(os.path.join(javatestdir,'Test.java'),'w')
+	java_file.write(class_check_source)
+	java_file.close()
+	os.popen(conf.env['JAVAC']+' '+os.path.join(javatestdir,'Test.java'))
+	(jstdin,jstdout,jstderr)=os.popen3(conf.env['JAVA']+' -cp '+classpath+' Test '+classname)
+	found=not bool(jstderr.read())
+	conf.check_message('Java class %s'%classname,"",found)
+	shutil.rmtree(javatestdir,True)
+	return found
+
+taskgen(apply_java)
+feature('java')(apply_java)
+conf(check_java_class)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/kde4.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/kde4.py
new file mode 100644
index 0000000..2a67bad
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/kde4.py
@@ -0,0 +1,62 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,re,TaskGen,Task,Utils
+from TaskGen import taskgen,feature,after
+class msgfmt_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def init_msgfmt(self):
+	Utils.def_attrs(self,default_install_path='${KDE4_LOCALE_INSTALL_DIR}',appname='set_your_app_name')
+def apply_msgfmt(self):
+	for lang in self.to_list(self.langs):
+		node=self.path.find_resource(lang+'.po')
+		task=self.create_task('msgfmt')
+		task.set_inputs(node)
+		task.set_outputs(node.change_ext('.mo'))
+		if not Options.is_install:continue
+		langname=lang.split('/')
+		langname=langname[-1]
+		tsk.install_path=self.install_path+os.sep+langname+os.sep+'LC_MESSAGES'
+		task.filename=self.appname+'.mo'
+		task.chmod=self.chmod
+def detect(conf):
+	kdeconfig=conf.find_program('kde4-config')
+	if not kdeconfig:
+		conf.fatal('we need kde4-config')
+	prefix=Utils.cmd_output('%s --prefix'%kdeconfig,silent=True).strip()
+	file='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix
+	try:os.stat(file)
+	except OSError:
+		file='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix
+		try:os.stat(file)
+		except:conf.fatal('could not open %s'%file)
+	try:
+		f=open(file,'r')
+		txt=f.read()
+		f.close()
+	except(OSError,IOError):
+		conf.fatal('could not read %s'%file)
+	txt=txt.replace('\\\n','\n')
+	fu=re.compile('#(.*)\n')
+	txt=fu.sub('',txt)
+	setregexp=re.compile('([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)')
+	found=setregexp.findall(txt)
+	for(_,key,val)in found:
+		conf.env[key]=val
+	conf.env['LIB_KDECORE']='kdecore'
+	conf.env['LIB_KDEUI']='kdeui'
+	conf.env['LIB_KIO']='kio'
+	conf.env['LIB_KHTML']='khtml'
+	conf.env['LIB_KPARTS']='kparts'
+	conf.env['LIBPATH_KDECORE']=conf.env['KDE4_LIB_INSTALL_DIR']
+	conf.env['CPPPATH_KDECORE']=conf.env['KDE4_INCLUDE_INSTALL_DIR']
+	conf.env.append_value('CPPPATH_KDECORE',conf.env['KDE4_INCLUDE_INSTALL_DIR']+"/KDE")
+	conf.env['MSGFMT']=conf.find_program('msgfmt')
+Task.simple_task_type('msgfmt','${MSGFMT} ${SRC} -o ${TGT}',color='BLUE')
+
+taskgen(init_msgfmt)
+feature('msgfmt')(init_msgfmt)
+taskgen(apply_msgfmt)
+feature('msgfmt')(apply_msgfmt)
+after('init_msgfmt')(apply_msgfmt)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/libtool.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/libtool.py
new file mode 100644
index 0000000..267a1e1
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/libtool.py
@@ -0,0 +1,244 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import sys,re,os,optparse
+import TaskGen,Task,Utils,preproc
+from Logs import error,debug,warn
+from TaskGen import taskgen,after,before,feature
+REVISION="0.1.3"
+fakelibtool_vardeps=['CXX','PREFIX']
+def fakelibtool_build(task):
+	env=task.env
+	dest=open(task.outputs[0].abspath(env),'w')
+	sname=task.inputs[0].name
+	fu=dest.write
+	fu("# Generated by ltmain.sh - GNU libtool 1.5.18 - (pwn3d by BKsys II code name WAF)\n")
+	if env['vnum']:
+		nums=env['vnum'].split('.')
+		libname=task.inputs[0].name
+		name3=libname+'.'+env['vnum']
+		name2=libname+'.'+nums[0]
+		name1=libname
+		fu("dlname='%s'\n"%name2)
+		strn=" ".join([name3,name2,name1])
+		fu("library_names='%s'\n"%(strn))
+	else:
+		fu("dlname='%s'\n"%sname)
+		fu("library_names='%s %s %s'\n"%(sname,sname,sname))
+	fu("old_library=''\n")
+	vars=' '.join(env['libtoolvars']+env['LINKFLAGS'])
+	fu("dependency_libs='%s'\n"%vars)
+	fu("current=0\n")
+	fu("age=0\nrevision=0\ninstalled=yes\nshouldnotlink=no\n")
+	fu("dlopen=''\ndlpreopen=''\n")
+	fu("libdir='%s/lib'\n"%env['PREFIX'])
+	dest.close()
+	return 0
+def read_la_file(path):
+	sp=re.compile(r'^([^=]+)=\'(.*)\'$')
+	dc={}
+	file=open(path,"r")
+	for line in file.readlines():
+		try:
+			_,left,right,_=sp.split(line.strip())
+			dc[left]=right
+		except ValueError:
+			pass
+	file.close()
+	return dc
+def apply_link_libtool(self):
+	if self.type!='program':
+		linktask=self.link_task
+		latask=self.create_task('fakelibtool')
+		latask.set_inputs(linktask.outputs)
+		latask.set_outputs(linktask.outputs[0].change_ext('.la'))
+		self.latask=latask
+	if Options.commands['install']or Options.commands['uninstall']:
+		Build.bld.install_files('PREFIX','lib',linktask.outputs[0].abspath(self.env),self.env)
+def apply_libtool(self):
+	self.env['vnum']=self.vnum
+	paths=[]
+	libs=[]
+	libtool_files=[]
+	libtool_vars=[]
+	for l in self.env['LINKFLAGS']:
+		if l[:2]=='-L':
+			paths.append(l[2:])
+		elif l[:2]=='-l':
+			libs.append(l[2:])
+	for l in libs:
+		for p in paths:
+			dict=read_la_file(p+'/lib'+l+'.la')
+			linkflags2=dict.get('dependency_libs','')
+			for v in linkflags2.split():
+				if v.endswith('.la'):
+					libtool_files.append(v)
+					libtool_vars.append(v)
+					continue
+				self.env.append_unique('LINKFLAGS',v)
+				break
+	self.env['libtoolvars']=libtool_vars
+	while libtool_files:
+		file=libtool_files.pop()
+		dict=read_la_file(file)
+		for v in dict['dependency_libs'].split():
+			if v[-3:]=='.la':
+				libtool_files.append(v)
+				continue
+			self.env.append_unique('LINKFLAGS',v)
+Task.task_type_from_func('fakelibtool',vars=fakelibtool_vardeps,func=fakelibtool_build,color='BLUE',after="cc_link cxx_link ar_link_static")
+class libtool_la_file:
+	def __init__(self,la_filename):
+		self.__la_filename=la_filename
+		self.linkname=str(os.path.split(la_filename)[-1])[:-3]
+		if self.linkname.startswith("lib"):
+			self.linkname=self.linkname[3:]
+		self.dlname=None
+		self.library_names=None
+		self.old_library=None
+		self.dependency_libs=None
+		self.current=None
+		self.age=None
+		self.revision=None
+		self.installed=None
+		self.shouldnotlink=None
+		self.dlopen=None
+		self.dlpreopen=None
+		self.libdir='/usr/lib'
+		if not self.__parse():
+			raise"file %s not found!!"%(la_filename)
+	def __parse(self):
+		if not os.path.isfile(self.__la_filename):return 0
+		la_file=open(self.__la_filename,'r')
+		for line in la_file:
+			ln=line.strip()
+			if not ln:continue
+			if ln[0]=='#':continue
+			(key,value)=str(ln).split('=',1)
+			key=key.strip()
+			value=value.strip()
+			if value=="no":value=False
+			elif value=="yes":value=True
+			else:
+				try:value=int(value)
+				except ValueError:value=value.strip("'")
+			setattr(self,key,value)
+		la_file.close()
+		return 1
+	def get_libs(self):
+		libs=[]
+		if self.dependency_libs:
+			libs=str(self.dependency_libs).strip().split()
+		if libs==None:
+			libs=[]
+		libs.insert(0,"-l%s"%self.linkname.strip())
+		libs.insert(0,"-L%s"%self.libdir.strip())
+		return libs
+	def __str__(self):
+		return'''\
+dlname = "%(dlname)s"
+library_names = "%(library_names)s"
+old_library = "%(old_library)s"
+dependency_libs = "%(dependency_libs)s"
+version = %(current)s.%(age)s.%(revision)s
+installed = "%(installed)s"
+shouldnotlink = "%(shouldnotlink)s"
+dlopen = "%(dlopen)s"
+dlpreopen = "%(dlpreopen)s"
+libdir = "%(libdir)s"'''%self.__dict__
+class libtool_config:
+	def __init__(self,la_filename):
+		self.__libtool_la_file=libtool_la_file(la_filename)
+		tmp=self.__libtool_la_file
+		self.__version=[int(tmp.current),int(tmp.age),int(tmp.revision)]
+		self.__sub_la_files=[]
+		self.__sub_la_files.append(la_filename)
+		self.__libs=None
+	def __cmp__(self,other):
+		if not other:
+			return 1
+		othervers=[int(s)for s in str(other).split(".")]
+		selfvers=self.__version
+		return cmp(selfvers,othervers)
+	def __str__(self):
+		return"\n".join([str(self.__libtool_la_file),' '.join(self.__libtool_la_file.get_libs()),'* New getlibs:',' '.join(self.get_libs())])
+	def __get_la_libs(self,la_filename):
+		return libtool_la_file(la_filename).get_libs()
+	def get_libs(self):
+		libs_list=list(self.__libtool_la_file.get_libs())
+		libs_map={}
+		while len(libs_list)>0:
+			entry=libs_list.pop(0)
+			if entry:
+				if str(entry).endswith(".la"):
+					if entry not in self.__sub_la_files:
+						self.__sub_la_files.append(entry)
+						libs_list.extend(self.__get_la_libs(entry))
+				else:
+					libs_map[entry]=1
+		self.__libs=libs_map.keys()
+		return self.__libs
+	def get_libs_only_L(self):
+		if not self.__libs:self.get_libs()
+		libs=self.__libs
+		libs=filter(lambda s:str(s).startswith('-L'),libs)
+		return libs
+	def get_libs_only_l(self):
+		if not self.__libs:self.get_libs()
+		libs=self.__libs
+		libs=filter(lambda s:str(s).startswith('-l'),libs)
+		return libs
+	def get_libs_only_other(self):
+		if not self.__libs:self.get_libs()
+		libs=self.__libs
+		libs=filter(lambda s:not(str(s).startswith('-L')or str(s).startswith('-l')),libs)
+		return libs
+def useCmdLine():
+	usage='''Usage: %prog [options] PathToFile.la
+example: %prog --atleast-version=2.0.0 /usr/lib/libIlmImf.la
+nor: %prog --libs /usr/lib/libamarok.la'''
+	parser=optparse.OptionParser(usage)
+	a=parser.add_option
+	a("--version",dest="versionNumber",action="store_true",default=False,help="output version of libtool-config")
+	a("--debug",dest="debug",action="store_true",default=False,help="enable debug")
+	a("--libs",dest="libs",action="store_true",default=False,help="output all linker flags")
+	a("--libs-only-l",dest="libs_only_l",action="store_true",default=False,help="output -l flags")
+	a("--libs-only-L",dest="libs_only_L",action="store_true",default=False,help="output -L flags")
+	a("--libs-only-other",dest="libs_only_other",action="store_true",default=False,help="output other libs (e.g. -pthread)")
+	a("--atleast-version",dest="atleast_version",default=None,help="return 0 if the module is at least version ATLEAST_VERSION")
+	a("--exact-version",dest="exact_version",default=None,help="return 0 if the module is exactly version EXACT_VERSION")
+	a("--max-version",dest="max_version",default=None,help="return 0 if the module is at no newer than version MAX_VERSION")
+	(options,args)=parser.parse_args()
+	if len(args)!=1 and not options.versionNumber:
+		parser.error("incorrect number of arguments")
+	if options.versionNumber:
+		print"libtool-config version %s"%REVISION
+		return 0
+	ltf=libtool_config(args[0])
+	if options.debug:
+		print(ltf)
+	if options.atleast_version:
+		if ltf>=options.atleast_version:return 0
+		sys.exit(1)
+	if options.exact_version:
+		if ltf==options.exact_version:return 0
+		sys.exit(1)
+	if options.max_version:
+		if ltf<=options.max_version:return 0
+		sys.exit(1)
+	def p(x):
+		print" ".join(x)
+	if options.libs:p(ltf.get_libs())
+	elif options.libs_only_l:p(ltf.get_libs_only_l())
+	elif options.libs_only_L:p(ltf.get_libs_only_L())
+	elif options.libs_only_other:p(ltf.get_libs_only_other())
+	return 0
+if __name__=='__main__':
+	useCmdLine()
+
+taskgen(apply_link_libtool)
+feature("libtool")(apply_link_libtool)
+after('apply_link')(apply_link_libtool)
+taskgen(apply_libtool)
+feature("libtool")(apply_libtool)
+before('apply_core')(apply_libtool)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/lua.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/lua.py
new file mode 100644
index 0000000..93f8604
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/lua.py
@@ -0,0 +1,14 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import TaskGen
+from TaskGen import taskgen,feature
+TaskGen.declare_chain(name='luac',action='${LUAC} -s -o ${TGT} ${SRC}',ext_in='.lua',ext_out='.luac',reentrant=0,install='LUADIR',)
+def init_lua(self):
+	self.default_chmod=0755
+def detect(conf):
+	luac=conf.find_program('luac',var='LUAC')
+	if not luac:conf.fatal('cannot find the compiler "luac"')
+
+taskgen(init_lua)
+feature('lua')(init_lua)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/misc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/misc.py
new file mode 100644
index 0000000..d37019d
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/misc.py
@@ -0,0 +1,301 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import shutil,re,os,types
+import TaskGen,Node,Task,Utils,Build,pproc
+from TaskGen import feature,taskgen,after
+from Logs import debug
+def copy_func(tsk):
+	env=tsk.env
+	infile=tsk.inputs[0].abspath(env)
+	outfile=tsk.outputs[0].abspath(env)
+	try:
+		shutil.copy2(infile,outfile)
+	except OSError,IOError:
+		return 1
+	else:
+		if tsk.chmod:os.chmod(outfile,tsk.chmod)
+		return 0
+def action_process_file_func(tsk):
+	if not tsk.fun:raise Utils.WafError('task must have a function attached to it for copy_func to work!')
+	return tsk.fun(tsk)
+class cmd_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def apply_cmd(self):
+	if not self.fun:raise Utils.WafError('cmdobj needs a function!')
+	tsk=Task.TaskBase()
+	tsk.fun=self.fun
+	tsk.env=self.env
+	self.tasks.append(tsk)
+	tsk.install_path=self.install_path
+class copy_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def apply_copy(self):
+	Utils.def_attrs(self,fun=copy_func)
+	self.default_install_path=0
+	lst=self.to_list(self.source)
+	for filename in lst:
+		node=self.path.find_resource(filename)
+		if not node:raise Utils.WafError('cannot find input file %s for processing'%filename)
+		target=self.target
+		if not target or len(lst)>1:target=node.name
+		newnode=self.path.find_or_declare(target)
+		tsk=self.create_task('copy')
+		tsk.set_inputs(node)
+		tsk.set_outputs(newnode)
+		tsk.fun=self.fun
+		tsk.chmod=self.chmod
+		if not tsk.env:
+			tsk.debug()
+			raise Utils.WafError('task without an environment')
+def subst_func(tsk):
+	m4_re=re.compile('@(\w+)@',re.M)
+	env=tsk.env
+	infile=tsk.inputs[0].abspath(env)
+	outfile=tsk.outputs[0].abspath(env)
+	file=open(infile,'r')
+	code=file.read()
+	file.close()
+	code=code.replace('%','%%')
+	s=m4_re.sub(r'%(\1)s',code)
+	dict=tsk.dict
+	if not dict:
+		names=m4_re.findall(code)
+		for i in names:
+			if env[i]and type(env[i])is types.ListType:
+				dict[i]=" ".join(env[i])
+			else:dict[i]=env[i]
+	file=open(outfile,'w')
+	file.write(s%dict)
+	file.close()
+	if tsk.chmod:os.chmod(outfile,tsk.chmod)
+	return 0
+class subst_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def apply_subst(self):
+	Utils.def_attrs(self,fun=subst_func)
+	self.default_install_path=0
+	lst=self.to_list(self.source)
+	self.dict=getattr(self,'dict',{})
+	for filename in lst:
+		node=self.path.find_resource(filename)
+		if not node:raise Utils.WafError('cannot find input file %s for processing'%filename)
+		newnode=node.change_ext('')
+		if self.dict and not self.env['DICT_HASH']:
+			self.env=self.env.copy()
+			self.env['DICT_HASH']=hash(str(self.dict))
+		tsk=self.create_task('copy')
+		tsk.set_inputs(node)
+		tsk.set_outputs(newnode)
+		tsk.fun=self.fun
+		tsk.dict=self.dict
+		tsk.dep_vars=['DICT_HASH']
+		tsk.install_path=self.install_path
+		tsk.chmod=self.chmod
+		if not tsk.env:
+			tsk.debug()
+			raise Utils.WafError('task without an environment')
+class cmd_arg(object):
+	def __init__(self,name,template='%s'):
+		self.name=name
+		self.template=template
+		self.node=None
+class input_file(cmd_arg):
+	def find_node(self,base_path):
+		assert isinstance(base_path,Node.Node)
+		self.node=base_path.find_resource(self.name)
+		if self.node is None:
+			raise Utils.WafError("Input file %s not found in "%(self.name,base_path))
+	def get_path(self,env,absolute):
+		if absolute:
+			return self.template%self.node.abspath(env)
+		else:
+			return self.template%self.node.srcpath(env)
+class output_file(cmd_arg):
+	def find_node(self,base_path):
+		assert isinstance(base_path,Node.Node)
+		self.node=base_path.find_or_declare(self.name)
+		if self.node is None:
+			raise Utils.WafError("Output file %s not found in "%(self.name,base_path))
+	def get_path(self,env,absolute):
+		if absolute:
+			return self.template%self.node.abspath(env)
+		else:
+			return self.template%self.node.bldpath(env)
+class cmd_dir_arg(cmd_arg):
+	def __init__(self,name,template=None):
+		cmd_arg.__init__(self)
+		self.name=name
+		self.node=None
+		if template is None:
+			self.template='%s'
+		else:
+			self.template=template
+	def find_node(self,base_path):
+		assert isinstance(base_path,Node.Node)
+		self.node=base_path.find_dir(self.name)
+		if self.node is None:
+			raise Utils.WafError("Directory %s not found in "%(self.name,base_path))
+class input_dir(cmd_dir_arg):
+	def get_path(self,dummy_env,dummy_absolute):
+		return self.template%self.node.abspath()
+class output_dir(cmd_dir_arg):
+	def get_path(self,env,dummy_absolute):
+		return self.template%self.node.abspath(env)
+class command_output(Task.Task):
+	color="BLUE"
+	def __init__(self,env,command,command_node,command_args,stdin,stdout,cwd,os_env,stderr):
+		Task.Task.__init__(self,env,normal=1)
+		assert isinstance(command,(str,Node.Node))
+		self.command=command
+		self.command_args=command_args
+		self.stdin=stdin
+		self.stdout=stdout
+		self.cwd=cwd
+		self.os_env=os_env
+		self.stderr=stderr
+		if command_node is not None:self.dep_nodes=[command_node]
+		self.dep_vars=[]
+	def run(self):
+		task=self
+		assert len(task.inputs)>0
+		def input_path(node,template):
+			if task.cwd is None:
+				return template%node.bldpath(task.env)
+			else:
+				return template%node.abspath()
+		def output_path(node,template):
+			fun=node.abspath
+			if task.cwd is None:fun=node.bldpath
+			return template%fun(task.env)
+		if isinstance(task.command,Node.Node):
+			argv=[input_path(task.command,'%s')]
+		else:
+			argv=[task.command]
+		for arg in task.command_args:
+			if isinstance(arg,str):
+				argv.append(arg)
+			else:
+				assert isinstance(arg,cmd_arg)
+				argv.append(arg.get_path(task.env,(task.cwd is not None)))
+		if task.stdin:
+			stdin=file(input_path(task.stdin,'%s'))
+		else:
+			stdin=None
+		if task.stdout:
+			stdout=file(output_path(task.stdout,'%s'),"w")
+		else:
+			stdout=None
+		if task.stderr:
+			stderr=file(output_path(task.stderr,'%s'),"w")
+		else:
+			stderr=None
+		if task.cwd is None:
+			cwd=('None (actually %r)'%os.getcwd())
+		else:
+			cwd=repr(task.cwd)
+		debug("command-output: cwd=%s, stdin=%r, stdout=%r, argv=%r"%(cwd,stdin,stdout,argv))
+		if task.os_env is None:
+			os_env=os.environ
+		else:
+			os_env=task.os_env
+		command=pproc.Popen(argv,stdin=stdin,stdout=stdout,stderr=stderr,cwd=task.cwd,env=os_env)
+		return command.wait()
+class cmd_output_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def init_cmd_output(self):
+	Utils.def_attrs(self,stdin=None,stdout=None,stderr=None,command=None,command_is_external=False,argv=[],dependencies=[],dep_vars=[],hidden_inputs=[],hidden_outputs=[],cwd=None,os_env=None)
+def apply_cmd_output(self):
+	if self.command is None:
+		raise Utils.WafError("command-output missing command")
+	if self.command_is_external:
+		cmd=self.command
+		cmd_node=None
+	else:
+		cmd_node=self.path.find_resource(self.command)
+		assert cmd_node is not None,('''Could not find command '%s' in source tree.
+Hint: if this is an external command,
+use command_is_external=True''')%(self.command,)
+		cmd=cmd_node
+	if self.cwd is None:
+		cwd=None
+	else:
+		assert isinstance(cwd,CmdDirArg)
+		self.cwd.find_node(self.path)
+	args=[]
+	inputs=[]
+	outputs=[]
+	for arg in self.argv:
+		if isinstance(arg,cmd_arg):
+			arg.find_node(self.path)
+			if isinstance(arg,input_file):
+				inputs.append(arg.node)
+			if isinstance(arg,output_file):
+				outputs.append(arg.node)
+	if self.stdout is None:
+		stdout=None
+	else:
+		assert isinstance(self.stdout,basestring)
+		stdout=self.path.find_or_declare(self.stdout)
+		if stdout is None:
+			raise Utils.WafError("File %s not found"%(self.stdout,))
+		outputs.append(stdout)
+	if self.stderr is None:
+		stderr=None
+	else:
+		assert isinstance(self.stderr,basestring)
+		stderr=self.path.find_or_declare(self.stderr)
+		if stderr is None:
+			Params.fatal("File %s not found"%(self.stderr,))
+		outputs.append(stderr)
+	if self.stdin is None:
+		stdin=None
+	else:
+		assert isinstance(self.stdin,basestring)
+		stdin=self.path.find_resource(self.stdin)
+		if stdin is None:
+			raise Utils.WafError("File %s not found"%(self.stdin,))
+		inputs.append(stdin)
+	for hidden_input in self.to_list(self.hidden_inputs):
+		node=self.path.find_resource(hidden_input)
+		if node is None:
+			raise Utils.WafError("File %s not found in dir %s"%(hidden_input,self.path))
+		inputs.append(node)
+	for hidden_output in self.to_list(self.hidden_outputs):
+		node=self.path.find_or_declare(hidden_output)
+		if node is None:
+			raise Utils.WafError("File %s not found in dir %s"%(hidden_output,self.path))
+		outputs.append(node)
+	if not inputs:
+		raise Utils.WafError("command-output objects must have at least one input file")
+	if not outputs:
+		raise Utils.WafError("command-output objects must have at least one output file")
+	task=command_output(self.env,cmd,cmd_node,self.argv,stdin,stdout,cwd,self.os_env,stderr)
+	Utils.copy_attrs(self,task,'before after ext_in ext_out',only_if_set=True)
+	self.tasks.append(task)
+	task.set_inputs(inputs)
+	task.set_outputs(outputs)
+	task.dep_vars=self.to_list(self.dep_vars)
+	for dep in self.dependencies:
+		assert dep is not self
+		dep.post()
+		for dep_task in dep.tasks:
+			task.set_run_after(dep_task)
+Task.task_type_from_func('copy',vars=[],func=action_process_file_func)
+TaskGen.task_gen.classes['command-output']=cmd_output_taskgen
+
+taskgen(apply_cmd)
+feature('cmd')(apply_cmd)
+taskgen(apply_copy)
+feature('copy')(apply_copy)
+taskgen(apply_subst)
+feature('subst')(apply_subst)
+taskgen(init_cmd_output)
+feature('command-output')(init_cmd_output)
+taskgen(apply_cmd_output)
+feature('command-output')(apply_cmd_output)
+after('init_cmd_output')(apply_cmd_output)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/msvc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/msvc.py
new file mode 100644
index 0000000..b7b2d30
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/msvc.py
@@ -0,0 +1,311 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,re,string,optparse
+import Utils,TaskGen,Runner,Configure,Task,Options
+from Logs import debug,error,warn
+from Utils import quote_whitespace
+from TaskGen import taskgen,after,before,feature
+from Configure import conftest
+import ccroot,cc,cxx,ar
+from libtool import read_la_file
+from os.path import exists
+def msvc_linker(task):
+	e=task.env
+	linker=e['LINK']
+	srcf=e['LINK_SRC_F']
+	trgtf=e['LINK_TGT_F']
+	linkflags=e.get_flat('LINKFLAGS')
+	libdirs=e.get_flat('_LIBDIRFLAGS')
+	libs=e.get_flat('_LIBFLAGS')
+	subsystem=''
+	if task.subsystem:
+		subsystem='/subsystem:%s'%task.subsystem
+	outfile=task.outputs[0].bldpath(e)
+	manifest=outfile+'.manifest'
+	pdbnode=task.outputs[0].change_ext('.pdb')
+	pdbfile=pdbnode.bldpath(e)
+	objs=" ".join(['"%s"'%a.abspath(e)for a in task.inputs])
+	cmd="%s %s %s%s %s%s %s %s %s"%(linker,subsystem,srcf,objs,trgtf,outfile,linkflags,libdirs,libs)
+	ret=task.generator.bld.exec_command(cmd,shell=False)
+	if ret:return ret
+	if os.path.exists(pdbfile):
+		task.outputs.append(pdbnode)
+	if os.path.exists(manifest):
+		debug('msvc: manifesttool')
+		mtool=e['MT']
+		if not mtool:
+			return 0
+		mode=''
+		if'cprogram'in task.features:
+			mode='1'
+		elif'cshlib'in task.features:
+			mode='2'
+		debug('msvc: embedding manifest')
+		flags=' '.join(e['MTFLAGS']or[])
+		cmd='%s %s -manifest "%s" -outputresource:"%s";#%s'%(mtool,flags,manifest,outfile,mode)
+		ret=task.generator.bld.exec_command(cmd,shell=False)
+	return ret
+g_msvc_systemlibs="""
+aclui activeds ad1 adptif adsiid advapi32 asycfilt authz bhsupp bits bufferoverflowu cabinet
+cap certadm certidl ciuuid clusapi comctl32 comdlg32 comsupp comsuppd comsuppw comsuppwd comsvcs
+credui crypt32 cryptnet cryptui d3d8thk daouuid dbgeng dbghelp dciman32 ddao35 ddao35d
+ddao35u ddao35ud delayimp dhcpcsvc dhcpsapi dlcapi dnsapi dsprop dsuiext dtchelp
+faultrep fcachdll fci fdi framedyd framedyn gdi32 gdiplus glauxglu32 gpedit gpmuuid
+gtrts32w gtrtst32hlink htmlhelp httpapi icm32 icmui imagehlp imm32 iphlpapi iprop
+kernel32 ksguid ksproxy ksuser libcmt libcmtd libcpmt libcpmtd loadperf lz32 mapi
+mapi32 mgmtapi minidump mmc mobsync mpr mprapi mqoa mqrt msacm32 mscms mscoree
+msdasc msimg32 msrating mstask msvcmrt msvcurt msvcurtd mswsock msxml2 mtx mtxdm
+netapi32 nmapinmsupp npptools ntdsapi ntdsbcli ntmsapi ntquery odbc32 odbcbcp
+odbccp32 oldnames ole32 oleacc oleaut32 oledb oledlgolepro32 opends60 opengl32
+osptk parser pdh penter pgobootrun pgort powrprof psapi ptrustm ptrustmd ptrustu
+ptrustud qosname rasapi32 rasdlg rassapi resutils riched20 rpcndr rpcns4 rpcrt4 rtm
+rtutils runtmchk scarddlg scrnsave scrnsavw secur32 sensapi setupapi sfc shell32
+shfolder shlwapi sisbkup snmpapi sporder srclient sti strsafe svcguid tapi32 thunk32
+traffic unicows url urlmon user32 userenv usp10 uuid uxtheme vcomp vcompd vdmdbg
+version vfw32 wbemuuid  webpost wiaguid wininet winmm winscard winspool winstrm
+wintrust wldap32 wmiutils wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 xaswitch xolehlp
+""".split()
+def find_lt_names_msvc(self,libname,is_static=False):
+	lt_names=['lib%s.la'%libname,'%s.la'%libname,]
+	for path in self.libpaths:
+		for la in lt_names:
+			laf=os.path.join(path,la)
+			dll=None
+			if exists(laf):
+				ltdict=read_la_file(laf)
+				lt_libdir=None
+				if ltdict.has_key('libdir')and ltdict['libdir']!='':
+					lt_libdir=ltdict['libdir']
+				if not is_static and ltdict.has_key('library_names')and ltdict['library_names']!='':
+					dllnames=ltdict['library_names'].split()
+					dll=dllnames[0].lower()
+					dll=re.sub('\.dll$','',dll)
+					return(lt_libdir,dll,False)
+				elif ltdict.has_key('old_library')and ltdict['old_library']!='':
+					olib=ltdict['old_library']
+					if exists(os.path.join(path,olib)):
+						return(path,olib,True)
+					elif lt_libdir!=''and exists(os.path.join(lt_libdir,olib)):
+						return(lt_libdir,olib,True)
+					else:
+						return(None,olib,True)
+				else:
+					raise Utils.WafError('invalid libtool object file: %s'%laf)
+	return(None,None,None)
+def libname_msvc(self,libname,is_static=False):
+	lib=libname.lower()
+	lib=re.sub('\.lib$','',lib)
+	if lib in g_msvc_systemlibs:
+		return lib+'.lib'
+	lib=re.sub('^lib','',lib)
+	if lib=='m':
+		return None
+	(lt_path,lt_libname,lt_static)=find_lt_names_msvc(self,lib,is_static)
+	if lt_path!=None and lt_libname!=None:
+		if lt_static==True:
+			return os.path.join(lt_path,lt_libname)
+	if lt_path!=None:
+		_libpaths=[lt_path]+self.libpaths
+	else:
+		_libpaths=self.libpaths
+	static_libs=['%ss.lib'%lib,'lib%ss.lib'%lib,'%s.lib'%lib,'lib%s.lib'%lib,]
+	dynamic_libs=['lib%s.dll.lib'%lib,'lib%s.dll.a'%lib,'%s.dll.lib'%lib,'%s.dll.a'%lib,'lib%s_d.lib'%lib,'%s_d.lib'%lib,'%s.lib'%lib,]
+	libnames=static_libs
+	if not is_static:
+		libnames=dynamic_libs+static_libs
+	for path in _libpaths:
+		for libn in libnames:
+			if os.path.exists(os.path.join(path,libn)):
+				debug('msvc: lib found: %s'%os.path.join(path,libn))
+				return libn
+	return None
+def apply_msvc_obj_vars(self):
+	debug('msvc: apply_msvc_obj_vars called for msvc')
+	env=self.env
+	app=env.append_unique
+	cpppath_st=env['CPPPATH_ST']
+	lib_st=env['LIB_ST']
+	staticlib_st=env['STATICLIB_ST']
+	libpath_st=env['LIBPATH_ST']
+	staticlibpath_st=env['STATICLIBPATH_ST']
+	for i in env['LIBPATH']:
+		app('LINKFLAGS',libpath_st%i)
+		if not self.libpaths.count(i):
+			self.libpaths.append(i)
+	for i in env['LIBPATH']:
+		app('LINKFLAGS',staticlibpath_st%i)
+		if not self.libpaths.count(i):
+			self.libpaths.append(i)
+	if not env['FULLSTATIC']:
+		if env['STATICLIB']or env['LIB']:
+			app('LINKFLAGS',env['SHLIB_MARKER'])
+	if env['STATICLIB']:
+		app('LINKFLAGS',env['STATICLIB_MARKER'])
+		for i in env['STATICLIB']:
+			debug('msvc: libname: %s'%i)
+			libname=libname_msvc(self,i,True)
+			debug('msvc: libnamefixed: %s'%libname)
+			if libname!=None:
+				app('LINKFLAGS',libname)
+	if self.env['LIB']:
+		for i in env['LIB']:
+			debug('msvc: libname: %s'%i)
+			libname=libname_msvc(self,i)
+			debug('msvc: libnamefixed: %s'%libname)
+			if libname!=None:
+				app('LINKFLAGS',libname)
+def apply_link_msvc(self):
+	if'objects'in self.features:
+		self.out_nodes=[]
+		app=self.out_nodes.append
+		for t in self.compiled_tasks:app(t.outputs[0])
+		return
+	link=getattr(self,'link',None)
+	if not link:
+		if'cstaticlib'in self.features:link='msvc_ar_link_static'
+		elif'cxx'in self.features:link='msvc_cxx_link'
+		else:link='msvc_cc_link'
+	linktask=self.create_task(link)
+	outputs=[t.outputs[0]for t in self.compiled_tasks]
+	linktask.set_inputs(outputs)
+	linktask.set_outputs(self.path.find_or_declare(ccroot.get_target_name(self)))
+	linktask.features=self.features
+	linktask.subsystem=getattr(self,'subsystem','')
+	self.link_task=linktask
+def init_msvc(self):
+	if self.env['CC_NAME']=='msvc'or self.env['CXX_NAME']=='msvc':
+		self.meths.remove('apply_link')
+		self.meths.remove('apply_obj_vars')
+	else:
+		for x in['apply_link_msvc','apply_msvc_obj_vars']:
+			self.meths.remove(x)
+	try:_libpaths=getattr(self,'libpaths')
+	except AttributeError:self.libpaths=[]
+static_link_str='${STLIBLINK} ${LINK_SRC_F}${SRC} ${LINK_TGT_F}${TGT}'
+Task.simple_task_type('msvc_ar_link_static',static_link_str,color='YELLOW',ext_in='.o')
+Task.task_type_from_func('msvc_cc_link',vars=['LINK','LINK_SRC_F','LINK_TGT_F','LINKFLAGS','_LIBDIRFLAGS','_LIBFLAGS','MT','MTFLAGS'],color='YELLOW',func=msvc_linker,ext_in='.o')
+Task.task_type_from_func('msvc_cxx_link',vars=['LINK','LINK_SRC_F','LINK_TGT_F','LINKFLAGS','_LIBDIRFLAGS','_LIBFLAGS','MT','MTFLAGS'],color='YELLOW',func=msvc_linker,ext_in='.o')
+rc_str='${RC} ${RCFLAGS} /fo ${TGT} ${SRC}'
+Task.simple_task_type('rc',rc_str,color='GREEN',before='cc cxx')
+import winres
+detect='''
+find_msvc
+msvc_common_flags
+cc_load_tools
+cxx_load_tools
+cc_add_flags
+cxx_add_flags
+'''
+def find_msvc(conf):
+	if sys.platform!='win32':
+		conf.fatal('MSVC module only works under native Win32 Python! cygwin is not supported yet')
+	v=conf.env
+	cxx=None
+	if v['CXX']:cxx=v['CXX']
+	elif'CXX'in os.environ:cxx=os.environ['CXX']
+	if not cxx:cxx=conf.find_program('CL',var='CXX')
+	if not cxx:conf.fatal('CL was not found (compiler)')
+	v['CXX']=cxx
+	v['CC']=v['CXX']
+	v['CXX_NAME']='msvc'
+	v['CC_NAME']='msvc'
+	if not v['LINK_CXX']:
+		link=conf.find_program('LINK')
+		if link:v['LINK_CXX']=link
+		else:conf.fatal('LINK was not found (linker)')
+	v['LINK']=link
+	if not v['LINK_CC']:v['LINK_CC']=v['LINK_CXX']
+	if not v['STLIBLINK']:
+		stliblink=conf.find_program('LIB')
+		if not stliblink:return
+		v['STLIBLINK']=stliblink
+	manifesttool=conf.find_program('MT')
+	if manifesttool:
+		v['MT']=manifesttool
+		v['MTFLAGS']=['/NOLOGO']
+	conf.check_tool('winres')
+	if not conf.env['WINRC']:
+		warn('Resource compiler not found. Compiling resource file is disabled')
+def msvc_common_flags(conf):
+	v=conf.env
+	v['CPPFLAGS']=['/W3','/nologo','/EHsc','/errorReport:prompt']
+	v['CCDEFINES']=['WIN32']
+	v['CXXDEFINES']=['WIN32']
+	v['_CCINCFLAGS']=[]
+	v['_CCDEFFLAGS']=[]
+	v['_CXXINCFLAGS']=[]
+	v['_CXXDEFFLAGS']=[]
+	v['CC_SRC_F']=''
+	v['CC_TGT_F']='/c /Fo'
+	v['CXX_SRC_F']=''
+	v['CXX_TGT_F']='/c /Fo'
+	v['CPPPATH_ST']='/I%s'
+	v['CPPFLAGS_CONSOLE']=['/SUBSYSTEM:CONSOLE']
+	v['CPPFLAGS_NATIVE']=['/SUBSYSTEM:NATIVE']
+	v['CPPFLAGS_POSIX']=['/SUBSYSTEM:POSIX']
+	v['CPPFLAGS_WINDOWS']=['/SUBSYSTEM:WINDOWS']
+	v['CPPFLAGS_WINDOWSCE']=['/SUBSYSTEM:WINDOWSCE']
+	v['CPPFLAGS_CRT_MULTITHREADED']=['/MT']
+	v['CPPFLAGS_CRT_MULTITHREADED_DLL']=['/MD']
+	v['CPPDEFINES_CRT_MULTITHREADED']=['_MT']
+	v['CPPDEFINES_CRT_MULTITHREADED_DLL']=['_MT','_DLL']
+	v['CPPFLAGS_CRT_MULTITHREADED_DBG']=['/MTd']
+	v['CPPFLAGS_CRT_MULTITHREADED_DLL_DBG']=['/MDd']
+	v['CPPDEFINES_CRT_MULTITHREADED_DBG']=['_DEBUG','_MT']
+	v['CPPDEFINES_CRT_MULTITHREADED_DLL_DBG']=['_DEBUG','_MT','_DLL']
+	v['CCFLAGS']=['/TC']
+	v['CCFLAGS_OPTIMIZED']=['/O2','/DNDEBUG']
+	v['CCFLAGS_RELEASE']=['/O2','/DNDEBUG']
+	v['CCFLAGS_DEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI']
+	v['CCFLAGS_ULTRADEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI']
+	v['CXXFLAGS']=['/TP']
+	v['CXXFLAGS_OPTIMIZED']=['/O2','/DNDEBUG']
+	v['CXXFLAGS_RELEASE']=['/O2','/DNDEBUG']
+	v['CXXFLAGS_DEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI']
+	v['CXXFLAGS_ULTRADEBUG']=['/Od','/RTC1','/D_DEBUG','/ZI']
+	v['LIB']=[]
+	v['LINK_TGT_F']='/OUT:'
+	v['LINK_SRC_F']=' '
+	v['LIB_ST']='%s.lib'
+	v['LIBPATH_ST']='/LIBPATH:%s'
+	v['STATICLIB_ST']='%s.lib'
+	v['STATICLIBPATH_ST']='/LIBPATH:%s'
+	v['CCDEFINES_ST']='/D%s'
+	v['CXXDEFINES_ST']='/D%s'
+	v['_LIBDIRFLAGS']=''
+	v['_LIBFLAGS']=''
+	v['SHLIB_MARKER']=''
+	v['STATICLIB_MARKER']=''
+	v['LINKFLAGS']=['/NOLOGO','/MACHINE:X86','/ERRORREPORT:PROMPT']
+	try:
+		debug_level=Options.options.debug_level.upper()
+	except AttributeError:
+		debug_level=ccroot.DEBUG_LEVELS.CUSTOM
+	v['CCFLAGS']+=v['CCFLAGS_'+debug_level]
+	v['CXXFLAGS']+=v['CXXFLAGS_'+debug_level]
+	v['LINKFLAGS']+=v['LINKFLAGS_'+debug_level]
+	v['shlib_CCFLAGS']=['']
+	v['shlib_CXXFLAGS']=['']
+	v['shlib_LINKFLAGS']=['/DLL']
+	v['shlib_PATTERN']='%s.dll'
+	v['staticlib_LINKFLAGS']=['']
+	v['staticlib_PATTERN']='%s.lib'
+	v['program_PATTERN']='%s.exe'
+def set_options(opt):
+	opt.add_option('-d','--debug-level',action='store',default=ccroot.DEBUG_LEVELS.DEBUG,help="Specify the debug level, does nothing if CFLAGS is set in the environment. [Allowed Values: '%s']"%"', '".join(ccroot.DEBUG_LEVELS.ALL),choices=ccroot.DEBUG_LEVELS.ALL,dest='debug_level')
+
+taskgen(apply_msvc_obj_vars)
+feature('cc','cxx')(apply_msvc_obj_vars)
+after('apply_obj_vars_cc')(apply_msvc_obj_vars)
+after('apply_obj_vars_cxx')(apply_msvc_obj_vars)
+taskgen(apply_link_msvc)
+feature('cc','cxx')(apply_link_msvc)
+after('apply_core')(apply_link_msvc)
+before('apply_obj_vars_cc')(apply_link_msvc)
+before('apply_obj_vars_cxx')(apply_link_msvc)
+taskgen(init_msvc)
+feature('cc','cxx')(init_msvc)
+before('apply_core')(init_msvc)
+conftest(find_msvc)
+conftest(msvc_common_flags)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/nasm.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/nasm.py
new file mode 100644
index 0000000..a2eac74
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/nasm.py
@@ -0,0 +1,31 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os
+import TaskGen,Task
+from TaskGen import taskgen,before,extension
+nasm_str='${NASM} ${NASM_FLAGS} ${NASM_INCLUDES} ${SRC} -o ${TGT}'
+EXT_NASM=['.s','.S','.asm','.ASM','.spp','.SPP']
+def apply_nasm_vars(self):
+	if hasattr(self,'nasm_flags'):
+		for flag in self.to_list(self.nasm_flags):
+			self.env.append_value('NASM_FLAGS',flag)
+	if hasattr(self,'includes'):
+		for inc in self.to_list(self.includes):
+			self.env.append_value('NASM_INCLUDES','-I %s'%inc.srcpath(self.env))
+def nasm_file(self,node):
+	o_node=node.change_ext('.o')
+	task=self.create_task('nasm')
+	task.set_inputs(node)
+	task.set_outputs(o_node)
+	self.compiled_tasks.append(task)
+	self.meths.append('apply_nasm_vars')
+Task.simple_task_type('nasm',nasm_str,color='BLUE',ext_out='.o')
+def detect(conf):
+	nasm=conf.find_program('nasm',var='NASM')
+	if not nasm:nasm=conf.find_program('yasm',var='NASM')
+	if not nasm:conf.fatal('could not find nasm (or yasm), install it or set PATH env var')
+
+taskgen(apply_nasm_vars)
+before('apply_link')(apply_nasm_vars)
+extension(EXT_NASM)(nasm_file)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ocaml.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ocaml.py
new file mode 100644
index 0000000..3e7bc3e
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/ocaml.py
@@ -0,0 +1,240 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,re
+import TaskGen,Utils,Task,Build
+from Logs import error
+from TaskGen import taskgen,feature,before,after,extension
+EXT_MLL=['.mll']
+EXT_MLY=['.mly']
+EXT_MLI=['.mli']
+EXT_MLC=['.c']
+EXT_ML=['.ml']
+open_re=re.compile('^\s*open\s+([a-zA-Z]+)(;;){0,1}$',re.M)
+foo=re.compile(r"""(\(\*)|(\*\))|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^()*"'\\]*)""",re.M)
+def filter_comments(txt):
+	meh=[0]
+	def repl(m):
+		if m.group(1):meh[0]+=1
+		elif m.group(2):meh[0]-=1
+		elif not meh[0]:return m.group(0)
+		return''
+	return foo.sub(repl,txt)
+def scan(self):
+	node=self.inputs[0]
+	code=filter_comments(node.read(self.env))
+	global open_re
+	names=[]
+	import_iterator=open_re.finditer(code)
+	if import_iterator:
+		for import_match in import_iterator:
+			names.append(import_match.group(1))
+	found_lst=[]
+	raw_lst=[]
+	for name in names:
+		nd=None
+		for x in self.incpaths:
+			nd=x.find_resource(name.lower()+'.ml')
+			if not nd:nd=x.find_resource(name+'.ml')
+			if nd:
+				found_lst.append(nd)
+				break
+		else:
+			raw_lst.append(name)
+	return(found_lst,raw_lst)
+native_lst=['native','all','c_object']
+bytecode_lst=['bytecode','all']
+class ocaml_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+TaskGen.bind_feature('ocaml','apply_core')
+def init_ml(self):
+	Utils.def_attrs(self,type='all',incpaths_lst=[],bld_incpaths_lst=[],mlltasks=[],mlytasks=[],mlitasks=[],native_tasks=[],bytecode_tasks=[],linktasks=[],bytecode_env=None,native_env=None,compiled_tasks=[],includes='',uselib='',out_nodes=[],are_deps_set=0)
+def init_envs_ml(self):
+	self.islibrary=getattr(self,'islibrary',False)
+	global native_lst,bytecode_lst
+	self.native_env=None
+	if self.type in native_lst:
+		self.native_env=self.env.copy()
+		if self.islibrary:self.native_env['OCALINKFLAGS']='-a'
+	self.bytecode_env=None
+	if self.type in bytecode_lst:
+		self.bytecode_env=self.env.copy()
+		if self.islibrary:self.bytecode_env['OCALINKFLAGS']='-a'
+	if self.type=='c_object':
+		self.native_env['OCALINK']=self.native_env['OCALINK']+' -output-obj'
+def apply_incpaths_ml(self):
+	inc_lst=self.includes.split()
+	lst=self.incpaths_lst
+	tree=Build.bld
+	for dir in inc_lst:
+		node=self.path.find_dir(dir)
+		if not node:
+			error("node not found: "+str(dir))
+			continue
+		Build.bld.rescan(node)
+		if not node in lst:lst.append(node)
+		self.bld_incpaths_lst.append(node)
+def apply_vars_ml(self):
+	for i in self.incpaths_lst:
+		if self.bytecode_env:
+			self.bytecode_env.append_value('OCAMLPATH','-I %s'%i.srcpath(self.env))
+			self.bytecode_env.append_value('OCAMLPATH','-I %s'%i.bldpath(self.env))
+		if self.native_env:
+			self.native_env.append_value('OCAMLPATH','-I %s'%i.bldpath(self.env))
+			self.native_env.append_value('OCAMLPATH','-I %s'%i.srcpath(self.env))
+	varnames=['INCLUDES','OCAMLFLAGS','OCALINKFLAGS','OCALINKFLAGS_OPT']
+	for name in self.uselib.split():
+		for vname in varnames:
+			cnt=self.env[vname+'_'+name]
+			if cnt:
+				if self.bytecode_env:self.bytecode_env.append_value(vname,cnt)
+				if self.native_env:self.native_env.append_value(vname,cnt)
+def apply_link_ml(self):
+	if self.bytecode_env:
+		ext=self.islibrary and'.cma'or'.run'
+		linktask=self.create_task('ocalink')
+		linktask.bytecode=1
+		linktask.set_outputs(self.path.find_or_declare(self.target+ext))
+		linktask.obj=self
+		linktask.env=self.bytecode_env
+		self.linktasks.append(linktask)
+	if self.native_env:
+		if getattr(self,'c_objects',''):ext='.o'
+		elif self.islibrary:ext='.cmxa'
+		else:ext=''
+		linktask=self.create_task('ocalinkx')
+		linktask.set_outputs(self.path.find_or_declare(self.target+ext))
+		linktask.obj=self
+		linktask.env=self.native_env
+		self.linktasks.append(linktask)
+		self.out_nodes+=linktask.outputs
+		if self.type=='c_object':self.compiled_tasks.append(linktask)
+def mll_hook(self,node):
+	mll_task=self.create_task('ocamllex',self.native_env)
+	mll_task.set_inputs(node)
+	mll_task.set_outputs(node.change_ext('.ml'))
+	self.mlltasks.append(mll_task)
+	self.allnodes.append(mll_task.outputs[0])
+def mly_hook(self,node):
+	mly_task=self.create_task('ocamlyacc',self.native_env)
+	mly_task.set_inputs(node)
+	mly_task.set_outputs([node.change_ext('.ml'),node.change_ext('.mli')])
+	self.mlytasks.append(mly_task)
+	self.allnodes.append(mly_task.outputs[0])
+	task=self.create_task('ocamlcmi',self.native_env)
+	task.set_inputs(mly_task.outputs[1])
+	task.set_outputs(mly_task.outputs[1].change_ext('.cmi'))
+def mli_hook(self,node):
+	task=self.create_task('ocamlcmi',self.native_env)
+	task.set_inputs(node)
+	task.set_outputs(node.change_ext('.cmi'))
+	self.mlitasks.append(task)
+def mlc_hook(self,node):
+	task=self.create_task('ocamlcc',self.native_env)
+	task.set_inputs(node)
+	task.set_outputs(node.change_ext('.o'))
+	self.out_nodes+=task.outputs
+def ml_hook(self,node):
+	if self.native_env:
+		task=self.create_task('ocamlx',self.native_env)
+		task.set_inputs(node)
+		task.set_outputs(node.change_ext('.cmx'))
+		task.obj=self
+		task.incpaths=self.bld_incpaths_lst
+		self.native_tasks.append(task)
+	if self.bytecode_env:
+		task=self.create_task('ocaml',self.bytecode_env)
+		task.set_inputs(node)
+		task.obj=self
+		task.bytecode=1
+		task.incpaths=self.bld_incpaths_lst
+		task.set_outputs(node.change_ext('.cmo'))
+		self.bytecode_tasks.append(task)
+def compile_may_start(self):
+	if not getattr(self,'flag_deps',''):
+		self.flag_deps=1
+		if getattr(self,'bytecode',''):alltasks=self.obj.bytecode_tasks
+		else:alltasks=self.obj.native_tasks
+		self.signature()
+		tree=Build.bld
+		env=self.env
+		for node in self.inputs:
+			lst=tree.node_deps[self.unique_id()]
+			for depnode in lst:
+				for t in alltasks:
+					if t==self:continue
+					if depnode in t.inputs:
+						self.set_run_after(t)
+		delattr(self,'cache_sig')
+		self.signature()
+	return Task.Task.runnable_status(self)
+b=Task.simple_task_type
+cls=b('ocamlx','${OCAMLOPT} ${OCAMLPATH} ${OCAMLFLAGS} ${INCLUDES} -c -o ${TGT} ${SRC}',color='GREEN')
+cls.runnable_status=compile_may_start
+cls.scan=scan
+b=Task.simple_task_type
+cls=b('ocaml','${OCAMLC} ${OCAMLPATH} ${OCAMLFLAGS} ${INCLUDES} -c -o ${TGT} ${SRC}',color='GREEN')
+cls.runnable_status=compile_may_start
+cls.scan=scan
+b('ocamlcmi','${OCAMLC} ${OCAMLPATH} ${INCLUDES} -o ${TGT} -c ${SRC}',color='BLUE',before="ocaml ocamlcc")
+b('ocamlcc','cd ${TGT[0].bld_dir(env)} && ${OCAMLOPT} ${OCAMLFLAGS} ${OCAMLPATH} ${INCLUDES} -c ${SRC[0].abspath(env)}',color='GREEN')
+b('ocamllex','${OCAMLLEX} ${SRC} -o ${TGT}',color='BLUE',before="ocamlcmi ocaml ocamlcc")
+b('ocamlyacc','${OCAMLYACC} -b ${TGT[0].bld_base(env)} ${SRC}',color='BLUE',before="ocamlcmi ocaml ocamlcc")
+def link_may_start(self):
+	if not getattr(self,'order',''):
+		if getattr(self,'bytecode',0):alltasks=self.obj.bytecode_tasks
+		else:alltasks=self.obj.native_tasks
+		seen=[]
+		pendant=[]+alltasks
+		while pendant:
+			task=pendant.pop(0)
+			if task in seen:continue
+			for x in task.run_after:
+				if not x in seen:
+					pendant.append(task)
+					break
+			else:
+				seen.append(task)
+		self.inputs=[x.outputs[0]for x in seen]
+		self.order=1
+	return Task.Task.runnable_status(self)
+act=b('ocalink','${OCAMLC} -o ${TGT} ${INCLUDES} ${OCALINKFLAGS} ${SRC}',color='YELLOW',after="ocaml ocamlcc")
+act.runnable_status=link_may_start
+act=b('ocalinkx','${OCAMLOPT} -o ${TGT} ${INCLUDES} ${OCALINKFLAGS_OPT} ${SRC}',color='YELLOW',after="ocamlx ocamlcc")
+act.runnable_status=link_may_start
+def detect(conf):
+	opt=conf.find_program('ocamlopt',var='OCAMLOPT')
+	occ=conf.find_program('ocamlc',var='OCAMLC')
+	if(not opt)or(not occ):
+		conf.fatal('The objective caml compiler was not found:\ninstall it or make it available in your PATH')
+	conf.env['OCAMLC']=occ
+	conf.env['OCAMLOPT']=opt
+	conf.env['OCAMLLEX']=conf.find_program('ocamllex',var='OCAMLLEX')
+	conf.env['OCAMLYACC']=conf.find_program('ocamlyacc',var='OCAMLYACC')
+	conf.env['OCAMLFLAGS']=''
+	conf.env['OCAMLLIB']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep
+	conf.env['LIBPATH_OCAML']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep
+	conf.env['CPPPATH_OCAML']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep
+	conf.env['LIB_OCAML']='camlrun'
+
+taskgen(init_ml)
+feature('ocaml')(init_ml)
+taskgen(init_envs_ml)
+feature('ocaml')(init_envs_ml)
+after('init_ml')(init_envs_ml)
+taskgen(apply_incpaths_ml)
+feature('ocaml')(apply_incpaths_ml)
+before('apply_vars_ml')(apply_incpaths_ml)
+after('init_envs_ml')(apply_incpaths_ml)
+taskgen(apply_vars_ml)
+feature('ocaml')(apply_vars_ml)
+before('apply_core')(apply_vars_ml)
+taskgen(apply_link_ml)
+feature('ocaml')(apply_link_ml)
+after('apply_core')(apply_link_ml)
+extension(EXT_MLL)(mll_hook)
+extension(EXT_MLY)(mly_hook)
+extension(EXT_MLI)(mli_hook)
+extension(EXT_MLC)(mlc_hook)
+extension(EXT_ML)(ml_hook)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/osx.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/osx.py
new file mode 100644
index 0000000..c89f4ba
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/osx.py
@@ -0,0 +1,105 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,shutil,sys
+import TaskGen,Task,Build,Options
+from TaskGen import taskgen,feature,after,before
+from Logs import error,debug
+def create_task_macapp(self):
+	if'cprogram'in self.features and self.link_task:
+		apptask=self.create_task('macapp',self.env)
+		apptask.set_inputs(self.link_task.outputs)
+		apptask.set_outputs(self.link_task.outputs[0].change_ext('.app'))
+		self.apptask=apptask
+def apply_link_osx(self):
+	if self.env['MACAPP']or getattr(self,'mac_app',False):
+		self.create_task_macapp()
+		name=self.link_task.outputs[0].name
+		if self.vnum:name=name.replace('.dylib','.%s.dylib'%self.vnum)
+		path=os.path.join(self.env['PREFIX'],lib,name)
+		path='-install_name %s'%path
+		self.env.append_value('LINKFLAGS',path)
+def apply_bundle(self):
+	if not'shlib'in self.features:return
+	if self.env['MACBUNDLE']or getattr(self,'mac_bundle',False):
+		self.env['shlib_PATTERN']='%s.bundle'
+		uselib=self.to_list(self.uselib)
+		if not'MACBUNDLE'in uselib:uselib.append('MACBUNDLE')
+def apply_bundle_remove_dynamiclib(self):
+	if not'shlib'in self.features:return
+	if self.env['MACBUNDLE']or getattr(self,'mac_bundle',False):
+		self.env["LINKFLAGS"].remove("-dynamiclib")
+		self.env.append_value("LINKFLAGS","-bundle")
+app_dirs=['Contents',os.path.join('Contents','MacOS'),os.path.join('Contents','Resources')]
+app_info='''
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleGetInfoString</key>
+	<string>Created by Waf</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>NOTE</key>
+	<string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
+	<key>CFBundleExecutable</key>
+	<string>%s</string>
+</dict>
+</plist>
+'''
+def app_build(task):
+	global app_dirs
+	env=task.env
+	i=0
+	for p in task.outputs:
+		srcfile=p.srcpath(env)
+		debug('osx: creating directories')
+		try:
+			os.mkdir(srcfile)
+			[os.makedirs(os.path.join(srcfile,d))for d in app_dirs]
+		except(OSError,IOError):
+			pass
+		srcprg=task.inputs[i].srcpath(env)
+		dst=os.path.join(srcfile,'Contents','MacOS')
+		debug('osx: copy %s to %s'%(srcprg,dst))
+		shutil.copy(srcprg,dst)
+		debug('osx: generate Info.plist')
+		f=file(os.path.join(srcfile,"Contents","Info.plist"),"w")
+		f.write(app_info%os.path.basename(srcprg))
+		f.close()
+		i+=1
+	return 0
+def install_shlib(task):
+	nums=task.vnum.split('.')
+	path=self.install_path
+	libname=task.outputs[0].name
+	name3=libname.replace('.dylib','.%s.dylib'%task.vnum)
+	name2=libname.replace('.dylib','.%s.dylib'%nums[0])
+	name1=libname
+	filename=task.outputs[0].abspath(task.env)
+	bld=Build.bld
+	bld.install_as(path+name3,filename,env=task.env)
+	bld.symlink_as(path+name2,name3)
+	bld.symlink_as(path+name1,name3)
+def install_target_osx_cshlib(self):
+	if not Options.is_install:return
+	if getattr(self,'vnum','')and sys.platform!='win32':
+		self.link_task.install=install_shlib
+Task.task_type_from_func('macapp',vars=[],func=app_build,after="cxx_link cc_link ar_link_static")
+
+taskgen(create_task_macapp)
+taskgen(apply_link_osx)
+after('apply_link')(apply_link_osx)
+feature('cc','cxx')(apply_link_osx)
+taskgen(apply_bundle)
+before('apply_link')(apply_bundle)
+before('apply_lib_vars')(apply_bundle)
+feature('cc','cxx')(apply_bundle)
+taskgen(apply_bundle_remove_dynamiclib)
+after('apply_link')(apply_bundle_remove_dynamiclib)
+feature('cc','cxx')(apply_bundle_remove_dynamiclib)
+taskgen(install_target_osx_cshlib)
+feature('osx')(install_target_osx_cshlib)
+after('install_target_cshlib')(install_target_osx_cshlib)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/perl.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/perl.py
new file mode 100644
index 0000000..0294183
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/perl.py
@@ -0,0 +1,78 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os
+import pproc
+import Task,Options,Utils
+from Configure import conf
+from TaskGen import extension,taskgen,feature,before
+xsubpp_str='${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}'
+EXT_XS=['.xs']
+def init_pyext(self):
+	self.uselib=self.to_list(getattr(self,'uselib',''))
+	if not'PERL'in self.uselib:self.uselib.append('PERL')
+	if not'PERLEXT'in self.uselib:self.uselib.append('PERLEXT')
+	self.env['shlib_PATTERN']=self.env['perlext_PATTERN']
+def xsubpp_file(self,node):
+	gentask=self.create_task('xsubpp')
+	gentask.set_inputs(node)
+	outnode=node.change_ext('.c')
+	gentask.set_outputs(outnode)
+	self.allnodes.append(outnode)
+Task.simple_task_type('xsubpp',xsubpp_str,color='BLUE',before="cc cxx")
+def check_perl_version(conf,minver=None):
+	res=True
+	if not getattr(Options.options,'perlbinary',None):
+		perl=conf.find_program("perl",var="PERL")
+		if not perl:
+			return False
+	else:
+		perl=Options.options.perlbinary
+		conf.env['PERL']=perl
+	version=Utils.cmd_output(perl+" -e'printf \"%vd\", $^V'")
+	if not version:
+		res=False
+		version="Unknown"
+	elif not minver is None:
+		ver=tuple(map(int,version.split(".")))
+		if ver<minver:
+			res=False
+	if minver is None:
+		cver=""
+	else:
+		cver=".".join(map(str,minver))
+	conf.check_message("perl",cver,res,version)
+	return res
+def check_perl_module(conf,module):
+	cmd=[conf.env['PERL'],'-e','use %s'%module]
+	r=pproc.call(cmd,stdout=pproc.PIPE,stderr=pproc.PIPE)==0
+	conf.check_message("perl module %s"%module,"",r)
+	return r
+def check_perl_ext_devel(conf):
+	if not conf.env['PERL']:
+		return False
+	perl=conf.env['PERL']
+	conf.env["LINKFLAGS_PERLEXT"]=Utils.cmd_output(perl+" -MConfig -e'print $Config{lddlflags}'")
+	conf.env["CPPPATH_PERLEXT"]=Utils.cmd_output(perl+" -MConfig -e'print \"$Config{archlib}/CORE\"'")
+	conf.env["CCFLAGS_PERLEXT"]=Utils.cmd_output(perl+" -MConfig -e'print \"$Config{ccflags} $Config{cccdlflags}\"'")
+	conf.env["XSUBPP"]=Utils.cmd_output(perl+" -MConfig -e'print \"$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}\"'")
+	conf.env["EXTUTILS_TYPEMAP"]=Utils.cmd_output(perl+" -MConfig -e'print \"$Config{privlib}/ExtUtils/typemap\"'")
+	if not getattr(Options.options,'perlarchdir',None):
+		conf.env["ARCHDIR_PERL"]=Utils.cmd_output(perl+" -MConfig -e'print $Config{sitearch}'")
+	else:
+		conf.env["ARCHDIR_PERL"]=getattr(Options.options,'perlarchdir')
+	conf.env['perlext_PATTERN']='%s.'+Utils.cmd_output(perl+" -MConfig -e'print $Config{dlext}'")
+	return True
+def detect(conf):
+	pass
+def set_options(opt):
+	opt.add_option("--with-perl-binary",type="string",dest="perlbinary",help='Specify alternate perl binary',default=None)
+	opt.add_option("--with-perl-archdir",type="string",dest="perlarchdir",help='Specify directory where to install arch specific files',default=None)
+
+taskgen(init_pyext)
+before('apply_incpaths')(init_pyext)
+feature('perlext')(init_pyext)
+extension(EXT_XS)(xsubpp_file)
+conf(check_perl_version)
+conf(check_perl_module)
+conf(check_perl_ext_devel)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/preproc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/preproc.py
new file mode 100644
index 0000000..087db71
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/preproc.py
@@ -0,0 +1,500 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import re,sys,os,string,types
+if __name__=='__main__':
+	sys.path=['.','..']+sys.path
+import Logs,Build,Utils
+from Logs import debug,error
+import traceback
+class PreprocError(Utils.WafError):
+	pass
+POPFILE='-'
+go_absolute=0
+standard_includes=['/usr/include']
+if sys.platform=="win32":
+	standard_includes=[]
+use_trigraphs=0
+'apply the trigraph rules first'
+strict_quotes=0
+g_optrans={'not':'!','and':'&&','bitand':'&','and_eq':'&=','or':'||','bitor':'|','or_eq':'|=','xor':'^','xor_eq':'^=','compl':'~',}
+re_lines=re.compile('^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*)\r*$',re.IGNORECASE|re.MULTILINE)
+re_mac=re.compile("^[a-zA-Z_]\w*")
+re_fun=re.compile('^[a-zA-Z_][a-zA-Z0-9_]*[(]')
+re_pragma_once=re.compile('^\s*once\s*',re.IGNORECASE)
+re_nl=re.compile('\\\\\r*\n',re.MULTILINE)
+re_cpp=re.compile(r"""(/\*[^*]*\*+([^/*][^*]*\*+)*/)|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)""",re.MULTILINE)
+trig_def=[('??'+a,b)for a,b in zip("=-/!'()<>",r'#~\|^[]{}')]
+chr_esc={'0':0,'a':7,'b':8,'t':9,'n':10,'f':11,'v':12,'r':13,'\\':92,"'":39}
+NUM='i'
+OP='O'
+IDENT='T'
+STR='s'
+CHAR='c'
+tok_types=[NUM,STR,IDENT,OP]
+exp_types=[r"""0[xX](?P<hex>[a-fA-F0-9]+)(?P<qual1>[uUlL]*)|L*?'(?P<char>(\\.|[^\\'])+)'|(?P<n1>\d+)[Ee](?P<exp0>[+-]*?\d+)(?P<float0>[fFlL]*)|(?P<n2>\d*\.\d+)([Ee](?P<exp1>[+-]*?\d+))?(?P<float1>[fFlL]*)|(?P<n4>\d+\.\d*)([Ee](?P<exp2>[+-]*?\d+))?(?P<float2>[fFlL]*)|(?P<oct>0*)(?P<n0>\d+)(?P<qual2>[uUlL]*)""",r'L?"([^"\\]|\\.)*"',r'[a-zA-Z_]\w*',r'%:%:|<<=|>>=|\.\.\.|<<|<%|<:|<=|>>|>=|\+\+|\+=|--|->|-=|\*=|/=|%:|%=|%>|==|&&|&=|\|\||\|=|\^=|:>|!=|##|[\(\)\{\}\[\]<>\?\|\^\*\+&=:!#;,%/\-\?\~\.]',]
+re_clexer=re.compile('|'.join(["(?P<%s>%s)"%(name,part)for name,part in zip(tok_types,exp_types)]),re.M)
+accepted='a'
+ignored='i'
+undefined='u'
+skipped='s'
+def repl(m):
+	s=m.group(1)
+	if s is not None:return' '
+	s=m.group(3)
+	if s is None:return''
+	return s
+def filter_comments(filename):
+	f=open(filename,"r")
+	code=f.read()
+	f.close()
+	if use_trigraphs:
+		for(a,b)in trig_def:code=code.split(a).join(b)
+	code=re_nl.sub('',code)
+	code=re_cpp.sub(repl,code)
+	return[(m.group(2),m.group(3))for m in re.finditer(re_lines,code)]
+prec={}
+ops=['* / %','+ -','<< >>','< <= >= >','== !=','& | ^','&& ||',',']
+for x in range(len(ops)):
+	syms=ops[x]
+	for u in syms.split():
+		prec[u]=x
+def reduce_nums(val_1,val_2,val_op):
+	try:a=0+val_1
+	except TypeError:a=int(val_1)
+	try:b=0+val_2
+	except TypeError:b=int(val_2)
+	d=val_op
+	if d=='%':c=a%b
+	elif d=='+':c=a+b
+	elif d=='-':c=a-b
+	elif d=='*':c=a*b
+	elif d=='/':c=a/b
+	elif d=='^':c=a^b
+	elif d=='|':c=a|b
+	elif d=='||':c=int(a or b)
+	elif d=='&':c=a&b
+	elif d=='&&':c=int(a and b)
+	elif d=='==':c=int(a==b)
+	elif d=='!=':c=int(a!=b)
+	elif d=='<=':c=int(a<=b)
+	elif d=='<':c=int(a<b)
+	elif d=='>':c=int(a>b)
+	elif d=='>=':c=int(a>=b)
+	elif d=='^':c=int(a^b)
+	elif d=='<<':c=a<<b
+	elif d=='>>':c=a>>b
+	else:c=0
+	return c
+def get_expr(lst,defs,ban):
+	if not lst:return([],[],[])
+	(p,v)=lst[0]
+	if p==NUM:
+		return(p,v,lst[1:])
+	elif p==STR:
+		try:
+			(p2,v2)=lst[1]
+			if p2==STR:return(p,v+v2,lst[2:])
+		except IndexError:pass
+		return(p,v,lst[1:])
+	elif p==OP:
+		if v in['+','-','!','~','#']:
+			(p2,v2,lst2)=get_expr(lst[1:],defs,ban)
+			if v=='#':
+				if p2!=IDENT:raise PreprocError,"ident expected %s"%str(lst)
+				return get_expr([(STR,v2)]+lst2,defs,ban)
+			if p2!=NUM:raise PreprocError,"num expected %s"%str(lst)
+			if v=='+':return(p2,v2,lst2)
+			elif v=='-':return(p2,-int(v2),lst2)
+			elif v=='!':return(p2,int(not int(v2)),lst2)
+			elif v=='~':return(p2,~int(v2),lst2)
+			return(p2,v2,lst2)
+		elif v=='(':
+			count_par=0
+			i=0
+			for _,v in lst:
+				if v==')':
+					count_par-=1
+					if count_par==0:break
+				elif v=='(':count_par+=1
+				i+=1
+			else:
+				raise PreprocError,"rparen expected %s"%str(lst)
+			ret=process_tokens(lst[1:i],defs,ban)
+			if len(ret)==1:
+				(p,v)=ret[0]
+				return(p,v,lst[i+1:])
+			else:
+				raise PreprocError,"cannot reduce %s"%str(lst)
+	elif p==IDENT:
+		if len(lst)>1:
+			(p2,v2)=lst[1]
+			if v2=="##":
+				(p3,v3)=lst[2]
+				if p3!=IDENT and p3!=NUM and p3!=OP:
+					raise PreprocError,"%s: ident expected after '##'"%str(lst)
+				return get_expr([(p,v+v3)]+lst[3:],defs,ban)
+		if v.lower()=='defined':
+			(p2,v2)=lst[1]
+			off=2
+			if v2=='(':
+				(p2,v2)=lst[2]
+				if p2!=IDENT:raise PreprocError,'expected an identifier after a "defined("'
+				(p3,v3)=lst[3]
+				if v3!=')':raise PreprocError,'expected a ")" after a "defined(x"'
+				off=4
+			elif p2!=IDENT:
+				raise PreprocError,'expected a "(" or an identifier after a defined'
+			x=0
+			if v2 in defs:x=1
+			return(NUM,x,lst[off:])
+		elif not v in defs or v in ban:
+			if"waf_include"in ban:return(p,v,lst[1:])
+			else:return(NUM,0,lst[1:])
+		if type(defs[v])is types.StringType:
+			v,k=extract_macro(defs[v])
+			defs[v]=k
+		macro_def=defs[v]
+		if not macro_def[0]:
+			lst=macro_def[1]+lst[1:]
+			return get_expr(lst,defs,ban)
+		else:
+			params=[]
+			i=1
+			p2,v2=lst[i]
+			if p2!=OP or v2!='(':raise PreprocError,"invalid function call '%s'"%v
+			one_param=[]
+			count_paren=0
+			try:
+				while 1:
+					i+=1
+					p2,v2=lst[i]
+					if p2==OP and count_paren==0:
+						if v2=='(':
+							one_param.append((p2,v2))
+							count_paren+=1
+						elif v2==')':
+							if one_param:params.append(one_param)
+							lst=lst[i+1:]
+							break
+						elif v2==',':
+							if not one_param:raise PreprocError,"empty param in funcall %s"%p
+							params.append(one_param)
+							one_param=[]
+						else:
+							one_param.append((p2,v2))
+					else:
+						one_param.append((p2,v2))
+						if v2=='(':count_paren+=1
+						elif v2==')':count_paren-=1
+			except IndexError,e:
+				raise
+			accu=[]
+			table=macro_def[0]
+			for p2,v2 in macro_def[1]:
+				if p2==IDENT and v2 in table:accu+=params[table[v2]]
+				else:
+					if v2=='__VA_ARGS__':
+						va_toks=[]
+						st=len(macro_def[0])
+						pt=len(params)
+						for x in params[pt-st+1:]:
+							va_toks.extend(x)
+							va_toks.append((OP,','))
+						if va_toks:va_toks.pop()
+						if len(accu)>1:
+							(p3,v3)=accu[-1]
+							(p4,v4)=accu[-2]
+							if v3=='##':
+								accu.pop()
+								if v4==','and pt<st:
+									accu.pop()
+						accu+=va_toks
+					else:
+						accu.append((p2,v2))
+			return get_expr(accu+lst,defs,ban+[v])
+def process_tokens(lst,defs,ban):
+	accu=[]
+	while lst:
+		p,v,nlst=get_expr(lst,defs,ban)
+		if p==NUM:
+			if not nlst:return[(p,v)]
+			op1,ov1=nlst[0]
+			if op1!=OP:
+				raise PreprocError,"op expected %s"%str(lst)
+			if ov1=='?':
+				i=0
+				count_par=0
+				for _,k in nlst:
+					if k==')':count_par-=1
+					elif k=='(':count_par+=1
+					elif k==':'and count_par==0:break
+					i+=1
+				else:raise PreprocError,"ending ':' expected %s"%str(lst)
+				if reduce_nums(v,0,'+'):lst=nlst[1:i]
+				else:lst=nlst[i+1:]
+				continue
+			elif ov1==',':
+				lst=nlst[1:]
+				continue
+			p2,v2,nlst=get_expr(nlst[1:],defs,ban)
+			if p2!=NUM:raise PreprocError,"num expected after op %s"%str(lst)
+			if nlst:
+				op3,ov3=nlst[0]
+				if prec[ov3]<prec[ov1]:
+					p4,v4,nlst2=get_expr(nlst[1:],defs,ban)
+					v5=reduce_nums(v2,v4,ov3)
+					lst=[(p,v),(op1,ov1),(NUM,v5)]+nlst2
+					continue
+			lst=[(NUM,reduce_nums(v,v2,ov1))]+nlst
+			continue
+		elif p==STR:
+			if nlst:raise PreprocError,"sequence must terminate with a string %s"%str(nlst)
+			return[(p,v)]
+		return(None,None,[])
+def eval_macro(lst,adefs):
+	ret=process_tokens(lst,adefs,[])
+	if not ret:raise PreprocError,"missing tokens to evaluate %s"%str(lst)
+	p,v=ret[0]
+	return int(v)!=0
+class c_parser(object):
+	def __init__(self,nodepaths=None,defines=None):
+		self.lines=[]
+		if defines is None:
+			self.defs={}
+		else:
+			self.defs=dict(defines)
+		self.state=[]
+		self.env=None
+		self.count_files=0
+		self.deps=[]
+		self.deps_paths=[]
+		self.currentnode_stack=[]
+		self.nodepaths=nodepaths or[]
+		self.nodes=[]
+		self.names=[]
+		self.curfile=''
+		self.ban_includes=[]
+		try:
+			self.parse_cache=Build.bld.parse_cache
+		except AttributeError:
+			Build.bld.parse_cache={}
+			self.parse_cache=Build.bld.parse_cache
+	def tryfind(self,filename):
+		self.curfile=filename
+		found=self.currentnode_stack[-1].find_resource(filename)
+		for n in self.nodepaths:
+			if found:
+				break
+			found=n.find_resource(filename)
+		if not found:
+			if not filename in self.names:
+				self.names.append(filename)
+			return
+		self.nodes.append(found)
+		if filename[-4:]!='.moc':
+			self.addlines(found)
+	def addlines(self,node):
+		self.currentnode_stack.append(node.parent)
+		filepath=node.abspath(self.env)
+		self.count_files+=1
+		if self.count_files>30000:raise PreprocError,"recursion limit exceeded, bailing out"
+		pc=self.parse_cache
+		debug('preproc: reading file %r'%filepath)
+		try:
+			lns=pc[filepath]
+		except KeyError:
+			pass
+		else:
+			self.lines=lns+self.lines
+			return
+		try:
+			lines=filter_comments(filepath)
+			lines.append((POPFILE,''))
+			pc[filepath]=lines
+			self.lines=lines+self.lines
+		except IOError:
+			raise PreprocError,"could not read the file %s"%filepath
+		except Exception:
+			if Logs.verbose>0:
+				error("parsing %s failed"%filepath)
+				traceback.print_exc()
+	def start(self,node,env):
+		debug('preproc: scanning %s (in %s)'%(node.name,node.parent.name))
+		self.env=env
+		variant=node.variant(env)
+		self.addlines(node)
+		if env['DEFLINES']:
+			self.lines=[('define',x)for x in env['DEFLINES']]+self.lines
+		while self.lines:
+			(type,line)=self.lines.pop(0)
+			if type==POPFILE:
+				self.currentnode_stack.pop()
+				continue
+			try:
+				self.process_line(type,line)
+			except Exception,ex:
+				if Logs.verbose:
+					error("line parsing failed (%s): %s"%(str(ex),line))
+					traceback.print_exc()
+	def process_line(self,token,line):
+		ve=Logs.verbose
+		if ve:debug('preproc: line is %s - %s state is %s'%(token,line,self.state))
+		state=self.state
+		if token in['ifdef','ifndef','if']:
+			state.append(undefined)
+		elif token=='endif':
+			state.pop()
+		if not token in['else','elif','endif']:
+			if skipped in self.state or ignored in self.state:
+				return
+		if token=='if':
+			ret=eval_macro(tokenize(line),self.defs)
+			if ret:state[-1]=accepted
+			else:state[-1]=ignored
+		elif token=='ifdef':
+			m=re_mac.search(line)
+			if m and m.group(0)in self.defs:state[-1]=accepted
+			else:state[-1]=ignored
+		elif token=='ifndef':
+			m=re_mac.search(line)
+			if m and m.group(0)in self.defs:state[-1]=ignored
+			else:state[-1]=accepted
+		elif token=='include'or token=='import':
+			(type,inc)=extract_include(line,self.defs)
+			if inc in self.ban_includes:return
+			if token=='import':self.ban_includes.append(inc)
+			if ve:debug('preproc: include found %s    (%s) '%(inc,type))
+			if type=='"'or not strict_quotes:
+				if not inc in self.deps:
+					self.deps.append(inc)
+				self.tryfind(inc)
+		elif token=='elif':
+			if state[-1]==accepted:
+				state[-1]=skipped
+			elif state[-1]==ignored:
+				if eval_macro(tokenize(line),self.defs):
+					state[-1]=accepted
+		elif token=='else':
+			if state[-1]==accepted:state[-1]=skipped
+			elif state[-1]==ignored:state[-1]=accepted
+		elif token=='define':
+			m=re_mac.search(line)
+			if m:
+				name=m.group(0)
+				if ve:debug('preproc: define %s   %s'%(name,line))
+				self.defs[name]=line
+			else:
+				raise PreprocError,"invalid define line %s"%line
+		elif token=='undef':
+			m=re_mac.search(line)
+			if m and m.group(0)in self.defs:
+				self.defs.__delitem__(m.group(0))
+		elif token=='pragma':
+			if re_pragma_once.search(line.lower()):
+				self.ban_includes.append(self.curfile)
+def extract_macro(txt):
+	t=tokenize(txt)
+	if re_fun.search(txt):
+		p,name=t[0]
+		p,v=t[1]
+		if p!=OP:raise PreprocError,"expected open parenthesis"
+		i=1
+		pindex=0
+		params={}
+		prev='('
+		while 1:
+			i+=1
+			p,v=t[i]
+			if prev=='(':
+				if p==IDENT:
+					params[v]=pindex
+					pindex+=1
+					prev=p
+				elif p==OP and v==')':
+					break
+				else:
+					raise PreprocError,"unexpected token"
+			elif prev==IDENT:
+				if p==OP and v==',':
+					prev=v
+				elif p==OP and v==')':
+					break
+				else:
+					raise PreprocError,"comma or ... expected"
+			elif prev==',':
+				if p==IDENT:
+					params[v]=pindex
+					pindex+=1
+					prev=p
+				elif p==OP and v=='...':
+					raise PreprocError,"not implemented"
+				else:
+					raise PreprocError,"comma or ... expected"
+			elif prev=='...':
+				raise PreprocError,"not implemented"
+			else:
+				raise PreprocError,"unexpected else"
+		print(name,[params,t[i+1:]])
+		return(name,[params,t[i+1:]])
+	else:
+		(p,v)=t[0]
+		return(v,[[],t[1:]])
+re_include=re.compile('^\s*(<(?P<a>.*)>|"(?P<b>.*)")')
+def extract_include(txt,defs):
+	m=re_include.search(txt)
+	if m:
+		if m.group('a'):return'<',m.group('a')
+		if m.group('b'):return'"',m.group('b')
+	tokens=tokenize(txt)
+	tokens=process_tokens(tokens,defs,['waf_include'])
+	p,v=tokens[0]
+	if p!=STR:raise PreprocError,"could not parse include %s"%txt
+	return('"',v)
+def parse_char(txt):
+	if not txt:raise PreprocError,"attempted to parse a null char"
+	if txt[0]!='\\':
+		return ord(txt)
+	c=txt[1]
+	if c=='x':
+		if len(txt)==4 and txt[3]in string.hexdigits:return int(txt[2:],16)
+		return int(txt[2:],16)
+	elif c.isdigit():
+		if c=='0'and len(txt)==2:return 0
+		for i in 3,2,1:
+			if len(txt)>i and txt[1:1+i].isdigit():
+				return(1+i,int(txt[1:1+i],8))
+	else:
+		try:return chr_esc[c]
+		except KeyError:raise PreprocError,"could not parse char literal '%s'"%txt
+def tokenize(s):
+	ret=[]
+	for match in re_clexer.finditer(s):
+		m=match.group
+		for name in tok_types:
+			v=m(name)
+			if v:
+				if name==IDENT:
+					try:v=g_optrans[v];name=OP
+					except KeyError:
+						if v.lower()=="true":
+							v=1
+							name=NUM
+						elif v.lower()=="false":
+							v=0
+							name=NUM
+				elif name==NUM:
+					if m('oct'):v=int(v,8)
+					elif m('hex'):v=int(m('hex'),16)
+					elif m('n0'):v=m('n0')
+					else:
+						v=m('char')
+						if v:v=parse_char(v)
+						else:v=m('n2')or m('n4')
+				elif name==OP:
+					if v=='%:':v='#'
+					elif v=='%:%:':v='##'
+				ret.append((name,v))
+				break
+	return ret
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/python.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/python.py
new file mode 100644
index 0000000..88ff061
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/python.py
@@ -0,0 +1,260 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys
+import TaskGen,Utils,Utils,Runner,Options,Build
+from Logs import debug,warn
+from TaskGen import extension,taskgen,before,after,feature
+from Configure import conf
+import pproc
+EXT_PY=['.py']
+def init_pyext(self):
+	self.default_install_path='${PYTHONDIR}'
+	self.uselib=self.to_list(getattr(self,'uselib',''))
+	if not'PYEXT'in self.uselib:
+		self.uselib.append('PYEXT')
+	self.env['MACBUNDLE']=True
+def pyext_shlib_ext(self):
+	self.env['shlib_PATTERN']=self.env['pyext_PATTERN']
+def init_pyembed(self):
+	self.uselib=self.to_list(getattr(self,'uselib',''))
+	if not'PYEMBED'in self.uselib:
+		self.uselib.append('PYEMBED')
+def process_py(self,node):
+	if Options.is_install and self.install_path:
+		installed_files=Build.bld.install_files(self.install_path,node.abspath(self.env),self.env,self.chmod)
+		if Options.commands['uninstall']:
+			print"* removing byte compiled python files"
+			for fname in installed_files:
+				try:
+					os.remove(fname+'c')
+				except OSError:
+					pass
+				try:
+					os.remove(fname+'o')
+				except OSError:
+					pass
+		if Options.commands['install']:
+			if self.env['PYC']or self.env['PYO']:
+				print"* byte compiling python files"
+			if self.env['PYC']:
+				program=("""
+import sys, py_compile
+for pyfile in sys.argv[1:]:
+	py_compile.compile(pyfile, pyfile + 'c')
+""")
+				argv=[self.env['PYTHON'],"-c",program]
+				argv.extend(installed_files)
+				retval=pproc.Popen(argv).wait()
+				if retval:
+					raise Utils.WafError("bytecode compilation failed")
+			if self.env['PYO']:
+				program=("""
+import sys, py_compile
+for pyfile in sys.argv[1:]:
+	py_compile.compile(pyfile, pyfile + 'o')
+""")
+				argv=[self.env['PYTHON'],self.env['PYFLAGS_OPT'],"-c",program]
+				argv.extend(installed_files)
+				retval=pproc.Popen(argv).wait()
+				if retval:
+					raise Utils.WafError("bytecode compilation failed")
+class py_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def init_py(self):
+	self.default_install_path='${PYTHONDIR}'
+def _get_python_variables(python_exe,variables,imports=['import sys']):
+	program=list(imports)
+	program.append('')
+	for v in variables:
+		program.append("print repr(%s)"%v)
+	proc=pproc.Popen([python_exe,"-c",'\n'.join(program)],stdout=pproc.PIPE)
+	output=proc.communicate()[0].split("\n")
+	if proc.returncode:
+		if Logs.verbose:
+			warn("Python program to extract python configuration variables failed:\n%s"%'\n'.join(["line %03i: %s"%(lineno+1,line)for lineno,line in enumerate(program)]))
+		raise ValueError
+	return_values=[]
+	for s in output:
+		s=s.strip()
+		if not s:
+			continue
+		if s=='None':
+			return_values.append(None)
+		elif s[0]=="'"and s[-1]=="'":
+			return_values.append(s[1:-1])
+		elif s[0].isdigit():
+			return_values.append(int(s))
+		else:break
+	return return_values
+def check_python_headers(conf):
+	env=conf.env
+	python=env['PYTHON']
+	assert python,("python is %r !"%(python,))
+	if Options.platform=='darwin':
+		conf.check_tool('osx')
+	try:
+		v='prefix SO SYSLIBS SHLIBS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED'.split()
+		(python_prefix,python_SO,python_SYSLIBS,python_SHLIBS,python_LIBDIR,python_LIBPL,INCLUDEPY,Py_ENABLE_SHARED)=_get_python_variables(python,["get_config_var('%s')"%x for x in v],['from distutils.sysconfig import get_config_var'])
+	except ValueError:
+		conf.fatal("Python development headers not found (-v for details).")
+	conf.log.write("""Configuration returned from %r:
+python_prefix = %r
+python_SO = %r
+python_SYSLIBS = %r
+python_SHLIBS = %r
+python_LIBDIR = %r
+python_LIBPL = %r
+INCLUDEPY = %r
+Py_ENABLE_SHARED = %r
+"""%(python,python_prefix,python_SO,python_SYSLIBS,python_SHLIBS,python_LIBDIR,python_LIBPL,INCLUDEPY,Py_ENABLE_SHARED))
+	env['pyext_PATTERN']='%s'+python_SO
+	if python_SYSLIBS is not None:
+		for lib in python_SYSLIBS.split():
+			if lib.startswith('-l'):
+				lib=lib[2:]
+			env.append_value('LIB_PYEMBED',lib)
+	if python_SHLIBS is not None:
+		for lib in python_SHLIBS.split():
+			if lib.startswith('-l'):
+				lib=lib[2:]
+			env.append_value('LIB_PYEMBED',lib)
+	code='''
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void Py_Initialize(void);
+ void Py_Finalize(void);
+#ifdef __cplusplus
+}
+#endif
+int main(int argc, char *argv[]) { Py_Initialize(); Py_Finalize(); return 0; }
+'''
+	result=1
+	name='python'+env['PYTHON_VERSION']
+	if python_LIBDIR is not None:
+		path=[python_LIBDIR]
+		result=conf.check_cc(lib=name,uselib='PYEMBED',libpath=path)
+	if result and python_LIBPL is not None:
+		path=[python_LIBPL]
+		result=conf.check_cc(lib=name,uselib='PYEMBED',libpath=path)
+	if result:
+		path=[os.path.join(python_prefix,"libs")]
+		name='python'+env['PYTHON_VERSION'].replace('.','')
+		result=conf.check_cc(lib=name,uselib='PYEMBED',libpath=path)
+	if not result:
+		env['LIBPATH_PYEMBED']=path
+		env.append_value('LIB_PYEMBED',name)
+	if(sys.platform=='win32'or sys.platform.startswith('os2')or sys.platform=='darwin'or Py_ENABLE_SHARED):
+		env['LIBPATH_PYEXT']=env['LIBPATH_PYEMBED']
+		env['LIB_PYEXT']=env['LIB_PYEMBED']
+	python_config=conf.find_program('python%s-config'%('.'.join(env['PYTHON_VERSION'].split('.')[:2])),var='PYTHON_CONFIG')
+	if python_config:
+		includes=[]
+		for incstr in os.popen("%s %s --includes"%(python,python_config)).readline().strip().split():
+			if(incstr.startswith('-I')or incstr.startswith('/I')):
+				incstr=incstr[2:]
+			if incstr not in includes:
+				includes.append(incstr)
+		conf.log.write("Include path for Python extensions ""(found via python-config --includes): %r\n"%(list(includes),))
+		env['CPPPATH_PYEXT']=list(includes)
+		env['CPPPATH_PYEMBED']=list(includes)
+	else:
+		conf.log.write("Include path for Python extensions ""(found via distutils module): %r\n"%(list(includes),))
+		env['CPPPATH_PYEXT']=[INCLUDEPY]
+		env['CPPPATH_PYEMBED']=[INCLUDEPY]
+	if env['CC']:
+		version=os.popen("%s --version"%env['CC']).readline()
+		if'(GCC)'in version or'gcc'in version:
+			env.append_value('CCFLAGS_PYEMBED','-fno-strict-aliasing')
+			env.append_value('CCFLAGS_PYEXT','-fno-strict-aliasing')
+	if env['CXX']:
+		version=os.popen("%s --version"%env['CXX']).readline()
+		if'(GCC)'in version or'g++'in version:
+			env.append_value('CXXFLAGS_PYEMBED','-fno-strict-aliasing')
+			env.append_value('CXXFLAGS_PYEXT','-fno-strict-aliasing')
+	test_env=env.copy()
+	test_env.append_value('CPPPATH',env['CPPPATH_PYEMBED'])
+	test_env.append_value('LIBPATH',env['LIBPATH_PYEMBED'])
+	test_env.append_value('LIB',env['LIB_PYEMBED'])
+	test_env.append_value('CXXFLAGS',env['CXXFLAGS_PYEMBED'])
+	test_env.append_value('CCFLAGS',env['CCFLAGS_PYEMBED'])
+	conf.check_cc(header_name='Python.h',define_name='HAVE_PYTHON_H',env=test_env,fragment='''#include <Python.h>\nint main(int argc, char *argv[]) { Py_Initialize(); Py_Finalize(); return 0; }\n''',errmsg='Could not find the python development headers',mandatory=1)
+def check_python_version(conf,minver=None):
+	assert minver is None or isinstance(minver,tuple)
+	python=conf.env['PYTHON']
+	assert python,("python is %r !"%(python,))
+	cmd=[python,"-c","import sys\nfor x in sys.version_info: print str(x)"]
+	debug('python: Running python command %r'%cmd)
+	proc=pproc.Popen(cmd,stdout=pproc.PIPE)
+	lines=proc.communicate()[0].split()
+	assert len(lines)==5,"found %i lines, expected 5: %r"%(len(lines),lines)
+	pyver_tuple=(int(lines[0]),int(lines[1]),int(lines[2]),lines[3],int(lines[4]))
+	result=(minver is None)or(pyver_tuple>=minver)
+	if result:
+		pyver='.'.join([str(x)for x in pyver_tuple[:2]])
+		conf.env['PYTHON_VERSION']=pyver
+		if'PYTHONDIR'in os.environ:
+			pydir=os.environ['PYTHONDIR']
+		else:
+			if sys.platform=='win32':
+				(python_LIBDEST,)=_get_python_variables(python,["get_config_var('LIBDEST')"],['from distutils.sysconfig import get_config_var'])
+			else:
+				python_LIBDEST=None
+			if python_LIBDEST is None:
+				if conf.env['LIBDIR']:
+					python_LIBDEST=os.path.join(conf.env['LIBDIR'],"python"+pyver)
+				else:
+					python_LIBDEST=os.path.join(conf.env['PREFIX'],"lib","python"+pyver)
+			pydir=os.path.join(python_LIBDEST,"site-packages")
+		if hasattr(conf,'define'):
+			conf.define('PYTHONDIR',pydir)
+		conf.env['PYTHONDIR']=pydir
+	pyver_full='.'.join(map(str,pyver_tuple[:3]))
+	if minver is None:
+		conf.check_message_custom('Python version','',pyver_full)
+	else:
+		minver_str='.'.join(map(str,minver))
+		conf.check_message('Python version',">= %s"%(minver_str,),result,option=pyver_full)
+	if not result:
+		conf.fatal("Python too old.")
+def check_python_module(conf,module_name):
+	result=not pproc.Popen([conf.env['PYTHON'],"-c","import %s"%module_name],stderr=pproc.PIPE,stdout=pproc.PIPE).wait()
+	conf.check_message('Python module',module_name,result)
+	if not result:
+		conf.fatal("Python module not found.")
+def detect(conf):
+	python=conf.find_program('python',var='PYTHON')
+	if not python:return
+	v=conf.env
+	v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"'
+	v['PYFLAGS']=''
+	v['PYFLAGS_OPT']='-O'
+	v['PYC']=getattr(Options.options,'pyc',1)
+	v['PYO']=getattr(Options.options,'pyo',1)
+def set_options(opt):
+	opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc')
+	opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo')
+
+taskgen(init_pyext)
+before('apply_incpaths')(init_pyext)
+feature('pyext')(init_pyext)
+before('apply_bundle')(init_pyext)
+taskgen(pyext_shlib_ext)
+before('apply_link')(pyext_shlib_ext)
+before('apply_lib_vars')(pyext_shlib_ext)
+after('apply_bundle')(pyext_shlib_ext)
+feature('pyext')(pyext_shlib_ext)
+taskgen(init_pyembed)
+before('apply_incpaths')(init_pyembed)
+feature('pyembed')(init_pyembed)
+extension(EXT_PY)(process_py)
+taskgen(init_py)
+before('apply_core')(init_py)
+after('vars_target_cprogram')(init_py)
+after('vars_target_cstaticlib')(init_py)
+feature('py')(init_py)
+conf(check_python_headers)
+conf(check_python_version)
+conf(check_python_module)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/qt4.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/qt4.py
new file mode 100644
index 0000000..b6725b2
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/qt4.py
@@ -0,0 +1,377 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+try:
+	from xml.sax import make_parser
+	from xml.sax.handler import ContentHandler
+except ImportError:
+	has_xml=False
+	ContentHandler=object
+else:
+	has_xml=True
+import os,sys
+import ccroot,cxx
+import TaskGen,Task,Utils,Runner,Options,Build
+from TaskGen import taskgen,feature,after,extension
+from Logs import error
+from Constants import*
+MOC_H=['.h','.hpp','.hxx','.hh']
+EXT_RCC=['.qrc']
+EXT_UI=['.ui']
+EXT_QT4=['.cpp','.cc','.cxx','.C']
+class MTask(Task.Task):
+	scan=ccroot.scan
+	before=['cxx_link','ar_link_static']
+	def __init__(self,parent):
+		Task.Task.__init__(self,parent.env)
+		self.moc_done=0
+		self.parent=parent
+	def runnable_status(self):
+		if self.moc_done:
+			for t in self.run_after:
+				if not t.hasrun:
+					return ASK_LATER
+			self.signature()
+			return Task.Task.runnable_status(self)
+		else:
+			self.add_moc_tasks()
+			return ASK_LATER
+	def add_moc_tasks(self):
+		tree=Build.bld
+		parn=self.parent
+		node=self.inputs[0]
+		try:
+			self.signature()
+		except:
+			print"TODO"
+		else:
+			delattr(self,'cache_sig')
+		moctasks=[]
+		mocfiles=[]
+		variant=node.variant(parn.env)
+		try:
+			tmp_lst=tree.raw_deps[self.unique_id()]
+			tree.raw_deps[self.unique_id()]=[]
+		except KeyError:
+			tmp_lst=[]
+		for d in tmp_lst:
+			if not d.endswith('.moc'):continue
+			if d in mocfiles:
+				error("paranoia owns")
+				continue
+			mocfiles.append(d)
+			ext=''
+			try:ext=Options.options.qt_header_ext
+			except AttributeError:pass
+			if not ext:
+				base2=d[:-4]
+				path=node.parent.srcpath(parn.env)
+				for i in MOC_H:
+					try:
+						os.stat(os.path.join(path,base2+i))
+					except OSError:
+						pass
+					else:
+						ext=i
+						break
+				if not ext:raise Utils.WafError("no header found for %s which is a moc file"%str(d))
+			h_node=node.parent.find_resource(base2+i)
+			m_node=h_node.change_ext('.moc')
+			tree.node_deps[(self.unique_id(),m_node.name)]=h_node
+			task=Task.TaskBase.classes['moc'](parn.env,normal=0)
+			task.set_inputs(h_node)
+			task.set_outputs(m_node)
+			generator=Build.bld.generator
+			generator.outstanding.insert(0,task)
+			generator.total+=1
+			moctasks.append(task)
+		tmp_lst=tree.raw_deps[self.unique_id()]=mocfiles
+		lst=tree.node_deps.get(self.unique_id(),())
+		for d in lst:
+			name=d.name
+			if name.endswith('.moc'):
+				task=Task.TaskBase.classes['moc'](parn.env,normal=0)
+				task.set_inputs(tree.node_deps[(self.unique_id(),name)])
+				task.set_outputs(d)
+				generator=Build.bld.generator
+				generator.outstanding.insert(0,task)
+				generator.total+=1
+				moctasks.append(task)
+		self.run_after=moctasks
+		self.moc_done=1
+	run=Task.TaskBase.classes['cxx'].__dict__['run']
+def translation_update(task):
+	outs=[a.abspath(task.env)for a in task.outputs]
+	outs=" ".join(outs)
+	lupdate=task.env['QT_LUPDATE']
+	for x in task.inputs:
+		file=x.abspath(task.env)
+		cmd="%s %s -ts %s"%(lupdate,file,outs)
+		Utils.pprint('BLUE',cmd)
+		task.generator.bld.exec_command(cmd)
+class XMLHandler(ContentHandler):
+	def __init__(self):
+		self.buf=[]
+		self.files=[]
+	def startElement(self,name,attrs):
+		if name=='file':
+			self.buf=[]
+	def endElement(self,name):
+		if name=='file':
+			self.files.append(''.join(self.buf))
+	def characters(self,cars):
+		self.buf.append(cars)
+def scan(self):
+	node=self.inputs[0]
+	parser=make_parser()
+	curHandler=XMLHandler()
+	parser.setContentHandler(curHandler)
+	fi=open(self.inputs[0].abspath(self.env))
+	parser.parse(fi)
+	fi.close()
+	nodes=[]
+	names=[]
+	root=self.inputs[0].parent
+	for x in curHandler.files:
+		x=x.encode('utf8')
+		nd=root.find_resource(x)
+		if nd:nodes.append(nd)
+		else:names.append(x)
+	return(nodes,names)
+def create_rcc_task(self,node):
+	rcnode=node.change_ext('_rc.cpp')
+	rcctask=self.create_task('rcc')
+	rcctask.inputs=[node]
+	rcctask.outputs=[rcnode]
+	cpptask=self.create_task('cxx')
+	cpptask.inputs=[rcnode]
+	cpptask.outputs=[rcnode.change_ext('.o')]
+	cpptask.defines=self.scanner_defines
+	self.compiled_tasks.append(cpptask)
+	return cpptask
+def create_uic_task(self,node):
+	uictask=self.create_task('ui4')
+	uictask.inputs=[node]
+	uictask.outputs=[node.change_ext('.h')]
+class qt4_taskgen(cxx.cxx_taskgen):
+	def __init__(self,*kw):
+		cxx.cxx_taskgen.__init__(self,*kw)
+		self.features.append('qt4')
+def apply_qt4(self):
+	if getattr(self,'lang',None):
+		lst=[]
+		trans=[]
+		for l in self.to_list(self.lang):
+			t=Task.TaskBase.classes['ts2qm'](self.env)
+			t.set_inputs(self.path.find_resource(l+'.ts'))
+			t.set_outputs(t.inputs[0].change_ext('.qm'))
+			lst.append(t.outputs[0])
+			if self.update:
+				trans.append(t.inputs[0])
+		if getattr(self,'update',None)and Options.options.trans_qt4:
+			u=Task.TaskCmd(translation_update,self.env,2)
+			u.inputs=[a.inputs[0]for a in self.compiled_tasks]
+			u.outputs=trans
+		if getattr(self,'langname',None):
+			t=Task.TaskBase.classes['qm2rcc'](self.env)
+			t.set_inputs(lst)
+			t.set_outputs(self.path.find_or_declare(self.langname+'.qrc'))
+			t.path=self.path
+			k=create_rcc_task(self,t.outputs[0])
+			self.link_task.inputs.append(k.outputs[0])
+	lst=[]
+	for flag in self.to_list(self.env['CXXFLAGS']):
+		if len(flag)<2:continue
+		if flag[0:2]=='-D'or flag[0:2]=='-I':
+			lst.append(flag)
+	self.env['MOC_FLAGS']=lst
+def find_sources_in_dirs(self,dirnames,excludes=[],exts=[]):
+	lst=[]
+	excludes=self.to_list(excludes)
+	dirnames=self.to_list(dirnames)
+	ext_lst=exts or self.mappings.keys()+TaskGen.task_gen.mappings.keys()
+	self.lang=getattr(self,'lang','')
+	for name in dirnames:
+		anode=self.path.find_dir(name)
+		Build.bld.rescan(anode)
+		for name in Build.bld.cache_dir_contents[anode.id]:
+			(base,ext)=os.path.splitext(name)
+			if ext in ext_lst:
+				if not name in lst:
+					if name in excludes:continue
+					lst.append((anode.path_to_parent(self.path)or'.')+'/'+name)
+			elif ext=='.ts':
+				self.lang+=' '+base
+	lst.sort()
+	self.source=self.source+' '+(" ".join(lst))
+setattr(qt4_taskgen,'find_sources_in_dirs',find_sources_in_dirs)
+def cxx_hook(self,node):
+	task=MTask(self)
+	self.tasks.append(task)
+	try:obj_ext=self.obj_ext
+	except AttributeError:obj_ext='_%d.o'%self.idx
+	task.defines=self.scanner_defines
+	task.inputs=[node]
+	task.outputs=[node.change_ext(obj_ext)]
+	self.compiled_tasks.append(task)
+def process_qm2rcc(task):
+	outfile=task.outputs[0].abspath(task.env)
+	f=open(outfile,'w')
+	f.write('<!DOCTYPE RCC><RCC version="1.0">\n<qresource>\n')
+	for k in task.inputs:
+		f.write(' <file>')
+		f.write(k.path_to_parent(task.path))
+		f.write('</file>\n')
+	f.write('</qresource>\n</RCC>')
+	f.close()
+b=Task.simple_task_type
+b('moc','${QT_MOC} ${MOC_FLAGS} ${SRC} ${MOC_ST} ${TGT}',color='BLUE',vars=['QT_MOC','MOC_FLAGS'])
+cls=b('rcc','${QT_RCC} -name ${SRC[0].name} ${SRC[0].abspath(env)} ${RCC_ST} -o ${TGT}',color='BLUE',before='cxx moc',after="qm2rcc")
+cls.scan=scan
+b('ui4','${QT_UIC} ${SRC} -o ${TGT}',color='BLUE',before='cxx moc')
+b('ts2qm','${QT_LRELEASE} ${QT_LRELEASE_FLAGS} ${SRC} -qm ${TGT}',color='BLUE',before='qm2rcc')
+Task.task_type_from_func('qm2rcc',vars=[],func=process_qm2rcc,color='BLUE',before='rcc',after='ts2qm')
+def detect_qt4(conf):
+	env=conf.env
+	opt=Options.options
+	qtlibs=getattr(opt,'qtlibs','')
+	qtincludes=getattr(opt,'qtincludes','')
+	qtbin=getattr(opt,'qtbin','')
+	useframework=getattr(opt,'use_qt4_osxframework',True)
+	qtdir=getattr(opt,'qtdir','')
+	if not qtdir:qtdir=os.environ.get('QT4_ROOT','')
+	if not qtdir:
+		try:
+			lst=os.listdir('/usr/local/Trolltech/')
+			lst.sort()
+			lst.reverse()
+			qtdir='/usr/local/Trolltech/%s/'%lst[0]
+		except OSError:
+			pass
+	if not qtdir:
+		try:
+			path=os.environ['PATH'].split(':')
+			for qmk in['qmake-qt4','qmake4','qmake']:
+				qmake=conf.find_program(qmk,path)
+				if qmake:
+					version=Utils.cmd_output(qmake+" -query QT_VERSION").strip().split('.')
+					if version[0]=="4":
+						qtincludes=Utils.cmd_output(qmake+" -query QT_INSTALL_HEADERS").strip()
+						qtdir=Utils.cmd_output(qmake+" -query QT_INSTALL_PREFIX").strip()+"/"
+						qtbin=Utils.cmd_output(qmake+" -query QT_INSTALL_BINS").strip()+"/"
+						break
+		except(OSError,ValueError):
+			pass
+	if not qtlibs:qtlibs=os.path.join(qtdir,'lib')
+	vars="QtCore QtGui QtNetwork QtOpenGL QtSql QtSvg QtTest QtXml QtWebKit Qt3Support".split()
+	framework_ok=False
+	if sys.platform=="darwin"and useframework:
+		for i in vars:
+			e=conf.create_framework_configurator()
+			e.path=[qtlibs,'/Library/Frameworks']
+			e.name=i
+			e.remove_dot_h=True
+			e.run()
+			if not i=='QtCore':
+				for r in env['CCFLAGS_'+i.upper()]:
+					if r.startswith('-F'):
+						env['CCFLAGS_'+i.upper()].remove(r)
+						break
+		if conf.is_defined("HAVE_QTOPENGL")and not'-framework OpenGL'in env["LINKFLAGS_QTOPENGL"]:
+			env["LINKFLAGS_QTOPENGL"]+=['-framework OpenGL']
+		if conf.is_defined("HAVE_QTGUI"):
+			if not'-framework AppKit'in env["LINKFLAGS_QTGUI"]:
+				env["LINKFLAGS_QTGUI"]+=['-framework AppKit']
+			if not'-framework ApplicationServices'in env["LINKFLAGS_QTGUI"]:
+				env["LINKFLAGS_QTGUI"]+=['-framework ApplicationServices']
+		framework_ok=True
+		if not conf.is_defined("HAVE_QTGUI"):
+			if not qtincludes:qtincludes=os.path.join(qtdir,'include')
+			env['QTINCLUDEPATH']=qtincludes
+			lst=[qtincludes,'/usr/share/qt4/include/','/opt/qt4/include']
+			conf.check(header_name='QtGui/QFont',define_name='HAVE_QTGUI',mandatory=1,includes=lst)
+	if not qtbin:qtbin=os.path.join(qtdir,'bin')
+	binpath=[qtbin,'/usr/share/qt4/bin/']+os.environ['PATH'].split(':')
+	def find_bin(lst,var):
+		for f in lst:
+			ret=conf.find_program(f,path_list=binpath)
+			if ret:
+				env[var]=ret
+				break
+	find_bin(['uic-qt3','uic3'],'QT_UIC3')
+	find_bin(['uic-qt4','uic'],'QT_UIC')
+	try:
+		version=Utils.cmd_output(env['QT_UIC']+" -version 2>&1").strip()
+	except ValueError:
+		conf.fatal('your uic compiler is for qt3, add uic for qt4 to your path')
+	version=version.replace('Qt User Interface Compiler ','')
+	version=version.replace('User Interface Compiler for Qt','')
+	if version.find(" 3.")!=-1:
+		conf.check_message('uic version','(too old)',0,option='(%s)'%version)
+		sys.exit(1)
+	conf.check_message('uic version','',1,option='(%s)'%version)
+	find_bin(['moc-qt4','moc'],'QT_MOC')
+	find_bin(['rcc'],'QT_RCC')
+	find_bin(['lrelease-qt4','lrelease'],'QT_LRELEASE')
+	find_bin(['lupdate-qt4','lupdate'],'QT_LUPDATE')
+	env['UIC3_ST']='%s -o %s'
+	env['UIC_ST']='%s -o %s'
+	env['MOC_ST']='-o'
+	env['QT_LRELEASE_FLAGS']=['-silent']
+	if not framework_ok:
+		vars_debug=[a+'_debug'for a in vars]
+		pkgconfig=env['pkg-config']or'PKGCONFIG_PATH=%s:%s/pkgconfig:/usr/lib/qt4/lib/pkgconfig:/opt/qt4/lib/pkgconfig:/usr/lib/qt4/lib:/opt/qt4/lib pkg-config --silence-errors'%(qtlibs,qtlibs)
+		for i in vars_debug+vars:
+			try:
+				conf.check_cfg(package=i,args='--cflags --libs',path=pkgconfig)
+			except ValueError:
+				pass
+		def process_lib(vars_,coreval):
+			for d in vars_:
+				var=d.upper()
+				if var=='QTCORE':continue
+				value=env['LIBPATH_'+var]
+				if value:
+					core=env[coreval]
+					accu=[]
+					for lib in value:
+						if lib in core:continue
+						accu.append(lib)
+					env['LIBPATH_'+var]=accu
+		process_lib(vars,'LIBPATH_QTCORE')
+		process_lib(vars_debug,'LIBPATH_QTCORE_DEBUG')
+		if Options.options.want_rpath:
+			def process_rpath(vars_,coreval):
+				for d in vars_:
+					var=d.upper()
+					value=env['LIBPATH_'+var]
+					if value:
+						core=env[coreval]
+						accu=[]
+						for lib in value:
+							if var!='QTCORE':
+								if lib in core:
+									continue
+							accu.append('-Wl,--rpath='+lib)
+						env['RPATH_'+var]=accu
+			process_rpath(vars,'LIBPATH_QTCORE')
+			process_rpath(vars_debug,'LIBPATH_QTCORE_DEBUG')
+	env['QTLOCALE']=str(env['PREFIX'])+'/share/locale'
+def detect(conf):
+	if sys.platform=='win32':conf.fatal('Qt4.py will not work on win32 for now - ask the author')
+	detect_qt4(conf)
+def set_options(opt):
+	opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]')
+	opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext')
+	for i in"qtdir qtincludes qtlibs qtbin".split():
+		opt.add_option('--'+i,type='string',default='',dest=i)
+	if sys.platform=="darwin":
+		opt.add_option('--no-qt4-framework',action="store_false",help='do not use the framework version of Qt4 in OS X',dest='use_qt4_osxframework',default=True)
+	opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False)
+
+extension(EXT_RCC)(create_rcc_task)
+extension(EXT_UI)(create_uic_task)
+taskgen(apply_qt4)
+feature('qt4')(apply_qt4)
+after('apply_link')(apply_qt4)
+extension(EXT_QT4)(cxx_hook)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/sunc++.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/sunc++.py
new file mode 100644
index 0000000..d0bee4e
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/sunc++.py
@@ -0,0 +1,66 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,optparse
+import Utils,Options,Configure
+import ccroot,ar
+from Configure import conftest
+def find_sxx(conf):
+	v=conf.env
+	cc=None
+	if v['CXX']:cc=v['CXX']
+	elif'CXX'in os.environ:cc=os.environ['CXX']
+	if not cc:cc=conf.find_program('c++',var='CXX')
+	if not cc:conf.fatal('sunc++ was not found')
+	v['CXX']=cc
+	v['CXX_NAME']='sun'
+def sxx_common_flags(conf):
+	v=conf.env
+	v['CXX_SRC_F']=''
+	v['CXX_TGT_F']='-c -o '
+	v['CPPPATH_ST']='-I%s'
+	if not v['LINK_CXX']:v['LINK_CXX']=v['CXX']
+	v['CXXLNK_SRC_F']=''
+	v['CXXLNK_TGT_F']='-o '
+	v['LIB_ST']='-l%s'
+	v['LIBPATH_ST']='-L%s'
+	v['STATICLIB_ST']='-l%s'
+	v['STATICLIBPATH_ST']='-L%s'
+	v['CXXDEFINES_ST']='-D%s'
+	v['SHLIB_MARKER']='-Bdynamic'
+	v['STATICLIB_MARKER']='-Bstatic'
+	v['program_PATTERN']='%s'
+	v['shlib_CXXFLAGS']=['-Kpic','-DPIC']
+	v['shlib_LINKFLAGS']=['-G']
+	v['shlib_PATTERN']='lib%s.so'
+	v['staticlib_LINKFLAGS']=['-Bstatic']
+	v['staticlib_PATTERN']='lib%s.a'
+def sxx_modifier_debug(conf,kind='cpp'):
+	v=conf.env
+	v['CXXFLAGS']=['']
+	if conf.check_flags('-O2',kind=kind):
+		v['CXXFLAGS_OPTIMIZED']=['-O2']
+		v['CXXFLAGS_RELEASE']=['-O2']
+	if conf.check_flags('-g -DDEBUG',kind=kind):
+		v['CXXFLAGS_DEBUG']=['-g','-DDEBUG']
+	if conf.check_flags('-g3 -O0 -DDEBUG',kind=kind):
+		v['CXXFLAGS_ULTRADEBUG']=['-g3','-O0','-DDEBUG']
+	try:
+		debug_level=Options.options.debug_level.upper()
+	except AttributeError:
+		debug_level=ccroot.DEBUG_LEVELS.CUSTOM
+	v.append_value('CXXFLAGS',v['CXXFLAGS_'+debug_level])
+detect='''
+find_sxx
+find_cpp
+find_ar
+sxx_common_flags
+cxx_load_tools
+cxx_check_features
+sxx_modifier_debug
+cxx_add_flags
+'''
+
+conftest(find_sxx)
+conftest(sxx_common_flags)
+conftest(sxx_modifier_debug)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/suncc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/suncc.py
new file mode 100644
index 0000000..47e1f82
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/suncc.py
@@ -0,0 +1,71 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,optparse
+import Utils,Options,Configure
+import ccroot,ar
+from Configure import conftest
+def find_scc(conf):
+	v=conf.env
+	cc=None
+	if v['CC']:cc=v['CC']
+	elif'CC'in os.environ:cc=os.environ['CC']
+	if not cc:cc=conf.find_program('cc',var='CC')
+	if not cc:conf.fatal('suncc was not found')
+	try:
+		if not Utils.cmd_output('%s -flags'%cc):
+			conf.fatal('suncc %r was not found'%cc)
+	except ValueError:
+		conf.fatal('suncc -flags could not be executed')
+	v['CC']=cc
+	v['CC_NAME']='sun'
+def scc_common_flags(conf):
+	v=conf.env
+	v['CC_SRC_F']=''
+	v['CC_TGT_F']='-c -o '
+	v['CPPPATH_ST']='-I%s'
+	if not v['LINK_CC']:v['LINK_CC']=v['CC']
+	v['CCLNK_SRC_F']=''
+	v['CCLNK_TGT_F']='-o '
+	v['LIB_ST']='-l%s'
+	v['LIBPATH_ST']='-L%s'
+	v['STATICLIB_ST']='-l%s'
+	v['STATICLIBPATH_ST']='-L%s'
+	v['CCDEFINES_ST']='-D%s'
+	v['SHLIB_MARKER']='-Bdynamic'
+	v['STATICLIB_MARKER']='-Bstatic'
+	v['program_PATTERN']='%s'
+	v['shlib_CCFLAGS']=['-Kpic','-DPIC']
+	v['shlib_LINKFLAGS']=['-G']
+	v['shlib_PATTERN']='lib%s.so'
+	v['staticlib_LINKFLAGS']=['-Bstatic']
+	v['staticlib_PATTERN']='lib%s.a'
+def scc_modifier_debug(conf):
+	v=conf.env
+	v['CCFLAGS']=['-O']
+	if conf.check_flags('-O2'):
+		v['CCFLAGS_OPTIMIZED']=['-O2']
+		v['CCFLAGS_RELEASE']=['-O2']
+	if conf.check_flags('-g -DDEBUG'):
+		v['CCFLAGS_DEBUG']=['-g','-DDEBUG']
+	if conf.check_flags('-g3 -O0 -DDEBUG'):
+		v['CCFLAGS_ULTRADEBUG']=['-g3','-O0','-DDEBUG']
+	try:
+		debug_level=Options.options.debug_level.upper()
+	except AttributeError:
+		debug_level=ccroot.DEBUG_LEVELS.CUSTOM
+	v.append_value('CCFLAGS',v['CCFLAGS_'+debug_level])
+detect='''
+find_scc
+find_cpp
+find_ar
+scc_common_flags
+cc_load_tools
+cc_check_features
+gcc_modifier_debug
+cc_add_flags
+'''
+
+conftest(find_scc)
+conftest(scc_common_flags)
+conftest(scc_modifier_debug)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/tex.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/tex.py
new file mode 100644
index 0000000..9be9e81
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/tex.py
@@ -0,0 +1,184 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,re
+import Utils,TaskGen,Task,Runner,Build
+from TaskGen import taskgen,feature
+from Logs import error,warn,debug
+re_tex=re.compile(r'\\(?P<type>include|input|import|bringin){(?P<file>[^{}]*)}',re.M)
+def scan(self):
+	node=self.inputs[0]
+	env=self.env
+	nodes=[]
+	names=[]
+	if not node:return(nodes,names)
+	fi=open(node.abspath(env),'r')
+	code=fi.read()
+	fi.close()
+	curdirnode=self.curdirnode
+	abs=curdirnode.abspath()
+	for match in re_tex.finditer(code):
+		path=match.group('file')
+		if path:
+			for k in['','.tex','.ltx']:
+				debug('tex: trying %s%s'%(path,k))
+				try:
+					os.stat(abs+os.sep+path+k)
+				except OSError:
+					continue
+				found=path+k
+				node=curdirnode.find_resource(found)
+				if node:
+					nodes.append(node)
+			else:
+				debug('tex: could not find %s'%path)
+				names.append(path)
+	debug("tex: found the following : %s and names %s"%(nodes,names))
+	return(nodes,names)
+g_bibtex_re=re.compile('bibdata',re.M)
+def tex_build(task,command='LATEX'):
+	env=task.env
+	bld=task.generator.bld
+	com='%s %s'%(env[command],env.get_flat(command+'FLAGS'))
+	if not env['PROMPT_LATEX']:com="%s %s"%(com,'-interaction=batchmode')
+	node=task.inputs[0]
+	reldir=node.bld_dir(env)
+	srcfile=node.srcpath(env)
+	lst=[]
+	for c in Utils.split_path(reldir):
+		if c:lst.append('..')
+	sr=os.path.join(*(lst+[srcfile]))
+	sr2=os.path.join(*(lst+[node.parent.srcpath(env)]))
+	aux_node=node.change_ext('.aux')
+	idx_node=node.change_ext('.idx')
+	hash=''
+	old_hash=''
+	nm=aux_node.name
+	docuname=nm[:len(nm)-4]
+	latex_compile_cmd='cd %s && TEXINPUTS=%s:$TEXINPUTS %s %s'%(reldir,sr2,com,sr)
+	warn('first pass on %s'%command)
+	ret=bld.exec_command(latex_compile_cmd)
+	if ret:return ret
+	try:
+		file=open(aux_node.abspath(env),'r')
+		ct=file.read()
+		file.close()
+	except(OSError,IOError):
+		error('error bibtex scan')
+	else:
+		fo=g_bibtex_re.findall(ct)
+		if fo:
+			bibtex_compile_cmd='cd %s && BIBINPUTS=%s:$BIBINPUTS %s %s'%(reldir,sr2,env['BIBTEX'],docuname)
+			warn('calling bibtex')
+			ret=bld.exec_command(bibtex_compile_cmd)
+			if ret:
+				error('error when calling bibtex %s'%bibtex_compile_cmd)
+				return ret
+	try:
+		idx_path=idx_node.abspath(env)
+		os.stat(idx_path)
+	except OSError:
+		error('error file.idx scan')
+	else:
+		makeindex_compile_cmd='cd %s && %s %s'%(reldir,env['MAKEINDEX'],idx_path)
+		warn('calling makeindex')
+		ret=bld.exec_command(makeindex_compile_cmd)
+		if ret:
+			error('error when calling makeindex %s'%makeindex_compile_cmd)
+			return ret
+	i=0
+	while i<10:
+		i+=1
+		old_hash=hash
+		try:
+			hash=Utils.h_file(aux_node.abspath(env))
+		except KeyError:
+			error('could not read aux.h -> %s'%aux_node.abspath(env))
+			pass
+		if hash and hash==old_hash:break
+		warn('calling %s'%command)
+		ret=bld.exec_command(latex_compile_cmd)
+		if ret:
+			error('error when calling %s %s'%(command,latex_compile_cmd))
+			return ret
+	return 0
+latex_vardeps=['LATEX','LATEXFLAGS']
+def latex_build(task):
+	return tex_build(task,'LATEX')
+pdflatex_vardeps=['PDFLATEX','PDFLATEXFLAGS']
+def pdflatex_build(task):
+	return tex_build(task,'PDFLATEX')
+class tex_taskgen(TaskGen.task_gen):
+	def __init__(self,*k,**kw):
+		TaskGen.task_gen.__init__(self,*k,**kw)
+def apply_tex(self):
+	if not self.type in['latex','pdflatex']:
+		raise Utils.WafError('type %s not supported for texobj'%type)
+	tree=Build.bld
+	outs=Utils.to_list(getattr(self,'outs',[]))
+	self.env['PROMPT_LATEX']=getattr(self,'prompt',1)
+	deps_lst=[]
+	if getattr(self,'deps',None):
+		deps=self.to_list(self.deps)
+		for filename in deps:
+			n=self.path.find_resource(filename)
+			if not n in deps_lst:deps_lst.append(n)
+	for filename in self.source.split():
+		base,ext=os.path.splitext(filename)
+		node=self.path.find_resource(filename)
+		if not node:raise Utils.WafError('cannot find %s'%filename)
+		if self.type=='latex':
+			task=self.create_task('latex')
+			task.set_inputs(node)
+			task.set_outputs(node.change_ext('.dvi'))
+		elif self.type=='pdflatex':
+			task=self.create_task('pdflatex')
+			task.set_inputs(node)
+			task.set_outputs(node.change_ext('.pdf'))
+		else:
+			raise Utils.WafError('no type or invalid type given in tex object (should be latex or pdflatex)')
+		task.env=self.env
+		task.curdirnode=self.path
+		if deps_lst:
+			variant=node.variant(self.env)
+			try:
+				lst=tree.node_deps[task.unique_id()]
+				for n in deps_lst:
+					if not n in lst:
+						lst.append(n)
+			except KeyError:
+				tree.node_deps[task.unique_id()]=deps_lst
+		if self.type=='latex':
+			if'ps'in outs:
+				pstask=self.create_task('dvips')
+				pstask.set_inputs(task.outputs)
+				pstask.set_outputs(node.change_ext('.ps'))
+			if'pdf'in outs:
+				pdftask=self.create_task('dvipdf')
+				pdftask.set_inputs(task.outputs)
+				pdftask.set_outputs(node.change_ext('.pdf'))
+		elif self.type=='pdflatex':
+			if'ps'in outs:
+				pstask=self.create_task('pdf2ps')
+				pstask.set_inputs(task.outputs)
+				pstask.set_outputs(node.change_ext('.ps'))
+def detect(conf):
+	v=conf.env
+	for p in'tex latex pdflatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split():
+		conf.find_program(p,var=p.upper())
+		v[p.upper()+'FLAGS']=''
+	v['DVIPSFLAGS']='-Ppdf'
+b=Task.simple_task_type
+b('tex','${TEX} ${TEXFLAGS} ${SRC}',color='BLUE')
+b('bibtex','${BIBTEX} ${BIBTEXFLAGS} ${SRC}',color='BLUE')
+b('dvips','${DVIPS} ${DVIPSFLAGS} ${SRC} -o ${TGT}',color='BLUE',after="latex pdflatex tex bibtex")
+b('dvipdf','${DVIPDF} ${DVIPDFFLAGS} ${SRC} ${TGT}',color='BLUE',after="latex pdflatex tex bibtex")
+b('pdf2ps','${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}',color='BLUE',after="dvipdf pdflatex")
+b=Task.task_type_from_func
+cls=b('latex',latex_build,vars=latex_vardeps)
+cls.scan=scan
+cls=b('pdflatex',pdflatex_build,vars=pdflatex_vardeps)
+cls.scan=scan
+
+taskgen(apply_tex)
+feature('tex')(apply_tex)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/vala.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/vala.py
new file mode 100644
index 0000000..2e32c33
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/vala.py
@@ -0,0 +1,174 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os.path,shutil
+import Task,Runner,Utils,Logs,Build,Node
+from TaskGen import extension
+EXT_VALA=['.vala','.gs']
+class valac_task(Task.Task):
+	vars=("VALAC","VALAC_VERSION","VALAFLAGS")
+	before=("cc","cxx")
+	def run(self):
+		env=self.env
+		inputs=[a.srcpath(env)for a in self.inputs]
+		valac=env['VALAC']
+		vala_flags=env.get_flat('VALAFLAGS')
+		top_src=self.generator.bld.srcnode.abspath()
+		top_bld=self.generator.bld.srcnode.abspath(env)
+		if env['VALAC_VERSION']>(0,1,6):
+			cmd=[valac,'-C','--quiet',vala_flags]
+		else:
+			cmd=[valac,'-C',vala_flags]
+		if self.threading:
+			cmd.append('--thread')
+		if self.target_glib:
+			cmd.append('--target-glib=%s'%self.target_glib)
+		features=self.generator.features
+		if'cshlib'in features or'cstaticlib'in features:
+			cmd.append('--library '+self.target)
+			cmd.append('--basedir '+top_src)
+			cmd.append('-d '+top_bld)
+		else:
+			output_dir=self.outputs[0].bld_dir(env)
+			cmd.append('-d %s'%output_dir)
+		for vapi_dir in self.vapi_dirs:
+			cmd.append('--vapidir=%s'%vapi_dir)
+		for package in self.packages:
+			cmd.append('--pkg %s'%package)
+		cmd.append(" ".join(inputs))
+		result=self.generator.bld.exec_command(" ".join(cmd))
+		if'cshlib'in features or'cstaticlib'in features:
+			if self.packages:
+				filename=os.path.join(self.generator.path.abspath(env),"%s.deps"%self.target)
+				deps=open(filename,'w')
+				for package in self.packages:
+					deps.write(package+'\n')
+				deps.close()
+			self._fix_output("../%s.vapi"%self.target)
+			self._fix_output("%s.vapi"%self.target)
+			self._fix_output("%s.gidl"%self.target)
+			self._fix_output("%s.gir"%self.target)
+		return result
+	def install(self):
+		bld=self.generator.bld
+		features=self.generator.features
+		if self.attr("install_path")and("cshlib"in features or"cstaticlib"in features):
+			headers_list=[o for o in self.outputs if o.suffix()==".h"]
+			vapi_list=[o for o in self.outputs if(o.suffix()in(".vapi",".deps"))]
+			for header in headers_list:
+				top_src=self.generator.bld.srcnode
+				package=self.env['PACKAGE']
+				try:
+					api_version=Utils.g_module.API_VERSION
+				except AttributeError:
+					version=Utils.g_module.VERSION.split(".")
+					if version[0]=="0":
+						api_version="0."+version[1]
+					else:
+						api_version=version[0]+".0"
+				install_path="${INCLUDEDIR}/%s-%s/%s"%(package,api_version,header.relpath_gen(top_src))
+				bld.install_as(install_path,header.abspath(self.env),self.env)
+			for vapi in vapi_list:
+				bld.install_files("${DATAROOTDIR}/vala/vapi",vapi.abspath(self.env),self.env)
+	def _fix_output(self,output):
+		top_bld=self.generator.bld.srcnode.abspath(self.env)
+		try:
+			src=os.path.join(top_bld,output)
+			dst=self.generator.path.abspath(self.env)
+			shutil.move(src,dst)
+		except IOError:
+			pass
+def vala_file(self,node):
+	valatask=getattr(self,"valatask",None)
+	if not valatask:
+		valatask=self.create_task('valac')
+		self.valatask=valatask
+		valatask.packages=[]
+		valatask.vapi_dirs=[]
+		valatask.target=self.target
+		valatask.threading=False
+		valatask.install_path=self.install_path
+		valatask.target_glib=None
+		packages=Utils.to_list(getattr(self,'packages',[]))
+		vapi_dirs=Utils.to_list(getattr(self,'vapi_dirs',[]))
+		if hasattr(self,'uselib_local'):
+			local_packages=Utils.to_list(self.uselib_local)
+			seen=[]
+			while len(local_packages)>0:
+				package=local_packages.pop()
+				if package in seen:
+					continue
+				seen.append(package)
+				package_obj=self.name_to_obj(package)
+				if not package_obj:
+					raise Utils.WafError("object '%s' was not found in uselib_local (required by '%s')"%(package,self.name))
+				package_name=package_obj.target
+				package_node=package_obj.path
+				package_dir=package_node.relpath_gen(self.path)
+				for task in package_obj.tasks:
+					for output in task.outputs:
+						if output.name==package_name+".vapi":
+							if package_name not in packages:
+								packages.append(package_name)
+								valatask.set_run_after(task)
+							if package_dir not in vapi_dirs:
+								vapi_dirs.append(package_dir)
+				if hasattr(package_obj,'uselib_local'):
+					lst=self.to_list(package_obj.uselib_local)
+					lst.reverse()
+					local_packages=[pkg for pkg in lst if pkg not in seen]+local_packages
+		valatask.packages=packages
+		for vapi_dir in vapi_dirs:
+			try:
+				valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath())
+				valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath(self.env))
+			except AttributeError:
+				Params.warning("Unable to locate Vala API directory: '%s'"%vapi_dir)
+		if hasattr(self,'threading'):
+			valatask.threading=self.threading
+			self.uselib=self.to_list(self.uselib)
+			if not'GTHREAD'in self.uselib:
+				self.uselib.append('GTHREAD')
+		if hasattr(self,'target_glib'):
+			valatask.target_glib=self.target_glib
+	env=valatask.env
+	output_nodes=[]
+	c_node=node.change_ext('.c')
+	output_nodes.append(c_node)
+	self.allnodes.append(c_node)
+	output_nodes.append(node.change_ext('.h'))
+	if not'cprogram'in self.features:
+		output_nodes.append(self.path.find_or_declare('%s.vapi'%self.target))
+		if env['VALAC_VERSION']>(0,3,5):
+			output_nodes.append(self.path.find_or_declare('%s.gir'%self.target))
+		elif env['VALAC_VERSION']>(0,1,7):
+			output_nodes.append(self.path.find_or_declare('%s.gidl'%self.target))
+		if valatask.packages:
+			output_nodes.append(self.path.find_or_declare('%s.deps'%self.target))
+	valatask.inputs.append(node)
+	valatask.outputs.extend(output_nodes)
+def detect(conf):
+	min_version=(0,1,6)
+	min_version_str="%d.%d.%d"%min_version
+	valac=conf.find_program('valac',var='VALAC')
+	if not valac:
+		conf.fatal("valac not found")
+		return
+	if not conf.env["HAVE_GTHREAD"]:
+		conf.check_cfg(package='gthread-2.0',uselib_store='GTHREAD',args='--cflags --libs')
+	try:
+		output=Utils.cmd_output(valac+" --version",silent=True)
+		version=output.split(' ',1)[-1].strip().split(".")
+		version=[int(x)for x in version]
+		valac_version=tuple(version)
+	except Exception:
+		valac_version=(0,0,0)
+	conf.check_message('program version','valac >= '+min_version_str,valac_version>=min_version,"%d.%d.%d"%valac_version)
+	conf.check_tool('gnu_dirs')
+	if valac_version<min_version:
+		conf.fatal("valac version too old to be used with this tool")
+		return
+	conf.env['VALAC_VERSION']=valac_version
+	conf.env['VALAFLAGS']=''
+
+extension(EXT_VALA)(vala_file)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/winres.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/winres.py
new file mode 100644
index 0000000..70c3285
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Tools/winres.py
@@ -0,0 +1,40 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os,sys,re
+import TaskGen,Task
+from Utils import quote_whitespace
+from TaskGen import extension
+EXT_WINRC=['.rc']
+winrc_str='${WINRC} ${_CPPDEFFLAGS} ${_CXXDEFFLAGS} ${_CCDEFFLAGS} ${WINRCFLAGS} ${_CPPINCFLAGS} ${_CXXINCFLAGS} ${_CCINCFLAGS} ${WINRC_TGT_F}${TGT} ${WINRC_SRC_F}${SRC}'
+def rc_file(self,node):
+	obj_ext='.rc.o'
+	if self.env['WINRC_TGT_F']=='/fo ':obj_ext='.res'
+	rctask=self.create_task('winrc')
+	rctask.set_inputs(node)
+	rctask.set_outputs(node.change_ext(obj_ext))
+	self.compiled_tasks.append(rctask)
+Task.simple_task_type('winrc',winrc_str,color='BLUE',before='cc cxx')
+def detect(conf):
+	v=conf.env
+	cc=os.path.basename(''.join(v['CC']).lower())
+	cxx=os.path.basename(''.join(v['CXX']).lower())
+	cc=re.sub('"','',cc)
+	cxx=re.sub('"','',cxx)
+	if cc in['gcc','cc','g++','c++']:
+		winrc=conf.find_program('windres',var='WINRC')
+		v['WINRC_TGT_F']='-o '
+		v['WINRC_SRC_F']='-i '
+	elif cc.startswith('cl.exe')or cxx.startswith('cl.exe'):
+		winrc=conf.find_program('RC',var='WINRC')
+		v['WINRC_TGT_F']='/fo '
+		v['WINRC_SRC_F']=' '
+	else:
+		return 0
+	if not winrc:
+		conf.fatal('winrc was not found!!')
+	else:
+		v['WINRC']=quote_whitespace(winrc)
+	v['WINRCFLAGS']=''
+
+extension(EXT_WINRC)(rc_file)
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Utils.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Utils.py
new file mode 100644
index 0000000..2c9d058
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/Utils.py
@@ -0,0 +1,278 @@
+#! /usr/bin/env python
+# encoding: utf-8
+import sys
+if sys.hexversion < 0x020400f0: from sets import Set as set
+import os,sys,imp,types,string,errno,traceback,inspect,re
+from UserDict import UserDict
+import Logs,pproc
+from Constants import*
+class WafError(Exception):
+	def __init__(self,*args):
+		self.args=args
+		self.stack=traceback.extract_stack()
+		Exception.__init__(self,*args)
+	def __str__(self):
+		return str(len(self.args)==1 and self.args[0]or self.args)
+class WscriptError(WafError):
+	def __init__(self,message,wscript_file=None):
+		if wscript_file:
+			self.wscript_file=wscript_file
+			self.wscript_line=None
+		else:
+			(self.wscript_file,self.wscript_line)=self.locate_error()
+		msg_file_line=''
+		if self.wscript_file:
+			msg_file_line="%s:"%self.wscript_file
+			if self.wscript_line:
+				msg_file_line+="%s:"%self.wscript_line
+		err_message="%s error: %s"%(msg_file_line,message)
+		WafError.__init__(self,err_message)
+	def locate_error(self):
+		stack=traceback.extract_stack()
+		stack.reverse()
+		for frame in stack:
+			file_name=os.path.basename(frame[0])
+			is_wscript=(file_name==WSCRIPT_FILE or file_name==WSCRIPT_BUILD_FILE)
+			if is_wscript:
+				return(frame[0],frame[1])
+		return(None,None)
+indicator=sys.platform=='win32'and'\x1b[A\x1b[K%s%s%s\r'or'\x1b[K%s%s%s\r'
+try:
+	from fnv import new as md5
+	import Constants
+	Constants.SIG_NIL='signofnv'
+	def h_file(filename):
+		m=md5()
+		try:
+			m.hfile(filename)
+			x=m.digest()
+			if x is None:raise OSError,"not a file"
+			return x
+		except SystemError:
+			raise OSError,"not a file"+filename
+except ImportError:
+	try:
+		from hashlib import md5
+	except ImportError:
+		from md5 import md5
+	def h_file(filename):
+		f=file(filename,'rb')
+		m=md5()
+		readBytes=100000
+		while(readBytes):
+			readString=f.read(readBytes)
+			m.update(readString)
+			readBytes=len(readString)
+		f.close()
+		return m.digest()
+class ordered_dict(UserDict):
+	def __init__(self,dict=None):
+		self.allkeys=[]
+		UserDict.__init__(self,dict)
+	def __delitem__(self,key):
+		self.allkeys.remove(key)
+		UserDict.__delitem__(self,key)
+	def __setitem__(self,key,item):
+		if key not in self.allkeys:self.allkeys.append(key)
+		UserDict.__setitem__(self,key,item)
+def exec_command(s,shell=1,log=None):
+	proc=pproc.Popen(s,shell=shell,stdout=log,stderr=log)
+	return proc.wait()
+if sys.platform=="win32":
+	old_log=exec_command
+	def exec_command(s,shell=1,log=None):
+		if len(s)<2000:return old_log(s,shell=shell,log=log)
+		startupinfo=pproc.STARTUPINFO()
+		startupinfo.dwFlags|=pproc.STARTF_USESHOWWINDOW
+		proc=pproc.Popen(s,shell=False,startupinfo=startupinfo)
+		return proc.wait()
+listdir=os.listdir
+if sys.platform=="win32":
+	def listdir_win32(s):
+		if re.match('^[A-Z]:$',s):
+			s+=os.sep
+		if not os.path.isdir(s):
+			e=OSError()
+			e.errno=errno.ENOENT
+			raise e
+		return os.listdir(s)
+	listdir=listdir_win32
+def waf_version(mini=0x010000,maxi=0x100000):
+	ver=HEXVERSION
+	try:min_val=mini+0
+	except TypeError:min_val=int(mini.replace('.','0'),16)
+	if min_val>ver:
+		Logs.error("waf version should be at least %s (%s found)"%(mini,ver))
+		sys.exit(0)
+	try:max_val=maxi+0
+	except TypeError:max_val=int(maxi.replace('.','0'),16)
+	if max_val<ver:
+		Logs.error("waf version should be at most %s (%s found)"%(maxi,ver))
+		sys.exit(0)
+def python_24_guard():
+	if sys.hexversion<0x20400f0:
+		raise ImportError,"Waf requires Python >= 2.3 but the raw source requires Python 2.4"
+def ex_stack():
+	exc_type,exc_value,tb=sys.exc_info()
+	exc_lines=traceback.format_exception(exc_type,exc_value,tb)
+	return''.join(exc_lines)
+def to_list(sth):
+	if type(sth)is types.ListType:
+		return sth
+	else:
+		return sth.split()
+g_loaded_modules={}
+g_module=None
+def load_module(file_path,name=WSCRIPT_FILE):
+	try:
+		return g_loaded_modules[file_path]
+	except KeyError:
+		pass
+	module=imp.new_module(name)
+	try:
+		file=open(file_path,'r')
+	except(IOError,OSError):
+		raise WscriptError('The file %s could not be opened!'%file_path)
+	module_dir=os.path.dirname(file_path)
+	sys.path.insert(0,module_dir)
+	exec file in module.__dict__
+	sys.path.remove(module_dir)
+	if file:file.close()
+	g_loaded_modules[file_path]=module
+	return module
+def set_main_module(file_path):
+	global g_module
+	g_module=load_module(file_path,'wscript_main')
+def to_hashtable(s):
+	tbl={}
+	lst=s.split('\n')
+	for line in lst:
+		if not line:continue
+		mems=line.split('=')
+		tbl[mems[0]]=mems[1]
+	return tbl
+def get_term_cols():
+	return 80
+try:
+	import struct,fcntl,termios
+except ImportError:
+	pass
+else:
+	if sys.stdout.isatty():
+		def myfun():
+			dummy_lines,cols=struct.unpack("HHHH",fcntl.ioctl(sys.stdout.fileno(),termios.TIOCGWINSZ,struct.pack("HHHH",0,0,0,0)))[:2]
+			return cols
+		try:
+			myfun()
+		except IOError:
+			pass
+		else:
+			get_term_cols=myfun
+rot_idx=0
+rot_chr=['\\','|','/','-']
+def split_path(path):
+	if not path:return['']
+	return path.split('/')
+if sys.platform=='win32':
+	def split_path(path):
+		h,t=os.path.splitunc(path)
+		if not h:return __split_dirs(t)
+		return[h]+__split_dirs(t)[1:]
+	def __split_dirs(path):
+		h,t=os.path.split(path)
+		if not h:return[t]
+		if h==path:return[h.replace('\\','')]
+		if not t:return __split_dirs(h)
+		else:return __split_dirs(h)+[t]
+def copy_attrs(orig,dest,names,only_if_set=False):
+	for a in to_list(names):
+		u=getattr(orig,a,())
+		if u or not only_if_set:
+			setattr(dest,a,u)
+def def_attrs(self,**kw):
+	for k,v in kw.iteritems():
+		try:
+			getattr(self,k)
+		except AttributeError:
+			setattr(self,k,v)
+quote_define_name_table=None
+def quote_define_name(path):
+	global quote_define_name_table
+	if not quote_define_name_table:
+		invalid_chars=set([chr(x)for x in xrange(256)])-set(string.digits+string.uppercase)
+		quote_define_name_table=string.maketrans(''.join(invalid_chars),'_'*len(invalid_chars))
+	return string.translate(string.upper(path),quote_define_name_table)
+def quote_whitespace(path):
+	return(path.strip().find(' ')>0 and'"%s"'%path or path).replace('""','"')
+def trimquotes(s):
+	if not s:return''
+	s=s.rstrip()
+	if s[0]=="'"and s[-1]=="'":return s[1:-1]
+	return s
+def h_list(lst):
+	m=md5()
+	m.update(str(lst))
+	return m.digest()
+def h_fun(fun):
+	try:
+		return fun.code
+	except AttributeError:
+		try:
+			h=inspect.getsource(fun)
+		except IOError:
+			h="nocode"
+		try:
+			fun.code=h
+		except AttributeError:
+			pass
+		return h
+_hash_blacklist_types=(types.BuiltinFunctionType,types.ModuleType,types.FunctionType,types.ClassType,types.TypeType,types.NoneType,)
+def hash_function_with_globals(prevhash,func):
+	assert type(func)is types.FunctionType
+	for name,value in func.func_globals.iteritems():
+		if type(value)in _hash_blacklist_types:
+			continue
+		if isinstance(value,type):
+			continue
+		try:
+			prevhash=hash((prevhash,name,value))
+		except TypeError:
+			pass
+	return hash((prevhash,inspect.getsource(func)))
+def pprint(col,str,label=''):
+	print"%s%s%s %s"%(Logs.colors(col),str,Logs.colors.NORMAL,label)
+def check_dir(dir):
+	try:
+		os.stat(dir)
+	except OSError:
+		try:
+			os.makedirs(dir)
+		except OSError,e:
+			raise WafError("Cannot create folder '%s' (original error: %s)"%(dir,e))
+def cmd_output(cmd,e=None,silent=False):
+	p=pproc.Popen(cmd,stdout=pproc.PIPE,shell=True,env=e)
+	output=p.communicate()[0]
+	if p.returncode:
+		if not silent:
+			msg="command execution failed: %s -> %r"%(cmd,str(output))
+			raise ValueError,msg
+		output=''
+	return output
+reg_subst=re.compile(r"(\\\\)|(\\\$)|\$\{([^}]+)\}")
+def subst_vars(expr,params):
+	def repl_var(m):
+		if m.group(1):
+			return'\\'
+		if m.group(2):
+			return'$'
+		return params[m.group(3)]
+	return reg_subst.sub(repl_var,expr)
+def detect_platform():
+	s=sys.platform
+	for x in'cygwin linux irix sunos hpux aix darwin'.split():
+		if s.find(x)>=0:
+			return x
+	if os.name in'posix java os2'.split():
+		return os.name
+	return s
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/__init__.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/__init__.py
new file mode 100644
index 0000000..cbc8406
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/__init__.py
@@ -0,0 +1,4 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+
diff --git a/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/pproc.py b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/pproc.py
new file mode 100644
index 0000000..67b39f9
--- /dev/null
+++ b/.waf-1.5.0-8e39a4c1c16303c1e8f010bf330305f6/wafadmin/pproc.py
@@ -0,0 +1,496 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import sys
+mswindows=(sys.platform=="win32")
+import os
+import types
+import traceback
+import gc
+class CalledProcessError(Exception):
+	def __init__(self,returncode,cmd):
+		self.returncode=returncode
+		self.cmd=cmd
+	def __str__(self):
+		return"Command '%s' returned non-zero exit status %d"%(self.cmd,self.returncode)
+if mswindows:
+	import threading
+	import msvcrt
+	if 0:
+		import pywintypes
+		from win32api import GetStdHandle,STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE
+		from win32api import GetCurrentProcess,DuplicateHandle,GetModuleFileName,GetVersion
+		from win32con import DUPLICATE_SAME_ACCESS,SW_HIDE
+		from win32pipe import CreatePipe
+		from win32process import CreateProcess,STARTUPINFO,GetExitCodeProcess,STARTF_USESTDHANDLES,STARTF_USESHOWWINDOW,CREATE_NEW_CONSOLE
+		from win32event import WaitForSingleObject,INFINITE,WAIT_OBJECT_0
+	else:
+		from _subprocess import*
+		class STARTUPINFO:
+			dwFlags=0
+			hStdInput=None
+			hStdOutput=None
+			hStdError=None
+			wShowWindow=0
+		class pywintypes:
+			error=IOError
+else:
+	import select
+	import errno
+	import fcntl
+	import pickle
+__all__=["Popen","PIPE","STDOUT","call","check_call","CalledProcessError"]
+try:
+	MAXFD=os.sysconf("SC_OPEN_MAX")
+except:
+	MAXFD=256
+try:
+	False
+except NameError:
+	False=0
+	True=1
+_active=[]
+def _cleanup():
+	for inst in _active[:]:
+		if inst.poll(_deadstate=sys.maxint)>=0:
+			try:
+				_active.remove(inst)
+			except ValueError:
+				pass
+PIPE=-1
+STDOUT=-2
+def call(*popenargs,**kwargs):
+	return Popen(*popenargs,**kwargs).wait()
+def check_call(*popenargs,**kwargs):
+	retcode=call(*popenargs,**kwargs)
+	cmd=kwargs.get("args")
+	if cmd is None:
+		cmd=popenargs[0]
+	if retcode:
+		raise CalledProcessError(retcode,cmd)
+	return retcode
+def list2cmdline(seq):
+	result=[]
+	needquote=False
+	for arg in seq:
+		bs_buf=[]
+		if result:
+			result.append(' ')
+		needquote=(" "in arg)or("\t"in arg)or arg==""
+		if needquote:
+			result.append('"')
+		for c in arg:
+			if c=='\\':
+				bs_buf.append(c)
+			elif c=='"':
+				result.append('\\'*len(bs_buf)*2)
+				bs_buf=[]
+				result.append('\\"')
+			else:
+				if bs_buf:
+					result.extend(bs_buf)
+					bs_buf=[]
+				result.append(c)
+		if bs_buf:
+			result.extend(bs_buf)
+		if needquote:
+			result.extend(bs_buf)
+			result.append('"')
+	return''.join(result)
+class Popen(object):
+	def __init__(self,args,bufsize=0,executable=None,stdin=None,stdout=None,stderr=None,preexec_fn=None,close_fds=False,shell=False,cwd=None,env=None,universal_newlines=False,startupinfo=None,creationflags=0):
+		_cleanup()
+		self._child_created=False
+		if not isinstance(bufsize,(int,long)):
+			raise TypeError("bufsize must be an integer")
+		if mswindows:
+			if preexec_fn is not None:
+				raise ValueError("preexec_fn is not supported on Windows platforms")
+			if close_fds:
+				raise ValueError("close_fds is not supported on Windows platforms")
+		else:
+			if startupinfo is not None:
+				raise ValueError("startupinfo is only supported on Windows platforms")
+			if creationflags!=0:
+				raise ValueError("creationflags is only supported on Windows platforms")
+		self.stdin=None
+		self.stdout=None
+		self.stderr=None
+		self.pid=None
+		self.returncode=None
+		self.universal_newlines=universal_newlines
+		(p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite)=self._get_handles(stdin,stdout,stderr)
+		self._execute_child(args,executable,preexec_fn,close_fds,cwd,env,universal_newlines,startupinfo,creationflags,shell,p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite)
+		if mswindows:
+			if stdin is None and p2cwrite is not None:
+				os.close(p2cwrite)
+				p2cwrite=None
+			if stdout is None and c2pread is not None:
+				os.close(c2pread)
+				c2pread=None
+			if stderr is None and errread is not None:
+				os.close(errread)
+				errread=None
+		if p2cwrite:
+			self.stdin=os.fdopen(p2cwrite,'wb',bufsize)
+		if c2pread:
+			if universal_newlines:
+				self.stdout=os.fdopen(c2pread,'rU',bufsize)
+			else:
+				self.stdout=os.fdopen(c2pread,'rb',bufsize)
+		if errread:
+			if universal_newlines:
+				self.stderr=os.fdopen(errread,'rU',bufsize)
+			else:
+				self.stderr=os.fdopen(errread,'rb',bufsize)
+	def _translate_newlines(self,data):
+		data=data.replace("\r\n","\n")
+		data=data.replace("\r","\n")
+		return data
+	def __del__(self,sys=sys):
+		if not self._child_created:
+			return
+		self.poll(_deadstate=sys.maxint)
+		if self.returncode is None and _active is not None:
+			_active.append(self)
+	def communicate(self,input=None):
+		if[self.stdin,self.stdout,self.stderr].count(None)>=2:
+			stdout=None
+			stderr=None
+			if self.stdin:
+				if input:
+					self.stdin.write(input)
+				self.stdin.close()
+			elif self.stdout:
+				stdout=self.stdout.read()
+			elif self.stderr:
+				stderr=self.stderr.read()
+			self.wait()
+			return(stdout,stderr)
+		return self._communicate(input)
+	if mswindows:
+		def _get_handles(self,stdin,stdout,stderr):
+			if stdin is None and stdout is None and stderr is None:
+				return(None,None,None,None,None,None)
+			p2cread,p2cwrite=None,None
+			c2pread,c2pwrite=None,None
+			errread,errwrite=None,None
+			if stdin is None:
+				p2cread=GetStdHandle(STD_INPUT_HANDLE)
+			if p2cread is not None:
+				pass
+			elif stdin is None or stdin==PIPE:
+				p2cread,p2cwrite=CreatePipe(None,0)
+				p2cwrite=p2cwrite.Detach()
+				p2cwrite=msvcrt.open_osfhandle(p2cwrite,0)
+			elif isinstance(stdin,int):
+				p2cread=msvcrt.get_osfhandle(stdin)
+			else:
+				p2cread=msvcrt.get_osfhandle(stdin.fileno())
+			p2cread=self._make_inheritable(p2cread)
+			if stdout is None:
+				c2pwrite=GetStdHandle(STD_OUTPUT_HANDLE)
+			if c2pwrite is not None:
+				pass
+			elif stdout is None or stdout==PIPE:
+				c2pread,c2pwrite=CreatePipe(None,0)
+				c2pread=c2pread.Detach()
+				c2pread=msvcrt.open_osfhandle(c2pread,0)
+			elif isinstance(stdout,int):
+				c2pwrite=msvcrt.get_osfhandle(stdout)
+			else:
+				c2pwrite=msvcrt.get_osfhandle(stdout.fileno())
+			c2pwrite=self._make_inheritable(c2pwrite)
+			if stderr is None:
+				errwrite=GetStdHandle(STD_ERROR_HANDLE)
+			if errwrite is not None:
+				pass
+			elif stderr is None or stderr==PIPE:
+				errread,errwrite=CreatePipe(None,0)
+				errread=errread.Detach()
+				errread=msvcrt.open_osfhandle(errread,0)
+			elif stderr==STDOUT:
+				errwrite=c2pwrite
+			elif isinstance(stderr,int):
+				errwrite=msvcrt.get_osfhandle(stderr)
+			else:
+				errwrite=msvcrt.get_osfhandle(stderr.fileno())
+			errwrite=self._make_inheritable(errwrite)
+			return(p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite)
+		def _make_inheritable(self,handle):
+			return DuplicateHandle(GetCurrentProcess(),handle,GetCurrentProcess(),0,1,DUPLICATE_SAME_ACCESS)
+		def _find_w9xpopen(self):
+			w9xpopen=os.path.join(os.path.dirname(GetModuleFileName(0)),"w9xpopen.exe")
+			if not os.path.exists(w9xpopen):
+				w9xpopen=os.path.join(os.path.dirname(sys.exec_prefix),"w9xpopen.exe")
+				if not os.path.exists(w9xpopen):
+					raise RuntimeError("Cannot locate w9xpopen.exe, which is needed for Popen to work with your shell or platform.")
+			return w9xpopen
+		def _execute_child(self,args,executable,preexec_fn,close_fds,cwd,env,universal_newlines,startupinfo,creationflags,shell,p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite):
+			if not isinstance(args,types.StringTypes):
+				args=list2cmdline(args)
+			if startupinfo is None:
+				startupinfo=STARTUPINFO()
+			if None not in(p2cread,c2pwrite,errwrite):
+				startupinfo.dwFlags|=STARTF_USESTDHANDLES
+				startupinfo.hStdInput=p2cread
+				startupinfo.hStdOutput=c2pwrite
+				startupinfo.hStdError=errwrite
+			if shell:
+				startupinfo.dwFlags|=STARTF_USESHOWWINDOW
+				startupinfo.wShowWindow=SW_HIDE
+				comspec=os.environ.get("COMSPEC","cmd.exe")
+				args=comspec+" /c "+args
+				if(GetVersion()>=0x80000000L or os.path.basename(comspec).lower()=="command.com"):
+					w9xpopen=self._find_w9xpopen()
+					args='"%s" %s'%(w9xpopen,args)
+					creationflags|=CREATE_NEW_CONSOLE
+			try:
+				hp,ht,pid,tid=CreateProcess(executable,args,None,None,1,creationflags,env,cwd,startupinfo)
+			except pywintypes.error,e:
+				raise WindowsError(*e.args)
+			self._child_created=True
+			self._handle=hp
+			self.pid=pid
+			ht.Close()
+			if p2cread is not None:
+				p2cread.Close()
+			if c2pwrite is not None:
+				c2pwrite.Close()
+			if errwrite is not None:
+				errwrite.Close()
+		def poll(self,_deadstate=None):
+			if self.returncode is None:
+				if WaitForSingleObject(self._handle,0)==WAIT_OBJECT_0:
+					self.returncode=GetExitCodeProcess(self._handle)
+			return self.returncode
+		def wait(self):
+			if self.returncode is None:
+				obj=WaitForSingleObject(self._handle,INFINITE)
+				self.returncode=GetExitCodeProcess(self._handle)
+			return self.returncode
+		def _readerthread(self,fh,buffer):
+			buffer.append(fh.read())
+		def _communicate(self,input):
+			stdout=None
+			stderr=None
+			if self.stdout:
+				stdout=[]
+				stdout_thread=threading.Thread(target=self._readerthread,args=(self.stdout,stdout))
+				stdout_thread.setDaemon(True)
+				stdout_thread.start()
+			if self.stderr:
+				stderr=[]
+				stderr_thread=threading.Thread(target=self._readerthread,args=(self.stderr,stderr))
+				stderr_thread.setDaemon(True)
+				stderr_thread.start()
+			if self.stdin:
+				if input is not None:
+					self.stdin.write(input)
+				self.stdin.close()
+			if self.stdout:
+				stdout_thread.join()
+			if self.stderr:
+				stderr_thread.join()
+			if stdout is not None:
+				stdout=stdout[0]
+			if stderr is not None:
+				stderr=stderr[0]
+			if self.universal_newlines and hasattr(file,'newlines'):
+				if stdout:
+					stdout=self._translate_newlines(stdout)
+				if stderr:
+					stderr=self._translate_newlines(stderr)
+			self.wait()
+			return(stdout,stderr)
+	else:
+		def _get_handles(self,stdin,stdout,stderr):
+			p2cread,p2cwrite=None,None
+			c2pread,c2pwrite=None,None
+			errread,errwrite=None,None
+			if stdin is None:
+				pass
+			elif stdin==PIPE:
+				p2cread,p2cwrite=os.pipe()
+			elif isinstance(stdin,int):
+				p2cread=stdin
+			else:
+				p2cread=stdin.fileno()
+			if stdout is None:
+				pass
+			elif stdout==PIPE:
+				c2pread,c2pwrite=os.pipe()
+			elif isinstance(stdout,int):
+				c2pwrite=stdout
+			else:
+				c2pwrite=stdout.fileno()
+			if stderr is None:
+				pass
+			elif stderr==PIPE:
+				errread,errwrite=os.pipe()
+			elif stderr==STDOUT:
+				errwrite=c2pwrite
+			elif isinstance(stderr,int):
+				errwrite=stderr
+			else:
+				errwrite=stderr.fileno()
+			return(p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite)
+		def _set_cloexec_flag(self,fd):
+			try:
+				cloexec_flag=fcntl.FD_CLOEXEC
+			except AttributeError:
+				cloexec_flag=1
+			old=fcntl.fcntl(fd,fcntl.F_GETFD)
+			fcntl.fcntl(fd,fcntl.F_SETFD,old|cloexec_flag)
+		def _close_fds(self,but):
+			for i in xrange(3,MAXFD):
+				if i==but:
+					continue
+				try:
+					os.close(i)
+				except:
+					pass
+		def _execute_child(self,args,executable,preexec_fn,close_fds,cwd,env,universal_newlines,startupinfo,creationflags,shell,p2cread,p2cwrite,c2pread,c2pwrite,errread,errwrite):
+			if isinstance(args,types.StringTypes):
+				args=[args]
+			else:
+				args=list(args)
+			if shell:
+				args=["/bin/sh","-c"]+args
+			if executable is None:
+				executable=args[0]
+			errpipe_read,errpipe_write=os.pipe()
+			self._set_cloexec_flag(errpipe_write)
+			gc_was_enabled=gc.isenabled()
+			gc.disable()
+			try:
+				self.pid=os.fork()
+			except:
+				if gc_was_enabled:
+					gc.enable()
+				raise
+			self._child_created=True
+			if self.pid==0:
+				try:
+					if p2cwrite:
+						os.close(p2cwrite)
+					if c2pread:
+						os.close(c2pread)
+					if errread:
+						os.close(errread)
+					os.close(errpipe_read)
+					if p2cread:
+						os.dup2(p2cread,0)
+					if c2pwrite:
+						os.dup2(c2pwrite,1)
+					if errwrite:
+						os.dup2(errwrite,2)
+					if p2cread and p2cread not in(0,):
+						os.close(p2cread)
+					if c2pwrite and c2pwrite not in(p2cread,1):
+						os.close(c2pwrite)
+					if errwrite and errwrite not in(p2cread,c2pwrite,2):
+						os.close(errwrite)
+					if close_fds:
+						self._close_fds(but=errpipe_write)
+					if cwd is not None:
+						os.chdir(cwd)
+					if preexec_fn:
+						apply(preexec_fn)
+					if env is None:
+						os.execvp(executable,args)
+					else:
+						os.execvpe(executable,args,env)
+				except:
+					exc_type,exc_value,tb=sys.exc_info()
+					exc_lines=traceback.format_exception(exc_type,exc_value,tb)
+					exc_value.child_traceback=''.join(exc_lines)
+					os.write(errpipe_write,pickle.dumps(exc_value))
+				os._exit(255)
+			if gc_was_enabled:
+				gc.enable()
+			os.close(errpipe_write)
+			if p2cread and p2cwrite:
+				os.close(p2cread)
+			if c2pwrite and c2pread:
+				os.close(c2pwrite)
+			if errwrite and errread:
+				os.close(errwrite)
+			data=os.read(errpipe_read,1048576)
+			os.close(errpipe_read)
+			if data!="":
+				os.waitpid(self.pid,0)
+				child_exception=pickle.loads(data)
+				raise child_exception
+		def _handle_exitstatus(self,sts):
+			if os.WIFSIGNALED(sts):
+				self.returncode=-os.WTERMSIG(sts)
+			elif os.WIFEXITED(sts):
+				self.returncode=os.WEXITSTATUS(sts)
+			else:
+				raise RuntimeError("Unknown child exit status!")
+		def poll(self,_deadstate=None):
+			if self.returncode is None:
+				try:
+					pid,sts=os.waitpid(self.pid,os.WNOHANG)
+					if pid==self.pid:
+						self._handle_exitstatus(sts)
+				except os.error:
+					if _deadstate is not None:
+						self.returncode=_deadstate
+			return self.returncode
+		def wait(self):
+			if self.returncode is None:
+				pid,sts=os.waitpid(self.pid,0)
+				self._handle_exitstatus(sts)
+			return self.returncode
+		def _communicate(self,input):
+			read_set=[]
+			write_set=[]
+			stdout=None
+			stderr=None
+			if self.stdin:
+				self.stdin.flush()
+				if input:
+					write_set.append(self.stdin)
+				else:
+					self.stdin.close()
+			if self.stdout:
+				read_set.append(self.stdout)
+				stdout=[]
+			if self.stderr:
+				read_set.append(self.stderr)
+				stderr=[]
+			input_offset=0
+			while read_set or write_set:
+				rlist,wlist,xlist=select.select(read_set,write_set,[])
+				if self.stdin in wlist:
+					bytes_written=os.write(self.stdin.fileno(),buffer(input,input_offset,512))
+					input_offset+=bytes_written
+					if input_offset>=len(input):
+						self.stdin.close()
+						write_set.remove(self.stdin)
+				if self.stdout in rlist:
+					data=os.read(self.stdout.fileno(),1024)
+					if data=="":
+						self.stdout.close()
+						read_set.remove(self.stdout)
+					stdout.append(data)
+				if self.stderr in rlist:
+					data=os.read(self.stderr.fileno(),1024)
+					if data=="":
+						self.stderr.close()
+						read_set.remove(self.stderr)
+					stderr.append(data)
+			if stdout is not None:
+				stdout=''.join(stdout)
+			if stderr is not None:
+				stderr=''.join(stderr)
+			if self.universal_newlines and hasattr(file,'newlines'):
+				if stdout:
+					stdout=self._translate_newlines(stdout)
+				if stderr:
+					stderr=self._translate_newlines(stderr)
+			self.wait()
+			return(stdout,stderr)
+
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index be46a20..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,96 +0,0 @@
-JACK was inspired by and partially designed during discussions on the
-Linux Audio Developers mailing list. Particularly significant
-contributions to those discussions came from (in alphabetical order):
-
-    Paul Davis
-    David Olofson
-    Benno Sennoner
-    Kai Vehmanen
-    
-Many other members of LAD contributed ideas to JACK, particularly
-Richard Guenther.
-
-CONTRIBUTORS (in rough chronological order)
-
-Paul Davis 
-	the principal author of the JACK API and of the
-	implementation contained here.  
-
-Jack O'Quin 
-	frequently acted as the primary maintainer of JACK for long
-	periods, and has contributed many new interfaces and bug fixes.  
-
-Andy Wingo 
-Kai Vehmanen
-	provided many small patches and documentation.  
-
-Fernando Pablo Lopez-Lezcano 
-	contributed the capabilities-based code for Linux 2.4,
-	and the RPM specfile.
-
-Jeremy Hall
-Steve Harris 
-Martin Boer 
-	contributed sample clients and utilities.  
-
-Taybin Rutkin 
-	manages releases and patch handling.
-
-Melanie Thielker 
-	contributed significantly to JACK's interaction with
-	aspects of both POSIX and System V APIs.  
-
-Stephane Letz 
-	ported JACK to Mac OS X and Windows, reimplemented
-	JACK in C++ to give Jackdmp/JACK 2, lots of design
-	work, bug fixes and testing.
-
-Jussi Laako 
-	wrote the OSS driver interface.  
-
-Tilman Linneweh 
-	ported JACK to FreeBSD.  
-
-Johnny Petrantoni 
-	wrote the Mac OS X CoreAudio driver interface.  
-
-Rui Nuno Capela 
-	designed and implemented JACK improvements to work with his
-	QJackCtl graphical interface for JACK.  
-
-Karsten Wiese 
-	(with Rui) added US-X2Y USB device support to the
-	ALSA backend, added read/write lock support.
-
-Lee Revell 
-	contributed statistical interfaces and much low-latency realtime testing.
-
-Ian Esten
-	wrote JACK's MIDI port handling and API, along with example
-	MIDI clients.
-
-Frank van der Pol
-	wrote the COMPLEX_MMAP patch for ALSA, allowing JACK to run
-	on multi-device PCM configurations.
-
-Dmitry Baikov
-	wrote the jackmidi ALSA hardware support.
-
-Pieter Palmers
-	wrote the freebob and firewire backends and some bugfixes.
-	add jack-midi support to netjack
-
-Nedko Arnaudov
-	contributed several fixes
-
-Jacob Meuser
-	contributed the sun backend.
-
-Marc-Olivier Barre
-	help with netjack integration and cleanup
-
-Torben Hohn
-       wrote netjack, implemented mixed 64/32 bit support and bug fixes.
-
-Many others have contributed patches and/or test results, and we thank
-them all.
diff --git a/BUILDING-FOR-LINUX-2.4-KERNEL b/BUILDING-FOR-LINUX-2.4-KERNEL
deleted file mode 100644
index 6efde3b..0000000
--- a/BUILDING-FOR-LINUX-2.4-KERNEL
+++ /dev/null
@@ -1,35 +0,0 @@
-Specific Instructions for a 2.4 Linux kernel
---------------------------------------------
-
-Before using JACK in realtime mode with a 2.4 kernel, you may
-need or want to take the following steps. A better choice is
-to use a 2.6 kernel.
-
-1) in /usr/src/linux/include/linux/capability.h find these lines
-
-#define CAP_INIT_EFF_SET    to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP))
-#define CAP_INIT_INH_SET    to_cap_t(0)
-
-   and change them to
-
-#define CAP_INIT_EFF_SET    to_cap_t(~0)
-#define CAP_INIT_INH_SET    to_cap_t(~0)
-
-   then recompile your kernel and boot it.  (Note that the above lines
-   are from linux 2.4.19; it may be different if you're using a
-   different version)
-
-   NB: This may expose your system to local denial of service attacks.
-   If it is a shared system or server, you should assess the impact of
-   enabling capabilities in the context of your overall system security
-   requirements.
-
-2) install libcap from
-   ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/
-
-3) if you're using a journalling filesystem, mount some directory with
-   -t tmpfs and use this with JACK's configure step as the
-   argument to --with-default-tmpdir.
-
-4) use --enable-capabilities with JACK's configure step
-
diff --git a/COPYING b/COPYING
deleted file mode 100644
index e1b524c..0000000
--- a/COPYING
+++ /dev/null
@@ -1,4 +0,0 @@
-Files in this tree are mainly licensed under the GPL, as noted in the
-file headers. However, the libjack/ tree is licensed under the LGPL in
-order to allow for proprietary usage of Jack. Please see COPYING.GPL and
-COPYING.LGPL for more information on these two licenses.
diff --git a/COPYING.GPL b/COPYING.GPL
deleted file mode 100644
index d60c31a..0000000
--- a/COPYING.GPL
+++ /dev/null
@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/COPYING.LGPL b/COPYING.LGPL
deleted file mode 100644
index c396169..0000000
--- a/COPYING.LGPL
+++ /dev/null
@@ -1,503 +0,0 @@
-                  GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                            Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-                  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                            NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..91292e2
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,1542 @@
+---------------------------
+  Contributors
+---------------------------
+
+Dmitry Baikov
+Gabriel M. Beddingfield
+Steven Chamberlain
+Thom Johansen
+Thibault LeMeur
+Tom Szilagyi
+Andrzej Szombierski 
+Kjetil S.Matheussen
+Pieter Palmers
+Tim Blechmann
+Marc-Olivier Barre
+Nedko Arnaudov
+Fernando Lopez-Lezcano
+Romain Moret
+Florian Faber
+Michael Voigt
+Torben Hohn  
+Paul Davis
+Peter L Jones
+Devin Anderson
+Josh Green
+Mario Lang
+
+---------------------------
+  Jackdmp changes log
+---------------------------
+
+2010-01-29 Gabriel M. Beddingfield <gabriel at teuton.org>
+
+	* Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF.
+
+2009-12-15 Stephane Letz  <letz at grame.fr>
+
+	* Shared memory manager was calling abort in case of fatal error, now return an error in caller.
+
+2009-12-13 Stephane Letz  <letz at grame.fr>
+
+	* Mario Lang alsa_io time calculation overflow patch.
+
+2009-12-10 Stephane Letz  <letz at grame.fr>
+
+	* Use a QUIT notification to properly quit the server channel, the server channel thread can then be 'stopped' instead of 'canceled'.
+
+2009-12-09 Stephane Letz  <letz at grame.fr>
+
+	* When threads are cancelled, the exception has to be rethrown. 
+
+2009-12-08 Stephane Letz  <letz at grame.fr>
+
+	* Josh Green ALSA driver capture only patch.  
+
+2009-12-03 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackCoreMidiDriver::ReadProcAux when ring buffer is full (thanks Devin Anderson).  
+
+2009-12-02 Stephane Letz  <letz at grame.fr>
+
+	* Special code in JackCoreAudio driver to handle completely buggy Digidesign CoreAudio user-land driver. 
+	* Ensure that client-side message buffer thread calls thread_init callback if/when it is set by the client (backport of JACK1 rev 3838).
+	* Check dynamic port-max value.
+
+2009-12-01 Stephane Letz  <letz at grame.fr>
+
+	* Fix port_rename callback : now both old name and new name are given as parameters.
+
+2009-11-30 Stephane Letz  <letz at grame.fr>
+
+	* Devin Anderson patch for Jack FFADO driver issues with lost MIDI bytes between periods (and more). 
+
+2009-11-29 Stephane Letz  <letz at grame.fr>
+
+	* More robust sample rate change handling code in JackCoreAudioDriver.
+
+2009-11-24 Stephane Letz  <letz at grame.fr>
+
+	* Dynamic choice of maximum port number.
+
+2009-11-23 Stephane Letz  <letz at grame.fr>
+
+	* Peter L Jones patch for NetJack1 compilation on Windows.
+
+2009-11-20 Stephane Letz  <letz at grame.fr>
+
+	* Version 1.9.5 started.
+	* Client debugging code improved.
+
+2009-11-18 Stephane Letz  <letz at grame.fr>
+
+	* Sync JackCoreAudioAdapter code with JackCoreAudioDriver.
+
+2009-11-17 Stephane Letz  <letz at grame.fr>
+
+	* In JackCoreAudio driver, clock drift compensation in aggregated devices working.
+	* In JackCoreAudio driver, clock drift compensation semantic changed a bit : when on, does not activate if not needed (same clock domain).
+
+2009-11-16 Stephane Letz  <letz at grame.fr>
+
+	* In JackCoreAudio driver, (possibly) clock drift compensation when needed in aggregated devices.
+
+2009-11-14 Stephane Letz  <letz at grame.fr>
+
+	* Sync with JACK1 : -r parameter now used for no-realtime, realtime (-R) is now default, usable backend given vie platform.
+
+2009-11-13 Stephane Letz  <letz at grame.fr>
+
+	* Better memory allocation error checking in ringbuffer.c, weak import improvements.
+	* Memory allocation error checking for jack_client_new and jack_client_open (server and client side).
+	* Memory allocation error checking in server for RPC.
+	* Simplify server temporary mode : now use a JackTemporaryException.
+	* Lock/Unlock shared memory segments (to test...).
+
+2009-11-12 Stephane Letz  <letz at grame.fr>
+
+	* Better memory allocation error checking on client (library) side. 
+
+2009-11-11 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackCoreAudio driver when empty strings are given as -C, -P or -d parameter. 
+
+2009-11-10 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackInfoShutdownCallback prototype, two new JackClientProcessFailure and JackClientZombie JackStatus code.  
+
+2009-11-09 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackGraphManager::GetBuffer for the "client loop with one connection" case : buffer must be copied.
+
+2009-11-07 Stephane Letz  <letz at grame.fr>
+
+	* Fix AcquireRealTime and DropRealTime: now distinguish when called from another thread (AcquireRealTime/DropRealTime) and from the thread itself (AcquireSelfRealTime/DropSelfRealTime).
+	* Correct JackPosixThread::StartImp : thread priority setting now done in the RT case only.
+
+2009-11-06 Stephane Letz  <letz at grame.fr>
+
+	* Correctly save and restore RT mode state in freewheel mode.
+	* Correct freewheel code on client side.
+
+2009-11-05 Stephane Letz  <letz at grame.fr>
+
+	* No reason to make jack_on_shutdown deprecated, so revert the incorrect change.
+	* Thread AcquireRealTime and DropRealTime were (incorrectly) using fThread field. Use pthread_self()) (or GetCurrentThread() on Windows) to get the calling thread.
+
+2009-10-30 Stephane Letz  <letz at grame.fr>
+
+	* In JackCoreAudioDriver, improve management of input/output channels: -1 is now used internally to indicate a wanted max value. 
+	* In JackCoreAudioDriver::OpenAUHAL, correct stream format setup and cleanup. 
+	* Correct crash bug in JackAudioAdapterInterface when not input is used in adapter (temporary fix...)
+	* Sync JackCoreAudioAdapter code on JackCoreAudioDriver one.
+	* JACK_SCHED_POLICY switched to SCHED_FIFO.
+	* Now can aggregate device that are themselves AD.
+
+2009-10-29 Stephane Letz  <letz at grame.fr>
+
+	* In JackCoreAudioDriver::Start, wait for the audio driver to effectively start (use the MeasureCallback).
+
+2009-10-28 Stephane Letz  <letz at grame.fr>
+
+	* In JackCoreAudioDriver, force the SR value to the wanted one *before* creating aggregate device (otherwise creation will fail). 
+	* In JackCoreAudioDriver, better cleanup of AD when intermediate open failure.
+
+2009-10-27 Stephane Letz  <letz at grame.fr>
+
+	* Dynamic system version detection in JackCoreAudioDriver to either create public or private aggregate device.
+
+2009-10-26 Stephane Letz  <letz at grame.fr>
+
+	* Implement "hog mode" (exclusive access of the audio device) in JackCoreAudioDriver.
+	* Fix jack_set_sample_rate_callback to have he same behavior as in JACK1.
+
+2009-10-25 Stephane Letz  <letz at grame.fr>
+
+	* Improve aggregate device management in JackCoreAudioDriver : now a "private" device only and cleanup properly.
+	* Aggregate device code added to JackCoreAudioAdapter.
+
+2009-10-23 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackProcessSync::LockedTimedWait.
+	* Correct JACK_MESSAGE_SIZE value, particularly in OSX RPC code.
+	* Now start server channel thread only when backend has been started (so in JackServer::Start). Should solve race conditions at start time.
+	* jack_verbose moved to JackGlobals class.
+
+2009-10-22 Stephane Letz  <letz at grame.fr>
+
+	* Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048.
+
+2009-10-20 Stephane Letz  <letz at grame.fr>
+
+	* Add a string parameter to server ==> client notification, add a new JackInfoShutdownCallback type.
+	* CoreAudio backend now issue a JackInfoShutdownCallback when an unrecoverable error is detected (sampling rate change, stream configuration changeÉ)
+
+2009-10-17 Stephane Letz  <letz at grame.fr>
+
+	* Correct server temporary mode : now set a global and quit after server/client message handling is finished.
+
+2009-10-15 Stephane Letz  <letz at grame.fr>
+
+	* Change CoreAudio notification thread setup for OSX Snow Leopard.
+
+2009-09-18 Stephane Letz  <letz at grame.fr>
+
+	* Simplify transport in NetJack2: master only can control transport.
+
+2009-09-15 Stephane Letz  <letz at grame.fr>
+
+	* Correct CPU timing in JackNetDriver, now take cycle begin time after Read.
+	* Fix issues in JackNetDriver::DecodeTransportData and JackNetDriver::Initialize.
+
+2009-08-28 Stephane Letz  <letz at grame.fr>
+
+	* Correct monitor port naming in JackAudioDriver and JackCoreAudioDriver.
+	* Big endian bug fix in memops.c (http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=11_be24bit.patch;att=1;bug=486308)
+
+2009-07-31 Stephane Letz  <letz at grame.fr>
+
+	* Use SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART API to synchronize input and output in Solaris boomer backend.
+
+2009-07-29 Stephane Letz  <letz at grame.fr>
+
+	* Add a -G parameter in CoreAudio backend (the computation value in RT thread expressed as percent of period).
+
+2009-07-28 Stephane Letz  <letz at grame.fr>
+
+	* Fix CopyAndConvertIn for Solaris backends.
+
+2009-07-22 Stephane Letz  <letz at grame.fr>
+
+	* Version 1.9.4 started.
+	* Solaris boomer backend now working in capture or playback only mode.
+	* Fix control.h for proper compilation on Solaris.
+
+2009-07-17 Stephane Letz  <letz at grame.fr>
+
+	* Loopback backend reborn as a dynamically loadable separated backend.
+	* -L parameter for loopback backend activated again in jackd.
+
+2009-07-17 Stephane Letz  <letz at grame.fr>
+
+	* Big rewrite of Solaris boomer driver, seems to work in duplex mode at least.
+
+2009-07-16 Stephane Letz  <letz at grame.fr>
+
+	* In combined --dbus and --classic compilation code, use PulseAudio acquire/release code.
+
+2009-07-15 Stephane Letz  <letz at grame.fr>
+
+	* Rename JackDriver::Init method to JackDriver::Initialize (to avoid confusion with JackThread::Init method).
+	* Update Solaris boomer driver.
+	* Report some cleanup and documentation improvements done on JACK1 timing functions.
+
+2009-07-11 Stephane Letz  <letz at grame.fr>
+
+	* Raise drivers time out used in synchronous mode.
+
+2009-07-09 Stephane Letz  <letz at grame.fr>
+
+	* Use __attribute__((__packed__)) again, more fixes for 64/32 mixed mode.
+	* Torben Hohn changes for 64/32 mixed mode in wscripts.
+	* Add compile time option for maximum ports per application.
+
+2009-07-07 Stephane Letz  <letz at grame.fr>
+
+	* Use __attribute__((__aligned__(32))) instead of __attribute__((__packed__)) for 64/32 mixed mode.
+
+2009-07-03 Stephane Letz  <letz at grame.fr>
+
+	* Another Tim Bechmann memops.c optimization patch.
+
+2009-07-01 Stephane Letz  <letz at grame.fr>
+
+	* Tim Bechmann memops.c optimization patch.
+
+2009-06-30 Stephane Letz  <letz at grame.fr>
+
+	* Tim Bechmann patch : hammerfall, only release monitor thread, if it has been created.
+
+2009-06-19 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackTransportEngine::MakeAllLocating, sync callback has to be called in this case also.
+	* NetJack2 code : better error checkout, method renaming.
+
+2009-06-17 Stephane Letz  <letz at grame.fr>
+
+	* Move DBus based audio device reservation code in ALSA backend compilation.
+
+2009-06-16 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackFifo::TimedWait for EINTR handling.
+
+2009-06-05 Stephane Letz  <letz at grame.fr>
+
+	* Correct jack_set_error_function, jack_set_info_function and jack_set_thread_creator functions.
+
+2009-05-18 Stephane Letz  <letz at grame.fr>
+
+	* Correct wcsript files to create jackdbus only (and not create jackd anymore) when compiled in --dbus mode, add a --classic option. Both options are possible but issue a warning.
+
+2009-05-15 Stephane Letz  <letz at grame.fr>
+
+	* Move InitFrameTime in JackDriver::Start method.
+
+2009-05-13 Stephane Letz  <letz at grame.fr>
+
+	* Reworked Torben Hohn fix for server restart issue on Windows.
+
+2009-05-11 Stephane Letz  <letz at grame.fr>
+
+	* New jack_free function added in jack.h.
+	* Torben Hohn fix for InitTime and GetMicroSeconds in JackWinTime.c.
+
+2009-05-07 Stephane Letz  <letz at grame.fr>
+
+	* Cleanup "loopback" stuff in server.
+
+2009-05-06 Stephane Letz  <letz at grame.fr>
+
+	* Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running).
+	* D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API.
+
+2009-05-05 Stephane Letz  <letz at grame.fr>
+
+	* First working version of native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver).
+
+2009-04-22 Stephane Letz  <letz at grame.fr>
+
+	* jackctl_server_load_master renamed to jackctl_server_switch_master, jackctl_server_unload_master is removed.
+
+2009-04-21 Stephane Letz  <letz at grame.fr>
+
+	* Add jackctl_server_load_master/jackctl_server_unload_master API.
+
+2009-04-20 Stephane Letz  <letz at grame.fr>
+
+	* In ALSA audio card reservation code, tries to open the card even if reservation fails.
+	* Clock source setting on Linux.
+
+2009-04-08 Stephane Letz  <letz at grame.fr>
+
+	* Native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver) in progress.
+
+2009-04-03 Stephane Letz  <letz at grame.fr>
+
+	* Simplify JackClient RT code, jack_thread_wait API marked deprecated."
+
+2009-03-29 Stephane Letz  <letz at grame.fr>
+
+	* Cleanup JackInternalClient code.
+
+2009-03-27 Stephane Letz  <letz at grame.fr>
+
+	* Add a buffer size callback for netmaster that just remove the client (it will be recreated with the new parameters).
+
+2009-03-26 Stephane Letz  <letz at grame.fr>
+
+	* First working JackBoomerDriver two threads version.
+
+2009-03-24 Stephane Letz  <letz at grame.fr>
+
+	* New JackBoomerDriver class for Boomer driver on Solaris.
+	* Add mixed 32/64 bits mode (off by default).
+
+2009-03-23 Stephane Letz  <letz at grame.fr>
+
+	* Version 1.9.3 started.
+
+2009-03-19 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann optimization patch (inlining some heavy used methods).
+
+2009-03-12 Stephane Letz  <letz at grame.fr>
+
+        * Virtualize and allow overriding of thread creation function, to allow Wine support (from JACK1).
+
+2009-03-12 Stephane Letz  <letz at grame.fr>
+
+        * Try automatic adaptative mode in adapters.
+
+2009-03-11 Stephane Letz  <letz at grame.fr>
+
+        * Client incorrect re-naming fixed : now done at socket level also.
+
+2009-03-10 Stephane Letz  <letz at grame.fr>
+
+	* Add -g (ring-buffer) parameter to netadapter.
+	* Automatic adaptative ringbuffer size mode when -g = 0.
+
+2009-03-09 Stephane Letz  <letz at grame.fr>
+
+	* Use Torben Hohn PI controler code for adapters (in progress).
+
+2009-03-05 Stephane Letz  <letz at grame.fr>
+
+	* Support for BIG_ENDIAN machines in NetJack2 for transport data.
+	* Add auto_connect parameter in netmanager and netadapter.
+
+2009-03-03 Stephane Letz  <letz at grame.fr>
+
+	* More robust profiling tools when clients come and go.
+
+2009-03-01 Stephane Letz  <letz at grame.fr>
+
+	* Raise default port number to 1024.
+
+2009-02-27 Stephane Letz  <letz at grame.fr>
+
+	* Improve generated gnuplot files for adapting code.
+
+2009-02-25 Stephane Letz  <letz at grame.fr>
+
+	* Major cleanup in adapter code.
+
+2009-02-25 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackNetDriver::Close method.
+        * For audio device reservation, add card_to_num function.
+        * Fix buffer size and sample rate handling in JackAlsaAdapter.
+        * Add control for adapter ringbuffer size.
+	* Fix JackAlsaAdapter.h for 64 bits compilation.
+
+2009-02-23 Stephane Letz  <letz at grame.fr>
+
+	* Another fix in systemdeps.h and types.h: jack_time_t now uniquely defined in types.h.
+	* Move generic code and data in JackNetInterface and JackNetMasterInterface classes.
+        * First version of D-Bus based audio device reservation.
+
+2009-02-20 Stephane Letz  <letz at grame.fr>
+
+	* Add InitConnection and InitRendering methods in JackNetSlaveInterface, better packet type checking in JackNetSlaveInterface::SyncRecv.
+	* Change fMulticastIP handling in JackNetInterface.
+        * Cleanup systemdeps.h on Windows.
+
+2009-02-17 Stephane Letz  <letz at grame.fr>
+
+	* Fix the mutex/signal classes on Windows.
+        * Client incorrect re-naming fixed: now done at fifo level only.
+
+2009-02-16 Stephane Letz  <letz at grame.fr>
+
+	* Rework the mutex/signal classes. Use them in JackMessageBuffer.
+
+2009-02-11 Stephane Letz  <letz at grame.fr>
+
+	* Merge Solaris branch back on trunk.
+        * Equality of input and output buffer size removed (for now) in JackOSSDriver.
+
+2009-02-10 Stephane Letz  <letz at grame.fr>
+
+	* Add a resample quality parameter in netadapter.
+
+2009-02-09 Stephane Letz  <letz at grame.fr>
+
+	* Use PRIu32 kind of macro in JackAlsaDriver again.
+	* Now correctly return an error if JackServer::SetBufferSize could not change the buffer size (and was just restoring the current one).
+
+2009-02-05 Stephane Letz  <letz at grame.fr>
+
+	* Add a resample quality parameter in audioadapter.
+
+2009-02-01 Stephane Letz  <letz at grame.fr>
+
+	* Add a JACK_INTERNAL_DIR environment variable to be used for internal clients.
+
+2009-01-30 Stephane Letz  <letz at grame.fr>
+
+	* In NetJack2, fix a bug when capture or playback only channels are used.
+
+2009-01-29 Stephane Letz  <letz at grame.fr>
+
+	* Support for "-h" option in internal clients to print the parameters. 
+	* Support for BIG_ENDIAN machines in NetJack2 for MIDI ports.
+
+2009-01-28 Stephane Letz  <letz at grame.fr>
+
+	* Support for BIG_ENDIAN machines in NetJack2.
+
+2009-01-27 Stephane Letz  <letz at grame.fr>
+
+	* Better recovery of network overload situations, now "resynchronize" by skipping cycles."
+
+2009-01-26 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackNetInterface::SetNetBufferSize for socket buffer size computation and JackNetMasterInterface::DataRecv if synch packet is received, various cleanup.
+	* Fix in JackAlsaAdapter::Open.
+	* Simplify audio packet order verification.
+	* Set default mode to 'slow' in JackNetDriver and JackNetAdapter.
+
+2009-01-19 Stephane Letz  <letz at grame.fr>
+
+	* Synchronize ALSA backend code with JACK1 one.
+
+2009-01-17 Stephane Letz  <letz at grame.fr>
+
+	* JackMessageBuffer was using thread "Stop" scheme in destructor, now use the safer thread "Kill" way. 
+
+2009-01-14 Stephane Letz  <letz at grame.fr>
+
+	* Cleanup server starting code for clients directly linked with libjackserver.so.
+
+2009-01-09 Stephane Letz  <letz at grame.fr>
+
+	* JackProfiler scan already running clients (so can now be added anytime in the graph).
+
+2009-01-09 Stephane Letz  <letz at grame.fr>
+
+	* New JackProfiler class for real-time server monitoring. 
+
+2009-01-07 Stephane Letz  <letz at grame.fr>
+
+	* Use up to BUFFER_SIZE_MAX frames in midi ports, fix for ticket #117.
+
+2009-01-05 Stephane Letz  <letz at grame.fr>
+
+	* Synchronize jack2 public headers with JACK1 ones. 
+	* Implement jack_client_real_time_priority and jack_client_max_real_time_priority API.
+
+2008-12-18 Stephane Letz  <letz at grame.fr>
+
+	* For ALSA driver, synchronize with latest JACK1 memops functions. 
+    	* Use memops functions in JackOSSDriver.
+	* Use memops functions in JackOSSAdapter.
+
+2008-12-17 Stephane Letz  <letz at grame.fr>
+
+	* Use JACK_DRIVER_DIR variable in internal clients loader.
+
+2008-12-16 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackOSSDriver::SetBufferSize (was crashing when restoring old size), fix ticket #111.
+        * Force memory page in of profiling array in JackOSSDriver::Open.
+	* Cleanup profiling code.
+	* Client and library global context cleanup in case of incorrect shutdown handling (that is applications not correctly closing client after server has shutdown).
+
+2008-12-08 Stephane Letz  <letz at grame.fr>
+
+	* Forbid JackOSSDriver to run in "aynchronous" mode, correct DSP CPU computation.
+
+2008-12-04 Stephane Letz  <letz at grame.fr>
+
+	* More profiling in JackOSSDriver: sample conversion duration is measured. 
+
+2008-12-02 Stephane Letz  <letz at grame.fr>
+
+	* Optimize JackOSSDriver: no samples conversion if ports are not connected.
+
+2008-12-01 Stephane Letz  <letz at grame.fr>
+
+	* Force preload of memory table in JackEngineProfiling.
+
+2008-11-27 Stephane Letz  <letz at grame.fr>
+
+	* Add timing profiling code in JackOSSDriver.
+	* Report ringbuffer.c fixes from JACK1.
+
+2008-11-21 Stephane Letz  <letz at grame.fr>
+
+	* Report ringbuffer.c fixes from JACK1.
+	* Better isolation of server and clients system resources to allow starting the server in several user account at the same time.
+	* Correct ressource cleanup in case of driver open failure.
+
+2008-11-19 Stephane Letz  <letz at grame.fr>
+
+	* Libjack shutdown handler does not "deactivate" (fActive = false) the client anymore, so that jack_deactivate correctly does the job later on.
+	* Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server. 
+
+2008-11-14 Stephane Letz  <letz at grame.fr>
+
+	* Version 1.9.1 started, fix symbols export in ringbuffer.c, cleanup on Windows.
+
+2008-11-13 Stephane Letz  <letz at grame.fr>
+
+	* Fix jackctl_server_unload_internal.
+
+2008-10-30 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackClient::ShutDown.
+        * TimeOut management in JackNetUnixSocket on Solaris.
+ 
+2008-10-23 Stephane Letz  <letz at grame.fr>
+	
+	* In JackOSSDriver, vmix mode is used by default, exclusif (O_EXCL) mode can be selected with -e option.
+	* Fix a crash in JackEngine::Close when backend cannot be loaded.
+	* Tim Blechmann optimization patch.
+	* Backport of latest Paul alsa_seqmidi changes.
+
+2008-10-15 Stephane Letz  <letz at grame.fr>
+	
+	* Fix a conflict with Audio Hijack in JackCoreAudioDriver. 
+
+2008-10-09 Stephane Letz  <letz at grame.fr>
+	
+	* Use a mutex to make jack_client_open/jack_client_close thread safe, remove use of jack_init/jack_uninit.
+
+2008-10-08 Stephane Letz  <letz at grame.fr>
+	
+	* Fix a SMP related bug introduced in rev 2957 : remove the __SMP__ flag and define LOCK for SMP in all cases.
+
+2008-10-02 Stephane Letz  <letz at grame.fr>
+	
+	* Correct file permission for jack-shm-registry POSIX shared memory segment.
+	* Checking for libsamplerate in waf, fix ticket #89." 
+        * Header cleanup, add --clients and --ports options in configure.
+
+2008-09-22 Stephane Letz  <letz at grame.fr>
+	
+        * Socket time out implementation on Solaris.
+	* Fix a conflict with Audio Hijack in JackCoreAudioDriver. 
+
+2008-10-10 Stephane Letz  <letz at grame.fr>
+	
+	* Improve OSS backend : SNDCTL_DSP_SETFRAGMENT must be done before, use of AFMT_S16_LE kind of values. 
+
+2008-10-09 Stephane Letz  <letz at grame.fr>
+	
+	* First version of OSS backend.
+	* Use a mutex to make jack_client_open/jack_client_close thread safe, remove use of jack_init/jack_uninit.
+
+2008-10-08 Stephane Letz  <letz at grame.fr>
+	
+	* Fix a SMP related bug introduced in rev 2957 : remove the __SMP__ flag and define LOCK for SMP in all cases.
+
+2008-10-03 Stephane Letz  <letz at grame.fr>
+	
+	* Add engine profiling tools.
+
+2008-10-02 Stephane Letz  <letz at grame.fr>
+	
+	* Correct file permission for jack-shm-registry POSIX shared memory segment.
+	* Checking for libsamplerate in waf, fix ticket #89." 
+        * Header cleanup, add --clients and --ports options in configure.
+
+2008-10-01 Stephane Letz  <letz at grame.fr>
+
+   	* First Solaris version.
+
+2008-09-22 Stephane Letz  <letz at grame.fr>
+	
+	* Cleanup jack_port_id_t/jack_port_t mess, should work again on 64 bits machines."
+
+2008-09-20 Stephane Letz  <letz at grame.fr>
+	
+	* Michael Voigt JackAPI cleanup patch.
+
+2008-09-19 Stephane Letz  <letz at grame.fr>
+	
+	* Michael Voigt JackTime cleanup patch.
+
+2008-09-17 Stephane Letz  <letz at grame.fr>
+	
+	* New JackDriverInfo class to cleanup driver loading code.
+
+2008-09-08 Stephane Letz  <letz at grame.fr>
+	
+	* Better symbols export for server and client side libraries. 
+
+2008-09-06 Stephane Letz  <letz at grame.fr>
+	
+	* Correct driver hierarchy on macosx and windows targets.
+
+2008-09-05 Stephane Letz  <letz at grame.fr>
+	
+	* Merge Michael Voigt "drops" branch after reorganization step.
+
+2008-09-04 Stephane Letz  <letz at grame.fr>
+	
+	* Michael Voigt 4th source reorganization patch.
+	* Correct JackNetDriver initialization.
+
+2008-09-03 Stephane Letz  <letz at grame.fr>
+	
+	* Implement DBUS entry points to handle internal clients, add new commands in jack_control.
+	* Add new "desc" (extended description) in jack_driver_desc_t, to be used by backends and internal clients.
+
+2008-09-01 Stephane Letz  <letz at grame.fr>
+	
+	* Michael Voigt third source reorganization patch.
+	* Add new jack_set_port_rename_callback API, jack_port_set_name is now a server request that call port rename callbacks.
+
+2008-08-31 Stephane Letz  <letz at grame.fr>
+	
+	* Michael Voigt second source reorganization patch.
+
+2008-08-28 Stephane Letz  <letz at grame.fr>
+	
+	* Michael Voigt first source reorganization patch.
+
+2008-08-26 Stephane Letz  <letz at grame.fr>
+	
+	* Better parameter handling in JackCoreAudioAdapter.
+	* Fix memory leaks.
+
+2008-08-23 Stephane Letz  <letz at grame.fr>
+	
+	* Implements internal clients management API.
+
+2008-08-22 Stephane Letz  <letz at grame.fr>
+	
+	* Move GetCurrentTransportFrame code from JackClient to JackTransportEngine.
+	* Add a fNetworkSync state in JackTransportEngine used in network.
+
+2008-08-03 Stephane Letz  <letz at grame.fr>
+	
+	* Fix JackFrameTimer::Time2Frames and JackTimer::Frames2Time, jack_cpu compiled again.
+
+2008-08-01 Stephane Letz  <letz at grame.fr>
+	
+	* Fix desallocation of remaining clients when server quits.
+	* Close remaining client sockets in JackSocketServerChannel::Close.
+	* Correct JackClient::Close() to request server close only if server is running.
+
+2008-07-30 Stephane Letz  <letz at grame.fr>
+
+	* Remove restriction that port connection could be done only if the client was activated.
+
+2008-07-25 Stephane Letz  <letz at grame.fr>
+
+	* Florian Faber patch for 32 bit float (LE only) support to jack's alsa driver.
+        * Fix a crash bug when desallocating a non completely created external client.
+
+2008-07-24 Stephane Letz  <letz at grame.fr>
+
+	* Fix server client OSX special notification mechanism, CoreAudio driver compilation back for 10.4.
+
+2008-07-18 Stephane Letz  <letz at grame.fr>
+
+	* Correct audioadapter when a sample rate value different from jack server one is chosen.
+	* Cleanup in JackTransportEngine, move some code that was in JackClient class.
+	* Remove transport_type.h file, move transport types in types.h file.
+
+2008-07-12 Stephane Letz  <letz at grame.fr>
+
+	* Loopback driver working again.
+
+2008-07-08 Stephane Letz  <letz at grame.fr>
+
+	* Add jack_get_descriptor in internal clients API.
+	* Fix JackFreewheelDriver::Process() in case if client time-out : continue processing until a better recovery strategy is chosen.
+
+2008-07-08 Stephane Letz  <letz at grame.fr>
+
+	* Merge windows branch back to trunk.
+
+2008-07-05 Stephane Letz  <letz at grame.fr>
+
+	* Netioadapter renamed in audioadapter.
+
+2008-07-04 Stephane Letz  <letz at grame.fr>
+
+	* Netioadapter now adapts for buffer size and sample rate changes.
+
+2008-07-03 Stephane Letz  <letz at grame.fr>
+
+	* Add IsFixedBufferSize method in all drivers.
+
+2008-07-02 Stephane Letz  <letz at grame.fr>
+
+	* New netioadapter in server client.
+
+2008-06-20 Stephane Letz  <letz at grame.fr>
+
+	* Add new jack_client_stop_thread and jack_client_kill_thread API.
+	* New generic BuildClientPath for internal clients loading.
+
+2008-06-19 Stephane Letz  <letz at grame.fr>
+
+	* Embed JackEngineControl in JackDriver (starting from Tim Blechmann idea).
+
+2008-06-18 Stephane Letz  <letz at grame.fr>
+
+	* On OSX waf now compiles Universal Binaries.
+
+2008-06-17 Stephane Letz  <letz at grame.fr>
+
+	* Driver class hierarchy simplification.
+	* Update waf for compilation on OSX.
+
+2008-06-13 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackPosixThread::ThreadHandler termination, do not set buffer size if same value is used.
+	* Another Tim Blechmann cleanup patch + do no allocate JackClientControl in shared memory for server internal clients.
+
+2008-06-12 Stephane Letz  <letz at grame.fr>
+
+	* Another Tim Blechmann patch to remove unnecessary virtual methods.
+
+2008-06-09 Stephane Letz  <letz at grame.fr>
+
+	* Improve net driver so that jack clients can be registered even if driver has not yet started. 
+
+2008-06-08 Stephane Letz  <letz at grame.fr>
+
+	* Add a missing EXPORT for JackException class. 
+
+2008-06-06 Stephane Letz  <letz at grame.fr>
+
+	* Better error checking in JackGraphManager::RemoveAllPorts.
+
+2008-06-05 Stephane Letz  <letz at grame.fr>
+
+	* Better control of exported symbols.
+	* Fix a bug in backend parameter parsing.
+
+2008-06-04 Stephane Letz  <letz at grame.fr>
+
+	* Merge of network branch.
+	* Use of set_threaded_log_function only when needed in RT threads.
+
+2008-06-02 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann patch to remove unnecessary virtual methods : choice of the appropriate platform version is now done at compilation time.
+
+2008-06-02 Stephane Letz  <letz at grame.fr>
+
+	* Cleanup and correct wscript for example-clients.
+	* Add a test for coherent freewheel state in JackDebugClient. 
+	* Cleanup JackMutex class.
+
+2008-05-31 Stephane Letz  <letz at grame.fr>
+
+	* Add missing include for proper compilation when jack headers are not installed.
+
+2008-05-30 Stephane Letz  <letz at grame.fr>
+
+	* Avoid using Terminate when "quitting" in RT thread. Cleanup JackEngineInterface.
+
+2008-05-29 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann patch for JackPosixSemaphore (still to test...).
+	* Correct JackWinThread::Terminate.
+
+2008-05-28 Stephane Letz  <letz at grame.fr>
+
+	* New testMutex test, correct timing in drivers.
+
+2008-05-27 Stephane Letz  <letz at grame.fr>
+
+	* Correct timing in drivers : frame time has to be incremented before Read.
+
+2008-05-26 Stephane Letz  <letz at grame.fr>
+
+	* Merge control branch.
+	* Cleanup example clients : use jack_client_open and install a proper 'quit' signal handler.
+
+2008-05-24 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann RAII idiom patch for JackServer ressource initialization.
+
+2008-05-23 Stephane Letz  <letz at grame.fr>
+
+	* Use StartSync to start the client notification thread, otherwise initial notifications from the server may be lost.
+	* Tim Blechmann JackEngine cleanup patch.
+	* Call init callback in notification thread also.
+
+2008-05-22 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackPort::ClearBuffer.
+	* Correct JackEngine inheritance graph.
+
+2008-05-21 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackEngine::PortUnRegister, JackEngine::ClientCloseAux and JackEngine::ClientDeactivate to correctly send notifications. 
+	* New jack_get_client_pid API, implemented on server side.
+	* Better handling of graph state read functions : never wait when used in the real-time thread, current state is used.
+
+2008-05-20 Stephane Letz  <letz at grame.fr>
+
+	* Package number bumped to 1.90 everywhere.
+	* Implementation of jack_get_max_delayed_usecs, jack_get_xrun_delayed_usecs and jack_reset_max_delayed_usecs.
+
+2008-05-19 Stephane Letz  <letz at grame.fr>
+
+	* Use of placement new for dynamic port allocation is possibly not safe... so avoid that until a definitive answer is found.
+	* JackAudioDriver::ProcessAsync and JackAudioDriver::ProcessSync were broken at some point : 0 has to be returned in all cases.
+
+2008-05-16 Stephane Letz  <letz at grame.fr>
+
+	* Activate now connect to FW driver and start the realtime thread only if clients are actually realtime, that is have setup any of the RT callback.
+
+2008-05-14 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackEngine::Close to only delete "loadable" clients.
+
+2008-05-13 Stephane Letz  <letz at grame.fr>
+
+	* Fix exception handling in JackShmMem::operator new.
+	* Fix JackMutex constructor.
+
+2008-05-12 Stephane Letz  <letz at grame.fr>
+
+	* Allows wrapper library to log in a file (using JACK_WRAPPER_DEBUG=file).
+
+2008-05-09 Stephane Letz  <letz at grame.fr>
+
+	* Mike Taht's fix for proper alsa xrun duration measurement.
+
+2008-05-06 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackPosixThread::StartImp and JackWinThread::StartImp.
+
+2008-05-05 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackClient::Close : notification channel is stopped first to avoid receiving notifications while closing and Close is again a synchronous call.
+	* No more remaining client close in JackEngine::Close().
+
+2008-05-01 Stephane Letz  <letz at grame.fr>
+
+	* Fix JackMachClientChannel::InternalClientLoad.
+	* Correct internal client loading.
+	* For threaded drivers, AcquireRealTime is called after Init step.
+
+2008-04-30 Stephane Letz  <letz at grame.fr>
+		
+	* Fix JackRestartThreadedDriver::Execute.
+	* Better handling of init and run state in JackThread.
+
+2008-04-28 Stephane Letz  <letz at grame.fr>
+		
+	* Add exceptions management to distinguish drivers recoverable errors from non recoverable ones. Will be used in special threaded drivers (for network).
+
+2008-04-25 Stephane Letz  <letz at grame.fr>
+		
+	* Correct JackServerGlobals::Init: now check is server is already started.
+
+2008-04-24 Stephane Letz  <letz at grame.fr>
+		
+	* Correct internal client load.
+
+2008-04-10 Stephane Letz  <letz at grame.fr>
+		
+	* Remove Linux Makefile, update Readme.
+
+2008-04-03 Stephane Letz  <letz at grame.fr>
+		
+	* Correct a dirty port array issue in JackGraphManager::GetPortsAux.
+
+2008-03-31 Stephane Letz  <letz at grame.fr>
+		
+	* New SetNonBlocking method for JackSocket.
+
+2008-03-29 Stephane Letz  <letz at grame.fr>
+		
+	* Correct a missing parameter in the usage message of jack_midiseq.
+	* Add a client counter in wrapper layer : library is unloaded only when all clients have been closed.
+
+2008-03-28 Stephane Letz  <letz at grame.fr>
+		
+	* Correct PortRegister, port name checking must be done on server side.
+	* Add an Init method for blocking drivers to be decorated using JackThreadedDriver class.
+
+2008-03-27 Stephane Letz  <letz at grame.fr>
+		
+	* Pieter Palmers patch for FFADO driver.
+	* Dmitry Baikov patch for alsa_rawmidi driver.
+
+2008-03-26 Stephane Letz  <letz at grame.fr>
+		
+	* JackWrapperAPI.cpp: use open_library in jack_client_name_size, jack_port_name_size and jack_port_type_size.
+
+2008-03-20 Stephane Letz  <letz at grame.fr>
+		
+	* Transport timebase fix.
+
+2008-03-19 Stephane Letz  <letz at grame.fr>
+		
+	* Synchronise transport.h with latest jackd version (Video handling).
+
+2008-03-19 Stephane Letz  <letz at grame.fr>
+		
+	* Add jack_port_type_id in jack API.
+
+2008-03-17 Stephane Letz  <letz at grame.fr>
+		
+	* New jack_server_control client to test notifications when linked to the server library.
+	* Correct JackClient::Activate so that first kGraphOrderCallback can be received by the client notification thread.
+	* MIDI API in wrapper lib.
+	* Fix connect notification to deliver *one* notification only.
+
+2008-03-16 Stephane Letz  <letz at grame.fr>
+		
+	* Use engine in JackAlsaDriver::port_register and JackAlsaDriver::port_unregister.
+	* New JackLockedEngine decorator class to serialize access from ALSA Midi thread, command thread and in-server clients.
+
+2008-03-15 Stephane Letz  <letz at grame.fr>
+		
+	* Add -L (extra output latency in aynchronous mode) in CoreAudio driver.
+	* RT scheduling for OSX thread (when use in dummy driver).
+
+2008-03-14 Stephane Letz  <letz at grame.fr>
+		
+	* Fernando Lopez-Lezcano scons patch.
+
+2008-03-13 Stephane Letz  <letz at grame.fr>
+		
+	* Add test for jack_cycle_wait, jack_cycle_wait and jack_set_process_thread API.
+	* Add jack_set_process_thread in wrapper library.
+	* Correct all backend playback port latency in case of "asynchronous" mode (1 buffer more).
+	* Correct jack_port_get_total_latency.
+	* Correct jack_port_by_id in wrapper library.
+
+2008-03-12 Stephane Letz  <letz at grame.fr>
+		
+	* Marc-Olivier Barre library related scons patch.
+	* Nedko Arnaudov FULL_MIMIC patch.
+	* Automatic server launch in wrapper layer.
+
+2008-03-11 Stephane Letz  <letz at grame.fr>
+		
+	* Fix engine real-time notification (was broken since ??).
+	* Correct jack_client_open_aux, jack_client_open and jack_client_new.
+	* Correct jack_internal_client_load for wrapper layer.
+	* In thread model, execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished).
+	* Correct jack_port_get_connections function (should return NULL when no connections).
+
+2008-03-10 Stephane Letz  <letz at grame.fr>
+		
+	* Nedko Arnaudov log patch.
+	* Remove unneeded jack_port_connect API.
+
+2008-03-07 Stephane Letz  <letz at grame.fr>
+		
+	* Define an internal jack_client_open_aux needed for library wrapper feature.
+	* Improve wrapper code.
+	* Correct FreeBob driver_initialize.
+
+2008-03-06 Stephane Letz  <letz at grame.fr>
+		
+	* Marc-Olivier Barre scons patch (3).
+
+2008-03-06 Stephane Letz  <letz at grame.fr>
+		
+	* Fix JackSocketClientChannel::ClientClose: async call from the client and server does not need to write any reply. 
+	* Correct port notification: 2 notifications have to be sent (src, dst) and (dst, src)...
+
+2008-03-05 Stephane Letz  <letz at grame.fr>
+		
+	* libjackdmp.so renamed to libjackservermp.so and same for OSX framework.
+	* tw1.c example added (new thread model).
+	* Marc-Olivier Barre scons patch (2).
+
+2008-03-02 Stephane Letz  <letz at grame.fr>
+		
+	* Correct JackSocketClientChannel::ClientClose to use ServerSyncCall instead of ServerAsyncCall.
+	* Better documentation in jack.h.
+	* Marc-Olivier Barre scons patch.
+
+2008-03-02 Stephane Letz  <letz at grame.fr>
+		
+	* Correct jack_get_time propotype.
+
+2008-02-25 Stephane Letz  <letz at grame.fr>
+		
+	* Add TimeCallback in JackDebugClient class.
+
+2008-02-22 Stephane Letz  <letz at grame.fr>
+		
+	* Correct JACK_port_unregister.
+
+2008-02-21 Stephane Letz  <letz at grame.fr>
+		
+	* Add port register/unregister notification in JackAlsaDriver.
+
+2008-02-12 Stephane Letz  <letz at grame.fr>
+		
+	* Fix in JackClient::Error(): when RT thread is failing and calling Shutdown, Shutdown was not desactivating the client correctly. 
+	* Notify ports unregistration in JackEngine::ClientCloseAux.
+	* Thanks Esben Stien for helping finding these bugs.
+
+2008-02-11 Stephane Letz  <letz at grame.fr>
+		
+	* Use SetAlias for port naming. Use jackd midi port naming scheme.
+
+2008-02-08 Stephane Letz  <letz at grame.fr>
+		
+	* More robust external API.
+
+2008-02-07 Stephane Letz  <letz at grame.fr>
+		
+	* Correct "server_connect": close the communication channel.
+
+2008-02-05 Stephane Letz  <letz at grame.fr>
+		
+	* Reduce WaitGraphChange wait value.
+	* Remove use of assert in JackFifo, JackMachSemaphore, and JackPosixSemaphore: print an error instead.
+
+2008-02-03 Stephane Letz  <letz at grame.fr>
+
+	* Add "Readme" file from package in src folder.
+	* Tim Blechmann sse optimization patch for JackaudioPort::MixAudioBuffer, use of Apple Accelerate framework on OSX.
+
+2008-02-02 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann patches.
+
+2008-02-01 Stephane Letz  <letz at grame.fr>
+
+	* Move transport related methods from JackEngine to JackServer.
+	* Finish port connection callback server side implementation.
+
+2008-01-31 Stephane Letz  <letz at grame.fr>
+
+	* Remove checking thread in CoreAudio driver, better device state change recovery strategy: the driver is stopped and restarted.
+	* jack_thread_wait implementation.
+	* Add jack_thread_wait client example.
+	* Add jack_mp_thread_wait client example.
+
+2008-01-30 Stephane Letz  <letz at grame.fr>
+	
+	* Latest jack_lsp code from jack SVN.
+	* Update in usx2y.c and JackPort.cpp to match jackd 0.109.2.
+
+2008-01-29 Stephane Letz  <letz at grame.fr>
+	
+	* Implement jack_recompute_total_latency and jack_recompute_total_latencies.
+	* Remove fBufferSize field in JackGraphManager object.
+	* Port connection callback, client side.
+
+2008-01-28 Stephane Letz  <letz at grame.fr>
+
+	* Updated API to match jack 0.109.0 version (in progress). Correct checking thread in CoreAudio driver.
+	* Port connection callback, server side.
+	* Cleanup jack_port_connected_to implementation.
+
+2008-01-25 Stephane Letz  <letz at grame.fr>
+
+	* OSX 32/64 bits version.
+
+2008-01-24 Stephane Letz  <letz at grame.fr>
+
+	* CoreAudio driver improvement: detect and notify abnormal situations (stopped driver in case of SR change...).
+
+2008-01-03 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov MIDI patch : alsa_seqmidi and alsa_rammidi drivers.
+
+2008-01-03 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann patch for JackGraphManager::GetPortsAux memory leak, Tim Blechmann patch for scons install.
+
+2007-12-12 Stephane Letz  <letz at grame.fr>
+
+	* Cleanup in CoreAudio driver.
+
+2007-12-11 Stephane Letz  <letz at grame.fr>
+
+	* Change string management for proper compilation with gcc 4.2.2. JackLog cleanup.
+
+2007-12-08 Stephane Letz  <letz at grame.fr>
+
+	* Tim Blechmann scons patch.
+
+2007-12-07 Stephane Letz  <letz at grame.fr>
+
+	* Pieter Palmers second new build system: scons and Makefile based build.
+
+2007-12-06 Stephane Letz  <letz at grame.fr>
+
+	* Pieter Palmers FFADO driver and scons based build.
+
+2007-12-05 Stephane Letz  <letz at grame.fr>
+
+	* Correct sample_rate management in JackCoreAudioDriver::Open. Better handling in sample_rate change listener.
+
+2007-12-04 Stephane Letz  <letz at grame.fr>
+
+	* Add a sample_rate change listener in CoreAudio driver.
+
+2007-12-03 Stephane Letz  <letz at grame.fr>
+
+	* Correct bug in CoreAudio driver sample rate management.
+
+2007-11-30 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackMachNotifyChannel::ClientNotify.
+
+2007-11-29 Stephane Letz  <letz at grame.fr>
+
+	* Correct fPeriodUsecs computation in JackAudioDriver::SetBufferSize and JackAudioDriver::SetSampleRate. 
+
+2007-11-28 Stephane Letz  <letz at grame.fr>
+
+	* On OSX, use jack server name in notification system.
+
+2007-11-21 Stephane Letz  <letz at grame.fr>
+
+	* On OSX, use CFNotificationCenterPostNotificationWithOptions with kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions for server ==> JackRouter plugin notification.
+
+2007-11-20 Stephane Letz  <letz at grame.fr>
+
+	* Correct CheckPort in JackAPI.cpp.
+
+2007-11-15 Stephane Letz  <letz at grame.fr>
+
+	* Move OSX start/stop notification mechanism in Jackdmp.cpp.
+
+2007-11-05 Stephane Letz  <letz at grame.fr>
+
+	* Use of JackWinSemaphore instead of JackWinEvent for inter-process synchronization.
+	* Correct types.h for use with MINGW on Windows.
+
+2007-11-04 Stephane Letz  <letz at grame.fr>
+
+	* Add an implementation for obsolete jack_internal_client_new and jack_internal_client_close. Add missing jack_port_type_size.
+
+2007-11-02 Stephane Letz  <letz at grame.fr>
+
+	* Correct ALSA driver Attach method: internal driver may have changed the buffer_size and sample_rate values.
+	* Add JackWinSemaphore class.
+
+2007-10-01 Stephane Letz  <letz at grame.fr>
+
+	* Server and user directory related code moved in a JackTools file.
+	* Client name rewritting to remove path characters (used in fifo naming).
+
+2007-10-30 Stephane Letz  <letz at grame.fr>
+
+	* Fix a bug in freewheel management in async mode: drivers now receive the kStartFreewheelCallback and kStopFreewheelCallback notifications.
+
+2007-10-26 Stephane Letz  <letz at grame.fr>
+
+	* Add midiseq and midisine examples. 
+	* Cleanup old zombification code. 
+	* Linux Makefile now install jack headers.
+	* Use of JACK_CLIENT_DEBUG environment variable to activate debug client mode.
+	* Definition of JACK_LOCATION variable using -D in the Makefile.
+	* Restore jack 0.103.0 MIDI API version.
+
+2007-10-25 Stephane Letz  <letz at grame.fr>
+
+	* Merge of Dmitry Baikov MIDI branch. 
+	* Correct JackGraphManager::GetPortsAux to use port type.
+	* Remove JackEngineTiming class: code moved in JackEngineControl.
+
+2007-10-24 Stephane Letz  <letz at grame.fr>
+
+	* Implementation of server_name setting (-n).
+
+2007-10-23 Stephane Letz  <letz at grame.fr>
+
+	* Correct jack_acquire_real_time_scheduling on OSX.
+
+2007-10-18 Stephane Letz  <letz at grame.fr>
+
+	* Use LIB_DIR variable for 64 bits related compilation (drivers location). More generic Linux script.
+
+2007-10-16 Stephane Letz  <letz at grame.fr>
+
+	* Reorganize jack headers. Improve Linux install/remove scripts.
+
+2007-10-16 Stephane Letz  <letz at grame.fr>
+
+	* Internal loadable client implementation, winpipe version added. 
+
+2007-10-12 Stephane Letz  <letz at grame.fr>
+
+	* Internal loadable client implementation, socket version added. 
+	* Fix JackEngine::Close() method.
+
+2007-10-11 Stephane Letz  <letz at grame.fr>
+
+	* Internal loadable client implementation (in progress).
+
+2007-10-08 Stephane Letz  <letz at grame.fr>
+
+	* Use .jackdrc file (instead of .jackdmprc). Install script now creates a link "jackd ==> jackdmp" so that automatic launch can work correctly. 
+	* Paul Davis patch for -r (--replace-registry) feature.
+
+2007-10-07 Stephane Letz  <letz at grame.fr>
+
+	* Add missing timestamps.c and timestamps.h files. Correctly export public headers in OSX frameworks. Suppress JackEngine::ClientInternalCloseIm method.
+
+2007-10-04 Stephane Letz  <letz at grame.fr>
+
+	* Correct "jack_register_server" in shm.c.
+
+2007-10-04 Stephane Letz  <letz at grame.fr>
+
+	* Fix a resource leak issue in JackCoreAudioDriver::Close(). Better implement "jack_client_open" when linking a client with the server library.
+
+2007-10-03 Stephane Letz  <letz at grame.fr>
+
+	* Rename server_name from "default" to "jackdmp_default" to avoid conflict with regular jackd server.
+
+2007-10-02 Stephane Letz  <letz at grame.fr>
+
+	* Correct jack_client_open "status" management.
+
+2007-08-27 Stephane Letz  <letz at grame.fr>
+
+	* Server/library protocol checking implementation.
+
+2007-08-26 Stephane Letz  <letz at grame.fr>
+
+	* Make "Rename" a method of JackPort class, call it from driver Attach method.
+
+2007-08-24 Stephane Letz  <letz at grame.fr>
+
+	* Implement server temporary (-T) mode.
+
+2007-08-23 Stephane Letz  <letz at grame.fr>
+
+	* Fix a bug in jack_test. Correct JackShmMem destructor. Correct end case in JackClient::Execute. Correct JackMachSemaphore::Disconnect.
+
+2007-08-22 Stephane Letz  <letz at grame.fr>
+
+	* Fix a bug in JackLibClient::Open introduced when adding automatic client renaming.
+
+2007-08-21 Stephane Letz  <letz at grame.fr>
+
+	* Fix backend port alias management (renaming in system:xxx).
+
+2007-08-20 Stephane Letz  <letz at grame.fr>
+
+	* Automatic server launch. Removes unneeded 'volatile' for JackTransportEngine::fWriteCounter.
+
+2007-08-19 Stephane Letz  <letz at grame.fr>
+
+	* Add "systemic" latencies management in CoreAudio driver.
+
+2007-08-16 Stephane Letz  <letz at grame.fr>
+
+	* Automatic client renaming.
+
+2007-07-27 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackEngine::ClientCloseAux (when called from JackEngine::ClientExternalOpen). Correct JackWinEvent::Allocate.
+
+2007-07-20 Stephane Letz  <letz at grame.fr>
+
+	* Correct notification for kActivateClient event.
+
+2007-06-11 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov buffer size patch.
+
+2007-06-10 Stephane Letz  <letz at grame.fr>
+
+	* Correct deprecated jack_set_sample_rate_callback to return 0 instead of -1.
+
+2007-06-09 Stephane Letz  <letz at grame.fr>
+
+	* Checking in the server to avoid calling the clients if no callback are registered.
+
+2007-06-08 Stephane Letz  <letz at grame.fr>
+
+	* New JackNotication.h header in preparation for callback checking in the server.
+
+2007-05-29 Stephane Letz  <letz at grame.fr>
+
+	* Add "callback exiting" and "jack_frame_time" tests in jack_test.
+
+2007-05-09 Stephane Letz  <letz at grame.fr>
+
+	* Add a mutex in JackGraphManager AllocatePort/ReleasePort methods.
+
+2007-05-05 Stephane Letz  <letz at grame.fr>
+
+	* Add jack_set_client_registration_callback API.
+
+2007-05-04 Stephane Letz  <letz at grame.fr>
+
+	* Steven Chamberlain patch to fix jack_port_type. Test for jack_port_type behaviour in jack_test.cpp tool.
+
+2007-05-03 Stephane Letz  <letz at grame.fr>
+
+	* Steven Chamberlain patch to fix jack_port_by_id export.
+
+2007-04-28 Stephane Letz  <letz at grame.fr>
+
+	* Add new jack_port_set_alias, jack_port_unset_alias and jack_port_get_aliases API.
+
+2007-04-27 Stephane Letz  <letz at grame.fr>
+
+	* Add missing -D__SMP__in OSX project.
+
+2007-04-23 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov jackmp-time patch: add jack_get_time, jack_time_to_frames, jack_frames_to_time.
+
+2007-04-03 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov remove-nframes patch.
+
+2007-04-02 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov lost-event patch.
+
+2007-04-01 Stephane Letz  <letz at grame.fr>
+
+	* Merge JackGraphManager Remove and Release method in a unique Release method.
+
+2007-03-12 Stephane Letz  <letz at grame.fr>
+ 
+	* Bug fix in JackMidiBuffer::MaxEventSize().
+
+2007-03-09 Stephane Letz  <letz at grame.fr>
+ 
+	* Dmitry Baikov MIDI patch phase 2.
+
+2007-03-08 Stephane Letz  <letz at grame.fr>
+ 
+	* Dmitry Baikov jackmp-port-clear patch.
+
+2007-03-06 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov MIDI patch phase 1.
+
+2007-03-04 Stephane Letz  <letz at grame.fr>
+
+	* Dmitry Baikov patch for JackGraphManager.cpp.
+	* Dmitry Baikov MIDI patch phase 0.
+
+2007-02-19 Stephane Letz  <letz at grame.fr>
+	
+	* Correct back JackAlsaDriver::Read method. 
+
+2007-02-14 Stephane Letz  <letz at grame.fr>
+	
+	* Better error checking in PortAudio driver.
+
+2007-02-07 Stephane Letz  <letz at grame.fr>
+	
+	* Thom Johansen fix for port buffer alignment issues.
+
+2007-02-05 Stephane Letz  <letz at grame.fr>
+	
+	* Add Pieter Palmers FreeBob driver.
+	* Thibault LeMeur ALSA driver patch.
+
+2007-01-31 Stephane Letz  <letz at grame.fr>
+
+	* Use pthread_attr_setstacksize in JackPosixThread class.
+
+2007-01-30 Stephane Letz  <letz at grame.fr>
+
+	* New LockAllMemory and UnlockAllMemory functions.
+
+2007-01-29 Stephane Letz  <letz at grame.fr>
+
+	* More robust activation/deactivation code, especially in case of client crash.
+
+2007-01-27 Stephane Letz  <letz at grame.fr>
+
+	* Uses a time out value of 10 sec in freewheel mode (like jack).
+
+2007-01-21 Stephane Letz  <letz at grame.fr>
+
+	* More client debug code: check if the client is still valid in every JackDebugClient method, check if the library context is still valid in every API call.
+
+2007-01-14 Stephane Letz  <letz at grame.fr>
+
+	* Implement thread.h API.
+
+2007-01-09 Stephane Letz  <letz at grame.fr>
+
+	* New server/client data transfer model to fix a 64 bits system bug. Fix a device name reversal bug in ALSA driver.
+
+2007-01-04 Stephane Letz  <letz at grame.fr>
+
+	*  Add call to the init callback (set up using the jack_set_thread_init_callback API) in Real-Time and Notification threads. Define a new 'kActivateClient' notification. 
+
+2007-01-02 Stephane Letz  <letz at grame.fr>
+
+	* Internal cleanup.
+
+2006-12-23 Stephane Letz  <letz at grame.fr>
+
+	* shared_ports renamed to shared_graph.
+
+2006-12-15 Stephane Letz  <letz at grame.fr>
+
+	* Move client refnum management in JackEngine.
+
+2006-12-12 Stephane Letz  <letz at grame.fr>
+
+	* Tom Szilagyi memory leak fix in ringbuffer.c.
+
+2006-11-29 Stephane Letz  <letz at grame.fr>
+
+	* Correct JackWinEnvent::Allocate (handle the ERROR_ALREADY_EXISTS case). Correct JackEngine::ClientExternalNew.
+	* Karsten Wiese correction for ALSA usx2y driver.
+
+2006-11-22 Stephane Letz  <letz at grame.fr>
+
+	* In synchronous mode, if the driver time out is reached, the server may get desynchronized (pending signal may arrive in later cycles), 
+	improve audio driver synchronous code to better handle this case.
+	 
+2006-11-08 Stephane Letz  <letz at grame.fr>
+
+	* Synchronize ALSA backend with jack one.
+
+2006-11-04 Stephane Letz  <letz at grame.fr>
+
+	* Use -D to setup ADDON_DIR on OSX and Linux.
+
+2006-10-11 Stephane Letz  <letz at grame.fr>
+
+	* Correct server SetBufferSize in case of failure. Correct PortAudio driver help.
+
+2006-10-06 Stephane Letz  <letz at grame.fr>
+
+	* Add a new cpu testing/loading client.
+
+2006-09-23  Stephane Letz  <letz at grame.fr>
+
+	* Rename global "verbose" in "jack_verbose" to avoid symbol clash with PureData.
+
+2006-09-20  Stephane Letz  <letz at grame.fr>
+
+	* On Windows, avoid to use the unsafe Kill thread method. Use thread Stop instead and have blocked IO be unlocked. 
+	* Still get RT thread termination problems, restore a version that works on OSX and Linux with conditionnal compilation for now.
+
+2006-09-16  Stephane Letz  <letz at grame.fr>
+
+	* Restore behaviour of LoopBack driver, which has to be opened in any case...
+
+2006-09-15  Stephane Letz  <letz at grame.fr>
+
+	* On Windows version, use signal to quit the server.
+
+2006-09-13  Stephane Letz  <letz at grame.fr>
+
+	* Correct pipe destruction bug in JackWinNamedPipe class.
+
+2006-09-11  Stephane Letz  <letz at grame.fr>
+
+	* Handling of LoopBack driver only when really needed.
+	* Correct crash bug when closing clients on Windows due to multi-threading synchronization issues.
+
+2006-09-06  Stephane Letz  <letz at grame.fr>
+
+	* Correct coreaudio driver (input was not working since 0.55 version).
+	* Version for 0.58 release.
+
+2006-09-04  Stephane Letz  <letz at grame.fr>
+
+	* Correct Windows VC++ projects.
+
+2006-09-03  Stephane Letz  <letz at grame.fr>
+
+	* First import of version 0.58 base code
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index e28a23d..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.h.in \
-                       stamp-h.in config.log config.cache config.status
-
-if HAVE_DOXYGEN
-DOC_DIR = doc
-dist-check-doxygen:
-else
-DOC_DIR =
-dist-check-doxygen:
-	@echo
-	@echo ' ******' You need doxygen installed to make dist.' ******'
-	@echo
-	@false
-endif
-
-SUBDIRS =      jack libjack jackd drivers example-clients tools config $(DOC_DIR) man
-DIST_SUBDIRS = config jack libjack jackd drivers example-clients tools doc man
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = jack.pc
-
-EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL libjack/simd.c jack.spec
-
-AUTOMAKE_OPTIONS = foreign
-
-rpm: dist
-	rpm -ta $(distdir).tar.gz
-
-dist-hook: dist-check-doxygen
diff --git a/README b/README
index a8aa8fc..2c68925 100644
--- a/README
+++ b/README
@@ -1,38 +1,237 @@
-Welcome to JACK, the Jack Audio Connection Kit.
+-----------------------------------------------
+jackdmp for Linux, MacOSX, Windows and Solaris
+-----------------------------------------------
+
+jackdmp is a C++ version of the JACK low-latency audio server for multi-processor machines. It is a new implementation of the JACK server core features that aims in removing some limitations of the current design. The activation system has been changed for a data flow model and lock-free programming techniques for graph access have been used to have a more dynamic and robust system.
+
+- jackdmp use a new client activation model that allows simultaneous client execution (on a smp machine) when parallel clients exist in the graph (client that have the same inputs). This activation model allows to better use available CPU on a smp machine, but also works on mono-processor machine.
+
+- jackdmp use a lock-free way to access (read/write) the client graph, thus allowing connections/disconnection to be done without interrupting the audio stream. The result is that connections/disconnections are glitch-free.
+
+- jackdmp can work in 2 different mode at the server level :
+	
+	- synchronous activation : in a given cycle, the server waits for all clients to be finished (similar to normal jackd)
+
+	- asynchronous activation : in a given cycle, the server does not wait for all clients to be finished and use output buffer computed the previous cycle. 
+	
+The audible result of this mode is that if a client is not activated during one cycle, other clients may still run and the resulting audio stream will still be produced (even if its partial in some way). This mode usually result in fewer (less audible) audio glitches in a loaded system.
+
+--------------
+Linux version
+--------------
+
+The published version still uses fifos for server/client synchronization. The use of POSIX named semaphore is implemented but still a bit unstable. Sockets are used for server/client communications. The ALSA backend derived from jackd implementation is used. To build jackdmp, a "waf" (http://code.google.com/p/waf/) based compilation system is available. The code has to be compiled on a machine where ALSA and possibly frebob (FFADO) headers and libraries are corrected installed.
 
-Please see the website (http://jackit.sf.net/) for more information.
+In the top folder do :
+
+./waf configure 
+./waf build 
+sudo ./waf install 
+
+Various compilation options can be seen using ./waf --help.
+
+Important compilation options :
 
-NOTE: If you are using reiserfs or ext3fs or anything except ext2fs
-for the directory where JACK puts its temporary files (/tmp by
-default), then the JACK team recommends that you do *one* of the 
-following:
+- default compilation mode will produce a set of libraries and executable that will *replace* regular jackd. If the "automatic start server option" is used by clients, jackd server will be started using the old fork + exe system.
+
+- the --dbus flag must be defined at configure time to compile the jackdbus executable. If the "automatic start server option" is used by clients, jackd server will be started using the dbus service.
 
-----------------------------
+----------------------------
+Known problems, limitations
+----------------------------
+
+- use of POSIX named semaphore is currently unstable and not recommended yet. 
 
-Mount a tmpfs on /tmp.  You should have a lot of swap space available
-in case some programs try to write very large files there.
-In your /etc/fstab add a line:
+----------------
+Solaris version
+----------------
 
-   none        /tmp    tmpfs   defaults        0       0
+The published version uses fifos for server/client synchronization. Sockets are used for server/client communications. An OSS backend is used. To build jackdmp, a "waf" (http://code.google.com/p/waf/) based compilation system is available. The code has to be compiled on a machine where OSS 4.0 headers and libraries are corrected installed.
 
- You'll probably want to reboot here, or kill X then 'mount /tmp'.
+In the top folder do :
+
+./waf configure 
+./waf build 
+sudo ./waf install 
 
----- OR ----
+(Note : you may have to use "pfexec" instead of "sudo" on systems where sudo is not there.)  
+
+Various compilation options can be seen using ./waf --help.
+
+Important compilation options :
 
-Alternatively, you can do this without affecting your /tmp:
+- if the "automatic start server option" is used by clients, jackd server will be started using the old fork + exe system.
+
+- the --dbus flag must be defined at configure time to compile the jackdbus executable. If the "automatic start server option" is used by clients, jackd server will be started using the dbus service.
 
-# mkdir /mnt/ramfs
+Starting the server :
 
-[edit /etc/fstab and add the following line]
- none       /mnt/ramfs      tmpfs      defaults  0 0
+- for best performances, the server has to be started with privileges that allows to use "real-time" threads, for example using the "pfexec" command (or configurating the system with "priocntl" first), for instance : pfexec jackd -R -S -P59 -d oss
 
-Then add --with-default-tmpdir=/mnt/ramfs to the JACK configure
-line when you build it.  No clients need to be recompiled.
+- audio cards info can be retrieved using "ossinfo" tool (for instance ossinfo -v3). Some card needs to be configurated first using "ossxmix" then the correct buffer size has to be used, for instance : pfexec jackd -R -S -P59 -d oss -p 512
+
+------------
+OSX version
+------------
+
+The published version uses Mach semaphores for server/client synchronization. MIG generated Remote Procedure Calls (RPC) are used for server/client communications. The CoreAudio backend derived from jackd implementation is used.
+
+The package contains :
+
+ - the compiled binaries with "install" and "remove" scripts located in bin/osx
+ - the source code with an XCode project
+ - the component needed to use CoreAudio applications with JACK (the JackRouter JACK/CoreAudio bridge)
 
-------------------------------
+Starting with 0.70 version, the OSX project can compile 32/64 bits binaries for PPC and Intel machines. On a 64 bits machine, using the "jackdmp" in a terminal will start the 64 bits version. Using the "arch" command possibly allows to force starting in 32 bits (see man arch). The JackPilot and JackRouter binaries are now also released as 32/64 bits versions for PPC and Intel machines. By default the JackPilot application will start in 32 bits mode (even on a 64 bits machine) and launch the 32 bits jackdmp. Unchecking the "Launch in 32 bits mode" box in the JackPilot info (GetInfo = %I in the Finder...) allows to start JackPilot in 64 bits then launch the 64 bits jackdmp version. Very few audio applications are already 64 bits aware: Apple AU Lab (included in Developer tools) can be launched in 64 bit, here again by unchecking the "Launch in 32 bits mode" box in the AU Lab info.
+
+WARNING !! WARNING !! 
+
+Users of the "official" JackOSX package (found at www.jackosx.com) MUST uninstall JackOSX (using the script located in /Applications/Jack) before installing and testing jackdmp. The "official" JackOSX package can then be re-installed by using the JackOSX installer again. 
+
+---------------------------------
+Mac Intel special considerations
+---------------------------------
+
+- New Mac Intel use 2 different coreaudio device for input/output. Jackdmp cannot directly handle 2 devices to do duplex processing. An "aggregate" device has to be built in this case. 
+
+Use the "/Applications/Utilities/Audio MIDI Setup" tool to build and aggregate device that combine both input and output in a single duplex device, then select it when launching jackdmp, with something like :
+
+jackdmp -R -d coreaudio -n "~:Aggregate:0"
+
+or directly with the JackPilot tool.
+
+- CoreAudio applications running under Rosetta emulator cannot access an Intel version of Jackdmp.
+
+Using Jackdmp with Qjackctl :
 
-Failure to do one of these could lead to extremely poor performance from JACK,
-since its normal operation will cause bursts of disk I/O that are
-completely unnecessary. This suggestion can also be used by ext2fs
-users if they wish.
+To start jackdmp server in Qjackctl, the complete server path has to be added, like /usr/local/bin/jackdmp in Setup/Server Path.
+
+----------------
+Windows version
+----------------
+
+The published version uses named event for server/client synchronization. Named pipes are used for server/client communications. A PortAudio (V19) based driver is used. It allows to access either MME, DirectSound or ASIO supported cards.
+
+The binary elements are :
+
+- jackd.exe : the JACK server
+
+- libjackserver.dll (and associated libjackserver.lib library) : the server code, shared by the jackdmp server and drivers.
+
+- libjack.dll (and associated libjack.lib library) : the jack library code, to be linked against by clients.
+
+- jack_portaudio.dll : the PortAudio based backend. The backend components (currently "jack_portaudio.dll" only) are searched for in a "jackmp" folder located with the "jackdmp.exe" server.
 
+- jack_dummy.dll : the "dummy" driver.
+
+- jack_net.dll : the NetJack driver.
+
+- netmanager.dll : the "in server" client NetJack Manager.
+
+- audioadapter.dll : the network to audio card adapter (to be used on a slave machine started with the NetJack driver).
+
+- netadapter.dll : the network to audio card adapter (to be used on a slave machine started with an audio driver).
+
+- jack_connect.exe, jack_disconnect.exe, jack_lsp.exe, jack_metro.exe, jack_load.exe, jack_unload.exe tools.
+
+- JackRouter.dll : an ASIO/JACK driver that allows ASIO compatible applications to become JACK clients and access the JACK server. ASIO "jackified" applications appear with their names. Ableton Live, Samplitude, Reason, Arturia applications have been successfully tested. To install it, use "regsvr32 JackRouter.dll" in a terminal (use regsvr32 /u JackRouter.dll to uninstall). [VISTA special note: regsvr32 has to be used with "administrator" priviledges to properly register JackRouter.dll (Start Menu -> All Programs -> Accessories -> Right Click on Command Prompt -> Run As Administrator)]. A JackRouter.ini file is used by the driver to read parameters : an [IO] section allows to setup the number of input/output jack ports for the application and a [AUTO_CONNECT] section allows to setup jack ports autoconnection mode to machine input/output.
+
+WARNING !! WARNING !!
+
+Depending of the used interface and driver settings, the PortAudio layer may add additionnal buffering between the real card interrupt and the jack server callback. This usually result in *unregular* calls of the jack server callback (for example if jack server used a 256 frames buffer and the card used a 512 frames, the jack server callback will be called twice every card interrupt). For proper functionning of jack server and clients in this case, the jack server has to be started in "synchronous" mode, using the "-S" parameter.
+
+----------------------------
+Known problems, limitations
+----------------------------
+
+- Thread handling in still not completely working : jack clients may "hang" when quitting.
+
+----------------------------
+Automatic server launch
+----------------------------
+
+Starting from the 0.64 version, automatic server launch from client is implemented : when the server is not yet running, and if the client uses the "jack_client_open" API, the server will be started automatically. The server configuration is saved in a ".jackdrc" file located in the user home folder. The Qjackctl tool allows to save its configuration in this . jackdrc (setting can be done in Qjackctl Setup/Misc). If no configuration file is found, a default setup will be used. 
+
+WARNING : automatic server launch is not implemented on Windows
+
+------------------
+Validations tools
+------------------
+
+jackdmp can possibly validate client applications by checking they are using the API in a correct manner (calling functions in the right order, correctly desallocating ressources....) and produce a log file. A JACK_CLIENT_DEBUG environment variable must be used to activate client validation : use "export JACK_CLIENT_DEBUG=on".
+
+--------------
+Documentation
+--------------
+
+- a technical report presenting the new design and implementation.
+
+- doxygen generated documentation of the C++ code.
+
+---------
+Versions
+---------
+
+0.1 : First published version
+0.2 : Implements jack_time_frame, new -S (sync) mode : when "synch" mode is activated, the jackdmp server waits for the graph to be finished in the current cycle before writing the output buffers. 
+Note : To experiment with the -S option, jackdmp must be launched in a console.
+0.3 : Implement client zombification + correct feedback loop management + code cleanup.
+0.31 : Correct bug in mixing code that caused Ardour + jackdmp to crash...
+0.4 : Linux version, code cleanup, new -L parameter to activate the loopback driver (see Documentation), a number of loopback ports can be defined. Client validation tool.
+0.41 : Add the ALSA MMAP_COMPLEX support for ALSA driver. Patch from Dmitry Daikov : compilation option to choose between "get_cycles" and "gettimeofday" to measure timing.
+0.42 : Patch from Nick Mainsbridge. Correct default mode for ALSA driver. Correct XCode project.
+0.43 : Correct freewheel mode. Optimize ALSA and coreaudio drivers. Correct OSX installation script.
+0.44 : Patch from Dmitry Daikov : use clock_gettime by default for timing. Correct dirty buffer issue in CoreAudio driver. Updated doc.
+0.45 : Script to remove the OSX binary stuff. Correct an export symbol issue that was preventing Qjacktcl to work on OSX. Fix the consequences of the asynchronous semantic of connections/disconnections.
+0.46 : Fix a bug in loop management. Fix a bug in driver loading/unloading code. Internal code cleanup for better 64 bits architecture support. Compilation on OSX/Intel. Add the -d option for coreaudio driver (display CoreAudio devices internal name).
+0.47 : More fix for 64 bits compilation. Correct ALSA driver. Create a specific folder for jackdmp drivers. Use /dev/shm as default for fifo and sockets. "Install" and "Remove" script for smoother use with regular jack.
+0.48 : Finish software monitoring implementation for ALSA and CoreAudio drivers. Simpler shared library management on OSX.
+0.49 : Internal connection manager code cleanup.
+0.50 : Transport API implementation.
+0.51 : Correct bugs in transport API implementation.
+0.52 : Universal version for Mac Intel and PPC. Improvement of CoreAudio driver for half duplex cases.
+0.53 : Correct JackPilotMP tool on OSX. Correct CoreAudio driver for half duplex cases. Fix a bug in transport for "unactivated" clients. Fix a bug when removing "unactivated" clients from the server. Tested on Linux/PPC.
+0.54 : Use the latest shm implementation that solve the uncleaned shm segment problem on OSX. Close still opened file descriptors (report from Giso Grimm). Updated html documentation.
+0.55 : Windows version. Correct management of monitor ports in ALSA driver. Engine code cleanup. Apply Rui patch for more consistent parameter naming in coreaudio driver. Correct JackProcessSync::TimedWait : time-out was not computed correctly. Check the return code of NotifyAddClient in JackEngine. 
+0.56 : Correct SetBufferSize in coreaudio driver, portaudio driver and JackServer. Real-time notifications for Windows version. In the PortAudio backend, display more informations for installed WinMME, DirectSound and ASIO drivers.
+0.57 : Correct bug in Mutex code in JackClientPipeThread::HandleRequest. ASIO JackRouter driver supports more applications. Updated HTML documentation. Windows dll binaries are compiled in "release" mode.
+0.58 : Correct a bug introduced in 0.55 version that was preventing coreaudio audio inputs to work. Restructured code structure after import on svn.
+0.59 : Various fixes in Windows version. Signal handling in the Windows server. Improved JackRouter ASIO/Jack bridge on Windows. Rename global "verbose" in "jack_verbose" to avoid symbol clash with PureData. Add a new cpu testing/loading client. Correct server SetBufferSize in case of failure. Correct PortAudio driver help. Use -D to setup ADDON_DIR on OSX and Linux. Synchronize ALSA backend with jack one.
+0.60 : Improve audio driver synchronous code to better handle possible time-out cases. Correct JackWinEnvent::Allocate (handle the ERROR_ALREADY_EXISTS case). Correct JackEngine::ClientExternalNew.
+0.61 : Tom Szilagyi memory leak fix in ringbuffer.c. Move client refnum management in JackEngine. Shared_ports renamed to shared_graph. Add call to the init callback (set up using the jack_set_thread_init_callback API) in Real-Time and Notification threads. Define a new 'kActivateClient' notification. New server/client data transfer model to fix a 64 bits system bug. Fix a device name reversal bug in ALSA driver. Implement thread.h API.
+0.62 : More client debug code : check if the client is still valid in every JackDebugClient method, check if the library context is still valid in every API call. Uses a time out value of 10 sec in freewheel mode (like jack). More robust activation/deactivation code, especially in case of client crash. New LockAllMemory and UnlockAllMemory functions. Use pthread_attr_setstacksize in JackPosixThread class.  Add Pieter Palmers FreeBob driver. Thibault LeMeur ALSA driver patch. Thom Johansen fix for port buffer alignment issues. Better error checking in PortAudio driver.
+0.63 : Correct back JackAlsaDriver::Read method. Dmitry Baikov patch for JackGraphManager.cpp. Merge JackGraphManager Remove and Release method in a unique Release method. Dmitry Baikov jackmp-time patch : add jack_get_time, jack_time_to_frames, jack_frames_to_time. Add missing -D__SMP__in OSX project.  Add new jack_port_set_alias, jack_port_unset_alias and jack_port_get_aliases API. Steven Chamberlain patch to fix jack_port_by_id export. Steven Chamberlain patch to fix jack_port_type. Test for jack_port_type behaviour in jack_test.cpp tool. Add jack_set_client_registration_callback API. Add "callback exiting" and "jack_frame_time" tests in jack_test.
+0.64 : Checking in the server to avoid calling the clients if no callback are registered. Correct deprecated jack_set_sample_rate_callback to return 0 instead of -1. Dmitry Baikov buffer size patch. Correct notification for kActivateClient event. Correct JackEngine::ClientCloseAux (when called from JackEngine::ClientExternalOpen). Correct JackWinEvent::Allocate. Automatic client renaming. Add "systemic" latencies management in CoreAudio driver. Automatic server launch. Removes unneeded 'volatile' for JackTransportEngine::fWriteCounter.
+0.65 : Fix backend port alias management (renaming in system:xxx). Fix a bug in JackLibClient::Open introduced when adding automatic client renaming. Fix a bug in jack_test. Correct JackShmMem destructor. Correct end case in JackClient::Execute. Correct JackMachSemaphore::Disconnect. Implement server temporary (-T) mode. Make "Rename" a method of JackPort class, call it from driver Attach method. Server/library protocol checking implementation.
+0.66 : Internal cleanup. Windows JackRouter.dll version 0.16 : use of "jack_client_open" API to allow automatic client renaming, better Windows VISTA support, new JackRouter.ini file.
+0.67 : Correct jack_client_open "status" management. Rename server_name from "default" to "jackdmp_default" to avoid conflict with regular jackd server. Fix a resource leak issue in JackCoreAudioDriver::Close(). Better implement "jack_client_open" when linking a client with the server library. Correct "jack_register_server" in shm.c. Add missing timestamps.c and timestamps.h files. Correctly export public headers in OSX frameworks. Suppress JackEngine::ClientInternalCloseIm method. Use .jackdrc file (instead of .jackdmprc). Install script now creates a link "jackd ==> jackdmp" so that automatic launch can work correctly. Paul Davis patch for -r (--replace-registry) feature. Internal loadable client implementation. Fix JackEngine::Close() method. Windows JackRouter.dll version 0.17: 32 integer sample format.
+0.68 : Internal loadable client implementation, winpipe version added. Reorganize jack headers. Improve Linux install/remove scripts. Use LIB_DIR variable for 64 bits related compilation (drivers location). More generic Linux script. Correct jack_acquire_real_time_scheduling on OSX. Merge of Dmitry Baikov MIDI branch. Correct JackGraphManager::GetPortsAux to use port type. Remove JackEngineTiming class: code moved in JackEngineControl. Add midiseq and midisine examples. Cleanup old zombification code. Linux Makefile now install jack headers. Use of JACK_CLIENT_DEBUG environment variable to activate debug client mode. Definition of JACK_LOCATION variable using -D in the Makefile. Restore jack 0.103.0 MIDI API version. Fix a bug in freewheel management in async mode: drivers now receive the kStartFreewheelCallback and kStopFreewheelCallback notifications. Server and user directory related code moved in a JackTools file. Client name rewritting to remove path characters (used in fifo naming). Correct ALSA driver Attach method: internal driver may have changed the buffer_size and sample_rate values. Add JackWinSemaphore class. Add an implementation for obsolete jack_internal_client_new and jack_internal_client_close. Add missing jack_port_type_size. Use of JackWinSemaphore instead of JackWinEvent for inter-process synchronization. Correct types.h for use with MINGW on Windows. Move OSX start/stop notification mechanism in Jackdmp.cpp. Correct CheckPort in JackAPI.cpp.
+0.69 : On OSX, use CFNotificationCenterPostNotificationWithOptions with kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions for server ==> JackRouter plugin notification. On OSX, use jack server name in notification system. Correct fPeriodUsecs computation in JackAudioDriver::SetBufferSize and JackAudioDriver::SetSampleRate. Correct JackMachNotifyChannel::ClientNotify. Correct bug in CoreAudio driver sample rate management. Add a sample_rate change listener in CoreAudio driver. Correct sample_rate management in JackCoreAudioDriver::Open. Better handling in sample_rate change listener. Pieter Palmers FFADO driver and scons based build. Pieter Palmers second new build system: scons and Makefile based build. Tim Blechmann scons patch. Change string management for proper compilation with gcc 4.2.2. JackLog cleanup. Cleanup in CoreAudio driver. Tim Blechmann patch for JackGraphManager::GetPortsAux memory leak, Tim Blechmann patch for scons install. Dmitry Baikov MIDI patch : alsa_seqmidi and alsa_rammidi drivers. CoreAudio driver improvement : detect and notify abnormal situations (stopped driver in case of SR change...).
+0.70 : Updated API to match jack 0.109.0 version. Update in usx2y.c and JackPort.cpp to match jackd 0.109.2. Latest jack_lsp code from jack SVN. Add jack_mp_thread_wait client example. Add jack_thread_wait client example. Remove checking thread in CoreAudio driver, better device state change recovery strategy: the driver is stopped and restarted. Move transport related methods from JackEngine to JackServer. Tim Blechmann sse optimization patch for JackaudioPort::MixAudioBuffer, use of Apple Accelerate framework on OSX. Remove use of assert in JackFifo, JackMachSemaphore, and JackPosixSemaphore: print an error instead. Correct "server_connect": close the communication channel. More robust external API. Use SetAlias for port naming. Use jackd midi port naming scheme. Notify ports unregistration in JackEngine::ClientCloseAux. Fix in JackClient::Error(): when RT thread is failing and calling Shutdown, Shutdown was not desactivating the client correctly.
+0.71 : Add port register/unregister notification in JackAlsaDriver. Correct JACK_port_unregister in MIDI backend. Add TimeCallback in JackDebugClient class. Correct jack_get_time propotype. Correct JackSocketClientChannel::ClientClose to use ServerSyncCall instead of ServerAsyncCall. Better documentation in jack.h. libjackdmp.so renamed to libjackservermp.so and same for OSX framework. Define an internal jack_client_open_aux needed for library wrapper feature. Remove unneeded jack_port_connect API. Correct jack_port_get_connections function (should return NULL when no connections). In thread model, execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished). Fix engine real-time notification (was broken since ??). Implements wrapper layer. Correct jack_port_get_total_latency. Correct all backend playback port latency in case of "asynchronous" mode (1 buffer more). Add test for jack_cycle_wait, jack_cycle_wait and jack_set_process_thread API. RT scheduling for OSX thread (when used in dummy driver). Add -L (extra output latency in aynchronous mode) in CoreAudio driver. New JackLockedEngine decorator class to serialize access from ALSA Midi thread, command thread and in-server clients. Use engine in JackAlsaDriver::port_register and JackAlsaDriver::port_unregister. Fix connect notification to deliver *one* notification only. Correct JackClient::Activate so that first kGraphOrderCallback can be received by the client notification thread. New jack_server_control client to test notifications when linked to the server library. Synchronise transport.h with latest jackd version (Video handling). Transport timebase fix. Dmitry Baikov patch for alsa_rawmidi driver. Pieter Palmers patch for FFADO driver. Add an Init method for blocking drivers to be decorated using JackThreadedDriver class. Correct PortRegister, port name checking must be done on server side. Correct a missing parameter in the usage message of jack_midiseq. New SetNonBlocking method for JackSocket. Correct a dirty port array issue in JackGraphManager::GetPortsAux. 
+1.9.0 : Waf based build system : Nedko Arnaudov, Grame for preliminary OSX support. Control API, dbus based server control access : Nedko Arnaudov, Grame. NetJack2 components (in progress) : jack_net backend, netmanager, audioadapter, netadapter : Romain Moret, Grame. Code restructuring to help port on other architectures : Michael Voigt. Code cleanup/optimization : Tim Blechmann. Improve handling of server internal clients that can now be loaded/unloaded using the new server control API : Grame. A lot of bug fix and improvements.
+1.9.1 : Fix jackctl_server_unload_internal. Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server. Libjack shutdown handler does not "deactivate" (fActive = false) the client anymore, so that jack_deactivate correctly does the job later on. Better isolation of server and clients system resources to allow starting the server in several user account at the same time. Report ringbuffer.c fixes from jack1. Client and library global context cleanup in case of incorrect shutdown handling (that is applications not correctly closing client after server has shutdown). Use JACK_DRIVER_DIR variable in internal clients loader. For ALSA driver, synchronize with latest jack1 memops functions. Synchronize jack2 public headers with jack1 ones. Implement jack_client_real_time_priority and jack_client_max_real_time_priority API. Use up to BUFFER_SIZE_MAX frames in midi ports, fix for ticket #117. Cleanup server starting code for clients directly linked with libjackserver.so. JackMessageBuffer was using thread "Stop" scheme in destructor, now use the safer thread "Kill" way. Synchronize ALSA backend code with JACK1 one. Set default mode to 'slow' in JackNetDriver and JackNetAdapter. Simplify audio packet order verification. Fix JackNetInterface::SetNetBufferSize for socket buffer size computation and JackNetMasterInterface::DataRecv if synch packet is received, various cleanup. Better recovery of network overload situations, now "resynchronize" by skipping cycles.". Support for BIG_ENDIAN machines in NetJack2. Support for BIG_ENDIAN machines in NetJack2 for MIDI ports. Support for "-h" option in internal clients to print the parameters. In NetJack2, fix a bug when capture or playback only channels are used. Add a JACK_INTERNAL_DIR environment variable to be used for internal clients. Add a resample quality parameter in audioadapter. Now correctly return an error if JackServer::SetBufferSize could not change the buffer size (and was just restoring the current one). Use PRIu32 kind of macro in JackAlsaDriver again. Add a resample quality parameter in netadapter.
+1.9.2 : Solaris version. New "profiling" tools. Rework the mutex/signal classes. Support for BIG_ENDIAN machines in NetJack2. D-BUS based device reservation to better coexist with PulseAudio on Linux. Add auto_connect parameter in netmanager and netadapter. Use Torben Hohn PI controler code for adapters. Client incorrect re-naming fixed : now done at socket and fifo level. Virtualize and allow overriding of thread creation function, to allow Wine support (from JACK1).
+1.9.3 : New JackBoomerDriver class for Boomer driver on Solaris. Add mixed 32/64 bits mode (off by default). Native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver). In ALSA audio card reservation code, tries to open the card even if reservation fails. Clock source setting on Linux. Add jackctl_server_switch_master API. Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running). D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API. Cleanup "loopback" stuff in server. Torben Hohn fix for InitTime and GetMicroSeconds in JackWinTime.c. New jack_free function added in jack.h. Reworked Torben Hohn fix for server restart issue on Windows. Correct jack_set_error_function, jack_set_info_function and jack_set_thread_creator functions. Correct JackFifo::TimedWait for EINTR handling. Move DBus based audio device reservation code in ALSA backend compilation. Correct JackTransportEngine::MakeAllLocating, sync callback has to be called in this case also. NetJack2 code : better error checkout, method renaming. Tim Bechmann patch : hammerfall, only release monitor thread, if it has been created. Tim Bechmann memops.c optimization patches. In combined --dbus and --classic compilation code, use PulseAudio acquire/release code. Big rewrite of Solaris boomer driver, seems to work in duplex mode at least. Loopback backend reborn as a dynamically loadable separated backend. 
+1.9.4 : Solaris boomer backend now working in capture or playback only mode. Add a -G parameter in CoreAudio backend (the computation value in RT thread expressed as percent of period). Use SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART API to synchronize input and output in Solaris boomer backend. Big endian bug fix in memops.c. Fix issues in JackNetDriver::DecodeTransportData and JackNetDriver::Initialize. Correct CPU timing in JackNetDriver, now take cycle begin time after Read. Simplify transport in NetJack2: master only can control transport. Change CoreAudio notification thread setup for OSX Snow Leopard. Correct server temporary mode : now set a global and quit after server/client message handling is finished. Add a string parameter to server ==> client notification, add a new JackInfoShutdownCallback type. CoreAudio backend now issue a JackInfoShutdownCallback when an unrecoverable error is detected (sampling rate change, stream configuration changeÉ).  Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048. Correct JackProcessSync::LockedTimedWait. Correct JACK_MESSAGE_SIZE value, particularly in OSX RPC code. Now start server channel thread only when backend has been started (so in JackServer::Start). Should solve race conditions at start time. jack_verbose moved to JackGlobals class. Improve aggregate device management in JackCoreAudioDriver : now a "private" device only and cleanup properly. Aggregate device code added to JackCoreAudioAdapter. Implement "hog mode" (exclusive access of the audio device) in JackCoreAudioDriver. Fix jack_set_sample_rate_callback to have he same behavior as in JACK1. Dynamic system version detection in JackCoreAudioDriver to either create public or private aggregate device. In JackCoreAudioDriver, force the SR value to the wanted one *before* creating aggregate device (otherwise creation will fail).  In JackCoreAudioDriver, better cleanup of AD when intermediate open failure. In JackCoreAudioDriver::Start, wait for the audio driver to effectively start (use the MeasureCallback). In JackCoreAudioDriver, improve management of input/output channels: -1 is now used internally to indicate a wanted max value. In JackCoreAudioDriver::OpenAUHAL, correct stream format setup and cleanup. Correct crash bug in JackAudioAdapterInterface when not input is used in adapter (temporary fixÉ). Sync JackCoreAudioAdapter code on JackCoreAudioDriver one. JACK_SCHED_POLICY switched to SCHED_FIFO. Now can aggregate device that are themselves AD. No reason to make jack_on_shutdown deprecated, so revert the incorrect change. Thread AcquireRealTime and DropRealTime were (incorrectly) using fThread field. Use pthread_self()) (or GetCurrentThread() on Windows) to get the calling thread. Correctly save and restore RT mode state in freewheel mode. Correct freewheel code on client side. Fix AcquireRealTime and DropRealTime: now distinguish when called from another thread (AcquireRealTime/DropRealTime) and from the thread itself (AcquireSelfRealTime/DropSelfRealTime). Correct JackPosixThread::StartImp : thread priority setting now done in the RT case only. Correct JackGraphManager::GetBuffer for the "client loop with one connection" case : buffer must be copied. Correct JackInfoShutdownCallback prototype, two new JackClientProcessFailure and JackClientZombie JackStatus code. Correct JackCoreAudio driver when empty strings are given as -C, -P or -d parameter. Better memory allocation error checking on client (library) side. Better memory allocation error checking in ringbuffer.c, weak import improvements. Memory allocation error checking for jack_client_new and jack_client_open (server and client side). Memory allocation error checking in server for RPC. Simplify server temporary mode : now use a JackTemporaryException. Lock/Unlock shared memory segments (to test...). Sync with JACK1 : -r parameter now used for no-realtime, realtime (-R) is now default, usable backend given vie platform. In JackCoreAudio driver, (possibly) clock drift compensation when needed in aggregated devices. In JackCoreAudio driver, clock drift compensation in aggregated devices working. In JackCoreAudio driver, clock drift compensation semantic changed a bit : when on, does not activate if not needed (same clock domain). Sync JackCoreAudioAdapter code with JackCoreAudioDriver.
+1.9.5 : Dynamic choice of maximum port number. More robust sample rate change handling code in JackCoreAudioDriver. Devin Anderson patch for Jack FFADO driver issues with lost MIDI bytes between periods (and more). Fix port_rename callback : now both old name and new name are given as parameters. Special code in JackCoreAudio driver to handle completely buggy Digidesign CoreAudio user-land driver. Ensure that client-side message buffer thread calls thread_init callback if/when it is set by the client (backport of JACK1 rev 3838). Check dynamic port-max value. Fix JackCoreMidiDriver::ReadProcAux when ring buffer is full (thanks Devin Anderson). Josh Green ALSA driver capture only patch. When threads are cancelled, the exception has to be rethrown.  Use a QUIT notification to properly quit the server channel, the server channel thread can then be 'stopped' instead of 'canceled'. Mario Lang alsa_io time calculation overflow patch. Shared memory manager was calling abort in case of fatal error, now return an error in caller. Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF.   
+
+This is a work in progress but the implementation is now stable enough to be tested. jackdmp has been used successfully with the following applications : Ardour, Hydrogen, Jamin, Qjackctl, Jack-Rack, SooperLooper, AlsaPlayer...  
+
+------------------------------------
+General known problems, limitations
+------------------------------------
+
+- zombification of clients is not implemented
+
+- the number of server audio ports is fixed
+
+- memory locking is not implemented
+
+The package is available at http://www.grame.fr/~letz/jackdmp.html
+
+=============================================
+Grame : Computer Music Research Laboratory
+Web : http://www.grame.fr/Research
+E-mail : letz at grame.fr
+=============================================
diff --git a/README.developers b/README.developers
deleted file mode 100644
index 4437015..0000000
--- a/README.developers
+++ /dev/null
@@ -1,153 +0,0 @@
-=======================================================================
-*** README.developers - JACK development practices                  ***
-=======================================================================
-
-:Version: $Id: README.developers 925 2005-09-11 12:34:41Z kaiv $
-:Formatting: restructured text, http://docutils.sourceforge.net/rst.html
-
-What is this? 
------------------------------------------------------------------------
-
-This file is a collection of practices and rules for JACK
-development. If you have questions, or would like to make 
-changes, raise the issue on jackit-devel (see 
-http://lists.sourceforge.net/lists/listinfo/jackit-devel ).
-
-
-Contents
------------------------------------------------------------------------
-
-- What is this?
-- Version numbers
-- Important files for developers
-- Sending patches
-- CVS Access
-- Decision Process
-
-
-Important files for developers
------------------------------------------------------------------------
-
-AUTHORS
-	List of contributors. If you have contributed code, mail Paul 
-	Davis to get your name added to the list, or if you have 
-	CVS-access, help yourself. :) Also remember to update the
-	per source file copyright statements when committing changes.
-
-README.developers 
-	This file.
-
-TODO
-	A one file mini-bugzilla for JACK developers. Note: this file
-	is no longer actively updated - please use the Mantis
-	bugtracker instead, see http://jackit.sourceforge.net/dev/ .
-
-libjack/ChangeLog
-	A list of _all_ changes to the public interface!
-
-
-Version numbers 
------------------------------------------------------------------------
-
-JACK's package version
-~~~~~~~~~~~~~~~~~~~~~~
-
-JACK's package version is set in configure.in, and consists of 
-major, minor and revision numbers. This version should be 
-updated whenever a non-trivial set of changes is committed 
-to CVS:
- 
-major version
-   ask on jackit-devel :)
-
-minor version
-   incremented when any of the public or internal
-   interfaces are changed
-
-revision
-   incremented when implementation-only
-   changes are made
-
-Client API versioning
-~~~~~~~~~~~~~~~~~~~~~
-
-JACK clients are affected by two interfaces, the JACK Client API (libjack)
-and the JACK Client Protocol API (interface between jackd and 
-libjack). The former one is versioned using libtool interface 
-versioniong (set in configure.in). This version should be updated 
-whenever a set of changes affecting the interface is committed 
-to CVS:
-
-current
-    incremented whenever the public libjack API is changed 
-   
-revision
-    incremented when the libjack implementation is changed
-    
-age
-    current libjack is both source and binary compatible with
-    libjack interfaces current,current-1,...,current-age
-
-Note! It was decided in January 2003 that current interface number
-      will remain as zero until the first stable JACK version
-      is released.
-
-JACK Client Protocol is versioned... <TBD>.
-
-Note! All changes that affect the libjack API must be documented 
-in jack/libjack/ChangeLog using the standard ChangeLog style
-(see GNU developer docs).
-
-
-Sending patches
----------------------------------------------------------------------
-
-People without CVS-access
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Send your patches to jackit-devel. Normally patches are accepted
-by Paul Davis and/or Jack O'Quin. Either the patch is applied right 
-away, or you get an "ok to me" message, after which other developers 
-with CVS-access can commit the patch.
-
-People with CVS-access
-~~~~~~~~~~~~~~~~~~~~~~
-
-Trivial changes can be committed without review. For non-trivial 
-changes, you should first send a proposal to jackit-devel and
-wait for comments. There are no strict approval rules so use of
-common sense is recommended. ;)
-
-Tips for making patches
-~~~~~~~~~~~~~~~~~~~~~~~
-
-- test your patch on a clean CVS-checkout
-- remember to run cvs update before making commits
-
-
-CVS Access
------------------------------------------------------------------------
-
-Contact Paul Davis.
-
-
-Uses of external libraries and other packages
------------------------------------------------------------------------
-
-The main JACK components, jackd and libjack, should only use 
-standard POSIX and ANSI-C services. If use of other interfaces is
-absolutely needed, it should be made optional in the build process (via
-a configure switch for example). 
-
-Other components like example clients and drivers, may rely on other 
-packages, but these dependencies should not affect the main build 
-process.
-
-
-Decision Process
------------------------------------------------------------------------
-
-All non-trivial changes should be discussed on the jackit-devel 
-mailing list. It has been agreed that Paul Davis will make 
-the final decisions based on these discussions.
-
diff --git a/README_NETJACK2 b/README_NETJACK2
new file mode 100644
index 0000000..206c4ec
--- /dev/null
+++ b/README_NETJACK2
@@ -0,0 +1,74 @@
+-------------------------------
+NetJack for Jackmp
+-------------------------------
+
+
+This release includes a version of netjack designed for jackmp. Indeed, the original concept has been completely redesigned to better fit to the jackmp architecture, but also in order to provide additional capabilities, and ultimately a greater robustness.
+
+This document describes the major changes between those two systems, then a simple how-to for setting up a basic usage of 'netjack2'.
+
+
+-------------------------------
+Major changes and architecture
+-------------------------------
+
+
+The biggest difference between netjack and netjack2 is the way of slicing audio and midi streams into network packets. For one audio cycle, netjack used to take all audio and midi buffers (one per channel), put butt all of them, then send it over the network. The problem is that a network packet has a fixed maximum size, depending on the network infrastructure (for 100mb, it reaches 1500bytes - MTU of the network). The solution is then to slice those buffers into smaller ones, and then send as many packets as we need. This cutting up can be done by network equipments, but it's more efficient and secure to include it in the software data management. Still this slicing brings another issue : all the packets are not pleased with any emission order and are unfortunately received in a random order, thanks to UDP. So we can't deal with data as it comes, we need to re-bufferize incoming streams in order to rebuild complete audio buffers.
+
+In netjack2, the main idea is to make this slicing depending on the network capabilities. If we can put only 128 complete audio frames (128 samples for all audio channels) in a network packet, the elementary packet will so carry 128 frames, and in one cycle, we will transmit as many packet as we need. We take the example of 128 frames because it's the current value for 2 channels. This value is determinated by taking the maximum 'power of 2' frames we can put in a packet. If we take 2 channels, 4 bytes per sample (float values), we get 8 bytes per frame, with 128 frames, we now have 1024 bytes, so we can put these 1024 bytes in one packet, and add a small header which identify the packet. This technique allows to separate the packets (in time) so they can be received in the order they have been emitted. If the master is running at 512 frames per second, four audio packets are sent per cycle and the slave deals with them as they arrive. With gigabytes networks, the MTU is larger, so we can put more data in one packet (in this example, we can even put the complete cycle in one packet).
+
+For midi data, netjack used to send the whole buffer, in this example, 512 frames * 4 bytes per sample and per midi port. Those 2048 bytes are in 99% of the time filled to a few bytes, but rarely more. This means that if we have 2 audio and 2 midi channels to transmit, everything happens as if we had 4 audio channels, which is quite a waste of bandwidth. In netjack2, the idea is to take into account that fact, by sending only the useful bytes, and not more. It's completely unappropriate to overload the network with useless data. So we now have : 99% of the time one midi packet (of a few dozen of bytes), followed by four audio packets (in this example).
+
+This way of separating audio and midi is quite important. We deal here with network transmissions, and also need to be 'realtime'. We need a system which allow to carry as many audio and midi data streams as we need and can, as if the distant computer was in fact a simple jack client. With all those constraints, we can't avoid packets loss. The better thing to do is to deal with it. But to loose an audio packet is different from skipping a midi one. Indeed, an audio loss leads to audio click, or undesirable, but very short side effect. Whereas a midi data loss can be completely disastrous. Imagine that we play some notes, with sustain, and we loose the sustain 0 value, which stops the effect. The sustain keeps going on on all following notes until the next 'sustain off' event. A simple missing byte can put all the midi system offside (that's the purpose of all the big PANIC buttons on midi softwares...). That's why we need to separate audio (more than one per cycle) from midi (one packet at 99% of the time). If we loose an audio packet, we probably still have an available midi packet, so we can use what we received, even if some audio is missing.
+
+Those audio and midi packets are preceded by a synchronization packet, which will make the slave directly synchronized on the master's cycle rythm. This packet also carries transport data. Thus it's actually possible to synchronize also transport. This feature goes a little further than in netjack. The idea here is to make every computer of the network fully synchronized on the master's transport. That means the master needs to know the state of every slow sync clients of each of its slaves. The master can now manage the transport state (especially the 'rolling' state) of each slave thus the main transport waits for the last slow sync client before turning 'rolling'. By doing this, the transport can start (roll) in the same cycle for every computers managed by the master.
+
+
+The second main difference between netjack and netjack2 is the way the two computers (master and slave) synchronise their parametering and launch. In netjack, once the slave configured (by the command line) and launched, it was waiting for the first incoming packet to synchronize (launch its first audio cycle) then run. The two computers needed to be configured separately but with the same parameters to run correctly.
+
+In netjack2, the only thing you have to set for the slave is its number of in/out midi and audio channels. No more need to choose and set parameters depending on the master, they are automatically determinated and communicated to the slave. This first synchronization step uses a multicast communication, no more need to know by advance all the IP addresses. The slave says on a multicast address "hey, I'm available". A master get the message, and communicate parametering to the slave. Once synchronization done, data transfers can start. Moreover, the master being still listening on the multicast address, it can catch other slaves and manage them (create a jack client to communicate with the slave, and neatily close everything when the slave is gone).
+
+The loaded internal client is no longer only an interface for the slave, like in netjack. It's now called 'network manager', it doesn't deal with audio or midi, just with some kind of 'network logistical messages'. The manager automatically create a new internal client as soon as a new slave is seen on the network (by sending messages on the multicast address the manager is listening on). This manager is also able to remove one of its internal client as soon as a slave has left the network. This conception allow a complete separation of audio exchanges from parametering and management.
+
+The 'unloading' of the internal client (the manager) will cause a full cleaning of the infrastructure. The jack clients are all removed from the server, the slave are all turned available again, ready to be cought by another master etc. When a slave quits, it's also automatically removed from the manager's slaves list.
+
+
+-------------------------------
+How-to use this ?
+-------------------------------
+
+
+Netjackmp is very simple to use. On the master's side, an internal client deals with the slaves, and the slaves themselves are classical jack servers running under a 'network audio driver'. The difference between the two versions is that the master now has a manager, which takes care of the slaves, while listening on the multicast address and create a new master as soon as a slave is available. But everything is transparent to the user, that's why it uses multicast (someone says "hello", and anyone who wants to hear it just has to listen).
+
+So, just compile and install jackmp as you are used to, on linux, using './waf configure', './waf' and './waf install' as root. On macosx, you can use the xcode project. On Windows, you can use the Code::Blocks workspace (you also have a small script to make an all in one installer).
+
+On the master, just launch a classical jack server, the period size doesn't matter. Then, load the network manager using jack_load :
+
+'jack_load netmanager'
+
+This will load the internal client, which will wait for an available slave (see the message window on qjackctl - or the console output). If you want to listen to a specific multicast socket, you can add some options. To spicify a complete command line, you can use :
+
+'jack_load netmanager -i"-a xxx.xxx.xxx.xxx -p udp_port"'
+
+If you set another multicast address or port, you have to set the same on the slave's side. The default value should be working in many cases.
+
+On the slave, just launch a new jack server using :
+
+'jackd -R -d net'
+
+As in a standard backend in Jackmp, you can use '-S' (synchronous mode). The asynchronous mode (without '-S') allows to send the computed data during the next cycle. In synchronous mode, data are sent back at the end of the cycle, that means after the process. You can specify some options, like '-n name' (will give a name to the slave, default is the network hostname), '-C input_ports' (the number of master-->slave channels), '-P output_ports' (the number of slave-->master channels), default is 2 ; or '-i midi_in_ports' and '-o midi_out_ports', default is 0. If you set multicast address or port on the master, you can add '-a xxx.xxx.xxx.xxx' and '-p udp_port'.
+
+You can also use others network mode, with '-m' option (fast, normal or slow). Fast mode allow a zero latency transmission. This mode means the master waits for its returned data from the slave in the current cycle. This mode is appropriated for 'small' transmissions (only a few channels with a light process on the slave). Normal mode brings one cycle latency. It allow a normal use of the network.
+
+Slow mode (default) allows a full usage of the whole system. Slow mode brings a two cycles additional latency. This mode allows to send a lot of data on the network, but it also takes into account some process time on the slave, thus the data aren't expected on the master before two cycles, so it's not necessary to wait for them.
+
+For additional informations, you can go to the NetJack2 Wiki at : http://trac.jackaudio.org/wiki/WalkThrough/User/NetJack2.
+
+
+-------------------------------
+What's next ?
+-------------------------------
+
+The development of netjack continues and some things are always moving... If you use it, please report encountered bugs, ideas or anything you think about.
+
+If you have any question, you can subscribe the jackaudio developers mailing list at http://www.jackaudio.org/ or join the IRC channel '#jack' on FreeNode.
diff --git a/TODO b/TODO
index f1b2283..dd40314 100644
--- a/TODO
+++ b/TODO
@@ -1,88 +1,60 @@
-=======================================================================
-*** TODO - A one file mini-bugzilla for JACK developers             ***
-=======================================================================
+---------------------
+  Jackdmp Todo list
+---------------------
 
-Version: $Id: TODO 3116 2008-11-24 15:36:26Z paul $
 
-NOTE: web-based bug tracker for JACK was put online in Oct 2003. It is 
-      now the preferred way to report and track bugs and feature 
-      requests. This TODO file is now used only for tracking release 
-      issues (mapping features and other todo-items to release 
-      roadmap, etc).
+2008-03-12 : Do not start the client RT thread if no callback or thread routine has been setup (no use of jack_set_process_callback or jack_set_process_thread). This require change in the server to avoid signaling the client in this case. Check direct access from server internal clients (see comment in JackInternalClient::JackInternalClient() in JackInternalClient.cpp)
 
-The new bug tracker can be found at:
+2008-02-07 : Pipelining idea:
 
-    http://jackit.sourceforge.net/mantis/
+- cut the driver buffer size in n slices : clients see the divided value, server deal with the driver value, some clients may want to keep the driver buffer size (non pipelining)
+- new jack_set_buffer_divisor/jack_get_buffer_divisor and jack_set_pipelining/jack_get_pipelining API
+- jack_set_buffer_size changes the driver buffer size, jack_get_buffer_size get the divided value
+- buffer_size callback notify the divided value for pipelining clients
 
------------------------------------------------------------------------
+2008-02-06 : Do a "fork-exec" for the server (deamon..)
 
-You can update this list directly via CVS or alternatively
-send a change request to jackit-devel mailing list.
+2008-02-05 : Hierarchical model : having several client graph running simultaneously (Fons) with a "link" between them (AKA NetJack)
 
------------------------------------------------------------------------
+2008-01-15 : Server control API (Nedko Arnoudov): would help to develop external control applications (DBUS or OSC based...)
 
-TODO for merging Mac OS X support
+2007-12-16 : Dynamic backend switch, so that audio backend can be switch off and replaced by the dummy backend.
 
-- clean up other header files
-  -- <sysdeps/poll.h>, fakepoll.h, etc.
-  -- <sysdeps/ipc.h>, <sys/ipc.h> in shm.c
+2007-10-17 : Optimize activation call graph with multiple clients in a same process
 
-TODO before-1.0
+Andrzej Szombierski recently did interesting test to measure jack client activation speed in different context: jack client opened in separated processes, multiple jack clients running in the server, multiple jack clients running in a same separated process, this using jackd or jackdmp.
 
-- add explanation of protocol versioning to README.developers (kaiv)
+jackd:
 
-TODO post-1.0
+- multiple jack clients in the server: fast because *direct function call* to the client process callback is done bypassing the fifo based activation system
+- jack clients in separated processes: slower using the fifo based activation system
+- multiple jack clients in a separated process: slower using the fifo based activation system
 
-- jack session handling (taybin)
-- first client run without jackd becomes jackd (joq)
-- TBD
+jackdmp:
 
-TODO general - no agreed timeline
+- multiple jack clients in the server: slower using the fifo based activation system
+- jack clients in separated processes: slower using the fifo based activation system
+- multiple jack clients in a separated process: slower using the fifo based activation system
 
-- better scheme for handling machine and system dependencies (joq)
-- proper handling of client return values in libjack
-- pool based malloc for rt client-local mem allocation (paul, moved back here)
+So basically jackdmp use the same fifo based activated system in all cases, and jackd does some optimization in the "multiple jack clients in the server" case.
 
-TO BE DECIDED - no agreed timeline
+Also having multiple clients in a same process (jack server or separated process) is not so common, it may still be interesting to be able to optimize the activation path with sequential clients in a same process (server or separated). I am thinking in a method that could be done in jackdmp data-flow model : since the activation path is "computed on the fly" when following links between clients, the step where a client activates all its output could be reworked a little with something like :
 
-- dropping the use of CAP_RESOURCE (nando)
-- support for on-the-fly sampling rate change
-- whether to default to triangular dithering for 16bit output. (swh)
+- find one of the client in the output client list that is in the same process
+- activate all other output clients using the normal fifo based system
+- *direct* call the client process callback
 
-TO THINK ABOUT - no agreed timeline
+(and this would be done recursively following a sequential path in the graph until no more client in the same process is found)
 
-- ensure that UST/MSC pairs work for transport API
-- whether we want to support varispeed (resampling and/or changing
-  the actual rate)
-- per-block timestamping against system clock (UST stamps at driver level)
-- dynamically increase the total number of ports in the system
+There is still an issue if a client uses the "Fons special" ((-: new jack_thread_wait API, where a client explicitly gives control back to libjack... I still don't have a clear idea if this optimization path could still be done.
 
-CLOSED (date,who,comment)
+Even if the "multiple clients" way is not really used in existing applications, is it a desirable feature to have at some point?
 
-- handle mixed-mode 64bit and 32bit clients (2008/10, done by torben)
-- don't build static libraries of drivers and ip-clients (2003/10/07,paul)
-- API to change buffer size (joq) (2003/10/07)
-- added code to enforce the 'bufsize==2^x' rule (taybin) (2003/8/28)
-- make sure that process callbacks always have nframes equal to buffersize (2003/08/27,done,kaiv)
-- add Paul's graph/subgraph explanation to the design doc (2003/08/27,done,kaiv)
-- add support for custom jackd --tmpdir in libjack (2003/05/06,done,jesse)
-- capture_client has pthread_mutex_lock() in its process() (2003/05/30,fixed,joq)
-- update at least the user-visible copyrights with year 2003 (2003/04/05,done,paul)
-- add a sane way handle situations where the unix sockets already 
-    exist when jackd is started (2003/04/05,sockets removed on startup,paul)
-- figure out how to have pools of buffers for ports by type - (2003/04/05, paul, implicit in new shm/port segment system)
-- passing args to drivers and clients? (?,done long ago,paul)
-- pool based malloc for rt client-local mem allocation (paul)
-- getting callbacks and args from dynamically loaded clients? (2003/02/25, paul, see jack/jack.h)
-- how do dynamically loaded clients (un)register ports, activate, etc. (2003/02/25, paul, see example-clients/inprocess.c)
-- server<->libjack interface version handshake (2003/02/11, trutkin, done)
-- alsa-driver parameter parsing patch (2003/02/25, joq, done)
-- jack_deactive called unconditionally in jack_client_close (2003/02/05, kaiv, fixed)
-- call time client before all others (2003/01/28, kaiv, another solution)
-- finalize discussion on transport API, and implement (2003/08/04, joq)
-- whether to hide the transport.h structs from clients (2003/08/04, joq)
-- define transport info struct contents (2003/08/13, joq)
-- resolve helper thread design question? (2003/08/31, joq)
-- get portaudio driver working under Linux (2003/10/29, joq)
+2007-10-07 : Before doing an official package, check all public headers
+
+2007-03-14 : Check JackGraphManager::GetPortsAux after MIDI branch merge.
+
+2007-03-14 : Add Paul dynamic jack server location code.
+
+2007-01-22 : Check the "dead" client removing code in the server : non running client may cause Desactivation and Close time out problems.
 
------------------------------------------------------------------------
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index e61e2f6..0000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
-dnl example
-dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
-dnl will set SYSCONFDIR to /usr/local/etc
-
-dnl written by thomas vander stichele
-
-AC_DEFUN([AS_AC_EXPAND],
-[
-  EXP_VAR=[$1]
-  FROM_VAR=[$2]
-
-  dnl first expand prefix and exec_prefix if necessary
-  prefix_save=$prefix
-  if test "x$prefix" = "xNONE"; then
-    prefix=/usr/local
-  fi
-  exec_prefix_save=$exec_prefix
-  if test "x$exec_prefix" = "xNONE"; then
-    if test "x$prefix_save" = "xNONE"; then
-      exec_prefix=/usr/local
-    else
-      exec_prefix=$prefix
-    fi
-  fi
-
-  full_var="$FROM_VAR"
-  dnl loop until it doesn't change anymore
-  while true; do
-    new_full_var="`eval echo $full_var`"
-    if test "x$new_full_var" = "x$full_var"; then break; fi
-    full_var=$new_full_var
-  done
-
-  dnl clean up
-  full_var=$new_full_var
-  [$1]=$full_var
-  prefix=$prefix_save
-  exec_prefix=$exec_prefix_save
-])
-
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 27c2011..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-#
-# on OS X, which(1) returns 0 even when it can't find a program 
-#
-
-if type libtoolize >/dev/null 2>&1
-then
-    LIBTOOLIZE=libtoolize
-else
-    if which glibtoolize >/dev/null
-    then
-	# on the Mac it's called glibtoolize for some reason
-	LIBTOOLIZE=glibtoolize
-    else
-	echo "libtoolize not found"
-	exit 1
-    fi
-fi
-
-$LIBTOOLIZE --force 2>&1 | sed '/^You should/d' || {
-    echo "libtool failed, exiting..."
-    exit 1
-}
-
-aclocal $ACLOCAL_FLAGS || {
-    echo "aclocal \$ACLOCAL_FLAGS where \$ACLOCAL_FLAGS= failed, exiting..."
-    exit 1
-}
-
-autoheader || {
-    echo "autoheader failed, exiting..."
-    exit 1
-}
-
-automake --add-missing --foreign || {
-    echo "automake --add-missing --foreign failed, exiting..."
-    exit 1
-}
-
-autoconf || {
-    echo "autoconf failed, exiting..."
-    exit 1
-}
-
-if test x$1 = x--run-conf; then
-  echo "because of \"$1\" Running ./configure --enable-maintainer-mode $@..."
-  ./configure --enable-maintainer-mode $@
-fi
diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp
new file mode 100644
index 0000000..0640883
--- /dev/null
+++ b/common/JackAPI.cpp
@@ -0,0 +1,1981 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackClient.h"
+#include "JackError.h"
+#include "JackGraphManager.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackGlobals.h"
+#include "JackTime.h"
+#include "JackCompilerDeps.h"
+#include "JackPortType.h"
+#include "JackPlatformPlug.h"
+#include <math.h>
+
+#ifdef __CLIENTDEBUG__
+#include "JackLibGlobals.h"
+#endif
+
+using namespace Jack;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    typedef void (*print_function)(const char *);
+    typedef void *(*thread_routine)(void*);
+
+    EXPORT
+    void
+    jack_get_version(
+        int *major_ptr,
+        int *minor_ptr,
+        int *micro_ptr,
+        int *proto_ptr);
+
+    EXPORT
+    const char *
+    jack_get_version_string();
+
+    EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, va_list ap);
+    EXPORT jack_client_t * jack_client_open (const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, ...);
+    EXPORT jack_client_t * jack_client_new (const char *client_name);
+    EXPORT int jack_client_name_size (void);
+    EXPORT char* jack_get_client_name (jack_client_t *client);
+    EXPORT int jack_internal_client_new (const char *client_name,
+                                         const char *load_name,
+                                         const char *load_init);
+    EXPORT void jack_internal_client_close (const char *client_name);
+    EXPORT int jack_is_realtime (jack_client_t *client);
+    EXPORT void jack_on_shutdown (jack_client_t *client,
+                                  JackShutdownCallback shutdown_callback, void *arg);
+    EXPORT void jack_on_info_shutdown (jack_client_t *client,
+                                  JackInfoShutdownCallback shutdown_callback, void *arg);
+    EXPORT int jack_set_process_callback (jack_client_t *client,
+                                          JackProcessCallback process_callback,
+                                          void *arg);
+    EXPORT jack_nframes_t jack_thread_wait(jack_client_t *client, int status);
+
+    // new
+    EXPORT jack_nframes_t jack_cycle_wait (jack_client_t*);
+    EXPORT void jack_cycle_signal (jack_client_t*, int status);
+    EXPORT int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg);
+
+    EXPORT int jack_set_thread_init_callback (jack_client_t *client,
+            JackThreadInitCallback thread_init_callback,
+            void *arg);
+    EXPORT int jack_set_freewheel_callback (jack_client_t *client,
+                                            JackFreewheelCallback freewheel_callback,
+                                            void *arg);
+    EXPORT int jack_set_freewheel(jack_client_t* client, int onoff);
+    EXPORT int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
+    EXPORT int jack_set_buffer_size_callback (jack_client_t *client,
+            JackBufferSizeCallback bufsize_callback,
+            void *arg);
+    EXPORT int jack_set_sample_rate_callback (jack_client_t *client,
+            JackSampleRateCallback srate_callback,
+            void *arg);
+    EXPORT int jack_set_client_registration_callback (jack_client_t *,
+            JackClientRegistrationCallback
+            registration_callback, void *arg);
+    EXPORT int jack_set_port_registration_callback (jack_client_t *,
+            JackPortRegistrationCallback
+            registration_callback, void *arg);
+    EXPORT int jack_set_port_connect_callback (jack_client_t *,
+            JackPortConnectCallback
+            connect_callback, void *arg);
+    EXPORT int jack_set_port_rename_callback (jack_client_t *,
+				    JackPortRenameCallback
+				    rename_callback, void *arg);
+    EXPORT int jack_set_graph_order_callback (jack_client_t *,
+            JackGraphOrderCallback graph_callback,
+            void *);
+    EXPORT int jack_set_xrun_callback (jack_client_t *,
+                                       JackXRunCallback xrun_callback, void *arg);
+    EXPORT int jack_activate (jack_client_t *client);
+    EXPORT int jack_deactivate (jack_client_t *client);
+    EXPORT jack_port_t * jack_port_register (jack_client_t *client,
+            const char *port_name,
+            const char *port_type,
+            unsigned long flags,
+            unsigned long buffer_size);
+    EXPORT int jack_port_unregister (jack_client_t *, jack_port_t *);
+    EXPORT void * jack_port_get_buffer (jack_port_t *, jack_nframes_t);
+    EXPORT const char * jack_port_name (const jack_port_t *port);
+    EXPORT const char * jack_port_short_name (const jack_port_t *port);
+    EXPORT int jack_port_flags (const jack_port_t *port);
+    EXPORT const char * jack_port_type (const jack_port_t *port);
+    EXPORT jack_port_type_id_t jack_port_type_id (const jack_port_t *port);
+    EXPORT int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
+    EXPORT int jack_port_connected (const jack_port_t *port);
+    EXPORT int jack_port_connected_to (const jack_port_t *port,
+                                       const char *port_name);
+    EXPORT const char ** jack_port_get_connections (const jack_port_t *port);
+    EXPORT const char ** jack_port_get_all_connections (const jack_client_t *client,
+            const jack_port_t *port);
+    EXPORT int jack_port_tie (jack_port_t *src, jack_port_t *dst);
+    EXPORT int jack_port_untie (jack_port_t *port);
+    EXPORT jack_nframes_t jack_port_get_latency (jack_port_t *port);
+    EXPORT jack_nframes_t jack_port_get_total_latency (jack_client_t *,
+            jack_port_t *port);
+    EXPORT void jack_port_set_latency (jack_port_t *, jack_nframes_t);
+    EXPORT int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
+    EXPORT int jack_recompute_total_latencies (jack_client_t*);
+    EXPORT int jack_port_set_name (jack_port_t *port, const char *port_name);
+    EXPORT int jack_port_set_alias (jack_port_t *port, const char *alias);
+    EXPORT int jack_port_unset_alias (jack_port_t *port, const char *alias);
+    EXPORT int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
+    EXPORT int jack_port_request_monitor (jack_port_t *port, int onoff);
+    EXPORT int jack_port_request_monitor_by_name (jack_client_t *client,
+            const char *port_name, int onoff);
+    EXPORT int jack_port_ensure_monitor (jack_port_t *port, int onoff);
+    EXPORT int jack_port_monitoring_input (jack_port_t *port);
+    EXPORT int jack_connect (jack_client_t *,
+                             const char *source_port,
+                             const char *destination_port);
+    EXPORT int jack_disconnect (jack_client_t *,
+                                const char *source_port,
+                                const char *destination_port);
+    EXPORT int jack_port_disconnect (jack_client_t *, jack_port_t *);
+    EXPORT int jack_port_name_size(void);
+    EXPORT int jack_port_type_size(void);
+    EXPORT jack_nframes_t jack_get_sample_rate (jack_client_t *);
+    EXPORT jack_nframes_t jack_get_buffer_size (jack_client_t *);
+    EXPORT const char ** jack_get_ports (jack_client_t *,
+                                         const char *port_name_pattern,
+                                         const char *type_name_pattern,
+                                         unsigned long flags);
+    EXPORT jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name);
+    EXPORT jack_port_t * jack_port_by_id (jack_client_t *client,
+                                          jack_port_id_t port_id);
+    EXPORT int jack_engine_takeover_timebase (jack_client_t *);
+    EXPORT jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
+    EXPORT jack_time_t jack_get_time();
+    EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t time);
+    EXPORT jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t frames);
+    EXPORT jack_nframes_t jack_frame_time (const jack_client_t *);
+    EXPORT jack_nframes_t jack_last_frame_time (const jack_client_t *client);
+    EXPORT float jack_cpu_load (jack_client_t *client);
+    EXPORT pthread_t jack_client_thread_id (jack_client_t *);
+    EXPORT void jack_set_error_function (print_function);
+    EXPORT void jack_set_info_function (print_function);
+
+    EXPORT float jack_get_max_delayed_usecs (jack_client_t *client);
+    EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client);
+    EXPORT void jack_reset_max_delayed_usecs (jack_client_t *client);
+
+    EXPORT int jack_release_timebase (jack_client_t *client);
+    EXPORT int jack_set_sync_callback (jack_client_t *client,
+                                       JackSyncCallback sync_callback,
+                                       void *arg);
+    EXPORT int jack_set_sync_timeout (jack_client_t *client,
+                                      jack_time_t timeout);
+    EXPORT int jack_set_timebase_callback (jack_client_t *client,
+                                           int conditional,
+                                           JackTimebaseCallback timebase_callback,
+                                           void *arg);
+    EXPORT int jack_transport_locate (jack_client_t *client,
+                                      jack_nframes_t frame);
+    EXPORT jack_transport_state_t jack_transport_query (const jack_client_t *client,
+            jack_position_t *pos);
+    EXPORT jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
+    EXPORT int jack_transport_reposition (jack_client_t *client,
+                                          jack_position_t *pos);
+    EXPORT void jack_transport_start (jack_client_t *client);
+    EXPORT void jack_transport_stop (jack_client_t *client);
+    EXPORT void jack_get_transport_info (jack_client_t *client,
+                                         jack_transport_info_t *tinfo);
+    EXPORT void jack_set_transport_info (jack_client_t *client,
+                                         jack_transport_info_t *tinfo);
+
+    EXPORT int jack_client_real_time_priority (jack_client_t*);
+    EXPORT int jack_client_max_real_time_priority (jack_client_t*);
+    EXPORT int jack_acquire_real_time_scheduling (pthread_t thread, int priority);
+    EXPORT int jack_client_create_thread (jack_client_t* client,
+                                          pthread_t *thread,
+                                          int priority,
+                                          int realtime, 	// boolean
+                                          thread_routine routine,
+                                          void *arg);
+    EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
+
+    EXPORT int jack_client_stop_thread (jack_client_t* client, pthread_t thread);
+    EXPORT int jack_client_kill_thread (jack_client_t* client, pthread_t thread);
+#ifndef WIN32
+    EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc);
+#endif
+    EXPORT char * jack_get_internal_client_name (jack_client_t *client,
+            jack_intclient_t intclient);
+    EXPORT jack_intclient_t jack_internal_client_handle (jack_client_t *client,
+            const char *client_name,
+            jack_status_t *status);
+    EXPORT jack_intclient_t jack_internal_client_load (jack_client_t *client,
+            const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, ...);
+    EXPORT jack_intclient_t jack_internal_client_load_aux (jack_client_t *client,
+            const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, va_list ap);
+
+    EXPORT jack_status_t jack_internal_client_unload (jack_client_t *client,
+            jack_intclient_t intclient);
+    EXPORT void jack_free(void* ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+static inline bool CheckPort(jack_port_id_t port_index)
+{
+    return (port_index > 0 && port_index < PORT_NUM_MAX);
+}
+
+static inline bool CheckBufferSize(jack_nframes_t buffer_size)
+{
+    return (buffer_size <= BUFFER_SIZE_MAX);
+}
+
+static inline void WaitGraphChange()
+{
+    /*
+    TLS key that is set only in RT thread, so never waits for pending
+    graph change in RT context (just read the current graph state).
+    */
+
+    if (jack_tls_get(JackGlobals::fRealTime) == NULL) {
+        JackGraphManager* manager = GetGraphManager();
+        JackEngineControl* control = GetEngineControl();
+        assert(manager);
+        assert(control);
+        if (manager->IsPendingChange()) {
+            jack_log("WaitGraphChange...");
+            JackSleep(int(control->fPeriodUsecs * 1.1f));
+        }
+    }
+}
+
+EXPORT void jack_set_error_function (print_function func)
+{
+    jack_error_callback = (func == NULL) ? &default_jack_error_callback : func;
+}
+
+EXPORT void jack_set_info_function (print_function func)
+{
+    jack_info_callback = (func == NULL) ? &default_jack_info_callback : func;
+}
+
+EXPORT jack_client_t* jack_client_new(const char* client_name)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_new");
+#endif
+    try {
+        assert(JackGlobals::fOpenMutex);
+        JackGlobals::fOpenMutex->Lock();
+        jack_error("jack_client_new: deprecated");
+        int options = JackUseExactName;
+        if (getenv("JACK_START_SERVER") == NULL)
+            options |= JackNoStartServer;
+        jack_client_t* res = jack_client_open_aux(client_name, (jack_options_t)options, NULL, NULL);
+        JackGlobals::fOpenMutex->Unlock();
+        return res;
+    } catch (std::bad_alloc& e) {
+        jack_error("Memory allocation error...");
+        return NULL;
+    } catch (...) {
+        jack_error("Unknown error...");
+        return NULL;
+    }
+}
+
+EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_get_buffer");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_get_buffer called with an incorrect port %ld", myport);
+        return NULL;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetBuffer(myport, frames) : NULL);
+    }
+}
+
+EXPORT const char* jack_port_name(const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_name");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_name called with an incorrect port %ld", myport);
+        return NULL;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->GetName() : NULL);
+    }
+}
+
+EXPORT const char* jack_port_short_name(const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_short_name");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_short_name called with an incorrect port %ld", myport);
+        return NULL;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->GetShortName() : NULL);
+    }
+}
+
+EXPORT int jack_port_flags(const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_flags");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_flags called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->GetFlags() : -1);
+    }
+}
+
+EXPORT const char* jack_port_type(const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_type");
+#endif
+ #if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+   if (!CheckPort(myport)) {
+        jack_error("jack_port_flags called an incorrect port %ld", myport);
+        return NULL;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->GetType() : NULL);
+    }
+}
+
+EXPORT jack_port_type_id_t jack_port_type_id(const jack_port_t *port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_type_id");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_type_id called an incorrect port %ld", myport);
+        return 0;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? GetPortTypeId(manager->GetPort(myport)->GetType()) : 0);
+    }
+}
+
+EXPORT int jack_port_connected(const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_connected");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_connected called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetConnectionsNum(myport) : -1);
+    }
+}
+
+EXPORT int jack_port_connected_to(const jack_port_t* port, const char* port_name)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_connected_to");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t src = (jack_port_id_t)port_aux;
+    if (!CheckPort(src)) {
+        jack_error("jack_port_connected_to called with an incorrect port %ld", src);
+        return -1;
+    } else if (port_name == NULL) {
+        jack_error("jack_port_connected_to called with a NULL port name");
+        return -1;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        jack_port_id_t dst = (manager ? manager->GetPort(port_name) : NO_PORT);
+        if (dst == NO_PORT) {
+            jack_error("Unknown destination port port_name = %s", port_name);
+            return 0;
+        } else {
+            return manager->IsConnected(src, dst);
+        }
+    }
+}
+
+EXPORT int jack_port_tie(jack_port_t* src, jack_port_t* dst)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_tie");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t src_aux = (uint64_t)src;
+#else
+    uint32_t src_aux = (uint32_t)src;
+#endif
+    jack_port_id_t mysrc = (jack_port_id_t)src_aux;
+    if (!CheckPort(mysrc)) {
+        jack_error("jack_port_tie called with a NULL src port");
+        return -1;
+    }
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t dst_aux = (uint64_t)dst;
+#else
+    uint32_t dst_aux = (uint32_t)dst;
+#endif
+    jack_port_id_t mydst = (jack_port_id_t)dst_aux;
+    if (!CheckPort(mydst)) {
+        jack_error("jack_port_tie called with a NULL dst port");
+        return -1;
+    }
+    JackGraphManager* manager = GetGraphManager();
+    if (manager && manager->GetPort(mysrc)->GetRefNum() != manager->GetPort(mydst)->GetRefNum()) {
+        jack_error("jack_port_tie called with ports not belonging to the same client");
+        return -1;
+    } else {
+        return manager->GetPort(mydst)->Tie(mysrc);
+    }
+}
+
+EXPORT int jack_port_untie(jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_untie");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_untie called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->UnTie() : -1);
+    }
+}
+
+EXPORT jack_nframes_t jack_port_get_latency(jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_get_latency");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_get_latency called with an incorrect port %ld", myport);
+        return 0;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->GetLatency() : 0);
+    }
+}
+
+EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_set_latency");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_set_latency called with an incorrect port %ld", myport);
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        if (manager)
+            manager->GetPort(myport)->SetLatency(frames);
+    }
+}
+
+EXPORT int jack_recompute_total_latency(jack_client_t* ext_client, jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_recompute_total_latency");
+#endif
+
+    JackClient* client = (JackClient*)ext_client;
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (client == NULL) {
+        jack_error("jack_recompute_total_latencies called with a NULL client");
+        return -1;
+    } else if (!CheckPort(myport)) {
+        jack_error("jack_recompute_total_latencies called with a NULL port");
+        return -1;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->ComputeTotalLatency(myport) : -1);
+    }
+}
+
+EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_recompute_total_latencies");
+#endif
+
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_recompute_total_latencies called with a NULL client");
+        return -1;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->ComputeTotalLatencies() : -1);
+    }
+}
+
+/*
+This is unsafe if case of concurrent access, and should be "serialized" doing a server call.
+*/
+
+EXPORT int jack_port_set_name(jack_port_t* port, const char* name)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_set_name");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_set_name called with an incorrect port %ld", myport);
+        return -1;
+    } else if (name == NULL) {
+        jack_error("jack_port_set_name called with a NULL port name");
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        int refnum;
+        if (manager && ((refnum = manager->GetPort(myport)->GetRefNum()) > 0)) {
+            JackClient* client = JackGlobals::fClientTable[refnum];
+            assert(client);
+            return client->PortRename(myport, name);
+        } else {
+            return -1;
+        }
+    }
+}
+
+EXPORT int jack_port_set_alias(jack_port_t* port, const char* name)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_set_alias");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_set_alias called with an incorrect port %ld", myport);
+        return -1;
+    } else if (name == NULL) {
+        jack_error("jack_port_set_alias called with a NULL port name");
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->SetAlias(name) : -1);
+    }
+}
+
+EXPORT int jack_port_unset_alias(jack_port_t* port, const char* name)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_unset_alias");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_unset_alias called with an incorrect port %ld", myport);
+        return -1;
+    } else if (name == NULL) {
+        jack_error("jack_port_unset_alias called with a NULL port name");
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->UnsetAlias(name) : -1);
+    }
+}
+
+EXPORT int jack_port_get_aliases(const jack_port_t* port, char* const aliases[2])
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_get_aliases");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_get_aliases called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->GetAliases(aliases) : -1);
+    }
+}
+
+EXPORT int jack_port_request_monitor(jack_port_t* port, int onoff)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_request_monitor");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_request_monitor called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->RequestMonitor(myport, onoff) : -1);
+    }
+}
+
+EXPORT int jack_port_request_monitor_by_name(jack_client_t* ext_client, const char* port_name, int onoff)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_request_monitor_by_name");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_request_monitor_by_name called with a NULL client");
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        if (!manager)
+            return -1;
+        jack_port_id_t myport = manager->GetPort(port_name);
+        if (!CheckPort(myport)) {
+            jack_error("jack_port_request_monitor_by_name called with an incorrect port %s", port_name);
+            return -1;
+        } else {
+            return manager->RequestMonitor(myport, onoff);
+        }
+    }
+}
+
+EXPORT int jack_port_ensure_monitor(jack_port_t* port, int onoff)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_ensure_monitor");
+#endif
+ #if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_ensure_monitor called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->EnsureMonitor(onoff) : -1);
+    }
+}
+
+EXPORT int jack_port_monitoring_input(jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_monitoring_input");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_monitoring_input called with an incorrect port %ld", myport);
+        return -1;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetPort(myport)->MonitoringInput() : -1);
+    }
+}
+
+EXPORT int jack_is_realtime(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_is_realtime");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_is_realtime called with a NULL client");
+        return -1;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control ? control->fRealTime : -1);
+    }
+}
+
+EXPORT void jack_on_shutdown(jack_client_t* ext_client, JackShutdownCallback callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_on_shutdown");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_on_shutdown called with a NULL client");
+    } else {
+        client->OnShutdown(callback, arg);
+    }
+}
+
+EXPORT void jack_on_info_shutdown(jack_client_t* ext_client, JackInfoShutdownCallback callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_on_info_shutdown");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_on_info_shutdown called with a NULL client");
+    } else {
+        client->OnInfoShutdown(callback, arg);
+    }
+}
+
+EXPORT int jack_set_process_callback(jack_client_t* ext_client, JackProcessCallback callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_process_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_process_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetProcessCallback(callback, arg);
+    }
+}
+
+EXPORT jack_nframes_t jack_thread_wait(jack_client_t* ext_client, int status)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_thread_wait");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_thread_wait called with a NULL client");
+        return 0;
+    } else {
+        jack_error("jack_thread_wait: deprecated, use jack_cycle_wait/jack_cycle_signal");
+        return 0;
+    }
+}
+
+EXPORT jack_nframes_t jack_cycle_wait(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_cycle_wait");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_cycle_wait called with a NULL client");
+        return 0;
+    } else {
+        return client->CycleWait();
+    }
+}
+
+EXPORT void jack_cycle_signal(jack_client_t* ext_client, int status)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_cycle_signal");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_cycle_signal called with a NULL client");
+    } else {
+        client->CycleSignal(status);
+    }
+}
+
+EXPORT int jack_set_process_thread(jack_client_t* ext_client, JackThreadCallback fun, void *arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_process_thread");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_process_thread called with a NULL client");
+        return -1;
+    } else {
+        return client->SetProcessThread(fun, arg);
+    }
+}
+
+EXPORT int jack_set_freewheel_callback(jack_client_t* ext_client, JackFreewheelCallback freewheel_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_freewheel_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_freewheel_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetFreewheelCallback(freewheel_callback, arg);
+    }
+}
+
+EXPORT int jack_set_freewheel(jack_client_t* ext_client, int onoff)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_freewheel");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_freewheel called with a NULL client");
+        return -1;
+    } else {
+        return client->SetFreeWheel(onoff);
+    }
+}
+
+EXPORT int jack_set_buffer_size(jack_client_t* ext_client, jack_nframes_t buffer_size)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_buffer_size");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_buffer_size called with a NULL client");
+        return -1;
+    } else if (!CheckBufferSize(buffer_size)) {
+        return -1;
+    } else {
+        return client->SetBufferSize(buffer_size);
+    }
+}
+
+EXPORT int jack_set_buffer_size_callback(jack_client_t* ext_client, JackBufferSizeCallback bufsize_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_buffer_size_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_buffer_size_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetBufferSizeCallback(bufsize_callback, arg);
+    }
+}
+
+EXPORT int jack_set_sample_rate_callback(jack_client_t* ext_client, JackSampleRateCallback srate_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_sample_rate_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_sample_rate_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetSampleRateCallback(srate_callback, arg);
+    }
+}
+
+EXPORT int jack_set_client_registration_callback(jack_client_t* ext_client, JackClientRegistrationCallback registration_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_client_registration_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_client_registration_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetClientRegistrationCallback(registration_callback, arg);
+    }
+}
+
+EXPORT int jack_set_port_registration_callback(jack_client_t* ext_client, JackPortRegistrationCallback registration_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_port_registration_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_port_registration_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetPortRegistrationCallback(registration_callback, arg);
+    }
+}
+
+EXPORT int jack_set_port_connect_callback(jack_client_t* ext_client, JackPortConnectCallback portconnect_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_port_connect_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_port_connect_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetPortConnectCallback(portconnect_callback, arg);
+    }
+}
+
+EXPORT int jack_set_port_rename_callback(jack_client_t* ext_client, JackPortRenameCallback rename_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_port_rename_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_port_rename_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetPortRenameCallback(rename_callback, arg);
+    }
+}
+
+EXPORT int jack_set_graph_order_callback(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_graph_order_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    jack_log("jack_set_graph_order_callback ext_client %x client %x ", ext_client, client);
+    if (client == NULL) {
+        jack_error("jack_set_graph_order_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetGraphOrderCallback(graph_callback, arg);
+    }
+}
+
+EXPORT int jack_set_xrun_callback(jack_client_t* ext_client, JackXRunCallback xrun_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_xrun_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_xrun_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetXRunCallback(xrun_callback, arg);
+    }
+}
+
+EXPORT int jack_set_thread_init_callback(jack_client_t* ext_client, JackThreadInitCallback init_callback, void *arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_thread_init_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    jack_log("jack_set_thread_init_callback ext_client %x client %x ", ext_client, client);
+    if (client == NULL) {
+        jack_error("jack_set_thread_init_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetInitCallback(init_callback, arg);
+    }
+}
+
+EXPORT int jack_activate(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_activate");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_activate called with a NULL client");
+        return -1;
+    } else {
+        return client->Activate();
+    }
+}
+
+EXPORT int jack_deactivate(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_deactivate");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_deactivate called with a NULL client");
+        return -1;
+    } else {
+        return client->Deactivate();
+    }
+}
+
+EXPORT jack_port_t* jack_port_register(jack_client_t* ext_client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_register");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_register called with a NULL client");
+        return NULL;
+    } else if ((port_name == NULL) || (port_type == NULL)) {
+        jack_error("jack_port_register called with a NULL port name or a NULL port_type");
+        return NULL;
+    } else {
+#if defined(__x86_64__) || defined(__ppc64__)
+        return (jack_port_t *)((uint64_t)client->PortRegister(port_name, port_type, flags, buffer_size));
+#else
+        return (jack_port_t *)client->PortRegister(port_name, port_type, flags, buffer_size);
+#endif
+    }
+}
+
+EXPORT int jack_port_unregister(jack_client_t* ext_client, jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_unregister");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_unregister called with a NULL client");
+        return -1;
+    }
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_unregister called with an incorrect port %ld", myport);
+        return -1;
+    }
+    return client->PortUnRegister(myport);
+}
+
+EXPORT int jack_port_is_mine(const jack_client_t* ext_client, const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_is_mine");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_is_mine called with a NULL client");
+        return -1;
+    }
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_is_mine called with an incorrect port %ld", myport);
+        return -1;
+    }
+    return client->PortIsMine(myport);
+}
+
+EXPORT const char** jack_port_get_connections(const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_get_connections");
+#endif
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_get_connections called with an incorrect port %ld", myport);
+        return NULL;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetConnections(myport) : NULL);
+    }
+}
+
+// Calling client does not need to "own" the port
+EXPORT const char** jack_port_get_all_connections(const jack_client_t* ext_client, const jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_get_all_connections");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_get_all_connections called with a NULL client");
+        return NULL;
+    }
+
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_get_all_connections called with an incorrect port %ld", myport);
+        return NULL;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        return (manager ? manager->GetConnections(myport) : NULL);
+    }
+}
+
+EXPORT jack_nframes_t jack_port_get_total_latency(jack_client_t* ext_client, jack_port_t* port)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_get_total_latency");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_get_total_latency called with a NULL client");
+        return 0;
+    }
+
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)port;
+#else
+    uint32_t port_aux = (uint32_t)port;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_get_total_latency called with an incorrect port %ld", myport);
+        return 0;
+    } else {
+        WaitGraphChange();
+        JackGraphManager* manager = GetGraphManager();
+        if (manager) {
+            manager->ComputeTotalLatency(myport);
+            return manager->GetPort(myport)->GetTotalLatency();
+        } else {
+            return 0;
+        }
+    }
+}
+
+EXPORT int jack_connect(jack_client_t* ext_client, const char* src, const char* dst)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_connect");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_connect called with a NULL client");
+        return -1;
+    } else if ((src == NULL) || (dst == NULL)) {
+        jack_error("jack_connect called with a NULL port name");
+        return -1;
+    } else {
+        return client->PortConnect(src, dst);
+    }
+}
+
+EXPORT int jack_disconnect(jack_client_t* ext_client, const char* src, const char* dst)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_disconnect");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_disconnect called with a NULL client");
+        return -1;
+    } else if ((src == NULL) || (dst == NULL)) {
+        jack_error("jack_connect called with a NULL port name");
+        return -1;
+    } else {
+        return client->PortDisconnect(src, dst);
+    }
+}
+
+EXPORT int jack_port_disconnect(jack_client_t* ext_client, jack_port_t* src)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_disconnect");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_port_disconnect called with a NULL client");
+        return -1;
+    }
+#if defined(__x86_64__) || defined(__ppc64__)
+    uint64_t port_aux = (uint64_t)src;
+#else
+    uint32_t port_aux = (uint32_t)src;
+#endif
+    jack_port_id_t myport = (jack_port_id_t)port_aux;
+    if (!CheckPort(myport)) {
+        jack_error("jack_port_disconnect called with an incorrect port %ld", myport);
+        return -1;
+    }
+    return client->PortDisconnect(myport);
+}
+
+EXPORT jack_nframes_t jack_get_sample_rate(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_sample_rate");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_sample_rate called with a NULL client");
+        return 0;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control ? control->fSampleRate : 0);
+    }
+}
+
+EXPORT jack_nframes_t jack_get_buffer_size(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_buffer_size");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_buffer_size called with a NULL client");
+        return 0;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control ? control->fBufferSize : 0);
+    }
+}
+
+EXPORT const char** jack_get_ports(jack_client_t* ext_client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_ports");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_ports called with a NULL client");
+        return NULL;
+    }
+    JackGraphManager* manager = GetGraphManager();
+    return (manager ? manager->GetPorts(port_name_pattern, type_name_pattern, flags) : NULL);
+}
+
+EXPORT jack_port_t* jack_port_by_name(jack_client_t* ext_client, const char* portname)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_by_name");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_ports called with a NULL client");
+        return 0;
+    }
+
+    if (portname == NULL) {
+        jack_error("jack_port_by_name called with a NULL port name");
+        return NULL;
+    } else {
+        JackGraphManager* manager = GetGraphManager();
+        if (!manager)
+            return NULL;
+        int res = manager->GetPort(portname); // returns a port index at least > 1
+#if defined(__x86_64__) || defined(__ppc64__)
+        return (res == NO_PORT) ? NULL : (jack_port_t*)((uint64_t)res);
+#else
+        return (res == NO_PORT) ? NULL : (jack_port_t*)res;
+#endif
+    }
+}
+
+EXPORT jack_port_t* jack_port_by_id(jack_client_t* ext_client, jack_port_id_t id)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_port_by_id");
+#endif
+    /* jack_port_t* type is actually the port index */
+#if defined(__x86_64__) || defined(__ppc64__)
+    return (jack_port_t*)((uint64_t)id);
+#else
+    return (jack_port_t*)id;
+#endif
+}
+
+EXPORT int jack_engine_takeover_timebase(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_engine_takeover_timebase");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_engine_takeover_timebase called with a NULL client");
+        return -1;
+    } else {
+        jack_error("jack_engine_takeover_timebase: deprecated\n");
+        return 0;
+    }
+}
+
+EXPORT jack_nframes_t jack_frames_since_cycle_start(const jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_frames_since_cycle_start");
+#endif
+    JackTimer timer;
+    JackEngineControl* control = GetEngineControl();
+    if (control) {
+        control->ReadFrameTime(&timer);
+        return timer.FramesSinceCycleStart(GetMicroSeconds(), control->fSampleRate);
+    } else {
+        return 0;
+    }
+}
+
+EXPORT jack_time_t jack_get_time()
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_time");
+#endif
+    return GetMicroSeconds();
+}
+
+EXPORT jack_time_t jack_frames_to_time(const jack_client_t* ext_client, jack_nframes_t frames)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_frames_to_time");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_frames_to_time called with a NULL client");
+        return 0;
+    } else {
+        JackTimer timer;
+        JackEngineControl* control = GetEngineControl();
+        if (control) {
+            control->ReadFrameTime(&timer);
+            return timer.Frames2Time(frames, control->fBufferSize);
+        } else {
+            return 0;
+        }
+    }
+}
+
+EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t* ext_client, jack_time_t time)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_time_to_frames");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_time_to_frames called with a NULL client");
+        return 0;
+    } else {
+        JackTimer timer;
+        JackEngineControl* control = GetEngineControl();
+        if (control) {
+            control->ReadFrameTime(&timer);
+            return timer.Time2Frames(time, control->fBufferSize);
+        } else {
+            return 0;
+        }
+    }
+}
+
+EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_frame_time");
+#endif
+    return jack_time_to_frames(ext_client, GetMicroSeconds());
+}
+
+EXPORT jack_nframes_t jack_last_frame_time(const jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_last_frame_time");
+#endif
+    JackEngineControl* control = GetEngineControl();
+    return (control) ? control->fFrameTimer.ReadCurrentState()->CurFrame() : 0;
+}
+
+EXPORT float jack_cpu_load(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_cpu_load");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_cpu_load called with a NULL client");
+        return 0.0f;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control ? control->fCPULoad :  0.0f);
+    }
+}
+
+EXPORT pthread_t jack_client_thread_id(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_thread_id");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_client_thread_id called with a NULL client");
+        return (pthread_t)NULL;
+    } else {
+        return client->GetThreadID();
+    }
+}
+
+EXPORT char* jack_get_client_name(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_client_name");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_client_name called with a NULL client");
+        return NULL;
+    } else {
+        return client->GetClientControl()->fName;
+    }
+}
+
+EXPORT int jack_client_name_size(void)
+{
+    return JACK_CLIENT_NAME_SIZE;
+}
+
+EXPORT int jack_port_name_size(void)
+{
+    return JACK_PORT_NAME_SIZE;
+}
+
+EXPORT int jack_port_type_size(void)
+{
+    return JACK_PORT_TYPE_SIZE;
+}
+
+// transport.h
+EXPORT int jack_release_timebase(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_release_timebase");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_release_timebase called with a NULL client");
+        return -1;
+    } else {
+        return client->ReleaseTimebase();
+    }
+}
+
+EXPORT int jack_set_sync_callback(jack_client_t* ext_client, JackSyncCallback sync_callback, void *arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_sync_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_sync_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetSyncCallback(sync_callback, arg);
+    }
+}
+
+EXPORT int jack_set_sync_timeout(jack_client_t* ext_client, jack_time_t timeout)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_sync_timeout");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_sync_timeout called with a NULL client");
+        return -1;
+    } else {
+        return client->SetSyncTimeout(timeout);
+    }
+}
+
+EXPORT int jack_set_timebase_callback(jack_client_t* ext_client, int conditional, JackTimebaseCallback timebase_callback, void* arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_timebase_callback");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_set_timebase_callback called with a NULL client");
+        return -1;
+    } else {
+        return client->SetTimebaseCallback(conditional, timebase_callback, arg);
+    }
+}
+
+EXPORT int jack_transport_locate(jack_client_t* ext_client, jack_nframes_t frame)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_transport_locate");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_transport_locate called with a NULL client");
+        return -1;
+    } else {
+        client->TransportLocate(frame);
+        return 0;
+    }
+}
+
+EXPORT jack_transport_state_t jack_transport_query(const jack_client_t* ext_client, jack_position_t* pos)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_transport_query");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_transport_query called with a NULL client");
+        return JackTransportStopped;
+    } else {
+        return client->TransportQuery(pos);
+    }
+}
+
+EXPORT jack_nframes_t jack_get_current_transport_frame(const jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_current_transport_frame");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_current_transport_frame called with a NULL client");
+        return 0;
+    } else {
+        return client->GetCurrentTransportFrame();
+    }
+}
+
+EXPORT int jack_transport_reposition(jack_client_t* ext_client, jack_position_t* pos)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_transport_reposition");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_transport_reposition called with a NULL client");
+        return -1;
+    } else {
+        client->TransportReposition(pos);
+        return 0;
+    }
+}
+
+EXPORT void jack_transport_start(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_transport_start");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_transport_start called with a NULL client");
+    } else {
+        client->TransportStart();
+    }
+}
+
+EXPORT void jack_transport_stop(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_transport_stop");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_transport_stop called with a NULL client");
+    } else {
+        client->TransportStop();
+    }
+}
+
+// deprecated
+EXPORT void jack_get_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_transport_info");
+#endif
+    jack_error("jack_get_transport_info: deprecated");
+    if (tinfo)
+        memset(tinfo, 0, sizeof(jack_transport_info_t));
+}
+
+EXPORT void jack_set_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_set_transport_info");
+#endif    
+    jack_error("jack_set_transport_info: deprecated");
+    if (tinfo)
+        memset(tinfo, 0, sizeof(jack_transport_info_t));
+}
+
+// statistics.h
+EXPORT float jack_get_max_delayed_usecs(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_max_delayed_usecs");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_max_delayed_usecs called with a NULL client");
+        return 0.f;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control ? control->fMaxDelayedUsecs : 0.f);
+    }
+ }
+
+EXPORT float jack_get_xrun_delayed_usecs(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_xrun_delayed_usecs");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_xrun_delayed_usecs called with a NULL client");
+        return 0.f;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control ? control->fXrunDelayedUsecs : 0.f);
+    }
+}
+
+EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_reset_max_delayed_usecs");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_reset_max_delayed_usecs called with a NULL client");
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        control->ResetXRun();
+    }
+}
+
+// thread.h
+EXPORT int jack_client_real_time_priority(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_real_time_priority");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_client_real_time_priority called with a NULL client");
+        return -1;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+        return (control->fRealTime) ? control->fClientPriority : -1;
+    }
+}
+
+EXPORT int jack_client_max_real_time_priority(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_max_real_time_priority");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_client_max_real_time_priority called with a NULL client");
+        return -1;
+    } else {
+        JackEngineControl* control = GetEngineControl();
+       return (control->fRealTime) ? control->fMaxClientPriority : -1;
+    }
+}
+
+EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority)
+{
+    JackEngineControl* control = GetEngineControl();
+    return (control ? JackThread::AcquireRealTimeImp(thread, priority, GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint) : -1);
+}
+
+EXPORT int jack_client_create_thread(jack_client_t* client,
+                                     pthread_t *thread,
+                                     int priority,
+                                     int realtime,  	/* boolean */
+                                     thread_routine routine,
+                                     void *arg)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_create_thread");
+#endif    
+    return JackThread::StartImp(thread, priority, realtime, routine, arg);
+}
+
+EXPORT int jack_drop_real_time_scheduling(pthread_t thread)
+{
+    return JackThread::DropRealTimeImp(thread);
+}
+
+EXPORT int jack_client_stop_thread(jack_client_t* client, pthread_t thread)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_stop_thread");
+#endif        
+    return JackThread::StopImp(thread);
+}
+
+EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_kill_thread");
+#endif            
+    return JackThread::KillImp(thread);
+}
+
+#ifndef WIN32
+EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc)
+{
+    JackGlobals::fJackThreadCreator = (jtc == NULL) ? pthread_create : jtc;
+}
+#endif
+
+// intclient.h
+EXPORT int jack_internal_client_new (const char *client_name,
+                                     const char *load_name,
+                                     const char *load_init)
+{
+    jack_error("jack_internal_client_new: deprecated");
+    return -1;
+}
+
+EXPORT void jack_internal_client_close (const char *client_name)
+{
+    jack_error("jack_internal_client_close: deprecated");
+}
+
+EXPORT char* jack_get_internal_client_name(jack_client_t* ext_client, jack_intclient_t intclient)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_get_internal_client_name");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_get_internal_client_name called with a NULL client");
+        return NULL;
+    } else if (intclient >= CLIENT_NUM) {
+        jack_error("jack_get_internal_client_name: incorrect client");
+        return NULL;
+    } else {
+        return client->GetInternalClientName(intclient);
+    }
+}
+
+EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, const char* client_name, jack_status_t* status)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_internal_client_handle");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_internal_client_handle called with a NULL client");
+        return 0;
+    } else {
+        jack_status_t my_status;
+        if (status == NULL)		/* no status from caller? */
+            status = &my_status;	/* use local status word */
+        *status = (jack_status_t)0;
+        return client->InternalClientHandle(client_name, status);
+    }
+}
+
+EXPORT jack_intclient_t jack_internal_client_load_aux(jack_client_t* ext_client, const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_internal_client_load_aux");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_internal_client_load called with a NULL client");
+        return 0;
+    } else {
+        jack_varargs_t va;
+        jack_status_t my_status;
+
+        if (status == NULL)			/* no status from caller? */
+            status = &my_status;	/* use local status word */
+        *status = (jack_status_t)0;
+
+        /* validate parameters */
+        if ((options & ~JackLoadOptions)) {
+            int my_status1 = *status | (JackFailure | JackInvalidOption);
+            *status = (jack_status_t)my_status1;
+            return 0;
+        }
+
+        /* parse variable arguments */
+        jack_varargs_parse(options, ap, &va);
+        return client->InternalClientLoad(client_name, options, status, &va);
+    }
+}
+
+EXPORT jack_intclient_t jack_internal_client_load(jack_client_t *client, const char *client_name, jack_options_t options, jack_status_t *status, ...)
+{
+    va_list ap;
+    va_start(ap, status);
+    jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap);
+    va_end(ap);
+    return res;
+}
+
+EXPORT jack_status_t jack_internal_client_unload(jack_client_t* ext_client, jack_intclient_t intclient)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_internal_client_load");
+#endif
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_internal_client_unload called with a NULL client");
+        return (jack_status_t)(JackNoSuchClient | JackFailure);
+    } else if (intclient >= CLIENT_NUM) {
+        jack_error("jack_internal_client_unload: incorrect client");
+        return (jack_status_t)(JackNoSuchClient | JackFailure);
+    } else {
+        jack_status_t my_status;
+        client->InternalClientUnload(intclient, &my_status);
+        return my_status;
+    }
+}
+
+EXPORT
+void
+jack_get_version(
+    int *major_ptr,
+    int *minor_ptr,
+    int *micro_ptr,
+    int *proto_ptr)
+{
+    // FIXME: We need these comming from build system
+    *major_ptr = 0;
+    *minor_ptr = 0;
+    *micro_ptr = 0;
+    *proto_ptr = 0;
+}
+
+EXPORT
+const char *
+jack_get_version_string()
+{
+    return VERSION;
+}
+
+EXPORT void jack_free(void* ptr)
+{
+    if (ptr) {
+        free(ptr);
+    }
+}
diff --git a/common/JackActivationCount.cpp b/common/JackActivationCount.cpp
new file mode 100644
index 0000000..1b26640
--- /dev/null
+++ b/common/JackActivationCount.cpp
@@ -0,0 +1,43 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackAtomic.h"
+#include "JackActivationCount.h"
+#include "JackConstants.h"
+#include "JackClientControl.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+bool JackActivationCount::Signal(JackSynchro* synchro, JackClientControl* control)
+{
+    if (fValue == 0) {
+        // Transfer activation to next clients
+        jack_error("JackActivationCount::Signal value = 0 ref = %ld", control->fRefNum);
+        return synchro->Signal();
+    } else if (DEC_ATOMIC(&fValue) == 1) {
+        return synchro->Signal();
+    } else {
+        return true;
+    }
+}
+
+} // end of namespace
+
diff --git a/common/JackActivationCount.h b/common/JackActivationCount.h
new file mode 100644
index 0000000..8a22bc6
--- /dev/null
+++ b/common/JackActivationCount.h
@@ -0,0 +1,81 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackActivationCount__
+#define __JackActivationCount__
+
+#include "JackPlatformPlug.h"
+#include "JackTime.h"
+#include "JackTypes.h"
+
+namespace Jack
+{
+
+struct JackClientControl;
+
+/*!
+\brief Client activation counter.
+*/
+
+class JackActivationCount
+{
+
+    private:
+
+        SInt32 fValue;
+        SInt32 fCount;
+
+    public:
+
+        JackActivationCount(): fValue(0), fCount(0)
+        {}
+
+        bool Signal(JackSynchro* synchro, JackClientControl* control);
+
+        inline void Reset()
+        {
+            fValue = fCount;
+        }
+
+        inline void SetValue(int val)
+        {
+            fCount = val;
+        }
+
+        inline void IncValue()
+        {
+            fCount++;
+        }
+
+        inline void DecValue()
+        {
+            fCount--;
+        }
+
+        inline int GetValue() const
+        {
+            return fValue;
+        }
+
+}  POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackArgParser.cpp b/common/JackArgParser.cpp
new file mode 100644
index 0000000..e9b8f6f
--- /dev/null
+++ b/common/JackArgParser.cpp
@@ -0,0 +1,235 @@
+/*
+  Copyright (C) 2006-2008 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackDriverLoader.h"
+#include "JackArgParser.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+using namespace std;
+
+namespace Jack {
+
+    // class JackArgParser ***************************************************
+    JackArgParser::JackArgParser ( const char* arg )
+    {
+        jack_log ( "JackArgParser::JackArgParser, arg_string : '%s'", arg );
+
+        fArgc = 0;
+        //if empty string
+        if ( strlen(arg) == 0 )
+            return;
+        fArgString = string(arg);
+        //else parse the arg string
+        const size_t arg_len = fArgString.length();
+        unsigned int i = 0;
+        size_t pos = 0;
+        size_t start = 0;
+        size_t copy_start = 0;
+        size_t copy_length = 0;
+        //we need a 'space terminated' string
+        fArgString += " ";
+        //first fill a vector with args
+        do {
+            //find the first non-space character from the actual position
+            start = fArgString.find_first_not_of ( ' ', start );
+            //get the next quote or space position
+            pos = fArgString.find_first_of ( " \"" , start );
+            //no more quotes or spaces, consider the end of the string
+            if ( pos == string::npos )
+                pos = arg_len;
+            //if double quote
+            if ( fArgString[pos] == '\"' ) {
+                //first character : copy the substring
+                if ( pos == start ) {
+                    copy_start = start + 1;
+                    pos = fArgString.find ( '\"', ++pos );
+                    copy_length = pos - copy_start;
+                    start = pos + 1;
+                }
+                //else there is someting before the quote, first copy that
+                else {
+                    copy_start = start;
+                    copy_length = pos - copy_start;
+                    start = pos;
+                }
+            }
+            //if space
+            if ( fArgString[pos] == ' ' ) {
+                //short option descriptor
+                if ( ( fArgString[start] == '-' ) && ( fArgString[start + 1] != '-' ) ) {
+                    copy_start = start;
+                    copy_length = 2;
+                    start += copy_length;
+                }
+                //else copy all the space delimitated string
+                else {
+                    copy_start = start;
+                    copy_length = pos - copy_start;
+                    start = pos + 1;
+				}
+            }
+            //then push the substring to the args vector
+            fArgv.push_back ( fArgString.substr ( copy_start, copy_length ) );
+            jack_log ( "JackArgParser::JackArgParser, add : '%s'", (*fArgv.rbegin()).c_str() );
+        } while ( start < arg_len );
+
+        //finally count the options
+        for ( i = 0; i < fArgv.size(); i++ )
+            if ( fArgv[i].at(0) == '-' )
+                fArgc++;
+    }
+
+    JackArgParser::~JackArgParser()
+    {}
+
+    string JackArgParser::GetArgString()
+    {
+        return fArgString;
+    }
+
+    int JackArgParser::GetNumArgv()
+    {
+        return fArgv.size();
+    }
+
+    int JackArgParser::GetArgc()
+    {
+        return fArgc;
+    }
+
+    int JackArgParser::GetArgv ( vector<string>& argv )
+    {
+        argv = fArgv;
+        return 0;
+    }
+
+    int JackArgParser::GetArgv ( char** argv )
+    {
+        //argv must be NULL
+        if ( argv )
+            return -1;
+        //else allocate and fill it
+        argv = (char**)calloc (fArgv.size(), sizeof(char*));
+        if (argv == NULL) 
+        {
+            return -1;
+        }
+        for ( unsigned int i = 0; i < fArgv.size(); i++ )
+        {
+            argv[i] = (char*)calloc(fArgv[i].length(), sizeof(char));
+            fill_n ( argv[i], fArgv[i].length() + 1, 0 );
+            fArgv[i].copy ( argv[i], fArgv[i].length() );
+        }
+        return 0;
+    }
+
+    void JackArgParser::DeleteArgv ( const char** argv )
+    {
+        unsigned int i;
+        for ( i = 0; i < fArgv.size(); i++ )
+            free((void*)argv[i]);
+        free((void*)argv);
+    }
+
+    bool JackArgParser::ParseParams ( jack_driver_desc_t* desc, JSList** param_list )
+    {
+        string options_list;
+        unsigned long i = 0;
+        unsigned int param = 0;
+        size_t param_id = 0;
+        JSList* params = NULL;
+        jack_driver_param_t* intclient_param;
+        
+        for ( i = 0; i < desc->nparams; i++ )
+            options_list += desc->params[i].character;
+
+        for ( param = 0; param < fArgv.size(); param++ )
+        {
+            if ( fArgv[param][0] == '-' )
+            {
+                //valid option
+                if ( ( param_id = options_list.find_first_of ( fArgv[param].at(1) ) ) != string::npos )
+                {
+                    intclient_param = static_cast<jack_driver_param_t*> ( calloc ( 1, sizeof ( jack_driver_param_t) ) );
+                    intclient_param->character = desc->params[param_id].character;
+                    
+                    switch ( desc->params[param_id].type )
+                    {
+                        case JackDriverParamInt:
+                            if (param + 1 < fArgv.size()) // something to parse
+                                intclient_param->value.i = atoi ( fArgv[param + 1].c_str() );
+                            break;
+                            
+                        case JackDriverParamUInt:
+                            if (param + 1 < fArgv.size()) // something to parse
+                                intclient_param->value.ui = strtoul ( fArgv[param + 1].c_str(), NULL, 10 );
+                            break;
+                            
+                        case JackDriverParamChar:
+                            if (param + 1 < fArgv.size()) // something to parse
+                                intclient_param->value.c = fArgv[param + 1][0];
+                            break;
+                            
+                        case JackDriverParamString:
+                            if (param + 1 < fArgv.size()) // something to parse
+                                fArgv[param + 1].copy ( intclient_param->value.str, min(static_cast<int>(fArgv[param + 1].length()), JACK_DRIVER_PARAM_STRING_MAX) );
+                            break;
+                            
+                        case JackDriverParamBool:
+                            intclient_param->value.i = true;
+                            break;
+                    }
+                    //add to the list
+                    params = jack_slist_append ( params, intclient_param );
+                }
+                //invalid option
+                else {
+                    if (fArgv[param][1] == 'h') {
+                        fprintf(stdout, "Internal client parameters:\n");
+                        jack_print_driver_options (desc, stdout);
+                        return false;
+                    } else {
+                        jack_error ( "Invalid option '%c'", fArgv[param][1] );
+                    }
+                }
+            }
+        }
+
+        assert(param_list);
+        *param_list = params;
+        return true;
+    }
+    
+    void JackArgParser::FreeParams ( JSList* param_list )
+    {
+        JSList *node_ptr = param_list;
+        JSList *next_node_ptr;
+    
+        while (node_ptr) {
+            next_node_ptr = node_ptr->next;
+            free(node_ptr->data);
+            free(node_ptr);
+            node_ptr = next_node_ptr;
+        }
+    }
+
+}
+
diff --git a/common/JackArgParser.h b/common/JackArgParser.h
new file mode 100644
index 0000000..2226eae
--- /dev/null
+++ b/common/JackArgParser.h
@@ -0,0 +1,61 @@
+/*
+  Copyright (C) 2006-2008 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackArgParser__
+#define __JackArgParser__
+
+#include "jslist.h"
+#include "driver_interface.h"
+#include "JackCompilerDeps.h"
+#include "JackError.h"
+
+#include <string>
+#include <algorithm>
+#include <vector>
+#include <iostream>
+#include <fstream>
+
+namespace Jack
+{
+
+    class SERVER_EXPORT JackArgParser
+    {
+        private:
+
+            std::string fArgString;
+            int fArgc;
+            std::vector<std::string> fArgv;
+
+        public:
+
+            JackArgParser ( const char* arg );
+            ~JackArgParser();
+            std::string GetArgString();
+            int GetNumArgv();
+            int GetArgc();
+            int GetArgv ( std::vector<std::string>& argv );
+            int GetArgv ( char** argv );
+            void DeleteArgv ( const char** argv );
+            bool ParseParams ( jack_driver_desc_t* desc, JSList** param_list );
+            void FreeParams ( JSList* param_list );
+    };
+
+}
+
+#endif
diff --git a/common/JackAtomic.h b/common/JackAtomic.h
new file mode 100644
index 0000000..481e17f
--- /dev/null
+++ b/common/JackAtomic.h
@@ -0,0 +1,46 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackAtomic__
+#define __JackAtomic__
+
+#include "JackTypes.h"
+#include "JackAtomic_os.h"
+
+static inline long INC_ATOMIC(volatile SInt32* val)
+{
+    SInt32 actual;
+    do {
+        actual = *val;
+    } while (!CAS(actual, actual + 1, val));
+    return actual;
+}
+
+static inline long DEC_ATOMIC(volatile SInt32* val)
+{
+    SInt32 actual;
+    do {
+        actual = *val;
+    } while (!CAS(actual, actual - 1, val));
+    return actual;
+}
+
+#endif
+
+
diff --git a/common/JackAtomicArrayState.h b/common/JackAtomicArrayState.h
new file mode 100644
index 0000000..8a0daf0
--- /dev/null
+++ b/common/JackAtomicArrayState.h
@@ -0,0 +1,257 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackAtomicArrayState__
+#define __JackAtomicArrayState__
+
+#include "JackAtomic.h"
+#include "JackCompilerDeps.h"
+#include <string.h> // for memcpy
+
+namespace Jack
+{
+
+/*!
+\brief Counter for CAS
+*/
+
+struct AtomicArrayCounter
+{
+    union {
+        struct {
+            unsigned char fByteVal[4];
+        }
+        scounter;
+        UInt32 fLongVal;
+    }info;
+    
+    AtomicArrayCounter()
+    {
+        info.fLongVal = 0;
+    }
+
+    AtomicArrayCounter(volatile const AtomicArrayCounter& obj) 
+    {
+        info.fLongVal = obj.info.fLongVal;
+    }
+
+    AtomicArrayCounter(volatile AtomicArrayCounter& obj) 
+    {
+        info.fLongVal = obj.info.fLongVal;
+    }
+
+    AtomicArrayCounter& operator=(volatile AtomicArrayCounter& obj)
+    {
+        info.fLongVal = obj.info.fLongVal;
+        return *this;
+    }
+	
+	AtomicArrayCounter& operator=(AtomicArrayCounter& obj)
+	{
+        info.fLongVal = obj.info.fLongVal;
+        return *this;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+#define Counter1(e) (e).info.fLongVal
+#define GetIndex1(e, state) ((e).info.scounter.fByteVal[state])
+#define SetIndex1(e, state, val) ((e).info.scounter.fByteVal[state] = val)
+#define IncIndex1(e, state) ((e).info.scounter.fByteVal[state]++)
+#define SwapIndex1(e, state) (((e).info.scounter.fByteVal[0] == state) ? 0 : state)
+
+/*!
+\brief A class to handle several states in a lock-free manner
+
+Requirement:
+
+	- a "current" state
+	- several possible "pending" state
+	- an TrySwitchState(int state) operation to atomically switch a "pending" to the "current" state (the pending becomes the current).
+
+	The TrySwitchState operation returns a "current" state (either the same if switch fails or the new one, one can know if the switch has succeeded)
+
+	- a WriteNextStartState(int state) returns a "pending" state to be written into
+	- a WriteNextStartStop(int state) make the written "pending" state become "switchable"
+
+	Different pending states can be written independantly and concurrently.
+
+	GetCurrentIndex() *must* return an increasing value to be able to check reading current state coherency
+
+	The fCounter is an array of indexes to access the current and 3 different "pending" states.
+
+	  WriteNextStateStart(int index) must return a valid state to be written into, and must invalidate state "index" ==> cur state switch.
+	  WriteNextStateStop(int index) makes the "index" state become "switchable" with the current state.
+	  TrySwitchState(int index) must detect that pending state is a new state, and does the switch
+	  ReadCurrentState() must return the state
+	  GetCurrentIndex() must return an index increased each new switch.
+	  WriteNextStateStart(int index1) and WriteNextStateStart(int index2) can be interleaved
+
+	[switch counter][index state][index state][cur index]
+
+*/
+
+// CHECK livelock
+
+template <class T>
+class JackAtomicArrayState
+{
+
+    protected:
+
+        // fState[0] ==> current
+        // fState[1] ==> pending
+        // fState[2] ==> request
+
+        T fState[3];
+        volatile AtomicArrayCounter fCounter;
+
+        UInt32 WriteNextStateStartAux(int state, bool* result)
+        {
+            AtomicArrayCounter old_val;
+            AtomicArrayCounter new_val;
+            UInt32 cur_index;
+            UInt32 next_index;
+            bool need_copy;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                *result = GetIndex1(new_val, state);
+                cur_index = GetIndex1(new_val, 0);
+                next_index = SwapIndex1(fCounter, state);
+                need_copy = (GetIndex1(new_val, state) == 0);	// Written = false, switch just occured
+                SetIndex1(new_val, state, 0);					// Written = false, invalidate state
+            } while (!CAS(Counter1(old_val), Counter1(new_val), (UInt32*)&fCounter));
+            if (need_copy)
+                memcpy(&fState[next_index], &fState[cur_index], sizeof(T));
+            return next_index;
+        }
+
+        void WriteNextStateStopAux(int state)
+        {
+            AtomicArrayCounter old_val;
+            AtomicArrayCounter new_val;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                SetIndex1(new_val, state, 1);  // Written = true, state becomes "switchable"
+            } while (!CAS(Counter1(old_val), Counter1(new_val), (UInt32*)&fCounter));
+        }
+
+    public:
+
+        JackAtomicArrayState()
+        {
+            Counter1(fCounter) = 0;
+        }
+
+        ~JackAtomicArrayState() // Not virtual ??
+        {}
+
+        /*!
+        \brief Returns the current state : only valid in the RT reader thread 
+        */
+
+        T* ReadCurrentState()
+        {
+            return &fState[GetIndex1(fCounter, 0)];
+        }
+
+        /*!
+        \brief Returns the current switch counter
+        */
+
+        UInt16 GetCurrentIndex()
+        {
+            return GetIndex1(fCounter, 3);
+        }
+
+        /*!
+        \brief Tries to switch to the next state and returns the new current state (either the same as before if case of switch failure or the new one)
+        */
+
+        T* TrySwitchState(int state)
+        {
+            AtomicArrayCounter old_val;
+            AtomicArrayCounter new_val;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                if (GetIndex1(new_val, state)) {						// If state has been written
+                    SetIndex1(new_val, 0, SwapIndex1(new_val, state));	// Prepare switch
+                    SetIndex1(new_val, state, 0);						// Invalidate the state "state"
+                    IncIndex1(new_val, 3);								// Inc switch
+                }
+            } while (!CAS(Counter1(old_val), Counter1(new_val), (UInt32*)&fCounter));
+            return &fState[GetIndex1(fCounter, 0)];	// Read the counter again
+        }
+
+        /*!
+        \brief Tries to switch to the next state and returns the new current state (either the same as before if case of switch failure or the new one)
+        */
+
+        T* TrySwitchState(int state, bool* result)
+        {
+            AtomicArrayCounter old_val;
+            AtomicArrayCounter new_val;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                if ((*result = GetIndex1(new_val, state))) {			// If state has been written
+                    SetIndex1(new_val, 0, SwapIndex1(new_val, state));	// Prepare switch
+                    SetIndex1(new_val, state, 0);						// Invalidate the state "state"
+                    IncIndex1(new_val, 3);								// Inc switch
+                }
+            } while (!CAS(Counter1(old_val), Counter1(new_val), (UInt32*)&fCounter));
+            return &fState[GetIndex1(fCounter, 0)];	// Read the counter again
+        }
+
+        /*!
+        \brief Start write operation : setup and returns the next state to update, check for recursive write calls.
+        */
+
+        T* WriteNextStateStart(int state)
+        {
+            bool tmp;
+            UInt32 index = WriteNextStateStartAux(state, &tmp);
+            return &fState[index];
+        }
+
+        T* WriteNextStateStart(int state, bool* result)
+        {
+            UInt32 index = WriteNextStateStartAux(state, result);
+            return &fState[index];
+        }
+
+        /*!
+        \brief Stop write operation : make the next state ready to be used by the RT thread
+        */
+        
+        void WriteNextStateStop(int state)
+        {
+            WriteNextStateStopAux(state);
+        }
+
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+
+#endif
+
diff --git a/common/JackAtomicState.h b/common/JackAtomicState.h
new file mode 100644
index 0000000..eaf164e
--- /dev/null
+++ b/common/JackAtomicState.h
@@ -0,0 +1,260 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackAtomicState__
+#define __JackAtomicState__
+
+#include "JackAtomic.h"
+#include "JackCompilerDeps.h"
+#include <string.h> // for memcpy
+
+namespace Jack
+{
+
+/*!
+\brief Counter for CAS
+*/
+
+struct AtomicCounter
+{
+    union {
+        struct {
+            UInt16 fShortVal1;	// Cur
+            UInt16 fShortVal2;	// Next
+        }
+        scounter;
+        UInt32 fLongVal;
+    }info;
+
+	AtomicCounter()
+	{
+        info.fLongVal = 0;
+    }
+
+	AtomicCounter(volatile const AtomicCounter& obj) 
+	{
+		info.fLongVal = obj.info.fLongVal;
+	}
+    
+	AtomicCounter(volatile AtomicCounter& obj) 
+	{
+		info.fLongVal = obj.info.fLongVal;
+	}
+
+ 	AtomicCounter& operator=(AtomicCounter& obj)
+    {
+        info.fLongVal = obj.info.fLongVal;
+        return *this;
+    }
+
+	AtomicCounter& operator=(volatile AtomicCounter& obj)
+	{
+        info.fLongVal = obj.info.fLongVal;
+        return *this;
+    }
+
+} POST_PACKED_STRUCTURE;
+
+#define Counter(e) (e).info.fLongVal
+#define CurIndex(e) (e).info.scounter.fShortVal1
+#define NextIndex(e) (e).info.scounter.fShortVal2
+
+#define CurArrayIndex(e) (CurIndex(e) & 0x0001)
+#define NextArrayIndex(e) ((CurIndex(e) + 1) & 0x0001)
+
+/*!
+\brief A class to handle two states (switching from one to the other) in a lock-free manner
+*/
+
+// CHECK livelock
+
+template <class T>
+class JackAtomicState
+{
+
+    protected:
+
+        T fState[2];
+        volatile AtomicCounter fCounter;
+        SInt32 fCallWriteCounter;
+
+        UInt32 WriteNextStateStartAux()
+        {
+            AtomicCounter old_val;
+            AtomicCounter new_val;
+            UInt32 cur_index;
+            UInt32 next_index;
+            bool need_copy;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                cur_index = CurArrayIndex(new_val);
+                next_index = NextArrayIndex(new_val);
+                need_copy = (CurIndex(new_val) == NextIndex(new_val));
+                NextIndex(new_val) = CurIndex(new_val); // Invalidate next index
+            } while (!CAS(Counter(old_val), Counter(new_val), (UInt32*)&fCounter));
+            if (need_copy)
+                memcpy(&fState[next_index], &fState[cur_index], sizeof(T));
+            return next_index;
+        }
+
+        void WriteNextStateStopAux()
+        {
+            AtomicCounter old_val;
+            AtomicCounter new_val;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                NextIndex(new_val)++; // Set next index
+            } while (!CAS(Counter(old_val), Counter(new_val), (UInt32*)&fCounter));
+        }
+
+    public:
+
+        JackAtomicState()
+        {
+            Counter(fCounter) = 0;
+            fCallWriteCounter = 0;
+        }
+
+        ~JackAtomicState() // Not virtual ??
+        {}
+
+        /*!
+        \brief Returns the current state : only valid in the RT reader thread 
+        */
+        T* ReadCurrentState()
+        {
+            return &fState[CurArrayIndex(fCounter)];
+        }
+
+        /*!
+        \brief Returns the current state index
+        */
+        UInt16 GetCurrentIndex()
+        {
+            return CurIndex(fCounter);
+        }
+
+        /*!
+        \brief Tries to switch to the next state and returns the new current state (either the same as before if case of switch failure or the new one)
+        */
+        T* TrySwitchState()
+        {
+            AtomicCounter old_val;
+            AtomicCounter new_val;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                CurIndex(new_val) = NextIndex(new_val);	// Prepare switch
+            } while (!CAS(Counter(old_val), Counter(new_val), (UInt32*)&fCounter));
+            return &fState[CurArrayIndex(fCounter)];	// Read the counter again
+        }
+
+        /*!
+        \brief Tries to switch to the next state and returns the new current state (either the same as before if case of switch failure or the new one)
+        */
+        T* TrySwitchState(bool* result)
+        {
+            AtomicCounter old_val;
+            AtomicCounter new_val;
+            do {
+                old_val = fCounter;
+                new_val = old_val;
+                *result = (CurIndex(new_val) != NextIndex(new_val));
+                CurIndex(new_val) = NextIndex(new_val);  // Prepare switch
+            } while (!CAS(Counter(old_val), Counter(new_val), (UInt32*)&fCounter));
+            return &fState[CurArrayIndex(fCounter)];	// Read the counter again
+        }
+
+        /*!
+        \brief Start write operation : setup and returns the next state to update, check for recursive write calls.
+        */
+        T* WriteNextStateStart()
+        {
+            UInt32 next_index = (fCallWriteCounter++ == 0)
+                                ? WriteNextStateStartAux()
+                                : NextArrayIndex(fCounter); // We are inside a wrapping WriteNextStateStart call, NextArrayIndex can be read safely
+            return &fState[next_index];
+        }
+
+        /*!
+        \brief Stop write operation : make the next state ready to be used by the RT thread
+        */
+        void WriteNextStateStop()
+        {
+            if (--fCallWriteCounter == 0)
+                WriteNextStateStopAux();
+        }
+
+        bool IsPendingChange()
+        {
+            return CurIndex(fCounter) != NextIndex(fCounter);
+        }
+
+        /*
+              // Single writer : write methods get the *next* state to be updated
+        void TestWriteMethod() 
+        {
+        	T* state = WriteNextStateStart();
+        	......
+        	......
+        	WriteNextStateStop(); 
+        }
+
+              // First RT call possibly switch state
+        void TestReadRTMethod1() 
+        {
+        	T* state = TrySwitchState();
+        	......
+        	......
+        }
+
+              // Other RT methods can safely use the current state during the *same* RT cycle
+        void TestReadRTMethod2() 
+        {
+        	T* state = ReadCurrentState();
+        	......
+        	......
+        }
+              
+              // Non RT read methods : must check state coherency
+        void TestReadMethod() 
+        {
+        	T* state;
+        	UInt16 cur_index;
+            UInt16 next_index = GetCurrentIndex();
+        	do {
+                cur_index = next_index; 
+        		state = ReadCurrentState();
+        		
+        		......
+        		......
+                
+                next_index = GetCurrentIndex();
+        	} while (cur_index != next_index);
+        }
+        */
+        
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackAudioAdapter.cpp b/common/JackAudioAdapter.cpp
new file mode 100644
index 0000000..03f4605
--- /dev/null
+++ b/common/JackAudioAdapter.cpp
@@ -0,0 +1,189 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackAudioAdapter.h"
+#include "JackError.h"
+#include "JackCompilerDeps.h"
+#include "JackTools.h"
+#include "JackTime.h"
+#include "jslist.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+//static methods ***********************************************************
+    int JackAudioAdapter::Process (jack_nframes_t frames, void* arg)
+    {
+        JackAudioAdapter* adapter = static_cast<JackAudioAdapter*>(arg);
+        float* inputBuffer[adapter->fAudioAdapter->GetInputs()];
+        float* outputBuffer[adapter->fAudioAdapter->GetOutputs()];
+
+        // Always clear output
+        for (int i = 0; i < adapter->fAudioAdapter->GetInputs(); i++) {
+            inputBuffer[i] = (float*)jack_port_get_buffer(adapter->fCapturePortList[i], frames);
+            memset(inputBuffer[i], 0, frames * sizeof(float));
+        }
+
+        for (int i = 0; i < adapter->fAudioAdapter->GetOutputs(); i++) {
+            outputBuffer[i] = (float*)jack_port_get_buffer(adapter->fPlaybackPortList[i], frames);
+        }
+
+        adapter->fAudioAdapter->PullAndPush(inputBuffer, outputBuffer, frames);
+      	return 0;
+    }
+
+    int JackAudioAdapter::BufferSize ( jack_nframes_t buffer_size, void* arg )
+    {
+        JackAudioAdapter* adapter = static_cast<JackAudioAdapter*> ( arg );
+        adapter->Reset();
+        adapter->fAudioAdapter->SetHostBufferSize ( buffer_size );
+        return 0;
+    }
+
+    int JackAudioAdapter::SampleRate ( jack_nframes_t sample_rate, void* arg )
+    {
+        JackAudioAdapter* adapter = static_cast<JackAudioAdapter*> ( arg );
+        adapter->Reset();
+        adapter->fAudioAdapter->SetHostSampleRate ( sample_rate );
+        return 0;
+    }
+
+//JackAudioAdapter *********************************************************
+
+     JackAudioAdapter::JackAudioAdapter (jack_client_t* jack_client, JackAudioAdapterInterface* audio_io, const JSList* params, bool system)
+        :fJackClient(jack_client), fAudioAdapter(audio_io)
+    {
+        const JSList* node;
+        const jack_driver_param_t* param;
+        fAutoConnect = false;
+
+        for (node = params; node; node = jack_slist_next(node)) {
+            param = (const jack_driver_param_t*) node->data;
+            switch (param->character) {
+                case 'c':
+                    fAutoConnect = true;
+                    break;
+            }
+        }
+    }
+
+    JackAudioAdapter::~JackAudioAdapter()
+    {
+        // When called, Close has already been used for the client, thus ports are already unregistered.
+        delete fAudioAdapter;
+    }
+
+    void JackAudioAdapter::FreePorts()
+    {
+        for (int i = 0; i < fAudioAdapter->GetInputs(); i++ )
+            if ( fCapturePortList[i] )
+                jack_port_unregister ( fJackClient, fCapturePortList[i] );
+        for (int i = 0; i < fAudioAdapter->GetOutputs(); i++ )
+            if ( fPlaybackPortList[i] )
+                jack_port_unregister ( fJackClient, fPlaybackPortList[i] );
+
+        delete[] fCapturePortList;
+        delete[] fPlaybackPortList;
+    }
+
+    void JackAudioAdapter::ConnectPorts()
+    {
+        const char **ports;
+
+        ports = jack_get_ports(fJackClient, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
+        if (ports != NULL) {
+            for (int i = 0; i < fAudioAdapter->GetInputs() && ports[i]; i++) {
+                jack_connect(fJackClient,jack_port_name(fCapturePortList[i]),  ports[i]);
+            }
+            free(ports);
+        }
+
+        ports = jack_get_ports(fJackClient, NULL, NULL, JackPortIsPhysical | JackPortIsOutput);
+        if (ports != NULL) {
+            for (int i = 0; i < fAudioAdapter->GetOutputs() && ports[i]; i++) {
+                jack_connect(fJackClient, ports[i], jack_port_name(fPlaybackPortList[i]));
+            }
+            free(ports);
+        }
+    }
+
+    void JackAudioAdapter::Reset()
+    {
+        fAudioAdapter->Reset();
+    }
+
+    int JackAudioAdapter::Open()
+    {
+        char name[32];
+        jack_log("JackAudioAdapter::Open fCaptureChannels %d fPlaybackChannels %d", fAudioAdapter->GetInputs(), fAudioAdapter->GetOutputs());
+        fAudioAdapter->Create();
+
+        //jack ports
+        fCapturePortList = new jack_port_t*[fAudioAdapter->GetInputs()];
+        fPlaybackPortList = new jack_port_t*[fAudioAdapter->GetOutputs()];
+
+        for (int i = 0; i < fAudioAdapter->GetInputs(); i++)
+        {
+            sprintf(name, "capture_%d", i + 1);
+            if ((fCapturePortList[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == NULL)
+                goto fail;
+        }
+
+        for (int i = 0; i < fAudioAdapter->GetOutputs(); i++)
+        {
+            sprintf(name, "playback_%d", i + 1);
+            if ((fPlaybackPortList[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0 )) == NULL)
+                goto fail;
+        }
+
+        //callbacks and activation
+        if ( jack_set_process_callback ( fJackClient, Process, this ) < 0 )
+            goto fail;
+        if ( jack_set_buffer_size_callback ( fJackClient, BufferSize, this ) < 0 )
+            goto fail;
+        if ( jack_set_sample_rate_callback ( fJackClient, SampleRate, this ) < 0 )
+            goto fail;
+        if ( jack_activate ( fJackClient ) < 0 )
+            goto fail;
+
+        if (fAutoConnect)
+            ConnectPorts();
+
+        // Ring buffer are now allocated..
+        return fAudioAdapter->Open();
+
+    fail:
+        FreePorts();
+        fAudioAdapter->Destroy();
+        return -1;
+    }
+
+    int JackAudioAdapter::Close()
+    {
+        fAudioAdapter->Close();
+        fAudioAdapter->Destroy();
+        return 0;
+    }
+
+} //namespace
diff --git a/common/JackAudioAdapter.h b/common/JackAudioAdapter.h
new file mode 100644
index 0000000..0eb93ee
--- /dev/null
+++ b/common/JackAudioAdapter.h
@@ -0,0 +1,63 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackAudioAdapter__
+#define __JackAudioAdapter__
+
+#include "JackAudioAdapterInterface.h"
+#include "driver_interface.h"
+
+namespace Jack
+{
+
+    /*!
+    \brief Audio adapter : Jack client side.
+    */
+
+    class JackAudioAdapter
+    {
+        private:
+
+            static int Process ( jack_nframes_t, void* arg );
+            static int BufferSize ( jack_nframes_t buffer_size, void *arg );
+            static int SampleRate ( jack_nframes_t sample_rate, void *arg );
+
+            jack_port_t** fCapturePortList;
+            jack_port_t** fPlaybackPortList;
+
+            jack_client_t* fJackClient;
+            JackAudioAdapterInterface* fAudioAdapter;
+            bool fAutoConnect;
+
+            void FreePorts();
+            void ConnectPorts();
+            void Reset();
+
+        public:
+
+            JackAudioAdapter(jack_client_t* jack_client, JackAudioAdapterInterface* audio_io, const JSList* params = NULL, bool system = false);
+            ~JackAudioAdapter();
+
+            int Open();
+            int Close();
+    };
+
+}
+
+#endif
diff --git a/common/JackAudioAdapterFactory.cpp b/common/JackAudioAdapterFactory.cpp
new file mode 100644
index 0000000..1426685
--- /dev/null
+++ b/common/JackAudioAdapterFactory.cpp
@@ -0,0 +1,121 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackAudioAdapter.h"
+#include "JackArgParser.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#ifdef __linux__
+#include "JackAlsaAdapter.h"
+#endif
+
+#ifdef __APPLE__
+#include "JackCoreAudioAdapter.h"
+#endif
+
+#ifdef WIN32
+#include "JackPortAudioAdapter.h"
+#endif
+
+#if defined(__sun__) || defined(sun)
+#include "JackOSSAdapter.h"
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    using namespace Jack;
+
+    SERVER_EXPORT int jack_internal_initialize(jack_client_t* jack_client, const JSList* params)
+    {
+        jack_log("Loading audioadapter");
+
+        Jack::JackAudioAdapter* adapter;
+        jack_nframes_t buffer_size = jack_get_buffer_size(jack_client);
+        jack_nframes_t sample_rate = jack_get_sample_rate(jack_client);
+        
+        try {
+
+    #ifdef __linux__
+            adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackAlsaAdapter(buffer_size, sample_rate, params));
+    #endif
+
+    #ifdef WIN32
+            adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackPortAudioAdapter(buffer_size, sample_rate, params));
+    #endif
+
+    #ifdef __APPLE__
+            adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackCoreAudioAdapter(buffer_size, sample_rate, params));
+    #endif
+
+    #if defined(__sun__) || defined(sun)
+            adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackOSSAdapter(buffer_size, sample_rate, params));
+    #endif
+   
+           assert(adapter);
+           
+            if (adapter->Open() == 0)
+                return 0;
+            else
+            {
+                delete adapter;
+                return 1;
+            }
+         
+        } catch (...) {
+            return 1;
+        }
+    }
+
+    SERVER_EXPORT int jack_initialize(jack_client_t* jack_client, const char* load_init)
+    {
+        JSList* params = NULL;
+        bool parse_params = true;
+        int res = 1;
+        jack_driver_desc_t* desc = jack_get_descriptor();
+
+        Jack::JackArgParser parser ( load_init );
+        if ( parser.GetArgc() > 0 )
+            parse_params = parser.ParseParams ( desc, &params );
+
+        if (parse_params) {
+            res = jack_internal_initialize ( jack_client, params );
+            parser.FreeParams ( params );
+        }
+        return res;
+    }
+
+    SERVER_EXPORT void jack_finish(void* arg)
+    {
+        Jack::JackAudioAdapter* adapter = static_cast<Jack::JackAudioAdapter*>(arg);
+
+        if (adapter) {
+            jack_log("Unloading audioadapter");
+            adapter->Close();
+            delete adapter;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/common/JackAudioAdapterInterface.cpp b/common/JackAudioAdapterInterface.cpp
new file mode 100644
index 0000000..738363b
--- /dev/null
+++ b/common/JackAudioAdapterInterface.cpp
@@ -0,0 +1,301 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackAudioAdapter.h"
+#include "JackLibSampleRateResampler.h"
+#include "JackTime.h"  
+#include <stdio.h>
+
+namespace Jack
+{
+
+#ifdef JACK_MONITOR
+
+    void MeasureTable::Write(int time1, int time2, float r1, float r2, int pos1, int pos2)
+    {
+        int pos = (++fCount) % TABLE_MAX;
+        fTable[pos].time1 = time1;
+        fTable[pos].time2 = time2;
+        fTable[pos].r1 = r1;
+        fTable[pos].r2 = r2;
+        fTable[pos].pos1 = pos1;
+        fTable[pos].pos2 = pos2;
+    }
+
+    void MeasureTable::Save(unsigned int fHostBufferSize, unsigned int fHostSampleRate, unsigned int fAdaptedSampleRate, unsigned int fAdaptedBufferSize)
+    {
+        char buffer[1024];
+        FILE* file = fopen("JackAudioAdapter.log", "w");
+
+        int max = (fCount) % TABLE_MAX - 1;
+        for (int i = 1; i < max; i++)
+        {
+            fprintf(file, "%d \t %d \t %d  \t %f \t %f \t %d \t %d \n",
+                    fTable[i].delta, fTable[i].time1, fTable[i].time2,
+                    fTable[i].r1, fTable[i].r2, fTable[i].pos1, fTable[i].pos2);
+        }
+        fclose(file);
+
+        // No used for now
+        // Adapter timing 1
+        file = fopen("AdapterTiming1.plot", "w");
+        fprintf(file, "set multiplot\n");
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
+            ,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"frames\"\n");
+        fprintf(file, "plot ");
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 2 title \"Ringbuffer error\" with lines,");
+        fprintf(file, buffer);
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 3 title \"Ringbuffer error with timing correction\" with lines");
+        fprintf(file, buffer);
+        
+        fprintf(file, "\n unset multiplot\n");  
+        fprintf(file, "set output 'AdapterTiming1.svg\n");
+        fprintf(file, "set terminal svg\n");
+        
+        fprintf(file, "set multiplot\n");
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
+            ,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"frames\"\n");
+        fprintf(file, "plot ");
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 2 title \"Consumer interrupt period\" with lines,");
+        fprintf(file, buffer);
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 3 title \"Producer interrupt period\" with lines\n");
+        fprintf(file, buffer);
+        fprintf(file, "unset multiplot\n");
+        fprintf(file, "unset output\n");
+        
+        fclose(file);
+   
+        // Adapter timing 2
+        file = fopen("AdapterTiming2.plot", "w");
+        fprintf(file, "set multiplot\n");
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
+            ,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"resampling ratio\"\n");
+        fprintf(file, "plot ");
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 4 title \"Ratio 1\" with lines,");
+        fprintf(file, buffer);
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 5 title \"Ratio 2\" with lines");
+        fprintf(file, buffer);
+        
+        fprintf(file, "\n unset multiplot\n");  
+        fprintf(file, "set output 'AdapterTiming2.svg\n");
+        fprintf(file, "set terminal svg\n");
+        
+        fprintf(file, "set multiplot\n");
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
+            ,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"resampling ratio\"\n");
+        fprintf(file, "plot ");
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 4 title \"Ratio 1\" with lines,");
+        fprintf(file, buffer);
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 5 title \"Ratio 2\" with lines\n");
+        fprintf(file, buffer);
+        fprintf(file, "unset multiplot\n");
+        fprintf(file, "unset output\n");
+        
+        fclose(file);
+
+        // Adapter timing 3
+        file = fopen("AdapterTiming3.plot", "w");
+        fprintf(file, "set multiplot\n");
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
+            ,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
+         fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"frames\"\n");
+        fprintf(file, "plot ");
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 6 title \"Frames position in consumer ringbuffer\" with lines,");
+        fprintf(file, buffer);
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 7 title \"Frames position in producer ringbuffer\" with lines");
+        fprintf(file, buffer);
+        
+        fprintf(file, "\n unset multiplot\n");  
+        fprintf(file, "set output 'AdapterTiming3.svg\n");
+        fprintf(file, "set terminal svg\n");
+        
+        fprintf(file, "set multiplot\n");
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
+            ,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"frames\"\n");
+        fprintf(file, "plot ");
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 6 title \"Frames position in consumer ringbuffer\" with lines,");
+        fprintf(file, buffer);
+        sprintf(buffer, "\"JackAudioAdapter.log\" using 7 title \"Frames position in producer ringbuffer\" with lines\n");
+        fprintf(file, buffer);
+        fprintf(file, "unset multiplot\n");
+        fprintf(file, "unset output\n");
+        
+        fclose(file);
+    }
+
+#endif
+
+    void JackAudioAdapterInterface::GrowRingBufferSize()
+    {
+        fRingbufferCurSize *= 2;
+    }
+    
+    void JackAudioAdapterInterface::AdaptRingBufferSize()
+    {
+        if (fHostBufferSize > fAdaptedBufferSize)
+            fRingbufferCurSize = 4 * fHostBufferSize;
+        else 
+            fRingbufferCurSize = 4 * fAdaptedBufferSize;
+    }
+        
+    void JackAudioAdapterInterface::ResetRingBuffers()
+    {
+        if (fRingbufferCurSize > DEFAULT_RB_SIZE) 
+            fRingbufferCurSize = DEFAULT_RB_SIZE;
+        
+        for (int i = 0; i < fCaptureChannels; i++)
+            fCaptureRingBuffer[i]->Reset(fRingbufferCurSize);
+        for (int i = 0; i < fPlaybackChannels; i++)
+            fPlaybackRingBuffer[i]->Reset(fRingbufferCurSize);
+    }
+    
+    void JackAudioAdapterInterface::Reset()
+    {
+        ResetRingBuffers();
+        fRunning = false;
+    }
+
+    void JackAudioAdapterInterface::Create()
+    {
+        //ringbuffers
+        fCaptureRingBuffer = new JackResampler*[fCaptureChannels];
+        fPlaybackRingBuffer = new JackResampler*[fPlaybackChannels];
+        
+        if (fAdaptative) {
+            AdaptRingBufferSize();
+            jack_info("Ringbuffer automatic adaptative mode size = %d frames", fRingbufferCurSize);
+        } else {
+            if (fRingbufferCurSize > DEFAULT_RB_SIZE) 
+                fRingbufferCurSize = DEFAULT_RB_SIZE;
+            jack_info("Fixed ringbuffer size = %d frames", fRingbufferCurSize);
+        }
+        
+        for (int i = 0; i < fCaptureChannels; i++ ) {
+            fCaptureRingBuffer[i] = new JackLibSampleRateResampler(fQuality);
+            fCaptureRingBuffer[i]->Reset(fRingbufferCurSize);
+        }
+        for (int i = 0; i < fPlaybackChannels; i++ ) {
+            fPlaybackRingBuffer[i] = new JackLibSampleRateResampler(fQuality);
+            fPlaybackRingBuffer[i]->Reset(fRingbufferCurSize);
+        }
+     
+        if (fCaptureChannels > 0)
+            jack_log("ReadSpace = %ld", fCaptureRingBuffer[0]->ReadSpace());
+        if (fPlaybackChannels > 0)
+            jack_log("WriteSpace = %ld", fPlaybackRingBuffer[0]->WriteSpace());
+    }
+
+    void JackAudioAdapterInterface::Destroy()
+    {
+        for (int i = 0; i < fCaptureChannels; i++ )
+            delete ( fCaptureRingBuffer[i] );
+        for (int i = 0; i < fPlaybackChannels; i++ )
+            delete ( fPlaybackRingBuffer[i] );
+
+        delete[] fCaptureRingBuffer;
+        delete[] fPlaybackRingBuffer;
+    }
+    
+    int JackAudioAdapterInterface::PushAndPull(float** inputBuffer, float** outputBuffer, unsigned int frames)
+    {
+        bool failure = false;
+        fRunning = true;
+   
+        // Finer estimation of the position in the ringbuffer
+        int delta_frames = (fPullAndPushTime > 0) ? (int)((float(long(GetMicroSeconds() - fPullAndPushTime)) * float(fAdaptedSampleRate)) / 1000000.f) : 0;
+        
+        double ratio = 1;
+        
+        // TODO : done like this just to avoid crash when input only or output only...
+        if (fCaptureChannels > 0)
+            ratio = fPIControler.GetRatio(fCaptureRingBuffer[0]->GetError() - delta_frames);
+        else if (fPlaybackChannels > 0)
+            ratio = fPIControler.GetRatio(fPlaybackRingBuffer[0]->GetError() - delta_frames);
+        
+    #ifdef JACK_MONITOR
+        if (fCaptureRingBuffer[0] != NULL)
+            fTable.Write(fCaptureRingBuffer[0]->GetError(), fCaptureRingBuffer[0]->GetError() - delta_frames, ratio, 1/ratio, fCaptureRingBuffer[0]->ReadSpace(), fCaptureRingBuffer[0]->ReadSpace());
+    #endif
+    
+        // Push/pull from ringbuffer
+        for (int i = 0; i < fCaptureChannels; i++) {
+            fCaptureRingBuffer[i]->SetRatio(ratio);
+            if (fCaptureRingBuffer[i]->WriteResample(inputBuffer[i], frames) < frames)
+                failure = true;
+        }
+
+        for (int i = 0; i < fPlaybackChannels; i++) {
+            fPlaybackRingBuffer[i]->SetRatio(1/ratio);
+            if (fPlaybackRingBuffer[i]->ReadResample(outputBuffer[i], frames) < frames)
+                 failure = true;
+        }
+        // Reset all ringbuffers in case of failure
+        if (failure) {
+            jack_error("JackAudioAdapterInterface::PushAndPull ringbuffer failure... reset");
+            if (fAdaptative) {
+                GrowRingBufferSize();
+                jack_info("Ringbuffer size = %d frames", fRingbufferCurSize);
+            }
+            ResetRingBuffers();
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+
+    int JackAudioAdapterInterface::PullAndPush(float** inputBuffer, float** outputBuffer, unsigned int frames) 
+    {
+        fPullAndPushTime = GetMicroSeconds();
+        if (!fRunning)
+            return 0;
+
+        int res = 0;
+    
+        // Push/pull from ringbuffer
+        for (int i = 0; i < fCaptureChannels; i++) {
+            if (fCaptureRingBuffer[i]->Read(inputBuffer[i], frames) < frames)
+                res = -1;
+        }
+
+        for (int i = 0; i < fPlaybackChannels; i++) {
+            if (fPlaybackRingBuffer[i]->Write(outputBuffer[i], frames) < frames)
+                res = -1;
+        }
+        
+        return res;
+    }
+ 
+} // namespace
diff --git a/common/JackAudioAdapterInterface.h b/common/JackAudioAdapterInterface.h
new file mode 100644
index 0000000..298b607
--- /dev/null
+++ b/common/JackAudioAdapterInterface.h
@@ -0,0 +1,214 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackAudioAdapterInterface__
+#define __JackAudioAdapterInterface__
+
+#include "JackResampler.h"
+#include "JackFilters.h"
+#include "JackConstants.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+#ifdef JACK_MONITOR
+
+#define TABLE_MAX 100000
+
+    struct Measure
+    {
+        int delta;
+        int time1;
+        int time2;
+        float r1;
+        float r2;
+        int pos1;
+        int pos2;
+    };
+
+    struct MeasureTable
+    {
+
+        Measure fTable[TABLE_MAX];
+        int fCount;
+
+        MeasureTable() :fCount ( 0 )
+        {}
+
+        void Write(int time1, int time2, float r1, float r2, int pos1, int pos2);
+        void Save(unsigned int fHostBufferSize, unsigned int fHostSampleRate, unsigned int fAdaptedSampleRate, unsigned int fAdaptedBufferSize);
+
+    };
+
+#endif
+
+    /*!
+    \brief Base class for audio adapters.
+    */
+
+    class JackAudioAdapterInterface
+    {
+
+    protected:
+
+#ifdef JACK_MONITOR
+        MeasureTable fTable;
+#endif
+        //channels
+        int fCaptureChannels;
+        int fPlaybackChannels;
+
+        //host parameters
+        jack_nframes_t fHostBufferSize;
+        jack_nframes_t fHostSampleRate;
+
+        //adapted parameters
+        jack_nframes_t fAdaptedBufferSize;
+        jack_nframes_t fAdaptedSampleRate;
+
+        //PI controler
+        JackPIControler fPIControler;
+
+        JackResampler** fCaptureRingBuffer;
+        JackResampler** fPlaybackRingBuffer;
+        
+        unsigned int fQuality;
+        unsigned int fRingbufferCurSize;
+        jack_time_t fPullAndPushTime;
+  
+        bool fRunning;
+        bool fAdaptative;
+        
+        void ResetRingBuffers();
+        void AdaptRingBufferSize();
+        void GrowRingBufferSize();
+        
+    public:
+
+         JackAudioAdapterInterface ( jack_nframes_t buffer_size, jack_nframes_t sample_rate ):
+            fCaptureChannels ( 0 ),
+            fPlaybackChannels ( 0 ),
+            fHostBufferSize ( buffer_size ),
+            fHostSampleRate ( sample_rate ),
+            fAdaptedBufferSize ( buffer_size),
+            fAdaptedSampleRate ( sample_rate ),
+            fPIControler(sample_rate / sample_rate, 256),
+            fCaptureRingBuffer(NULL), fPlaybackRingBuffer(NULL),
+            fQuality(0),
+            fRingbufferCurSize(DEFAULT_ADAPTATIVE_SIZE),
+            fPullAndPushTime(0),
+            fRunning(false),
+            fAdaptative(true)
+        {}
+
+        virtual ~JackAudioAdapterInterface()
+        {}
+
+        virtual void Reset();
+       
+        void Create();
+        void Destroy();
+        
+        virtual int Open()
+        {
+            return 0;
+        }
+        
+        virtual int Close()
+        {
+            return 0;
+        }
+
+        virtual int SetHostBufferSize ( jack_nframes_t buffer_size )
+        {
+            fHostBufferSize = buffer_size;
+            if (fAdaptative) 
+                AdaptRingBufferSize();
+            return 0;
+        }
+
+        virtual int SetAdaptedBufferSize ( jack_nframes_t buffer_size )
+        {
+            fAdaptedBufferSize = buffer_size;
+            if (fAdaptative) 
+                AdaptRingBufferSize();
+            return 0;
+        }
+
+        virtual int SetBufferSize ( jack_nframes_t buffer_size )
+        {
+            SetHostBufferSize ( buffer_size );
+            SetAdaptedBufferSize ( buffer_size );
+            return 0;
+        }
+
+        virtual int SetHostSampleRate ( jack_nframes_t sample_rate )
+        {
+            fHostSampleRate = sample_rate;
+            fPIControler.Init(double(fHostSampleRate) / double(fAdaptedSampleRate));
+            return 0;
+        }
+
+        virtual int SetAdaptedSampleRate ( jack_nframes_t sample_rate )
+        {
+            fAdaptedSampleRate = sample_rate;
+            fPIControler.Init(double(fHostSampleRate) / double(fAdaptedSampleRate));
+            return 0;
+        }
+
+        virtual int SetSampleRate ( jack_nframes_t sample_rate )
+        {
+            SetHostSampleRate ( sample_rate );
+            SetAdaptedSampleRate ( sample_rate );
+            return 0;
+        }
+      
+        void SetInputs ( int inputs )
+        {
+            jack_log ( "JackAudioAdapterInterface::SetInputs %d", inputs );
+            fCaptureChannels = inputs;
+        }
+
+        void SetOutputs ( int outputs )
+        {
+            jack_log ( "JackAudioAdapterInterface::SetOutputs %d", outputs );
+            fPlaybackChannels = outputs;
+        }
+
+        int GetInputs()
+        {
+            jack_log ( "JackAudioAdapterInterface::GetInputs %d", fCaptureChannels );
+            return fCaptureChannels;
+        }
+
+        int GetOutputs()
+        {
+            jack_log ( "JackAudioAdapterInterface::GetOutputs %d", fPlaybackChannels );
+            return fPlaybackChannels;
+        }
+        
+        int PushAndPull(float** inputBuffer, float** outputBuffer, unsigned int inNumberFrames);
+        int PullAndPush(float** inputBuffer, float** outputBuffer, unsigned int inNumberFrames);
+  
+    };
+
+}
+
+#endif
diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp
new file mode 100644
index 0000000..dc53077
--- /dev/null
+++ b/common/JackAudioDriver.cpp
@@ -0,0 +1,319 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+(at your option) any later version.
+
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackAudioDriver.h"
+#include "JackTime.h"
+#include "JackError.h"
+#include "JackEngineControl.h"
+#include "JackPort.h"
+#include "JackGraphManager.h"
+#include "JackLockedEngine.h"
+#include "JackException.h"
+#include <assert.h>
+
+namespace Jack
+{
+
+JackAudioDriver::JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+        : JackDriver(name, alias, engine, table),
+        fCaptureChannels(0),
+        fPlaybackChannels(0),
+        fWithMonitorPorts(false)
+{}
+
+JackAudioDriver::~JackAudioDriver()
+{}
+
+int JackAudioDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    fEngineControl->fBufferSize = buffer_size;
+    fGraphManager->SetBufferSize(buffer_size);
+    fEngineControl->fPeriodUsecs = jack_time_t(1000000.f / fEngineControl->fSampleRate * fEngineControl->fBufferSize);	// in microsec
+    if (!fEngineControl->fTimeOut)
+        fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs);
+    return 0;
+}
+
+int JackAudioDriver::SetSampleRate(jack_nframes_t sample_rate)
+{
+    fEngineControl->fSampleRate = sample_rate;
+    fEngineControl->fPeriodUsecs = jack_time_t(1000000.f / fEngineControl->fSampleRate * fEngineControl->fBufferSize);	// in microsec
+    if (!fEngineControl->fTimeOut)
+        fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs);
+    return 0;
+}
+
+int JackAudioDriver::Open(jack_nframes_t buffer_size,
+                          jack_nframes_t samplerate,
+                          bool capturing,
+                          bool playing,
+                          int inchannels,
+                          int outchannels,
+                          bool monitor,
+                          const char* capture_driver_name,
+                          const char* playback_driver_name,
+                          jack_nframes_t capture_latency,
+                          jack_nframes_t playback_latency)
+{
+    fCaptureChannels = inchannels;
+    fPlaybackChannels = outchannels;
+    fWithMonitorPorts = monitor;
+    return JackDriver::Open(buffer_size, samplerate, capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency);
+}
+
+int JackAudioDriver::Open(bool capturing,
+                          bool playing,
+                          int inchannels,
+                          int outchannels,
+                          bool monitor,
+                          const char* capture_driver_name,
+                          const char* playback_driver_name,
+                          jack_nframes_t capture_latency,
+                          jack_nframes_t playback_latency)
+{
+    fCaptureChannels = inchannels;
+    fPlaybackChannels = outchannels;
+    fWithMonitorPorts = monitor;
+    return JackDriver::Open(capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency);
+}
+
+int JackAudioDriver::Attach()
+{
+    JackPort* port;
+    jack_port_id_t port_index;
+    char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    int i;
+
+    jack_log("JackAudioDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    for (i = 0; i < fCaptureChannels; i++) {
+        snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
+        snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        port->SetLatency(fEngineControl->fBufferSize + fCaptureLatency);
+        fCapturePortList[i] = port_index;
+        jack_log("JackAudioDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
+    }
+
+    for (i = 0; i < fPlaybackChannels; i++) {
+        snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
+        snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        // Add more latency if "async" mode is used...
+        port->SetLatency(fEngineControl->fBufferSize + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + fPlaybackLatency);
+        fPlaybackPortList[i] = port_index;
+        jack_log("JackAudioDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
+
+        // Monitor ports
+        if (fWithMonitorPorts) {
+            jack_log("Create monitor port ");
+            snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("Cannot register monitor port for %s", name);
+                return -1;
+            } else {
+                port = fGraphManager->GetPort(port_index);
+                port->SetAlias(alias);
+                port->SetLatency(fEngineControl->fBufferSize);
+                fMonitorPortList[i] = port_index;
+            }
+        }
+    }
+
+    return 0;
+}
+
+int JackAudioDriver::Detach()
+{
+    int i;
+    jack_log("JackAudioDriver::Detach");
+
+    for (i = 0; i < fCaptureChannels; i++) {
+        fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
+    }
+
+    for (i = 0; i < fPlaybackChannels; i++) {
+        fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
+        if (fWithMonitorPorts)
+            fGraphManager->ReleasePort(fClientControl.fRefNum, fMonitorPortList[i]);
+    }
+
+    return 0;
+}
+
+int JackAudioDriver::Write()
+{
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        if (fGraphManager->GetConnectionsNum(fPlaybackPortList[i]) > 0) {
+            float* buffer = GetOutputBuffer(i);
+            int size = sizeof(float) * fEngineControl->fBufferSize;
+            // Monitor ports
+            if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0)
+                memcpy(GetMonitorBuffer(i), buffer, size);
+        }
+    }
+    return 0;
+}
+
+int JackAudioDriver::ProcessNull()
+{
+    // Keep begin cycle time
+    JackDriver::CycleTakeBeginTime();
+    
+    if (fEngineControl->fSyncMode) {
+        ProcessGraphSync();
+    } else {
+        ProcessGraphAsync();
+    }
+            
+     // Keep end cycle time
+    JackDriver::CycleTakeEndTime();
+    WaitUntilNextCycle();
+    return 0;
+}
+
+int JackAudioDriver::Process()
+{
+    return (fEngineControl->fSyncMode) ? ProcessSync() : ProcessAsync();
+}
+
+/*
+The driver ASYNC mode: output buffers computed at the *previous cycle* are used, the server does not
+synchronize to the end of client graph execution.
+*/
+
+int JackAudioDriver::ProcessAsync()
+{
+    // Read input buffers for the current cycle
+    if (Read() < 0) {   
+        jack_error("JackAudioDriver::ProcessAsync: read error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+
+    // Write output buffers from the previous cycle
+    if (Write() < 0) {
+        jack_error("JackAudioDriver::ProcessAsync: write error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+
+    if (fIsMaster) {
+        ProcessGraphAsync();
+    } else {
+        fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
+    }
+    
+    // Keep end cycle time
+    JackDriver::CycleTakeEndTime();
+    return 0;
+}
+
+/*
+The driver SYNC mode: the server does synchronize to the end of client graph execution,
+output buffers computed at the *current cycle* are used.
+*/
+
+int JackAudioDriver::ProcessSync()
+{
+    // Read input buffers for the current cycle
+    if (Read() < 0) { 
+        jack_error("JackAudioDriver::ProcessSync: read error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+
+    if (fIsMaster) {
+        ProcessGraphSync();
+    } else {
+        fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
+    }
+    
+    // Write output buffers for the current cycle
+    if (Write() < 0) { 
+        jack_error("JackAudioDriver::ProcessSync: write error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+    
+    // Keep end cycle time
+    JackDriver::CycleTakeEndTime();
+    return 0;
+}
+
+void JackAudioDriver::ProcessGraphAsync()
+{
+    // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
+    if (!fEngine->Process(fBeginDateUst, fEndDateUst)) 
+        jack_error("JackAudioDriver::ProcessAsync Process error");
+    fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
+    if (ProcessSlaves() < 0)
+        jack_error("JackAudioDriver::ProcessAsync ProcessSlaves error");
+}
+
+void JackAudioDriver::ProcessGraphSync()
+{
+    // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
+    if (fEngine->Process(fBeginDateUst, fEndDateUst)) { 
+        fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
+        if (ProcessSlaves() < 0)
+            jack_error("JackAudioDriver::ProcessSync ProcessSlaves error, engine may now behave abnormally!!");
+        if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0)
+            jack_error("JackAudioDriver::ProcessSync SuspendRefNum error, engine may now behave abnormally!!");
+    } else { // Graph not finished: do not activate it
+        jack_error("JackAudioDriver::ProcessSync: error");
+    }
+}
+
+void JackAudioDriver::WaitUntilNextCycle()
+{
+    int wait_time_usec = (int((float(fEngineControl->fBufferSize) / (float(fEngineControl->fSampleRate))) * 1000000.0f));
+    wait_time_usec = int(wait_time_usec - (GetMicroSeconds() - fBeginDateUst));
+	if (wait_time_usec > 0)
+		JackSleep(wait_time_usec);
+}
+
+jack_default_audio_sample_t* JackAudioDriver::GetInputBuffer(int port_index)
+{
+    assert(fCapturePortList[port_index]);
+    return (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[port_index], fEngineControl->fBufferSize);
+}
+
+jack_default_audio_sample_t* JackAudioDriver::GetOutputBuffer(int port_index)
+{
+    assert(fPlaybackPortList[port_index]);
+    return (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[port_index], fEngineControl->fBufferSize);
+}
+
+jack_default_audio_sample_t* JackAudioDriver::GetMonitorBuffer(int port_index)
+{
+    assert(fPlaybackPortList[port_index]);
+    return (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fMonitorPortList[port_index], fEngineControl->fBufferSize);
+}
+
+} // end of namespace
diff --git a/common/JackAudioDriver.h b/common/JackAudioDriver.h
new file mode 100644
index 0000000..6fb64e6
--- /dev/null
+++ b/common/JackAudioDriver.h
@@ -0,0 +1,102 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackAudioDriver__
+#define __JackAudioDriver__
+
+#include "JackDriver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The base class for audio drivers: drivers with audio ports.
+*/
+
+class SERVER_EXPORT JackAudioDriver : public JackDriver
+{
+
+    protected:
+
+        void ProcessGraphAsync();
+        void ProcessGraphSync();
+        void WaitUntilNextCycle();
+
+        virtual int ProcessAsync();
+        virtual int ProcessSync();
+  
+        int fCaptureChannels;
+        int fPlaybackChannels;
+
+        // Static tables since the actual number of ports may be changed by the real driver
+        // thus dynamic allocation is more difficult to handle
+        jack_port_id_t fCapturePortList[DRIVER_PORT_NUM];
+        jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM];
+        jack_port_id_t fMonitorPortList[DRIVER_PORT_NUM];
+
+        bool fWithMonitorPorts;
+
+        jack_default_audio_sample_t* GetInputBuffer(int port_index);
+        jack_default_audio_sample_t* GetOutputBuffer(int port_index);
+        jack_default_audio_sample_t* GetMonitorBuffer(int port_index);
+
+    public:
+
+        JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        virtual ~JackAudioDriver();
+
+        virtual int Open(jack_nframes_t buffer_size,
+                        jack_nframes_t samplerate,
+                        bool capturing,
+                        bool playing,
+                        int inchannels,
+                        int outchannels,
+                        bool monitor,
+                        const char* capture_driver_name,
+                        const char* playback_driver_name,
+                        jack_nframes_t capture_latency,
+                        jack_nframes_t playback_latency);
+                        
+        virtual int Open(bool capturing,
+                        bool playing,
+                        int inchannels,
+                        int outchannels,
+                        bool monitor,
+                        const char* capture_driver_name,
+                        const char* playback_driver_name,
+                        jack_nframes_t capture_latency,
+                        jack_nframes_t playback_latency);
+                  
+        virtual int Process();
+        virtual int ProcessNull();
+
+        virtual int Attach();
+        virtual int Detach();
+        
+        virtual int Write();
+
+        virtual int SetBufferSize(jack_nframes_t buffer_size);
+        virtual int SetSampleRate(jack_nframes_t sample_rate);
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackAudioPort.cpp b/common/JackAudioPort.cpp
new file mode 100644
index 0000000..20cf1e8
--- /dev/null
+++ b/common/JackAudioPort.cpp
@@ -0,0 +1,138 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackPortType.h"
+#include <string.h>
+
+#if defined (__APPLE__)
+#include <Accelerate/Accelerate.h>
+#elif defined (__SSE__) && !defined (__sun__)
+#include <xmmintrin.h>
+#endif
+
+namespace Jack
+{
+
+static void AudioBufferInit(void* buffer, size_t buffer_size, jack_nframes_t)
+{
+    memset(buffer, 0, buffer_size);
+}
+
+static inline void MixAudioBuffer(float* mixbuffer, float* buffer, jack_nframes_t frames)
+{
+#ifdef __APPLE__
+    // It seems that a vector mult only operation does not exist...
+    float gain = 1.0f;
+    vDSP_vsma(buffer, 1, &gain, mixbuffer, 1, mixbuffer, 1, frames);
+#else
+    jack_nframes_t frames_group = frames / 4;
+    frames = frames % 4;
+
+    while (frames_group > 0) {
+#if defined (__SSE__) && !defined (__sun__) 
+        __m128 vec = _mm_add_ps(_mm_load_ps(mixbuffer), _mm_load_ps(buffer));
+        _mm_store_ps(mixbuffer, vec);
+
+        mixbuffer += 4;
+        buffer += 4;
+        frames_group--;
+#else
+    register float mixFloat1 = *mixbuffer;
+    register float sourceFloat1 = *buffer;
+    register float mixFloat2 = *(mixbuffer + 1);
+    register float sourceFloat2 = *(buffer + 1);
+    register float mixFloat3 = *(mixbuffer + 2);
+    register float sourceFloat3 = *(buffer + 2);
+    register float mixFloat4 = *(mixbuffer + 3);
+    register float sourceFloat4 = *(buffer + 3);
+
+    buffer += 4;
+    frames_group--;
+
+    mixFloat1 += sourceFloat1;
+    mixFloat2 += sourceFloat2;
+    mixFloat3 += sourceFloat3;
+    mixFloat4 += sourceFloat4;
+
+    *mixbuffer = mixFloat1;
+    *(mixbuffer + 1) = mixFloat2;
+    *(mixbuffer + 2) = mixFloat3;
+    *(mixbuffer + 3) = mixFloat4;
+
+    mixbuffer += 4;
+#endif
+    }
+
+    while (frames > 0) {
+        register float mixFloat1 = *mixbuffer;
+        register float sourceFloat1 = *buffer;
+        buffer++;
+        frames--;
+        mixFloat1 += sourceFloat1;
+        *mixbuffer = mixFloat1;
+        mixbuffer++;
+    }
+#endif
+}
+
+static void AudioBufferMixdown(void* mixbuffer, void** src_buffers, int src_count, jack_nframes_t nframes)
+{
+    void* buffer;
+
+    // Copy first buffer
+#if defined (__SSE__) && !defined (__sun__) 
+    jack_nframes_t frames_group = nframes / 4;
+    jack_nframes_t remaining_frames = nframes % 4;
+
+    float * source = static_cast<float*>(src_buffers[0]);
+    float * target = static_cast<float*>(mixbuffer);
+
+    while (frames_group > 0)
+    {
+        __m128 vec = _mm_load_ps(source);
+        _mm_store_ps(target, vec);
+        source += 4;
+        target += 4;
+        --frames_group;
+    }
+
+    for (jack_nframes_t i = 0; i != remaining_frames; ++i)
+        target[i] = source[i];
+
+#else
+    memcpy(mixbuffer, src_buffers[0], nframes * sizeof(float));
+#endif
+
+    // Mix remaining buffers
+    for (int i = 1; i < src_count; ++i) {
+        buffer = src_buffers[i];
+        MixAudioBuffer(static_cast<float*>(mixbuffer), static_cast<float*>(buffer), nframes);
+    }
+}
+
+const JackPortType gAudioPortType =
+    {
+        JACK_DEFAULT_AUDIO_TYPE,
+        AudioBufferInit,
+        AudioBufferMixdown
+    };
+
+} // namespace Jack
+
diff --git a/common/JackChannel.h b/common/JackChannel.h
new file mode 100644
index 0000000..655e2bc
--- /dev/null
+++ b/common/JackChannel.h
@@ -0,0 +1,136 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackChannel__
+#define __JackChannel__
+
+#include "types.h"
+
+namespace Jack
+{
+
+class JackClientInterface;
+class JackClient;
+class JackServer;
+struct JackEngineControl;
+class JackGraphManager;
+
+namespace detail
+{
+
+/*!
+\brief Inter process channel for server/client bidirectionnal communication : request and (receiving) notifications.
+*/
+
+class JackClientChannelInterface
+{
+
+    public:
+
+        JackClientChannelInterface()
+        {}
+        virtual ~JackClientChannelInterface()
+        {}
+
+        // Open the Server/Client connection
+        virtual int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
+        {
+            return 0;
+        }
+
+        // Close the Server/Client connection
+        virtual void Close()
+        {}
+
+        // Start listening for messages from the server
+        virtual int Start()
+        {
+            return 0;
+        }
+
+        // Stop listening for messages from the server
+        virtual void Stop()
+        {}
+
+        virtual int ServerCheck(const char* server_name)
+        {
+            return -1;
+        }
+
+        virtual void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
+        {}
+        virtual void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+        {}
+        virtual void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
+        {}
+        virtual void ClientClose(int refnum, int* result)
+        {}
+
+        virtual void ClientActivate(int refnum, int is_real_time, int* result)
+        {}
+        virtual void ClientDeactivate(int refnum, int* result)
+        {}
+
+        virtual void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
+        {}
+        virtual void PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
+        {}
+
+        virtual void PortConnect(int refnum, const char* src, const char* dst, int* result)
+        {}
+        virtual void PortDisconnect(int refnum, const char* src, const char* dst, int* result)
+        {}
+        virtual void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+        {}
+        virtual void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+        {}
+        virtual void PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
+        {}
+
+        virtual void SetBufferSize(jack_nframes_t buffer_size, int* result)
+        {}
+        virtual void SetFreewheel(int onoff, int* result)
+        {}
+
+        virtual void ReleaseTimebase(int refnum, int* result)
+        {}
+
+        virtual void SetTimebaseCallback(int refnum, int conditional, int* result)
+        {}
+
+        virtual void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
+        {}
+
+        virtual void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
+        {}
+
+        virtual void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
+        {}
+
+        virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result)
+        {}
+        
+};
+
+}
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackClient.cpp b/common/JackClient.cpp
new file mode 100644
index 0000000..889a24a
--- /dev/null
+++ b/common/JackClient.cpp
@@ -0,0 +1,1043 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackClient.h"
+#include "JackGraphManager.h"
+#include "JackClientControl.h"
+#include "JackEngineControl.h"
+#include "JackGlobals.h"
+#include "JackChannel.h"
+#include "JackTransportEngine.h"
+#include "driver_interface.h"
+#include "JackLibGlobals.h"
+
+#include <math.h>
+#include <string>
+#include <algorithm>
+
+using namespace std;
+
+namespace Jack
+{
+
+#define IsRealTime() ((fProcess != NULL) | (fThreadFun != NULL) | (fSync != NULL) | (fTimebase != NULL))
+
+JackClient::JackClient():fThread(this)
+{}
+
+JackClient::JackClient(JackSynchro* table):fThread(this)
+{
+    fSynchroTable = table;
+    fProcess = NULL;
+    fGraphOrder = NULL;
+    fXrun = NULL;
+    fShutdown = NULL;
+    fInfoShutdown = NULL;
+    fInit = NULL;
+    fBufferSize = NULL;
+    fClientRegistration = NULL;
+    fFreewheel = NULL;
+    fPortRegistration = NULL;
+    fPortConnect = NULL;
+    fPortRename = NULL;
+    fTimebase = NULL;
+    fSync = NULL;
+    fThreadFun = NULL;
+    fProcessArg = NULL;
+    fGraphOrderArg = NULL;
+    fXrunArg = NULL;
+    fShutdownArg = NULL;
+    fInfoShutdownArg = NULL;
+    fInitArg = NULL;
+    fBufferSizeArg = NULL;
+    fFreewheelArg = NULL;
+    fClientRegistrationArg = NULL;
+    fPortRegistrationArg = NULL;
+    fPortConnectArg = NULL;
+    fPortRenameArg = NULL;
+    fSyncArg = NULL;
+    fTimebaseArg = NULL;
+    fThreadFunArg = NULL;
+}
+
+JackClient::~JackClient()
+{}
+
+int JackClient::Close()
+{
+    jack_log("JackClient::Close ref = %ld", GetClientControl()->fRefNum);
+    int result = 0;
+    
+    Deactivate();
+    fChannel->Stop();  // Channels is stopped first to avoid receiving notifications while closing
+    
+    // Request close only if server is still running
+    if (JackGlobals::fServerRunning) {
+        fChannel->ClientClose(GetClientControl()->fRefNum, &result);
+    } else {
+        jack_log("JackClient::Close server is shutdown"); 
+    }
+    
+    fChannel->Close();
+    fSynchroTable[GetClientControl()->fRefNum].Disconnect();
+    JackGlobals::fClientTable[GetClientControl()->fRefNum] = NULL;
+    return result;
+}
+
+bool JackClient::IsActive()
+{
+    return (GetClientControl()) ? GetClientControl()->fActive : false;
+}
+
+pthread_t JackClient::GetThreadID()
+{
+    return fThread.GetThreadID();
+}
+
+/*!
+	In "async" mode, the server does not synchronize itself on the output drivers, thus it would never "consume" the activations.
+	The synchronization primitives for drivers are setup in "flush" mode that to not keep unneeded activations.
+	Drivers synchro are setup in "flush" mode if server is "async" and NOT freewheel.
+*/
+void JackClient::SetupDriverSync(bool freewheel)
+{
+    if (!freewheel && !GetEngineControl()->fSyncMode) {
+        jack_log("JackClient::SetupDriverSync driver sem in flush mode");
+        for (int i = 0; i < GetEngineControl()->fDriverNum; i++) {
+            fSynchroTable[i].SetFlush(true);
+        }
+    } else {
+        jack_log("JackClient::SetupDriverSync driver sem in normal mode");
+        for (int i = 0; i < GetEngineControl()->fDriverNum; i++)
+            fSynchroTable[i].SetFlush(false);
+    }
+}
+
+/*!
+\brief Notification received from the server.
+*/
+
+int JackClient::ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    return 0;
+}
+
+int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    int res = 0;
+
+    // Done all time: redirected on subclass implementation JackLibClient and JackInternalClient
+    switch (notify) {
+
+        case kAddClient:
+            res = ClientNotifyImp(refnum, name, notify, sync, message, value1, value2);
+            break;
+
+        case kRemoveClient:
+            res = ClientNotifyImp(refnum, name, notify, sync, message, value1, value2);
+            break;
+
+        case kActivateClient:
+            jack_log("JackClient::kActivateClient name = %s ref = %ld ", name, refnum);
+            Init();
+            break;
+    }
+
+    /*
+    The current semantic is that notifications can only be received when the client has been activated,
+    although is this implementation, one could imagine calling notifications as soon as the client has be opened.
+    */
+    if (IsActive()) {
+
+        switch (notify) {
+
+            case kAddClient:
+                jack_log("JackClient::kAddClient fName = %s name = %s", GetClientControl()->fName, name);
+                if (fClientRegistration && strcmp(GetClientControl()->fName, name) != 0) {	// Don't call the callback for the registering client itself
+                    fClientRegistration(name, 1, fClientRegistrationArg);
+                }
+                break;
+
+            case kRemoveClient:
+                jack_log("JackClient::kRemoveClient fName = %s name = %s", GetClientControl()->fName, name);
+                if (fClientRegistration && strcmp(GetClientControl()->fName, name) != 0) { // Don't call the callback for the registering client itself
+                    fClientRegistration(name, 0, fClientRegistrationArg);
+                }
+                break;
+
+            case kBufferSizeCallback:
+                jack_log("JackClient::kBufferSizeCallback buffer_size = %ld", value1);
+                if (fBufferSize) {
+                    res = fBufferSize(value1, fBufferSizeArg);
+                }
+                break;
+                
+            case kSampleRateCallback:
+                jack_log("JackClient::kSampleRateCallback sample_rate = %ld", value1);
+                if (fSampleRate) {
+                    res = fSampleRate(value1, fSampleRateArg);
+                }
+                break;
+
+            case kGraphOrderCallback:
+                jack_log("JackClient::kGraphOrderCallback");
+                if (fGraphOrder) {
+                    res = fGraphOrder(fGraphOrderArg);
+                }
+                break;
+
+            case kStartFreewheelCallback:
+                jack_log("JackClient::kStartFreewheel");
+                SetupDriverSync(true);
+                fThread.DropRealTime();     // Always done (JACK server in RT mode or not...)
+                if (fFreewheel) {
+                    fFreewheel(1, fFreewheelArg);
+                }
+                break;
+
+            case kStopFreewheelCallback:
+                jack_log("JackClient::kStopFreewheel");
+                SetupDriverSync(false);
+                if (fFreewheel) {
+                    fFreewheel(0, fFreewheelArg);
+                }
+                if (GetEngineControl()->fRealTime) {
+                    fThread.AcquireRealTime();
+                }
+                break;
+
+            case kPortRegistrationOnCallback:
+                jack_log("JackClient::kPortRegistrationOn port_index = %ld", value1);
+                if (fPortRegistration) {
+                    fPortRegistration(value1, 1, fPortRegistrationArg);
+                }
+                break;
+
+            case kPortRegistrationOffCallback:
+                jack_log("JackClient::kPortRegistrationOff port_index = %ld ", value1);
+                if (fPortRegistration) {
+                    fPortRegistration(value1, 0, fPortRegistrationArg);
+                }
+                break;
+
+            case kPortConnectCallback:
+                jack_log("JackClient::kPortConnectCallback src = %ld dst = %ld", value1, value2);
+                if (fPortConnect) {
+                    fPortConnect(value1, value2, 1, fPortConnectArg);
+                }
+                break;
+
+            case kPortDisconnectCallback:
+                jack_log("JackClient::kPortDisconnectCallback src = %ld dst = %ld", value1, value2);
+                if (fPortConnect) {
+                    fPortConnect(value1, value2, 0, fPortConnectArg);
+                }
+                break;
+                
+             case kPortRenameCallback:
+                jack_log("JackClient::kPortRenameCallback port = %ld", value1);
+                if (fPortRename) {
+                    fPortRename(value1, message, GetGraphManager()->GetPort(value1)->GetName(), fPortRenameArg);
+                }
+                break;
+
+            case kXRunCallback:
+                jack_log("JackClient::kXRunCallback");
+                if (fXrun) {
+                    res = fXrun(fXrunArg);
+                }
+                break;
+                
+            case kShutDownCallback:
+                jack_log("JackClient::kShutDownCallback");
+                if (fInfoShutdown) {
+                    fInfoShutdown((jack_status_t)value1, message, fInfoShutdownArg);
+                    fInfoShutdown = NULL;
+                }
+                break;
+        }
+    }
+
+    return res;
+}
+
+/*!
+\brief We need to start thread before activating in the server, otherwise the FW driver
+	   connected to the client may not be activated.
+*/
+int JackClient::Activate()
+{
+    jack_log("JackClient::Activate");
+    if (IsActive())
+        return 0;
+
+    // RT thread is started only when needed...
+    if (IsRealTime()) {
+        if (StartThread() < 0)
+            return -1;
+    }
+    
+    /*
+    Insertion of client in the graph will cause a kGraphOrderCallback notification 
+    to be delivered by the server, the client wants to receive it.
+    */
+    GetClientControl()->fActive = true;
+    
+    // Transport related callback become "active"
+    GetClientControl()->fTransportSync = true;
+    GetClientControl()->fTransportTimebase = true;
+
+    int result = -1;
+    GetClientControl()->fCallback[kRealTimeCallback] = IsRealTime();
+    fChannel->ClientActivate(GetClientControl()->fRefNum, IsRealTime(), &result);
+    return result;
+}
+
+/*!
+\brief Need to stop thread after deactivating in the server.
+*/
+int JackClient::Deactivate()
+{
+    jack_log("JackClient::Deactivate");
+    if (!IsActive())
+        return 0;
+
+    GetClientControl()->fActive = false;
+    
+    // Transport related callback become "unactive"
+    GetClientControl()->fTransportSync = false;
+    GetClientControl()->fTransportTimebase = false;
+    
+    // We need to wait for the new engine cycle before stopping the RT thread, but this is done by ClientDeactivate
+    int result = -1;
+    fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result);
+    jack_log("JackClient::Deactivate res = %ld", result);
+  
+    // RT thread is stopped only when needed...
+    if (IsRealTime()) 
+        fThread.Kill();
+    return result;
+}
+
+//----------------------
+// RT thread management
+//----------------------
+
+/*!
+\brief Called once when the thread starts.
+*/
+bool JackClient::Init()
+{
+    if (fInit) {
+        jack_log("JackClient::Init calling client thread init callback");
+        fInit(fInitArg);
+    }
+    return true;
+}
+
+int JackClient::StartThread()
+{
+    jack_log("JackClient::StartThread : period = %ld computation = %ld constraint = %ld",
+             long(int64_t(GetEngineControl()->fPeriod) / 1000.0f),
+             long(int64_t(GetEngineControl()->fComputation) / 1000.0f),
+             long(int64_t(GetEngineControl()->fConstraint) / 1000.0f));
+
+    // Will do "something" on OSX only...
+    fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
+
+    if (fThread.StartSync() < 0) {
+        jack_error("Start thread error");
+        return -1;
+    }
+
+    if (GetEngineControl()->fRealTime) {
+        if (fThread.AcquireRealTime(GetEngineControl()->fClientPriority) < 0) {
+            jack_error("AcquireRealTime error");
+        }
+    }
+
+    return 0;
+}
+
+/*!
+\brief RT thread.
+*/
+
+bool JackClient::Execute()
+{
+    if (!jack_tls_set(JackGlobals::fRealTime, this)) 
+        jack_error("failed to set thread realtime key");
+        
+    if (GetEngineControl()->fRealTime) 
+        set_threaded_log_function(); 
+        
+    // Execute a dummy cycle to be sure thread has the correct properties
+    DummyCycle();
+      
+    if (fThreadFun) {
+        fThreadFun(fThreadFunArg);
+    } else {
+        ExecuteThread();
+    }
+    return false; 
+}
+
+void JackClient::DummyCycle()
+{
+    WaitSync();
+    SignalSync();
+}
+
+inline void JackClient::ExecuteThread()
+{
+    while (true) { 
+        CycleWaitAux();
+        CycleSignalAux(CallProcessCallback());  
+	}
+}
+
+inline jack_nframes_t JackClient::CycleWaitAux()
+{
+    if (!WaitSync()) 
+        Error();   // Terminates the thread
+    CallSyncCallbackAux();
+    return GetEngineControl()->fBufferSize;
+}
+
+inline void JackClient::CycleSignalAux(int status)
+{
+    if (status == 0)
+        CallTimebaseCallbackAux();
+    SignalSync();
+    if (status != 0) 
+        End();     // Terminates the thread
+}
+
+jack_nframes_t JackClient::CycleWait()
+{
+    return CycleWaitAux();
+}
+
+void JackClient::CycleSignal(int status)
+{
+    CycleSignalAux(status);
+}
+
+inline int JackClient::CallProcessCallback()
+{
+    return (fProcess != NULL) ? fProcess(GetEngineControl()->fBufferSize, fProcessArg) : 0;
+}
+
+inline bool JackClient::WaitSync()
+{
+    // Suspend itself: wait on the input synchro
+    if (GetGraphManager()->SuspendRefNum(GetClientControl(), fSynchroTable, 0x7FFFFFFF) < 0) {
+        jack_error("SuspendRefNum error");
+        return false;
+    } else {
+        return true;
+    }
+}
+
+inline void JackClient::SignalSync()
+{
+    // Resume: signal output clients connected to the running client
+    if (GetGraphManager()->ResumeRefNum(GetClientControl(), fSynchroTable) < 0) {
+        jack_error("ResumeRefNum error");
+    }
+}
+
+inline void JackClient::End()
+{
+    jack_log("JackClient::Execute end name = %s", GetClientControl()->fName);
+    // Hum... not sure about this, the following "close" code is called in the RT thread...
+    int result;
+    fThread.DropSelfRealTime();
+    GetClientControl()->fActive = false;
+    fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result);
+    fThread.Terminate();
+}
+
+inline void JackClient::Error()
+{
+    jack_error("JackClient::Execute error name = %s", GetClientControl()->fName);
+    // Hum... not sure about this, the following "close" code is called in the RT thread...
+    int result;
+    fThread.DropSelfRealTime();
+    GetClientControl()->fActive = false;
+    fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result);
+    ShutDown();
+    fThread.Terminate();
+}
+
+//-----------------
+// Port management
+//-----------------
+
+int JackClient::PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size)
+{
+    // Check if port name is empty
+    string port_name_str = string(port_name);
+    if (port_name_str.size() == 0) {
+        jack_error("port_name is empty");
+        return 0; // Means failure here...
+    }
+
+    // Check port name length
+    string name = string(GetClientControl()->fName) + string(":") + port_name_str;
+    if (name.size() >= JACK_PORT_NAME_SIZE) {
+        jack_error("\"%s:%s\" is too long to be used as a JACK port name.\n"
+                   "Please use %lu characters or less",
+                   GetClientControl()->fName,
+                   port_name,
+                   JACK_PORT_NAME_SIZE - 1);
+        return 0; // Means failure here...
+    }
+
+    int result = -1;
+    jack_port_id_t port_index = NO_PORT;
+    fChannel->PortRegister(GetClientControl()->fRefNum, name.c_str(), port_type, flags, buffer_size, &port_index, &result);
+  
+    if (result == 0) {
+        jack_log("JackClient::PortRegister ref = %ld name = %s type = %s port_index = %ld", GetClientControl()->fRefNum, name.c_str(), port_type, port_index);
+        fPortList.push_back(port_index);
+        return port_index;
+    } else {
+        return 0;
+    }
+}
+
+int JackClient::PortUnRegister(jack_port_id_t port_index)
+{
+    jack_log("JackClient::PortUnRegister port_index = %ld", port_index);
+    list<jack_port_id_t>::iterator it = find(fPortList.begin(), fPortList.end(), port_index);
+
+    if (it != fPortList.end()) {
+        fPortList.erase(it);
+        int result = -1;
+        fChannel->PortUnRegister(GetClientControl()->fRefNum, port_index, &result);
+        return result;
+    } else {
+        jack_error("unregistering a port %ld that is not own by the client", port_index);
+        return -1;
+    }
+}
+
+int JackClient::PortConnect(const char* src, const char* dst)
+{
+    jack_log("JackClient::Connect src = %s dst = %s", src, dst);
+    int result = -1;
+    fChannel->PortConnect(GetClientControl()->fRefNum, src, dst, &result);
+    return result;
+}
+
+int JackClient::PortDisconnect(const char* src, const char* dst)
+{
+    jack_log("JackClient::Disconnect src = %s dst = %s", src, dst);
+    int result = -1;
+    fChannel->PortDisconnect(GetClientControl()->fRefNum, src, dst, &result);
+    return result;
+}
+
+int JackClient::PortDisconnect(jack_port_id_t src)
+{
+    jack_log("JackClient::PortDisconnect src = %ld", src);
+    int result = -1;
+    fChannel->PortDisconnect(GetClientControl()->fRefNum, src, ALL_PORTS, &result);
+    return result;
+}
+
+int JackClient::PortIsMine(jack_port_id_t port_index)
+{
+    JackPort* port = GetGraphManager()->GetPort(port_index);
+    return GetClientControl()->fRefNum == port->GetRefNum();
+}
+
+int JackClient::PortRename(jack_port_id_t port_index, const char* name)
+{
+    int result = -1;
+    fChannel->PortRename(GetClientControl()->fRefNum, port_index, name, &result);
+    return result;
+}
+
+//--------------------
+// Context management
+//--------------------
+
+int JackClient::SetBufferSize(jack_nframes_t buffer_size)
+{
+    int result = -1;
+    fChannel->SetBufferSize(buffer_size, &result);
+    return result;
+}
+
+int JackClient::SetFreeWheel(int onoff)
+{
+    int result = -1;
+    fChannel->SetFreewheel(onoff, &result);
+    return result;
+}
+
+/*
+ShutDown is called:
+- from the RT thread when Execute method fails
+- possibly from a "closed" notification channel
+(Not needed since the synch object used (Sema of Fifo will fails when server quits... see ShutDown))
+*/
+
+void JackClient::ShutDown()
+{
+    jack_log("ShutDown");
+    JackGlobals::fServerRunning = false;
+    
+    if (fInfoShutdown) {
+        fInfoShutdown(JackFailure, "JACK server has been closed", fInfoShutdownArg);
+        fInfoShutdown = NULL;
+    } else if (fShutdown) {
+        fShutdown(fShutdownArg);
+        fShutdown = NULL;
+    }
+}
+
+//----------------------
+// Transport management
+//----------------------
+
+inline int JackClient::ActivateAux()
+{
+    // If activated without RT thread...
+    if (IsActive() && fThread.GetStatus() != JackThread::kRunning) {
+    
+        jack_log("ActivateAux");
+    
+        // RT thread is started
+        if (StartThread() < 0)
+            return -1;
+        
+        int result = -1;
+        GetClientControl()->fCallback[kRealTimeCallback] = IsRealTime();
+        fChannel->ClientActivate(GetClientControl()->fRefNum, IsRealTime(), &result);
+        return result;
+        
+    } else {
+        return 0;
+    }
+}
+
+int JackClient::ReleaseTimebase()
+{
+    int result = -1;
+    fChannel->ReleaseTimebase(GetClientControl()->fRefNum, &result);
+    if (result == 0) {
+        GetClientControl()->fTransportTimebase = false;
+        fTimebase = NULL;
+        fTimebaseArg = NULL;
+    }
+    return result;
+}
+
+/* Call the server if the client is active, otherwise keeps the arguments */
+int JackClient::SetSyncCallback(JackSyncCallback sync_callback, void* arg)
+{
+    GetClientControl()->fTransportSync = (fSync != NULL);
+    fSyncArg = arg;
+    fSync = sync_callback;
+    return ActivateAux();
+}
+
+int JackClient::SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg)
+{
+    int result = -1;
+    fChannel->SetTimebaseCallback(GetClientControl()->fRefNum, conditional, &result);
+    
+    if (result == 0) {
+        GetClientControl()->fTransportTimebase = true;
+        fTimebase = timebase_callback;
+        fTimebaseArg = arg;
+        return ActivateAux();
+    } else {
+        fTimebase = NULL;
+        fTimebaseArg = NULL;
+        return -1;
+    }
+}
+
+int JackClient::SetSyncTimeout(jack_time_t timeout)
+{
+    GetEngineControl()->fTransport.SetSyncTimeout(timeout);
+    return 0;
+}
+
+// Must be RT safe
+
+void JackClient::TransportLocate(jack_nframes_t frame)
+{
+    jack_position_t pos;
+    pos.frame = frame;
+    pos.valid = (jack_position_bits_t)0;
+    jack_log("TransportLocate pos = %ld", pos.frame);
+    GetEngineControl()->fTransport.RequestNewPos(&pos);
+}
+
+int JackClient::TransportReposition(jack_position_t* pos)
+{
+    jack_position_t tmp = *pos;
+    jack_log("TransportReposition pos = %ld", pos->frame);
+    if (tmp.valid & ~JACK_POSITION_MASK) {
+        return EINVAL;
+    } else {
+        GetEngineControl()->fTransport.RequestNewPos(pos);
+        return 0;
+    }
+}
+
+jack_transport_state_t JackClient::TransportQuery(jack_position_t* pos)
+{
+    return GetEngineControl()->fTransport.Query(pos);
+}
+
+jack_nframes_t JackClient::GetCurrentTransportFrame()
+{
+    return GetEngineControl()->fTransport.GetCurrentFrame();
+}
+
+// Must be RT safe: directly write in the transport shared mem
+void JackClient::TransportStart()
+{
+    GetEngineControl()->fTransport.SetCommand(TransportCommandStart);
+}
+
+// Must be RT safe: directly write in the transport shared mem
+void JackClient::TransportStop()
+{
+    GetEngineControl()->fTransport.SetCommand(TransportCommandStop);
+}
+
+// Never called concurently with the server
+// TODO check concurrency with SetSyncCallback
+
+void JackClient::CallSyncCallback()
+{
+    CallSyncCallbackAux();
+}
+
+inline void JackClient::CallSyncCallbackAux()
+{
+    if (GetClientControl()->fTransportSync) {
+    
+        JackTransportEngine& transport = GetEngineControl()->fTransport;
+        jack_position_t* cur_pos = transport.ReadCurrentState();
+        jack_transport_state_t transport_state = transport.GetState();
+    
+        if (fSync != NULL) {
+            if (fSync(transport_state, cur_pos, fSyncArg)) {
+                GetClientControl()->fTransportState = JackTransportRolling;
+                GetClientControl()->fTransportSync = false;
+            }
+        } else {
+            GetClientControl()->fTransportState = JackTransportRolling;
+            GetClientControl()->fTransportSync = false;
+        }
+    }
+}
+
+void JackClient::CallTimebaseCallback()
+{
+    CallTimebaseCallbackAux();
+}
+
+inline void JackClient::CallTimebaseCallbackAux()
+{
+    JackTransportEngine& transport = GetEngineControl()->fTransport;
+    int master;
+    bool unused;
+    
+    transport.GetTimebaseMaster(master, unused);
+    
+    if (GetClientControl()->fRefNum == master && fTimebase) { // Client *is* timebase...
+    
+        jack_transport_state_t transport_state = transport.GetState();
+        jack_position_t* cur_pos = transport.WriteNextStateStart(1);
+        
+        if (GetClientControl()->fTransportTimebase) {
+            fTimebase(transport_state, GetEngineControl()->fBufferSize, cur_pos, true, fTimebaseArg); 
+            GetClientControl()->fTransportTimebase = false; // Callback is called only once with "new_pos" = true 
+        } else if (transport_state == JackTransportRolling) {
+            fTimebase(transport_state, GetEngineControl()->fBufferSize, cur_pos, false, fTimebaseArg);
+        } 
+        
+        transport.WriteNextStateStop(1);
+    }
+}
+
+//---------------------
+// Callback management
+//---------------------
+
+void JackClient::OnShutdown(JackShutdownCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+    } else {
+        fShutdownArg = arg;
+        fShutdown = callback;
+    }
+}
+    
+void JackClient::OnInfoShutdown(JackInfoShutdownCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+    } else {
+        GetClientControl()->fCallback[kShutDownCallback] = (callback != NULL);
+        fInfoShutdownArg = arg;
+        fInfoShutdown = callback;
+    }
+}
+
+int JackClient::SetProcessCallback(JackProcessCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else if (fThreadFun) {
+        jack_error ("A thread callback has already been setup, both models cannot be used at the same time!");
+        return -1;
+    } else {
+        fProcessArg = arg;
+        fProcess = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetXRunCallback(JackXRunCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kXRunCallback] = (callback != NULL);
+        fXrunArg = arg;
+        fXrun = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetInitCallback(JackThreadInitCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        fInitArg = arg;
+        fInit = callback;
+        /* make sure that the message buffer thread is initialized too */
+        JackMessageBuffer::fInstance->SetInitCallback(callback, arg);
+        return 0;
+    }
+}
+
+int JackClient::SetGraphOrderCallback(JackGraphOrderCallback callback, void *arg)
+{
+    jack_log("SetGraphOrderCallback ");
+
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kGraphOrderCallback] = (callback != NULL);
+        fGraphOrder = callback;
+        fGraphOrderArg = arg;
+        return 0;
+    }
+}
+
+int JackClient::SetBufferSizeCallback(JackBufferSizeCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kBufferSizeCallback] = (callback != NULL);
+        fBufferSizeArg = arg;
+        fBufferSize = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetSampleRateCallback(JackSampleRateCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kSampleRateCallback] = (callback != NULL);
+        fSampleRateArg = arg;
+        fSampleRate = callback;
+        // Now invoke it 
+        if (callback) 
+            callback(GetEngineControl()->fSampleRate, arg);
+        return 0;
+    }
+}
+
+int JackClient::SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        // kAddClient and kRemoveClient notifications must be delivered by the server in any case
+        fClientRegistrationArg = arg;
+        fClientRegistration = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetFreewheelCallback(JackFreewheelCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kStartFreewheelCallback] = (callback != NULL);
+        GetClientControl()->fCallback[kStopFreewheelCallback] = (callback != NULL);
+        fFreewheelArg = arg;
+        fFreewheel = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetPortRegistrationCallback(JackPortRegistrationCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kPortRegistrationOnCallback] = (callback != NULL);
+        GetClientControl()->fCallback[kPortRegistrationOffCallback] = (callback != NULL);
+        fPortRegistrationArg = arg;
+        fPortRegistration = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetPortConnectCallback(JackPortConnectCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kPortConnectCallback] = (callback != NULL);
+        GetClientControl()->fCallback[kPortDisconnectCallback] = (callback != NULL);
+        fPortConnectArg = arg;
+        fPortConnect = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetPortRenameCallback(JackPortRenameCallback callback, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else {
+        GetClientControl()->fCallback[kPortRenameCallback] = (callback != NULL);
+        fPortRenameArg = arg;
+        fPortRename = callback;
+        return 0;
+    }
+}
+
+int JackClient::SetProcessThread(JackThreadCallback fun, void *arg)
+{
+    if (IsActive()) {
+        jack_error("You cannot set callbacks on an active client");
+        return -1;
+    } else if (fProcess) {
+        jack_error ("A process callback has already been setup, both models cannot be used at the same time!");
+        return -1;
+    } else {
+        fThreadFun = fun;
+        fThreadFunArg = arg;
+        return 0;
+    }
+}
+
+//------------------
+// Internal clients
+//------------------
+
+char* JackClient::GetInternalClientName(int ref)
+{
+    char name_res[JACK_CLIENT_NAME_SIZE + 1];
+    int result = -1;
+    fChannel->GetInternalClientName(GetClientControl()->fRefNum, ref, name_res, &result);
+    return (result < 0) ? NULL : strdup(name_res);
+}
+
+int JackClient::InternalClientHandle(const char* client_name, jack_status_t* status)
+{
+    int int_ref, result = -1;
+    fChannel->InternalClientHandle(GetClientControl()->fRefNum, client_name, (int*)status, &int_ref, &result);
+    return int_ref;
+}
+
+int JackClient::InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va)
+{
+    if (strlen(client_name) >= JACK_CLIENT_NAME_SIZE) {
+        jack_error ("\"%s\" is too long for a JACK client name.\n"
+                    "Please use %lu characters or less.",
+                    client_name, JACK_CLIENT_NAME_SIZE);
+        return 0;
+    }
+
+    if (va->load_name && (strlen(va->load_name) >= JACK_PATH_MAX)) {
+        jack_error("\"%s\" is too long for a shared object name.\n"
+                   "Please use %lu characters or less.",
+                   va->load_name, PATH_MAX);
+        int my_status1 = *status | (JackFailure | JackInvalidOption);
+        *status = (jack_status_t)my_status1;
+        return 0;
+    }
+
+    if (va->load_init && (strlen(va->load_init) >= JACK_LOAD_INIT_LIMIT)) {
+        jack_error ("\"%s\" is too long for internal client init "
+                    "string.\nPlease use %lu characters or less.",
+                    va->load_init, JACK_LOAD_INIT_LIMIT);
+        int my_status1 = *status | (JackFailure | JackInvalidOption);
+        *status = (jack_status_t)my_status1;
+        return 0;
+    }
+
+    int int_ref, result = -1;
+    fChannel->InternalClientLoad(GetClientControl()->fRefNum, client_name, va->load_name, va->load_init, options, (int*)status, &int_ref, &result);
+    return int_ref;
+}
+
+void JackClient::InternalClientUnload(int ref, jack_status_t* status)
+{
+    int result = -1;
+    fChannel->InternalClientUnload(GetClientControl()->fRefNum, ref, (int*)status, &result);
+}
+
+
+} // end of namespace
+
diff --git a/common/JackClient.h b/common/JackClient.h
new file mode 100644
index 0000000..215098a
--- /dev/null
+++ b/common/JackClient.h
@@ -0,0 +1,194 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackClient__
+#define __JackClient__
+
+#include "JackClientInterface.h"
+#include "JackThread.h"
+#include "JackConstants.h"
+#include "JackSynchro.h"
+#include "JackPlatformPlug.h"
+#include "JackChannel.h"
+#include "types.h"
+#include "varargs.h"
+#include <list>
+
+namespace Jack
+{
+
+class JackGraphManager;
+class JackServer;
+class JackEngine;
+struct JackClientControl;
+struct JackEngineControl;
+
+/*!
+\brief The base class for clients: share part of the implementation for JackInternalClient and JackLibClient.
+*/
+
+class JackClient : public JackClientInterface, public JackRunnableInterface
+{
+        friend class JackDebugClient;
+
+    protected:
+
+        JackProcessCallback fProcess;
+        JackGraphOrderCallback fGraphOrder;
+        JackXRunCallback fXrun;
+        JackShutdownCallback fShutdown;
+        JackInfoShutdownCallback fInfoShutdown;
+        JackThreadInitCallback fInit;
+        JackBufferSizeCallback fBufferSize;
+        JackSampleRateCallback fSampleRate;
+        JackClientRegistrationCallback fClientRegistration;
+        JackFreewheelCallback fFreewheel;
+        JackPortRegistrationCallback fPortRegistration;
+        JackPortConnectCallback fPortConnect;
+        JackPortRenameCallback fPortRename;
+        JackTimebaseCallback fTimebase;
+        JackSyncCallback fSync;
+        JackThreadCallback fThreadFun;
+
+        void* fProcessArg;
+        void* fGraphOrderArg;
+        void* fXrunArg;
+        void* fShutdownArg;
+        void* fInfoShutdownArg;
+        void* fInitArg;
+        void* fBufferSizeArg;
+        void* fSampleRateArg;
+        void* fClientRegistrationArg;
+        void* fFreewheelArg;
+        void* fPortRegistrationArg;
+        void* fPortConnectArg;
+        void* fPortRenameArg;
+        void* fTimebaseArg;
+        void* fSyncArg;
+        void* fThreadFunArg;
+        char fServerName[64];
+
+        JackThread fThread;    /*! Thread to execute the Process function */
+        detail::JackClientChannelInterface* fChannel;
+        JackSynchro* fSynchroTable;
+        std::list<jack_port_id_t> fPortList;
+  
+        int StartThread();
+        void SetupDriverSync(bool freewheel);
+        bool IsActive();
+
+        void CallSyncCallback();
+        void CallTimebaseCallback();
+   
+        virtual int ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value);
+
+        inline void DummyCycle();
+        inline void ExecuteThread();
+        inline bool WaitSync();
+        inline void SignalSync();
+        inline int CallProcessCallback();
+        inline void End();
+        inline void Error();
+        inline jack_nframes_t CycleWaitAux();
+        inline void CycleSignalAux(int status);
+        inline void CallSyncCallbackAux();
+        inline void CallTimebaseCallbackAux();
+        inline int ActivateAux();
+   
+    public:
+
+        JackClient();
+        JackClient(JackSynchro* table);
+        virtual ~JackClient();
+
+        virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status) = 0;
+        virtual int Close();
+
+        virtual JackGraphManager* GetGraphManager() const = 0;
+        virtual JackEngineControl* GetEngineControl() const = 0;
+
+        // Notifications
+        virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
+
+        virtual int Activate();
+        virtual int Deactivate();
+
+        // Context
+        virtual int SetBufferSize(jack_nframes_t buffer_size);
+        virtual int SetFreeWheel(int onoff);
+        virtual void ShutDown();
+        virtual pthread_t GetThreadID();
+
+        // Port management
+        virtual int PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
+        virtual int PortUnRegister(jack_port_id_t port);
+
+        virtual int PortConnect(const char* src, const char* dst);
+        virtual int PortDisconnect(const char* src, const char* dst);
+        virtual int PortDisconnect(jack_port_id_t src);
+
+        virtual int PortIsMine(jack_port_id_t port_index);
+        virtual int PortRename(jack_port_id_t port_index, const char* name);
+
+        // Transport
+        virtual int ReleaseTimebase();
+        virtual int SetSyncCallback(JackSyncCallback sync_callback, void* arg);
+        virtual int SetSyncTimeout(jack_time_t timeout);
+        virtual int SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg);
+        virtual void TransportLocate(jack_nframes_t frame);
+        virtual jack_transport_state_t TransportQuery(jack_position_t* pos);
+        virtual jack_nframes_t GetCurrentTransportFrame();
+        virtual int TransportReposition(jack_position_t* pos);
+        virtual void TransportStart();
+        virtual void TransportStop();
+
+        // Callbacks
+        virtual void OnShutdown(JackShutdownCallback callback, void *arg);
+        virtual void OnInfoShutdown(JackInfoShutdownCallback callback, void *arg);
+        virtual int SetProcessCallback(JackProcessCallback callback, void* arg);
+        virtual int SetXRunCallback(JackXRunCallback callback, void* arg);
+        virtual int SetInitCallback(JackThreadInitCallback callback, void* arg);
+        virtual int SetGraphOrderCallback(JackGraphOrderCallback callback, void* arg);
+        virtual int SetBufferSizeCallback(JackBufferSizeCallback callback, void* arg);
+        virtual int SetSampleRateCallback(JackBufferSizeCallback callback, void* arg);
+        virtual int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
+        virtual int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
+        virtual int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
+        virtual int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
+        virtual int SetPortRenameCallback(JackPortRenameCallback callback, void *arg);
+
+        // Internal clients
+        virtual char* GetInternalClientName(int ref);
+        virtual int InternalClientHandle(const char* client_name, jack_status_t* status);
+        virtual int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
+        virtual void InternalClientUnload(int ref, jack_status_t* status);
+
+        jack_nframes_t CycleWait();
+        void CycleSignal(int status);
+        int SetProcessThread(JackThreadCallback fun, void *arg);
+
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackClientControl.h b/common/JackClientControl.h
new file mode 100644
index 0000000..a82313c
--- /dev/null
+++ b/common/JackClientControl.h
@@ -0,0 +1,87 @@
+/*
+Copyright (C) 2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackClientControl__
+#define __JackClientControl__
+
+#include "JackShmMem.h"
+#include "JackPort.h"
+#include "JackSynchro.h"
+#include "JackNotification.h"
+
+namespace Jack
+{
+
+/*!
+\brief Client control possibly in shared memory.
+*/
+
+struct JackClientControl : public JackShmMemAble
+{
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+    bool fCallback[kMaxNotification];
+    volatile jack_transport_state_t fTransportState;
+    volatile bool fTransportSync;      /* Will be true when slow-sync cb has to be called */
+    volatile bool fTransportTimebase;  /* Will be true when timebase cb is called with new_pos on */
+    int fRefNum;
+    int fPID;
+    bool fActive;
+
+    JackClientControl(const char* name, int pid, int refnum)
+    {
+        Init(name, pid, refnum);
+    }
+
+    JackClientControl(const char* name)
+    {
+        Init(name, 0, -1);
+    }
+
+    JackClientControl()
+    {
+        Init("", 0, -1);
+    }
+
+    void Init(const char* name, int pid, int refnum)
+    {
+        strcpy(fName, name);
+        for (int i = 0; i < kMaxNotification; i++)
+            fCallback[i] = false;
+        // Always activated
+        fCallback[kAddClient] = true;
+        fCallback[kRemoveClient] = true;
+        fCallback[kActivateClient] = true;
+        // So that driver synchro are correctly setup in "flush" or "normal" mode
+        fCallback[kStartFreewheelCallback] = true;
+        fCallback[kStopFreewheelCallback] = true;
+        fRefNum = refnum;
+        fPID = pid;
+        fTransportState = JackTransportStopped;
+        fTransportSync = false;
+        fTransportTimebase = false;
+        fActive = false;
+    }
+
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackClientInterface.h b/common/JackClientInterface.h
new file mode 100644
index 0000000..bd94ed3
--- /dev/null
+++ b/common/JackClientInterface.h
@@ -0,0 +1,55 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackClientInterface__
+#define __JackClientInterface__
+
+#include "JackCompilerDeps.h"
+
+namespace Jack
+{
+
+struct JackClientControl;
+
+/*!
+\brief Client interface.
+*/
+
+class SERVER_EXPORT JackClientInterface
+{
+
+     public:
+    
+        JackClientInterface()
+        {}
+        virtual ~JackClientInterface()
+        {}
+ 
+        virtual int Close() = 0;
+
+        virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2) = 0;
+
+        virtual JackClientControl* GetClientControl() const = 0;
+};
+
+
+} // end of namespace
+
+#endif
diff --git a/common/JackCompilerDeps.h b/common/JackCompilerDeps.h
new file mode 100644
index 0000000..04f87c1
--- /dev/null
+++ b/common/JackCompilerDeps.h
@@ -0,0 +1,25 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackCompilerDeps__
+#define __JackCompilerDeps__
+
+#include "JackCompilerDeps_os.h"
+
+#endif
diff --git a/common/JackConnectionManager.cpp b/common/JackConnectionManager.cpp
new file mode 100644
index 0000000..f6a74dc
--- /dev/null
+++ b/common/JackConnectionManager.cpp
@@ -0,0 +1,409 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackConnectionManager.h"
+#include "JackClientControl.h"
+#include "JackEngineControl.h"
+#include "JackGlobals.h"
+#include "JackError.h"
+#include <iostream>
+#include <assert.h>
+
+namespace Jack
+{
+
+JackConnectionManager::JackConnectionManager()
+{
+    int i;
+    jack_log("JackConnectionManager::InitConnections size = %ld ", sizeof(JackConnectionManager));
+
+    for (i = 0; i < PORT_NUM_MAX; i++) {
+        fConnection[i].Init();
+    }
+
+    fLoopFeedback.Init();
+
+    jack_log("JackConnectionManager::InitClients");
+    for (i = 0; i < CLIENT_NUM; i++) {
+        InitRefNum(i);
+    }
+}
+
+JackConnectionManager::~JackConnectionManager()
+{}
+
+//--------------
+// Internal API
+//--------------
+
+bool JackConnectionManager::IsLoopPathAux(int ref1, int ref2) const
+{
+    jack_log("JackConnectionManager::IsLoopPathAux ref1 = %ld ref2 = %ld", ref1, ref2);
+
+    if (ref1 < GetEngineControl()->fDriverNum || ref2 < GetEngineControl()->fDriverNum) {
+        return false;
+    } else if (ref1 == ref2) {	// Same refnum
+        return true;
+    } else {
+        jack_int_t output[CLIENT_NUM];
+        fConnectionRef.GetOutputTable(ref1, output);
+
+        if (fConnectionRef.IsInsideTable(ref2, output)) { // If ref2 is contained in the outputs of ref1
+            return true;
+        } else {
+            for (int i = 0; i < CLIENT_NUM && output[i] != EMPTY; i++) { // Otherwise recurse for all ref1 outputs
+                if (IsLoopPathAux(output[i], ref2))
+                    return true; // Stop when a path is found
+            }
+            return false;
+        }
+    }
+}
+
+//--------------
+// External API
+//--------------
+
+/*!
+\brief Connect port_src to port_dst.
+*/
+int JackConnectionManager::Connect(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    jack_log("JackConnectionManager::Connect port_src = %ld port_dst = %ld", port_src, port_dst);
+
+    if (fConnection[port_src].AddItem(port_dst)) {
+        return 0;
+    } else {
+        jack_error("Connection table is full !!");
+        return -1;
+    }
+}
+
+/*!
+\brief Disconnect port_src from port_dst.
+*/
+int JackConnectionManager::Disconnect(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    jack_log("JackConnectionManager::Disconnect port_src = %ld port_dst = %ld", port_src, port_dst);
+
+    if (fConnection[port_src].RemoveItem(port_dst)) {
+        return 0;
+    } else {
+        jack_error("Connection not found !!");
+        return -1;
+    }
+}
+
+/*!
+\brief Check if port_src and port_dst are connected.
+*/
+bool JackConnectionManager::IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst) const
+{
+    return fConnection[port_src].CheckItem(port_dst);
+}
+
+/*!
+\brief Get the connection port array.
+*/
+const jack_int_t* JackConnectionManager::GetConnections(jack_port_id_t port_index) const
+{
+    return fConnection[port_index].GetItems();
+}
+
+//------------------------
+// Client port management
+//------------------------
+
+/*!
+\brief Add an input port to a client.
+*/
+int JackConnectionManager::AddInputPort(int refnum, jack_port_id_t port_index)
+{
+    if (fInputPort[refnum].AddItem(port_index)) {
+        jack_log("JackConnectionManager::AddInputPort ref = %ld port = %ld", refnum, port_index);
+        return 0;
+    } else {
+        jack_error("Maximum number of input ports is reached for application ref = %ld", refnum);
+        return -1;
+    }
+}
+
+/*!
+\brief Add an output port to a client.
+*/
+int JackConnectionManager::AddOutputPort(int refnum, jack_port_id_t port_index)
+{
+    if (fOutputPort[refnum].AddItem(port_index)) {
+        jack_log("JackConnectionManager::AddOutputPort ref = %ld port = %ld", refnum, port_index);
+        return 0;
+    } else {
+        jack_error("Maximum number of output ports is reached for application ref = %ld", refnum);
+        return -1;
+    }
+}
+
+/*!
+\brief Remove an input port from a client.
+*/
+int JackConnectionManager::RemoveInputPort(int refnum, jack_port_id_t port_index)
+{
+    jack_log("JackConnectionManager::RemoveInputPort ref = %ld port_index = %ld ", refnum, port_index);
+
+    if (fInputPort[refnum].RemoveItem(port_index)) {
+        return 0;
+    } else {
+        jack_error("Input port index = %ld not found for application ref = %ld", port_index, refnum);
+        return -1;
+    }
+}
+
+/*!
+\brief Remove an output port from a client.
+*/
+int JackConnectionManager::RemoveOutputPort(int refnum, jack_port_id_t port_index)
+{
+    jack_log("JackConnectionManager::RemoveOutputPort ref = %ld port_index = %ld ", refnum, port_index);
+
+    if (fOutputPort[refnum].RemoveItem(port_index)) {
+        return 0;
+    } else {
+        jack_error("Output port index = %ld not found for application ref = %ld", port_index, refnum);
+        return -1;
+    }
+}
+
+/*!
+\brief Get the input port array of a given refnum.
+*/
+const jack_int_t* JackConnectionManager::GetInputPorts(int refnum)
+{
+    return fInputPort[refnum].GetItems();
+}
+
+/*!
+\brief Get the output port array of a given refnum.
+*/
+const jack_int_t* JackConnectionManager::GetOutputPorts(int refnum)
+{
+    return fOutputPort[refnum].GetItems();
+}
+
+/*!
+\brief Init the refnum.
+*/
+void JackConnectionManager::InitRefNum(int refnum)
+{
+    fInputPort[refnum].Init();
+    fOutputPort[refnum].Init();
+    fConnectionRef.Init(refnum);
+    fInputCounter[refnum].SetValue(0);
+}
+
+/*!
+\brief Reset all clients activation.
+*/
+void JackConnectionManager::ResetGraph(JackClientTiming* timing)
+{
+    // Reset activation counter : must be done *before* starting to resume clients
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        fInputCounter[i].Reset();
+        timing[i].fStatus = NotTriggered;
+    }
+}
+
+/*!
+\brief Wait on the input synchro.
+*/
+int JackConnectionManager::SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec)
+{
+    bool res;
+    if ((res = table[control->fRefNum].TimedWait(time_out_usec))) {
+        timing[control->fRefNum].fStatus = Running;
+        timing[control->fRefNum].fAwakeAt = GetMicroSeconds();
+    }
+    return (res) ? 0 : -1;
+}
+
+/*!
+\brief Signal clients connected to the given client.
+*/
+int JackConnectionManager::ResumeRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing)
+{
+    jack_time_t current_date = GetMicroSeconds();
+    const jack_int_t* outputRef = fConnectionRef.GetItems(control->fRefNum);
+    int res = 0;
+
+    // Update state and timestamp of current client
+    timing[control->fRefNum].fStatus = Finished;
+    timing[control->fRefNum].fFinishedAt = current_date;
+
+    for (int i = 0; i < CLIENT_NUM; i++) {
+
+        // Signal connected clients or drivers
+        if (outputRef[i] > 0) {
+
+            // Update state and timestamp of destination clients
+            timing[i].fStatus = Triggered;
+            timing[i].fSignaledAt = current_date;
+
+            if (!fInputCounter[i].Signal(table + i, control)) {
+                jack_log("JackConnectionManager::ResumeRefNum error: ref = %ld output = %ld ", control->fRefNum, i);
+                res = -1;
+            }
+        }
+    }
+
+    return res;
+}
+
+/*!
+\brief Increment the number of ports between 2 clients, if the 2 clients become connected, then the Activation counter is updated.
+*/
+void JackConnectionManager::IncDirectConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    int ref1 = GetOutputRefNum(port_src);
+    int ref2 = GetInputRefNum(port_dst);
+
+    assert(ref1 >= 0 && ref2 >= 0);
+
+    DirectConnect(ref1, ref2);
+    jack_log("JackConnectionManager::IncConnectionRef: ref1 = %ld ref2 = %ld", ref1, ref2);
+}
+
+/*!
+\brief Decrement the number of ports between 2 clients, if the 2 clients become disconnected, then the Activation counter is updated.
+*/
+void JackConnectionManager::DecDirectConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    int ref1 = GetOutputRefNum(port_src);
+    int ref2 = GetInputRefNum(port_dst);
+
+    assert(ref1 >= 0 && ref2 >= 0);
+
+    DirectDisconnect(ref1, ref2);
+    jack_log("JackConnectionManager::DecConnectionRef: ref1 = %ld ref2 = %ld", ref1, ref2);
+}
+
+/*!
+\brief Directly connect 2 reference numbers.
+*/
+void JackConnectionManager::DirectConnect(int ref1, int ref2)
+{
+    assert(ref1 >= 0 && ref2 >= 0);
+
+    if (fConnectionRef.IncItem(ref1, ref2) == 1) { // First connection between client ref1 and client ref2
+        jack_log("JackConnectionManager::DirectConnect first: ref1 = %ld ref2 = %ld", ref1, ref2);
+        fInputCounter[ref2].IncValue();
+    }
+}
+
+/*!
+\brief Directly disconnect 2 reference numbers.
+*/
+void JackConnectionManager::DirectDisconnect(int ref1, int ref2)
+{
+    assert(ref1 >= 0 && ref2 >= 0);
+
+    if (fConnectionRef.DecItem(ref1, ref2) == 0) { // Last connection between client ref1 and client ref2
+        jack_log("JackConnectionManager::DirectDisconnect last: ref1 = %ld ref2 = %ld", ref1, ref2);
+        fInputCounter[ref2].DecValue();
+    }
+}
+
+/*!
+\brief Returns the connections state between 2 refnum.
+*/
+bool JackConnectionManager::IsDirectConnection(int ref1, int ref2) const
+{
+    assert(ref1 >= 0 && ref2 >= 0);
+    return (fConnectionRef.GetItemCount(ref1, ref2) > 0);
+}
+
+/*!
+\brief Get the client refnum of a given input port.
+*/
+int JackConnectionManager::GetInputRefNum(jack_port_id_t port_index) const
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        if (fInputPort[i].CheckItem(port_index))
+            return i;
+    }
+
+    return -1;
+}
+
+/*!
+\brief Get the client refnum of a given ouput port.
+*/
+int JackConnectionManager::GetOutputRefNum(jack_port_id_t port_index) const
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        if (fOutputPort[i].CheckItem(port_index))
+            return i;
+    }
+
+    return -1;
+}
+
+/*!
+\brief Test is a connection path exists between port_src and port_dst.
+*/
+bool JackConnectionManager::IsLoopPath(jack_port_id_t port_src, jack_port_id_t port_dst) const
+{
+    return IsLoopPathAux(GetInputRefNum(port_dst), GetOutputRefNum(port_src));
+}
+
+bool JackConnectionManager::IsFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst) const
+{
+    return (fLoopFeedback.GetConnectionIndex(GetOutputRefNum(port_src), GetInputRefNum(port_dst)) >= 0);
+}
+
+bool JackConnectionManager::IncFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    int ref1 = GetOutputRefNum(port_src);
+    int ref2 = GetInputRefNum(port_dst);
+
+    // Add an activation connection in the other direction
+    jack_log("JackConnectionManager::IncFeedbackConnection ref1 = %ld ref2 = %ld", ref1, ref2);
+    assert(ref1 >= 0 && ref2 >= 0);
+
+    if (ref1 != ref2)
+        DirectConnect(ref2, ref1);
+
+    return fLoopFeedback.IncConnection(ref1, ref2); // Add the feedback connection
+}
+
+bool JackConnectionManager::DecFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    int ref1 = GetOutputRefNum(port_src);
+    int ref2 = GetInputRefNum(port_dst);
+
+    // Remove an activation connection in the other direction
+    jack_log("JackConnectionManager::DecFeedbackConnection ref1 = %ld ref2 = %ld", ref1, ref2);
+    assert(ref1 >= 0 && ref2 >= 0);
+
+    if (ref1 != ref2)
+        DirectDisconnect(ref2, ref1);
+
+    return fLoopFeedback.DecConnection(ref1, ref2); // Remove the feedback connection
+}
+
+} // end of namespace
+
+
diff --git a/common/JackConnectionManager.h b/common/JackConnectionManager.h
new file mode 100644
index 0000000..5d5b8c6
--- /dev/null
+++ b/common/JackConnectionManager.h
@@ -0,0 +1,470 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackConnectionManager__
+#define __JackConnectionManager__
+
+#include "JackConstants.h"
+#include "JackActivationCount.h"
+#include "JackError.h"
+#include "JackCompilerDeps.h"
+
+#include <assert.h>
+
+namespace Jack
+{
+
+struct JackClientControl;
+
+/*!
+\brief Utility class.
+*/
+
+template <int SIZE>
+class JackFixedArray
+{
+
+    private:
+
+        jack_int_t fTable[SIZE];
+        uint32_t fCounter;
+
+    public:
+
+        JackFixedArray()
+        {
+            Init();
+        }
+
+        void Init()
+        {
+            for (int i = 0; i < SIZE; i++)
+                fTable[i] = EMPTY;
+            fCounter = 0;
+        }
+
+        bool AddItem(jack_int_t index)
+        {
+            for (int i = 0; i < SIZE; i++) {
+                if (fTable[i] == EMPTY) {
+                    fTable[i] = index;
+                    fCounter++;
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        bool RemoveItem(jack_int_t index)
+        {
+            for (int i = 0; i < SIZE; i++) {
+                if (fTable[i] == index) {
+                    fCounter--;
+                    // Shift all indexes
+                    if (i == SIZE - 1) {
+                        fTable[i] = EMPTY;
+                    } else {
+                        int j;
+                        for (j = i; j <= SIZE - 2 && fTable[j] != EMPTY; j++) {
+                            fTable[j] = fTable[j + 1];
+                        }
+                        fTable[j] = EMPTY;
+                    }
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        jack_int_t GetItem(jack_int_t index) const
+        {
+            return (index < SIZE) ? fTable[index] : EMPTY;
+        }
+
+        const jack_int_t* GetItems() const
+        {
+            return fTable;
+        }
+
+        bool CheckItem(jack_int_t index) const
+        {
+            for (int i = 0; i < SIZE && fTable[i] != EMPTY; i++) {
+                if (fTable[i] == index)
+                    return true;
+            }
+            return false;
+        }
+
+        uint32_t GetItemCount() const
+        {
+            return fCounter;
+        }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Utility class.
+*/
+
+template <int SIZE>
+class JackFixedArray1 : public JackFixedArray<SIZE>
+{
+    private:
+
+        bool fUsed;
+
+    public:
+
+        JackFixedArray1()
+        {
+            Init();
+        }
+
+        void Init()
+        {
+            JackFixedArray<SIZE>::Init();
+            fUsed = false;
+        }
+
+        bool IsAvailable()
+        {
+            if (fUsed) {
+                return false;
+            } else {
+                fUsed = true;
+                return true;
+            }
+        }
+        
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Utility class.
+*/
+
+template <int SIZE>
+class JackFixedMatrix
+{
+    private:
+
+        jack_int_t fTable[SIZE][SIZE];
+
+    public:
+
+        JackFixedMatrix()
+        {}
+
+        void Init(jack_int_t index)
+        {
+            for (int i = 0; i < SIZE; i++) {
+                fTable[index][i] = 0;
+                fTable[i][index] = 0;
+            }
+        }
+
+        const jack_int_t* GetItems(jack_int_t index) const
+        {
+            return fTable[index];
+        }
+
+        jack_int_t IncItem(jack_int_t index1, jack_int_t index2)
+        {
+            fTable[index1][index2]++;
+            return fTable[index1][index2];
+        }
+
+        jack_int_t DecItem(jack_int_t index1, jack_int_t index2)
+        {
+            fTable[index1][index2]--;
+            return fTable[index1][index2];
+        }
+
+        jack_int_t GetItemCount(jack_int_t index1, jack_int_t index2) const
+        {
+            return fTable[index1][index2];
+        }
+
+        /*!
+        	\brief Get the output indexes of a given index.
+        */
+        void GetOutputTable(jack_int_t index, jack_int_t* output) const
+        {
+            int i, j;
+
+            for (i = 0; i < SIZE; i++)
+                output[i] = EMPTY;
+
+            for (i = 0, j = 0; i < SIZE; i++) {
+                if (fTable[index][i] > 0) {
+                    output[j] = i;
+                    j++;
+                }
+            }
+        }
+
+        bool IsInsideTable(jack_int_t index, jack_int_t* output) const
+        {
+            for (int i = 0; i < SIZE && output[i] != EMPTY; i++) {
+                if (output[i] == index)
+                    return true;
+            }
+            return false;
+        }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Utility class.
+*/
+
+template <int SIZE>
+class JackLoopFeedback
+{
+    private:
+
+        int fTable[SIZE][3];
+
+        /*!
+        	\brief Add a feedback connection between 2 refnum.
+        */
+        bool AddConnectionAux(int ref1, int ref2)
+        {
+            for (int i = 0; i < SIZE; i++) {
+                if (fTable[i][0] == EMPTY) {
+                    fTable[i][0] = ref1;
+                    fTable[i][1] = ref2;
+                    fTable[i][2] = 1;
+                    jack_log("JackLoopFeedback::AddConnectionAux ref1 = %ld ref2 = %ld", ref1, ref2);
+                    return true;
+                }
+            }
+            jack_error("Feedback table is full !!\n");
+            return false;
+        }
+
+        /*!
+        	\brief Remove a feedback connection between 2 refnum.
+        */
+        bool RemoveConnectionAux(int ref1, int ref2)
+        {
+            for (int i = 0; i < SIZE; i++) {
+                if (fTable[i][0] == ref1 && fTable[i][1] == ref2) {
+                    fTable[i][0] = EMPTY;
+                    fTable[i][1] = EMPTY;
+                    fTable[i][2] = 0;
+                    jack_log("JackLoopFeedback::RemoveConnectionAux ref1 = %ld ref2 = %ld", ref1, ref2);
+                    return true;
+                }
+            }
+            jack_error("Feedback connection not found\n");
+            return false;
+        }
+
+        int IncConnection(int index)
+        {
+            fTable[index][2]++;
+            return fTable[index][2];
+        }
+
+        int DecConnection(int index)
+        {
+            fTable[index][2]--;
+            return fTable[index][2];
+        }
+
+    public:
+
+        JackLoopFeedback()
+        {
+            Init();
+        }
+
+        void Init()
+        {
+            for (int i = 0; i < SIZE; i++) {
+                fTable[i][0] = EMPTY;
+                fTable[i][1] = EMPTY;
+                fTable[i][2] = 0;
+            }
+        }
+
+        bool IncConnection(int ref1, int ref2)
+        {
+            int index = GetConnectionIndex(ref1, ref2);
+
+            if (index >= 0) { // Feedback connection is already added, increment counter
+                IncConnection(index);
+                return true;
+            } else {
+                return AddConnectionAux(ref1, ref2); // Add the feedback connection
+            }
+        }
+
+        bool DecConnection(int ref1, int ref2)
+        {
+            int index = GetConnectionIndex(ref1, ref2);
+
+            if (index >= 0) {
+                jack_log("JackLoopFeedback::DecConnection ref1 = %ld ref2 = %ld index = %ld", ref1, ref2, index);
+                return (DecConnection(index) == 0) ? RemoveConnectionAux(ref1, ref2) : true;
+            } else {
+                return false;
+            }
+        }
+
+        /*!
+        	\brief Test if a connection between 2 refnum is a feedback connection.
+        */
+        int GetConnectionIndex(int ref1, int ref2) const
+        {
+            for (int i = 0; i < SIZE; i++) {
+                if (fTable[i][0] == ref1 && fTable[i][1] == ref2)
+                    return i;
+            }
+            return -1;
+        }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief For client timing measurements.
+*/
+
+struct JackClientTiming
+{
+    jack_time_t fSignaledAt;
+    jack_time_t fAwakeAt;
+    jack_time_t fFinishedAt;
+    jack_client_state_t fStatus;
+
+    JackClientTiming()
+    {
+        Init();
+    }
+    ~JackClientTiming()
+    {}
+    
+    void Init()
+    {
+        fSignaledAt = 0;
+        fAwakeAt = 0;
+        fFinishedAt = 0;
+        fStatus = NotTriggered;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Connection manager.
+
+<UL>
+<LI>The <B>fConnection</B> array contains the list (array line) of connected ports for a given port.
+<LI>The <B>fConnectionCount</B> array contains the number of connected ports to a given port.
+<LI>The <B>fInputPort</B> array contains the list (array line) of input connected  ports for a given client.
+<LI>The <B>fOutputPort</B> array contains the list (array line) of ouput connected  ports for a given client.
+<LI>The <B>fConnectionRef</B> array contains the number of ports connected between two clients.
+<LI>The <B>fInputRef</B> array contains the number of input clients connected to a given client.
+<LI>The <B>fInputCounter</B> array contains the number of input clients connected to a given for activation purpose.
+</UL>
+*/
+
+class SERVER_EXPORT JackConnectionManager
+{
+
+    private:
+
+        JackFixedArray<CONNECTION_NUM_FOR_PORT> fConnection[PORT_NUM_MAX];  /*! Connection matrix: list of connected ports for a given port: needed to compute Mix buffer */
+        JackFixedArray1<PORT_NUM_FOR_CLIENT> fInputPort[CLIENT_NUM];	/*! Table of input port per refnum : to find a refnum for a given port */
+        JackFixedArray<PORT_NUM_FOR_CLIENT> fOutputPort[CLIENT_NUM];	/*! Table of output port per refnum : to find a refnum for a given port */
+        JackFixedMatrix<CLIENT_NUM> fConnectionRef;						/*! Table of port connections by (refnum , refnum) */
+        JackActivationCount fInputCounter[CLIENT_NUM];					/*! Activation counter per refnum */
+        JackLoopFeedback<CONNECTION_NUM_FOR_PORT> fLoopFeedback;		/*! Loop feedback connections */
+
+        bool IsLoopPathAux(int ref1, int ref2) const;
+
+    public:
+
+        JackConnectionManager();
+        ~JackConnectionManager();
+
+        // Connections management
+        int Connect(jack_port_id_t port_src, jack_port_id_t port_dst);
+        int Disconnect(jack_port_id_t port_src, jack_port_id_t port_dst);
+        bool IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst) const;
+
+        /*!
+          \brief Get the connection number of a given port.
+        */
+        jack_int_t Connections(jack_port_id_t port_index) const
+        {
+            return fConnection[port_index].GetItemCount();
+        }
+
+        jack_port_id_t GetPort(jack_port_id_t port_index, int connection) const
+        {
+            assert(connection < CONNECTION_NUM_FOR_PORT);
+            return (jack_port_id_t)fConnection[port_index].GetItem(connection);
+        }
+
+        const jack_int_t* GetConnections(jack_port_id_t port_index) const;
+
+        bool IncFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst);
+        bool DecFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst);
+        bool IsFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst) const;
+
+        bool IsLoopPath(jack_port_id_t port_src, jack_port_id_t port_dst) const;
+        void IncDirectConnection(jack_port_id_t port_src, jack_port_id_t port_dst);
+        void DecDirectConnection(jack_port_id_t port_src, jack_port_id_t port_dst);
+
+        // Ports management
+        int AddInputPort(int refnum, jack_port_id_t port_index);
+        int AddOutputPort(int refnum, jack_port_id_t port_index);
+
+        int RemoveInputPort(int refnum, jack_port_id_t port_index);
+        int RemoveOutputPort(int refnum, jack_port_id_t port_index);
+
+        const jack_int_t* GetInputPorts(int refnum);
+        const jack_int_t* GetOutputPorts(int refnum);
+
+        // Client management
+        void InitRefNum(int refnum);
+        int GetInputRefNum(jack_port_id_t port_index) const;
+        int GetOutputRefNum(jack_port_id_t port_index) const;
+
+        // Connect/Disconnect 2 refnum "directly"
+        bool IsDirectConnection(int ref1, int ref2) const;
+        void DirectConnect(int ref1, int ref2);
+        void DirectDisconnect(int ref1, int ref2);
+
+        int GetActivation(int refnum) const
+        {
+            return fInputCounter[refnum].GetValue();
+        }
+
+        // Graph
+        void ResetGraph(JackClientTiming* timing);
+        int ResumeRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing);
+        int SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec);
+        
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackConstants.h b/common/JackConstants.h
new file mode 100644
index 0000000..60a631c
--- /dev/null
+++ b/common/JackConstants.h
@@ -0,0 +1,103 @@
+/*
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackConstants__
+#define __JackConstants__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define VERSION "1.9.5"
+
+#define BUFFER_SIZE_MAX 8192
+
+#define JACK_PORT_NAME_SIZE 256
+#define JACK_PORT_TYPE_SIZE 32
+
+#define JACK_CLIENT_NAME_SIZE 64
+#define JACK_MESSAGE_SIZE 256
+
+#ifndef PORT_NUM
+#define PORT_NUM 2048
+#endif
+
+#define PORT_NUM_MAX 4096           // The "max" value for ports used in connection manager, although port number in graph manager is dynamic
+
+#define DRIVER_PORT_NUM 256
+
+#ifndef PORT_NUM_FOR_CLIENT
+#define PORT_NUM_FOR_CLIENT 768
+#endif
+
+#define FIRST_AVAILABLE_PORT 1
+
+#define CONNECTION_NUM_FOR_PORT PORT_NUM_FOR_CLIENT
+
+#ifndef CLIENT_NUM
+#define CLIENT_NUM 64
+#endif
+
+#define AUDIO_DRIVER_REFNUM   0                 // Audio driver is initialized first, it will get the refnum 0
+#define FREEWHEEL_DRIVER_REFNUM   1             // Freewheel driver is initialized second, it will get the refnum 1
+
+#define JACK_DEFAULT_SERVER_NAME "default"
+
+#ifdef WIN32
+#define jack_server_dir "server"
+#define jack_client_dir "client"
+#define ADDON_DIR "jack"
+#endif
+
+#ifdef __APPLE__
+#define jack_server_dir "/tmp"
+#define jack_client_dir "/tmp"
+#define JACK_DEFAULT_DRIVER "coreaudio"
+#endif
+
+#ifdef __linux__
+#define jack_server_dir "/dev/shm"
+#define jack_client_dir "/dev/shm"
+#define JACK_DEFAULT_DRIVER "alsa"
+#endif
+
+#if defined(__sun__) || defined(sun)
+#define jack_server_dir "/tmp"
+#define jack_client_dir "/tmp"
+#define JACK_DEFAULT_DRIVER "oss"
+#endif
+
+#define jack_server_entry "jackdmp_entry"
+#define jack_client_entry "jack_client"
+
+#define ALL_CLIENTS -1 // for notification
+
+#define JACK_PROTOCOL_VERSION 7  
+
+#define SOCKET_TIME_OUT 5               // in sec
+#define DRIVER_OPEN_TIMEOUT 5           // in sec
+#define FREEWHEEL_DRIVER_TIMEOUT 10     // in sec
+#define DRIVER_TIMEOUT_FACTOR    10     
+
+#define NO_PORT   0xFFFE
+
+#define EMPTY   0xFFFD
+#define FREE	0xFFFC
+
+#endif
diff --git a/common/JackControlAPI.cpp b/common/JackControlAPI.cpp
new file mode 100644
index 0000000..f485020
--- /dev/null
+++ b/common/JackControlAPI.cpp
@@ -0,0 +1,1230 @@
+// u/* -*- Mode: C++ ; c-basic-offset: 4 -*- */
+/*
+  JACK control API implementation
+
+  Copyright (C) 2008 Nedko Arnaudov
+  Copyright (C) 2008 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef WIN32
+#include <stdint.h>
+#include <dirent.h>
+#include <pthread.h>
+#endif
+
+#include "types.h"
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <assert.h>
+#include <signal.h>
+
+#include "jslist.h"
+#include "driver_interface.h"
+#include "JackError.h"
+#include "JackServer.h"
+#include "shm.h"
+#include "JackTools.h"
+#include "JackControlAPI.h"
+#include "JackLockedEngine.h"
+#include "JackConstants.h"
+#include "JackDriverLoader.h"
+#include "JackServerGlobals.h"
+
+using namespace Jack;
+
+struct jackctl_server
+{
+    JSList * drivers;
+    JSList * internals;
+    JSList * parameters;
+
+    class JackServer * engine;
+
+    /* string, server name */
+    union jackctl_parameter_value name;
+    union jackctl_parameter_value default_name;
+
+    /* bool, whether to be "realtime" */
+    union jackctl_parameter_value realtime;
+    union jackctl_parameter_value default_realtime;
+
+    /* int32_t */
+    union jackctl_parameter_value realtime_priority;
+    union jackctl_parameter_value default_realtime_priority;
+
+    /* bool, whether to exit once all clients have closed their connections */
+    union jackctl_parameter_value temporary;
+    union jackctl_parameter_value default_temporary;
+
+    /* bool, whether to be verbose */
+    union jackctl_parameter_value verbose;
+    union jackctl_parameter_value default_verbose;
+
+    /* int32_t, msecs; if zero, use period size. */
+    union jackctl_parameter_value client_timeout;
+    union jackctl_parameter_value default_client_timeout;
+    
+    /* uint32_t, clock source type */
+    union jackctl_parameter_value clock_source;
+    union jackctl_parameter_value default_clock_source;
+   
+    /* uint32_t, max port number */
+    union jackctl_parameter_value port_max;
+    union jackctl_parameter_value default_port_max;
+    
+    /* bool */
+    union jackctl_parameter_value replace_registry;
+    union jackctl_parameter_value default_replace_registry;
+
+    /* bool, synchronous or asynchronous engine mode */
+    union jackctl_parameter_value sync;
+    union jackctl_parameter_value default_sync;
+};
+
+struct jackctl_driver
+{
+    jack_driver_desc_t * desc_ptr;
+    JSList * parameters;
+    JSList * set_parameters;
+    JackDriverInfo* info;
+};
+
+struct jackctl_internal
+{
+    jack_driver_desc_t * desc_ptr;
+    JSList * parameters;
+    JSList * set_parameters;
+    int refnum;
+};
+
+struct jackctl_parameter
+{
+    const char * name;
+    const char * short_description;
+    const char * long_description;
+    jackctl_param_type_t type;
+    bool is_set;
+    union jackctl_parameter_value * value_ptr;
+    union jackctl_parameter_value * default_value_ptr;
+
+    union jackctl_parameter_value value;
+    union jackctl_parameter_value default_value;
+    struct jackctl_driver * driver_ptr;
+    char id;
+    jack_driver_param_t * driver_parameter_ptr;
+    jack_driver_param_constraint_desc_t * constraint_ptr;
+};
+
+static
+struct jackctl_parameter *
+jackctl_add_parameter(
+    JSList ** parameters_list_ptr_ptr,
+    const char * name,
+    const char * short_description,
+    const char * long_description,
+    jackctl_param_type_t type,
+    union jackctl_parameter_value * value_ptr,
+    union jackctl_parameter_value * default_value_ptr,
+    union jackctl_parameter_value value,
+    jack_driver_param_constraint_desc_t * constraint_ptr = NULL)
+{
+    struct jackctl_parameter * parameter_ptr;
+
+    parameter_ptr = (struct jackctl_parameter *)malloc(sizeof(struct jackctl_parameter));
+    if (parameter_ptr == NULL)
+    {
+        jack_error("Cannot allocate memory for jackctl_parameter structure.");
+        goto fail;
+    }
+
+    parameter_ptr->name = name;
+    parameter_ptr->short_description = short_description;
+    parameter_ptr->long_description = long_description;
+    parameter_ptr->type = type;
+    parameter_ptr->is_set = false;
+
+    if (value_ptr == NULL)
+    {
+        value_ptr = &parameter_ptr->value;
+    }
+
+    if (default_value_ptr == NULL)
+    {
+        default_value_ptr = &parameter_ptr->default_value;
+    }
+
+    parameter_ptr->value_ptr = value_ptr;
+    parameter_ptr->default_value_ptr = default_value_ptr;
+
+    *value_ptr = *default_value_ptr = value;
+
+    parameter_ptr->driver_ptr = NULL;
+    parameter_ptr->driver_parameter_ptr = NULL;
+    parameter_ptr->id = 0;
+    parameter_ptr->constraint_ptr = constraint_ptr;
+
+    *parameters_list_ptr_ptr = jack_slist_append(*parameters_list_ptr_ptr, parameter_ptr);
+
+    return parameter_ptr;
+
+fail:
+    return NULL;
+}
+
+static
+void
+jackctl_free_driver_parameters(
+    struct jackctl_driver * driver_ptr)
+{
+    JSList * next_node_ptr;
+
+    while (driver_ptr->parameters)
+    {
+        next_node_ptr = driver_ptr->parameters->next;
+        free(driver_ptr->parameters->data);
+        free(driver_ptr->parameters);
+        driver_ptr->parameters = next_node_ptr;
+    }
+
+    while (driver_ptr->set_parameters)
+    {
+        next_node_ptr = driver_ptr->set_parameters->next;
+        free(driver_ptr->set_parameters->data);
+        free(driver_ptr->set_parameters);
+        driver_ptr->set_parameters = next_node_ptr;
+    }
+}
+
+static
+bool
+jackctl_add_driver_parameters(
+    struct jackctl_driver * driver_ptr)
+{
+    uint32_t i;
+    union jackctl_parameter_value jackctl_value;
+    jackctl_param_type_t jackctl_type;
+    struct jackctl_parameter * parameter_ptr;
+    jack_driver_param_desc_t * descriptor_ptr;
+
+    for (i = 0 ; i < driver_ptr->desc_ptr->nparams ; i++)
+    {
+        descriptor_ptr = driver_ptr->desc_ptr->params + i;
+
+        switch (descriptor_ptr->type)
+        {
+        case JackDriverParamInt:
+            jackctl_type = JackParamInt;
+            jackctl_value.i = descriptor_ptr->value.i;
+            break;
+        case JackDriverParamUInt:
+            jackctl_type = JackParamUInt;
+            jackctl_value.ui = descriptor_ptr->value.ui;
+            break;
+        case JackDriverParamChar:
+            jackctl_type = JackParamChar;
+            jackctl_value.c = descriptor_ptr->value.c;
+            break;
+        case JackDriverParamString:
+            jackctl_type = JackParamString;
+            strcpy(jackctl_value.str, descriptor_ptr->value.str);
+            break;
+        case JackDriverParamBool:
+            jackctl_type = JackParamBool;
+            jackctl_value.b = descriptor_ptr->value.i;
+            break;
+        default:
+            jack_error("unknown driver parameter type %i", (int)descriptor_ptr->type);
+            assert(0);
+            goto fail;
+        }
+
+        parameter_ptr = jackctl_add_parameter(
+            &driver_ptr->parameters,
+            descriptor_ptr->name,
+            descriptor_ptr->short_desc,
+            descriptor_ptr->long_desc,
+            jackctl_type,
+            NULL,
+            NULL,
+            jackctl_value,
+            descriptor_ptr->constraint);
+
+        if (parameter_ptr == NULL)
+        {
+            goto fail;
+        }
+
+        parameter_ptr->driver_ptr = driver_ptr;
+        parameter_ptr->id = descriptor_ptr->character;
+    }
+
+    return true;
+
+fail:
+    jackctl_free_driver_parameters(driver_ptr);
+
+    return false;
+}
+
+static int
+jackctl_drivers_load(
+    struct jackctl_server * server_ptr)
+{
+    struct jackctl_driver * driver_ptr;
+    JSList *node_ptr;
+    JSList *descriptor_node_ptr;
+
+    descriptor_node_ptr = jack_drivers_load(NULL);
+    if (descriptor_node_ptr == NULL)
+    {
+        jack_error("could not find any drivers in driver directory!");
+        return false;
+    }
+
+    while (descriptor_node_ptr != NULL)
+    {
+        driver_ptr = (struct jackctl_driver *)malloc(sizeof(struct jackctl_driver));
+        if (driver_ptr == NULL)
+        {
+            jack_error("memory allocation of jackctl_driver structure failed.");
+            goto next;
+        }
+
+        driver_ptr->desc_ptr = (jack_driver_desc_t *)descriptor_node_ptr->data;
+        driver_ptr->parameters = NULL;
+        driver_ptr->set_parameters = NULL;
+
+        if (!jackctl_add_driver_parameters(driver_ptr))
+        {
+            assert(driver_ptr->parameters == NULL);
+            free(driver_ptr);
+            goto next;
+        }
+
+        server_ptr->drivers = jack_slist_append(server_ptr->drivers, driver_ptr);
+
+    next:
+        node_ptr = descriptor_node_ptr;
+        descriptor_node_ptr = descriptor_node_ptr->next;
+        free(node_ptr);
+    }
+
+    return true;
+}
+
+static
+void
+jackctl_server_free_drivers(
+    struct jackctl_server * server_ptr)
+{
+    JSList * next_node_ptr;
+    struct jackctl_driver * driver_ptr;
+
+    while (server_ptr->drivers)
+    {
+        next_node_ptr = server_ptr->drivers->next;
+        driver_ptr = (struct jackctl_driver *)server_ptr->drivers->data;
+
+        jackctl_free_driver_parameters(driver_ptr);
+        free(driver_ptr->desc_ptr->params);
+        free(driver_ptr->desc_ptr);
+        free(driver_ptr);
+
+        free(server_ptr->drivers);
+        server_ptr->drivers = next_node_ptr;
+    }
+}
+
+static int
+jackctl_internals_load(
+    struct jackctl_server * server_ptr)
+{
+    struct jackctl_internal * internal_ptr;
+    JSList *node_ptr;
+    JSList *descriptor_node_ptr;
+
+    descriptor_node_ptr = jack_internals_load(NULL);
+    if (descriptor_node_ptr == NULL)
+    {
+        jack_error("could not find any internals in driver directory!");
+        return false;
+    }
+
+    while (descriptor_node_ptr != NULL)
+    {     
+        internal_ptr = (struct jackctl_internal *)malloc(sizeof(struct jackctl_internal));
+        if (internal_ptr == NULL)
+        {
+            jack_error("memory allocation of jackctl_driver structure failed.");
+            goto next;
+        }
+
+        internal_ptr->desc_ptr = (jack_driver_desc_t *)descriptor_node_ptr->data;
+        internal_ptr->parameters = NULL;
+        internal_ptr->set_parameters = NULL;
+
+        if (!jackctl_add_driver_parameters((struct jackctl_driver *)internal_ptr))
+        {
+            assert(internal_ptr->parameters == NULL);
+            free(internal_ptr);
+            goto next;
+        }
+
+        server_ptr->internals = jack_slist_append(server_ptr->internals, internal_ptr);
+
+    next:
+        node_ptr = descriptor_node_ptr;
+        descriptor_node_ptr = descriptor_node_ptr->next;
+        free(node_ptr);
+    }
+
+    return true;
+}
+
+static
+void
+jackctl_server_free_internals(
+    struct jackctl_server * server_ptr)
+{
+    JSList * next_node_ptr;
+    struct jackctl_internal * internal_ptr;
+
+    while (server_ptr->internals)
+    {
+        next_node_ptr = server_ptr->internals->next;
+        internal_ptr = (struct jackctl_internal *)server_ptr->internals->data;
+
+        jackctl_free_driver_parameters((struct jackctl_driver *)internal_ptr);
+        free(internal_ptr->desc_ptr->params);
+        free(internal_ptr->desc_ptr);
+        free(internal_ptr);
+
+        free(server_ptr->internals);
+        server_ptr->internals = next_node_ptr;
+    }
+}
+
+static
+void
+jackctl_server_free_parameters(
+    struct jackctl_server * server_ptr)
+{
+    JSList * next_node_ptr;
+
+    while (server_ptr->parameters)
+    {
+        next_node_ptr = server_ptr->parameters->next;
+        free(server_ptr->parameters->data);
+        free(server_ptr->parameters);
+        server_ptr->parameters = next_node_ptr;
+    }
+}
+
+#ifdef WIN32
+
+static HANDLE waitEvent;
+
+static void do_nothing_handler(int signum)
+{
+    printf("jack main caught signal %d\n", signum);
+    (void) signal(SIGINT, SIG_DFL);
+    SetEvent(waitEvent);
+}
+
+sigset_t
+jackctl_setup_signals(
+    unsigned int flags)
+{
+	if ((waitEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) {
+        jack_error("CreateEvent fails err = %ld", GetLastError());
+        return 0;
+    }
+
+	(void) signal(SIGINT, do_nothing_handler);
+    (void) signal(SIGABRT, do_nothing_handler);
+    (void) signal(SIGTERM, do_nothing_handler);
+
+	return (sigset_t)waitEvent;
+}
+
+void jackctl_wait_signals(sigset_t signals)
+{
+	if (WaitForSingleObject(waitEvent, INFINITE) != WAIT_OBJECT_0) {
+        jack_error("WaitForSingleObject fails err = %ld", GetLastError());
+    }
+}
+
+#else
+
+static
+void
+do_nothing_handler(int sig)
+{
+    /* this is used by the child (active) process, but it never
+       gets called unless we are already shutting down after
+       another signal.
+    */
+    char buf[64];
+    snprintf (buf, sizeof(buf), "received signal %d during shutdown (ignored)\n", sig);
+}
+
+EXPORT sigset_t
+jackctl_setup_signals(
+    unsigned int flags)
+{
+    sigset_t signals;
+    sigset_t allsignals;
+    struct sigaction action;
+    int i;
+
+    /* ensure that we are in our own process group so that
+       kill (SIG, -pgrp) does the right thing.
+    */
+
+    setsid();
+
+    pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
+    /* what's this for?
+
+       POSIX says that signals are delivered like this:
+
+       * if a thread has blocked that signal, it is not
+           a candidate to receive the signal.
+           * of all threads not blocking the signal, pick
+           one at random, and deliver the signal.
+
+           this means that a simple-minded multi-threaded program can
+           expect to get POSIX signals delivered randomly to any one
+           of its threads,
+
+       here, we block all signals that we think we might receive
+       and want to catch. all "child" threads will inherit this
+       setting. if we create a thread that calls sigwait() on the
+       same set of signals, implicitly unblocking all those
+       signals. any of those signals that are delivered to the
+       process will be delivered to that thread, and that thread
+       alone. this makes cleanup for a signal-driven exit much
+       easier, since we know which thread is doing it and more
+       importantly, we are free to call async-unsafe functions,
+       because the code is executing in normal thread context
+       after a return from sigwait().
+    */
+
+    sigemptyset(&signals);
+    sigaddset(&signals, SIGHUP);
+    sigaddset(&signals, SIGINT);
+    sigaddset(&signals, SIGQUIT);
+    sigaddset(&signals, SIGPIPE);
+    sigaddset(&signals, SIGTERM);
+    sigaddset(&signals, SIGUSR1);
+    sigaddset(&signals, SIGUSR2);
+
+    /* all child threads will inherit this mask unless they
+     * explicitly reset it
+     */
+
+     pthread_sigmask(SIG_BLOCK, &signals, 0);
+
+    /* install a do-nothing handler because otherwise pthreads
+       behaviour is undefined when we enter sigwait.
+    */
+
+    sigfillset(&allsignals);
+    action.sa_handler = do_nothing_handler;
+    action.sa_mask = allsignals;
+    action.sa_flags = SA_RESTART|SA_RESETHAND;
+
+    for (i = 1; i < NSIG; i++)
+    {
+        if (sigismember (&signals, i))
+        {
+            sigaction(i, &action, 0);
+        }
+    }
+
+    return signals;
+}
+
+EXPORT void
+jackctl_wait_signals(sigset_t signals)
+{
+    int sig;
+    bool waiting = true;
+
+    while (waiting) {
+    #if defined(sun) && !defined(__sun__) // SUN compiler only, to check
+        sigwait(&signals);
+    #else
+        sigwait(&signals, &sig);
+    #endif
+        fprintf(stderr, "jack main caught signal %d\n", sig);
+
+        switch (sig) {
+            case SIGUSR1:
+                //jack_dump_configuration(engine, 1);
+                break;
+            case SIGUSR2:
+                // driver exit
+                waiting = false;
+                break;
+            case SIGTTOU:
+                break;
+            default:
+                waiting = false;
+                break;
+        }
+    }
+
+    if (sig != SIGSEGV) {
+        // unblock signals so we can see them during shutdown.
+        // this will help prod developers not to lose sight of
+        // bugs that cause segfaults etc. during shutdown.
+        sigprocmask(SIG_UNBLOCK, &signals, 0);
+    }
+}
+#endif
+
+static
+jack_driver_param_constraint_desc_t *
+get_realtime_priority_constraint()
+{
+    jack_driver_param_constraint_desc_t * constraint_ptr;
+    int min, max;
+
+    if (!jack_get_thread_realtime_priority_range(&min, &max))
+    {
+        return NULL;
+    }
+
+    //jack_info("realtime priority range is (%d,%d)", min, max);
+
+    constraint_ptr = (jack_driver_param_constraint_desc_t *)calloc(1, sizeof(jack_driver_param_value_enum_t));
+    if (constraint_ptr == NULL)
+    {
+        jack_error("Cannot allocate memory for jack_driver_param_constraint_desc_t structure.");
+        return NULL;
+    }
+    constraint_ptr->flags = JACK_CONSTRAINT_FLAG_RANGE;
+
+    constraint_ptr->constraint.range.min.i = min;
+    constraint_ptr->constraint.range.max.i = max;
+
+    return constraint_ptr;
+}
+
+EXPORT jackctl_server_t * jackctl_server_create(
+    bool (* on_device_acquire)(const char * device_name),
+    void (* on_device_release)(const char * device_name))
+{
+    struct jackctl_server * server_ptr;
+    union jackctl_parameter_value value;
+
+    server_ptr = (struct jackctl_server *)malloc(sizeof(struct jackctl_server));
+    if (server_ptr == NULL)
+    {
+        jack_error("Cannot allocate memory for jackctl_server structure.");
+        goto fail;
+    }
+
+    server_ptr->drivers = NULL;
+    server_ptr->internals = NULL;
+    server_ptr->parameters = NULL;
+    server_ptr->engine = NULL;
+
+    strcpy(value.str, JACK_DEFAULT_SERVER_NAME);
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "name",
+            "Server name to use.",
+            "",
+            JackParamString,
+            &server_ptr->name,
+            &server_ptr->default_name,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.b = false;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "realtime",
+            "Whether to use realtime mode.",
+            "Use realtime scheduling. This is needed for reliable low-latency performance. On most systems, it requires JACK to run with special scheduler and memory allocation privileges, which may be obtained in several ways. On Linux you should use PAM.",
+            JackParamBool,
+            &server_ptr->realtime,
+            &server_ptr->default_realtime,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.i = 10;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "realtime-priority",
+            "Scheduler priority when running in realtime mode.",
+            "",
+            JackParamInt,
+            &server_ptr->realtime_priority,
+            &server_ptr->default_realtime_priority,
+            value,
+            get_realtime_priority_constraint()) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.b = false;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "temporary",
+            "Exit once all clients have closed their connections.",
+            "",
+            JackParamBool,
+            &server_ptr->temporary,
+            &server_ptr->default_temporary,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.b = false;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "verbose",
+            "Verbose mode.",
+            "",
+            JackParamBool,
+            &server_ptr->verbose,
+            &server_ptr->default_verbose,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.i = 0;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "client-timeout",
+            "Client timeout limit in milliseconds.",
+            "",
+            JackParamInt,
+            &server_ptr->client_timeout,
+            &server_ptr->default_client_timeout,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.ui = 0;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "clock-source",
+            "Clocksource type : c(ycle) | h(pet) | s(ystem).",
+            "",
+            JackParamUInt,
+            &server_ptr->clock_source,
+            &server_ptr->default_clock_source,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+    
+    value.ui = PORT_NUM;
+    if (jackctl_add_parameter(
+          &server_ptr->parameters,
+          "port-max",
+          "Maximum number of ports.",
+          "",
+          JackParamUInt,
+          &server_ptr->port_max,
+          &server_ptr->default_port_max,
+          value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.b = false;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "replace-registry",
+            "Replace shared memory registry.",
+            "",
+            JackParamBool,
+            &server_ptr->replace_registry,
+            &server_ptr->default_replace_registry,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    value.b = false;
+    if (jackctl_add_parameter(
+            &server_ptr->parameters,
+            "sync",
+            "Use server synchronous mode.",
+            "",
+            JackParamBool,
+            &server_ptr->sync,
+            &server_ptr->default_sync,
+            value) == NULL)
+    {
+        goto fail_free_parameters;
+    }
+
+    JackServerGlobals::on_device_acquire = on_device_acquire;
+    JackServerGlobals::on_device_release = on_device_release;
+
+    if (!jackctl_drivers_load(server_ptr))
+    {
+        goto fail_free_parameters;
+    }
+    
+    /* Allowed to fail */
+    jackctl_internals_load(server_ptr);
+
+    return server_ptr;
+
+fail_free_parameters:
+    jackctl_server_free_parameters(server_ptr);
+
+    free(server_ptr);
+
+fail:
+    return NULL;
+}
+
+EXPORT void jackctl_server_destroy(jackctl_server *server_ptr)
+{
+    jackctl_server_free_drivers(server_ptr);
+    jackctl_server_free_internals(server_ptr);
+    jackctl_server_free_parameters(server_ptr);
+    free(server_ptr);
+}
+
+EXPORT const JSList * jackctl_server_get_drivers_list(jackctl_server *server_ptr)
+{
+    return server_ptr->drivers;
+}
+
+EXPORT bool jackctl_server_stop(jackctl_server *server_ptr)
+{
+    server_ptr->engine->Stop();
+    server_ptr->engine->Close();
+    delete server_ptr->engine;
+
+    /* clean up shared memory and files from this server instance */
+    jack_log("cleaning up shared memory");
+
+    jack_cleanup_shm();
+
+    jack_log("cleaning up files");
+
+    JackTools::CleanupFiles(server_ptr->name.str);
+
+    jack_log("unregistering server `%s'", server_ptr->name.str);
+
+    jack_unregister_server(server_ptr->name.str);
+
+    server_ptr->engine = NULL;
+
+    return true;
+}
+
+EXPORT const JSList * jackctl_server_get_parameters(jackctl_server *server_ptr)
+{
+    return server_ptr->parameters;
+}
+
+EXPORT bool
+jackctl_server_start(
+    jackctl_server *server_ptr,
+    jackctl_driver *driver_ptr)
+{
+    int rc;
+
+    rc = jack_register_server(server_ptr->name.str, server_ptr->replace_registry.b);
+    switch (rc)
+    {
+    case EEXIST:
+        jack_error("`%s' server already active", server_ptr->name.str);
+        goto fail;
+    case ENOSPC:
+        jack_error("too many servers already active");
+        goto fail;
+    case ENOMEM:
+        jack_error("no access to shm registry");
+        goto fail;
+    }
+
+    jack_log("server `%s' registered", server_ptr->name.str);
+
+    /* clean up shared memory and files from any previous
+     * instance of this server name */
+    jack_cleanup_shm();
+    JackTools::CleanupFiles(server_ptr->name.str);
+
+    if (!server_ptr->realtime.b && server_ptr->client_timeout.i == 0)
+        server_ptr->client_timeout.i = 500; /* 0.5 sec; usable when non realtime. */
+    
+    /* check port max value before allocating server */
+    if (server_ptr->port_max.ui > PORT_NUM_MAX) {
+        jack_error("JACK server started with too much ports %d (when port max can be %d)", server_ptr->port_max.ui, PORT_NUM_MAX);
+        goto fail;
+    }
+
+    /* get the engine/driver started */
+    server_ptr->engine = new JackServer(
+        server_ptr->sync.b,
+        server_ptr->temporary.b,
+        server_ptr->client_timeout.i,
+        server_ptr->realtime.b,
+        server_ptr->realtime_priority.i,
+        server_ptr->port_max.ui,                                
+        server_ptr->verbose.b,
+        (jack_timer_type_t)server_ptr->clock_source.ui,
+        server_ptr->name.str);
+    if (server_ptr->engine == NULL)
+    {
+        jack_error("Failed to create new JackServer object");
+        goto fail_unregister;
+    }
+
+    rc = server_ptr->engine->Open(driver_ptr->desc_ptr, driver_ptr->set_parameters);
+    if (rc < 0)
+    {
+        jack_error("JackServer::Open() failed with %d", rc);
+        goto fail_delete;
+    }
+
+    rc = server_ptr->engine->Start();
+    if (rc < 0)
+    {
+        jack_error("JackServer::Start() failed with %d", rc);
+        goto fail_close;
+    }
+
+    return true;
+
+fail_close:
+    server_ptr->engine->Close();
+
+fail_delete:
+    delete server_ptr->engine;
+    server_ptr->engine = NULL;
+
+fail_unregister:
+    jack_log("cleaning up shared memory");
+
+    jack_cleanup_shm();
+
+    jack_log("cleaning up files");
+
+    JackTools::CleanupFiles(server_ptr->name.str);
+
+    jack_log("unregistering server `%s'", server_ptr->name.str);
+
+    jack_unregister_server(server_ptr->name.str);
+
+fail:
+    return false;
+}
+
+EXPORT const char * jackctl_driver_get_name(jackctl_driver *driver_ptr)
+{
+    return driver_ptr->desc_ptr->name;
+}
+
+EXPORT const JSList * jackctl_driver_get_parameters(jackctl_driver *driver_ptr)
+{
+    return driver_ptr->parameters;
+}
+
+EXPORT jack_driver_desc_t * jackctl_driver_get_desc(jackctl_driver *driver_ptr)
+{
+    return driver_ptr->desc_ptr;
+}
+
+EXPORT const char * jackctl_parameter_get_name(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->name;
+}
+
+EXPORT const char * jackctl_parameter_get_short_description(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->short_description;
+}
+
+EXPORT const char * jackctl_parameter_get_long_description(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->long_description;
+}
+
+EXPORT bool jackctl_parameter_has_range_constraint(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->constraint_ptr != NULL && (parameter_ptr->constraint_ptr->flags & JACK_CONSTRAINT_FLAG_RANGE) != 0;
+}
+
+EXPORT bool jackctl_parameter_has_enum_constraint(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->constraint_ptr != NULL && (parameter_ptr->constraint_ptr->flags & JACK_CONSTRAINT_FLAG_RANGE) == 0;
+}
+
+EXPORT uint32_t jackctl_parameter_get_enum_constraints_count(jackctl_parameter *parameter_ptr)
+{
+    if (!jackctl_parameter_has_enum_constraint(parameter_ptr))
+    {
+        return 0;
+    }
+
+    return parameter_ptr->constraint_ptr->constraint.enumeration.count;
+}
+
+EXPORT union jackctl_parameter_value jackctl_parameter_get_enum_constraint_value(jackctl_parameter *parameter_ptr, uint32_t index)
+{
+    jack_driver_param_value_t * value_ptr;
+    union jackctl_parameter_value jackctl_value;
+
+    value_ptr = &parameter_ptr->constraint_ptr->constraint.enumeration.possible_values_array[index].value;
+
+    switch (parameter_ptr->type)
+    {
+    case JackParamInt:
+        jackctl_value.i = value_ptr->i;
+        break;
+    case JackParamUInt:
+        jackctl_value.ui = value_ptr->ui;
+        break;
+    case JackParamChar:
+        jackctl_value.c = value_ptr->c;
+        break;
+    case JackParamString:
+        strcpy(jackctl_value.str, value_ptr->str);
+        break;
+    default:
+        jack_error("bad driver parameter type %i (enum constraint)", (int)parameter_ptr->type);
+        assert(0);
+    }
+
+    return jackctl_value;
+}
+
+EXPORT const char * jackctl_parameter_get_enum_constraint_description(jackctl_parameter *parameter_ptr, uint32_t index)
+{
+    return parameter_ptr->constraint_ptr->constraint.enumeration.possible_values_array[index].short_desc;
+}
+
+EXPORT void jackctl_parameter_get_range_constraint(jackctl_parameter *parameter_ptr, union jackctl_parameter_value * min_ptr, union jackctl_parameter_value * max_ptr)
+{
+    switch (parameter_ptr->type)
+    {
+    case JackParamInt:
+        min_ptr->i = parameter_ptr->constraint_ptr->constraint.range.min.i;
+        max_ptr->i = parameter_ptr->constraint_ptr->constraint.range.max.i;
+        return;
+    case JackParamUInt:
+        min_ptr->ui = parameter_ptr->constraint_ptr->constraint.range.min.ui;
+        max_ptr->ui = parameter_ptr->constraint_ptr->constraint.range.max.ui;
+        return;
+    default:
+        jack_error("bad driver parameter type %i (range constraint)", (int)parameter_ptr->type);
+        assert(0);
+    }
+}
+
+EXPORT bool jackctl_parameter_constraint_is_strict(jackctl_parameter_t * parameter_ptr)
+{
+    return parameter_ptr->constraint_ptr != NULL && (parameter_ptr->constraint_ptr->flags & JACK_CONSTRAINT_FLAG_STRICT) != 0;
+}
+
+EXPORT bool jackctl_parameter_constraint_is_fake_value(jackctl_parameter_t * parameter_ptr)
+{
+    return parameter_ptr->constraint_ptr != NULL && (parameter_ptr->constraint_ptr->flags & JACK_CONSTRAINT_FLAG_FAKE_VALUE) != 0;
+}
+
+EXPORT jackctl_param_type_t jackctl_parameter_get_type(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->type;
+}
+
+EXPORT char jackctl_parameter_get_id(jackctl_parameter_t * parameter_ptr)
+{
+    return parameter_ptr->id;
+}
+
+EXPORT bool jackctl_parameter_is_set(jackctl_parameter *parameter_ptr)
+{
+    return parameter_ptr->is_set;
+}
+
+EXPORT union jackctl_parameter_value jackctl_parameter_get_value(jackctl_parameter *parameter_ptr)
+{
+    return *parameter_ptr->value_ptr;
+}
+
+EXPORT bool jackctl_parameter_reset(jackctl_parameter *parameter_ptr)
+{
+    if (!parameter_ptr->is_set)
+    {
+        return true;
+    }
+
+    parameter_ptr->is_set = false;
+
+    *parameter_ptr->value_ptr = *parameter_ptr->default_value_ptr;
+
+    return true;
+}
+
+EXPORT bool jackctl_parameter_set_value(jackctl_parameter *parameter_ptr, const union jackctl_parameter_value * value_ptr)
+{
+    bool new_driver_parameter;
+
+    /* for driver parameters, set the parameter by adding jack_driver_param_t in the set_parameters list */
+    if (parameter_ptr->driver_ptr != NULL)
+    {
+/*      jack_info("setting driver parameter %p ...", parameter_ptr); */
+        new_driver_parameter = parameter_ptr->driver_parameter_ptr == NULL;
+        if (new_driver_parameter)
+        {
+/*          jack_info("new driver parameter..."); */
+            parameter_ptr->driver_parameter_ptr = (jack_driver_param_t *)malloc(sizeof(jack_driver_param_t));
+            if (parameter_ptr->driver_parameter_ptr == NULL)
+            {
+                jack_error ("Allocation of jack_driver_param_t structure failed");
+                return false;
+            }
+
+           parameter_ptr->driver_parameter_ptr->character = parameter_ptr->id;
+           parameter_ptr->driver_ptr->set_parameters = jack_slist_append(parameter_ptr->driver_ptr->set_parameters, parameter_ptr->driver_parameter_ptr);
+        }
+
+        switch (parameter_ptr->type)
+        {
+        case JackParamInt:
+            parameter_ptr->driver_parameter_ptr->value.i = value_ptr->i;
+            break;
+        case JackParamUInt:
+            parameter_ptr->driver_parameter_ptr->value.ui = value_ptr->ui;
+            break;
+        case JackParamChar:
+            parameter_ptr->driver_parameter_ptr->value.c = value_ptr->c;
+            break;
+        case JackParamString:
+            strcpy(parameter_ptr->driver_parameter_ptr->value.str, value_ptr->str);
+            break;
+        case JackParamBool:
+            parameter_ptr->driver_parameter_ptr->value.i = value_ptr->b;
+            break;
+        default:
+            jack_error("unknown parameter type %i", (int)parameter_ptr->type);
+            assert(0);
+
+            if (new_driver_parameter)
+            {
+                parameter_ptr->driver_ptr->set_parameters = jack_slist_remove(parameter_ptr->driver_ptr->set_parameters, parameter_ptr->driver_parameter_ptr);
+            }
+
+            return false;
+        }
+    }
+
+    parameter_ptr->is_set = true;
+    *parameter_ptr->value_ptr = *value_ptr;
+
+    return true;
+}
+
+EXPORT union jackctl_parameter_value jackctl_parameter_get_default_value(jackctl_parameter *parameter_ptr)
+{
+    return *parameter_ptr->default_value_ptr;
+}
+
+// Internals clients
+
+EXPORT const JSList * jackctl_server_get_internals_list(jackctl_server *server_ptr)
+{
+    return server_ptr->internals;
+}
+
+EXPORT const char * jackctl_internal_get_name(jackctl_internal *internal_ptr)
+{
+    return internal_ptr->desc_ptr->name;
+}
+
+EXPORT const JSList * jackctl_internal_get_parameters(jackctl_internal *internal_ptr)
+{
+    return internal_ptr->parameters;
+}
+
+EXPORT bool jackctl_server_load_internal(
+    jackctl_server * server_ptr,
+    jackctl_internal * internal)
+{
+    int status;
+    if (server_ptr->engine != NULL) {
+        server_ptr->engine->InternalClientLoad(internal->desc_ptr->name, internal->desc_ptr->name, internal->set_parameters, JackNullOption, &internal->refnum, &status);
+        return (internal->refnum > 0);
+    } else {
+        return false;
+    }
+}
+
+EXPORT bool jackctl_server_unload_internal(
+    jackctl_server * server_ptr,
+    jackctl_internal * internal)
+{
+    int status;
+    if (server_ptr->engine != NULL && internal->refnum > 0) {
+        return ((server_ptr->engine->GetEngine()->InternalClientUnload(internal->refnum, &status)) == 0);
+    } else {
+        return false;
+    }
+}
+
+EXPORT bool jackctl_server_add_slave(jackctl_server * server_ptr, jackctl_driver * driver_ptr)
+{
+    if (server_ptr->engine != NULL) {
+        driver_ptr->info = server_ptr->engine->AddSlave(driver_ptr->desc_ptr, driver_ptr->set_parameters);
+        return (driver_ptr->info != 0);
+    } else {
+        return false;
+    }
+}
+
+EXPORT bool jackctl_server_remove_slave(jackctl_server * server_ptr, jackctl_driver * driver_ptr)
+{
+    if (server_ptr->engine != NULL) {
+        server_ptr->engine->RemoveSlave(driver_ptr->info);
+        delete driver_ptr->info;
+        return true;
+    } else {
+        return false;
+    }
+}
+
+EXPORT bool jackctl_server_switch_master(jackctl_server * server_ptr, jackctl_driver * driver_ptr)
+{
+    if (server_ptr->engine != NULL) {
+        return (server_ptr->engine->SwitchMaster(driver_ptr->desc_ptr, driver_ptr->set_parameters) == 0);
+    } else {
+        return false;
+    }
+}
+
diff --git a/common/JackControlAPI.h b/common/JackControlAPI.h
new file mode 100644
index 0000000..cc07dca
--- /dev/null
+++ b/common/JackControlAPI.h
@@ -0,0 +1,242 @@
+/*
+  JACK control API
+
+  Copyright (C) 2008 Nedko Arnaudov
+  Copyright (C) 2008 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackControlAPI__
+#define __JackControlAPI__
+
+#include "jslist.h"
+#include "JackCompilerDeps.h"
+
+#ifdef WIN32
+#ifdef __MINGW32__
+#include <sys/types.h>
+#else
+typedef HANDLE sigset_t;
+#endif
+#endif
+
+/** Parameter types, intentionally similar to jack_driver_param_type_t */
+typedef enum
+{
+    JackParamInt = 1,			/**< @brief value type is a signed integer */
+    JackParamUInt,				/**< @brief value type is an unsigned integer */
+    JackParamChar,				/**< @brief value type is a char */
+    JackParamString,			/**< @brief value type is a string with max size of ::JACK_PARAM_STRING_MAX+1 chars */
+    JackParamBool,				/**< @brief value type is a boolean */
+} jackctl_param_type_t;
+
+/** @brief Max value that jackctl_param_type_t type can have */
+#define JACK_PARAM_MAX (JackParamBool + 1)
+
+/** @brief Max length of string parameter value, excluding terminating nul char */
+#define JACK_PARAM_STRING_MAX  63
+
+/** @brief Type for parameter value */
+/* intentionally similar to jack_driver_param_value_t */
+union jackctl_parameter_value
+{
+    uint32_t ui;				/**< @brief member used for ::JackParamUInt */
+    int32_t i;					/**< @brief member used for ::JackParamInt */
+    char c;						/**< @brief member used for ::JackParamChar */
+    char str[JACK_PARAM_STRING_MAX + 1]; /**< @brief member used for ::JackParamString */
+    bool b;				/**< @brief member used for ::JackParamBool */
+};
+
+/** opaque type for server object */
+typedef struct jackctl_server jackctl_server_t;
+
+/** opaque type for driver object */
+typedef struct jackctl_driver jackctl_driver_t;
+
+/** opaque type for internal client object */
+typedef struct jackctl_internal jackctl_internal_t;
+
+/** opaque type for parameter object */
+typedef struct jackctl_parameter jackctl_parameter_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+} /* Adjust editor indent */
+#endif
+
+EXPORT sigset_t
+jackctl_setup_signals(
+    unsigned int flags);
+
+EXPORT void
+jackctl_wait_signals(
+    sigset_t signals);
+
+EXPORT jackctl_server_t *
+jackctl_server_create(
+    bool (* on_device_acquire)(const char * device_name),
+    void (* on_device_release)(const char * device_name));
+
+EXPORT void
+jackctl_server_destroy(
+	jackctl_server_t * server);
+
+EXPORT const JSList *
+jackctl_server_get_drivers_list(
+	jackctl_server_t * server);
+
+EXPORT bool
+jackctl_server_start(
+    jackctl_server_t * server,
+    jackctl_driver_t * driver);
+
+EXPORT bool
+jackctl_server_stop(
+	jackctl_server_t * server);
+
+EXPORT const JSList *
+jackctl_server_get_parameters(
+	jackctl_server_t * server);
+
+EXPORT const char *
+jackctl_driver_get_name(
+	jackctl_driver_t * driver);
+
+EXPORT const JSList *
+jackctl_driver_get_parameters(
+	jackctl_driver_t * driver);
+
+EXPORT const char *
+jackctl_parameter_get_name(
+	jackctl_parameter_t * parameter);
+
+EXPORT const char *
+jackctl_parameter_get_short_description(
+	jackctl_parameter_t * parameter);
+
+EXPORT const char *
+jackctl_parameter_get_long_description(
+	jackctl_parameter_t * parameter);
+
+EXPORT jackctl_param_type_t
+jackctl_parameter_get_type(
+	jackctl_parameter_t * parameter);
+
+EXPORT char
+jackctl_parameter_get_id(
+	jackctl_parameter_t * parameter);
+
+EXPORT bool
+jackctl_parameter_is_set(
+	jackctl_parameter_t * parameter);
+
+EXPORT bool
+jackctl_parameter_reset(
+	jackctl_parameter_t * parameter);
+
+EXPORT union jackctl_parameter_value
+jackctl_parameter_get_value(
+	jackctl_parameter_t * parameter);
+
+EXPORT bool
+jackctl_parameter_set_value(
+	jackctl_parameter_t * parameter,
+	const union jackctl_parameter_value * value_ptr);
+
+EXPORT union jackctl_parameter_value
+jackctl_parameter_get_default_value(
+	jackctl_parameter_t * parameter);
+    
+EXPORT union jackctl_parameter_value 
+jackctl_parameter_get_default_value(
+    jackctl_parameter *parameter_ptr);
+    
+EXPORT bool
+jackctl_parameter_has_range_constraint(
+	jackctl_parameter_t * parameter_ptr);
+
+EXPORT bool
+jackctl_parameter_has_enum_constraint(
+	jackctl_parameter_t * parameter_ptr);
+
+EXPORT uint32_t
+jackctl_parameter_get_enum_constraints_count(
+	jackctl_parameter_t * parameter_ptr);
+
+EXPORT union jackctl_parameter_value
+jackctl_parameter_get_enum_constraint_value(
+	jackctl_parameter_t * parameter_ptr,
+	uint32_t index);
+
+EXPORT const char *
+jackctl_parameter_get_enum_constraint_description(
+	jackctl_parameter_t * parameter_ptr,
+	uint32_t index);
+
+EXPORT void
+jackctl_parameter_get_range_constraint(
+	jackctl_parameter_t * parameter_ptr,
+	union jackctl_parameter_value * min_ptr,
+	union jackctl_parameter_value * max_ptr);
+
+EXPORT bool
+jackctl_parameter_constraint_is_strict(
+	jackctl_parameter_t * parameter_ptr);
+
+EXPORT bool
+jackctl_parameter_constraint_is_fake_value(
+	jackctl_parameter_t * parameter_ptr);
+
+EXPORT const JSList * 
+jackctl_server_get_internals_list(
+    jackctl_server *server_ptr);
+    
+EXPORT const char * 
+jackctl_internal_get_name(
+    jackctl_internal *internal_ptr);
+    
+EXPORT const JSList * 
+jackctl_internal_get_parameters(
+    jackctl_internal *internal_ptr);
+    
+EXPORT bool jackctl_server_load_internal(
+    jackctl_server * server,
+    jackctl_internal * internal);
+    
+EXPORT bool jackctl_server_unload_internal(
+    jackctl_server * server,
+    jackctl_internal * internal);
+    
+EXPORT bool jackctl_server_add_slave(jackctl_server_t * server,
+                            jackctl_driver_t * driver);
+
+EXPORT bool jackctl_server_remove_slave(jackctl_server_t * server,
+                            jackctl_driver_t * driver);
+
+EXPORT bool 
+jackctl_server_switch_master(jackctl_server_t * server,
+                            jackctl_driver_t * driver);
+
+#if 0
+{ /* Adjust editor indent */
+#endif
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/common/JackDebugClient.cpp b/common/JackDebugClient.cpp
new file mode 100644
index 0000000..6a90fcd
--- /dev/null
+++ b/common/JackDebugClient.cpp
@@ -0,0 +1,540 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackDebugClient.h"
+#include "JackEngineControl.h"
+#include "JackException.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <fstream>
+#include <string>
+#include <time.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+JackDebugClient::JackDebugClient(JackClient * client)
+{
+    fTotalPortNumber = 1;	// The total number of port opened and maybe closed. Historical view.
+    fOpenPortNumber = 0;	// The current number of opened port.
+    fIsActivated = 0;
+    fIsDeactivated = 0;
+    fIsClosed = 0;
+    fClient = client;
+    fFreewheel = false;
+}
+
+JackDebugClient::~JackDebugClient()
+{
+    fTotalPortNumber--; // fTotalPortNumber start at 1
+    *fStream << endl << endl << "----------------------------------- JackDebugClient summary ------------------------------- " << endl << endl;
+    *fStream << "Client flags ( 1:yes / 0:no ) :" << endl;
+    *fStream << setw(5) << "- Client call activated : " << fIsActivated << endl;
+    *fStream << setw(5) << "- Client call deactivated : " << fIsDeactivated << endl;
+    *fStream << setw(5) << "- Client call closed : " << fIsClosed << endl;
+    *fStream << setw(5) << "- Total number of instantiated port : " << fTotalPortNumber << endl;
+    *fStream << setw(5) << "- Number of port remaining open when exiting client : " << fOpenPortNumber << endl;
+    if (fOpenPortNumber != 0)
+        *fStream << "!!! WARNING !!! Some ports have not been unregistered ! Incorrect exiting !" << endl;
+    if (fIsDeactivated != fIsActivated)
+        *fStream << "!!! ERROR !!! Client seem to not perform symetric activation-deactivation ! (not the same number of activate and deactivate)" << endl;
+    if (fIsClosed == 0)
+        *fStream << "!!! ERROR !!! Client have not been closed with jack_client_close() !" << endl;
+
+    *fStream << endl << endl << "---------------------------- JackDebugClient detailed port summary ------------------------ " << endl << endl;
+    //for (int i = 0; i < fTotalPortNumber ; i++) {
+    for (int i = 1; i <= fTotalPortNumber ; i++) {
+        *fStream << endl << "Port index (internal debug test value) : " << i << endl;
+        *fStream << setw(5) << "- Name : " << fPortList[i].name << endl;
+        *fStream << setw(5) << "- idport : " << fPortList[i].idport << endl;
+        *fStream << setw(5) << "- IsConnected : " << fPortList[i].IsConnected << endl;
+        *fStream << setw(5) << "- IsUnregistered : " << fPortList[i].IsUnregistered << endl;
+        if (fPortList[i].IsUnregistered == 0)
+            *fStream << "!!! WARNING !!! Port have not been unregistered ! Incorrect exiting !" << endl;
+    }
+    *fStream << "delete object JackDebugClient : end of tracing" << endl;
+    delete fStream;
+    delete fClient;
+}
+
+int JackDebugClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
+{
+    int res = fClient->Open(server_name, name, options, status);
+    char provstr[256];
+    char buffer[256];
+    time_t curtime;
+    struct tm *loctime;
+    /* Get the current time. */
+    curtime = time (NULL);
+    /* Convert it to local time representation. */
+    loctime = localtime (&curtime);
+    strftime (buffer, 256, "%I-%M", loctime);
+    sprintf(provstr, "JackClientDebug-%s-%s.log", name, buffer);
+    fStream = new ofstream(provstr, ios_base::ate);
+    if (fStream->is_open()) {
+        if (res == -1) {
+            *fStream << "Trying to open client with name '" << name << "' with bad result (client not opened)." << res << endl;
+        } else {
+            *fStream << "Open client with name '" << name << "'." << endl;
+        }
+    } else {
+        jack_log("JackDebugClient::Open : cannot open log file");
+    }
+    strcpy(fClientName, name);
+    return res;
+}
+
+int JackDebugClient::Close()
+{
+    *fStream << "Client '" << fClientName << "' was closed" << endl;
+    int res = fClient->Close();
+    fIsClosed++;
+    return res;
+}
+
+void JackDebugClient::CheckClient(const char* function_name) const
+{
+    *fStream << "CheckClient : " << function_name << ", calling thread : " << pthread_self() << endl;
+    
+    if (fIsClosed > 0)  {
+        *fStream << "!!! ERROR !!! : Accessing a client '" << fClientName << "' already closed " << "from " << function_name << endl; 
+        *fStream << "This is likely to cause crash !'" << endl;
+    #ifdef __APPLE__
+       // Debugger();
+    #endif 
+    }
+}
+
+pthread_t JackDebugClient::GetThreadID()
+{
+    CheckClient("GetThreadID");
+    return fClient->GetThreadID();
+}
+
+JackGraphManager* JackDebugClient::GetGraphManager() const
+{
+    CheckClient("GetGraphManager");
+    return fClient->GetGraphManager();
+}
+JackEngineControl* JackDebugClient::GetEngineControl() const
+{
+    CheckClient("GetEngineControl");
+    return fClient->GetEngineControl();
+}
+/*!
+\brief Notification received from the server.
+*/
+
+int JackDebugClient::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    CheckClient("ClientNotify");
+    return fClient->ClientNotify( refnum, name, notify, sync, message, value1, value2);
+}
+
+int JackDebugClient::Activate()
+{
+    CheckClient("Activate");
+    int res = fClient->Activate();
+    fIsActivated++;
+    if (fIsDeactivated)
+        *fStream << "Client '" << fClientName << "' call activate a new time (it already call 'activate' previously)." << endl;
+    *fStream << "Client '" << fClientName << "' Activated" << endl;
+    if (res != 0)
+        *fStream << "Client '" << fClientName << "' try to activate but server return " << res << " ." << endl;
+    return res;
+}
+
+int JackDebugClient::Deactivate()
+{
+    CheckClient("Deactivate");
+    int res = fClient->Deactivate();
+    fIsDeactivated++;
+    if (fIsActivated == 0)
+        *fStream << "Client '" << fClientName << "' deactivate while it hasn't been previoulsy activated !" << endl;
+    *fStream << "Client '" << fClientName << "' Deactivated" << endl;
+    if (res != 0)
+        *fStream << "Client '" << fClientName << "' try to deactivate but server return " << res << " ." << endl;
+    return res;
+}
+
+//-----------------
+// Port management
+//-----------------
+
+int JackDebugClient::PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size)
+{
+    CheckClient("PortRegister");
+    int res = fClient->PortRegister(port_name, port_type, flags, buffer_size);
+    if (res <= 0) {
+        *fStream << "Client '" << fClientName << "' try port register ('" << port_name << "') and server return error  " << res << " ." << endl;
+    } else {
+        if (fTotalPortNumber < MAX_PORT_HISTORY) {
+            fPortList[fTotalPortNumber].idport = res;
+            strcpy(fPortList[fTotalPortNumber].name, port_name);
+            fPortList[fTotalPortNumber].IsConnected = 0;
+            fPortList[fTotalPortNumber].IsUnregistered = 0;
+        } else {
+            *fStream << "!!! WARNING !!! History is full : no more port history will be recorded." << endl;
+        }
+        fTotalPortNumber++;
+        fOpenPortNumber++;
+        *fStream << "Client '" << fClientName << "' port register with portname '" << port_name << " port " << res << "' ." << endl;
+    }
+    return res;
+}
+
+int JackDebugClient::PortUnRegister(jack_port_id_t port_index)
+{
+    CheckClient("PortUnRegister");
+    int res = fClient->PortUnRegister(port_index);
+    fOpenPortNumber--;
+    int i;
+    for (i = (fTotalPortNumber - 1); i >= 0; i--) {	// We search the record into the history
+        if (fPortList[i].idport == port_index) {		// We found the last record
+            if (fPortList[i].IsUnregistered != 0)
+                *fStream << "!!! ERROR !!! : '" << fClientName << "' id deregistering port '" << fPortList[i].name << "' that have already been unregistered !" << endl;
+            fPortList[i].IsUnregistered++;
+            break;
+        }
+    }
+    if (i == 0) // Port is not found
+        *fStream << "JackClientDebug : PortUnregister : port " << port_index << " was not previously registered !" << endl;
+    if (res != 0)
+        *fStream << "Client '" << fClientName << "' try to do PortUnregister and server return " << res << endl;
+    *fStream << "Client '" << fClientName << "' unregister port '" << port_index << "'." << endl;
+    return res;
+}
+
+int JackDebugClient::PortConnect(const char* src, const char* dst)
+{
+    CheckClient("PortConnect");
+    if (!fIsActivated)
+        *fStream << "!!! ERROR !!! Trying to connect a port ( " << src << " to " << dst << ") while the client has not been activated !" << endl;
+    int i;
+    int res = fClient->PortConnect( src, dst);
+    for (i = (fTotalPortNumber - 1); i >= 0; i--) {	// We search the record into the history
+        if (strcmp(fPortList[i].name, src) == 0) {	// We found the last record in sources
+            if (fPortList[i].IsUnregistered != 0)
+                *fStream << "!!! ERROR !!! Connecting port " << src << " previoulsy unregistered !" << endl;
+            fPortList[i].IsConnected++;
+            *fStream << "Connecting port " << src << " to " << dst << ". ";
+            break;
+        } else if (strcmp(fPortList[i].name, dst) == 0 ) { // We found the record in dest
+            if (fPortList[i].IsUnregistered != 0)
+                *fStream << "!!! ERROR !!! Connecting port  " << dst << " previoulsy unregistered !" << endl;
+            fPortList[i].IsConnected++;
+            *fStream << "Connecting port " << src << " to " << dst << ". ";
+            break;
+        }
+    }
+    if (i == 0) // Port is not found
+        *fStream << "JackClientDebug : PortConnect : port was not found in debug database !" << endl;
+    if (res != 0)
+        *fStream << "Client '" << fClientName << "' try to do PortConnect but server return " << res << " ." << endl;
+    //*fStream << "Client Port Connect done with names" << endl;
+    return res;
+}
+
+int JackDebugClient::PortDisconnect(const char* src, const char* dst)
+{
+    CheckClient("PortDisconnect");
+    if (!fIsActivated)
+        *fStream << "!!! ERROR !!! Trying to disconnect a port ( " << src << " to " << dst << ") while the client has not been activated !" << endl;
+    int res = fClient->PortDisconnect( src, dst);
+    int i;
+    for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
+        if (strcmp(fPortList[i].name, src) == 0) { // We found the record in sources
+            if (fPortList[i].IsUnregistered != 0)
+                *fStream << "!!! ERROR !!! : Disconnecting port " << src << " previoulsy unregistered !" << endl;
+            fPortList[i].IsConnected--;
+            *fStream << "disconnecting port " << src << ". ";
+            break;
+        } else if (strcmp(fPortList[i].name, dst) == 0 ) { // We found the record in dest
+            if (fPortList[i].IsUnregistered != 0)
+                *fStream << "!!! ERROR !!! : Disonnecting port  " << dst << " previoulsy unregistered !" << endl;
+            fPortList[i].IsConnected--;
+            *fStream << "disconnecting port " << dst << ". ";
+            break;
+        }
+    }
+    if (i == 0) // Port is not found
+        *fStream << "JackClientDebug : PortDisConnect : port was not found in debug database !" << endl;
+    if (res != 0)
+        *fStream << "Client '" << fClientName << "' try to do PortDisconnect but server return " << res << " ." << endl;
+    //*fStream << "Client Port Disconnect done." << endl;
+    return res;
+}
+
+int JackDebugClient::PortDisconnect(jack_port_id_t src)
+{
+    CheckClient("PortDisconnect");
+    if (!fIsActivated)
+        *fStream << "!!! ERROR !!! : Trying to disconnect port  " << src << " while that client has not been activated !" << endl;
+    int res = fClient->PortDisconnect(src);
+    int i;
+    for (i = (fTotalPortNumber - 1); i >= 0; i--) {		// We search the record into the history
+        if (fPortList[i].idport == src) {				// We found the record in sources
+            if (fPortList[i].IsUnregistered != 0)
+                *fStream << "!!! ERROR !!! : Disconnecting port  " << src << " previoulsy unregistered !" << endl;
+            fPortList[i].IsConnected--;
+            *fStream << "Disconnecting port " << src << ". " << endl;
+            break;
+        }
+    }
+    if (i == 0) // Port is not found
+        *fStream << "JackClientDebug : PortDisconnect : port was not found in debug database !" << endl;
+    if (res != 0)
+        *fStream << "Client '" << fClientName << "' try to do PortDisconnect but server return " << res << " ." << endl;
+    //*fStream << "Client Port Disconnect with ID done." << endl;
+    return res;
+}
+
+int JackDebugClient::PortIsMine(jack_port_id_t port_index)
+{
+    CheckClient("PortIsMine");
+    return fClient->PortIsMine(port_index);
+}
+
+//--------------------
+// Context management
+//--------------------
+
+int JackDebugClient::SetBufferSize(jack_nframes_t buffer_size)
+{
+    CheckClient("SetBufferSize");
+    return fClient->SetBufferSize(buffer_size);
+}
+
+int JackDebugClient::SetFreeWheel(int onoff)
+{
+    CheckClient("SetFreeWheel");
+    if (onoff && fFreewheel)
+         *fStream << "!!! ERROR !!! : Freewheel setup seems incorrect : set = ON while FW is already ON " << endl;
+    if (!onoff && !fFreewheel)
+         *fStream << "!!! ERROR !!! : Freewheel setup seems incorrect : set = OFF while FW is already OFF " << endl;
+    fFreewheel = onoff;
+    return fClient->SetFreeWheel(onoff);
+}
+
+/*
+ShutDown is called:
+- from the RT thread when Execute method fails
+- possibly from a "closed" notification channel
+(Not needed since the synch object used (Sema of Fifo will fails when server quits... see ShutDown))
+*/
+
+void JackDebugClient::ShutDown()
+{
+    fClient->ShutDown();
+}
+
+//---------------------
+// Transport management
+//---------------------
+
+int JackDebugClient::ReleaseTimebase()
+{
+    CheckClient("ReleaseTimebase");
+    return fClient->ReleaseTimebase();
+}
+
+int JackDebugClient::SetSyncCallback(JackSyncCallback sync_callback, void* arg)
+{
+    CheckClient("SetSyncCallback");
+    return fClient->SetSyncCallback(sync_callback, arg);
+}
+
+int JackDebugClient::SetSyncTimeout(jack_time_t timeout)
+{
+    CheckClient("SetSyncTimeout");
+    return fClient->SetSyncTimeout(timeout);
+}
+
+int JackDebugClient::SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg)
+{
+    CheckClient("SetTimebaseCallback");
+    return fClient->SetTimebaseCallback( conditional, timebase_callback, arg);
+}
+
+void JackDebugClient::TransportLocate(jack_nframes_t frame)
+{
+    CheckClient("TransportLocate");
+    fClient->TransportLocate(frame);
+}
+
+jack_transport_state_t JackDebugClient::TransportQuery(jack_position_t* pos)
+{
+    CheckClient("TransportQuery");
+    return fClient->TransportQuery(pos);
+}
+
+jack_nframes_t JackDebugClient::GetCurrentTransportFrame()
+{
+    CheckClient("GetCurrentTransportFrame");
+    return fClient->GetCurrentTransportFrame();
+}
+
+int JackDebugClient::TransportReposition(jack_position_t* pos)
+{
+    CheckClient("TransportReposition");
+    return fClient->TransportReposition(pos);
+}
+
+void JackDebugClient::TransportStart()
+{
+    CheckClient("TransportStart");
+    fClient->TransportStart();
+}
+
+void JackDebugClient::TransportStop()
+{
+    CheckClient("TransportStop");
+    fClient->TransportStop();
+}
+
+//---------------------
+// Callback management
+//---------------------
+
+void JackDebugClient::OnShutdown(JackShutdownCallback callback, void *arg)
+{
+    CheckClient("OnShutdown");
+    fClient->OnShutdown(callback, arg);
+}
+
+void JackDebugClient::OnInfoShutdown(JackInfoShutdownCallback callback, void *arg)
+{
+    CheckClient("OnInfoShutdown");
+    fClient->OnInfoShutdown(callback, arg);
+}
+    
+int JackDebugClient::TimeCallback(jack_nframes_t nframes, void *arg)
+{
+    JackDebugClient* client = (JackDebugClient*)arg;
+    jack_time_t t1 = GetMicroSeconds();
+    int res = client->fProcessTimeCallback(nframes, client->fProcessTimeCallbackArg);
+    if (res == 0) {
+    jack_time_t t2 = GetMicroSeconds();
+        long delta = long((t2 - t1) - client->GetEngineControl()->fPeriodUsecs);
+        if (delta > 0 && !client->fFreewheel)
+            *client->fStream << "!!! ERROR !!! : Process overload of " << delta << " us" << endl;
+    }
+    return res;
+}
+
+int JackDebugClient::SetProcessCallback(JackProcessCallback callback, void *arg)
+{
+    CheckClient("SetProcessCallback");
+    fProcessTimeCallback = callback;
+    fProcessTimeCallbackArg = arg;
+    return fClient->SetProcessCallback(TimeCallback, this);
+}
+
+int JackDebugClient::SetXRunCallback(JackXRunCallback callback, void *arg)
+{
+    CheckClient("SetXRunCallback");
+    return fClient->SetXRunCallback(callback, arg);
+}
+
+int JackDebugClient::SetInitCallback(JackThreadInitCallback callback, void *arg)
+{
+    CheckClient("SetInitCallback");
+    return fClient->SetInitCallback(callback, arg);
+}
+
+int JackDebugClient::SetGraphOrderCallback(JackGraphOrderCallback callback, void *arg)
+{
+    CheckClient("SetGraphOrderCallback");
+    return fClient->SetGraphOrderCallback(callback, arg);
+}
+
+int JackDebugClient::SetBufferSizeCallback(JackBufferSizeCallback callback, void *arg)
+{
+    CheckClient("SetBufferSizeCallback");
+    return fClient->SetBufferSizeCallback(callback, arg);
+}
+
+int JackDebugClient::SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg)
+{
+    CheckClient("SetClientRegistrationCallback");
+    return fClient->SetClientRegistrationCallback(callback, arg);
+}
+
+int JackDebugClient::SetFreewheelCallback(JackFreewheelCallback callback, void *arg)
+{
+    CheckClient("SetFreewheelCallback");
+    return fClient->SetFreewheelCallback(callback, arg);
+}
+
+int JackDebugClient::SetPortRegistrationCallback(JackPortRegistrationCallback callback, void *arg)
+{
+    CheckClient("SetPortRegistrationCallback");
+    return fClient->SetPortRegistrationCallback(callback, arg);
+}
+
+int JackDebugClient::SetPortConnectCallback(JackPortConnectCallback callback, void *arg)
+{
+    CheckClient("SetPortConnectCallback");
+    return fClient->SetPortConnectCallback(callback, arg);
+}
+
+int JackDebugClient::SetPortRenameCallback(JackPortRenameCallback callback, void *arg)
+{
+    CheckClient("SetPortRenameCallback");
+    return fClient->SetPortRenameCallback(callback, arg);
+}
+
+JackClientControl* JackDebugClient::GetClientControl() const
+{
+    CheckClient("GetClientControl");
+    return fClient->GetClientControl();
+}
+
+// Internal clients
+char* JackDebugClient::GetInternalClientName(int ref)
+{
+    CheckClient("GetInternalClientName");
+    return fClient->GetInternalClientName(ref);
+}
+
+int JackDebugClient::InternalClientHandle(const char* client_name, jack_status_t* status)
+{
+    CheckClient("InternalClientHandle");
+    return fClient->InternalClientHandle(client_name, status);
+}
+
+int JackDebugClient::InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va)
+{
+    CheckClient("InternalClientLoad");
+    return fClient->InternalClientLoad(client_name, options, status, va);
+}
+
+void JackDebugClient::InternalClientUnload(int ref, jack_status_t* status)
+{
+    CheckClient("InternalClientUnload");
+    fClient->InternalClientUnload(ref, status);
+}
+
+} // end of namespace
+
diff --git a/common/JackDebugClient.h b/common/JackDebugClient.h
new file mode 100644
index 0000000..6a31f43
--- /dev/null
+++ b/common/JackDebugClient.h
@@ -0,0 +1,140 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackDebugClient__
+#define __JackDebugClient__
+
+#define MAX_PORT_HISTORY 2048
+
+#include "JackClient.h"
+#include <list>
+#include <fstream>
+
+namespace Jack
+{
+
+/*!
+\brief Follow a single port.
+*/
+
+typedef struct
+{
+    jack_port_id_t idport;
+    char name[JACK_PORT_NAME_SIZE]; //portname
+    int IsConnected;
+    int IsUnregistered;
+}
+PortFollower;
+
+/*!
+\brief A "decorator" debug client to validate API use.
+*/
+
+class JackDebugClient : public JackClient
+{
+    protected:
+
+        JackClient* fClient;
+        std::ofstream* fStream;
+        PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
+        int fTotalPortNumber;	// The total number of port opened and maybe closed. Historical view.
+        int fOpenPortNumber;	// The current number of opened port.
+        int fIsActivated;
+        int fIsDeactivated;
+        int fIsClosed;
+        bool fFreewheel;
+        char fClientName[JACK_CLIENT_NAME_SIZE + 1];
+        JackProcessCallback fProcessTimeCallback;
+        void* fProcessTimeCallbackArg;
+
+    public:
+
+        JackDebugClient(JackClient* fTheClient);
+        virtual ~JackDebugClient();
+
+        virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
+        int Close();
+
+        virtual JackGraphManager* GetGraphManager() const;
+        virtual JackEngineControl* GetEngineControl() const;
+
+        // Notifications
+        int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
+
+        int Activate();
+        int Deactivate();
+
+        // Context
+        int SetBufferSize(jack_nframes_t buffer_size);
+        int SetFreeWheel(int onoff);
+        void ShutDown();
+        pthread_t GetThreadID();
+
+        // Port management
+        int PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
+        int PortUnRegister(jack_port_id_t port);
+
+        int PortConnect(const char* src, const char* dst);
+        int PortDisconnect(const char* src, const char* dst);
+        int PortDisconnect(jack_port_id_t src);
+
+        int PortIsMine(jack_port_id_t port_index);
+
+        // Transport
+        int ReleaseTimebase();
+        int SetSyncCallback(JackSyncCallback sync_callback, void* arg);
+        int SetSyncTimeout(jack_time_t timeout);
+        int SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg);
+        void TransportLocate(jack_nframes_t frame);
+        jack_transport_state_t TransportQuery(jack_position_t* pos);
+        jack_nframes_t GetCurrentTransportFrame();
+        int TransportReposition(jack_position_t* pos);
+        void TransportStart();
+        void TransportStop();
+
+        // Callbacks
+        void OnShutdown(JackShutdownCallback callback, void *arg);
+        void OnInfoShutdown(JackInfoShutdownCallback callback, void *arg);
+        int SetProcessCallback(JackProcessCallback callback, void* arg);
+        int SetXRunCallback(JackXRunCallback callback, void* arg);
+        int SetInitCallback(JackThreadInitCallback callback, void* arg);
+        int SetGraphOrderCallback(JackGraphOrderCallback callback, void* arg);
+        int SetBufferSizeCallback(JackBufferSizeCallback callback, void* arg);
+        int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
+        int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
+        int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
+        int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
+        int SetPortRenameCallback(JackPortRenameCallback callback, void *arg);
+
+        // Internal clients
+        char* GetInternalClientName(int ref);
+        int InternalClientHandle(const char* client_name, jack_status_t* status);
+        int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
+        void InternalClientUnload(int ref, jack_status_t* status);
+
+        JackClientControl* GetClientControl() const;
+        void CheckClient(const char* function_name) const;
+
+        static int TimeCallback(jack_nframes_t nframes, void *arg);
+};
+
+
+} // end of namespace
+
+#endif
diff --git a/common/JackDriver.cpp b/common/JackDriver.cpp
new file mode 100644
index 0000000..a485d81
--- /dev/null
+++ b/common/JackDriver.cpp
@@ -0,0 +1,357 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackDriver.h"
+#include "JackTime.h"
+#include "JackError.h"
+#include "JackPort.h"
+#include "JackGraphManager.h"
+#include "JackGlobals.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackLockedEngine.h"
+#include <math.h>
+#include <assert.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+    :fClientControl(name)
+{
+    assert(strlen(name) < JACK_CLIENT_NAME_SIZE);
+    fSynchroTable = table;
+    strcpy(fAliasName, alias);
+    fEngine = engine;
+    fGraphManager = NULL;
+    fBeginDateUst = 0;
+    fDelayedUsecs = 0.f;
+    fIsMaster = true;
+ }
+
+JackDriver::JackDriver()
+{
+    fSynchroTable = NULL;
+    fEngine = NULL;
+    fGraphManager = NULL;
+    fBeginDateUst = 0;
+    fIsMaster = true;
+}
+
+JackDriver::~JackDriver()
+{
+    jack_log("~JackDriver");
+}
+
+int JackDriver::Open()
+{
+    int refnum = -1;
+
+    if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
+        jack_error("Cannot allocate internal client for driver");
+        return -1;
+    }
+
+    fClientControl.fRefNum = refnum;
+    fClientControl.fActive = true;
+    fEngineControl->fDriverNum++;
+    fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode
+    SetupDriverSync(fClientControl.fRefNum, false);
+    return 0;
+}
+
+int JackDriver::Open (bool capturing,
+                     bool playing,
+                     int inchannels,
+                     int outchannels,
+                     bool monitor,
+                     const char* capture_driver_name,
+                     const char* playback_driver_name,
+                     jack_nframes_t capture_latency,
+                     jack_nframes_t playback_latency)
+{
+    jack_log("JackDriver::Open capture_driver_name = %s", capture_driver_name);
+    jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name);
+    int refnum = -1;
+
+    if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
+        jack_error("Cannot allocate internal client for driver");
+        return -1;
+    }
+
+    fClientControl.fRefNum = refnum;
+    fClientControl.fActive = true;
+    fEngineControl->fDriverNum++;
+    fCaptureLatency = capture_latency;
+    fPlaybackLatency = playback_latency;
+
+    assert(strlen(capture_driver_name) < JACK_CLIENT_NAME_SIZE);
+    assert(strlen(playback_driver_name) < JACK_CLIENT_NAME_SIZE);
+
+    strcpy(fCaptureDriverName, capture_driver_name);
+    strcpy(fPlaybackDriverName, playback_driver_name);
+
+    fEngineControl->fPeriodUsecs = jack_time_t(1000000.f / fEngineControl->fSampleRate * fEngineControl->fBufferSize); // in microsec
+    if (!fEngineControl->fTimeOut)
+        fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs);
+
+    fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode
+    SetupDriverSync(fClientControl.fRefNum, false);
+    return 0;
+}
+
+int JackDriver::Open(jack_nframes_t buffer_size,
+                     jack_nframes_t samplerate,
+                     bool capturing,
+                     bool playing,
+                     int inchannels,
+                     int outchannels,
+                     bool monitor,
+                     const char* capture_driver_name,
+                     const char* playback_driver_name,
+                     jack_nframes_t capture_latency,
+                     jack_nframes_t playback_latency)
+{
+    jack_log("JackDriver::Open capture_driver_name = %s", capture_driver_name);
+    jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name);
+    int refnum = -1;
+
+    if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
+        jack_error("Cannot allocate internal client for driver");
+        return -1;
+    }
+
+    fClientControl.fRefNum = refnum;
+    fClientControl.fActive = true;
+    fEngineControl->fDriverNum++;
+    fEngineControl->fBufferSize = buffer_size;
+    fEngineControl->fSampleRate = samplerate;
+    fCaptureLatency = capture_latency;
+    fPlaybackLatency = playback_latency;
+
+    assert(strlen(capture_driver_name) < JACK_CLIENT_NAME_SIZE);
+    assert(strlen(playback_driver_name) < JACK_CLIENT_NAME_SIZE);
+
+    strcpy(fCaptureDriverName, capture_driver_name);
+    strcpy(fPlaybackDriverName, playback_driver_name);
+
+    fEngineControl->fPeriodUsecs = jack_time_t(1000000.f / fEngineControl->fSampleRate * fEngineControl->fBufferSize); // in microsec
+    if (!fEngineControl->fTimeOut)
+        fEngineControl->fTimeOutUsecs = jack_time_t(2.f * fEngineControl->fPeriodUsecs);
+
+    fGraphManager->SetBufferSize(buffer_size);
+    fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode
+    SetupDriverSync(fClientControl.fRefNum, false);
+    return 0;
+}
+
+int JackDriver::Close()
+{
+    if (fClientControl.fRefNum >= 0) { 
+        jack_log("JackDriver::Close");
+        fGraphManager->DirectDisconnect(fClientControl.fRefNum, fClientControl.fRefNum); // Disconnect driver from itself for sync
+        fClientControl.fActive = false;
+        fEngineControl->fDriverNum--;
+        return fEngine->ClientInternalClose(fClientControl.fRefNum, false);
+    } else {
+        return -1;
+    }
+}
+
+/*!
+	In "async" mode, the server does not synchronize itself on the output drivers, thus it would never "consume" the activations.
+	The synchronization primitives for drivers are setup in "flush" mode that to not keep unneeded activations.
+	Drivers synchro are setup in "flush" mode if server is "async" and NOT freewheel.
+*/
+void JackDriver::SetupDriverSync(int ref, bool freewheel)
+{
+    if (!freewheel && !fEngineControl->fSyncMode) {
+        jack_log("JackDriver::SetupDriverSync driver sem in flush mode");
+        fSynchroTable[ref].SetFlush(true);
+    } else {
+        jack_log("JackDriver::SetupDriverSync driver sem in normal mode");
+        fSynchroTable[ref].SetFlush(false);
+    }
+}
+
+int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    switch (notify) {
+
+        case kStartFreewheelCallback:
+            jack_log("JackDriver::kStartFreewheel");
+            SetupDriverSync(fClientControl.fRefNum, true);
+            break;
+
+        case kStopFreewheelCallback:
+            jack_log("JackDriver::kStopFreewheel");
+            SetupDriverSync(fClientControl.fRefNum, false);
+            break;
+    }
+
+    return 0;
+}
+
+bool JackDriver::IsRealTime() const
+{
+    return fEngineControl->fRealTime;
+}
+
+void JackDriver::CycleIncTime()
+{
+    fEngineControl->CycleIncTime(fBeginDateUst);
+}
+
+void JackDriver::CycleTakeBeginTime()
+{   
+    fBeginDateUst = GetMicroSeconds();  // Take callback date here
+    fEngineControl->CycleIncTime(fBeginDateUst);
+}
+
+void JackDriver::CycleTakeEndTime()
+{   
+    fEndDateUst = GetMicroSeconds();    // Take end date here
+}
+
+JackClientControl* JackDriver::GetClientControl() const
+{
+    return (JackClientControl*)&fClientControl;
+}
+
+void JackDriver::NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs)
+{
+    fEngine->NotifyXRun(cur_cycle_begin, delayed_usecs);
+}
+
+void JackDriver::NotifyBufferSize(jack_nframes_t buffer_size)
+{
+    fEngine->NotifyBufferSize(buffer_size);
+    fEngineControl->InitFrameTime();
+}
+
+void JackDriver::NotifySampleRate(jack_nframes_t sample_rate)
+{
+    fEngine->NotifySampleRate(sample_rate);
+    fEngineControl->InitFrameTime();
+}
+    
+void JackDriver::NotifyFailure(int code, const char* reason)
+{
+    fEngine->NotifyFailure(code, reason);
+}
+
+void JackDriver::SetMaster(bool onoff)
+{
+    fIsMaster = onoff;
+}
+
+bool JackDriver::GetMaster()
+{
+    return fIsMaster;
+}
+
+void JackDriver::AddSlave(JackDriverInterface* slave)
+{
+    fSlaveList.push_back(slave);
+}
+
+void JackDriver::RemoveSlave(JackDriverInterface* slave)
+{
+    fSlaveList.remove(slave);
+}
+
+int JackDriver::ProcessSlaves()
+{
+    int res = 0;
+    list<JackDriverInterface*>::const_iterator it;
+    for (it = fSlaveList.begin(); it != fSlaveList.end(); it++) {
+        JackDriverInterface* slave = *it;
+        if (slave->Process() < 0)
+            res = -1;
+    }
+    return res;
+}
+
+int JackDriver::Process()
+{
+    return 0;
+}
+
+int JackDriver::ProcessNull()
+{
+    return 0;
+}
+
+int JackDriver::Attach()
+{
+    return 0;
+}
+
+int JackDriver::Detach()
+{
+    return 0;
+}
+
+int JackDriver::Read()
+{
+    return 0;
+}
+
+int JackDriver::Write()
+{
+    return 0;
+}
+
+int JackDriver::Start()
+{
+    fEngineControl->InitFrameTime();
+    return 0;
+}
+
+int JackDriver::Stop()
+{
+    return 0;
+}
+
+bool JackDriver::IsFixedBufferSize()
+{
+    return true;
+}
+
+int JackDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    return 0;
+}
+
+int JackDriver::SetSampleRate(jack_nframes_t sample_rate)
+{
+    return 0;
+}
+
+bool JackDriver::Initialize()
+{
+    return true;
+}
+
+
+} // end of namespace
diff --git a/common/JackDriver.h b/common/JackDriver.h
new file mode 100644
index 0000000..901e6bf
--- /dev/null
+++ b/common/JackDriver.h
@@ -0,0 +1,217 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ 
+ */
+
+#ifndef __JackDriver__
+#define __JackDriver__
+
+#include "types.h"
+#include "JackClientInterface.h"
+#include "JackConstants.h"
+#include "JackPlatformPlug.h"
+#include "JackClientControl.h"
+#include <list>
+
+namespace Jack
+{
+    
+class JackLockedEngine;
+class JackGraphManager;
+struct JackEngineControl;
+    
+/*!
+\brief The base interface for drivers.
+*/
+    
+class SERVER_EXPORT JackDriverInterface
+{
+
+    public:
+        
+        JackDriverInterface()
+        {}
+        virtual ~JackDriverInterface()
+        {}
+        
+        virtual int Open() = 0;
+        
+        virtual int Open (bool capturing,
+                     bool playing,
+                     int inchannels,
+                     int outchannels,
+                     bool monitor,
+                     const char* capture_driver_name,
+                     const char* playback_driver_name,
+                     jack_nframes_t capture_latency,
+                     jack_nframes_t playback_latency) = 0;
+    
+        virtual int Open(jack_nframes_t buffer_size,
+                         jack_nframes_t samplerate,
+                         bool capturing,
+                         bool playing,
+                         int inchannels,
+                         int outchannels,
+                         bool monitor,
+                         const char* capture_driver_name,
+                         const char* playback_driver_name,
+                         jack_nframes_t capture_latency,
+                         jack_nframes_t playback_latency) = 0;
+        
+        virtual int Attach() = 0;
+        virtual int Detach() = 0;
+        
+        virtual int Read() = 0;
+        virtual int Write() = 0;
+        
+        virtual int Start() = 0;
+        virtual int Stop() = 0;
+        
+        virtual bool IsFixedBufferSize() = 0;
+        virtual int SetBufferSize(jack_nframes_t buffer_size) = 0;
+        virtual int SetSampleRate(jack_nframes_t sample_rate) = 0;
+        
+        virtual int Process() = 0;
+        virtual int ProcessNull() = 0;
+        
+        virtual void SetMaster(bool onoff) = 0;
+        virtual bool GetMaster() = 0;
+        virtual void AddSlave(JackDriverInterface* slave) = 0;
+        virtual void RemoveSlave(JackDriverInterface* slave) = 0;
+        virtual std::list<JackDriverInterface*> GetSlaves() = 0;
+        virtual int ProcessSlaves() = 0;
+        
+        virtual bool IsRealTime() const = 0;
+};
+
+/*!
+ \brief The base interface for drivers clients.
+ */
+
+class SERVER_EXPORT JackDriverClientInterface : public JackDriverInterface, public JackClientInterface
+{};
+
+/*!
+ \brief The base class for drivers.
+ */
+ 
+#define CaptureDriverFlags  static_cast<JackPortFlags>(JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive)
+#define PlaybackDriverFlags static_cast<JackPortFlags>(JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive)
+#define MonitorDriverFlags static_cast<JackPortFlags>(JackPortIsOutput | JackPortIsActive)
+
+class SERVER_EXPORT JackDriver : public JackDriverClientInterface
+{
+    
+    protected:
+        
+        char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1];
+        char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1];
+        char fAliasName[JACK_CLIENT_NAME_SIZE + 1];
+        jack_nframes_t fCaptureLatency;
+        jack_nframes_t fPlaybackLatency;
+        jack_time_t fBeginDateUst;
+        jack_time_t fEndDateUst;
+        float fDelayedUsecs;
+        JackLockedEngine* fEngine;
+        JackGraphManager* fGraphManager;
+        JackSynchro* fSynchroTable;
+        JackEngineControl* fEngineControl;
+        JackClientControl fClientControl;
+        std::list<JackDriverInterface*> fSlaveList;
+        bool fIsMaster;
+           
+        void CycleIncTime();
+        void CycleTakeBeginTime();
+        void CycleTakeEndTime();
+        
+        void SetupDriverSync(int ref, bool freewheel);
+        
+        void NotifyXRun(jack_time_t callback_usecs, float delayed_usecs);   // XRun notification sent by the driver
+        void NotifyBufferSize(jack_nframes_t buffer_size);                  // BufferSize notification sent by the driver
+        void NotifySampleRate(jack_nframes_t sample_rate);                  // SampleRate notification sent by the driver
+        void NotifyFailure(int code, const char* reason);                   // Failure notification sent by the driver
+ 
+    public:
+        
+        JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        JackDriver();
+        virtual ~JackDriver();
+        
+        void SetMaster(bool onoff);
+        bool GetMaster();
+        
+        void AddSlave(JackDriverInterface* slave);
+        void RemoveSlave(JackDriverInterface* slave);
+        std::list<JackDriverInterface*> GetSlaves()
+        {
+            return fSlaveList;
+        }
+        int ProcessSlaves();
+      
+        virtual int Open();
+            
+        virtual int Open (bool capturing,
+                     bool playing,
+                     int inchannels,
+                     int outchannels,
+                     bool monitor,
+                     const char* capture_driver_name,
+                     const char* playback_driver_name,
+                     jack_nframes_t capture_latency,
+                     jack_nframes_t playback_latency);
+        
+        virtual int Open(jack_nframes_t buffer_size,
+                         jack_nframes_t samplerate,
+                         bool capturing,
+                         bool playing,
+                         int inchannels,
+                         int outchannels,
+                         bool monitor,
+                         const char* capture_driver_name,
+                         const char* playback_driver_name,
+                         jack_nframes_t capture_latency,
+                         jack_nframes_t playback_latency);
+        virtual int Close();
+        
+        virtual int Process();
+        virtual int ProcessNull();
+        
+        virtual int Attach();
+        virtual int Detach();
+         
+        virtual int Read();
+        virtual int Write();
+          
+        virtual int Start();
+        virtual int Stop();
+        
+        virtual bool IsFixedBufferSize();
+        virtual int SetBufferSize(jack_nframes_t buffer_size);
+        virtual int SetSampleRate(jack_nframes_t sample_rate);
+        
+        virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
+        virtual JackClientControl* GetClientControl() const;
+        
+        virtual bool IsRealTime() const;
+        virtual bool Initialize();  // To be called by the wrapping thread Init method when the driver is a "blocking" one 
+            
+};
+    
+} // end of namespace
+
+#endif
diff --git a/common/JackDriverLoader.cpp b/common/JackDriverLoader.cpp
new file mode 100644
index 0000000..428d3ab
--- /dev/null
+++ b/common/JackDriverLoader.cpp
@@ -0,0 +1,807 @@
+/*
+Copyright (C) 2001-2005 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackDriverLoader.h"
+#include "JackConstants.h"
+#include "JackError.h"
+#include <getopt.h>
+#include <stdio.h>
+#include <errno.h>
+
+#ifndef WIN32
+#include <dirent.h>
+#endif
+
+jack_driver_desc_t * jackctl_driver_get_desc(jackctl_driver_t * driver);
+
+SERVER_EXPORT void jack_print_driver_options (jack_driver_desc_t* desc, FILE* file)
+{
+    unsigned long i;
+    char arg_default[JACK_DRIVER_PARAM_STRING_MAX + 1];
+
+    for (i = 0; i < desc->nparams; i++) {
+        switch (desc->params[i].type) {
+            case JackDriverParamInt:
+                sprintf (arg_default, "%" "i", desc->params[i].value.i);
+                break;
+            case JackDriverParamUInt:
+                sprintf (arg_default, "%" "u", desc->params[i].value.ui);
+                break;
+            case JackDriverParamChar:
+                sprintf (arg_default, "%c", desc->params[i].value.c);
+                break;
+            case JackDriverParamString:
+                if (desc->params[i].value.str && strcmp (desc->params[i].value.str, "") != 0)
+                    sprintf (arg_default, "%s", desc->params[i].value.str);
+                else
+                    sprintf (arg_default, "none");
+                break;
+            case JackDriverParamBool:
+                sprintf (arg_default, "%s", desc->params[i].value.i ? "true" : "false");
+                break;
+        }
+
+        fprintf (file, "\t-%c, --%s \t%s (default: %s)\n",
+                 desc->params[i].character,
+                 desc->params[i].name,
+                 desc->params[i].long_desc,
+                 arg_default);
+    }
+}
+
+static void
+jack_print_driver_param_usage (jack_driver_desc_t * desc, unsigned long param, FILE *file)
+{
+    fprintf (file, "Usage information for the '%s' parameter for driver '%s':\n",
+             desc->params[param].name, desc->name);
+    fprintf (file, "%s\n", desc->params[param].long_desc);
+}
+
+SERVER_EXPORT void jack_free_driver_params(JSList * driver_params)
+{
+    JSList *node_ptr = driver_params;
+    JSList *next_node_ptr;
+
+    while (node_ptr) {
+        next_node_ptr = node_ptr->next;
+        free(node_ptr->data);
+        free(node_ptr);
+        node_ptr = next_node_ptr;
+    }
+}
+
+int
+jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr)
+{
+    struct option * long_options;
+    char * options, * options_ptr;
+    unsigned long i;
+    int opt;
+    unsigned int param_index;
+    JSList * params = NULL;
+    jack_driver_param_t * driver_param;
+
+    if (argc <= 1) {
+        *param_ptr = NULL;
+        return 0;
+    }
+
+    /* check for help */
+    if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
+        if (argc > 2) {
+            for (i = 0; i < desc->nparams; i++) {
+                if (strcmp (desc->params[i].name, argv[2]) == 0) {
+                    jack_print_driver_param_usage (desc, i, stdout);
+                    return 1;
+                }
+            }
+
+            fprintf (stderr, "jackd: unknown option '%s' "
+                     "for driver '%s'\n", argv[2],
+                     desc->name);
+        }
+
+        printf ("Parameters for driver '%s' (all parameters are optional):\n", desc->name);
+        jack_print_driver_options (desc, stdout);
+        return 1;
+    }
+
+    /* set up the stuff for getopt */
+    options = (char*)calloc (desc->nparams * 3 + 1, sizeof (char));
+    long_options = (option*)calloc (desc->nparams + 1, sizeof (struct option));
+
+    options_ptr = options;
+    for (i = 0; i < desc->nparams; i++) {
+        sprintf (options_ptr, "%c::", desc->params[i].character);
+        options_ptr += 3;
+        long_options[i].name = desc->params[i].name;
+        long_options[i].flag = NULL;
+        long_options[i].val = desc->params[i].character;
+        long_options[i].has_arg = optional_argument;
+    }
+
+    /* create the params */
+    optind = 0;
+    opterr = 0;
+    while ((opt = getopt_long(argc, argv, options, long_options, NULL)) != -1) {
+
+        if (opt == ':' || opt == '?') {
+            if (opt == ':') {
+                fprintf (stderr, "Missing option to argument '%c'\n", optopt);
+            } else {
+                fprintf (stderr, "Unknownage with option '%c'\n", optopt);
+            }
+
+            fprintf (stderr, "Options for driver '%s':\n", desc->name);
+            jack_print_driver_options (desc, stderr);
+            exit (1);
+        }
+
+        for (param_index = 0; param_index < desc->nparams; param_index++) {
+            if (opt == desc->params[param_index].character) {
+                break;
+            }
+        }
+
+        driver_param = (jack_driver_param_t*)calloc (1, sizeof (jack_driver_param_t));
+        driver_param->character = desc->params[param_index].character;
+
+        if (!optarg && optind < argc &&
+                strlen(argv[optind]) &&
+                argv[optind][0] != '-') {
+            optarg = argv[optind];
+        }
+
+        if (optarg) {
+            switch (desc->params[param_index].type) {
+                case JackDriverParamInt:
+                    driver_param->value.i = atoi (optarg);
+                    break;
+                case JackDriverParamUInt:
+                    driver_param->value.ui = strtoul (optarg, NULL, 10);
+                    break;
+                case JackDriverParamChar:
+                    driver_param->value.c = optarg[0];
+                    break;
+                case JackDriverParamString:
+                    strncpy (driver_param->value.str, optarg, JACK_DRIVER_PARAM_STRING_MAX);
+                    break;
+                case JackDriverParamBool:
+
+                    /*
+                                if (strcasecmp ("false", optarg) == 0 ||
+                                        strcasecmp ("off", optarg) == 0 ||
+                                        strcasecmp ("no", optarg) == 0 ||
+                                        strcasecmp ("0", optarg) == 0 ||
+                                        strcasecmp ("(null)", optarg) == 0 ) {
+                    */
+                    // steph
+                    if (strcmp ("false", optarg) == 0 ||
+                            strcmp ("off", optarg) == 0 ||
+                            strcmp ("no", optarg) == 0 ||
+                            strcmp ("0", optarg) == 0 ||
+                            strcmp ("(null)", optarg) == 0 ) {
+                        driver_param->value.i = false;
+
+                    } else {
+
+                        driver_param->value.i = true;
+
+                    }
+                    break;
+            }
+        } else {
+            if (desc->params[param_index].type == JackDriverParamBool) {
+                driver_param->value.i = true;
+            } else {
+                driver_param->value = desc->params[param_index].value;
+            }
+        }
+
+        params = jack_slist_append (params, driver_param);
+    }
+
+    free (options);
+    free (long_options);
+
+    if (param_ptr)
+        *param_ptr = params;
+
+    return 0;
+}
+
+SERVER_EXPORT int
+jackctl_parse_driver_params (jackctl_driver *driver_ptr, int argc, char* argv[])
+{
+    struct option * long_options;
+    char * options, * options_ptr;
+    unsigned long i;
+    int opt;
+    JSList * node_ptr;
+    jackctl_parameter_t * param = NULL;
+    union jackctl_parameter_value value;
+
+    if (argc <= 1)
+        return 0;
+
+    const JSList * driver_params = jackctl_driver_get_parameters(driver_ptr);
+    if (driver_params == NULL)
+        return 1;
+
+    jack_driver_desc_t * desc = jackctl_driver_get_desc(driver_ptr);
+
+    /* check for help */
+    if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
+        if (argc > 2) {
+            for (i = 0; i < desc->nparams; i++) {
+                if (strcmp (desc->params[i].name, argv[2]) == 0) {
+                    jack_print_driver_param_usage (desc, i, stdout);
+                    return 1;
+                }
+            }
+
+            fprintf (stderr, "jackd: unknown option '%s' "
+                     "for driver '%s'\n", argv[2],
+                     desc->name);
+        }
+
+        printf ("Parameters for driver '%s' (all parameters are optional):\n", desc->name);
+        jack_print_driver_options (desc, stdout);
+        return 1;
+    }
+
+   /* set up the stuff for getopt */
+    options = (char*)calloc (desc->nparams * 3 + 1, sizeof (char));
+    long_options = (option*)calloc (desc->nparams + 1, sizeof (struct option));
+
+    options_ptr = options;
+    for (i = 0; i < desc->nparams; i++) {
+        sprintf (options_ptr, "%c::", desc->params[i].character);
+        options_ptr += 3;
+        long_options[i].name = desc->params[i].name;
+        long_options[i].flag = NULL;
+        long_options[i].val = desc->params[i].character;
+        long_options[i].has_arg = optional_argument;
+    }
+
+    /* create the params */
+    optind = 0;
+    opterr = 0;
+    while ((opt = getopt_long(argc, argv, options, long_options, NULL)) != -1) {
+
+        if (opt == ':' || opt == '?') {
+            if (opt == ':') {
+                fprintf (stderr, "Missing option to argument '%c'\n", optopt);
+            } else {
+                fprintf (stderr, "Unknownage with option '%c'\n", optopt);
+            }
+
+            fprintf (stderr, "Options for driver '%s':\n", desc->name);
+            jack_print_driver_options(desc, stderr);
+            return 1;
+        }
+
+        node_ptr = (JSList *)driver_params;
+       	while (node_ptr) {
+            param = (jackctl_parameter_t*)node_ptr->data;
+            if (opt == jackctl_parameter_get_id(param)) {
+                break;
+            }
+            node_ptr = node_ptr->next;
+        }
+
+        if (!optarg && optind < argc &&
+            strlen(argv[optind]) &&
+            argv[optind][0] != '-') {
+            optarg = argv[optind];
+        }
+
+        if (optarg) {
+            switch (jackctl_parameter_get_type(param)) {
+                case JackDriverParamInt:
+                    value.i = atoi (optarg);
+                    jackctl_parameter_set_value(param, &value);
+                    break;
+                case JackDriverParamUInt:
+                    value.ui = strtoul (optarg, NULL, 10);
+                    jackctl_parameter_set_value(param, &value);
+                    break;
+                case JackDriverParamChar:
+                    value.c = optarg[0];
+                    jackctl_parameter_set_value(param, &value);
+                    break;
+                case JackDriverParamString:
+                    strncpy (value.str, optarg, JACK_DRIVER_PARAM_STRING_MAX);
+                    jackctl_parameter_set_value(param, &value);
+                    break;
+                case JackDriverParamBool:
+                    /*
+                     if (strcasecmp ("false", optarg) == 0 ||
+                         strcasecmp ("off", optarg) == 0 ||
+                         strcasecmp ("no", optarg) == 0 ||
+                         strcasecmp ("0", optarg) == 0 ||
+                         strcasecmp ("(null)", optarg) == 0 ) {
+                    */
+                    // steph
+                    if (strcmp ("false", optarg) == 0 ||
+                        strcmp ("off", optarg) == 0 ||
+                        strcmp ("no", optarg) == 0 ||
+                        strcmp ("0", optarg) == 0 ||
+                        strcmp ("(null)", optarg) == 0 ) {
+                        value.i = false;
+                    } else {
+                        value.i = true;
+                    }
+                    jackctl_parameter_set_value(param, &value);
+                    break;
+            }
+        } else {
+            if (jackctl_parameter_get_type(param) == JackParamBool) {
+                value.i = true;
+            } else {
+                value = jackctl_parameter_get_default_value(param);
+            }
+            jackctl_parameter_set_value(param, &value);
+        }
+    }
+
+    free(options);
+    free(long_options);
+    return 0;
+}
+
+jack_driver_desc_t *
+jack_find_driver_descriptor (JSList * drivers, const char * name)
+{
+    jack_driver_desc_t * desc = 0;
+    JSList * node;
+
+    for (node = drivers; node; node = jack_slist_next (node)) {
+        desc = (jack_driver_desc_t *) node->data;
+
+        if (strcmp (desc->name, name) != 0) {
+            desc = NULL;
+        } else {
+            break;
+        }
+    }
+
+    return desc;
+}
+
+static jack_driver_desc_t *
+jack_get_descriptor (JSList * drivers, const char * sofile, const char * symbol)
+{
+    jack_driver_desc_t * descriptor, * other_descriptor;
+    JackDriverDescFunction so_get_descriptor = NULL;
+    JSList * node;
+    void * dlhandle;
+    char * filename;
+#ifdef WIN32
+    int dlerr;
+#else
+    const char * dlerr;
+#endif
+
+    int err;
+    const char* driver_dir;
+
+    if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+        // for WIN32 ADDON_DIR is defined in JackConstants.h as relative path
+        // for posix systems, it is absolute path of default driver dir
+#ifdef WIN32
+        char temp_driver_dir1[512];
+        char temp_driver_dir2[512];
+        GetCurrentDirectory(512, temp_driver_dir1);
+        sprintf(temp_driver_dir2, "%s/%s", temp_driver_dir1, ADDON_DIR);
+        driver_dir = temp_driver_dir2;
+#else
+        driver_dir = ADDON_DIR;
+#endif
+    }
+
+    filename = (char *)malloc(strlen (driver_dir) + 1 + strlen(sofile) + 1);
+    sprintf (filename, "%s/%s", driver_dir, sofile);
+
+    if ((dlhandle = LoadDriverModule(filename)) == NULL) {
+#ifdef WIN32
+        jack_error ("could not open driver .dll '%s': %ld", filename, GetLastError());
+#else
+        jack_error ("could not open driver .so '%s': %s", filename, dlerror());
+#endif
+
+        free(filename);
+        return NULL;
+    }
+
+    so_get_descriptor = (JackDriverDescFunction)GetDriverProc(dlhandle, symbol);
+
+#ifdef WIN32
+    if ((so_get_descriptor == NULL) && (dlerr = GetLastError()) != 0) {
+        jack_log("jack_get_descriptor : dll is not a driver, err = %ld", dlerr);
+#else
+    if ((so_get_descriptor == NULL) && (dlerr = dlerror ()) != NULL) {
+        jack_log("jack_get_descriptor err = %s", dlerr);
+#endif
+
+        UnloadDriverModule(dlhandle);
+        free(filename);
+        return NULL;
+    }
+
+    if ((descriptor = so_get_descriptor ()) == NULL) {
+        jack_error("driver from '%s' returned NULL descriptor", filename);
+        UnloadDriverModule(dlhandle);
+        free(filename);
+        return NULL;
+    }
+
+#ifdef WIN32
+    if ((err = UnloadDriverModule(dlhandle)) == 0) {
+        jack_error ("error closing driver .so '%s': %ld", filename, GetLastError ());
+    }
+#else
+    if ((err = UnloadDriverModule(dlhandle)) != 0) {
+        jack_error ("error closing driver .so '%s': %s", filename, dlerror ());
+    }
+#endif
+
+    /* check it doesn't exist already */
+    for (node = drivers; node; node = jack_slist_next (node)) {
+        other_descriptor = (jack_driver_desc_t *) node->data;
+
+        if (strcmp(descriptor->name, other_descriptor->name) == 0) {
+            jack_error("the drivers in '%s' and '%s' both have the name '%s'; using the first",
+                       other_descriptor->file, filename, other_descriptor->name);
+            /* FIXME: delete the descriptor */
+            free(filename);
+            return NULL;
+        }
+    }
+
+    strncpy(descriptor->file, filename, JACK_PATH_MAX);
+    free(filename);
+    return descriptor;
+}
+
+static bool check_symbol(const char* sofile, const char* symbol)
+{
+    void * dlhandle;
+    bool res = false;
+    const char* driver_dir;
+
+    if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+        // for WIN32 ADDON_DIR is defined in JackConstants.h as relative path
+        // for posix systems, it is absolute path of default driver dir
+#ifdef WIN32
+        char temp_driver_dir1[512];
+        char temp_driver_dir2[512];
+        GetCurrentDirectory(512, temp_driver_dir1);
+        sprintf(temp_driver_dir2, "%s/%s", temp_driver_dir1, ADDON_DIR);
+        driver_dir = temp_driver_dir2;
+#else
+        driver_dir = ADDON_DIR;
+#endif
+    }
+
+    char* filename = (char *)malloc(strlen (driver_dir) + 1 + strlen(sofile) + 1);
+    sprintf (filename, "%s/%s", driver_dir, sofile);
+
+    if ((dlhandle = LoadDriverModule(filename)) == NULL) {
+#ifdef WIN32
+        jack_error ("could not open component .dll '%s': %ld", filename, GetLastError());
+#else
+        jack_error ("could not open component .so '%s': %s", filename, dlerror());
+#endif
+     } else {
+        res = (GetDriverProc(dlhandle, symbol)) ? true : false;
+        UnloadDriverModule(dlhandle);
+    }
+
+    free(filename);
+    return res;
+}
+
+#ifdef WIN32
+
+JSList *
+jack_drivers_load (JSList * drivers) {
+    char * driver_dir;
+    char driver_dir_storage[512];
+    char dll_filename[512];
+    WIN32_FIND_DATA filedata;
+    HANDLE file;
+    const char * ptr = NULL;
+    JSList * driver_list = NULL;
+    jack_driver_desc_t * desc;
+
+    if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+        // for WIN32 ADDON_DIR is defined in JackConstants.h as relative path
+        GetCurrentDirectory(512, driver_dir_storage);
+        strcat(driver_dir_storage, "/");
+        strcat(driver_dir_storage, ADDON_DIR);
+        driver_dir = driver_dir_storage;
+    }
+
+    sprintf(dll_filename, "%s/*.dll", driver_dir);
+
+    file = (HANDLE )FindFirstFile(dll_filename, &filedata);
+
+    if (file == INVALID_HANDLE_VALUE) {
+        jack_error("error invalid handle");
+        return NULL;
+    }
+
+    do {
+        ptr = strrchr (filedata.cFileName, '.');
+        if (!ptr) {
+            continue;
+        }
+        ptr++;
+        if (strncmp ("dll", ptr, 3) != 0) {
+            continue;
+        }
+
+        desc = jack_get_descriptor (drivers, filedata.cFileName, "driver_get_descriptor");
+        if (desc) {
+            driver_list = jack_slist_append (driver_list, desc);
+        }
+
+    } while (FindNextFile(file, &filedata));
+
+    if (!driver_list) {
+        jack_error ("could not find any drivers in %s!", driver_dir);
+        return NULL;
+    }
+
+    return driver_list;
+}
+
+#else
+
+JSList *
+jack_drivers_load (JSList * drivers) {
+    struct dirent * dir_entry;
+    DIR * dir_stream;
+    const char * ptr;
+    int err;
+    JSList * driver_list = NULL;
+    jack_driver_desc_t * desc;
+
+    const char* driver_dir;
+    if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+        driver_dir = ADDON_DIR;
+    }
+
+    /* search through the driver_dir and add get descriptors
+    from the .so files in it */
+    dir_stream = opendir (driver_dir);
+    if (!dir_stream) {
+        jack_error ("could not open driver directory %s: %s",
+                    driver_dir, strerror (errno));
+        return NULL;
+    }
+
+    while ((dir_entry = readdir(dir_stream))) {
+
+        /* check the filename is of the right format */
+        if (strncmp ("jack_", dir_entry->d_name, 5) != 0) {
+            continue;
+        }
+
+        ptr = strrchr (dir_entry->d_name, '.');
+        if (!ptr) {
+            continue;
+        }
+        ptr++;
+        if (strncmp ("so", ptr, 2) != 0) {
+            continue;
+        }
+
+        desc = jack_get_descriptor (drivers, dir_entry->d_name, "driver_get_descriptor");
+        if (desc) {
+            driver_list = jack_slist_append (driver_list, desc);
+        }
+    }
+
+    err = closedir (dir_stream);
+    if (err) {
+        jack_error ("error closing driver directory %s: %s",
+                    driver_dir, strerror (errno));
+    }
+
+    if (!driver_list) {
+        jack_error ("could not find any drivers in %s!", driver_dir);
+        return NULL;
+    }
+
+    return driver_list;
+}
+
+#endif
+
+#ifdef WIN32
+
+JSList *
+jack_internals_load (JSList * internals) {
+    char * driver_dir;
+    char driver_dir_storage[512];
+    char dll_filename[512];
+    WIN32_FIND_DATA filedata;
+    HANDLE file;
+    const char * ptr = NULL;
+    JSList * driver_list = NULL;
+    jack_driver_desc_t * desc;
+
+    if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+        // for WIN32 ADDON_DIR is defined in JackConstants.h as relative path
+        GetCurrentDirectory(512, driver_dir_storage);
+        strcat(driver_dir_storage, "/");
+        strcat(driver_dir_storage, ADDON_DIR);
+        driver_dir = driver_dir_storage;
+    }
+
+    sprintf(dll_filename, "%s/*.dll", driver_dir);
+
+    file = (HANDLE )FindFirstFile(dll_filename, &filedata);
+
+    if (file == INVALID_HANDLE_VALUE) {
+        jack_error("error");
+        return NULL;
+    }
+
+    do {
+
+        ptr = strrchr (filedata.cFileName, '.');
+        if (!ptr) {
+            continue;
+        }
+        ptr++;
+        if (strncmp ("dll", ptr, 3) != 0) {
+            continue;
+        }
+
+        /* check if dll is an internal client */
+        if (!check_symbol(filedata.cFileName, "jack_internal_initialize")) {
+             continue;
+        }
+
+        desc = jack_get_descriptor (internals, filedata.cFileName, "jack_get_descriptor");
+        if (desc) {
+            driver_list = jack_slist_append (driver_list, desc);
+        }
+
+    } while (FindNextFile(file, &filedata));
+
+    if (!driver_list) {
+        jack_error ("could not find any internals in %s!", driver_dir);
+        return NULL;
+    }
+
+    return driver_list;
+}
+
+#else
+
+JSList *
+jack_internals_load (JSList * internals) {
+    struct dirent * dir_entry;
+    DIR * dir_stream;
+    const char * ptr;
+    int err;
+    JSList * driver_list = NULL;
+    jack_driver_desc_t * desc;
+
+    const char* driver_dir;
+    if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+        driver_dir = ADDON_DIR;
+    }
+
+    /* search through the driver_dir and add get descriptors
+    from the .so files in it */
+    dir_stream = opendir (driver_dir);
+    if (!dir_stream) {
+        jack_error ("could not open driver directory %s: %s\n",
+                    driver_dir, strerror (errno));
+        return NULL;
+    }
+
+    while ((dir_entry = readdir(dir_stream))) {
+
+        ptr = strrchr (dir_entry->d_name, '.');
+        if (!ptr) {
+            continue;
+        }
+        ptr++;
+        if (strncmp ("so", ptr, 2) != 0) {
+            continue;
+        }
+
+        /* check if dll is an internal client */
+        if (!check_symbol(dir_entry->d_name, "jack_internal_initialize")) {
+             continue;
+        }
+
+        desc = jack_get_descriptor (internals, dir_entry->d_name, "jack_get_descriptor");
+        if (desc) {
+            driver_list = jack_slist_append (driver_list, desc);
+        }
+    }
+
+    err = closedir (dir_stream);
+    if (err) {
+        jack_error ("error closing internal directory %s: %s\n",
+                    driver_dir, strerror (errno));
+    }
+
+    if (!driver_list) {
+        jack_error ("could not find any internals in %s!", driver_dir);
+        return NULL;
+    }
+
+    return driver_list;
+}
+
+#endif
+
+Jack::JackDriverClientInterface* JackDriverInfo::Open(jack_driver_desc_t* driver_desc, 
+                                                    Jack::JackLockedEngine* engine, 
+                                                    Jack::JackSynchro* synchro, 
+                                                    const JSList* params)
+{
+#ifdef WIN32
+    int errstr;
+#else
+    const char * errstr;
+#endif
+
+    fHandle = LoadDriverModule (driver_desc->file);
+    
+    if (fHandle == NULL) {
+#ifdef WIN32
+        if ((errstr = GetLastError ()) != 0) {
+            jack_error ("can't load \"%s\": %ld", driver_desc->file, errstr);
+#else
+        if ((errstr = dlerror ()) != 0) {
+            jack_error ("can't load \"%s\": %s", driver_desc->file, errstr);
+#endif
+
+        } else {
+            jack_error ("bizarre error loading driver shared object %s", driver_desc->file);
+        }
+        return NULL;
+    }
+
+    fInitialize = (driverInitialize)GetDriverProc(fHandle, "driver_initialize");
+
+#ifdef WIN32
+    if ((fInitialize == NULL) && (errstr = GetLastError ()) != 0) {
+#else
+    if ((fInitialize == NULL) && (errstr = dlerror ()) != 0) {
+#endif
+        jack_error("no initialize function in shared object %s\n", driver_desc->file);
+        return NULL;
+    }
+    
+    fBackend = fInitialize(engine, synchro, params);
+    return fBackend;
+}
+
diff --git a/common/JackDriverLoader.h b/common/JackDriverLoader.h
new file mode 100644
index 0000000..f68fb04
--- /dev/null
+++ b/common/JackDriverLoader.h
@@ -0,0 +1,76 @@
+/*
+Copyright (C) 2001-2005 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackDriverLoader__
+#define __JackDriverLoader__
+
+#include "driver_interface.h"
+#include "JackControlAPI.h"
+#include "JackPlatformPlug.h"
+#include "JackSystemDeps.h"
+
+namespace Jack
+{
+    class JackDriverClientInterface;
+    class JackLockedEngine;
+};
+
+typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
+typedef Jack::JackDriverClientInterface* (*driverInitialize) (Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*);
+
+class JackDriverInfo
+{
+
+    private:
+    
+        driverInitialize fInitialize;
+        DRIVER_HANDLE fHandle;
+        Jack::JackDriverClientInterface* fBackend;
+        
+    public:
+    
+        JackDriverInfo():fInitialize(NULL),fHandle(NULL)
+        {}
+        ~JackDriverInfo()
+        {
+            if (fHandle)
+                UnloadDriverModule(fHandle);
+        }
+        
+        Jack::JackDriverClientInterface* Open(jack_driver_desc_t* driver_desc, Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*);
+        
+        Jack::JackDriverClientInterface* GetBackend()
+        {
+            return fBackend;
+        }
+    
+};
+
+jack_driver_desc_t * jack_find_driver_descriptor (JSList * drivers, const char * name);
+
+JSList * jack_drivers_load (JSList * drivers);
+JSList * jack_internals_load (JSList * internals);
+
+SERVER_EXPORT int jackctl_parse_driver_params (jackctl_driver * driver_ptr, int argc, char* argv[]);
+SERVER_EXPORT void jack_free_driver_params(JSList * param_ptr);
+SERVER_EXPORT void jack_print_driver_options(jack_driver_desc_t* desc, FILE* file);
+
+#endif
+
diff --git a/common/JackDummyDriver.cpp b/common/JackDummyDriver.cpp
new file mode 100644
index 0000000..5f31cb8
--- /dev/null
+++ b/common/JackDummyDriver.cpp
@@ -0,0 +1,205 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackDummyDriver.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackDriverLoader.h"
+#include "JackThreadedDriver.h"
+#include "JackCompilerDeps.h"
+#include <iostream>
+#include <unistd.h>
+
+namespace Jack
+{
+
+int JackDummyDriver::Open(jack_nframes_t buffer_size,
+                          jack_nframes_t samplerate,
+                          bool capturing,
+                          bool playing,
+                          int inchannels,
+                          int outchannels,
+                          bool monitor,
+                          const char* capture_driver_name,
+                          const char* playback_driver_name,
+                          jack_nframes_t capture_latency,
+                          jack_nframes_t playback_latency)
+{
+    if (JackAudioDriver::Open(buffer_size,
+                            samplerate,
+                            capturing,
+                            playing,
+                            inchannels,
+                            outchannels,
+                            monitor,
+                            capture_driver_name,
+                            playback_driver_name,
+                            capture_latency,
+                            playback_latency) == 0) {
+        fEngineControl->fPeriod = 0;
+        fEngineControl->fComputation = 500 * 1000;
+        fEngineControl->fConstraint = 500 * 1000;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackDummyDriver::Process()
+{
+    JackDriver::CycleTakeBeginTime();
+    JackAudioDriver::Process();
+    JackSleep(std::max(0L, long(fWaitTime - (GetMicroSeconds() - fBeginDateUst))));
+    return 0;
+}
+
+int JackDummyDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    JackAudioDriver::SetBufferSize(buffer_size);
+    fWaitTime = (unsigned long)((((float)buffer_size) / ((float)fEngineControl->fSampleRate)) * 1000000.0f);
+    return 0;
+}
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor () {
+        jack_driver_desc_t * desc;
+        unsigned int i;
+
+        desc = (jack_driver_desc_t*)calloc (1, sizeof (jack_driver_desc_t));
+        strcpy(desc->name, "dummy");                  // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Timer based backend");    // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 6;
+        desc->params = (jack_driver_param_desc_t*)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy(desc->params[i].name, "capture");
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 2U;
+        strcpy(desc->params[i].short_desc, "Number of capture ports");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "playback");
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[1].value.ui = 2U;
+        strcpy(desc->params[i].short_desc, "Number of playback ports");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "rate");
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 48000U;
+        strcpy(desc->params[i].short_desc, "Sample rate");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "monitor");
+        desc->params[i].character = 'm';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Provide monitor ports for the output");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "period");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 1024U;
+        strcpy(desc->params[i].short_desc, "Frames per period");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "wait");
+        desc->params[i].character = 'w';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 21333U;
+        strcpy(desc->params[i].short_desc,
+               "Number of usecs to wait between engine processes");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) {
+        jack_nframes_t sample_rate = 48000;
+        jack_nframes_t period_size = 1024;
+        unsigned int capture_ports = 2;
+        unsigned int playback_ports = 2;
+        unsigned long wait_time = 0;
+        const JSList * node;
+        const jack_driver_param_t * param;
+        bool monitor = false;
+
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (const jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+
+                case 'C':
+                    capture_ports = param->value.ui;
+                    break;
+
+                case 'P':
+                    playback_ports = param->value.ui;
+                    break;
+
+                case 'r':
+                    sample_rate = param->value.ui;
+                    break;
+
+                case 'p':
+                    period_size = param->value.ui;
+                    break;
+
+                case 'w':
+                    wait_time = param->value.ui;
+                    break;
+
+                case 'm':
+                    monitor = param->value.i;
+                    break;
+            }
+        }
+
+        if (wait_time == 0) // Not set
+            wait_time = (unsigned long)((((float)period_size) / ((float)sample_rate)) * 1000000.0f);
+
+        Jack::JackDriverClientInterface* driver = new Jack::JackThreadedDriver(new Jack::JackDummyDriver("system", "dummy_pcm", engine, table, wait_time));
+        if (driver->Open(period_size, sample_rate, 1, 1, capture_ports, playback_ports, monitor, "dummy", "dummy", 0, 0) == 0) {
+            return driver;
+        } else {
+            delete driver;
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/common/JackDummyDriver.h b/common/JackDummyDriver.h
new file mode 100644
index 0000000..cfd6b47
--- /dev/null
+++ b/common/JackDummyDriver.h
@@ -0,0 +1,73 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackDummyDriver__
+#define __JackDummyDriver__
+
+#include "JackAudioDriver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The dummy driver.
+*/
+
+class JackDummyDriver : public JackAudioDriver
+{
+    private:
+
+        long fWaitTime;
+
+    public:
+
+        JackDummyDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, unsigned long wait_time)
+                : JackAudioDriver(name, alias, engine, table), fWaitTime(wait_time)
+        {}
+        virtual ~JackDummyDriver()
+        {}
+
+        int Open(jack_nframes_t buffersize,
+                 jack_nframes_t samplerate,
+                 bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency);
+
+        int Process();
+        
+        // BufferSize can be changed
+        bool IsFixedBufferSize()
+        {
+            return false;
+        }
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp
new file mode 100644
index 0000000..8c20597
--- /dev/null
+++ b/common/JackEngine.cpp
@@ -0,0 +1,867 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <fstream>
+#include <assert.h>
+
+#include "JackSystemDeps.h"
+#include "JackLockedEngine.h"
+#include "JackExternalClient.h"
+#include "JackInternalClient.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackServerGlobals.h"
+#include "JackGlobals.h"
+#include "JackChannel.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+JackEngine::JackEngine(JackGraphManager* manager,
+                       JackSynchro* table,
+                       JackEngineControl* control)
+{
+    fGraphManager = manager;
+    fSynchroTable = table;
+    fEngineControl = control;
+    for (int i = 0; i < CLIENT_NUM; i++)
+        fClientTable[i] = NULL;
+}
+
+JackEngine::~JackEngine()
+{
+    jack_log("JackEngine::~JackEngine");
+}
+
+int JackEngine::Open()
+{
+    jack_log("JackEngine::Open");
+
+    // Open audio thread => request thread communication channel
+    if (fChannel.Open(fEngineControl->fServerName) < 0) {
+        jack_error("Cannot connect to server");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackEngine::Close()
+{
+    jack_log("JackEngine::Close");
+    fChannel.Close();
+
+    // Close remaining clients (RT is stopped)
+    for (int i = fEngineControl->fDriverNum; i < CLIENT_NUM; i++) {
+        if (JackLoadableInternalClient* loadable_client = dynamic_cast<JackLoadableInternalClient*>(fClientTable[i])) {
+            jack_log("JackEngine::Close loadable client = %s", loadable_client->GetClientControl()->fName);
+            loadable_client->Close();
+            // Close does not delete the pointer for internal clients
+            fClientTable[i] = NULL;
+            delete loadable_client;
+        } else if (JackExternalClient* external_client = dynamic_cast<JackExternalClient*>(fClientTable[i])) {
+            jack_log("JackEngine::Close external client = %s", external_client->GetClientControl()->fName);
+            external_client->Close();
+            // Close deletes the pointer for external clients
+            fClientTable[i] = NULL;
+        }
+    }
+
+    return 0;
+}
+    
+void JackEngine::NotifyQuit()
+{
+    fChannel.NotifyQuit();
+}
+
+//-----------------------------
+// Client ressource management
+//-----------------------------
+
+int JackEngine::AllocateRefnum()
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        if (!fClientTable[i]) {
+            jack_log("JackEngine::AllocateRefNum ref = %ld", i);
+            return i;
+        }
+    }
+    return -1;
+}
+
+void JackEngine::ReleaseRefnum(int ref)
+{
+    fClientTable[ref] = NULL;
+
+    if (fEngineControl->fTemporary) {
+        int i;
+        for (i = fEngineControl->fDriverNum; i < CLIENT_NUM; i++) {
+            if (fClientTable[i])
+                break;
+        }
+        if (i == CLIENT_NUM) {
+            // last client and temporay case: quit the server
+            jack_log("JackEngine::ReleaseRefnum server quit");
+            fEngineControl->fTemporary = false;
+            throw JackTemporaryException();
+        }
+    }
+}
+
+//------------------
+// Graph management
+//------------------
+
+void JackEngine::ProcessNext(jack_time_t cur_cycle_begin)
+{
+    fLastSwitchUsecs = cur_cycle_begin;
+    if (fGraphManager->RunNextGraph())	// True if the graph actually switched to a new state
+        fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0);
+    fSignal.Signal();                   // Signal for threads waiting for next cycle
+}
+
+void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin)
+{
+    if (cur_cycle_begin < fLastSwitchUsecs + 2 * fEngineControl->fPeriodUsecs) // Signal XRun only for the first failing cycle
+        CheckXRun(cur_cycle_begin);
+    fGraphManager->RunCurrentGraph();
+}
+
+bool JackEngine::Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end)
+{
+    bool res = true;
+
+    // Cycle  begin
+    fEngineControl->CycleBegin(fClientTable, fGraphManager, cur_cycle_begin, prev_cycle_end);
+
+    // Graph
+    if (fGraphManager->IsFinishedGraph()) {
+        ProcessNext(cur_cycle_begin);
+        res = true;
+    } else {
+        jack_log("Process: graph not finished!");
+        if (cur_cycle_begin > fLastSwitchUsecs + fEngineControl->fTimeOutUsecs) {
+            jack_log("Process: switch to next state delta = %ld", long(cur_cycle_begin - fLastSwitchUsecs));
+            ProcessNext(cur_cycle_begin);
+            res = true;
+        } else {
+            jack_log("Process: waiting to switch delta = %ld", long(cur_cycle_begin - fLastSwitchUsecs));
+            ProcessCurrent(cur_cycle_begin);
+            res = false;
+        }
+    }
+
+    // Cycle end
+    fEngineControl->CycleEnd(fClientTable);
+    return res;
+}
+
+/*
+Client that finish *after* the callback date are considered late even if their output buffers may have been
+correctly mixed in the time window: callbackUsecs <==> Read <==> Write.
+*/
+
+void JackEngine::CheckXRun(jack_time_t callback_usecs)  // REVOIR les conditions de fin
+{
+    for (int i = fEngineControl->fDriverNum; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = fClientTable[i];
+        if (client && client->GetClientControl()->fActive) {
+            JackClientTiming* timing = fGraphManager->GetClientTiming(i);
+            jack_client_state_t status = timing->fStatus;
+            jack_time_t finished_date = timing->fFinishedAt;
+
+            if (status != NotTriggered && status != Finished) {
+                jack_error("JackEngine::XRun: client = %s was not run: state = %ld", client->GetClientControl()->fName, status);
+                fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0);  // Notify all clients
+            }
+
+            if (status == Finished && (long)(finished_date - callback_usecs) > 0) {
+                jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName);
+                fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0);  // Notify all clients
+            }
+        }
+    }
+}
+
+//---------------
+// Notifications
+//---------------
+
+void JackEngine::NotifyClient(int refnum, int event, int sync, const char* message, int value1, int value2)
+{
+    JackClientInterface* client = fClientTable[refnum];
+
+    // The client may be notified by the RT thread while closing
+    if (client) {
+    
+        if (client && client->GetClientControl()->fCallback[event]) {
+            /*
+                Important for internal clients : unlock before calling the notification callbacks.
+            */
+            bool res = fMutex.Unlock();
+            if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, message, value1, value2) < 0)
+                jack_error("NotifyClient fails name = %s event = %ld val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
+            if (res)
+                fMutex.Lock();
+       
+        } else {
+            jack_log("JackEngine::NotifyClient: no callback for event = %ld", event);
+        }
+    }
+}
+
+void JackEngine::NotifyClients(int event, int sync, const char* message, int value1, int value2)
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        NotifyClient(i, event, sync, message, value1, value2);
+    }
+}
+
+int JackEngine::NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum)
+{
+    jack_log("JackEngine::NotifyAddClient: name = %s", name);
+    // Notify existing clients of the new client and new client of existing clients.
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        JackClientInterface* old_client = fClientTable[i];
+        if (old_client) {
+            if (old_client->ClientNotify(refnum, name, kAddClient, true, "", 0, 0) < 0) {
+                jack_error("NotifyAddClient old_client fails name = %s", old_client->GetClientControl()->fName);
+                return -1;
+            }
+            if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, kAddClient, true, "", 0, 0) < 0) {
+                jack_error("NotifyAddClient new_client fails name = %s", name);
+                return -1;
+            }
+        }
+    }
+
+    return 0;
+}
+
+void JackEngine::NotifyRemoveClient(const char* name, int refnum)
+{
+    // Notify existing clients (including the one beeing suppressed) of the removed client
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = fClientTable[i];
+        if (client) {
+            client->ClientNotify(refnum, name, kRemoveClient, true, "",0, 0);
+        }
+    }
+}
+
+// Coming from the driver
+void JackEngine::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs)
+{
+    // Use the audio thread => request thread communication channel
+    fEngineControl->NotifyXRun(callback_usecs, delayed_usecs);
+    fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0);
+}
+
+void JackEngine::NotifyXRun(int refnum)
+{
+    if (refnum == ALL_CLIENTS) {
+        NotifyClients(kXRunCallback, false, "", 0, 0);
+    } else {
+        NotifyClient(refnum, kXRunCallback, false, "", 0, 0);
+    }
+}
+
+void JackEngine::NotifyGraphReorder()
+{
+    NotifyClients(kGraphOrderCallback, false, "", 0, 0);
+}
+
+void JackEngine::NotifyBufferSize(jack_nframes_t buffer_size)
+{
+    NotifyClients(kBufferSizeCallback, true, "", buffer_size, 0);
+}
+
+void JackEngine::NotifySampleRate(jack_nframes_t sample_rate)
+{
+    NotifyClients(kSampleRateCallback, true, "", sample_rate, 0);
+}
+
+void JackEngine::NotifyFailure(int code, const char* reason)
+{
+    NotifyClients(kShutDownCallback, false, reason, code, 0);
+}
+    
+void JackEngine::NotifyFreewheel(bool onoff)
+{
+    if (onoff) {
+        // Save RT state
+        fEngineControl->fSavedRealTime = fEngineControl->fRealTime;
+        fEngineControl->fRealTime = false;
+    } else {
+        // Restore RT state
+        fEngineControl->fRealTime = fEngineControl->fSavedRealTime;
+        fEngineControl->fSavedRealTime = false;
+    }
+    NotifyClients((onoff ? kStartFreewheelCallback : kStopFreewheelCallback), true, "", 0, 0);
+}
+
+void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff)
+{
+    NotifyClients((onoff ? kPortRegistrationOnCallback : kPortRegistrationOffCallback), false, "", port_index, 0);
+}
+
+void JackEngine::NotifyPortRename(jack_port_id_t port, const char* old_name)
+{
+    NotifyClients(kPortRenameCallback, false, old_name, port, 0);
+}
+
+void JackEngine::NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff)
+{
+    NotifyClients((onoff ? kPortConnectCallback : kPortDisconnectCallback), false, "", src, dst);
+}
+
+void JackEngine::NotifyActivate(int refnum)
+{
+    NotifyClient(refnum, kActivateClient, true, "", 0, 0);
+}
+
+//----------------------------
+// Loadable client management
+//----------------------------
+
+int JackEngine::GetInternalClientName(int refnum, char* name_res)
+{
+    JackClientInterface* client = fClientTable[refnum];
+    strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE);
+    return 0;
+}
+
+int JackEngine::InternalClientHandle(const char* client_name, int* status, int* int_ref)
+{
+    // Clear status
+    *status = 0;
+
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = fClientTable[i];
+        if (client && dynamic_cast<JackLoadableInternalClient*>(client) && (strcmp(client->GetClientControl()->fName, client_name) == 0)) {
+            jack_log("InternalClientHandle found client name = %s ref = %ld",  client_name, i);
+            *int_ref = i;
+            return 0;
+        }
+    }
+
+    *status |= (JackNoSuchClient | JackFailure);
+    return -1;
+}
+
+int JackEngine::InternalClientUnload(int refnum, int* status)
+{
+    JackClientInterface* client = fClientTable[refnum];
+    if (client) {
+        int res = client->Close();
+        delete client;
+        *status = 0;
+        return res;
+    } else {
+        *status = (JackNoSuchClient | JackFailure);
+        return -1;
+    }
+}
+
+//-------------------
+// Client management
+//-------------------
+
+int JackEngine::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status)
+{
+    // Clear status
+    *status = 0;
+    strcpy(name_res, name);
+
+    jack_log("Check protocol client %ld server = %ld", protocol, JACK_PROTOCOL_VERSION);
+
+    if (protocol != JACK_PROTOCOL_VERSION) {
+        *status |= (JackFailure | JackVersionError);
+        jack_error("JACK protocol mismatch (%d vs %d)", protocol, JACK_PROTOCOL_VERSION);
+        return -1;
+    }
+
+    if (ClientCheckName(name)) {
+
+        *status |= JackNameNotUnique;
+
+        if (options & JackUseExactName) {
+            jack_error("cannot create new client; %s already exists", name);
+            *status |= JackFailure;
+            return -1;
+        }
+
+        if (GenerateUniqueName(name_res)) {
+            *status |= JackFailure;
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+bool JackEngine::GenerateUniqueName(char* name)
+{
+    int tens, ones;
+    int length = strlen(name);
+
+    if (length > JACK_CLIENT_NAME_SIZE - 4) {
+        jack_error("%s exists and is too long to make unique", name);
+        return true;		/* failure */
+    }
+
+    /*  generate a unique name by appending "-01".."-99" */
+    name[length++] = '-';
+    tens = length++;
+    ones = length++;
+    name[tens] = '0';
+    name[ones] = '1';
+    name[length] = '\0';
+
+    while (ClientCheckName(name)) {
+        if (name[ones] == '9') {
+            if (name[tens] == '9') {
+                jack_error("client %s has 99 extra instances already", name);
+                return true; /* give up */
+            }
+            name[tens]++;
+            name[ones] = '0';
+        } else {
+            name[ones]++;
+        }
+    }
+    return false;
+}
+
+bool JackEngine::ClientCheckName(const char* name)
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = fClientTable[i];
+        if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
+            return true;
+    }
+
+    return false;
+}
+
+int JackEngine::GetClientPID(const char* name)
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = fClientTable[i];
+        if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
+            return client->GetClientControl()->fPID;
+    }
+
+    return 0;
+}
+
+int JackEngine::GetClientRefNum(const char* name)
+{
+    for (int i = 0; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = fClientTable[i];
+        if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
+            return client->GetClientControl()->fRefNum;
+    }
+
+    return -1;
+}
+
+// Used for external clients
+int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
+{
+    jack_log("JackEngine::ClientExternalOpen: name = %s ", name);
+
+    int refnum = AllocateRefnum();
+    if (refnum < 0) {
+        jack_error("No more refnum available");
+        return -1;
+    }
+
+    JackExternalClient* client = new JackExternalClient();
+
+    if (!fSynchroTable[refnum].Allocate(name, fEngineControl->fServerName, 0)) {
+        jack_error("Cannot allocate synchro");
+        goto error;
+    }
+
+    if (client->Open(name, pid, refnum, shared_client) < 0) {
+        jack_error("Cannot open client");
+        goto error;
+    }
+
+    if (!fSignal.LockedTimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) {
+        // Failure if RT thread is not running (problem with the driver...)
+        jack_error("Driver is not running");
+        goto error;
+    }
+
+    fClientTable[refnum] = client;
+
+    if (NotifyAddClient(client, name, refnum) < 0) {
+        jack_error("Cannot notify add client");
+        goto error;
+    }
+
+    fGraphManager->InitRefNum(refnum);
+    fEngineControl->ResetRollingUsecs();
+    *shared_engine = fEngineControl->GetShmIndex();
+    *shared_graph_manager = fGraphManager->GetShmIndex();
+    *ref = refnum;
+    return 0;
+
+error:
+    // Cleanup...
+    fSynchroTable[refnum].Destroy();
+    fClientTable[refnum] = 0;
+    client->Close();
+    delete client;
+    return -1;
+}
+
+// Used for server driver clients
+int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait)
+{
+    jack_log("JackEngine::ClientInternalOpen: name = %s", name);
+
+    int refnum = AllocateRefnum();
+    if (refnum < 0) {
+        jack_error("No more refnum available");
+        goto error;
+    }
+
+    if (!fSynchroTable[refnum].Allocate(name, fEngineControl->fServerName, 0)) {
+        jack_error("Cannot allocate synchro");
+        goto error;
+    }
+
+    if (wait && !fSignal.LockedTimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) {
+        // Failure if RT thread is not running (problem with the driver...)
+        jack_error("Driver is not running");
+        goto error;
+    }
+
+    fClientTable[refnum] = client;
+
+    if (NotifyAddClient(client, name, refnum) < 0) {
+        jack_error("Cannot notify add client");
+        goto error;
+    }
+
+    fGraphManager->InitRefNum(refnum);
+    fEngineControl->ResetRollingUsecs();
+    *shared_engine = fEngineControl;
+    *shared_manager = fGraphManager;
+    *ref = refnum;
+    return 0;
+
+error:
+    // Cleanup...
+    fSynchroTable[refnum].Destroy();
+    fClientTable[refnum] = 0;
+    return -1;
+}
+
+// Used for external clients
+int JackEngine::ClientExternalClose(int refnum)
+{
+    JackClientInterface* client = fClientTable[refnum];
+    fEngineControl->fTransport.ResetTimebase(refnum);
+    int res = ClientCloseAux(refnum, client, true);
+    client->Close();
+    delete client;
+    return res;
+}
+
+// Used for server internal clients or drivers when the RT thread is stopped
+int JackEngine::ClientInternalClose(int refnum, bool wait)
+{
+    JackClientInterface* client = fClientTable[refnum];
+    return ClientCloseAux(refnum, client, wait);
+}
+
+int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait)
+{
+    jack_log("JackEngine::ClientCloseAux ref = %ld", refnum);
+
+    // Unregister all ports ==> notifications are sent
+    jack_int_t ports[PORT_NUM_FOR_CLIENT];
+    int i;
+
+    fGraphManager->GetInputPorts(refnum, ports);
+    for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
+        PortUnRegister(refnum, ports[i]);
+    }
+
+    fGraphManager->GetOutputPorts(refnum, ports);
+    for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
+        PortUnRegister(refnum, ports[i]);
+    }
+
+    // Remove the client from the table
+    ReleaseRefnum(refnum);
+
+    // Remove all ports
+    fGraphManager->RemoveAllPorts(refnum);
+
+    // Wait until next cycle to be sure client is not used anymore
+    if (wait) {
+        if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 2)) { // Must wait at least until a switch occurs in Process, even in case of graph end failure
+            jack_error("JackEngine::ClientCloseAux wait error ref = %ld", refnum);
+        }
+    }
+
+    // Notify running clients
+    NotifyRemoveClient(client->GetClientControl()->fName, client->GetClientControl()->fRefNum);
+
+    // Cleanup...
+    fSynchroTable[refnum].Destroy();
+    fEngineControl->ResetRollingUsecs();
+    return 0;
+}
+
+int JackEngine::ClientActivate(int refnum, bool is_real_time)
+{
+    JackClientInterface* client = fClientTable[refnum];
+    jack_log("JackEngine::ClientActivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
+    
+    if (is_real_time)
+        fGraphManager->Activate(refnum);
+
+    // Wait for graph state change to be effective
+    if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 10)) {
+        jack_error("JackEngine::ClientActivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName);
+        return -1;
+    } else {
+        jack_int_t input_ports[PORT_NUM_FOR_CLIENT];
+        jack_int_t output_ports[PORT_NUM_FOR_CLIENT];
+        fGraphManager->GetInputPorts(refnum, input_ports);
+        fGraphManager->GetOutputPorts(refnum, output_ports);
+        
+        // First add port state to JackPortIsActive
+        for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
+            fGraphManager->ActivatePort(input_ports[i]);
+        }
+        for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
+            fGraphManager->ActivatePort(output_ports[i]);
+        }
+        
+        // Notify client
+        NotifyActivate(refnum);
+        
+        // Then issue port registration notification
+        for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
+            NotifyPortRegistation(input_ports[i], true);
+        }
+        for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
+            NotifyPortRegistation(output_ports[i], true);
+        }
+
+        return 0;
+    }
+}
+
+// May be called without client
+int JackEngine::ClientDeactivate(int refnum)
+{
+    JackClientInterface* client = fClientTable[refnum];
+    jack_log("JackEngine::ClientDeactivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
+
+    jack_int_t input_ports[PORT_NUM_FOR_CLIENT];
+    jack_int_t output_ports[PORT_NUM_FOR_CLIENT];
+    fGraphManager->GetInputPorts(refnum, input_ports);
+    fGraphManager->GetOutputPorts(refnum, output_ports);
+
+    // First disconnect all ports and remove their JackPortIsActive state
+    for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
+        PortDisconnect(refnum, input_ports[i], ALL_PORTS);
+        fGraphManager->DeactivatePort(input_ports[i]);
+    }
+    for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
+        PortDisconnect(refnum, output_ports[i], ALL_PORTS);
+        fGraphManager->DeactivatePort(output_ports[i]);
+    }
+    
+    // Then issue port registration notification
+    for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
+        NotifyPortRegistation(input_ports[i], false);
+    }
+    for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
+        NotifyPortRegistation(output_ports[i], false);
+    }
+
+    fGraphManager->Deactivate(refnum);
+    fLastSwitchUsecs = 0; // Force switch to occur next cycle, even when called with "dead" clients
+
+    // Wait for graph state change to be effective
+    if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 10)) {
+        jack_error("JackEngine::ClientDeactivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName);
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+//-----------------
+// Port management
+//-----------------
+
+int JackEngine::PortRegister(int refnum, const char* name, const char *type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index)
+{
+    jack_log("JackEngine::PortRegister ref = %ld name = %s type = %s flags = %d buffer_size = %d", refnum, name, type, flags, buffer_size);
+    JackClientInterface* client = fClientTable[refnum];
+
+    // Check if port name already exists
+    if (fGraphManager->GetPort(name) != NO_PORT) {
+        jack_error("port_name \"%s\" already exists", name);
+        return -1;
+    }
+
+    *port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, fEngineControl->fBufferSize);
+    if (*port_index != NO_PORT) {
+        if (client->GetClientControl()->fActive)
+            NotifyPortRegistation(*port_index, true);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
+{
+    jack_log("JackEngine::PortUnRegister ref = %ld port_index = %ld", refnum, port_index);
+    JackClientInterface* client = fClientTable[refnum];
+
+    // Disconnect port ==> notification is sent
+    PortDisconnect(refnum, port_index, ALL_PORTS);
+
+    if (fGraphManager->ReleasePort(refnum, port_index) == 0) {
+        if (client->GetClientControl()->fActive)
+            NotifyPortRegistation(port_index, false);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackEngine::PortConnect(int refnum, const char* src, const char* dst)
+{
+    jack_log("JackEngine::PortConnect src = %s dst = %s", src, dst);
+    jack_port_id_t port_src, port_dst;
+
+    return (fGraphManager->GetTwoPorts(src, dst, &port_src, &port_dst) < 0)
+           ? -1
+           : PortConnect(refnum, port_src, port_dst);
+}
+
+int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
+{
+    jack_log("JackEngine::PortConnect src = %d dst = %d", src, dst);
+    JackClientInterface* client;
+    int ref;
+
+    if (fGraphManager->CheckPorts(src, dst) < 0)
+        return -1;
+
+    ref = fGraphManager->GetOutputRefNum(src);
+    assert(ref >= 0);
+    client = fClientTable[ref];
+    assert(client);
+    if (!client->GetClientControl()->fActive) {
+        jack_error("Cannot connect ports owned by inactive clients:"
+                   " \"%s\" is not active", client->GetClientControl()->fName);
+        return -1;
+    }
+
+    ref = fGraphManager->GetInputRefNum(dst);
+    assert(ref >= 0);
+    client = fClientTable[ref];
+    assert(client);
+    if (!client->GetClientControl()->fActive) {
+        jack_error("Cannot connect ports owned by inactive clients:"
+                   " \"%s\" is not active", client->GetClientControl()->fName);
+        return -1;
+    }
+
+    int res = fGraphManager->Connect(src, dst);
+    if (res == 0)
+        NotifyPortConnect(src, dst, true);
+    return res;
+}
+
+int JackEngine::PortDisconnect(int refnum, const char* src, const char* dst)
+{
+    jack_log("JackEngine::PortDisconnect src = %s dst = %s", src, dst);
+    jack_port_id_t port_src, port_dst;
+
+    return (fGraphManager->GetTwoPorts(src, dst, &port_src, &port_dst) < 0)
+           ? -1
+           : PortDisconnect(refnum, port_src, port_dst);
+}
+
+int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
+{
+    jack_log("JackEngine::PortDisconnect src = %d dst = %d", src, dst);
+ 
+    if (dst == ALL_PORTS) {
+
+        jack_int_t connections[CONNECTION_NUM_FOR_PORT];
+        fGraphManager->GetConnections(src, connections);
+
+        JackPort* port = fGraphManager->GetPort(src);
+        int ret = 0;
+        if (port->GetFlags() & JackPortIsOutput) {
+            for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) {
+                if (PortDisconnect(refnum, src, connections[i]) != 0) {
+                    ret = -1;
+                }
+            }
+        } else {
+            for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) {
+                if (PortDisconnect(refnum, connections[i], src) != 0) {
+                    ret = -1;
+                }
+            }
+        }
+
+        return ret;
+    } else if (fGraphManager->CheckPorts(src, dst) < 0) {
+        return -1;
+    } else if (fGraphManager->Disconnect(src, dst) == 0) {
+        // Notifications
+        NotifyPortConnect(src, dst, false);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name)
+{
+    char old_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    strcpy(old_name, fGraphManager->GetPort(port)->GetName());
+    fGraphManager->GetPort(port)->SetName(name);
+    NotifyPortRename(port, old_name);
+    return 0;
+}
+
+} // end of namespace
+
diff --git a/common/JackEngine.h b/common/JackEngine.h
new file mode 100644
index 0000000..945d7e9
--- /dev/null
+++ b/common/JackEngine.h
@@ -0,0 +1,140 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackEngine__
+#define __JackEngine__
+
+#include "JackConstants.h"
+#include "JackGraphManager.h"
+#include "JackSynchro.h"
+#include "JackMutex.h"
+#include "JackTransportEngine.h"
+#include "JackPlatformPlug.h"
+
+namespace Jack
+{
+
+class JackClientInterface;
+struct JackEngineControl;
+class JackExternalClient;
+
+/*!
+\brief Engine description.
+*/
+
+class SERVER_EXPORT JackEngine : public JackLockAble
+{
+    friend class JackLockedEngine;
+    
+    private:
+
+        JackGraphManager* fGraphManager;
+        JackEngineControl* fEngineControl;
+        JackClientInterface* fClientTable[CLIENT_NUM];
+        JackSynchro* fSynchroTable;
+        JackServerNotifyChannel fChannel;              /*! To communicate between the RT thread and server */
+        JackProcessSync fSignal;
+        jack_time_t fLastSwitchUsecs;
+
+        int ClientCloseAux(int refnum, JackClientInterface* client, bool wait);
+        void CheckXRun(jack_time_t callback_usecs);
+
+        int NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum);
+        void NotifyRemoveClient(const char* name, int refnum);
+
+        void ProcessNext(jack_time_t callback_usecs);
+        void ProcessCurrent(jack_time_t callback_usecs);
+
+        bool ClientCheckName(const char* name);
+        bool GenerateUniqueName(char* name);
+
+        int AllocateRefnum();
+        void ReleaseRefnum(int ref);
+
+        void NotifyClient(int refnum, int event, int sync, const char*  message, int value1, int value2);
+        void NotifyClients(int event, int sync, const char*  message,  int value1, int value2);
+    
+        void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
+        void NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff);
+        void NotifyPortRename(jack_port_id_t src, const char* old_name);
+        void NotifyActivate(int refnum);
+        
+        bool CheckClient(int refnum)
+        {
+            return (refnum >= 0 && refnum < CLIENT_NUM && fClientTable[refnum] != NULL);
+        }
+
+    public:
+
+        JackEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler);
+        ~JackEngine();
+
+        int Open();
+        int Close();
+  
+        // Client management
+        int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status);
+        int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
+        int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait);
+
+        int ClientExternalClose(int refnum);
+        int ClientInternalClose(int refnum, bool wait);
+
+        int ClientActivate(int refnum, bool is_real_time);
+        int ClientDeactivate(int refnum);
+    
+        int GetClientPID(const char* name);
+        int GetClientRefNum(const char* name);
+    
+        // Internal client management
+        int GetInternalClientName(int int_ref, char* name_res);
+        int InternalClientHandle(const char* client_name, int* status, int* int_ref);
+        int InternalClientUnload(int refnum, int* status);
+
+        // Port management
+        int PortRegister(int refnum, const char* name, const char *type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port);
+        int PortUnRegister(int refnum, jack_port_id_t port);
+
+        int PortConnect(int refnum, const char* src, const char* dst);
+        int PortDisconnect(int refnum, const char* src, const char* dst);
+
+        int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
+        int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
+        
+        int PortRename(int refnum, jack_port_id_t port, const char* name);
+
+        // Graph
+        bool Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end);
+
+        // Notifications
+        void NotifyXRun(jack_time_t callback_usecs, float delayed_usecs);
+        void NotifyFailure(int code, const char* reason);
+        void NotifyXRun(int refnum);
+        void NotifyGraphReorder();
+        void NotifyBufferSize(jack_nframes_t buffer_size);
+        void NotifySampleRate(jack_nframes_t sample_rate);
+        void NotifyFreewheel(bool onoff);
+        void NotifyQuit();
+};
+
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackEngineControl.cpp b/common/JackEngineControl.cpp
new file mode 100644
index 0000000..db13ae7
--- /dev/null
+++ b/common/JackEngineControl.cpp
@@ -0,0 +1,92 @@
+/*
+Copyright (C) 2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackClientInterface.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackClientControl.h"
+#include <algorithm>
+#include <math.h>
+
+namespace Jack
+{
+
+static inline jack_time_t JACK_MAX(jack_time_t a, jack_time_t b)
+{
+    return (a < b) ? b : a;
+}
+
+void JackEngineControl::CalcCPULoad(JackClientInterface** table, 
+                                    JackGraphManager* manager, 
+                                    jack_time_t cur_cycle_begin, 
+                                    jack_time_t prev_cycle_end)
+{
+    fPrevCycleTime = fCurCycleTime;
+    fCurCycleTime = cur_cycle_begin;
+    jack_time_t last_cycle_end = prev_cycle_end;
+    
+    // In Asynchronous mode, last cycle end is the max of client end dates
+    if (!fSyncMode) {
+        for (int i = fDriverNum; i < CLIENT_NUM; i++) {
+            JackClientInterface* client = table[i];
+            JackClientTiming* timing = manager->GetClientTiming(i);
+            if (client && client->GetClientControl()->fActive && timing->fStatus == Finished) 
+                last_cycle_end = JACK_MAX(last_cycle_end, timing->fFinishedAt);
+        }
+    }
+
+    // Store the execution time for later averaging 
+    fRollingClientUsecs[fRollingClientUsecsIndex++] = last_cycle_end - fPrevCycleTime;
+    if (fRollingClientUsecsIndex >= JACK_ENGINE_ROLLING_COUNT) 
+        fRollingClientUsecsIndex = 0;
+  
+    // Every so often, recompute the current maximum use over the
+    // last JACK_ENGINE_ROLLING_COUNT client iterations.
+ 
+    if (++fRollingClientUsecsCnt % fRollingInterval == 0) {
+
+        jack_time_t max_usecs = 0;
+        for (int i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++) 
+            max_usecs = JACK_MAX(fRollingClientUsecs[i], max_usecs);
+    
+        fMaxUsecs = JACK_MAX(fMaxUsecs, max_usecs);
+        fSpareUsecs = jack_time_t((max_usecs < fPeriodUsecs) ? fPeriodUsecs - max_usecs : 0);
+        fCPULoad = ((1.f - (float(fSpareUsecs) / float(fPeriodUsecs))) * 50.f + (fCPULoad * 0.5f));
+    }
+}
+
+void JackEngineControl::ResetRollingUsecs()
+{
+    memset(fRollingClientUsecs, 0, sizeof(fRollingClientUsecs));
+    fRollingClientUsecsIndex = 0;
+    fRollingClientUsecsCnt = 0;
+    fSpareUsecs = 0;
+    fRollingInterval = int(floor((JACK_ENGINE_ROLLING_INTERVAL * 1000.f) / fPeriodUsecs));
+}
+    
+void JackEngineControl::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs)
+{
+    ResetFrameTime(callback_usecs);
+    fXrunDelayedUsecs = delayed_usecs;
+    if (delayed_usecs > fMaxDelayedUsecs)
+        fMaxDelayedUsecs = delayed_usecs;
+}
+    
+} // end of namespace
diff --git a/common/JackEngineControl.h b/common/JackEngineControl.h
new file mode 100644
index 0000000..3ba54b8
--- /dev/null
+++ b/common/JackEngineControl.h
@@ -0,0 +1,179 @@
+/*
+Copyright (C) 2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackEngineControl__
+#define __JackEngineControl__
+
+#include "JackShmMem.h"
+#include "JackFrameTimer.h"
+#include "JackTransportEngine.h"
+#include "JackConstants.h"
+#include "types.h"
+#include <stdio.h>
+
+#ifdef JACK_MONITOR
+#include "JackEngineProfiling.h"
+#endif
+
+namespace Jack
+{
+
+class JackClientInterface;
+class JackGraphManager;
+
+#define JACK_ENGINE_ROLLING_COUNT 32
+#define JACK_ENGINE_ROLLING_INTERVAL 1024
+
+/*!
+\brief Engine control in shared memory.
+*/
+
+struct SERVER_EXPORT JackEngineControl : public JackShmMem
+{
+    // Shared state
+    jack_nframes_t fBufferSize;
+    jack_nframes_t fSampleRate;
+    bool fSyncMode;
+    bool fTemporary;
+    jack_time_t fPeriodUsecs;
+    jack_time_t fTimeOutUsecs;
+    float fMaxDelayedUsecs;
+    float fXrunDelayedUsecs;
+    bool fTimeOut;
+    bool fRealTime;
+    bool fSavedRealTime;  // RT state saved and restored during Freewheel mode
+    int fServerPriority;
+    int fClientPriority;
+    int fMaxClientPriority;
+    char fServerName[64];
+    JackTransportEngine fTransport;
+    jack_timer_type_t fClockSource;
+    int fDriverNum;
+    bool fVerbose;
+
+    // CPU Load
+    jack_time_t fPrevCycleTime;
+    jack_time_t fCurCycleTime;
+    jack_time_t fSpareUsecs;
+    jack_time_t fMaxUsecs;
+    jack_time_t fRollingClientUsecs[JACK_ENGINE_ROLLING_COUNT];
+    int	fRollingClientUsecsCnt;
+    int	fRollingClientUsecsIndex;
+    int	fRollingInterval;
+    float fCPULoad;
+
+    // For OSX thread
+    UInt64 fPeriod;
+    UInt64 fComputation;
+    UInt64 fConstraint;
+
+    // Timer
+    JackFrameTimer fFrameTimer;
+    
+#ifdef JACK_MONITOR
+    JackEngineProfiling fProfiler;
+#endif   
+
+    JackEngineControl(bool sync, bool temporary, long timeout, bool rt, long priority, bool verbose, jack_timer_type_t clock, const char* server_name)
+    {
+        fBufferSize = 512;
+        fSampleRate = 48000;
+        fPeriodUsecs = jack_time_t(1000000.f / fSampleRate * fBufferSize);
+        fSyncMode = sync;
+        fTemporary = temporary;
+        fTimeOut = (timeout > 0);
+        fTimeOutUsecs = timeout * 1000;
+        fRealTime = rt;
+        fSavedRealTime = false;
+        fServerPriority = priority;
+        fClientPriority = (rt) ? priority - 5 : 0;
+        fMaxClientPriority = (rt) ? priority - 1 : 0;
+        fVerbose = verbose;
+        fPrevCycleTime = 0;
+        fCurCycleTime = 0;
+        fSpareUsecs = 0;
+        fMaxUsecs = 0;
+        ResetRollingUsecs();
+        strncpy(fServerName, server_name, sizeof(fServerName));
+        fPeriod = 0;
+        fComputation = 0;
+        fConstraint = 0;
+        fMaxDelayedUsecs = 0.f;
+        fXrunDelayedUsecs = 0.f;
+        fClockSource = clock;
+        fDriverNum = 0;
+   }
+    
+    ~JackEngineControl()
+    {}
+
+    // Cycle
+    void CycleIncTime(jack_time_t callback_usecs)
+    {
+        // Timer
+        fFrameTimer.IncFrameTime(fBufferSize, callback_usecs, fPeriodUsecs);
+    }
+
+    void CycleBegin(JackClientInterface** table, JackGraphManager* manager, jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end)
+    {
+        fTransport.CycleBegin(fSampleRate, cur_cycle_begin);
+        CalcCPULoad(table, manager, cur_cycle_begin, prev_cycle_end);
+#ifdef JACK_MONITOR
+        fProfiler.Profile(table, manager, fPeriodUsecs, cur_cycle_begin, prev_cycle_end);
+#endif
+    }
+
+    void CycleEnd(JackClientInterface** table)
+    {
+        fTransport.CycleEnd(table, fSampleRate, fBufferSize);
+    }
+
+    // Timer
+    void InitFrameTime()
+    {
+        fFrameTimer.InitFrameTime();
+    }
+
+    void ResetFrameTime(jack_time_t callback_usecs)
+    {
+        fFrameTimer.ResetFrameTime(fSampleRate, callback_usecs, fPeriodUsecs);
+    }
+
+    void ReadFrameTime(JackTimer* timer)
+    {
+        fFrameTimer.ReadFrameTime(timer);
+    }
+    
+    // XRun
+    void NotifyXRun(jack_time_t callback_usecs, float delayed_usecs);
+    void ResetXRun()
+    {
+        fMaxDelayedUsecs = 0.f;
+    }
+
+    // Private
+    void CalcCPULoad(JackClientInterface** table, JackGraphManager* manager, jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end);
+    void ResetRollingUsecs();
+
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+#endif
diff --git a/common/JackEngineProfiling.cpp b/common/JackEngineProfiling.cpp
new file mode 100644
index 0000000..4557fec
--- /dev/null
+++ b/common/JackEngineProfiling.cpp
@@ -0,0 +1,384 @@
+/*
+Copyright (C) 2008 Grame & RTL
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackEngineProfiling.h"
+#include "JackGraphManager.h"
+#include "JackClientControl.h"
+#include "JackEngineControl.h"
+#include "JackClientInterface.h"
+#include "JackGlobals.h"
+#include "JackTime.h"
+
+#include <iostream>
+#include <fstream>
+
+namespace Jack
+{
+
+JackEngineProfiling::JackEngineProfiling():fAudioCycle(0),fMeasuredClient(0)
+{
+    jack_info("Engine profiling activated, beware %ld MBytes are needed to record profiling points...", sizeof(fProfileTable) / (1024 * 1024));
+    
+    // Force memory page in
+    memset(fProfileTable, 0, sizeof(fProfileTable));
+}
+
+JackEngineProfiling::~JackEngineProfiling()
+{
+    std::ofstream fStream("JackEngineProfiling.log", std::ios_base::ate);
+    jack_info("Write server and clients timing data...");
+
+    if (!fStream.is_open()) {
+        jack_error("JackEngineProfiling::Save cannot open JackEngineProfiling.log file");
+    } else {
+    
+        // For each measured point
+        for (int i = 2; i < TIME_POINTS; i++) {
+            
+            // Driver timing values
+            long d1 = long(fProfileTable[i].fCurCycleBegin - fProfileTable[i - 1].fCurCycleBegin);
+            long d2 = long(fProfileTable[i].fPrevCycleEnd - fProfileTable[i - 1].fCurCycleBegin);
+            
+            if (d1 <= 0 || fProfileTable[i].fAudioCycle <= 0)
+                continue; // Skip non valid cycles
+                
+            // Print driver delta and end cycle
+            fStream << d1 << "\t" << d2 << "\t";
+             
+            // For each measured client
+            for (unsigned int j = 0; j < fMeasuredClient; j++) { 
+            
+                int ref = fIntervalTable[j].fRefNum;
+            
+                // Is valid client cycle 
+                 if (fProfileTable[i].fClientTable[ref].fStatus != NotTriggered) {
+             
+                    long d5 = long(fProfileTable[i].fClientTable[ref].fSignaledAt - fProfileTable[i - 1].fCurCycleBegin);
+                    long d6 = long(fProfileTable[i].fClientTable[ref].fAwakeAt - fProfileTable[i - 1].fCurCycleBegin);
+                    long d7 = long(fProfileTable[i].fClientTable[ref].fFinishedAt - fProfileTable[i - 1].fCurCycleBegin);
+                        
+                     fStream << ref << "\t" ;
+                     fStream << ((d5 > 0) ? d5 : 0) << "\t";
+                     fStream << ((d6 > 0) ? d6 : 0) << "\t" ;
+                     fStream << ((d7 > 0) ? d7 : 0) << "\t";
+                     fStream << ((d6 > 0 && d5 > 0) ? (d6 - d5) : 0) << "\t" ;
+                     fStream << ((d7 > 0 && d6 > 0) ? (d7 - d6) : 0) << "\t" ;
+                     fStream << fProfileTable[i].fClientTable[ref].fStatus << "\t" ;;
+                
+                 } else { // Print tabs
+                     fStream <<  "\t  \t  \t  \t  \t  \t \t";
+                }
+            }
+            
+            // Terminate line
+            fStream << std::endl;
+        }
+    }
+    
+    // Driver period
+     std::ofstream fStream1("Timing1.plot", std::ios_base::ate);
+ 
+    if (!fStream1.is_open()) {
+        jack_error("JackEngineProfiling::Save cannot open Timing1.plot file");
+    } else {
+        
+        fStream1 << "set grid\n";
+        fStream1 <<  "set title \"Audio driver timing\"\n";
+        fStream1 <<  "set xlabel \"audio cycles\"\n";
+        fStream1 <<  "set ylabel \"usec\"\n";
+        fStream1 <<  "plot \"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines \n";
+        
+        fStream1 <<  "set output 'Timing1.svg\n";
+        fStream1 <<  "set terminal svg\n";
+        
+        fStream1 <<  "set grid\n";
+        fStream1 <<  "set title \"Audio driver timing\"\n";
+        fStream1 <<  "set xlabel \"audio cycles\"\n";
+        fStream1 <<  "set ylabel \"usec\"\n";
+        fStream1 <<  "plot \"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines \n";
+	fStream1 <<  "unset output\n";
+    }
+    
+    // Driver end date
+    std::ofstream fStream2("Timing2.plot", std::ios_base::ate);
+  
+    if (!fStream2.is_open()) {
+        jack_error("JackEngineProfiling::Save cannot open Timing2.plot file");
+    } else {
+   
+        fStream2 << "set grid\n";
+        fStream2 <<  "set title \"Driver end date\"\n";
+        fStream2 <<  "set xlabel \"audio cycles\"\n";
+        fStream2 <<  "set ylabel \"usec\"\n";
+        fStream2 <<  "plot  \"JackEngineProfiling.log\" using 2 title \"Driver end date\" with lines \n";
+    
+        fStream2 <<  "set output 'Timing2.svg\n";
+        fStream2 <<  "set terminal svg\n";
+    
+        fStream2 <<  "set grid\n";
+        fStream2 <<  "set title \"Driver end date\"\n";
+        fStream2 <<  "set xlabel \"audio cycles\"\n";
+        fStream2 <<  "set ylabel \"usec\"\n";
+        fStream2 <<  "plot  \"JackEngineProfiling.log\" using 2 title \"Driver end date\" with lines \n";
+	fStream2 <<  "unset output\n";
+    }
+        
+    // Clients end date
+    if (fMeasuredClient > 0) {
+        std::ofstream fStream3("Timing3.plot", std::ios_base::ate);
+        
+        if (!fStream3.is_open()) {
+            jack_error("JackEngineProfiling::Save cannot open Timing3.plot file");
+        } else {
+        
+            fStream3 << "set multiplot\n";
+            fStream3 << "set grid\n";
+            fStream3 << "set title \"Clients end date\"\n";
+            fStream3 << "set xlabel \"audio cycles\"\n";
+            fStream3 << "set ylabel \"usec\"\n";
+            fStream3 << "plot ";
+            for (unsigned int i = 0; i < fMeasuredClient; i++) {
+                if (i == 0) {
+                    if (i + 1 == fMeasuredClient) { // Last client
+                        fStream3 << "\"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines,\"JackEngineProfiling.log\" using ";
+                        fStream3 <<  ((i + 1) * 7) - 1;
+                        fStream3 << " title \"" << fIntervalTable[i].fName << "\"with lines";
+                     } else {
+                        fStream3 << "\"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines,\"JackEngineProfiling.log\" using ";
+                        fStream3 <<  ((i + 1) * 7) - 1;
+                        fStream3 << " title \"" << fIntervalTable[i].fName << "\"with lines,";
+                    }
+                } else if (i + 1 == fMeasuredClient) { // Last client
+                    fStream3 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) - 1  << " title \"" << fIntervalTable[i].fName << "\" with lines";
+                } else {
+                    fStream3 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) - 1  << " title \"" << fIntervalTable[i].fName << "\" with lines,";
+                }
+            }
+        
+            fStream3 << "\n unset multiplot\n";  
+            fStream3 << "set output 'Timing3.svg\n";
+            fStream3 << "set terminal svg\n";
+        
+            fStream3 << "set multiplot\n";
+            fStream3 << "set grid\n";
+            fStream3 << "set title \"Clients end date\"\n";
+            fStream3 << "set xlabel \"audio cycles\"\n";
+            fStream3 << "set ylabel \"usec\"\n";
+            fStream3 << "plot ";
+            for (unsigned int i = 0; i < fMeasuredClient; i++) {
+                if (i == 0) {
+                    if ((i + 1) == fMeasuredClient) { // Last client
+                        fStream3 << "\"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines,\"JackEngineProfiling.log\" using ";
+                        fStream3 <<  ((i + 1) * 7) - 1;
+                        fStream3 << " title \"" << fIntervalTable[i].fName << "\"with lines";
+                    } else {
+                        fStream3 << "\"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines,\"JackEngineProfiling.log\" using ";
+                        fStream3 <<  ((i + 1) * 7) - 1;
+                        fStream3 << " title \"" << fIntervalTable[i].fName << "\"with lines,";
+                    }
+                } else if ((i + 1) == fMeasuredClient) { // Last client
+                    fStream3 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) - 1  << " title \"" << fIntervalTable[i].fName << "\" with lines";
+                } else {
+                    fStream3 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) - 1  << " title \"" << fIntervalTable[i].fName << "\" with lines,";
+                }
+            }
+	    fStream3 << "\nunset multiplot\n";
+	    fStream3 << "unset output\n";
+        }
+    }
+
+    // Clients scheduling
+    if (fMeasuredClient > 0) {
+        std::ofstream fStream4("Timing4.plot", std::ios_base::ate);
+        
+        if (!fStream4.is_open()) {
+            jack_error("JackEngineProfiling::Save cannot open Timing4.plot file");
+        } else {
+        
+            fStream4 << "set multiplot\n";
+            fStream4 << "set grid\n";
+            fStream4 << "set title \"Clients scheduling latency\"\n";
+            fStream4 << "set xlabel \"audio cycles\"\n";
+            fStream4 << "set ylabel \"usec\"\n";
+            fStream4 << "plot ";
+            for (unsigned int i = 0; i < fMeasuredClient; i++) {
+                if ((i + 1) == fMeasuredClient) { // Last client
+                    fStream4 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7)  << " title \"" << fIntervalTable[i].fName << "\" with lines";
+                 } else {
+                     fStream4 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7)  << " title \"" << fIntervalTable[i].fName << "\" with lines,";
+                }
+            }
+            
+            fStream4 << "\n unset multiplot\n";  
+            fStream4 << "set output 'Timing4.svg\n";
+            fStream4 << "set terminal svg\n";
+            
+            fStream4 << "set multiplot\n";
+            fStream4 << "set grid\n";
+            fStream4 << "set title \"Clients scheduling latency\"\n";
+            fStream4 << "set xlabel \"audio cycles\"\n";
+            fStream4 << "set ylabel \"usec\"\n";
+            fStream4 << "plot ";
+            for (unsigned int i = 0; i < fMeasuredClient; i++) {
+                if ((i + 1) == fMeasuredClient) { // Last client
+                    fStream4 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7)  << " title \"" << fIntervalTable[i].fName << "\" with lines";
+                } else {
+                     fStream4 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7)  << " title \"" << fIntervalTable[i].fName << "\" with lines,";
+                }
+            }
+	    fStream4 << "\nunset multiplot\n";
+	    fStream4 << "unset output\n";
+        }
+    }
+    
+     // Clients duration
+    if (fMeasuredClient > 0) {
+        std::ofstream fStream5("Timing5.plot", std::ios_base::ate);
+
+        if (!fStream5.is_open()) {
+            jack_error("JackEngineProfiling::Save cannot open Timing5.plot file");
+        } else {
+        
+            fStream5 << "set multiplot\n";
+            fStream5 << "set grid\n";
+            fStream5 << "set title \"Clients duration\"\n";
+            fStream5 << "set xlabel \"audio cycles\"\n";
+            fStream5 << "set ylabel \"usec\"\n";
+            fStream5 << "plot ";
+            for (unsigned int i = 0; i < fMeasuredClient; i++) {
+                if ((i + 1) == fMeasuredClient) { // Last client
+                    fStream5 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) + 1  << " title \"" << fIntervalTable[i].fName << "\" with lines";
+                } else {
+                    fStream5 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) + 1  << " title \"" << fIntervalTable[i].fName << "\" with lines,";
+                }
+            }
+            
+            fStream5 << "\n unset multiplot\n";  
+            fStream5 << "set output 'Timing5.svg\n";
+            fStream5 << "set terminal svg\n";
+            
+            fStream5 << "set multiplot\n";
+            fStream5 << "set grid\n";
+            fStream5 << "set title \"Clients duration\"\n";
+            fStream5 << "set xlabel \"audio cycles\"\n";
+            fStream5 << "set ylabel \"usec\"\n";
+            fStream5 << "plot ";
+            for (unsigned int i = 0; i < fMeasuredClient; i++) {
+                if ((i + 1) == fMeasuredClient) {// Last client
+                    fStream5 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) + 1  << " title \"" << fIntervalTable[i].fName << "\" with lines";
+                } else {
+                    fStream5 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) + 1  << " title \"" << fIntervalTable[i].fName << "\" with lines,";
+                }
+            }
+	    fStream5 << "\nunset multiplot\n";
+	    fStream5 << "unset output\n";
+        }
+    }
+    
+    std::ofstream fStream6("Timings.html", std::ios_base::ate);
+    if (!fStream6.is_open()) {
+        jack_error("JackEngineProfiling::Save cannot open Timings.html file");
+    } else {
+        fStream6 << "<?xml version='1.0' encoding='utf-8'?>\n";
+        fStream6 << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
+        fStream6 << "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
+        fStream6 << "<html xmlns='http://www.w3.org/1999/xhtml' lang='en'>\n";
+        fStream6 << "  <head>\n";
+        fStream6 << "    <title>JACK engine profiling</title>\n";
+        fStream6 << "    <!-- assuming that images are 600px wide -->\n";
+        fStream6 << "    <style media='all' type='text/css'>\n";
+        fStream6 << "    .center { margin-left:auto ; margin-right: auto; width: 650px; height: 550px }\n";
+        fStream6 << "    </style>\n";
+        fStream6 << "  </head>\n";
+        fStream6 << "  <body>\n";
+        fStream6 << "    <h2 style='text-align:center'>JACK engine profiling</h2>\n";
+        fStream6 << "    <div class='center'><object class='center' type='image/svg+xml' data='Timing1.svg'>Timing1</object></div>";
+        fStream6 << "    <div class='center'><object class='center' type='image/svg+xml' data='Timing2.svg'>Timing2</object></div>";
+        fStream6 << "    <div class='center'><object class='center' type='image/svg+xml' data='Timing3.svg'>Timing3</object></div>";
+        fStream6 << "    <div class='center'><object class='center' type='image/svg+xml' data='Timing4.svg'>Timing4</object></div>";
+        fStream6 << "    <div class='center'><object class='center' type='image/svg+xml' data='Timing5.svg'>Timing5</object></div>";
+        fStream6 << "  </body>\n";
+        fStream6 << "</html>\n";
+    }  
+    
+    std::ofstream fStream7("generate_timings", std::ios_base::ate);
+    if (!fStream7.is_open()) {
+        jack_error("JackEngineProfiling::Save cannot open generate_timings file");
+    } else {
+        fStream7 << "gnuplot -persist Timing1.plot \n";
+        fStream7 << "gnuplot -persist Timing2.plot\n";
+        fStream7 << "gnuplot -persist Timing3.plot\n";
+        fStream7 << "gnuplot -persist Timing4.plot\n";
+        fStream7 << "gnuplot -persist Timing5.plot\n";
+    }       
+}
+
+bool JackEngineProfiling::CheckClient(const char* name, int cur_point)
+{
+    for (int i = 0; i < MEASURED_CLIENTS; i++) {
+       if (strcmp(fIntervalTable[i].fName, name) == 0) {
+            fIntervalTable[i].fEndInterval = cur_point;
+            return true;
+        }
+    }
+    return false;
+}
+
+void JackEngineProfiling::Profile(JackClientInterface** table, 
+                                   JackGraphManager* manager, 
+                                   jack_time_t period_usecs,
+                                   jack_time_t cur_cycle_begin, 
+                                   jack_time_t prev_cycle_end)
+{
+    fAudioCycle = (fAudioCycle + 1) % TIME_POINTS;
+  
+    // Keeps cycle data
+    fProfileTable[fAudioCycle].fPeriodUsecs = period_usecs;
+    fProfileTable[fAudioCycle].fCurCycleBegin = cur_cycle_begin;
+    fProfileTable[fAudioCycle].fPrevCycleEnd = prev_cycle_end;
+    fProfileTable[fAudioCycle].fAudioCycle = fAudioCycle;
+
+    for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = table[i];
+        JackClientTiming* timing = manager->GetClientTiming(i);
+        if (client && client->GetClientControl()->fActive && client->GetClientControl()->fCallback[kRealTimeCallback]) {
+           
+            if (!CheckClient(client->GetClientControl()->fName, fAudioCycle)) {
+                // Keep new measured client
+                fIntervalTable[fMeasuredClient].fRefNum = i;
+                strcpy(fIntervalTable[fMeasuredClient].fName, client->GetClientControl()->fName);
+                fIntervalTable[fMeasuredClient].fBeginInterval = fAudioCycle;
+                fIntervalTable[fMeasuredClient].fEndInterval = fAudioCycle;
+                fMeasuredClient++;
+            }
+            fProfileTable[fAudioCycle].fClientTable[i].fRefNum = i;
+            fProfileTable[fAudioCycle].fClientTable[i].fSignaledAt = timing->fSignaledAt;
+            fProfileTable[fAudioCycle].fClientTable[i].fAwakeAt = timing->fAwakeAt;
+            fProfileTable[fAudioCycle].fClientTable[i].fFinishedAt = timing->fFinishedAt;
+            fProfileTable[fAudioCycle].fClientTable[i].fStatus = timing->fStatus;
+        }
+    }
+}
+
+JackTimingMeasure* JackEngineProfiling::GetCurMeasure()
+{
+    return &fProfileTable[fAudioCycle];
+}
+    
+} // end of namespace
diff --git a/common/JackEngineProfiling.h b/common/JackEngineProfiling.h
new file mode 100644
index 0000000..c06487a
--- /dev/null
+++ b/common/JackEngineProfiling.h
@@ -0,0 +1,135 @@
+/*
+Copyright (C) 2008 Grame & RTL
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackEngineProfiling__
+#define __JackEngineProfiling__
+
+#include "types.h"
+#include "JackTypes.h"
+#include "JackConstants.h"
+#include "JackShmMem.h"
+
+namespace Jack
+{
+
+#define TIME_POINTS 100000
+#define FAILURE_TIME_POINTS 10000
+#define FAILURE_WINDOW 10
+#define MEASURED_CLIENTS 32
+
+/*!
+\brief Timing stucture for a client.
+*/
+
+struct JackTimingMeasureClient
+{
+    int fRefNum;
+    jack_time_t	fSignaledAt;
+    jack_time_t	fAwakeAt;
+    jack_time_t	fFinishedAt;
+    jack_client_state_t fStatus;
+    
+    JackTimingMeasureClient() 
+        :fRefNum(-1),
+        fSignaledAt(0),
+        fAwakeAt(0),
+        fFinishedAt(0),
+        fStatus((jack_client_state_t)0)
+    {}
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Timing interval in the global table for a given client
+*/
+
+struct JackTimingClientInterval
+{
+    int fRefNum;
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+    int fBeginInterval;
+    int fEndInterval;
+    
+    JackTimingClientInterval()
+         :fRefNum(-1),
+         fBeginInterval(-1),
+         fEndInterval(-1)
+    {}
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Timing stucture for a table of clients.
+*/
+
+struct JackTimingMeasure
+{
+    unsigned int fAudioCycle;
+    jack_time_t fPeriodUsecs;
+    jack_time_t fCurCycleBegin;
+    jack_time_t fPrevCycleEnd;
+    JackTimingMeasureClient fClientTable[CLIENT_NUM];
+    
+    JackTimingMeasure()
+        :fAudioCycle(0), 
+        fPeriodUsecs(0),
+        fCurCycleBegin(0),
+        fPrevCycleEnd(0)
+    {}
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Client timing monitoring.
+*/
+
+class JackClientInterface;
+class JackGraphManager;
+
+class SERVER_EXPORT JackEngineProfiling
+{
+
+    private:
+    
+        JackTimingMeasure fProfileTable[TIME_POINTS];
+        JackTimingClientInterval fIntervalTable[MEASURED_CLIENTS];
+         
+        unsigned int fAudioCycle;
+        unsigned int fMeasuredClient;
+        
+        bool CheckClient(const char* name, int cur_point);
+        
+    public:
+    
+        JackEngineProfiling();
+        ~JackEngineProfiling();
+   
+        void Profile(JackClientInterface** table, 
+                    JackGraphManager* manager, 
+                    jack_time_t period_usecs,
+                    jack_time_t cur_cycle_begin, 
+                    jack_time_t prev_cycle_end);
+                    
+        JackTimingMeasure* GetCurMeasure();
+
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+#endif
diff --git a/common/JackError.cpp b/common/JackError.cpp
new file mode 100644
index 0000000..3705c35
--- /dev/null
+++ b/common/JackError.cpp
@@ -0,0 +1,138 @@
+/*
+    Copyright (C) 2001 Paul Davis
+	Copyright (C) 2004-2008 Grame
+    Copyright (C) 2008 Nedko Arnaudov
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "JackError.h"
+#include "JackGlobals.h"
+#include "JackMessageBuffer.h"
+
+using namespace Jack;
+
+void change_thread_log_function(jack_log_function_t log_function)
+{
+    if (!jack_tls_set(JackGlobals::fKeyLogFunction, (void*)log_function))
+    {
+        jack_error("failed to set thread log function");
+    }
+}
+
+SERVER_EXPORT void set_threaded_log_function()
+{
+    change_thread_log_function(JackMessageBufferAdd);
+}
+
+void jack_log_function(int level, const char *message)
+{
+    void (* log_callback)(const char *);
+
+    switch (level)
+    {
+    case LOG_LEVEL_INFO:
+        log_callback = jack_info_callback;
+        break;
+    case LOG_LEVEL_ERROR:
+        log_callback = jack_error_callback;
+        break;
+    default:
+        return;
+    }
+
+    log_callback(message);
+}
+
+static void jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap)
+{
+    char buffer[300];
+    size_t len;
+    jack_log_function_t log_function;
+
+    if (prefix != NULL) {
+        len = strlen(prefix);
+        memcpy(buffer, prefix, len);
+    } else {
+        len = 0;
+    }
+
+    vsnprintf(buffer + len, sizeof(buffer) - len, fmt, ap);
+
+    log_function = (jack_log_function_t)jack_tls_get(JackGlobals::fKeyLogFunction);
+
+    /* if log function is not overriden for thread, use default one */
+    if (log_function == NULL)
+    {
+        log_function = jack_log_function;
+        //log_function(LOG_LEVEL_INFO, "------ Using default log function");
+    }
+    else
+    {
+        //log_function(LOG_LEVEL_INFO, "++++++ Using thread-specific log function");
+    }
+
+    log_function(level, buffer);
+}
+
+SERVER_EXPORT void jack_error(const char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	jack_format_and_log(LOG_LEVEL_ERROR, NULL, fmt, ap);
+	va_end(ap);
+}
+
+SERVER_EXPORT void jack_info(const char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	jack_format_and_log(LOG_LEVEL_INFO, NULL, fmt, ap);
+	va_end(ap);
+}
+
+SERVER_EXPORT void jack_log(const char *fmt,...)
+{
+	if (JackGlobals::fVerbose) {
+		va_list ap;
+		va_start(ap, fmt);
+        jack_format_and_log(LOG_LEVEL_INFO, "Jack: ", fmt, ap);
+		va_end(ap);
+	}
+}
+
+SERVER_EXPORT void default_jack_error_callback(const char *desc)
+{
+    fprintf(stderr, "%s\n", desc);
+    fflush(stderr);
+}
+
+SERVER_EXPORT void default_jack_info_callback(const char *desc)
+{
+    fprintf(stdout, "%s\n", desc);
+    fflush(stdout);
+}
+
+SERVER_EXPORT void silent_jack_error_callback(const char *desc)
+{}
+
+SERVER_EXPORT void silent_jack_info_callback(const char *desc)
+{}
+
+SERVER_EXPORT void (*jack_error_callback)(const char *desc) = &default_jack_error_callback;
+SERVER_EXPORT void (*jack_info_callback)(const char *desc) = &default_jack_info_callback;
diff --git a/common/JackError.h b/common/JackError.h
new file mode 100644
index 0000000..403c55a
--- /dev/null
+++ b/common/JackError.h
@@ -0,0 +1,66 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+Copyright (C) 2008 Nedko Arnaudov
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+*/
+
+#ifndef __JackError__
+#define __JackError__
+
+#include <string.h>
+#include <errno.h>
+#include "JackCompilerDeps.h"
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define LOG_LEVEL_INFO   1
+#define LOG_LEVEL_ERROR  2
+
+    SERVER_EXPORT void jack_error(const char *fmt, ...);
+
+    SERVER_EXPORT void jack_info(const char *fmt, ...);
+
+    // like jack_info() but only if verbose mode is enabled
+    SERVER_EXPORT void jack_log(const char *fmt, ...);
+
+    SERVER_EXPORT extern void (*jack_error_callback)(const char *desc);
+    SERVER_EXPORT extern void (*jack_info_callback)(const char *desc);
+    
+    SERVER_EXPORT extern void default_jack_error_callback(const char *desc);
+    SERVER_EXPORT extern void default_jack_info_callback(const char *desc);
+    
+    SERVER_EXPORT extern void silent_jack_error_callback(const char *desc);
+    SERVER_EXPORT extern void silent_jack_info_callback(const char *desc);
+
+    typedef void (* jack_log_function_t)(int level, const char *message);
+
+    void change_thread_log_function(jack_log_function_t log_function);
+    void jack_log_function(int level, const char *message);
+   
+    SERVER_EXPORT void set_threaded_log_function();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/JackException.h b/common/JackException.h
new file mode 100644
index 0000000..58a9a23
--- /dev/null
+++ b/common/JackException.h
@@ -0,0 +1,116 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackException__
+#define __JackException__
+
+#include <stdexcept>
+#include <iostream>
+#include <string>
+#include "JackCompilerDeps.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+/*!
+\brief Exception base class.
+*/
+
+class SERVER_EXPORT JackException : public std::runtime_error {
+
+    public:
+
+        JackException(const std::string& msg) : std::runtime_error(msg)
+        {}
+        JackException(char* msg) : std::runtime_error(msg)
+        {}
+        JackException(const char* msg) : std::runtime_error(msg)
+        {}
+
+        std::string Message()
+        {
+            return what();
+        }
+
+        void PrintMessage()
+        {
+            std::string str = what();
+            if (str != "")
+                jack_info(str.c_str());
+        }
+};
+
+/*!
+ \brief Exception thrown by JackEngine in temporary mode.
+ */
+
+class SERVER_EXPORT JackTemporaryException : public JackException {
+    
+    public:
+        
+        JackTemporaryException(const std::string& msg) : JackException(msg)
+        {}
+        JackTemporaryException(char* msg) : JackException(msg)
+        {}
+        JackTemporaryException(const char* msg) : JackException(msg)
+        {}
+        JackTemporaryException() : JackException("")
+        {}
+};
+    
+/*!
+ \brief 
+ */
+
+class SERVER_EXPORT JackQuitException : public JackException {
+    
+    public:
+        
+        JackQuitException(const std::string& msg) : JackException(msg)
+        {}
+        JackQuitException(char* msg) : JackException(msg)
+        {}
+        JackQuitException(const char* msg) : JackException(msg)
+        {}
+        JackQuitException() : JackException("")
+        {}
+};
+    
+/*!
+\brief Exception possibly thrown by Net slaves.
+*/
+
+class SERVER_EXPORT JackNetException : public JackException {
+
+    public:
+
+        JackNetException(const std::string& msg) : JackException(msg)
+        {}
+        JackNetException(char* msg) : JackException(msg)
+        {}
+        JackNetException(const char* msg) : JackException(msg)
+        {}
+        JackNetException() : JackException("")
+        {}
+};
+
+}
+
+#endif
diff --git a/common/JackExternalClient.cpp b/common/JackExternalClient.cpp
new file mode 100644
index 0000000..4d56557
--- /dev/null
+++ b/common/JackExternalClient.cpp
@@ -0,0 +1,87 @@
+/*
+  Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackExternalClient.h"
+#include "JackClientControl.h"
+#include "JackGlobals.h"
+#include "JackChannel.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+JackExternalClient::JackExternalClient(): fClientControl(NULL)
+{}
+
+JackExternalClient::~JackExternalClient()
+{}
+
+int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    int result = -1;
+    jack_log("JackExternalClient::ClientNotify ref = %ld name = %s notify = %ld", refnum, name, notify);
+    fChannel.ClientNotify(refnum, name, notify, sync, message, value1, value2, &result);
+    return result;
+}
+
+int JackExternalClient::Open(const char* name, int pid, int refnum, int* shared_client)
+{
+    try {
+
+        if (fChannel.Open(name) < 0) {
+            jack_error("Cannot connect to client name = %s\n", name);
+            return -1;
+        }
+        
+        // Use "placement new" to allocate object in shared memory
+        JackShmMemAble* shared_mem = static_cast<JackShmMemAble*>(JackShmMem::operator new(sizeof(JackClientControl)));
+        shared_mem->Init();
+        fClientControl = new(shared_mem) JackClientControl(name, pid, refnum);
+      
+        if (!fClientControl) {
+            jack_error("Cannot allocate client shared memory segment");
+            return -1;
+        }
+       
+        *shared_client = shared_mem->GetShmIndex();
+        jack_log("JackExternalClient::Open name = %s index = %ld base = %x", name, shared_mem->GetShmIndex(), shared_mem->GetShmAddress());
+        return 0;
+
+    } catch (std::exception e) {
+        return -1;
+    }
+}
+
+int JackExternalClient::Close()
+{
+    fChannel.Close();
+    if (fClientControl) {
+        fClientControl->~JackClientControl();
+        JackShmMem::operator delete(fClientControl);
+    }
+    return 0;
+}
+
+JackClientControl* JackExternalClient::GetClientControl() const
+{
+    return fClientControl;
+}
+
+} // end of namespace
diff --git a/common/JackExternalClient.h b/common/JackExternalClient.h
new file mode 100644
index 0000000..29e0f7d
--- /dev/null
+++ b/common/JackExternalClient.h
@@ -0,0 +1,60 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackExternalClient__
+#define __JackExternalClient__
+
+#include "JackClientInterface.h"
+#include "JackPlatformPlug.h"
+
+namespace Jack
+{
+
+struct JackClientControl;
+
+/*!
+\brief Server side implementation of library clients.
+*/
+
+class JackExternalClient : public JackClientInterface
+{
+
+    private:
+
+        JackNotifyChannel fChannel;   /*! Server/client communication channel */
+        JackClientControl*	fClientControl;     /*! Client control in shared memory     */
+
+    public:
+
+        JackExternalClient();
+        virtual ~JackExternalClient();
+
+        int Open(const char* name, int pid, int refnum, int* shared_client);
+        int Close();
+
+        int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
+
+        JackClientControl* GetClientControl() const;
+};
+
+
+} // end of namespace
+
+#endif
diff --git a/common/JackFilters.h b/common/JackFilters.h
new file mode 100644
index 0000000..76bf7ec
--- /dev/null
+++ b/common/JackFilters.h
@@ -0,0 +1,335 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackFilters__
+#define __JackFilters__
+
+#include "jack.h"
+#include "JackAtomicState.h"
+#include <math.h>
+#include <stdlib.h>
+
+namespace Jack
+{
+
+    #define MAX_SIZE 64
+    
+	struct JackFilter 
+    {
+    
+        jack_time_t fTable[MAX_SIZE];
+        
+        JackFilter()
+        {
+            for (int i = 0; i < MAX_SIZE; i++)
+                fTable[i] = 0;
+        }
+        
+        void AddValue(jack_time_t val)
+        {
+            memcpy(&fTable[1], &fTable[0], sizeof(jack_time_t) * (MAX_SIZE - 1));
+            fTable[0] = val;
+        }
+        
+        jack_time_t GetVal()
+        {
+            jack_time_t mean = 0;
+            for (int i = 0; i < MAX_SIZE; i++)
+                mean += fTable[i];
+            return mean / MAX_SIZE;
+        }
+        
+    } POST_PACKED_STRUCTURE;
+    
+    class JackDelayLockedLoop
+    {
+    
+        private:
+        
+            jack_nframes_t fFrames;
+            jack_time_t	fCurrentWakeup;
+            jack_time_t	fCurrentCallback;
+            jack_time_t	fNextWakeUp;
+            float fSecondOrderIntegrator;
+            jack_nframes_t fBufferSize;
+            jack_nframes_t fSampleRate;
+            jack_time_t fPeriodUsecs;
+            float fFilterCoefficient;	/* set once, never altered */
+            bool fUpdating;
+        
+        public:
+        
+            JackDelayLockedLoop()
+            {}
+            
+            JackDelayLockedLoop(jack_nframes_t buffer_size, jack_nframes_t sample_rate)
+            {
+                Init(buffer_size, sample_rate);
+            }
+            
+            void Init(jack_nframes_t buffer_size, jack_nframes_t sample_rate)
+            {
+                fFrames = 0;
+                fCurrentWakeup = 0;
+                fCurrentCallback = 0;
+                fNextWakeUp = 0;
+                fFilterCoefficient = 0.01f;
+                fSecondOrderIntegrator = 0.0f;
+                fBufferSize = buffer_size;
+                fSampleRate = sample_rate;
+                fPeriodUsecs = jack_time_t(1000000.f / fSampleRate * fBufferSize);	// in microsec
+            }
+        
+            void Init(jack_time_t callback_usecs)
+            {
+                fFrames = 0;
+                fCurrentWakeup = 0;
+                fSecondOrderIntegrator = 0.0f;
+                fCurrentCallback = callback_usecs;
+                fNextWakeUp = callback_usecs + fPeriodUsecs;
+            }
+            
+            void IncFrame(jack_time_t callback_usecs)
+            {
+                float delta = (int64_t)callback_usecs - (int64_t)fNextWakeUp;
+                fCurrentWakeup = fNextWakeUp;
+                fCurrentCallback = callback_usecs;
+                fFrames += fBufferSize;
+                fSecondOrderIntegrator += 0.5f * fFilterCoefficient * delta;
+                fNextWakeUp = fCurrentWakeup + fPeriodUsecs + (int64_t) floorf((fFilterCoefficient * (delta + fSecondOrderIntegrator)));
+            }
+            
+            jack_nframes_t Time2Frames(jack_time_t time)
+            {
+                long delta = (long) rint(((double) ((long long)(time - fCurrentWakeup)) / ((long long)(fNextWakeUp - fCurrentWakeup))) * fBufferSize);
+                return (delta < 0) ? ((fFrames > 0) ? fFrames : 1) : (fFrames + delta);
+            }
+            
+            jack_time_t Frames2Time(jack_nframes_t frames)
+            {
+                long delta = (long) rint(((double) ((long long)(frames - fFrames)) * ((long long)(fNextWakeUp - fCurrentWakeup))) / fBufferSize);
+                return (delta < 0) ? ((fCurrentWakeup > 0) ? fCurrentWakeup : 1) : (fCurrentWakeup + delta);
+            }
+            
+            jack_nframes_t CurFrame()
+            {
+                return fFrames;
+            }
+                 
+            jack_time_t CurTime()
+            {
+                return fCurrentWakeup;
+            }
+  
+    } POST_PACKED_STRUCTURE;
+    
+    class JackAtomicDelayLockedLoop : public JackAtomicState<JackDelayLockedLoop>
+    {
+         public:
+         
+            JackAtomicDelayLockedLoop(jack_nframes_t buffer_size, jack_nframes_t sample_rate)
+            {
+                fState[0].Init(buffer_size, sample_rate);
+                fState[1].Init(buffer_size, sample_rate);
+            }
+            
+            void Init(jack_time_t callback_usecs)
+            {
+                JackDelayLockedLoop* dll = WriteNextStateStart();
+                dll->Init(callback_usecs);
+                WriteNextStateStop();
+                TrySwitchState(); // always succeed since there is only one writer
+            }
+            
+            void Init(jack_nframes_t buffer_size, jack_nframes_t sample_rate)
+            {
+                JackDelayLockedLoop* dll = WriteNextStateStart();
+                dll->Init(buffer_size, sample_rate);
+                WriteNextStateStop();
+                TrySwitchState(); // always succeed since there is only one writer
+            }
+            
+            void IncFrame(jack_time_t callback_usecs)
+            {
+                JackDelayLockedLoop* dll = WriteNextStateStart();
+                dll->IncFrame(callback_usecs);
+                WriteNextStateStop();
+                TrySwitchState(); // always succeed since there is only one writer
+            }
+            
+            jack_nframes_t Time2Frames(jack_time_t time)
+            {
+                UInt16 next_index = GetCurrentIndex();
+                UInt16 cur_index;
+                jack_nframes_t res;
+                
+                do {
+                    cur_index = next_index;
+                    res = ReadCurrentState()->Time2Frames(time);
+                    next_index = GetCurrentIndex();
+                } while (cur_index != next_index); // Until a coherent state has been read
+                
+                return res;
+            }
+             
+            jack_time_t Frames2Time(jack_nframes_t frames)
+            {
+                UInt16 next_index = GetCurrentIndex();
+                UInt16 cur_index;
+                jack_time_t res;
+                
+                do {
+                    cur_index = next_index;
+                    res = ReadCurrentState()->Frames2Time(frames);
+                    next_index = GetCurrentIndex();
+                } while (cur_index != next_index); // Until a coherent state has been read
+                
+                return res;
+            }
+    } POST_PACKED_STRUCTURE;
+    
+    /*
+    Torben Hohn PI controler from JACK1
+    */
+    
+    struct JackPIControler {
+    
+        double resample_mean;
+        double static_resample_factor;
+
+        double* offset_array;
+        double* window_array;
+        int offset_differential_index;
+
+        double offset_integral;
+
+        double catch_factor;
+        double catch_factor2;
+        double pclamp;
+        double controlquant;
+        int smooth_size;
+    
+        double hann(double x)
+        {
+            return 0.5 * (1.0 - cos(2 * M_PI * x));
+        }
+        
+        JackPIControler(double resample_factor, int fir_size)
+        {
+            resample_mean = resample_factor;
+            static_resample_factor = resample_factor;
+            offset_array = new double[fir_size];
+            window_array = new double[fir_size];
+            offset_differential_index = 0;
+            offset_integral = 0.0;
+            smooth_size = fir_size;
+            
+            for (int i = 0; i < fir_size; i++) {
+                offset_array[i] = 0.0;
+                window_array[i] = hann(double(i) / (double(fir_size) - 1.0));
+            }
+
+            // These values could be configurable
+            catch_factor = 100000;
+            catch_factor2 = 10000;
+            pclamp = 15.0;
+            controlquant = 10000.0;
+        }
+        
+        ~JackPIControler()
+        {
+            delete[] offset_array;
+            delete[] window_array;
+        }
+        
+        void Init(double resample_factor)
+        {
+            resample_mean = resample_factor;
+            static_resample_factor = resample_factor;
+        }
+        
+        /*
+        double GetRatio(int fill_level)
+        {
+            double offset = fill_level;
+
+            // Save offset.
+            offset_array[(offset_differential_index++) % smooth_size] = offset;
+            
+            // Build the mean of the windowed offset array basically fir lowpassing.
+            double smooth_offset = 0.0;
+            for (int i = 0; i < smooth_size; i++) {
+                smooth_offset += offset_array[(i + offset_differential_index - 1) % smooth_size] * window_array[i];
+            }
+            smooth_offset /= double(smooth_size);
+        
+            // This is the integral of the smoothed_offset
+            offset_integral += smooth_offset;
+
+            // Clamp offset : the smooth offset still contains unwanted noise which would go straigth onto the resample coeff.
+            // It only used in the P component and the I component is used for the fine tuning anyways.
+            if (fabs(smooth_offset) < pclamp)
+                smooth_offset = 0.0;
+         
+            // Ok, now this is the PI controller. 
+            // u(t) = K * (e(t) + 1/T \int e(t') dt')
+            // Kp = 1/catch_factor and T = catch_factor2  Ki = Kp/T 
+            double current_resample_factor 
+                = static_resample_factor - smooth_offset / catch_factor - offset_integral / catch_factor / catch_factor2;
+            
+            // Now quantize this value around resample_mean, so that the noise which is in the integral component doesnt hurt.
+            current_resample_factor = floor((current_resample_factor - resample_mean) * controlquant + 0.5) / controlquant + resample_mean;
+
+            // Calculate resample_mean so we can init ourselves to saner values.
+            resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor;
+            return current_resample_factor;
+        }
+        */
+
+        double GetRatio(int error)
+        {
+            double smooth_offset = error;
+
+            // This is the integral of the smoothed_offset
+            offset_integral += smooth_offset;
+
+            // Ok, now this is the PI controller. 
+            // u(t) = K * (e(t) + 1/T \int e(t') dt')
+            // Kp = 1/catch_factor and T = catch_factor2 Ki = Kp/T 
+            return static_resample_factor - smooth_offset/catch_factor - offset_integral/catch_factor/catch_factor2;
+        }
+        
+        void OurOfBounds()
+        {
+            int i;
+            // Set the resample_rate... we need to adjust the offset integral, to do this.
+            // first look at the PI controller, this code is just a special case, which should never execute once
+            // everything is swung in. 
+            offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
+            // Also clear the array. we are beginning a new control cycle.
+            for (i = 0; i < smooth_size; i++) {
+                offset_array[i] = 0.0;
+            }
+        }
+    
+    };
+
+}
+
+#endif
diff --git a/common/JackFrameTimer.cpp b/common/JackFrameTimer.cpp
new file mode 100644
index 0000000..bd6d9b5
--- /dev/null
+++ b/common/JackFrameTimer.cpp
@@ -0,0 +1,145 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackFrameTimer.h"
+#include "JackError.h"
+#include <math.h>
+#include <stdio.h>
+
+namespace Jack
+{
+
+#if defined(WIN32) && !defined(__MINGW32__)
+/* missing on Windows : see http://bugs.mysql.com/bug.php?id=15936 */
+inline double rint(double nr)
+{
+    double f = floor(nr);
+    double c = ceil(nr);
+    return (((c -nr) >= (nr - f)) ? f : c);
+}
+#endif
+
+JackTimer::JackTimer()
+{
+    fInitialized = false;
+    fFrames = 0;
+    fCurrentWakeup = 0;
+    fCurrentCallback = 0;
+    fNextWakeUp = 0;
+    fFilterCoefficient = 0.01f;
+    fSecondOrderIntegrator = 0.0f;
+}
+
+jack_nframes_t JackTimer::Time2Frames(jack_time_t time, jack_nframes_t buffer_size)
+{
+    if (fInitialized) {
+        return fFrames + (long)rint(((double) ((long long)(time - fCurrentWakeup)) / ((long long)(fNextWakeUp - fCurrentWakeup))) * buffer_size);
+    } else {
+        return 0;
+    }
+}
+
+jack_time_t JackTimer::Frames2Time(jack_nframes_t frames, jack_nframes_t buffer_size)
+{
+    if (fInitialized) {
+        return fCurrentWakeup + (long)rint(((double) ((long long)(frames - fFrames)) * ((long long)(fNextWakeUp - fCurrentWakeup))) / buffer_size);
+    } else {
+        return 0;
+    }
+}
+
+jack_nframes_t JackTimer::FramesSinceCycleStart(jack_time_t cur_time, jack_nframes_t frames_rate)
+{
+    return (jack_nframes_t) floor((((float)frames_rate) / 1000000.0f) * (cur_time - fCurrentCallback));
+}
+
+void JackFrameTimer::InitFrameTime()
+{
+    fFirstWakeUp = true;
+}
+
+void JackFrameTimer::IncFrameTime(jack_nframes_t buffer_size, jack_time_t callback_usecs, jack_time_t period_usecs)
+{
+    if (fFirstWakeUp) {
+        InitFrameTimeAux(callback_usecs, period_usecs);
+        fFirstWakeUp = false;
+    } else {
+        IncFrameTimeAux(buffer_size, callback_usecs, period_usecs);
+    }
+}
+
+void JackFrameTimer::ResetFrameTime(jack_nframes_t frames_rate, jack_time_t callback_usecs, jack_time_t period_usecs)
+{
+    if (!fFirstWakeUp) { // ResetFrameTime may be called by a xrun/delayed wakeup on the first cycle
+        JackTimer* timer = WriteNextStateStart();
+        jack_nframes_t period_size_guess = (jack_nframes_t)(frames_rate * ((timer->fNextWakeUp - timer->fCurrentWakeup) / 1000000.0));
+        timer->fFrames += ((callback_usecs - timer->fNextWakeUp) / period_size_guess) * period_size_guess;
+        timer->fCurrentWakeup = callback_usecs;
+        timer->fCurrentCallback = callback_usecs;
+        timer->fNextWakeUp = callback_usecs + period_usecs;
+        WriteNextStateStop();
+        TrySwitchState(); // always succeed since there is only one writer
+    }
+}
+
+/*
+	Use the state returned by ReadCurrentState and check that the state was not changed during the read operation.
+	The operation is lock-free since there is no intermediate state in the write operation that could cause the
+	read to loop forever.
+*/
+void JackFrameTimer::ReadFrameTime(JackTimer* timer)
+{
+    UInt16 next_index = GetCurrentIndex();
+    UInt16 cur_index;
+    do {
+        cur_index = next_index;
+        memcpy(timer, ReadCurrentState(), sizeof(JackTimer));
+        next_index = GetCurrentIndex();
+    } while (cur_index != next_index); // Until a coherent state has been read
+}
+
+// Internal
+
+void JackFrameTimer::InitFrameTimeAux(jack_time_t callback_usecs, jack_time_t period_usecs)
+{
+    JackTimer* timer = WriteNextStateStart();
+    timer->fSecondOrderIntegrator = 0.0f;
+    timer->fCurrentCallback = callback_usecs;
+    timer->fNextWakeUp = callback_usecs + period_usecs;
+    WriteNextStateStop();
+    TrySwitchState(); // always succeed since there is only one writer
+}
+
+void JackFrameTimer::IncFrameTimeAux(jack_nframes_t buffer_size, jack_time_t callback_usecs, jack_time_t period_usecs)
+{
+    JackTimer* timer = WriteNextStateStart();
+    float delta = (int64_t)callback_usecs - (int64_t)timer->fNextWakeUp;
+    timer->fCurrentWakeup = timer->fNextWakeUp;
+    timer->fCurrentCallback = callback_usecs;
+    timer->fFrames += buffer_size;
+    timer->fSecondOrderIntegrator += 0.5f * timer->fFilterCoefficient * delta;
+    timer->fNextWakeUp = timer->fCurrentWakeup + period_usecs + (int64_t) floorf((timer->fFilterCoefficient * (delta + timer->fSecondOrderIntegrator)));
+    timer->fInitialized = true;
+    WriteNextStateStop();
+    TrySwitchState(); // always succeed since there is only one writer
+}
+
+} // end of namespace
+
diff --git a/common/JackFrameTimer.h b/common/JackFrameTimer.h
new file mode 100644
index 0000000..aca70ad
--- /dev/null
+++ b/common/JackFrameTimer.h
@@ -0,0 +1,102 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackFrameTimer__
+#define __JackFrameTimer__
+
+#include "JackAtomicState.h"
+#include "JackCompilerDeps.h"
+#include "types.h"
+
+namespace Jack
+{
+
+/*!
+\brief A structure used for time management.
+*/
+
+class SERVER_EXPORT JackTimer
+{
+
+    friend class JackFrameTimer;
+    
+    private: 
+    
+        jack_nframes_t fFrames;
+        jack_time_t	fCurrentWakeup;
+        jack_time_t	fCurrentCallback;
+        jack_time_t	fNextWakeUp;
+        float fSecondOrderIntegrator;
+        float fFilterCoefficient;	/* set once, never altered */
+        bool fInitialized;
+
+    public: 
+    
+        JackTimer();
+        ~JackTimer()
+        {}
+        
+        jack_nframes_t Time2Frames(jack_time_t time, jack_nframes_t buffer_size);
+        jack_time_t Frames2Time(jack_nframes_t frames, jack_nframes_t buffer_size);
+        jack_nframes_t FramesSinceCycleStart(jack_time_t cur_time, jack_nframes_t frames_rate);
+        
+        jack_nframes_t CurFrame()
+        {
+            return fFrames;
+        }
+        
+        jack_time_t CurTime()
+        {
+            return fCurrentWakeup;
+        }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief A class using the JackAtomicState to manage jack time.
+*/
+
+class SERVER_EXPORT JackFrameTimer : public JackAtomicState<JackTimer>
+{
+    
+    private:
+
+        bool fFirstWakeUp;
+        void IncFrameTimeAux(jack_nframes_t buffer_size, jack_time_t callback_usecs, jack_time_t period_usecs);
+        void InitFrameTimeAux(jack_time_t callback_usecs, jack_time_t period_usecs);
+
+    public:
+
+        JackFrameTimer(): fFirstWakeUp(true)
+        {}
+        ~JackFrameTimer()
+        {}
+
+        void InitFrameTime();
+        void ResetFrameTime(jack_nframes_t frames_rate, jack_time_t callback_usecs, jack_time_t period_usecs);
+        void IncFrameTime(jack_nframes_t buffer_size, jack_time_t callback_usecs, jack_time_t period_usecs);
+        void ReadFrameTime(JackTimer* timer);
+        
+} POST_PACKED_STRUCTURE;
+
+
+} // end of namespace
+
+#endif
diff --git a/common/JackFreewheelDriver.cpp b/common/JackFreewheelDriver.cpp
new file mode 100644
index 0000000..c28e30c
--- /dev/null
+++ b/common/JackFreewheelDriver.cpp
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackFreewheelDriver.h"
+#include "JackEngineControl.h"
+#include "JackLockedEngine.h"
+
+namespace Jack
+{
+
+int JackFreewheelDriver::Process()
+{
+    if (fIsMaster) {
+        jack_log("JackFreewheelDriver::Process master %lld", fEngineControl->fTimeOutUsecs);
+        JackDriver::CycleTakeBeginTime();
+        fEngine->Process(fBeginDateUst, fEndDateUst);
+        fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
+        if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, FREEWHEEL_DRIVER_TIMEOUT * 1000000) < 0) { // Wait for all clients to finish for 10 sec
+            jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
+            /* We have a client time-out error, but still continue to process, until a better recovery strategy is chosen */
+            return 0;
+        }
+    } else {
+        fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
+        if (fEngineControl->fSyncMode) {
+            if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0) {
+                jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
+                return -1;
+            }
+        }
+    }
+    return 0;
+}
+
+} // end of namespace
diff --git a/common/JackFreewheelDriver.h b/common/JackFreewheelDriver.h
new file mode 100644
index 0000000..b988ffb
--- /dev/null
+++ b/common/JackFreewheelDriver.h
@@ -0,0 +1,54 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackFreewheelDriver__
+#define __JackFreewheelDriver__
+
+#include "JackDriver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The FreeWheel driver : run Jack engine at full speed.
+*/
+
+class JackFreewheelDriver : public JackDriver
+{
+
+    public:
+
+        JackFreewheelDriver(JackLockedEngine* engine, JackSynchro* table): JackDriver("freewheel", "", engine, table)
+        {}
+        virtual ~JackFreewheelDriver()
+        {}
+
+        bool IsRealTime() const
+        {
+            return false;
+        }
+
+        int Process();
+};
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackGlobals.cpp b/common/JackGlobals.cpp
new file mode 100644
index 0000000..2314c84
--- /dev/null
+++ b/common/JackGlobals.cpp
@@ -0,0 +1,64 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackGlobals.h"
+
+namespace Jack
+{
+
+bool JackGlobals::fVerbose = 0;
+    
+jack_tls_key JackGlobals::fRealTime;
+static bool gKeyRealtimeInitialized = jack_tls_allocate_key(&JackGlobals::fRealTime);
+
+jack_tls_key JackGlobals::fKeyLogFunction;
+static bool fKeyLogFunctionInitialized = jack_tls_allocate_key(&JackGlobals::fKeyLogFunction);
+
+JackMutex* JackGlobals::fOpenMutex = new JackMutex();
+bool JackGlobals::fServerRunning = false;
+JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {};
+
+#ifndef WIN32
+jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create;
+#endif
+    
+#ifdef __CLIENTDEBUG__
+std::ofstream* JackGlobals::fStream = NULL;
+
+void JackGlobals::CheckContext(const char* name)
+{
+    if (JackGlobals::fStream == NULL) {
+        char provstr[256];
+        char buffer[256];
+        time_t curtime;
+        struct tm *loctime;
+        /* Get the current time. */
+        curtime = time (NULL);
+        /* Convert it to local time representation. */
+        loctime = localtime (&curtime);
+        strftime (buffer, 256, "%I-%M", loctime);
+        sprintf(provstr, "JackAPICall-%s.log", buffer);
+        JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate);
+        JackGlobals::fStream->is_open();
+    }
+    (*fStream) << "JACK API call : " << name << ", calling thread : " << pthread_self() << std::endl;
+}
+#endif    
+
+} // end of namespace
diff --git a/common/JackGlobals.h b/common/JackGlobals.h
new file mode 100644
index 0000000..63dc9ab
--- /dev/null
+++ b/common/JackGlobals.h
@@ -0,0 +1,62 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackGlobals__
+#define __JackGlobals__
+
+#include "JackPlatformPlug.h"
+#include "JackConstants.h"
+
+#ifdef __CLIENTDEBUG__ 
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <time.h>
+#endif 
+
+namespace Jack
+{
+
+// Globals used for client management on server or library side.
+struct JackGlobals {
+
+    static jack_tls_key fRealTime;
+    static jack_tls_key fKeyLogFunction;
+    static JackMutex* fOpenMutex;
+    static bool fServerRunning;
+    static JackClient* fClientTable[];
+    static bool fVerbose;
+#ifndef WIN32
+    static jack_thread_creator_t fJackThreadCreator;
+#endif
+    
+#ifdef __CLIENTDEBUG__
+    static std::ofstream* fStream;
+    static void CheckContext(const char* name);
+#endif
+};
+
+// Each "side" server and client will implement this to get the shared graph manager, engine control and inter-process synchro table.
+extern EXPORT JackGraphManager* GetGraphManager();
+extern EXPORT JackEngineControl* GetEngineControl();
+extern EXPORT JackSynchro* GetSynchroTable();
+
+} // end of namespace
+
+#endif
diff --git a/common/JackGraphManager.cpp b/common/JackGraphManager.cpp
new file mode 100644
index 0000000..36e2943
--- /dev/null
+++ b/common/JackGraphManager.cpp
@@ -0,0 +1,862 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackGraphManager.h"
+#include "JackConstants.h"
+#include "JackError.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <algorithm>
+#include <regex.h>
+
+namespace Jack
+{
+
+
+static void AssertBufferSize(jack_nframes_t buffer_size)
+{
+    if (buffer_size > BUFFER_SIZE_MAX) {
+        jack_log("JackGraphManager::AssertBufferSize frames = %ld", buffer_size);
+        assert(buffer_size <= BUFFER_SIZE_MAX);
+    }
+}
+  
+void JackGraphManager::AssertPort(jack_port_id_t port_index)
+{
+    if (port_index >= fPortMax) {
+        jack_log("JackGraphManager::AssertPort port_index = %ld", port_index);
+        assert(port_index < fPortMax);
+    }
+}
+    
+JackGraphManager* JackGraphManager::Allocate(int port_max)
+{
+    // Using "Placement" new
+    void* shared_ptr = JackShmMem::operator new(sizeof(JackGraphManager) + port_max * sizeof(JackPort));
+    return new(shared_ptr) JackGraphManager(port_max);
+}
+
+void JackGraphManager::Destroy(JackGraphManager* manager)
+{
+    // "Placement" new was used
+    manager->~JackGraphManager();
+    JackShmMem::operator delete(manager);
+}
+    
+JackGraphManager::JackGraphManager(int port_max) 
+{
+    assert(port_max <= PORT_NUM_MAX);
+    
+    for (int i = 0; i < port_max; i++) {
+        fPortArray[i].Release();
+    }
+            
+    fPortMax = port_max;
+}
+        
+JackPort* JackGraphManager::GetPort(jack_port_id_t port_index)
+{
+    AssertPort(port_index);
+    return &fPortArray[port_index];
+}
+
+float* JackGraphManager::GetBuffer(jack_port_id_t port_index)
+{
+    return fPortArray[port_index].GetBuffer();
+}
+
+// Server
+void JackGraphManager::InitRefNum(int refnum)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    manager->InitRefNum(refnum);
+    WriteNextStateStop();
+}
+
+// RT
+void JackGraphManager::RunCurrentGraph()
+{
+    JackConnectionManager* manager = ReadCurrentState();
+    manager->ResetGraph(fClientTiming);
+}
+
+// RT
+bool JackGraphManager::RunNextGraph()
+{
+    bool res;
+    JackConnectionManager* manager = TrySwitchState(&res);
+    manager->ResetGraph(fClientTiming);
+    return res;
+}
+
+// RT
+bool JackGraphManager::IsFinishedGraph()
+{
+    JackConnectionManager* manager = ReadCurrentState();
+    return (manager->GetActivation(FREEWHEEL_DRIVER_REFNUM) == 0);
+}
+
+// RT
+int JackGraphManager::ResumeRefNum(JackClientControl* control, JackSynchro* table)
+{
+    JackConnectionManager* manager = ReadCurrentState();
+    return manager->ResumeRefNum(control, table, fClientTiming);
+}
+
+// RT
+int JackGraphManager::SuspendRefNum(JackClientControl* control, JackSynchro* table, long usec)
+{
+    JackConnectionManager* manager = ReadCurrentState();
+    return manager->SuspendRefNum(control, table, fClientTiming, usec);
+}
+
+// Server
+void JackGraphManager::DirectConnect(int ref1, int ref2)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    manager->DirectConnect(ref1, ref2);
+    jack_log("JackGraphManager::ConnectRefNum cur_index = %ld ref1 = %ld ref2 = %ld", CurIndex(fCounter), ref1, ref2);
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::DirectDisconnect(int ref1, int ref2)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    manager->DirectDisconnect(ref1, ref2);
+    jack_log("JackGraphManager::DisconnectRefNum cur_index = %ld ref1 = %ld ref2 = %ld", CurIndex(fCounter), ref1, ref2);
+    WriteNextStateStop();
+}
+
+// Server
+bool JackGraphManager::IsDirectConnection(int ref1, int ref2)
+{
+    JackConnectionManager* manager = ReadCurrentState();
+    return manager->IsDirectConnection(ref1, ref2);
+}
+
+// RT
+void* JackGraphManager::GetBuffer(jack_port_id_t port_index, jack_nframes_t buffer_size)
+{
+    AssertPort(port_index);
+    AssertBufferSize(buffer_size);
+
+    JackConnectionManager* manager = ReadCurrentState();
+    JackPort* port = GetPort(port_index);
+
+    // This happens when a port has just been unregistered and is still used by the RT code
+    if (!port->IsUsed()) {
+        jack_log("JackGraphManager::GetBuffer : port = %ld is released state", port_index);
+        return GetBuffer(0); // port_index 0 is not used
+    }
+
+    // Output port
+    if (port->fFlags & JackPortIsOutput) {
+        return (port->fTied != NO_PORT) ? GetBuffer(port->fTied, buffer_size) : GetBuffer(port_index);
+    }
+
+    // Input port
+    jack_int_t len = manager->Connections(port_index);
+
+    // No connections : return a zero-filled buffer
+    if (len == 0) { 
+        port->ClearBuffer(buffer_size);
+        return port->GetBuffer();
+        
+    // One connection
+    } else if (len == 1) {	 
+        jack_port_id_t src_index = manager->GetPort(port_index, 0);
+        
+        // Ports in same client : copy the buffer
+        if (GetPort(src_index)->GetRefNum() == port->GetRefNum()) {
+            void* buffers[1];
+            buffers[0] = GetBuffer(src_index, buffer_size);
+            port->MixBuffers(buffers, 1, buffer_size);
+            return port->GetBuffer();
+        // Otherwise, use zero-copy mode, just pass the buffer of the connected (output) port.
+        } else {
+            return GetBuffer(src_index, buffer_size);
+        }
+        
+    // Multiple connections : mix all buffers
+    } else {  
+    
+        const jack_int_t* connections = manager->GetConnections(port_index);
+        void* buffers[CONNECTION_NUM_FOR_PORT];
+        jack_port_id_t src_index;
+        int i;
+
+        for (i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((src_index = connections[i]) != EMPTY); i++) {
+            AssertPort(src_index);
+            buffers[i] = GetBuffer(src_index, buffer_size);
+        }
+
+        port->MixBuffers(buffers, i, buffer_size);
+        return port->GetBuffer();
+    }
+}
+
+// Server
+int JackGraphManager::RequestMonitor(jack_port_id_t port_index, bool onoff) // Client
+{
+    AssertPort(port_index);
+    JackPort* port = GetPort(port_index);
+
+    /**
+    jackd.h 
+        * If @ref JackPortCanMonitor is set for this @a port, turn input
+        * monitoring on or off. Otherwise, do nothing.
+     
+     if (!(fFlags & JackPortCanMonitor))
+    	return -1;
+    */
+
+    port->RequestMonitor(onoff);
+
+    const jack_int_t* connections = ReadCurrentState()->GetConnections(port_index);
+    if ((port->fFlags & JackPortIsOutput) == 0) { // ?? Taken from jack, why not (port->fFlags  & JackPortIsInput) ?
+        jack_port_id_t src_index;
+        for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((src_index = connections[i]) != EMPTY); i++) {
+            // XXX much worse things will happen if there is a feedback loop !!!
+            RequestMonitor(src_index, onoff);
+        }
+    }
+
+    return 0;
+}
+
+// Client
+jack_nframes_t JackGraphManager::ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count)
+{
+    const jack_int_t* connections = manager->GetConnections(port_index);
+    jack_nframes_t max_latency = 0;
+    jack_port_id_t dst_index;
+
+    if (hop_count > 8)
+        return GetPort(port_index)->GetLatency();
+
+    for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((dst_index = connections[i]) != EMPTY); i++) {
+        if (src_port_index != dst_index) {
+            AssertPort(dst_index);
+            JackPort* dst_port = GetPort(dst_index);
+            jack_nframes_t this_latency = (dst_port->fFlags & JackPortIsTerminal)
+                                          ? dst_port->GetLatency()
+                                          : ComputeTotalLatencyAux(dst_index, port_index, manager, hop_count + 1);
+            max_latency = ((max_latency > this_latency) ? max_latency : this_latency);
+        }
+    }
+
+    return max_latency + GetPort(port_index)->GetLatency();
+}
+
+// Client
+int JackGraphManager::ComputeTotalLatency(jack_port_id_t port_index)
+{
+    UInt16 cur_index;
+    UInt16 next_index;
+    JackPort* port = GetPort(port_index);
+    AssertPort(port_index);
+
+    do {
+        cur_index = GetCurrentIndex();
+        port->fTotalLatency = ComputeTotalLatencyAux(port_index, port_index, ReadCurrentState(), 0);
+        next_index = GetCurrentIndex();
+    } while (cur_index != next_index); // Until a coherent state has been read
+
+    jack_log("JackGraphManager::GetTotalLatency port_index = %ld total latency = %ld", port_index, port->fTotalLatency);
+    return 0;
+}
+
+// Client
+int JackGraphManager::ComputeTotalLatencies()
+{
+    jack_port_id_t port_index;
+    for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
+        JackPort* port = GetPort(port_index);
+        if (port->IsUsed())
+            ComputeTotalLatency(port_index);
+    }
+    return 0;
+}
+
+// Server
+void JackGraphManager::SetBufferSize(jack_nframes_t buffer_size)
+{
+    jack_log("JackGraphManager::SetBufferSize size = %ld", buffer_size);
+
+    jack_port_id_t port_index;
+    for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
+        JackPort* port = GetPort(port_index);
+        if (port->IsUsed())
+            port->ClearBuffer(buffer_size);
+    }
+}
+
+// Server
+jack_port_id_t JackGraphManager::AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags)
+{
+    jack_port_id_t port_index;
+
+    // Available ports start at FIRST_AVAILABLE_PORT (= 1), otherwise a port_index of 0 is "seen" as a NULL port by the external API...
+    for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
+        JackPort* port = GetPort(port_index);
+        if (!port->IsUsed()) {
+            jack_log("JackGraphManager::AllocatePortAux port_index = %ld name = %s type = %s", port_index, port_name, port_type);
+            if (!port->Allocate(refnum, port_name, port_type, flags))
+                return NO_PORT;
+            break;
+        }
+    }
+
+    return (port_index < fPortMax) ? port_index : NO_PORT;
+}
+
+// Server
+jack_port_id_t JackGraphManager::AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    jack_port_id_t port_index = AllocatePortAux(refnum, port_name, port_type, flags);
+
+    if (port_index != NO_PORT) {
+        JackPort* port = GetPort(port_index);
+        assert(port);
+        port->ClearBuffer(buffer_size);
+
+        int res;
+        if (flags & JackPortIsOutput) {
+            res = manager->AddOutputPort(refnum, port_index);
+        } else {
+            res = manager->AddInputPort(refnum, port_index);
+        }
+        // Insertion failure
+        if (res < 0) {
+            port->Release();
+            port_index = NO_PORT;
+        }
+    }
+
+    WriteNextStateStop();
+    return port_index;
+}
+
+// Server
+int JackGraphManager::ReleasePort(int refnum, jack_port_id_t port_index)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    JackPort* port = GetPort(port_index);
+    int res;
+
+    if (port->fFlags & JackPortIsOutput) {
+        DisconnectAllOutput(port_index);
+        res = manager->RemoveOutputPort(refnum, port_index);
+    } else {
+        DisconnectAllInput(port_index);
+        res = manager->RemoveInputPort(refnum, port_index);
+    }
+
+    port->Release();
+    WriteNextStateStop();
+    return res;
+}
+
+void JackGraphManager::ActivatePort(jack_port_id_t port_index)
+{
+    JackPort* port = GetPort(port_index);
+    port->fFlags = (JackPortFlags)(port->fFlags | JackPortIsActive);
+}
+
+void JackGraphManager::DeactivatePort(jack_port_id_t port_index)
+{
+    JackPort* port = GetPort(port_index);
+    port->fFlags = (JackPortFlags)(port->fFlags | ~JackPortIsActive);
+}
+
+void JackGraphManager::GetInputPorts(int refnum, jack_int_t* res)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    const jack_int_t* input = manager->GetInputPorts(refnum);
+    memcpy(res, input, sizeof(jack_int_t) * PORT_NUM_FOR_CLIENT);
+    WriteNextStateStop();
+}
+
+void JackGraphManager::GetOutputPorts(int refnum, jack_int_t* res)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    const jack_int_t* output = manager->GetOutputPorts(refnum);
+    memcpy(res, output, sizeof(jack_int_t) * PORT_NUM_FOR_CLIENT);
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::RemoveAllPorts(int refnum)
+{
+    jack_log("JackGraphManager::RemoveAllPorts ref = %ld", refnum);
+    JackConnectionManager* manager = WriteNextStateStart();
+    jack_port_id_t port_index;
+
+    // Warning : ReleasePort shift port to left, thus we always remove the first port until the "input" table is empty
+    const jack_int_t* input = manager->GetInputPorts(refnum);
+    while ((port_index = input[0]) != EMPTY) {
+        int res = ReleasePort(refnum, port_index);
+        if (res < 0) {
+            jack_error("JackGraphManager::RemoveAllPorts failure ref = %ld port_index = %ld", refnum, port_index);
+            assert(true);
+            break;
+        }
+    }
+
+    // Warning : ReleasePort shift port to left, thus we always remove the first port until the "output" table is empty
+    const jack_int_t* output = manager->GetOutputPorts(refnum);
+    while ((port_index = output[0]) != EMPTY) {
+        int res = ReleasePort(refnum, port_index);
+        if (res < 0) {
+            jack_error("JackGraphManager::RemoveAllPorts failure ref = %ld port_index = %ld", refnum, port_index);
+            assert(true);
+            break;
+        } 
+    }
+
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::DisconnectAllPorts(int refnum)
+{
+    int i;
+    jack_log("JackGraphManager::DisconnectAllPorts ref = %ld", refnum);
+    JackConnectionManager* manager = WriteNextStateStart();
+
+    const jack_int_t* input = manager->GetInputPorts(refnum);
+    for (i = 0; i < PORT_NUM_FOR_CLIENT && input[i] != EMPTY ; i++) {
+        DisconnectAllInput(input[i]);
+    }
+
+    const jack_int_t* output = manager->GetOutputPorts(refnum);
+    for (i = 0; i < PORT_NUM_FOR_CLIENT && output[i] != EMPTY; i++) {
+        DisconnectAllOutput(output[i]);
+    }
+
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::DisconnectAllInput(jack_port_id_t port_index)
+{
+    jack_log("JackGraphManager::DisconnectAllInput port_index = %ld", port_index);
+    JackConnectionManager* manager = WriteNextStateStart();
+
+    for (unsigned int i = 0; i < fPortMax; i++) {
+        if (manager->IsConnected(i, port_index)) {
+            jack_log("JackGraphManager::Disconnect i = %ld  port_index = %ld", i, port_index);
+            Disconnect(i, port_index);
+        }
+    }
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::DisconnectAllOutput(jack_port_id_t port_index)
+{
+    jack_log("JackGraphManager::DisconnectAllOutput port_index = %ld ", port_index);
+    JackConnectionManager* manager = WriteNextStateStart();
+
+    const jack_int_t* connections = manager->GetConnections(port_index);
+    while (connections[0] != EMPTY) {
+        Disconnect(port_index, connections[0]); // Warning : Disconnect shift port to left
+    }
+    WriteNextStateStop();
+}
+
+// Server
+int JackGraphManager::DisconnectAll(jack_port_id_t port_index)
+{
+    AssertPort(port_index);
+
+    JackPort* port = GetPort(port_index);
+    if (port->fFlags & JackPortIsOutput) {
+        DisconnectAllOutput(port_index);
+    } else {
+        DisconnectAllInput(port_index);
+    }
+    return 0;
+}
+
+// Server
+void JackGraphManager::GetConnections(jack_port_id_t port_index, jack_int_t* res)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    const jack_int_t* connections = manager->GetConnections(port_index);
+    memcpy(res, connections, sizeof(jack_int_t) * CONNECTION_NUM_FOR_PORT);
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::Activate(int refnum)
+{
+    DirectConnect(FREEWHEEL_DRIVER_REFNUM, refnum);
+    DirectConnect(refnum, FREEWHEEL_DRIVER_REFNUM);
+}
+
+/*
+	Disconnection from the FW must be done in last otherwise an intermediate "unconnected"
+	(thus unactivated) state may happen where the client is still checked for its end.
+*/
+
+// Server
+void JackGraphManager::Deactivate(int refnum)
+{
+    // Disconnect only when needed
+    if (IsDirectConnection(refnum, FREEWHEEL_DRIVER_REFNUM)) {
+        DirectDisconnect(refnum, FREEWHEEL_DRIVER_REFNUM);
+    } else {
+        jack_log("JackServer::Deactivate client = %ld was not activated", refnum);
+    }
+
+    // Disconnect only when needed
+    if (IsDirectConnection(FREEWHEEL_DRIVER_REFNUM, refnum)) {
+        DirectDisconnect(FREEWHEEL_DRIVER_REFNUM, refnum);
+    } else {
+        jack_log("JackServer::Deactivate client = %ld was not activated", refnum);
+    }
+}
+
+// Server
+int JackGraphManager::GetInputRefNum(jack_port_id_t port_index)
+{
+    AssertPort(port_index);
+    JackConnectionManager* manager = WriteNextStateStart();
+    int res = manager->GetInputRefNum(port_index);
+    WriteNextStateStop();
+    return res;
+}
+
+// Server
+int JackGraphManager::GetOutputRefNum(jack_port_id_t port_index)
+{
+    AssertPort(port_index);
+    JackConnectionManager* manager = WriteNextStateStart();
+    int res = manager->GetOutputRefNum(port_index);
+    WriteNextStateStop();
+    return res;
+}
+
+int JackGraphManager::Connect(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    jack_log("JackGraphManager::Connect port_src = %ld port_dst = %ld", port_src, port_dst);
+    JackPort* src = GetPort(port_src);
+    JackPort* dst = GetPort(port_dst);
+    int res = 0;
+
+    if (!src->fInUse || !dst->fInUse) {
+        if (!src->fInUse)
+            jack_error("JackGraphManager::Connect port_src = %ld not used name = %s", port_src, GetPort(port_src)->fName);
+        if (!dst->fInUse)
+            jack_error("JackGraphManager::Connect port_dst = %ld not used name = %s", port_dst, GetPort(port_dst)->fName);
+        res = -1;
+        goto end;
+    }
+    if (src->fTypeId != dst->fTypeId) {
+        jack_error("JackGraphManager::Connect different port types port_src = %ld port_dst = %ld", port_src, port_dst);
+        res = -1;
+        goto end;
+    }
+    if (manager->IsConnected(port_src, port_dst)) {
+        jack_error("JackGraphManager::Connect already connected port_src = %ld port_dst = %ld", port_src, port_dst);
+        res = EEXIST;
+        goto end;
+    }
+
+    res = manager->Connect(port_src, port_dst);
+    if (res < 0) {
+        jack_error("JackGraphManager::Connect failed port_src = %ld port_dst = %ld", port_src, port_dst);
+        goto end;
+    }
+    res = manager->Connect(port_dst, port_src);
+    if (res < 0) {
+        jack_error("JackGraphManager::Connect failed port_dst = %ld port_src = %ld", port_dst, port_src);
+        goto end;
+    }
+
+    if (manager->IsLoopPath(port_src, port_dst)) {
+        jack_log("JackGraphManager::Connect: LOOP detected");
+        manager->IncFeedbackConnection(port_src, port_dst);
+    } else {
+        manager->IncDirectConnection(port_src, port_dst);
+    }
+
+end:
+    WriteNextStateStop();
+    return res;
+}
+
+// Server
+int JackGraphManager::Disconnect(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    jack_log("JackGraphManager::Disconnect port_src = %ld port_dst = %ld", port_src, port_dst);
+    bool in_use_src = GetPort(port_src)->fInUse;
+    bool in_use_dst = GetPort(port_dst)->fInUse;
+    int res = 0;
+
+    if (!in_use_src || !in_use_dst) {
+        if (!in_use_src)
+            jack_error("JackGraphManager::Disconnect: port_src = %ld not used name = %s", port_src, GetPort(port_src)->fName);
+        if (!in_use_dst)
+            jack_error("JackGraphManager::Disconnect: port_src = %ld not used name = %s", port_dst, GetPort(port_dst)->fName);
+        res = -1;
+        goto end;
+    }
+    if (!manager->IsConnected(port_src, port_dst)) {
+        jack_error("JackGraphManager::Disconnect not connected port_src = %ld port_dst = %ld", port_src, port_dst);
+        res = -1;
+        goto end;
+    }
+
+    res = manager->Disconnect(port_src, port_dst);
+    if (res < 0) {
+        jack_error("JackGraphManager::Disconnect failed port_src = %ld port_dst = %ld", port_src, port_dst);
+        goto end;
+    }
+    res = manager->Disconnect(port_dst, port_src);
+    if (res < 0) {
+        jack_error("JackGraphManager::Disconnect failed port_dst = %ld port_src = %ld", port_dst, port_src);
+        goto end;
+    }
+
+    if (manager->IsFeedbackConnection(port_src, port_dst)) {
+        jack_log("JackGraphManager::Disconnect: FEEDBACK removed");
+        manager->DecFeedbackConnection(port_src, port_dst);
+    } else {
+        manager->DecDirectConnection(port_src, port_dst);
+    }
+
+end:
+    WriteNextStateStop();
+    return res;
+}
+
+// Client
+int JackGraphManager::IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    JackConnectionManager* manager = ReadCurrentState();
+    return manager->IsConnected(port_src, port_dst);
+}
+
+// Server
+int JackGraphManager::CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst)
+{
+    JackPort* src = GetPort(port_src);
+    JackPort* dst = GetPort(port_dst);
+
+    if ((dst->fFlags & JackPortIsInput) == 0) {
+        jack_error("Destination port in attempted (dis)connection of %s and %s is not an input port", src->fName, dst->fName);
+        return -1;
+    }
+
+    if ((src->fFlags & JackPortIsOutput) == 0) {
+        jack_error("Source port in attempted (dis)connection of %s and %s is not an output port", src->fName, dst->fName);
+        return -1;
+    }
+
+    return 0;
+}
+
+int JackGraphManager::GetTwoPorts(const char* src_name, const char* dst_name, jack_port_id_t* port_src, jack_port_id_t* port_dst)
+{
+    jack_log("JackGraphManager::CheckConnect src_name = %s dst_name = %s", src_name, dst_name);
+
+    if ((*port_src = GetPort(src_name)) == NO_PORT) {
+        jack_error("Unknown source port in attempted (dis)connection src_name [%s] dst_name [%s]", src_name, dst_name);
+        return -1;
+    }
+
+    if ((*port_dst = GetPort(dst_name)) == NO_PORT) {
+        jack_error("Unknown destination port in attempted (dis)connection src_name [%s] dst_name [%s]", src_name, dst_name);
+        return -1;
+    }
+
+    return 0;
+}
+
+// Client : port array
+jack_port_id_t JackGraphManager::GetPort(const char* name)
+{
+    for (unsigned int i = 0; i < fPortMax; i++) {
+        JackPort* port = GetPort(i);
+        if (port->IsUsed() && port->NameEquals(name))
+            return i;
+    }
+    return NO_PORT;
+}
+
+/*!
+\brief Get the connection port name array.
+*/
+
+// Client
+void JackGraphManager::GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index)
+{
+    const jack_int_t* connections = manager->GetConnections(port_index);
+    jack_int_t index;
+    int i;
+    
+    // Cleanup connection array
+    memset(res, 0, sizeof(char*) * CONNECTION_NUM_FOR_PORT);
+
+    for (i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((index = connections[i]) != EMPTY); i++) {
+        JackPort* port = GetPort(index);
+        res[i] = port->fName;
+    }
+
+    res[i] = NULL;
+}
+
+/*
+	Use the state returned by ReadCurrentState and check that the state was not changed during the read operation.
+	The operation is lock-free since there is no intermediate state in the write operation that could cause the
+	read to loop forever.
+*/
+
+// Client
+const char** JackGraphManager::GetConnections(jack_port_id_t port_index)
+{
+    const char** res = (const char**)malloc(sizeof(char*) * CONNECTION_NUM_FOR_PORT);
+    UInt16 cur_index, next_index;
+    
+    if (!res)
+        return NULL;
+
+    do {
+        cur_index = GetCurrentIndex();
+        GetConnectionsAux(ReadCurrentState(), res, port_index);
+        next_index = GetCurrentIndex();
+    } while (cur_index != next_index); // Until a coherent state has been read
+
+    if (res[0]) {	// at least one connection
+        return res;
+    } else {		// empty array, should return NULL
+        free(res);
+        return NULL;
+    }
+}
+
+// Client
+void JackGraphManager::GetPortsAux(const char** matching_ports, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
+{
+    int match_cnt = 0;
+    regex_t port_regex, type_regex;
+  
+    if (port_name_pattern && port_name_pattern[0]) {
+        regcomp(&port_regex, port_name_pattern, REG_EXTENDED | REG_NOSUB);
+    }
+    if (type_name_pattern && type_name_pattern[0]) {
+        regcomp(&type_regex, type_name_pattern, REG_EXTENDED | REG_NOSUB);
+    }
+
+    // Cleanup port array
+    memset(matching_ports, 0, sizeof(char*) * fPortMax);
+
+    for (unsigned int i = 0; i < fPortMax; i++) {
+        bool matching = true;
+        JackPort* port = GetPort(i);
+
+        if (port->IsUsed()) {
+
+            if (flags) {
+                if ((port->fFlags & flags) != flags) {
+                    matching = false;
+                }
+            }
+
+            if (matching && port_name_pattern && port_name_pattern[0]) {
+                if (regexec(&port_regex, port->GetName(), 0, NULL, 0)) {
+                    matching = false;
+                }
+            }
+            if (matching && type_name_pattern && type_name_pattern[0]) {
+                if (regexec(&type_regex, port->GetType(), 0, NULL, 0)) {
+                    matching = false;
+                }
+            }
+
+            if (matching) {
+                matching_ports[match_cnt++] = port->fName;
+            }
+        }
+    }
+
+    matching_ports[match_cnt] = 0;
+
+    if (port_name_pattern && port_name_pattern[0]) {
+        regfree(&port_regex);
+    }
+    if (type_name_pattern && type_name_pattern[0]) {
+        regfree(&type_regex);
+    }
+}
+
+// Client
+/*
+	Check that the state was not changed during the read operation.
+	The operation is lock-free since there is no intermediate state in the write operation that could cause the
+	read to loop forever.
+*/
+const char** JackGraphManager::GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
+{
+    const char** res = (const char**)malloc(sizeof(char*) * fPortMax);
+    UInt16 cur_index, next_index;
+    
+    if (!res)
+        return NULL;
+ 
+    do {
+        cur_index = GetCurrentIndex();
+        GetPortsAux(res, port_name_pattern, type_name_pattern, flags);
+        next_index = GetCurrentIndex();
+    } while (cur_index != next_index);  // Until a coherent state has been read 
+
+    if (res[0]) {    // at least one port
+        return res;
+    } else {
+        free(res);   // empty array, should return NULL
+        return NULL;
+    }
+}
+
+// Server
+void JackGraphManager::Save(JackConnectionManager* dst)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    memcpy(dst, manager, sizeof(JackConnectionManager));
+    WriteNextStateStop();
+}
+
+// Server
+void JackGraphManager::Restore(JackConnectionManager* src)
+{
+    JackConnectionManager* manager = WriteNextStateStart();
+    memcpy(manager, src, sizeof(JackConnectionManager));
+    WriteNextStateStop();
+}
+
+} // end of namespace
+
+
diff --git a/common/JackGraphManager.h b/common/JackGraphManager.h
new file mode 100644
index 0000000..93b09ff
--- /dev/null
+++ b/common/JackGraphManager.h
@@ -0,0 +1,143 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackGraphManager__
+#define __JackGraphManager__
+
+#include "JackShmMem.h"
+#include "JackPort.h"
+#include "JackConstants.h"
+#include "JackConnectionManager.h"
+#include "JackAtomicState.h"
+#include "JackPlatformPlug.h"
+#include "JackSystemDeps.h"
+
+
+namespace Jack
+{
+
+/*!
+\brief Graph manager: contains the connection manager and the port array.
+*/
+    
+class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectionManager>
+{
+
+    private:
+
+        unsigned int fPortMax;
+        JackClientTiming fClientTiming[CLIENT_NUM];
+        JackPort fPortArray[0];    // The actual size depends of port_max, it will be dynamically computed and allocated using "placement" new
+
+        void AssertPort(jack_port_id_t port_index);
+        jack_port_id_t AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
+        void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
+        void GetPortsAux(const char** matching_ports, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
+        float* GetBuffer(jack_port_id_t port_index);
+        void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
+        jack_nframes_t ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
+
+    public:
+
+        JackGraphManager(int port_max);
+        ~JackGraphManager()
+        {}
+
+        void SetBufferSize(jack_nframes_t buffer_size);
+
+        // Ports management
+        jack_port_id_t AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size);
+        int ReleasePort(int refnum, jack_port_id_t port_index);
+        void ActivatePort(jack_port_id_t port_index);
+        void DeactivatePort(jack_port_id_t port_index);
+        void GetInputPorts(int refnum, jack_int_t* res);
+        void GetOutputPorts(int refnum, jack_int_t* res);
+        void RemoveAllPorts(int refnum);
+        void DisconnectAllPorts(int refnum);
+
+        JackPort* GetPort(jack_port_id_t index);
+        jack_port_id_t GetPort(const char* name);
+        int ComputeTotalLatency(jack_port_id_t port_index);
+        int ComputeTotalLatencies();
+        int RequestMonitor(jack_port_id_t port_index, bool onoff);
+   
+        // Connections management
+        int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
+        int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);
+        int IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst);
+
+        // RT, client
+        int GetConnectionsNum(jack_port_id_t port_index)
+        {
+            JackConnectionManager* manager = ReadCurrentState();
+            return manager->Connections(port_index);
+        }
+
+        const char** GetConnections(jack_port_id_t port_index);
+        void GetConnections(jack_port_id_t port_index, jack_int_t* connections);  // TODO
+        const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
+
+        int GetTwoPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index);
+        int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst);
+
+        void DisconnectAllInput(jack_port_id_t port_index);
+        void DisconnectAllOutput(jack_port_id_t port_index);
+        int DisconnectAll(jack_port_id_t port_index);
+
+        bool IsDirectConnection(int ref1, int ref2);
+        void DirectConnect(int ref1, int ref2);
+        void DirectDisconnect(int ref1, int ref2);
+
+        void Activate(int refnum);
+        void Deactivate(int refnum);
+
+        int GetInputRefNum(jack_port_id_t port_index);
+        int GetOutputRefNum(jack_port_id_t port_index);
+
+        // Buffer management
+        void* GetBuffer(jack_port_id_t port_index, jack_nframes_t frames);
+
+        // Activation management
+        void RunCurrentGraph();
+        bool RunNextGraph();
+        bool IsFinishedGraph();
+
+        void InitRefNum(int refnum);
+        int ResumeRefNum(JackClientControl* control, JackSynchro* table);
+        int SuspendRefNum(JackClientControl* control, JackSynchro* table, long usecs);
+
+        JackClientTiming* GetClientTiming(int refnum)
+        {
+            return &fClientTiming[refnum];
+        }
+
+        void Save(JackConnectionManager* dst);
+        void Restore(JackConnectionManager* src);
+    
+        static JackGraphManager* Allocate(int port_max);
+        static void Destroy(JackGraphManager* manager);
+
+} POST_PACKED_STRUCTURE;
+
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackInternalClient.cpp b/common/JackInternalClient.cpp
new file mode 100644
index 0000000..1150a5e
--- /dev/null
+++ b/common/JackInternalClient.cpp
@@ -0,0 +1,234 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackServerGlobals.h"
+#include "JackGraphManager.h"
+#include "JackConstants.h"
+#include "JackInternalClient.h"
+#include "JackLockedEngine.h"
+#include "JackServer.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackInternalClientChannel.h"
+#include "JackTools.h"
+#include <assert.h>
+
+namespace Jack
+{
+
+JackGraphManager* JackInternalClient::fGraphManager = NULL;
+JackEngineControl* JackInternalClient::fEngineControl = NULL;
+
+// Used for external C API (JackAPI.cpp)
+EXPORT JackGraphManager* GetGraphManager()
+{
+    return JackServerGlobals::fInstance->GetGraphManager();
+}
+
+EXPORT JackEngineControl* GetEngineControl()
+{
+    return JackServerGlobals::fInstance->GetEngineControl();
+}
+
+EXPORT JackSynchro* GetSynchroTable()
+{
+    return JackServerGlobals::fInstance->GetSynchroTable();
+}
+
+JackInternalClient::JackInternalClient(JackServer* server, JackSynchro* table): JackClient(table)
+{
+    fChannel = new JackInternalClientChannel(server);
+}
+
+JackInternalClient::~JackInternalClient()
+{
+    delete fChannel;
+}
+
+int JackInternalClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
+{
+    int result;
+    char name_res[JACK_CLIENT_NAME_SIZE + 1];
+    jack_log("JackInternalClient::Open name = %s", name);
+
+    strncpy(fServerName, server_name, sizeof(fServerName));
+
+    fChannel->ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
+    if (result < 0) {
+        int status1 = *status;
+        if (status1 & JackVersionError)
+            jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
+        else
+            jack_error("Client name = %s conflits with another running client", name);
+        goto error;
+    }
+
+    strcpy(fClientControl.fName, name_res);
+
+    // Require new client
+    fChannel->ClientOpen(name_res, &fClientControl.fRefNum, &fEngineControl, &fGraphManager, this, &result);
+    if (result < 0) {
+        jack_error("Cannot open client name = %s", name_res);
+        goto error;
+    }
+
+    SetupDriverSync(false);
+    JackGlobals::fClientTable[fClientControl.fRefNum] = this;
+    JackGlobals::fServerRunning = true;
+    jack_log("JackInternalClient::Open name = %s refnum = %ld", name_res, fClientControl.fRefNum);
+    return 0;
+
+error:
+    fChannel->Stop();
+    fChannel->Close();
+    return -1;
+}
+
+JackGraphManager* JackInternalClient::GetGraphManager() const
+{
+    assert(fGraphManager);
+    return fGraphManager;
+}
+
+JackEngineControl* JackInternalClient::GetEngineControl() const
+{
+    assert(fEngineControl);
+    return fEngineControl;
+}
+
+JackClientControl* JackInternalClient::GetClientControl() const
+{
+    return const_cast<JackClientControl*>(&fClientControl);
+}
+
+int JackLoadableInternalClient::Init(const char* so_name)
+{
+    char path_to_so[JACK_PATH_MAX + 1];
+    BuildClientPath(path_to_so, sizeof(path_to_so), so_name);
+ 
+    fHandle = LoadJackModule(path_to_so);
+    jack_log("JackLoadableInternalClient::JackLoadableInternalClient path_to_so = %s", path_to_so);
+
+    if (fHandle == NULL) {
+        PrintLoadError(so_name);
+        return -1;
+    }
+
+    fFinish = (FinishCallback)GetJackProc(fHandle, "jack_finish");
+    if (fFinish == NULL) {
+        UnloadJackModule(fHandle);
+        jack_error("symbol jack_finish cannot be found in %s", so_name);
+        return -1;
+    }
+
+    fDescriptor = (JackDriverDescFunction)GetJackProc(fHandle, "jack_get_descriptor");
+    if (fDescriptor == NULL) {
+        jack_info("No jack_get_descriptor entry-point for %s", so_name);
+    }
+    return 0;
+}
+
+int JackLoadableInternalClient1::Init(const char* so_name)
+{
+    if (JackLoadableInternalClient::Init(so_name) < 0) {
+        return -1;
+    }
+    
+    fInitialize = (InitializeCallback)GetJackProc(fHandle, "jack_initialize");
+    if (fInitialize == NULL) {
+        UnloadJackModule(fHandle);
+        jack_error("symbol jack_initialize cannot be found in %s", so_name);
+        return -1;
+    }
+
+    return 0;
+}
+
+int JackLoadableInternalClient2::Init(const char* so_name)
+{
+    if (JackLoadableInternalClient::Init(so_name) < 0) {
+        return -1;
+    }
+    
+    fInitialize = (InternalInitializeCallback)GetJackProc(fHandle, "jack_internal_initialize");
+    if (fInitialize == NULL) {
+        UnloadJackModule(fHandle);
+        jack_error("symbol jack_internal_initialize cannot be found in %s", so_name);
+        return -1;
+    }
+
+    return 0;
+}
+
+JackLoadableInternalClient1::JackLoadableInternalClient1(JackServer* server, JackSynchro* table, const char* object_data)
+        : JackLoadableInternalClient(server, table)
+{
+    strncpy(fObjectData, object_data, JACK_LOAD_INIT_LIMIT);   
+}
+
+JackLoadableInternalClient2::JackLoadableInternalClient2(JackServer* server, JackSynchro* table, const JSList*  parameters)
+        : JackLoadableInternalClient(server, table)
+{
+    fParameters = parameters;
+}
+
+JackLoadableInternalClient::~JackLoadableInternalClient()
+{
+    if (fFinish != NULL)
+        fFinish(fProcessArg);
+    if (fHandle != NULL)
+        UnloadJackModule(fHandle);
+}
+
+int JackLoadableInternalClient1::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
+{
+    int res = -1;
+    
+    if (JackInternalClient::Open(server_name, name, options, status) == 0) {
+        if (fInitialize((jack_client_t*)this, fObjectData) == 0) {
+            res = 0;
+        } else {
+            JackInternalClient::Close();
+            fFinish = NULL;
+        }
+    }
+    
+    return res;
+}
+
+int JackLoadableInternalClient2::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
+{
+    int res = -1;
+    
+    if (JackInternalClient::Open(server_name, name, options, status) == 0) {
+        if (fInitialize((jack_client_t*)this, fParameters) == 0) {
+            res = 0;
+        } else {
+            JackInternalClient::Close();
+            fFinish = NULL;
+        }
+    }
+    
+    return res;
+}
+
+} // end of namespace
+
diff --git a/common/JackInternalClient.h b/common/JackInternalClient.h
new file mode 100644
index 0000000..fe39813
--- /dev/null
+++ b/common/JackInternalClient.h
@@ -0,0 +1,129 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackInternalClient__
+#define __JackInternalClient__
+
+#include "JackClient.h"
+#include "JackClientControl.h"
+#include "driver_interface.h"
+
+namespace Jack
+{
+
+struct JackEngineControl;
+
+/*!
+\brief Internal clients in the server.
+*/
+
+class JackInternalClient : public JackClient
+{
+
+    private:
+
+        JackClientControl fClientControl;     /*! Client control */
+
+    public:
+
+        JackInternalClient(JackServer* server, JackSynchro* table);
+        virtual ~JackInternalClient();
+
+        int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
+
+        JackGraphManager* GetGraphManager() const;
+        JackEngineControl* GetEngineControl() const;
+        JackClientControl* GetClientControl() const;
+
+        static JackGraphManager* fGraphManager;		/*! Shared memory Port manager */
+        static JackEngineControl* fEngineControl;	/*! Shared engine cotrol */
+};
+
+/*!
+\brief Loadable internal clients in the server.
+*/
+
+typedef int (*InitializeCallback)(jack_client_t*, const char*);
+typedef int (*InternalInitializeCallback)(jack_client_t*, const JSList* params);
+typedef void (*FinishCallback)(void *);
+typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
+
+class JackLoadableInternalClient : public JackInternalClient
+{
+
+    protected:
+
+        JACK_HANDLE fHandle;
+        FinishCallback fFinish;
+        JackDriverDescFunction fDescriptor;
+
+    public:
+
+        JackLoadableInternalClient(JackServer* server, JackSynchro* table)
+            :JackInternalClient(server, table), fHandle(NULL), fFinish(NULL), fDescriptor(NULL)
+        {}
+        virtual ~JackLoadableInternalClient();
+
+        virtual int Init(const char* so_name);
+
+};
+
+class JackLoadableInternalClient1 : public JackLoadableInternalClient
+{
+
+    private:
+
+        InitializeCallback fInitialize;
+        char fObjectData[JACK_LOAD_INIT_LIMIT];
+    
+    public:
+
+        JackLoadableInternalClient1(JackServer* server, JackSynchro* table, const char* object_data);
+        virtual ~JackLoadableInternalClient1()
+        {}
+
+        int Init(const char* so_name);
+        int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
+
+};
+
+class JackLoadableInternalClient2 : public JackLoadableInternalClient
+{
+
+    private:
+
+        InternalInitializeCallback fInitialize;
+        const JSList* fParameters;
+  
+    public:
+
+        JackLoadableInternalClient2(JackServer* server, JackSynchro* table, const JSList*  parameters);
+        virtual ~JackLoadableInternalClient2()
+        {}
+
+        int Init(const char* so_name);
+        int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
+
+};
+
+
+} // end of namespace
+
+#endif
diff --git a/common/JackInternalClientChannel.h b/common/JackInternalClientChannel.h
new file mode 100644
index 0000000..93130ca
--- /dev/null
+++ b/common/JackInternalClientChannel.h
@@ -0,0 +1,150 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackInternalClientChannel__
+#define __JackInternalClientChannel__
+
+#include "JackChannel.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackClientChannel for server internal clients.
+*/
+
+class JackInternalClientChannel : public detail::JackClientChannelInterface
+{
+
+    private:
+
+        JackServer* fServer;
+        JackLockedEngine* fEngine;
+
+    public:
+
+        JackInternalClientChannel(JackServer* server): fServer(server), fEngine(server->GetEngine())
+        {}
+        virtual ~JackInternalClientChannel()
+        {}
+
+        // Open the Server/Client connection
+        virtual int Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
+        {
+            return 0;
+        }
+
+        void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
+        {
+            *result = fEngine->ClientCheck(name, name_res, protocol, options, status);
+        }
+        void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
+        {
+            *result = fEngine->ClientInternalOpen(name, ref, shared_engine, shared_manager, client, true);
+        }
+        void ClientClose(int refnum, int* result)
+        {
+            *result = fEngine->ClientInternalClose(refnum, true);
+        }
+
+        void ClientActivate(int refnum, int is_real_time, int* result)
+        {
+            *result = fEngine->ClientActivate(refnum, is_real_time);
+        }
+        void ClientDeactivate(int refnum, int* result)
+        {
+            *result = fEngine->ClientDeactivate(refnum);
+        }
+
+        void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, unsigned int* port_index, int* result)
+        {
+            *result = fEngine->PortRegister(refnum, name, type, flags, buffer_size, port_index);
+        }
+        void PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
+        {
+            *result = fEngine->PortUnRegister(refnum, port_index);
+        }
+
+        void PortConnect(int refnum, const char* src, const char* dst, int* result)
+        {
+            *result = fEngine->PortConnect(refnum, src, dst);
+        }
+        void PortDisconnect(int refnum, const char* src, const char* dst, int* result)
+        {
+            *result = fEngine->PortDisconnect(refnum, src, dst);
+        }
+
+        void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+        {
+            *result = fEngine->PortConnect(refnum, src, dst);
+        }
+        void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+        {
+            *result = fEngine->PortDisconnect(refnum, src, dst);
+        }
+        void PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
+        {
+            *result = fEngine->PortRename(refnum, port, name);
+        }
+
+        void SetBufferSize(jack_nframes_t buffer_size, int* result)
+        {
+            *result = fServer->SetBufferSize(buffer_size);
+        }
+        void SetFreewheel(int onoff, int* result)
+        {
+            *result = fServer->SetFreewheel(onoff);
+        }
+
+        void ReleaseTimebase(int refnum, int* result)
+        {
+            *result = fServer->ReleaseTimebase(refnum);
+        }
+
+        void SetTimebaseCallback(int refnum, int conditional, int* result)
+        {
+            *result = fServer->SetTimebaseCallback(refnum, conditional);
+        }
+        
+        void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
+        {
+            *result = fEngine->GetInternalClientName(int_ref, name_res);
+        }
+
+        void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
+        {
+            *result = fEngine->InternalClientHandle(client_name, status, int_ref);
+        }
+
+        void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
+        {
+            *result = fServer->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, status);	
+        }
+
+        void InternalClientUnload(int refnum, int int_ref, int* status, int* result)
+        {
+            *result = fEngine->InternalClientUnload(int_ref, status);
+        }
+
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackLibAPI.cpp b/common/JackLibAPI.cpp
new file mode 100644
index 0000000..45649c2
--- /dev/null
+++ b/common/JackLibAPI.cpp
@@ -0,0 +1,162 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackDebugClient.h"
+#include "JackLibClient.h"
+#include "JackChannel.h"
+#include "JackLibGlobals.h"
+#include "JackGlobals.h"
+#include "JackCompilerDeps.h"
+#include "JackTools.h"
+#include "JackSystemDeps.h"
+#include "JackServerLaunch.h"
+#include <assert.h>
+
+using namespace Jack;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, va_list ap);
+    EXPORT jack_client_t * jack_client_open (const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, ...);
+    EXPORT int jack_client_close (jack_client_t *client);
+    EXPORT int jack_get_client_pid (const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+JackLibGlobals* JackLibGlobals::fGlobals = NULL;
+int JackLibGlobals::fClientCount = 0;
+
+EXPORT jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
+{
+    jack_varargs_t va;		/* variable arguments */
+    jack_status_t my_status;
+    JackClient* client;
+ 
+    if (client_name == NULL) {
+        jack_error("jack_client_open called with a NULL client_name");
+        return NULL;
+    }
+
+    jack_log("jack_client_open %s", client_name);
+   
+    if (status == NULL)			/* no status from caller? */
+        status = &my_status;	/* use local status word */
+    *status = (jack_status_t)0;
+
+    /* validate parameters */
+    if ((options & ~JackOpenOptions)) {
+        int my_status1 = *status | (JackFailure | JackInvalidOption);
+        *status = (jack_status_t)my_status1;
+        return NULL;
+    }
+
+    /* parse variable arguments */
+    if (ap) {
+        jack_varargs_parse(options, ap, &va);
+    } else {
+        jack_varargs_init(&va);
+    }
+        
+    JackLibGlobals::Init(); // jack library initialisation
+
+    if (try_start_server(&va, options, status)) {
+        jack_error("jack server is not running or cannot be started");
+        JackLibGlobals::Destroy(); // jack library destruction
+        return 0;
+    }
+
+    if (JACK_DEBUG) {
+        client = new JackDebugClient(new JackLibClient(GetSynchroTable())); // Debug mode
+    } else {
+        client = new JackLibClient(GetSynchroTable());
+    }
+
+    int res = client->Open(va.server_name, client_name, options, status);
+    if (res < 0) {
+        delete client;
+        JackLibGlobals::Destroy(); // jack library destruction
+        int my_status1 = (JackFailure | JackServerError);
+        *status = (jack_status_t)my_status1;
+        return NULL;
+    } else {
+        return (jack_client_t*)client;
+    }
+}
+
+EXPORT jack_client_t* jack_client_open(const char* ext_client_name, jack_options_t options, jack_status_t* status, ...)
+{
+    try {
+#ifdef __CLIENTDEBUG__
+        JackGlobals::CheckContext("jack_client_open");
+#endif
+        assert(JackGlobals::fOpenMutex);
+        JackGlobals::fOpenMutex->Lock();
+        va_list ap;
+        va_start(ap, status);
+        jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap);
+        va_end(ap);
+        JackGlobals::fOpenMutex->Unlock();
+        return res;
+    } catch(std::bad_alloc& e) {
+        jack_error("Memory allocation error...");
+        return NULL;
+    } catch (...) {
+        jack_error("Unknown error...");
+        return NULL;
+    }
+}
+
+EXPORT int jack_client_close(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_close");
+#endif
+    assert(JackGlobals::fOpenMutex);
+    JackGlobals::fOpenMutex->Lock();
+    int res = -1;
+    jack_log("jack_client_close");
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_client_close called with a NULL client");
+    } else {
+        res = client->Close();
+        delete client;
+        JackLibGlobals::Destroy(); // jack library destruction
+        jack_log("jack_client_close res = %d", res);
+    }
+    JackGlobals::fOpenMutex->Unlock();
+    return res;
+}
+
+EXPORT int jack_get_client_pid(const char *name)
+{
+    jack_error("jack_get_client_pid : not implemented on library side");
+    return 0;
+}
+
diff --git a/common/JackLibClient.cpp b/common/JackLibClient.cpp
new file mode 100644
index 0000000..effdfc6
--- /dev/null
+++ b/common/JackLibClient.cpp
@@ -0,0 +1,177 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackLibClient.h"
+#include "JackTime.h"
+#include "JackLibGlobals.h"
+#include "JackGlobals.h"
+#include "JackPlatformPlug.h"
+#include "JackTools.h"
+
+namespace Jack
+{
+
+// Used for external C API (JackAPI.cpp)
+JackGraphManager* GetGraphManager()
+{
+    if (JackLibGlobals::fGlobals) {
+        return JackLibGlobals::fGlobals->fGraphManager;
+    } else {
+        return NULL;
+    }
+}
+
+JackEngineControl* GetEngineControl()
+{
+    if (JackLibGlobals::fGlobals) {
+        return JackLibGlobals::fGlobals->fEngineControl;
+    } else {
+        return NULL;
+    }
+}
+
+JackSynchro* GetSynchroTable()
+{
+    return (JackLibGlobals::fGlobals ? JackLibGlobals::fGlobals->fSynchroTable : 0);
+}
+
+//-------------------
+// Client management
+//-------------------
+
+JackLibClient::JackLibClient(JackSynchro* table): JackClient(table)
+{
+    jack_log("JackLibClient::JackLibClient table = %x", table);
+    fChannel = new JackClientChannel();
+}
+
+JackLibClient::~JackLibClient()
+{
+    jack_log("JackLibClient::~JackLibClient");
+    delete fChannel;
+}
+
+int JackLibClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
+{
+    int shared_engine, shared_client, shared_graph, result;
+    jack_log("JackLibClient::Open name = %s", name);
+
+    strncpy(fServerName, server_name, sizeof(fServerName));
+
+    // Open server/client channel
+    char name_res[JACK_CLIENT_NAME_SIZE + 1];
+    if (fChannel->Open(server_name, name, name_res, this, options, status) < 0) {
+        jack_error("Cannot connect to the server");
+        goto error;
+    }
+
+    // Start receiving notifications
+    if (fChannel->Start() < 0) {
+        jack_error("Cannot start channel");
+        goto error;
+    }
+
+    // Require new client
+    fChannel->ClientOpen(name_res, JackTools::GetPID(), &shared_engine, &shared_client, &shared_graph, &result);
+    if (result < 0) {
+        jack_error("Cannot open %s client", name_res);
+        goto error;
+    }
+
+    try {
+        // Map shared memory segments
+        JackLibGlobals::fGlobals->fEngineControl.SetShmIndex(shared_engine, fServerName);
+        JackLibGlobals::fGlobals->fGraphManager.SetShmIndex(shared_graph, fServerName);
+        fClientControl.SetShmIndex(shared_client, fServerName);
+        JackGlobals::fVerbose = GetEngineControl()->fVerbose;
+    } catch (int n) {
+        jack_error("Map shared memory segments exception %d", n);
+        goto error;
+    } catch (...) {
+        jack_error("Unknown error...");
+        goto error;
+    }
+
+    SetupDriverSync(false);
+ 
+    // Connect shared synchro : the synchro must be usable in I/O mode when several clients live in the same process
+    if (!fSynchroTable[GetClientControl()->fRefNum].Connect(name_res, fServerName)) {
+        jack_error("Cannot ConnectSemaphore %s client", name_res);
+        goto error;
+    }
+  
+    JackGlobals::fClientTable[GetClientControl()->fRefNum] = this;
+    JackGlobals::fServerRunning = true;
+    SetClockSource(GetEngineControl()->fClockSource);
+    jack_log("JackLibClient::Open name = %s refnum = %ld", name_res, GetClientControl()->fRefNum);
+    return 0;
+
+error:
+    fChannel->Stop();
+    fChannel->Close();
+    return -1;
+}
+
+// Notifications received from the server
+// TODO this should be done once for all clients in the process, when a shared notification channel
+// will be shared by all clients...
+int JackLibClient::ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    int res = 0;
+
+    // Done all time
+    switch (notify) {
+
+        case kAddClient:
+            jack_log("JackClient::AddClient name = %s, ref = %ld ", name, refnum);
+            // the synchro must be usable in I/O mode when several clients live in the same process
+            res = fSynchroTable[refnum].Connect(name, fServerName) ? 0 : -1;
+            break;
+
+        case kRemoveClient:
+            jack_log("JackClient::RemoveClient name = %s, ref = %ld ", name, refnum);
+            if (strcmp(GetClientControl()->fName, name) != 0)
+                res = fSynchroTable[refnum].Disconnect() ? 0 : -1;
+            break;
+    }
+
+    return res;
+}
+
+JackGraphManager* JackLibClient::GetGraphManager() const
+{
+    assert(JackLibGlobals::fGlobals->fGraphManager);
+    return JackLibGlobals::fGlobals->fGraphManager;
+}
+
+JackEngineControl* JackLibClient::GetEngineControl() const
+{
+    assert(JackLibGlobals::fGlobals->fEngineControl);
+    return JackLibGlobals::fGlobals->fEngineControl;
+}
+
+JackClientControl* JackLibClient::GetClientControl() const
+{
+    return fClientControl;
+}
+
+} // end of namespace
+
+
+
diff --git a/common/JackLibClient.h b/common/JackLibClient.h
new file mode 100644
index 0000000..0621ed1
--- /dev/null
+++ b/common/JackLibClient.h
@@ -0,0 +1,60 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackLibClient__
+#define __JackLibClient__
+
+#include "JackClient.h"
+#include "JackShmMem.h"
+#include "JackClientControl.h"
+#include "JackEngineControl.h"
+
+namespace Jack
+{
+
+/*!
+\brief Client on the library side.
+*/
+
+class JackLibClient : public JackClient
+{
+
+    private:
+
+        JackShmReadWritePtr1<JackClientControl>	fClientControl;	/*! Shared client control */
+
+    public:
+
+        JackLibClient(JackSynchro* table);
+        virtual ~JackLibClient();
+
+        int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
+
+        int ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
+
+        JackGraphManager* GetGraphManager() const;
+        JackEngineControl* GetEngineControl() const;
+        JackClientControl* GetClientControl() const;
+};
+
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackLibGlobals.h b/common/JackLibGlobals.h
new file mode 100644
index 0000000..5ef8b9e
--- /dev/null
+++ b/common/JackLibGlobals.h
@@ -0,0 +1,132 @@
+/*
+Copyright (C) 2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackLibGlobals__
+#define __JackLibGlobals__
+
+#include "JackShmMem.h"
+#include "JackEngineControl.h"
+#include "JackGlobals.h"
+#include "JackPlatformPlug.h"
+#include "JackGraphManager.h"
+#include "JackMessageBuffer.h"
+#include "JackTime.h"
+#include "JackClient.h"
+#include "JackError.h"
+#include <assert.h>
+#include <signal.h>
+ 
+
+namespace Jack
+{
+
+class JackClient;
+
+/*!
+\brief Global library static structure: singleton kind of pattern.
+*/
+
+struct JackLibGlobals
+{
+    JackShmReadWritePtr<JackGraphManager> fGraphManager;	/*! Shared memory Port manager */
+    JackShmReadWritePtr<JackEngineControl> fEngineControl;	/*! Shared engine control */  // transport engine has to be writable
+    JackSynchro fSynchroTable[CLIENT_NUM];                  /*! Shared synchro table */
+    sigset_t fProcessSignals;
+ 
+    static int fClientCount;
+    static JackLibGlobals* fGlobals;
+
+    JackLibGlobals()
+    {
+        jack_log("JackLibGlobals");
+        JackMessageBuffer::Create();
+        fGraphManager = -1;
+        fEngineControl = -1;
+
+        // Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server.
+    #ifdef WIN32
+        // TODO
+    #else
+        sigset_t signals;
+        sigemptyset(&signals);
+        sigaddset(&signals, SIGPIPE);
+        sigprocmask(SIG_BLOCK, &signals, &fProcessSignals);
+    #endif       
+    }
+
+    ~JackLibGlobals()
+    {
+        jack_log("~JackLibGlobals");
+        for (int i = 0; i < CLIENT_NUM; i++) {
+            fSynchroTable[i].Disconnect();
+        }
+        JackMessageBuffer::Destroy();
+
+       // Restore old signal mask
+    #ifdef WIN32
+       // TODO
+    #else
+       sigprocmask(SIG_BLOCK, &fProcessSignals, 0);
+    #endif   
+    }
+
+    static void Init()
+    {
+        if (!JackGlobals::fServerRunning && fClientCount > 0) {
+        
+            // Cleanup remaining clients
+            jack_error("Jack server was closed but clients are still allocated, cleanup...");
+            for (int i = 0; i < CLIENT_NUM; i++) {
+                JackClient* client = JackGlobals::fClientTable[i];
+                if (client) {
+                    jack_error("Cleanup client ref = %d", i);
+                    client->Close();
+                    delete client;
+                    JackGlobals::fClientTable[CLIENT_NUM] = NULL;
+                }
+            }
+            
+            // Cleanup global context
+            fClientCount = 0;
+            delete fGlobals;
+            fGlobals = NULL;
+        }
+        
+        if (fClientCount++ == 0 && !fGlobals) {
+            jack_log("JackLibGlobals Init %x", fGlobals);
+            InitTime();
+            fGlobals = new JackLibGlobals();
+        }
+    }
+
+    static void Destroy()
+    {
+        if (--fClientCount == 0 && fGlobals) {
+            jack_log("JackLibGlobals Destroy %x", fGlobals);
+            delete fGlobals;
+            fGlobals = NULL;
+        }
+    }
+
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackLibSampleRateResampler.cpp b/common/JackLibSampleRateResampler.cpp
new file mode 100644
index 0000000..7475282
--- /dev/null
+++ b/common/JackLibSampleRateResampler.cpp
@@ -0,0 +1,176 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackLibSampleRateResampler.h"
+
+namespace Jack
+{
+
+JackLibSampleRateResampler::JackLibSampleRateResampler()
+    :JackResampler()
+{
+    int error;
+    fResampler = src_new(SRC_LINEAR, 1, &error);
+    if (error != 0) 
+        jack_error("JackLibSampleRateResampler::JackLibSampleRateResampler err = %s", src_strerror(error));
+}
+
+JackLibSampleRateResampler::JackLibSampleRateResampler(unsigned int quality)
+    :JackResampler()
+{
+     switch (quality) {
+       case 0:
+            quality = SRC_LINEAR;
+            break;
+        case 1:
+            quality = SRC_ZERO_ORDER_HOLD;
+            break;
+        case 2:
+            quality = SRC_SINC_FASTEST;
+            break;
+        case 3:
+            quality = SRC_SINC_MEDIUM_QUALITY;
+            break;
+        case 4:
+            quality = SRC_SINC_BEST_QUALITY;
+            break;
+        default: 
+            quality = SRC_LINEAR;
+            jack_error("Out of range resample quality");
+            break;
+    }
+
+    int error;
+    fResampler = src_new(quality, 1, &error);
+    if (error != 0) 
+        jack_error("JackLibSampleRateResampler::JackLibSampleRateResampler err = %s", src_strerror(error));
+}
+
+JackLibSampleRateResampler::~JackLibSampleRateResampler()
+{
+    src_delete(fResampler);
+}
+
+void JackLibSampleRateResampler::Reset(unsigned int new_size)
+{
+    JackResampler::Reset(new_size);
+    src_reset(fResampler);
+}
+
+unsigned int JackLibSampleRateResampler::ReadResample(float* buffer, unsigned int frames)
+{
+    jack_ringbuffer_data_t ring_buffer_data[2];
+    SRC_DATA src_data;
+    unsigned int frames_to_write = frames;
+    unsigned int written_frames = 0;
+    int res;
+    
+    jack_ringbuffer_get_read_vector(fRingBuffer, ring_buffer_data);
+    unsigned int available_frames = (ring_buffer_data[0].len + ring_buffer_data[1].len) / sizeof(float);
+    jack_log("Output available = %ld", available_frames);
+      
+    for (int j = 0; j < 2; j++) {
+    
+        if (ring_buffer_data[j].len > 0) {
+            
+            src_data.data_in = (float*)ring_buffer_data[j].buf;
+            src_data.data_out = &buffer[written_frames];
+            src_data.input_frames = ring_buffer_data[j].len / sizeof(float);
+            src_data.output_frames = frames_to_write;
+            src_data.end_of_input = 0;
+            src_data.src_ratio = fRatio;
+             
+            res = src_process(fResampler, &src_data);
+            if (res != 0) {
+                jack_error("JackLibSampleRateResampler::ReadResample ratio = %f err = %s", fRatio, src_strerror(res));
+                return 0;
+            }
+                
+            frames_to_write -= src_data.output_frames_gen;
+            written_frames += src_data.output_frames_gen;
+            
+            if ((src_data.input_frames_used == 0 || src_data.output_frames_gen == 0) && j == 0) {
+                jack_log("Output : j = %d input_frames_used = %ld output_frames_gen = %ld frames1 = %lu frames2 = %lu"
+                    , j, src_data.input_frames_used, src_data.output_frames_gen, ring_buffer_data[0].len, ring_buffer_data[1].len);
+            }
+            
+            jack_log("Output : j = %d input_frames_used = %ld output_frames_gen = %ld", j, src_data.input_frames_used, src_data.output_frames_gen);
+            jack_ringbuffer_read_advance(fRingBuffer, src_data.input_frames_used * sizeof(float));
+        }
+    }
+    
+    if (written_frames < frames) {
+        jack_error("Output available = %ld", available_frames);
+        jack_error("JackLibSampleRateResampler::ReadResample error written_frames = %ld", written_frames);
+    }
+        
+    return written_frames;
+}
+
+unsigned int JackLibSampleRateResampler::WriteResample(float* buffer, unsigned int frames)
+{
+    jack_ringbuffer_data_t ring_buffer_data[2];
+    SRC_DATA src_data;
+    unsigned int frames_to_read = frames;
+    unsigned int read_frames = 0;
+    int res;
+    
+    jack_ringbuffer_get_write_vector(fRingBuffer, ring_buffer_data);
+    unsigned int available_frames = (ring_buffer_data[0].len + ring_buffer_data[1].len) / sizeof(float);
+    jack_log("Input available = %ld", available_frames);
+    
+    for (int j = 0; j < 2; j++) {
+            
+        if (ring_buffer_data[j].len > 0) {
+        
+            src_data.data_in = &buffer[read_frames];
+            src_data.data_out = (float*)ring_buffer_data[j].buf;
+            src_data.input_frames = frames_to_read;
+            src_data.output_frames = (ring_buffer_data[j].len / sizeof(float));
+            src_data.end_of_input = 0;
+            src_data.src_ratio = fRatio;
+         
+            res = src_process(fResampler, &src_data);
+            if (res != 0) {
+                jack_error("JackLibSampleRateResampler::ReadResample ratio = %f err = %s", fRatio, src_strerror(res));
+                return 0;
+            }
+                
+            frames_to_read -= src_data.input_frames_used;
+            read_frames += src_data.input_frames_used;
+            
+            if ((src_data.input_frames_used == 0 || src_data.output_frames_gen == 0) && j == 0) {
+                jack_log("Input : j = %d input_frames_used = %ld output_frames_gen = %ld frames1 = %lu frames2 = %lu"
+                    , j, src_data.input_frames_used, src_data.output_frames_gen, ring_buffer_data[0].len, ring_buffer_data[1].len);
+            }
+        
+            jack_log("Input : j = %d input_frames_used = %ld output_frames_gen = %ld", j, src_data.input_frames_used, src_data.output_frames_gen);
+            jack_ringbuffer_write_advance(fRingBuffer, src_data.output_frames_gen * sizeof(float));
+        }
+    }
+    
+    if (read_frames < frames) {
+        jack_error("Input available = %ld", available_frames);
+        jack_error("JackLibSampleRateResampler::ReadResample error read_frames = %ld", read_frames);
+    }
+        
+    return read_frames;
+}
+
+}
diff --git a/common/JackLibSampleRateResampler.h b/common/JackLibSampleRateResampler.h
new file mode 100644
index 0000000..e51a744
--- /dev/null
+++ b/common/JackLibSampleRateResampler.h
@@ -0,0 +1,54 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackLibSampleRateResampler__
+#define __JackLibSampleRateResampler__
+
+#include "JackResampler.h"
+#include <samplerate.h>
+
+namespace Jack
+{
+
+/*!
+\brief Resampler using "libsamplerate" (http://www.mega-nerd.com/SRC/).
+*/
+
+class JackLibSampleRateResampler : public JackResampler
+{
+
+    private:
+    
+        SRC_STATE* fResampler;
+           
+    public:
+    
+        JackLibSampleRateResampler();
+        JackLibSampleRateResampler(unsigned int quality);
+        virtual ~JackLibSampleRateResampler();
+        
+        unsigned int ReadResample(float* buffer, unsigned int frames);
+        unsigned int WriteResample(float* buffer, unsigned int frames);
+        
+        void Reset(unsigned int new_size);
+          
+    };
+}
+
+#endif
diff --git a/common/JackLockedEngine.h b/common/JackLockedEngine.h
new file mode 100644
index 0000000..827ab52
--- /dev/null
+++ b/common/JackLockedEngine.h
@@ -0,0 +1,315 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackLockedEngine__
+#define __JackLockedEngine__
+
+#include "JackEngine.h"
+#include "JackMutex.h"
+#include "JackTools.h"
+#include "JackException.h"
+
+namespace Jack
+{
+
+#define TRY_CALL    \
+    try {           \
+
+/*
+See : http://groups.google.com/group/comp.programming.threads/browse_thread/thread/652bcf186fbbf697/f63757846514e5e5
+
+catch (...) {
+    // Assuming thread cancellation, must rethrow
+    throw;
+}
+*/
+
+#define CATCH_EXCEPTION_RETURN                      \
+    } catch(std::bad_alloc& e) {                    \
+        jack_error("Memory allocation error...");   \
+        return -1;                                  \
+    } catch(JackTemporaryException& e) {                       \
+        jack_error("JackTemporaryException : now quits...");   \
+        JackTools::KillServer();                     \
+        return -1;                                  \
+    } catch (...) {                                 \
+        jack_error("Unknown error...");             \
+        throw;                                      \
+    }                                               \
+
+#define CATCH_EXCEPTION                      \
+    } catch(std::bad_alloc& e) {                    \
+        jack_error("Memory allocation error...");   \
+    } catch (...) {                                 \
+        jack_error("Unknown error...");             \
+        throw;                                      \
+    }                                               \
+
+
+/*!
+\brief Locked Engine, access to methods is serialized using a mutex.
+*/
+
+class SERVER_EXPORT JackLockedEngine 
+{
+    private:
+
+        JackEngine fEngine;
+
+    public:
+
+        JackLockedEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler):
+            fEngine(manager, table, controler)
+        {}
+        ~JackLockedEngine()
+        {}
+
+        int Open()
+        {
+            // No lock needed
+            TRY_CALL
+            return fEngine.Open();
+            CATCH_EXCEPTION_RETURN
+        }
+        int Close()
+        {
+            // No lock needed
+            TRY_CALL
+            return fEngine.Close();
+            CATCH_EXCEPTION_RETURN
+        }
+    
+        // Client management
+        int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.ClientCheck(name, name_res, protocol, options, status);
+            CATCH_EXCEPTION_RETURN
+        }
+        int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.ClientExternalOpen(name, pid, ref, shared_engine, shared_client, shared_graph_manager);
+            CATCH_EXCEPTION_RETURN
+        }
+        int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.ClientInternalOpen(name, ref, shared_engine, shared_manager, client, wait);
+            CATCH_EXCEPTION_RETURN
+        }
+
+        int ClientExternalClose(int refnum)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.ClientExternalClose(refnum) : - 1;
+            CATCH_EXCEPTION_RETURN
+        }
+        int ClientInternalClose(int refnum, bool wait)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.ClientInternalClose(refnum, wait) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+
+        int ClientActivate(int refnum, bool is_real_time)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.ClientActivate(refnum, is_real_time) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+        int ClientDeactivate(int refnum)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.ClientDeactivate(refnum) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+
+        // Internal client management
+        int GetInternalClientName(int int_ref, char* name_res)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.GetInternalClientName(int_ref, name_res);
+            CATCH_EXCEPTION_RETURN
+        }
+        int InternalClientHandle(const char* client_name, int* status, int* int_ref)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.InternalClientHandle(client_name, status, int_ref);
+            CATCH_EXCEPTION_RETURN
+        }
+        int InternalClientUnload(int refnum, int* status)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            // Client is tested in fEngine.InternalClientUnload
+            return fEngine.InternalClientUnload(refnum, status);
+            CATCH_EXCEPTION_RETURN
+        }
+
+        // Port management
+        int PortRegister(int refnum, const char* name, const char *type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortRegister(refnum, name, type, flags, buffer_size, port) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+        int PortUnRegister(int refnum, jack_port_id_t port)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortUnRegister(refnum, port) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+
+        int PortConnect(int refnum, const char* src, const char* dst)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortConnect(refnum, src, dst) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+        int PortDisconnect(int refnum, const char* src, const char* dst)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortDisconnect(refnum, src, dst) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+
+        int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortConnect(refnum, src, dst) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+        int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortDisconnect(refnum, src, dst) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+
+        int PortRename(int refnum, jack_port_id_t port, const char* name)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return (fEngine.CheckClient(refnum)) ? fEngine.PortRename(refnum, port, name) : -1;
+            CATCH_EXCEPTION_RETURN
+        }
+
+        // Graph
+        bool Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end)
+        {
+            // RT : no lock
+            return fEngine.Process(cur_cycle_begin, prev_cycle_end);
+        }
+
+        // Notifications
+        void NotifyXRun(jack_time_t cur_cycle_begin, float delayed_usecs)
+        {
+            // RT : no lock
+            fEngine.NotifyXRun(cur_cycle_begin, delayed_usecs);
+        }
+
+        void NotifyXRun(int refnum)
+        {
+            // RT : no lock
+            fEngine.NotifyXRun(refnum);
+        }
+        
+        void NotifyGraphReorder()
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            fEngine.NotifyGraphReorder();
+            CATCH_EXCEPTION
+        }
+        void NotifyBufferSize(jack_nframes_t buffer_size)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            fEngine.NotifyBufferSize(buffer_size);
+            CATCH_EXCEPTION
+        }
+        void NotifySampleRate(jack_nframes_t sample_rate)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            fEngine.NotifySampleRate(sample_rate);
+            CATCH_EXCEPTION
+        }
+        void NotifyFreewheel(bool onoff)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            fEngine.NotifyFreewheel(onoff);
+            CATCH_EXCEPTION
+        }
+
+        void NotifyFailure(int code, const char* reason)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            fEngine.NotifyFailure(code, reason);
+            CATCH_EXCEPTION
+        }
+
+        int GetClientPID(const char* name)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.GetClientPID(name);
+            CATCH_EXCEPTION_RETURN
+        }
+
+        int GetClientRefNum(const char* name)
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.GetClientRefNum(name);
+            CATCH_EXCEPTION_RETURN
+        }
+    
+        void NotifyQuit()
+        {
+            TRY_CALL
+            JackLock lock(&fEngine);
+            return fEngine.NotifyQuit();
+            CATCH_EXCEPTION
+        }
+ 
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackLoopbackDriver.cpp b/common/JackLoopbackDriver.cpp
new file mode 100644
index 0000000..48a9d25
--- /dev/null
+++ b/common/JackLoopbackDriver.cpp
@@ -0,0 +1,108 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackLoopbackDriver.h"
+#include "JackDriverLoader.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackError.h"
+#include <iostream>
+#include <assert.h>
+
+namespace Jack
+{
+
+int JackLoopbackDriver::Process()
+{
+    // Loopback copy
+    for (int i = 0; i < fCaptureChannels; i++) {
+        memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(float) * fEngineControl->fBufferSize);
+    }
+
+    fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
+    if (fEngineControl->fSyncMode) {
+        if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0) {
+            jack_error("JackLoopbackDriver::ProcessSync SuspendRefNum error");
+            return -1;
+        }
+    }
+    return 0;
+}
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor() 
+    {
+        jack_driver_desc_t * desc;
+        unsigned int i;
+
+        desc = (jack_driver_desc_t*)calloc (1, sizeof (jack_driver_desc_t));
+        strcpy(desc->name, "loopback");              // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Loopback backend");      // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 1;
+        desc->params = (jack_driver_param_desc_t*)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+        
+        i = 0;
+        strcpy(desc->params[i].name, "channels");
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Maximum number of loopback ports");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) 
+    {
+        const JSList * node;
+        const jack_driver_param_t * param;
+        int channels = 2;
+      
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (const jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+
+                case 'c':
+                    channels = param->value.ui;
+                    break;
+                }
+        }
+        
+        Jack::JackDriverClientInterface* driver = new Jack::JackLoopbackDriver(engine, table);
+        if (driver->Open(1, 1, channels, channels, false, "loopback", "loopback", 0, 0) == 0) {
+            return driver;
+        } else {
+            delete driver;
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/common/JackLoopbackDriver.h b/common/JackLoopbackDriver.h
new file mode 100644
index 0000000..5c542e3
--- /dev/null
+++ b/common/JackLoopbackDriver.h
@@ -0,0 +1,49 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackLoopbackDriver__
+#define __JackLoopbackDriver__
+
+#include "JackAudioDriver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The loopback driver : to be used to "pipeline" applications connected in sequence.
+*/
+
+class JackLoopbackDriver : public JackAudioDriver
+{
+
+    public:
+
+        JackLoopbackDriver(JackLockedEngine* engine, JackSynchro* table)
+                : JackAudioDriver("loopback", "", engine, table)
+        {}
+        virtual ~JackLoopbackDriver()
+        {}
+
+        int Process();
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackMessageBuffer.cpp b/common/JackMessageBuffer.cpp
new file mode 100644
index 0000000..b9f2846
--- /dev/null
+++ b/common/JackMessageBuffer.cpp
@@ -0,0 +1,143 @@
+/*
+ *  Copyright (C) 2004 Rui Nuno Capela, Steve Harris
+ *  Copyright (C) 2008 Nedko Arnaudov
+ *  Copyright (C) 2008 Grame
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Lesser General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software 
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "JackMessageBuffer.h"
+#include "JackGlobals.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+JackMessageBuffer* JackMessageBuffer::fInstance = NULL;
+
+JackMessageBuffer::JackMessageBuffer()
+    :fInit(NULL),fInitArg(NULL),fThread(this),fInBuffer(0),fOutBuffer(0),fOverruns(0),fRunning(false)
+{}
+
+JackMessageBuffer::~JackMessageBuffer()
+{}
+    
+void JackMessageBuffer::Start()
+{
+    fRunning = true;
+    fThread.StartSync();
+}
+
+void JackMessageBuffer::Stop()
+{
+    if (fOverruns > 0) {
+        jack_error("WARNING: %d message buffer overruns!", fOverruns); 
+    } else {
+        jack_log("no message buffer overruns"); 
+    }
+    fGuard.Lock();
+    fRunning = false;
+    fGuard.Signal();
+    fGuard.Unlock();
+    fThread.Stop();
+    Flush();
+}
+    
+void JackMessageBuffer::Flush()
+{
+    while (fOutBuffer != fInBuffer) {
+        jack_log_function(fBuffers[fOutBuffer].level, fBuffers[fOutBuffer].message);
+        fOutBuffer = MB_NEXT(fOutBuffer);
+    }
+}
+
+void JackMessageBuffer::AddMessage(int level, const char *message)
+{
+    if (fGuard.Trylock()) {
+        fBuffers[fInBuffer].level = level;
+        strncpy(fBuffers[fInBuffer].message, message, MB_BUFFERSIZE);
+        fInBuffer = MB_NEXT(fInBuffer);
+        fGuard.Signal();
+        fGuard.Unlock();
+    } else {            /* lock collision */
+        INC_ATOMIC(&fOverruns);
+    }
+}
+         
+bool JackMessageBuffer::Execute()
+{
+    while (fRunning) {
+        fGuard.Lock();
+        fGuard.Wait();
+        /* the client asked for all threads to run a thread
+        initialization callback, which includes us.
+        */
+        if (fInit) {
+            fInit(fInitArg);
+            fInit = NULL;
+            /* and we're done */
+            fGuard.Signal();
+        }
+        Flush();
+        fGuard.Unlock();
+    }
+    return false;	
+}
+
+void JackMessageBuffer::Create() 
+{
+    if (fInstance == NULL) {
+        fInstance = new JackMessageBuffer();
+        fInstance->Start();
+    }
+}
+
+void JackMessageBuffer::Destroy() 
+{
+    if (fInstance != NULL) {
+        fInstance->Stop();
+        delete fInstance;
+        fInstance = NULL;
+    }
+}
+
+void JackMessageBufferAdd(int level, const char *message) 
+{
+    if (Jack::JackMessageBuffer::fInstance == NULL) {
+        /* Unable to print message with realtime safety. Complain and print it anyway. */
+        jack_log_function(LOG_LEVEL_ERROR, "messagebuffer not initialized, skip message");
+    } else {
+        Jack::JackMessageBuffer::fInstance->AddMessage(level, message);
+    }
+}
+
+void JackMessageBuffer::SetInitCallback(JackThreadInitCallback callback, void *arg)
+{
+    fGuard.Lock();
+    /* set up the callback */
+    fInitArg = arg;
+    fInit = callback;
+    /* wake msg buffer thread */
+    fGuard.Signal();
+    /* wait for it to be done */
+    fGuard.Wait();
+    /* and we're done */
+    fGuard.Unlock();
+}
+    
+
+};
+
diff --git a/common/JackMessageBuffer.h b/common/JackMessageBuffer.h
new file mode 100644
index 0000000..ec13a5d
--- /dev/null
+++ b/common/JackMessageBuffer.h
@@ -0,0 +1,105 @@
+/*
+ * messagebuffer.h -- realtime-safe message interface for jackd.
+ *
+ *  This function is included in libjack so backend drivers can use
+ *  it, *not* for external client processes.  The VERBOSE() and
+ *  MESSAGE() macros are realtime-safe.
+ */
+
+/*
+ *  Copyright (C) 2004 Rui Nuno Capela, Steve Harris
+ *  Copyright (C) 2008 Nedko Arnaudov
+ *  Copyright (C) 2008 Grame
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Lesser General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software 
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __JackMessageBuffer__
+#define __JackMessageBuffer__
+
+#include "JackPlatformPlug.h"
+#include "JackMutex.h"
+#include "JackAtomic.h"
+
+namespace Jack
+{
+
+/* MB_NEXT() relies on the fact that MB_BUFFERS is a power of two */
+#define MB_BUFFERS  128
+#define MB_NEXT(index) ((index+1) & (MB_BUFFERS-1))
+#define MB_BUFFERSIZE   256     /* message length limit */
+
+struct JackMessage
+{
+    int level;
+    char message[MB_BUFFERSIZE];
+};
+
+/*!
+\brief Message buffer to be used from RT threads.
+*/
+
+class JackMessageBuffer : public JackRunnableInterface
+{
+
+    private:
+    
+        JackThreadInitCallback fInit;
+        void* fInitArg;
+        JackMessage fBuffers[MB_BUFFERS];
+        JackThread fThread;
+        JackProcessSync fGuard;
+        volatile unsigned int fInBuffer;
+        volatile unsigned int fOutBuffer;
+        SInt32 fOverruns;
+        bool fRunning;
+
+        void Flush();
+    
+        void Start();
+        void Stop();
+ 	    
+    public:
+    
+        JackMessageBuffer();     
+        ~JackMessageBuffer();
+         
+        // JackRunnableInterface interface
+        bool Execute();
+
+	    void static Create();
+	    void static Destroy();
+
+        void AddMessage(int level, const char *message);
+        void SetInitCallback(JackThreadInitCallback callback, void *arg);
+
+	    static JackMessageBuffer* fInstance;
+};
+
+#ifdef __cplusplus
+extern "C" 
+{
+#endif
+
+void JackMessageBufferAdd(int level, const char *message);
+
+#ifdef __cplusplus
+} 
+#endif
+
+};
+
+#endif 
diff --git a/common/JackMidiAPI.cpp b/common/JackMidiAPI.cpp
new file mode 100644
index 0000000..b06a93a
--- /dev/null
+++ b/common/JackMidiAPI.cpp
@@ -0,0 +1,131 @@
+/*
+Copyright (C) 2007 Dmitry Baikov
+Original JACK MIDI implementation Copyright (C) 2004 Ian Esten
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackError.h"
+#include "JackMidiPort.h"
+#include "JackCompilerDeps.h"
+#include <errno.h>
+#include <string.h>
+#include "JackSystemDeps.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    EXPORT jack_nframes_t jack_midi_get_event_count(void* port_buffer);
+
+    EXPORT int jack_midi_event_get(jack_midi_event_t* event,
+                                   void* port_buffer, jack_nframes_t event_index);
+
+    EXPORT void jack_midi_clear_buffer(void* port_buffer);
+
+    EXPORT size_t jack_midi_max_event_size(void* port_buffer);
+
+    EXPORT jack_midi_data_t* jack_midi_event_reserve(void* port_buffer,
+            jack_nframes_t time, size_t data_size);
+
+    EXPORT int jack_midi_event_write(void* port_buffer,
+                                     jack_nframes_t time, const jack_midi_data_t* data, size_t data_size);
+
+    EXPORT jack_nframes_t jack_midi_get_lost_event_count(void* port_buffer);
+
+#ifdef __cplusplus
+}
+#endif
+
+using namespace Jack;
+
+EXPORT
+jack_nframes_t jack_midi_get_event_count(void* port_buffer)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (!buf || !buf->IsValid())
+        return 0;
+    return buf->event_count;
+}
+
+EXPORT
+int jack_midi_event_get(jack_midi_event_t *event, void* port_buffer, jack_nframes_t event_index)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (!buf || !buf->IsValid())
+        return -EINVAL;
+    if (event_index >= buf->event_count)
+        return -ENOBUFS;
+    JackMidiEvent* ev = &buf->events[event_index];
+    event->time = ev->time;
+    event->size = ev->size;
+    event->buffer = ev->GetData(buf);
+    return 0;
+}
+
+EXPORT
+void jack_midi_clear_buffer(void* port_buffer)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (buf && buf->IsValid())
+        buf->Reset(buf->nframes);
+}
+
+EXPORT
+size_t jack_midi_max_event_size(void* port_buffer)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (buf && buf->IsValid())
+        return buf->MaxEventSize();
+    return 0;
+}
+
+EXPORT
+jack_midi_data_t* jack_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (!buf && !buf->IsValid())
+        return 0;
+    if (time >= buf->nframes || (buf->event_count && buf->events[buf->event_count - 1].time > time))
+        return 0;
+    return buf->ReserveEvent(time, data_size);
+}
+
+EXPORT
+int jack_midi_event_write(void* port_buffer,
+                          jack_nframes_t time, const jack_midi_data_t* data, size_t data_size)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (!buf && !buf->IsValid())
+        return -EINVAL;
+    if (time >= buf->nframes || (buf->event_count && buf->events[buf->event_count - 1].time > time))
+        return -EINVAL;
+    jack_midi_data_t* dest = buf->ReserveEvent(time, data_size);
+    if (!dest)
+        return -ENOBUFS;
+    memcpy(dest, data, data_size);
+    return 0;
+}
+
+EXPORT
+jack_nframes_t jack_midi_get_lost_event_count(void* port_buffer)
+{
+    JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer;
+    if (buf && buf->IsValid())
+        return buf->lost_events;
+    return 0;
+}
diff --git a/common/JackMidiDriver.cpp b/common/JackMidiDriver.cpp
new file mode 100644
index 0000000..4ddf417
--- /dev/null
+++ b/common/JackMidiDriver.cpp
@@ -0,0 +1,178 @@
+/*
+Copyright (C) 2009 Grame.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+(at your option) any later version.
+
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackMidiDriver.h"
+#include "JackTime.h"
+#include "JackError.h"
+#include "JackEngineControl.h"
+#include "JackPort.h"
+#include "JackGraphManager.h"
+#include "JackException.h"
+#include <assert.h>
+
+namespace Jack
+{
+
+JackMidiDriver::JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+        : JackDriver(name, alias, engine, table),
+        fCaptureChannels(0),
+        fPlaybackChannels(0)
+{
+    for (int i = 0; i < DRIVER_PORT_NUM; i++) {
+        fRingBuffer[i] = NULL;
+    }
+}
+
+JackMidiDriver::~JackMidiDriver()
+{
+    for (int i = 0; i < fCaptureChannels; i++) {
+        if (fRingBuffer[i])
+            jack_ringbuffer_free(fRingBuffer[i]);
+    }
+}
+
+int JackMidiDriver::Open(bool capturing,
+                        bool playing,
+                        int inchannels,
+                        int outchannels,
+                        bool monitor,
+                        const char* capture_driver_name,
+                        const char* playback_driver_name,
+                        jack_nframes_t capture_latency,
+                        jack_nframes_t playback_latency)
+{
+    fCaptureChannels = inchannels;
+    fPlaybackChannels = outchannels;
+    
+    for (int i = 0; i < fCaptureChannels; i++) {
+        fRingBuffer[i] = jack_ringbuffer_create(sizeof(float) * BUFFER_SIZE_MAX);
+    }
+  
+    return JackDriver::Open(capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency);
+}
+
+int JackMidiDriver::Attach()
+{
+    JackPort* port;
+    jack_port_id_t port_index;
+    char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    int i;
+
+    jack_log("JackMidiDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    for (i = 0; i < fCaptureChannels; i++) {
+        snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
+        snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        fCapturePortList[i] = port_index;
+        jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
+    }
+
+    for (i = 0; i < fPlaybackChannels; i++) {
+        snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
+        snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        fPlaybackPortList[i] = port_index;
+        jack_log("JackMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
+    }
+
+    return 0;
+}
+
+int JackMidiDriver::Detach()
+{
+    int i;
+    jack_log("JackMidiDriver::Detach");
+
+    for (i = 0; i < fCaptureChannels; i++) {
+        fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
+    }
+
+    for (i = 0; i < fPlaybackChannels; i++) {
+        fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
+    }
+
+    return 0;
+}
+
+int JackMidiDriver::Read()
+{
+    return 0;
+}
+
+int JackMidiDriver::Write()
+{
+    return 0;
+}
+
+int JackMidiDriver::ProcessNull()
+{
+    return 0;
+}
+
+int JackMidiDriver::Process()
+{
+    // Read input buffers for the current cycle
+    if (Read() < 0) { 
+        jack_error("JackMidiDriver::Process: read error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+    
+    fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
+    if (fEngineControl->fSyncMode) {
+        if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
+            jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
+            return -1;
+        }
+    }
+    
+    // Write output buffers for the current cycle
+    if (Write() < 0) { 
+        jack_error("JackMidiDriver::Process: write error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+    
+    return 0;
+}
+
+JackMidiBuffer* JackMidiDriver::GetInputBuffer(int port_index)
+{
+    assert(fCapturePortList[port_index]);
+    return (JackMidiBuffer*)fGraphManager->GetBuffer(fCapturePortList[port_index], fEngineControl->fBufferSize);
+}
+
+JackMidiBuffer* JackMidiDriver::GetOutputBuffer(int port_index)
+{
+    assert(fPlaybackPortList[port_index]);
+    return (JackMidiBuffer*)fGraphManager->GetBuffer(fPlaybackPortList[port_index], fEngineControl->fBufferSize);
+}
+
+} // end of namespace
diff --git a/common/JackMidiDriver.h b/common/JackMidiDriver.h
new file mode 100644
index 0000000..7c5bc5e
--- /dev/null
+++ b/common/JackMidiDriver.h
@@ -0,0 +1,79 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackMidiDriver__
+#define __JackMidiDriver__
+
+#include "JackDriver.h"
+#include "JackMidiPort.h"
+#include "JackLockedEngine.h"
+#include "ringbuffer.h"
+
+namespace Jack
+{
+
+/*!
+\brief The base class for MIDI drivers: drivers with MIDI ports.
+*/
+
+class SERVER_EXPORT JackMidiDriver : public JackDriver
+{
+
+     protected:
+
+        int fCaptureChannels;
+        int fPlaybackChannels;
+        
+        jack_ringbuffer_t* fRingBuffer[DRIVER_PORT_NUM];
+
+        jack_port_id_t fCapturePortList[DRIVER_PORT_NUM];
+        jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM];
+   
+        JackMidiBuffer* GetInputBuffer(int port_index);
+        JackMidiBuffer* GetOutputBuffer(int port_index);
+ 
+    public:
+
+        JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        virtual ~JackMidiDriver();
+
+        virtual int Open(bool capturing,
+                        bool playing,
+                        int inchannels,
+                        int outchannels,
+                        bool monitor,
+                        const char* capture_driver_name,
+                        const char* playback_driver_name,
+                        jack_nframes_t capture_latency,
+                        jack_nframes_t playback_latency);
+                        
+        virtual int Process();
+        virtual int ProcessNull();
+
+        virtual int Attach();
+        virtual int Detach();
+        
+        virtual int Read();
+        virtual int Write();
+ 
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackMidiPort.cpp b/common/JackMidiPort.cpp
new file mode 100644
index 0000000..fb933c8
--- /dev/null
+++ b/common/JackMidiPort.cpp
@@ -0,0 +1,143 @@
+/*
+Copyright (C) 2007 Dmitry Baikov
+Original JACK MIDI implementation Copyright (C) 2004 Ian Esten
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackError.h"
+#include "JackPortType.h"
+#include "JackMidiPort.h"
+#include <assert.h>
+#include <string.h>
+
+namespace Jack
+{
+
+SERVER_EXPORT void JackMidiBuffer::Reset(jack_nframes_t nframes)
+{
+    /* This line ate 1 hour of my life... dsbaikov */
+    this->nframes = nframes;
+    write_pos = 0;
+    event_count = 0;
+    lost_events = 0;
+    mix_index = 0;
+}
+
+SERVER_EXPORT jack_shmsize_t JackMidiBuffer::MaxEventSize() const
+{
+    assert (((jack_shmsize_t) - 1) < 0); // jack_shmsize_t should be signed
+    jack_shmsize_t left = buffer_size - (sizeof(JackMidiBuffer) + sizeof(JackMidiEvent) * (event_count + 1) + write_pos);
+    if (left < 0)
+        return 0;
+    if (left <= JackMidiEvent::INLINE_SIZE_MAX)
+        return JackMidiEvent::INLINE_SIZE_MAX;
+    return left;
+}
+
+SERVER_EXPORT jack_midi_data_t* JackMidiBuffer::ReserveEvent(jack_nframes_t time, jack_shmsize_t size)
+{
+    jack_shmsize_t space = MaxEventSize();
+    if (space == 0 || size > space) {
+        lost_events++;
+        return 0;
+    }
+
+    JackMidiEvent* event = &events[event_count++];
+    event->time = time;
+    event->size = size;
+    if (size <= JackMidiEvent::INLINE_SIZE_MAX)
+        return event->data;
+
+    write_pos += size;
+    event->offset = buffer_size - write_pos;
+    return (jack_midi_data_t*)this + event->offset;
+}
+
+static void MidiBufferInit(void* buffer, size_t buffer_size, jack_nframes_t nframes)
+{
+    JackMidiBuffer* midi = (JackMidiBuffer*)buffer;
+    midi->magic = JackMidiBuffer::MAGIC;
+    /* Since port buffer has actually always BUFFER_SIZE_MAX frames, we can safely use all the size */
+    midi->buffer_size = BUFFER_SIZE_MAX * sizeof(float);
+    midi->Reset(nframes);
+}
+
+/*
+ * The mixdown function below, is a simplest (read slowest) implementation possible.
+ * But, since it is unlikely that it will mix many buffers with many events,
+ * it should perform quite good.
+ * More efficient (and possibly, fastest possible) implementation (it exists),
+ * using calendar queue algorithm is about 3 times bigger, and uses alloca().
+ * So, let's listen to D.Knuth about premature optimisation, a leave the current
+ * implementation as is, until it is proved to be a bottleneck.
+ * Dmitry Baikov.
+ */
+static void MidiBufferMixdown(void* mixbuffer, void** src_buffers, int src_count, jack_nframes_t nframes)
+{
+    JackMidiBuffer* mix = static_cast<JackMidiBuffer*>(mixbuffer);
+    if (!mix->IsValid()) {
+        jack_error("MIDI: invalid mix buffer");
+        return;
+    }
+    mix->Reset(nframes);
+
+    int event_count = 0;
+    for (int i = 0; i < src_count; ++i) {
+        JackMidiBuffer* buf = static_cast<JackMidiBuffer*>(src_buffers[i]);
+        if (!buf->IsValid())
+            return;
+        buf->mix_index = 0;
+        event_count += buf->event_count;
+        mix->lost_events += buf->lost_events;
+    }
+
+    int events_done;
+    for (events_done = 0; events_done < event_count; ++events_done) {
+        JackMidiBuffer* next_buf = 0;
+        JackMidiEvent* next_event = 0;
+
+        // find the earliest event
+        for (int i = 0; i < src_count; ++i) {
+            JackMidiBuffer* buf = static_cast<JackMidiBuffer*>(src_buffers[i]);
+            if (buf->mix_index >= buf->event_count)
+                continue;
+            JackMidiEvent* e = &buf->events[buf->mix_index];
+            if (!next_event || e->time < next_event->time) {
+                next_event = e;
+                next_buf = buf;
+            }
+        }
+        assert(next_event != 0);
+
+        // write the event
+        jack_midi_data_t* dest = mix->ReserveEvent(next_event->time, next_event->size);
+        if (!dest)
+            break;
+        memcpy(dest, next_event->GetData(next_buf), next_event->size);
+        next_buf->mix_index++;
+    }
+    mix->lost_events += event_count - events_done;
+}
+
+const JackPortType gMidiPortType =
+    {
+        JACK_DEFAULT_MIDI_TYPE,
+        MidiBufferInit,
+        MidiBufferMixdown
+    };
+
+} // namespace Jack
diff --git a/common/JackMidiPort.h b/common/JackMidiPort.h
new file mode 100644
index 0000000..0dbfcb9
--- /dev/null
+++ b/common/JackMidiPort.h
@@ -0,0 +1,101 @@
+/*
+Copyright (C) 2007 Dmitry Baikov
+Original JACK MIDI API implementation Copyright (C) 2004 Ian Esten
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMidiPort__
+#define __JackMidiPort__
+
+#include "types.h"
+#include "JackConstants.h"
+#include "JackPlatformPlug.h"
+#include <stddef.h>
+
+/** Type for raw event data contained in @ref jack_midi_event_t. */
+typedef unsigned char jack_midi_data_t;
+
+/** A Jack MIDI event. */
+struct jack_midi_event_t
+{
+    jack_nframes_t    time;   /**< Sample index at which event is valid */
+    size_t            size;   /**< Number of bytes of data in \a buffer */
+    jack_midi_data_t *buffer; /**< Raw MIDI data */
+};
+
+/** A Jack MIDI port type. */
+#define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
+
+namespace Jack
+{
+
+struct SERVER_EXPORT JackMidiEvent
+{
+    // Most MIDI events are < 4 bytes in size, so we can save a lot, storing them inplace.
+    enum { INLINE_SIZE_MAX = sizeof(jack_shmsize_t) };
+
+    uint32_t time;
+    jack_shmsize_t size;
+    union {
+        jack_shmsize_t   offset;
+        jack_midi_data_t data[INLINE_SIZE_MAX];
+    };
+
+    jack_midi_data_t* GetData(void* buffer)
+    {
+        if (size <= INLINE_SIZE_MAX)
+            return data;
+        else
+            return (jack_midi_data_t*)buffer + offset;
+    }
+};
+
+/*
+ * To store events with arbitrarily sized payload, but still have O(1) indexed access
+ * we use a trick here:
+ * Events are stored in an linear array from the beginning of the buffer,
+ * but their data (if not inlined) is stored from the end of the same buffer.
+ */
+
+struct JackMidiBuffer
+{
+    enum { MAGIC = 0x900df00d };
+
+    uint32_t magic;
+    jack_shmsize_t buffer_size;
+    jack_nframes_t nframes;
+    jack_shmsize_t write_pos; //!< data write position from the end of the buffer.
+    uint32_t event_count;
+    uint32_t lost_events;
+    uint32_t mix_index;
+
+    JackMidiEvent events[1]; // Using 0 size does not compile with older GCC versions, so use 1 here.
+
+    int IsValid() const
+    {
+        return magic == MAGIC;
+    }
+    void Reset(jack_nframes_t nframes);
+    jack_shmsize_t MaxEventSize() const;
+
+    // checks only size constraints.
+    jack_midi_data_t* ReserveEvent(jack_nframes_t time, jack_shmsize_t size);
+};
+
+} // namespace Jack
+
+#endif
diff --git a/common/JackMutex.h b/common/JackMutex.h
new file mode 100644
index 0000000..0a2600d
--- /dev/null
+++ b/common/JackMutex.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2006 Grame
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+ Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
+ grame at grame.fr
+*/
+
+#ifndef __JackMutex__
+#define __JackMutex__
+
+#include <assert.h>
+#include "JackError.h"
+#include "JackPlatformPlug.h"
+
+
+namespace Jack
+{
+/*!
+\brief Base class for "lockable" objects.
+*/
+
+class JackLockAble
+{
+
+    protected:
+    
+        JackMutex fMutex;
+
+        JackLockAble()
+        {}
+        ~JackLockAble()
+        {}
+
+    public:
+     
+        void Lock()
+        {
+            fMutex.Lock();
+        }
+
+        bool Trylock()
+        {
+            return fMutex.Trylock();
+        }
+
+        void Unlock()
+        {
+            fMutex.Unlock();
+        }
+
+};
+
+class JackLock
+{
+    private:
+
+        JackLockAble* fObj;
+
+    public:
+
+        JackLock(JackLockAble* obj): fObj(obj)
+        {
+            fObj->Lock();
+        }
+
+        JackLock(const JackLockAble* obj): fObj((JackLockAble*)obj)
+        {
+            fObj->Lock();
+        }
+
+        ~JackLock()
+        {
+            fObj->Unlock();
+        }
+};
+
+
+} // namespace
+
+#endif
diff --git a/common/JackNetAdapter.cpp b/common/JackNetAdapter.cpp
new file mode 100644
index 0000000..5532f01
--- /dev/null
+++ b/common/JackNetAdapter.cpp
@@ -0,0 +1,543 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "JackNetAdapter.h"
+#include "JackException.h"
+#include "JackServerGlobals.h"
+#include "JackEngineControl.h"
+#include "JackArgParser.h"
+#include <assert.h>
+
+namespace Jack
+{
+    JackNetAdapter::JackNetAdapter ( jack_client_t* jack_client, jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params )
+            : JackAudioAdapterInterface ( buffer_size, sample_rate ), JackNetSlaveInterface(), fThread ( this )
+    {
+        jack_log ( "JackNetAdapter::JackNetAdapter" );
+
+        //global parametering
+        //we can't call JackNetSlaveInterface constructor with some parameters before
+        //because we don't have full parametering right now
+        //parameters will be parsed from the param list, and then JackNetSlaveInterface will be filled with proper values
+        strcpy ( fMulticastIP, DEFAULT_MULTICAST_IP );
+        uint port = DEFAULT_PORT;
+        GetHostName ( fParams.fName, JACK_CLIENT_NAME_SIZE );
+        fSocket.GetName ( fParams.fSlaveNetName );
+        fParams.fMtu = DEFAULT_MTU;
+        fParams.fTransportSync = 0;
+        fParams.fSendAudioChannels = 2;
+        fParams.fReturnAudioChannels = 2;
+        fParams.fSendMidiChannels = 0;
+        fParams.fReturnMidiChannels = 0;
+        fParams.fSampleRate = sample_rate;
+        fParams.fPeriodSize = buffer_size;
+        fParams.fSlaveSyncMode = 1;
+        fParams.fNetworkMode = 's';
+        fJackClient = jack_client;
+
+        //options parsing
+        const JSList* node;
+        const jack_driver_param_t* param;
+        for ( node = params; node; node = jack_slist_next ( node ) )
+        {
+            param = ( const jack_driver_param_t* ) node->data;
+            switch ( param->character )
+            {
+                case 'a' :
+                    if (strlen (param->value.str) < 32)
+                        strcpy(fMulticastIP, param->value.str);
+                    else
+                        jack_error("Can't use multicast address %s, using default %s", param->value.ui, DEFAULT_MULTICAST_IP);
+                    break;
+                case 'p' :
+                    fSocket.SetPort ( param->value.ui );
+                    break;
+                case 'M' :
+                    fParams.fMtu = param->value.i;
+                    break;
+                case 'C' :
+                    fParams.fSendAudioChannels = param->value.i;
+                    break;
+                case 'P' :
+                    fParams.fReturnAudioChannels = param->value.i;
+                    break;
+                case 'n' :
+                    strncpy ( fParams.fName, param->value.str, JACK_CLIENT_NAME_SIZE );
+                    break;
+                case 't' :
+                    //fParams.fTransportSync = param->value.ui;
+                    break;
+                case 'm' :
+                    if ( strcmp ( param->value.str, "normal" ) == 0 )
+                        fParams.fNetworkMode = 'n';
+                    else if ( strcmp ( param->value.str, "slow" ) == 0 )
+                        fParams.fNetworkMode = 's';
+                    else if ( strcmp ( param->value.str, "fast" ) == 0 )
+                        fParams.fNetworkMode = 'f';
+                    else
+                        jack_error ( "Unknown network mode, using 'normal' mode." );
+                    break;
+                case 'q':
+                    fQuality = param->value.ui;
+                    break;
+                case 'g':
+                    fRingbufferCurSize = param->value.ui;
+                    fAdaptative = false;
+                    break;
+             }
+        }
+
+        //set the socket parameters
+        fSocket.SetPort ( port );
+        fSocket.SetAddress ( fMulticastIP, port );
+
+        //set the audio adapter interface channel values
+        SetInputs ( fParams.fSendAudioChannels );
+        SetOutputs ( fParams.fReturnAudioChannels );
+
+        //soft buffers will be allocated later (once network initialization done)
+        fSoftCaptureBuffer = NULL;
+        fSoftPlaybackBuffer = NULL;
+    }
+
+    JackNetAdapter::~JackNetAdapter()
+    {
+        jack_log ( "JackNetAdapter::~JackNetAdapter" );
+
+        int port_index;
+        if ( fSoftCaptureBuffer )
+        {
+            for ( port_index = 0; port_index < fCaptureChannels; port_index++ )
+                delete[] fSoftCaptureBuffer[port_index];
+            delete[] fSoftCaptureBuffer;
+        }
+        if ( fSoftPlaybackBuffer )
+        {
+            for ( port_index = 0; port_index < fPlaybackChannels; port_index++ )
+                delete[] fSoftPlaybackBuffer[port_index];
+            delete[] fSoftPlaybackBuffer;
+        }
+    }
+
+//open/close--------------------------------------------------------------------------
+    int JackNetAdapter::Open()
+    {
+        jack_log ( "JackNetAdapter::Open" );
+
+        jack_info ( "NetAdapter started in %s mode %s Master's transport sync.",
+                    ( fParams.fSlaveSyncMode ) ? "sync" : "async", ( fParams.fTransportSync ) ? "with" : "without" );
+
+        if ( fThread.StartSync() < 0 )
+        {
+            jack_error ( "Cannot start netadapter thread" );
+            return -1;
+        }
+
+        return 0;
+    }
+
+    int JackNetAdapter::Close()
+    {
+        jack_log ( "JackNetAdapter::Close" );
+
+#ifdef JACK_MONITOR
+        fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
+#endif
+
+        switch ( fThread.GetStatus() )
+        {
+                // Kill the thread in Init phase
+            case JackThread::kStarting:
+            case JackThread::kIniting:
+                if ( fThread.Kill() < 0 )
+                {
+                    jack_error ( "Cannot kill thread" );
+                    return -1;
+                }
+                break;
+                // Stop when the thread cycle is finished
+                
+            case JackThread::kRunning:
+                if ( fThread.Stop() < 0 )
+                {
+                    jack_error ( "Cannot stop thread" );
+                    return -1;
+                }
+                break;
+                
+            default:
+                break;
+        }
+        fSocket.Close();
+        return 0;
+    }
+
+    int JackNetAdapter::SetBufferSize ( jack_nframes_t buffer_size )
+    {
+        JackAudioAdapterInterface::SetHostBufferSize ( buffer_size );
+        return 0;
+    }
+
+//thread------------------------------------------------------------------------------
+    bool JackNetAdapter::Init()
+    {
+        jack_log ( "JackNetAdapter::Init" );
+
+        int port_index;
+
+        //init network connection
+        if ( !JackNetSlaveInterface::Init() )
+            return false;
+
+        //then set global parameters
+        SetParams();
+
+        //set buffers
+        fSoftCaptureBuffer = new sample_t*[fCaptureChannels];
+        for ( port_index = 0; port_index < fCaptureChannels; port_index++ )
+        {
+            fSoftCaptureBuffer[port_index] = new sample_t[fParams.fPeriodSize];
+            fNetAudioCaptureBuffer->SetBuffer ( port_index, fSoftCaptureBuffer[port_index] );
+        }
+        fSoftPlaybackBuffer = new sample_t*[fPlaybackChannels];
+        for ( port_index = 0; port_index < fCaptureChannels; port_index++ )
+        {
+            fSoftPlaybackBuffer[port_index] = new sample_t[fParams.fPeriodSize];
+            fNetAudioPlaybackBuffer->SetBuffer ( port_index, fSoftPlaybackBuffer[port_index] );
+        }
+
+        //set audio adapter parameters
+        SetAdaptedBufferSize ( fParams.fPeriodSize );
+        SetAdaptedSampleRate ( fParams.fSampleRate );
+        
+        // Will do "something" on OSX only...
+        fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
+        
+        if (fThread.AcquireSelfRealTime(GetEngineControl()->fClientPriority) < 0) {
+            jack_error("AcquireSelfRealTime error");
+        } else {
+            set_threaded_log_function();
+        }
+  
+        //init done, display parameters
+        SessionParamsDisplay ( &fParams );
+        return true;
+    }
+
+    bool JackNetAdapter::Execute()
+    {
+        try {
+            // Keep running even in case of error
+            while (fThread.GetStatus() == JackThread::kRunning)
+                if (Process() == SOCKET_ERROR)
+                    return false;
+            return false;
+        } catch (JackNetException& e) {
+            e.PrintMessage();
+            jack_info("NetAdapter is restarted.");
+            Reset();
+            fThread.DropSelfRealTime();
+            fThread.SetStatus(JackThread::kIniting);
+            if (Init()) {
+                fThread.SetStatus(JackThread::kRunning);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+//transport---------------------------------------------------------------------------
+    void JackNetAdapter::DecodeTransportData()
+    {
+        //TODO : we need here to get the actual timebase master to eventually release it from its duty (see JackNetDriver)
+
+        //is there a new transport state ?
+        if ( fSendTransportData.fNewState && ( fSendTransportData.fState != jack_transport_query ( fJackClient, NULL ) ) )
+        {
+            switch ( fSendTransportData.fState )
+            {
+                case JackTransportStopped :
+                    jack_transport_stop ( fJackClient );
+                    jack_info ( "NetMaster : transport stops." );
+                    break;
+                    
+                case JackTransportStarting :
+                    jack_transport_reposition ( fJackClient, &fSendTransportData.fPosition );
+                    jack_transport_start ( fJackClient );
+                    jack_info ( "NetMaster : transport starts." );
+                    break;
+                    
+                case JackTransportRolling :
+                    //TODO , we need to :
+                    // - find a way to call TransportEngine->SetNetworkSync()
+                    // - turn the transport state to JackTransportRolling
+                    jack_info ( "NetMaster : transport rolls." );
+                    break;
+            }
+        }
+    }
+
+    void JackNetAdapter::EncodeTransportData()
+    {
+        //is there a timebase master change ?
+        int refnum = -1;
+        bool conditional = 0;
+        //TODO : get the actual timebase master
+        if ( refnum != fLastTimebaseMaster )
+        {
+            //timebase master has released its function
+            if ( refnum == -1 )
+            {
+                fReturnTransportData.fTimebaseMaster = RELEASE_TIMEBASEMASTER;
+                jack_info ( "Sending a timebase master release request." );
+            }
+            //there is a new timebase master
+            else
+            {
+                fReturnTransportData.fTimebaseMaster = ( conditional ) ? CONDITIONAL_TIMEBASEMASTER : TIMEBASEMASTER;
+                jack_info ( "Sending a %s timebase master request.", ( conditional ) ? "conditional" : "non-conditional" );
+            }
+            fLastTimebaseMaster = refnum;
+        }
+        else
+            fReturnTransportData.fTimebaseMaster = NO_CHANGE;
+
+        //update transport state and position
+        fReturnTransportData.fState = jack_transport_query ( fJackClient, &fReturnTransportData.fPosition );
+
+        //is it a new state (that the master need to know...) ?
+        fReturnTransportData.fNewState = ( ( fReturnTransportData.fState != fLastTransportState ) &&
+                                            ( fReturnTransportData.fState != fSendTransportData.fState ) );
+        if ( fReturnTransportData.fNewState )
+            jack_info ( "Sending transport state '%s'.", GetTransportState ( fReturnTransportData.fState ) );
+        fLastTransportState = fReturnTransportData.fState;
+    }
+
+//read/write operations---------------------------------------------------------------
+    int JackNetAdapter::Read()
+    {
+        //don't return -1 in case of sync recv failure
+        //we need the process to continue for network error detection
+        if ( SyncRecv() == SOCKET_ERROR )
+            return 0;
+
+        DecodeSyncPacket();
+        return DataRecv();
+    }
+
+    int JackNetAdapter::Write()
+    {
+        EncodeSyncPacket();
+     
+        if ( SyncSend() == SOCKET_ERROR )
+            return SOCKET_ERROR;
+
+        return DataSend();
+    }
+
+//process-----------------------------------------------------------------------------
+    int JackNetAdapter::Process()
+    {
+        //read data from the network
+        //in case of fatal network error, stop the process
+        if (Read() == SOCKET_ERROR)
+            return SOCKET_ERROR;
+            
+        PushAndPull(fSoftCaptureBuffer, fSoftPlaybackBuffer, fAdaptedBufferSize);
+
+        //then write data to network
+        //in case of failure, stop process
+        if (Write() == SOCKET_ERROR)
+            return SOCKET_ERROR;
+
+        return 0;
+    }
+    
+} // namespace Jack
+
+//loader------------------------------------------------------------------------------
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "driver_interface.h"
+#include "JackAudioAdapter.h"
+
+    using namespace Jack;
+
+    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+    {
+        jack_driver_desc_t* desc = ( jack_driver_desc_t* ) calloc ( 1, sizeof ( jack_driver_desc_t ) );
+        
+        strcpy(desc->name, "netadapter");                              // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "netjack net <==> audio backend adapter");  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+       
+        desc->nparams = 11;
+        desc->params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) );
+
+        int i = 0;
+        strcpy ( desc->params[i].name, "multicast_ip" );
+        desc->params[i].character = 'a';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, DEFAULT_MULTICAST_IP );
+        strcpy ( desc->params[i].short_desc, "Multicast Address" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "udp_net_port" );
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.i = DEFAULT_PORT;
+        strcpy ( desc->params[i].short_desc, "UDP port" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "mtu" );
+        desc->params[i].character = 'M';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.i = DEFAULT_MTU;
+        strcpy ( desc->params[i].short_desc, "MTU to the master" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "input-ports" );
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.i = 2;
+        strcpy ( desc->params[i].short_desc, "Number of audio input ports" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "output-ports" );
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.i = 2;
+        strcpy ( desc->params[i].short_desc, "Number of audio output ports" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "client-name" );
+        desc->params[i].character = 'n';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, "'hostname'" );
+        strcpy ( desc->params[i].short_desc, "Name of the jack client" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "transport-sync" );
+        desc->params[i].character  = 't';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 1U;
+        strcpy ( desc->params[i].short_desc, "Sync transport with master's" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "mode" );
+        desc->params[i].character  = 'm';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, "slow" );
+        strcpy ( desc->params[i].short_desc, "Slow, Normal or Fast mode." );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+        
+        i++;
+        strcpy(desc->params[i].name, "quality");
+        desc->params[i].character = 'q';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Resample algorithm quality (0 - 4)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "ring-buffer");
+        desc->params[i].character = 'g';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 32768;
+        strcpy(desc->params[i].short_desc, "Fixed ringbuffer size");
+        strcpy(desc->params[i].long_desc, "Fixed ringbuffer size (if not set => automatic adaptative)");
+        
+        i++;
+        strcpy ( desc->params[i].name, "auto-connect" );
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = false;
+        strcpy ( desc->params[i].short_desc, "Auto connect netmaster to system ports" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+    
+        return desc;
+    }
+
+    SERVER_EXPORT int jack_internal_initialize ( jack_client_t* jack_client, const JSList* params )
+    {
+        jack_log ( "Loading netadapter" );
+
+        Jack::JackAudioAdapter* adapter;
+        jack_nframes_t buffer_size = jack_get_buffer_size ( jack_client );
+        jack_nframes_t sample_rate = jack_get_sample_rate ( jack_client );
+        
+        try {
+        
+            adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackNetAdapter(jack_client, buffer_size, sample_rate, params), params, false);
+            assert ( adapter );
+
+            if ( adapter->Open() == 0 )
+                return 0;
+            else
+            {
+                delete adapter;
+                return 1;
+            }
+            
+        } catch (...) {
+            return 1;
+        }
+    }
+
+    SERVER_EXPORT int jack_initialize ( jack_client_t* jack_client, const char* load_init )
+    {
+        JSList* params = NULL;
+        bool parse_params = true;
+        int res = 1;
+        jack_driver_desc_t* desc = jack_get_descriptor();
+
+        Jack::JackArgParser parser ( load_init );
+        if ( parser.GetArgc() > 0 )
+            parse_params = parser.ParseParams ( desc, &params );
+
+        if (parse_params) {
+            res = jack_internal_initialize ( jack_client, params );
+            parser.FreeParams ( params );
+        }
+        return res;
+    }
+
+    SERVER_EXPORT void jack_finish ( void* arg )
+    {
+        Jack::JackAudioAdapter* adapter = static_cast<Jack::JackAudioAdapter*> ( arg );
+
+        if (adapter) {
+            jack_log ( "Unloading netadapter" );
+            adapter->Close();
+            delete adapter;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/common/JackNetAdapter.h b/common/JackNetAdapter.h
new file mode 100644
index 0000000..f6b7675
--- /dev/null
+++ b/common/JackNetAdapter.h
@@ -0,0 +1,74 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetAdapter__
+#define __JackNetAdapter__
+
+#include "JackAudioAdapterInterface.h"
+#include "JackNetInterface.h"
+
+namespace Jack
+{
+
+    /*!
+    \brief Net adapter.
+    */
+
+    class JackNetAdapter : public JackAudioAdapterInterface, public JackNetSlaveInterface, public JackRunnableInterface
+    {
+    private:
+        //jack data
+        jack_client_t* fJackClient;
+
+        //transport data
+        int fLastTransportState;
+        int fLastTimebaseMaster;
+     
+        //sample buffers
+        sample_t** fSoftCaptureBuffer;
+        sample_t** fSoftPlaybackBuffer;
+
+        //adapter thread
+        JackThread fThread;
+
+        //transport
+        void EncodeTransportData();
+        void DecodeTransportData();
+
+    public:
+
+        JackNetAdapter ( jack_client_t* jack_client, jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params );
+        ~JackNetAdapter();
+
+        int Open();
+        int Close();
+
+        int SetBufferSize ( jack_nframes_t buffer_size );
+
+        bool Init();
+        bool Execute();
+
+        int Read();
+        int Write();
+
+        int Process();
+    };
+}
+
+#endif
diff --git a/common/JackNetDriver.cpp b/common/JackNetDriver.cpp
new file mode 100644
index 0000000..5f5af5d
--- /dev/null
+++ b/common/JackNetDriver.cpp
@@ -0,0 +1,745 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "JackNetDriver.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackWaitThreadedDriver.h"
+
+
+using namespace std;
+
+namespace Jack
+{
+    JackNetDriver::JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
+                                   const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports,
+                                   char* net_name, uint transport_sync, char network_mode )
+            : JackAudioDriver ( name, alias, engine, table ), JackNetSlaveInterface ( ip, port )
+    {
+        jack_log ( "JackNetDriver::JackNetDriver ip %s, port %d", ip, port );
+
+        // Use the hostname if no name parameter was given
+        if ( strcmp ( net_name, "" ) == 0 )
+            GetHostName ( net_name, JACK_CLIENT_NAME_SIZE );
+
+        fParams.fMtu = mtu;
+        fParams.fSendMidiChannels = midi_input_ports;
+        fParams.fReturnMidiChannels = midi_output_ports;
+        strcpy ( fParams.fName, net_name );
+        fSocket.GetName ( fParams.fSlaveNetName );
+        fParams.fTransportSync = transport_sync;
+        fParams.fNetworkMode = network_mode;
+        fSendTransportData.fState = -1;
+        fReturnTransportData.fState = -1;
+        fLastTransportState = -1;
+        fLastTimebaseMaster = -1;
+        fMidiCapturePortList = NULL;
+        fMidiPlaybackPortList = NULL;
+#ifdef JACK_MONITOR
+        fNetTimeMon = NULL;
+        fRcvSyncUst = 0;
+#endif
+    }
+
+    JackNetDriver::~JackNetDriver()
+    {
+        delete[] fMidiCapturePortList;
+        delete[] fMidiPlaybackPortList;
+#ifdef JACK_MONITOR
+        delete fNetTimeMon;
+#endif
+    }
+
+//open, close, attach and detach------------------------------------------------------
+    int JackNetDriver::Open ( jack_nframes_t buffer_size, jack_nframes_t samplerate, bool capturing, bool playing,
+                              int inchannels, int outchannels, bool monitor,
+                              const char* capture_driver_name, const char* playback_driver_name,
+                              jack_nframes_t capture_latency, jack_nframes_t playback_latency )
+    {
+        if ( JackAudioDriver::Open ( buffer_size,
+                                     samplerate,
+                                     capturing,
+                                     playing,
+                                     inchannels,
+                                     outchannels,
+                                     monitor,
+                                     capture_driver_name,
+                                     playback_driver_name,
+                                     capture_latency,
+                                     playback_latency ) == 0 )
+        {
+            fEngineControl->fPeriod = 0;
+            fEngineControl->fComputation = 500 * 1000;
+            fEngineControl->fConstraint = 500 * 1000;
+            return 0;
+        }
+        else
+        {
+            return -1;
+        }
+    }
+
+    int JackNetDriver::Close()
+    {
+#ifdef JACK_MONITOR
+        if ( fNetTimeMon )
+            fNetTimeMon->Save();
+#endif
+        FreeAll();
+        return JackDriver::Close();
+    }
+
+    // Attach and Detach are defined as empty methods: port allocation is done when driver actually start (that is in Init)
+    int JackNetDriver::Attach()
+    {
+        return 0;
+    }
+
+    int JackNetDriver::Detach()
+    {
+        return 0;
+    }
+
+//init and restart--------------------------------------------------------------------
+    /*
+        JackNetDriver is wrapped in a JackWaitThreadedDriver decorator that behaves 
+        as a "dummy driver, until Init method returns.
+    */
+    
+    bool JackNetDriver::Initialize()
+    {
+        jack_log("JackNetDriver::Initialize()");
+
+        //new loading, but existing socket, restart the driver
+        if (fSocket.IsSocket()) {
+            jack_info("Restarting driver...");
+            FreeAll();
+        }
+
+        //set the parameters to send
+        fParams.fSendAudioChannels = fCaptureChannels;
+        fParams.fReturnAudioChannels = fPlaybackChannels;
+        fParams.fSlaveSyncMode = fEngineControl->fSyncMode;
+
+        //display some additional infos
+        jack_info ( "NetDriver started in %s mode %s Master's transport sync.",
+                    ( fParams.fSlaveSyncMode ) ? "sync" : "async", ( fParams.fTransportSync ) ? "with" : "without" );
+
+        //init network
+        if ( !JackNetSlaveInterface::Init() )
+            return false;
+
+        //set global parameters
+        SetParams();
+         
+        //allocate midi ports lists
+        fMidiCapturePortList = new jack_port_id_t [fParams.fSendMidiChannels];
+        fMidiPlaybackPortList = new jack_port_id_t [fParams.fReturnMidiChannels];
+        assert ( fMidiCapturePortList );
+        assert ( fMidiPlaybackPortList );
+
+        //register jack ports
+        if ( AllocPorts() != 0 )
+        {
+            jack_error ( "Can't allocate ports." );
+            return false;
+        }
+
+        //init done, display parameters
+        SessionParamsDisplay ( &fParams );
+
+        //monitor
+#ifdef JACK_MONITOR
+        string plot_name;
+        //NetTimeMon
+        plot_name = string ( fParams.fName );
+        plot_name += string ( "_slave" );
+        plot_name += ( fEngineControl->fSyncMode ) ? string ( "_sync" ) : string ( "_async" );
+        switch ( fParams.fNetworkMode )
+        {
+            case 's' :
+                plot_name += string ( "_slow" );
+                break;
+
+            case 'n' :
+                plot_name += string ( "_normal" );
+                break;
+
+            case 'f' :
+                plot_name += string ( "_fast" );
+                break;
+        }
+        fNetTimeMon = new JackGnuPlotMonitor<float> ( 128, 5, plot_name );
+        string net_time_mon_fields[] =
+        {
+            string ( "sync decoded" ),
+            string ( "end of read" ),
+            string ( "start of write" ),
+            string ( "sync send" ),
+            string ( "end of write" )
+        };
+        string net_time_mon_options[] =
+        {
+            string ( "set xlabel \"audio cycles\"" ),
+            string ( "set ylabel \"% of audio cycle\"" )
+        };
+        fNetTimeMon->SetPlotFile ( net_time_mon_options, 2, net_time_mon_fields, 5 );
+#endif
+        //driver parametering
+        JackAudioDriver::SetBufferSize ( fParams.fPeriodSize );
+        JackAudioDriver::SetSampleRate ( fParams.fSampleRate );
+
+        JackDriver::NotifyBufferSize ( fParams.fPeriodSize );
+        JackDriver::NotifySampleRate ( fParams.fSampleRate );
+
+        //transport engine parametering
+        fEngineControl->fTransport.SetNetworkSync ( fParams.fTransportSync );
+        return true;
+    }
+
+    void JackNetDriver::FreeAll()
+    {
+        FreePorts();
+        
+        delete[] fTxBuffer;
+        delete[] fRxBuffer;
+        delete fNetAudioCaptureBuffer;
+        delete fNetAudioPlaybackBuffer;
+        delete fNetMidiCaptureBuffer;
+        delete fNetMidiPlaybackBuffer;
+        delete[] fMidiCapturePortList;
+        delete[] fMidiPlaybackPortList;
+        
+        fTxBuffer = NULL;
+        fRxBuffer = NULL;
+        fNetAudioCaptureBuffer = NULL;
+        fNetAudioPlaybackBuffer = NULL;
+        fNetMidiCaptureBuffer = NULL;
+        fNetMidiPlaybackBuffer = NULL;
+        fMidiCapturePortList = NULL;
+        fMidiPlaybackPortList = NULL;
+        
+#ifdef JACK_MONITOR
+        delete fNetTimeMon;
+        fNetTimeMon = NULL;
+#endif
+    }
+
+//jack ports and buffers--------------------------------------------------------------
+    int JackNetDriver::AllocPorts()
+    {
+        jack_log ( "JackNetDriver::AllocPorts fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate );
+
+        JackPort* port;
+        jack_port_id_t port_id;
+        char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+        char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+        unsigned long port_flags;
+        int audio_port_index;
+        uint midi_port_index;
+
+        //audio
+        port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
+        for ( audio_port_index = 0; audio_port_index < fCaptureChannels; audio_port_index++ )
+        {
+            snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, audio_port_index + 1 );
+            snprintf ( name, sizeof ( name ) - 1, "%s:capture_%d", fClientControl.fName, audio_port_index + 1 );
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
+                             static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", name );
+                return -1;
+            }
+            port = fGraphManager->GetPort ( port_id );
+            port->SetAlias ( alias );
+            //port latency
+            port->SetLatency ( fEngineControl->fBufferSize );
+            fCapturePortList[audio_port_index] = port_id;
+            jack_log ( "JackNetDriver::AllocPorts() fCapturePortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_id, port->GetLatency() );
+        }
+        port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
+        for ( audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++ )
+        {
+            snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, audio_port_index + 1 );
+            snprintf ( name, sizeof ( name ) - 1, "%s:playback_%d",fClientControl.fName, audio_port_index + 1 );
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE,
+                             static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", name );
+                return -1;
+            }
+            port = fGraphManager->GetPort ( port_id );
+            port->SetAlias ( alias );
+            //port latency
+            switch ( fParams.fNetworkMode )
+            {
+                case 'f' :
+                    port->SetLatency ( ( fEngineControl->fSyncMode ) ? 0 : fEngineControl->fBufferSize );
+                    break;
+                case 'n' :
+                    port->SetLatency ( fEngineControl->fBufferSize + ( fEngineControl->fSyncMode ) ? 0 : fEngineControl->fBufferSize );
+                    break;
+                case 's' :
+                    port->SetLatency ( 2 * fEngineControl->fBufferSize + ( fEngineControl->fSyncMode ) ? 0 : fEngineControl->fBufferSize );
+                    break;
+            }
+            fPlaybackPortList[audio_port_index] = port_id;
+            jack_log ( "JackNetDriver::AllocPorts() fPlaybackPortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_id, port->GetLatency() );
+        }
+        //midi
+        port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
+        for ( midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++ )
+        {
+            snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, midi_port_index + 1 );
+            snprintf ( name, sizeof ( name ) - 1, "%s:midi_capture_%d", fClientControl.fName, midi_port_index + 1 );
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
+                             static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", name );
+                return -1;
+            }
+            port = fGraphManager->GetPort ( port_id );
+            //port latency
+            port->SetLatency ( fEngineControl->fBufferSize );
+            fMidiCapturePortList[midi_port_index] = port_id;
+            jack_log ( "JackNetDriver::AllocPorts() fMidiCapturePortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_id, port->GetLatency() );
+        }
+
+        port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
+        for ( midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++ )
+        {
+            snprintf ( alias, sizeof ( alias ) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, midi_port_index + 1 );
+            snprintf ( name, sizeof ( name ) - 1, "%s:midi_playback_%d", fClientControl.fName, midi_port_index + 1 );
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE,
+                             static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", name );
+                return -1;
+            }
+            port = fGraphManager->GetPort ( port_id );
+            //port latency
+            switch ( fParams.fNetworkMode )
+            {
+                case 'f' :
+                    port->SetLatency ( ( fEngineControl->fSyncMode ) ? 0 : fEngineControl->fBufferSize );
+                    break;
+                case 'n' :
+                    port->SetLatency ( fEngineControl->fBufferSize + ( fEngineControl->fSyncMode ) ? 0 : fEngineControl->fBufferSize ) ;
+                    break;
+                case 's' :
+                    port->SetLatency ( 2 * fEngineControl->fBufferSize + ( fEngineControl->fSyncMode ) ? 0 : fEngineControl->fBufferSize );
+                    break;
+            }
+            fMidiPlaybackPortList[midi_port_index] = port_id;
+            jack_log ( "JackNetDriver::AllocPorts() fMidiPlaybackPortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_id, port->GetLatency() );
+        }
+
+        return 0;
+    }
+
+    int JackNetDriver::FreePorts()
+    {
+        jack_log ( "JackNetDriver::FreePorts" );
+
+        int audio_port_index;
+        uint midi_port_index;
+        for ( audio_port_index = 0; audio_port_index < fCaptureChannels; audio_port_index++ )
+            if (fCapturePortList[audio_port_index] > 0)
+                fGraphManager->ReleasePort ( fClientControl.fRefNum, fCapturePortList[audio_port_index] );
+        for ( audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++ )
+            if (fPlaybackPortList[audio_port_index] > 0)
+                fGraphManager->ReleasePort ( fClientControl.fRefNum, fPlaybackPortList[audio_port_index] );
+        for ( midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++ )
+            if (fMidiCapturePortList[midi_port_index] > 0)
+                fGraphManager->ReleasePort ( fClientControl.fRefNum, fMidiCapturePortList[midi_port_index] );
+        for ( midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++ )
+            if (fMidiPlaybackPortList[midi_port_index] > 0)
+                fGraphManager->ReleasePort ( fClientControl.fRefNum, fMidiPlaybackPortList[midi_port_index] );
+        return 0;
+    }
+
+    JackMidiBuffer* JackNetDriver::GetMidiInputBuffer ( int port_index )
+    {
+        return static_cast<JackMidiBuffer*> ( fGraphManager->GetBuffer ( fMidiCapturePortList[port_index], fEngineControl->fBufferSize ) );
+    }
+
+    JackMidiBuffer* JackNetDriver::GetMidiOutputBuffer ( int port_index )
+    {
+        return static_cast<JackMidiBuffer*> ( fGraphManager->GetBuffer ( fMidiPlaybackPortList[port_index], fEngineControl->fBufferSize ) );
+    }
+
+//transport---------------------------------------------------------------------------
+    void JackNetDriver::DecodeTransportData()
+    {
+        //is there a new timebase master on the net master ?
+        // - release timebase master only if it's a non-conditional request
+        // - no change or no request : don't do anything
+        // - conditional request : don't change anything too, the master will know if this slave is actually the timebase master
+        int refnum;
+        bool conditional;
+        if ( fSendTransportData.fTimebaseMaster == TIMEBASEMASTER )
+        {
+            fEngineControl->fTransport.GetTimebaseMaster ( refnum, conditional );
+            if ( refnum != -1 )
+                fEngineControl->fTransport.ResetTimebase ( refnum );
+            jack_info ( "The NetMaster is now the new timebase master." );
+        }
+
+        //is there a transport state change to handle ?
+        if ( fSendTransportData.fNewState && ( fSendTransportData.fState != fEngineControl->fTransport.GetState() ) )
+        {
+           
+            switch ( fSendTransportData.fState )
+            {
+                case JackTransportStopped :
+                    fEngineControl->fTransport.SetCommand ( TransportCommandStop );
+                    jack_info ( "Master stops transport." );
+                    break;
+
+                case JackTransportStarting :
+                    fEngineControl->fTransport.RequestNewPos ( &fSendTransportData.fPosition );
+                    fEngineControl->fTransport.SetCommand ( TransportCommandStart );
+                    jack_info ( "Master starts transport frame = %d", fSendTransportData.fPosition.frame);
+                    break;
+
+                case JackTransportRolling :
+                    //fEngineControl->fTransport.SetCommand ( TransportCommandStart );
+                    fEngineControl->fTransport.SetState ( JackTransportRolling );
+                    jack_info ( "Master is rolling." );
+                    break;
+            }
+        }
+    }
+
+    void JackNetDriver::EncodeTransportData()
+    {
+        /* Desactivated
+        //is there a timebase master change ?
+        int refnum;
+        bool conditional;
+        fEngineControl->fTransport.GetTimebaseMaster ( refnum, conditional );
+        if ( refnum != fLastTimebaseMaster )
+        {
+            //timebase master has released its function
+            if ( refnum == -1 )
+            {
+                fReturnTransportData.fTimebaseMaster = RELEASE_TIMEBASEMASTER;
+                jack_info ( "Sending a timebase master release request." );
+            }
+            //there is a new timebase master
+            else
+            {
+                fReturnTransportData.fTimebaseMaster = ( conditional ) ? CONDITIONAL_TIMEBASEMASTER : TIMEBASEMASTER;
+                jack_info ( "Sending a %s timebase master request.", ( conditional ) ? "conditional" : "non-conditional" );
+            }
+            fLastTimebaseMaster = refnum;
+        }
+        else
+            fReturnTransportData.fTimebaseMaster = NO_CHANGE;
+        */
+        
+        //update transport state and position
+        fReturnTransportData.fState = fEngineControl->fTransport.Query ( &fReturnTransportData.fPosition );
+    
+        //is it a new state (that the master need to know...) ?
+        fReturnTransportData.fNewState = (( fReturnTransportData.fState == JackTransportNetStarting) &&
+                                           ( fReturnTransportData.fState != fLastTransportState ) && 
+                                           ( fReturnTransportData.fState != fSendTransportData.fState ) );
+        if ( fReturnTransportData.fNewState )
+            jack_info ( "Sending '%s'.", GetTransportState ( fReturnTransportData.fState ) );
+        fLastTransportState = fReturnTransportData.fState;
+    }
+
+//driver processes--------------------------------------------------------------------
+    int JackNetDriver::Read()
+    {
+        uint midi_port_index;
+        uint audio_port_index;
+
+        //buffers
+        for ( midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++ )
+            fNetMidiCaptureBuffer->SetBuffer ( midi_port_index, GetMidiInputBuffer ( midi_port_index ) );
+        for ( audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++ )
+            fNetAudioCaptureBuffer->SetBuffer ( audio_port_index, GetInputBuffer ( audio_port_index ) );
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->New();
+#endif
+
+        //receive sync (launch the cycle)
+        if ( SyncRecv() == SOCKET_ERROR )
+            return 0;
+
+#ifdef JACK_MONITOR
+        // For timing  
+        fRcvSyncUst = GetMicroSeconds();
+#endif
+
+        //decode sync
+        //if there is an error, don't return -1, it will skip Write() and the network error probably won't be identified
+        DecodeSyncPacket();
+ 
+#ifdef JACK_MONITOR
+        fNetTimeMon->Add ( ( ( float ) ( GetMicroSeconds() - fRcvSyncUst ) / ( float ) fEngineControl->fPeriodUsecs ) * 100.f );
+#endif
+        //audio, midi or sync if driver is late
+        if ( DataRecv() == SOCKET_ERROR )
+            return SOCKET_ERROR;
+
+        //take the time at the beginning of the cycle
+        JackDriver::CycleTakeBeginTime();
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->Add ( ( ( float ) ( GetMicroSeconds() - fRcvSyncUst ) / ( float ) fEngineControl->fPeriodUsecs ) * 100.f );
+#endif
+
+        return 0;
+    }
+
+    int JackNetDriver::Write()
+    {
+        uint midi_port_index;
+        int audio_port_index;
+
+        //buffers
+        for ( midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++ )
+            fNetMidiPlaybackBuffer->SetBuffer ( midi_port_index, GetMidiOutputBuffer ( midi_port_index ) );
+        for ( audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++ )
+            fNetAudioPlaybackBuffer->SetBuffer ( audio_port_index, GetOutputBuffer ( audio_port_index ) );
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->Add ( ( ( float ) ( GetMicroSeconds() - fRcvSyncUst ) / ( float ) fEngineControl->fPeriodUsecs ) * 100.f );
+#endif
+
+        //sync
+        EncodeSyncPacket();
+   
+        //send sync
+        if ( SyncSend() == SOCKET_ERROR )
+            return SOCKET_ERROR;
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->Add ( ( ( float ) ( GetMicroSeconds() - fRcvSyncUst ) / ( float ) fEngineControl->fPeriodUsecs ) * 100.f );
+#endif
+
+        //send data
+        if ( DataSend() == SOCKET_ERROR )
+            return SOCKET_ERROR;
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->AddLast ( ( ( float ) ( GetMicroSeconds() - fRcvSyncUst ) / ( float ) fEngineControl->fPeriodUsecs ) * 100.f );
+#endif
+
+        return 0;
+    }
+
+//driver loader-----------------------------------------------------------------------
+
+#ifdef __cplusplus
+    extern "C"
+    {
+#endif
+        SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor ()
+        {
+            jack_driver_desc_t* desc = ( jack_driver_desc_t* ) calloc ( 1, sizeof ( jack_driver_desc_t ) );
+
+            strcpy ( desc->name, "net" );                             // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+            strcpy ( desc->desc, "netjack slave backend component" ); // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+            desc->nparams = 10;
+            desc->params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) );
+
+            int i = 0;
+            strcpy ( desc->params[i].name, "multicast_ip" );
+            desc->params[i].character = 'a';
+            desc->params[i].type = JackDriverParamString;
+            strcpy ( desc->params[i].value.str, DEFAULT_MULTICAST_IP );
+            strcpy ( desc->params[i].short_desc, "Multicast Address" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "udp_net_port" );
+            desc->params[i].character = 'p';
+            desc->params[i].type = JackDriverParamInt;
+            desc->params[i].value.i = DEFAULT_PORT;
+            strcpy ( desc->params[i].short_desc, "UDP port" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "mtu" );
+            desc->params[i].character = 'M';
+            desc->params[i].type = JackDriverParamInt;
+            desc->params[i].value.i = DEFAULT_MTU;
+            strcpy ( desc->params[i].short_desc, "MTU to the master" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "input_ports" );
+            desc->params[i].character = 'C';
+            desc->params[i].type = JackDriverParamInt;
+            desc->params[i].value.i = 2;
+            strcpy ( desc->params[i].short_desc, "Number of audio input ports" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "output_ports" );
+            desc->params[i].character = 'P';
+            desc->params[i].type = JackDriverParamInt;
+            desc->params[i].value.i = 2;
+            strcpy ( desc->params[i].short_desc, "Number of audio output ports" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "midi_in_ports" );
+            desc->params[i].character = 'i';
+            desc->params[i].type = JackDriverParamInt;
+            desc->params[i].value.i = 0;
+            strcpy ( desc->params[i].short_desc, "Number of midi input ports" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "midi_out_ports" );
+            desc->params[i].character = 'o';
+            desc->params[i].type = JackDriverParamUInt;
+            desc->params[i].value.i = 0;
+            strcpy ( desc->params[i].short_desc, "Number of midi output ports" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "client_name" );
+            desc->params[i].character = 'n';
+            desc->params[i].type = JackDriverParamString;
+            strcpy ( desc->params[i].value.str, "'hostname'" );
+            strcpy ( desc->params[i].short_desc, "Name of the jack client" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "transport_sync" );
+            desc->params[i].character  = 't';
+            desc->params[i].type = JackDriverParamUInt;
+            desc->params[i].value.ui = 1U;
+            strcpy ( desc->params[i].short_desc, "Sync transport with master's" );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            i++;
+            strcpy ( desc->params[i].name, "mode" );
+            desc->params[i].character  = 'm';
+            desc->params[i].type = JackDriverParamString;
+            strcpy ( desc->params[i].value.str, "slow" );
+            strcpy ( desc->params[i].short_desc, "Slow, Normal or Fast mode." );
+            strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+            return desc;
+        }
+
+        SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize ( Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params )
+        {
+            char multicast_ip[16];
+            strcpy ( multicast_ip, DEFAULT_MULTICAST_IP );
+            char net_name[JACK_CLIENT_NAME_SIZE + 1];
+            int udp_port = DEFAULT_PORT;
+            int mtu = DEFAULT_MTU;
+            uint transport_sync = 1;
+            jack_nframes_t period_size = 128;
+            jack_nframes_t sample_rate = 48000;
+            int audio_capture_ports = 2;
+            int audio_playback_ports = 2;
+            int midi_input_ports = 0;
+            int midi_output_ports = 0;
+            bool monitor = false;
+            char network_mode = 's';
+            const JSList* node;
+            const jack_driver_param_t* param;
+
+            net_name[0] = 0;
+
+            for ( node = params; node; node = jack_slist_next ( node ) )
+            {
+                param = ( const jack_driver_param_t* ) node->data;
+                switch ( param->character )
+                {
+                    case 'a' :
+                        strncpy ( multicast_ip, param->value.str, 15 );
+                        break;
+                    case 'p':
+                        udp_port = param->value.ui;
+                        break;
+                    case 'M':
+                        mtu = param->value.i;
+                        break;
+                    case 'C':
+                        audio_capture_ports = param->value.i;
+                        break;
+                    case 'P':
+                        audio_playback_ports = param->value.i;
+                        break;
+                    case 'i':
+                        midi_input_ports = param->value.i;
+                        break;
+                    case 'o':
+                        midi_output_ports = param->value.i;
+                        break;
+                    case 'n' :
+                        strncpy ( net_name, param->value.str, JACK_CLIENT_NAME_SIZE );
+                        break;
+                    case 't' :
+                        transport_sync = param->value.ui;
+                        break;
+                    case 'm' :
+                        if ( strcmp ( param->value.str, "normal" ) == 0 )
+                            network_mode = 'n';
+                        else if ( strcmp ( param->value.str, "slow" ) == 0 )
+                            network_mode = 's';
+                        else if ( strcmp ( param->value.str, "fast" ) == 0 )
+                            network_mode = 'f';
+                        else
+                            jack_error ( "Unknown network mode, using 'normal' mode." );
+                        break;
+                }
+            }
+
+            try
+            {
+
+                Jack::JackDriverClientInterface* driver =
+                    new Jack::JackWaitThreadedDriver (
+                    new Jack::JackNetDriver ( "system", "net_pcm", engine, table, multicast_ip, udp_port, mtu,
+                                              midi_input_ports, midi_output_ports, net_name, transport_sync, network_mode ) );
+                if ( driver->Open ( period_size, sample_rate, 1, 1, audio_capture_ports, audio_playback_ports,
+                                    monitor, "from_master_", "to_master_", 0, 0 ) == 0 )
+                {
+                    return driver;
+                }
+                else
+                {
+                    delete driver;
+                    return NULL;
+                }
+
+            }
+            catch ( ... )
+            {
+                return NULL;
+            }
+        }
+
+#ifdef __cplusplus
+    }
+#endif
+}
diff --git a/common/JackNetDriver.h b/common/JackNetDriver.h
new file mode 100644
index 0000000..af137b4
--- /dev/null
+++ b/common/JackNetDriver.h
@@ -0,0 +1,103 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetDriver__
+#define __JackNetDriver__
+
+#include "JackAudioDriver.h"
+#include "JackNetInterface.h"
+
+#ifdef JACK_MONITOR
+#include "JackFrameTimer.h"
+#endif
+
+namespace Jack
+{
+    /**
+    \Brief This class describes the Net Backend
+    */
+
+    class JackNetDriver : public JackAudioDriver, public JackNetSlaveInterface
+    {
+        private:
+            //jack data
+            jack_port_id_t* fMidiCapturePortList;
+            jack_port_id_t* fMidiPlaybackPortList;
+	   
+            //transport
+            int fLastTransportState;
+            int fLastTimebaseMaster;
+  
+            //monitoring
+	#ifdef JACK_MONITOR
+            JackGnuPlotMonitor<float>* fNetTimeMon;
+            jack_time_t fRcvSyncUst;
+	#endif
+
+            bool Initialize();
+            void FreeAll();
+            
+            int AllocPorts();
+            int FreePorts();
+
+            //transport
+            void EncodeTransportData();
+            void DecodeTransportData();
+
+            JackMidiBuffer* GetMidiInputBuffer ( int port_index );
+            JackMidiBuffer* GetMidiOutputBuffer ( int port_index );
+
+        public:
+            JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
+                            const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports,
+                            char* net_name, uint transport_sync, char network_master_mode );
+            ~JackNetDriver();
+
+            int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
+                       int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
+                       const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency );
+            int Close();
+
+            int Attach();
+            int Detach();
+
+            int Read();
+            int Write();
+
+            // BufferSize can't be changed
+            bool IsFixedBufferSize()
+            {
+                return true;
+            }
+
+            int SetBufferSize ( jack_nframes_t buffer_size )
+            {
+                return -1;
+            }
+
+            int SetSampleRate ( jack_nframes_t sample_rate )
+            {
+                return -1;
+            }
+
+    };
+}
+
+#endif
diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp
new file mode 100644
index 0000000..b794e8b
--- /dev/null
+++ b/common/JackNetInterface.cpp
@@ -0,0 +1,988 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "JackNetInterface.h"
+#include "JackException.h"
+#include "JackPlatformPlug.h"
+#include <assert.h>
+
+using namespace std;
+
+/*  
+ TODO : since midi buffers now uses up to BUFFER_SIZE_MAX frames, 
+ probably also use BUFFER_SIZE_MAX in everything related to MIDI events 
+ handling (see MidiBufferInit in JackMidiPort.cpp)
+*/
+
+namespace Jack
+{
+    // JackNetInterface*******************************************
+
+    JackNetInterface::JackNetInterface() : fSocket()
+    {
+        fTxBuffer = NULL;
+        fRxBuffer = NULL;
+        fNetAudioCaptureBuffer = NULL;
+        fNetAudioPlaybackBuffer = NULL;
+        fNetMidiCaptureBuffer = NULL;
+        fNetMidiPlaybackBuffer = NULL;
+        memset(&fSendTransportData, 0, sizeof(net_transport_data_t));
+        memset(&fReturnTransportData, 0, sizeof(net_transport_data_t));
+    }
+
+    JackNetInterface::JackNetInterface ( const char* multicast_ip, int port ) : fSocket ( multicast_ip, port )
+    {
+        strcpy(fMulticastIP, multicast_ip);
+        fTxBuffer = NULL;
+        fRxBuffer = NULL;
+        fNetAudioCaptureBuffer = NULL;
+        fNetAudioPlaybackBuffer = NULL;
+        fNetMidiCaptureBuffer = NULL;
+        fNetMidiPlaybackBuffer = NULL;
+        memset(&fSendTransportData, 0, sizeof(net_transport_data_t));
+        memset(&fReturnTransportData, 0, sizeof(net_transport_data_t));
+    }
+
+    JackNetInterface::JackNetInterface ( session_params_t& params, JackNetSocket& socket, const char* multicast_ip ) : fSocket ( socket )
+    {
+        fParams = params;
+        strcpy(fMulticastIP, multicast_ip);
+        fTxBuffer = NULL;
+        fRxBuffer = NULL;
+        fNetAudioCaptureBuffer = NULL;
+        fNetAudioPlaybackBuffer = NULL;
+        fNetMidiCaptureBuffer = NULL;
+        fNetMidiPlaybackBuffer = NULL;
+        memset(&fSendTransportData, 0, sizeof(net_transport_data_t));
+        memset(&fReturnTransportData, 0, sizeof(net_transport_data_t));
+    }
+
+    JackNetInterface::~JackNetInterface()
+    {
+        jack_log ( "JackNetInterface::~JackNetInterface" );
+
+        fSocket.Close();
+        delete[] fTxBuffer;
+        delete[] fRxBuffer;
+        delete fNetAudioCaptureBuffer;
+        delete fNetAudioPlaybackBuffer;
+        delete fNetMidiCaptureBuffer;
+        delete fNetMidiPlaybackBuffer;
+    }
+
+    void JackNetInterface::SetFramesPerPacket()
+    {
+        jack_log ( "JackNetInterface::SetFramesPerPacket" );
+
+        if (fParams.fSendAudioChannels == 0 && fParams.fReturnAudioChannels == 0) {
+            fParams.fFramesPerPacket = fParams.fPeriodSize;
+        } else {
+            jack_nframes_t period = ( int ) powf ( 2.f, ( int ) ( log (float ( fParams.fMtu - sizeof ( packet_header_t ) )
+                                               / ( max ( fParams.fReturnAudioChannels, fParams.fSendAudioChannels ) * sizeof ( sample_t ) ) ) / log ( 2. ) ) );
+            fParams.fFramesPerPacket = ( period > fParams.fPeriodSize ) ? fParams.fPeriodSize : period;
+        }
+    }
+
+    int JackNetInterface::SetNetBufferSize()
+    {
+        jack_log ( "JackNetInterface::SetNetBufferSize" );
+
+        float audio_size, midi_size;
+        int bufsize;
+        //audio
+        audio_size = fParams.fMtu * ( fParams.fPeriodSize / fParams.fFramesPerPacket );
+        //midi
+        midi_size = fParams.fMtu * ( max ( fParams.fSendMidiChannels, fParams.fReturnMidiChannels ) *
+                                     fParams.fPeriodSize * sizeof ( sample_t ) / ( fParams.fMtu - sizeof ( packet_header_t ) ) );
+        //bufsize = sync + audio + midi
+        bufsize = MAX_LATENCY * (fParams.fMtu + ( int ) audio_size + ( int ) midi_size);
+
+        //tx buffer
+        if ( fSocket.SetOption ( SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof ( bufsize ) ) == SOCKET_ERROR )
+            return SOCKET_ERROR;
+
+        //rx buffer
+        if ( fSocket.SetOption ( SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof ( bufsize ) ) == SOCKET_ERROR )
+            return SOCKET_ERROR;
+
+        return 0;
+    }
+
+    int JackNetInterface::GetNMidiPckt()
+    {
+        //even if there is no midi data, jack need an empty buffer to know there is no event to read
+        //99% of the cases : all data in one packet
+        if ( fTxHeader.fMidiDataSize <= ( fParams.fMtu - sizeof ( packet_header_t ) ) )
+            return 1;
+        //else, get the number of needed packets (simply slice the biiig buffer)
+        int npckt = fTxHeader.fMidiDataSize / ( fParams.fMtu - sizeof ( packet_header_t ) );
+        if ( fTxHeader.fMidiDataSize % ( fParams.fMtu - sizeof ( packet_header_t ) ) )
+            return ++npckt;
+        return npckt;
+    }
+
+    bool JackNetInterface::IsNextPacket()
+    {
+        packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
+        //ignore first cycle
+        if ( fRxHeader.fCycle <= 1 ) {
+            return true;
+        }
+        //same PcktID (cycle), next SubPcktID (subcycle)
+        if ( ( fRxHeader.fSubCycle < ( fNSubProcess - 1 ) ) && ( rx_head->fCycle == fRxHeader.fCycle ) && ( rx_head->fSubCycle == ( fRxHeader.fSubCycle + 1 ) ) ) {
+             return true;
+        }
+        //next PcktID (cycle), SubPcktID reset to 0 (first subcyle)
+        if ( ( rx_head->fCycle == ( fRxHeader.fCycle + 1 ) ) && ( fRxHeader.fSubCycle == ( fNSubProcess - 1 ) ) && ( rx_head->fSubCycle == 0 ) ) {
+            return true;
+        }
+        //else, packet(s) missing, return false
+        return false;
+    }
+
+    void JackNetInterface::SetParams()
+    {
+        //number of audio subcycles (packets)
+        fNSubProcess = fParams.fPeriodSize / fParams.fFramesPerPacket;
+
+        //payload size
+        fPayloadSize = fParams.fMtu - sizeof ( packet_header_t );
+
+        //TX header init
+        strcpy ( fTxHeader.fPacketType, "header" );
+        fTxHeader.fID = fParams.fID;
+        fTxHeader.fCycle = 0;
+        fTxHeader.fSubCycle = 0;
+        fTxHeader.fMidiDataSize = 0;
+        fTxHeader.fBitdepth = fParams.fBitdepth;
+        fTxHeader.fIsLastPckt = 0;
+
+        //RX header init
+        strcpy ( fRxHeader.fPacketType, "header" );
+        fRxHeader.fID = fParams.fID;
+        fRxHeader.fCycle = 0;
+        fRxHeader.fSubCycle = 0;
+        fRxHeader.fMidiDataSize = 0;
+        fRxHeader.fBitdepth = fParams.fBitdepth;
+        fRxHeader.fIsLastPckt = 0;
+
+        //network buffers
+        fTxBuffer = new char[fParams.fMtu];
+        fRxBuffer = new char[fParams.fMtu];
+        assert ( fTxBuffer );
+        assert ( fRxBuffer );
+
+        //net audio/midi buffers'addresses
+        fTxData = fTxBuffer + sizeof ( packet_header_t );
+        fRxData = fRxBuffer + sizeof ( packet_header_t );
+    }
+
+    // JackNetMasterInterface ************************************************************************************
+
+    bool JackNetMasterInterface::Init()
+    {
+        jack_log ( "JackNetMasterInterface::Init, ID %u.", fParams.fID );
+
+        session_params_t host_params;
+        uint attempt = 0;
+        int rx_bytes = 0;
+
+        //socket
+        if ( fSocket.NewSocket() == SOCKET_ERROR ) {
+            jack_error ( "Can't create socket : %s", StrError ( NET_ERROR_CODE ) );
+            return false;
+        }
+
+        //timeout on receive (for init)
+        if ( fSocket.SetTimeOut ( MASTER_INIT_TIMEOUT ) < 0 )
+            jack_error ( "Can't set timeout : %s", StrError ( NET_ERROR_CODE ) );
+            
+        //connect
+        if ( fSocket.Connect() == SOCKET_ERROR ) {
+            jack_error ( "Can't connect : %s", StrError ( NET_ERROR_CODE ) );
+            return false;
+        }
+
+        //set the number of complete audio frames we can put in a packet
+        SetFramesPerPacket();
+
+        //send 'SLAVE_SETUP' until 'START_MASTER' received
+        jack_info ( "Sending parameters to %s ...", fParams.fSlaveNetName );
+        do
+        {
+            session_params_t net_params;
+            memset(&net_params, 0, sizeof ( session_params_t ));
+            SetPacketType ( &fParams, SLAVE_SETUP );
+            SessionParamsHToN(&fParams, &net_params);
+            
+            if ( fSocket.Send ( &net_params, sizeof ( session_params_t ), 0 ) == SOCKET_ERROR )
+                jack_error ( "Error in send : ", StrError ( NET_ERROR_CODE ) );
+                
+            memset(&net_params, 0, sizeof ( session_params_t ));
+            if ( ( ( rx_bytes = fSocket.Recv ( &net_params, sizeof ( session_params_t ), 0 ) ) == SOCKET_ERROR ) && ( fSocket.GetError() != NET_NO_DATA ) )
+            {
+                jack_error ( "Problem with network." );
+                return false;
+            }
+            
+            SessionParamsNToH(&net_params, &host_params);
+        }
+        while ( ( GetPacketType ( &host_params ) != START_MASTER ) && ( ++attempt < SLAVE_SETUP_RETRY ) );
+        if ( attempt == SLAVE_SETUP_RETRY ) {
+            jack_error ( "Slave doesn't respond, exiting." );
+            return false;
+        }
+
+        //set the new timeout for the socket
+        if ( SetRxTimeout() == SOCKET_ERROR ) {
+            jack_error ( "Can't set rx timeout : %s", StrError ( NET_ERROR_CODE ) );
+            return false;
+        }
+
+        //set the new rx buffer size
+        if ( SetNetBufferSize() == SOCKET_ERROR ) {
+            jack_error ( "Can't set net buffer sizes : %s", StrError ( NET_ERROR_CODE ) );
+            return false;
+        }
+
+        return true;
+    }
+
+    int JackNetMasterInterface::SetRxTimeout()
+    {
+        jack_log ( "JackNetMasterInterface::SetRxTimeout" );
+
+        float time = 0;
+        //slow or normal mode, short timeout on recv (2 audio subcycles)
+        if ( ( fParams.fNetworkMode == 's' ) || ( fParams.fNetworkMode == 'n' ) )
+            time = 2000000.f * ( static_cast<float> ( fParams.fFramesPerPacket ) / static_cast<float> ( fParams.fSampleRate ) );
+        //fast mode, wait for 75% of the entire cycle duration
+        else if ( fParams.fNetworkMode == 'f' )
+            time = 750000.f * ( static_cast<float> ( fParams.fPeriodSize ) / static_cast<float> ( fParams.fSampleRate ) );
+        return fSocket.SetTimeOut ( static_cast<int> ( time ) );
+    }
+
+    void JackNetMasterInterface::SetParams()
+    {
+        jack_log ( "JackNetMasterInterface::SetParams" );
+
+        JackNetInterface::SetParams();
+
+        fTxHeader.fDataStream = 's';
+        fRxHeader.fDataStream = 'r';
+
+        //midi net buffers
+        fNetMidiCaptureBuffer = new NetMidiBuffer ( &fParams, fParams.fSendMidiChannels, fTxData );
+        fNetMidiPlaybackBuffer = new NetMidiBuffer ( &fParams, fParams.fReturnMidiChannels, fRxData );
+        assert ( fNetMidiCaptureBuffer );
+        assert ( fNetMidiPlaybackBuffer );
+
+        //audio net buffers
+        fNetAudioCaptureBuffer = new NetAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData );
+        fNetAudioPlaybackBuffer = new NetAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData );
+        assert ( fNetAudioCaptureBuffer );
+        assert ( fNetAudioPlaybackBuffer );
+
+        //audio netbuffer length
+        fAudioTxLen = sizeof ( packet_header_t ) + fNetAudioCaptureBuffer->GetSize();
+        fAudioRxLen = sizeof ( packet_header_t ) + fNetAudioPlaybackBuffer->GetSize();
+    }
+
+    void JackNetMasterInterface::Exit()
+    {
+        jack_log ( "JackNetMasterInterface::Exit, ID %u", fParams.fID );
+
+        //stop process
+        fRunning = false;
+
+        //send a 'multicast euthanasia request' - new socket is required on macosx
+        jack_info ( "Exiting '%s'", fParams.fName );
+        SetPacketType ( &fParams, KILL_MASTER );
+        JackNetSocket mcast_socket ( fMulticastIP, fSocket.GetPort() );
+        
+        session_params_t net_params;
+        memset(&net_params, 0, sizeof ( session_params_t ));
+        SessionParamsHToN(&fParams, &net_params);
+
+        if ( mcast_socket.NewSocket() == SOCKET_ERROR )
+            jack_error ( "Can't create socket : %s", StrError ( NET_ERROR_CODE ) );
+        if ( mcast_socket.SendTo ( &net_params, sizeof ( session_params_t ), 0, fMulticastIP ) == SOCKET_ERROR )
+            jack_error ( "Can't send suicide request : %s", StrError ( NET_ERROR_CODE ) );
+            
+        mcast_socket.Close();
+    }
+
+    int JackNetMasterInterface::Recv ( size_t size, int flags )
+    {
+        int rx_bytes;
+        if ( ( ( rx_bytes = fSocket.Recv ( fRxBuffer, size, flags ) ) == SOCKET_ERROR ) && fRunning )
+        {
+            net_error_t error = fSocket.GetError();
+            //no data isn't really a network error, so just return 0 avalaible read bytes
+            if ( error == NET_NO_DATA )
+                return 0;
+            else if ( error == NET_CONN_ERROR )
+            {
+                //fatal connection issue, exit
+                jack_error ( "'%s' : %s, exiting.", fParams.fName, StrError ( NET_ERROR_CODE ) );
+                //ask to the manager to properly remove the master
+                Exit();
+                
+                // UGLY temporary way to be sure the thread does not call code possibly causing a deadlock in JackEngine.
+                ThreadExit();
+            }
+            else
+                jack_error ( "Error in master receive : %s", StrError ( NET_ERROR_CODE ) );
+        }
+        
+        packet_header_t* header = reinterpret_cast<packet_header_t*>(fRxBuffer);
+        PacketHeaderNToH(header, header);
+        return rx_bytes;
+    }
+    
+    int JackNetMasterInterface::Send ( size_t size, int flags )
+    {
+        int tx_bytes;
+        packet_header_t* header = reinterpret_cast<packet_header_t*>(fTxBuffer);
+        PacketHeaderHToN(header, header);
+        
+        if ( ( ( tx_bytes = fSocket.Send ( fTxBuffer, size, flags ) ) == SOCKET_ERROR ) && fRunning )
+        {
+            net_error_t error = fSocket.GetError();
+            if ( error == NET_CONN_ERROR )
+            {
+                //fatal connection issue, exit
+                jack_error ( "'%s' : %s, exiting.", fParams.fName, StrError ( NET_ERROR_CODE ) );
+                Exit();
+                
+                // UGLY temporary way to be sure the thread does not call code possibly causing a deadlock in JackEngine.
+                ThreadExit();
+            }
+            else
+                jack_error ( "Error in master send : %s", StrError ( NET_ERROR_CODE ) );
+        }
+        return tx_bytes;
+    }
+    
+    bool JackNetMasterInterface::IsSynched()
+    {
+        if (fParams.fNetworkMode == 's') {
+            return (fCycleOffset < 3);
+        } else {
+            return true;
+        }
+    }
+    
+    int JackNetMasterInterface::SyncSend()
+    {
+        fTxHeader.fCycle++;
+        fTxHeader.fSubCycle = 0;
+        fTxHeader.fDataType = 's';
+        fTxHeader.fIsLastPckt = ( fParams.fSendMidiChannels == 0 && fParams.fSendAudioChannels == 0) ?  1 : 0;
+        fTxHeader.fPacketSize = fParams.fMtu;
+        memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
+        return Send ( fTxHeader.fPacketSize, 0 );
+    }
+
+    int JackNetMasterInterface::DataSend()
+    {
+        uint subproc;
+        //midi
+        if ( fParams.fSendMidiChannels > 0)
+        {
+            //set global header fields and get the number of midi packets
+            fTxHeader.fDataType = 'm';
+            fTxHeader.fMidiDataSize = fNetMidiCaptureBuffer->RenderFromJackPorts();
+            fTxHeader.fNMidiPckt = GetNMidiPckt();
+            for ( subproc = 0; subproc < fTxHeader.fNMidiPckt; subproc++ )
+            {
+                fTxHeader.fSubCycle = subproc;
+                fTxHeader.fIsLastPckt = ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && (fParams.fSendAudioChannels == 0)) ? 1 : 0;
+                fTxHeader.fPacketSize = sizeof ( packet_header_t ) + fNetMidiCaptureBuffer->RenderToNetwork ( subproc, fTxHeader.fMidiDataSize );
+                memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
+                if ( Send ( fTxHeader.fPacketSize, 0 ) == SOCKET_ERROR )
+                    return SOCKET_ERROR;
+            }
+        }
+
+        //audio
+        if ( fParams.fSendAudioChannels > 0)
+        {
+            fTxHeader.fDataType = 'a';
+            fTxHeader.fMidiDataSize = 0;
+            fTxHeader.fNMidiPckt = 0;
+            for ( subproc = 0; subproc < fNSubProcess; subproc++ )
+            {
+                fTxHeader.fSubCycle = subproc;
+                fTxHeader.fIsLastPckt = ( subproc == ( fNSubProcess - 1 ) ) ? 1 : 0;
+                fTxHeader.fPacketSize = fAudioTxLen;
+                memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
+                fNetAudioCaptureBuffer->RenderFromJackPorts ( subproc );
+                if ( Send ( fTxHeader.fPacketSize, 0 ) == SOCKET_ERROR )
+                    return SOCKET_ERROR;
+            }
+        }
+
+        return 0;
+    }
+
+    int JackNetMasterInterface::SyncRecv()
+    {
+        packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
+        int rx_bytes = Recv ( fParams.fMtu, MSG_PEEK );
+        
+        if ( ( rx_bytes == 0 ) || ( rx_bytes == SOCKET_ERROR ) )
+            return rx_bytes;
+
+        fCycleOffset = fTxHeader.fCycle - rx_head->fCycle;
+      
+        switch ( fParams.fNetworkMode )
+        {
+            case 's' :
+                //slow mode : allow to use full bandwidth and heavy process on the slave
+                //  - extra latency is set to two cycles, one cycle for send/receive operations + one cycle for heavy process on the slave
+                //  - if the network is two fast, just wait the next cycle, this mode allows a shorter cycle duration for the master
+                //  - this mode will skip the two first cycles, thus it lets time for data to be processed and queued on the socket rx buffer
+                //the slow mode is the safest mode because it wait twice the bandwidth relative time (send/return + process)
+                if (fCycleOffset < 2)
+                     return 0;
+                else
+                    rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                    
+                if (fCycleOffset > 2) {
+                    jack_info("Warning : '%s' runs in slow network mode, but data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset);
+                }
+                break;
+
+            case 'n' :
+                //normal use of the network :
+                //  - extra latency is set to one cycle, what is the time needed to receive streams using full network bandwidth
+                //  - if the network is too fast, just wait the next cycle, the benefit here is the master's cycle is shorter
+                //  - indeed, data is supposed to be on the network rx buffer, so we don't have to wait for it
+                if (fCycleOffset < 1)
+                    return 0;
+                else
+                    rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                    
+                if (fCycleOffset != 1) 
+                    jack_info("'%s' can't run in normal network mode, data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset);
+                break;
+
+            case 'f' :
+                //fast mode suppose the network bandwith is larger than required for the transmission (only a few channels for example)
+                //    - packets can be quickly received, quickly is here relative to the cycle duration
+                //    - here, receive data, we can't keep it queued on the rx buffer,
+                //    - but if there is a cycle offset, tell the user, that means we're not in fast mode anymore, network is too slow
+                rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                
+                if (fCycleOffset != 0)
+                    jack_info("'%s' can't run in fast network mode, data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset);
+                break;
+        }
+
+        fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
+        return rx_bytes;
+    }
+    
+    int JackNetMasterInterface::DataRecv()
+    {
+        int rx_bytes = 0;
+        uint jumpcnt = 0;
+        uint recvd_midi_pckt = 0;
+        uint recvd_audio_pckt = 0;
+        packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
+        
+        while ( !fRxHeader.fIsLastPckt )
+        {
+            //how much data is queued on the rx buffer ?
+            rx_bytes = Recv ( fParams.fMtu, MSG_PEEK );
+              
+            if ( rx_bytes == SOCKET_ERROR )
+                return rx_bytes;
+            //if no data
+            if ( ( rx_bytes == 0 ) && ( ++jumpcnt == fNSubProcess ) )
+            {
+                jack_error ( "No data from %s...", fParams.fName );
+                jumpcnt = 0;
+            }
+            //else if data is valid,
+            if ( rx_bytes && ( rx_head->fDataStream == 'r' ) && ( rx_head->fID == fParams.fID ) )
+            {
+                //read data
+                switch ( rx_head->fDataType )
+                {
+                    case 'm':   //midi
+                        rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                        fRxHeader.fCycle = rx_head->fCycle;
+                        fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
+                        fNetMidiPlaybackBuffer->RenderFromNetwork ( rx_head->fSubCycle, rx_bytes - sizeof ( packet_header_t ) );
+                        if ( ++recvd_midi_pckt == rx_head->fNMidiPckt )
+                            fNetMidiPlaybackBuffer->RenderToJackPorts();
+                        jumpcnt = 0;
+                        break;
+
+                    case 'a':   //audio
+                        rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                        // SL: 25/01/09
+                        // if ( !IsNextPacket() )
+                        //    jack_error ( "Packet(s) missing from '%s'...", fParams.fName );
+                        if (recvd_audio_pckt++ != rx_head->fSubCycle) {
+                            jack_error("Packet(s) missing from '%s'...", fParams.fSlaveNetName);
+                        }
+                        fRxHeader.fCycle = rx_head->fCycle;
+                        fRxHeader.fSubCycle = rx_head->fSubCycle;
+                        fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
+                        fNetAudioPlaybackBuffer->RenderToJackPorts ( rx_head->fSubCycle );
+                        jumpcnt = 0;
+                        break;
+
+                    case 's':   //sync
+                        /* SL: 25/01/09
+                        if ( rx_head->fCycle == fTxHeader.fCycle )
+                            return 0;
+                        */
+                        jack_info("NetMaster : overloaded, skipping receive from '%s'", fParams.fName);
+                        return 0;
+                }
+            }
+        }
+        return rx_bytes;
+    }
+    
+    void JackNetMasterInterface::EncodeSyncPacket()
+    {
+        //this method contains every step of sync packet informations coding
+        //first of all, reset sync packet
+        memset ( fTxData, 0, fPayloadSize );
+
+        //then, first step : transport
+        if (fParams.fTransportSync) {
+            EncodeTransportData();
+            TransportDataHToN( &fSendTransportData,  &fSendTransportData);
+            //copy to TxBuffer
+            memcpy ( fTxData, &fSendTransportData, sizeof ( net_transport_data_t ) );
+        }
+        //then others (freewheel etc.)
+        //...
+    }
+
+    void JackNetMasterInterface::DecodeSyncPacket()
+    {
+        //this method contains every step of sync packet informations decoding process
+        //first : transport
+        if (fParams.fTransportSync) {
+            //copy received transport data to transport data structure
+            memcpy ( &fReturnTransportData, fRxData, sizeof ( net_transport_data_t ) );
+            TransportDataNToH( &fReturnTransportData,  &fReturnTransportData);
+            DecodeTransportData();
+        }
+        //then others
+        //...
+    }
+
+// JackNetSlaveInterface ************************************************************************************************
+
+    uint JackNetSlaveInterface::fSlaveCounter = 0;
+
+    bool JackNetSlaveInterface::Init()
+    {
+        jack_log ( "JackNetSlaveInterface::Init()" );
+
+        //set the parameters to send
+        strcpy ( fParams.fPacketType, "params" );
+        fParams.fProtocolVersion = SLAVE_PROTOCOL;
+        SetPacketType ( &fParams, SLAVE_AVAILABLE );
+
+        //init loop : get a master and start, do it until connection is ok
+        net_status_t status;
+        do
+        {
+            //first, get a master, do it until a valid connection is running
+            do
+            {
+                status = SendAvailableToMaster();
+                if ( status == NET_SOCKET_ERROR )
+                    return false;
+            }
+            while ( status != NET_CONNECTED );
+
+            //then tell the master we are ready
+            jack_info ( "Initializing connection with %s...", fParams.fMasterNetName );
+            status = SendStartToMaster();
+            if ( status == NET_ERROR )
+                return false;
+        }
+        while ( status != NET_ROLLING );
+
+        return true;
+    }
+    
+    // Separate the connection protocol into two separated step
+    
+    bool JackNetSlaveInterface::InitConnection()
+    {
+        jack_log ( "JackNetSlaveInterface::InitConnection()" );
+
+        //set the parameters to send
+        strcpy (fParams.fPacketType, "params");
+        fParams.fProtocolVersion = SLAVE_PROTOCOL;
+        SetPacketType (&fParams, SLAVE_AVAILABLE);
+
+        net_status_t status;
+        do
+        {
+            //get a master
+            status = SendAvailableToMaster();
+            if (status == NET_SOCKET_ERROR)
+                return false;
+        }
+        while (status != NET_CONNECTED);
+  
+        return true;
+    }
+    
+    bool JackNetSlaveInterface::InitRendering()
+    {
+        jack_log("JackNetSlaveInterface::InitRendering()");
+
+        net_status_t status;
+        do
+        {
+            //then tell the master we are ready
+            jack_info("Initializing connection with %s...", fParams.fMasterNetName);
+            status = SendStartToMaster();
+            if (status == NET_ERROR)
+                return false;
+        }
+        while (status != NET_ROLLING);   
+        
+        return true;
+    }
+
+    net_status_t JackNetSlaveInterface::SendAvailableToMaster()
+    {
+        jack_log ( "JackNetSlaveInterface::SendAvailableToMaster()" );
+        //utility
+        session_params_t host_params;
+        int rx_bytes = 0;
+
+        //socket
+        if ( fSocket.NewSocket() == SOCKET_ERROR ) {
+            jack_error ( "Fatal error : network unreachable - %s", StrError ( NET_ERROR_CODE ) );
+            return NET_SOCKET_ERROR;
+        }
+
+        //bind the socket
+        if ( fSocket.Bind() == SOCKET_ERROR ) {
+            jack_error ( "Can't bind the socket : %s", StrError ( NET_ERROR_CODE ) );
+            return NET_SOCKET_ERROR;
+        }
+
+        //timeout on receive
+        if ( fSocket.SetTimeOut ( SLAVE_INIT_TIMEOUT ) == SOCKET_ERROR ) 
+            jack_error ( "Can't set timeout : %s", StrError ( NET_ERROR_CODE ) );
+
+        //disable local loop
+        if ( fSocket.SetLocalLoop() == SOCKET_ERROR )
+            jack_error ( "Can't disable multicast loop : %s", StrError ( NET_ERROR_CODE ) );
+
+        //send 'AVAILABLE' until 'SLAVE_SETUP' received
+        jack_info ( "Waiting for a master..." );
+        do
+        {
+            //send 'available'
+            session_params_t net_params;
+            memset(&net_params, 0, sizeof ( session_params_t ));
+            SessionParamsHToN(&fParams, &net_params);
+            if ( fSocket.SendTo ( &net_params, sizeof ( session_params_t ), 0, fMulticastIP ) == SOCKET_ERROR )
+                jack_error ( "Error in data send : %s", StrError ( NET_ERROR_CODE ) );
+                
+            //filter incoming packets : don't exit while no error is detected
+            memset(&net_params, 0, sizeof ( session_params_t ));
+            rx_bytes = fSocket.CatchHost ( &net_params, sizeof ( session_params_t ), 0 );
+            SessionParamsNToH(&net_params, &host_params);
+            if ( ( rx_bytes == SOCKET_ERROR ) && ( fSocket.GetError() != NET_NO_DATA ) )
+            {
+                jack_error ( "Can't receive : %s", StrError ( NET_ERROR_CODE ) );
+                return NET_RECV_ERROR;
+            }
+        }
+        while ( strcmp ( host_params.fPacketType, fParams.fPacketType )  && ( GetPacketType ( &host_params ) != SLAVE_SETUP ) );
+
+        //everything is OK, copy parameters
+        fParams = host_params;
+
+        //set the new buffer sizes
+        if ( SetNetBufferSize() == SOCKET_ERROR ) {
+            jack_error ( "Can't set net buffer sizes : %s", StrError ( NET_ERROR_CODE ) );
+             return NET_SOCKET_ERROR;
+        }
+
+        //connect the socket
+        if ( fSocket.Connect() == SOCKET_ERROR ) {
+            jack_error ( "Error in connect : %s", StrError ( NET_ERROR_CODE ) );
+            return NET_CONNECT_ERROR;
+        }
+
+        return NET_CONNECTED;
+    }
+
+    net_status_t JackNetSlaveInterface::SendStartToMaster()
+    {
+        jack_log ( "JackNetSlaveInterface::SendStartToMaster" );
+
+        //tell the master to start
+        session_params_t net_params;
+        memset(&net_params, 0, sizeof ( session_params_t ));
+        SetPacketType ( &fParams, START_MASTER );
+        SessionParamsHToN(&fParams, &net_params);
+        if ( fSocket.Send ( &net_params, sizeof ( session_params_t ), 0 ) == SOCKET_ERROR )
+        {
+            jack_error ( "Error in send : %s", StrError ( NET_ERROR_CODE ) );
+            return ( fSocket.GetError() == NET_CONN_ERROR ) ? NET_ERROR : NET_SEND_ERROR;
+        }
+        return NET_ROLLING;
+    }
+
+    void JackNetSlaveInterface::SetParams()
+    {
+        jack_log ( "JackNetSlaveInterface::SetParams" );
+
+        JackNetInterface::SetParams();
+
+        fTxHeader.fDataStream = 'r';
+        fRxHeader.fDataStream = 's';
+
+        //midi net buffers
+        fNetMidiCaptureBuffer = new NetMidiBuffer ( &fParams, fParams.fSendMidiChannels, fRxData );
+        fNetMidiPlaybackBuffer = new NetMidiBuffer ( &fParams, fParams.fReturnMidiChannels, fTxData );
+
+        //audio net buffers
+        fNetAudioCaptureBuffer = new NetAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
+        fNetAudioPlaybackBuffer = new NetAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
+
+        //audio netbuffer length
+        fAudioTxLen = sizeof ( packet_header_t ) + fNetAudioPlaybackBuffer->GetSize();
+        fAudioRxLen = sizeof ( packet_header_t ) + fNetAudioCaptureBuffer->GetSize();
+    }
+
+    int JackNetSlaveInterface::Recv ( size_t size, int flags )
+    {
+        int rx_bytes = fSocket.Recv ( fRxBuffer, size, flags );
+        //handle errors
+        if ( rx_bytes == SOCKET_ERROR )
+        {
+            net_error_t error = fSocket.GetError();
+            //no data isn't really an error in realtime processing, so just return 0
+            if ( error == NET_NO_DATA )
+                jack_error ( "No data, is the master still running ?" );
+            //if a network error occurs, this exception will restart the driver
+            else if ( error == NET_CONN_ERROR )
+            {
+                jack_error ( "Connection lost." );
+                throw JackNetException();
+            }
+            else
+                jack_error ( "Fatal error in slave receive : %s", StrError ( NET_ERROR_CODE ) );
+        }
+        
+        packet_header_t* header = reinterpret_cast<packet_header_t*>(fRxBuffer);
+        PacketHeaderNToH(header, header);
+        return rx_bytes;
+    }
+
+    int JackNetSlaveInterface::Send ( size_t size, int flags )
+    {
+        packet_header_t* header = reinterpret_cast<packet_header_t*>(fTxBuffer);
+        PacketHeaderHToN(header, header);
+        int tx_bytes = fSocket.Send ( fTxBuffer, size, flags );
+         
+        //handle errors
+        if ( tx_bytes == SOCKET_ERROR )
+        {
+            net_error_t error = fSocket.GetError();
+            //if a network error occurs, this exception will restart the driver
+            if ( error == NET_CONN_ERROR )
+            {
+                jack_error ( "Connection lost." );
+                throw JackNetException();
+            }
+            else
+                jack_error ( "Fatal error in slave send : %s", StrError ( NET_ERROR_CODE ) );
+        }
+        return tx_bytes;
+    }
+
+    int JackNetSlaveInterface::SyncRecv()
+    {
+        int rx_bytes = 0;
+        packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
+        //receive sync (launch the cycle)
+        do
+        {
+            rx_bytes = Recv ( fParams.fMtu, 0 );
+            //connection issue, send will detect it, so don't skip the cycle (return 0)
+            if ( rx_bytes == SOCKET_ERROR )
+                return rx_bytes;
+        }
+        while ((strcmp(rx_head->fPacketType, "header") != 0) && (rx_head->fDataType != 's'));
+        
+        fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
+        return rx_bytes;
+    }
+
+    int JackNetSlaveInterface::DataRecv()
+    {
+        uint recvd_midi_pckt = 0;
+        uint recvd_audio_pckt = 0;
+        int rx_bytes = 0;
+        packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
+
+        while ( !fRxHeader.fIsLastPckt )
+        {
+            rx_bytes = Recv ( fParams.fMtu, MSG_PEEK );
+            //error here, problem with recv, just skip the cycle (return -1)
+
+            if ( rx_bytes == SOCKET_ERROR )
+                return rx_bytes;
+            if ( rx_bytes && ( rx_head->fDataStream == 's' ) && ( rx_head->fID == fParams.fID ) )
+            {
+                switch ( rx_head->fDataType )
+                {
+                    case 'm':   //midi
+                        rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                        fRxHeader.fCycle = rx_head->fCycle;
+                        fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
+                        fNetMidiCaptureBuffer->RenderFromNetwork ( rx_head->fSubCycle, rx_bytes - sizeof ( packet_header_t ) );
+                        if ( ++recvd_midi_pckt == rx_head->fNMidiPckt )
+                            fNetMidiCaptureBuffer->RenderToJackPorts();
+                        break;
+
+                    case 'a':   //audio
+                        rx_bytes = Recv ( rx_head->fPacketSize, 0 );
+                        //SL: 25/01/09
+                        // if ( !IsNextPacket() )
+                        //    jack_error ( "Packet(s) missing..." );
+                        if (recvd_audio_pckt++ != rx_head->fSubCycle) {
+                            jack_error("Packet(s) missing from '%s'...", fParams.fMasterNetName);
+                        }
+                        fRxHeader.fCycle = rx_head->fCycle;
+                        fRxHeader.fSubCycle = rx_head->fSubCycle;
+                        fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
+                        fNetAudioCaptureBuffer->RenderToJackPorts ( rx_head->fSubCycle );
+                        break;
+
+                    case 's':   //sync
+                        jack_info ( "NetSlave : overloaded, skipping receive." );
+                        return 0;
+                }
+            }
+        }
+        fRxHeader.fCycle = rx_head->fCycle;
+        return 0;
+    }
+
+    int JackNetSlaveInterface::SyncSend()
+    {
+        //tx header
+        if ( fParams.fSlaveSyncMode )
+            fTxHeader.fCycle = fRxHeader.fCycle;
+        else
+            fTxHeader.fCycle++;
+        fTxHeader.fSubCycle = 0;
+        fTxHeader.fDataType = 's';
+        fTxHeader.fIsLastPckt = ( fParams.fReturnMidiChannels == 0 && fParams.fReturnAudioChannels == 0) ?  1 : 0;
+        fTxHeader.fPacketSize = fParams.fMtu;
+        memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
+        return Send ( fTxHeader.fPacketSize, 0 );
+    }
+
+    int JackNetSlaveInterface::DataSend()
+    {
+        uint subproc;
+
+        //midi
+        if ( fParams.fReturnMidiChannels > 0)
+        {
+            fTxHeader.fDataType = 'm';
+            fTxHeader.fMidiDataSize = fNetMidiPlaybackBuffer->RenderFromJackPorts();
+            fTxHeader.fNMidiPckt = GetNMidiPckt();
+            for ( subproc = 0; subproc < fTxHeader.fNMidiPckt; subproc++ )
+            {
+                fTxHeader.fSubCycle = subproc;
+                fTxHeader.fIsLastPckt = ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fReturnAudioChannels ) ? 1 : 0;
+                fTxHeader.fPacketSize = sizeof ( packet_header_t ) + fNetMidiPlaybackBuffer->RenderToNetwork ( subproc, fTxHeader.fMidiDataSize );
+                memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
+                if ( Send ( fTxHeader.fPacketSize, 0 ) == SOCKET_ERROR )
+                    return SOCKET_ERROR;
+            }
+        }
+
+        //audio
+        if ( fParams.fReturnAudioChannels > 0)
+        {
+            fTxHeader.fDataType = 'a';
+            fTxHeader.fMidiDataSize = 0;
+            fTxHeader.fNMidiPckt = 0;
+            for ( subproc = 0; subproc < fNSubProcess; subproc++ )
+            {
+                fTxHeader.fSubCycle = subproc;
+                fTxHeader.fIsLastPckt = ( subproc == ( fNSubProcess - 1 ) ) ? 1 : 0;
+                fTxHeader.fPacketSize = fAudioTxLen;
+                memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
+                fNetAudioPlaybackBuffer->RenderFromJackPorts ( subproc );
+                if ( Send ( fTxHeader.fPacketSize, 0 ) == SOCKET_ERROR )
+                    return SOCKET_ERROR;
+            }
+        }
+        return 0;
+    }
+    
+    //network sync------------------------------------------------------------------------
+    void JackNetSlaveInterface::EncodeSyncPacket()
+    {
+        //this method contains every step of sync packet informations coding
+        //first of all, reset sync packet
+        memset ( fTxData, 0, fPayloadSize );
+        //then first step : transport
+        if (fParams.fTransportSync) {
+            EncodeTransportData();
+            TransportDataHToN( &fReturnTransportData,  &fReturnTransportData);
+            //copy to TxBuffer
+            memcpy ( fTxData, &fReturnTransportData, sizeof ( net_transport_data_t ) );
+        }
+        //then others
+        //...
+    }
+    
+    void JackNetSlaveInterface::DecodeSyncPacket()
+    {
+        //this method contains every step of sync packet informations decoding process
+        //first : transport
+        if (fParams.fTransportSync) {
+            //copy received transport data to transport data structure
+            memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) );
+            TransportDataNToH( &fSendTransportData,  &fSendTransportData);
+            DecodeTransportData();
+        }
+        //then others
+        //...
+    }
+
+}
diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h
new file mode 100644
index 0000000..ca90875
--- /dev/null
+++ b/common/JackNetInterface.h
@@ -0,0 +1,217 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetInterface__
+#define __JackNetInterface__
+
+#include "JackNetTool.h"
+
+namespace Jack
+{
+    /**
+    \Brief This class describes the basic Net Interface, used by both master and slave
+    */
+
+    class SERVER_EXPORT JackNetInterface
+    {
+        protected:
+            session_params_t fParams;
+            JackNetSocket fSocket;
+            char fMulticastIP[32];
+            uint fNSubProcess;
+
+            //headers
+            packet_header_t fTxHeader;
+            packet_header_t fRxHeader;
+            
+            // transport
+            net_transport_data_t fSendTransportData;
+            net_transport_data_t fReturnTransportData;
+
+            //network buffers
+            char* fTxBuffer;
+            char* fRxBuffer;
+            char* fTxData;
+            char* fRxData;
+
+            //jack buffers
+            NetMidiBuffer* fNetMidiCaptureBuffer;
+            NetMidiBuffer* fNetMidiPlaybackBuffer;
+            NetAudioBuffer* fNetAudioCaptureBuffer;
+            NetAudioBuffer* fNetAudioPlaybackBuffer;
+
+            //sizes
+            int fAudioRxLen;
+            int fAudioTxLen;
+            int fPayloadSize;
+
+            //utility methods
+            void SetFramesPerPacket();
+            int SetNetBufferSize();
+            int GetNMidiPckt();
+            bool IsNextPacket();
+
+            //virtual methods : depends on the sub class master/slave
+            virtual void SetParams();
+            virtual bool Init() = 0;
+
+            //transport
+            virtual void EncodeTransportData() = 0;
+            virtual void DecodeTransportData() = 0;
+
+            //sync packet
+            virtual void EncodeSyncPacket() = 0;
+            virtual void DecodeSyncPacket() = 0;
+
+            virtual int SyncRecv() = 0;
+            virtual int SyncSend() = 0;
+            virtual int DataRecv() = 0;
+            virtual int DataSend() = 0;
+
+            virtual int Send ( size_t size, int flags ) = 0;
+            virtual int Recv ( size_t size, int flags ) = 0;
+
+            JackNetInterface();
+            JackNetInterface ( const char* multicast_ip, int port );
+            JackNetInterface ( session_params_t& params, JackNetSocket& socket, const char* multicast_ip );
+
+        public:
+            virtual ~JackNetInterface();
+    };
+
+    /**
+    \Brief This class describes the Net Interface for masters (NetMaster)
+    */
+
+    class SERVER_EXPORT JackNetMasterInterface : public JackNetInterface
+    {
+        protected:
+            bool fRunning;
+            int fCycleOffset;
+
+            bool Init();
+            int SetRxTimeout();
+            void SetParams();
+            
+            void Exit();
+            
+            int SyncRecv();
+            int SyncSend();
+            
+            int DataRecv();
+            int DataSend();
+            
+             //sync packet
+            void EncodeSyncPacket();
+            void DecodeSyncPacket();
+
+            int Send ( size_t size, int flags );
+            int Recv ( size_t size, int flags );
+            
+            bool IsSynched();
+
+        public:
+            JackNetMasterInterface() : JackNetInterface(), fRunning(false), fCycleOffset(0)
+            {}
+            JackNetMasterInterface ( session_params_t& params, JackNetSocket& socket, const char* multicast_ip )
+                    : JackNetInterface ( params, socket, multicast_ip )
+            {}
+            ~JackNetMasterInterface()
+            {}
+    };
+
+    /**
+    \Brief This class describes the Net Interface for slaves (NetDriver and NetAdapter)
+    */
+
+    class SERVER_EXPORT JackNetSlaveInterface : public JackNetInterface
+    {
+        protected:
+        
+            static uint fSlaveCounter;
+       
+            bool Init();
+            bool InitConnection();
+            bool InitRendering();
+            
+            net_status_t SendAvailableToMaster();
+            net_status_t SendStartToMaster();
+            
+            void SetParams();
+            
+            int SyncRecv();
+            int SyncSend();
+            
+            int DataRecv();
+            int DataSend();
+            
+            //sync packet
+            void EncodeSyncPacket();
+            void DecodeSyncPacket();
+
+            int Recv ( size_t size, int flags );
+            int Send ( size_t size, int flags );
+
+        public:
+            JackNetSlaveInterface() : JackNetInterface()
+            {
+                //open Socket API with the first slave
+                if ( fSlaveCounter++ == 0 )
+                {
+                    if ( SocketAPIInit() < 0 )
+                    {
+                        jack_error ( "Can't init Socket API, exiting..." );
+                        throw -1;
+                    }
+                }
+            }
+            JackNetSlaveInterface ( const char* ip, int port ) : JackNetInterface ( ip, port )
+            {
+                //open Socket API with the first slave
+                if ( fSlaveCounter++ == 0 )
+                {
+                    if ( SocketAPIInit() < 0 )
+                    {
+                        jack_error ( "Can't init Socket API, exiting..." );
+                        throw -1;
+                    }
+                }
+            }
+            ~JackNetSlaveInterface()
+            {
+                //close Socket API with the last slave
+                if ( --fSlaveCounter == 0 )
+                    SocketAPIEnd();
+            }
+    };
+}
+
+#define DEFAULT_MULTICAST_IP "225.3.19.154"
+#define DEFAULT_PORT 19000
+#define DEFAULT_MTU 1500
+
+#define SLAVE_SETUP_RETRY 5
+
+#define MASTER_INIT_TIMEOUT 1000000     // in usec
+#define SLAVE_INIT_TIMEOUT 2000000      // in usec
+
+#define MAX_LATENCY 6
+
+#endif
diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp
new file mode 100644
index 0000000..b42d970
--- /dev/null
+++ b/common/JackNetManager.cpp
@@ -0,0 +1,798 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "JackNetManager.h"
+#include "JackArgParser.h"
+#include "JackTime.h"
+
+using namespace std;
+
+namespace Jack
+{
+//JackNetMaster******************************************************************************************************
+
+    JackNetMaster::JackNetMaster ( JackNetSocket& socket, session_params_t& params, const char* multicast_ip)
+            : JackNetMasterInterface ( params, socket, multicast_ip )
+    {
+        jack_log ( "JackNetMaster::JackNetMaster" );
+
+        //settings
+        fClientName = const_cast<char*> ( fParams.fName );
+        fJackClient = NULL;
+        fSendTransportData.fState = -1;
+        fReturnTransportData.fState = -1;
+        fLastTransportState = -1;
+        uint port_index;
+
+        //jack audio ports
+        fAudioCapturePorts = new jack_port_t* [fParams.fSendAudioChannels];
+        for ( port_index = 0; port_index < fParams.fSendAudioChannels; port_index++ )
+            fAudioCapturePorts[port_index] = NULL;
+        fAudioPlaybackPorts = new jack_port_t* [fParams.fReturnAudioChannels];
+        for ( port_index = 0; port_index < fParams.fReturnAudioChannels; port_index++ )
+            fAudioPlaybackPorts[port_index] = NULL;
+        //jack midi ports
+        fMidiCapturePorts = new jack_port_t* [fParams.fSendMidiChannels];
+        for ( port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ )
+            fMidiCapturePorts[port_index] = NULL;
+        fMidiPlaybackPorts = new jack_port_t* [fParams.fReturnMidiChannels];
+        for ( port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ )
+            fMidiPlaybackPorts[port_index] = NULL;
+
+        //monitor
+#ifdef JACK_MONITOR
+        fPeriodUsecs = ( int ) ( 1000000.f * ( ( float ) fParams.fPeriodSize / ( float ) fParams.fSampleRate ) );
+        string plot_name;
+        plot_name = string ( fParams.fName );
+        plot_name += string ( "_master" );
+        plot_name += string ( ( fParams.fSlaveSyncMode ) ? "_sync" : "_async" );
+        switch ( fParams.fNetworkMode )
+        {
+            case 's' :
+                plot_name += string ( "_slow" );
+                break;
+            case 'n' :
+                plot_name += string ( "_normal" );
+                break;
+            case 'f' :
+                plot_name += string ( "_fast" );
+                break;
+        }
+        fNetTimeMon = new JackGnuPlotMonitor<float> ( 128, 4, plot_name );
+        string net_time_mon_fields[] =
+        {
+            string ( "sync send" ),
+            string ( "end of send" ),
+            string ( "sync recv" ),
+            string ( "end of cycle" )
+        };
+        string net_time_mon_options[] =
+        {
+            string ( "set xlabel \"audio cycles\"" ),
+            string ( "set ylabel \"% of audio cycle\"" )
+        };
+        fNetTimeMon->SetPlotFile ( net_time_mon_options, 2, net_time_mon_fields, 4 );
+#endif
+    }
+
+    JackNetMaster::~JackNetMaster()
+    {
+        jack_log ( "JackNetMaster::~JackNetMaster, ID %u.", fParams.fID );
+
+        if ( fJackClient )
+        {
+            jack_deactivate ( fJackClient );
+            FreePorts();
+            jack_client_close ( fJackClient );
+        }
+        delete[] fAudioCapturePorts;
+        delete[] fAudioPlaybackPorts;
+        delete[] fMidiCapturePorts;
+        delete[] fMidiPlaybackPorts;
+#ifdef JACK_MONITOR
+        fNetTimeMon->Save();
+        delete fNetTimeMon;
+#endif
+    }
+//init--------------------------------------------------------------------------------
+    bool JackNetMaster::Init(bool auto_connect)
+    {
+        //network init
+        if ( !JackNetMasterInterface::Init() )
+            return false;
+
+        //set global parameters
+        SetParams();
+
+        //jack client and process
+        jack_status_t status;
+        if ( ( fJackClient = jack_client_open ( fClientName, JackNullOption, &status, NULL ) ) == NULL )
+        {
+            jack_error ( "Can't open a new jack client." );
+            return false;
+        }
+
+        if (jack_set_process_callback(fJackClient, SetProcess, this ) < 0)
+             goto fail;
+             
+        if (jack_set_buffer_size_callback(fJackClient, SetBufferSize, this) < 0)
+             goto fail;
+
+        if ( AllocPorts() != 0 )
+        {
+            jack_error ( "Can't allocate jack ports." );
+            goto fail;
+        }
+
+        //process can now run
+        fRunning = true;
+
+        //finally activate jack client
+        if ( jack_activate ( fJackClient ) != 0 )
+        {
+            jack_error ( "Can't activate jack client." );
+            goto fail;
+        }
+        
+        if (auto_connect)
+            ConnectPorts();
+        jack_info ( "New NetMaster started." );
+        return true;
+
+    fail:
+        FreePorts();
+        jack_client_close ( fJackClient );
+        fJackClient = NULL;
+        return false;
+    }
+
+//jack ports--------------------------------------------------------------------------
+    int JackNetMaster::AllocPorts()
+    {
+        uint i;
+        char name[24];
+        jack_nframes_t port_latency = jack_get_buffer_size ( fJackClient );
+        
+        jack_log ( "JackNetMaster::AllocPorts" );
+
+        //audio
+        for ( i = 0; i < fParams.fSendAudioChannels; i++ )
+        {
+            sprintf ( name, "to_slave_%d", i+1 );
+            if ( ( fAudioCapturePorts[i] = jack_port_register ( fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0 ) ) == NULL )
+                return -1;
+            //port latency
+            jack_port_set_latency ( fAudioCapturePorts[i], 0 );
+        }
+        
+        for ( i = 0; i < fParams.fReturnAudioChannels; i++ )
+        {
+            sprintf ( name, "from_slave_%d", i+1 );
+            if ( ( fAudioPlaybackPorts[i] = jack_port_register ( fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal, 0 ) ) == NULL )
+                return -1;
+            //port latency
+            switch ( fParams.fNetworkMode )
+            {
+                case 'f' :
+                    jack_port_set_latency ( fAudioPlaybackPorts[i], ( fParams.fSlaveSyncMode ) ? 0 : port_latency );
+                    break;
+                case 'n' :
+                    jack_port_set_latency ( fAudioPlaybackPorts[i], port_latency + ( fParams.fSlaveSyncMode ) ? 0 : port_latency );
+                    break;
+                case 's' :
+                    jack_port_set_latency ( fAudioPlaybackPorts[i], 2 * port_latency + ( fParams.fSlaveSyncMode ) ? 0 : port_latency );
+                    break;
+            }
+        }
+        
+        
+        //midi
+        for ( i = 0; i < fParams.fSendMidiChannels; i++ )
+        {
+            sprintf ( name, "midi_to_slave_%d", i+1 );
+            if ( ( fMidiCapturePorts[i] = jack_port_register ( fJackClient, name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput | JackPortIsTerminal, 0 ) ) == NULL )
+                return -1;
+            //port latency
+            jack_port_set_latency ( fMidiCapturePorts[i], 0 );
+        }
+        for ( i = 0; i < fParams.fReturnMidiChannels; i++ )
+        {
+            sprintf ( name, "midi_from_slave_%d", i+1 );
+            if ( ( fMidiPlaybackPorts[i] = jack_port_register ( fJackClient, name, JACK_DEFAULT_MIDI_TYPE,  JackPortIsOutput | JackPortIsTerminal, 0 ) ) == NULL )
+                return -1;
+            //port latency
+            switch ( fParams.fNetworkMode )
+            {
+                case 'f' :
+                    jack_port_set_latency ( fMidiPlaybackPorts[i], ( fParams.fSlaveSyncMode ) ? 0 : port_latency );
+                    break;
+                case 'n' :
+                    jack_port_set_latency ( fMidiPlaybackPorts[i], port_latency + ( fParams.fSlaveSyncMode ) ? 0 : port_latency );
+                    break;
+                case 's' :
+                    jack_port_set_latency ( fMidiPlaybackPorts[i], 2 * port_latency + ( fParams.fSlaveSyncMode ) ? 0 : port_latency );
+                    break;
+            }
+        }
+        return 0;
+    }
+    
+    void JackNetMaster::ConnectPorts()
+    {
+        const char **ports;
+         
+        ports = jack_get_ports(fJackClient, NULL, NULL, JackPortIsPhysical | JackPortIsOutput);
+        if (ports != NULL) {
+            for (unsigned int i = 0; i < fParams.fSendAudioChannels && ports[i]; i++) {
+                jack_connect(fJackClient, ports[i], jack_port_name(fAudioCapturePorts[i]));
+            }
+            free(ports);
+        }
+        
+        ports = jack_get_ports(fJackClient, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
+        if (ports != NULL) {
+            for (unsigned int i = 0; i < fParams.fReturnAudioChannels && ports[i]; i++) {
+                jack_connect(fJackClient, jack_port_name(fAudioPlaybackPorts[i]), ports[i]);
+            }
+            free(ports);
+        }
+    }
+
+    void JackNetMaster::FreePorts()
+    {
+        jack_log ( "JackNetMaster::FreePorts, ID %u", fParams.fID );
+
+        uint port_index;
+        for ( port_index = 0; port_index < fParams.fSendAudioChannels; port_index++ )
+            if ( fAudioCapturePorts[port_index] )
+                jack_port_unregister ( fJackClient, fAudioCapturePorts[port_index] );
+        for ( port_index = 0; port_index < fParams.fReturnAudioChannels; port_index++ )
+            if ( fAudioPlaybackPorts[port_index] )
+                jack_port_unregister ( fJackClient, fAudioPlaybackPorts[port_index] );
+        for ( port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ )
+            if ( fMidiCapturePorts[port_index] )
+                jack_port_unregister ( fJackClient, fMidiCapturePorts[port_index] );
+        for ( port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ )
+            if ( fMidiPlaybackPorts[port_index] )
+                jack_port_unregister ( fJackClient, fMidiPlaybackPorts[port_index] );
+    }
+
+//transport---------------------------------------------------------------------------
+    void JackNetMaster::EncodeTransportData()
+    {
+        //is there a new timebase master ?
+        //TODO : check if any timebase callback has been called (and if it's conditional or not) and set correct value...
+        fSendTransportData.fTimebaseMaster = NO_CHANGE;
+
+        //update state and position
+        fSendTransportData.fState = static_cast<uint> ( jack_transport_query ( fJackClient, &fSendTransportData.fPosition ) );
+
+        //is it a new state ?
+        fSendTransportData.fNewState = ( ( fSendTransportData.fState != fLastTransportState ) &&
+                                         ( fSendTransportData.fState != fReturnTransportData.fState ) );
+        if ( fSendTransportData.fNewState )
+            jack_info ( "Sending '%s' to '%s' frame = %ld", GetTransportState ( fSendTransportData.fState ), fParams.fName, fSendTransportData.fPosition.frame );
+        fLastTransportState = fSendTransportData.fState;
+   }
+
+    void JackNetMaster::DecodeTransportData()
+    {
+        //is there timebase master change ?
+        if ( fReturnTransportData.fTimebaseMaster != NO_CHANGE )
+        {
+            int timebase = 0;
+            switch ( fReturnTransportData.fTimebaseMaster )
+            {
+                case RELEASE_TIMEBASEMASTER :
+                    timebase = jack_release_timebase ( fJackClient );
+                    if ( timebase < 0 )
+                        jack_error ( "Can't release timebase master." );
+                    else
+                        jack_info ( "'%s' isn't the timebase master anymore.", fParams.fName );
+                    break;
+                    
+                case TIMEBASEMASTER :
+                    timebase = jack_set_timebase_callback ( fJackClient, 0, SetTimebaseCallback, this );
+                    if ( timebase < 0 )
+                        jack_error ( "Can't set a new timebase master." );
+                    else
+                        jack_info ( "'%s' is the new timebase master.", fParams.fName );
+                    break;
+                    
+                case CONDITIONAL_TIMEBASEMASTER :
+                    timebase = jack_set_timebase_callback ( fJackClient, 1, SetTimebaseCallback, this );
+                    if ( timebase != EBUSY )
+                    {
+                        if ( timebase < 0 )
+                            jack_error ( "Can't set a new timebase master." );
+                        else
+                            jack_info ( "'%s' is the new timebase master.", fParams.fName );
+                    }
+                    break;
+            }
+        }
+
+        //is the slave in a new transport state and is this state different from master's ?
+        if ( fReturnTransportData.fNewState && ( fReturnTransportData.fState != jack_transport_query ( fJackClient, NULL ) ) )
+        {
+            switch ( fReturnTransportData.fState )
+            {
+                case JackTransportStopped :
+                    jack_transport_stop ( fJackClient );
+                    jack_info ( "'%s' stops transport.", fParams.fName );
+                    break;
+                    
+                case JackTransportStarting :
+                    if ( jack_transport_reposition ( fJackClient, &fReturnTransportData.fPosition ) == EINVAL )
+                        jack_error ( "Can't set new position." );
+                    jack_transport_start ( fJackClient );
+                    jack_info ( "'%s' starts transport frame = %d", fParams.fName, fReturnTransportData.fPosition.frame);
+                    break;
+                    
+                case JackTransportNetStarting :
+                    jack_info ( "'%s' is ready to roll..", fParams.fName );
+                    break;
+                    
+                case JackTransportRolling :
+                    jack_info ( "'%s' is rolling.", fParams.fName );
+                    break;
+            }
+        }
+    }
+
+    void JackNetMaster::SetTimebaseCallback ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t* pos, int new_pos, void* arg )
+    {
+        static_cast<JackNetMaster*> ( arg )->TimebaseCallback ( pos );
+    }
+
+    void JackNetMaster::TimebaseCallback ( jack_position_t* pos )
+    {
+        pos->bar = fReturnTransportData.fPosition.bar;
+        pos->beat = fReturnTransportData.fPosition.beat;
+        pos->tick = fReturnTransportData.fPosition.tick;
+        pos->bar_start_tick = fReturnTransportData.fPosition.bar_start_tick;
+        pos->beats_per_bar = fReturnTransportData.fPosition.beats_per_bar;
+        pos->beat_type = fReturnTransportData.fPosition.beat_type;
+        pos->ticks_per_beat = fReturnTransportData.fPosition.ticks_per_beat;
+        pos->beats_per_minute = fReturnTransportData.fPosition.beats_per_minute;
+    }
+
+//sync--------------------------------------------------------------------------------
+ 
+    bool JackNetMaster::IsSlaveReadyToRoll()
+    {
+        return ( fReturnTransportData.fState == JackTransportNetStarting );
+    }
+    
+    int JackNetMaster::SetBufferSize (jack_nframes_t nframes, void* arg)
+    {
+        jack_error("Cannot handle bufer size change, so proxy will be removed...");
+        static_cast<JackNetMaster*> ( arg )->Exit();
+        return 0;
+    }
+
+//process-----------------------------------------------------------------------------
+    int JackNetMaster::SetProcess ( jack_nframes_t nframes, void* arg )
+    {
+        return static_cast<JackNetMaster*> ( arg )->Process();
+    }
+
+    int JackNetMaster::Process()
+    {
+        if ( !fRunning )
+            return 0;
+
+        uint port_index;
+        int res = 0;
+
+#ifdef JACK_MONITOR
+        jack_time_t begin_time = GetMicroSeconds();
+        fNetTimeMon->New();
+#endif
+
+        //buffers
+        for ( port_index = 0; port_index < fParams.fSendMidiChannels; port_index++ )
+            fNetMidiCaptureBuffer->SetBuffer ( port_index, static_cast<JackMidiBuffer*> ( jack_port_get_buffer ( fMidiCapturePorts[port_index],
+                                               fParams.fPeriodSize ) ) );
+        for ( port_index = 0; port_index < fParams.fSendAudioChannels; port_index++ )
+            fNetAudioCaptureBuffer->SetBuffer ( port_index, static_cast<sample_t*> ( jack_port_get_buffer ( fAudioCapturePorts[port_index],
+                                                fParams.fPeriodSize ) ) );
+        for ( port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++ )
+            fNetMidiPlaybackBuffer->SetBuffer ( port_index, static_cast<JackMidiBuffer*> ( jack_port_get_buffer ( fMidiPlaybackPorts[port_index],
+                                                fParams.fPeriodSize ) ) );
+        for ( port_index = 0; port_index < fParams.fReturnAudioChannels; port_index++ )
+            fNetAudioPlaybackBuffer->SetBuffer ( port_index, static_cast<sample_t*> ( jack_port_get_buffer ( fAudioPlaybackPorts[port_index],
+                                                 fParams.fPeriodSize ) ) );
+
+        if (IsSynched()) {  // only send if connection is "synched"
+        
+            //encode the first packet
+            EncodeSyncPacket();
+   
+            //send sync
+            if ( SyncSend() == SOCKET_ERROR )
+                return SOCKET_ERROR;
+
+    #ifdef JACK_MONITOR
+            fNetTimeMon->Add ( ( ( ( float ) (GetMicroSeconds() - begin_time ) ) / ( float ) fPeriodUsecs ) * 100.f );
+    #endif
+
+            //send data
+            if ( DataSend() == SOCKET_ERROR )
+                return SOCKET_ERROR;
+
+    #ifdef JACK_MONITOR
+            fNetTimeMon->Add ( ( ( ( float ) (GetMicroSeconds() - begin_time ) ) / ( float ) fPeriodUsecs ) * 100.f );
+    #endif
+    
+        } else {
+            jack_error("Connection is not synched, skip cycle...");
+        }
+
+        //receive sync
+        res = SyncRecv();
+        if ( ( res == 0 ) || ( res == SOCKET_ERROR ) )
+            return res;
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->Add ( ( ( ( float ) (GetMicroSeconds() - begin_time ) ) / ( float ) fPeriodUsecs ) * 100.f );
+#endif
+
+        //decode sync
+        DecodeSyncPacket();
+  
+        //receive data
+        res = DataRecv();
+        if ( ( res == 0 ) || ( res == SOCKET_ERROR ) )
+            return res;
+
+#ifdef JACK_MONITOR
+        fNetTimeMon->AddLast ( ( ( ( float ) (GetMicroSeconds() - begin_time ) ) / ( float ) fPeriodUsecs ) * 100.f );
+#endif
+        return 0;
+    }
+
+//JackNetMasterManager***********************************************************************************************
+
+    JackNetMasterManager::JackNetMasterManager ( jack_client_t* client, const JSList* params ) : fSocket()
+    {
+        jack_log ( "JackNetMasterManager::JackNetMasterManager" );
+
+        fManagerClient = client;
+        fManagerName = jack_get_client_name ( fManagerClient );
+        strcpy(fMulticastIP, DEFAULT_MULTICAST_IP);
+        fSocket.SetPort ( DEFAULT_PORT );
+        fGlobalID = 0;
+        fRunning = true;
+        fAutoConnect = false;
+
+        const JSList* node;
+        const jack_driver_param_t* param;
+        for ( node = params; node; node = jack_slist_next ( node ) )
+        {
+            param = ( const jack_driver_param_t* ) node->data;
+            switch ( param->character )
+            {
+                case 'a' :
+                    if (strlen (param->value.str) < 32)
+                        strcpy(fMulticastIP, param->value.str);
+                    else
+                        jack_error("Can't use multicast address %s, using default %s", param->value.ui, DEFAULT_MULTICAST_IP);
+                    break;
+                    
+                case 'p':
+                    fSocket.SetPort ( param->value.ui );
+                    break;
+                    
+                case 'c':
+                    fAutoConnect = param->value.i;
+                    break;
+            }
+        }
+
+        //set sync callback
+        jack_set_sync_callback ( fManagerClient, SetSyncCallback, this );
+
+        //activate the client (for sync callback)
+        if ( jack_activate ( fManagerClient ) != 0 )
+            jack_error ( "Can't activate the network manager client, transport disabled." );
+
+        //launch the manager thread
+        if ( jack_client_create_thread ( fManagerClient, &fManagerThread, 0, 0, NetManagerThread, this ) )
+            jack_error ( "Can't create the network manager control thread." );
+    }
+
+    JackNetMasterManager::~JackNetMasterManager()
+    {
+        jack_log ( "JackNetMasterManager::~JackNetMasterManager" );
+        jack_info ( "Exiting net manager..." );
+        fRunning = false;
+        jack_client_kill_thread ( fManagerClient, fManagerThread );
+        master_list_t::iterator it;
+        for ( it = fMasterList.begin(); it != fMasterList.end(); it++ )
+            delete ( *it );
+        fSocket.Close();
+        SocketAPIEnd();
+    }
+
+    int JackNetMasterManager::SetSyncCallback ( jack_transport_state_t state, jack_position_t* pos, void* arg )
+    {
+        return static_cast<JackNetMasterManager*> ( arg )->SyncCallback ( state, pos );
+    }
+
+    int JackNetMasterManager::SyncCallback ( jack_transport_state_t state, jack_position_t* pos )
+    {
+        //check if each slave is ready to roll
+        int ret = 1;
+        master_list_it_t it;
+        for ( it = fMasterList.begin(); it != fMasterList.end(); it++ )
+            if ( ! ( *it )->IsSlaveReadyToRoll() )
+                ret = 0;
+        jack_log ( "JackNetMasterManager::SyncCallback returns '%s'", ( ret ) ? "true" : "false" );
+        return ret;
+    }
+
+    void* JackNetMasterManager::NetManagerThread ( void* arg )
+    {
+        JackNetMasterManager* master_manager = static_cast<JackNetMasterManager*> ( arg );
+        jack_info ( "Starting Jack Network Manager." );
+        jack_info ( "Listening on '%s:%d'", master_manager->fMulticastIP, master_manager->fSocket.GetPort() );
+        master_manager->Run();
+        return NULL;
+    }
+
+    void JackNetMasterManager::Run()
+    {
+        jack_log ( "JackNetMasterManager::Run" );
+        //utility variables
+        int attempt = 0;
+
+        //data
+        session_params_t host_params;
+        int rx_bytes = 0;
+        JackNetMaster* net_master;
+
+        //init socket API (win32)
+        if ( SocketAPIInit() < 0 )
+        {
+            jack_error ( "Can't init Socket API, exiting..." );
+            return;
+        }
+
+        //socket
+        if ( fSocket.NewSocket() == SOCKET_ERROR )
+        {
+            jack_error ( "Can't create the network management input socket : %s", StrError ( NET_ERROR_CODE ) );
+            return;
+        }
+
+        //bind the socket to the local port
+        if ( fSocket.Bind() == SOCKET_ERROR )
+        {
+            jack_error ( "Can't bind the network manager socket : %s", StrError ( NET_ERROR_CODE ) );
+            fSocket.Close();
+            return;
+        }
+
+        //join multicast group
+        if ( fSocket.JoinMCastGroup ( fMulticastIP ) == SOCKET_ERROR )
+            jack_error ( "Can't join multicast group : %s", StrError ( NET_ERROR_CODE ) );
+
+        //local loop
+        if ( fSocket.SetLocalLoop() == SOCKET_ERROR )
+            jack_error ( "Can't set local loop : %s", StrError ( NET_ERROR_CODE ) );
+
+        //set a timeout on the multicast receive (the thread can now be cancelled)
+        if ( fSocket.SetTimeOut ( 2000000 ) == SOCKET_ERROR )
+            jack_error ( "Can't set timeout : %s", StrError ( NET_ERROR_CODE ) );
+
+        jack_info ( "Waiting for a slave..." );
+
+        //main loop, wait for data, deal with it and wait again
+        do
+        {
+            session_params_t net_params;
+            rx_bytes = fSocket.CatchHost ( &net_params, sizeof ( session_params_t ), 0 );
+            SessionParamsNToH(&net_params, &host_params);
+            if ( ( rx_bytes == SOCKET_ERROR ) && ( fSocket.GetError() != NET_NO_DATA ) )
+            {
+                jack_error ( "Error in receive : %s", StrError ( NET_ERROR_CODE ) );
+                if ( ++attempt == 10 )
+                {
+                    jack_error ( "Can't receive on the socket, exiting net manager." );
+                    return;
+                }
+            }
+            if ( rx_bytes == sizeof ( session_params_t ) )
+            {
+                switch ( GetPacketType ( &host_params ) )
+                {
+                    case SLAVE_AVAILABLE:
+                        if ( ( net_master = InitMaster ( host_params ) ) )
+                            SessionParamsDisplay ( &net_master->fParams );
+                        else
+                            jack_error ( "Can't init new net master..." );
+                        jack_info ( "Waiting for a slave..." );
+                        break;
+                    case KILL_MASTER:
+                        if ( KillMaster ( &host_params ) )
+                            jack_info ( "Waiting for a slave..." );
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+        while ( fRunning );
+    }
+
+    JackNetMaster* JackNetMasterManager::InitMaster ( session_params_t& params )
+    {
+        jack_log ( "JackNetMasterManager::InitMaster, Slave : %s", params.fName );
+        
+        //check MASTER <<==> SLAVE network protocol coherency
+        if (params.fProtocolVersion != MASTER_PROTOCOL) {
+            jack_error ( "Error : slave is running with a different protocol %s", params.fName );
+            return NULL;
+        }
+
+        //settings
+        fSocket.GetName ( params.fMasterNetName );
+        params.fID = ++fGlobalID;
+        params.fSampleRate = jack_get_sample_rate ( fManagerClient );
+        params.fPeriodSize = jack_get_buffer_size ( fManagerClient );
+        params.fBitdepth = 0;
+        SetSlaveName ( params );
+
+        //create a new master and add it to the list
+        JackNetMaster* master = new JackNetMaster(fSocket, params, fMulticastIP);
+        if ( master->Init(fAutoConnect) )
+        {
+            fMasterList.push_back ( master );
+            return master;
+        }
+        delete master;
+        return NULL;
+    }
+
+    void JackNetMasterManager::SetSlaveName ( session_params_t& params )
+    {
+        jack_log ( "JackNetMasterManager::SetSlaveName" );
+
+        master_list_it_t it;
+        for ( it = fMasterList.begin(); it != fMasterList.end(); it++ )
+            if ( strcmp ( ( *it )->fParams.fName, params.fName ) == 0 )
+                sprintf ( params.fName, "%s-%u", params.fName, params.fID );
+    }
+
+    master_list_it_t JackNetMasterManager::FindMaster ( uint32_t id )
+    {
+        jack_log ( "JackNetMasterManager::FindMaster, ID %u.", id );
+
+        master_list_it_t it;
+        for ( it = fMasterList.begin(); it != fMasterList.end(); it++ )
+            if ( ( *it )->fParams.fID == id )
+                return it;
+        return it;
+    }
+
+    int JackNetMasterManager::KillMaster ( session_params_t* params )
+    {
+        jack_log ( "JackNetMasterManager::KillMaster, ID %u.", params->fID );
+
+        master_list_it_t master = FindMaster ( params->fID );
+        if ( master != fMasterList.end() )
+        {
+            fMasterList.erase ( master );
+            delete *master;
+            return 1;
+        }
+        return 0;
+    }
+}//namespace
+
+static Jack::JackNetMasterManager* master_manager = NULL;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+    {
+        jack_driver_desc_t *desc;
+        desc = ( jack_driver_desc_t* ) calloc ( 1, sizeof ( jack_driver_desc_t ) );
+
+        strcpy ( desc->name, "netmanager" );                        // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy ( desc->desc, "netjack multi-cast master component" );  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 3;
+        desc->params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) );
+
+        int i = 0;
+        strcpy ( desc->params[i].name, "multicast_ip" );
+        desc->params[i].character = 'a';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, DEFAULT_MULTICAST_IP );
+        strcpy ( desc->params[i].short_desc, "Multicast Address" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "udp_net_port" );
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.i = DEFAULT_PORT;
+        strcpy ( desc->params[i].short_desc, "UDP port" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+        
+        i++;
+        strcpy ( desc->params[i].name, "auto_connect" );
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = false;
+        strcpy ( desc->params[i].short_desc, "Auto connect netmaster to system ports" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        return desc;
+    }
+
+    SERVER_EXPORT int jack_internal_initialize ( jack_client_t* jack_client, const JSList* params )
+    {
+        if ( master_manager )
+        {
+            jack_error ( "Master Manager already loaded" );
+            return 1;
+        }
+        else
+        {
+            jack_log ( "Loading Master Manager" );
+            master_manager = new Jack::JackNetMasterManager ( jack_client, params );
+            return ( master_manager ) ? 0 : 1;
+        }
+    }
+
+    SERVER_EXPORT int jack_initialize ( jack_client_t* jack_client, const char* load_init )
+    {
+        JSList* params = NULL;
+        bool parse_params = true;
+        int res = 1;
+        jack_driver_desc_t* desc = jack_get_descriptor();
+
+        Jack::JackArgParser parser ( load_init );
+        if ( parser.GetArgc() > 0 )
+            parse_params = parser.ParseParams ( desc, &params );
+
+        if (parse_params) {
+            res = jack_internal_initialize ( jack_client, params );
+            parser.FreeParams ( params );
+        }
+        return res;
+    }
+
+    SERVER_EXPORT void jack_finish ( void* arg )
+    {
+        if ( master_manager )
+        {
+            jack_log ( "Unloading Master Manager" );
+            delete master_manager;
+            master_manager = NULL;
+        }
+    }
+#ifdef __cplusplus
+}
+#endif
diff --git a/common/JackNetManager.h b/common/JackNetManager.h
new file mode 100644
index 0000000..29c8386
--- /dev/null
+++ b/common/JackNetManager.h
@@ -0,0 +1,120 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JACKNETMANAGER_H__
+#define __JACKNETMANAGER_H__
+
+#include "JackNetInterface.h"
+#include "thread.h"
+#include "jack.h"
+#include "jslist.h"
+#include <list>
+
+namespace Jack
+{
+    class JackNetMasterManager;
+
+    /**
+    \Brief This class describes a Net Master
+    */
+
+    class JackNetMaster : public JackNetMasterInterface
+    {
+            friend class JackNetMasterManager;
+        private:
+            static int SetProcess ( jack_nframes_t nframes, void* arg );
+            static int SetBufferSize (jack_nframes_t nframes, void* arg);
+            static void SetTimebaseCallback ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t* pos, int new_pos, void* arg );
+
+            //jack client
+            jack_client_t* fJackClient;
+            const char* fClientName;
+
+            //jack ports
+            jack_port_t** fAudioCapturePorts;
+            jack_port_t** fAudioPlaybackPorts;
+            jack_port_t** fMidiCapturePorts;
+            jack_port_t** fMidiPlaybackPorts;
+
+            //sync and transport
+            int fLastTransportState;
+     
+            //monitoring
+#ifdef JACK_MONITOR
+            jack_time_t fPeriodUsecs;
+            JackGnuPlotMonitor<float>* fNetTimeMon;
+#endif
+
+            bool Init(bool auto_connect);
+            int AllocPorts();
+            void FreePorts();
+     
+            //transport
+            void EncodeTransportData();
+            void DecodeTransportData();
+
+            int Process();
+            void TimebaseCallback ( jack_position_t* pos );
+            void ConnectPorts();
+
+        public:
+            JackNetMaster ( JackNetSocket& socket, session_params_t& params, const char* multicast_ip);
+            ~JackNetMaster ();
+
+            bool IsSlaveReadyToRoll();
+    };
+
+    typedef std::list<JackNetMaster*> master_list_t;
+    typedef master_list_t::iterator master_list_it_t;
+
+    /**
+    \Brief This class describer the Network Manager
+    */
+
+    class JackNetMasterManager
+    {
+            friend class JackNetMaster;
+        private:
+            static int SetSyncCallback ( jack_transport_state_t state, jack_position_t* pos, void* arg );
+            static void* NetManagerThread ( void* arg );
+
+            jack_client_t* fManagerClient;
+            const char* fManagerName;
+            char fMulticastIP[32];
+            JackNetSocket fSocket;
+            pthread_t fManagerThread;
+            master_list_t fMasterList;
+            uint32_t fGlobalID;
+            bool fRunning;
+            bool fAutoConnect;
+
+            void Run();
+            JackNetMaster* InitMaster ( session_params_t& params );
+            master_list_it_t FindMaster ( uint32_t client_id );
+            int KillMaster ( session_params_t* params );
+            void SetSlaveName ( session_params_t& params );
+
+            int SyncCallback ( jack_transport_state_t state, jack_position_t* pos );
+        public:
+            JackNetMasterManager ( jack_client_t* jack_client, const JSList* params);
+            ~JackNetMasterManager();
+    };
+}
+
+#endif
diff --git a/common/JackNetOneDriver.cpp b/common/JackNetOneDriver.cpp
new file mode 100644
index 0000000..3259b56
--- /dev/null
+++ b/common/JackNetOneDriver.cpp
@@ -0,0 +1,1135 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifdef WIN32
+#include <malloc.h>
+#endif
+
+#include "JackNetOneDriver.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackWaitThreadedDriver.h"
+#include "JackTools.h"
+#include "driver_interface.h"
+
+#include "netjack.h"
+#include "netjack_packet.h"
+
+#if HAVE_SAMPLERATE
+#include "samplerate.h"
+#endif
+
+#if HAVE_CELT
+#include "celt/celt.h"
+#endif
+
+#define MIN(x,y) ((x)<(y) ? (x) : (y))
+
+using namespace std;
+
+namespace Jack
+{
+    JackNetOneDriver::JackNetOneDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
+                                   int port, int mtu, int capture_ports, int playback_ports, int midi_input_ports, int midi_output_ports,
+				   int sample_rate, int period_size, int resample_factor,
+                                   const char* net_name, uint transport_sync, int bitdepth, int use_autoconfig,
+				   int latency, int redundancy, int dont_htonl_floats, int always_deadline, int jitter_val )
+            : JackAudioDriver ( name, alias, engine, table )
+    {
+        jack_log ( "JackNetOneDriver::JackNetOneDriver port %d", port );
+
+#ifdef WIN32
+    WSADATA wsa;
+    int rc = WSAStartup(MAKEWORD(2,0),&wsa);
+#endif
+
+	netjack_init( & (this->netj),
+		NULL, // client
+                name,
+                capture_ports,
+                playback_ports,
+                midi_input_ports,
+                midi_output_ports,
+                sample_rate,
+                period_size,
+                port,
+                transport_sync,
+                resample_factor,
+                0,
+                bitdepth,
+		use_autoconfig,
+		latency,
+		redundancy,
+		dont_htonl_floats,
+		always_deadline,
+		jitter_val);
+    }
+
+    JackNetOneDriver::~JackNetOneDriver()
+    {
+	// No destructor yet.
+    }
+
+//open, close, attach and detach------------------------------------------------------
+    int JackNetOneDriver::Open ( jack_nframes_t buffer_size, jack_nframes_t samplerate, bool capturing, bool playing,
+                              int inchannels, int outchannels, bool monitor,
+                              const char* capture_driver_name, const char* playback_driver_name,
+                              jack_nframes_t capture_latency, jack_nframes_t playback_latency )
+    {
+        if ( JackAudioDriver::Open ( buffer_size,
+                                     samplerate,
+                                     capturing,
+                                     playing,
+                                     inchannels,
+                                     outchannels,
+                                     monitor,
+                                     capture_driver_name,
+                                     playback_driver_name,
+                                     capture_latency,
+                                     playback_latency ) == 0 )
+        {
+            fEngineControl->fPeriod = 0;
+            fEngineControl->fComputation = 500 * 1000;
+            fEngineControl->fConstraint = 500 * 1000;
+            return 0;
+        }
+        else
+        {
+            jack_error( "open fail" );
+            return -1;
+        }
+    }
+
+    int JackNetOneDriver::Close()
+    {
+        FreePorts();
+        netjack_release( &netj );
+        return JackDriver::Close();
+    }
+
+    int JackNetOneDriver::Attach()
+    {
+        return 0;
+    }
+
+    int JackNetOneDriver::Detach()
+    {
+        return 0;
+    }
+
+    int JackNetOneDriver::AllocPorts()
+    {
+	jack_port_id_t port_id;
+	char buf[64];
+	unsigned int chn;
+
+	//if (netj.handle_transport_sync)
+	//    jack_set_sync_callback(netj.client, (JackSyncCallback) net_driver_sync_cb, NULL);
+
+	for (chn = 0; chn < netj.capture_channels_audio; chn++) {
+	    snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);
+
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
+                             CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", buf );
+                return -1;
+            }
+            //port = fGraphManager->GetPort ( port_id );
+
+	    netj.capture_ports =
+		jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
+
+	    if( netj.bitdepth == CELT_MODE ) {
+#if HAVE_CELT
+#if HAVE_CELT_API_0_7
+	    celt_int32 lookahead;
+	    CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL );
+	    netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
+#else
+	    celt_int32_t lookahead;
+	    CELTMode *celt_mode = celt_mode_create( netj.sample_rate, 1, netj.period_size, NULL );
+	    netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode ) );
+#endif
+	    celt_mode_info( celt_mode, CELT_GET_LOOKAHEAD, &lookahead );
+	    netj.codec_latency = 2*lookahead;
+#endif
+	    } else {
+#if HAVE_SAMPLERATE
+		netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
+#endif
+	    }
+	}
+	for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) {
+	    snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);
+
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
+                             CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", buf );
+                return -1;
+            }
+            //port = fGraphManager->GetPort ( port_id );
+
+	    netj.capture_ports =
+		jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
+	}
+
+	for (chn = 0; chn < netj.playback_channels_audio; chn++) {
+	    snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);
+
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
+                             PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", buf );
+                return -1;
+            }
+            //port = fGraphManager->GetPort ( port_id );
+
+	    netj.playback_ports =
+		jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
+
+	    if( netj.bitdepth == CELT_MODE ) {
+#if HAVE_CELT
+#if HAVE_CELT_API_0_7
+	    CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL );
+	    netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
+#else
+	    CELTMode *celt_mode = celt_mode_create( netj.sample_rate, 1, netj.period_size, NULL );
+	    netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode ) );
+#endif
+#endif
+	    } else {
+#if HAVE_SAMPLERATE
+		netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
+#endif
+	    }
+	}
+	for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) {
+	    snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);
+
+            if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
+                             PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
+            {
+                jack_error ( "driver: cannot register port for %s", buf );
+                return -1;
+            }
+            //port = fGraphManager->GetPort ( port_id );
+
+	    netj.playback_ports =
+		jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
+	}
+	return 0;
+    }
+
+//init and restart--------------------------------------------------------------------
+    bool JackNetOneDriver::Initialize()
+    {
+        jack_log ( "JackNetOneDriver::Init()" );
+
+	if( global_packcache != NULL ) {
+	    FreePorts();
+	    netjack_release( &netj );
+	}
+
+        //display some additional infos
+        jack_info ( "NetOne driver started" );
+	if( netjack_startup( &netj ) ) {
+	    return false;
+	}
+
+        //register jack ports
+        if ( AllocPorts() != 0 )
+        {
+            jack_error ( "Can't allocate ports." );
+            return false;
+        }
+
+
+        //monitor
+        //driver parametering
+        JackAudioDriver::SetBufferSize ( netj.period_size );
+        JackAudioDriver::SetSampleRate ( netj.sample_rate );
+
+        JackDriver::NotifyBufferSize ( netj.period_size );
+        JackDriver::NotifySampleRate ( netj.sample_rate );
+
+        //transport engine parametering
+        fEngineControl->fTransport.SetNetworkSync ( true );
+        return true;
+    }
+
+
+//jack ports and buffers--------------------------------------------------------------
+
+//driver processes--------------------------------------------------------------------
+    int JackNetOneDriver::Read()
+    {
+	int delay;
+	delay = netjack_wait( &netj );
+	if( delay ) {
+	    NotifyXRun(fBeginDateUst, (float) delay);
+	    jack_error( "netxruns... duration: %dms", delay/1000 );
+	}
+
+	if( (netj.num_lost_packets * netj.period_size / netj.sample_rate) > 2 )
+        JackTools::ThrowJackNetException();
+
+	//netjack_read( &netj, netj.period_size );
+        JackDriver::CycleTakeBeginTime();
+
+	jack_position_t local_trans_pos;
+	jack_transport_state_t local_trans_state;
+
+	unsigned int *packet_buf, *packet_bufX;
+
+	if( ! netj.packet_data_valid ) {
+            jack_log( "data not valid" );
+	    render_payload_to_jack_ports (netj.bitdepth, NULL, netj.net_period_down, netj.capture_ports, netj.capture_srcs, netj.period_size, netj.dont_htonl_floats );
+	    return 0;
+	}
+	packet_buf = netj.rx_buf;
+
+	jacknet_packet_header *pkthdr = (jacknet_packet_header *)packet_buf;
+
+	packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
+
+	netj.reply_port = pkthdr->reply_port;
+	netj.latency = pkthdr->latency;
+
+	// Special handling for latency=0
+	if( netj.latency == 0 )
+	    netj.resync_threshold = 0;
+	else
+	    netj.resync_threshold = MIN( 15, pkthdr->latency-1 );
+
+	// check whether, we should handle the transport sync stuff, or leave trnasports untouched.
+	if (netj.handle_transport_sync) {
+#if 1
+	    unsigned int compensated_tranport_pos = (pkthdr->transport_frame + (pkthdr->latency * netj.period_size) + netj.codec_latency);
+
+	    // read local transport info....
+	    //local_trans_state = jack_transport_query(netj.client, &local_trans_pos);
+
+            local_trans_state = fEngineControl->fTransport.Query ( &local_trans_pos );
+
+	    // Now check if we have to start or stop local transport to sync to remote...
+	    switch (pkthdr->transport_state) {
+		case JackTransportStarting:
+		    // the master transport is starting... so we set our reply to the sync_callback;
+		    if (local_trans_state == JackTransportStopped) {
+			fEngineControl->fTransport.SetCommand ( TransportCommandStart );
+			//jack_transport_start(netj.client);
+			//last_transport_state = JackTransportStopped;
+			netj.sync_state = 0;
+			jack_info("locally stopped... starting...");
+		    }
+
+		    if (local_trans_pos.frame != compensated_tranport_pos)
+		    {
+			jack_position_t new_pos = local_trans_pos;
+			new_pos.frame = compensated_tranport_pos + 2*netj.period_size;
+			new_pos.valid = (jack_position_bits_t) 0;
+
+
+			fEngineControl->fTransport.RequestNewPos ( &new_pos );
+			//jack_transport_locate(netj.client, compensated_tranport_pos);
+			//last_transport_state = JackTransportRolling;
+			netj.sync_state = 0;
+			jack_info("starting locate to %d", compensated_tranport_pos );
+		    }
+		    break;
+		case JackTransportStopped:
+		    netj.sync_state = 1;
+		    if (local_trans_pos.frame != (pkthdr->transport_frame)) {
+			jack_position_t new_pos = local_trans_pos;
+			new_pos.frame = pkthdr->transport_frame;
+			new_pos.valid = (jack_position_bits_t)0;
+			fEngineControl->fTransport.RequestNewPos ( &new_pos );
+			//jack_transport_locate(netj.client, (pkthdr->transport_frame));
+			jack_info("transport is stopped locate to %d", pkthdr->transport_frame);
+		    }
+		    if (local_trans_state != JackTransportStopped)
+			//jack_transport_stop(netj.client);
+			fEngineControl->fTransport.SetCommand ( TransportCommandStop );
+		    break;
+		case JackTransportRolling:
+		    netj.sync_state = 1;
+//		    if(local_trans_pos.frame != (pkthdr->transport_frame + (pkthdr->latency) * netj.period_size)) {
+//		        jack_transport_locate(netj.client, (pkthdr->transport_frame + (pkthdr->latency + 2) * netj.period_size));
+//			jack_info("running locate to %d", pkthdr->transport_frame + (pkthdr->latency)*netj.period_size);
+//		    		}
+		    if (local_trans_state != JackTransportRolling)
+			fEngineControl->fTransport.SetState ( JackTransportRolling );
+
+		    break;
+
+		case JackTransportLooping:
+		    break;
+	    }
+#endif
+	}
+
+	render_payload_to_jack_ports (netj.bitdepth, packet_bufX, netj.net_period_down, netj.capture_ports, netj.capture_srcs, netj.period_size, netj.dont_htonl_floats );
+	packet_cache_release_packet(global_packcache, netj.expected_framecnt );
+	return 0;
+    }
+
+    int JackNetOneDriver::Write()
+    {
+	int syncstate = netj.sync_state | ((fEngineControl->fTransport.GetState() == JackTransportNetStarting) ? 1 : 0 );
+	uint32_t *packet_buf, *packet_bufX;
+
+	int packet_size = get_sample_size(netj.bitdepth) * netj.playback_channels * netj.net_period_up + sizeof(jacknet_packet_header);
+	jacknet_packet_header *pkthdr;
+
+	packet_buf = (uint32_t *) alloca(packet_size);
+	pkthdr = (jacknet_packet_header *)packet_buf;
+
+	if( netj.running_free ) {
+	    return 0;
+	}
+
+	// offset packet_bufX by the packetheader.
+	packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
+
+	pkthdr->sync_state = syncstate;;
+	pkthdr->latency = netj.time_to_deadline;
+	//printf( "time to deadline = %d  goodness=%d\n", (int)netj.time_to_deadline, netj.deadline_goodness );
+	pkthdr->framecnt = netj.expected_framecnt;
+
+
+	render_jack_ports_to_payload(netj.bitdepth, netj.playback_ports, netj.playback_srcs, netj.period_size, packet_bufX, netj.net_period_up, netj.dont_htonl_floats );
+
+	packet_header_hton(pkthdr);
+	if (netj.srcaddress_valid)
+	{
+	    unsigned int r;
+
+#ifdef __APPLE__
+	    static const int flag = 0;
+#else
+	    static const int flag = 0;
+#endif
+
+	    if (netj.reply_port)
+		netj.syncsource_address.sin_port = htons(netj.reply_port);
+
+	    for( r=0; r<netj.redundancy; r++ )
+		netjack_sendto(netj.sockfd, (char *)packet_buf, packet_size,
+			flag, (struct sockaddr*)&(netj.syncsource_address), sizeof(struct sockaddr_in), netj.mtu);
+	}
+	return 0;
+    }
+
+void
+JackNetOneDriver::FreePorts ()
+{
+    JSList *node = netj.capture_ports;
+
+    while( node != NULL ) {
+	JSList *this_node = node;
+	jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
+	node = jack_slist_remove_link( node, this_node );
+	jack_slist_free_1( this_node );
+	fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
+    }
+    netj.capture_ports = NULL;
+
+    node = netj.playback_ports;
+    while( node != NULL ) {
+	JSList *this_node = node;
+	jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
+	node = jack_slist_remove_link( node, this_node );
+	jack_slist_free_1( this_node );
+	fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
+    }
+    netj.playback_ports = NULL;
+
+    if( netj.bitdepth == CELT_MODE ) {
+#if HAVE_CELT
+	node = netj.playback_srcs;
+	while( node != NULL ) {
+	    JSList *this_node = node;
+	    CELTEncoder *enc = (CELTEncoder *) node->data;
+	    node = jack_slist_remove_link( node, this_node );
+	    jack_slist_free_1( this_node );
+	    celt_encoder_destroy( enc );
+	}
+	netj.playback_srcs = NULL;
+
+	node = netj.capture_srcs;
+	while( node != NULL ) {
+	    JSList *this_node = node;
+	    CELTDecoder *dec = (CELTDecoder *) node->data;
+	    node = jack_slist_remove_link( node, this_node );
+	    jack_slist_free_1( this_node );
+	    celt_decoder_destroy( dec );
+	}
+	netj.capture_srcs = NULL;
+#endif
+    } else {
+#if HAVE_SAMPLERATE
+	node = netj.playback_srcs;
+	while( node != NULL ) {
+	    JSList *this_node = node;
+	    SRC_STATE *state = (SRC_STATE *) node->data;
+	    node = jack_slist_remove_link( node, this_node );
+	    jack_slist_free_1( this_node );
+	    src_delete( state );
+	}
+	netj.playback_srcs = NULL;
+
+	node = netj.capture_srcs;
+	while( node != NULL ) {
+	    JSList *this_node = node;
+	    SRC_STATE *state = (SRC_STATE *) node->data;
+	    node = jack_slist_remove_link( node, this_node );
+	    jack_slist_free_1( this_node );
+	    src_delete( state );
+	}
+	netj.capture_srcs = NULL;
+#endif
+    }
+}
+//Render functions--------------------------------------------------------------------
+
+// render functions for float
+void
+JackNetOneDriver::render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
+{
+    uint32_t chn = 0;
+    JSList *node = capture_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = capture_srcs;
+#endif
+
+    uint32_t *packet_bufX = (uint32_t *)packet_payload;
+
+    if( !packet_payload )
+	return;
+
+    while (node != NULL)
+    {
+        unsigned int i;
+        int_float_t val;
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+
+	jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
+	JackPort *port = fGraphManager->GetPort( port_id );
+
+        jack_default_audio_sample_t* buf =
+            (jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
+
+        const char *porttype = port->GetType();
+
+        if (strncmp (porttype, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0)
+        {
+#if HAVE_SAMPLERATE
+            // audio port, resample if necessary
+            if (net_period_down != nframes)
+            {
+                SRC_STATE *src_state = (SRC_STATE *)src_node->data;
+                for (i = 0; i < net_period_down; i++)
+                {
+                    packet_bufX[i] = ntohl (packet_bufX[i]);
+                }
+
+                src.data_in = (float *) packet_bufX;
+                src.input_frames = net_period_down;
+
+                src.data_out = buf;
+                src.output_frames = nframes;
+
+                src.src_ratio = (float) nframes / (float) net_period_down;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+            {
+		if( dont_htonl_floats )
+		{
+		    memcpy( buf, packet_bufX, net_period_down*sizeof(jack_default_audio_sample_t));
+		}
+		else
+		{
+		    for (i = 0; i < net_period_down; i++)
+		    {
+			val.i = packet_bufX[i];
+			val.i = ntohl (val.i);
+			buf[i] = val.f;
+		    }
+		}
+            }
+        }
+        else if (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
+        {
+            // midi port, decode midi events
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_down;
+            uint32_t * buffer_uint32 = (uint32_t*)packet_bufX;
+            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_down);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+void
+JackNetOneDriver::render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats )
+{
+    uint32_t chn = 0;
+    JSList *node = playback_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = playback_srcs;
+#endif
+
+    uint32_t *packet_bufX = (uint32_t *) packet_payload;
+
+    while (node != NULL)
+    {
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+        unsigned int i;
+        int_float_t val;
+	jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
+	JackPort *port = fGraphManager->GetPort( port_id );
+
+        jack_default_audio_sample_t* buf =
+            (jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
+
+        const char *porttype = port->GetType();
+
+        if (strncmp (porttype, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0)
+        {
+            // audio port, resample if necessary
+
+#if HAVE_SAMPLERATE
+            if (net_period_up != nframes) {
+                SRC_STATE *src_state = (SRC_STATE *) src_node->data;
+                src.data_in = buf;
+                src.input_frames = nframes;
+
+                src.data_out = (float *) packet_bufX;
+                src.output_frames = net_period_up;
+
+                src.src_ratio = (float) net_period_up / (float) nframes;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+
+                for (i = 0; i < net_period_up; i++)
+                {
+                    packet_bufX[i] = htonl (packet_bufX[i]);
+                }
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+            {
+		if( dont_htonl_floats )
+		{
+		    memcpy( packet_bufX, buf, net_period_up*sizeof(jack_default_audio_sample_t) );
+		}
+		else
+		{
+		    for (i = 0; i < net_period_up; i++)
+		    {
+			val.f = buf[i];
+			val.i = htonl (val.i);
+			packet_bufX[i] = val.i;
+		    }
+		}
+            }
+        }
+        else if (strncmp(porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
+        {
+            // encode midi events from port to packet
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_up;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_up);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+#if HAVE_CELT
+// render functions for celt.
+void
+JackNetOneDriver::render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
+{
+    uint32_t chn = 0;
+    JSList *node = capture_ports;
+    JSList *src_node = capture_srcs;
+
+    unsigned char *packet_bufX = (unsigned char *)packet_payload;
+
+    while (node != NULL)
+    {
+	jack_port_id_t port_id = (jack_port_id_t) (intptr_t)node->data;
+	JackPort *port = fGraphManager->GetPort( port_id );
+
+        jack_default_audio_sample_t* buf =
+            (jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
+
+        const char *portname = port->GetType();
+
+
+        if (strncmp(portname, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0)
+        {
+            // audio port, decode celt data.
+
+	    CELTDecoder *decoder = (CELTDecoder *)src_node->data;
+	    if( !packet_payload )
+		celt_decode_float( decoder, NULL, net_period_down, buf );
+	    else
+		celt_decode_float( decoder, packet_bufX, net_period_down, buf );
+
+	    src_node = jack_slist_next (src_node);
+        }
+        else if (strncmp(portname, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
+        {
+            // midi port, decode midi events
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_down / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+	    if( packet_payload )
+		decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_down);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+void
+JackNetOneDriver::render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
+{
+    uint32_t chn = 0;
+    JSList *node = playback_ports;
+    JSList *src_node = playback_srcs;
+
+    unsigned char *packet_bufX = (unsigned char *)packet_payload;
+
+    while (node != NULL)
+    {
+	jack_port_id_t port_id = (jack_port_id_t) (intptr_t) node->data;
+	JackPort *port = fGraphManager->GetPort( port_id );
+
+        jack_default_audio_sample_t* buf =
+            (jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
+
+        const char *portname = port->GetType();
+
+        if (strncmp (portname, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0)
+        {
+            // audio port, encode celt data.
+
+	    int encoded_bytes;
+	    float *floatbuf = (float *)alloca (sizeof(float) * nframes );
+	    memcpy( floatbuf, buf, nframes*sizeof(float) );
+	    CELTEncoder *encoder = (CELTEncoder *)src_node->data;
+	    encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up );
+	    if( encoded_bytes != (int)net_period_up )
+		jack_error( "something in celt changed. netjack needs to be changed to handle this." );
+	    src_node = jack_slist_next( src_node );
+        }
+        else if (strncmp(portname, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
+        {
+            // encode midi events from port to packet
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_up / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_up);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+#endif
+/* Wrapper functions with bitdepth argument... */
+void
+JackNetOneDriver::render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
+{
+#if HAVE_CELT
+    if (bitdepth == CELT_MODE)
+        render_payload_to_jack_ports_celt (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
+    else
+#endif
+        render_payload_to_jack_ports_float (packet_payload, net_period_down, capture_ports, capture_srcs, nframes, dont_htonl_floats);
+}
+
+void
+JackNetOneDriver::render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats)
+{
+#if HAVE_CELT
+    if (bitdepth == CELT_MODE)
+        render_jack_ports_to_payload_celt (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
+    else
+#endif
+        render_jack_ports_to_payload_float (playback_ports, playback_srcs, nframes, packet_payload, net_period_up, dont_htonl_floats);
+}
+
+
+
+//driver loader-----------------------------------------------------------------------
+
+#ifdef __cplusplus
+    extern "C"
+    {
+#endif
+        SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor ()
+	{
+	    jack_driver_desc_t* desc = ( jack_driver_desc_t* ) calloc ( 1, sizeof ( jack_driver_desc_t ) );
+	    jack_driver_param_desc_t * params;
+
+	    strcpy ( desc->name, "netone" );                             // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+	    strcpy ( desc->desc, "netjack one slave backend component" ); // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+	    desc->nparams = 18;
+	    params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) );
+
+	    int i = 0;
+	    strcpy (params[i].name, "audio-ins");
+	    params[i].character  = 'i';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 2U;
+	    strcpy (params[i].short_desc, "Number of capture channels (defaults to 2)");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "audio-outs");
+	    params[i].character  = 'o';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 2U;
+	    strcpy (params[i].short_desc, "Number of playback channels (defaults to 2)");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "midi-ins");
+	    params[i].character  = 'I';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 1U;
+	    strcpy (params[i].short_desc, "Number of midi capture channels (defaults to 1)");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "midi-outs");
+	    params[i].character  = 'O';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 1U;
+	    strcpy (params[i].short_desc, "Number of midi playback channels (defaults to 1)");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "rate");
+	    params[i].character  = 'r';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 48000U;
+	    strcpy (params[i].short_desc, "Sample rate");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "period");
+	    params[i].character  = 'p';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 1024U;
+	    strcpy (params[i].short_desc, "Frames per period");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "num-periods");
+	    params[i].character  = 'n';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 5U;
+	    strcpy (params[i].short_desc,
+		    "Network latency setting in no. of periods");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "listen-port");
+	    params[i].character  = 'l';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 3000U;
+	    strcpy (params[i].short_desc,
+		    "The socket port we are listening on for sync packets");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "factor");
+	    params[i].character  = 'f';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 1U;
+	    strcpy (params[i].short_desc,
+		    "Factor for sample rate reduction");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "upstream-factor");
+	    params[i].character  = 'u';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 0U;
+	    strcpy (params[i].short_desc,
+		    "Factor for sample rate reduction on the upstream");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "celt");
+	    params[i].character  = 'c';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 0U;
+	    strcpy (params[i].short_desc,
+		    "sets celt encoding and number of kbits per channel");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "bit-depth");
+	    params[i].character  = 'b';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 0U;
+	    strcpy (params[i].short_desc,
+		    "Sample bit-depth (0 for float, 8 for 8bit and 16 for 16bit)");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "transport-sync");
+	    params[i].character  = 't';
+	    params[i].type       = JackDriverParamBool;
+	    params[i].value.ui   = 1U;
+	    strcpy (params[i].short_desc,
+		    "Whether to slave the transport to the master transport");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "autoconf");
+	    params[i].character  = 'a';
+	    params[i].type       = JackDriverParamBool;
+	    params[i].value.ui   = 1U;
+	    strcpy (params[i].short_desc,
+		    "Whether to use Autoconfig, or just start.");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "redundancy");
+	    params[i].character  = 'R';
+	    params[i].type       = JackDriverParamUInt;
+	    params[i].value.ui   = 1U;
+	    strcpy (params[i].short_desc,
+		    "Send packets N times");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "native-endian");
+	    params[i].character  = 'e';
+	    params[i].type       = JackDriverParamBool;
+	    params[i].value.ui   = 0U;
+	    strcpy (params[i].short_desc,
+		    "Dont convert samples to network byte order.");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "jitterval");
+	    params[i].character  = 'J';
+	    params[i].type       = JackDriverParamInt;
+	    params[i].value.i   = 0;
+	    strcpy (params[i].short_desc,
+		    "attempted jitterbuffer microseconds on master");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    i++;
+	    strcpy (params[i].name, "always-deadline");
+	    params[i].character  = 'D';
+	    params[i].type       = JackDriverParamBool;
+	    params[i].value.ui   = 0U;
+	    strcpy (params[i].short_desc,
+		    "always use deadline");
+	    strcpy (params[i].long_desc, params[i].short_desc);
+
+	    desc->params = params;
+
+	    return desc;
+	}
+
+        SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize ( Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params )
+        {
+    jack_nframes_t sample_rate = 48000;
+    jack_nframes_t resample_factor = 1;
+    jack_nframes_t period_size = 1024;
+    unsigned int capture_ports = 2;
+    unsigned int playback_ports = 2;
+    unsigned int capture_ports_midi = 1;
+    unsigned int playback_ports_midi = 1;
+    unsigned int listen_port = 3000;
+    unsigned int resample_factor_up = 0;
+    unsigned int bitdepth = 0;
+    unsigned int handle_transport_sync = 1;
+    unsigned int use_autoconfig = 1;
+    unsigned int latency = 5;
+    unsigned int redundancy = 1;
+    unsigned int mtu = 1400;
+    int dont_htonl_floats = 0;
+    int always_deadline = 0;
+    int jitter_val = 0;
+    const JSList * node;
+    const jack_driver_param_t * param;
+
+
+
+            for ( node = params; node; node = jack_slist_next ( node ) )
+            {
+                param = ( const jack_driver_param_t* ) node->data;
+                switch ( param->character )
+                {
+            case 'i':
+                capture_ports = param->value.ui;
+                break;
+
+            case 'o':
+                playback_ports = param->value.ui;
+                break;
+
+            case 'I':
+                capture_ports_midi = param->value.ui;
+                break;
+
+            case 'O':
+                playback_ports_midi = param->value.ui;
+                break;
+
+            case 'r':
+                sample_rate = param->value.ui;
+                break;
+
+            case 'p':
+                period_size = param->value.ui;
+                break;
+
+            case 'l':
+                listen_port = param->value.ui;
+                break;
+
+            case 'f':
+        #if HAVE_SAMPLERATE
+                resample_factor = param->value.ui;
+        #else
+                jack_error( "not built with libsamplerate support" );
+                return NULL;
+        #endif
+                break;
+
+            case 'u':
+        #if HAVE_SAMPLERATE
+                resample_factor_up = param->value.ui;
+        #else
+                jack_error( "not built with libsamplerate support" );
+                return NULL;
+        #endif
+                break;
+
+            case 'b':
+                bitdepth = param->value.ui;
+                break;
+
+            case 'c':
+        #if HAVE_CELT
+                bitdepth = CELT_MODE;
+                resample_factor = param->value.ui;
+        #else
+                jack_error( "not built with celt support" );
+                return NULL;
+        #endif
+                break;
+
+            case 't':
+                handle_transport_sync = param->value.ui;
+                break;
+
+            case 'a':
+                use_autoconfig = param->value.ui;
+                break;
+
+            case 'n':
+                latency = param->value.ui;
+                break;
+
+            case 'R':
+                redundancy = param->value.ui;
+                break;
+
+            case 'H':
+                dont_htonl_floats = param->value.ui;
+                break;
+
+            case 'J':
+                jitter_val = param->value.i;
+                break;
+
+            case 'D':
+                always_deadline = param->value.ui;
+                break;
+                }
+            }
+
+            try
+            {
+
+                Jack::JackDriverClientInterface* driver =
+                    new Jack::JackWaitThreadedDriver (
+                    new Jack::JackNetOneDriver ( "system", "net_pcm", engine, table, listen_port, mtu,
+                                              capture_ports_midi, playback_ports_midi, capture_ports, playback_ports,
+					      sample_rate, period_size, resample_factor,
+					      "net_pcm", handle_transport_sync, bitdepth, use_autoconfig, latency, redundancy, 
+					      dont_htonl_floats, always_deadline, jitter_val ) );
+
+                if ( driver->Open ( period_size, sample_rate, 1, 1, capture_ports, playback_ports,
+                                    0, "from_master_", "to_master_", 0, 0 ) == 0 )
+                {
+                    return driver;
+                }
+                else
+                {
+                    delete driver;
+                    return NULL;
+                }
+
+            }
+            catch ( ... )
+            {
+                return NULL;
+            }
+        }
+
+#ifdef __cplusplus
+    }
+#endif
+}
diff --git a/common/JackNetOneDriver.h b/common/JackNetOneDriver.h
new file mode 100644
index 0000000..b288c91
--- /dev/null
+++ b/common/JackNetOneDriver.h
@@ -0,0 +1,96 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetDriver__
+#define __JackNetDriver__
+
+#include "JackAudioDriver.h"
+#include "netjack.h"
+#include "netjack_packet.h"
+
+namespace Jack
+{
+    /**
+    \Brief This class describes the Net Backend
+    */
+
+    class JackNetOneDriver : public JackAudioDriver
+    {
+        private:
+	    netjack_driver_state_t netj;
+
+void
+render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats);
+void
+render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats );
+#ifdef HAVE_CELT
+void
+render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes);
+void
+render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up);
+#endif
+void
+render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats);
+void
+render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats);
+
+        public:
+	    JackNetOneDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
+			int port, int mtu, int capture_ports, int playback_ports, int midi_input_ports, int midi_output_ports,
+			int sample_rate, int period_size, int resample_factor,
+			const char* net_name, uint transport_sync, int bitdepth, int use_autoconfig,
+			int latency, int redundancy, int dont_htonl_floats, int always_deadline, int jitter_val );
+            ~JackNetOneDriver();
+
+            int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
+                       int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
+                       const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency );
+
+	    int Close();
+            int Attach();
+            int Detach();
+
+            int Read();
+            int Write();
+
+	    bool Initialize();
+	    int AllocPorts();
+	    void FreePorts();
+
+            // BufferSize can't be changed
+            bool IsFixedBufferSize()
+            {
+                return true;
+            }
+
+            int SetBufferSize ( jack_nframes_t buffer_size )
+            {
+                return -1;
+            }
+
+            int SetSampleRate ( jack_nframes_t sample_rate )
+            {
+                return -1;
+            }
+
+    };
+}
+
+#endif
diff --git a/common/JackNetSocket.h b/common/JackNetSocket.h
new file mode 100644
index 0000000..7f95080
--- /dev/null
+++ b/common/JackNetSocket.h
@@ -0,0 +1,48 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetSocket__
+#define __JackNetSocket__
+
+#include "JackCompilerDeps.h"
+#include "JackError.h"
+#include <cstdlib>
+#include <cstdio>
+#include <iostream>
+#include <errno.h>
+
+namespace Jack
+{
+    //get host name*********************************
+    SERVER_EXPORT int GetHostName ( char * name, int size );
+
+    //net errors ***********************************
+    enum _net_error
+    {
+        NET_CONN_ERROR = 10000,
+        NET_OP_ERROR,
+        NET_NO_DATA,
+        NET_NO_NETWORK,
+        NET_NO_ERROR
+    };
+
+    typedef enum _net_error net_error_t;
+}
+
+#endif
diff --git a/common/JackNetTool.cpp b/common/JackNetTool.cpp
new file mode 100644
index 0000000..81e2404
--- /dev/null
+++ b/common/JackNetTool.cpp
@@ -0,0 +1,510 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackNetTool.h"
+
+using namespace std;
+
+namespace Jack
+{
+// NetMidiBuffer**********************************************************************************
+
+    NetMidiBuffer::NetMidiBuffer ( session_params_t* params, uint32_t nports, char* net_buffer )
+    {
+        fNPorts = nports;
+        fMaxBufsize = fNPorts * sizeof ( sample_t ) * params->fPeriodSize ;
+        fMaxPcktSize = params->fMtu - sizeof ( packet_header_t );
+        fBuffer = new char[fMaxBufsize];
+        fPortBuffer = new JackMidiBuffer* [fNPorts];
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+            fPortBuffer[port_index] = NULL;
+        fNetBuffer = net_buffer;
+    }
+
+    NetMidiBuffer::~NetMidiBuffer()
+    {
+        delete[] fBuffer;
+        delete[] fPortBuffer;
+    }
+
+    size_t NetMidiBuffer::GetSize()
+    {
+        return fMaxBufsize;
+    }
+
+    void NetMidiBuffer::SetBuffer ( int index, JackMidiBuffer* buffer )
+    {
+        fPortBuffer[index] = buffer;
+    }
+
+    JackMidiBuffer* NetMidiBuffer::GetBuffer ( int index )
+    {
+        return fPortBuffer[index];
+    }
+
+    void NetMidiBuffer::DisplayEvents()
+    {
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+        {
+            for ( uint event = 0; event < fPortBuffer[port_index]->event_count; event++ )
+                if ( fPortBuffer[port_index]->IsValid() )
+                    jack_info ( "port %d : midi event %u/%u -> time : %u, size : %u",
+                                port_index + 1, event + 1, fPortBuffer[port_index]->event_count,
+                                fPortBuffer[port_index]->events[event].time, fPortBuffer[port_index]->events[event].size );
+        }
+    }
+
+    int NetMidiBuffer::RenderFromJackPorts()
+    {
+        int pos = 0;
+        size_t copy_size;
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+        {
+            char* write_pos = fBuffer + pos;
+            
+            copy_size = sizeof ( JackMidiBuffer ) + fPortBuffer[port_index]->event_count * sizeof ( JackMidiEvent );
+            memcpy ( fBuffer + pos, fPortBuffer[port_index], copy_size );
+            pos += copy_size;
+            memcpy ( fBuffer + pos, fPortBuffer[port_index] + ( fPortBuffer[port_index]->buffer_size - fPortBuffer[port_index]->write_pos ),
+                     fPortBuffer[port_index]->write_pos );
+            pos += fPortBuffer[port_index]->write_pos;
+            
+            JackMidiBuffer* midi_buffer = reinterpret_cast<JackMidiBuffer*>(write_pos);
+            MidiBufferHToN(midi_buffer, midi_buffer);
+        }
+        return pos;
+    }
+
+    int NetMidiBuffer::RenderToJackPorts()
+    {
+        int pos = 0;
+        int copy_size;
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+        {
+            JackMidiBuffer* midi_buffer = reinterpret_cast<JackMidiBuffer*>(fBuffer + pos);
+            MidiBufferNToH(midi_buffer, midi_buffer);
+            
+            copy_size = sizeof ( JackMidiBuffer ) + reinterpret_cast<JackMidiBuffer*> ( fBuffer + pos )->event_count * sizeof ( JackMidiEvent );
+            memcpy ( fPortBuffer[port_index], fBuffer + pos, copy_size );
+            pos += copy_size;
+            memcpy ( fPortBuffer[port_index] + ( fPortBuffer[port_index]->buffer_size - fPortBuffer[port_index]->write_pos ),
+                     fBuffer + pos, fPortBuffer[port_index]->write_pos );
+            pos += fPortBuffer[port_index]->write_pos;
+        }
+        return pos;
+    }
+    
+    int NetMidiBuffer::RenderFromNetwork ( int subcycle, size_t copy_size )
+    {
+        memcpy ( fBuffer + subcycle * fMaxPcktSize, fNetBuffer, copy_size );
+        return copy_size;
+    }
+
+    int NetMidiBuffer::RenderToNetwork ( int subcycle, size_t total_size )
+    {
+        int size = total_size - subcycle * fMaxPcktSize;
+        int copy_size = ( size <= fMaxPcktSize ) ? size : fMaxPcktSize;
+        memcpy ( fNetBuffer, fBuffer + subcycle * fMaxPcktSize, copy_size );
+        return copy_size;
+    }
+
+
+// net audio buffer *********************************************************************************
+
+    NetAudioBuffer::NetAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer )
+    {
+        fNPorts = nports;
+        fPeriodSize = params->fPeriodSize;
+        fSubPeriodSize = params->fFramesPerPacket;
+        fSubPeriodBytesSize = fSubPeriodSize * sizeof ( sample_t );
+        fPortBuffer = new sample_t* [fNPorts];
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+            fPortBuffer[port_index] = NULL;
+        fNetBuffer = net_buffer;
+    }
+
+    NetAudioBuffer::~NetAudioBuffer()
+    {
+        delete[] fPortBuffer;
+    }
+
+    size_t NetAudioBuffer::GetSize()
+    {
+        return fNPorts * fSubPeriodBytesSize;
+    }
+
+    void NetAudioBuffer::SetBuffer ( int index, sample_t* buffer )
+    {
+        fPortBuffer[index] = buffer;
+    }
+
+    sample_t* NetAudioBuffer::GetBuffer ( int index )
+    {
+        return fPortBuffer[index];
+    }
+
+#ifdef __BIG_ENDIAN__
+
+    static inline float SwapFloat(float f)
+    {
+          union
+          {
+            float f;
+            unsigned char b[4];
+          } dat1, dat2;
+
+          dat1.f = f;
+          dat2.b[0] = dat1.b[3];
+          dat2.b[1] = dat1.b[2];
+          dat2.b[2] = dat1.b[1];
+          dat2.b[3] = dat1.b[0];
+          return dat2.f;
+    }
+
+    void NetAudioBuffer::RenderFromJackPorts ( int subcycle )
+    {
+        for ( int port_index = 0; port_index < fNPorts; port_index++ ) {
+            float* src = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize);
+            float* dst = (float*)(fNetBuffer + port_index * fSubPeriodBytesSize);
+            for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) {
+                dst[sample] = SwapFloat(src[sample]);
+            }
+        }
+    }
+
+    void NetAudioBuffer::RenderToJackPorts ( int subcycle )
+    {
+        for ( int port_index = 0; port_index < fNPorts; port_index++ ) {
+            float* src = (float*)(fNetBuffer + port_index * fSubPeriodBytesSize);
+            float* dst = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize);
+            for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) {
+                dst[sample] = SwapFloat(src[sample]);
+            }
+        }    
+    }
+    
+#else
+
+    void NetAudioBuffer::RenderFromJackPorts ( int subcycle )
+    {
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+            memcpy ( fNetBuffer + port_index * fSubPeriodBytesSize, fPortBuffer[port_index] + subcycle * fSubPeriodSize, fSubPeriodBytesSize );
+    }
+
+    void NetAudioBuffer::RenderToJackPorts ( int subcycle )
+    {
+        for ( int port_index = 0; port_index < fNPorts; port_index++ )
+            memcpy ( fPortBuffer[port_index] + subcycle * fSubPeriodSize, fNetBuffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize );
+    }
+
+#endif
+
+// SessionParams ************************************************************************************
+
+    SERVER_EXPORT void SessionParamsHToN ( session_params_t* src_params, session_params_t* dst_params )
+    {
+        memcpy(dst_params, src_params, sizeof(session_params_t));
+        dst_params->fPacketID = htonl ( src_params->fPacketID );
+        dst_params->fMtu = htonl ( src_params->fMtu );
+        dst_params->fID = htonl ( src_params->fID );
+        dst_params->fTransportSync = htonl ( src_params->fTransportSync );
+        dst_params->fSendAudioChannels = htonl ( src_params->fSendAudioChannels );
+        dst_params->fReturnAudioChannels = htonl ( src_params->fReturnAudioChannels );
+        dst_params->fSendMidiChannels = htonl ( src_params->fSendMidiChannels );
+        dst_params->fReturnMidiChannels = htonl ( src_params->fReturnMidiChannels );
+        dst_params->fSampleRate = htonl ( src_params->fSampleRate );
+        dst_params->fPeriodSize = htonl ( src_params->fPeriodSize );
+        dst_params->fFramesPerPacket = htonl ( src_params->fFramesPerPacket );
+        dst_params->fBitdepth = htonl ( src_params->fBitdepth );
+        dst_params->fSlaveSyncMode = htonl ( src_params->fSlaveSyncMode );
+    }
+
+    SERVER_EXPORT void SessionParamsNToH (  session_params_t* src_params, session_params_t* dst_params )
+    {
+        memcpy(dst_params, src_params, sizeof(session_params_t));
+        dst_params->fPacketID = ntohl ( src_params->fPacketID );
+        dst_params->fMtu = ntohl ( src_params->fMtu );
+        dst_params->fID = ntohl ( src_params->fID );
+        dst_params->fTransportSync = ntohl ( src_params->fTransportSync );
+        dst_params->fSendAudioChannels = ntohl ( src_params->fSendAudioChannels );
+        dst_params->fReturnAudioChannels = ntohl ( src_params->fReturnAudioChannels );
+        dst_params->fSendMidiChannels = ntohl ( src_params->fSendMidiChannels );
+        dst_params->fReturnMidiChannels = ntohl ( src_params->fReturnMidiChannels );
+        dst_params->fSampleRate = ntohl ( src_params->fSampleRate );
+        dst_params->fPeriodSize = ntohl ( src_params->fPeriodSize );
+        dst_params->fFramesPerPacket = ntohl ( src_params->fFramesPerPacket );
+        dst_params->fBitdepth = ntohl ( src_params->fBitdepth );
+        dst_params->fSlaveSyncMode = ntohl ( src_params->fSlaveSyncMode );
+    }
+
+    SERVER_EXPORT void SessionParamsDisplay ( session_params_t* params )
+    {
+        char bitdepth[16];
+        ( params->fBitdepth ) ? sprintf ( bitdepth, "%u", params->fBitdepth ) : sprintf ( bitdepth, "%s", "float" );
+        char mode[8];
+        switch ( params->fNetworkMode )
+        {
+            case 's' :
+                strcpy ( mode, "slow" );
+                break;
+            case 'n' :
+                strcpy ( mode, "normal" );
+                break;
+            case 'f' :
+                strcpy ( mode, "fast" );
+                break;
+        }
+        jack_info ( "**************** Network parameters ****************" );
+        jack_info ( "Name : %s", params->fName );
+        jack_info ( "Protocol revision : %d", params->fProtocolVersion );
+        jack_info ( "MTU : %u", params->fMtu );
+        jack_info ( "Master name : %s", params->fMasterNetName );
+        jack_info ( "Slave name : %s", params->fSlaveNetName );
+        jack_info ( "ID : %u", params->fID );
+        jack_info ( "Transport Sync : %s", ( params->fTransportSync ) ? "yes" : "no" );
+        jack_info ( "Send channels (audio - midi) : %d - %d", params->fSendAudioChannels, params->fSendMidiChannels );
+        jack_info ( "Return channels (audio - midi) : %d - %d", params->fReturnAudioChannels, params->fReturnMidiChannels );
+        jack_info ( "Sample rate : %u frames per second", params->fSampleRate );
+        jack_info ( "Period size : %u frames per period", params->fPeriodSize );
+        jack_info ( "Frames per packet : %u", params->fFramesPerPacket );
+        jack_info ( "Packet per period : %u", params->fPeriodSize / params->fFramesPerPacket );
+        jack_info ( "Bitdepth : %s", bitdepth );
+        jack_info ( "Slave mode : %s", ( params->fSlaveSyncMode ) ? "sync" : "async" );
+        jack_info ( "Network mode : %s", mode );
+        jack_info ( "****************************************************" );
+    }
+
+    SERVER_EXPORT sync_packet_type_t GetPacketType ( session_params_t* params )
+    {
+        switch ( params->fPacketID )
+        {
+            case 0:
+                return SLAVE_AVAILABLE;
+            case 1:
+                return SLAVE_SETUP;
+            case 2:
+                return START_MASTER;
+            case 3:
+                return START_SLAVE;
+            case 4:
+                return KILL_MASTER;
+        }
+        return INVALID;
+    }
+
+    SERVER_EXPORT int SetPacketType ( session_params_t* params, sync_packet_type_t packet_type )
+    {
+        switch ( packet_type )
+        {
+            case INVALID:
+                return -1;
+            case SLAVE_AVAILABLE:
+                params->fPacketID = 0;
+                break;
+            case SLAVE_SETUP:
+                params->fPacketID = 1;
+                break;
+            case START_MASTER:
+                params->fPacketID = 2;
+                break;
+            case START_SLAVE:
+                params->fPacketID = 3;
+                break;
+            case KILL_MASTER:
+                params->fPacketID = 4;
+        }
+        return 0;
+    }
+
+// Packet header **********************************************************************************
+
+    SERVER_EXPORT void PacketHeaderHToN ( packet_header_t* src_header, packet_header_t* dst_header )
+    {
+        memcpy(dst_header, src_header, sizeof(packet_header_t));
+        dst_header->fID = htonl ( src_header->fID );
+        dst_header->fMidiDataSize = htonl ( src_header->fMidiDataSize );
+        dst_header->fBitdepth = htonl ( src_header->fBitdepth );
+        dst_header->fNMidiPckt = htonl ( src_header->fNMidiPckt );
+        dst_header->fPacketSize = htonl ( src_header->fPacketSize );
+        dst_header->fCycle = htonl ( src_header->fCycle );
+        dst_header->fSubCycle = htonl ( src_header->fSubCycle );
+        dst_header->fIsLastPckt = htonl ( src_header->fIsLastPckt );
+    }
+
+    SERVER_EXPORT void PacketHeaderNToH ( packet_header_t* src_header, packet_header_t* dst_header )
+    {
+        memcpy(dst_header, src_header, sizeof(packet_header_t));
+        dst_header->fID = ntohl ( src_header->fID );
+        dst_header->fMidiDataSize = ntohl ( src_header->fMidiDataSize );
+        dst_header->fBitdepth = ntohl ( src_header->fBitdepth );
+        dst_header->fNMidiPckt = ntohl ( src_header->fNMidiPckt );
+        dst_header->fPacketSize = ntohl ( src_header->fPacketSize );
+        dst_header->fCycle = ntohl ( src_header->fCycle );
+        dst_header->fSubCycle = ntohl ( src_header->fSubCycle );
+        dst_header->fIsLastPckt = ntohl ( src_header->fIsLastPckt );
+    }
+
+    SERVER_EXPORT void PacketHeaderDisplay ( packet_header_t* header )
+    {
+        char bitdepth[16];
+        ( header->fBitdepth ) ? sprintf ( bitdepth, "%u", header->fBitdepth ) : sprintf ( bitdepth, "%s", "float" );
+        jack_info ( "********************Header********************" );
+        jack_info ( "Data type : %c", header->fDataType );
+        jack_info ( "Data stream : %c", header->fDataStream );
+        jack_info ( "ID : %u", header->fID );
+        jack_info ( "Cycle : %u", header->fCycle );
+        jack_info ( "SubCycle : %u", header->fSubCycle );
+        jack_info ( "Midi packets : %u", header->fNMidiPckt );
+        jack_info ( "Midi data size : %u", header->fMidiDataSize );
+        jack_info ( "Last packet : '%s'", ( header->fIsLastPckt ) ? "yes" : "no" );
+        jack_info ( "Bitdepth : %s", bitdepth );
+        jack_info ( "**********************************************" );
+    }
+    
+    SERVER_EXPORT void NetTransportDataDisplay ( net_transport_data_t* data )
+    {
+        jack_info ( "********************Network Transport********************" );
+        jack_info ( "Transport new state : %u", data->fNewState );
+        jack_info ( "Transport timebase master : %u", data->fTimebaseMaster );
+        jack_info ( "Transport cycle state : %u", data->fState );
+        jack_info ( "**********************************************" );
+    }
+   
+    SERVER_EXPORT void MidiBufferHToN ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer )
+    {
+        dst_buffer->magic = htonl(src_buffer->magic);
+        dst_buffer->buffer_size = htonl(src_buffer->buffer_size);
+        dst_buffer->nframes = htonl(src_buffer->nframes);
+        dst_buffer->write_pos = htonl(src_buffer->write_pos);
+        dst_buffer->event_count = htonl(src_buffer->event_count);
+        dst_buffer->lost_events = htonl(src_buffer->lost_events);
+        dst_buffer->mix_index = htonl(src_buffer->mix_index);
+    }
+    
+    SERVER_EXPORT void MidiBufferNToH ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer )
+    {
+        dst_buffer->magic = ntohl(src_buffer->magic);
+        dst_buffer->buffer_size = ntohl(src_buffer->buffer_size);
+        dst_buffer->nframes = ntohl(src_buffer->nframes);
+        dst_buffer->write_pos = ntohl(src_buffer->write_pos);
+        dst_buffer->event_count = ntohl(src_buffer->event_count);
+        dst_buffer->lost_events = ntohl(src_buffer->lost_events);
+        dst_buffer->mix_index = ntohl(src_buffer->mix_index);
+    }
+    
+    SERVER_EXPORT void TransportDataHToN ( net_transport_data_t* src_params, net_transport_data_t* dst_params )
+    {
+        dst_params->fNewState = htonl(src_params->fNewState);
+        dst_params->fTimebaseMaster = htonl(src_params->fTimebaseMaster);
+        dst_params->fState = htonl(src_params->fState);
+        dst_params->fPosition.unique_1 = htonll(src_params->fPosition.unique_1);
+        dst_params->fPosition.usecs = htonl(src_params->fPosition.usecs);
+        dst_params->fPosition.frame_rate = htonl(src_params->fPosition.frame_rate);
+        dst_params->fPosition.frame = htonl(src_params->fPosition.frame);
+        dst_params->fPosition.valid = (jack_position_bits_t)htonl((uint32_t)src_params->fPosition.valid);
+        dst_params->fPosition.bar = htonl(src_params->fPosition.bar);
+        dst_params->fPosition.beat = htonl(src_params->fPosition.beat);
+        dst_params->fPosition.tick = htonl(src_params->fPosition.tick);
+        dst_params->fPosition.bar_start_tick = htonll((uint64_t)src_params->fPosition.bar_start_tick);
+        dst_params->fPosition.beats_per_bar = htonl((uint32_t)src_params->fPosition.beats_per_bar);
+        dst_params->fPosition.beat_type = htonl((uint32_t)src_params->fPosition.beat_type);
+        dst_params->fPosition.ticks_per_beat = htonll((uint64_t)src_params->fPosition.ticks_per_beat);
+        dst_params->fPosition.beats_per_minute = htonll((uint64_t)src_params->fPosition.beats_per_minute);
+        dst_params->fPosition.frame_time = htonll((uint64_t)src_params->fPosition.frame_time);
+        dst_params->fPosition.next_time = htonll((uint64_t)src_params->fPosition.next_time);
+        dst_params->fPosition.bbt_offset = htonl(src_params->fPosition.bbt_offset);
+        dst_params->fPosition.audio_frames_per_video_frame = htonl((uint32_t)src_params->fPosition.audio_frames_per_video_frame);
+        dst_params->fPosition.video_offset = htonl(src_params->fPosition.video_offset);
+        dst_params->fPosition.unique_2 = htonll(src_params->fPosition.unique_2);
+    }
+    
+    SERVER_EXPORT void TransportDataNToH ( net_transport_data_t* src_params, net_transport_data_t* dst_params )
+    {
+        dst_params->fNewState = ntohl(src_params->fNewState);
+        dst_params->fTimebaseMaster =  ntohl(src_params->fTimebaseMaster);
+        dst_params->fState = ntohl(src_params->fState);
+        dst_params->fPosition.unique_1 = ntohll(src_params->fPosition.unique_1);
+        dst_params->fPosition.usecs = ntohl(src_params->fPosition.usecs);
+        dst_params->fPosition.frame_rate = ntohl(src_params->fPosition.frame_rate);
+        dst_params->fPosition.frame = ntohl(src_params->fPosition.frame);
+        dst_params->fPosition.valid = (jack_position_bits_t)ntohl((uint32_t)src_params->fPosition.valid);
+        dst_params->fPosition.bar = ntohl(src_params->fPosition.bar);
+        dst_params->fPosition.beat = ntohl(src_params->fPosition.beat);
+        dst_params->fPosition.tick = ntohl(src_params->fPosition.tick);
+        dst_params->fPosition.bar_start_tick = ntohll((uint64_t)src_params->fPosition.bar_start_tick);
+        dst_params->fPosition.beats_per_bar = ntohl((uint32_t)src_params->fPosition.beats_per_bar);
+        dst_params->fPosition.beat_type = ntohl((uint32_t)src_params->fPosition.beat_type);
+        dst_params->fPosition.ticks_per_beat = ntohll((uint64_t)src_params->fPosition.ticks_per_beat);
+        dst_params->fPosition.beats_per_minute = ntohll((uint64_t)src_params->fPosition.beats_per_minute);
+        dst_params->fPosition.frame_time = ntohll((uint64_t)src_params->fPosition.frame_time);
+        dst_params->fPosition.next_time = ntohll((uint64_t)src_params->fPosition.next_time);
+        dst_params->fPosition.bbt_offset = ntohl(src_params->fPosition.bbt_offset);
+        dst_params->fPosition.audio_frames_per_video_frame = ntohl((uint32_t)src_params->fPosition.audio_frames_per_video_frame);
+        dst_params->fPosition.video_offset = ntohl(src_params->fPosition.video_offset);
+        dst_params->fPosition.unique_2 = ntohll(src_params->fPosition.unique_2);
+    }
+
+// Utility *******************************************************************************************************
+
+    SERVER_EXPORT int SocketAPIInit()
+    {
+#ifdef WIN32
+        WORD wVersionRequested = MAKEWORD ( 2, 2 );
+        WSADATA wsaData;
+
+        if ( WSAStartup ( wVersionRequested, &wsaData ) != 0 )
+        {
+            jack_error ( "WSAStartup error : %s", strerror ( NET_ERROR_CODE ) );
+            return -1;
+        }
+
+        if ( LOBYTE ( wsaData.wVersion ) != 2 || HIBYTE ( wsaData.wVersion ) != 2 )
+        {
+            jack_error ( "Could not find a useable version of Winsock.dll\n" );
+            WSACleanup();
+            return -1;
+        }
+#endif
+        return 0;
+    }
+
+    SERVER_EXPORT int SocketAPIEnd()
+    {
+#ifdef WIN32
+        return WSACleanup();
+#endif
+        return 0;
+    }
+
+    SERVER_EXPORT const char* GetTransportState ( int transport_state )
+    {
+        switch ( transport_state )
+        {
+            case JackTransportRolling:
+                return "rolling";
+            case JackTransportStarting:
+                return "starting";
+            case JackTransportStopped:
+                return "stopped";
+            case JackTransportNetStarting:
+                return "netstarting";
+        }
+        return NULL;
+    }
+}
diff --git a/common/JackNetTool.h b/common/JackNetTool.h
new file mode 100644
index 0000000..cb6f494
--- /dev/null
+++ b/common/JackNetTool.h
@@ -0,0 +1,308 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackMidiPort.h"
+#include "JackTools.h"
+#include "JackPlatformPlug.h"
+#include "types.h"
+#include "transport.h"
+#ifndef WIN32
+#include <netinet/in.h>
+#endif
+#include <cmath>
+
+using namespace std;
+
+#ifndef htonll
+#ifdef __BIG_ENDIAN__
+#define htonll(x)   (x)
+#define ntohll(x)   (x)
+#else
+#define htonll(x)   ((((uint64_t)htonl(x)) << 32) + htonl(x >> 32))
+#define ntohll(x)   ((((uint64_t)ntohl(x)) << 32) + ntohl(x >> 32))
+#endif
+#endif
+
+namespace Jack
+{
+    typedef struct _session_params session_params_t;
+    typedef struct _packet_header packet_header_t;
+    typedef struct _net_transport_data net_transport_data_t;
+    typedef struct sockaddr socket_address_t;
+    typedef struct in_addr address_t;
+    typedef jack_default_audio_sample_t sample_t;
+
+//session params ******************************************************************************
+
+    /**
+    \brief This structure containes master/slave connection parameters, it's used to setup the whole system
+
+    We have :
+        - some info like version, type and packet id
+        - names
+        - network parameters (hostnames and mtu)
+        - nunber of audio and midi channels
+        - sample rate and buffersize
+        - number of audio frames in one network packet (depends on the channel number)
+        - is the NetDriver in Sync or ASync mode ?
+        - is the NetDriver linked with the master's transport
+
+    Data encoding : headers (session_params and packet_header) are encoded using HTN kind of functions but float data
+    are kept in LITTLE_ENDIAN format (to avoid 2 conversions in the more common LITTLE_ENDIAN <==> LITTLE_ENDIAN connection case).
+    */
+
+    #define MASTER_PROTOCOL 1
+    #define SLAVE_PROTOCOL 1
+
+    struct _session_params
+    {
+        char fPacketType[7];                //packet type ('param')
+        char fProtocolVersion;              //version
+        uint32_t fPacketID;                 //indicates the packet type
+        char fName[JACK_CLIENT_NAME_SIZE];  //slave's name
+        char fMasterNetName[256];           //master hostname (network)
+        char fSlaveNetName[256];            //slave hostname (network)
+        uint32_t fMtu;                      //connection mtu
+        uint32_t fID;                       //slave's ID
+        uint32_t fTransportSync;            //is the transport synced ?
+        uint32_t fSendAudioChannels;        //number of master->slave channels
+        uint32_t fReturnAudioChannels;      //number of slave->master channels
+        uint32_t fSendMidiChannels;         //number of master->slave midi channels
+        uint32_t fReturnMidiChannels;       //number of slave->master midi channels
+        uint32_t fSampleRate;               //session sample rate
+        uint32_t fPeriodSize;               //period size
+        uint32_t fFramesPerPacket;          //complete frames per packet
+        uint32_t fBitdepth;                 //samples bitdepth (unused)
+        uint32_t fSlaveSyncMode;            //is the slave in sync mode ?
+        char fNetworkMode;                  //fast, normal or slow mode
+    };
+
+//net status **********************************************************************************
+
+    /**
+    \Brief This enum groups network error by type
+    */
+
+    enum  _net_status
+    {
+        NET_SOCKET_ERROR = 0,
+        NET_CONNECT_ERROR,
+        NET_ERROR,
+        NET_SEND_ERROR,
+        NET_RECV_ERROR,
+        NET_CONNECTED,
+        NET_ROLLING
+    };
+
+    typedef enum _net_status net_status_t;
+
+//sync packet type ****************************************************************************
+
+    /**
+    \Brief This enum indicates the type of a sync packet (used in the initialization phase)
+    */
+
+    enum _sync_packet_type
+    {
+        INVALID = 0,        //...
+        SLAVE_AVAILABLE,    //a slave is available
+        SLAVE_SETUP,        //slave configuration
+        START_MASTER,       //slave is ready, start master
+        START_SLAVE,        //master is ready, activate slave
+        KILL_MASTER         //master must stop
+    };
+
+    typedef enum _sync_packet_type sync_packet_type_t;
+
+
+//packet header *******************************************************************************
+
+    /**
+    \Brief This structure is a complete header
+
+    A header indicates :
+        - it is a header
+        - the type of data the packet contains (sync, midi or audio)
+        - the path of the packet (send -master->slave- or return -slave->master-)
+        - the unique ID of the slave
+        - the sample's bitdepth (unused for now)
+        - the size of the midi data contains in the packet (indicates how much midi data will be sent)
+        - the number of midi packet(s) : more than one is very unusual, it depends on the midi load
+        - the ID of the current cycle (used to check missing packets)
+        - the ID of the packet subcycle (for audio data)
+        - a flag indicating this packet is the last of the cycle (for sync robustness, it's better to process this way)
+        - a flag indicating if, in async mode, the previous graph was not finished or not
+        - padding to fill 64 bytes
+
+    */
+
+    struct _packet_header
+    {
+        char fPacketType[7];        //packet type ( 'headr' )
+        char fDataType;             //a for audio, m for midi and s for sync
+        char fDataStream;           //s for send, r for return
+        uint32_t fID;               //unique ID of the slave
+        uint32_t fBitdepth;         //bitdepth of the data samples
+        uint32_t fMidiDataSize;     //size of midi data in bytes
+        uint32_t fNMidiPckt;        //number of midi packets of the cycle
+        uint32_t fPacketSize;       //packet size in bytes
+        uint32_t fCycle;            //process cycle counter
+        uint32_t fSubCycle;         //midi/audio subcycle counter
+        uint32_t fIsLastPckt;       //is it the last packet of a given cycle ('y' or 'n')
+        char fASyncWrongCycle;      //is the current async cycle wrong (slave's side; 'y' or 'n')
+        char fFree[26];             //unused
+    };
+
+//net timebase master
+
+    /**
+    \Brief This enum describes timebase master's type
+    */
+
+    enum _net_timebase_master
+    {
+        NO_CHANGE = 0,
+        RELEASE_TIMEBASEMASTER = 1,
+        TIMEBASEMASTER = 2,
+        CONDITIONAL_TIMEBASEMASTER = 3
+    };
+
+    typedef enum _net_timebase_master net_timebase_master_t;
+
+
+//transport data ******************************************************************************
+
+    /**
+    \Brief This structure contains transport data to be sent over the network
+    */
+
+    struct _net_transport_data
+    {
+        uint32_t fNewState;             //is it a state change
+        uint32_t fTimebaseMaster;       //is there a new timebase master
+        int32_t fState;                 //current cycle state
+        jack_position_t fPosition;      //current cycle position
+    };
+
+//midi data ***********************************************************************************
+
+    /**
+    \Brief Midi buffer and operations class
+
+    This class is a toolset to manipulate Midi buffers.
+    A JackMidiBuffer has a fixed size, which is the same than an audio buffer size.
+    An intermediate fixed size buffer allows to uninterleave midi data (from jack ports).
+    But for a big majority of the process cycles, this buffer is filled less than 1%,
+    Sending over a network 99% of useless data seems completely unappropriate.
+    The idea is to count effective midi data, and then send the smallest packet we can.
+    To do it, we use an intermediate buffer.
+    We have two methods to convert data from jack ports to intermediate buffer,
+    And two others to convert this intermediate buffer to a network buffer (header + payload data)
+
+    */
+
+    class SERVER_EXPORT NetMidiBuffer
+    {
+        private:
+            int fNPorts;
+            size_t fMaxBufsize;
+            int fMaxPcktSize;
+            char* fBuffer;
+            char* fNetBuffer;
+            JackMidiBuffer** fPortBuffer;
+
+        public:
+            NetMidiBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
+            ~NetMidiBuffer();
+
+            void Reset();
+            size_t GetSize();
+            //utility
+            void DisplayEvents();
+            //jack<->buffer
+            int RenderFromJackPorts();
+            int RenderToJackPorts();
+            //network<->buffer
+            int RenderFromNetwork ( int subcycle, size_t copy_size );
+            int RenderToNetwork ( int subcycle, size_t total_size );
+
+            void SetBuffer ( int index, JackMidiBuffer* buffer );
+            JackMidiBuffer* GetBuffer ( int index );
+    };
+
+// audio data *********************************************************************************
+
+    /**
+    \Brief Audio buffer and operations class
+
+    This class is a toolset to manipulate audio buffers.
+    The manipulation of audio buffers is similar to midi buffer, except those buffers have fixed size.
+    The interleaving/uninterleaving operations are simplier here because audio buffers have fixed size,
+    So there is no need of an intermediate buffer as in NetMidiBuffer.
+
+    */
+
+    class SERVER_EXPORT NetAudioBuffer
+    {
+        private:
+            int fNPorts;
+            jack_nframes_t fPeriodSize;
+            jack_nframes_t fSubPeriodSize;
+            size_t fSubPeriodBytesSize;
+            char* fNetBuffer;
+            sample_t** fPortBuffer;
+        public:
+            NetAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
+            ~NetAudioBuffer();
+
+            size_t GetSize();
+            //jack<->buffer
+            void RenderFromJackPorts ( int subcycle );
+            void RenderToJackPorts ( int subcycle );
+
+            void SetBuffer ( int index, sample_t* buffer );
+            sample_t* GetBuffer ( int index );
+    };
+
+//utility *************************************************************************************
+
+    //socket API management
+    SERVER_EXPORT int SocketAPIInit();
+    SERVER_EXPORT int SocketAPIEnd();
+    //n<-->h functions
+    SERVER_EXPORT void SessionParamsHToN ( session_params_t* src_params, session_params_t* dst_params );
+    SERVER_EXPORT void SessionParamsNToH ( session_params_t* src_params, session_params_t* dst_params );
+    SERVER_EXPORT void PacketHeaderHToN ( packet_header_t* src_header, packet_header_t* dst_header );
+    SERVER_EXPORT void PacketHeaderNToH ( packet_header_t* src_header, packet_header_t* dst_header );
+    SERVER_EXPORT void MidiBufferHToN ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer );
+    SERVER_EXPORT void MidiBufferNToH ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer );
+    SERVER_EXPORT void TransportDataHToN ( net_transport_data_t* src_params, net_transport_data_t* dst_params );
+    SERVER_EXPORT void TransportDataNToH ( net_transport_data_t* src_params, net_transport_data_t* dst_params );
+    //display session parameters
+    SERVER_EXPORT void SessionParamsDisplay ( session_params_t* params );
+    //display packet header
+    SERVER_EXPORT void PacketHeaderDisplay ( packet_header_t* header );
+    //get the packet type from a sesion parameters
+    SERVER_EXPORT sync_packet_type_t GetPacketType ( session_params_t* params );
+    //set the packet type in a session parameters
+    SERVER_EXPORT int SetPacketType ( session_params_t* params, sync_packet_type_t packet_type );
+    //transport utility
+    SERVER_EXPORT const char* GetTransportState ( int transport_state );
+    SERVER_EXPORT void NetTransportDataDisplay ( net_transport_data_t* data );
+}
diff --git a/common/JackNotification.h b/common/JackNotification.h
new file mode 100644
index 0000000..be0c89f
--- /dev/null
+++ b/common/JackNotification.h
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2007 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackNotification__
+#define __JackNotification__
+
+namespace Jack
+{
+
+/*!
+\brief Notifications sent by the server for clients.
+*/
+
+enum NotificationType {
+    kAddClient = 0,
+    kRemoveClient = 1,
+    kActivateClient = 2,
+    kXRunCallback = 3,
+    kGraphOrderCallback = 4,
+    kBufferSizeCallback = 5,
+    kSampleRateCallback = 6,
+    kStartFreewheelCallback = 7,
+    kStopFreewheelCallback = 8,
+    kPortRegistrationOnCallback = 9,
+    kPortRegistrationOffCallback = 10,
+    kPortConnectCallback = 11,
+    kPortDisconnectCallback = 12,
+    kPortRenameCallback = 13,
+    kRealTimeCallback = 14,
+    kShutDownCallback = 15,
+    kQUIT = 16,
+    kMaxNotification
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackPhysicalMidiInput.cpp b/common/JackPhysicalMidiInput.cpp
new file mode 100644
index 0000000..311dad0
--- /dev/null
+++ b/common/JackPhysicalMidiInput.cpp
@@ -0,0 +1,287 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include <cassert>
+#include <cstring>
+#include <new>
+
+#include "JackError.h"
+#include "JackPhysicalMidiInput.h"
+
+namespace Jack {
+
+JackPhysicalMidiInput::JackPhysicalMidiInput(size_t buffer_size)
+{
+    size_t datum_size = sizeof(jack_midi_data_t);
+    assert(buffer_size > 0);
+    input_ring = jack_ringbuffer_create((buffer_size + 1) * datum_size);
+    if (! input_ring) {
+        throw std::bad_alloc();
+    }
+    jack_ringbuffer_mlock(input_ring);
+    Clear();
+    expected_data_bytes = 0;
+    status_byte = 0;
+}
+
+JackPhysicalMidiInput::~JackPhysicalMidiInput()
+{
+    jack_ringbuffer_free(input_ring);
+}
+
+void
+JackPhysicalMidiInput::Clear()
+{
+    jack_ringbuffer_reset(input_ring);
+    buffered_bytes = 0;
+    unbuffered_bytes = 0;
+}
+
+void
+JackPhysicalMidiInput::HandleBufferFailure(size_t unbuffered_bytes,
+                                           size_t total_bytes)
+{
+    jack_error("%d MIDI byte(s) of a %d byte message could not be buffered - "
+               "message dropped", unbuffered_bytes, total_bytes);
+}
+
+void
+JackPhysicalMidiInput::HandleIncompleteMessage(size_t bytes)
+{
+    jack_error("Discarding %d MIDI byte(s) - incomplete message (cable "
+               "unplugged?)", bytes);
+}
+
+void
+JackPhysicalMidiInput::HandleInvalidStatusByte(jack_midi_data_t status)
+{
+    jack_error("Dropping invalid MIDI status byte '%x'",
+               (unsigned int) status);
+}
+
+void
+JackPhysicalMidiInput::HandleUnexpectedSysexEnd(size_t bytes)
+{
+    jack_error("Discarding %d MIDI byte(s) - received sysex end without sysex "
+               "start (cable unplugged?)", bytes);
+}
+
+void
+JackPhysicalMidiInput::HandleWriteFailure(size_t bytes)
+{
+    jack_error("Failed to write a %d byte MIDI message to the port buffer",
+               bytes);
+}
+
+void
+JackPhysicalMidiInput::Process(jack_nframes_t frames)
+{
+    assert(port_buffer);
+    port_buffer->Reset(frames);
+    jack_nframes_t current_frame = 0;
+    size_t datum_size = sizeof(jack_midi_data_t);
+    for (;;) {
+        jack_midi_data_t datum;
+        current_frame = Receive(&datum, current_frame, frames);
+        if (current_frame >= frames) {
+            break;
+        }
+
+        jack_log("JackPhysicalMidiInput::Process (%d) - Received '%x' byte",
+                 current_frame, (unsigned int) datum);
+
+        if (datum >= 0xf8) {
+            // Realtime
+            if (datum == 0xfd) {
+                HandleInvalidStatusByte(datum);
+            } else {
+
+                jack_log("JackPhysicalMidiInput::Process - Writing realtime "
+                         "event.");
+
+                WriteByteEvent(current_frame, datum);
+            }
+            continue;
+        }
+        if (datum == 0xf7) {
+            // Sysex end
+            if (status_byte != 0xf0) {
+                HandleUnexpectedSysexEnd(buffered_bytes + unbuffered_bytes);
+                Clear();
+                expected_data_bytes = 0;
+                status_byte = 0;
+            } else {
+
+                jack_log("JackPhysicalMidiInput::Process - Writing sysex "
+                         "event.");
+
+                WriteBufferedSysexEvent(current_frame);
+            }
+            continue;
+        }
+        if (datum >= 0x80) {
+
+            // We're handling a non-realtime status byte
+
+            jack_log("JackPhysicalMidiInput::Process - Handling non-realtime "
+                     "status byte.");
+
+            if (buffered_bytes || unbuffered_bytes) {
+                HandleIncompleteMessage(buffered_bytes + unbuffered_bytes + 1);
+                Clear();
+            }
+            status_byte = datum;
+            switch (datum & 0xf0) {
+            case 0x80:
+            case 0x90:
+            case 0xa0:
+            case 0xb0:
+            case 0xe0:
+                // Note On, Note Off, Aftertouch, Control Change, Pitch Wheel
+                expected_data_bytes = 2;
+                break;
+            case 0xc0:
+            case 0xd0:
+                // Program Change, Channel Pressure
+                expected_data_bytes = 1;
+                break;
+            case 0xf0:
+                switch (datum) {
+                case 0xf0:
+                    // Sysex message
+                    expected_data_bytes = 0;
+                    break;
+                case 0xf1:
+                case 0xf3:
+                    // MTC Quarter frame, Song Select
+                    expected_data_bytes = 1;
+                    break;
+                case 0xf2:
+                    // Song Position
+                    expected_data_bytes = 2;
+                    break;
+                case 0xf4:
+                case 0xf5:
+                    // Undefined
+                    HandleInvalidStatusByte(datum);
+                    expected_data_bytes = 0;
+                    status_byte = 0;
+                    break;
+                case 0xf6:
+                    // Tune Request
+                    WriteByteEvent(current_frame, datum);
+                    expected_data_bytes = 0;
+                    status_byte = 0;
+                }
+                break;
+            }
+            continue;
+        }
+
+        // We're handling a data byte
+
+        jack_log("JackPhysicalMidiInput::Process - Buffering data byte.");
+
+        if (jack_ringbuffer_write(input_ring, (const char *) &datum,
+                                  datum_size) == datum_size) {
+            buffered_bytes++;
+        } else {
+            unbuffered_bytes++;
+        }
+        unsigned long total_bytes = buffered_bytes + unbuffered_bytes;
+        assert((! expected_data_bytes) ||
+               (total_bytes <= expected_data_bytes));
+        if (total_bytes == expected_data_bytes) {
+            if (! unbuffered_bytes) {
+
+                jack_log("JackPhysicalMidiInput::Process - Writing buffered "
+                         "event.");
+
+                WriteBufferedEvent(current_frame);
+            } else {
+                HandleBufferFailure(unbuffered_bytes, total_bytes);
+                Clear();
+            }
+            if (status_byte >= 0xf0) {
+                expected_data_bytes = 0;
+                status_byte = 0;
+            }
+        }
+    }
+}
+
+void
+JackPhysicalMidiInput::WriteBufferedEvent(jack_nframes_t frame)
+{
+    assert(port_buffer && port_buffer->IsValid());
+    size_t space = jack_ringbuffer_read_space(input_ring);
+    jack_midi_data_t *event = port_buffer->ReserveEvent(frame, space + 1);
+    if (event) {
+        jack_ringbuffer_data_t vector[2];
+        jack_ringbuffer_get_read_vector(input_ring, vector);
+        event[0] = status_byte;
+        size_t data_length_1 = vector[0].len;
+        memcpy(event + 1, vector[0].buf, data_length_1);
+        size_t data_length_2 = vector[1].len;
+        if (data_length_2) {
+            memcpy(event + data_length_1 + 1, vector[1].buf, data_length_2);
+        }
+    } else {
+        HandleWriteFailure(space + 1);
+    }
+    Clear();
+}
+
+void
+JackPhysicalMidiInput::WriteBufferedSysexEvent(jack_nframes_t frame)
+{
+    assert(port_buffer && port_buffer->IsValid());
+    size_t space = jack_ringbuffer_read_space(input_ring);
+    jack_midi_data_t *event = port_buffer->ReserveEvent(frame, space + 2);
+    if (event) {
+        jack_ringbuffer_data_t vector[2];
+        jack_ringbuffer_get_read_vector(input_ring, vector);
+        event[0] = status_byte;
+        size_t data_length_1 = vector[0].len;
+        memcpy(event + 1, vector[0].buf, data_length_1);
+        size_t data_length_2 = vector[1].len;
+        if (data_length_2) {
+            memcpy(event + data_length_1 + 1, vector[1].buf, data_length_2);
+        }
+        event[data_length_1 + data_length_2 + 1] = 0xf7;
+    } else {
+        HandleWriteFailure(space + 2);
+    }
+    Clear();
+}
+
+void
+JackPhysicalMidiInput::WriteByteEvent(jack_nframes_t frame,
+                                      jack_midi_data_t datum)
+{
+    assert(port_buffer && port_buffer->IsValid());
+    jack_midi_data_t *event = port_buffer->ReserveEvent(frame, 1);
+    if (event) {
+        event[0] = datum;
+    } else {
+        HandleWriteFailure(1);
+    }
+}
+
+}
diff --git a/common/JackPhysicalMidiInput.h b/common/JackPhysicalMidiInput.h
new file mode 100644
index 0000000..6ba3b47
--- /dev/null
+++ b/common/JackPhysicalMidiInput.h
@@ -0,0 +1,146 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPhysicalMidiInput__
+#define __JackPhysicalMidiInput__
+
+#include "JackMidiPort.h"
+#include "ringbuffer.h"
+
+namespace Jack {
+
+    class JackPhysicalMidiInput {
+
+    private:
+
+        size_t buffered_bytes;
+        size_t expected_data_bytes;
+        jack_ringbuffer_t *input_ring;
+        JackMidiBuffer *port_buffer;
+        jack_midi_data_t status_byte;
+        size_t unbuffered_bytes;
+
+        void
+        Clear();
+
+        void
+        WriteBufferedEvent(jack_nframes_t);
+
+        void
+        WriteBufferedSysexEvent(jack_nframes_t);
+
+        void
+        WriteByteEvent(jack_nframes_t, jack_midi_data_t);
+
+    protected:
+
+        /**
+         * Override to specify how to react when 1 or more bytes of a MIDI
+         * message are lost because there wasn't enough room in the input
+         * buffer.  The first argument is the amount of bytes that couldn't be
+         * buffered, and the second argument is the total amount of bytes in
+         * the MIDI message.  The default implementation calls 'jack_error'
+         * with a basic error message.
+         */
+
+        virtual void
+        HandleBufferFailure(size_t, size_t);
+
+        /**
+         * Override to specify how to react when a new status byte is received
+         * before all of the data bytes in a message are received.  The
+         * argument is the number of bytes being discarded.  The default
+         * implementation calls 'jack_error' with a basic error message.
+         */
+
+        virtual void
+        HandleIncompleteMessage(size_t);
+
+        /**
+         * Override to specify how to react when an invalid status byte (0xf4,
+         * 0xf5, 0xfd) is received.  The argument contains the invalid status
+         * byte.  The default implementation calls 'jack_error' with a basic
+         * error message.
+         */
+
+        virtual void
+        HandleInvalidStatusByte(jack_midi_data_t);
+
+        /**
+         * Override to specify how to react when a sysex end byte (0xf7) is
+         * received without first receiving a sysex start byte (0xf0).  The
+         * argument contains the amount of bytes that will be discarded.  The
+         * default implementation calls 'jack_error' with a basic error
+         * message.
+         */
+
+        virtual void
+        HandleUnexpectedSysexEnd(size_t);
+
+        /**
+         * Override to specify how to react when a MIDI message can not be
+         * written to the port buffer.  The argument specifies the length of
+         * the MIDI message.  The default implementation calls 'jack_error'
+         * with a basic error message.
+         */
+
+        virtual void
+        HandleWriteFailure(size_t);
+
+        /**
+         * This method *must* be overridden to handle receiving MIDI bytes.
+         * The first argument is a pointer to the memory location at which the
+         * MIDI byte should be stored.  The second argument is the last frame
+         * at which a MIDI byte was received, except at the beginning of the
+         * period when the value is 0.  The third argument is the total number
+         * of frames in the period.  The return value is the frame at which the
+         * MIDI byte is received at, or the value of the third argument is no
+         * more MIDI bytes can be received in this period.
+         */
+
+        virtual jack_nframes_t
+        Receive(jack_midi_data_t *, jack_nframes_t, jack_nframes_t) = 0;
+
+    public:
+
+        JackPhysicalMidiInput(size_t buffer_size=1024);
+        ~JackPhysicalMidiInput();
+
+        /**
+         * Called to process MIDI data during a period.
+         */
+
+        void
+        Process(jack_nframes_t);
+
+        /**
+         * Set the MIDI buffer that will receive incoming messages.
+         */
+
+        inline void
+        SetPortBuffer(JackMidiBuffer *port_buffer)
+        {
+            this->port_buffer = port_buffer;
+        }
+
+    };
+
+}
+
+#endif
diff --git a/common/JackPhysicalMidiOutput.cpp b/common/JackPhysicalMidiOutput.cpp
new file mode 100644
index 0000000..8f41d44
--- /dev/null
+++ b/common/JackPhysicalMidiOutput.cpp
@@ -0,0 +1,320 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include <cassert>
+
+#include "JackError.h"
+#include "JackPhysicalMidiOutput.h"
+
+namespace Jack {
+
+JackPhysicalMidiOutput::JackPhysicalMidiOutput(size_t non_rt_buffer_size,
+                                               size_t rt_buffer_size)
+{
+    size_t datum_size = sizeof(jack_midi_data_t);
+    assert(non_rt_buffer_size > 0);
+    assert(rt_buffer_size > 0);
+    output_ring = jack_ringbuffer_create((non_rt_buffer_size + 1) *
+                                         datum_size);
+    if (! output_ring) {
+        throw std::bad_alloc();
+    }
+    rt_output_ring = jack_ringbuffer_create((rt_buffer_size + 1) *
+                                            datum_size);
+    if (! rt_output_ring) {
+        jack_ringbuffer_free(output_ring);
+        throw std::bad_alloc();
+    }
+    jack_ringbuffer_mlock(output_ring);
+    jack_ringbuffer_mlock(rt_output_ring);
+    running_status = 0;
+}
+
+JackPhysicalMidiOutput::~JackPhysicalMidiOutput()
+{
+    jack_ringbuffer_free(output_ring);
+    jack_ringbuffer_free(rt_output_ring);
+}
+
+jack_nframes_t
+JackPhysicalMidiOutput::Advance(jack_nframes_t frame)
+{
+    return frame;
+}
+
+inline jack_midi_data_t
+JackPhysicalMidiOutput::ApplyRunningStatus(jack_midi_data_t **buffer,
+                                           size_t *size)
+{
+
+    // Stolen and modified from alsa/midi_pack.h
+
+    jack_midi_data_t status = (*buffer)[0];
+    if ((status >= 0x80) && (status < 0xf0)) {
+        if (status == running_status) {
+            (*buffer)++;
+            (*size)--;
+        } else {
+            running_status = status;
+        }
+    } else if (status < 0xf8) {
+        running_status = 0;
+    }
+    return status;
+}
+
+void
+JackPhysicalMidiOutput::HandleEventLoss(JackMidiEvent *event)
+{
+    jack_error("%d byte MIDI event lost", event->size);
+}
+
+void
+JackPhysicalMidiOutput::Process(jack_nframes_t frames)
+{
+    assert(port_buffer);
+    jack_nframes_t current_frame = Advance(0);
+    jack_nframes_t current_midi_event = 0;
+    jack_midi_data_t datum;
+    size_t datum_size = sizeof(jack_midi_data_t);
+    JackMidiEvent *midi_event;
+    jack_midi_data_t *midi_event_buffer;
+    size_t midi_event_size;
+    jack_nframes_t midi_events = port_buffer->event_count;
+
+    // First, send any realtime MIDI data that's left from last cycle.
+
+    if ((current_frame < frames) &&
+        jack_ringbuffer_read_space(rt_output_ring)) {
+
+        jack_log("JackPhysicalMidiOutput::Process (%d) - Sending buffered "
+                 "realtime data from last period.", current_frame);
+
+        current_frame = SendBufferedData(rt_output_ring, current_frame,
+                                         frames);
+
+        jack_log("JackPhysicalMidiOutput::Process (%d) - Sent", current_frame);
+
+    }
+
+    // Iterate through the events in this cycle.
+
+    for (; (current_midi_event < midi_events) && (current_frame < frames);
+         current_midi_event++) {
+
+        // Once we're inside this loop, we know that the realtime buffer
+        // is empty.  As long as we don't find a realtime message, we can
+        // concentrate on sending non-realtime data.
+
+        midi_event = &(port_buffer->events[current_midi_event]);
+        jack_nframes_t midi_event_time = midi_event->time;
+        midi_event_buffer = midi_event->GetData(port_buffer);
+        midi_event_size = midi_event->size;
+        datum = ApplyRunningStatus(&midi_event_buffer, &midi_event_size);
+        if (current_frame < midi_event_time) {
+
+            // We have time before this event is scheduled to be sent.
+            // Send data in the non-realtime buffer.
+
+            if (jack_ringbuffer_read_space(output_ring)) {
+
+                jack_log("JackPhysicalMidiOutput::Process (%d) - Sending "
+                         "buffered non-realtime data from last period.",
+                         current_frame);
+
+                current_frame = SendBufferedData(output_ring, current_frame,
+                                                 midi_event_time);
+
+                jack_log("JackPhysicalMidiOutput::Process (%d) - Sent",
+                         current_frame);
+
+            }
+            if (current_frame < midi_event_time) {
+
+                // We _still_ have time before this event is scheduled to
+                // be sent.  Let's send as much of this event as we can
+                // (save for one byte, which will need to be sent at or
+                // after its scheduled time).  First though, we need to
+                // make sure that we can buffer this data if we need to.
+                // Otherwise, we might start sending a message that we
+                // can't finish.
+
+                if (midi_event_size > 1) {
+                    if (jack_ringbuffer_write_space(output_ring) <
+                        ((midi_event_size - 1) * datum_size)) {
+                        HandleEventLoss(midi_event);
+                        continue;
+                    }
+
+                    // Send as much of the event as possible (save for one
+                    // byte).
+
+                    do {
+
+                        jack_log("JackPhysicalMidiOutput::Process (%d) - "
+                                 "Sending unbuffered event byte early.",
+                                 current_frame);
+
+                        current_frame = Send(current_frame,
+                                             *midi_event_buffer);
+
+                        jack_log("JackPhysicalMidiOutput::Process (%d) - "
+                                 "Sent.", current_frame);
+
+                        midi_event_buffer++;
+                        midi_event_size--;
+                        if (current_frame >= midi_event_time) {
+
+                            // The event we're processing must be a
+                            // non-realtime event.  It has more than one
+                            // byte.
+
+                            goto buffer_non_realtime_data;
+                        }
+                    } while (midi_event_size > 1);
+                }
+
+                jack_log("JackPhysicalMidiOutput::Process (%d) - Advancing to "
+                         ">= %d", current_frame, midi_event_time);
+
+                current_frame = Advance(midi_event_time);
+
+                jack_log("JackPhysicalMidiOutput::Process (%d) - Advanced.",
+                         current_frame);
+
+            }
+        }
+
+        // If the event is realtime, then we'll send the event now.
+        // Otherwise, we attempt to put the rest of the event bytes in the
+        // non-realtime buffer.
+
+        if (datum >= 0xf8) {
+
+            jack_log("JackPhysicalMidiOutput::Process (%d) - Sending "
+                     "unbuffered realtime event.", current_frame);
+
+            current_frame = Send(current_frame, datum);
+
+            jack_log("JackPhysicalMidiOutput::Process (%d) - Sent.",
+                     current_frame);
+
+        } else if (jack_ringbuffer_write_space(output_ring) >=
+                   (midi_event_size * datum_size)) {
+        buffer_non_realtime_data:
+
+            jack_log("JackPhysicalMidiOutput::Process (%d) - Buffering %d "
+                     "byte(s) of non-realtime data.", current_frame,
+                     midi_event_size);
+
+            jack_ringbuffer_write(output_ring,
+                                  (const char *) midi_event_buffer,
+                                  midi_event_size);
+        } else {
+            HandleEventLoss(midi_event);
+        }
+    }
+
+    if (current_frame < frames) {
+
+        // If we have time left to send data, then we know that all of the
+        // data in the realtime buffer has been sent, and that all of the
+        // non-realtime messages have either been sent, or buffered.  We
+        // use whatever time is left to send data in the non-realtime
+        // buffer.
+
+        if (jack_ringbuffer_read_space(output_ring)) {
+
+            jack_log("JackPhysicalMidiOutput::Process (%d) - All events "
+                     "processed.  Sending buffered non-realtime data.",
+                     current_frame);
+
+            current_frame = SendBufferedData(output_ring, current_frame,
+                                             frames);
+
+            jack_log("JackPhysicalMidiOutput::Process (%d) - Sent.",
+                     current_frame);
+
+        }
+    } else {
+
+        // Since we have no time left, we need to put all remaining midi
+        // events in their appropriate buffers, and send them next period.
+
+        for (; current_midi_event < midi_events; current_midi_event++) {
+            midi_event = &(port_buffer->events[current_midi_event]);
+            midi_event_buffer = midi_event->GetData(port_buffer);
+            midi_event_size = midi_event->size;
+            datum = ApplyRunningStatus(&midi_event_buffer, &midi_event_size);
+            if (datum >= 0xf8) {
+
+                // Realtime.
+
+                if (jack_ringbuffer_write_space(rt_output_ring) >=
+                    datum_size) {
+
+                    jack_log("JackPhysicalMidiOutput::Process - Buffering "
+                             "realtime event for next period.");
+
+                    jack_ringbuffer_write(rt_output_ring,
+                                          (const char *) &datum, datum_size);
+                    continue;
+                }
+            } else {
+
+                // Non-realtime.
+
+                if (jack_ringbuffer_write_space(output_ring) >=
+                    (midi_event_size * datum_size)) {
+
+                    jack_log("JackPhysicalMidiOutput::Process - Buffering "
+                             "non-realtime event for next period.");
+
+                    jack_ringbuffer_write(output_ring,
+                                          (const char *) midi_event_buffer,
+                                          midi_event_size * datum_size);
+                    continue;
+                }
+            }
+            HandleEventLoss(midi_event);
+        }
+    }
+}
+
+jack_nframes_t
+JackPhysicalMidiOutput::SendBufferedData(jack_ringbuffer_t *buffer,
+                                         jack_nframes_t current_frame,
+                                         jack_nframes_t boundary)
+{
+    assert(buffer);
+    assert(current_frame < boundary);
+    size_t datum_size = sizeof(jack_midi_data_t);
+    size_t data_length = jack_ringbuffer_read_space(buffer) / datum_size;
+    for (size_t i = 0; i < data_length; i++) {
+        jack_midi_data_t datum;
+        jack_ringbuffer_read(buffer, (char *) &datum, datum_size);
+        current_frame = Send(current_frame, datum);
+        if (current_frame >= boundary) {
+            break;
+        }
+    }
+    return current_frame;
+}
+
+}
diff --git a/common/JackPhysicalMidiOutput.h b/common/JackPhysicalMidiOutput.h
new file mode 100644
index 0000000..f76a233
--- /dev/null
+++ b/common/JackPhysicalMidiOutput.h
@@ -0,0 +1,118 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPhysicalMidiOutput__
+#define __JackPhysicalMidiOutput__
+
+#include "JackMidiPort.h"
+#include "ringbuffer.h"
+
+namespace Jack {
+
+    class JackPhysicalMidiOutput {
+
+    private:
+
+        jack_midi_data_t
+        ApplyRunningStatus(jack_midi_data_t **, size_t *);
+
+        jack_ringbuffer_t *output_ring;
+        JackMidiBuffer *port_buffer;
+        jack_ringbuffer_t *rt_output_ring;
+        jack_midi_data_t running_status;
+
+    protected:
+
+        /**
+         * Override to specify the next frame at which a midi byte can be sent.
+         * The returned frame must be greater than or equal to the frame
+         * argument.  The default returns the frame passed to it.
+         */
+
+        virtual jack_nframes_t
+        Advance(jack_nframes_t);
+
+        /**
+         * Override to customize how to react when a MIDI event can't be
+         * buffered and can't be sent immediately.  The default calls
+         * 'jack_error' and specifies the number of bytes lost.
+         */
+
+        virtual void
+        HandleEventLoss(JackMidiEvent *);
+
+        /**
+         * This method *must* be overridden to specify what happens when a MIDI
+         * byte is sent at the specfied frame.  The frame argument specifies
+         * the frame at which the MIDI byte should be sent, and the second
+         * argument specifies the byte itself. The return value is the next
+         * frame at which a MIDI byte can be sent, and must be greater than or
+         * equal to the frame argument.
+         */
+
+        virtual jack_nframes_t
+        Send(jack_nframes_t, jack_midi_data_t) = 0;
+
+        /**
+         * Override to optimize behavior when sending MIDI data that's in the
+         * ringbuffer.  The first frame argument is the current frame, and the
+         * second frame argument is the boundary frame.  The function returns
+         * the next frame at which MIDI data can be sent, regardless of whether
+         * or not the boundary is reached.  The default implementation calls
+         * 'Send' with each byte in the ringbuffer until either the ringbuffer
+         * is empty, or a frame beyond the boundary frame is returned by
+         * 'Send'.
+         */
+
+        virtual jack_nframes_t
+        SendBufferedData(jack_ringbuffer_t *, jack_nframes_t, jack_nframes_t);
+
+    public:
+
+        /**
+         * The non-realtime buffer size and the realtime buffer size are both
+         * optional arguments.
+         */
+
+        JackPhysicalMidiOutput(size_t non_rt_buffer_size=1024,
+                               size_t rt_buffer_size=64);
+        ~JackPhysicalMidiOutput();
+
+        /**
+         * Called to process MIDI data during a period.
+         */
+
+        void
+        Process(jack_nframes_t);
+
+        /**
+         * Set the MIDI buffer that will contain the outgoing MIDI messages.
+         */
+
+        inline void
+        SetPortBuffer(JackMidiBuffer *port_buffer)
+        {
+            this->port_buffer = port_buffer;
+        }
+
+    };
+
+}
+
+#endif
diff --git a/common/JackPlatformPlug.h b/common/JackPlatformPlug.h
new file mode 100644
index 0000000..560755b
--- /dev/null
+++ b/common/JackPlatformPlug.h
@@ -0,0 +1,25 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPlatformPlug__
+#define __JackPlatformPlug__
+
+#include "JackPlatformPlug_os.h"
+
+#endif
diff --git a/common/JackPort.cpp b/common/JackPort.cpp
new file mode 100644
index 0000000..f8c62d6
--- /dev/null
+++ b/common/JackPort.cpp
@@ -0,0 +1,254 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackPort.h"
+#include "JackError.h"
+#include "JackPortType.h"
+#include <stdio.h>
+#include <assert.h>
+
+namespace Jack
+{
+
+JackPort::JackPort()
+{
+    Release();
+}
+
+bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags)
+{
+    jack_port_type_id_t id = GetPortTypeId(port_type);
+    if (id == PORT_TYPES_MAX)
+        return false;
+    fTypeId = id;
+    fFlags = flags;
+    fRefNum = refnum;
+    strcpy(fName, port_name);
+    fInUse = true;
+    fLatency = 0;
+    fTotalLatency = 0;
+    fTied = NO_PORT;
+    // DB: At this point we do not know current buffer size in frames,
+    // but every time buffer will be returned to any user,
+    // it will be called with either ClearBuffer or MixBuffers
+    // with correct current buffer size.
+    // So it is safe to init with 0 here.
+    ClearBuffer(0);
+    return true;
+}
+
+void JackPort::Release()
+{
+    fTypeId = 0;
+    fFlags = JackPortIsInput;
+    fRefNum = -1;
+    fInUse = false;
+    fLatency = 0;
+    fTotalLatency = 0;
+    fMonitorRequests = 0;
+    fTied = NO_PORT;
+    fAlias1[0] = '\0';
+    fAlias2[0] = '\0';
+}
+
+int JackPort::GetRefNum() const
+{
+    return fRefNum;
+}
+
+jack_nframes_t JackPort::GetLatency() const
+{
+    return fLatency;
+}
+
+jack_nframes_t JackPort::GetTotalLatency() const
+{
+    return fTotalLatency;
+}
+
+void JackPort::SetLatency(jack_nframes_t nframes)
+{
+    fLatency = nframes;
+}
+
+int JackPort::Tie(jack_port_id_t port_index)
+{
+    fTied = port_index;
+    return 0;
+}
+
+int JackPort::UnTie()
+{
+    fTied = NO_PORT;
+    return 0;
+}
+
+int JackPort::RequestMonitor(bool onoff)
+{
+    /**
+    jackd.h 
+    * If @ref JackPortCanMonitor is set for this @a port, turn input
+    * monitoring on or off. Otherwise, do nothing.
+     
+    if (!(fFlags & JackPortCanMonitor))
+    	return -1;
+    */
+
+    if (onoff) {
+        fMonitorRequests++;
+    } else if (fMonitorRequests) {
+        fMonitorRequests--;
+    }
+
+    return 0;
+}
+
+int JackPort::EnsureMonitor(bool onoff)
+{
+    /**
+    jackd.h 
+    * If @ref JackPortCanMonitor is set for this @a port, turn input
+    * monitoring on or off. Otherwise, do nothing.
+     
+    if (!(fFlags & JackPortCanMonitor))
+    	return -1;
+    */
+
+    if (onoff) {
+        if (fMonitorRequests == 0) {
+            fMonitorRequests++;
+        }
+    } else {
+        if (fMonitorRequests > 0) {
+            fMonitorRequests = 0;
+        }
+    }
+
+    return 0;
+}
+
+const char* JackPort::GetName() const
+{
+    return fName;
+}
+
+const char* JackPort::GetShortName() const
+{
+    /* we know there is always a colon, because we put
+       it there ...
+    */
+    return strchr(fName, ':') + 1;
+}
+
+int JackPort::GetFlags() const
+{
+    return fFlags;
+}
+
+const char* JackPort::GetType() const
+{
+    const JackPortType* type = GetPortType(fTypeId);
+    return type->name;
+}
+
+void JackPort::SetName(const char* new_name)
+{
+    char* colon = strchr(fName, ':');
+    int len = sizeof(fName) - ((int) (colon - fName)) - 2;
+    snprintf(colon + 1, len, "%s", new_name);
+}
+
+bool JackPort::NameEquals(const char* target)
+{
+    char buf[JACK_PORT_NAME_SIZE + 1];
+
+    /* this nasty, nasty kludge is here because between 0.109.0 and 0.109.1,
+       the ALSA audio backend had the name "ALSA", whereas as before and
+       after it, it was called "alsa_pcm". this stops breakage for
+       any setups that have saved "alsa_pcm" or "ALSA" in their connection
+       state.
+    */
+
+    if (strncmp(target, "ALSA:capture", 12) == 0 || strncmp(target, "ALSA:playback", 13) == 0) {
+        snprintf(buf, sizeof(buf), "alsa_pcm%s", target + 4);
+        target = buf;
+    }
+
+    return (strcmp(fName, target) == 0
+            || strcmp(fAlias1, target) == 0
+            || strcmp(fAlias2, target) == 0);
+}
+
+int JackPort::GetAliases(char* const aliases[2])
+{
+    int cnt = 0;
+
+    if (fAlias1[0] != '\0') {
+        snprintf(aliases[0], JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE, "%s", fAlias1);
+        cnt++;
+    }
+
+    if (fAlias2[0] != '\0') {
+        snprintf(aliases[1], JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE, "%s", fAlias2);
+        cnt++;
+    }
+
+    return cnt;
+}
+
+int JackPort::SetAlias(const char* alias)
+{
+    if (fAlias1[0] == '\0') {
+        snprintf(fAlias1, sizeof(fAlias1), "%s", alias);
+    } else if (fAlias2[0] == '\0') {
+        snprintf(fAlias2, sizeof(fAlias2), "%s", alias);
+    } else {
+        return -1;
+    }
+
+    return 0;
+}
+
+int JackPort::UnsetAlias(const char* alias)
+{
+    if (strcmp(fAlias1, alias) == 0) {
+        fAlias1[0] = '\0';
+    } else if (strcmp(fAlias2, alias) == 0) {
+        fAlias2[0] = '\0';
+    } else {
+        return -1;
+    }
+
+    return 0;
+}
+
+void JackPort::ClearBuffer(jack_nframes_t frames)
+{
+    const JackPortType* type = GetPortType(fTypeId);
+    (type->init)(GetBuffer(), frames * sizeof(float), frames);
+}
+
+void JackPort::MixBuffers(void** src_buffers, int src_count, jack_nframes_t buffer_size)
+{
+    const JackPortType* type = GetPortType(fTypeId);
+    (type->mixdown)(GetBuffer(), src_buffers, src_count, buffer_size);
+}
+
+} // end of namespace
diff --git a/common/JackPort.h b/common/JackPort.h
new file mode 100644
index 0000000..45f9073
--- /dev/null
+++ b/common/JackPort.h
@@ -0,0 +1,115 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPort__
+#define __JackPort__
+
+#include "types.h"
+#include "JackConstants.h"
+#include "JackCompilerDeps.h"
+
+namespace Jack
+{
+
+#define ALL_PORTS	0xFFFF
+#define NO_PORT		0xFFFE
+
+/*!
+\brief Base class for port.
+*/
+
+class SERVER_EXPORT JackPort
+{
+
+        friend class JackGraphManager;
+
+    private:
+
+        int fTypeId;
+        enum JackPortFlags fFlags;
+        char fName[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+        char fAlias1[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+        char fAlias2[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+        int fRefNum;
+
+        jack_nframes_t fLatency;
+        jack_nframes_t fTotalLatency;
+        uint8_t fMonitorRequests;
+
+        bool fInUse;
+        jack_port_id_t fTied;   // Locally tied source port
+        float fBuffer[BUFFER_SIZE_MAX + 4];
+     
+        bool IsUsed() const
+        {
+            return fInUse;
+        }
+
+        // RT
+        void ClearBuffer(jack_nframes_t frames);
+        void MixBuffers(void** src_buffers, int src_count, jack_nframes_t frames);
+
+    public:
+
+        JackPort();
+
+        bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
+        void Release();
+        const char* GetName() const;
+        const char* GetShortName() const;
+        void SetName(const char* name);
+
+        int GetAliases(char* const aliases[2]);
+        int SetAlias(const char* alias);
+        int UnsetAlias(const char* alias);
+        bool NameEquals(const char* target);
+
+        int	GetFlags() const;
+        const char* GetType() const;
+
+        int Tie(jack_port_id_t port_index);
+        int UnTie();
+
+        jack_nframes_t GetLatency() const;
+        jack_nframes_t GetTotalLatency() const;
+        void SetLatency(jack_nframes_t latency);
+
+        int RequestMonitor(bool onoff);
+        int EnsureMonitor(bool onoff);
+        bool MonitoringInput()
+        {
+            return (fMonitorRequests > 0);
+        }
+
+        // Since we are in shared memory, the resulting pointer cannot be cached, so align it here...
+        float* GetBuffer()
+        {
+            return (float*)((long)fBuffer & ~15L) + 4;
+        }
+
+        int GetRefNum() const;
+        
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+
+#endif
+
diff --git a/common/JackPortType.cpp b/common/JackPortType.cpp
new file mode 100644
index 0000000..7f72080
--- /dev/null
+++ b/common/JackPortType.cpp
@@ -0,0 +1,54 @@
+/*
+Copyright (C) 2007 Dmitry Baikov
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackPortType.h"
+#include <string.h>
+#include <assert.h>
+
+namespace Jack
+{
+
+static const JackPortType* port_types[] =
+{
+    &gAudioPortType,
+    &gMidiPortType,
+};
+
+jack_port_type_id_t PORT_TYPES_MAX = sizeof(port_types) / sizeof(port_types[0]);
+
+jack_port_type_id_t GetPortTypeId(const char* port_type)
+{
+    for (jack_port_type_id_t i = 0; i < PORT_TYPES_MAX; ++i) {
+        const JackPortType* type = port_types[i];
+        assert(type != 0);
+        if (strcmp(port_type, type->name) == 0)
+            return i;
+    }
+    return PORT_TYPES_MAX;
+}
+
+const JackPortType* GetPortType(jack_port_type_id_t type_id)
+{
+    assert(type_id >= 0 && type_id <= PORT_TYPES_MAX);
+    const JackPortType* type = port_types[type_id];
+    assert(type != 0);
+    return type;
+}
+
+} // namespace Jack
diff --git a/common/JackPortType.h b/common/JackPortType.h
new file mode 100644
index 0000000..616e0ae
--- /dev/null
+++ b/common/JackPortType.h
@@ -0,0 +1,47 @@
+/*
+Copyright (C) 2007 Dmitry Baikov
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPortType__
+#define __JackPortType__
+
+#include "types.h"
+#include "JackConstants.h"
+#include <stddef.h>
+
+namespace Jack
+{
+
+extern jack_port_type_id_t PORT_TYPES_MAX;
+
+struct JackPortType
+{
+    const char* name;
+    void (*init)(void* buffer, size_t buffer_size, jack_nframes_t nframes);
+    void (*mixdown)(void *mixbuffer, void** src_buffers, int src_count, jack_nframes_t nframes);
+};
+
+extern jack_port_type_id_t GetPortTypeId(const char* port_type);
+extern const struct JackPortType* GetPortType(jack_port_type_id_t port_type_id);
+
+extern const struct JackPortType gAudioPortType;
+extern const struct JackPortType gMidiPortType;
+
+} // namespace Jack
+
+#endif
diff --git a/common/JackProfiler.cpp b/common/JackProfiler.cpp
new file mode 100644
index 0000000..b74abc1
--- /dev/null
+++ b/common/JackProfiler.cpp
@@ -0,0 +1,291 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "JackProfiler.h"
+#include "JackServerGlobals.h"
+#include "JackEngineControl.h"
+#include "JackLockedEngine.h"
+#include "JackArgParser.h"
+#include <assert.h>
+#include <string>
+
+namespace Jack
+{
+
+    JackProfilerClient::JackProfilerClient(jack_client_t* client, const char* name)
+        :fClient(client)
+    {
+        char port_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+        fRefNum = JackServerGlobals::fInstance->GetEngine()->GetClientRefNum(name);
+        
+        snprintf(port_name, sizeof(port_name) - 1, "%s:scheduling", name);
+        fSchedulingPort = jack_port_register(client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+        
+        snprintf(port_name, sizeof(port_name) - 1, "%s:duration", name);
+        fDurationPort = jack_port_register(client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+    }
+    
+    JackProfilerClient::~JackProfilerClient()
+    {
+        jack_port_unregister(fClient, fSchedulingPort);
+        jack_port_unregister(fClient, fDurationPort);
+    }
+    
+#ifdef JACK_MONITOR
+    JackProfiler::JackProfiler(jack_client_t* client, const JSList* params)
+        :fClient(client), fLastMeasure(NULL)
+#else
+    JackProfiler::JackProfiler(jack_client_t* client, const JSList* params)
+        :fClient(client)
+#endif
+    {
+        jack_log("JackProfiler::JackProfiler");
+        
+        fCPULoadPort = fDriverPeriodPort = fDriverEndPort = NULL;
+      
+        const JSList* node;
+        const jack_driver_param_t* param;
+        for (node = params; node; node = jack_slist_next(node)) {
+            param = (const jack_driver_param_t*)node->data;
+            
+            switch (param->character) {
+                case 'c':
+                    fCPULoadPort = jack_port_register(client, "cpu_load", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+                    break;
+                    
+                case 'p':
+                    fDriverPeriodPort = jack_port_register(client, "driver_period", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+                    break;
+                     
+                case 'e':
+                    fDriverEndPort = jack_port_register(client, "driver_end_time", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+                    break;
+            }
+        }
+       
+        // Resigster all running clients
+        const char **ports = jack_get_ports(client, NULL, NULL, 0);
+        if (ports) {
+            for (int i = 0; ports[i]; ++i) {
+                std::string str = std::string(ports[i]);
+                ClientRegistration(str.substr(0, str.find_first_of(':')).c_str(), 1, this);
+            }
+            free(ports);
+        }
+     
+        jack_set_process_callback(client, Process, this);
+        jack_set_client_registration_callback(client, ClientRegistration, this);
+        jack_activate(client);
+    }
+
+    JackProfiler::~JackProfiler()
+    {
+        jack_log("JackProfiler::~JackProfiler");
+    }
+    
+    void JackProfiler::ClientRegistration(const char* name, int val, void *arg)
+    {
+    #ifdef JACK_MONITOR
+        JackProfiler* profiler = static_cast<JackProfiler*>(arg);
+        
+        // Filter client or "system" name
+        if (strcmp(name, jack_get_client_name(profiler->fClient)) == 0 || strcmp(name, "system") == 0)
+            return;
+        
+        profiler->fMutex.Lock();
+        if (val) {
+            std::map<std::string, JackProfilerClient*>::iterator it = profiler->fClientTable.find(name);
+            if (it == profiler->fClientTable.end()) {
+                jack_log("Client %s added", name);
+                profiler->fClientTable[name] = new JackProfilerClient(profiler->fClient, name);
+            }
+        } else {
+            std::map<std::string, JackProfilerClient*>::iterator it = profiler->fClientTable.find(name);
+            if (it != profiler->fClientTable.end()) {
+                jack_log("Client %s removed", name);
+                profiler->fClientTable.erase(it);
+                delete((*it).second);
+            }
+        }
+        profiler->fMutex.Unlock();
+    #endif
+    }
+
+    int JackProfiler::Process(jack_nframes_t nframes, void* arg)
+    {
+        JackProfiler* profiler = static_cast<JackProfiler*>(arg);
+        
+        if (profiler->fCPULoadPort) {
+            float* buffer_cpu_load = (float*)jack_port_get_buffer(profiler->fCPULoadPort, nframes);
+            float cpu_load = jack_cpu_load(profiler->fClient);
+            for (unsigned int i = 0; i < nframes; i++) {
+                buffer_cpu_load[i] = cpu_load / 100.f;
+            }
+        }
+ 
+    #ifdef JACK_MONITOR      
+        
+        JackEngineControl* control = JackServerGlobals::fInstance->GetEngineControl();
+        JackEngineProfiling* engine_profiler = &control->fProfiler;
+        JackTimingMeasure* measure = engine_profiler->GetCurMeasure();
+        
+       if (profiler->fLastMeasure && profiler->fMutex.Trylock()) {
+        
+            if (profiler->fDriverPeriodPort) {
+                float* buffer_driver_period = (float*)jack_port_get_buffer(profiler->fDriverPeriodPort, nframes);
+                float value1 = (float(measure->fPeriodUsecs) - float(measure->fCurCycleBegin - profiler->fLastMeasure->fCurCycleBegin)) / float(measure->fPeriodUsecs);
+                for (unsigned int i = 0; i < nframes; i++) {
+                    buffer_driver_period[i] = value1;
+                }
+            }
+            
+            if (profiler->fDriverEndPort) {
+                float* buffer_driver_end_time = (float*)jack_port_get_buffer(profiler->fDriverEndPort, nframes);
+                float value2 = (float(measure->fPrevCycleEnd - profiler->fLastMeasure->fCurCycleBegin)) / float(measure->fPeriodUsecs);
+                for (unsigned int i = 0; i < nframes; i++) {
+                    buffer_driver_end_time[i] = value2;
+                }
+            }
+            
+            std::map<std::string, JackProfilerClient*>::iterator it;
+            for (it = profiler->fClientTable.begin(); it != profiler->fClientTable.end(); it++) {
+                int ref = (*it).second->fRefNum;
+                long d5 = long(measure->fClientTable[ref].fSignaledAt - profiler->fLastMeasure->fCurCycleBegin);
+                long d6 = long(measure->fClientTable[ref].fAwakeAt - profiler->fLastMeasure->fCurCycleBegin);
+                long d7 = long(measure->fClientTable[ref].fFinishedAt - profiler->fLastMeasure->fCurCycleBegin);
+                  
+                float* buffer_scheduling = (float*)jack_port_get_buffer((*it).second->fSchedulingPort, nframes);
+                float value3 = float(d6 - d5) / float(measure->fPeriodUsecs);
+                jack_log("Scheduling %f", value3);
+                for (unsigned int i = 0; i < nframes; i++) {
+                    buffer_scheduling[i] = value3;
+                }
+                  
+                float* buffer_duration = (float*)jack_port_get_buffer((*it).second->fDurationPort, nframes);
+                float value4 = float(d7 - d6) / float(measure->fPeriodUsecs);
+                jack_log("Duration %f", value4);
+                for (unsigned int i = 0; i < nframes; i++) {
+                    buffer_duration[i] = value4;
+                }
+            }
+            
+            profiler->fMutex.Unlock();
+        }
+        profiler->fLastMeasure = measure;
+    #endif
+        return 0;
+    }
+    
+} // namespace Jack
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "driver_interface.h"
+
+    using namespace Jack;
+    
+    static Jack::JackProfiler* profiler = NULL;
+
+    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+    {
+        jack_driver_desc_t* desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+        
+        strcpy(desc->name, "profiler");                    // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "real-time server profiling");  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+       
+        desc->nparams = 3;
+        desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+        
+        int i = 0;
+        strcpy(desc->params[i].name, "cpu-load");
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Show DSP CPU load");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "driver-period");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Show driver period");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "driver-end-time");
+        desc->params[i].character = 'e';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Show driver end time");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        return desc;
+    }
+
+    SERVER_EXPORT int jack_internal_initialize(jack_client_t* jack_client, const JSList* params)
+    {
+        if (profiler) {
+            jack_info("profiler already loaded");
+            return 1;
+        }
+        
+        jack_log("Loading profiler");
+        try {
+            profiler = new Jack::JackProfiler(jack_client, params);
+            assert(profiler);
+            return 0;
+        } catch (...) {
+            return 1;
+        }
+    }
+
+    SERVER_EXPORT int jack_initialize(jack_client_t* jack_client, const char* load_init)
+    {
+        JSList* params = NULL;
+        bool parse_params = true;
+        int res = 1;
+        jack_driver_desc_t* desc = jack_get_descriptor();
+
+        Jack::JackArgParser parser ( load_init );
+        if ( parser.GetArgc() > 0 )
+            parse_params = parser.ParseParams ( desc, &params );
+
+        if (parse_params) {
+            res = jack_internal_initialize ( jack_client, params );
+            parser.FreeParams ( params );
+        }
+        return res;
+    }
+
+    SERVER_EXPORT void jack_finish(void* arg)
+    {
+        Jack::JackProfiler* profiler = static_cast<Jack::JackProfiler*>(arg);
+
+        if (profiler) {
+            jack_log("Unloading profiler");
+            delete profiler;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/common/JackProfiler.h b/common/JackProfiler.h
new file mode 100644
index 0000000..bdf3419
--- /dev/null
+++ b/common/JackProfiler.h
@@ -0,0 +1,80 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackProfiler__
+#define __JackProfiler__
+
+#include "JackConstants.h"
+#include "JackPlatformPlug.h"
+#include "jack.h"
+#include "jslist.h"
+#include <map>
+#include <string>
+
+#ifdef JACK_MONITOR
+#include "JackEngineProfiling.h"
+#endif
+
+namespace Jack
+{
+
+struct JackProfilerClient {
+
+    int fRefNum;
+    jack_client_t* fClient;
+    jack_port_t* fSchedulingPort;
+    jack_port_t* fDurationPort;
+    
+    JackProfilerClient(jack_client_t* client, const char* name);
+    ~JackProfilerClient();
+    
+};
+
+/*!
+\brief Server real-time monitoring
+*/
+
+class JackProfiler 
+{
+
+    private:
+    
+        jack_client_t* fClient;
+        jack_port_t* fCPULoadPort;
+        jack_port_t* fDriverPeriodPort;
+        jack_port_t* fDriverEndPort;
+    #ifdef JACK_MONITOR
+        JackTimingMeasure* fLastMeasure;
+        std::map<std::string, JackProfilerClient*> fClientTable;
+        JackMutex fMutex;
+    #endif
+ 
+    public:
+
+        JackProfiler(jack_client_t* jack_client, const JSList* params);
+        ~JackProfiler();
+
+        static int Process(jack_nframes_t nframes, void* arg);
+        static void ClientRegistration(const char* name, int val, void *arg);
+
+};
+
+}
+
+#endif
diff --git a/common/JackRequest.h b/common/JackRequest.h
new file mode 100644
index 0000000..d366f69
--- /dev/null
+++ b/common/JackRequest.h
@@ -0,0 +1,1121 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackRequest__
+#define __JackRequest__
+
+#include "JackConstants.h"
+#include "JackPlatformPlug.h"
+#include "types.h"
+#include <string.h>
+#include <stdio.h>
+
+namespace Jack
+{
+
+#define CheckRes(exp) { if ((exp) < 0) return -1;}
+
+/*!
+\brief Request from client to server.
+*/
+
+struct JackRequest
+{
+
+    enum RequestType {
+        kRegisterPort = 1,
+        kUnRegisterPort = 2,
+        kConnectPorts = 3,
+        kDisconnectPorts = 4,
+        kSetTimeBaseClient = 5,
+        kActivateClient = 6,
+        kDeactivateClient = 7,
+        kDisconnectPort = 8,
+        kSetClientCapabilities = 9,
+        kGetPortConnections = 10,
+        kGetPortNConnections = 11,
+        kReleaseTimebase = 12,
+        kSetTimebaseCallback = 13,
+        kSetBufferSize = 20,
+        kSetFreeWheel = 21,
+        kClientCheck = 22,
+        kClientOpen = 23,
+        kClientClose = 24,
+        kConnectNamePorts = 25,
+        kDisconnectNamePorts = 26,
+        kGetInternalClientName = 27,
+        kInternalClientHandle = 28,
+        kInternalClientLoad = 29,
+        kInternalClientUnload = 30,
+        kPortRename = 31,
+        kNotification = 32
+    };
+
+    RequestType fType;
+
+    JackRequest()
+    {}
+
+    JackRequest(RequestType type): fType(type)
+    {}
+
+    virtual ~JackRequest()
+    {}
+
+    virtual int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fType, sizeof(RequestType));
+    }
+
+    virtual int Write(JackChannelTransaction* trans)
+    {
+        return trans->Write(&fType, sizeof(RequestType));
+    }
+
+};
+
+/*!
+\brief Result from the server.
+*/
+
+struct JackResult
+{
+
+    int	fResult;
+
+    JackResult(): fResult( -1)
+    {}
+    JackResult(int result): fResult(result)
+    {}
+    virtual ~JackResult()
+    {}
+
+    virtual int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fResult, sizeof(int));
+    }
+
+    virtual int Write(JackChannelTransaction* trans)
+    {
+        return trans->Write(&fResult, sizeof(int));
+    }
+    
+};
+
+/*!
+\brief CheckClient request.
+*/
+
+struct JackClientCheckRequest : public JackRequest
+{
+
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+    int fProtocol;
+    int fOptions;
+
+    JackClientCheckRequest()
+    {}
+    JackClientCheckRequest(const char* name, int protocol, int options)
+        : JackRequest(JackRequest::kClientCheck), fProtocol(protocol), fOptions(options)
+    {
+        snprintf(fName, sizeof(fName), "%s", name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fProtocol, sizeof(int)));
+        return trans->Read(&fOptions, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fProtocol, sizeof(int)));
+        return trans->Write(&fOptions, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief CheckClient result.
+*/
+
+struct JackClientCheckResult : public JackResult
+{
+
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+    int fStatus;
+
+    JackClientCheckResult(): JackResult(), fStatus(0)
+    {}
+    JackClientCheckResult(int32_t result, const char* name, int status)
+            : JackResult(result), fStatus(status)
+    {
+        snprintf(fName, sizeof(fName), "%s", name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fStatus, sizeof(int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fStatus, sizeof(int)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief NewClient request.
+*/
+
+struct JackClientOpenRequest : public JackRequest
+{
+
+    int fPID;
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+
+    JackClientOpenRequest()
+    {}
+    JackClientOpenRequest(const char* name, int pid): JackRequest(JackRequest::kClientOpen)
+    {
+        snprintf(fName, sizeof(fName), "%s", name);
+        fPID = pid;
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fPID, sizeof(int)));
+        return trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1);
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fPID, sizeof(int)));
+        return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1);
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief NewClient result.
+*/
+
+struct JackClientOpenResult : public JackResult
+{
+
+    int fSharedEngine;
+    int fSharedClient;
+    int fSharedGraph;
+   
+    JackClientOpenResult()
+            : JackResult(), fSharedEngine(-1), fSharedClient(-1), fSharedGraph(-1)
+    {}
+    JackClientOpenResult(int32_t result, int index1, int index2, int index3)
+            : JackResult(result), fSharedEngine(index1), fSharedClient(index2), fSharedGraph(index3)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        CheckRes(trans->Read(&fSharedEngine, sizeof(int)));
+        CheckRes(trans->Read(&fSharedClient, sizeof(int)));
+        CheckRes(trans->Read(&fSharedGraph, sizeof(int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        CheckRes(trans->Write(&fSharedEngine, sizeof(int)));
+        CheckRes(trans->Write(&fSharedClient, sizeof(int)));
+        CheckRes(trans->Write(&fSharedGraph, sizeof(int)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief CloseClient request.
+*/
+
+struct JackClientCloseRequest : public JackRequest
+{
+
+    int fRefNum;
+
+    JackClientCloseRequest()
+    {}
+    JackClientCloseRequest(int refnum): JackRequest(JackRequest::kClientClose), fRefNum(refnum)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fRefNum, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        return trans->Write(&fRefNum, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Activate request.
+*/
+
+struct JackActivateRequest : public JackRequest
+{
+
+    int fRefNum;
+    int fIsRealTime;
+
+    JackActivateRequest()
+    {}
+    JackActivateRequest(int refnum, int is_real_time)
+        : JackRequest(JackRequest::kActivateClient), fRefNum(refnum), fIsRealTime(is_real_time)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        return trans->Read(&fIsRealTime, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        return trans->Write(&fIsRealTime, sizeof(int));
+    }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief Deactivate request.
+*/
+
+struct JackDeactivateRequest : public JackRequest
+{
+
+    int fRefNum;
+
+    JackDeactivateRequest()
+    {}
+    JackDeactivateRequest(int refnum): JackRequest(JackRequest::kDeactivateClient), fRefNum(refnum)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fRefNum, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        return trans->Write(&fRefNum, sizeof(int));
+    }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortRegister request.
+*/
+
+struct JackPortRegisterRequest : public JackRequest
+{
+
+    int fRefNum;
+    char fName[JACK_PORT_NAME_SIZE + 1];
+    char fPortType[JACK_PORT_TYPE_SIZE + 1];
+    unsigned int fFlags;
+    unsigned int fBufferSize;
+
+    JackPortRegisterRequest()
+    {}
+    JackPortRegisterRequest(int refnum, const char* name, const char* port_type, unsigned int flags, unsigned int buffer_size)
+            : JackRequest(JackRequest::kRegisterPort), fRefNum(refnum), fFlags(flags), fBufferSize(buffer_size)
+    {
+        strcpy(fName, name);
+        strcpy(fPortType, port_type);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fName, JACK_PORT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fPortType, JACK_PORT_TYPE_SIZE + 1));
+        CheckRes(trans->Read(&fFlags, sizeof(unsigned int)));
+        CheckRes(trans->Read(&fBufferSize, sizeof(unsigned int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fName, JACK_PORT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fPortType, JACK_PORT_TYPE_SIZE + 1));
+        CheckRes(trans->Write(&fFlags, sizeof(unsigned int)));
+        CheckRes(trans->Write(&fBufferSize, sizeof(unsigned int)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortRegister result.
+*/
+
+struct JackPortRegisterResult : public JackResult
+{
+
+    jack_port_id_t fPortIndex;
+
+    JackPortRegisterResult(): JackResult(), fPortIndex(NO_PORT)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        return trans->Read(&fPortIndex, sizeof(jack_port_id_t));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        return trans->Write(&fPortIndex, sizeof(jack_port_id_t));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortUnregister request.
+*/
+
+struct JackPortUnRegisterRequest : public JackRequest
+{
+
+    int fRefNum;
+    jack_port_id_t fPortIndex;
+
+    JackPortUnRegisterRequest()
+    {}
+    JackPortUnRegisterRequest(int refnum, jack_port_id_t index)
+        : JackRequest(JackRequest::kUnRegisterPort), fRefNum(refnum), fPortIndex(index)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fPortIndex, sizeof(jack_port_id_t)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fPortIndex, sizeof(jack_port_id_t)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortConnectName request.
+*/
+
+struct JackPortConnectNameRequest : public JackRequest
+{
+
+    int fRefNum;
+    char fSrc[JACK_PORT_NAME_SIZE + 1];
+    char fDst[JACK_PORT_NAME_SIZE + 1];
+
+    JackPortConnectNameRequest()
+    {}
+    JackPortConnectNameRequest(int refnum, const char* src_name, const char* dst_name)
+        : JackRequest(JackRequest::kConnectNamePorts), fRefNum(refnum)
+    {
+        strcpy(fSrc, src_name);
+        strcpy(fDst, dst_name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fSrc, JACK_PORT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fDst, JACK_PORT_NAME_SIZE + 1));
+        return 0;
+
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fSrc, JACK_PORT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fDst, JACK_PORT_NAME_SIZE + 1));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortDisconnectName request.
+*/
+
+struct JackPortDisconnectNameRequest : public JackRequest
+{
+
+    int fRefNum;
+    char fSrc[JACK_PORT_NAME_SIZE + 1];
+    char fDst[JACK_PORT_NAME_SIZE + 1];
+
+    JackPortDisconnectNameRequest()
+    {}
+    JackPortDisconnectNameRequest(int refnum, const char* src_name, const char* dst_name)
+        : JackRequest(JackRequest::kDisconnectNamePorts), fRefNum(refnum)
+    {
+        strcpy(fSrc, src_name);
+        strcpy(fDst, dst_name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fSrc, JACK_PORT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fDst, JACK_PORT_NAME_SIZE + 1));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fSrc, JACK_PORT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fDst, JACK_PORT_NAME_SIZE + 1));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortConnect request.
+*/
+
+struct JackPortConnectRequest : public JackRequest
+{
+
+    int fRefNum;
+    jack_port_id_t fSrc;
+    jack_port_id_t fDst;
+
+    JackPortConnectRequest()
+    {}
+    JackPortConnectRequest(int refnum, jack_port_id_t src, jack_port_id_t dst)
+        : JackRequest(JackRequest::kConnectPorts), fRefNum(refnum), fSrc(src), fDst(dst)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fSrc, sizeof(jack_port_id_t)));
+        CheckRes(trans->Read(&fDst, sizeof(jack_port_id_t)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fSrc, sizeof(jack_port_id_t)));
+        CheckRes(trans->Write(&fDst, sizeof(jack_port_id_t)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortDisconnect request.
+*/
+
+struct JackPortDisconnectRequest : public JackRequest
+{
+
+    int fRefNum;
+    jack_port_id_t fSrc;
+    jack_port_id_t fDst;
+
+    JackPortDisconnectRequest()
+    {}
+    JackPortDisconnectRequest(int refnum, jack_port_id_t src, jack_port_id_t dst)
+        : JackRequest(JackRequest::kDisconnectPorts), fRefNum(refnum), fSrc(src), fDst(dst)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fSrc, sizeof(jack_port_id_t)));
+        CheckRes(trans->Read(&fDst, sizeof(jack_port_id_t)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fSrc, sizeof(jack_port_id_t)));
+        CheckRes(trans->Write(&fDst, sizeof(jack_port_id_t)));
+        return 0;
+
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief PortRename request.
+*/
+
+struct JackPortRenameRequest : public JackRequest
+{
+
+    int fRefNum;
+    jack_port_id_t fPort;
+    char fName[JACK_PORT_NAME_SIZE + 1];
+
+    JackPortRenameRequest()
+    {}
+    JackPortRenameRequest(int refnum, jack_port_id_t port, const char* name)
+        : JackRequest(JackRequest::kPortRename), fRefNum(refnum), fPort(port)
+    {
+        strcpy(fName, name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fPort, sizeof(jack_port_id_t)));
+        CheckRes(trans->Read(&fName, JACK_PORT_NAME_SIZE + 1));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fPort, sizeof(jack_port_id_t)));
+        CheckRes(trans->Write(&fName, JACK_PORT_NAME_SIZE + 1));
+        return 0;
+
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief SetBufferSize request.
+*/
+
+struct JackSetBufferSizeRequest : public JackRequest
+{
+
+    jack_nframes_t fBufferSize;
+
+    JackSetBufferSizeRequest()
+    {}
+    JackSetBufferSizeRequest(jack_nframes_t buffer_size)
+        : JackRequest(JackRequest::kSetBufferSize), fBufferSize(buffer_size)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fBufferSize, sizeof(jack_nframes_t));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        return trans->Write(&fBufferSize, sizeof(jack_nframes_t));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief SetFreeWheel request.
+*/
+
+struct JackSetFreeWheelRequest : public JackRequest
+{
+
+    int fOnOff;
+
+    JackSetFreeWheelRequest()
+    {}
+    JackSetFreeWheelRequest(int onoff)
+        : JackRequest(JackRequest::kSetFreeWheel), fOnOff(onoff)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fOnOff, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        return trans->Write(&fOnOff, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief ReleaseTimebase request.
+*/
+
+struct JackReleaseTimebaseRequest : public JackRequest
+{
+
+    int fRefNum;
+
+    JackReleaseTimebaseRequest()
+    {}
+    JackReleaseTimebaseRequest(int refnum)
+        : JackRequest(JackRequest::kReleaseTimebase), fRefNum(refnum)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        return trans->Read(&fRefNum, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        return trans->Write(&fRefNum, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief SetTimebaseCallback request.
+*/
+
+struct JackSetTimebaseCallbackRequest : public JackRequest
+{
+
+    int fRefNum;
+    int fConditionnal;
+
+    JackSetTimebaseCallbackRequest()
+    {}
+    JackSetTimebaseCallbackRequest(int refnum, int conditional)
+        : JackRequest(JackRequest::kSetTimebaseCallback), fRefNum(refnum), fConditionnal(conditional)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        return trans->Read(&fConditionnal, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        return trans->Write(&fConditionnal, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief GetInternalClientName request.
+*/
+
+struct JackGetInternalClientNameRequest : public JackRequest
+{
+
+    int fRefNum;
+    int fIntRefNum;
+
+    JackGetInternalClientNameRequest()
+    {}
+    JackGetInternalClientNameRequest(int refnum, int int_ref)
+            : JackRequest(JackRequest::kGetInternalClientName), fRefNum(refnum), fIntRefNum(int_ref)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        return trans->Read(&fIntRefNum, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        return trans->Write(&fIntRefNum, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief GetInternalClient result.
+*/
+
+struct JackGetInternalClientNameResult : public JackResult
+{
+
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+
+    JackGetInternalClientNameResult(): JackResult()
+    {}
+    JackGetInternalClientNameResult(int32_t result, const char* name)
+            : JackResult(result)
+    {
+        snprintf(fName, sizeof(fName), "%s", name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief InternalClientHandle request.
+*/
+
+struct JackInternalClientHandleRequest : public JackRequest
+{
+
+    int fRefNum;
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+
+    JackInternalClientHandleRequest()
+    {}
+    JackInternalClientHandleRequest(int refnum, const char* client_name)
+            : JackRequest(JackRequest::kInternalClientHandle), fRefNum(refnum)
+    {
+        snprintf(fName, sizeof(fName), "%s", client_name);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        return trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1);
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1);
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief InternalClientHandle result.
+*/
+
+struct JackInternalClientHandleResult : public JackResult
+{
+
+    int fStatus;
+    int fIntRefNum;
+
+    JackInternalClientHandleResult(): JackResult()
+    {}
+    JackInternalClientHandleResult(int32_t result, int status, int int_ref)
+            : JackResult(result), fStatus(status), fIntRefNum(int_ref)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        CheckRes(trans->Read(&fStatus, sizeof(int)));
+        CheckRes(trans->Read(&fIntRefNum, sizeof(int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        CheckRes(trans->Write(&fStatus, sizeof(int)));
+        CheckRes(trans->Write(&fIntRefNum, sizeof(int)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief InternalClientLoad request.
+*/
+
+struct JackInternalClientLoadRequest : public JackRequest
+{
+
+#ifndef MAX_PATH
+#define MAX_PATH 256
+#endif
+
+    int fRefNum;
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+    char fDllName[MAX_PATH + 1];
+    char fLoadInitName[JACK_LOAD_INIT_LIMIT + 1];
+    int fOptions;
+
+    JackInternalClientLoadRequest()
+    {}
+    JackInternalClientLoadRequest(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options)
+            : JackRequest(JackRequest::kInternalClientLoad), fRefNum(refnum), fOptions(options)
+    {
+        snprintf(fName, sizeof(fName), "%s", client_name);
+        snprintf(fDllName, sizeof(fDllName), "%s", so_name);
+        snprintf(fLoadInitName, sizeof(fLoadInitName), "%s", objet_data);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fDllName, MAX_PATH + 1));
+        CheckRes(trans->Read(&fLoadInitName, JACK_LOAD_INIT_LIMIT + 1));
+        return trans->Read(&fOptions, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fDllName, MAX_PATH + 1));
+        CheckRes(trans->Write(&fLoadInitName, JACK_LOAD_INIT_LIMIT + 1));
+        return trans->Write(&fOptions, sizeof(int));
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief InternalClientLoad result.
+*/
+
+struct JackInternalClientLoadResult : public JackResult
+{
+
+    int fStatus;
+    int fIntRefNum;
+
+    JackInternalClientLoadResult(): JackResult()
+    {}
+    JackInternalClientLoadResult(int32_t result, int status, int int_ref)
+            : JackResult(result), fStatus(status), fIntRefNum(int_ref)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        CheckRes(trans->Read(&fStatus, sizeof(int)));
+        CheckRes(trans->Read(&fIntRefNum, sizeof(int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        CheckRes(trans->Write(&fStatus, sizeof(int)));
+        CheckRes(trans->Write(&fIntRefNum, sizeof(int)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief InternalClientUnload request.
+*/
+
+struct JackInternalClientUnloadRequest : public JackRequest
+{
+
+    int fRefNum;
+    int fIntRefNum;
+
+    JackInternalClientUnloadRequest()
+    {}
+    JackInternalClientUnloadRequest(int refnum, int int_ref)
+            : JackRequest(JackRequest::kInternalClientUnload), fRefNum(refnum), fIntRefNum(int_ref)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        return trans->Read(&fIntRefNum, sizeof(int));
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        return trans->Write(&fIntRefNum, sizeof(int));
+    }
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief InternalClientLoad result.
+*/
+
+struct JackInternalClientUnloadResult : public JackResult
+{
+
+    int fStatus;
+
+    JackInternalClientUnloadResult(): JackResult()
+    {}
+    JackInternalClientUnloadResult(int32_t result, int status)
+            : JackResult(result), fStatus(status)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Read(trans));
+        CheckRes(trans->Read(&fStatus, sizeof(int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackResult::Write(trans));
+        CheckRes(trans->Write(&fStatus, sizeof(int)));
+        return 0;
+    }
+    
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief ClientNotification request.
+*/
+
+struct JackClientNotificationRequest : public JackRequest
+{
+
+    int fRefNum;
+    int fNotify;
+    int fValue;
+
+    JackClientNotificationRequest()
+    {}
+    JackClientNotificationRequest(int refnum, int notify, int value)
+            : JackRequest(JackRequest::kNotification), fRefNum(refnum), fNotify(notify), fValue(value)
+    {}
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fNotify, sizeof(int)));
+        CheckRes(trans->Read(&fValue, sizeof(int)));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(JackRequest::Write(trans));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fNotify, sizeof(int)));
+        CheckRes(trans->Write(&fValue, sizeof(int)));
+        return 0;
+    }
+
+} POST_PACKED_STRUCTURE;
+
+/*!
+\brief ClientNotification.
+*/
+
+struct JackClientNotification
+{
+    char fName[JACK_CLIENT_NAME_SIZE + 1];
+    int fRefNum;
+    int fNotify;
+    int fValue1;
+    int fValue2;
+    int fSync;
+    char fMessage[JACK_MESSAGE_SIZE + 1];
+
+    JackClientNotification(): fNotify(-1), fValue1(-1), fValue2(-1)
+    {}
+    JackClientNotification(const char* name, int refnum, int notify, int sync, const char* message, int value1, int value2)
+            : fRefNum(refnum), fNotify(notify), fValue1(value1), fValue2(value2), fSync(sync)
+    {
+        snprintf(fName, sizeof(fName), "%s", name);
+        snprintf(fMessage, sizeof(fMessage), "%s", message);
+    }
+
+    int Read(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Read(&fRefNum, sizeof(int)));
+        CheckRes(trans->Read(&fNotify, sizeof(int)));
+        CheckRes(trans->Read(&fValue1, sizeof(int)));
+        CheckRes(trans->Read(&fValue2, sizeof(int)));
+        CheckRes(trans->Read(&fSync, sizeof(int)));
+        CheckRes(trans->Read(&fMessage, JACK_MESSAGE_SIZE + 1));
+        return 0;
+    }
+
+    int Write(JackChannelTransaction* trans)
+    {
+        CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
+        CheckRes(trans->Write(&fRefNum, sizeof(int)));
+        CheckRes(trans->Write(&fNotify, sizeof(int)));
+        CheckRes(trans->Write(&fValue1, sizeof(int)));
+        CheckRes(trans->Write(&fValue2, sizeof(int)));
+        CheckRes(trans->Write(&fSync, sizeof(int)));
+        CheckRes(trans->Write(&fMessage, JACK_MESSAGE_SIZE + 1));
+        return 0;
+    }
+
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+#endif
diff --git a/common/JackResampler.cpp b/common/JackResampler.cpp
new file mode 100644
index 0000000..fb1793d
--- /dev/null
+++ b/common/JackResampler.cpp
@@ -0,0 +1,94 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackResampler.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+JackResampler::JackResampler()
+    :fRatio(1),fRingBufferSize(DEFAULT_RB_SIZE)
+{
+    fRingBuffer = jack_ringbuffer_create(sizeof(float) * fRingBufferSize);
+    jack_ringbuffer_read_advance(fRingBuffer, (sizeof(float) * fRingBufferSize) / 2);
+}
+
+JackResampler::~JackResampler()
+{
+    if (fRingBuffer)
+        jack_ringbuffer_free(fRingBuffer);
+}
+
+void JackResampler::Reset(unsigned int new_size)
+{
+    fRingBufferSize = new_size;
+    jack_ringbuffer_reset_size(fRingBuffer, sizeof(float) * fRingBufferSize);
+    jack_ringbuffer_read_advance(fRingBuffer, (sizeof(float) * fRingBufferSize / 2));
+}
+
+unsigned int JackResampler::ReadSpace()
+{
+    return (jack_ringbuffer_read_space(fRingBuffer) / sizeof(float));
+}
+
+unsigned int JackResampler::WriteSpace()
+{
+    return (jack_ringbuffer_write_space(fRingBuffer) / sizeof(float));
+}
+
+unsigned int JackResampler::Read(float* buffer, unsigned int frames)
+{
+    size_t len = jack_ringbuffer_read_space(fRingBuffer);
+    jack_log("JackResampler::Read input available = %ld", len / sizeof(float));
+        
+    if (len < frames * sizeof(float)) {
+        jack_error("JackResampler::Read : producer too slow, missing frames = %d", frames);
+        return 0;
+    } else {
+        jack_ringbuffer_read(fRingBuffer, (char*)buffer, frames * sizeof(float));
+        return frames;
+    }
+}
+
+unsigned int JackResampler::Write(float* buffer, unsigned int frames)
+{
+    size_t len = jack_ringbuffer_write_space(fRingBuffer);
+    jack_log("JackResampler::Write output available = %ld", len / sizeof(float));
+        
+    if (len < frames * sizeof(float)) {
+        jack_error("JackResampler::Write : consumer too slow, skip frames = %d", frames);
+        return 0;
+    } else {
+        jack_ringbuffer_write(fRingBuffer, (char*)buffer, frames * sizeof(float));
+        return frames;
+    }
+}
+
+unsigned int JackResampler::ReadResample(float* buffer, unsigned int frames)
+{
+    return Read(buffer, frames);
+}
+
+unsigned int JackResampler::WriteResample(float* buffer, unsigned int frames)
+{
+    return Write(buffer, frames);
+}
+
+}
diff --git a/common/JackResampler.h b/common/JackResampler.h
new file mode 100644
index 0000000..521f513
--- /dev/null
+++ b/common/JackResampler.h
@@ -0,0 +1,84 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackResampler__
+#define __JackResampler__
+
+#include "ringbuffer.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+#define DEFAULT_RB_SIZE 32768
+#define DEFAULT_ADAPTATIVE_SIZE 2048		
+
+inline float Range(float min, float max, float val)
+{
+    return (val < min) ? min : ((val > max) ? max : val);
+}
+    
+/*!
+\brief Base class for Resampler.
+*/
+
+class JackResampler
+{
+
+    protected:
+    
+        jack_ringbuffer_t* fRingBuffer;
+        double fRatio;
+        unsigned int fRingBufferSize;
+       
+    public:
+    
+        JackResampler();
+        virtual ~JackResampler();
+        
+        virtual void Reset(unsigned int new_size);
+        
+        virtual unsigned int ReadResample(float* buffer, unsigned int frames);
+        virtual unsigned int WriteResample(float* buffer, unsigned int frames);
+        
+        virtual unsigned int Read(float* buffer, unsigned int frames);
+        virtual unsigned int Write(float* buffer, unsigned int frames);
+        
+        virtual unsigned int ReadSpace();
+        virtual unsigned int WriteSpace();
+        
+        unsigned int GetError()
+        {
+            return (jack_ringbuffer_read_space(fRingBuffer) / sizeof(float)) - (fRingBufferSize / 2);
+        }
+
+        void SetRatio(double ratio)
+        {
+            fRatio = Range(0.25, 4.0, ratio);
+        }
+        
+        double GetRatio()
+        {
+            return fRatio;
+        }
+ 
+    };
+}
+
+#endif
diff --git a/common/JackRestartThreadedDriver.cpp b/common/JackRestartThreadedDriver.cpp
new file mode 100644
index 0000000..faf9eb3
--- /dev/null
+++ b/common/JackRestartThreadedDriver.cpp
@@ -0,0 +1,52 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackRestartThreadedDriver.h"
+#include "JackException.h"
+
+namespace Jack
+{
+
+bool JackRestartThreadedDriver::Execute()
+{
+    try {
+        // Keep running even in case of error
+        while (fThread.GetStatus() == JackThread::kRunning) {
+            Process();
+        }
+        return false;
+    } catch (JackNetException& e) {
+        e.PrintMessage();
+        jack_log("Driver is restarted");
+        fThread.DropSelfRealTime();
+        // Thread in kIniting status again...
+        fThread.SetStatus(JackThread::kIniting);
+        if (Init()) {
+            // Thread in kRunning status again...
+            fThread.SetStatus(JackThread::kRunning);
+            return true;
+        } else {
+            return false;
+        }
+    }
+}
+
+} // end of namespace
diff --git a/common/JackRestartThreadedDriver.h b/common/JackRestartThreadedDriver.h
new file mode 100644
index 0000000..eb9846b
--- /dev/null
+++ b/common/JackRestartThreadedDriver.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackRestartThreadedDriver__
+#define __JackRestartThreadedDriver__
+
+#include "JackThreadedDriver.h"
+
+namespace Jack
+{
+
+/*!
+\brief Restart a driver after an exception is thrown. 
+*/
+
+class SERVER_EXPORT JackRestartThreadedDriver : public JackThreadedDriver
+{
+    public:
+
+        JackRestartThreadedDriver(JackDriver* driver)
+            :JackThreadedDriver(driver)
+        {}
+        virtual ~JackRestartThreadedDriver()
+        {}
+
+        // JackRunnableInterface interface
+        virtual bool Execute();
+};
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackServer.cpp b/common/JackServer.cpp
new file mode 100644
index 0000000..e267650
--- /dev/null
+++ b/common/JackServer.cpp
@@ -0,0 +1,389 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackServerGlobals.h"
+#include "JackTime.h"
+#include "JackFreewheelDriver.h"
+#include "JackDummyDriver.h"
+#include "JackThreadedDriver.h"
+#include "JackGlobals.h"
+#include "JackLockedEngine.h"
+#include "JackAudioDriver.h"
+#include "JackChannel.h"
+#include "JackClientControl.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackInternalClient.h"
+#include "JackError.h"
+#include "JackMessageBuffer.h"
+
+namespace Jack
+{
+
+JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, const char* server_name)
+{
+    if (rt) {
+        jack_info("JACK server starting in realtime mode with priority %ld", priority);
+    } else {
+        jack_info("JACK server starting in non-realtime mode");
+    }
+    
+    fGraphManager = JackGraphManager::Allocate(port_max);
+    fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, clock, server_name);
+    fEngine = new JackLockedEngine(fGraphManager, GetSynchroTable(), fEngineControl);
+    fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver(fEngine, GetSynchroTable()));
+    fDriverInfo = new JackDriverInfo();
+    fAudioDriver = NULL;
+    fFreewheel = false;
+    JackServerGlobals::fInstance = this;   // Unique instance
+    JackServerGlobals::fUserCount = 1;     // One user
+    JackGlobals::fVerbose = verbose;
+}
+
+JackServer::~JackServer()
+{
+    JackGraphManager::Destroy(fGraphManager);
+    delete fAudioDriver;
+    delete fDriverInfo;
+    delete fFreewheelDriver;
+    delete fEngine;
+    delete fEngineControl;
+}
+
+int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params)
+{
+    // TODO: move that in reworked JackServerGlobals::Init()
+    JackMessageBuffer::Create();
+  
+    if (fChannel.Open(fEngineControl->fServerName, this) < 0) {
+        jack_error("Server channel open error");
+        goto fail_close1;
+    }
+  
+    if (fEngine->Open() < 0) {
+        jack_error("Cannot open engine");
+        goto fail_close2;
+    }
+
+    if ((fAudioDriver = fDriverInfo->Open(driver_desc, fEngine, GetSynchroTable(), driver_params)) == NULL) {
+        jack_error("Cannot initialize driver");
+        goto fail_close3;
+    }
+ 
+    if (fFreewheelDriver->Open() < 0) { // before engine open
+        jack_error("Cannot open driver");
+        goto fail_close4;
+    }
+ 
+    if (fAudioDriver->Attach() < 0) {
+        jack_error("Cannot attach audio driver");
+        goto fail_close5;
+    }
+   
+    fFreewheelDriver->SetMaster(false);
+    fAudioDriver->SetMaster(true);
+    fAudioDriver->AddSlave(fFreewheelDriver); // After ???
+    InitTime();
+    SetClockSource(fEngineControl->fClockSource);
+    return 0;
+
+fail_close5:
+    fFreewheelDriver->Close();
+
+fail_close4:
+    fAudioDriver->Close();
+
+fail_close3:
+    fEngine->Close();
+ 
+fail_close2:     
+    fChannel.Close();
+
+fail_close1:     
+    JackMessageBuffer::Destroy();
+    return -1;
+}
+
+int JackServer::Close()
+{
+    jack_log("JackServer::Close");
+    fEngine->NotifyQuit();
+    fChannel.Close();
+    fAudioDriver->Detach();
+    fAudioDriver->Close();
+    fFreewheelDriver->Close();
+    fEngine->Close();
+    // TODO: move that in reworked JackServerGlobals::Destroy()
+    JackMessageBuffer::Destroy();
+    return 0;
+}
+
+int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int* status)
+{
+    JackLoadableInternalClient* client = new JackLoadableInternalClient1(JackServerGlobals::fInstance, GetSynchroTable(), objet_data);
+    assert(client);
+    return InternalClientLoadAux(client, so_name, client_name, options, int_ref, status);
+ }
+
+int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int* status)
+{
+    JackLoadableInternalClient* client = new JackLoadableInternalClient2(JackServerGlobals::fInstance, GetSynchroTable(), parameters);
+    assert(client);
+    return InternalClientLoadAux(client, so_name, client_name, options, int_ref, status);
+}
+
+int JackServer::InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int* status)
+{
+    // Clear status
+    *status = 0;
+    if ((client->Init(so_name) < 0) || (client->Open(JACK_DEFAULT_SERVER_NAME, client_name, (jack_options_t)options, (jack_status_t*)status) < 0)) {
+        delete client;
+        int my_status1 = *status | JackFailure;
+        *status = (jack_status_t)my_status1;
+        *int_ref = 0;
+        return -1;
+    } else {
+        *int_ref = client->GetClientControl()->fRefNum;
+        return 0;
+    }
+ }
+
+int JackServer::Start()
+{
+    jack_log("JackServer::Start");
+    if (fAudioDriver->Start() < 0) {
+        return -1;
+    }
+    return fChannel.Start();
+}
+
+int JackServer::Stop()
+{
+    jack_log("JackServer::Stop");
+    return fAudioDriver->Stop();
+}
+
+int JackServer::SetBufferSize(jack_nframes_t buffer_size)
+{
+    jack_log("JackServer::SetBufferSize nframes = %ld", buffer_size);
+    jack_nframes_t current_buffer_size = fEngineControl->fBufferSize;
+
+    if (current_buffer_size == buffer_size) {
+        jack_log("SetBufferSize: requirement for new buffer size equals current value");
+        return 0;
+    }
+    
+    if (fAudioDriver->IsFixedBufferSize()) {
+        jack_log("SetBufferSize: driver only supports a fixed buffer size");
+        return -1;
+    }
+
+    if (fAudioDriver->Stop() != 0) {
+        jack_error("Cannot stop audio driver");
+        return -1;
+    }
+
+    if (fAudioDriver->SetBufferSize(buffer_size) == 0) {
+        fFreewheelDriver->SetBufferSize(buffer_size);
+        fEngine->NotifyBufferSize(buffer_size);
+        return fAudioDriver->Start();
+    } else { // Failure: try to restore current value
+        jack_error("Cannot SetBufferSize for audio driver, restore current value %ld", current_buffer_size);
+        fAudioDriver->SetBufferSize(current_buffer_size);
+        fFreewheelDriver->SetBufferSize(current_buffer_size);
+        fAudioDriver->Start();
+        // SetBufferSize actually failed, so return an error...
+        return -1;
+    }
+}
+
+/*
+Freewheel mode is implemented by switching from the (audio + freewheel) driver to the freewheel driver only:
+
+    - "global" connection state is saved
+    - all audio driver ports are deconnected, thus there is no more dependancies with the audio driver
+    - the freewheel driver will be synchronized with the end of graph execution : all clients are connected to the freewheel driver
+    - the freewheel driver becomes the "master"
+
+Normal mode is restored with the connections state valid before freewheel mode was done. Thus one consider that
+no graph state change can be done during freewheel mode.
+*/
+
+int JackServer::SetFreewheel(bool onoff)
+{
+    jack_log("JackServer::SetFreewheel is = %ld want = %ld", fFreewheel, onoff);
+
+    if (fFreewheel) {
+        if (onoff) {
+            return -1;
+        } else {
+            fFreewheel = false;
+            fFreewheelDriver->Stop();
+            fGraphManager->Restore(&fConnectionState);   // Restore previous connection state
+            fEngine->NotifyFreewheel(onoff);
+            fFreewheelDriver->SetMaster(false);
+            return fAudioDriver->Start();
+        }
+    } else {
+        if (onoff) {
+            fFreewheel = true;
+            fAudioDriver->Stop();
+            fGraphManager->Save(&fConnectionState);     // Save connection state
+            fGraphManager->DisconnectAllPorts(fAudioDriver->GetClientControl()->fRefNum);
+            fEngine->NotifyFreewheel(onoff);
+            fFreewheelDriver->SetMaster(true);
+            return fFreewheelDriver->Start();
+        } else {
+            return -1;
+        }
+    }
+}
+
+// Coming from the RT thread
+void JackServer::Notify(int refnum, int notify, int value)
+{
+    switch (notify) {
+
+        case kGraphOrderCallback:
+            fEngine->NotifyGraphReorder();
+            break;
+
+        case kXRunCallback:
+            fEngine->NotifyXRun(refnum);
+            break;
+
+    }
+}
+
+void JackServer::ClientKill(int refnum)
+{
+    jack_log("JackServer::ClientKill ref = %ld", refnum);
+    if (fEngine->ClientDeactivate(refnum) < 0) {
+        jack_error("JackServer::ClientKill ref = %ld cannot be removed from the graph !!", refnum);
+    }
+    if (fEngine->ClientExternalClose(refnum) < 0) {
+        jack_error("JackServer::ClientKill ref = %ld cannot be closed", refnum);
+    }
+}
+
+//----------------------
+// Backend management
+//----------------------
+
+JackDriverInfo* JackServer::AddSlave(jack_driver_desc_t* driver_desc, JSList* driver_params)
+{
+    JackDriverInfo* info = new JackDriverInfo();
+    JackDriverClientInterface* slave = info->Open(driver_desc, fEngine, GetSynchroTable(), driver_params);
+    if (slave == NULL) {
+        delete info;
+        return NULL;
+    } else {
+        slave->Attach();
+        fAudioDriver->AddSlave(slave);
+        return info;
+    }
+}
+
+void JackServer::RemoveSlave(JackDriverInfo* info)
+{
+    JackDriverClientInterface* slave = info->GetBackend();
+    fAudioDriver->RemoveSlave(slave);
+    slave->Detach();
+    slave->Close();
+}
+
+int JackServer::SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params)
+{
+    /// Remove current master
+    fAudioDriver->Stop();
+    fAudioDriver->Detach();
+    fAudioDriver->Close();
+    
+    // Open new master
+    JackDriverInfo* info = new JackDriverInfo();
+    JackDriverClientInterface* master = info->Open(driver_desc, fEngine, GetSynchroTable(), driver_params);
+    
+    if (master == NULL || info == NULL) {
+        delete info;
+        delete master;
+        return -1;
+    } else {
+    
+        // Get slaves list
+        std::list<JackDriverInterface*> slave_list = fAudioDriver->GetSlaves();
+        std::list<JackDriverInterface*>::const_iterator it;
+        
+        // Move slaves in new master
+        for (it = slave_list.begin(); it != slave_list.end(); it++) {
+            JackDriverInterface* slave = *it;
+            master->AddSlave(slave);
+        }
+    
+        // Delete old master
+        delete fAudioDriver;
+        delete fDriverInfo;
+         
+        // Activate master
+        fAudioDriver = master;
+        fDriverInfo = info;
+        fAudioDriver->Attach();
+        fAudioDriver->SetMaster(true);
+        return fAudioDriver->Start();        
+    }
+}
+
+//----------------------
+// Transport management
+//----------------------
+
+int JackServer::ReleaseTimebase(int refnum)
+{
+    return fEngineControl->fTransport.ResetTimebase(refnum);
+}
+
+int JackServer::SetTimebaseCallback(int refnum, int conditional)
+{
+    return fEngineControl->fTransport.SetTimebaseMaster(refnum, conditional);
+}
+
+JackLockedEngine* JackServer::GetEngine()
+{
+    return fEngine;
+}
+
+JackSynchro* JackServer::GetSynchroTable()
+{
+    return fSynchroTable;
+}
+
+JackEngineControl* JackServer::GetEngineControl()
+{
+    return fEngineControl;
+}
+
+JackGraphManager* JackServer::GetGraphManager()
+{
+    return fGraphManager;
+}
+
+
+} // end of namespace
+
diff --git a/common/JackServer.h b/common/JackServer.h
new file mode 100644
index 0000000..f99d7c2
--- /dev/null
+++ b/common/JackServer.h
@@ -0,0 +1,104 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackServer__
+#define __JackServer__
+
+#include "JackCompilerDeps.h"
+#include "driver_interface.h"
+#include "JackDriverLoader.h"
+#include "JackConnectionManager.h"
+#include "JackGlobals.h"
+#include "JackPlatformPlug.h"
+#include "jslist.h"
+
+namespace Jack
+{
+
+class JackGraphManager;
+class JackDriverClientInterface;
+struct JackEngineControl;
+class JackLockedEngine;
+class JackLoadableInternalClient;
+
+/*!
+\brief The Jack server.
+*/
+
+class SERVER_EXPORT JackServer
+{
+
+    private:
+
+        JackDriverInfo* fDriverInfo;
+        JackDriverClientInterface* fAudioDriver;
+        JackDriverClientInterface* fFreewheelDriver;
+        JackLockedEngine* fEngine;
+        JackEngineControl* fEngineControl;
+        JackGraphManager* fGraphManager;
+        JackServerChannel fChannel;
+        JackConnectionManager fConnectionState;
+        JackSynchro fSynchroTable[CLIENT_NUM];
+        bool fFreewheel;
+        
+        int InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int* status);
+
+    public:
+
+        JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, const char* server_name);
+        ~JackServer();
+
+        int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);
+        int Close();
+
+        int Start();
+        int Stop();
+
+        // RT thread
+        void Notify(int refnum, int notify, int value);
+
+        // Command thread : API
+        int SetBufferSize(jack_nframes_t buffer_size);
+        int SetFreewheel(bool onoff);
+        int InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int* status);
+        int InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int* status);
+        void ClientKill(int refnum);
+
+        // Transport management
+        int ReleaseTimebase(int refnum);
+        int SetTimebaseCallback(int refnum, int conditional);
+        
+        // Backend management
+        JackDriverInfo* AddSlave(jack_driver_desc_t* driver_desc, JSList* driver_params);
+        void RemoveSlave(JackDriverInfo* info);
+        int SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params);
+ 
+        // Object access
+        JackLockedEngine* GetEngine();
+        JackEngineControl* GetEngineControl();
+        JackSynchro* GetSynchroTable();
+        JackGraphManager* GetGraphManager();
+
+};
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackServerAPI.cpp b/common/JackServerAPI.cpp
new file mode 100644
index 0000000..a9755fe
--- /dev/null
+++ b/common/JackServerAPI.cpp
@@ -0,0 +1,157 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackGraphManager.h"
+#include "JackInternalClient.h"
+#include "JackServer.h"
+#include "JackDebugClient.h"
+#include "JackServerGlobals.h"
+#include "JackTools.h"
+#include "JackCompilerDeps.h"
+#include "JackLockedEngine.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, va_list ap);
+    EXPORT jack_client_t * jack_client_open (const char *client_name,
+            jack_options_t options,
+            jack_status_t *status, ...);
+    EXPORT int jack_client_close (jack_client_t *client);
+    EXPORT int jack_get_client_pid (const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+using namespace Jack;
+
+EXPORT jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
+{
+    jack_varargs_t va;		/* variable arguments */
+    jack_status_t my_status;
+    JackClient* client;
+
+    if (client_name == NULL) {
+        jack_error("jack_client_open called with a NULL client_name");
+        return NULL;
+    }
+
+    jack_log("jack_client_open %s", client_name);
+ 
+    if (status == NULL)			/* no status from caller? */
+        status = &my_status;	/* use local status word */
+    *status = (jack_status_t)0;
+
+    /* validate parameters */
+    if ((options & ~JackOpenOptions)) {
+        int my_status1 = *status | (JackFailure | JackInvalidOption);
+        *status = (jack_status_t)my_status1;
+        return NULL;
+    }
+
+    /* parse variable arguments */
+    if (ap) {
+        jack_varargs_parse(options, ap, &va);
+    } else {
+        jack_varargs_init(&va);
+    }
+
+    if (!JackServerGlobals::Init()) { // jack server initialisation
+        int my_status1 = (JackFailure | JackServerError);
+        *status = (jack_status_t)my_status1;
+        return NULL;
+    }
+ 
+    if (JACK_DEBUG) {
+        client = new JackDebugClient(new JackInternalClient(JackServerGlobals::fInstance, GetSynchroTable())); // Debug mode
+    } else {
+        client = new JackInternalClient(JackServerGlobals::fInstance, GetSynchroTable());
+    }
+
+    int res = client->Open(va.server_name, client_name, options, status);
+    if (res < 0) {
+        delete client;
+        JackServerGlobals::Destroy(); // jack server destruction
+        int my_status1 = (JackFailure | JackServerError);
+        *status = (jack_status_t)my_status1;
+        return NULL;
+    } else {
+        return (jack_client_t*)client;
+    }
+}
+
+EXPORT jack_client_t* jack_client_open(const char* ext_client_name, jack_options_t options, jack_status_t* status, ...)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_open");
+#endif
+    try {
+        assert(JackGlobals::fOpenMutex);
+        JackGlobals::fOpenMutex->Lock();
+        va_list ap;
+        va_start(ap, status);
+        jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap);
+        va_end(ap);
+        JackGlobals::fOpenMutex->Unlock();
+        return res;
+    } catch(std::bad_alloc& e) {
+        jack_error("Memory allocation error...");
+        return NULL;
+    } catch (...) {
+        jack_error("Unknown error...");
+        return NULL;
+    }
+}
+
+EXPORT int jack_client_close(jack_client_t* ext_client)
+{
+#ifdef __CLIENTDEBUG__
+    JackGlobals::CheckContext("jack_client_close");
+#endif    
+    assert(JackGlobals::fOpenMutex);
+    JackGlobals::fOpenMutex->Lock();
+    int res = -1;
+    jack_log("jack_client_close");
+    JackClient* client = (JackClient*)ext_client;
+    if (client == NULL) {
+        jack_error("jack_client_close called with a NULL client");
+    } else {
+        res = client->Close();
+        delete client;
+        JackServerGlobals::Destroy();	// jack server destruction
+        jack_log("jack_client_close res = %d", res);
+    }
+    JackGlobals::fOpenMutex->Unlock();
+    return res;
+}
+
+EXPORT int jack_get_client_pid(const char *name)
+{
+    return (JackServerGlobals::fInstance != NULL) 
+        ? JackServerGlobals::fInstance->GetEngine()->GetClientPID(name)
+        : 0;
+}
+
diff --git a/common/JackServerGlobals.cpp b/common/JackServerGlobals.cpp
new file mode 100644
index 0000000..fcad0a7
--- /dev/null
+++ b/common/JackServerGlobals.cpp
@@ -0,0 +1,331 @@
+/*
+Copyright (C) 2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackServerGlobals.h"
+#include "JackTools.h"
+#include "shm.h"
+#include <getopt.h>
+#include <errno.h>
+
+static char* server_name = NULL;
+
+namespace Jack
+{
+
+JackServer* JackServerGlobals::fInstance; 
+unsigned int JackServerGlobals::fUserCount;
+bool (* JackServerGlobals::on_device_acquire)(const char * device_name) = NULL;
+void (* JackServerGlobals::on_device_release)(const char * device_name) = NULL;
+
+int JackServerGlobals::Start(const char* server_name,
+                             jack_driver_desc_t* driver_desc,
+                             JSList* driver_params,
+                             int sync,
+                             int temporary,
+                             int time_out_ms,
+                             int rt,
+                             int priority,
+                             int port_max,
+                             int verbose,
+                            jack_timer_type_t clock)
+{
+    jack_log("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld ", sync, time_out_ms, rt, priority, verbose);
+    new JackServer(sync, temporary, time_out_ms, rt, priority, port_max, verbose, clock, server_name);  // Will setup fInstance and fUserCount globals
+    int res = fInstance->Open(driver_desc, driver_params);
+    return (res < 0) ? res : fInstance->Start();
+}
+
+void JackServerGlobals::Stop()
+{
+    jack_log("Jackdmp: server close");
+    fInstance->Stop();
+    fInstance->Close();
+}
+
+void JackServerGlobals::Delete()
+{
+    jack_log("Jackdmp: delete server");
+    delete fInstance;
+    fInstance = NULL;
+}
+
+bool JackServerGlobals::Init()
+{
+    int realtime = 0;
+    int client_timeout = 0; /* msecs; if zero, use period size. */
+    int realtime_priority = 10;
+    int verbose_aux = 0;
+    int do_mlock = 1;
+    unsigned int port_max = 128;
+    int do_unlock = 0;
+    int temporary = 0;
+
+    int opt = 0;
+    int option_index = 0;
+    int seen_driver = 0;
+    char *driver_name = NULL;
+    char **driver_args = NULL;
+    JSList* driver_params = NULL;
+    int driver_nargs = 1;
+    JSList* drivers = NULL;
+    int show_version = 0;
+    int sync = 0;
+    int rc, i;
+    int ret;
+
+    FILE* fp = 0;
+    char filename[255];
+    char buffer[255];
+    int argc = 0;
+    char* argv[32];
+    jack_timer_type_t clock_source = JACK_TIMER_SYSTEM_CLOCK;
+    
+    // First user starts the server
+    if (fUserCount++ == 0) {
+
+        jack_log("JackServerGlobals Init");
+
+        jack_driver_desc_t* driver_desc;
+        const char *options = "-ad:P:uvshVRL:STFl:t:mn:p:c:";
+        static struct option long_options[] = {
+                                                  { "clock-source", 1, 0, 'c' },
+                                                  { "driver", 1, 0, 'd' },
+                                                  { "verbose", 0, 0, 'v' },
+                                                  { "help", 0, 0, 'h' },
+                                                  { "port-max", 1, 0, 'p' },
+                                                  { "no-mlock", 0, 0, 'm' },
+                                                  { "name", 0, 0, 'n' },
+                                                  { "unlock", 0, 0, 'u' },
+                                                  { "realtime", 0, 0, 'R' },
+                                                  { "realtime-priority", 1, 0, 'P' },
+                                                  { "timeout", 1, 0, 't' },
+                                                  { "temporary", 0, 0, 'T' },
+                                                  { "version", 0, 0, 'V' },
+                                                  { "silent", 0, 0, 's' },
+                                                  { "sync", 0, 0, 'S' },
+                                                  { 0, 0, 0, 0 }
+                                              };
+
+        snprintf(filename, 255, "%s/.jackdrc", getenv("HOME"));
+        fp = fopen(filename, "r");
+
+        if (!fp) {
+            fp = fopen("/etc/jackdrc", "r");
+        }
+        // if still not found, check old config name for backwards compatability
+        if (!fp) {
+            fp = fopen("/etc/jackd.conf", "r");
+        }
+
+        argc = 0;
+        if (fp) {
+            ret = fscanf(fp, "%s", buffer);
+            while (ret != 0 && ret != EOF) {
+                argv[argc] = (char*)malloc(64);
+                strcpy(argv[argc], buffer);
+                ret = fscanf(fp, "%s", buffer);
+                argc++;
+            }
+            fclose(fp);
+        }
+
+        /*
+        For testing
+        int argc = 15;
+        char* argv[] = {"jackdmp", "-R", "-v", "-d", "coreaudio", "-p", "512", "-d", "~:Aggregate:0", "-r", "48000", "-i", "2", "-o", "2" };
+        */
+
+        opterr = 0;
+        optind = 1; // Important : to reset argv parsing
+
+        while (!seen_driver &&
+                (opt = getopt_long(argc, argv, options, long_options, &option_index)) != EOF) {
+
+            switch (opt) {
+            
+                case 'c':
+                    if (tolower (optarg[0]) == 'h') {
+                        clock_source = JACK_TIMER_HPET;
+                    } else if (tolower (optarg[0]) == 'c') {
+                        clock_source = JACK_TIMER_CYCLE_COUNTER;
+                    } else if (tolower (optarg[0]) == 's') {
+                        clock_source = JACK_TIMER_SYSTEM_CLOCK;
+                    } else {
+                        jack_error("unknown option character %c", optopt);
+                    }                
+                    break;
+
+                case 'd':
+                    seen_driver = 1;
+                    driver_name = optarg;
+                    break;
+
+                case 'v':
+                    verbose_aux = 1;
+                    break;
+
+                case 'S':
+                    sync = 1;
+                    break;
+
+                case 'n':
+                    server_name = optarg;
+                    break;
+
+                case 'm':
+                    do_mlock = 0;
+                    break;
+
+                case 'p':
+                    port_max = (unsigned int)atol(optarg);
+                    break;
+
+                case 'P':
+                    realtime_priority = atoi(optarg);
+                    break;
+
+                case 'R':
+                    realtime = 1;
+                    break;
+
+                case 'T':
+                    temporary = 1;
+                    break;
+
+                case 't':
+                    client_timeout = atoi(optarg);
+                    break;
+
+                case 'u':
+                    do_unlock = 1;
+                    break;
+
+                case 'V':
+                    show_version = 1;
+                    break;
+
+                default:
+                    jack_error("unknown option character %c", optopt);
+                    break;
+            }
+        }
+
+        drivers = jack_drivers_load(drivers);
+        if (!drivers) {
+            jack_error("jackdmp: no drivers found; exiting");
+            goto error;
+        }
+
+        driver_desc = jack_find_driver_descriptor(drivers, driver_name);
+        if (!driver_desc) {
+            jack_error("jackdmp: unknown driver '%s'", driver_name);
+            goto error;
+        }
+
+        if (optind < argc) {
+            driver_nargs = 1 + argc - optind;
+        } else {
+            driver_nargs = 1;
+        }
+
+        if (driver_nargs == 0) {
+            jack_error("No driver specified ... hmm. JACK won't do"
+                       " anything when run like this.");
+            goto error;
+        }
+
+        driver_args = (char**)malloc(sizeof(char*) * driver_nargs);
+        driver_args[0] = driver_name;
+
+        for (i = 1; i < driver_nargs; i++) {
+            driver_args[i] = argv[optind++];
+        }
+
+        if (jack_parse_driver_params(driver_desc, driver_nargs, driver_args, &driver_params)) {
+            goto error;
+        }
+
+#ifndef WIN32
+        if (server_name == NULL)
+            server_name = (char*)JackTools::DefaultServerName();
+#endif
+
+        rc = jack_register_server(server_name, false);
+        switch (rc) {
+            case EEXIST:
+                jack_error("`%s' server already active", server_name);
+                goto error;
+            case ENOSPC:
+                jack_error("too many servers already active");
+                goto error;
+            case ENOMEM:
+                jack_error("no access to shm registry");
+                goto error;
+            default:
+                jack_info("server `%s' registered", server_name);
+        }
+
+        /* clean up shared memory and files from any previous instance of this server name */
+        jack_cleanup_shm();
+        JackTools::CleanupFiles(server_name);
+
+        if (!realtime && client_timeout == 0)
+            client_timeout = 500; /* 0.5 sec; usable when non realtime. */
+
+        for (i = 0; i < argc; i++) {
+            free(argv[i]);
+        }
+
+        int res = Start(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, port_max, verbose_aux, clock_source);
+        if (res < 0) {
+            jack_error("Cannot start server... exit");
+            Delete();
+            jack_cleanup_shm();
+            JackTools::CleanupFiles(server_name);
+            jack_unregister_server(server_name);
+            goto error;
+        }
+    }
+
+    if (driver_params)
+        jack_free_driver_params(driver_params);
+    return true;
+
+error:
+    if (driver_params)
+        jack_free_driver_params(driver_params);
+    fUserCount--;
+    return false;
+}
+
+void JackServerGlobals::Destroy()
+{
+    if (--fUserCount == 0) {
+        jack_log("JackServerGlobals Destroy");
+        Stop();
+        Delete();
+        jack_cleanup_shm();
+        JackTools::CleanupFiles(server_name);
+        jack_unregister_server(server_name);
+    }
+}
+
+} // end of namespace
+
+
diff --git a/common/JackServerGlobals.h b/common/JackServerGlobals.h
new file mode 100644
index 0000000..b4b688c
--- /dev/null
+++ b/common/JackServerGlobals.h
@@ -0,0 +1,67 @@
+/*
+Copyright (C) 2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackServerGlobals__
+#define __JackServerGlobals__
+
+#include "driver_interface.h"
+#include "JackDriverLoader.h"
+#include "JackCompilerDeps.h"
+#include "JackServer.h"
+
+namespace Jack
+{
+
+class JackClient;
+
+/*!
+\brief Global server static structure: singleton kind of pattern.
+*/
+
+struct SERVER_EXPORT JackServerGlobals
+{
+    static JackServer* fInstance;
+    static unsigned int fUserCount;
+    static bool (* on_device_acquire)(const char * device_name);
+    static void (* on_device_release)(const char * device_name);
+ 
+    JackServerGlobals();
+    ~JackServerGlobals();
+
+    static bool Init();
+    static void Destroy();
+    static int Start(const char* server_name,
+                     jack_driver_desc_t* driver_desc,
+                     JSList* driver_params,
+                     int sync,
+                     int temporary,
+                     int time_out_ms,
+                     int rt,
+                     int priority,
+                     int port_max,
+                     int verbose,
+                    jack_timer_type_t clock);
+    static void Stop();
+    static void Delete();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackServerLaunch.h b/common/JackServerLaunch.h
new file mode 100644
index 0000000..2241ff9
--- /dev/null
+++ b/common/JackServerLaunch.h
@@ -0,0 +1,29 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackServerLaunch__
+#define __JackServerLaunch__
+
+#include "varargs.h"
+#include "types.h"
+
+int try_start_server(jack_varargs_t* va, jack_options_t options, jack_status_t* status);
+
+#endif
diff --git a/common/JackShmMem.cpp b/common/JackShmMem.cpp
new file mode 100644
index 0000000..90d42e7
--- /dev/null
+++ b/common/JackShmMem.cpp
@@ -0,0 +1,158 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackError.h"
+#include "JackShmMem.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+static unsigned int fSegmentNum = 0;
+static jack_shm_info_t gInfo;
+size_t JackMem::gSize = 0;
+
+JackShmMem::JackShmMem()
+{
+    JackShmMemAble::Init();
+    LockMemory();
+}
+    
+JackShmMem::~JackShmMem()
+{
+    UnlockMemory();
+}
+
+void JackShmMemAble::Init()
+{
+    fInfo.index = gInfo.index;
+    fInfo.ptr.attached_at = gInfo.ptr.attached_at;
+    fInfo.size = gInfo.size;
+}
+    
+void* JackShmMem::operator new(size_t size, void* memory)
+{
+    jack_log("JackShmMem::new placement size = %ld", size);
+    return memory;
+}
+
+void* JackShmMem::operator new(size_t size)
+{
+    jack_shm_info_t info;
+    JackShmMem* obj;
+    char name[64];
+
+    snprintf(name, sizeof(name), "/jack_shared%d", fSegmentNum++);
+
+    if (jack_shmalloc(name, size, &info)) {
+        jack_error("cannot create shared memory segment of size = %d", size, strerror(errno));
+        goto error;
+    }
+
+    if (jack_attach_shm(&info)) {
+        jack_error("cannot attach shared memory segment name = %s err = %s", name, strerror(errno));
+        jack_destroy_shm(&info);
+        goto error;
+    }
+
+    obj = (JackShmMem*)jack_shm_addr(&info);
+    // It is unsafe to set object fields directly (may be overwritten during object initialization),
+    // so use an intermediate global data
+    gInfo.index = info.index;
+    gInfo.size = size;
+    gInfo.ptr.attached_at = info.ptr.attached_at;
+
+    jack_log("JackShmMem::new index = %ld attached = %x size = %ld ", info.index, info.ptr.attached_at, size);
+    return obj;
+
+error:
+    jack_error("JackShmMem::new bad alloc", size);
+    throw std::bad_alloc();
+}
+
+void JackShmMem::operator delete(void* p, size_t size)
+{
+    jack_shm_info_t info;
+    JackShmMem* obj = (JackShmMem*)p;
+    info.index = obj->fInfo.index;
+    info.ptr.attached_at = obj->fInfo.ptr.attached_at;
+
+    jack_log("JackShmMem::delete size = %ld index = %ld", size, info.index);
+
+    jack_release_shm(&info);
+    jack_destroy_shm(&info);
+}
+
+void JackShmMem::operator delete(void* obj)
+{	
+    if (obj) {
+        JackShmMem::operator delete(obj, 0);
+    }
+}
+
+void LockMemoryImp(void* ptr, size_t size)
+{
+    if (CHECK_MLOCK((char*)ptr, size)) {
+        jack_log("Succeeded in locking %u byte memory area", size);
+    } else {
+        jack_error("Cannot lock down memory area (%s)", strerror(errno));
+    }
+}
+
+void InitLockMemoryImp(void* ptr, size_t size)
+{
+    if (CHECK_MLOCK((char*)ptr, size)) {
+        memset(ptr, 0, size);
+        jack_log("Succeeded in locking %u byte memory area", size);
+    } else {
+        jack_error("Cannot lock down memory area (%s)", strerror(errno));
+    }
+}
+
+void UnlockMemoryImp(void* ptr, size_t size)
+{
+    if (CHECK_MUNLOCK((char*)ptr, size)) {
+        jack_log("Succeeded in unlocking %u byte memory area", size);
+    } else {
+        jack_error("Cannot unlock down memory area (%s)", strerror(errno));
+    }
+}
+
+void LockAllMemory()
+{
+    if (CHECK_MLOCKALL()) {
+        jack_log("Succeeded in locking all memory");
+    } else {
+        jack_error("Cannot lock all memory (%s)", strerror(errno));
+    }
+}
+
+void UnlockAllMemory()
+{
+    if (CHECK_MUNLOCKALL()) {
+        jack_log("Succeeded in unlocking all memory");
+    } else {
+        jack_error("Cannot unlock all memory (%s)", strerror(errno));
+    }
+}
+
+
+} // end of namespace
+
diff --git a/common/JackShmMem.h b/common/JackShmMem.h
new file mode 100644
index 0000000..0a00daa
--- /dev/null
+++ b/common/JackShmMem.h
@@ -0,0 +1,396 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackShmMem__
+#define __JackShmMem__
+
+#include "shm.h"
+#include "JackError.h"
+#include "JackCompilerDeps.h"
+
+#include <new>  // GCC 4.0
+#include <errno.h>
+#include <stdlib.h>
+
+#include "JackShmMem_os.h"
+
+namespace Jack
+{
+
+SERVER_EXPORT void LockMemoryImp(void* ptr, size_t size);
+SERVER_EXPORT void InitLockMemoryImp(void* ptr, size_t size);
+SERVER_EXPORT void UnlockMemoryImp(void* ptr, size_t size);
+SERVER_EXPORT void LockAllMemory();
+SERVER_EXPORT void UnlockAllMemory();
+
+class JackMem
+{
+    private:
+
+        size_t fSize;
+        static size_t gSize;
+
+    protected:
+    
+        JackMem(): fSize(gSize)
+        {}
+        ~JackMem()
+        {}
+        
+    public:
+
+        void* operator new(size_t size)
+        {
+            gSize = size;
+            return calloc(1, size);
+        }
+
+        void operator delete(void* ptr, size_t size)
+        {
+            free(ptr);
+        }
+	
+        void LockMemory()
+        {
+            LockMemoryImp(this, fSize);
+        }
+
+        void UnlockMemory()
+        {
+            UnlockMemoryImp(this, fSize);
+        }
+
+};
+
+/*!
+\brief
+
+A class which objects possibly want to be allocated in shared memory derives from this class.
+*/
+
+class JackShmMemAble
+{
+    protected:
+        
+        jack_shm_info_t fInfo;
+        
+    public:
+             
+        void Init();
+
+        int GetShmIndex()
+        {
+            return fInfo.index;
+        }
+
+        char* GetShmAddress()
+        {
+            return (char*)fInfo.ptr.attached_at;
+        }
+
+        void LockMemory()
+        {
+            LockMemoryImp(this, fInfo.size);
+        }
+
+        void UnlockMemory()
+        {
+            UnlockMemoryImp(this, fInfo.size);
+        }
+
+};
+
+/*!
+\brief The base class for shared memory management.
+
+A class which objects need to be allocated in shared memory derives from this class.
+*/
+
+class SERVER_EXPORT JackShmMem : public JackShmMemAble
+{
+
+     protected:
+    
+        JackShmMem();
+        ~JackShmMem();
+  
+    public:
+    
+        void* operator new(size_t size);
+        void* operator new(size_t size, void* memory);
+        
+        void operator delete(void* p, size_t size);
+		void operator delete(void* p);
+   
+};
+
+/*!
+\brief Pointer on shared memory segment in the client side.
+*/
+
+template <class T>
+class JackShmReadWritePtr
+{
+
+    private:
+
+        jack_shm_info_t fInfo;
+
+        void Init(int index, const char* server_name = "default")
+        {
+            if (fInfo.index < 0 && index >= 0) {
+                jack_log("JackShmReadWritePtr::Init %ld %ld", index, fInfo.index);
+                if (jack_initialize_shm(server_name) < 0)
+                    throw - 1;
+                fInfo.index = index;
+                if (jack_attach_shm(&fInfo)) {
+                    throw - 2;
+                }
+                GetShmAddress()->LockMemory();
+            }
+        }
+
+    public:
+
+        JackShmReadWritePtr()
+        {
+            fInfo.index = -1;
+            fInfo.ptr.attached_at = (char*)NULL;
+        }
+
+        JackShmReadWritePtr(int index, const char* server_name)
+        {
+            Init(index, server_name);
+        }
+
+        ~JackShmReadWritePtr()
+        {
+            if (fInfo.index >= 0) {
+                jack_log("JackShmReadWritePtr::~JackShmReadWritePtr %ld", fInfo.index);
+                GetShmAddress()->UnlockMemory();
+                jack_release_shm(&fInfo);
+                fInfo.index = -1;
+             }
+        }
+
+        T* operator->() const
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+        operator T*() const
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+        JackShmReadWritePtr& operator=(int index)
+        {
+            Init(index);
+            return *this;
+        }
+
+        void SetShmIndex(int index, const char* server_name)
+        {
+            Init(index, server_name);
+        }
+
+        int GetShmIndex()
+        {
+            return fInfo.index;
+        }
+
+        T* GetShmAddress()
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+};
+
+/*!
+\brief Pointer on shared memory segment in the client side: destroy the segment (used client control)
+*/
+
+template <class T>
+class JackShmReadWritePtr1
+{
+
+    private:
+
+        jack_shm_info_t fInfo;
+
+        void Init(int index, const char* server_name = "default")
+        {
+            if (fInfo.index < 0 && index >= 0) {
+                jack_log("JackShmReadWritePtr1::Init %ld %ld", index, fInfo.index);
+                if (jack_initialize_shm(server_name) < 0)
+                    throw - 1;
+                fInfo.index = index;
+                if (jack_attach_shm(&fInfo)) {
+                    throw - 2;
+                }
+                /*
+                nobody else needs to access this shared memory any more, so
+                destroy it. because we have our own attachment to it, it won't
+                vanish till we exit (and release it).
+                */
+                jack_destroy_shm(&fInfo);
+                GetShmAddress()->LockMemory();
+            }
+        }
+
+    public:
+
+        JackShmReadWritePtr1()
+        {
+            fInfo.index = -1;
+            fInfo.ptr.attached_at = NULL;
+        }
+
+        JackShmReadWritePtr1(int index, const char* server_name)
+        {
+            Init(index, server_name);
+        }
+
+        ~JackShmReadWritePtr1()
+        {
+            if (fInfo.index >= 0) {
+                jack_log("JackShmReadWritePtr1::~JackShmReadWritePtr1 %ld", fInfo.index);
+                GetShmAddress()->UnlockMemory();
+                jack_release_shm(&fInfo);
+                fInfo.index = -1;
+            }
+        }
+
+        T* operator->() const
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+        operator T*() const
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+        JackShmReadWritePtr1& operator=(int index)
+        {
+            Init(index);
+            return *this;
+        }
+
+        void SetShmIndex(int index, const char* server_name)
+        {
+            Init(index, server_name);
+        }
+
+        int GetShmIndex()
+        {
+            return fInfo.index;
+        }
+
+        T* GetShmAddress()
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+};
+
+/*!
+\brief Pointer on shared memory segment in the client side.
+*/
+
+template <class T>
+class JackShmReadPtr
+{
+
+    private:
+
+        jack_shm_info_t fInfo;
+
+        void Init(int index, const char* server_name = "default")
+        {
+            if (fInfo.index < 0 && index >= 0) {
+                jack_log("JackShmPtrRead::Init %ld %ld", index, fInfo.index);
+                if (jack_initialize_shm(server_name) < 0)
+                    throw - 1;
+                fInfo.index = index;
+                if (jack_attach_shm_read(&fInfo)) {
+                    throw - 2;
+                }
+                GetShmAddress()->LockMemory();
+            }
+        }
+
+    public:
+
+        JackShmReadPtr()
+        {
+            fInfo.index = -1;
+            fInfo.ptr.attached_at = NULL;
+        }
+
+        JackShmReadPtr(int index, const char* server_name)
+        {
+            Init(index, server_name);
+        }
+
+        ~JackShmReadPtr()
+        {
+            if (fInfo.index >= 0) {
+                jack_log("JackShmPtrRead::~JackShmPtrRead %ld", fInfo.index);
+                GetShmAddress()->UnlockMemory();
+                jack_release_shm(&fInfo);
+                fInfo.index = -1;
+            }
+        }
+
+        T* operator->() const
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+        operator T*() const
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+        JackShmReadPtr& operator=(int index)
+        {
+            Init(index);
+            return *this;
+        }
+
+        void SetShmIndex(int index, const char* server_name)
+        {
+            Init(index, server_name);
+        }
+
+        int GetShmIndex()
+        {
+            return fInfo.index;
+        }
+
+        T* GetShmAddress()
+        {
+            return (T*)fInfo.ptr.attached_at;
+        }
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/common/JackSynchro.h b/common/JackSynchro.h
new file mode 100644
index 0000000..0518001
--- /dev/null
+++ b/common/JackSynchro.h
@@ -0,0 +1,104 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackSynchro__
+#define __JackSynchro__
+
+#define SYNC_MAX_NAME_SIZE 256
+
+namespace Jack
+{
+
+namespace detail
+{
+
+/*!
+\brief An inter process synchronization primitive.
+*/
+
+class JackSynchro
+{
+
+    protected:
+
+        char fName[SYNC_MAX_NAME_SIZE];
+        bool fFlush; // If true, signal are "flushed" : used for drivers that do no consume the signal
+
+        void BuildName(const char* name, const char* server_name, char* res)
+        {}
+
+    public:
+
+        JackSynchro(): fFlush(false)
+        {}
+        ~JackSynchro()
+        {}
+
+        bool Signal()
+        {
+            return true;
+        }
+        bool SignalAll()
+        {
+            return true;
+        }
+        bool Wait()
+        {
+            return true;
+        }
+        bool TimedWait(long usec)
+        {
+            return true;
+        }
+        bool Allocate(const char* name, const char* server_name, int value)
+        {
+            return true;
+        }
+        bool Connect(const char* name, const char* server_name)
+        {
+            return true;
+        }
+        bool ConnectInput(const char* name, const char* server_name)
+        {
+            return true;
+        }
+        bool ConnectOutput(const char* name, const char* server_name)
+        {
+            return true;
+        }
+        bool Disconnect()
+        {
+            return true;
+        }
+        void Destroy()
+        {}
+
+        void SetFlush(bool mode)
+        {
+            fFlush = mode;
+        }
+
+};
+
+}
+
+} // end of namespace
+
+#endif
+
diff --git a/common/JackSystemDeps.h b/common/JackSystemDeps.h
new file mode 100644
index 0000000..adcc51f
--- /dev/null
+++ b/common/JackSystemDeps.h
@@ -0,0 +1,26 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackSystemDeps__
+#define __JackSystemDeps__
+
+#include "systemdeps.h"
+#include "JackSystemDeps_os.h"
+
+#endif
diff --git a/common/JackThread.h b/common/JackThread.h
new file mode 100644
index 0000000..9517a30
--- /dev/null
+++ b/common/JackThread.h
@@ -0,0 +1,130 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software 
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ 
+ */
+
+#ifndef __JackThread__
+#define __JackThread__
+
+#include "JackCompilerDeps.h"
+#include "JackTypes.h"
+
+namespace Jack
+{
+    
+/*!
+ \brief The base class for runnable objects, that have an <B> Init </B> and <B> Execute </B> method to be called in a thread.
+ */
+
+class JackRunnableInterface
+{
+        
+    protected:
+    
+        JackRunnableInterface()
+        {}
+        virtual ~JackRunnableInterface()
+        {}
+        
+    public:
+    
+        virtual bool Init()          /*! Called once when the thread is started */
+        {
+            return true;
+        }
+        virtual bool Execute() = 0;  /*! Must be implemented by subclasses */
+};
+
+namespace detail
+{
+
+/*!
+ \brief The thread base class.
+ */
+
+class SERVER_EXPORT JackThreadInterface
+{
+
+    public:
+        
+        enum kThreadState {kIdle, kStarting, kIniting, kRunning};
+        
+    protected:
+        
+        JackRunnableInterface* fRunnable;
+        int fPriority;
+        bool fRealTime;
+        volatile kThreadState fStatus;
+        int fCancellation;
+        
+    public:
+        
+        JackThreadInterface(JackRunnableInterface* runnable, int priority, bool real_time, int cancellation):
+        fRunnable(runnable), fPriority(priority), fRealTime(real_time), fStatus(kIdle), fCancellation(cancellation)
+        {}
+         
+        kThreadState GetStatus()
+        {
+            return fStatus;
+        }
+        void SetStatus(kThreadState status)
+        {
+            fStatus = status;
+        }
+        
+        void SetParams(UInt64 period, UInt64 computation, UInt64 constraint) // Empty implementation, will only make sense on OSX...
+        {}
+        
+        int Start();
+        int StartSync();
+        int Kill();
+        int Stop();
+        void Terminate();
+
+        int AcquireRealTime();                  // Used when called from another thread
+        int AcquireSelfRealTime();              // Used when called from thread itself
+        
+        int AcquireRealTime(int priority);      // Used when called from another thread
+        int AcquireSelfRealTime(int priority);  // Used when called from thread itself
+        
+        int DropRealTime();                     // Used when called from another thread
+        int DropSelfRealTime();                 // Used when called from thread itself
+
+        pthread_t GetThreadID();
+
+        static int AcquireRealTimeImp(pthread_t thread, int priority);
+        static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint);
+        static int DropRealTimeImp(pthread_t thread);
+        static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg);
+        static int StopImp(pthread_t thread);
+        static int KillImp(pthread_t thread);
+};
+    
+}
+
+} // end of namespace
+
+bool jack_get_thread_realtime_priority_range(int * min_ptr, int * max_ptr);
+
+bool jack_tls_allocate_key(jack_tls_key *key_ptr);
+bool jack_tls_free_key(jack_tls_key key);
+
+bool jack_tls_set(jack_tls_key key, void *data_ptr);
+void *jack_tls_get(jack_tls_key key);
+
+#endif
diff --git a/common/JackThreadedDriver.cpp b/common/JackThreadedDriver.cpp
new file mode 100644
index 0000000..52e4919
--- /dev/null
+++ b/common/JackThreadedDriver.cpp
@@ -0,0 +1,230 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackThreadedDriver.h"
+#include "JackError.h"
+#include "JackGlobals.h"
+#include "JackEngineControl.h"
+
+namespace Jack
+{
+
+JackThreadedDriver::JackThreadedDriver(JackDriver* driver):fThread(this)
+{
+    fDriver = driver;
+}
+
+JackThreadedDriver::~JackThreadedDriver()
+{
+    delete fDriver;
+}
+
+int JackThreadedDriver::Open()
+{
+    return fDriver->Open();
+}
+
+int JackThreadedDriver::Open(jack_nframes_t buffer_size,
+                 jack_nframes_t samplerate,
+                 bool capturing,
+                 bool playing,
+                 int inchannels,
+                 int outchannels,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency)
+{
+    return fDriver->Open(buffer_size, samplerate, capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency);
+}
+
+int JackThreadedDriver::Close()
+{
+    return fDriver->Close();
+}
+
+int JackThreadedDriver::Process()
+{
+    return fDriver->Process();
+}
+
+int JackThreadedDriver::ProcessNull()
+{
+    return fDriver->ProcessNull();
+}
+
+int JackThreadedDriver::Attach()
+{
+    return fDriver->Attach();
+}
+
+int JackThreadedDriver::Detach()
+{
+    return fDriver->Detach();
+}
+
+int JackThreadedDriver::Read()
+{
+    return fDriver->Read();
+}
+
+int JackThreadedDriver::Write()
+{
+    return fDriver->Write();
+}
+
+bool JackThreadedDriver::IsFixedBufferSize()
+{
+    return fDriver->IsFixedBufferSize();
+}
+
+int JackThreadedDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    return fDriver->SetBufferSize(buffer_size);
+}
+
+int JackThreadedDriver::SetSampleRate(jack_nframes_t sample_rate)
+{
+    return fDriver->SetSampleRate(sample_rate);
+}
+
+void JackThreadedDriver::SetMaster(bool onoff)
+{
+    fDriver->SetMaster(onoff);
+}
+
+bool JackThreadedDriver::GetMaster()
+{
+    return fDriver->GetMaster();
+}
+
+void JackThreadedDriver::AddSlave(JackDriverInterface* slave)
+{
+    fDriver->AddSlave(slave);
+}
+
+void JackThreadedDriver::RemoveSlave(JackDriverInterface* slave)
+{
+    fDriver->RemoveSlave(slave);
+}
+
+int JackThreadedDriver::ProcessSlaves()
+{
+    return fDriver->ProcessSlaves();
+}
+
+std::list<JackDriverInterface*> JackThreadedDriver::GetSlaves()
+{
+    return fDriver->GetSlaves();
+}
+
+int JackThreadedDriver::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2)
+{
+    return fDriver->ClientNotify(refnum, name, notify, sync, message, value1, value2);
+}
+
+JackClientControl* JackThreadedDriver::GetClientControl() const
+{
+    return fDriver->GetClientControl();
+}
+
+bool JackThreadedDriver::IsRealTime() const
+{
+    return fDriver->IsRealTime();
+}
+
+int JackThreadedDriver::Start()
+{
+    jack_log("JackThreadedDriver::Start");
+
+    if (fDriver->Start() < 0) {
+        jack_error("Cannot start driver");
+        return -1;
+    }
+    if (fThread.StartSync() < 0) {
+        jack_error("Cannot start thread");
+        return -1;
+    }
+
+    return 0;
+}
+
+int JackThreadedDriver::Stop()
+{
+    jack_log("JackThreadedDriver::Stop");
+    
+    switch (fThread.GetStatus()) {
+            
+        // Kill the thread in Init phase
+        case JackThread::kStarting:
+        case JackThread::kIniting:
+            if (fThread.Kill() < 0) {
+                jack_error("Cannot kill thread");
+                return -1;
+            }
+            break;
+           
+        // Stop when the thread cycle is finished
+        case JackThread::kRunning:
+            if (fThread.Stop() < 0) {
+                jack_error("Cannot stop thread"); 
+                return -1;
+            }
+            break;
+            
+        default:
+            break;
+    }
+
+    if (fDriver->Stop() < 0) {
+        jack_error("Cannot stop driver");
+        return -1;
+    }
+    return 0;
+}
+
+bool JackThreadedDriver::Execute()
+{
+    return (Process() == 0);
+}
+
+bool JackThreadedDriver::Init()
+{
+    if (fDriver->Initialize())  {
+        if (fDriver->IsRealTime()) {
+            jack_log("JackThreadedDriver::Init IsRealTime");
+            // Will do "something" on OSX only...
+            GetEngineControl()->fPeriod = GetEngineControl()->fConstraint = GetEngineControl()->fPeriodUsecs * 1000;
+            fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
+            if (fThread.AcquireSelfRealTime(GetEngineControl()->fServerPriority) < 0) {
+                jack_error("AcquireSelfRealTime error");
+            } else {
+                set_threaded_log_function(); 
+            }
+        }
+        return true;
+    } else {
+        return false;
+    }
+}
+
+} // end of namespace
diff --git a/common/JackThreadedDriver.h b/common/JackThreadedDriver.h
new file mode 100644
index 0000000..f7bbf2d
--- /dev/null
+++ b/common/JackThreadedDriver.h
@@ -0,0 +1,110 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackThreadedDriver__
+#define __JackThreadedDriver__
+
+#include "JackDriver.h"
+#include "JackPlatformPlug.h"
+
+namespace Jack
+{
+
+/*!
+\brief The base class for threaded drivers. Threaded drivers are used with blocking devices.
+*/
+
+class SERVER_EXPORT JackThreadedDriver : public JackDriverClientInterface, public JackRunnableInterface
+{
+
+    protected:
+
+        JackThread fThread;
+        JackDriver* fDriver;
+        
+    public:
+
+        JackThreadedDriver(JackDriver* driver);
+        virtual ~JackThreadedDriver();
+
+        virtual int Open();
+        
+        virtual int Open (bool capturing,
+                     bool playing,
+                     int inchannels,
+                     int outchannels,
+                     bool monitor,
+                     const char* capture_driver_name,
+                     const char* playback_driver_name,
+                     jack_nframes_t capture_latency,
+                     jack_nframes_t playback_latency) 
+        {
+            return -1;
+        }
+        virtual int Open(jack_nframes_t buffer_size,
+                         jack_nframes_t samplerate,
+                         bool capturing,
+                         bool playing,
+                         int inchannels,
+                         int outchannels,
+                         bool monitor,
+                         const char* capture_driver_name,
+                         const char* playback_driver_name,
+                         jack_nframes_t capture_latency,
+                         jack_nframes_t playback_latency);
+        virtual int Close();
+  
+        virtual int Process();
+        virtual int ProcessNull();
+    
+        virtual int Attach();
+        virtual int Detach();
+     
+        virtual int Read();
+        virtual int Write();
+    
+        virtual int Start();
+        virtual int Stop();
+
+        virtual bool IsFixedBufferSize();
+        virtual int SetBufferSize(jack_nframes_t buffer_size);
+        virtual int SetSampleRate(jack_nframes_t sample_rate);
+     
+        virtual void SetMaster(bool onoff);
+        virtual bool GetMaster();
+        virtual void AddSlave(JackDriverInterface* slave);
+        virtual void RemoveSlave(JackDriverInterface* slave);
+        virtual std::list<JackDriverInterface*> GetSlaves();
+        virtual int ProcessSlaves();
+        
+        virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
+        virtual JackClientControl* GetClientControl() const;
+        virtual bool IsRealTime() const;
+   
+        // JackRunnableInterface interface
+        virtual bool Execute();
+        virtual bool Init();
+
+};
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackTime.h b/common/JackTime.h
new file mode 100644
index 0000000..10ef1e8
--- /dev/null
+++ b/common/JackTime.h
@@ -0,0 +1,43 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackTime__
+#define __JackTime__
+
+#include "types.h"
+#include "JackCompilerDeps.h"
+#include "JackTypes.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT void InitTime();
+    SERVER_EXPORT jack_time_t GetMicroSeconds(void);
+    SERVER_EXPORT void JackSleep(long usec);
+    SERVER_EXPORT void SetClockSource(jack_timer_type_t source);
+    SERVER_EXPORT const char* ClockSourceName(jack_timer_type_t source);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/JackTools.cpp b/common/JackTools.cpp
new file mode 100644
index 0000000..a7a7020
--- /dev/null
+++ b/common/JackTools.cpp
@@ -0,0 +1,288 @@
+/*
+  Copyright (C) 2006-2008 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackConstants.h"
+#include "JackDriverLoader.h"
+#include "JackTools.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+#ifdef WIN32
+#include <process.h>
+#endif
+
+
+using namespace std;
+
+namespace Jack {
+
+    void JackTools::KillServer()
+    {
+#ifdef WIN32
+        exit(1);
+#else
+        kill(GetPID(), SIGINT);
+#endif
+    }
+
+    void JackTools::ThrowJackNetException() 
+    {
+        throw JackNetException();
+    }
+
+#define DEFAULT_TMP_DIR "/tmp"
+    char* jack_tmpdir = (char*)DEFAULT_TMP_DIR;
+
+    int JackTools::GetPID()
+    {
+#ifdef WIN32
+        return _getpid();
+#else
+        return getpid();
+#endif
+    }
+
+    int JackTools::GetUID()
+    {
+#ifdef WIN32
+        return  _getpid();
+        //#error "No getuid function available"
+#else
+        return getuid();
+#endif
+    }
+
+    const char* JackTools::DefaultServerName()
+    {
+        const char* server_name;
+        if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
+            server_name = JACK_DEFAULT_SERVER_NAME;
+        return server_name;
+    }
+
+    /* returns the name of the per-user subdirectory of jack_tmpdir */
+#ifdef WIN32
+
+    char* JackTools::UserDir()
+    {
+        return "";
+    }
+
+    char* JackTools::ServerDir(const char* server_name, char* server_dir)
+    {
+        return "";
+    }
+
+    void JackTools::CleanupFiles(const char* server_name) {}
+
+    int JackTools::GetTmpdir()
+    {
+        return 0;
+    }
+
+#else
+    char* JackTools::UserDir()
+    {
+        static char user_dir[JACK_PATH_MAX + 1] = "";
+
+        /* format the path name on the first call */
+        if (user_dir[0] == '\0') {
+            if (getenv ("JACK_PROMISCUOUS_SERVER")) {
+                snprintf(user_dir, sizeof(user_dir), "%s/jack", jack_tmpdir);
+            } else {
+                snprintf(user_dir, sizeof(user_dir), "%s/jack-%d", jack_tmpdir, GetUID());
+            }
+        }
+
+        return user_dir;
+    }
+
+    /* returns the name of the per-server subdirectory of jack_user_dir() */
+    char* JackTools::ServerDir(const char* server_name, char* server_dir)
+    {
+        /* format the path name into the suppled server_dir char array,
+        * assuming that server_dir is at least as large as JACK_PATH_MAX + 1 */
+
+        snprintf(server_dir, JACK_PATH_MAX + 1, "%s/%s", UserDir(), server_name);
+        return server_dir;
+    }
+
+    void JackTools::CleanupFiles(const char* server_name)
+    {
+        DIR* dir;
+        struct dirent *dirent;
+        char dir_name[JACK_PATH_MAX + 1] = "";
+        ServerDir(server_name, dir_name);
+
+        /* On termination, we remove all files that jackd creates so
+        * subsequent attempts to start jackd will not believe that an
+        * instance is already running. If the server crashes or is
+        * terminated with SIGKILL, this is not possible. So, cleanup
+        * is also attempted when jackd starts.
+        *
+        * There are several tricky issues. First, the previous JACK
+        * server may have run for a different user ID, so its files
+        * may be inaccessible. This is handled by using a separate
+        * JACK_TMP_DIR subdirectory for each user. Second, there may
+        * be other servers running with different names. Each gets
+        * its own subdirectory within the per-user directory. The
+        * current process has already registered as `server_name', so
+        * we know there is no other server actively using that name.
+        */
+
+        /* nothing to do if the server directory does not exist */
+        if ((dir = opendir(dir_name)) == NULL) {
+            return;
+        }
+
+        /* unlink all the files in this directory, they are mine */
+        while ((dirent = readdir(dir)) != NULL) {
+
+            char fullpath[JACK_PATH_MAX + 1];
+
+            if ((strcmp(dirent->d_name, ".") == 0) || (strcmp (dirent->d_name, "..") == 0)) {
+                continue;
+            }
+
+            snprintf(fullpath, sizeof(fullpath), "%s/%s", dir_name, dirent->d_name);
+
+            if (unlink(fullpath)) {
+                jack_error("cannot unlink `%s' (%s)", fullpath, strerror(errno));
+            }
+        }
+
+        closedir(dir);
+
+        /* now, delete the per-server subdirectory, itself */
+        if (rmdir(dir_name)) {
+            jack_error("cannot remove `%s' (%s)", dir_name, strerror(errno));
+        }
+
+        /* finally, delete the per-user subdirectory, if empty */
+        if (rmdir(UserDir())) {
+            if (errno != ENOTEMPTY) {
+                jack_error("cannot remove `%s' (%s)", UserDir(), strerror(errno));
+            }
+        }
+    }
+
+    int JackTools::GetTmpdir()
+    {
+        FILE* in;
+        size_t len;
+        char buf[JACK_PATH_MAX + 2]; /* allow tmpdir to live anywhere, plus newline, plus null */
+
+        if ((in = popen("jackd -l", "r")) == NULL) {
+            return -1;
+        }
+
+        if (fgets(buf, sizeof(buf), in) == NULL) {
+            fclose(in);
+            return -1;
+        }
+
+        len = strlen(buf);
+
+        if (buf[len - 1] != '\n') {
+            /* didn't get a whole line */
+            fclose(in);
+            return -1;
+        }
+
+        jack_tmpdir = (char *)malloc(len);
+        memcpy(jack_tmpdir, buf, len - 1);
+        jack_tmpdir[len - 1] = '\0';
+
+        fclose(in);
+        return 0;
+    }
+#endif
+
+    void JackTools::RewriteName(const char* name, char* new_name)
+    {
+        size_t i;
+        for (i = 0; i < strlen(name); i++) {
+            if ((name[i] == '/') || (name[i] == '\\'))
+                new_name[i] = '_';
+            else
+                new_name[i] = name[i];
+        }
+        new_name[i] = '\0';
+    }
+
+#ifdef WIN32
+
+void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
+{
+    snprintf(path_to_so, path_len, ADDON_DIR "/%s.dll", so_name);
+}
+
+void PrintLoadError(const char* so_name)
+{
+    // Retrieve the system error message for the last-error code
+    LPVOID lpMsgBuf;
+    LPVOID lpDisplayBuf;
+    DWORD dw = GetLastError();
+
+    FormatMessage(
+        FORMAT_MESSAGE_ALLOCATE_BUFFER |
+        FORMAT_MESSAGE_FROM_SYSTEM |
+        FORMAT_MESSAGE_IGNORE_INSERTS,
+        NULL,
+        dw,
+        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+        (LPTSTR) &lpMsgBuf,
+        0, NULL );
+
+    // Display the error message and exit the process
+    lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
+        (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)so_name) + 40) * sizeof(TCHAR));
+    _snprintf((LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(TCHAR),
+        TEXT("error loading %s err = %s"), so_name, lpMsgBuf);
+
+    jack_error((LPCTSTR)lpDisplayBuf);
+
+    LocalFree(lpMsgBuf);
+    LocalFree(lpDisplayBuf);
+}
+
+#else
+
+void PrintLoadError(const char* so_name)
+{
+    jack_log("error loading %s err = %s", so_name, dlerror());
+}
+
+void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
+{
+    const char* internal_dir;
+    if ((internal_dir = getenv("JACK_INTERNAL_DIR")) == 0) {
+        if ((internal_dir = getenv("JACK_DRIVER_DIR")) == 0) {
+            internal_dir = ADDON_DIR;
+        }
+    }
+
+    snprintf(path_to_so, path_len, "%s/%s.so", internal_dir, so_name);
+}
+
+#endif
+
+}  // end of namespace
+
diff --git a/common/JackTools.h b/common/JackTools.h
new file mode 100644
index 0000000..5960fed
--- /dev/null
+++ b/common/JackTools.h
@@ -0,0 +1,215 @@
+/*
+  Copyright (C) 2006-2008 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackTools__
+#define __JackTools__
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#include <dirent.h>
+#endif
+
+#ifdef __APPLE__
+#include <sys/syslimits.h>
+#endif
+
+#include "jslist.h"
+#include "driver_interface.h"
+#include "JackCompilerDeps.h"
+#include "JackError.h"
+#include "JackException.h"
+
+#include <string>
+#include <algorithm>
+#include <vector>
+#include <iostream>
+#include <fstream>
+
+namespace Jack
+{
+
+    /*!
+    \brief Utility functions.
+    */
+
+    struct SERVER_EXPORT JackTools
+    {
+        static int GetPID();
+        static int GetUID();
+
+        static void KillServer();
+
+        static char* UserDir();
+        static char* ServerDir ( const char* server_name, char* server_dir );
+        static const char* DefaultServerName();
+        static void CleanupFiles ( const char* server_name );
+        static int GetTmpdir();
+        static void RewriteName ( const char* name, char* new_name );
+        
+        static void ThrowJackNetException();
+    };
+
+    /*!
+    \brief Generic monitoring class. Saves data to GnuPlot files ('.plt' and '.log' datafile)
+
+    This template class allows to manipulate monitoring records, and automatically generate the GnuPlot config and data files.
+    Operations are RT safe because it uses fixed size data buffers.
+    You can set the number of measure points, and the number of records.
+
+    To use it :
+    - create a JackGnuPlotMonitor, you can use the data type you want.
+    - create a temporary array for your measure
+    - once you have filled this array with 'measure points' value, call write() to add it to the record
+    - once you've done with your measurment, just call save() to save your data file
+
+    You can also call SetPlotFile() to automatically generate '.plt' file from an options list.
+
+    */
+
+    template <class T> class JackGnuPlotMonitor
+    {
+        private:
+            uint32_t fMeasureCnt;
+            uint32_t fMeasurePoints;
+            uint32_t fMeasureId;
+            T* fCurrentMeasure;
+            T** fMeasureTable;
+            uint32_t fTablePos;
+            std::string fName;
+
+        public:
+            JackGnuPlotMonitor ( uint32_t measure_cnt = 512, uint32_t measure_points = 5, std::string name = std::string ( "default" ) )
+            {
+                jack_log ( "JackGnuPlotMonitor::JackGnuPlotMonitor %u measure points - %u measures", measure_points, measure_cnt );
+
+                fMeasureCnt = measure_cnt;
+                fMeasurePoints = measure_points;
+                fTablePos = 0;
+                fName = name;
+                fCurrentMeasure = new T[fMeasurePoints];
+                fMeasureTable = new T*[fMeasureCnt];
+                for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
+                {
+                    fMeasureTable[cnt] = new T[fMeasurePoints];
+                    fill_n ( fMeasureTable[cnt], fMeasurePoints, 0 );
+                }
+            }
+
+            ~JackGnuPlotMonitor()
+            {
+                jack_log ( "JackGnuPlotMonitor::~JackGnuPlotMonitor" );
+
+                for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
+                    delete[] fMeasureTable[cnt];
+                delete[] fMeasureTable;
+                delete[] fCurrentMeasure;
+            }
+
+            T AddNew ( T measure_point )
+            {
+				fMeasureId = 0;
+				return fCurrentMeasure[fMeasureId++] = measure_point;
+            }
+
+			uint32_t New()
+			{
+				return fMeasureId = 0;
+			}
+
+            T Add ( T measure_point )
+            {
+				return fCurrentMeasure[fMeasureId++] = measure_point;
+            }
+
+            uint32_t AddLast ( T measure_point )
+            {
+            	fCurrentMeasure[fMeasureId] = measure_point;
+            	fMeasureId = 0;
+            	return Write();
+            }
+
+            uint32_t Write()
+            {
+                for ( uint32_t point = 0; point < fMeasurePoints; point++ )
+                    fMeasureTable[fTablePos][point] = fCurrentMeasure[point];
+                if ( ++fTablePos == fMeasureCnt )
+                    fTablePos = 0;
+                return fTablePos;
+            }
+
+            int Save ( std::string name = std::string ( "" ) )
+            {
+                std::string filename = ( name.empty() ) ? fName : name;
+                filename += ".log";
+
+                jack_log ( "JackGnuPlotMonitor::Save filename %s", filename.c_str() );
+
+                std::ofstream file ( filename.c_str() );
+
+                for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
+                {
+                    for ( uint32_t point = 0; point < fMeasurePoints; point++ )
+                        file << fMeasureTable[cnt][point] << " \t";
+                    file << std::endl;
+                }
+
+                file.close();
+                return 0;
+            }
+
+            int SetPlotFile ( std::string* options_list = NULL, uint32_t options_number = 0,
+                              std::string* field_names = NULL, uint32_t field_number = 0,
+                              std::string name = std::string ( "" ) )
+            {
+                std::string title = ( name.empty() ) ? fName : name;
+                std::string plot_filename = title + ".plt";
+                std::string data_filename = title + ".log";
+
+                std::ofstream file ( plot_filename.c_str() );
+
+                file << "set multiplot" << std::endl;
+                file << "set grid" << std::endl;
+                file << "set title \"" << title << "\"" << std::endl;
+
+                for ( uint32_t i = 0; i < options_number; i++ )
+                    file << options_list[i] << std::endl;
+
+                file << "plot ";
+                for ( uint32_t row = 1; row <= field_number; row++ )
+                {
+                    file << "\"" << data_filename << "\" using " << row << " title \"" << field_names[row-1] << "\" with lines";
+                    file << ( ( row < field_number ) ? ", " : "\n" );
+                }
+
+                jack_log ( "JackGnuPlotMonitor::SetPlotFile - Save GnuPlot file to '%s'", plot_filename.c_str() );
+
+                file.close();
+                return 0;
+            }
+    };
+
+    void BuildClientPath(char* path_to_so, int path_len, const char* so_name);
+    void PrintLoadError(const char* so_name);
+
+}
+
+#endif
diff --git a/common/JackTransportEngine.cpp b/common/JackTransportEngine.cpp
new file mode 100644
index 0000000..19168ee
--- /dev/null
+++ b/common/JackTransportEngine.cpp
@@ -0,0 +1,319 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackTransportEngine.h"
+#include "JackClientInterface.h"
+#include "JackClientControl.h"
+#include "JackEngineControl.h"
+#include "JackGlobals.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+JackTransportEngine::JackTransportEngine(): JackAtomicArrayState<jack_position_t>()
+{
+    fTransportState = JackTransportStopped;
+    fTransportCmd = fPreviousCmd = TransportCommandStop;
+    fSyncTimeout = 10000000;	/* 10 seconds default... 
+				   in case of big netjack1 roundtrip */
+    fSyncTimeLeft = 0;
+    fTimeBaseMaster = -1;
+    fWriteCounter = 0;
+    fConditionnal = false;
+    fPendingPos = false;
+    fNetworkSync = false;
+}
+
+// compute the number of cycle for timeout
+void JackTransportEngine::SyncTimeout(jack_nframes_t frame_rate, jack_nframes_t buffer_size)
+{
+    long buf_usecs = (long)((buffer_size * (jack_time_t)1000000) / frame_rate);
+    fSyncTimeLeft = fSyncTimeout / buf_usecs;
+    jack_log("SyncTimeout fSyncTimeout = %ld fSyncTimeLeft = %ld", (long)fSyncTimeout, (long)fSyncTimeLeft);
+}
+
+// Server
+int JackTransportEngine::ResetTimebase(int refnum)
+{
+    if (fTimeBaseMaster == refnum) {
+        jack_position_t* request = WriteNextStateStart(2); // To check
+        request->valid = (jack_position_bits_t)0;
+        WriteNextStateStop(2);
+        fTimeBaseMaster = -1;
+        return 0;
+    } else {
+        return EINVAL;
+    }
+}
+
+// Server
+int JackTransportEngine::SetTimebaseMaster(int refnum, bool conditionnal)
+{
+    if (conditionnal && fTimeBaseMaster > 0) {
+        if (refnum != fTimeBaseMaster) {
+            jack_log("conditional timebase for ref = %ld failed: %ld is already the master", refnum, fTimeBaseMaster);
+            return EBUSY;
+        } else {
+            jack_log("ref = %ld was already timebase master", refnum);
+            return 0;
+        }
+    } else {
+        fTimeBaseMaster = refnum;
+        fConditionnal = conditionnal;
+        jack_log("new timebase master: ref = %ld", refnum);
+        return 0;
+    }
+}
+
+// RT
+bool JackTransportEngine::CheckAllRolling(JackClientInterface** table)
+{
+    for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = table[i];
+        if (client && client->GetClientControl()->fTransportState != JackTransportRolling) {
+            jack_log("CheckAllRolling ref = %ld is not rolling", i);
+            return false;
+        }
+    }
+    jack_log("CheckAllRolling");
+    return true;
+}
+
+// RT
+void JackTransportEngine::MakeAllStartingLocating(JackClientInterface** table)
+{
+    for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = table[i];
+        if (client) {
+            JackClientControl* control = client->GetClientControl();
+            // Inactive clients don't have their process function called at all, so they must appear as already "rolling" for the transport....
+            control->fTransportState = (control->fActive && control->fCallback[kRealTimeCallback]) ? JackTransportStarting : JackTransportRolling;
+            control->fTransportSync = true; 
+            control->fTransportTimebase = true; 
+            jack_log("MakeAllStartingLocating ref = %ld", i);
+        }
+    }
+}
+
+// RT
+void JackTransportEngine::MakeAllStopping(JackClientInterface** table)
+{
+    for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = table[i];
+        if (client) {
+            JackClientControl* control = client->GetClientControl();
+            control->fTransportState = JackTransportStopped;
+            control->fTransportSync = false; 
+            control->fTransportTimebase = false; 
+            jack_log("MakeAllStopping ref = %ld", i);
+        }
+    }
+}
+
+// RT
+void JackTransportEngine::MakeAllLocating(JackClientInterface** table)
+{
+    for (int i = GetEngineControl()->fDriverNum; i < CLIENT_NUM; i++) {
+        JackClientInterface* client = table[i];
+        if (client) {
+            JackClientControl* control = client->GetClientControl();
+            control->fTransportState = JackTransportStopped;
+            control->fTransportSync = true; 
+            control->fTransportTimebase = true; 
+            jack_log("MakeAllLocating ref = %ld", i);
+        }
+    }
+}
+
+// RT
+void JackTransportEngine::CycleBegin(jack_nframes_t frame_rate, jack_time_t time)
+{
+    jack_position_t* pending = WriteNextStateStart(1); // Update "pending" state
+    pending->usecs = time;
+    pending->frame_rate = frame_rate;
+    WriteNextStateStop(1);
+}
+
+// RT
+void JackTransportEngine::CycleEnd(JackClientInterface** table, jack_nframes_t frame_rate, jack_nframes_t buffer_size)
+{
+    TrySwitchState(1);	// Switch from "pending" to "current", it always works since there is always a pending state
+
+    /* Handle any new transport command from the last cycle. */
+    transport_command_t cmd = fTransportCmd;
+    if (cmd != fPreviousCmd) {
+        fPreviousCmd = cmd;
+        jack_log("transport command: %s", (cmd == TransportCommandStart ? "Transport start" : "Transport stop"));
+    } else {
+        cmd = TransportCommandNone;
+    }
+
+    /* state transition switch */
+    switch (fTransportState) {
+
+        case JackTransportStopped:
+            // Set a JackTransportStarting for the current cycle, if all clients are ready (no slow_sync) ==> JackTransportRolling next state
+            if (cmd == TransportCommandStart) {
+                jack_log("transport stopped ==> starting frame = %d", ReadCurrentState()->frame);
+                fTransportState = JackTransportStarting;
+                MakeAllStartingLocating(table);
+                SyncTimeout(frame_rate, buffer_size);
+            } else if (fPendingPos) {
+                jack_log("transport stopped ==> stopped (locating) frame = %d", ReadCurrentState()->frame);
+                MakeAllLocating(table);
+            }
+            break;
+
+        case JackTransportStarting:
+            if (cmd == TransportCommandStop) {
+                jack_log("transport starting ==> stopped frame = %d", ReadCurrentState()->frame);
+                fTransportState = JackTransportStopped;
+                MakeAllStopping(table);
+            } else if (fPendingPos) {
+                jack_log("transport starting ==> starting frame = %d"), ReadCurrentState()->frame;
+                fTransportState = JackTransportStarting;
+                MakeAllStartingLocating(table);
+                SyncTimeout(frame_rate, buffer_size);
+            } else if (--fSyncTimeLeft == 0 || CheckAllRolling(table)) {  // Slow clients may still catch up
+                if (fNetworkSync) {
+                    jack_log("transport starting ==> netstarting frame = %d");
+                    fTransportState = JackTransportNetStarting;
+                } else {
+                    jack_log("transport starting ==> rolling fSyncTimeLeft = %ld", fSyncTimeLeft);
+                    fTransportState = JackTransportRolling;
+                }
+            }
+            break;
+
+        case JackTransportRolling:
+            if (cmd == TransportCommandStop) {
+                jack_log("transport rolling ==> stopped");
+                fTransportState = JackTransportStopped;
+                MakeAllStopping(table);
+            } else if (fPendingPos) {
+                jack_log("transport rolling ==> starting");
+                fTransportState = JackTransportStarting;
+                MakeAllStartingLocating(table);
+                SyncTimeout(frame_rate, buffer_size);
+            }
+            break;
+
+        case JackTransportNetStarting:
+            break;
+
+        default:
+            jack_error("Invalid JACK transport state: %d", fTransportState);
+    }
+
+    /* Update timebase, if needed. */
+    if (fTransportState == JackTransportRolling) {
+        jack_position_t* pending = WriteNextStateStart(1); // Update "pending" state
+        pending->frame += buffer_size;
+        WriteNextStateStop(1);
+    }
+
+    /* See if an asynchronous position request arrived during the last cycle. */
+    jack_position_t* request = WriteNextStateStart(2, &fPendingPos);
+    if (fPendingPos) {
+        jack_log("New pos = %ld", request->frame);
+        jack_position_t* pending = WriteNextStateStart(1);
+        CopyPosition(request, pending);
+        WriteNextStateStop(1);
+    }
+}
+
+// Client
+void JackTransportEngine::ReadCurrentPos(jack_position_t* pos)
+{
+    UInt16 next_index = GetCurrentIndex();
+    UInt16 cur_index;
+    do {
+        cur_index = next_index;
+        memcpy(pos, ReadCurrentState(), sizeof(jack_position_t));
+        next_index = GetCurrentIndex();
+    } while (cur_index != next_index); // Until a coherent state has been read
+}
+
+void JackTransportEngine::RequestNewPos(jack_position_t* pos)
+{
+    jack_position_t* request = WriteNextStateStart(2);
+    pos->unique_1 = pos->unique_2 = GenerateUniqueID();
+    CopyPosition(pos, request);
+    jack_log("RequestNewPos pos = %ld", pos->frame);
+    WriteNextStateStop(2);
+}
+
+jack_transport_state_t JackTransportEngine::Query(jack_position_t* pos)
+{
+    if (pos)
+        ReadCurrentPos(pos);
+    return GetState();
+}
+
+jack_nframes_t JackTransportEngine::GetCurrentFrame()
+{
+    jack_position_t pos;
+    ReadCurrentPos(&pos);
+
+    if (fTransportState == JackTransportRolling) {
+        float usecs = GetMicroSeconds() - pos.usecs;
+        jack_nframes_t elapsed = (jack_nframes_t)floor((((float) pos.frame_rate) / 1000000.0f) * usecs);
+        return pos.frame + elapsed;
+    } else {
+        return pos.frame;
+    }
+}
+
+// RT, client
+void JackTransportEngine::CopyPosition(jack_position_t* from, jack_position_t* to)
+{
+    int tries = 0;
+    long timeout = 1000;
+
+    do {
+        /* throttle the busy wait if we don't get the answer
+         * very quickly. See comment above about this
+         * design.
+         */
+        if (tries > 10) {
+            JackSleep(20);
+            tries = 0;
+
+            /* debug code to avoid system hangs... */
+            if (--timeout == 0) {
+                jack_error("hung in loop copying position B");
+                abort();
+            }
+        }
+        *to = *from;
+        tries++;
+
+    } while (to->unique_1 != to->unique_2);
+}
+
+
+} // end of namespace
diff --git a/common/JackTransportEngine.h b/common/JackTransportEngine.h
new file mode 100644
index 0000000..a1ff2b9
--- /dev/null
+++ b/common/JackTransportEngine.h
@@ -0,0 +1,200 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackTransportEngine__
+#define __JackTransportEngine__
+
+#include "JackAtomicArrayState.h"
+#include "JackCompilerDeps.h"
+#include "types.h"
+
+namespace Jack
+{
+
+typedef enum {
+    TransportCommandNone = 0,
+    TransportCommandStart = 1,
+    TransportCommandStop = 2,
+} transport_command_t;
+
+/*!
+\brief The client transport structure.
+
+We have:
+
+	- a "current" position
+	- a "pending" position prepared by the server at each cycle
+	- a "request" position wanted by a client
+
+	At the beginning of a cycle the server needs to select a new current position. When a request and a pending position are available,
+	the request takes precedence on the pending one. The server atomically switches to the new position.
+	The current position can be read by clients.
+
+	We use a JackAtomicArrayState pattern that allows to manage several "next" states independantly.
+    
+    In jack1 implementation, transport code (jack_transport_cycle_end) was not called if the graph could not be locked (see jack_run_one_cycle).
+    Here transport cycle (CycleBegin, CycleEnd) has to run in the RT thread concurrently with code executed from the "command" thread.
+    
+    Each client maintains a state in it's shared memory area defined by:
+    
+    - it's current transport state
+    - a boolean that is "true" when slow-sync cb has to be called
+    - a boolean that is "true" when timebase cb is called with new_pos on
+    
+    Several operations set the "slow-sync cb" flag to true:
+    
+        - setting a new cb (client)
+        - activate (client)
+        - transport start (server)
+        - new pos (server)
+        
+    Slow-sync cb calls stops when:
+    
+        - the cb return true (client)
+        - desactivate (client)
+        - transport stop (server)
+        
+    Several operations set the "timebase cb" flag to true:
+    
+        - setting a new cb (client)
+        - activate (client)
+        - transport start (server) ??
+        - new pos (server)
+        
+    Timebase cb "new_pos" argument calls stops when:
+    
+        - after one cb call with "new_pos" argument true (client)
+        - desactivate (client)
+        - release (client)
+        - transport stop (server)
+        
+*/
+
+class JackClientInterface;
+
+class SERVER_EXPORT JackTransportEngine : public JackAtomicArrayState<jack_position_t>
+{
+
+    private:
+
+        jack_transport_state_t fTransportState;
+        volatile transport_command_t fTransportCmd;
+        transport_command_t fPreviousCmd;		/* previous transport_cmd */
+        jack_time_t fSyncTimeout;
+        int fSyncTimeLeft;
+        int fTimeBaseMaster;
+        bool fPendingPos;
+        bool fNetworkSync;
+        bool fConditionnal;
+        SInt32 fWriteCounter;
+
+        bool CheckAllRolling(JackClientInterface** table);
+        void MakeAllStartingLocating(JackClientInterface** table);
+        void MakeAllStopping(JackClientInterface** table);
+        void MakeAllLocating(JackClientInterface** table);
+        
+        void SyncTimeout(jack_nframes_t frame_rate, jack_nframes_t buffer_size);
+
+    public:
+
+        JackTransportEngine();
+
+        ~JackTransportEngine()
+        {}
+
+        void SetCommand(transport_command_t state)
+        {
+            fTransportCmd = state;
+        }
+
+        jack_transport_state_t GetState() const
+        {
+            return fTransportState;
+        }
+        
+        void SetState(jack_transport_state_t state)
+        {
+            fTransportState = state;
+        }
+        
+        /*
+        	\brief 
+        */
+        int ResetTimebase(int refnum);
+
+        /*
+        	\brief 
+        */
+        int SetTimebaseMaster(int refnum, bool conditionnal);
+        
+        void GetTimebaseMaster(int& refnum, bool& conditionnal)
+        {
+            refnum = fTimeBaseMaster;
+            conditionnal = fConditionnal;
+        }
+
+        /*
+        	\brief 
+        */
+        void CycleBegin(jack_nframes_t frame_rate, jack_time_t time);
+
+        /*
+        	\brief 
+        */
+        void CycleEnd(JackClientInterface** table, jack_nframes_t frame_rate, jack_nframes_t buffer_size);
+
+        /*
+        	\brief 
+        */
+        void SetSyncTimeout(jack_time_t timeout)
+        {
+            fSyncTimeout = timeout;
+        }
+
+        void ReadCurrentPos(jack_position_t* pos);
+
+        jack_unique_t GenerateUniqueID()
+        {
+            return (jack_unique_t)INC_ATOMIC(&fWriteCounter);
+        }
+        
+        void RequestNewPos(jack_position_t* pos);
+        
+        jack_transport_state_t Query(jack_position_t* pos);
+        
+        jack_nframes_t GetCurrentFrame();
+
+        static void CopyPosition(jack_position_t* from, jack_position_t* to);
+        
+        bool GetNetworkSync() const
+        {
+            return fNetworkSync;
+        }
+        
+        void SetNetworkSync(bool sync)
+        {
+            fNetworkSync = sync;
+        }
+
+} POST_PACKED_STRUCTURE;
+
+} // end of namespace
+
+#endif
diff --git a/common/JackTypes.h b/common/JackTypes.h
new file mode 100644
index 0000000..234be17
--- /dev/null
+++ b/common/JackTypes.h
@@ -0,0 +1,52 @@
+/*
+  Copyright (C) 2001 Paul Davis
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: JackTypes.h,v 1.2.2.1 2006/06/20 14:44:00 letz Exp $
+*/
+
+#ifndef __JackTypes__
+#define __JackTypes__
+
+#include "JackCompilerDeps.h"
+
+typedef unsigned short UInt16;
+#if __LP64__
+typedef unsigned int UInt32;
+typedef signed int   SInt32;
+#else
+typedef unsigned long UInt32;
+typedef signed long   SInt32;
+#endif
+
+#include "JackTypes_os.h"
+
+typedef uint16_t jack_int_t;  // Internal type for ports and refnum
+
+typedef enum {
+	JACK_TIMER_SYSTEM_CLOCK,
+	JACK_TIMER_CYCLE_COUNTER,
+	JACK_TIMER_HPET,
+} jack_timer_type_t;
+
+typedef enum {
+    NotTriggered,
+    Triggered,
+    Running,
+    Finished,
+} jack_client_state_t;
+
+#endif
diff --git a/common/JackWaitThreadedDriver.cpp b/common/JackWaitThreadedDriver.cpp
new file mode 100644
index 0000000..0da831f
--- /dev/null
+++ b/common/JackWaitThreadedDriver.cpp
@@ -0,0 +1,79 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackSystemDeps.h"
+#include "JackWaitThreadedDriver.h"
+#include "JackGlobals.h"
+#include "JackClient.h"
+#include "JackEngineControl.h"
+#include "JackException.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+bool JackWaitThreadedDriver::Init()
+{
+    return (fStarter.Start() == 0);
+}
+
+bool JackWaitThreadedDriver::Execute()
+{
+    try {
+        // Process a null cycle until NetDriver has started
+        while (!fStarter.fRunning && fThread.GetStatus() == JackThread::kRunning) {
+            fDriver->ProcessNull();
+        }
+
+        // Set RT
+        if (fDriver->IsRealTime()) {
+            jack_log("JackWaitThreadedDriver::Init IsRealTime");
+            // Will do "something" on OSX only...
+            GetEngineControl()->fPeriod = GetEngineControl()->fConstraint = GetEngineControl()->fPeriodUsecs * 1000;
+            fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
+            if (fThread.AcquireSelfRealTime(GetEngineControl()->fServerPriority) < 0) {
+                jack_error("AcquireSelfRealTime error");
+            } else {
+                set_threaded_log_function();
+            }
+        }
+
+        // Switch to keep running even in case of error
+        while (fThread.GetStatus() == JackThread::kRunning) {
+            fDriver->Process();
+        }
+        return false;
+    } catch (JackNetException& e) {
+        e.PrintMessage();
+        jack_info("Driver is restarted");
+        fThread.DropSelfRealTime();
+        // Thread in kIniting status again...
+        fThread.SetStatus(JackThread::kIniting);
+        if (Init()) {
+            // Thread in kRunning status again...
+            fThread.SetStatus(JackThread::kRunning);
+            return true;
+        } else {
+            return false;
+        }
+	}
+}
+
+} // end of namespace
diff --git a/common/JackWaitThreadedDriver.h b/common/JackWaitThreadedDriver.h
new file mode 100644
index 0000000..f81db20
--- /dev/null
+++ b/common/JackWaitThreadedDriver.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ Copyright (C) 2004-2008 Grame
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackWaitThreadedDriver__
+#define __JackWaitThreadedDriver__
+
+#include "JackThreadedDriver.h"
+#include "JackAudioDriver.h"
+
+namespace Jack
+{
+    
+/*!
+\brief To be used as a wrapper of JackNetDriver. 
+
+The idea is to behave as the "dummy" driver, until the network connection is really started and processing starts. 
+The Execute method will call the ProcessNull method until the decorated driver Init method returns.
+A helper JackDriverStarter thread is used for that purpose.
+*/
+
+class SERVER_EXPORT JackWaitThreadedDriver : public JackThreadedDriver
+{
+    private:
+    
+        struct SERVER_EXPORT JackDriverStarter : public JackRunnableInterface 
+        {
+        
+                JackDriver* fDriver;
+                JackThread fThread;
+                bool fRunning;
+                
+                JackDriverStarter(JackDriver* driver)
+                    :fDriver(driver),fThread(this),fRunning(false)
+                {}
+                
+                ~JackDriverStarter()
+                {
+                     fThread.Kill();
+                }
+                
+                int Start()
+                {
+                    fRunning = false;
+                    return fThread.Start();
+                }
+            
+                // JackRunnableInterface interface
+                bool Execute()
+                {
+                    // Blocks until decorated driver is started (that is when it's Init method returns).
+                    fDriver->Initialize();
+                    fRunning = true;
+                    return false;
+                }
+        
+        };
+        
+        JackDriverStarter fStarter;
+                
+    public:
+
+        JackWaitThreadedDriver(JackDriver* netdriver)
+            :JackThreadedDriver(netdriver),fStarter(netdriver)
+        {}
+        virtual ~JackWaitThreadedDriver()
+        {}
+    
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};    
+
+
+} // end of namespace
+
+
+#endif
diff --git a/common/JackWeakAPI.cpp b/common/JackWeakAPI.cpp
new file mode 100644
index 0000000..81e21d3
--- /dev/null
+++ b/common/JackWeakAPI.cpp
@@ -0,0 +1,261 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/*
+    Completed from Julien Pommier (PianoTeq : http://www.pianoteq.com/) code.
+*/
+
+#include <jack/jack.h>
+#include <jack/thread.h>
+#include <jack/midiport.h>
+#include <math.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <cassert>
+#include <iostream>
+
+/* dynamically load libjack and forward all registered calls to libjack 
+   (similar to what relaytool is trying to do, but more portably..)
+*/
+
+typedef void (*print_function)(const char *);
+typedef void *(*thread_routine)(void*);
+
+using std::cerr;
+
+int libjack_is_present = 0;     // public symbol, similar to what relaytool does.
+static void *libjack_handle = 0;
+
+static void __attribute__((constructor)) tryload_libjack()
+{
+    if (getenv("SKIP_LIBJACK") == 0) { // just in case libjack is causing troubles..
+    #ifdef __APPLE__
+        libjack_handle = dlopen("libjack.0.dylib", RTLD_LAZY);
+    #else
+        libjack_handle = dlopen("libjack.so.0", RTLD_LAZY);
+    #endif
+        
+    }
+    libjack_is_present = (libjack_handle != 0);
+}
+
+void *load_jack_function(const char *fn_name) 
+{
+    void *fn = 0;
+    if (!libjack_handle) { 
+        std::cerr << "libjack not found, so do not try to load " << fn_name << " ffs !\n";
+        return 0;
+    }
+    fn = dlsym(libjack_handle, fn_name);
+    if (!fn) { 
+        std::cerr << "could not dlsym(" << libjack_handle << "), " << dlerror() << "\n"; 
+    }
+    return fn;
+}
+
+#define DECL_FUNCTION(return_type, fn_name, arguments_types, arguments) \
+  typedef return_type (*fn_name##_ptr_t)arguments_types;                \
+  return_type fn_name arguments_types {                                 \
+    static fn_name##_ptr_t fn = 0;                                      \
+    if (fn == 0) { fn = (fn_name##_ptr_t)load_jack_function(#fn_name); } \
+    if (fn) return (*fn)arguments;                                      \
+    else return (return_type)-1;                                                      \
+  }
+
+#define DECL_VOID_FUNCTION(fn_name, arguments_types, arguments)         \
+  typedef void (*fn_name##_ptr_t)arguments_types;                       \
+  void fn_name arguments_types {                                        \
+    static fn_name##_ptr_t fn = 0;                                      \
+    if (fn == 0) { fn = (fn_name##_ptr_t)load_jack_function(#fn_name); } \
+    if (fn) (*fn)arguments;                                             \
+  }
+
+DECL_VOID_FUNCTION(jack_get_version, (int *major_ptr, int *minor_ptr, int *micro_ptr, int *proto_ptr), (major_ptr, minor_ptr, micro_ptr, proto_ptr));
+DECL_FUNCTION(const char *, jack_get_version_string, (), ());      
+DECL_FUNCTION(jack_client_t *, jack_client_open, (const char *client_name, jack_options_t options, jack_status_t *status, ...), 
+              (client_name, options, status));
+DECL_FUNCTION(int, jack_client_close, (jack_client_t *client), (client));
+DECL_FUNCTION(jack_client_t *, jack_client_new, (const char *client_name), (client_name));
+DECL_FUNCTION(int, jack_client_name_size, (), ());
+DECL_FUNCTION(char*, jack_get_client_name, (jack_client_t *client), (client));
+DECL_FUNCTION(int, jack_internal_client_new, (const char *client_name,
+                                            const char *load_name,
+                                            const char *load_init), (client_name, load_name, load_init));
+DECL_VOID_FUNCTION(jack_internal_client_close, (const char *client_name), (client_name));
+DECL_FUNCTION(int, jack_is_realtime, (jack_client_t *client), (client));
+DECL_VOID_FUNCTION(jack_on_shutdown, (jack_client_t *client, JackShutdownCallback shutdown_callback, void *arg), (client, shutdown_callback, arg));
+DECL_VOID_FUNCTION(jack_on_info_shutdown, (jack_client_t* client, JackInfoShutdownCallback shutdown_callback, void* arg), (client, shutdown_callback, arg));
+DECL_FUNCTION(int, jack_set_process_callback, (jack_client_t *client,
+                                            JackProcessCallback process_callback,
+                                            void *arg), (client, process_callback, arg));
+DECL_FUNCTION(jack_nframes_t, jack_thread_wait, (jack_client_t *client, int status), (client, status));      
+                                      
+//
+DECL_FUNCTION(jack_nframes_t, jack_cycle_wait, (jack_client_t *client), (client));   
+DECL_VOID_FUNCTION(jack_cycle_signal, (jack_client_t *client, int status), (client, status));                                          
+DECL_FUNCTION(int, jack_set_process_thread, (jack_client_t *client,
+                                            JackThreadCallback fun,
+                                            void *arg), (client, fun, arg));
+DECL_FUNCTION(int, jack_set_thread_init_callback, (jack_client_t *client,
+                                            JackThreadInitCallback thread_init_callback,
+                                            void *arg), (client, thread_init_callback, arg));
+DECL_FUNCTION(int, jack_set_freewheel_callback, (jack_client_t *client,
+                                            JackFreewheelCallback freewheel_callback,
+                                            void *arg), (client, freewheel_callback, arg));
+DECL_FUNCTION(int, jack_set_freewheel, (jack_client_t *client, int onoff), (client, onoff));   
+DECL_FUNCTION(int, jack_set_buffer_size, (jack_client_t *client, jack_nframes_t nframes), (client, nframes));   
+DECL_FUNCTION(int, jack_set_buffer_size_callback, (jack_client_t *client,
+                                            JackBufferSizeCallback bufsize_callback,
+                                            void *arg), (client, bufsize_callback, arg));
+DECL_FUNCTION(int, jack_set_sample_rate_callback, (jack_client_t *client,
+                                            JackSampleRateCallback srate_callback,
+                                            void *arg), (client, srate_callback, arg));
+DECL_FUNCTION(int, jack_set_client_registration_callback, (jack_client_t *client,
+                                            JackClientRegistrationCallback registration_callback,
+                                            void *arg), (client, registration_callback, arg));
+DECL_FUNCTION(int, jack_set_port_registration_callback, (jack_client_t *client,
+                                            JackPortRegistrationCallback registration_callback,
+                                            void *arg), (client, registration_callback, arg));
+DECL_FUNCTION(int, jack_set_port_connect_callback, (jack_client_t *client,
+                                            JackPortConnectCallback connect_callback,
+                                            void *arg), (client, connect_callback, arg));
+DECL_FUNCTION(int, jack_set_port_rename_callback, (jack_client_t *client,
+                                            JackPortRenameCallback rename_callback,
+                                            void *arg), (client, rename_callback, arg));
+DECL_FUNCTION(int, jack_set_graph_order_callback, (jack_client_t *client,
+                                            JackGraphOrderCallback graph_callback,
+                                            void *arg), (client, graph_callback, arg));
+DECL_FUNCTION(int, jack_set_xrun_callback, (jack_client_t *client,
+                                            JackXRunCallback xrun_callback,
+                                            void *arg), (client, xrun_callback, arg));
+DECL_FUNCTION(int, jack_activate, (jack_client_t *client), (client));
+DECL_FUNCTION(int, jack_deactivate, (jack_client_t *client), (client));
+DECL_FUNCTION(jack_port_t *, jack_port_register, (jack_client_t *client, const char *port_name, const char *port_type,
+                                                  unsigned long flags, unsigned long buffer_size),
+              (client, port_name, port_type, flags, buffer_size));
+DECL_FUNCTION(int, jack_port_unregister, (jack_client_t *client, jack_port_t* port), (client, port));
+DECL_FUNCTION(void *, jack_port_get_buffer, (jack_port_t *port, jack_nframes_t nframes), (port, nframes));
+DECL_FUNCTION(const char*, jack_port_name, (const jack_port_t *port), (port));
+DECL_FUNCTION(const char*, jack_port_short_name, (const jack_port_t *port), (port));
+DECL_FUNCTION(int, jack_port_flags, (const jack_port_t *port), (port));
+DECL_FUNCTION(const char*, jack_port_type, (const jack_port_t *port), (port));
+DECL_FUNCTION(jack_port_type_id_t, jack_port_type_id, (const jack_port_t *port), (port));
+DECL_FUNCTION(int, jack_port_is_mine, (const jack_client_t *client, const jack_port_t* port), (client, port));
+DECL_FUNCTION(int, jack_port_connected, (const jack_port_t *port), (port));
+DECL_FUNCTION(int, jack_port_connected_to, (const jack_port_t *port, const char *port_name), (port, port_name));
+DECL_FUNCTION(const char**, jack_port_get_connections, (const jack_port_t *port), (port));
+DECL_FUNCTION(const char**, jack_port_get_all_connections, (const jack_client_t *client,const jack_port_t *port), (client, port));
+DECL_FUNCTION(int, jack_port_tie, (jack_port_t *src, jack_port_t *dst), (src, dst));
+DECL_FUNCTION(int, jack_port_untie, (jack_port_t *port), (port));
+DECL_FUNCTION(jack_nframes_t, jack_port_get_latency, (jack_port_t *port), (port));
+DECL_FUNCTION(jack_nframes_t, jack_port_get_total_latency ,(jack_client_t * client, jack_port_t *port), (client, port));
+DECL_VOID_FUNCTION(jack_port_set_latency, (jack_port_t * port, jack_nframes_t frames), (port, frames));
+DECL_FUNCTION(int, jack_recompute_total_latency, (jack_client_t* client, jack_port_t* port), (client, port));
+DECL_FUNCTION(int, jack_recompute_total_latencies, (jack_client_t* client),(client));
+
+DECL_FUNCTION(int, jack_port_set_name, (jack_port_t *port, const char *port_name), (port, port_name));
+DECL_FUNCTION(int, jack_port_set_alias, (jack_port_t *port, const char *alias), (port, alias));
+DECL_FUNCTION(int, jack_port_unset_alias, (jack_port_t *port, const char *alias), (port, alias));
+DECL_FUNCTION(int, jack_port_get_aliases, (const jack_port_t *port, char* const aliases[2]), (port,aliases));
+DECL_FUNCTION(int, jack_port_request_monitor, (jack_port_t *port, int onoff), (port, onoff));
+DECL_FUNCTION(int, jack_port_request_monitor_by_name, (jack_client_t *client, const char *port_name, int onoff), (client, port_name, onoff));
+DECL_FUNCTION(int, jack_port_ensure_monitor, (jack_port_t *port, int onoff), (port, onoff));
+DECL_FUNCTION(int, jack_port_monitoring_input, (jack_port_t *port) ,(port));
+DECL_FUNCTION(int, jack_connect, (jack_client_t * client, const char *source_port, const char *destination_port), (client, source_port, destination_port));
+DECL_FUNCTION(int, jack_disconnect, (jack_client_t * client, const char *source_port, const char *destination_port), (client, source_port, destination_port));
+DECL_FUNCTION(int, jack_port_disconnect, (jack_client_t * client, jack_port_t * port), (client, port));
+DECL_FUNCTION(int, jack_port_name_size,(),());
+DECL_FUNCTION(int, jack_port_type_size,(),());
+            
+DECL_FUNCTION(jack_nframes_t, jack_get_sample_rate, (jack_client_t *client), (client));
+DECL_FUNCTION(jack_nframes_t, jack_get_buffer_size, (jack_client_t *client), (client));
+DECL_FUNCTION(const char**, jack_get_ports, (jack_client_t *client, const char *port_name_pattern, const char *	type_name_pattern,
+                                             unsigned long flags), (client, port_name_pattern, type_name_pattern, flags));
+DECL_FUNCTION(jack_port_t *, jack_port_by_name, (jack_client_t * client, const char *port_name), (client, port_name));
+DECL_FUNCTION(jack_port_t *, jack_port_by_id, (jack_client_t *client, jack_port_id_t port_id), (client, port_id));
+
+DECL_FUNCTION(int, jack_engine_takeover_timebase, (jack_client_t * client), (client));
+DECL_FUNCTION(jack_nframes_t, jack_frames_since_cycle_start, (const jack_client_t * client), (client));
+DECL_FUNCTION(jack_time_t, jack_get_time, (), ());
+DECL_FUNCTION(jack_nframes_t, jack_time_to_frames, (const jack_client_t *client, jack_time_t time), (client, time));
+DECL_FUNCTION(jack_time_t, jack_frames_to_time, (const jack_client_t *client, jack_nframes_t frames), (client, frames));
+DECL_FUNCTION(jack_nframes_t, jack_frame_time, (const jack_client_t *client), (client));
+DECL_FUNCTION(jack_nframes_t, jack_last_frame_time, (const jack_client_t *client), (client));
+DECL_FUNCTION(float, jack_cpu_load, (jack_client_t *client), (client));
+DECL_FUNCTION(pthread_t, jack_client_thread_id, (jack_client_t *client), (client));
+DECL_VOID_FUNCTION(jack_set_error_function, (print_function fun), (fun));
+DECL_VOID_FUNCTION(jack_set_info_function, (print_function fun), (fun));
+
+DECL_FUNCTION(float, jack_get_max_delayed_usecs, (jack_client_t *client), (client));
+DECL_FUNCTION(float, jack_get_xrun_delayed_usecs, (jack_client_t *client), (client));
+DECL_VOID_FUNCTION(jack_reset_max_delayed_usecs, (jack_client_t *client), (client));
+
+DECL_FUNCTION(int, jack_release_timebase, (jack_client_t *client), (client));
+DECL_FUNCTION(int, jack_set_sync_callback, (jack_client_t *client, JackSyncCallback sync_callback, void *arg), (client, sync_callback, arg));
+DECL_FUNCTION(int, jack_set_sync_timeout, (jack_client_t *client, jack_time_t timeout), (client, timeout));
+DECL_FUNCTION(int, jack_set_timebase_callback, (jack_client_t *client, 
+                                                int conditional,
+                                                JackTimebaseCallback timebase_callback,
+                                                void *arg), (client, conditional, timebase_callback, arg));
+DECL_FUNCTION(int, jack_transport_locate, (jack_client_t *client, jack_nframes_t frame), (client, frame));
+DECL_FUNCTION(jack_transport_state_t, jack_transport_query, (const jack_client_t *client, jack_position_t *pos), (client, pos));
+DECL_FUNCTION(jack_nframes_t, jack_get_current_transport_frame, (const jack_client_t *client), (client));
+DECL_FUNCTION(int, jack_transport_reposition, (jack_client_t *client, jack_position_t *pos), (client, pos));
+DECL_VOID_FUNCTION(jack_transport_start, (jack_client_t *client), (client));
+DECL_VOID_FUNCTION(jack_transport_stop, (jack_client_t *client), (client));
+DECL_VOID_FUNCTION(jack_get_transport_info, (jack_client_t *client, jack_transport_info_t *tinfo), (client,tinfo));
+DECL_VOID_FUNCTION(jack_set_transport_info, (jack_client_t *client, jack_transport_info_t *tinfo), (client,tinfo));
+
+DECL_FUNCTION(int, jack_client_real_time_priority, (jack_client_t* client), (client));
+DECL_FUNCTION(int, jack_client_max_real_time_priority, (jack_client_t* client), (client));
+DECL_FUNCTION(int, jack_acquire_real_time_scheduling, (pthread_t thread, int priority), (thread, priority));
+DECL_FUNCTION(int, jack_client_create_thread, (jack_client_t* client,
+                                      pthread_t *thread,
+                                      int priority,
+                                      int realtime, 	// boolean
+                                      thread_routine routine,
+                                      void *arg), (client, thread, priority, realtime, routine, arg));
+DECL_FUNCTION(int, jack_drop_real_time_scheduling, (pthread_t thread), (thread));
+
+DECL_FUNCTION(int, jack_client_stop_thread, (jack_client_t* client, pthread_t thread), (client, thread));
+DECL_FUNCTION(int, jack_client_kill_thread, (jack_client_t* client, pthread_t thread), (client, thread));
+#ifndef WIN32
+DECL_VOID_FUNCTION(jack_set_thread_creator, (jack_thread_creator_t jtc), (jtc));
+#endif
+DECL_FUNCTION(char *, jack_get_internal_client_name, (jack_client_t *client, jack_intclient_t intclient), (client, intclient));
+DECL_FUNCTION(jack_intclient_t, jack_internal_client_handle, (jack_client_t *client, const char *client_name, jack_status_t *status), (client, client_name, status));
+/*
+DECL_FUNCTION(jack_intclient_t, jack_internal_client_load, (jack_client_t *client, 
+                                                            const char *client_name, 
+                                                            jack_options_t options, 
+                                                            jack_status_t *status
+                                                            , ...), (client, client_name, options, status, ...));
+*/
+DECL_FUNCTION(jack_status_t, jack_internal_client_unload, (jack_client_t *client, jack_intclient_t intclient), (client, intclient));
+DECL_VOID_FUNCTION(jack_free, (void* ptr), (ptr));
+
+// MIDI
+
+DECL_FUNCTION(jack_nframes_t, jack_midi_get_event_count, (void* port_buffer), (port_buffer));
+DECL_FUNCTION(int, jack_midi_event_get, (jack_midi_event_t* event, void* port_buffer, jack_nframes_t event_index), (event, port_buffer, event_index)) ;
+DECL_VOID_FUNCTION(jack_midi_clear_buffer, (void* port_buffer), (port_buffer));
+DECL_FUNCTION(size_t, jack_midi_max_event_size, (void* port_buffer), (port_buffer));
+DECL_FUNCTION(jack_midi_data_t*, jack_midi_event_reserve, (void* port_buffer, jack_nframes_t time, size_t data_size), (port_buffer, time, data_size));
+DECL_FUNCTION(int, jack_midi_event_write, (void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size), (port_buffer, time, data, data_size));
+DECL_FUNCTION(jack_nframes_t, jack_midi_get_lost_event_count, (void* port_buffer), (port_buffer));
diff --git a/common/Jackdmp.cpp b/common/Jackdmp.cpp
new file mode 100644
index 0000000..89ed084
--- /dev/null
+++ b/common/Jackdmp.cpp
@@ -0,0 +1,496 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <assert.h>
+#include <cassert>
+#include <csignal>
+#include <sys/types.h>
+#include <getopt.h>
+#include <cstring>
+#include <cstdio>
+
+#include "types.h"
+#include "jack.h"
+#include "JackConstants.h"
+#include "JackDriverLoader.h"
+
+#if defined(JACK_DBUS) && defined(__linux__)
+#include <dbus/dbus.h> 
+#include "audio_reserve.h"
+#endif
+
+/*
+This is a simple port of the old jackdmp.cpp file to use the new Jack 2.0 control API. Available options for the server
+are "hard-coded" in the source. A much better approach would be to use the control API to:
+- dynamically retrieve available server parameters and then prepare to parse them
+- get available drivers and their possible parameters, then prepare to parse them.
+*/
+
+#ifdef __APPLE__
+#include <CoreFoundation/CFNotificationCenter.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+static void notify_server_start(const char* server_name)
+{
+    // Send notification to be used in the JackRouter plugin
+    CFStringRef ref = CFStringCreateWithCString(NULL, server_name, kCFStringEncodingMacRoman);
+    CFNotificationCenterPostNotificationWithOptions(CFNotificationCenterGetDistributedCenter(),
+            CFSTR("com.grame.jackserver.start"),
+            ref,
+            NULL,
+            kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions);
+    CFRelease(ref);
+}
+
+static void notify_server_stop(const char* server_name)
+{
+    // Send notification to be used in the JackRouter plugin
+    CFStringRef ref1 = CFStringCreateWithCString(NULL, server_name, kCFStringEncodingMacRoman);
+    CFNotificationCenterPostNotificationWithOptions(CFNotificationCenterGetDistributedCenter(),
+            CFSTR("com.grame.jackserver.stop"),
+            ref1,
+            NULL,
+            kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions);
+    CFRelease(ref1);
+}
+
+#else
+
+static void notify_server_start(const char* server_name)
+{}
+static void notify_server_stop(const char* server_name)
+{}
+
+#endif
+
+static void copyright(FILE* file)
+{
+    fprintf(file, "jackdmp " VERSION "\n"
+            "Copyright 2001-2005 Paul Davis and others.\n"
+            "Copyright 2004-2009 Grame.\n"
+            "jackdmp comes with ABSOLUTELY NO WARRANTY\n"
+            "This is free software, and you are welcome to redistribute it\n"
+            "under certain conditions; see the file COPYING for details\n");
+}
+
+static void usage(FILE* file)
+{
+    fprintf(file, "\n"
+            "usage: jackdmp [ --no-realtime OR -r ]\n"
+            "               [ --realtime OR -R [ --realtime-priority OR -P priority ] ]\n"
+            "      (the two previous arguments are mutually exclusive. The default is --realtime)\n"
+            "               [ --name OR -n server-name ]\n"
+            "               [ --timeout OR -t client-timeout-in-msecs ]\n"
+            "               [ --loopback OR -L loopback-port-number ]\n"
+            "               [ --port-max OR -p maximum-number-of-ports]\n"
+            "               [ --midi OR -X midi-driver ]\n"
+            "               [ --verbose OR -v ]\n"
+#ifdef __linux__
+            "               [ --clocksource OR -c [ c(ycle) | h(pet) | s(ystem) ]\n"
+#endif
+            "               [ --replace-registry ]\n"
+            "               [ --silent OR -s ]\n"
+            "               [ --sync OR -S ]\n"
+            "               [ --temporary OR -T ]\n"
+            "               [ --version OR -V ]\n"
+            "         -d backend [ ... backend args ... ]\n"
+#ifdef __APPLE__
+            "               Available backends may include: coreaudio, dummy or net.\n\n"
+#endif 
+#ifdef WIN32
+            "               Available backends may include: portaudio, dummy or net.\n\n"
+#endif 
+#ifdef __linux__
+            "               Available backends may include: alsa, dummy, freebob, firewire or net\n\n"
+#endif
+#if defined(__sun__) || defined(sun)
+            "               Available backends may include: boomer, oss, dummy or net.\n\n"
+#endif
+            "       jackdmp -d backend --help\n"
+            "             to display options for each backend\n\n");
+}
+
+// To put in the control.h interface??
+static jackctl_driver_t *
+jackctl_server_get_driver(
+    jackctl_server_t *server,
+    const char *driver_name)
+{
+    const JSList * node_ptr;
+
+    node_ptr = jackctl_server_get_drivers_list(server);
+
+    while (node_ptr)
+    {
+        if (strcmp(jackctl_driver_get_name((jackctl_driver_t *)node_ptr->data), driver_name) == 0)
+        {
+            return (jackctl_driver_t *)node_ptr->data;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    return NULL;
+}
+
+static jackctl_parameter_t *
+jackctl_get_parameter(
+    const JSList * parameters_list,
+    const char * parameter_name)
+{
+    while (parameters_list)
+    {
+        if (strcmp(jackctl_parameter_get_name((jackctl_parameter_t *)parameters_list->data), parameter_name) == 0)
+        {
+            return (jackctl_parameter_t *)parameters_list->data;
+        }
+
+        parameters_list = jack_slist_next(parameters_list);
+    }
+
+    return NULL;
+}
+
+int main(int argc, char* argv[])
+{
+    jackctl_server_t * server_ctl;
+    const JSList * server_parameters;
+    const char* server_name = "default";
+    jackctl_driver_t * audio_driver_ctl;
+    jackctl_driver_t * midi_driver_ctl;
+    jackctl_driver_t * loopback_driver_ctl;
+    int replace_registry = 0;
+    
+    const char *options = "-d:X:P:uvshVrRL:STFl:t:mn:p:"
+#ifdef __linux__
+        "c:"
+#endif
+        ;
+    
+    struct option long_options[] = {
+#ifdef __linux__
+                                       { "clock-source", 1, 0, 'c' },
+#endif
+                                       { "loopback-driver", 1, 0, 'L' },
+                                       { "audio-driver", 1, 0, 'd' },
+                                       { "midi-driver", 1, 0, 'X' },
+                                       { "verbose", 0, 0, 'v' },
+                                       { "help", 0, 0, 'h' },
+                                       { "port-max", 1, 0, 'p' },
+                                       { "no-mlock", 0, 0, 'm' },
+                                       { "name", 0, 0, 'n' },
+                                       { "unlock", 0, 0, 'u' },
+                                       { "realtime", 0, 0, 'R' },
+                                       { "no-realtime", 0, 0, 'r' }, 
+                                       { "replace-registry", 0, &replace_registry, 0 },
+                                       { "loopback", 0, 0, 'L' },
+                                       { "realtime-priority", 1, 0, 'P' },
+                                       { "timeout", 1, 0, 't' },
+                                       { "temporary", 0, 0, 'T' },
+                                       { "version", 0, 0, 'V' },
+                                       { "silent", 0, 0, 's' },
+                                       { "sync", 0, 0, 'S' },
+                                       { 0, 0, 0, 0 }
+                                   };
+
+    int i,opt = 0;
+    int option_index = 0;
+    bool seen_audio_driver = false;
+    bool seen_midi_driver = false;
+    char *audio_driver_name = NULL;
+    char **audio_driver_args = NULL;
+    int audio_driver_nargs = 1;
+    char *midi_driver_name = NULL;
+    char **midi_driver_args = NULL;
+    int midi_driver_nargs = 1;
+    int do_mlock = 1;
+    int do_unlock = 0;
+    int loopback = 0;
+    bool show_version = false;
+    sigset_t signals;
+    jackctl_parameter_t* param;
+    union jackctl_parameter_value value;
+
+    copyright(stdout);
+#if defined(JACK_DBUS) && defined(__linux__)
+    server_ctl = jackctl_server_create(audio_acquire, audio_release);
+#else
+    server_ctl = jackctl_server_create(NULL, NULL);
+#endif
+    if (server_ctl == NULL) {
+        fprintf(stderr, "Failed to create server object\n");
+        return -1;
+    }
+  
+    server_parameters = jackctl_server_get_parameters(server_ctl);
+    
+    // Default setting
+    param = jackctl_get_parameter(server_parameters, "realtime");
+    if (param != NULL) {
+        value.b = true;
+        jackctl_parameter_set_value(param, &value);
+    }
+    
+    opterr = 0;
+    while (!seen_audio_driver &&
+            (opt = getopt_long(argc, argv, options,
+                               long_options, &option_index)) != EOF) {
+        switch (opt) {
+
+        #ifdef __linux__        
+            case 'c':
+                param = jackctl_get_parameter(server_parameters, "clock-source");
+                if (param != NULL) {
+                    if (tolower (optarg[0]) == 'h') {
+                        value.ui = JACK_TIMER_HPET;
+                        jackctl_parameter_set_value(param, &value);
+                    } else if (tolower (optarg[0]) == 'c') {
+                        value.ui = JACK_TIMER_CYCLE_COUNTER;
+                        jackctl_parameter_set_value(param, &value);
+                    } else if (tolower (optarg[0]) == 's') {
+                        value.ui = JACK_TIMER_SYSTEM_CLOCK;
+                        jackctl_parameter_set_value(param, &value);
+                    } else {
+                        usage(stdout);
+                        goto fail_free1;
+                    }
+                }
+                break;
+        #endif
+
+            case 'd':
+                seen_audio_driver = true;
+                audio_driver_name = optarg;
+                break;
+                
+            case 'L':
+                loopback = atoi(optarg);
+                break;
+
+            case 'X':
+                seen_midi_driver = true;
+                midi_driver_name = optarg;
+                break;
+
+            case 'p':
+                param = jackctl_get_parameter(server_parameters, "port-max");
+                if (param != NULL) {
+                    value.ui = atoi(optarg);
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 'm':
+                do_mlock = 0;
+                break;
+
+            case 'u':
+                do_unlock = 1;
+                break;
+
+            case 'v':
+                param = jackctl_get_parameter(server_parameters, "verbose");
+                if (param != NULL) {
+                    value.b = true;
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 's':
+                jack_set_error_function(silent_jack_error_callback);
+                break;
+
+            case 'S':
+                param = jackctl_get_parameter(server_parameters, "sync");
+                if (param != NULL) {
+                    value.b = true;
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 'n':
+                server_name = optarg;
+                param = jackctl_get_parameter(server_parameters, "name");
+                if (param != NULL) {
+                    strncpy(value.str, optarg, JACK_PARAM_STRING_MAX);
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 'P':
+                param = jackctl_get_parameter(server_parameters, "realtime-priority");
+                if (param != NULL) {
+                    value.i = atoi(optarg);
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+          
+            case 'r':
+                param = jackctl_get_parameter(server_parameters, "realtime");
+                if (param != NULL) {
+                    value.b = false;
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 'R':
+                param = jackctl_get_parameter(server_parameters, "realtime");
+                if (param != NULL) {
+                    value.b = true;
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 'T':
+                param = jackctl_get_parameter(server_parameters, "temporary");
+                if (param != NULL) {
+                    value.b = true;
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 't':
+                param = jackctl_get_parameter(server_parameters, "client-timeout");
+                if (param != NULL) {
+                    value.i = atoi(optarg);
+                    jackctl_parameter_set_value(param, &value);
+                }
+                break;
+
+            case 'V':
+                show_version = true;
+                break;
+
+            default:
+                fprintf(stderr, "unknown option character %c\n", optopt);
+                /*fallthru*/
+
+            case 'h':
+                usage(stdout);
+                goto fail_free1;
+        }
+    }
+    
+    // Long option with no letter so treated separately
+    param = jackctl_get_parameter(server_parameters, "replace-registry");
+    if (param != NULL) {
+        value.b = replace_registry;
+        jackctl_parameter_set_value(param, &value);
+    }
+ 
+    if (show_version) {
+        printf( "jackdmp version " VERSION
+                " tmpdir " jack_server_dir
+                " protocol %d"
+                "\n", JACK_PROTOCOL_VERSION);
+        return -1;
+    }
+
+    if (!seen_audio_driver) {
+        usage(stderr);
+        goto fail_free1;
+    }
+
+    // Audio driver
+    audio_driver_ctl = jackctl_server_get_driver(server_ctl, audio_driver_name);
+    if (audio_driver_ctl == NULL) {
+        fprintf(stderr, "Unknown driver \"%s\"\n", audio_driver_name);
+        goto fail_free1;
+    }
+
+    if (optind < argc) {
+        audio_driver_nargs = 1 + argc - optind;
+    } else {
+        audio_driver_nargs = 1;
+    }
+
+    if (audio_driver_nargs == 0) {
+        fprintf(stderr, "No driver specified ... hmm. JACK won't do"
+                " anything when run like this.\n");
+        goto fail_free1;
+    }
+
+    audio_driver_args = (char **) malloc(sizeof(char *) * audio_driver_nargs);
+    audio_driver_args[0] = audio_driver_name;
+
+    for (i = 1; i < audio_driver_nargs; i++) {
+        audio_driver_args[i] = argv[optind++];
+    }
+
+    if (jackctl_parse_driver_params(audio_driver_ctl, audio_driver_nargs, audio_driver_args)) {
+        goto fail_free1;
+    }
+
+    // Start server
+    if (!jackctl_server_start(server_ctl, audio_driver_ctl)) {
+        fprintf(stderr, "Failed to start server\n");
+        goto fail_free1;
+    }
+
+    // MIDI driver
+    if (seen_midi_driver) {
+
+        midi_driver_ctl = jackctl_server_get_driver(server_ctl, midi_driver_name);
+        if (midi_driver_ctl == NULL) {
+            fprintf(stderr, "Unknown driver \"%s\"\n", midi_driver_name);
+            goto fail_free2;
+        }
+
+        jackctl_server_add_slave(server_ctl, midi_driver_ctl);
+    }
+    
+    // Loopback driver
+    if (loopback > 0) {
+        loopback_driver_ctl = jackctl_server_get_driver(server_ctl, "loopback");
+        if (loopback_driver_ctl != NULL) {
+            const JSList * loopback_parameters = jackctl_driver_get_parameters(loopback_driver_ctl);
+            param = jackctl_get_parameter(loopback_parameters, "channels");
+            if (param != NULL) {
+                value.ui = loopback;
+                jackctl_parameter_set_value(param, &value);
+            }
+            jackctl_server_add_slave(server_ctl, loopback_driver_ctl);
+        }
+    }
+
+    notify_server_start(server_name);
+
+    // Waits for signal
+    signals = jackctl_setup_signals(0);
+    jackctl_wait_signals(signals);
+
+    if (!jackctl_server_stop(server_ctl))
+        fprintf(stderr, "Cannot stop server...\n");
+    
+    jackctl_server_destroy(server_ctl);
+    notify_server_stop(server_name);
+    return 0;
+
+fail_free1:
+    jackctl_server_destroy(server_ctl);
+    return -1;
+    
+fail_free2:
+    jackctl_server_stop(server_ctl);
+    jackctl_server_destroy(server_ctl);
+    notify_server_stop(server_name);
+    return -1;
+}
diff --git a/common/driver_interface.h b/common/driver_interface.h
new file mode 100644
index 0000000..d336f41
--- /dev/null
+++ b/common/driver_interface.h
@@ -0,0 +1,123 @@
+/*
+  Copyright (C) 2003 Bob Ham <rah at bash.sh>
+  Copyright (C) 2008 Nedko Arnaudov <nedko at arnaudov.name>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_driver_interface_h__
+#define __jack_driver_interface_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <limits.h>
+#include "jslist.h"
+#include "JackCompilerDeps.h"
+#include "JackSystemDeps.h"
+
+#define JACK_DRIVER_NAME_MAX          15
+#define JACK_DRIVER_PARAM_NAME_MAX    15
+#define JACK_DRIVER_PARAM_STRING_MAX  63
+#define JACK_DRIVER_PARAM_DESC        255
+#define JACK_PATH_MAX                 511
+
+#define JACK_CONSTRAINT_FLAG_RANGE       ((uint32_t)1) /**< if set, constraint is a range (min-max) */
+#define JACK_CONSTRAINT_FLAG_STRICT      ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
+#define JACK_CONSTRAINT_FLAG_FAKE_VALUE  ((uint32_t)4) /**< if set, values have no user meaningful meaning */
+
+    /** Driver parameter types */
+    typedef enum
+    {
+        JackDriverParamInt = 1,
+        JackDriverParamUInt,
+        JackDriverParamChar,
+        JackDriverParamString,
+        JackDriverParamBool
+    } jack_driver_param_type_t;
+
+    /** Driver parameter value */
+    typedef union
+    {
+        uint32_t ui;
+        int32_t i;
+        char c;
+        char str[JACK_DRIVER_PARAM_STRING_MAX + 1];
+    } jack_driver_param_value_t;
+
+    typedef struct {
+        jack_driver_param_value_t value;
+        char short_desc[64];               /**< A short (~30 chars) description for the user */
+    } jack_driver_param_value_enum_t;
+
+    typedef struct {
+        uint32_t flags;         /**< JACK_CONSTRAINT_FLAG_XXX */
+
+        union {
+            struct {
+                jack_driver_param_value_t min;
+                jack_driver_param_value_t max;
+            } range;            /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
+
+            struct {
+                uint32_t count;
+                jack_driver_param_value_enum_t * possible_values_array;
+            } enumeration;      /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
+        } constraint;
+    } jack_driver_param_constraint_desc_t;
+
+    /** A driver parameter descriptor */
+    typedef struct {
+        char name[JACK_DRIVER_NAME_MAX + 1]; /**< The parameter's name */
+        char character;                    /**< The parameter's character (for getopt, etc) */
+        jack_driver_param_type_t type;     /**< The parameter's type */
+        jack_driver_param_value_t value;   /**< The parameter's (default) value */
+        jack_driver_param_constraint_desc_t * constraint; /**< Pointer to parameter constraint descriptor. NULL if there is no constraint */
+        char short_desc[64];               /**< A short (~30 chars) description for the user */
+        char long_desc[1024];              /**< A longer description for the user */
+    }
+    jack_driver_param_desc_t;
+
+    /** A driver parameter */
+    typedef struct {
+        char character;
+        jack_driver_param_value_t value;
+    }
+    jack_driver_param_t;
+
+
+    /** A struct for describing a jack driver */
+    typedef struct {
+        char name[JACK_DRIVER_NAME_MAX + 1];      /**< The driver's canonical name */
+        char desc[JACK_DRIVER_PARAM_DESC + 1];    /**< The driver's extended description */
+        char file[JACK_PATH_MAX + 1];             /**< The filename of the driver's shared object file */
+        uint32_t nparams;                         /**< The number of parameters the driver has */
+        jack_driver_param_desc_t * params;        /**< An array of parameter descriptors */
+    }
+    jack_driver_desc_t;
+
+
+SERVER_EXPORT int jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_driver_interface_h__ */
+
+
diff --git a/common/jack/control.h b/common/jack/control.h
new file mode 100644
index 0000000..6360d30
--- /dev/null
+++ b/common/jack/control.h
@@ -0,0 +1,565 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+  JACK control API
+
+  Copyright (C) 2008 Nedko Arnaudov
+  Copyright (C) 2008 GRAME
+    
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+/**
+ * @file   jack/control.h
+ * @ingroup publicheader
+ * @brief  JACK control API
+ *
+ */
+
+#ifndef JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED
+#define JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED
+
+#include <jack/jslist.h>
+#include <jack/systemdeps.h>
+#if !defined (__sun__)
+#include <stdbool.h>
+#endif
+
+/** Parameter types, intentionally similar to jack_driver_param_type_t */
+typedef enum
+{
+    JackParamInt = 1,			/**< @brief value type is a signed integer */
+    JackParamUInt,				/**< @brief value type is an unsigned integer */
+    JackParamChar,				/**< @brief value type is a char */
+    JackParamString,			/**< @brief value type is a string with max size of ::JACK_PARAM_STRING_MAX+1 chars */
+    JackParamBool,				/**< @brief value type is a boolean */
+} jackctl_param_type_t;
+
+/** @brief Max value that jackctl_param_type_t type can have */
+#define JACK_PARAM_MAX (JackParamBool + 1)
+
+/** @brief Max length of string parameter value, excluding terminating nul char */
+#define JACK_PARAM_STRING_MAX  63
+
+/** @brief Type for parameter value */
+/* intentionally similar to jack_driver_param_value_t */
+union jackctl_parameter_value
+{
+    uint32_t ui;				/**< @brief member used for ::JackParamUInt */
+    int32_t i;					/**< @brief member used for ::JackParamInt */
+    char c;						/**< @brief member used for ::JackParamChar */
+    char str[JACK_PARAM_STRING_MAX + 1]; /**< @brief member used for ::JackParamString */
+    bool b;				/**< @brief member used for ::JackParamBool */
+};
+
+/** opaque type for server object */
+typedef struct jackctl_server jackctl_server_t;
+
+/** opaque type for driver object */
+typedef struct jackctl_driver jackctl_driver_t;
+
+/** opaque type for internal client object */
+typedef struct jackctl_internal jackctl_internal_t;
+
+/** opaque type for parameter object */
+typedef struct jackctl_parameter jackctl_parameter_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+} /* Adjust editor indent */
+#endif
+
+/**
+ * @defgroup ServerControl Controling the server
+ * @{
+ */
+
+/** 
+ * Call this function to setup process signal handling. As a general
+ * rule, it is required for proper operation for the server object.
+ * 
+ * @param flags signals setup flags, use 0 for none. Currently no
+ * flags are defined
+ *
+ * @return the configurated signal set.
+ */
+sigset_t
+jackctl_setup_signals(
+    unsigned int flags);
+
+/** 
+ * Call this function to wait on a signal set.
+ * 
+ * @param signals signals set to wait on
+ */
+void
+jackctl_wait_signals(
+    sigset_t signals);
+
+/**
+ * Call this function to create server object.
+ *
+ * @param on_device_acquire - Optional callback to be called before device is acquired. If false is returned, device usage will fail
+ * @param on_device_release - Optional callback to be called after device is released.
+ *
+ * @return server object handle, NULL if creation of server object
+ * failed. Successfully created server object must be destroyed with
+ * paired call to ::jackctl_server_destroy
+ */
+jackctl_server_t *
+jackctl_server_create(
+    bool (* on_device_acquire)(const char * device_name),
+    void (* on_device_release)(const char * device_name));
+
+/** 
+ * Call this function to destroy server object.
+ * 
+ * @param server server object handle to destroy
+ */
+void
+jackctl_server_destroy(
+	jackctl_server_t * server);
+
+/** 
+ * Call this function to start JACK server
+ * 
+ * @param server server object handle
+ * @param driver driver to use
+ * 
+ * @return success status: true - success, false - fail
+ */
+bool
+jackctl_server_start(
+    jackctl_server_t * server,
+    jackctl_driver_t * driver);
+
+/** 
+ * Call this function to stop JACK server
+ * 
+ * @param server server object handle
+ * 
+ * @return success status: true - success, false - fail
+ */
+bool
+jackctl_server_stop(
+	jackctl_server_t * server);
+
+/** 
+ * Call this function to get list of available drivers. List node data
+ * pointers is a driver object handle (::jackctl_driver_t).
+ * 
+ * @param server server object handle to get drivers for
+ *
+ * @return Single linked list of driver object handles. Must not be
+ * modified. Always same for same server object.
+ */
+const JSList *
+jackctl_server_get_drivers_list(
+	jackctl_server_t * server);
+
+/** 
+ * Call this function to get list of server parameters. List node data
+ * pointers is a parameter object handle (::jackctl_parameter_t).
+ * 
+ * @param server server object handle to get parameters for
+ *
+ * @return Single linked list of parameter object handles. Must not be
+ * modified. Always same for same server object.
+ */
+const JSList *
+jackctl_server_get_parameters(
+	jackctl_server_t * server);
+
+/** 
+ * Call this function to get list of available internal clients. List node data
+ * pointers is a internal client object handle (::jackctl_internal_t).
+ * 
+ * @param server server object handle to get internal clients for
+ *
+ * @return Single linked list of internal client object handles. Must not be
+ * modified. Always same for same server object.
+ */
+const JSList *
+jackctl_server_get_internals_list(
+	jackctl_server_t * server);
+
+/** 
+ * Call this function to load one internal client.
+ * 
+ * @param server server object handle
+ * @param internal internal to use
+ * 
+ * @return success status: true - success, false - fail
+ */
+bool
+jackctl_server_load_internal(
+    jackctl_server_t * server,
+    jackctl_internal_t * internal);
+
+/** 
+ * Call this function to unload one internal client.
+ * 
+ * @param server server object handle
+ * @param internal internal to unload
+ * 
+ * @return success status: true - success, false - fail
+ */
+bool
+jackctl_server_unload_internal(
+    jackctl_server_t * server,
+    jackctl_internal_t * internal);
+
+/** 
+ * Call this function to add a slave in the driver slave list.
+ * 
+ * @param server server object handle
+ * @param driver driver to add in the driver slave list.
+ * 
+ * @return success status: true - success, false - fail
+ */ 
+bool 
+jackctl_server_add_slave(jackctl_server_t * server,
+                            jackctl_driver_t * driver);
+
+/** 
+ * Call this function to remove a slave from the driver slave list.
+ * 
+ * @param server server object handle
+ * @param driver driver to remove from the driver slave list.
+ * 
+ * @return success status: true - success, false - fail
+ */ 
+bool 
+jackctl_server_remove_slave(jackctl_server_t * server,
+                            jackctl_driver_t * driver);
+
+/** 
+ * Call this function to switch master driver.
+ * 
+ * @param server server object handle
+ * @param driver driver to switch to
+ * 
+ * @return success status: true - success, false - fail
+ */                          
+bool 
+jackctl_server_switch_master(jackctl_server_t * server,
+                            jackctl_driver_t * driver);
+                            
+
+/** 
+ * Call this function to get name of driver.
+ * 
+ * @param driver driver object handle to get name of
+ *
+ * @return driver name. Must not be modified. Always same for same
+ * driver object.
+ */
+const char *
+jackctl_driver_get_name(
+	jackctl_driver_t * driver);
+
+/** 
+ * Call this function to get list of driver parameters. List node data
+ * pointers is a parameter object handle (::jackctl_parameter_t).
+ * 
+ * @param driver driver object handle to get parameters for
+ *
+ * @return Single linked list of parameter object handles. Must not be
+ * modified. Always same for same driver object.
+ */
+const JSList *
+jackctl_driver_get_parameters(
+	jackctl_driver_t * driver);
+
+/** 
+ * Call this function to get name of internal client.
+ * 
+ * @param internal internal object handle to get name of
+ *
+ * @return internal name. Must not be modified. Always same for same
+ * internal object.
+ */
+const char *
+jackctl_internal_get_name(
+	jackctl_internal_t * internal);
+
+/** 
+ * Call this function to get list of internal parameters. List node data
+ * pointers is a parameter object handle (::jackctl_parameter_t).
+ * 
+ * @param internal internal object handle to get parameters for
+ *
+ * @return Single linked list of parameter object handles. Must not be
+ * modified. Always same for same internal object.
+ */
+const JSList *
+jackctl_internal_get_parameters(
+	jackctl_internal_t * internal);
+
+/** 
+ * Call this function to get parameter name.
+ * 
+ * @param parameter parameter object handle to get name of
+ *
+ * @return parameter name. Must not be modified. Always same for same
+ * parameter object.
+ */
+const char *
+jackctl_parameter_get_name(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to get parameter short description.
+ * 
+ * @param parameter parameter object handle to get short description of
+ *
+ * @return parameter short description. Must not be modified. Always
+ * same for same parameter object.
+ */
+const char *
+jackctl_parameter_get_short_description(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to get parameter long description.
+ * 
+ * @param parameter parameter object handle to get long description of
+ *
+ * @return parameter long description. Must not be modified. Always
+ * same for same parameter object.
+ */
+const char *
+jackctl_parameter_get_long_description(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to get parameter type.
+ * 
+ * @param parameter parameter object handle to get type of
+ *
+ * @return parameter type. Always same for same parameter object.
+ */
+jackctl_param_type_t
+jackctl_parameter_get_type(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to get parameter character.
+ * 
+ * @param parameter parameter object handle to get character of
+ *
+ * @return character. 
+ */
+char
+jackctl_parameter_get_id(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to check whether parameter has been set, or its
+ * default value is being used.
+ * 
+ * @param parameter parameter object handle to check
+ *
+ * @return true - parameter is set, false - parameter is using default
+ * value.
+ */
+bool
+jackctl_parameter_is_set(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to reset parameter to its default value.
+ * 
+ * @param parameter parameter object handle to reset value of
+ *
+ * @return success status: true - success, false - fail
+ */
+bool
+jackctl_parameter_reset(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to get parameter value.
+ * 
+ * @param parameter parameter object handle to get value of
+ *
+ * @return parameter value.
+ */
+union jackctl_parameter_value
+jackctl_parameter_get_value(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to set parameter value.
+ * 
+ * @param parameter parameter object handle to get value of
+ * @param value_ptr pointer to variable containing parameter value
+ *
+ * @return success status: true - success, false - fail
+ */
+bool
+jackctl_parameter_set_value(
+	jackctl_parameter_t * parameter,
+	const union jackctl_parameter_value * value_ptr);
+
+/** 
+ * Call this function to get parameter default value.
+ * 
+ * @param parameter parameter object handle to get default value of
+ *
+ * @return parameter default value.
+ */
+union jackctl_parameter_value
+jackctl_parameter_get_default_value(
+	jackctl_parameter_t * parameter);
+    
+/** 
+ * Call this function check whether parameter has range constraint.
+ * 
+ * @param parameter object handle of parameter to check
+ *
+ * @return whether parameter has range constraint.
+ */
+bool
+jackctl_parameter_has_range_constraint(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function check whether parameter has enumeration constraint.
+ * 
+ * @param parameter object handle of parameter to check
+ *
+ * @return whether parameter has enumeration constraint.
+ */
+bool
+jackctl_parameter_has_enum_constraint(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function get how many enumeration values parameter has.
+ * 
+ * @param parameter object handle of parameter
+ *
+ * @return number of enumeration values
+ */
+uint32_t
+jackctl_parameter_get_enum_constraints_count(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to get parameter enumeration value.
+ * 
+ * @param parameter object handle of parameter
+ * @param index index of parameter enumeration value
+ *
+ * @return enumeration value.
+ */
+union jackctl_parameter_value
+jackctl_parameter_get_enum_constraint_value(
+	jackctl_parameter_t * parameter,
+	uint32_t index);
+
+/** 
+ * Call this function to get parameter enumeration value description.
+ * 
+ * @param parameter object handle of parameter
+ * @param index index of parameter enumeration value
+ *
+ * @return enumeration value description.
+ */
+const char *
+jackctl_parameter_get_enum_constraint_description(
+	jackctl_parameter_t * parameter,
+	uint32_t index);
+
+/** 
+ * Call this function to get parameter range.
+ * 
+ * @param parameter object handle of parameter
+ * @param min_ptr pointer to variable receiving parameter minimum value
+ * @param max_ptr pointer to variable receiving parameter maximum value
+ */
+void
+jackctl_parameter_get_range_constraint(
+	jackctl_parameter_t * parameter,
+	union jackctl_parameter_value * min_ptr,
+	union jackctl_parameter_value * max_ptr);
+
+/** 
+ * Call this function to check whether parameter constraint is strict,
+ * i.e. whether supplying non-matching value will not work for sure.
+ * 
+ * @param parameter parameter object handle to check
+ *
+ * @return whether parameter constraint is strict.
+ */
+bool
+jackctl_parameter_constraint_is_strict(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to check whether parameter has fake values,
+ * i.e. values have no user meaningful meaning and only value
+ * description is meaningful to user.
+ * 
+ * @param parameter parameter object handle to check
+ *
+ * @return whether parameter constraint is strict.
+ */
+bool
+jackctl_parameter_constraint_is_fake_value(
+	jackctl_parameter_t * parameter);
+
+/** 
+ * Call this function to log an error message.
+ * 
+ * @param format string
+ */
+void
+jack_error(
+	const char *format,
+	...);
+
+/** 
+ * Call this function to log an information message.
+ * 
+ * @param format string
+ */
+void
+jack_info(
+	const char *format,
+	...);
+
+/** 
+ * Call this function to log an information message but only when
+ * verbose mode is enabled.
+ * 
+ * @param format string
+ */
+void
+jack_log(
+	const char *format,
+	...);
+
+/* @} */
+
+#if 0
+{ /* Adjust editor indent */
+#endif
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* #ifndef JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED */
diff --git a/common/jack/intclient.h b/common/jack/intclient.h
new file mode 100644
index 0000000..50d758d
--- /dev/null
+++ b/common/jack/intclient.h
@@ -0,0 +1,130 @@
+/*
+*  Copyright (C) 2004 Jack O'Quin
+*  
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU Lesser General Public License as published by
+*  the Free Software Foundation; either version 2.1 of the License, or
+*  (at your option) any later version.
+*  
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU Lesser General Public License for more details.
+*  
+*  You should have received a copy of the GNU Lesser General Public License
+*  along with this program; if not, write to the Free Software 
+*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#ifndef __jack_intclient_h__
+#define __jack_intclient_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <jack/types.h>
+
+/**
+ * Get an internal client's name.  This is useful when @ref
+ * JackUseExactName was not specified on jack_internal_client_load()
+ * and @ref JackNameNotUnique status was returned.  In that case, the
+ * actual name will differ from the @a client_name requested.
+ *
+ * @param client requesting JACK client's handle.
+ *
+ * @param intclient handle returned from jack_internal_client_load()
+ * or jack_internal_client_handle().
+ *
+ * @return NULL if unsuccessful, otherwise pointer to the internal
+ * client name obtained from the heap via malloc().  The caller should
+ * free() this storage when no longer needed.
+ */
+char *jack_get_internal_client_name (jack_client_t *client,
+                                     jack_intclient_t intclient);
+
+/**
+ * Return the @ref jack_intclient_t handle for an internal client
+ * running in the JACK server.
+ *
+ * @param client requesting JACK client's handle.
+ *
+ * @param client_name for the internal client of no more than
+ * jack_client_name_size() characters.  The name scope is local to the
+ * current server.
+ *
+ * @param status (if non-NULL) an address for JACK to return
+ * information from this operation.  This status word is formed by
+ * OR-ing together the relevant @ref JackStatus bits.
+ *
+ * @return Opaque internal client handle if successful.  If 0, the
+ * internal client was not found, and @a *status includes the @ref
+ * JackNoSuchClient and @ref JackFailure bits.
+ */
+jack_intclient_t jack_internal_client_handle (jack_client_t *client,
+        const char *client_name,
+        jack_status_t *status);
+
+/**
+ * Load an internal client into the JACK server.
+ *
+ * Internal clients run inside the JACK server process.  They can use
+ * most of the same functions as external clients.  Each internal
+ * client is built as a shared object module, which must declare
+ * jack_initialize() and jack_finish() entry points called at load and
+ * unload times.  See @ref inprocess.c for an example.
+ *
+ * @param client loading JACK client's handle.
+ *
+ * @param client_name of at most jack_client_name_size() characters
+ * for the internal client to load.  The name scope is local to the
+ * current server.
+ *
+ * @param options formed by OR-ing together @ref JackOptions bits.
+ * Only the @ref JackLoadOptions bits are valid.
+ *
+ * @param status (if non-NULL) an address for JACK to return
+ * information from the load operation.  This status word is formed by
+ * OR-ing together the relevant @ref JackStatus bits.
+ *
+ * <b>Optional parameters:</b> depending on corresponding [@a options
+ * bits] additional parameters may follow @a status (in this order).
+ *
+ * @arg [@ref JackLoadName] <em>(char *) load_name</em> is the shared
+ * object file from which to load the new internal client (otherwise
+ * use the @a client_name).
+ *
+ * @arg [@ref JackLoadInit] <em>(char *) load_init</em> an arbitary
+ * string passed to the internal client's jack_initialize() routine
+ * (otherwise NULL), of no more than @ref JACK_LOAD_INIT_LIMIT bytes.
+ *
+ * @return Opaque internal client handle if successful.  If this is 0,
+ * the load operation failed, the internal client was not loaded, and
+ * @a *status includes the @ref JackFailure bit.
+ */
+jack_intclient_t jack_internal_client_load (jack_client_t *client,
+        const char *client_name,
+        jack_options_t options,
+        jack_status_t *status, ...);
+/**
+ * Unload an internal client from a JACK server.  This calls the
+ * intclient's jack_finish() entry point then removes it.  See @ref
+ * inprocess.c for an example.
+ *
+ * @param client unloading JACK client's handle.
+ *
+ * @param intclient handle returned from jack_internal_client_load() or
+ * jack_internal_client_handle().
+ *
+ * @return 0 if successful, otherwise @ref JackStatus bits.
+ */
+jack_status_t jack_internal_client_unload (jack_client_t *client,
+        jack_intclient_t intclient);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_intclient_h__ */
diff --git a/common/jack/jack.h b/common/jack/jack.h
new file mode 100644
index 0000000..96800dc
--- /dev/null
+++ b/common/jack/jack.h
@@ -0,0 +1,1142 @@
+/*
+  Copyright (C) 2001 Paul Davis
+  Copyright (C) 2004 Jack O'Quin
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+  
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software 
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_h__
+#define __jack_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <jack/systemdeps.h>
+#include <jack/types.h>
+#include <jack/transport.h>
+
+/**
+ * Note: More documentation can be found in jack/types.h.
+ */
+ 
+    /*************************************************************
+     * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
+     * added to the JACK API after the 0.116.2 release.
+     * 
+     * Functions that predate this release are marked with 
+     * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile
+     * time in a variety of ways. The default definition is empty,
+     * so that these symbols get normal linkage. If you wish to
+     * use all JACK symbols with weak linkage, include 
+     * <jack/weakjack.h> before jack.h.
+     *************************************************************/
+    
+#include <jack/weakmacros.h>
+    
+/**
+ * Call this function to get version of the JACK, in form of several numbers
+ *
+ * @param major_ptr pointer to variable receiving major version of JACK.
+ *
+ * @param minor_ptr pointer to variable receiving minor version of JACK.
+ *
+ * @param major_ptr pointer to variable receiving micro version of JACK.
+ *
+ * @param major_ptr pointer to variable receiving protocol version of JACK.
+ *
+ */
+void
+jack_get_version(
+    int *major_ptr,
+    int *minor_ptr,
+    int *micro_ptr,
+    int *proto_ptr) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Call this function to get version of the JACK, in form of a string
+ *
+ * @return Human readable string describing JACK version being used.
+ *
+ */
+const char *
+jack_get_version_string() JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Open an external client session with a JACK server.  This interface
+ * is more complex but more powerful than jack_client_new().  With it,
+ * clients may choose which of several servers to connect, and control
+ * whether and how to start the server automatically, if it was not
+ * already running.  There is also an option for JACK to generate a
+ * unique client name, when necessary.
+ *
+ * @param client_name of at most jack_client_name_size() characters.
+ * The name scope is local to each server.  Unless forbidden by the
+ * @ref JackUseExactName option, the server will modify this name to
+ * create a unique variant, if needed.
+ *
+ * @param options formed by OR-ing together @ref JackOptions bits.
+ * Only the @ref JackOpenOptions bits are allowed.
+ *
+ * @param status (if non-NULL) an address for JACK to return
+ * information from the open operation.  This status word is formed by
+ * OR-ing together the relevant @ref JackStatus bits.
+ *
+ *
+ * <b>Optional parameters:</b> depending on corresponding [@a options
+ * bits] additional parameters may follow @a status (in this order).
+ *
+ * @arg [@ref JackServerName] <em>(char *) server_name</em> selects
+ * from among several possible concurrent server instances.  Server
+ * names are unique to each user.  If unspecified, use "default"
+ * unless \$JACK_DEFAULT_SERVER is defined in the process environment.
+ *
+ * @return Opaque client handle if successful.  If this is NULL, the
+ * open operation failed, @a *status includes @ref JackFailure and the
+ * caller is not a JACK client.
+ */
+jack_client_t * jack_client_open (const char *client_name,
+                                  jack_options_t options,
+                                  jack_status_t *status, ...) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+* \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
+*  NEW JACK CLIENTS
+*
+* @deprecated Please use jack_client_open().
+*/
+jack_client_t * jack_client_new (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
+
+/**
+ * Disconnects an external client from a JACK server.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_client_close (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the maximum number of characters in a JACK client name
+ * including the final NULL character.  This value is a constant.
+ */
+int jack_client_name_size (void) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return pointer to actual client name.  This is useful when @ref
+ * JackUseExactName is not specified on open and @ref
+ * JackNameNotUnique status was returned.  In that case, the actual
+ * name will differ from the @a client_name requested.
+ */
+char * jack_get_client_name (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Load an internal client into the Jack server.
+ *
+ * Internal clients run inside the JACK server process.  They can use
+ * most of the same functions as external clients.  Each internal
+ * client must declare jack_initialize() and jack_finish() entry
+ * points, called at load and unload times.  See inprocess.c for an
+ * example of how to write an internal client.
+ *
+ * @deprecated Please use jack_internal_client_load().
+ *
+ * @param client_name of at most jack_client_name_size() characters.
+ *
+ * @param load_name of a shared object file containing the code for
+ * the new client.
+ *
+ * @param load_init an arbitary string passed to the jack_initialize()
+ * routine of the new client (may be NULL).
+ *
+ * @return 0 if successful.
+ */
+int jack_internal_client_new (const char *client_name,
+                              const char *load_name,
+                              const char *load_init) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
+
+/**
+ * Remove an internal client from a JACK server.
+ *
+ * @deprecated Please use jack_internal_client_load().
+ */
+void jack_internal_client_close (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
+
+/**
+ * Tell the Jack server that the program is ready to start processing
+ * audio.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_activate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the Jack server to remove this @a client from the process
+ * graph.  Also, disconnect all ports belonging to it, since inactive
+ * clients have no port connections.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_deactivate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return pid of client. If not available, 0 will be returned.
+ */
+int jack_get_client_pid (const char *name) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the pthread ID of the thread running the JACK client side
+ * code.
+ */
+pthread_t jack_client_thread_id (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+/**
+ * @param client pointer to JACK client structure.
+ *
+ * Check if the JACK subsystem is running with -R (--realtime).
+ *
+ * @return 1 if JACK is running realtime, 0 otherwise
+ */
+int jack_is_realtime (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @defgroup NonCallbackAPI The non-callback API
+ * @{
+ */
+
+/**
+ * \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
+ *  NEW JACK CLIENTS.
+ *
+ * @deprecated Please use jack_cycle_wait() and jack_cycle_signal() functions.
+ */
+jack_nframes_t jack_thread_wait (jack_client_t*, int status) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Wait until this JACK client should process data.
+ * 
+ * @param client - pointer to a JACK client structure
+ *
+ * @return the number of frames of data to process
+ */
+    jack_nframes_t jack_cycle_wait (jack_client_t* client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Signal next clients in the graph.
+ * 
+ * @param client - pointer to a JACK client structure
+ * @param status - if non-zero, calling thread should exit
+ */
+void jack_cycle_signal (jack_client_t* client, int status) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the Jack server to call @a thread_callback in the RT thread.
+ * Typical use are in conjunction with @a jack_cycle_wait and @a jack_cycle_signal functions.
+ * The code in the supplied function must be suitable for real-time
+ * execution.  That means that it cannot call functions that might
+ * block for a long time. This includes malloc, free, printf,
+ * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
+ * pthread_cond_wait, etc, etc. See
+ * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
+ * for more information.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+*/
+int jack_set_process_thread(jack_client_t* client, JackThreadCallback thread_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+/**
+ * @defgroup ClientCallbacks Setting Client Callbacks
+ * @{
+ */
+
+/**
+ * Tell JACK to call @a thread_init_callback once just after
+ * the creation of the thread in which all other callbacks 
+ * will be handled.
+ *
+ * The code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code, causing JACK
+ * to remove that client from the process() graph.
+ */
+int jack_set_thread_init_callback (jack_client_t *client,
+                                   JackThreadInitCallback thread_init_callback,
+                                   void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @param client pointer to JACK client structure.
+ * @param function The jack_shutdown function pointer.
+ * @param arg The arguments for the jack_shutdown function.
+ *
+ * Register a function (and argument) to be called if and when the
+ * JACK server shuts down the client thread.  The function must
+ * be written as if it were an asynchonrous POSIX signal
+ * handler --- use only async-safe functions, and remember that it
+ * is executed from another thread.  A typical function might
+ * set a flag or write to a pipe so that the rest of the
+ * application knows that the JACK client thread has shut
+ * down.
+ *
+ * NOTE: clients do not need to call this.  It exists only
+ * to help more complex clients understand what is going
+ * on.  It should be called before jack_client_activate().
+ *
+ * NOTE: if a client calls this AND jack_on_info_shutdown(), then
+ * the event of a client thread shutdown, the callback
+ * passed to this function will not be called, and the one passed to
+ * jack_on_info_shutdown() will.
+ */
+void jack_on_shutdown (jack_client_t *client,
+                       JackShutdownCallback shutdown_callback, void *arg) JACK_WEAK_EXPORT;
+
+/**
+ * @param client pointer to JACK client structure.
+ * @param function The jack_info_shutdown function pointer.
+ * @param arg The arguments for the jack_info_shutdown function.
+ *
+ * Register a function (and argument) to be called if and when the
+ * JACK server shuts down the client thread.  The function must
+ * be written as if it were an asynchonrous POSIX signal
+ * handler --- use only async-safe functions, and remember that it
+ * is executed from another thread.  A typical function might
+ * set a flag or write to a pipe so that the rest of the
+ * application knows that the JACK client thread has shut
+ * down.
+ *
+ * NOTE: clients do not need to call this.  It exists only
+ * to help more complex clients understand what is going
+ * on.  It should be called before jack_client_activate().
+ *
+ * NOTE: if a client calls this AND jack_on_info_shutdown(), then
+ * the event of a client thread shutdown, the callback
+ * passed to this function will not be called, and the one passed to
+ * jack_on_info_shutdown() will.
+ */
+void jack_on_info_shutdown (jack_client_t *client,
+                            JackInfoShutdownCallback shutdown_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+    
+/**
+ * Tell the Jack server to call @a process_callback whenever there is
+ * work be done, passing @a arg as the second argument.
+ *
+ * The code in the supplied function must be suitable for real-time
+ * execution.  That means that it cannot call functions that might
+ * block for a long time. This includes malloc, free, printf,
+ * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
+ * pthread_cond_wait, etc, etc. See
+ * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
+ * for more information.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int jack_set_process_callback (jack_client_t *client,
+                               JackProcessCallback process_callback,
+                               void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the Jack server to call @a freewheel_callback
+ * whenever we enter or leave "freewheel" mode, passing @a
+ * arg as the second argument. The first argument to the
+ * callback will be non-zero if JACK is entering freewheel
+ * mode, and zero otherwise.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int jack_set_freewheel_callback (jack_client_t *client,
+                                 JackFreewheelCallback freewheel_callback,
+                                 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell JACK to call @a bufsize_callback whenever the size of the the
+ * buffer that will be passed to the @a process_callback is about to
+ * change.  Clients that depend on knowing the buffer size must supply
+ * a @a bufsize_callback before activating themselves.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @param client pointer to JACK client structure.
+ * @param bufsize_callback function to call when the buffer size changes.
+ * @param arg argument for @a bufsize_callback.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_buffer_size_callback (jack_client_t *client,
+                                   JackBufferSizeCallback bufsize_callback,
+                                   void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the Jack server to call @a srate_callback whenever the system
+ * sample rate changes.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_sample_rate_callback (jack_client_t *client,
+                                   JackSampleRateCallback srate_callback,
+                                   void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the JACK server to call @a client_registration_callback whenever a
+ * client is registered or unregistered, passing @a arg as a parameter.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_client_registration_callback (jack_client_t *,
+                       JackClientRegistrationCallback
+                                           registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the JACK server to call @a registration_callback whenever a
+ * port is registered or unregistered, passing @a arg as a parameter.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+ int jack_set_port_registration_callback (jack_client_t *,
+                                          JackPortRegistrationCallback
+                                          registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+        
+ /**
+ * Tell the JACK server to call @a connect_callback whenever a
+ * port is connected or disconnected, passing @a arg as a parameter.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_port_connect_callback (jack_client_t *,
+                                    JackPortConnectCallback
+                                    connect_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+ /**
+ * Tell the JACK server to call @a rename_callback whenever a
+ * port is renamed, passing @a arg as a parameter.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_port_rename_callback (jack_client_t *,
+                                   JackPortRenameCallback
+                                   rename_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the JACK server to call @a graph_callback whenever the
+ * processing graph is reordered, passing @a arg as a parameter.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_graph_order_callback (jack_client_t *,
+                                   JackGraphOrderCallback graph_callback,
+                                   void *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Tell the JACK server to call @a xrun_callback whenever there is a
+ * xrun, passing @a arg as a parameter.
+ *
+ * All "notification events" are received in a seperated non RT thread,
+ * the code in the supplied function does not need to be
+ * suitable for real-time execution.
+ *
+ * NOTE: this function cannot be called while the client is activated 
+ * (after jack_activate has been called.)
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_xrun_callback (jack_client_t *,
+                            JackXRunCallback xrun_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+                            
+/*@}*/
+
+/**
+ * @defgroup ServerClientControl Controlling & querying JACK server operation
+ * @{
+ */
+                         
+/**
+ * Start/Stop JACK's "freewheel" mode.
+ *
+ * When in "freewheel" mode, JACK no longer waits for
+ * any external event to begin the start of the next process
+ * cycle. 
+ *
+ * As a result, freewheel mode causes "faster than realtime"
+ * execution of a JACK graph. If possessed, real-time
+ * scheduling is dropped when entering freewheel mode, and
+ * if appropriate it is reacquired when stopping.
+ * 
+ * IMPORTANT: on systems using capabilities to provide real-time
+ * scheduling (i.e. Linux kernel 2.4), if onoff is zero, this function
+ * must be called from the thread that originally called jack_activate(). 
+ * This restriction does not apply to other systems (e.g. Linux kernel 2.6 
+ * or OS X).
+ * 
+ * @param client pointer to JACK client structure
+ * @param onoff  if non-zero, freewheel mode starts. Otherwise
+ *                  freewheel mode ends.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int jack_set_freewheel(jack_client_t* client, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Change the buffer size passed to the @a process_callback.
+ *
+ * This operation stops the JACK engine process cycle, then calls all
+ * registered @a bufsize_callback functions before restarting the
+ * process cycle.  This will cause a gap in the audio flow, so it
+ * should only be done at appropriate stopping points.
+ *
+ * @see jack_set_buffer_size_callback()
+ *
+ * @param client pointer to JACK client structure.
+ * @param nframes new buffer size.  Must be a power of two.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes) JACK_OPTIONAL_WEAK_EXPORT;
+                       
+/**
+ * @return the sample rate of the jack system, as set by the user when
+ * jackd was started.
+ */
+jack_nframes_t jack_get_sample_rate (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the current maximum size that will ever be passed to the @a
+ * process_callback.  It should only be used *before* the client has
+ * been activated.  This size may change, clients that depend on it
+ * must register a @a bufsize_callback so they will be notified if it
+ * does.
+ *
+ * @see jack_set_buffer_size_callback()
+ */
+jack_nframes_t jack_get_buffer_size (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Old-style interface to become the timebase for the entire JACK
+ * subsystem.
+ *
+ * @deprecated This function still exists for compatibility with the
+ * earlier transport interface, but it does nothing.  Instead, see
+ * transport.h and use jack_set_timebase_callback().
+ *
+ * @return ENOSYS, function not implemented.
+ */
+int jack_engine_takeover_timebase (jack_client_t *) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
+
+/**
+ * @return the current CPU load estimated by JACK.  This is a running
+ * average of the time it takes to execute a full process cycle for
+ * all clients as a percentage of the real time available per cycle
+ * determined by the buffer size and sample rate.
+ */
+float jack_cpu_load (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+/**
+ * @defgroup PortFunctions Creating & manipulating ports
+ * @{
+ */
+ 
+/**
+ * Create a new port for the client. This is an object used for moving
+ * data of any type in or out of the client.  Ports may be connected
+ * in various ways.
+ *
+ * Each port has a short name.  The port's full name contains the name
+ * of the client concatenated with a colon (:) followed by its short
+ * name.  The jack_port_name_size() is the maximum length of this full
+ * name.  Exceeding that will cause the port registration to fail and
+ * return NULL.
+ *
+ * All ports have a type, which may be any non-NULL and non-zero
+ * length string, passed as an argument.  Some port types are built
+ * into the JACK API, currently only JACK_DEFAULT_AUDIO_TYPE.
+ *
+ * @param client pointer to JACK client structure.
+ * @param port_name non-empty short name for the new port (not
+ * including the leading @a "client_name:").
+ * @param port_type port type name.  If longer than
+ * jack_port_type_size(), only that many characters are significant.
+ * @param flags @ref JackPortFlags bit mask.
+ * @param buffer_size must be non-zero if this is not a built-in @a
+ * port_type.  Otherwise, it is ignored.
+ *
+ * @return jack_port_t pointer on success, otherwise NULL.
+ */
+jack_port_t * jack_port_register (jack_client_t *client,
+                                  const char *port_name,
+                                  const char *port_type,
+                                  unsigned long flags,
+                                  unsigned long buffer_size) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Remove the port from the client, disconnecting any existing
+ * connections.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_port_unregister (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * This returns a pointer to the memory area associated with the
+ * specified port. For an output port, it will be a memory area
+ * that can be written to; for an input port, it will be an area
+ * containing the data from the port's connection(s), or
+ * zero-filled. if there are multiple inbound connections, the data
+ * will be mixed appropriately.  
+ *
+ * FOR OUTPUT PORTS ONLY : DEPRECATED in Jack 2.0 !!
+ * ---------------------------------------------------
+ * You may cache the value returned, but only between calls to
+ * your "blocksize" callback. For this reason alone, you should
+ * either never cache the return value or ensure you have
+ * a "blocksize" callback and be sure to invalidate the cached
+ * address from there.
+ * 
+ * Caching output ports is DEPRECATED in Jack 2.0, due to some new optimization (like "pipelining").
+ * Port buffers have to be retrieved in each callback for proper functionning. 
+ */
+void * jack_port_get_buffer (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the full name of the jack_port_t (including the @a
+ * "client_name:" prefix).
+ *
+ * @see jack_port_name_size().
+ */
+const char * jack_port_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the short name of the jack_port_t (not including the @a
+ * "client_name:" prefix).
+ *
+ * @see jack_port_name_size().
+ */
+const char * jack_port_short_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the @ref JackPortFlags of the jack_port_t.
+ */
+int jack_port_flags (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the @a port type, at most jack_port_type_size() characters
+ * including a final NULL.
+ */
+const char * jack_port_type (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+ /**
+ * @return the @a port type id.
+ */
+jack_port_type_id_t jack_port_type_id (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return TRUE if the jack_port_t belongs to the jack_client_t.
+ */
+int jack_port_is_mine (const jack_client_t *, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return number of connections to or from @a port.
+ *
+ * @pre The calling client must own @a port.
+ */
+int jack_port_connected (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return TRUE if the locally-owned @a port is @b directly connected
+ * to the @a port_name.
+ *
+ * @see jack_port_name_size()
+ */
+int jack_port_connected_to (const jack_port_t *port,
+                            const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return a null-terminated array of full port names to which the @a
+ * port is connected.  If none, returns NULL.
+ *
+ * The caller is responsible for calling free(3) on any non-NULL
+ * returned value.
+ *
+ * @param port locally owned jack_port_t pointer.
+ *
+ * @see jack_port_name_size(), jack_port_get_all_connections()
+ */
+const char ** jack_port_get_connections (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return a null-terminated array of full port names to which the @a
+ * port is connected.  If none, returns NULL.
+ *
+ * The caller is responsible for calling free(3) on any non-NULL
+ * returned value.
+ *
+ * This differs from jack_port_get_connections() in two important
+ * respects:
+ *
+ *     1) You may not call this function from code that is
+ *          executed in response to a JACK event. For example,
+ *          you cannot use it in a GraphReordered handler.
+ *
+ *     2) You need not be the owner of the port to get information
+ *          about its connections. 
+ *
+ * @see jack_port_name_size()
+ */
+const char ** jack_port_get_all_connections (const jack_client_t *client,
+                                             const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ *
+ * @deprecated This function will be removed from a future version 
+ * of JACK. Do not use it. There is no replacement. It has 
+ * turned out to serve essentially no purpose in real-life
+ * JACK clients.
+ */
+int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
+
+/**
+ *
+ * @deprecated This function will be removed from a future version 
+ * of JACK. Do not use it. There is no replacement. It has 
+ * turned out to serve essentially no purpose in real-life
+ * JACK clients.
+ */
+int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
+
+ /**
+ * @return the time (in frames) between data being available or
+ * delivered at/to a port, and the time at which it arrived at or is
+ * delivered to the "other side" of the port.  E.g. for a physical
+ * audio output port, this is the time between writing to the port and
+ * when the signal will leave the connector.  For a physical audio
+ * input port, this is the time between the sound arriving at the
+ * connector and the corresponding frames being readable from the
+ * port.
+ */
+jack_nframes_t jack_port_get_latency (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * The maximum of the sum of the latencies in every
+ * connection path that can be drawn between the port and other
+ * ports with the @ref JackPortIsTerminal flag set.
+ */
+jack_nframes_t jack_port_get_total_latency (jack_client_t *,
+                                            jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * The port latency is zero by default. Clients that control
+ * physical hardware with non-zero latency should call this
+ * to set the latency to its correct value. Note that the value
+ * should include any systemic latency present "outside" the
+ * physical hardware controlled by the client. For example,
+ * for a client controlling a digital audio interface connected
+ * to an external digital converter, the latency setting should
+ * include both buffering by the audio interface *and* the converter. 
+ */
+void jack_port_set_latency (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+* Request a complete recomputation of a port's total latency. This
+* can be called by a client that has just changed the internal
+* latency of its port using @function jack_port_set_latency
+* and wants to ensure that all signal pathways in the graph
+* are updated with respect to the values that will be returned
+* by @function jack_port_get_total_latency. 
+* 
+* @return zero for successful execution of the request. non-zero
+*         otherwise.
+*/
+int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+* Request a complete recomputation of all port latencies. This
+* can be called by a client that has just changed the internal
+* latency of its port using @function jack_port_set_latency
+* and wants to ensure that all signal pathways in the graph
+* are updated with respect to the values that will be returned
+* by @function jack_port_get_total_latency. It allows a client 
+* to change multiple port latencies without triggering a 
+* recompute for each change.
+* 
+* @return zero for successful execution of the request. non-zero
+*         otherwise.
+*/
+    int jack_recompute_total_latencies (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Modify a port's short name.  May be called at any time.  If the
+ * resulting full name (including the @a "client_name:" prefix) is
+ * longer than jack_port_name_size(), it will be truncated.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Set @a alias as an alias for @a port.  May be called at any time.
+ * If the alias is longer than jack_port_name_size(), it will be truncated.
+ * 
+ * After a successful call, and until JACK exits or
+ * @function jack_port_unset_alias() is called, @alias may be
+ * used as a alternate name for the port.
+ *
+ * Ports can have up to two aliases - if both are already 
+ * set, this function will return an error.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int jack_port_set_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Remove @a alias as an alias for @a port.  May be called at any time.
+ * 
+ * After a successful call, @a alias can no longer be 
+ * used as a alternate name for the port.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int jack_port_unset_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Get any aliases known for @port.
+ *
+ * @return the number of aliases discovered for the port
+ */
+int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * If @ref JackPortCanMonitor is set for this @a port, turn input
+ * monitoring on or off.  Otherwise, do nothing.
+ */
+int jack_port_request_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * If @ref JackPortCanMonitor is set for this @a port_name, turn input
+ * monitoring on or off.  Otherwise, do nothing.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ *
+ * @see jack_port_name_size()
+ */
+int jack_port_request_monitor_by_name (jack_client_t *client,
+                                       const char *port_name, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * If @ref JackPortCanMonitor is set for a port, this function turns
+ * on input monitoring if it was off, and turns it off if only one
+ * request has been made to turn it on.  Otherwise it does nothing.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_port_ensure_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return TRUE if input monitoring has been requested for @a port.
+ */
+int jack_port_monitoring_input (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Establish a connection between two ports.
+ *
+ * When a connection exists, data written to the source port will
+ * be available to be read at the destination port.
+ *
+ * @pre The port types must be identical.
+ *
+ * @pre The @ref JackPortFlags of the @a source_port must include @ref
+ * JackPortIsOutput.
+ *
+ * @pre The @ref JackPortFlags of the @a destination_port must include
+ * @ref JackPortIsInput.
+ *
+ * @return 0 on success, EEXIST if the connection is already made,
+ * otherwise a non-zero error code
+ */
+int jack_connect (jack_client_t *,
+                  const char *source_port,
+                  const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Remove a connection between two ports.
+ *
+ * @pre The port types must be identical.
+ *
+ * @pre The @ref JackPortFlags of the @a source_port must include @ref
+ * JackPortIsOutput.
+ *
+ * @pre The @ref JackPortFlags of the @a destination_port must include
+ * @ref JackPortIsInput.
+ *
+ * @return 0 on success, otherwise a non-zero error code
+ */
+int jack_disconnect (jack_client_t *,
+                     const char *source_port,
+                     const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Perform the same function as jack_disconnect() using port handles
+ * rather than names.  This avoids the name lookup inherent in the
+ * name-based version.
+ *
+ * Clients connecting their own ports are likely to use this function,
+ * while generic connection clients (e.g. patchbays) would use
+ * jack_disconnect().
+ */
+int jack_port_disconnect (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the maximum number of characters in a full JACK port name
+ * including the final NULL character.  This value is a constant.
+ *
+ * A port's full name contains the owning client name concatenated
+ * with a colon (:) followed by its short name and a NULL
+ * character.
+ */
+int jack_port_name_size(void) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the maximum number of characters in a JACK port type name
+ * including the final NULL character.  This value is a constant.
+ */
+int jack_port_type_size(void) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+/**
+ * @defgroup PortSearching Looking up ports
+ * @{
+ */
+
+/**
+ * @param port_name_pattern A regular expression used to select 
+ * ports by name.  If NULL or of zero length, no selection based 
+ * on name will be carried out.
+ * @param type_name_pattern A regular expression used to select 
+ * ports by type.  If NULL or of zero length, no selection based 
+ * on type will be carried out.
+ * @param flags A value used to select ports by their flags.  
+ * If zero, no selection based on flags will be carried out.
+ *
+ * @return a NULL-terminated array of ports that match the specified
+ * arguments.  The caller is responsible for calling free(3) any
+ * non-NULL returned value.
+ *
+ * @see jack_port_name_size(), jack_port_type_size()
+ */
+const char ** jack_get_ports (jack_client_t *,
+                              const char *port_name_pattern,
+                              const char *type_name_pattern,
+                              unsigned long flags) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return address of the jack_port_t named @a port_name.
+ *
+ * @see jack_port_name_size()
+ */
+jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return address of the jack_port_t of a @a port_id.
+ */
+jack_port_t * jack_port_by_id (jack_client_t *client,
+                               jack_port_id_t port_id) JACK_OPTIONAL_WEAK_EXPORT;
+                               
+/*@}*/ 
+
+/**
+ * @defgroup TimeFunctions Handling time
+ * @{
+ *
+ * JACK time is in units of 'frames', according to the current sample rate.
+ * The absolute value of frame times is meaningless, frame times have meaning
+ * only relative to each other.
+ */
+
+/**
+ * @return the estimated time in frames that has passed since the JACK
+ * server began the current process cycle.
+ */
+jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the estimated current time in frames.
+ * This function is intended for use in other threads (not the process
+ * callback).  The return value can be compared with the value of
+ * jack_last_frame_time to relate time in other threads to JACK time.
+ */
+jack_nframes_t jack_frame_time (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the precise time at the start of the current process cycle.
+ * This function may only be used from the process callback, and can
+ * be used to interpret timestamps generated by jack_frame_time() in
+ * other threads with respect to the current process cycle.
+ * 
+ * This is the only jack time function that returns exact time:
+ * when used during the process callback it always returns the same
+ * value (until the next process callback, where it will return
+ * that value + nframes, etc).  The return value is guaranteed to be
+ * monotonic and linear in this fashion unless an xrun occurs.
+ * If an xrun occurs, clients must check this value again, as time
+ * may have advanced in a non-linear way (e.g. cycles may have been skipped).
+ */
+jack_nframes_t jack_last_frame_time (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the estimated time in microseconds of the specified frame time
+ */
+jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return the estimated time in frames for the specified system time.
+ */
+jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @return return JACK's current system time in microseconds,
+ *         using the JACK clock source. 
+ * 
+ * The value returned is guaranteed to be monotonic, but not linear.
+ */
+jack_time_t jack_get_time() JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+/**
+ * @defgroup ErrorOutput Controlling error/information output
+ */
+/*@{*/
+
+/**
+ * Display JACK error message.
+ *
+ * Set via jack_set_error_function(), otherwise a JACK-provided
+ * default will print @a msg (plus a newline) to stderr.
+ *
+ * @param msg error message text (no newline at end).
+ */
+extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Set the @ref jack_error_callback for error message display.
+ * Set it to NULL to restore default_jack_error_callback function.
+ *
+ * The JACK library provides two built-in callbacks for this purpose:
+ * default_jack_error_callback() and silent_jack_error_callback().
+ */
+void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Display JACK info message.
+ *
+ * Set via jack_set_info_function(), otherwise a JACK-provided
+ * default will print @a msg (plus a newline) to stdout.
+ *
+ * @param msg info message text (no newline at end).
+ */
+extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Set the @ref jack_info_callback for info message display.
+ * Set it to NULL to restore default_jack_info_callback function.
+ *
+ * The JACK library provides two built-in callbacks for this purpose:
+ * default_jack_info_callback() and silent_jack_info_callback().
+ */
+void jack_set_info_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+/**
+ * The free function to be used on memory returned by jack_port_get_connections, 
+ * jack_port_get_all_connections and jack_get_ports functions.
+ * This is MANDATORY on Windows when otherwise all nasty runtime version related crashes can occur.
+ * Developers are strongly encouraged to use this function instead of the standard "free" function in new code.
+ *
+ */
+void jack_free(void* ptr) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_h__ */
diff --git a/common/jack/jslist.h b/common/jack/jslist.h
new file mode 100644
index 0000000..3ec0ce9
--- /dev/null
+++ b/common/jack/jslist.h
@@ -0,0 +1,293 @@
+/*
+  Based on gslist.c from glib-1.2.9 (LGPL).
+
+  Adaption to JACK, Copyright (C) 2002 Kai Vehmanen.
+    - replaced use of gtypes with normal ANSI C types
+    - glib's memory allocation routines replaced with
+      malloc/free calls
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_jslist_h__
+#define __jack_jslist_h__
+
+#include <stdlib.h>
+#include <jack/systemdeps.h>
+
+#ifdef sun
+#define __inline__
+#endif
+
+typedef struct _JSList JSList;
+
+typedef int	(*JCompareFunc)	(void* a, void* b);
+struct _JSList
+{
+    void *data;
+    JSList *next;
+};
+
+static __inline__
+JSList*
+jack_slist_alloc (void)
+{
+    JSList *new_list;
+
+    new_list = (JSList*)malloc(sizeof(JSList));
+    if (new_list) {
+        new_list->data = NULL;
+        new_list->next = NULL;
+    }
+
+    return new_list;
+}
+
+static __inline__
+JSList*
+jack_slist_prepend (JSList* list, void* data)
+{
+    JSList *new_list;
+
+    new_list = (JSList*)malloc(sizeof(JSList));
+    if (new_list) {
+        new_list->data = data;
+        new_list->next = list;
+    }
+
+    return new_list;
+}
+
+#define jack_slist_next(slist)	((slist) ? (((JSList *)(slist))->next) : NULL)
+static __inline__
+JSList*
+jack_slist_last (JSList *list)
+{
+    if (list) {
+        while (list->next)
+            list = list->next;
+    }
+
+    return list;
+}
+
+static __inline__
+JSList*
+jack_slist_remove_link (JSList *list,
+                        JSList *link)
+{
+    JSList *tmp;
+    JSList *prev;
+
+    prev = NULL;
+    tmp = list;
+
+    while (tmp) {
+        if (tmp == link) {
+            if (prev)
+                prev->next = tmp->next;
+            if (list == tmp)
+                list = list->next;
+
+            tmp->next = NULL;
+            break;
+        }
+
+        prev = tmp;
+        tmp = tmp->next;
+    }
+
+    return list;
+}
+
+static __inline__
+void
+jack_slist_free (JSList *list)
+{
+    while (list) {
+        JSList *next = list->next;
+        free(list);
+        list = next;
+    }
+}
+
+static __inline__
+void
+jack_slist_free_1 (JSList *list)
+{
+    if (list) {
+        free(list);
+    }
+}
+
+static __inline__
+JSList*
+jack_slist_remove (JSList *list,
+                   void *data)
+{
+    JSList *tmp;
+    JSList *prev;
+
+    prev = NULL;
+    tmp = list;
+
+    while (tmp) {
+        if (tmp->data == data) {
+            if (prev)
+                prev->next = tmp->next;
+            if (list == tmp)
+                list = list->next;
+
+            tmp->next = NULL;
+            jack_slist_free (tmp);
+
+            break;
+        }
+
+        prev = tmp;
+        tmp = tmp->next;
+    }
+
+    return list;
+}
+
+static __inline__
+unsigned int
+jack_slist_length (JSList *list)
+{
+    unsigned int length;
+
+    length = 0;
+    while (list) {
+        length++;
+        list = list->next;
+    }
+
+    return length;
+}
+
+static __inline__
+JSList*
+jack_slist_find (JSList *list,
+                 void *data)
+{
+    while (list) {
+        if (list->data == data)
+            break;
+        list = list->next;
+    }
+
+    return list;
+}
+
+static __inline__
+JSList*
+jack_slist_copy (JSList *list)
+{
+    JSList *new_list = NULL;
+
+    if (list) {
+        JSList *last;
+
+        new_list = jack_slist_alloc ();
+        new_list->data = list->data;
+        last = new_list;
+        list = list->next;
+        while (list) {
+            last->next = jack_slist_alloc ();
+            last = last->next;
+            last->data = list->data;
+            list = list->next;
+        }
+    }
+
+    return new_list;
+}
+
+static __inline__
+JSList*
+jack_slist_append (JSList *list,
+                   void *data)
+{
+    JSList *new_list;
+    JSList *last;
+
+    new_list = jack_slist_alloc ();
+    new_list->data = data;
+
+    if (list) {
+        last = jack_slist_last (list);
+        last->next = new_list;
+
+        return list;
+    } else
+        return new_list;
+}
+
+static __inline__
+JSList*
+jack_slist_sort_merge (JSList *l1,
+                       JSList *l2,
+                       JCompareFunc compare_func)
+{
+    JSList list, *l;
+
+    l = &list;
+
+    while (l1 && l2) {
+        if (compare_func(l1->data, l2->data) < 0) {
+            l = l->next = l1;
+            l1 = l1->next;
+        } else {
+            l = l->next = l2;
+            l2 = l2->next;
+        }
+    }
+    l->next = l1 ? l1 : l2;
+
+    return list.next;
+}
+
+static __inline__
+JSList*
+jack_slist_sort (JSList *list,
+                 JCompareFunc compare_func)
+{
+    JSList *l1, *l2;
+
+    if (!list)
+        return NULL;
+    if (!list->next)
+        return list;
+
+    l1 = list;
+    l2 = list->next;
+
+    while ((l2 = l2->next) != NULL) {
+        if ((l2 = l2->next) == NULL)
+            break;
+        l1 = l1->next;
+    }
+    l2 = l1->next;
+    l1->next = NULL;
+
+    return jack_slist_sort_merge (jack_slist_sort (list, compare_func),
+                                  jack_slist_sort (l2, compare_func),
+                                  compare_func);
+}
+
+#endif /* __jack_jslist_h__ */
+
diff --git a/common/jack/midiport.h b/common/jack/midiport.h
new file mode 100644
index 0000000..fd620b8
--- /dev/null
+++ b/common/jack/midiport.h
@@ -0,0 +1,159 @@
+/*
+    Copyright (C) 2004 Ian Esten
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+
+#ifndef __JACK_MIDIPORT_H
+#define __JACK_MIDIPORT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+	
+#include <jack/types.h>
+#include <stdlib.h>
+#include <jack/weakmacros.h>
+	
+/** Type for raw event data contained in @ref jack_midi_event_t. */
+typedef unsigned char jack_midi_data_t;
+
+
+/** A Jack MIDI event. */
+typedef struct _jack_midi_event
+{
+	jack_nframes_t    time;   /**< Sample index at which event is valid */
+	size_t            size;   /**< Number of bytes of data in \a buffer */
+	jack_midi_data_t *buffer; /**< Raw MIDI data */
+} jack_midi_event_t;
+
+
+/**
+ * @defgroup MIDIAPI Reading and writing MIDI data 
+ * @{
+ */
+
+/** Get number of events in a port buffer.
+ *
+ * @param port_buffer Port buffer from which to retrieve event.
+ * @return number of events inside @a port_buffer
+ */
+jack_nframes_t
+jack_midi_get_event_count(void* port_buffer) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+/** Get a MIDI event from an event port buffer.
+ * 
+ * Jack MIDI is normalised, the MIDI event returned by this function is
+ * guaranteed to be a complete MIDI event (the status byte will always be
+ * present, and no realtime events will interspered with the event).
+ *
+ * @param event Event structure to store retrieved event in.
+ * @param port_buffer Port buffer from which to retrieve event.
+ * @param event_index Index of event to retrieve.
+ * @return 0 on success, ENODATA if buffer is empty.
+ */
+int
+jack_midi_event_get(jack_midi_event_t *event,
+                    void              *port_buffer,
+                    jack_nframes_t     event_index) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+/** Clear an event buffer.
+ * 
+ * This should be called at the beginning of each process cycle before calling
+ * @ref jack_midi_event_reserve or @ref jack_midi_event_write. This
+ * function may not be called on an input port's buffer.
+ *
+ * @param port_buffer Port buffer to clear (must be an output port buffer).
+ */
+void
+jack_midi_clear_buffer(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+/** Get the size of the largest event that can be stored by the port.
+ *
+ * This function returns the current space available, taking into account
+ * events already stored in the port.
+ *
+ * @param port_buffer Port buffer to check size of.
+ */
+size_t
+jack_midi_max_event_size(void* port_buffer) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+/** Allocate space for an event to be written to an event port buffer.
+ *
+ * Clients are to write the actual event data to be written starting at the
+ * pointer returned by this function. Clients must not write more than
+ * @a data_size bytes into this buffer.  Clients must write normalised
+ * MIDI data to the port - no running status and no (1-byte) realtime
+ * messages interspersed with other messages (realtime messages are fine
+ * when they occur on their own, like other messages).
+ *
+ * @param port_buffer Buffer to write event to.
+ * @param time Sample offset of event.
+ * @param data_size Length of event's raw data in bytes.
+ * @return Pointer to the beginning of the reserved event's data buffer, or
+ * NULL on error (ie not enough space).
+ */
+jack_midi_data_t*
+jack_midi_event_reserve(void *port_buffer,
+                        jack_nframes_t  time, 
+                        size_t data_size) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+/** Write an event into an event port buffer.
+ *
+ * This function is simply a wrapper for @ref jack_midi_event_reserve
+ * which writes the event data into the space reserved in the buffer.
+ * The same restrictions on the MIDI data apply.
+ * 
+ * @param port_buffer Buffer to write event to.
+ * @param time Sample offset of event.
+ * @param data Message data to be written.
+ * @param data_size Length of @a data in bytes.
+ * @return 0 on success, ENOBUFS if there's not enough space in buffer for event.
+ */
+int
+jack_midi_event_write(void *port_buffer,
+                      jack_nframes_t time,
+                      const jack_midi_data_t *data,
+                      size_t data_size) JACK_OPTIONAL_WEAK_EXPORT;
+
+
+/** Get the number of events that could not be written to @a port_buffer.
+ *
+ * This function returning a non-zero value implies @a port_buffer is full.
+ * Currently the only way this can happen is if events are lost on port mixdown.
+ *
+ * @param port_buffer Port to receive count for.
+ * @returns Number of events that could not be written to @a port_buffer.
+ */
+jack_nframes_t
+jack_midi_get_lost_event_count(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __JACK_MIDIPORT_H */
+
+
diff --git a/common/jack/ringbuffer.h b/common/jack/ringbuffer.h
new file mode 100644
index 0000000..cb0ca94
--- /dev/null
+++ b/common/jack/ringbuffer.h
@@ -0,0 +1,243 @@
+/*
+  Copyright (C) 2000 Paul Davis
+  Copyright (C) 2003 Rohan Drape
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+  
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software 
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef _RINGBUFFER_H
+#define _RINGBUFFER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <sys/types.h>
+
+/** @file ringbuffer.h
+ *
+ * A set of library functions to make lock-free ringbuffers available
+ * to JACK clients.  The `capture_client.c' (in the example_clients
+ * directory) is a fully functioning user of this API.
+ *
+ * The key attribute of a ringbuffer is that it can be safely accessed
+ * by two threads simultaneously -- one reading from the buffer and
+ * the other writing to it -- without using any synchronization or
+ * mutual exclusion primitives.  For this to work correctly, there can
+ * only be a single reader and a single writer thread.  Their
+ * identities cannot be interchanged.
+ */
+
+typedef struct {
+    char *buf;
+    size_t len;
+}
+jack_ringbuffer_data_t ;
+
+typedef struct {
+    char	*buf;
+    volatile size_t write_ptr;
+    volatile size_t read_ptr;
+    size_t	size;
+    size_t	size_mask;
+    int	mlocked;
+}
+jack_ringbuffer_t ;
+
+/**
+ * Allocates a ringbuffer data structure of a specified size. The
+ * caller must arrange for a call to jack_ringbuffer_free() to release
+ * the memory associated with the ringbuffer.
+ *
+ * @param sz the ringbuffer size in bytes.
+ *
+ * @return a pointer to a new jack_ringbuffer_t, if successful; NULL
+ * otherwise.
+ */
+jack_ringbuffer_t *jack_ringbuffer_create(size_t sz);
+
+/**
+ * Frees the ringbuffer data structure allocated by an earlier call to
+ * jack_ringbuffer_create().
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ */
+void jack_ringbuffer_free(jack_ringbuffer_t *rb);
+
+/**
+ * Fill a data structure with a description of the current readable
+ * data held in the ringbuffer.  This description is returned in a two
+ * element array of jack_ringbuffer_data_t.  Two elements are needed
+ * because the data to be read may be split across the end of the
+ * ringbuffer.
+ *
+ * The first element will always contain a valid @a len field, which
+ * may be zero or greater.  If the @a len field is non-zero, then data
+ * can be read in a contiguous fashion using the address given in the
+ * corresponding @a buf field.
+ *
+ * If the second element has a non-zero @a len field, then a second
+ * contiguous stretch of data can be read from the address given in
+ * its corresponding @a buf field.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param vec a pointer to a 2 element array of jack_ringbuffer_data_t.
+ *
+ */
+void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb,
+                                     jack_ringbuffer_data_t *vec);
+
+/**
+ * Fill a data structure with a description of the current writable
+ * space in the ringbuffer.  The description is returned in a two
+ * element array of jack_ringbuffer_data_t.  Two elements are needed
+ * because the space available for writing may be split across the end
+ * of the ringbuffer.
+ *
+ * The first element will always contain a valid @a len field, which
+ * may be zero or greater.  If the @a len field is non-zero, then data
+ * can be written in a contiguous fashion using the address given in
+ * the corresponding @a buf field.
+ *
+ * If the second element has a non-zero @a len field, then a second
+ * contiguous stretch of data can be written to the address given in
+ * the corresponding @a buf field.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param vec a pointer to a 2 element array of jack_ringbuffer_data_t.
+ */
+void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb,
+                                      jack_ringbuffer_data_t *vec);
+
+/**
+ * Read data from the ringbuffer.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param dest a pointer to a buffer where data read from the
+ * ringbuffer will go.
+ * @param cnt the number of bytes to read.
+ *
+ * @return the number of bytes read, which may range from 0 to cnt.
+ */
+size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt);
+
+/**
+ * Read data from the ringbuffer. Opposed to jack_ringbuffer_read()
+ * this function does not move the read pointer. Thus it's
+ * a convenient way to inspect data in the ringbuffer in a
+ * continous fashion. The price is that the data is copied
+ * into a user provided buffer. For "raw" non-copy inspection
+ * of the data in the ringbuffer use jack_ringbuffer_get_read_vector().
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param dest a pointer to a buffer where data read from the
+ * ringbuffer will go.
+ * @param cnt the number of bytes to read.
+ *
+ * @return the number of bytes read, which may range from 0 to cnt.
+ */
+size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt);
+
+/**
+ * Advance the read pointer.
+ *
+ * After data have been read from the ringbuffer using the pointers
+ * returned by jack_ringbuffer_get_read_vector(), use this function to
+ * advance the buffer pointers, making that space available for future
+ * write operations.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param cnt the number of bytes read.
+ */
+void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt);
+
+/**
+ * Return the number of bytes available for reading.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ *
+ * @return the number of bytes available to read.
+ */
+size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb);
+
+/**
+ * Lock a ringbuffer data block into memory.
+ *
+ * Uses the mlock() system call.  This is not a realtime operation.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ */
+int jack_ringbuffer_mlock(jack_ringbuffer_t *rb);
+
+/**
+ * Reset the read and write pointers, making an empty buffer.
+ *
+ * This is not thread safe.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ */
+void jack_ringbuffer_reset(jack_ringbuffer_t *rb);
+
+/**
+ * Reset the internal "available" size, and read and write pointers, making an empty buffer.
+ *
+ * This is not thread safe.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param sz the new size, that must be less than allocated size.
+ */
+void jack_ringbuffer_reset_size (jack_ringbuffer_t * rb, size_t sz);
+
+/**
+ * Write data into the ringbuffer.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param src a pointer to the data to be written to the ringbuffer.
+ * @param cnt the number of bytes to write.
+ *
+ * @return the number of bytes write, which may range from 0 to cnt
+ */
+size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src,
+                             size_t cnt);
+
+/**
+ * Advance the write pointer.
+ *
+ * After data have been written the ringbuffer using the pointers
+ * returned by jack_ringbuffer_get_write_vector(), use this function
+ * to advance the buffer pointer, making the data available for future
+ * read operations.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ * @param cnt the number of bytes written.
+ */
+void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt);
+
+/**
+ * Return the number of bytes available for writing.
+ *
+ * @param rb a pointer to the ringbuffer structure.
+ *
+ * @return the amount of free space (in bytes) available for writing.
+ */
+size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/jack/statistics.h b/common/jack/statistics.h
new file mode 100644
index 0000000..28c270d
--- /dev/null
+++ b/common/jack/statistics.h
@@ -0,0 +1,57 @@
+/*
+*  Copyright (C) 2004 Rui Nuno Capela, Lee Revell
+*  
+*  This program is free software; you can redistribute it and/or
+*  modify it under the terms of the GNU Lesser General Public License
+*  as published by the Free Software Foundation; either version 2.1
+*  of the License, or (at your option) any later version.
+*  
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+*  Lesser General Public License for more details.
+*  
+*  You should have received a copy of the GNU Lesser General Public
+*  License along with this program; if not, write to the Free
+*  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+*  02111-1307, USA.
+*
+*/
+
+#ifndef __statistics_h__
+#define __statistics_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <jack/types.h>
+
+/**
+ * @return the maximum delay reported by the backend since
+ * startup or reset.  When compared to the period size in usecs, this
+ * can be used to estimate the ideal period size for a given setup.
+ */
+float jack_get_max_delayed_usecs (jack_client_t *client);
+
+/**
+ * @return the delay in microseconds due to the most recent XRUN
+ * occurrence.  This probably only makes sense when called from a @ref
+ * JackXRunCallback defined using jack_set_xrun_callback().
+ */
+float jack_get_xrun_delayed_usecs (jack_client_t *client);
+
+/**
+ * Reset the maximum delay counter.  This would be useful
+ * to estimate the effect that a change to the configuration of a running
+ * system (e.g. toggling kernel preemption) has on the delay
+ * experienced by JACK, without having to restart the JACK engine.
+ */
+void jack_reset_max_delayed_usecs (jack_client_t *client);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __statistics_h__ */
diff --git a/common/jack/systemdeps.h b/common/jack/systemdeps.h
new file mode 100644
index 0000000..939e3c3
--- /dev/null
+++ b/common/jack/systemdeps.h
@@ -0,0 +1,62 @@
+/*
+Copyright (C) 2004-2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __jack_systemdeps_h__
+#define __jack_systemdeps_h__
+
+#ifdef WIN32
+
+#include <windows.h>
+
+#ifdef _MSC_VER     /* Microsoft compiler */
+    #define __inline__ inline
+    #ifndef int8_t
+        typedef char int8_t;
+        typedef unsigned char uint8_t;
+        typedef short int16_t;
+        typedef unsigned short uint16_t;
+        typedef long int32_t;
+        typedef unsigned long uint32_t;
+        typedef LONGLONG int64_t;
+        typedef ULONGLONG uint64_t;
+    #endif
+    #ifndef pthread_t
+        typedef HANDLE pthread_t;
+    #endif
+#elif __MINGW32__   /* MINGW */
+    #include <stdint.h>
+    #include <sys/types.h>
+    #ifndef pthread_t
+        typedef HANDLE pthread_t;
+    #endif
+#else               /* other compilers ...*/
+    #include <inttypes.h>
+    #include <pthread.h>
+    #include <sys/types.h>
+#endif
+
+#endif /* WIN32 */
+
+#if defined(__APPLE__) || defined(__linux__) || defined(__sun__) || defined(sun)
+    #include <inttypes.h>
+    #include <pthread.h>
+    #include <sys/types.h>
+#endif /* __APPLE__ || __linux__ || __sun__ || sun */
+
+#endif
diff --git a/common/jack/thread.h b/common/jack/thread.h
new file mode 100644
index 0000000..5d002af
--- /dev/null
+++ b/common/jack/thread.h
@@ -0,0 +1,156 @@
+/*
+   Copyright (C) 2004 Paul Davis
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_thread_h__
+#define __jack_thread_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <jack/systemdeps.h>
+#include <jack/weakmacros.h>
+
+/** @file thread.h
+ *
+ * Library functions to standardize thread creation for JACK and its
+ * clients.  These interfaces hide some system variations in the
+ * handling of realtime scheduling and associated privileges.
+ */
+
+/**
+ * @defgroup ClientThreads Creating and managing client threads
+ * @{
+ */
+
+ /**
+ * @returns if JACK is running with realtime scheduling, this returns
+ * the priority that any JACK-created client threads will run at.
+ * Otherwise returns -1.
+ */
+
+int jack_client_real_time_priority (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * @returns if JACK is running with realtime scheduling, this returns
+ * the maximum priority that a JACK client thread should use if the thread
+ * is subject to realtime scheduling. Otherwise returns -1.
+ */
+
+int jack_client_max_real_time_priority (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Attempt to enable realtime scheduling for a thread.  On some
+ * systems that may require special privileges.
+ *
+ * @param thread POSIX thread ID.
+ * @param priority requested thread priority.
+ *
+ * @returns 0, if successful; EPERM, if the calling process lacks
+ * required realtime privileges; otherwise some other error number.
+ */
+int jack_acquire_real_time_scheduling (pthread_t thread, int priority) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Create a thread for JACK or one of its clients.  The thread is
+ * created executing @a start_routine with @a arg as its sole
+ * argument.
+ *
+ * @param client the JACK client for whom the thread is being created. May be
+ * NULL if the client is being created within the JACK server.
+ * @param thread place to return POSIX thread ID.
+ * @param priority thread priority, if realtime.
+ * @param realtime true for the thread to use realtime scheduling.  On
+ * some systems that may require special privileges.
+ * @param start_routine function the thread calls when it starts.
+ * @param arg parameter passed to the @a start_routine.
+ *
+ * @returns 0, if successful; otherwise some error number.
+ */
+int jack_client_create_thread (jack_client_t* client,
+                               pthread_t *thread,
+                               int priority,
+                               int realtime, 	/* boolean */
+                               void *(*start_routine)(void*),
+                               void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Drop realtime scheduling for a thread.
+ *
+ * @param thread POSIX thread ID.
+ *
+ * @returns 0, if successful; otherwise an error number.
+ */
+int jack_drop_real_time_scheduling (pthread_t thread) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Stop the thread, waiting for the thread handler to terminate.
+ *
+ * @param thread POSIX thread ID.
+ *
+ * @returns 0, if successful; otherwise an error number.
+ */
+int jack_client_stop_thread(jack_client_t* client, pthread_t thread) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Cancel the thread then waits for the thread handler to terminate.
+ *
+ * @param thread POSIX thread ID.
+ *
+ * @returns 0, if successful; otherwise an error number.
+ */
+ int jack_client_kill_thread(jack_client_t* client, pthread_t thread) JACK_OPTIONAL_WEAK_EXPORT;
+
+#ifndef WIN32
+
+ typedef int (*jack_thread_creator_t)(pthread_t*,
+				     const pthread_attr_t*,
+				     void* (*function)(void*),
+				     void* arg);
+/**
+ * This function can be used in very very specialized cases
+ * where it is necessary that client threads created by JACK
+ * are created by something other than pthread_create(). After
+ * it is used, any threads that JACK needs for the client will
+ * will be created by calling the function passed to this
+ * function.
+ *
+ * No normal application/client should consider calling this.
+ * The specific case for which it was created involves running
+ * win32/x86 plugins under Wine on Linux, where it is necessary
+ * that all threads that might call win32 functions are known
+ * to Wine.
+ *
+ * Set it to NULL to restore thread creation function.
+ *
+ * @param creator a function that creates a new thread
+ *
+ */
+void jack_set_thread_creator (jack_thread_creator_t creator) JACK_OPTIONAL_WEAK_EXPORT;
+
+#endif
+
+/* @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_thread_h__ */
diff --git a/common/jack/transport.h b/common/jack/transport.h
new file mode 100644
index 0000000..e8ba8cb
--- /dev/null
+++ b/common/jack/transport.h
@@ -0,0 +1,247 @@
+/*
+    Copyright (C) 2002 Paul Davis
+    Copyright (C) 2003 Jack O'Quin
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_transport_h__
+#define __jack_transport_h__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <jack/types.h>
+#include <jack/weakmacros.h>
+
+/**
+ * @defgroup TransportControl Transport and Timebase control
+ * @{
+ */
+
+/**
+ * Called by the timebase master to release itself from that
+ * responsibility.
+ *
+ * If the timebase master releases the timebase or leaves the JACK
+ * graph for any reason, the JACK engine takes over at the start of
+ * the next process cycle.  The transport state does not change.  If
+ * rolling, it continues to play, with frame numbers as the only
+ * available position information.
+ *
+ * @see jack_set_timebase_callback
+ *
+ * @param client the JACK client structure.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int  jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Register (or unregister) as a slow-sync client, one that cannot
+ * respond immediately to transport position changes.
+ *
+ * The @a sync_callback will be invoked at the first available
+ * opportunity after its registration is complete.  If the client is
+ * currently active this will be the following process cycle,
+ * otherwise it will be the first cycle after calling jack_activate().
+ * After that, it runs according to the ::JackSyncCallback rules.
+ * Clients that don't set a @a sync_callback are assumed to be ready
+ * immediately any time the transport wants to start.
+ *
+ * @param client the JACK client structure.
+ * @param sync_callback is a realtime function that returns TRUE when
+ * the client is ready.  Setting @a sync_callback to NULL declares that
+ * this client no longer requires slow-sync processing.
+ * @param arg an argument for the @a sync_callback function.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int  jack_set_sync_callback (jack_client_t *client,
+			     JackSyncCallback sync_callback,
+			     void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Set the timeout value for slow-sync clients.
+ *
+ * This timeout prevents unresponsive slow-sync clients from
+ * completely halting the transport mechanism.  The default is two
+ * seconds.  When the timeout expires, the transport starts rolling,
+ * even if some slow-sync clients are still unready.  The @a
+ * sync_callbacks of these clients continue being invoked, giving them
+ * a chance to catch up.
+ *
+ * @see jack_set_sync_callback
+ *
+ * @param client the JACK client structure.
+ * @param timeout is delay (in microseconds) before the timeout expires.
+ *
+ * @return 0 on success, otherwise a non-zero error code.
+ */
+int  jack_set_sync_timeout (jack_client_t *client,
+			    jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Register as timebase master for the JACK subsystem.
+ *
+ * The timebase master registers a callback that updates extended
+ * position information such as beats or timecode whenever necessary.
+ * Without this extended information, there is no need for this
+ * function.
+ *
+ * There is never more than one master at a time.  When a new client
+ * takes over, the former @a timebase_callback is no longer called.
+ * Taking over the timebase may be done conditionally, so it fails if
+ * there was a master already.
+ *
+ * @param client the JACK client structure.
+ * @param conditional non-zero for a conditional request.
+ * @param timebase_callback is a realtime function that returns
+ * position information.
+ * @param arg an argument for the @a timebase_callback function.
+ *
+ * @return
+ *   - 0 on success;
+ *   - EBUSY if a conditional request fails because there was already a
+ *   timebase master;
+ *   - other non-zero error code.
+ */
+int  jack_set_timebase_callback (jack_client_t *client,
+				 int conditional,
+				 JackTimebaseCallback timebase_callback,
+				 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Reposition the transport to a new frame number.
+ *
+ * May be called at any time by any client.  The new position takes
+ * effect in two process cycles.  If there are slow-sync clients and
+ * the transport is already rolling, it will enter the
+ * ::JackTransportStarting state and begin invoking their @a
+ * sync_callbacks until ready.  This function is realtime-safe.
+ *
+ * @see jack_transport_reposition, jack_set_sync_callback
+ * 
+ * @param client the JACK client structure.
+ * @param frame frame number of new transport position.
+ *
+ * @return 0 if valid request, non-zero otherwise.
+ */
+int  jack_transport_locate (jack_client_t *client,
+			    jack_nframes_t frame) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Query the current transport state and position.
+ *
+ * This function is realtime-safe, and can be called from any thread.
+ * If called from the process thread, @a pos corresponds to the first
+ * frame of the current cycle and the state returned is valid for the
+ * entire cycle.
+ *
+ * @param client the JACK client structure.
+ * @param pos pointer to structure for returning current transport
+ * position; @a pos->valid will show which fields contain valid data.
+ * If @a pos is NULL, do not return position information.
+ *
+ * @return Current transport state.
+ */
+jack_transport_state_t jack_transport_query (const jack_client_t *client,
+					     jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Return an estimate of the current transport frame,
+ * including any time elapsed since the last transport
+ * positional update.
+ *
+ * @param client the JACK client structure
+ */
+jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+						 
+/**
+ * Request a new transport position.
+ *
+ * May be called at any time by any client.  The new position takes
+ * effect in two process cycles.  If there are slow-sync clients and
+ * the transport is already rolling, it will enter the
+ * ::JackTransportStarting state and begin invoking their @a
+ * sync_callbacks until ready.  This function is realtime-safe.
+ *
+ * @see jack_transport_locate, jack_set_sync_callback
+ * 
+ * @param client the JACK client structure.
+ * @param pos requested new transport position.
+ *
+ * @return 0 if valid request, EINVAL if position structure rejected.
+ */
+int  jack_transport_reposition (jack_client_t *client,
+				jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Start the JACK transport rolling.
+ *
+ * Any client can make this request at any time.  It takes effect no
+ * sooner than the next process cycle, perhaps later if there are
+ * slow-sync clients.  This function is realtime-safe.
+ *
+ * @see jack_set_sync_callback
+ *
+ * @param client the JACK client structure.
+ */
+void jack_transport_start (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Stop the JACK transport.
+ *
+ * Any client can make this request at any time.  It takes effect on
+ * the next process cycle.  This function is realtime-safe.
+ *
+ * @param client the JACK client structure.
+ */
+void jack_transport_stop (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Gets the current transport info structure (deprecated).
+ *
+ * @param client the JACK client structure.
+ * @param tinfo current transport info structure.  The "valid" field
+ * describes which fields contain valid data.
+ *
+ * @deprecated This is for compatibility with the earlier transport
+ * interface.  Use jack_transport_query(), instead.
+ *
+ * @pre Must be called from the process thread.
+ */
+void jack_get_transport_info (jack_client_t *client,
+			      jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT;
+
+/**
+ * Set the transport info structure (deprecated).
+ *
+ * @deprecated This function still exists for compatibility with the
+ * earlier transport interface, but it does nothing.  Instead, define
+ * a ::JackTimebaseCallback.
+ */
+void jack_set_transport_info (jack_client_t *client,
+			      jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT;
+
+/*@}*/
+	
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_transport_h__ */
diff --git a/common/jack/types.h b/common/jack/types.h
new file mode 100644
index 0000000..3722d7f
--- /dev/null
+++ b/common/jack/types.h
@@ -0,0 +1,680 @@
+/*
+  Copyright (C) 2001 Paul Davis
+  Copyright (C) 2004 Jack O'Quin
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_types_h__
+#define __jack_types_h__
+
+#include <jack/systemdeps.h>
+
+
+typedef int32_t jack_shmsize_t;
+
+/**
+ * Type used to represent sample frame counts.
+ */
+typedef uint32_t	jack_nframes_t;
+
+/**
+ * Maximum value that can be stored in jack_nframes_t
+ */
+#define JACK_MAX_FRAMES (4294967295U)	/* This should be UINT32_MAX, but C++ has a problem with that. */
+
+/**
+ * Type used to represent the value of free running
+ * monotonic clock with units of microseconds.
+ */
+typedef uint64_t jack_time_t;
+
+/**
+ *  Maximum size of @a load_init string passed to an internal client
+ *  jack_initialize() function via jack_internal_client_load().
+ */
+#define JACK_LOAD_INIT_LIMIT 1024
+
+/**
+ *  jack_intclient_t is an opaque type representing a loaded internal
+ *  client.  You may only access it using the API provided in @ref
+ *  intclient.h "<jack/intclient.h>".
+ */
+typedef uint64_t jack_intclient_t;
+
+/**
+ *  jack_port_t is an opaque type.  You may only access it using the
+ *  API provided.
+ */
+typedef struct _jack_port jack_port_t;
+
+/**
+ *  jack_client_t is an opaque type.  You may only access it using the
+ *  API provided.
+ */
+typedef struct _jack_client jack_client_t;
+
+/**
+ *  Ports have unique ids. A port registration callback is the only
+ *  place you ever need to know their value.
+ */
+typedef uint32_t jack_port_id_t;
+
+typedef uint32_t jack_port_type_id_t;
+
+/**
+ * Prototype for the client supplied function that is called
+ * by the engine anytime there is work to be done.
+ *
+ * @pre nframes == jack_get_buffer_size()
+ * @pre nframes == pow(2,x)
+ *
+ * @param nframes number of frames to process
+ * @param arg pointer to a client supplied structure
+ *
+ * @return zero on success, non-zero on error
+ */
+typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
+
+/**
+ * Prototype for the client thread routine called
+ * by the engine when the client is inserted in the graph.
+ *
+ * @param arg pointer to a client supplied structure
+ *
+ */
+typedef void *(*JackThreadCallback)(void* arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * once after the creation of the thread in which other
+ * callbacks will be made. Special thread characteristics
+ * can be set from this callback, for example. This is a
+ * highly specialized callback and most clients will not
+ * and should not use it.
+ *
+ * @param arg pointer to a client supplied structure
+ *
+ * @return void
+ */
+typedef void (*JackThreadInitCallback)(void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever the processing graph is reordered.
+ *
+ * @param arg pointer to a client supplied structure
+ *
+ * @return zero on success, non-zero on error
+ */
+typedef int (*JackGraphOrderCallback)(void *arg);
+
+/**
+ * Prototype for the client-supplied function that is called whenever
+ * an xrun has occured.
+ *
+ * @see jack_get_xrun_delayed_usecs()
+ *
+ * @param arg pointer to a client supplied structure
+ *
+ * @return zero on success, non-zero on error
+ */
+typedef int (*JackXRunCallback)(void *arg);
+
+/**
+ * Prototype for the @a bufsize_callback that is invoked whenever the
+ * JACK engine buffer size changes.  Although this function is called
+ * in the JACK process thread, the normal process cycle is suspended
+ * during its operation, causing a gap in the audio flow.  So, the @a
+ * bufsize_callback can allocate storage, touch memory not previously
+ * referenced, and perform other operations that are not realtime
+ * safe.
+ *
+ * @param nframes buffer size
+ * @param arg pointer supplied by jack_set_buffer_size_callback().
+ *
+ * @return zero on success, non-zero on error
+ */
+typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * when the engine sample rate changes.
+ *
+ * @param nframes new engine sample rate
+ * @param arg pointer to a client supplied structure
+ *
+ * @return zero on success, non-zero on error
+ */
+typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever a port is registered or unregistered.
+ *
+ * @param arg pointer to a client supplied structure
+ */
+typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int, void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever a client is registered or unregistered.
+ *
+ * @param name a null-terminated string containing the client name
+ * @param register non-zero if the client is being registered,
+ *                     zero if the client is being unregistered
+ * @param arg pointer to a client supplied structure
+ */
+typedef void (*JackClientRegistrationCallback)(const char* name, int val, void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever a port is connected or disconnected.
+ *
+ * @param a one of two ports connected or disconnected
+ * @param b one of two ports connected or disconnected
+ * @param connect non-zero if ports were connected
+ *                    zero if ports were disconnected
+ * @param arg pointer to a client supplied data
+ */
+typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever the port name has been changed.
+ *
+ * @param port the port that has been renamed
+ * @param new_name the new name
+ * @param arg pointer to a client supplied structure
+ *
+ * @return zero on success, non-zero on error
+ */
+typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever jackd starts or stops freewheeling.
+ *
+ * @param starting non-zero if we start starting to freewheel, zero otherwise
+ * @param arg pointer to a client supplied structure
+ */
+typedef void (*JackFreewheelCallback)(int starting, void *arg);
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever jackd is shutdown. Note that after server shutdown, 
+ * the client pointer is *not* deallocated by libjack,
+ * the application is responsible to properly use jack_client_close()
+ * to release client ressources. Warning: jack_client_close() cannot be
+ * safely used inside the shutdown callback and has to be called outside of
+ * the callback context.
+ *
+ * @param arg pointer to a client supplied structure
+ */
+typedef void (*JackShutdownCallback)(void *arg);
+
+/**
+ * Used for the type argument of jack_port_register() for default
+ * audio ports and midi ports.
+ */
+#define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
+#define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
+
+/**
+ * For convenience, use this typedef if you want to be able to change
+ * between float and double. You may want to typedef sample_t to
+ * jack_default_audio_sample_t in your application.
+ */
+typedef float jack_default_audio_sample_t;
+
+/**
+ *  A port has a set of flags that are formed by AND-ing together the
+ *  desired values from the list below. The flags "JackPortIsInput" and
+ *  "JackPortIsOutput" are mutually exclusive and it is an error to use
+ *  them both.
+ */
+enum JackPortFlags {
+
+    /**
+     * if JackPortIsInput is set, then the port can receive
+     * data.
+     */
+    JackPortIsInput = 0x1,
+
+    /**
+     * if JackPortIsOutput is set, then data can be read from
+     * the port.
+     */
+    JackPortIsOutput = 0x2,
+
+    /**
+     * if JackPortIsPhysical is set, then the port corresponds
+     * to some kind of physical I/O connector.
+     */
+    JackPortIsPhysical = 0x4,
+
+    /**
+     * if JackPortCanMonitor is set, then a call to
+     * jack_port_request_monitor() makes sense.
+     *
+     * Precisely what this means is dependent on the client. A typical
+     * result of it being called with TRUE as the second argument is
+     * that data that would be available from an output port (with
+     * JackPortIsPhysical set) is sent to a physical output connector
+     * as well, so that it can be heard/seen/whatever.
+     *
+     * Clients that do not control physical interfaces
+     * should never create ports with this bit set.
+     */
+    JackPortCanMonitor = 0x8,
+
+    /**
+     * JackPortIsTerminal means:
+     *
+     *	for an input port: the data received by the port
+     *                    will not be passed on or made
+     *		           available at any other port
+     *
+     * for an output port: the data available at the port
+     *                    does not originate from any other port
+     *
+     * Audio synthesizers, I/O hardware interface clients, HDR
+     * systems are examples of clients that would set this flag for
+     * their ports.
+     */
+    JackPortIsTerminal = 0x10,
+    
+    /**
+     * JackPortIsActive means the port has been registered and the 
+     * client is "active", that is jack_activate has been called
+     * 
+     * JackPortIsActive is on between jack_activate and jack_deactivate.
+     */
+    JackPortIsActive = 0x20
+};
+
+/**
+ *  @ref jack_options_t bits
+ */
+enum JackOptions {
+
+    /**
+     * Null value to use when no option bits are needed.
+     */
+    JackNullOption = 0x00,
+
+    /**
+     * Do not automatically start the JACK server when it is not
+     * already running.  This option is always selected if
+     * \$JACK_NO_START_SERVER is defined in the calling process
+     * environment.
+     */
+    JackNoStartServer = 0x01,
+
+    /**
+     * Use the exact client name requested.  Otherwise, JACK
+     * automatically generates a unique one, if needed.
+     */
+    JackUseExactName = 0x02,
+
+    /**
+     * Open with optional <em>(char *) server_name</em> parameter.
+     */
+    JackServerName = 0x04,
+
+    /**
+     * Load internal client from optional <em>(char *)
+     * load_name</em>.  Otherwise use the @a client_name.
+     */
+    JackLoadName = 0x08,
+
+    /**
+     * Pass optional <em>(char *) load_init</em> string to the
+     * jack_initialize() entry point of an internal client.
+     */
+    JackLoadInit = 0x10
+};
+
+/** Valid options for opening an external client. */
+#define JackOpenOptions (JackServerName|JackNoStartServer|JackUseExactName)
+
+/** Valid options for loading an internal client. */
+#define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
+
+/**
+ *  Options for several JACK operations, formed by OR-ing together the
+ *  relevant @ref JackOptions bits.
+ */
+typedef enum JackOptions jack_options_t;
+
+/**
+ *  @ref jack_status_t bits
+ */
+enum JackStatus {
+
+    /**
+     * Overall operation failed.
+     */
+    JackFailure = 0x01,
+
+    /**
+     * The operation contained an invalid or unsupported option.
+     */
+    JackInvalidOption = 0x02,
+
+    /**
+     * The desired client name was not unique.  With the @ref
+     * JackUseExactName option this situation is fatal.  Otherwise,
+     * the name was modified by appending a dash and a two-digit
+     * number in the range "-01" to "-99".  The
+     * jack_get_client_name() function will return the exact string
+     * that was used.  If the specified @a client_name plus these
+     * extra characters would be too long, the open fails instead.
+     */
+    JackNameNotUnique = 0x04,
+
+    /**
+     * The JACK server was started as a result of this operation.
+     * Otherwise, it was running already.  In either case the caller
+     * is now connected to jackd, so there is no race condition.
+     * When the server shuts down, the client will find out.
+     */
+    JackServerStarted = 0x08,
+
+    /**
+     * Unable to connect to the JACK server.
+     */
+    JackServerFailed = 0x10,
+
+    /**
+     * Communication error with the JACK server.
+     */
+    JackServerError = 0x20,
+
+    /**
+     * Requested client does not exist.
+     */
+    JackNoSuchClient = 0x40,
+
+    /**
+     * Unable to load internal client
+     */
+    JackLoadFailure = 0x80,
+
+    /**
+     * Unable to initialize client
+     */
+    JackInitFailure = 0x100,
+
+    /**
+     * Unable to access shared memory
+     */
+    JackShmFailure = 0x200,
+
+    /**
+     * Client's protocol version does not match
+     */
+    JackVersionError = 0x400,
+    
+    /**
+     * Backend error
+     */
+    JackBackendError = 0x800,
+    
+    /**
+     * Client zombified failure
+     */
+    JackClientZombie = 0x1000
+};
+
+/**
+ *  Status word returned from several JACK operations, formed by
+ *  OR-ing together the relevant @ref JackStatus bits.
+ */
+typedef enum JackStatus jack_status_t;
+
+/**
+ * Transport states.
+ */
+typedef enum {
+
+    /* the order matters for binary compatibility */
+    JackTransportStopped = 0,       /**< Transport halted */
+    JackTransportRolling = 1,       /**< Transport playing */
+    JackTransportLooping = 2,       /**< For OLD_TRANSPORT, now ignored */
+    JackTransportStarting = 3,      /**< Waiting for sync ready */
+    JackTransportNetStarting = 4, 	/**< Waiting for sync ready on the network*/
+
+} jack_transport_state_t;
+
+typedef uint64_t jack_unique_t;		/**< Unique ID (opaque) */
+
+/**
+ * Optional struct jack_position_t fields.
+ */
+typedef enum {
+
+    JackPositionBBT = 0x10,  	/**< Bar, Beat, Tick */
+    JackPositionTimecode = 0x20,	/**< External timecode */
+    JackBBTFrameOffset =      0x40,	/**< Frame offset of BBT information */
+    JackAudioVideoRatio =     0x80, /**< audio frames per video frame */
+    JackVideoFrameOffset =   0x100  /**< frame offset of first video frame */
+    
+} jack_position_bits_t;
+
+/** all valid position bits */
+#define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
+#define EXTENDED_TIME_INFO
+
+typedef struct {
+
+    /* these four cannot be set from clients: the server sets them */
+    jack_unique_t	unique_1;	/**< unique ID */
+    jack_time_t		usecs;		/**< monotonic, free-rolling */
+    jack_nframes_t	frame_rate;	/**< current frame rate (per second) */
+    jack_nframes_t	frame;		/**< frame number, always present */
+
+    jack_position_bits_t valid;		/**< which other fields are valid */
+
+    /* JackPositionBBT fields: */
+    int32_t		bar;		/**< current bar */
+    int32_t		beat;		/**< current beat-within-bar */
+    int32_t		tick;		/**< current tick-within-beat */
+    double		bar_start_tick;
+
+    float		beats_per_bar;	/**< time signature "numerator" */
+    float		beat_type;	/**< time signature "denominator" */
+    double		ticks_per_beat;
+    double		beats_per_minute;
+
+    /* JackPositionTimecode fields:	(EXPERIMENTAL: could change) */
+    double		frame_time;	/**< current time in seconds */
+    double		next_time;	/**< next sequential frame_time
+                         (unless repositioned) */
+
+    /* JackBBTFrameOffset fields: */
+    jack_nframes_t	bbt_offset;	/**< frame offset for the BBT fields
+                         (the given bar, beat, and tick
+                         values actually refer to a time
+                         frame_offset frames before the
+                         start of the cycle), should
+                         be assumed to be 0 if
+                         JackBBTFrameOffset is not
+                         set. If JackBBTFrameOffset is
+                         set and this value is zero, the BBT
+                         time refers to the first frame of this
+                         cycle. If the value is positive,
+                         the BBT time refers to a frame that
+                         many frames before the start of the
+                         cycle. */
+
+    /* JACK video positional data (experimental) */
+
+    float               audio_frames_per_video_frame; /**< number of audio frames
+                         per video frame. Should be assumed
+                         zero if JackAudioVideoRatio is not
+                         set. If JackAudioVideoRatio is set
+                         and the value is zero, no video
+                         data exists within the JACK graph */
+
+    jack_nframes_t      video_offset;   /**< audio frame at which the first video
+                         frame in this cycle occurs. Should
+                         be assumed to be 0 if JackVideoFrameOffset
+                         is not set. If JackVideoFrameOffset is
+                         set, but the value is zero, there is
+                         no video frame within this cycle. */
+
+    /* For binary compatibility, new fields should be allocated from
+     * this padding area with new valid bits controlling access, so
+     * the existing structure size and offsets are preserved. */
+    int32_t		padding[7];
+
+    /* When (unique_1 == unique_2) the contents are consistent. */
+    jack_unique_t	unique_2;	/**< unique ID */
+
+} jack_position_t;
+
+/**
+    * Prototype for the @a sync_callback defined by slow-sync clients.
+    * When the client is active, this callback is invoked just before
+    * process() in the same thread.  This occurs once after registration,
+    * then subsequently whenever some client requests a new position, or
+    * the transport enters the ::JackTransportStarting state.  This
+    * realtime function must not wait.
+    *
+    * The transport @a state will be:
+    *
+    *   - ::JackTransportStopped when a new position is requested;
+    *   - ::JackTransportStarting when the transport is waiting to start;
+    *   - ::JackTransportRolling when the timeout has expired, and the
+    *   position is now a moving target.
+    *
+    * @param state current transport state.
+    * @param pos new transport position.
+    * @param arg the argument supplied by jack_set_sync_callback().
+    *
+    * @return TRUE (non-zero) when ready to roll.
+    */
+typedef int (*JackSyncCallback)(jack_transport_state_t state,
+                                jack_position_t *pos,
+                                void *arg);
+
+
+/**
+  * Prototype for the @a timebase_callback used to provide extended
+  * position information.  Its output affects all of the following
+  * process cycle.  This realtime function must not wait.
+  *
+  * This function is called immediately after process() in the same
+  * thread whenever the transport is rolling, or when any client has
+  * requested a new position in the previous cycle.  The first cycle
+  * after jack_set_timebase_callback() is also treated as a new
+  * position, or the first cycle after jack_activate() if the client
+  * had been inactive.
+  *
+  * The timebase master may not use its @a pos argument to set @a
+  * pos->frame.  To change position, use jack_transport_reposition() or
+  * jack_transport_locate().  These functions are realtime-safe, the @a
+  * timebase_callback can call them directly.
+  *
+  * @param state current transport state.
+  * @param nframes number of frames in current period.
+  * @param pos address of the position structure for the next cycle; @a
+  * pos->frame will be its frame number.  If @a new_pos is FALSE, this
+  * structure contains extended position information from the current
+  * cycle.  If TRUE, it contains whatever was set by the requester.
+  * The @a timebase_callback's task is to update the extended
+  * information here.
+  * @param new_pos TRUE (non-zero) for a newly requested @a pos, or for
+  * the first cycle after the @a timebase_callback is defined.
+  * @param arg the argument supplied by jack_set_timebase_callback().
+  */
+typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
+                                     jack_nframes_t nframes,
+                                     jack_position_t *pos,
+                                     int new_pos,
+                                     void *arg);
+
+/*********************************************************************
+    * The following interfaces are DEPRECATED.  They are only provided
+    * for compatibility with the earlier JACK transport implementation.
+    *********************************************************************/
+
+/**
+ * Optional struct jack_transport_info_t fields.
+ *
+ * @see jack_position_bits_t.
+ */
+typedef enum {
+
+    JackTransportState = 0x1,  	/**< Transport state */
+    JackTransportPosition = 0x2,  	/**< Frame number */
+    JackTransportLoop = 0x4,  	/**< Loop boundaries (ignored) */
+    JackTransportSMPTE = 0x8,  	/**< SMPTE (ignored) */
+    JackTransportBBT = 0x10	/**< Bar, Beat, Tick */
+
+} jack_transport_bits_t;
+
+/**
+ * Deprecated struct for transport position information.
+ *
+ * @deprecated This is for compatibility with the earlier transport
+ * interface.  Use the jack_position_t struct, instead.
+ */
+typedef struct {
+
+    /* these two cannot be set from clients: the server sets them */
+
+    jack_nframes_t frame_rate;		/**< current frame rate (per second) */
+    jack_time_t usecs;		/**< monotonic, free-rolling */
+
+    jack_transport_bits_t valid;	/**< which fields are legal to read */
+    jack_transport_state_t transport_state;
+    jack_nframes_t frame;
+    jack_nframes_t loop_start;
+    jack_nframes_t loop_end;
+
+    long smpte_offset;	/**< SMPTE offset (from frame 0) */
+    float smpte_frame_rate;	/**< 29.97, 30, 24 etc. */
+
+    int bar;
+    int beat;
+    int tick;
+    double bar_start_tick;
+
+    float beats_per_bar;
+    float beat_type;
+    double ticks_per_beat;
+    double beats_per_minute;
+
+} jack_transport_info_t;
+
+/**
+ * Prototype for the client supplied function that is called
+ * whenever jackd is shutdown. Note that after server shutdown, 
+ * the client pointer is *not* deallocated by libjack,
+ * the application is responsible to properly use jack_client_close()
+ * to release client ressources. Warning: jack_client_close() cannot be
+ * safely used inside the shutdown callback and has to be called outside of
+ * the callback context.
+ 
+ * @param code a status word, formed by OR-ing together the relevant @ref JackStatus bits.
+ * @param reason a string describing the shutdown reason (backend failure, server crash... etc...)
+ * @param arg pointer to a client supplied structure
+ */
+typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
+
+#endif /* __jack_types_h__ */
diff --git a/common/jack/weakjack.h b/common/jack/weakjack.h
new file mode 100644
index 0000000..11d2aca
--- /dev/null
+++ b/common/jack/weakjack.h
@@ -0,0 +1,52 @@
+/*
+    Copyright (C) 2010 Paul Davis
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __weakjack_h__
+#define __weakjack_h__
+
+#ifndef JACK_OPTIONAL_WEAK_EXPORT
+/* JACK_OPTIONAL_WEAK_EXPORT needs to be a macro which
+   expands into a compiler directive. If non-null, the directive 
+   must tell the compiler to arrange for weak linkage of 
+   the symbol it used with. For this to work fully may
+   require linker arguments for the client as well.
+*/
+#ifdef __GNUC__
+#define JACK_OPTIONAL_WEAK_EXPORT __attribute__((__weak__))
+#else
+/* Add other things here for non-gcc platforms */
+#endif
+#endif
+
+#ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
+/* JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT needs to be a macro
+   which expands into a compiler directive. If non-null, the directive
+   must tell the compiler to arrange for weak linkage of the
+   symbol it is used with AND optionally to mark the symbol
+   as deprecated. For this to work fully may require
+   linker arguments for the client as well.
+*/
+#ifdef __GNUC__
+#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT __attribute__((__weak__,__deprecated__))
+#else
+/* Add other things here for non-gcc platforms */
+#endif
+#endif
+
+#endif /* weakjack */
diff --git a/common/jack/weakmacros.h b/common/jack/weakmacros.h
new file mode 100644
index 0000000..b3207f6
--- /dev/null
+++ b/common/jack/weakmacros.h
@@ -0,0 +1,63 @@
+/*
+    Copyright (C) 2010 Paul Davis
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __weakmacros_h__
+#define __weakmacros_h__
+
+/*************************************************************
+ * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
+ * added to the JACK API after the 0.116.2 release.
+ * 
+ * Functions that predate this release are marked with 
+ * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile
+ * time in a variety of ways. The default definition is empty,
+ * so that these symbols get normal linkage. If you wish to
+ * use all JACK symbols with weak linkage, include 
+ * <jack/weakjack.h> before jack.h.
+ *************************************************************/
+
+#ifndef JACK_WEAK_EXPORT
+#ifdef __GNUC__
+/* JACK_WEAK_EXPORT needs to be a macro which
+   expands into a compiler directive. If non-null, the directive 
+   must tell the compiler to arrange for weak linkage of 
+   the symbol it used with. For this to work full may
+   require linker arguments in the client as well.
+*/
+#define JACK_WEAK_EXPORT __attribute__((weak))
+#else
+/* Add other things here for non-gcc platforms */
+#define JACK_WEAK_EXPORT
+#endif
+#endif
+
+#ifndef JACK_OPTIONAL_WEAK_EXPORT
+#define JACK_OPTIONAL_WEAK_EXPORT
+#endif
+
+#ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
+#ifdef __GNUC__
+#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT __attribute__((__deprecated__))
+#else
+/* Add other things here for non-gcc platforms */
+#define  JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
+#endif /* __GNUC__ */
+#endif
+
+#endif /* __weakmacros_h__ */
diff --git a/common/memops.c b/common/memops.c
new file mode 100644
index 0000000..8ef4f09
--- /dev/null
+++ b/common/memops.c
@@ -0,0 +1,845 @@
+/*
+    Copyright (C) 2000 Paul Davis 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#define _ISOC9X_SOURCE  1
+#define _ISOC99_SOURCE  1
+
+#define __USE_ISOC9X    1
+#define __USE_ISOC99    1
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <memory.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <limits.h>
+#ifdef __linux__
+#include <endian.h>
+#endif
+#include "memops.h"
+
+#if defined (__SSE2__) && !defined (__sun__)
+#include <emmintrin.h>
+#ifdef __SSE4_1__
+#include <smmintrin.h>
+#endif
+#endif
+
+/* Notes about these *_SCALING values.
+
+   the MAX_<N>BIT values are floating point. when multiplied by
+   a full-scale normalized floating point sample value (-1.0..+1.0)
+   they should give the maxium value representable with an integer
+   sample type of N bits. Note that this is asymmetric. Sample ranges 
+   for signed integer, 2's complement values are -(2^(N-1) to +(2^(N-1)-1)
+
+   Complications
+   -------------
+   If we use +2^(N-1) for the scaling factors, we run into a problem:
+
+   if we start with a normalized float value of -1.0, scaling
+   to 24 bits would give -8388608 (-2^23), which is ideal.
+   But with +1.0, we get +8388608, which is technically out of range.
+
+   We never multiply a full range normalized value by this constant,
+   but we could multiply it by a positive value that is close enough to +1.0
+   to produce a value > +(2^(N-1)-1.
+
+   There is no way around this paradox without wasting CPU cycles to determine
+   which scaling factor to use (i.e. determine if its negative or not,
+   use the right factor).
+
+   So, for now (October 2008) we use 2^(N-1)-1 as the scaling factor.
+*/
+
+#define SAMPLE_24BIT_SCALING  8388607.0f
+#define SAMPLE_16BIT_SCALING  32767.0f
+
+/* these are just values to use if the floating point value was out of range
+   
+   advice from Fons Adriaensen: make the limits symmetrical
+ */
+
+#define SAMPLE_24BIT_MAX  8388607  
+#define SAMPLE_24BIT_MIN  -8388607 
+#define SAMPLE_24BIT_MAX_F  8388607.0f  
+#define SAMPLE_24BIT_MIN_F  -8388607.0f 
+
+#define SAMPLE_16BIT_MAX  32767
+#define SAMPLE_16BIT_MIN  -32767
+#define SAMPLE_16BIT_MAX_F  32767.0f
+#define SAMPLE_16BIT_MIN_F  -32767.0f
+
+/* these mark the outer edges of the range considered "within" range
+   for a floating point sample value. values outside (and on the boundaries) 
+   of this range will be clipped before conversion; values within this 
+   range will be scaled to appropriate values for the target sample
+   type.
+*/
+
+#define NORMALIZED_FLOAT_MIN -1.0f
+#define NORMALIZED_FLOAT_MAX  1.0f
+
+/* define this in case we end up on a platform that is missing
+   the real lrintf functions
+*/
+
+#define f_round(f) lrintf(f)
+
+#define float_16(s, d)\
+	if ((s) <= NORMALIZED_FLOAT_MIN) {\
+		(d) = SAMPLE_16BIT_MIN;\
+	} else if ((s) >= NORMALIZED_FLOAT_MAX) {\
+		(d) = SAMPLE_16BIT_MAX;\
+	} else {\
+		(d) = f_round ((s) * SAMPLE_16BIT_SCALING);\
+	}
+
+/* call this when "s" has already been scaled (e.g. when dithering)
+ */
+
+#define float_16_scaled(s, d)\
+        if ((s) <= SAMPLE_16BIT_MIN_F) {\
+		(d) = SAMPLE_16BIT_MIN_F;\
+	} else if ((s) >= SAMPLE_16BIT_MAX_F) {	\
+		(d) = SAMPLE_16BIT_MAX;\
+	} else {\
+	        (d) = f_round ((s));\
+	}
+
+#define float_24u32(s, d) \
+	if ((s) <= NORMALIZED_FLOAT_MIN) {\
+		(d) = SAMPLE_24BIT_MIN << 8;\
+	} else if ((s) >= NORMALIZED_FLOAT_MAX) {\
+		(d) = SAMPLE_24BIT_MAX << 8;\
+	} else {\
+		(d) = f_round ((s) * SAMPLE_24BIT_SCALING) << 8;\
+	}
+
+/* call this when "s" has already been scaled (e.g. when dithering)
+ */
+
+#define float_24u32_scaled(s, d)\
+        if ((s) <= SAMPLE_24BIT_MIN_F) {\
+		(d) = SAMPLE_24BIT_MIN << 8;\
+	} else if ((s) >= SAMPLE_24BIT_MAX_F) {	\
+		(d) = SAMPLE_24BIT_MAX << 8;		\
+	} else {\
+		(d) = f_round ((s)) << 8; \
+	}
+
+#define float_24(s, d) \
+	if ((s) <= NORMALIZED_FLOAT_MIN) {\
+		(d) = SAMPLE_24BIT_MIN;\
+	} else if ((s) >= NORMALIZED_FLOAT_MAX) {\
+		(d) = SAMPLE_24BIT_MAX;\
+	} else {\
+		(d) = f_round ((s) * SAMPLE_24BIT_SCALING);\
+	}
+
+/* call this when "s" has already been scaled (e.g. when dithering)
+ */
+
+#define float_24_scaled(s, d)\
+        if ((s) <= SAMPLE_24BIT_MIN_F) {\
+		(d) = SAMPLE_24BIT_MIN;\
+	} else if ((s) >= SAMPLE_24BIT_MAX_F) {	\
+		(d) = SAMPLE_24BIT_MAX;		\
+	} else {\
+		(d) = f_round ((s)); \
+	}
+
+
+#if defined (__SSE2__) && !defined (__sun__)
+
+/* generates same as _mm_set_ps(1.f, 1.f, 1f., 1f) but faster  */
+static inline __m128 gen_one(void)
+{
+    volatile __m128i x;
+    __m128i ones = _mm_cmpeq_epi32(x, x);
+    return (__m128)_mm_slli_epi32 (_mm_srli_epi32(ones, 25), 23);
+}
+
+static inline __m128 clip(__m128 s, __m128 min, __m128 max)
+{
+    return _mm_min_ps(max, _mm_max_ps(s, min));
+}
+
+static inline __m128i float_24_sse(__m128 s)
+{
+    const __m128 upper_bound = gen_one(); /* NORMALIZED_FLOAT_MAX */
+    const __m128 lower_bound = _mm_sub_ps(_mm_setzero_ps(), upper_bound);
+
+    __m128 clipped = clip(s, lower_bound, upper_bound);
+    __m128 scaled = _mm_mul_ps(clipped, _mm_set1_ps(SAMPLE_24BIT_SCALING));
+    return _mm_cvtps_epi32(scaled);
+}
+#endif
+
+/* Linear Congruential noise generator. From the music-dsp list
+ * less random than rand(), but good enough and 10x faster 
+ */
+static unsigned int seed = 22222;
+
+inline unsigned int fast_rand() {
+	seed = (seed * 96314165) + 907633515;
+	return seed;
+}
+
+/* functions for native float sample data */
+
+void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) {
+	while (nsamples--) {
+		*dst = *((float *) src);
+		dst++;
+		src += src_skip;
+	}
+}
+
+void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) {
+	while (nsamples--) {
+		*((float *) dst) = *src;
+		dst += dst_skip;
+		src++;
+	}
+}
+
+/* NOTES on function naming:
+
+   foo_bar_d<TYPE>_s<TYPE>
+
+   the "d<TYPE>" component defines the destination type for the operation
+   the "s<TYPE>" component defines the source type for the operation
+
+   TYPE can be one of:
+   
+   S      - sample is a jack_default_audio_sample_t, currently (October 2008) a 32 bit floating point value
+   Ss     - like S but reverse endian from the host CPU
+   32u24  - sample is an signed 32 bit integer value, but data is in upper 24 bits only
+   32u24s - like 32u24 but reverse endian from the host CPU
+   24     - sample is an signed 24 bit integer value
+   24s    - like 24 but reverse endian from the host CPU
+   16     - sample is an signed 16 bit integer value
+   16s    - like 16 but reverse endian from the host CPU
+
+   For obvious reasons, the reverse endian versions only show as source types.
+
+   This covers all known sample formats at 16 bits or larger.
+*/   
+
+/* functions for native integer sample data */
+
+void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
+{
+	int32_t z;
+
+	while (nsamples--) {
+
+		float_24u32 (*src, z);
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		dst[0]=(char)(z>>24);
+		dst[1]=(char)(z>>16);
+		dst[2]=(char)(z>>8);
+		dst[3]=(char)(z);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		dst[0]=(char)(z);
+		dst[1]=(char)(z>>8);
+		dst[2]=(char)(z>>16);
+		dst[3]=(char)(z>>24);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+}	
+
+void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
+{
+#if defined (__SSE2__) && !defined (__sun__)
+	__m128 int_max = _mm_set1_ps(SAMPLE_24BIT_MAX_F);
+	__m128 int_min = _mm_sub_ps(_mm_setzero_ps(), int_max);
+	__m128 factor = int_max;
+
+	unsigned long unrolled = nsamples / 4;
+	nsamples = nsamples & 3;
+
+	while (unrolled--) {
+		__m128 in = _mm_load_ps(src);
+		__m128 scaled = _mm_mul_ps(in, factor);
+		__m128 clipped = clip(scaled, int_min, int_max);
+
+		__m128i y = _mm_cvttps_epi32(clipped);
+		__m128i shifted = _mm_slli_epi32(y, 8);
+
+#ifdef __SSE4_1__
+		*(int32_t*)dst              = _mm_extract_epi32(shifted, 0);
+		*(int32_t*)(dst+dst_skip)   = _mm_extract_epi32(shifted, 1);
+		*(int32_t*)(dst+2*dst_skip) = _mm_extract_epi32(shifted, 2);
+		*(int32_t*)(dst+3*dst_skip) = _mm_extract_epi32(shifted, 3);
+#else
+		__m128i shuffled1 = _mm_shuffle_epi32(shifted, _MM_SHUFFLE(0, 3, 2, 1));
+		__m128i shuffled2 = _mm_shuffle_epi32(shifted, _MM_SHUFFLE(1, 0, 3, 2));
+		__m128i shuffled3 = _mm_shuffle_epi32(shifted, _MM_SHUFFLE(2, 1, 0, 3));
+
+		_mm_store_ss((float*)dst, (__m128)shifted);
+
+		_mm_store_ss((float*)(dst+dst_skip), (__m128)shuffled1);
+		_mm_store_ss((float*)(dst+2*dst_skip), (__m128)shuffled2);
+		_mm_store_ss((float*)(dst+3*dst_skip), (__m128)shuffled3);
+#endif
+		dst += 4*dst_skip;
+
+		src+= 4;
+	}
+
+	while (nsamples--) {
+		__m128 in = _mm_load_ss(src);
+		__m128 scaled = _mm_mul_ss(in, factor);
+		__m128 clipped = _mm_min_ss(int_max, _mm_max_ss(scaled, int_min));
+
+		int y = _mm_cvttss_si32(clipped);
+		*((int *) dst) = y<<8;
+
+		dst += dst_skip;
+		src++;
+	}
+
+#else
+	while (nsamples--) {
+		float_24u32 (*src, *((int32_t*) dst));
+		dst += dst_skip;
+		src++;
+	}
+#endif
+}	
+
+void sample_move_dS_s32u24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
+{
+	/* ALERT: signed sign-extension portability !!! */
+
+	const jack_default_audio_sample_t scaling = 1.0/SAMPLE_24BIT_SCALING;
+
+	while (nsamples--) {
+		int x;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		x = (unsigned char)(src[0]);
+		x <<= 8;
+		x |= (unsigned char)(src[1]);
+		x <<= 8;
+		x |= (unsigned char)(src[2]);
+		x <<= 8;
+		x |= (unsigned char)(src[3]);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		x = (unsigned char)(src[3]);
+		x <<= 8;
+		x |= (unsigned char)(src[2]);
+		x <<= 8;
+		x |= (unsigned char)(src[1]);
+		x <<= 8;
+		x |= (unsigned char)(src[0]);
+#endif
+		*dst = (x >> 8) * scaling;
+		dst++;
+		src += src_skip;
+	}
+}	
+
+void sample_move_dS_s32u24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
+{
+#if defined (__SSE2__) && !defined (__sun__)
+	unsigned long unrolled = nsamples / 4;
+	static float inv_sample_max_24bit = 1.0 / SAMPLE_24BIT_SCALING;
+	__m128 factor = _mm_set1_ps(inv_sample_max_24bit);
+	while (unrolled--)
+	{
+		int i1 = *((int *) src);
+		src+= src_skip;
+		int i2 = *((int *) src);
+		src+= src_skip;
+		int i3 = *((int *) src);
+		src+= src_skip;
+		int i4 = *((int *) src);
+		src+= src_skip;
+
+		__m128i src = _mm_set_epi32(i4, i3, i2, i1);
+		__m128i shifted = _mm_srai_epi32(src, 8);
+
+		__m128 as_float = _mm_cvtepi32_ps(shifted);
+		__m128 divided = _mm_mul_ps(as_float, factor);
+
+		_mm_storeu_ps(dst, divided);
+
+		dst += 4;
+	}
+	nsamples = nsamples & 3;
+#endif
+
+	/* ALERT: signed sign-extension portability !!! */
+
+	const jack_default_audio_sample_t scaling = 1.0/SAMPLE_24BIT_SCALING;
+	while (nsamples--) {
+		*dst = (*((int *) src) >> 8) * scaling;
+		dst++;
+		src += src_skip;
+	}
+}	
+
+void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
+{
+	int32_t z;
+
+	while (nsamples--) {
+		float_24 (*src, z);
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		dst[0]=(char)(z>>16);
+		dst[1]=(char)(z>>8);
+		dst[2]=(char)(z);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		dst[0]=(char)(z);
+		dst[1]=(char)(z>>8);
+		dst[2]=(char)(z>>16);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+}	
+
+void sample_move_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
+{
+#if defined (__SSE2__) && !defined (__sun__)
+	_MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);
+	while (nsamples >= 4) {
+		int i;
+		int32_t z[4];
+		__m128 samples = _mm_loadu_ps(src);
+		__m128i converted = float_24_sse(samples);
+
+#ifdef __SSE4_1__
+		z[0] = _mm_extract_epi32(converted, 0);
+		z[1] = _mm_extract_epi32(converted, 1);
+		z[2] = _mm_extract_epi32(converted, 2);
+		z[3] = _mm_extract_epi32(converted, 3);
+#else
+		__m128i shuffled1 = _mm_shuffle_epi32(converted, _MM_SHUFFLE(0, 3, 2, 1));
+		__m128i shuffled2 = _mm_shuffle_epi32(converted, _MM_SHUFFLE(1, 0, 3, 2));
+		__m128i shuffled3 = _mm_shuffle_epi32(converted, _MM_SHUFFLE(2, 1, 0, 3));
+
+		_mm_store_ss((float*)z, (__m128)converted);
+		_mm_store_ss((float*)z+1, (__m128)shuffled1);
+		_mm_store_ss((float*)z+2, (__m128)shuffled2);
+		_mm_store_ss((float*)z+3, (__m128)shuffled3);
+
+		for (i = 0; i != 4; ++i) {
+			memcpy (dst, z+i, 3);
+			dst += dst_skip;
+		}
+#endif
+
+		nsamples -= 4;
+		src += 4;
+	}
+#endif
+
+    int32_t z;
+
+	while (nsamples--) {
+		float_24 (*src, z);
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		memcpy (dst, &z, 3);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		memcpy (dst, (char *)&z + 1, 3);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_dS_s24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
+{
+	/* ALERT: signed sign-extension portability !!! */
+
+	const jack_default_audio_sample_t scaling = 1.0/SAMPLE_24BIT_SCALING;
+	while (nsamples--) {
+		int x;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		x = (unsigned char)(src[0]);
+		x <<= 8;
+		x |= (unsigned char)(src[1]);
+		x <<= 8;
+		x |= (unsigned char)(src[2]);
+		/* correct sign bit and the rest of the top byte */
+		if (src[0] & 0x80) {
+			x |= 0xff << 24;
+		}
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		x = (unsigned char)(src[2]);
+		x <<= 8;
+		x |= (unsigned char)(src[1]);
+		x <<= 8;
+		x |= (unsigned char)(src[0]);
+		/* correct sign bit and the rest of the top byte */
+		if (src[2] & 0x80) {
+			x |= 0xff << 24;
+		}
+#endif
+		*dst = x * scaling;
+		dst++;
+		src += src_skip;
+	}
+}
+
+void sample_move_dS_s24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
+{
+	const jack_default_audio_sample_t scaling = 1.f/SAMPLE_24BIT_SCALING;
+
+#if defined (__SSE2__) && !defined (__sun__)
+	const __m128 scaling_block = _mm_set_ps1(scaling);
+	while (nsamples >= 4) {
+		int x0, x1, x2, x3;
+
+		memcpy((char*)&x0 + 1, src, 3);
+		memcpy((char*)&x1 + 1, src+src_skip, 3);
+		memcpy((char*)&x2 + 1, src+2*src_skip, 3);
+		memcpy((char*)&x3 + 1, src+3*src_skip, 3);
+		src += 4 * src_skip;
+
+		const __m128i block_i = _mm_set_epi32(x3, x2, x1, x0);
+		const __m128i shifted = _mm_srai_epi32(block_i, 8);
+		const __m128 converted = _mm_cvtepi32_ps (shifted);
+		const __m128 scaled = _mm_mul_ps(converted, scaling_block);
+		_mm_storeu_ps(dst, scaled);
+		dst += 4;
+		nsamples -= 4;
+	}
+#endif
+
+	while (nsamples--) {
+		int x;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		memcpy((char*)&x + 1, src, 3);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		memcpy(&x, src, 3);
+#endif
+		x >>= 8;
+		*dst = x * scaling;
+		dst++;
+		src += src_skip;
+	}
+}
+
+
+void sample_move_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	int16_t tmp;
+
+	while (nsamples--) {
+		// float_16 (*src, tmp);
+
+		if (*src <= NORMALIZED_FLOAT_MIN) {
+			tmp = SAMPLE_16BIT_MIN;
+		} else if (*src >= NORMALIZED_FLOAT_MAX) {
+			tmp = SAMPLE_16BIT_MAX;
+		} else {
+			tmp = (int16_t) f_round (*src * SAMPLE_16BIT_SCALING);
+		}
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		dst[0]=(char)(tmp>>8);
+		dst[1]=(char)(tmp);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		dst[0]=(char)(tmp);
+		dst[1]=(char)(tmp>>8);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	while (nsamples--) {
+		float_16 (*src, *((int16_t*) dst));
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_dither_rect_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	jack_default_audio_sample_t val;
+	int16_t      tmp;
+
+	while (nsamples--) {
+		val = (*src * SAMPLE_16BIT_SCALING) + fast_rand() / (float) UINT_MAX - 0.5f;
+		float_16_scaled (val, tmp);
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		dst[0]=(char)(tmp>>8);
+		dst[1]=(char)(tmp);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		dst[0]=(char)(tmp);
+		dst[1]=(char)(tmp>>8);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_dither_rect_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	jack_default_audio_sample_t val;
+
+	while (nsamples--) {
+		val = (*src * SAMPLE_16BIT_SCALING) + fast_rand() / (float)UINT_MAX - 0.5f;
+		float_16_scaled (val, *((int16_t*) dst));
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_dither_tri_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	jack_default_audio_sample_t val;
+	int16_t      tmp;
+
+	while (nsamples--) {
+		val = (*src * SAMPLE_16BIT_SCALING) + ((float)fast_rand() + (float)fast_rand()) / (float)UINT_MAX - 1.0f;
+		float_16_scaled (val, tmp);
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		dst[0]=(char)(tmp>>8);
+		dst[1]=(char)(tmp);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		dst[0]=(char)(tmp);
+		dst[1]=(char)(tmp>>8);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_dither_tri_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	jack_default_audio_sample_t val;
+
+	while (nsamples--) {
+		val = (*src * SAMPLE_16BIT_SCALING) + ((float)fast_rand() + (float)fast_rand()) / (float)UINT_MAX - 1.0f;
+		float_16_scaled (val, *((int16_t*) dst));
+		dst += dst_skip;
+		src++;
+	}
+}
+
+void sample_move_dither_shaped_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	jack_default_audio_sample_t     x;
+	jack_default_audio_sample_t     xe; /* the innput sample - filtered error */
+	jack_default_audio_sample_t     xp; /* x' */
+	float        r;
+	float        rm1 = state->rm1;
+	unsigned int idx = state->idx;
+	int16_t      tmp;
+
+	while (nsamples--) {
+		x = *src * SAMPLE_16BIT_SCALING;
+		r = ((float)fast_rand() + (float)fast_rand())  / (float)UINT_MAX - 1.0f;
+		/* Filter the error with Lipshitz's minimally audible FIR:
+		   [2.033 -2.165 1.959 -1.590 0.6149] */
+		xe = x
+		     - state->e[idx] * 2.033f
+		     + state->e[(idx - 1) & DITHER_BUF_MASK] * 2.165f
+		     - state->e[(idx - 2) & DITHER_BUF_MASK] * 1.959f
+		     + state->e[(idx - 3) & DITHER_BUF_MASK] * 1.590f
+		     - state->e[(idx - 4) & DITHER_BUF_MASK] * 0.6149f;
+		xp = xe + r - rm1;
+		rm1 = r;
+
+		float_16_scaled (xp, tmp);
+
+		/* Intrinsic z^-1 delay */
+		idx = (idx + 1) & DITHER_BUF_MASK;
+		state->e[idx] = xp - xe;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		dst[0]=(char)(tmp>>8);
+		dst[1]=(char)(tmp);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		dst[0]=(char)(tmp);
+		dst[1]=(char)(tmp>>8);
+#endif
+		dst += dst_skip;
+		src++;
+	}
+	state->rm1 = rm1;
+	state->idx = idx;
+}
+
+void sample_move_dither_shaped_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
+{
+	jack_default_audio_sample_t     x;
+	jack_default_audio_sample_t     xe; /* the innput sample - filtered error */
+	jack_default_audio_sample_t     xp; /* x' */
+	float        r;
+	float        rm1 = state->rm1;
+	unsigned int idx = state->idx;
+
+	while (nsamples--) {
+		x = *src * SAMPLE_16BIT_SCALING;
+		r = ((float)fast_rand() + (float)fast_rand()) / (float)UINT_MAX - 1.0f;
+		/* Filter the error with Lipshitz's minimally audible FIR:
+		   [2.033 -2.165 1.959 -1.590 0.6149] */
+		xe = x
+		     - state->e[idx] * 2.033f
+		     + state->e[(idx - 1) & DITHER_BUF_MASK] * 2.165f
+		     - state->e[(idx - 2) & DITHER_BUF_MASK] * 1.959f
+		     + state->e[(idx - 3) & DITHER_BUF_MASK] * 1.590f
+		     - state->e[(idx - 4) & DITHER_BUF_MASK] * 0.6149f;
+		xp = xe + r - rm1;
+		rm1 = r;
+
+		float_16_scaled (xp, *((int16_t*) dst));
+
+		/* Intrinsic z^-1 delay */
+		idx = (idx + 1) & DITHER_BUF_MASK;
+		state->e[idx] = *((int16_t*) dst) - xe;
+
+		dst += dst_skip;
+		src++;
+	}
+	state->rm1 = rm1;
+	state->idx = idx;
+}
+
+void sample_move_dS_s16s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) 	
+{
+	short z;
+	const jack_default_audio_sample_t scaling = 1.0/SAMPLE_16BIT_SCALING;
+
+	/* ALERT: signed sign-extension portability !!! */
+	while (nsamples--) {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+		z = (unsigned char)(src[0]);
+		z <<= 8;
+		z |= (unsigned char)(src[1]);
+#elif __BYTE_ORDER == __BIG_ENDIAN
+		z = (unsigned char)(src[1]);
+		z <<= 8;
+		z |= (unsigned char)(src[0]);
+#endif
+		*dst = z * scaling;
+		dst++;
+		src += src_skip;
+	}
+}	
+
+void sample_move_dS_s16 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) 
+{
+	/* ALERT: signed sign-extension portability !!! */
+	const jack_default_audio_sample_t scaling = 1.0/SAMPLE_16BIT_SCALING;
+	while (nsamples--) {
+		*dst = (*((short *) src)) * scaling;
+		dst++;
+		src += src_skip;
+	}
+}	
+
+void memset_interleave (char *dst, char val, unsigned long bytes, 
+			unsigned long unit_bytes, 
+			unsigned long skip_bytes) 
+{
+	switch (unit_bytes) {
+	case 1:
+		while (bytes--) {
+			*dst = val;
+			dst += skip_bytes;
+		}
+		break;
+	case 2:
+		while (bytes) {
+			*((short *) dst) = (short) val;
+			dst += skip_bytes;
+			bytes -= 2;
+		}
+		break;
+	case 4:		    
+		while (bytes) {
+			*((int *) dst) = (int) val;
+			dst += skip_bytes;
+			bytes -= 4;
+		}
+		break;
+	default:
+		while (bytes) {
+			memset(dst, val, unit_bytes);
+			dst += skip_bytes;
+			bytes -= unit_bytes;
+		}
+		break;
+	}
+}
+
+/* COPY FUNCTIONS: used to move data from an input channel to an
+   output channel. Note that we assume that the skip distance
+   is the same for both channels. This is completely fine
+   unless the input and output were on different audio interfaces that
+   were interleaved differently. We don't try to handle that.
+*/
+
+void 
+memcpy_fake (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar)
+{
+	memcpy (dst, src, src_bytes);
+}
+
+void 
+memcpy_interleave_d16_s16 (char *dst, char *src, unsigned long src_bytes,
+			   unsigned long dst_skip_bytes, unsigned long src_skip_bytes)
+{
+	while (src_bytes) {
+		*((short *) dst) = *((short *) src);
+		dst += dst_skip_bytes;
+		src += src_skip_bytes;
+		src_bytes -= 2;
+	}
+}
+
+void 
+memcpy_interleave_d24_s24 (char *dst, char *src, unsigned long src_bytes,
+			   unsigned long dst_skip_bytes, unsigned long src_skip_bytes)
+{
+	while (src_bytes) {
+		memcpy(dst, src, 3);
+		dst += dst_skip_bytes;
+		src += src_skip_bytes;
+		src_bytes -= 3;
+	}
+}
+
+void 
+memcpy_interleave_d32_s32 (char *dst, char *src, unsigned long src_bytes,
+			   unsigned long dst_skip_bytes, unsigned long src_skip_bytes)
+{
+	while (src_bytes) {
+		*((int *) dst) = *((int *) src);
+		dst += dst_skip_bytes;
+		src += src_skip_bytes;
+		src_bytes -= 4;
+	}
+}
+
diff --git a/common/memops.h b/common/memops.h
new file mode 100644
index 0000000..c027e4d
--- /dev/null
+++ b/common/memops.h
@@ -0,0 +1,126 @@
+/*
+    Copyright (C) 1999-2000 Paul Davis 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __jack_memops_h__
+#define __jack_memops_h__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef sun
+#define __inline__
+#endif
+
+typedef	enum  {
+	None,
+	Rectangular,
+	Triangular,
+	Shaped
+} DitherAlgorithm;
+
+#define DITHER_BUF_SIZE 8
+#define DITHER_BUF_MASK 7
+
+typedef struct {
+    unsigned int depth;
+    float rm1;
+    unsigned int idx;
+    float e[DITHER_BUF_SIZE];
+} dither_state_t;
+
+/* float functions */
+void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long dst_skip);
+void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+
+/* integer functions */
+void sample_move_d32u24_sSs          (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d32u24_sS           (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d24_sSs             (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d24_sS              (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d16_sSs             (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d16_sS              (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+
+void sample_move_dither_rect_d32u24_sSs   (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d32u24_sS    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d32u24_sSs    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d32u24_sS     (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d32u24_sS  (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d24_sSs      (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d24_sS       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d24_sSs       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d24_sS        (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d24_sSs    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d24_sS     (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d16_sSs      (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d16_sS       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d16_sSs       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d16_sS        (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d16_sSs    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d16_sS     (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+
+void sample_move_dS_s32u24s          (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s32u24           (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s24s             (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s24              (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s16s             (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s16              (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+
+void sample_merge_d16_sS             (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_merge_d32u24_sS          (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+
+static __inline__ void
+sample_merge (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt)
+{
+	while (cnt--) {
+		*dst += *src;
+		dst++;
+		src++;
+	}
+}
+
+static __inline__ void
+sample_memcpy (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt)
+{
+	memcpy (dst, src, cnt * sizeof (jack_default_audio_sample_t));
+}
+
+void memset_interleave               (char *dst, char val, unsigned long bytes, unsigned long unit_bytes, unsigned long skip_bytes);
+void memcpy_fake                     (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
+
+void memcpy_interleave_d16_s16       (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void memcpy_interleave_d24_s24       (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void memcpy_interleave_d32_s32       (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+
+void merge_memcpy_interleave_d16_s16 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void merge_memcpy_interleave_d24_s24 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void merge_memcpy_interleave_d32_s32 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+
+void merge_memcpy_d16_s16            (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
+void merge_memcpy_d32_s32            (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_memops_h__ */
diff --git a/common/netjack.c b/common/netjack.c
new file mode 100644
index 0000000..a073c2c
--- /dev/null
+++ b/common/netjack.c
@@ -0,0 +1,755 @@
+
+/* -*- mode: c; c-file-style: "linux"; -*- */
+/*
+NetJack Abstraction.
+
+Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
+Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
+Copyright (C) 2003 Robert Ham <rah at bash.sh>
+Copyright (C) 2001 Paul Davis
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+$Id: net_driver.c,v 1.17 2006/04/16 20:16:10 torbenh Exp $
+*/
+
+
+#include <math.h>
+#include <stdio.h>
+#include <memory.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+
+#include <jack/types.h>
+#include "jack/jslist.h"
+
+#include <sys/types.h>
+
+#ifdef WIN32
+#include <winsock.h>
+#include <malloc.h>
+#define socklen_t int
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif
+
+#include "netjack.h"
+
+#ifdef __linux__
+#include "config.h"
+#endif
+
+#if HAVE_SAMPLERATE
+#include <samplerate.h>
+#endif
+
+#if HAVE_CELT
+#include <celt/celt.h>
+#endif
+
+#include "netjack.h"
+#include "netjack_packet.h"
+
+// JACK2
+#include "jack/control.h"
+
+#define MIN(x,y) ((x)<(y) ? (x) : (y))
+
+static int sync_state = 1;
+static jack_transport_state_t last_transport_state;
+
+static int
+net_driver_sync_cb(jack_transport_state_t state, jack_position_t *pos, void *data)
+{
+    int retval = sync_state;
+
+    if (state == JackTransportStarting && last_transport_state != JackTransportStarting) {
+        retval = 0;
+    }
+//    if (state == JackTransportStarting)
+//		jack_info("Starting sync_state = %d", sync_state);
+    last_transport_state = state;
+    return retval;
+}
+
+int netjack_wait( netjack_driver_state_t *netj )
+{
+    int we_have_the_expected_frame = 0;
+    jack_nframes_t next_frame_avail;
+    jack_time_t packet_recv_time_stamp;
+    jacknet_packet_header *pkthdr;
+
+    if( !netj->next_deadline_valid ) {
+	    netj->next_deadline = jack_get_time() + netj->period_usecs;
+	    netj->next_deadline_valid = 1;
+    }
+
+    // Increment expected frame here.
+
+    if( netj->expected_framecnt_valid ) {
+	netj->expected_framecnt += 1;
+    } else {
+	// starting up.... lets look into the packetcache, and fetch the highest packet.
+	packet_cache_drain_socket( global_packcache, netj->sockfd );
+	if( packet_cache_get_highest_available_framecnt( global_packcache, &next_frame_avail ) ) {
+	    netj->expected_framecnt = next_frame_avail;
+	    netj->expected_framecnt_valid = 1;
+	} else {
+	    // no packets there... start normally.
+	    netj->expected_framecnt = 0;
+	    netj->expected_framecnt_valid = 1;
+	}
+
+    }
+
+    //jack_log( "expect %d", netj->expected_framecnt );
+    // Now check if required packet is already in the cache.
+    // then poll (have deadline calculated)
+    // then drain socket, rinse and repeat.
+    while(1) {
+	if( packet_cache_get_next_available_framecnt( global_packcache, netj->expected_framecnt, &next_frame_avail) ) {
+	    if( next_frame_avail == netj->expected_framecnt ) {
+		we_have_the_expected_frame = 1;
+		if( !netj->always_deadline )
+			break;
+	    }
+	}
+	if( ! netjack_poll_deadline( netj->sockfd, netj->next_deadline ) ) {
+	    break;
+	}
+
+	packet_cache_drain_socket( global_packcache, netj->sockfd );
+    }
+
+    // check if we know who to send our packets too.
+    if (!netj->srcaddress_valid)
+	if( global_packcache->master_address_valid ) {
+	    memcpy (&(netj->syncsource_address), &(global_packcache->master_address), sizeof( struct sockaddr_in ) );
+	    netj->srcaddress_valid = 1;
+	}
+
+    // XXX: switching mode unconditionally is stupid.
+    //      if we were running free perhaps we like to behave differently
+    //      ie. fastforward one packet etc.
+    //      well... this is the first packet we see. hmm.... dunno ;S
+    //      it works... so...
+    netj->running_free = 0;
+
+    //if( !we_have_the_expected_frame )
+    //    jack_error( "netxrun... %d", netj->expected_framecnt );
+
+    if( we_have_the_expected_frame ) {
+
+	jack_time_t now =  jack_get_time();
+	if( now < netj->next_deadline )
+		netj->time_to_deadline = netj->next_deadline - now;
+	else
+		netj->time_to_deadline = 0;
+
+	packet_cache_retreive_packet_pointer( global_packcache, netj->expected_framecnt, (char **) &(netj->rx_buf), netj->rx_bufsize , &packet_recv_time_stamp);
+	pkthdr = (jacknet_packet_header *) netj->rx_buf;
+	packet_header_ntoh(pkthdr);
+	netj->deadline_goodness = (int)pkthdr->sync_state;
+	netj->packet_data_valid = 1;
+
+	int want_deadline;
+	if( netj->jitter_val != 0 )
+		want_deadline = netj->jitter_val;
+	else if( netj->latency < 4 )
+		want_deadline = -netj->period_usecs/2;
+	else
+		want_deadline = (netj->period_usecs/4+10*(int)netj->period_usecs*netj->latency/100);
+
+	if( netj->deadline_goodness != MASTER_FREEWHEELS ) {
+		if( netj->deadline_goodness < want_deadline ) {
+			netj->next_deadline -= netj->period_usecs/100;
+			//jack_log( "goodness: %d, Adjust deadline: --- %d\n", netj->deadline_goodness, (int) netj->period_usecs*netj->latency/100 );
+		}
+		if( netj->deadline_goodness > want_deadline ) {
+			netj->next_deadline += netj->period_usecs/100;
+			//jack_log( "goodness: %d, Adjust deadline: +++ %d\n", netj->deadline_goodness, (int) netj->period_usecs*netj->latency/100 );
+		}
+	}
+//	if( netj->next_deadline < (netj->period_usecs*70/100) ) {
+//		jack_error( "master is forcing deadline_offset to below 70%% of period_usecs... increase latency setting on master" );
+//		netj->deadline_offset = (netj->period_usecs*90/100);
+//	}
+
+	netj->next_deadline += netj->period_usecs;
+    } else {
+	netj->time_to_deadline = 0;
+	netj->next_deadline += netj->period_usecs;
+	// bah... the packet is not there.
+	// either
+	// - it got lost.
+	// - its late
+	// - sync source is not sending anymore.
+
+	// lets check if we have the next packets, we will just run a cycle without data.
+	// in that case.
+
+	if( packet_cache_get_next_available_framecnt( global_packcache, netj->expected_framecnt, &next_frame_avail) )
+	{
+	    jack_nframes_t offset = next_frame_avail - netj->expected_framecnt;
+
+	    //XXX: hmm... i need to remember why resync_threshold wasnt right.
+	    //if( offset < netj->resync_threshold )
+	    if( offset < 10 ) {
+		// ok. dont do nothing. we will run without data.
+		// this seems to be one or 2 lost packets.
+		//
+		// this can also be reordered packet jitter.
+		// (maybe this is not happening in real live)
+		//  but it happens in netem.
+
+		netj->packet_data_valid = 0;
+
+		// I also found this happening, when the packet queue, is too full.
+		// but wtf ? use a smaller latency. this link can handle that ;S
+		if( packet_cache_get_fill( global_packcache, netj->expected_framecnt ) > 80.0 )
+		    netj->next_deadline -= netj->period_usecs/2;
+
+
+	    } else {
+		// the diff is too high. but we have a packet in the future.
+		// lets resync.
+		netj->expected_framecnt = next_frame_avail;
+		packet_cache_retreive_packet_pointer( global_packcache, netj->expected_framecnt, (char **) &(netj->rx_buf), netj->rx_bufsize, NULL );
+		pkthdr = (jacknet_packet_header *) netj->rx_buf;
+		packet_header_ntoh(pkthdr);
+		//netj->deadline_goodness = 0;
+		netj->deadline_goodness = (int)pkthdr->sync_state - (int)netj->period_usecs * offset;
+		netj->next_deadline_valid = 0;
+		netj->packet_data_valid = 1;
+	    }
+
+	} else {
+	    // no packets in buffer.
+	    netj->packet_data_valid = 0;
+
+	    //printf( "frame %d No Packet in queue. num_lost_packets = %d \n", netj->expected_framecnt, netj->num_lost_packets );
+	    if( netj->num_lost_packets < 5 ) {
+		// ok. No Packet in queue. The packet was either lost,
+		// or we are running too fast.
+		//
+		// Adjusting the deadline unconditionally resulted in
+		// too many xruns on master.
+		// But we need to adjust for the case we are running too fast.
+		// So lets check if the last packet is there now.
+		//
+		// It would not be in the queue anymore, if it had been
+		// retrieved. This might break for redundancy, but
+		// i will make the packet cache drop redundant packets,
+		// that have already been retreived.
+		//
+		if( packet_cache_get_highest_available_framecnt( global_packcache, &next_frame_avail) ) {
+		    if( next_frame_avail == (netj->expected_framecnt - 1) ) {
+			// Ok. the last packet is there now.
+			// and it had not been retrieved.
+			//
+			// TODO: We are still dropping 2 packets.
+			//       perhaps we can adjust the deadline
+			//       when (num_packets lost == 0)
+
+			// This might still be too much.
+			netj->next_deadline += netj->period_usecs;
+		    }
+		}
+	    } else if( (netj->num_lost_packets <= 100) ) {
+		// lets try adjusting the deadline harder, for some packets, we might have just ran 2 fast.
+		netj->next_deadline += netj->period_usecs*netj->latency/8;
+	    } else {
+
+		// But now we can check for any new frame available.
+		//
+		if( packet_cache_get_highest_available_framecnt( global_packcache, &next_frame_avail) ) {
+		    netj->expected_framecnt = next_frame_avail;
+		    packet_cache_retreive_packet_pointer( global_packcache, netj->expected_framecnt, (char **) &(netj->rx_buf), netj->rx_bufsize, NULL );
+		    pkthdr = (jacknet_packet_header *) netj->rx_buf;
+		    packet_header_ntoh(pkthdr);
+		    netj->deadline_goodness = pkthdr->sync_state;
+		    netj->next_deadline_valid = 0;
+		    netj->packet_data_valid = 1;
+		    netj->running_free = 0;
+		    jack_info( "resync after freerun... %d", netj->expected_framecnt );
+		} else {
+		    if( netj->num_lost_packets == 101 ) {
+			jack_info( "master seems gone... entering freerun mode", netj->expected_framecnt );
+		    }
+
+		    netj->running_free = 1;
+
+		    // when we really dont see packets.
+		    // reset source address. and open possibility for new master.
+		    // maybe dsl reconnect. Also restart of netsource without fix
+		    // reply address changes port.
+		    if (netj->num_lost_packets > 200 ) {
+			netj->srcaddress_valid = 0;
+			packet_cache_reset_master_address( global_packcache );
+		    }
+		}
+	    }
+	}
+    }
+
+    int retval = 0;
+
+    if( !netj->packet_data_valid ) {
+	netj->num_lost_packets += 1;
+	if( netj->num_lost_packets == 1 )
+	    retval = netj->period_usecs;
+    } else {
+	if( (netj->num_lost_packets>1) && !netj->running_free )
+	    retval = (netj->num_lost_packets-1) * netj->period_usecs;
+
+	netj->num_lost_packets = 0;
+    }
+
+    return retval;
+}
+
+void netjack_send_silence( netjack_driver_state_t *netj, int syncstate )
+{
+    int tx_size = get_sample_size(netj->bitdepth) * netj->playback_channels * netj->net_period_up + sizeof(jacknet_packet_header);
+    unsigned int *packet_buf, *packet_bufX;
+
+    packet_buf = alloca( tx_size);
+    jacknet_packet_header *tx_pkthdr = (jacknet_packet_header *)packet_buf;
+    jacknet_packet_header *rx_pkthdr = (jacknet_packet_header *)netj->rx_buf;
+
+    //framecnt = rx_pkthdr->framecnt;
+
+    netj->reply_port = rx_pkthdr->reply_port;
+
+    // offset packet_bufX by the packetheader.
+    packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
+
+    tx_pkthdr->sync_state = syncstate;
+    tx_pkthdr->framecnt = netj->expected_framecnt;
+
+    // memset 0 the payload.
+    int payload_size = get_sample_size(netj->bitdepth) * netj->playback_channels * netj->net_period_up;
+    memset(packet_bufX, 0, payload_size);
+
+    packet_header_hton(tx_pkthdr);
+    if (netj->srcaddress_valid)
+    {
+	int r;
+	if (netj->reply_port)
+	    netj->syncsource_address.sin_port = htons(netj->reply_port);
+
+	for( r=0; r<netj->redundancy; r++ )
+	    netjack_sendto(netj->outsockfd, (char *)packet_buf, tx_size,
+		    0, (struct sockaddr*)&(netj->syncsource_address), sizeof(struct sockaddr_in), netj->mtu);
+    }
+}
+
+
+void netjack_attach( netjack_driver_state_t *netj )
+{
+    //puts ("net_driver_attach");
+    jack_port_t * port;
+    char buf[32];
+    unsigned int chn;
+    int port_flags;
+
+
+    if (netj->handle_transport_sync)
+        jack_set_sync_callback(netj->client, (JackSyncCallback) net_driver_sync_cb, NULL);
+
+    port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
+
+    for (chn = 0; chn < netj->capture_channels_audio; chn++) {
+        snprintf (buf, sizeof(buf) - 1, "capture_%u", chn + 1);
+
+        port = jack_port_register (netj->client, buf,
+                                   JACK_DEFAULT_AUDIO_TYPE,
+                                   port_flags, 0);
+        if (!port) {
+            jack_error ("NET: cannot register port for %s", buf);
+            break;
+        }
+
+        netj->capture_ports =
+            jack_slist_append (netj->capture_ports, port);
+
+	if( netj->bitdepth == CELT_MODE ) {
+#if HAVE_CELT
+#if HAVE_CELT_API_0_7
+	    celt_int32 lookahead;
+	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL );
+	    netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
+#else
+	    celt_int32_t lookahead;
+	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, 1, netj->period_size, NULL );
+	    netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( celt_mode ) );
+#endif
+	    celt_mode_info( celt_mode, CELT_GET_LOOKAHEAD, &lookahead );
+	    netj->codec_latency = 2*lookahead;
+#endif
+	} else {
+#if HAVE_SAMPLERATE
+	    netj->capture_srcs = jack_slist_append(netj->capture_srcs, src_new(SRC_LINEAR, 1, NULL));
+#endif
+	}
+    }
+    for (chn = netj->capture_channels_audio; chn < netj->capture_channels; chn++) {
+        snprintf (buf, sizeof(buf) - 1, "capture_%u", chn + 1);
+
+        port = jack_port_register (netj->client, buf,
+                                   JACK_DEFAULT_MIDI_TYPE,
+                                   port_flags, 0);
+        if (!port) {
+            jack_error ("NET: cannot register port for %s", buf);
+            break;
+        }
+
+        netj->capture_ports =
+            jack_slist_append (netj->capture_ports, port);
+    }
+
+    port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
+
+    for (chn = 0; chn < netj->playback_channels_audio; chn++) {
+        snprintf (buf, sizeof(buf) - 1, "playback_%u", chn + 1);
+
+        port = jack_port_register (netj->client, buf,
+                                   JACK_DEFAULT_AUDIO_TYPE,
+                                   port_flags, 0);
+
+        if (!port) {
+            jack_error ("NET: cannot register port for %s", buf);
+            break;
+        }
+
+        netj->playback_ports =
+            jack_slist_append (netj->playback_ports, port);
+	if( netj->bitdepth == CELT_MODE ) {
+#if HAVE_CELT
+#if HAVE_CELT_API_0_7
+	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL );
+	    netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
+#else
+	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, 1, netj->period_size, NULL );
+	    netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_encoder_create( celt_mode ) );
+#endif
+#endif
+	} else {
+#if HAVE_SAMPLERATE
+	    netj->playback_srcs = jack_slist_append(netj->playback_srcs, src_new(SRC_LINEAR, 1, NULL));
+#endif
+	}
+    }
+    for (chn = netj->playback_channels_audio; chn < netj->playback_channels; chn++) {
+        snprintf (buf, sizeof(buf) - 1, "playback_%u", chn + 1);
+
+        port = jack_port_register (netj->client, buf,
+                                   JACK_DEFAULT_MIDI_TYPE,
+                                   port_flags, 0);
+
+        if (!port) {
+            jack_error ("NET: cannot register port for %s", buf);
+            break;
+        }
+
+        netj->playback_ports =
+            jack_slist_append (netj->playback_ports, port);
+    }
+
+    jack_activate (netj->client);
+}
+
+
+void netjack_detach( netjack_driver_state_t *netj )
+{
+    JSList * node;
+
+
+    for (node = netj->capture_ports; node; node = jack_slist_next (node))
+        jack_port_unregister (netj->client,
+                              ((jack_port_t *) node->data));
+
+    jack_slist_free (netj->capture_ports);
+    netj->capture_ports = NULL;
+
+    for (node = netj->playback_ports; node; node = jack_slist_next (node))
+        jack_port_unregister (netj->client,
+                              ((jack_port_t *) node->data));
+
+    jack_slist_free (netj->playback_ports);
+    netj->playback_ports = NULL;
+}
+
+
+netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
+		jack_client_t * client,
+                const char *name,
+                unsigned int capture_ports,
+                unsigned int playback_ports,
+                unsigned int capture_ports_midi,
+                unsigned int playback_ports_midi,
+                jack_nframes_t sample_rate,
+                jack_nframes_t period_size,
+                unsigned int listen_port,
+                unsigned int transport_sync,
+                unsigned int resample_factor,
+                unsigned int resample_factor_up,
+                unsigned int bitdepth,
+		unsigned int use_autoconfig,
+		unsigned int latency,
+		unsigned int redundancy,
+		int dont_htonl_floats,
+		int always_deadline,
+		int jitter_val )
+{
+
+    // Fill in netj values.
+    // might be subject to autoconfig...
+    // so dont calculate anything with them...
+
+
+    netj->sample_rate = sample_rate;
+    netj->period_size = period_size;
+    netj->dont_htonl_floats = dont_htonl_floats;
+
+    netj->listen_port   = listen_port;
+
+    netj->capture_channels  = capture_ports + capture_ports_midi;
+    netj->capture_channels_audio  = capture_ports;
+    netj->capture_channels_midi   = capture_ports_midi;
+    netj->capture_ports     = NULL;
+    netj->playback_channels = playback_ports + playback_ports_midi;
+    netj->playback_channels_audio = playback_ports;
+    netj->playback_channels_midi = playback_ports_midi;
+    netj->playback_ports    = NULL;
+    netj->codec_latency = 0;
+
+    netj->handle_transport_sync = transport_sync;
+    netj->mtu = 1400;
+    netj->latency = latency;
+    netj->redundancy = redundancy;
+    netj->use_autoconfig = use_autoconfig;
+    netj->always_deadline = always_deadline;
+
+
+    netj->client = client;
+
+
+    if ((bitdepth != 0) && (bitdepth != 8) && (bitdepth != 16) && (bitdepth != CELT_MODE))
+    {
+        jack_info ("Invalid bitdepth: %d (8, 16 or 0 for float) !!!", bitdepth);
+        return NULL;
+    }
+    netj->bitdepth = bitdepth;
+
+
+    if (resample_factor_up == 0)
+        resample_factor_up = resample_factor;
+
+    netj->resample_factor = resample_factor;
+    netj->resample_factor_up = resample_factor_up;
+
+
+    return netj;
+}
+
+void netjack_release( netjack_driver_state_t *netj )
+{
+    close( netj->sockfd );
+    close( netj->outsockfd );
+
+    packet_cache_free( global_packcache );
+    global_packcache = NULL;
+}
+
+int
+netjack_startup( netjack_driver_state_t *netj )
+{
+    int first_pack_len;
+    struct sockaddr_in address;
+    // Now open the socket, and wait for the first packet to arrive...
+    netj->sockfd = socket (AF_INET, SOCK_DGRAM, 0);
+
+#ifdef WIN32
+    u_long parm = 1;
+    DWORD bufsize = 262144;
+    //ioctlsocket( netj->sockfd, FIONBIO, &parm );
+    setsockopt( netj->sockfd, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize) );
+    setsockopt( netj->sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&bufsize, sizeof(bufsize) );
+    if (netj->sockfd == INVALID_SOCKET)
+#else
+    if (netj->sockfd == -1)
+#endif
+    {
+        jack_info ("socket error");
+        return -1;
+    }
+    address.sin_family = AF_INET;
+    address.sin_port = htons(netj->listen_port);
+    address.sin_addr.s_addr = htonl(INADDR_ANY);
+    if (bind (netj->sockfd, (struct sockaddr *) &address, sizeof (address)) < 0)
+    {
+        jack_info("bind error");
+        return -1;
+    }
+
+    netj->outsockfd = socket (AF_INET, SOCK_DGRAM, 0);
+#ifdef WIN32
+    if (netj->outsockfd == INVALID_SOCKET)
+#else
+    if (netj->outsockfd == -1)
+#endif
+    {
+        jack_info ("socket error");
+        return -1;
+    }
+    netj->srcaddress_valid = 0;
+    if (netj->use_autoconfig)
+    {
+	jacknet_packet_header *first_packet = alloca (sizeof (jacknet_packet_header));
+#ifdef WIN32
+    int address_size = sizeof( struct sockaddr_in );
+#else
+	socklen_t address_size = sizeof (struct sockaddr_in);
+#endif
+	//jack_info ("Waiting for an incoming packet !!!");
+	//jack_info ("*** IMPORTANT *** Dont connect a client to jackd until the driver is attached to a clock source !!!");
+
+    while(1) {
+    first_pack_len = recvfrom (netj->sockfd, (char *)first_packet, sizeof (jacknet_packet_header), 0, (struct sockaddr*) & netj->syncsource_address, &address_size);
+#ifdef WIN32
+        if( first_pack_len == -1 ) {
+            first_pack_len = sizeof(jacknet_packet_header);
+            break;
+        }
+#else
+        if (first_pack_len == sizeof (jacknet_packet_header))
+            break;
+#endif
+    }
+	netj->srcaddress_valid = 1;
+
+	if (first_pack_len == sizeof (jacknet_packet_header))
+	{
+	    packet_header_ntoh (first_packet);
+
+	    jack_info ("AutoConfig Override !!!");
+	    if (netj->sample_rate != first_packet->sample_rate)
+	    {
+		jack_info ("AutoConfig Override: Master JACK sample rate = %d", first_packet->sample_rate);
+		netj->sample_rate = first_packet->sample_rate;
+	    }
+
+	    if (netj->period_size != first_packet->period_size)
+	    {
+		jack_info ("AutoConfig Override: Master JACK period size is %d", first_packet->period_size);
+		netj->period_size = first_packet->period_size;
+	    }
+	    if (netj->capture_channels_audio != first_packet->capture_channels_audio)
+	    {
+		jack_info ("AutoConfig Override: capture_channels_audio = %d", first_packet->capture_channels_audio);
+		netj->capture_channels_audio = first_packet->capture_channels_audio;
+	    }
+	    if (netj->capture_channels_midi != first_packet->capture_channels_midi)
+	    {
+		jack_info ("AutoConfig Override: capture_channels_midi = %d", first_packet->capture_channels_midi);
+		netj->capture_channels_midi = first_packet->capture_channels_midi;
+	    }
+	    if (netj->playback_channels_audio != first_packet->playback_channels_audio)
+	    {
+		jack_info ("AutoConfig Override: playback_channels_audio = %d", first_packet->playback_channels_audio);
+		netj->playback_channels_audio = first_packet->playback_channels_audio;
+	    }
+	    if (netj->playback_channels_midi != first_packet->playback_channels_midi)
+	    {
+		jack_info ("AutoConfig Override: playback_channels_midi = %d", first_packet->playback_channels_midi);
+		netj->playback_channels_midi = first_packet->playback_channels_midi;
+	    }
+
+	    netj->mtu = first_packet->mtu;
+	    jack_info ("MTU is set to %d bytes", first_packet->mtu);
+	    netj->latency = first_packet->latency;
+	}
+    }
+    netj->capture_channels  = netj->capture_channels_audio + netj->capture_channels_midi;
+    netj->playback_channels = netj->playback_channels_audio + netj->playback_channels_midi;
+
+    if( (netj->capture_channels * netj->period_size * netj->latency * 4) > 100000000 ) {
+	    jack_error( "autoconfig requests more than 100MB packet cache... bailing out" );
+	    exit(1);
+    }
+
+    if( netj->playback_channels > 1000 ) {
+	    jack_error( "autoconfig requests more than 1000 playback channels... bailing out" );
+	    exit(1);
+    }
+
+
+    if( netj->mtu < (2*sizeof( jacknet_packet_header )) ) {
+	    jack_error( "bullshit mtu requested by autoconfig" );
+	    exit(1);
+    }
+
+    if( netj->sample_rate == 0 ) {
+	    jack_error( "sample_rate 0 requested by autoconfig" );
+	    exit(1);
+    }
+
+    // After possible Autoconfig: do all calculations...
+    netj->period_usecs =
+        (jack_time_t) floor ((((float) netj->period_size) / (float)netj->sample_rate)
+                             * 1000000.0f);
+
+    if( netj->latency == 0 )
+	netj->deadline_offset = 50*netj->period_usecs;
+    else
+	netj->deadline_offset = netj->period_usecs + 10*netj->latency*netj->period_usecs/100;
+
+    if( netj->bitdepth == CELT_MODE ) {
+	// celt mode.
+	// TODO: this is a hack. But i dont want to change the packet header.
+	netj->resample_factor = (netj->resample_factor * netj->period_size * 1024 / netj->sample_rate / 8)&(~1);
+	netj->resample_factor_up = (netj->resample_factor_up * netj->period_size * 1024 / netj->sample_rate / 8)&(~1);
+
+	netj->net_period_down = netj->resample_factor;
+	netj->net_period_up = netj->resample_factor_up;
+    } else {
+	netj->net_period_down = (float) netj->period_size / (float) netj->resample_factor;
+	netj->net_period_up = (float) netj->period_size / (float) netj->resample_factor_up;
+    }
+
+    netj->rx_bufsize = sizeof (jacknet_packet_header) + netj->net_period_down * netj->capture_channels * get_sample_size (netj->bitdepth);
+    netj->pkt_buf = malloc (netj->rx_bufsize);
+    global_packcache = packet_cache_new (netj->latency + 50, netj->rx_bufsize, netj->mtu);
+
+    netj->expected_framecnt_valid = 0;
+    netj->num_lost_packets = 0;
+    netj->next_deadline_valid = 0;
+    netj->deadline_goodness = 0;
+    netj->time_to_deadline = 0;
+
+    // Special handling for latency=0
+    if( netj->latency == 0 )
+	netj->resync_threshold = 0;
+    else
+	netj->resync_threshold = MIN( 15, netj->latency-1 );
+
+    netj->running_free = 0;
+
+    return 0;
+}
diff --git a/common/netjack.h b/common/netjack.h
new file mode 100644
index 0000000..91c81be
--- /dev/null
+++ b/common/netjack.h
@@ -0,0 +1,147 @@
+
+/*
+    Copyright (C) 2003 Robert Ham <rah at bash.sh>
+    Copyright (C) 2005 Torben Hohn <torbenh at gmx.de>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __NETJACK_H__
+#define __NETJACK_H__
+
+#include <unistd.h>
+
+#include <jack/types.h>
+//#include <jack/driver.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+#include "jack/jslist.h"
+
+//#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct _netjack_driver_state netjack_driver_state_t;
+
+struct _netjack_driver_state {
+    jack_nframes_t  net_period_up;
+    jack_nframes_t  net_period_down;
+
+    jack_nframes_t  sample_rate;
+    jack_nframes_t  bitdepth;
+    jack_nframes_t  period_size;
+    jack_time_t	    period_usecs;
+    int		    dont_htonl_floats;
+    int		    always_deadline;
+
+    jack_nframes_t  codec_latency;
+
+    unsigned int    listen_port;
+
+    unsigned int    capture_channels;
+    unsigned int    playback_channels;
+    unsigned int    capture_channels_audio;
+    unsigned int    playback_channels_audio;
+    unsigned int    capture_channels_midi;
+    unsigned int    playback_channels_midi;
+
+    JSList	    *capture_ports;
+    JSList	    *playback_ports;
+    JSList	    *playback_srcs;
+    JSList	    *capture_srcs;
+
+    jack_client_t   *client;
+
+#ifdef WIN32
+    SOCKET	    sockfd;
+    SOCKET	    outsockfd;
+#else
+    int		    sockfd;
+    int		    outsockfd;
+#endif
+
+    struct sockaddr_in syncsource_address;
+
+    int		    reply_port;
+    int		    srcaddress_valid;
+
+    int sync_state;
+    unsigned int handle_transport_sync;
+
+    unsigned int *rx_buf;
+    unsigned int *pkt_buf;
+    unsigned int rx_bufsize;
+    //unsigned int tx_bufsize;
+    unsigned int mtu;
+    unsigned int latency;
+    unsigned int redundancy;
+
+    jack_nframes_t expected_framecnt;
+    int		   expected_framecnt_valid;
+    unsigned int   num_lost_packets;
+    jack_time_t	   next_deadline;
+    jack_time_t	   deadline_offset;
+    int		   next_deadline_valid;
+    int		   packet_data_valid;
+    int		   resync_threshold;
+    int		   running_free;
+    int		   deadline_goodness;
+    jack_time_t	   time_to_deadline;
+    unsigned int   use_autoconfig;
+    unsigned int   resample_factor;
+    unsigned int   resample_factor_up;
+    int		   jitter_val;
+};
+
+int netjack_wait( netjack_driver_state_t *netj );
+void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
+void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
+void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
+void netjack_attach( netjack_driver_state_t *netj );
+void netjack_detach( netjack_driver_state_t *netj );
+
+netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
+		jack_client_t * client,
+                const char *name,
+                unsigned int capture_ports,
+                unsigned int playback_ports,
+                unsigned int capture_ports_midi,
+                unsigned int playback_ports_midi,
+                jack_nframes_t sample_rate,
+                jack_nframes_t period_size,
+                unsigned int listen_port,
+                unsigned int transport_sync,
+                unsigned int resample_factor,
+                unsigned int resample_factor_up,
+                unsigned int bitdepth,
+		unsigned int use_autoconfig,
+		unsigned int latency,
+		unsigned int redundancy,
+		int dont_htonl_floats,
+		int always_deadline,
+		int jitter_val );
+
+void netjack_release( netjack_driver_state_t *netj );
+int netjack_startup( netjack_driver_state_t *netj );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/netjack_packet.c b/common/netjack_packet.c
new file mode 100644
index 0000000..dfe3b9e
--- /dev/null
+++ b/common/netjack_packet.c
@@ -0,0 +1,1524 @@
+
+/*
+ * NetJack - Packet Handling functions
+ *
+ * used by the driver and the jacknet_client
+ *
+ * Copyright (C) 2008 Marc-Olivier Barre <marco at marcochapeau.org>
+ * Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
+ * Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: net_driver.c,v 1.16 2006/03/20 19:41:37 torbenh Exp $
+ *
+ */
+
+#ifdef __linux__
+#include "config.h"
+#endif
+
+#ifdef __APPLE__
+#define _DARWIN_C_SOURCE
+#endif
+
+#if HAVE_PPOLL
+#define _GNU_SOURCE
+#endif
+
+#include <math.h>
+#include <stdio.h>
+#include <memory.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+
+#include <jack/types.h>
+
+#include <sys/types.h>
+
+#ifdef WIN32
+#include <winsock2.h>
+#define socklen_t int
+#include <malloc.h>
+#define socklen_t int
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <poll.h>
+#endif
+
+#include <errno.h>
+#include <signal.h>
+
+#if HAVE_SAMPLERATE
+#include <samplerate.h>
+#endif
+
+#if HAVE_CELT
+#include <celt/celt.h>
+#endif
+
+#include "netjack_packet.h"
+
+// JACK2 specific.
+#include "jack/control.h"
+
+#ifdef NO_JACK_ERROR
+#define jack_error printf
+#endif
+
+int fraggo = 0;
+
+packet_cache *global_packcache = NULL;
+
+void
+packet_header_hton (jacknet_packet_header *pkthdr)
+{
+    pkthdr->capture_channels_audio = htonl(pkthdr->capture_channels_audio);
+    pkthdr->playback_channels_audio = htonl(pkthdr->playback_channels_audio);
+    pkthdr->capture_channels_midi = htonl(pkthdr->capture_channels_midi);
+    pkthdr->playback_channels_midi = htonl(pkthdr->playback_channels_midi);
+    pkthdr->period_size = htonl(pkthdr->period_size);
+    pkthdr->sample_rate = htonl(pkthdr->sample_rate);
+    pkthdr->sync_state = htonl(pkthdr->sync_state);
+    pkthdr->transport_frame = htonl(pkthdr->transport_frame);
+    pkthdr->transport_state = htonl(pkthdr->transport_state);
+    pkthdr->framecnt = htonl(pkthdr->framecnt);
+    pkthdr->latency = htonl(pkthdr->latency);
+    pkthdr->reply_port = htonl(pkthdr->reply_port);
+    pkthdr->mtu = htonl(pkthdr->mtu);
+    pkthdr->fragment_nr = htonl(pkthdr->fragment_nr);
+}
+
+void
+packet_header_ntoh (jacknet_packet_header *pkthdr)
+{
+    pkthdr->capture_channels_audio = ntohl(pkthdr->capture_channels_audio);
+    pkthdr->playback_channels_audio = ntohl(pkthdr->playback_channels_audio);
+    pkthdr->capture_channels_midi = ntohl(pkthdr->capture_channels_midi);
+    pkthdr->playback_channels_midi = ntohl(pkthdr->playback_channels_midi);
+    pkthdr->period_size = ntohl(pkthdr->period_size);
+    pkthdr->sample_rate = ntohl(pkthdr->sample_rate);
+    pkthdr->sync_state = ntohl(pkthdr->sync_state);
+    pkthdr->transport_frame = ntohl(pkthdr->transport_frame);
+    pkthdr->transport_state = ntohl(pkthdr->transport_state);
+    pkthdr->framecnt = ntohl(pkthdr->framecnt);
+    pkthdr->latency = ntohl(pkthdr->latency);
+    pkthdr->reply_port = ntohl(pkthdr->reply_port);
+    pkthdr->mtu = ntohl(pkthdr->mtu);
+    pkthdr->fragment_nr = ntohl(pkthdr->fragment_nr);
+}
+
+int get_sample_size (int bitdepth)
+{
+    if (bitdepth == 8)
+        return sizeof (int8_t);
+    if (bitdepth == 16)
+        return sizeof (int16_t);
+    //JN: why? is this for buffer sizes before or after encoding?
+    //JN: if the former, why not int16_t, if the latter, shouldn't it depend on -c N?
+    if( bitdepth == CELT_MODE )
+	return sizeof( unsigned char );
+    return sizeof (int32_t);
+}
+
+int jack_port_is_audio(const char *porttype)
+{
+    return (strncmp (porttype, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0);
+}
+
+int jack_port_is_midi(const char *porttype)
+{
+    return (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0);
+}
+
+
+// fragment management functions.
+
+packet_cache
+*packet_cache_new (int num_packets, int pkt_size, int mtu)
+{
+    int fragment_payload_size = mtu - sizeof (jacknet_packet_header);
+    int i, fragment_number;
+
+    if( pkt_size == sizeof(jacknet_packet_header) )
+	    fragment_number = 1;
+    else
+	    fragment_number = (pkt_size - sizeof (jacknet_packet_header) - 1) / fragment_payload_size + 1;
+
+    packet_cache *pcache = malloc (sizeof (packet_cache));
+    if (pcache == NULL)
+    {
+        jack_error ("could not allocate packet cache (1)");
+        return NULL;
+    }
+
+    pcache->size = num_packets;
+    pcache->packets = malloc (sizeof (cache_packet) * num_packets);
+    pcache->master_address_valid = 0;
+    pcache->last_framecnt_retreived = 0;
+    pcache->last_framecnt_retreived_valid = 0;
+
+    if (pcache->packets == NULL)
+    {
+        jack_error ("could not allocate packet cache (2)");
+        return NULL;
+    }
+
+    for (i = 0; i < num_packets; i++)
+    {
+        pcache->packets[i].valid = 0;
+        pcache->packets[i].num_fragments = fragment_number;
+        pcache->packets[i].packet_size = pkt_size;
+        pcache->packets[i].mtu = mtu;
+        pcache->packets[i].framecnt = 0;
+        pcache->packets[i].fragment_array = malloc (sizeof (char) * fragment_number);
+        pcache->packets[i].packet_buf = malloc (pkt_size);
+        if ((pcache->packets[i].fragment_array == NULL) || (pcache->packets[i].packet_buf == NULL))
+        {
+            jack_error ("could not allocate packet cache (3)");
+            return NULL;
+        }
+    }
+    pcache->mtu = mtu;
+
+    return pcache;
+}
+
+void
+packet_cache_free (packet_cache *pcache)
+{
+    int i;
+    if( pcache == NULL )
+	return;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+        free (pcache->packets[i].fragment_array);
+        free (pcache->packets[i].packet_buf);
+    }
+
+    free (pcache->packets);
+    free (pcache);
+}
+
+cache_packet
+*packet_cache_get_packet (packet_cache *pcache, jack_nframes_t framecnt)
+{
+    int i;
+    cache_packet *retval;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+        if (pcache->packets[i].valid && (pcache->packets[i].framecnt == framecnt))
+            return &(pcache->packets[i]);
+    }
+
+    // The Packet is not in the packet cache.
+    // find a free packet.
+
+    retval = packet_cache_get_free_packet (pcache);
+    if (retval != NULL)
+    {
+        cache_packet_set_framecnt (retval, framecnt);
+        return retval;
+    }
+
+    // No Free Packet available
+    // Get The Oldest packet and reset it.
+
+    retval = packet_cache_get_oldest_packet (pcache);
+    //printf( "Dropping %d from Cache :S\n", retval->framecnt );
+    cache_packet_reset (retval);
+    cache_packet_set_framecnt (retval, framecnt);
+
+    return retval;
+}
+
+// TODO: fix wrapping case... need to pass
+//       current expected frame here.
+//
+//       or just save framecount into packet_cache.
+
+cache_packet
+*packet_cache_get_oldest_packet (packet_cache *pcache)
+{
+    jack_nframes_t minimal_frame = JACK_MAX_FRAMES;
+    cache_packet *retval = &(pcache->packets[0]);
+    int i;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+        if (pcache->packets[i].valid && (pcache->packets[i].framecnt < minimal_frame))
+        {
+            minimal_frame = pcache->packets[i].framecnt;
+            retval = &(pcache->packets[i]);
+        }
+    }
+
+    return retval;
+}
+
+cache_packet
+*packet_cache_get_free_packet (packet_cache *pcache)
+{
+    int i;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+        if (pcache->packets[i].valid == 0)
+            return &(pcache->packets[i]);
+    }
+
+    return NULL;
+}
+
+void
+cache_packet_reset (cache_packet *pack)
+{
+    int i;
+    pack->valid = 0;
+
+    // XXX: i dont think this is necessary here...
+    //      fragement array is cleared in _set_framecnt()
+
+    for (i = 0; i < pack->num_fragments; i++)
+        pack->fragment_array[i] = 0;
+}
+
+void
+cache_packet_set_framecnt (cache_packet *pack, jack_nframes_t framecnt)
+{
+    int i;
+
+    pack->framecnt = framecnt;
+
+    for (i = 0; i < pack->num_fragments; i++)
+        pack->fragment_array[i] = 0;
+
+    pack->valid = 1;
+}
+
+void
+cache_packet_add_fragment (cache_packet *pack, char *packet_buf, int rcv_len)
+{
+    jacknet_packet_header *pkthdr = (jacknet_packet_header *) packet_buf;
+    int fragment_payload_size = pack->mtu - sizeof (jacknet_packet_header);
+    char *packet_bufX = pack->packet_buf + sizeof (jacknet_packet_header);
+    char *dataX = packet_buf + sizeof (jacknet_packet_header);
+
+    jack_nframes_t fragment_nr = ntohl (pkthdr->fragment_nr);
+    jack_nframes_t framecnt    = ntohl (pkthdr->framecnt);
+
+    if (framecnt != pack->framecnt)
+    {
+        jack_error ("errror. framecnts dont match");
+        return;
+    }
+
+
+    if (fragment_nr == 0)
+    {
+        memcpy (pack->packet_buf, packet_buf, rcv_len);
+        pack->fragment_array[0] = 1;
+
+        return;
+    }
+
+    if ((fragment_nr < pack->num_fragments) && (fragment_nr > 0))
+    {
+        if ((fragment_nr * fragment_payload_size + rcv_len - sizeof (jacknet_packet_header)) <= (pack->packet_size - sizeof (jacknet_packet_header)))
+        {
+            memcpy (packet_bufX + fragment_nr * fragment_payload_size, dataX, rcv_len - sizeof (jacknet_packet_header));
+            pack->fragment_array[fragment_nr] = 1;
+        }
+        else
+            jack_error ("too long packet received...");
+    }
+}
+
+int
+cache_packet_is_complete (cache_packet *pack)
+{
+    int i;
+    for (i = 0; i < pack->num_fragments; i++)
+        if (pack->fragment_array[i] == 0)
+            return 0;
+
+    return 1;
+}
+
+#ifndef WIN32
+// new poll using nanoseconds resolution and
+// not waiting forever.
+int
+netjack_poll_deadline (int sockfd, jack_time_t deadline)
+{
+    struct pollfd fds;
+    int poll_err = 0;
+#if HAVE_PPOLL
+    struct timespec timeout_spec = { 0, 0 };
+#else
+    int timeout;
+#endif
+
+
+    jack_time_t now = jack_get_time();
+    if( now >= deadline )
+	return 0;
+
+    if( (deadline-now) >= 1000000 ) {
+	    jack_error( "deadline more than 1 second in the future, trimming it." );
+	    deadline = now+500000;
+    }
+#if HAVE_PPOLL
+    timeout_spec.tv_nsec = (deadline - now) * 1000;
+#else
+    timeout = (deadline - now + 500) / 1000;
+#endif
+
+
+    fds.fd = sockfd;
+    fds.events = POLLIN;
+
+#if HAVE_PPOLL
+    poll_err = ppoll (&fds, 1, &timeout_spec, NULL);
+#else
+    poll_err = poll (&fds, 1, timeout);
+#endif
+
+    if (poll_err == -1)
+    {
+        switch (errno)
+        {
+            case EBADF:
+            jack_error ("Error %d: An invalid file descriptor was given in one of the sets", errno);
+            break;
+            case EFAULT:
+            jack_error ("Error %d: The array given as argument was not contained in the calling program's address space", errno);
+            break;
+            case EINTR:
+            jack_error ("Error %d: A signal occurred before any requested event", errno);
+            break;
+            case EINVAL:
+            jack_error ("Error %d: The nfds value exceeds the RLIMIT_NOFILE value", errno);
+            break;
+            case ENOMEM:
+            jack_error ("Error %d: There was no space to allocate file descriptor tables", errno);
+            break;
+        }
+    }
+    return poll_err;
+}
+
+int
+netjack_poll (int sockfd, int timeout)
+{
+    struct pollfd fds;
+    int i, poll_err = 0;
+    sigset_t sigmask, rsigmask;
+    struct sigaction action;
+
+    sigemptyset(&sigmask);
+	sigaddset(&sigmask, SIGHUP);
+	sigaddset(&sigmask, SIGINT);
+	sigaddset(&sigmask, SIGQUIT);
+	sigaddset(&sigmask, SIGPIPE);
+	sigaddset(&sigmask, SIGTERM);
+	sigaddset(&sigmask, SIGUSR1);
+	sigaddset(&sigmask, SIGUSR2);
+
+	action.sa_handler = SIG_DFL;
+	action.sa_mask = sigmask;
+	action.sa_flags = SA_RESTART;
+
+    for (i = 1; i < NSIG; i++)
+        if (sigismember (&sigmask, i))
+            sigaction (i, &action, 0);
+
+    fds.fd = sockfd;
+    fds.events = POLLIN;
+
+    sigprocmask(SIG_UNBLOCK, &sigmask, &rsigmask);
+    while (poll_err == 0)
+    {
+        poll_err = poll (&fds, 1, timeout);
+    }
+    sigprocmask(SIG_SETMASK, &rsigmask, NULL);
+
+    if (poll_err == -1)
+    {
+        switch (errno)
+        {
+            case EBADF:
+            jack_error ("Error %d: An invalid file descriptor was given in one of the sets", errno);
+            break;
+            case EFAULT:
+            jack_error ("Error %d: The array given as argument was not contained in the calling program's address space", errno);
+            break;
+            case EINTR:
+            jack_error ("Error %d: A signal occurred before any requested event", errno);
+            break;
+            case EINVAL:
+            jack_error ("Error %d: The nfds value exceeds the RLIMIT_NOFILE value", errno);
+            break;
+            case ENOMEM:
+            jack_error ("Error %d: There was no space to allocate file descriptor tables", errno);
+            break;
+        }
+        return 0;
+    }
+    return 1;
+}
+
+#else
+int
+netjack_poll (int sockfd, int timeout)
+{
+    jack_error( "netjack_poll not implemented" );
+    return 0;
+}
+int
+netjack_poll_deadline (int sockfd, jack_time_t deadline)
+{
+    fd_set fds;
+    FD_ZERO( &fds );
+    FD_SET( sockfd, &fds );
+
+    struct timeval timeout;
+    while( 1 ) {
+        jack_time_t now = jack_get_time();
+        if( now >= deadline )
+                return 0;
+
+        int timeout_usecs = (deadline - now);
+    //jack_error( "timeout = %d", timeout_usecs );
+        timeout.tv_sec = 0;
+        timeout.tv_usec = (timeout_usecs < 500) ? 500 : timeout_usecs;
+        timeout.tv_usec = (timeout_usecs > 1000000) ? 500000 : timeout_usecs;
+
+        int poll_err = select (0, &fds, NULL, NULL, &timeout);
+        if( poll_err != 0 )
+            return poll_err;
+    }
+
+    return 0;
+}
+#endif
+// This now reads all a socket has into the cache.
+// replacing netjack_recv functions.
+
+void
+packet_cache_drain_socket( packet_cache *pcache, int sockfd )
+{
+    char *rx_packet = alloca (pcache->mtu);
+    jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
+    int rcv_len;
+    jack_nframes_t framecnt;
+    cache_packet *cpack;
+    struct sockaddr_in sender_address;
+#ifdef WIN32
+    size_t senderlen = sizeof( struct sockaddr_in );
+    u_long parm = 1;
+    ioctlsocket( sockfd, FIONBIO, &parm );
+#else
+    socklen_t senderlen = sizeof( struct sockaddr_in );
+#endif
+    while (1)
+    {
+#ifdef WIN32
+        rcv_len = recvfrom (sockfd, rx_packet, pcache->mtu, 0,
+			    (struct sockaddr*) &sender_address, &senderlen);
+#else
+        rcv_len = recvfrom (sockfd, rx_packet, pcache->mtu, MSG_DONTWAIT,
+			    (struct sockaddr*) &sender_address, &senderlen);
+#endif
+        if (rcv_len < 0)
+            return;
+
+	if (pcache->master_address_valid) {
+	    // Verify its from our master.
+	    if (memcmp (&sender_address, &(pcache->master_address), senderlen) != 0)
+		continue;
+	} else {
+	    // Setup this one as master
+	    //printf( "setup master...\n" );
+	    memcpy ( &(pcache->master_address), &sender_address, senderlen );
+	    pcache->master_address_valid = 1;
+	}
+
+        framecnt = ntohl (pkthdr->framecnt);
+	if( pcache->last_framecnt_retreived_valid && (framecnt <= pcache->last_framecnt_retreived ))
+	    continue;
+
+        cpack = packet_cache_get_packet (global_packcache, framecnt);
+        cache_packet_add_fragment (cpack, rx_packet, rcv_len);
+	cpack->recv_timestamp = jack_get_time();
+    }
+}
+
+void
+packet_cache_reset_master_address( packet_cache *pcache )
+{
+    pcache->master_address_valid = 0;
+    pcache->last_framecnt_retreived = 0;
+    pcache->last_framecnt_retreived_valid = 0;
+}
+
+void
+packet_cache_clear_old_packets (packet_cache *pcache, jack_nframes_t framecnt )
+{
+    int i;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+        if (pcache->packets[i].valid && (pcache->packets[i].framecnt < framecnt))
+        {
+            cache_packet_reset (&(pcache->packets[i]));
+        }
+    }
+}
+
+int
+packet_cache_retreive_packet_pointer( packet_cache *pcache, jack_nframes_t framecnt, char **packet_buf, int pkt_size, jack_time_t *timestamp )
+{
+    int i;
+    cache_packet *cpack = NULL;
+
+
+    for (i = 0; i < pcache->size; i++) {
+        if (pcache->packets[i].valid && (pcache->packets[i].framecnt == framecnt)) {
+	    cpack = &(pcache->packets[i]);
+            break;
+	}
+    }
+
+    if( cpack == NULL ) {
+	//printf( "retreive packet: %d....not found\n", framecnt );
+	return -1;
+    }
+
+    if( !cache_packet_is_complete( cpack ) ) {
+	return -1;
+    }
+
+    // ok. cpack is the one we want and its complete.
+    *packet_buf = cpack->packet_buf;
+    if( timestamp )
+	*timestamp = cpack->recv_timestamp;
+
+    pcache->last_framecnt_retreived_valid = 1;
+    pcache->last_framecnt_retreived = framecnt;
+
+    return pkt_size;
+}
+
+int
+packet_cache_release_packet( packet_cache *pcache, jack_nframes_t framecnt )
+{
+    int i;
+    cache_packet *cpack = NULL;
+
+
+    for (i = 0; i < pcache->size; i++) {
+        if (pcache->packets[i].valid && (pcache->packets[i].framecnt == framecnt)) {
+	    cpack = &(pcache->packets[i]);
+            break;
+	}
+    }
+
+    if( cpack == NULL ) {
+	//printf( "retreive packet: %d....not found\n", framecnt );
+	return -1;
+    }
+
+    if( !cache_packet_is_complete( cpack ) ) {
+	return -1;
+    }
+
+    cache_packet_reset (cpack);
+    packet_cache_clear_old_packets( pcache, framecnt );
+
+    return 0;
+}
+float
+packet_cache_get_fill( packet_cache *pcache, jack_nframes_t expected_framecnt )
+{
+    int num_packets_before_us = 0;
+    int i;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+	cache_packet *cpack = &(pcache->packets[i]);
+        if (cpack->valid && cache_packet_is_complete( cpack ))
+	    if( cpack->framecnt >= expected_framecnt )
+		num_packets_before_us += 1;
+    }
+
+    return 100.0 * (float)num_packets_before_us / (float)( pcache->size ) ;
+}
+
+// Returns 0 when no valid packet is inside the cache.
+int
+packet_cache_get_next_available_framecnt( packet_cache *pcache, jack_nframes_t expected_framecnt, jack_nframes_t *framecnt )
+{
+    int i;
+    jack_nframes_t best_offset = JACK_MAX_FRAMES/2-1;
+    int retval = 0;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+	cache_packet *cpack = &(pcache->packets[i]);
+	//printf( "p%d: valid=%d, frame %d\n", i, cpack->valid, cpack->framecnt );
+
+        if (!cpack->valid || !cache_packet_is_complete( cpack )) {
+	    //printf( "invalid\n" );
+	    continue;
+	}
+
+	if( cpack->framecnt < expected_framecnt )
+	    continue;
+
+	if( (cpack->framecnt - expected_framecnt) > best_offset ) {
+	    continue;
+	}
+
+	best_offset = cpack->framecnt - expected_framecnt;
+	retval = 1;
+
+	if( best_offset == 0 )
+	    break;
+    }
+    if( retval && framecnt )
+	*framecnt = expected_framecnt + best_offset;
+
+    return retval;
+}
+
+int
+packet_cache_get_highest_available_framecnt( packet_cache *pcache, jack_nframes_t *framecnt )
+{
+    int i;
+    jack_nframes_t best_value = 0;
+    int retval = 0;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+	cache_packet *cpack = &(pcache->packets[i]);
+	//printf( "p%d: valid=%d, frame %d\n", i, cpack->valid, cpack->framecnt );
+
+        if (!cpack->valid || !cache_packet_is_complete( cpack )) {
+	    //printf( "invalid\n" );
+	    continue;
+	}
+
+	if (cpack->framecnt < best_value) {
+	    continue;
+	}
+
+	best_value = cpack->framecnt;
+	retval = 1;
+
+    }
+    if( retval && framecnt )
+	*framecnt = best_value;
+
+    return retval;
+}
+
+// Returns 0 when no valid packet is inside the cache.
+int
+packet_cache_find_latency( packet_cache *pcache, jack_nframes_t expected_framecnt, jack_nframes_t *framecnt )
+{
+    int i;
+    jack_nframes_t best_offset = 0;
+    int retval = 0;
+
+    for (i = 0; i < pcache->size; i++)
+    {
+	cache_packet *cpack = &(pcache->packets[i]);
+	//printf( "p%d: valid=%d, frame %d\n", i, cpack->valid, cpack->framecnt );
+
+        if (!cpack->valid || !cache_packet_is_complete( cpack )) {
+	    //printf( "invalid\n" );
+	    continue;
+	}
+
+	if( (cpack->framecnt - expected_framecnt) < best_offset ) {
+	    continue;
+	}
+
+	best_offset = cpack->framecnt - expected_framecnt;
+	retval = 1;
+
+	if( best_offset == 0 )
+	    break;
+    }
+    if( retval && framecnt )
+	*framecnt = JACK_MAX_FRAMES - best_offset;
+
+    return retval;
+}
+// fragmented packet IO
+int
+netjack_recvfrom (int sockfd, char *packet_buf, int pkt_size, int flags, struct sockaddr *addr, size_t *addr_size, int mtu)
+{
+    int retval;
+    socklen_t from_len = *addr_size;
+    if (pkt_size <= mtu) {
+        retval = recvfrom (sockfd, packet_buf, pkt_size, flags, addr, &from_len);
+	*addr_size = from_len;
+	return retval;
+    }
+
+    char *rx_packet = alloca (mtu);
+    jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
+    int rcv_len;
+    jack_nframes_t framecnt;
+    cache_packet *cpack;
+    do
+    {
+        rcv_len = recvfrom (sockfd, rx_packet, mtu, 0, addr, &from_len);
+        if (rcv_len < 0)
+            return rcv_len;
+        framecnt = ntohl (pkthdr->framecnt);
+        cpack = packet_cache_get_packet (global_packcache, framecnt);
+        cache_packet_add_fragment (cpack, rx_packet, rcv_len);
+    } while (!cache_packet_is_complete (cpack));
+    memcpy (packet_buf, cpack->packet_buf, pkt_size);
+    cache_packet_reset (cpack);
+    *addr_size = from_len;
+    return pkt_size;
+}
+
+int
+netjack_recv (int sockfd, char *packet_buf, int pkt_size, int flags, int mtu)
+{
+    if (pkt_size <= mtu)
+        return recv (sockfd, packet_buf, pkt_size, flags);
+    char *rx_packet = alloca (mtu);
+    jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
+    int rcv_len;
+    jack_nframes_t framecnt;
+    cache_packet *cpack;
+    do
+    {
+        rcv_len = recv (sockfd, rx_packet, mtu, flags);
+        if (rcv_len < 0)
+            return rcv_len;
+        framecnt = ntohl (pkthdr->framecnt);
+        cpack = packet_cache_get_packet (global_packcache, framecnt);
+        cache_packet_add_fragment (cpack, rx_packet, rcv_len);
+    } while (!cache_packet_is_complete (cpack));
+    memcpy (packet_buf, cpack->packet_buf, pkt_size);
+    cache_packet_reset (cpack);
+    return pkt_size;
+}
+
+void
+netjack_sendto (int sockfd, char *packet_buf, int pkt_size, int flags, struct sockaddr *addr, int addr_size, int mtu)
+{
+    int frag_cnt = 0;
+    char *tx_packet, *dataX;
+    jacknet_packet_header *pkthdr;
+
+    tx_packet = alloca (mtu + 10);
+    dataX = tx_packet + sizeof (jacknet_packet_header);
+    pkthdr = (jacknet_packet_header *) tx_packet;
+
+    int fragment_payload_size = mtu - sizeof (jacknet_packet_header);
+
+    if (pkt_size <= mtu) {
+	int err;
+	pkthdr = (jacknet_packet_header *) packet_buf;
+        pkthdr->fragment_nr = htonl (0);
+        err = sendto(sockfd, packet_buf, pkt_size, flags, addr, addr_size);
+	if( err<0 ) {
+	    //printf( "error in send\n" );
+	    perror( "send" );
+	}
+    }
+    else
+    {
+	int err;
+        // Copy the packet header to the tx pack first.
+        memcpy(tx_packet, packet_buf, sizeof (jacknet_packet_header));
+
+        // Now loop and send all
+        char *packet_bufX = packet_buf + sizeof (jacknet_packet_header);
+
+        while (packet_bufX < (packet_buf + pkt_size - fragment_payload_size))
+        {
+            pkthdr->fragment_nr = htonl (frag_cnt++);
+            memcpy (dataX, packet_bufX, fragment_payload_size);
+            sendto (sockfd, tx_packet, mtu, flags, addr, addr_size);
+            packet_bufX += fragment_payload_size;
+        }
+
+        int last_payload_size = packet_buf + pkt_size - packet_bufX;
+        memcpy (dataX, packet_bufX, last_payload_size);
+        pkthdr->fragment_nr = htonl (frag_cnt);
+        //jack_log("last fragment_count = %d, payload_size = %d\n", fragment_count, last_payload_size);
+
+        // sendto(last_pack_size);
+        err = sendto(sockfd, tx_packet, last_payload_size + sizeof(jacknet_packet_header), flags, addr, addr_size);
+	if( err<0 ) {
+	    //printf( "error in send\n" );
+	    perror( "send" );
+	}
+    }
+}
+
+
+void
+decode_midi_buffer (uint32_t *buffer_uint32, unsigned int buffer_size_uint32, jack_default_audio_sample_t* buf)
+{
+    int i;
+    jack_midi_clear_buffer (buf);
+    for (i = 0; i < buffer_size_uint32 - 3;)
+    {
+        uint32_t payload_size;
+        payload_size = buffer_uint32[i];
+        payload_size = ntohl (payload_size);
+        if (payload_size)
+        {
+            jack_midi_event_t event;
+            event.time = ntohl (buffer_uint32[i+1]);
+            event.size = ntohl (buffer_uint32[i+2]);
+            event.buffer = (jack_midi_data_t*) (&(buffer_uint32[i+3]));
+            jack_midi_event_write (buf, event.time, event.buffer, event.size);
+
+            // skip to the next event
+            unsigned int nb_data_quads = (((event.size-1) & ~0x3) >> 2)+1;
+            i += 3+nb_data_quads;
+        }
+        else
+            break; // no events can follow an empty event, we're done
+    }
+}
+
+void
+encode_midi_buffer (uint32_t *buffer_uint32, unsigned int buffer_size_uint32, jack_default_audio_sample_t* buf)
+{
+    int i;
+    unsigned int written = 0;
+    // midi port, encode midi events
+    unsigned int nevents = jack_midi_get_event_count (buf);
+    for (i = 0; i < nevents; ++i)
+    {
+        jack_midi_event_t event;
+        jack_midi_event_get (&event, buf, i);
+        unsigned int nb_data_quads = (((event.size - 1) & ~0x3) >> 2) + 1;
+        unsigned int payload_size = 3 + nb_data_quads;
+        // only write if we have sufficient space for the event
+        // otherwise drop it
+        if (written + payload_size < buffer_size_uint32 - 1)
+        {
+            // write header
+            buffer_uint32[written]=htonl (payload_size);
+            written++;
+            buffer_uint32[written]=htonl (event.time);
+            written++;
+            buffer_uint32[written]=htonl (event.size);
+            written++;
+
+            // write data
+            jack_midi_data_t* tmpbuff = (jack_midi_data_t*)(&(buffer_uint32[written]));
+            memcpy (tmpbuff, event.buffer, event.size);
+            written += nb_data_quads;
+        }
+        else
+        {
+            // buffer overflow
+            jack_error ("midi buffer overflow");
+            break;
+        }
+    }
+    // now put a netjack_midi 'no-payload' event, signaling EOF
+    buffer_uint32[written]=0;
+}
+
+// render functions for float
+void
+render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
+{
+    int chn = 0;
+    JSList *node = capture_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = capture_srcs;
+#endif
+
+    uint32_t *packet_bufX = (uint32_t *)packet_payload;
+
+    if( !packet_payload )
+	return;
+
+    while (node != NULL)
+    {
+        int i;
+        int_float_t val;
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+#if HAVE_SAMPLERATE
+            // audio port, resample if necessary
+            if (net_period_down != nframes)
+            {
+                SRC_STATE *src_state = src_node->data;
+                for (i = 0; i < net_period_down; i++)
+                {
+                    packet_bufX[i] = ntohl (packet_bufX[i]);
+                }
+
+                src.data_in = (float *) packet_bufX;
+                src.input_frames = net_period_down;
+
+                src.data_out = buf;
+                src.output_frames = nframes;
+
+                src.src_ratio = (float) nframes / (float) net_period_down;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+            {
+		if( dont_htonl_floats )
+		{
+		    memcpy( buf, packet_bufX, net_period_down*sizeof(jack_default_audio_sample_t));
+		}
+		else
+		{
+		    for (i = 0; i < net_period_down; i++)
+		    {
+			val.i = packet_bufX[i];
+			val.i = ntohl (val.i);
+			buf[i] = val.f;
+		    }
+		}
+            }
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // midi port, decode midi events
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_down;
+            uint32_t * buffer_uint32 = (uint32_t*)packet_bufX;
+            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_down);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+void
+render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats )
+{
+    int chn = 0;
+    JSList *node = playback_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = playback_srcs;
+#endif
+
+    uint32_t *packet_bufX = (uint32_t *) packet_payload;
+
+    while (node != NULL)
+    {
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+        int i;
+        int_float_t val;
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+            // audio port, resample if necessary
+
+#if HAVE_SAMPLERATE
+            if (net_period_up != nframes) {
+                SRC_STATE *src_state = src_node->data;
+                src.data_in = buf;
+                src.input_frames = nframes;
+
+                src.data_out = (float *) packet_bufX;
+                src.output_frames = net_period_up;
+
+                src.src_ratio = (float) net_period_up / (float) nframes;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+
+                for (i = 0; i < net_period_up; i++)
+                {
+                    packet_bufX[i] = htonl (packet_bufX[i]);
+                }
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+            {
+		if( dont_htonl_floats )
+		{
+		    memcpy( packet_bufX, buf, net_period_up*sizeof(jack_default_audio_sample_t) );
+		}
+		else
+		{
+		    for (i = 0; i < net_period_up; i++)
+		    {
+			val.f = buf[i];
+			val.i = htonl (val.i);
+			packet_bufX[i] = val.i;
+		    }
+		}
+            }
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // encode midi events from port to packet
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_up;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_up);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+// render functions for 16bit
+void
+render_payload_to_jack_ports_16bit (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
+{
+    int chn = 0;
+    JSList *node = capture_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = capture_srcs;
+#endif
+
+    uint16_t *packet_bufX = (uint16_t *)packet_payload;
+
+    if( !packet_payload )
+	return;
+
+    while (node != NULL)
+    {
+        int i;
+        //uint32_t val;
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+
+#if HAVE_SAMPLERATE
+        float *floatbuf = alloca (sizeof(float) * net_period_down);
+#endif
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+            // audio port, resample if necessary
+
+#if HAVE_SAMPLERATE
+            if (net_period_down != nframes)
+            {
+                SRC_STATE *src_state = src_node->data;
+                for (i = 0; i < net_period_down; i++)
+                {
+                    floatbuf[i] = ((float) ntohs(packet_bufX[i])) / 32767.0 - 1.0;
+                }
+
+                src.data_in = floatbuf;
+                src.input_frames = net_period_down;
+
+                src.data_out = buf;
+                src.output_frames = nframes;
+
+                src.src_ratio = (float) nframes / (float) net_period_down;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+                for (i = 0; i < net_period_down; i++)
+                    buf[i] = ((float) ntohs (packet_bufX[i])) / 32768.0 - 1.0;
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // midi port, decode midi events
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_down / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_down);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+void
+render_jack_ports_to_payload_16bit (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
+{
+    int chn = 0;
+    JSList *node = playback_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = playback_srcs;
+#endif
+
+    uint16_t *packet_bufX = (uint16_t *)packet_payload;
+
+    while (node != NULL)
+    {
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+        int i;
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+            // audio port, resample if necessary
+
+#if HAVE_SAMPLERATE
+            if (net_period_up != nframes)
+            {
+                SRC_STATE *src_state = src_node->data;
+
+                float *floatbuf = alloca (sizeof(float) * net_period_up);
+
+                src.data_in = buf;
+                src.input_frames = nframes;
+
+                src.data_out = floatbuf;
+                src.output_frames = net_period_up;
+
+                src.src_ratio = (float) net_period_up / (float) nframes;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+
+                for (i = 0; i < net_period_up; i++)
+                {
+                    packet_bufX[i] = htons (((uint16_t)((floatbuf[i] + 1.0) * 32767.0)));
+                }
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+                for (i = 0; i < net_period_up; i++)
+                    packet_bufX[i] = htons(((uint16_t)((buf[i] + 1.0) * 32767.0)));
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // encode midi events from port to packet
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_up / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_up);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+// render functions for 8bit
+void
+render_payload_to_jack_ports_8bit (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
+{
+    int chn = 0;
+    JSList *node = capture_ports;
+
+#if HAVE_SAMPLERATE
+    JSList *src_node = capture_srcs;
+#endif
+
+    int8_t *packet_bufX = (int8_t *)packet_payload;
+
+    if( !packet_payload )
+	return;
+
+    while (node != NULL)
+    {
+        int i;
+        //uint32_t val;
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+
+#if HAVE_SAMPLERATE
+        float *floatbuf = alloca (sizeof (float) * net_period_down);
+#endif
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio(porttype))
+        {
+#if HAVE_SAMPLERATE
+            // audio port, resample if necessary
+            if (net_period_down != nframes)
+            {
+                SRC_STATE *src_state = src_node->data;
+                for (i = 0; i < net_period_down; i++)
+                    floatbuf[i] = ((float) packet_bufX[i]) / 127.0;
+
+                src.data_in = floatbuf;
+                src.input_frames = net_period_down;
+
+                src.data_out = buf;
+                src.output_frames = nframes;
+
+                src.src_ratio = (float) nframes / (float) net_period_down;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+                for (i = 0; i < net_period_down; i++)
+                    buf[i] = ((float) packet_bufX[i]) / 127.0;
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // midi port, decode midi events
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_down / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_down);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+void
+render_jack_ports_to_payload_8bit (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
+{
+    int chn = 0;
+    JSList *node = playback_ports;
+#if HAVE_SAMPLERATE
+    JSList *src_node = playback_srcs;
+#endif
+
+    int8_t *packet_bufX = (int8_t *)packet_payload;
+
+    while (node != NULL)
+    {
+#if HAVE_SAMPLERATE
+        SRC_DATA src;
+#endif
+        int i;
+        jack_port_t *port = (jack_port_t *) node->data;
+
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+#if HAVE_SAMPLERATE
+            // audio port, resample if necessary
+            if (net_period_up != nframes)
+            {
+
+                SRC_STATE *src_state = src_node->data;
+
+                float *floatbuf = alloca (sizeof (float) * net_period_up);
+
+                src.data_in = buf;
+                src.input_frames = nframes;
+
+                src.data_out = floatbuf;
+                src.output_frames = net_period_up;
+
+                src.src_ratio = (float) net_period_up / (float) nframes;
+                src.end_of_input = 0;
+
+                src_set_ratio (src_state, src.src_ratio);
+                src_process (src_state, &src);
+
+                for (i = 0; i < net_period_up; i++)
+                    packet_bufX[i] = floatbuf[i] * 127.0;
+                src_node = jack_slist_next (src_node);
+            }
+            else
+#endif
+                for (i = 0; i < net_period_up; i++)
+                    packet_bufX[i] = buf[i] * 127.0;
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // encode midi events from port to packet
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_up / 4;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_up);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+#if HAVE_CELT
+// render functions for celt.
+void
+render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
+{
+    int chn = 0;
+    JSList *node = capture_ports;
+    JSList *src_node = capture_srcs;
+
+    unsigned char *packet_bufX = (unsigned char *)packet_payload;
+
+    while (node != NULL)
+    {
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+            // audio port, decode celt data.
+
+	    CELTDecoder *decoder = src_node->data;
+	    if( !packet_payload )
+		celt_decode_float( decoder, NULL, net_period_down, buf );
+	    else
+		celt_decode_float( decoder, packet_bufX, net_period_down, buf );
+
+	    src_node = jack_slist_next (src_node);
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // midi port, decode midi events
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_down / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+	    if( packet_payload )
+		decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_down);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+void
+render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
+{
+    int chn = 0;
+    JSList *node = playback_ports;
+    JSList *src_node = playback_srcs;
+
+    unsigned char *packet_bufX = (unsigned char *)packet_payload;
+
+    while (node != NULL)
+    {
+        jack_port_t *port = (jack_port_t *) node->data;
+        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
+        const char *porttype = jack_port_type (port);
+
+        if (jack_port_is_audio (porttype))
+        {
+            // audio port, encode celt data.
+
+	    int encoded_bytes;
+	    float *floatbuf = alloca (sizeof(float) * nframes );
+	    memcpy( floatbuf, buf, nframes*sizeof(float) );
+	    CELTEncoder *encoder = src_node->data;
+	    encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up );
+	    if( encoded_bytes != net_period_up )
+		printf( "something in celt changed. netjack needs to be changed to handle this.\n" );
+	    src_node = jack_slist_next( src_node );
+        }
+        else if (jack_port_is_midi (porttype))
+        {
+            // encode midi events from port to packet
+            // convert the data buffer to a standard format (uint32_t based)
+            unsigned int buffer_size_uint32 = net_period_up / 2;
+            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
+            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
+        }
+        packet_bufX = (packet_bufX + net_period_up);
+        node = jack_slist_next (node);
+        chn++;
+    }
+}
+
+#endif
+/* Wrapper functions with bitdepth argument... */
+void
+render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
+{
+    if (bitdepth == 8)
+        render_payload_to_jack_ports_8bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
+    else if (bitdepth == 16)
+        render_payload_to_jack_ports_16bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
+#if HAVE_CELT
+    else if (bitdepth == CELT_MODE)
+        render_payload_to_jack_ports_celt (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
+#endif
+    else
+        render_payload_to_jack_ports_float (packet_payload, net_period_down, capture_ports, capture_srcs, nframes, dont_htonl_floats);
+}
+
+void
+render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats)
+{
+    if (bitdepth == 8)
+        render_jack_ports_to_payload_8bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
+    else if (bitdepth == 16)
+        render_jack_ports_to_payload_16bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
+#if HAVE_CELT
+    else if (bitdepth == CELT_MODE)
+        render_jack_ports_to_payload_celt (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
+#endif
+    else
+        render_jack_ports_to_payload_float (playback_ports, playback_srcs, nframes, packet_payload, net_period_up, dont_htonl_floats);
+}
diff --git a/drivers/netjack/netjack_packet.h b/common/netjack_packet.h
similarity index 100%
rename from drivers/netjack/netjack_packet.h
rename to common/netjack_packet.h
diff --git a/common/ringbuffer.c b/common/ringbuffer.c
new file mode 100644
index 0000000..45ee27b
--- /dev/null
+++ b/common/ringbuffer.c
@@ -0,0 +1,404 @@
+/*
+  Copyright (C) 2000 Paul Davis
+  Copyright (C) 2003 Rohan Drape
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+  ISO/POSIX C version of Paul Davis's lock free ringbuffer C++ code.
+  This is safe for the case of one read thread and one write thread.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#ifdef USE_MLOCK
+#include <sys/mman.h>
+#endif /* USE_MLOCK */
+#include "JackCompilerDeps.h"
+
+typedef struct {
+    char *buf;
+    size_t len;
+}
+jack_ringbuffer_data_t ;
+
+typedef struct {
+    char	*buf;
+    volatile size_t write_ptr;
+    volatile size_t read_ptr;
+    size_t	size;
+    size_t	size_mask;
+    int	mlocked;
+}
+jack_ringbuffer_t ;
+
+EXPORT jack_ringbuffer_t *jack_ringbuffer_create(size_t sz);
+EXPORT void jack_ringbuffer_free(jack_ringbuffer_t *rb);
+EXPORT void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb,
+                                         jack_ringbuffer_data_t *vec);
+EXPORT void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb,
+                                          jack_ringbuffer_data_t *vec);
+EXPORT size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt);
+EXPORT size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt);
+EXPORT void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt);
+EXPORT size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb);
+EXPORT int jack_ringbuffer_mlock(jack_ringbuffer_t *rb);
+EXPORT void jack_ringbuffer_reset(jack_ringbuffer_t *rb);
+EXPORT void jack_ringbuffer_reset_size (jack_ringbuffer_t * rb, size_t sz);
+EXPORT size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src,
+                                 size_t cnt);
+void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt);
+size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb);                                                                
+
+/* Create a new ringbuffer to hold at least `sz' bytes of data. The
+   actual buffer size is rounded up to the next power of two.  */
+
+EXPORT jack_ringbuffer_t *
+jack_ringbuffer_create (size_t sz)
+{
+	int power_of_two;
+	jack_ringbuffer_t *rb;
+	
+	if ((rb = (jack_ringbuffer_t *) malloc (sizeof (jack_ringbuffer_t))) == NULL) {
+		return NULL;
+	}
+	
+	for (power_of_two = 1; 1 << power_of_two < sz; power_of_two++);
+	
+	rb->size = 1 << power_of_two;
+	rb->size_mask = rb->size;
+	rb->size_mask -= 1;
+	rb->write_ptr = 0;
+	rb->read_ptr = 0;
+	if ((rb->buf = (char *) malloc (rb->size)) == NULL) {
+		free (rb);
+		return NULL;
+	}
+	rb->mlocked = 0;
+	
+	return rb;
+}
+
+/* Free all data associated with the ringbuffer `rb'. */
+
+EXPORT void
+jack_ringbuffer_free (jack_ringbuffer_t * rb)
+{
+#ifdef USE_MLOCK
+	if (rb->mlocked) {
+		munlock (rb->buf, rb->size);
+	}
+#endif /* USE_MLOCK */
+	free (rb->buf);
+	free (rb);
+}
+
+/* Lock the data block of `rb' using the system call 'mlock'.  */
+
+EXPORT int
+jack_ringbuffer_mlock (jack_ringbuffer_t * rb)
+{
+#ifdef USE_MLOCK
+	if (mlock (rb->buf, rb->size)) {
+		return -1;
+	}
+#endif /* USE_MLOCK */
+	rb->mlocked = 1;
+	return 0;
+}
+
+/* Reset the read and write pointers to zero. This is not thread
+   safe. */
+
+EXPORT void
+jack_ringbuffer_reset (jack_ringbuffer_t * rb)
+{
+	rb->read_ptr = 0;
+	rb->write_ptr = 0;
+}
+
+/* Reset the read and write pointers to zero. This is not thread
+   safe. */
+
+EXPORT void
+jack_ringbuffer_reset_size (jack_ringbuffer_t * rb, size_t sz)
+{
+    rb->size = sz;
+    rb->size_mask = rb->size;
+    rb->size_mask -= 1;
+    rb->read_ptr = 0;
+    rb->write_ptr = 0;
+}
+
+/* Return the number of bytes available for reading.  This is the
+   number of bytes in front of the read pointer and behind the write
+   pointer.  */
+
+EXPORT size_t
+jack_ringbuffer_read_space (const jack_ringbuffer_t * rb)
+{
+	size_t w, r;
+	
+	w = rb->write_ptr;
+	r = rb->read_ptr;
+	
+	if (w > r) {
+		return w - r;
+	} else {
+		return (w - r + rb->size) & rb->size_mask;
+	}
+}
+
+/* Return the number of bytes available for writing.  This is the
+   number of bytes in front of the write pointer and behind the read
+   pointer.  */
+
+EXPORT size_t
+jack_ringbuffer_write_space (const jack_ringbuffer_t * rb)
+{
+	size_t w, r;
+
+	w = rb->write_ptr;
+	r = rb->read_ptr;
+
+	if (w > r) {
+		return ((r - w + rb->size) & rb->size_mask) - 1;
+	} else if (w < r) {
+		return (r - w) - 1;
+	} else {
+		return rb->size - 1;
+	}
+}
+
+/* The copying data reader.  Copy at most `cnt' bytes from `rb' to
+   `dest'.  Returns the actual number of bytes copied. */
+
+EXPORT size_t
+jack_ringbuffer_read (jack_ringbuffer_t * rb, char *dest, size_t cnt)
+{
+	size_t free_cnt;
+	size_t cnt2;
+	size_t to_read;
+	size_t n1, n2;
+
+	if ((free_cnt = jack_ringbuffer_read_space (rb)) == 0) {
+		return 0;
+	}
+
+	to_read = cnt > free_cnt ? free_cnt : cnt;
+
+	cnt2 = rb->read_ptr + to_read;
+
+	if (cnt2 > rb->size) {
+		n1 = rb->size - rb->read_ptr;
+		n2 = cnt2 & rb->size_mask;
+	} else {
+		n1 = to_read;
+		n2 = 0;
+	}
+
+	memcpy (dest, &(rb->buf[rb->read_ptr]), n1);
+	rb->read_ptr = (rb->read_ptr + n1) & rb->size_mask;
+
+	if (n2) {
+		memcpy (dest + n1, &(rb->buf[rb->read_ptr]), n2);
+		rb->read_ptr = (rb->read_ptr + n2) & rb->size_mask;
+	}
+
+	return to_read;
+}
+
+/* The copying data reader w/o read pointer advance.  Copy at most 
+   `cnt' bytes from `rb' to `dest'.  Returns the actual number of bytes 
+   copied. */
+
+EXPORT size_t
+jack_ringbuffer_peek (jack_ringbuffer_t * rb, char *dest, size_t cnt)
+{
+	size_t free_cnt;
+	size_t cnt2;
+	size_t to_read;
+	size_t n1, n2;
+	size_t tmp_read_ptr;
+
+	tmp_read_ptr = rb->read_ptr;
+
+	if ((free_cnt = jack_ringbuffer_read_space (rb)) == 0) {
+		return 0;
+	}
+
+	to_read = cnt > free_cnt ? free_cnt : cnt;
+
+	cnt2 = tmp_read_ptr + to_read;
+
+	if (cnt2 > rb->size) {
+		n1 = rb->size - tmp_read_ptr;
+		n2 = cnt2 & rb->size_mask;
+	} else {
+		n1 = to_read;
+		n2 = 0;
+	}
+
+	memcpy (dest, &(rb->buf[tmp_read_ptr]), n1);
+	tmp_read_ptr = (tmp_read_ptr + n1) & rb->size_mask;
+
+	if (n2) {
+		memcpy (dest + n1, &(rb->buf[tmp_read_ptr]), n2);
+	}
+
+	return to_read;
+}
+
+/* The copying data writer.  Copy at most `cnt' bytes to `rb' from
+   `src'.  Returns the actual number of bytes copied. */
+
+EXPORT size_t
+jack_ringbuffer_write (jack_ringbuffer_t * rb, const char *src, size_t cnt)
+{
+	size_t free_cnt;
+	size_t cnt2;
+	size_t to_write;
+	size_t n1, n2;
+
+	if ((free_cnt = jack_ringbuffer_write_space (rb)) == 0) {
+		return 0;
+	}
+
+	to_write = cnt > free_cnt ? free_cnt : cnt;
+
+	cnt2 = rb->write_ptr + to_write;
+
+	if (cnt2 > rb->size) {
+		n1 = rb->size - rb->write_ptr;
+		n2 = cnt2 & rb->size_mask;
+	} else {
+		n1 = to_write;
+		n2 = 0;
+	}
+
+	memcpy (&(rb->buf[rb->write_ptr]), src, n1);
+	rb->write_ptr = (rb->write_ptr + n1) & rb->size_mask;
+
+	if (n2) {
+		memcpy (&(rb->buf[rb->write_ptr]), src + n1, n2);
+		rb->write_ptr = (rb->write_ptr + n2) & rb->size_mask;
+	}
+
+	return to_write;
+}
+
+/* Advance the read pointer `cnt' places. */
+
+EXPORT void
+jack_ringbuffer_read_advance (jack_ringbuffer_t * rb, size_t cnt)
+{
+	size_t tmp = (rb->read_ptr + cnt) & rb->size_mask;
+	rb->read_ptr = tmp;
+}
+
+/* Advance the write pointer `cnt' places. */
+
+EXPORT void
+jack_ringbuffer_write_advance (jack_ringbuffer_t * rb, size_t cnt)
+{
+	size_t tmp = (rb->write_ptr + cnt) & rb->size_mask;
+	rb->write_ptr = tmp;
+}
+
+/* The non-copying data reader.  `vec' is an array of two places.  Set
+   the values at `vec' to hold the current readable data at `rb'.  If
+   the readable data is in one segment the second segment has zero
+   length.  */
+
+EXPORT void
+jack_ringbuffer_get_read_vector (const jack_ringbuffer_t * rb,
+				 jack_ringbuffer_data_t * vec)
+{
+	size_t free_cnt;
+	size_t cnt2;
+	size_t w, r;
+
+	w = rb->write_ptr;
+	r = rb->read_ptr;
+
+	if (w > r) {
+		free_cnt = w - r;
+	} else {
+		free_cnt = (w - r + rb->size) & rb->size_mask;
+	}
+
+	cnt2 = r + free_cnt;
+
+	if (cnt2 > rb->size) {
+
+		/* Two part vector: the rest of the buffer after the current write
+		   ptr, plus some from the start of the buffer. */
+
+		vec[0].buf = &(rb->buf[r]);
+		vec[0].len = rb->size - r;
+		vec[1].buf = rb->buf;
+		vec[1].len = cnt2 & rb->size_mask;
+
+	} else {
+
+		/* Single part vector: just the rest of the buffer */
+
+		vec[0].buf = &(rb->buf[r]);
+		vec[0].len = free_cnt;
+		vec[1].len = 0;
+	}
+}
+
+/* The non-copying data writer.  `vec' is an array of two places.  Set
+   the values at `vec' to hold the current writeable data at `rb'.  If
+   the writeable data is in one segment the second segment has zero
+   length.  */
+
+EXPORT void
+jack_ringbuffer_get_write_vector (const jack_ringbuffer_t * rb,
+				  jack_ringbuffer_data_t * vec)
+{
+	size_t free_cnt;
+	size_t cnt2;
+	size_t w, r;
+
+	w = rb->write_ptr;
+	r = rb->read_ptr;
+
+	if (w > r) {
+		free_cnt = ((r - w + rb->size) & rb->size_mask) - 1;
+	} else if (w < r) {
+		free_cnt = (r - w) - 1;
+	} else {
+		free_cnt = rb->size - 1;
+	}
+
+	cnt2 = w + free_cnt;
+
+	if (cnt2 > rb->size) {
+
+		/* Two part vector: the rest of the buffer after the current write
+		   ptr, plus some from the start of the buffer. */
+
+		vec[0].buf = &(rb->buf[w]);
+		vec[0].len = rb->size - w;
+		vec[1].buf = rb->buf;
+		vec[1].len = cnt2 & rb->size_mask;
+	} else {
+		vec[0].buf = &(rb->buf[w]);
+		vec[0].len = free_cnt;
+		vec[1].len = 0;
+	}
+}
+
diff --git a/common/shm.c b/common/shm.c
new file mode 100644
index 0000000..e74a213
--- /dev/null
+++ b/common/shm.c
@@ -0,0 +1,1214 @@
+/*
+ * Copyright (C) 2003 Paul Davis
+ * Copyright (C) 2004 Jack O'Quin
+ * Copyright (C) 2006-2007 Grame
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/* This module provides a set of abstract shared memory interfaces
+ * with support using both System V and POSIX shared memory
+ * implementations.  The code is divided into three sections:
+ *
+ *	- common (interface-independent) code
+ *	- POSIX implementation
+ *	- System V implementation
+ *
+ * The implementation used is determined by whether USE_POSIX_SHM was
+ * set in the ./configure step.
+ */
+
+#include "JackConstants.h"
+
+#ifdef WIN32
+#include <process.h>
+#include <stdio.h>
+#else
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <limits.h>
+#include <errno.h>
+#include <dirent.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <stdlib.h>
+
+#endif
+
+#include "shm.h"
+#include "JackError.h"
+
+static int GetUID()
+{
+#ifdef WIN32
+    return  _getpid();
+    //#error "No getuid function available"
+#else
+    return getuid();
+#endif
+}
+
+static int GetPID()
+{
+#ifdef WIN32
+    return  _getpid();
+#else
+    return getpid();
+#endif
+}
+
+#ifdef USE_POSIX_SHM
+static jack_shmtype_t jack_shmtype = shm_POSIX;
+#elif WIN32
+static jack_shmtype_t jack_shmtype = shm_WIN32;
+#else
+static jack_shmtype_t jack_shmtype = shm_SYSV;
+#endif
+
+/* interface-dependent forward declarations */
+static int	jack_access_registry (jack_shm_info_t *ri);
+static int	jack_create_registry (jack_shm_info_t *ri);
+static void	jack_remove_shm (jack_shm_id_t *id);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * common interface-independent section
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* The JACK SHM registry is a chunk of memory for keeping track of the
+ * shared memory used by each active JACK server.  This allows the
+ * server to clean up shared memory when it exits.  To avoid memory
+ * leakage due to kill -9, crashes or debugger-driven exits, this
+ * cleanup is also done when a new instance of that server starts.
+ */
+
+/* per-process global data for the SHM interfaces */
+static jack_shm_id_t   registry_id;	/* SHM id for the registry */
+
+#ifdef WIN32
+static jack_shm_info_t registry_info = {/* SHM info for the registry */
+	JACK_SHM_NULL_INDEX,
+	NULL
+};
+#else
+static jack_shm_info_t registry_info = { /* SHM info for the registry */
+	.index = JACK_SHM_NULL_INDEX,
+	.ptr.attached_at = MAP_FAILED
+};
+#endif
+
+/* pointers to registry header and array */
+static jack_shm_header_t   *jack_shm_header = NULL;
+static jack_shm_registry_t *jack_shm_registry = NULL;
+static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE] = "";
+
+/* jack_shm_lock_registry() serializes updates to the shared memory
+ * segment JACK uses to keep track of the SHM segments allocated to
+ * all its processes, including multiple servers.
+ *
+ * This is not a high-contention lock, but it does need to work across
+ * multiple processes. High transaction rates and realtime safety are
+ * not required. Any solution needs to at least be portable to POSIX
+ * and POSIX-like systems.
+ *
+ * We must be particularly careful to ensure that the lock be released
+ * if the owning process terminates abnormally. Otherwise, a segfault
+ * or kill -9 at the wrong moment could prevent JACK from ever running
+ * again on that machine until after a reboot.
+ */
+
+#define JACK_SEMAPHORE_KEY 0x282929
+#ifndef USE_POSIX_SHM
+#define JACK_SHM_REGISTRY_KEY JACK_SEMAPHORE_KEY
+#endif
+
+static int semid = -1;
+
+#ifdef WIN32
+
+static int
+semaphore_init () {return 0;}
+
+static  int
+semaphore_add (int value) {return 0;}
+
+#else
+/* all semaphore errors are fatal -- issue message, but do not return */
+static void
+semaphore_error (char *msg)
+{
+	jack_error ("JACK semaphore error: %s (%s)",
+		    msg, strerror (errno));
+}
+
+static int
+semaphore_init ()
+{
+	key_t semkey = JACK_SEMAPHORE_KEY;
+	struct sembuf sbuf;
+	int create_flags = IPC_CREAT | IPC_EXCL
+		| S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+
+	/* Get semaphore ID associated with this key. */
+	if ((semid = semget(semkey, 0, 0)) == -1) {
+
+		/* Semaphore does not exist - Create. */
+		if ((semid = semget(semkey, 1, create_flags)) != -1) {
+
+			/* Initialize the semaphore, allow one owner. */
+			sbuf.sem_num = 0;
+			sbuf.sem_op = 1;
+			sbuf.sem_flg = 0;
+			if (semop(semid, &sbuf, 1) == -1) {
+                semaphore_error ("semop");
+                return -1;
+			}
+
+		} else if (errno == EEXIST) {
+			if ((semid = semget(semkey, 0, 0)) == -1) {
+                semaphore_error ("semget");
+                return -1;
+			}
+
+		} else {
+            semaphore_error ("semget creation");
+            return -1;
+		}
+	}
+
+    return 0;
+}
+
+static inline int
+semaphore_add (int value)
+{
+	struct sembuf sbuf;
+
+	sbuf.sem_num = 0;
+	sbuf.sem_op = value;
+	sbuf.sem_flg = SEM_UNDO;
+
+	if (semop(semid, &sbuf, 1) == -1) {
+		semaphore_error ("semop");
+        return -1;
+	}
+
+    return 0;
+}
+
+#endif
+
+static int
+jack_shm_lock_registry (void)
+{
+	if (semid == -1) {
+        if (semaphore_init () < 0)
+            return -1;
+    }
+
+	return semaphore_add (-1);
+}
+
+static void
+jack_shm_unlock_registry (void)
+{
+	semaphore_add (1);
+}
+
+static void
+jack_shm_init_registry ()
+{
+	/* registry must be locked */
+	int i;
+
+	memset (jack_shm_header, 0, JACK_SHM_REGISTRY_SIZE);
+
+	jack_shm_header->magic = JACK_SHM_MAGIC;
+	//jack_shm_header->protocol = JACK_PROTOCOL_VERSION;
+	jack_shm_header->type = jack_shmtype;
+	jack_shm_header->size = JACK_SHM_REGISTRY_SIZE;
+	jack_shm_header->hdr_len = sizeof (jack_shm_header_t);
+	jack_shm_header->entry_len = sizeof (jack_shm_registry_t);
+
+	for (i = 0; i < MAX_SHM_ID; ++i) {
+		jack_shm_registry[i].index = i;
+	}
+}
+
+static int
+jack_shm_validate_registry ()
+{
+	/* registry must be locked */
+
+	if ((jack_shm_header->magic == JACK_SHM_MAGIC)
+	    //&& (jack_shm_header->protocol == JACK_PROTOCOL_VERSION)
+	    && (jack_shm_header->type == jack_shmtype)
+	    && (jack_shm_header->size == JACK_SHM_REGISTRY_SIZE)
+	    && (jack_shm_header->hdr_len == sizeof (jack_shm_header_t))
+	    && (jack_shm_header->entry_len == sizeof (jack_shm_registry_t))) {
+
+		return 0;		/* registry OK */
+	}
+
+	return -1;
+}
+
+/* set a unique per-user, per-server shm prefix string
+ *
+ * According to the POSIX standard:
+ *
+ *   "The name argument conforms to the construction rules for a
+ *   pathname. If name begins with the slash character, then processes
+ *   calling shm_open() with the same value of name refer to the same
+ *   shared memory object, as long as that name has not been
+ *   removed. If name does not begin with the slash character, the
+ *   effect is implementation-defined. The interpretation of slash
+ *   characters other than the leading slash character in name is
+ *   implementation-defined."
+ *
+ * Since the Linux implementation does not allow slashes *within* the
+ * name, in the interest of portability we use colons instead.
+ */
+static void
+jack_set_server_prefix (const char *server_name)
+{
+	snprintf (jack_shm_server_prefix, sizeof (jack_shm_server_prefix),
+		  "jack-%d:%s:", GetUID(), server_name);
+}
+
+/* gain server addressability to shared memory registration segment
+ *
+ * returns: 0 if successful
+ */
+static int
+jack_server_initialize_shm (int new_registry)
+{
+	int rc;
+
+	if (jack_shm_header)
+		return 0;		/* already initialized */
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	rc = jack_access_registry (&registry_info);
+
+	if (new_registry) {
+		jack_remove_shm (&registry_id);
+		rc = ENOENT;
+	}
+
+	switch (rc) {
+	case ENOENT:		/* registry does not exist */
+		rc = jack_create_registry (&registry_info);
+		break;
+	case 0:				/* existing registry */
+		if (jack_shm_validate_registry () == 0)
+			break;
+		/* else it was invalid, so fall through */
+	case EINVAL:			/* bad registry */
+		/* Apparently, this registry was created by an older
+		 * JACK version.  Delete it so we can try again. */
+		jack_release_shm (&registry_info);
+		jack_remove_shm (&registry_id);
+		if ((rc = jack_create_registry (&registry_info)) != 0) {
+			jack_error ("incompatible shm registry (%s)",
+				    strerror (errno));
+#ifndef USE_POSIX_SHM
+			jack_error ("to delete, use `ipcrm -M 0x%0.8x'",
+				    JACK_SHM_REGISTRY_KEY);
+#endif
+		}
+		break;
+	default:			/* failure return code */
+		break;
+	}
+
+	jack_shm_unlock_registry ();
+	return rc;
+}
+
+/* gain client addressability to shared memory registration segment
+ *
+ * NOTE: this function is no longer used for server initialization,
+ * instead it calls jack_register_server().
+ *
+ * returns: 0 if successful
+ */
+int
+jack_initialize_shm (const char *server_name)
+{
+	int rc;
+
+	if (jack_shm_header)
+		return 0;		/* already initialized */
+
+	jack_set_server_prefix (server_name);
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	if ((rc = jack_access_registry (&registry_info)) == 0) {
+		if ((rc = jack_shm_validate_registry ()) != 0) {
+			jack_error ("Incompatible shm registry, "
+				    "are jackd and libjack in sync?");
+		}
+	}
+	jack_shm_unlock_registry ();
+
+	return rc;
+}
+
+
+char* jack_shm_addr (jack_shm_info_t* si)
+{
+	return (char*)si->ptr.attached_at;
+}
+
+void
+jack_destroy_shm (jack_shm_info_t* si)
+{
+	/* must NOT have the registry locked */
+	if (si->index == JACK_SHM_NULL_INDEX)
+		return;			/* segment not allocated */
+
+	jack_remove_shm (&jack_shm_registry[si->index].id);
+	jack_release_shm_info (si->index);
+}
+
+jack_shm_registry_t *
+jack_get_free_shm_info ()
+{
+	/* registry must be locked */
+	jack_shm_registry_t* si = NULL;
+	int i;
+
+	for (i = 0; i < MAX_SHM_ID; ++i) {
+		if (jack_shm_registry[i].size == 0) {
+			break;
+		}
+	}
+
+	if (i < MAX_SHM_ID) {
+		si = &jack_shm_registry[i];
+	}
+
+	return si;
+}
+
+static void
+jack_release_shm_entry (jack_shm_registry_index_t index)
+{
+	/* the registry must be locked */
+	jack_shm_registry[index].size = 0;
+	jack_shm_registry[index].allocator = 0;
+	memset (&jack_shm_registry[index].id, 0,
+		sizeof (jack_shm_registry[index].id));
+}
+
+int
+jack_release_shm_info (jack_shm_registry_index_t index)
+{
+	/* must NOT have the registry locked */
+	if (jack_shm_registry[index].allocator == GetPID()) {
+		if (jack_shm_lock_registry () < 0) {
+            jack_error ("jack_shm_lock_registry fails...");
+            return -1;
+        }
+		jack_release_shm_entry (index);
+		jack_shm_unlock_registry ();
+	}
+
+    return 0;
+}
+
+/* Claim server_name for this process.
+ *
+ * returns 0 if successful
+ *	   EEXIST if server_name was already active for this user
+ *	   ENOSPC if server registration limit reached
+ *	   ENOMEM if unable to access shared memory registry
+ */
+int
+jack_register_server (const char *server_name, int new_registry)
+{
+	int i, res = 0;
+
+	jack_set_server_prefix (server_name);
+
+	if (jack_server_initialize_shm (new_registry))
+		return ENOMEM;
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	/* See if server_name already registered.  Since server names
+	 * are per-user, we register the unique server prefix string.
+	 */
+	for (i = 0; i < MAX_SERVERS; i++) {
+
+		if (strncmp (jack_shm_header->server[i].name,
+			     jack_shm_server_prefix,
+			     JACK_SERVER_NAME_SIZE) != 0)
+			continue;	/* no match */
+
+		if (jack_shm_header->server[i].pid == GetPID()){
+			res = 0; /* it's me */
+			goto unlock;
+		}
+
+		/* see if server still exists */
+	#ifndef WIN32 // steph TO CHECK
+		if (kill (jack_shm_header->server[i].pid, 0) == 0)  {
+			res = EEXIST;	/* other server running */
+			goto unlock;
+		}
+	#endif
+
+		/* it's gone, reclaim this entry */
+		memset (&jack_shm_header->server[i], 0,
+			sizeof (jack_shm_server_t));
+	}
+
+	/* find a free entry */
+	for (i = 0; i < MAX_SERVERS; i++) {
+		if (jack_shm_header->server[i].pid == 0)
+			break;
+	}
+
+	if (i >= MAX_SERVERS){
+		res = ENOSPC;		/* out of space */
+		goto unlock;
+	}
+
+	/* claim it */
+	jack_shm_header->server[i].pid = GetPID();
+	strncpy (jack_shm_header->server[i].name,
+		 jack_shm_server_prefix,
+		 JACK_SERVER_NAME_SIZE);
+
+ unlock:
+	jack_shm_unlock_registry ();
+	return 0;
+}
+
+/* release server_name registration */
+int
+jack_unregister_server (const char *server_name /* unused */)
+{
+	int i;
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	for (i = 0; i < MAX_SERVERS; i++) {
+		if (jack_shm_header->server[i].pid == GetPID()) {
+			memset (&jack_shm_header->server[i], 0,
+				sizeof (jack_shm_server_t));
+		}
+	}
+
+	jack_shm_unlock_registry ();
+	return 0;
+}
+
+/* called for server startup and termination */
+int
+jack_cleanup_shm ()
+{
+	int i;
+	int destroy;
+	jack_shm_info_t copy;
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	for (i = 0; i < MAX_SHM_ID; i++) {
+		jack_shm_registry_t* r;
+
+		r = &jack_shm_registry[i];
+		memcpy (&copy, r, sizeof (jack_shm_info_t));
+		destroy = FALSE;
+
+		/* ignore unused entries */
+		if (r->allocator == 0)
+			continue;
+
+		/* is this my shm segment? */
+		if (r->allocator == GetPID()) {
+
+			/* allocated by this process, so unattach
+			   and destroy. */
+			jack_release_shm (&copy);
+			destroy = TRUE;
+
+		} else {
+
+			/* see if allocator still exists */
+		#ifdef WIN32 // steph
+			jack_info("TODO: kill API not available !!");
+		#else
+			if (kill (r->allocator, 0)) {
+				if (errno == ESRCH) {
+					/* allocator no longer exists,
+					 * so destroy */
+					destroy = TRUE;
+				}
+			}
+		#endif
+		}
+
+		if (destroy) {
+
+			int index = copy.index;
+
+			if ((index >= 0)  && (index < MAX_SHM_ID)) {
+				jack_remove_shm (&jack_shm_registry[index].id);
+				jack_release_shm_entry (index);
+			}
+			r->size = 0;
+			r->allocator = 0;
+		}
+	}
+
+	jack_shm_unlock_registry ();
+	return TRUE;
+}
+
+/* resize a shared memory segment
+ *
+ * There is no way to resize a System V shm segment.  Resizing is
+ * possible with POSIX shm, but not with the non-conformant Mac OS X
+ * implementation.  Since POSIX shm is mainly used on that platform,
+ * it's simpler to treat them both the same.
+ *
+ * So, we always resize by deleting and reallocating.  This is
+ * tricky, because the old segment will not disappear until
+ * all the clients have released it.  We only do what we can
+ * from here.
+ *
+ * This is not done under a single lock.  I don't even want to think
+ * about all the things that could possibly go wrong if multple
+ * processes tried to resize the same segment concurrently.  That
+ * probably doesn't happen.
+ */
+int
+jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size)
+{
+	jack_shm_id_t id;
+
+	/* The underlying type of `id' differs for SYSV and POSIX */
+	memcpy (&id, &jack_shm_registry[si->index].id, sizeof (id));
+
+	jack_release_shm (si);
+	jack_destroy_shm (si);
+
+	if (jack_shmalloc ((char *) id, size, si)) {
+		return -1;
+	}
+
+	return jack_attach_shm (si);
+}
+
+#ifdef USE_POSIX_SHM
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * POSIX interface-dependent functions
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* gain addressability to existing SHM registry segment
+ *
+ * sets up global registry pointers, if successful
+ *
+ * returns: 0 if existing registry accessed successfully
+ *          ENOENT if registry does not exist
+ *          EINVAL if registry exists, but has the wrong size
+ */
+static int
+jack_access_registry (jack_shm_info_t *ri)
+{
+	/* registry must be locked */
+	int shm_fd;
+
+	strncpy (registry_id, "/jack-shm-registry", sizeof (registry_id));
+
+	/* try to open an existing segment */
+	if ((shm_fd = shm_open (registry_id, O_RDWR, 0666)) < 0) {
+		int rc = errno;
+		if (errno != ENOENT) {
+			jack_error ("Cannot open existing shm registry segment"
+				    " (%s)", strerror (errno));
+		}
+		close (shm_fd);
+		return rc;
+	}
+
+	if ((ri->ptr.attached_at = mmap (0, JACK_SHM_REGISTRY_SIZE,
+				     PROT_READ|PROT_WRITE,
+				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
+		jack_error ("Cannot mmap shm registry segment (%s)",
+			    strerror (errno));
+		close (shm_fd);
+		return EINVAL;
+	}
+
+	/* set up global pointers */
+	ri->index = JACK_SHM_REGISTRY_INDEX;
+	jack_shm_header = ri->ptr.attached_at;
+	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
+
+	close (shm_fd); // steph
+	return 0;
+}
+
+/* create a new SHM registry segment
+ *
+ * sets up global registry pointers, if successful
+ *
+ * returns: 0 if registry created successfully
+ *          nonzero error code if unable to allocate a new registry
+ */
+static int
+jack_create_registry (jack_shm_info_t *ri)
+{
+	/* registry must be locked */
+	int shm_fd;
+
+	strncpy (registry_id, "/jack-shm-registry", sizeof (registry_id));
+
+	if ((shm_fd = shm_open (registry_id, O_RDWR|O_CREAT, 0666)) < 0) {
+		int rc = errno;
+		jack_error ("Cannot create shm registry segment (%s)",
+			    strerror (errno));
+		return rc;
+	}
+
+    /* Previous shm_open result depends of the actual value of umask, force correct file permisssion here */
+    if (fchmod(shm_fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) < 0) {
+	    jack_log("Cannot chmod jack-shm-registry (%s) %d %d", strerror (errno));
+    }
+
+	/* Set the desired segment size.  NOTE: the non-conformant Mac
+	 * OS X POSIX shm only allows ftruncate() on segment creation.
+	 */
+	if (ftruncate (shm_fd, JACK_SHM_REGISTRY_SIZE) < 0) {
+		int rc = errno;
+		jack_error ("Cannot set registry size (%s)", strerror (errno));
+		jack_remove_shm (&registry_id);
+		close (shm_fd);
+		return rc;
+	}
+
+	if ((ri->ptr.attached_at = mmap (0, JACK_SHM_REGISTRY_SIZE,
+				     PROT_READ|PROT_WRITE,
+				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
+		jack_error ("Cannot mmap shm registry segment (%s)",
+			    strerror (errno));
+		jack_remove_shm (&registry_id);
+		close (shm_fd);
+		return EINVAL;
+	}
+
+	/* set up global pointers */
+	ri->index = JACK_SHM_REGISTRY_INDEX;
+	jack_shm_header = ri->ptr.attached_at;
+	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
+
+	/* initialize registry contents */
+	jack_shm_init_registry ();
+	close (shm_fd); // steph
+	return 0;
+}
+
+static void
+jack_remove_shm (jack_shm_id_t *id)
+{
+	/* registry may or may not be locked */
+	shm_unlink ((char *) id);
+}
+
+void
+jack_release_shm (jack_shm_info_t* si)
+{
+	/* registry may or may not be locked */
+	if (si->ptr.attached_at != MAP_FAILED) {
+		munmap (si->ptr.attached_at, jack_shm_registry[si->index].size);
+	}
+}
+
+/* allocate a POSIX shared memory segment */
+int
+jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
+{
+	jack_shm_registry_t* registry;
+	int shm_fd;
+	int rc = -1;
+	char name[SHM_NAME_MAX+1];
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	if ((registry = jack_get_free_shm_info ()) == NULL) {
+		jack_error ("shm registry full");
+		goto unlock;
+	}
+
+	/* On Mac OS X, the maximum length of a shared memory segment
+	 * name is SHM_NAME_MAX (instead of NAME_MAX or PATH_MAX as
+	 * defined by the standard).  Unfortunately, Apple sets this
+	 * value so small (about 31 bytes) that it is useless for
+	 * actual names.  So, we construct a short name from the
+	 * registry index for uniqueness and ignore the shm_name
+	 * parameter.  Bah!
+	 */
+	snprintf (name, sizeof (name), "/jack-%d-%d", GetUID(), registry->index);
+
+	if (strlen (name) >= sizeof (registry->id)) {
+		jack_error ("shm segment name too long %s", name);
+		goto unlock;
+	}
+
+	if ((shm_fd = shm_open (name, O_RDWR|O_CREAT, 0666)) < 0) {
+		jack_error ("Cannot create shm segment %s (%s)",
+			    name, strerror (errno));
+		goto unlock;
+	}
+
+	if (ftruncate (shm_fd, size) < 0) {
+		jack_error ("Cannot set size of engine shm "
+			    "registry 0 (%s)",
+			    strerror (errno));
+		close (shm_fd);
+		goto unlock;
+	}
+
+	close (shm_fd);
+	registry->size = size;
+	strncpy (registry->id, name, sizeof (registry->id));
+	registry->allocator = GetPID();
+	si->index = registry->index;
+	si->ptr.attached_at = MAP_FAILED;	/* not attached */
+	rc = 0;				/* success */
+
+ unlock:
+	jack_shm_unlock_registry ();
+	return rc;
+}
+
+int
+jack_attach_shm (jack_shm_info_t* si)
+{
+	int shm_fd;
+	jack_shm_registry_t *registry = &jack_shm_registry[si->index];
+
+	if ((shm_fd = shm_open (registry->id,
+				O_RDWR, 0666)) < 0) {
+		jack_error ("Cannot open shm segment %s (%s)", registry->id,
+			    strerror (errno));
+		return -1;
+	}
+
+	if ((si->ptr.attached_at = mmap (0, registry->size, PROT_READ|PROT_WRITE,
+				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
+		jack_error ("Cannot mmap shm segment %s (%s)",
+			    registry->id,
+			    strerror (errno));
+		close (shm_fd);
+		return -1;
+	}
+
+	close (shm_fd);
+	return 0;
+}
+
+int
+jack_attach_shm_read (jack_shm_info_t* si)
+{
+	int shm_fd;
+	jack_shm_registry_t *registry = &jack_shm_registry[si->index];
+
+	if ((shm_fd = shm_open (registry->id,
+				O_RDONLY, 0666)) < 0) {
+		jack_error ("Cannot open shm segment %s (%s)", registry->id,
+			    strerror (errno));
+		return -1;
+	}
+
+	if ((si->ptr.attached_at = mmap (0, registry->size, PROT_READ,
+				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
+		jack_error ("Cannot mmap shm segment %s (%s)",
+			    registry->id,
+			    strerror (errno));
+		close (shm_fd);
+		return -1;
+	}
+
+	close (shm_fd);
+	return 0;
+}
+
+#elif WIN32
+
+static int
+jack_access_registry (jack_shm_info_t *ri)
+{
+	/* registry must be locked */
+	HANDLE shm_fd;
+	strncpy (registry_id, "jack-shm-registry", sizeof (registry_id));
+
+	/* try to open an existing segment */
+
+	if ((shm_fd = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, registry_id)) == NULL) {
+		int rc = GetLastError();
+		if (rc != ERROR_FILE_NOT_FOUND) {
+			jack_error ("Cannot open existing shm registry segment (%ld)", rc);
+		}
+		return rc;
+	}
+
+	if ((ri->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, JACK_SHM_REGISTRY_SIZE)) == NULL) {
+		jack_error ("Cannot mmap shm registry segment (%ld)", GetLastError());
+		jack_remove_shm (&registry_id);
+		CloseHandle (shm_fd);
+		return EINVAL;
+	}
+
+	/* set up global pointers */
+	ri->index = JACK_SHM_REGISTRY_INDEX;
+	jack_shm_header = ri->ptr.attached_at;
+	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
+
+	//CloseHandle(shm_fd);  // TO CHECK
+	return 0;
+}
+
+static int
+jack_create_registry (jack_shm_info_t *ri)
+{
+	/* registry must be locked */
+	HANDLE shm_fd;
+
+	strncpy (registry_id, "jack-shm-registry", sizeof (registry_id));
+
+	if ((shm_fd = CreateFileMapping(INVALID_HANDLE_VALUE,
+									0, PAGE_READWRITE,
+									0, JACK_SHM_REGISTRY_SIZE,
+									registry_id)) == NULL || (shm_fd == INVALID_HANDLE_VALUE)) {
+		int rc = GetLastError();
+		jack_error ("Cannot create shm registry segment (%ld)", rc);
+		return rc;
+	}
+
+	if ((ri->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, JACK_SHM_REGISTRY_SIZE)) == NULL) {
+		jack_error ("Cannot mmap shm registry segment (%ld)", GetLastError());
+		jack_remove_shm (&registry_id);
+		CloseHandle (shm_fd);
+		return EINVAL;
+	}
+
+	/* set up global pointers */
+	ri->index = JACK_SHM_REGISTRY_INDEX;
+	jack_shm_header = ri->ptr.attached_at;
+	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
+
+	/* initialize registry contents */
+	jack_shm_init_registry ();
+
+	//CloseHandle(shm_fd); // TO CHECK
+	return 0;
+}
+
+static void
+jack_remove_shm (jack_shm_id_t *id)
+{
+	/* nothing to do */
+}
+
+void
+jack_release_shm (jack_shm_info_t* si)
+{
+	/* registry may or may not be locked */
+	if (si->ptr.attached_at != NULL) {
+		UnmapViewOfFile (si->ptr.attached_at);
+	}
+}
+
+int
+jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
+{
+	jack_shm_registry_t* registry;
+	HANDLE shm_fd;
+	int rc = -1;
+	char name[SHM_NAME_MAX+1];
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	if ((registry = jack_get_free_shm_info ()) == NULL) {
+		jack_error ("shm registry full");
+		goto unlock;
+	}
+
+	snprintf (name, sizeof (name), "jack-%d-%d", GetUID(), registry->index);
+
+	if (strlen (name) >= sizeof (registry->id)) {
+		jack_error ("shm segment name too long %s", name);
+		goto unlock;
+	}
+
+	if ((shm_fd = CreateFileMapping(INVALID_HANDLE_VALUE,
+									0, PAGE_READWRITE,
+									0, size,
+									name)) == NULL || (shm_fd == INVALID_HANDLE_VALUE)) {
+		int rc = GetLastError();
+		jack_error ("Cannot create shm segment (%ld)",rc);
+		goto unlock;
+	}
+
+	//CloseHandle (shm_fd); // TO CHECK
+
+	registry->size = size;
+	strncpy (registry->id, name, sizeof (registry->id));
+	registry->allocator = _getpid();
+	si->index = registry->index;
+	si->ptr.attached_at = NULL;	/* not attached */
+	rc = 0;				/* success */
+
+ unlock:
+	jack_shm_unlock_registry ();
+	return rc;
+}
+
+int
+jack_attach_shm (jack_shm_info_t* si)
+{
+	HANDLE shm_fd;
+	jack_shm_registry_t *registry = &jack_shm_registry[si->index];
+
+	if ((shm_fd = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, registry->id)) == NULL) {
+		int rc = GetLastError();
+		jack_error ("Cannot open shm segment (%ld)",rc);
+		return -1;
+	}
+
+	if ((si->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, registry->size)) == NULL) {
+		jack_error ("Cannot mmap shm segment (%ld)", GetLastError());
+		jack_remove_shm (&registry_id);
+		CloseHandle (shm_fd);
+		return -1;
+	}
+
+	//CloseHandle (shm_fd);  // TO CHECK
+	return 0;
+}
+
+int
+jack_attach_shm_read (jack_shm_info_t* si)
+{
+	HANDLE shm_fd;
+	jack_shm_registry_t *registry = &jack_shm_registry[si->index];
+
+	if ((shm_fd = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, registry->id)) == NULL) {
+		int rc = GetLastError();
+		jack_error ("Cannot open shm segment (%ld)",rc);
+		return -1;
+	}
+
+	if ((si->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_READ, 0, 0, registry->size)) == NULL) {
+		jack_error("Cannot mmap shm segment (%ld)", GetLastError());
+		jack_remove_shm(&registry_id);
+		CloseHandle(shm_fd);
+		return -1;
+	}
+
+	//CloseHandle (shm_fd); // TO CHECK
+	return 0;
+}
+
+#else
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * System V interface-dependent functions
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* gain addressability to existing SHM registry segment
+ *
+ * sets up global registry pointers, if successful
+ *
+ * returns: 0 if existing registry accessed successfully
+ *          ENOENT if registry does not exist
+ *          EINVAL if registry exists, but has the wrong size
+ *          other nonzero error code if unable to access registry
+ */
+static int
+jack_access_registry (jack_shm_info_t *ri)
+{
+	/* registry must be locked */
+
+	/* try without IPC_CREAT to get existing segment */
+	if ((registry_id = shmget (JACK_SHM_REGISTRY_KEY,
+				   JACK_SHM_REGISTRY_SIZE, 0666)) < 0) {
+
+		switch (errno) {
+
+		case ENOENT:		/* segment does not exist */
+			return ENOENT;
+
+		case EINVAL:		/* segment exists, but too small */
+			/* attempt minimum size access */
+			registry_id = shmget (JACK_SHM_REGISTRY_KEY, 1, 0666);
+			return EINVAL;
+
+		default:		/* or other error */
+			jack_error ("unable to access shm registry (%s)",
+				    strerror (errno));
+			return errno;
+		}
+	}
+
+	if ((ri->attached_at = shmat (registry_id, 0, 0)) < 0) {
+		jack_error ("Cannot attach shm registry segment (%s)",
+			    strerror (errno));
+		return EINVAL;
+	}
+
+	/* set up global pointers */
+	ri->index = JACK_SHM_REGISTRY_INDEX;
+	jack_shm_header = ri->attached_at;
+	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
+	return 0;
+}
+
+/* create a new SHM registry segment
+ *
+ * sets up global registry pointers, if successful
+ *
+ * returns: 0 if registry created successfully
+ *          nonzero error code if unable to allocate a new registry
+ */
+static int
+jack_create_registry (jack_shm_info_t *ri)
+{
+	/* registry must be locked */
+	if ((registry_id = shmget (JACK_SHM_REGISTRY_KEY,
+				   JACK_SHM_REGISTRY_SIZE,
+				   0666|IPC_CREAT)) < 0) {
+		jack_error ("Cannot create shm registry segment (%s)",
+			    strerror (errno));
+		return errno;
+	}
+
+	if ((ri->attached_at = shmat (registry_id, 0, 0)) < 0) {
+		jack_error ("Cannot attach shm registry segment (%s)",
+			    strerror (errno));
+		return EINVAL;
+	}
+
+	/* set up global pointers */
+	ri->index = JACK_SHM_REGISTRY_INDEX;
+	jack_shm_header = ri->attached_at;
+	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
+
+	/* initialize registry contents */
+	jack_shm_init_registry ();
+	return 0;
+}
+
+static void
+jack_remove_shm (jack_shm_id_t *id)
+{
+	/* registry may or may not be locked */
+	shmctl (*id, IPC_RMID, NULL);
+}
+
+void
+jack_release_shm (jack_shm_info_t* si)
+{
+	/* registry may or may not be locked */
+	if (si->attached_at != MAP_FAILED) {
+		shmdt (si->attached_at);
+	}
+}
+
+int
+jack_shmalloc (const char* name_not_used, jack_shmsize_t size,
+	       jack_shm_info_t* si)
+{
+	int shmflags;
+	int shmid;
+	int rc = -1;
+	jack_shm_registry_t* registry;
+
+	if (jack_shm_lock_registry () < 0) {
+        jack_error ("jack_shm_lock_registry fails...");
+        return -1;
+    }
+
+	if ((registry = jack_get_free_shm_info ())) {
+
+		shmflags = 0666 | IPC_CREAT | IPC_EXCL;
+
+		if ((shmid = shmget (IPC_PRIVATE, size, shmflags)) >= 0) {
+
+			registry->size = size;
+			registry->id = shmid;
+			registry->allocator = getpid();
+			si->index = registry->index;
+			si->attached_at = MAP_FAILED; /* not attached */
+			rc = 0;
+
+		} else {
+			jack_error ("Cannot create shm segment %s (%s)",
+				    name_not_used, strerror (errno));
+		}
+	}
+
+	jack_shm_unlock_registry ();
+	return rc;
+}
+
+int
+jack_attach_shm (jack_shm_info_t* si)
+{
+	if ((si->attached_at = shmat (jack_shm_registry[si->index].id, 0, 0)) < 0) {
+		jack_error ("Cannot attach shm segment (%s)",
+			    strerror (errno));
+		jack_release_shm_info (si->index);
+		return -1;
+	}
+	return 0;
+}
+
+#endif /* !USE_POSIX_SHM */
diff --git a/common/shm.h b/common/shm.h
new file mode 100644
index 0000000..ed5a953
--- /dev/null
+++ b/common/shm.h
@@ -0,0 +1,159 @@
+#ifndef __jack_shm_h__
+#define __jack_shm_h__
+
+#include <limits.h>
+#include <sys/types.h>
+#include "types.h"
+#include "JackCompilerDeps.h"
+
+#define TRUE 1
+#define FALSE 0
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define MAX_SERVERS 8			/* maximum concurrent servers */
+#define MAX_SHM_ID 256			/* generally about 16 per server */
+#define JACK_SERVER_NAME_SIZE 256	/* maximum length of server name */
+#define JACK_SHM_MAGIC 0x4a41434b	/* shm magic number: "JACK" */
+#define JACK_SHM_NULL_INDEX -1		/* NULL SHM index */
+#define JACK_SHM_REGISTRY_INDEX -2	/* pseudo SHM index for registry */
+
+
+    /* On Mac OS X, SHM_NAME_MAX is the maximum length of a shared memory
+     * segment name (instead of NAME_MAX or PATH_MAX as defined by the
+     * standard).
+     */
+#ifdef USE_POSIX_SHM
+
+#ifndef NAME_MAX
+#define NAME_MAX            255
+#endif
+
+#ifndef SHM_NAME_MAX
+#define SHM_NAME_MAX NAME_MAX
+#endif
+    typedef char shm_name_t[SHM_NAME_MAX];
+    typedef shm_name_t jack_shm_id_t;
+
+#elif WIN32   // TO CHECK
+#define NAME_MAX            255
+#ifndef SHM_NAME_MAX
+#define SHM_NAME_MAX NAME_MAX
+#endif
+    typedef char shm_name_t[SHM_NAME_MAX];
+    typedef shm_name_t jack_shm_id_t;
+
+#else
+    /* System V SHM */
+    typedef int	jack_shm_id_t;
+#endif /* SHM type */
+
+    /* shared memory type */
+    typedef enum {
+        shm_POSIX = 1, 			/* POSIX shared memory */
+        shm_SYSV = 2, 			/* System V shared memory */
+        shm_WIN32 = 3			/* Windows 32 shared memory */
+    } jack_shmtype_t;
+
+    typedef int16_t jack_shm_registry_index_t;
+
+    /**
+     * A structure holding information about shared memory allocated by
+     * JACK. this persists across invocations of JACK, and can be used by
+     * multiple JACK servers.  It contains no pointers and is valid across
+     * address spaces.
+     *
+     * The registry consists of two parts: a header including an array of
+     * server names, followed by an array of segment registry entries.
+     */
+    typedef struct _jack_shm_server {
+#ifdef WIN32
+        int	pid;	/* process ID */
+#else
+        pid_t pid;	/* process ID */
+#endif
+
+        char	name[JACK_SERVER_NAME_SIZE];
+    }
+    jack_shm_server_t;
+
+    typedef struct _jack_shm_header {
+        uint32_t	magic;	/* magic number */
+        uint16_t	protocol;	/* JACK protocol version */
+        jack_shmtype_t	type;	/* shm type */
+        jack_shmsize_t	size;	/* total registry segment size */
+        jack_shmsize_t	hdr_len;	/* size of header */
+        jack_shmsize_t	entry_len; /* size of registry entry */
+        jack_shm_server_t server[MAX_SERVERS]; /* current server array */
+    }
+    jack_shm_header_t;
+
+    typedef struct _jack_shm_registry {
+        jack_shm_registry_index_t index;     /* offset into the registry */
+
+#ifdef WIN32
+        int	allocator; /* PID that created shm segment */
+#else
+        pid_t allocator; /* PID that created shm segment */
+#endif
+
+        jack_shmsize_t size;      /* for POSIX unattach */
+        jack_shm_id_t id;        /* API specific, see above */
+    }
+    jack_shm_registry_t;
+
+#define JACK_SHM_REGISTRY_SIZE (sizeof (jack_shm_header_t) \
+				+ sizeof (jack_shm_registry_t) * MAX_SHM_ID)
+
+    /**
+     * a structure holding information about shared memory
+     * allocated by JACK. this version is valid only
+     * for a given address space. It contains a pointer
+     * indicating where the shared memory has been
+     * attached to the address space.
+     */
+
+    typedef struct _jack_shm_info {
+        jack_shm_registry_index_t index;       /* offset into the registry */
+        uint32_t size;
+        union {
+            void *attached_at;  /* address where attached */
+            char ptr_size[8];
+        } ptr;  /* a "pointer" that has the same 8 bytes size when compling in 32 or 64 bits */
+    }
+    POST_PACKED_STRUCTURE jack_shm_info_t;
+
+    /* utility functions used only within JACK */
+
+    void jack_shm_copy_from_registry (jack_shm_info_t*,
+                jack_shm_registry_index_t);
+    void jack_shm_copy_to_registry (jack_shm_info_t*,
+                                               jack_shm_registry_index_t*);
+    int jack_release_shm_info (jack_shm_registry_index_t);
+    char* jack_shm_addr (jack_shm_info_t* si);
+
+    // here begin the API
+    int jack_register_server (const char *server_name, int new_registry);
+    int jack_unregister_server (const char *server_name);
+
+    int jack_initialize_shm (const char *server_name);
+    int jack_initialize_shm_server (void);
+    int jack_initialize_shm_client (void);
+    int jack_cleanup_shm (void);
+
+    int jack_shmalloc (const char *shm_name, jack_shmsize_t size,
+                                  jack_shm_info_t* result);
+    void jack_release_shm (jack_shm_info_t*);
+    void jack_destroy_shm (jack_shm_info_t*);
+    int jack_attach_shm (jack_shm_info_t*);
+    int jack_attach_shm_read (jack_shm_info_t*);
+    int jack_resize_shm (jack_shm_info_t*, jack_shmsize_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_shm_h__ */
diff --git a/common/timestamps.c b/common/timestamps.c
new file mode 100644
index 0000000..7a48e8a
--- /dev/null
+++ b/common/timestamps.c
@@ -0,0 +1,79 @@
+/*
+    Copyright (C) 2002-2003 Paul Davis
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include "timestamps.h"
+#include "JackTime.h"
+
+typedef struct {
+    jack_time_t when;
+    const char *what;
+} jack_timestamp_t;
+
+static jack_timestamp_t *timestamps = 0;
+static unsigned long timestamp_cnt = 0;
+static unsigned long timestamp_index;
+
+void
+jack_init_timestamps (unsigned long howmany)
+{
+	if (timestamps) {
+		free (timestamps);
+	}
+	timestamps = (jack_timestamp_t *)
+		malloc (howmany * sizeof(jack_timestamp_t));
+	timestamp_cnt = howmany;
+	memset (timestamps, 0, sizeof(jack_timestamp_t) * howmany);
+	timestamp_index = 0;
+}
+
+void
+jack_timestamp (const char *what)
+{
+	if (timestamp_index < timestamp_cnt) {
+		timestamps[timestamp_index].when = GetMicroSeconds();
+		timestamps[timestamp_index].what = what;
+		++timestamp_index;
+	}
+}
+
+void
+jack_dump_timestamps (FILE *out)
+{
+	unsigned long i;
+
+	for (i = 0; i < timestamp_index; ++i) {
+		fprintf (out, "%-.32s %" PRIu64 " %" PRIu64, 
+			 timestamps[i].what, timestamps[i].when,
+			 timestamps[i].when - timestamps[0].when);
+		if (i > 0) {
+			fprintf (out, " %" PRIu64,
+				 timestamps[i].when - timestamps[i-1].when);
+		}
+		fputc ('\n', out);
+	}
+}
+
+void
+jack_reset_timestamps ()
+{
+	timestamp_index = 0;
+}
+
diff --git a/common/timestamps.h b/common/timestamps.h
new file mode 100644
index 0000000..984e14c
--- /dev/null
+++ b/common/timestamps.h
@@ -0,0 +1,41 @@
+/*
+    Copyright (C) 2002 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __jack_timestamps_h__
+#define __jack_timestamps_h__
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    void jack_init_timestamps (unsigned long howmany);
+    void jack_timestamp (const char *what);
+    void jack_dump_timestamps (FILE *out);
+    void jack_reset_timestamps ();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_timestamps_h__ */
+
+
diff --git a/common/varargs.h b/common/varargs.h
new file mode 100644
index 0000000..d1442fd
--- /dev/null
+++ b/common/varargs.h
@@ -0,0 +1,75 @@
+/*
+*  Copyright (C) 2004 Jack O'Quin
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU Lesser General Public License as published by
+*  the Free Software Foundation; either version 2.1 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU Lesser General Public License for more details.
+*
+*  You should have received a copy of the GNU Lesser General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#ifndef __jack_varargs_h__
+#define __jack_varargs_h__
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /* variable argument structure */
+    typedef struct {
+        char *server_name;		/* server name */
+        char *load_name;		/* load module name */
+        char *load_init;		/* initialization string */
+    }
+    jack_varargs_t;
+
+    static const char* jack_default_server_name (void) 
+	{
+        const char *server_name;
+        if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
+            server_name = "default";
+        return server_name;
+    }
+
+    static inline void jack_varargs_init (jack_varargs_t *va) 
+	{
+        memset (va, 0, sizeof(jack_varargs_t));
+        va->server_name = (char*)jack_default_server_name();
+    }
+
+    static inline void jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va) 
+	{
+        // initialize default settings
+        jack_varargs_init (va);
+
+        if ((options & JackServerName)) {
+            char *sn = va_arg(ap, char *);
+            if (sn)
+                va->server_name = sn;
+        }
+        if ((options & JackLoadName))
+            va->load_name = va_arg(ap, char *);
+        if ((options & JackLoadInit))
+            va->load_init = va_arg(ap, char *);
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_varargs_h__ */
diff --git a/common/wscript b/common/wscript
new file mode 100644
index 0000000..da3ab93
--- /dev/null
+++ b/common/wscript
@@ -0,0 +1,290 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import Build
+import re
+import os
+
+def configure(conf):
+    conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
+   
+    if conf.is_defined('HAVE_SAMPLERATE'):
+        conf.env['LIB_SAMPLERATE'] = ['samplerate']
+
+    conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')
+
+def create_jack_process_obj(bld, target, sources, uselib = None):
+    process = bld.new_task_gen('cxx', 'shlib')
+    process.env['shlib_PATTERN'] = '%s.so'
+    process.defines  = ['HAVE_CONFIG_H','SERVER_SIDE']
+    if bld.env['IS_MACOSX']:
+        env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
+    if bld.env['IS_LINUX']:
+	env_includes = ['../linux', '../posix', '../linux/alsa']
+    if bld.env['IS_SUN']:
+        env_includes = ['../solaris', '../posix', '../solaris/oss']
+    process.includes = ['.'] + env_includes + ['jack', '..']
+    process.name     = target
+    process.target   = target
+    process.source   = sources
+    if bld.env['IS_LINUX']:
+        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
+    if bld.env['IS_MACOSX']:
+        process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+        #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
+        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
+    process.install_path = '${ADDON_DIR}/'
+    process.uselib_local = uselib.name
+    return process
+
+def build(bld):
+    common_libsources = [
+        'JackActivationCount.cpp',
+        'JackAPI.cpp',
+        'JackClient.cpp',
+        'JackConnectionManager.cpp',
+        'ringbuffer.c',
+        'JackError.cpp',
+        'JackFrameTimer.cpp',
+        'JackGraphManager.cpp',
+        'JackPort.cpp',
+        'JackPortType.cpp',
+        'JackAudioPort.cpp',
+        'JackMidiPort.cpp',
+        'JackMidiAPI.cpp',
+        'JackEngineControl.cpp',
+        'JackShmMem.cpp',
+        'shm.c',
+        'JackGlobals.cpp',
+        'JackDebugClient.cpp',
+        'JackTransportEngine.cpp',
+        'timestamps.c',
+        'JackTools.cpp',
+        'JackMessageBuffer.cpp',
+        'JackEngineProfiling.cpp',
+        ]
+
+    includes = ['.', './jack', '..']
+    uselib = ["PTHREAD"]
+
+    if bld.env['IS_LINUX']:
+        common_libsources += [
+            '../posix/JackPosixThread.cpp',
+            '../posix/JackPosixSemaphore.cpp',
+            '../posix/JackFifo.cpp',
+            '../posix/JackProcessSync.cpp',
+            '../posix/JackSocket.cpp',
+            '../linux/JackLinuxTime.c',
+            ]
+        includes = ['../linux', '../posix'] + includes
+        uselib.append('RT')
+        uselib.append('DL')
+
+    if bld.env['IS_SUN']:
+        common_libsources += [
+           '../posix/JackPosixThread.cpp',
+           '../posix/JackFifo.cpp',
+           '../posix/JackProcessSync.cpp',
+           '../posix/JackSocket.cpp',
+           '../solaris/JackSolarisTime.c',
+           ]
+        includes = ['../solaris', '../posix'] + includes
+        uselib.append('RT')
+
+    if bld.env['IS_MACOSX']:
+        common_libsources += [
+            '../posix/JackProcessSync.cpp',
+            '../posix/JackPosixThread.cpp',
+            '../macosx/JackMachThread.cpp',
+            '../macosx/JackMachSemaphore.cpp',
+            '../macosx/JackMachPort.cpp',
+            '../macosx/JackMachTime.c',
+            ]
+        includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
+
+    serverlib = bld.new_task_gen('cxx', 'shlib')
+    serverlib.features.append('cc')
+    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
+    serverlib.includes = includes
+    serverlib.name         = 'serverlib'
+    serverlib.target       = 'jackserver'
+    serverlib.uselib = uselib
+    serverlib.install_path = '${LIBDIR}'
+    serverlib.source = [] + common_libsources
+    serverlib.source += [
+        'JackAudioDriver.cpp',
+        'JackMidiDriver.cpp',
+        'JackDriver.cpp',
+        'JackEngine.cpp',
+        'JackExternalClient.cpp',
+        'JackFreewheelDriver.cpp',
+        'JackInternalClient.cpp',
+        'JackServer.cpp',
+        'JackThreadedDriver.cpp',
+        'JackRestartThreadedDriver.cpp',
+        'JackWaitThreadedDriver.cpp',
+        'JackServerAPI.cpp',
+        'JackDriverLoader.cpp',
+        'JackServerGlobals.cpp',
+        'JackControlAPI.cpp',
+        'JackNetTool.cpp',
+        'JackNetInterface.cpp',
+        'JackArgParser.cpp',
+        'JackPhysicalMidiInput.cpp',
+        'JackPhysicalMidiOutput.cpp',
+        ]
+
+    if bld.env['IS_LINUX']:
+        serverlib.source += [
+            '../posix/JackSocketServerChannel.cpp',
+            '../posix/JackSocketNotifyChannel.cpp',
+            '../posix/JackSocketServerNotifyChannel.cpp',
+            '../posix/JackNetUnixSocket.cpp',
+            ]
+
+    if bld.env['IS_SUN']:
+        serverlib.source += [
+            '../posix/JackSocketServerChannel.cpp',
+            '../posix/JackSocketNotifyChannel.cpp',
+            '../posix/JackSocketServerNotifyChannel.cpp',
+            '../posix/JackNetUnixSocket.cpp',
+            ]
+
+    if bld.env['IS_MACOSX']:
+        serverlib.source += [
+            '../macosx/JackMachServerChannel.cpp',
+            '../macosx/JackMachNotifyChannel.cpp',
+            '../macosx/JackMachServerNotifyChannel.cpp',
+            '../macosx/JackMacEngineRPC.cpp',
+            '../macosx/RPC/JackRPCClientUser.c',
+            '../posix/JackNetUnixSocket.cpp',
+            ]
+
+    serverlib.vnum = bld.env['JACK_API_VERSION']
+
+    if bld.env['IS_LINUX']:
+        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
+
+    if bld.env['IS_MACOSX']:
+        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
+        serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+        #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc")
+        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
+        serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
+
+    if bld.env['IS_SUN']:
+        serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
+
+    clientlib = bld.new_task_gen('cxx', 'shlib')
+    clientlib.features.append('cc')
+    clientlib.defines = 'HAVE_CONFIG_H'
+    clientlib.uselib = uselib
+    clientlib.install_path = '${LIBDIR}'
+    if bld.env['BUILD_JACKDBUS'] == True and bld.env['BUILD_JACKD'] == False:
+        clientlib.uselib.append('DBUS-1')
+    clientlib.includes = includes
+    clientlib.name         = 'clientlib'
+    clientlib.target       = 'jack'
+    clientlib.source = [] + common_libsources
+    clientlib.source += [
+        'JackLibClient.cpp',
+        'JackLibAPI.cpp',
+        ]
+
+    if bld.env['IS_LINUX']:
+        clientlib.source += [
+            '../posix/JackSocketClientChannel.cpp',
+            '../posix/JackPosixServerLaunch.cpp',
+            ]
+
+    if bld.env['IS_SUN']:
+        clientlib.source += [
+            '../posix/JackSocketClientChannel.cpp',
+            '../posix/JackPosixServerLaunch.cpp',
+            ]
+
+    if bld.env['IS_MACOSX']:
+        clientlib.source += [
+            '../macosx/JackMachClientChannel.cpp',
+            '../macosx/RPC/JackRPCEngineUser.c',
+            '../macosx/JackMacLibClientRPC.cpp',
+            '../posix/JackPosixServerLaunch.cpp',
+            ]
+
+    clientlib.vnum = bld.env['JACK_API_VERSION']
+
+    if bld.env['IS_LINUX']:
+        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
+    
+    if bld.env['IS_MACOSX']:
+        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
+        clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+        #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc"
+        clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
+        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
+
+    if bld.env['IS_SUN']:
+        clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
+
+    if bld.env['BUILD_WITH_32_64']:
+        print "create 32bit lib..."
+        clientlib32bit = clientlib.clone('lib32')
+  
+    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)
+
+    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)
+
+    net_adapter_sources = [
+        'JackResampler.cpp',
+        'JackLibSampleRateResampler.cpp',
+        'JackAudioAdapter.cpp',
+        'JackAudioAdapterInterface.cpp',
+        'JackNetAdapter.cpp',
+        ]
+
+    if bld.env['BUILD_ADAPTER'] == True:
+        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
+        process.uselib = 'SAMPLERATE'
+
+    audio_adapter_sources = [
+        'JackResampler.cpp',
+        'JackLibSampleRateResampler.cpp',
+        'JackAudioAdapter.cpp',
+        'JackAudioAdapterInterface.cpp',
+        'JackAudioAdapterFactory.cpp',
+         ]
+
+    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
+         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
+         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
+         process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
+         process.uselib = 'SAMPLERATE'
+
+    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
+         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
+         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
+         process.uselib = ['ALSA', 'SAMPLERATE']
+
+    if bld.env['BUILD_ADAPTER'] and bld.env['IS_SUN']:
+         audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
+         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
+         process.uselib = 'SAMPLERATE'
+
+    #audio_adapter_sources += ['../windows/JackPortAudioAdapter.cpp']
+    #process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
+
+    bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
+
+    # process jack.pc.in -> jack.pc
+    import misc
+    obj = bld.new_task_gen('subst')
+    obj.source = '../jack.pc.in'
+    obj.target = 'jack.pc'
+    obj.dict = {'PREFIX': bld.env['PREFIX'],
+                'LIBDIR': bld.env['LIBDIR'],
+                'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
+                'SERVERLIB': serverlib.target,
+                'JACK_VERSION': bld.env['JACK_VERSION'],
+                }
+    obj.install_path = '${LIBDIR}/pkgconfig/'
+    obj.fun = misc.subst_func
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..e356790
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,17 @@
+/* config.h.in. */
+#ifndef CONFIG_H
+#define CONFIG_H
+
+/* Name of package */
+#define PACKAGE $PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "<jack-devel at jackaudio.org>"
+
+#define ADDON_DIR "$ADDON_DIR"
+
+#define JACK_LOCATION "$JACK_LOCATION"
+
+#define JACK_SVNREVISION "$JACK_SVNREVISION"
+
+#endif // CONFIG_H
diff --git a/config/.cvsignore b/config/.cvsignore
deleted file mode 100644
index c0b20bc..0000000
--- a/config/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-Makefile
-Makefile.in
-compile
-config.guess
-config.sub
-depcomp
-install-sh
-ltmain.sh
-missing
-mkinstalldirs
diff --git a/config/Makefile.am b/config/Makefile.am
deleted file mode 100644
index d608932..0000000
--- a/config/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-# We don't actually build anything in the `cpu' and `os'
-# subdirectories.
-
-DIST_SUBDIRS = cpu os sysdeps
-
-EXTRA_DIST = depcomp
-MAINTAINERCLEANFILES = Makefile.in config.guess config.sub \
-                       install-sh ltmain.sh missing mkinstalldirs 
diff --git a/config/cpu/Makefile.am b/config/cpu/Makefile.am
deleted file mode 100644
index d527e34..0000000
--- a/config/cpu/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-DIST_SUBDIRS = alpha cris generic i386 i486 ia64 m68k mips powerpc s390
diff --git a/config/cpu/alpha/Makefile.am b/config/cpu/alpha/Makefile.am
deleted file mode 100644
index 2f6ff81..0000000
--- a/config/cpu/alpha/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h cycles.h
-
diff --git a/config/cpu/alpha/atomicity.h b/config/cpu/alpha/atomicity.h
deleted file mode 100644
index cb071cd..0000000
--- a/config/cpu/alpha/atomicity.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Low-level functions for atomic operations: Alpha version  -*- C++ -*-
-
-// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H	1
-
-/* @@@ With gas we can play nice .subsection games to get the
-   non-predicted branch pointing forward.  But Digital assemblers
-   don't understand those directives.  This isn't a terribly
-   important issue, so just ignore it.  */
-
-typedef int _Atomic_word;
-
-static inline _Atomic_word
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  register int __result, __tmp;
-
-  __asm__ __volatile__ (
-      "\n$Lxadd_%=:\n\t"
-      "ldl_l  %0,%3\n\t"
-      "addl   %0,%4,%1\n\t"
-      "stl_c  %1,%2\n\t"
-      "beq    %1,$Lxadd_%=\n\t"
-      "mb"
-      : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
-      : "m" (*__mem), "r"(__val));
-
-  return __result;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  register _Atomic_word __result;
-
-  __asm__ __volatile__ (
-      "\n$Ladd_%=:\n\t"
-      "ldl_l  %0,%2\n\t"
-      "addl   %0,%3,%0\n\t"
-      "stl_c  %0,%1\n\t"
-      "beq    %0,$Ladd_%=\n\t"
-      "mb"
-      : "=&r"(__result), "=m"(*__mem)
-      : "m" (*__mem), "r"(__val));
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/alpha/cycles.h b/config/cpu/alpha/cycles.h
deleted file mode 100644
index dccbd04..0000000
--- a/config/cpu/alpha/cycles.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Code derived from various headers from the Linux kernel
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_cycles_h__
-#define __jack_cycles_h__
-
-/* alpha */
-
-typedef unsigned int cycles_t;
-static inline cycles_t get_cycles (void)
-{
-	cycles_t ret;
-	__asm__ __volatile__ ("rpcc %0" : "=r"(ret));
-	return ret;
-}
-
-#endif /* __jack_cycles_h__ */
diff --git a/config/cpu/cris/Makefile.am b/config/cpu/cris/Makefile.am
deleted file mode 100644
index 166d93d..0000000
--- a/config/cpu/cris/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h
-
diff --git a/config/cpu/cris/atomicity.h b/config/cpu/cris/atomicity.h
deleted file mode 100644
index fecb9dc..0000000
--- a/config/cpu/cris/atomicity.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Low-level functions for atomic operations: CRIS version  -*- C++ -*-
-
-// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H	1
-
-// This entity must not cross a page boundary.
-typedef int _Atomic_word __attribute__ ((__aligned__ (4)));
-
-static inline _Atomic_word
-__attribute__ ((__unused__))
-__exchange_and_add(_Atomic_word* __mem, int __val)
-{
-  int __tmp;
-  _Atomic_word __result;
-
-#if (__CRIS_arch_version >= 10)
-  __asm__ __volatile__ (" clearf		\n"
-			"0:			\n"
-			" move.d %4,%2		\n"
-			" move.d [%3],%0	\n"
-			" add.d %0,%2		\n"
-			" ax			\n"
-			" move.d %2,[%3]	\n"
-			" bwf 0b		\n"
-			" clearf		\n"
-			:  "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
-			: "r" (__mem), "g" (__val), "m" (*__mem));
-#else
-  __asm__ __volatile__ (" move $ccr,$r9		\n"
-			" di			\n"
-			" move.d %4,%2		\n"
-			" move.d [%3],%0	\n"
-			" add.d %0,%2		\n"
-			" move.d %2,[%3]	\n"
-			" move $r9,$ccr		\n"
-			:  "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
-			: "r" (__mem), "g" (__val), "m" (*__mem)
-			: "r9");
-#endif
-
-  return __result;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(_Atomic_word* __mem, int __val)
-{
-  __exchange_and_add(__mem, __val);
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/generic/Makefile.am b/config/cpu/generic/Makefile.am
deleted file mode 100644
index 2f6ff81..0000000
--- a/config/cpu/generic/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h cycles.h
-
diff --git a/config/cpu/generic/atomicity.h b/config/cpu/generic/atomicity.h
deleted file mode 100644
index 655cc14..0000000
--- a/config/cpu/generic/atomicity.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Low-level functions for atomic operations.  Stub version.
-   Copyright (C) 1997,2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H	1
-
-#warning "stub atomicity functions are not atomic on this platform"
-
-typedef int _Atomic_word;
-
-static inline _Atomic_word 
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* mem, int val)
-{
-  int result = *mem;
-  *mem += val;
-  return result;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* mem, int val)
-{
-  *mem += val;
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/generic/cycles.h b/config/cpu/generic/cycles.h
deleted file mode 100644
index 8213a05..0000000
--- a/config/cpu/generic/cycles.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_cycles_h__
-#define __jack_cycles_h__
-
-/* generic solution that is not really a solution at all */
-
-#warning You are compiling JACK on a platform for which jack/config/sysdep/cycles.h needs work
-#include <sys/time.h>
-
-typedef long cycles_t;
-
-static inline cycles_t get_cycles(void)
-{
-       struct timeval tv;
-       gettimeofday (&tv, NULL);
-
-       return ((cycles_t) tv.tv_sec * 1000000) + tv.tv_usec;
-}
-
-#endif /* __jack_cycles_h__ */
diff --git a/config/cpu/i386/Makefile.am b/config/cpu/i386/Makefile.am
deleted file mode 100644
index 2f6ff81..0000000
--- a/config/cpu/i386/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h cycles.h
-
diff --git a/config/cpu/i386/atomicity.h b/config/cpu/i386/atomicity.h
deleted file mode 100644
index 73be009..0000000
--- a/config/cpu/i386/atomicity.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H	1
-
-typedef int _Atomic_word;
-
-static inline _Atomic_word 
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  register _Atomic_word __result;
-  __asm__ __volatile__ ("lock; xaddl %0,%1"
-			: "=r" (__result), "=m" (*__mem) 
-			: "0" (__val), "m" (*__mem));
-  return __result;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  __asm__ __volatile__ ("lock; addl %1,%0"
-			: "=m" (*__mem) : "ir" (__val), "m" (*__mem));
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/i386/cycles.h b/config/cpu/i386/cycles.h
deleted file mode 100644
index f90c445..0000000
--- a/config/cpu/i386/cycles.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Code derived from various headers from the Linux kernel
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_cycles_h__
-#define __jack_cycles_h__
-
-typedef unsigned long long cycles_t;
-
-static inline cycles_t get_cycles (void)
-{
-	unsigned long long ret;
-	__asm__ __volatile__("rdtsc" : "=A" (ret));
-	return ret;
-}
-
-#endif /* __jack_cycles_h__ */
diff --git a/config/cpu/i486/Makefile.am b/config/cpu/i486/Makefile.am
deleted file mode 100644
index ba2deab..0000000
--- a/config/cpu/i486/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = cycles.h
-
diff --git a/config/cpu/i486/cycles.h b/config/cpu/i486/cycles.h
deleted file mode 100644
index 33579d7..0000000
--- a/config/cpu/i486/cycles.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* the i386 version of this header is compatible */
-
-#include <config/cpu/i386/cycles.h>
diff --git a/config/cpu/ia64/Makefile.am b/config/cpu/ia64/Makefile.am
deleted file mode 100644
index a5f23c7..0000000
--- a/config/cpu/ia64/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h cycles.h ia64intrin.h
-
diff --git a/config/cpu/ia64/atomicity.h b/config/cpu/ia64/atomicity.h
deleted file mode 100644
index d326a13..0000000
--- a/config/cpu/ia64/atomicity.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Low-level functions for atomic operations: IA64 version  -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H       1
-
-#include <sysdeps/ia64intrin.h>
-
-typedef int _Atomic_word;
-
-static inline _Atomic_word 
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  return __sync_fetch_and_add(__mem, __val);
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  __sync_fetch_and_add(__mem, __val);
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/ia64/cycles.h b/config/cpu/ia64/cycles.h
deleted file mode 100644
index d927cce..0000000
--- a/config/cpu/ia64/cycles.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Code derived from various headers from the Linux kernel
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_cycles_h__
-#define __jack_cycles_h__
-
-/* ia64 */
-
-typedef unsigned long cycles_t;
-static inline cycles_t
-get_cycles (void)
-{
-	cycles_t ret;
-	__asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret));
-	return ret;
-}
-
-#endif /* __jack_cycles_h__ */
diff --git a/config/cpu/ia64/ia64intrin.h b/config/cpu/ia64/ia64intrin.h
deleted file mode 100644
index 262dc20..0000000
--- a/config/cpu/ia64/ia64intrin.h
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef _IA64INTRIN_H_INCLUDED
-#define _IA64INTRIN_H_INCLUDED
-
-/* Actually, everything is a compiler builtin, but just so
-   there's no confusion...  */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void __sync_synchronize (void);
-
-extern int __sync_val_compare_and_swap_si (int *, int, int);
-extern long __sync_val_compare_and_swap_di (long *, long, long);
-#define __sync_val_compare_and_swap(PTR, OLD, NEW)			\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR)))						\
-    __sync_val_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW))	\
-  : (__typeof__(*(PTR)))						\
-    __sync_val_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW)))
-
-extern int __sync_bool_compare_and_swap_si (int *, int, int);
-extern int __sync_bool_compare_and_swap_di (long *, long, long);
-#define __sync_bool_compare_and_swap(PTR, OLD, NEW)			\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? __sync_bool_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW))	\
-  : __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW)))
-
-extern void __sync_lock_release_si (int *);
-extern void __sync_lock_release_di (long *);
-#define __sync_lock_release(PTR)		\
-  ((sizeof (*(PTR)) == sizeof(int))		\
-   ? __sync_lock_release_si((int *)(PTR))	\
-   : __sync_lock_release_di((long *)(PTR)))
-
-extern int __sync_lock_test_and_set_si (int *, int);
-extern long __sync_lock_test_and_set_di (long *, long);
-#define __sync_lock_test_and_set(PTR,VAL)				\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_lock_test_and_set_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_lock_test_and_set_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_fetch_and_add_si (int *, int);
-extern long __sync_fetch_and_add_di (long *, long);
-#define __sync_fetch_and_add(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_fetch_and_add_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_fetch_and_add_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_fetch_and_sub_si (int *, int);
-extern long __sync_fetch_and_sub_di (long *, long);
-#define __sync_fetch_and_sub(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_fetch_and_sub_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_fetch_and_sub_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_fetch_and_and_si (int *, int);
-extern long __sync_fetch_and_and_di (long *, long);
-#define __sync_fetch_and_and(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_fetch_and_and_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_fetch_and_and_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_fetch_and_or_si (int *, int);
-extern long __sync_fetch_and_or_di (long *, long);
-#define __sync_fetch_and_or(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_fetch_and_or_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_fetch_and_or_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_fetch_and_xor_si (int *, int);
-extern long __sync_fetch_and_xor_di (long *, long);
-#define __sync_fetch_and_xor(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_fetch_and_xor_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_fetch_and_xor_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_fetch_and_nand_si (int *, int);
-extern long __sync_fetch_and_nand_di (long *, long);
-#define __sync_fetch_and_nand(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_fetch_and_nand_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_fetch_and_nand_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_add_and_fetch_si (int *, int);
-extern long __sync_add_and_fetch_di (long *, long);
-#define __sync_add_and_fetch(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_add_and_fetch_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_add_and_fetch_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_sub_and_fetch_si (int *, int);
-extern long __sync_sub_and_fetch_di (long *, long);
-#define __sync_sub_and_fetch(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_sub_and_fetch_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_sub_and_fetch_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_and_and_fetch_si (int *, int);
-extern long __sync_and_and_fetch_di (long *, long);
-#define __sync_and_and_fetch(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_and_and_fetch_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_and_and_fetch_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_or_and_fetch_si (int *, int);
-extern long __sync_or_and_fetch_di (long *, long);
-#define __sync_or_and_fetch(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_or_and_fetch_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_or_and_fetch_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_xor_and_fetch_si (int *, int);
-extern long __sync_xor_and_fetch_di (long *, long);
-#define __sync_xor_and_fetch(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_xor_and_fetch_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_xor_and_fetch_di((long *)(PTR),(long)(VAL)))
-
-extern int __sync_nand_and_fetch_si (int *, int);
-extern long __sync_nand_and_fetch_di (long *, long);
-#define __sync_nand_and_fetch(PTR,VAL)					\
- ((sizeof (*(PTR)) == sizeof(int))					\
-  ? (__typeof__(*(PTR))) __sync_nand_and_fetch_si((int *)(PTR),(int)(VAL)) \
-  : (__typeof__(*(PTR))) __sync_nand_and_fetch_di((long *)(PTR),(long)(VAL)))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/config/cpu/m68k/Makefile.am b/config/cpu/m68k/Makefile.am
deleted file mode 100644
index 166d93d..0000000
--- a/config/cpu/m68k/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h
-
diff --git a/config/cpu/m68k/atomicity.h b/config/cpu/m68k/atomicity.h
deleted file mode 100644
index eb801de..0000000
--- a/config/cpu/m68k/atomicity.h
+++ /dev/null
@@ -1,139 +0,0 @@
-// Low-level functions for atomic operations: m68k version -*- C++ -*-
-
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H	1
-
-typedef int _Atomic_word;
-
-#if ( defined(__mc68020__) || defined(__mc68030__) \
-      || defined(__mc68040__) || defined(__mc68060__) ) \
-    && !defined(__mcpu32__)
-// These variants support compare-and-swap.
-
-static inline _Atomic_word 
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  register _Atomic_word __result = *__mem;
-  register _Atomic_word __temp;
-  __asm__ __volatile__ ("1: move%.l %0,%1\n\t"
-			"add%.l %3,%1\n\t"
-			"cas%.l %0,%1,%2\n\t"
-			"jne 1b"
-			: "=d" (__result), "=&d" (__temp), "=m" (*__mem)
-			: "d" (__val), "0" (__result), "m" (*__mem));
-  return __result;
-}
-
-#elif defined(__rtems__)
-  /*
-   * TAS/JBNE is unsafe on systems with strict priority-based scheduling.
-   * Disable interrupts, which we can do only from supervisor mode.
-   */
-static inline _Atomic_word
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  _Atomic_word __result;
-  short __level, __tmpsr;
-  __asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr"
-                       : "=d"(__level), "=d"(__tmpsr) : "1"(0x700));
-
-  __result = *__mem;
-  *__mem = __result + __val;
-
-  __asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level));
-
-  return __result;
-}
-
-#else
-
-template<int __inst>
-  struct __Atomicity_lock
-  {
-    static volatile unsigned char _S_atomicity_lock;
-  };
-
-template<int __inst>
-volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
-
-template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
-
-static inline _Atomic_word 
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  _Atomic_word __result;
-
-// bset with no immediate addressing (not SMP-safe)
-#if defined(__mcf5200__) || defined(__mcf5300__)
-  __asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b"
-		       : /* no outputs */
-		       : "a"(&__Atomicity_lock<0>::_S_atomicity_lock)
-		       : "cc", "memory");
-
-// CPU32 and MCF5400 support test-and-set (SMP-safe).
-#elif defined(__mcpu32__) || defined(__mcf5400__)
-  __asm__ __volatile__("1: tas %0\n\tjbne 1b"
-		       : "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
-		       : /* none */
-		       : "cc");
-
-// Use bset with immediate addressing for 68000/68010 (not SMP-safe)
-// NOTE: TAS is available on the 68000, but unsupported by some Amiga
-// memory controllers.
-#else
-  __asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b"
-		       : "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
-		       : /* none */
-		       : "cc");
-#endif
-
-  __result = *__mem;
-  *__mem = __result + __val;
-
-  __Atomicity_lock<0>::_S_atomicity_lock = 0;
-
-  return __result;
-}
-
-#endif /* TAS / BSET */
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  // Careful: using add.l with a memory destination is not
-  // architecturally guaranteed to be atomic.
-  (void) __exchange_and_add(__mem, __val);
-}
-
-#endif /* !_GLIBCXX_ATOMICITY_H */
diff --git a/config/cpu/mips/Makefile.am b/config/cpu/mips/Makefile.am
deleted file mode 100644
index 166d93d..0000000
--- a/config/cpu/mips/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h
-
diff --git a/config/cpu/mips/atomicity.h b/config/cpu/mips/atomicity.h
deleted file mode 100644
index 3d0c7a1..0000000
--- a/config/cpu/mips/atomicity.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Low-level functions for atomic operations.
-
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H 1
-
-typedef int _Atomic_word;
-
-static inline int
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  int __result, __tmp;
-
-  __asm__ __volatile__
-    ("/* Inline exchange & add */\n\t"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-     "ll	%0,%3\n\t"
-     "addu	%1,%4,%0\n\t"
-     "sc	%1,%2\n\t"
-     ".set	pop\n\t"
-     "beqz	%1,1b\n\t"
-     "/* End exchange & add */"
-     : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
-     : "m" (*__mem), "r"(__val));
-
-  return __result;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  int __result;
-
-  __asm__ __volatile__
-    ("/* Inline atomic add */\n\t"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-     "ll	%0,%2\n\t"
-     "addu	%0,%3,%0\n\t"
-     "sc	%0,%1\n\t"
-     ".set	pop\n\t"
-     "beqz	%0,1b\n\t"
-     "/* End atomic add */"
-     : "=&r"(__result), "=m"(*__mem)
-     : "m" (*__mem), "r"(__val));
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/powerpc/Makefile.am b/config/cpu/powerpc/Makefile.am
deleted file mode 100644
index 2f6ff81..0000000
--- a/config/cpu/powerpc/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h cycles.h
-
diff --git a/config/cpu/powerpc/atomicity.h b/config/cpu/powerpc/atomicity.h
deleted file mode 100644
index 3b44b7d..0000000
--- a/config/cpu/powerpc/atomicity.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Low-level functions for atomic operations: PowerPC version  -*- C++ -*-
-
-// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H	1
-
-#ifdef __PPC405__
-#define _STWCX "sync \n\tstwcx. "
-#else
-#define _STWCX "stwcx. "
-#endif
-
-typedef int _Atomic_word;
-
-static inline _Atomic_word
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  _Atomic_word __tmp, __res;
-  __asm__ __volatile__ (
-	"/* Inline exchange & add */\n"
-	"0:\t"
-	"lwarx    %0,0,%3 \n\t"
-	"add%I4   %1,%0,%4 \n\t"
-	_STWCX "  %1,0,%3 \n\t"
-	"bne-     0b \n\t"
-	"/* End exchange & add */"
-	: "=&b"(__res), "=&r"(__tmp), "=m" (*__mem)
-	: "r" (__mem), "Ir"(__val), "m" (*__mem)
-	: "cr0");
-  return __res;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  _Atomic_word __tmp;
-  __asm__ __volatile__ (
-	"/* Inline atomic add */\n"
-	"0:\t"
-	"lwarx    %0,0,%2 \n\t"
-	"add%I3   %0,%0,%3 \n\t"
-	_STWCX "  %0,0,%2 \n\t"
-	"bne-     0b \n\t"
-	"/* End atomic add */"
-	: "=&b"(__tmp), "=m" (*__mem)
-	: "r" (__mem), "Ir"(__val), "m" (*__mem)
-	: "cr0");
-}
-
-#endif /* atomicity.h */
diff --git a/config/cpu/powerpc/cycles.h b/config/cpu/powerpc/cycles.h
deleted file mode 100644
index bdf9908..0000000
--- a/config/cpu/powerpc/cycles.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Code derived from various headers from the Linux kernel
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_cycles_h__
-#define __jack_cycles_h__
-
-/* PowerPC */
-
-#define CPU_FTR_601			0x00000100
-#ifdef __powerpc64__
-#define CPU_FTR_CELL_TB_BUG		0x0000800000000000UL
-#endif /* __powerpc64__ */
-
-typedef unsigned long cycles_t;
-
-/* For the "cycle" counter we use the timebase lower half. */
-
-extern cycles_t cacheflush_time;
-
-static inline cycles_t get_cycles(void)
-{
-	cycles_t ret = 0;
-
-#ifdef __powerpc64__
-#ifdef ENABLE_CELLBE
-	asm volatile(					\
-		"90:	mftb %0;\n"			\
-		"97:	cmpwi %0,0;\n"			\
-		"	beq- 90b;\n"			\
-		"99:\n"					\
-		".section __ftr_fixup,\"a\"\n"		\
-		".align 3\n"				\
-		"98:\n"					\
-		"	.llong %1\n"			\
-		"	.llong %1\n"			\
-		"	.llong 97b-98b\n"		\
-		"	.llong 99b-98b\n"		\
-		".previous"				\
-		: "=r" (ret) : "i" (CPU_FTR_CELL_TB_BUG));
-#else /* !ENABLE_CELLBE */
-	__asm__ __volatile__("mftb %0" : "=r" (ret));
-#endif /* !ENABLE_CELLBE */
-#else /* !__powerpc64__ */
-	__asm__ __volatile__(
-		"98:	mftb %0\n"
-		"99:\n"
-		".section __ftr_fixup,\"a\"\n"
-		"	.long %1\n"
-		"	.long 0\n"
-		"	.long 98b\n"
-		"	.long 99b\n"
-		".previous"
-		: "=r" (ret) : "i" (CPU_FTR_601));
-#endif /* !__powerpc64__ */
-	return ret;
-}
-
-#endif /* __jack_cycles_h__ */
diff --git a/config/cpu/s390/Makefile.am b/config/cpu/s390/Makefile.am
deleted file mode 100644
index 166d93d..0000000
--- a/config/cpu/s390/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = atomicity.h
-
diff --git a/config/cpu/s390/atomicity.h b/config/cpu/s390/atomicity.h
deleted file mode 100644
index 8647c76..0000000
--- a/config/cpu/s390/atomicity.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Low-level functions for atomic operations: S/390 version  -*- C++ -*-
-
-// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H	1
-
-typedef int _Atomic_word;
-
-static inline _Atomic_word 
-__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
-{
-  register _Atomic_word __old_val, __new_val;
-
-  __asm__ __volatile__ ("   l     %0,0(%3)\n"
-                        "0: lr    %1,%0\n"
-                        "   ar    %1,%4\n"
-                        "   cs    %0,%1,0(%3)\n"
-                        "   jl    0b"
-                        : "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem)
-                        : "a" (__mem), "d" (__val), "m" (*__mem) : "cc");
-  return __old_val;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
-{
-  __exchange_and_add(__mem, __val);
-}
-
-#endif /* atomicity.h */
-
-
diff --git a/config/os/Makefile.am b/config/os/Makefile.am
deleted file mode 100644
index ceb5da9..0000000
--- a/config/os/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-DIST_SUBDIRS = generic gnu-linux macosx
-
diff --git a/config/os/generic/Makefile.am b/config/os/generic/Makefile.am
deleted file mode 100644
index da418e0..0000000
--- a/config/os/generic/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = sanitycheck.c ipc.h poll.h time.c time.h
diff --git a/config/os/generic/ipc.h b/config/os/generic/ipc.h
deleted file mode 100644
index 05aeef8..0000000
--- a/config/os/generic/ipc.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-    Copyright (C) 2004 Jack O'Quin
-
-    Generic version, overridden by OS-specific defines when needed.
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef _jack_sys_ipc
-#define _jack_sys_ipc 1
-
-#include <sys/ipc.h>
-
-#endif /* _jack_sys_ipc */
diff --git a/config/os/generic/poll.h b/config/os/generic/poll.h
deleted file mode 100644
index 5fbc3c6..0000000
--- a/config/os/generic/poll.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-    Copyright (C) 2004 Jack O'Quin
-
-    Generic version, overridden by OS-specific defines when needed.
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef _jack_sys_poll
-#define _jack_sys_poll 1
-
-#include <sys/poll.h>
-
-#endif /* _jack_sys_poll */
diff --git a/config/os/generic/sanitycheck.c b/config/os/generic/sanitycheck.c
deleted file mode 100644
index 2f818c7..0000000
--- a/config/os/generic/sanitycheck.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <jack/sanitycheck.h>
-
-int
-sanitycheck (int a, int b)
-{
-	return 0;
-}
diff --git a/config/os/generic/time.c b/config/os/generic/time.c
deleted file mode 100644
index 0a6deaa..0000000
--- a/config/os/generic/time.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-    Copyright (C) 2001-2004 Paul Davis, Tilman Linneweh
-
-    Generic version, overridden by OS-specific definition when needed.
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-void jack_init_time ()
-{
-	/* nothing to do on a generic system - we use the system clock */
-}
-void jack_set_clock_source (jack_timer_type_t clocksrc) 
-{
-	/* only one clock source on a generic system */
-}
-
diff --git a/config/os/generic/time.h b/config/os/generic/time.h
deleted file mode 100644
index 6e1760a..0000000
--- a/config/os/generic/time.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-    Copyright (C) 2001-2004 Paul Davis, Tilman Linneweh
-
-    Generic version, overridden by OS-specific definition when needed.
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-#ifndef __jack_time_h__
-#define __jack_time_h__
-
-#include <jack/types.h>
-
-extern jack_time_t jack_get_microseconds_from_system (void);
-
-static inline jack_time_t
-jack_get_microseconds (void) {
-	return jack_get_microseconds_from_system ();
-}
-
-#endif /* __jack_time_h__ */
diff --git a/config/os/gnu-linux/Makefile.am b/config/os/gnu-linux/Makefile.am
deleted file mode 100644
index eb4c557..0000000
--- a/config/os/gnu-linux/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = systemtest.c sanitycheck.c time.c time.h
-
diff --git a/config/os/gnu-linux/sanitycheck.c b/config/os/gnu-linux/sanitycheck.c
deleted file mode 100644
index 2b778c8..0000000
--- a/config/os/gnu-linux/sanitycheck.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- *   
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * @author Florian Faber
- *
- **/
-
-#include <stdio.h>
-#include <jack/systemtest.h>
-#include <jack/sanitycheck.h>
-
-int sanitycheck (int care_about_realtime, 
-		 int care_about_freqscaling) 
-{
-  int errors = 0;
-  int warnings = 0;
-  int relogin = 0;
-
-  if (care_about_realtime && !system_user_can_rtprio()) {
-	  errors++;
-	  relogin++;
-	  fprintf(stderr, "\nJACK is running in realtime mode, but you are not allowed to use realtime scheduling.\n");
-		  
-	  if (!system_has_rtprio_limits_conf()) {
-		  errors++;
-		  relogin++;
-		  fprintf (stderr, "Please check your /etc/security/limits.conf for the following lines\n");
-		  fprintf (stderr, "and correct/add them:\n\n");
-		  fprintf(stderr, "  @audio          -       rtprio          100\n");
-		  fprintf(stderr, "  @audio          -       nice            -10\n");
-	  } else if (!system_has_audiogroup()) {
-		  errors++;
-		  relogin++;
-		  fprintf(stderr, "\nYour system has no audio group. Please add it by executing (as root):\n");
-		  fprintf(stderr, "  groupadd -r audio\n");
-		  fprintf(stderr, "  usermod -a -G audio %s\n", system_get_username());
-	  } else if (!system_user_in_audiogroup()) {
-		  errors++;
-		  relogin++;
-		  fprintf(stderr, "\nYour system has an audio group, but you are not a member of it.\n");
-		  fprintf(stderr, "Please add yourself to the audio group by executing (as root):\n");
-		  fprintf(stderr, "  usermod -a -G audio %s\n", system_get_username());
-	  }
-  }
-  if (care_about_freqscaling && system_has_frequencyscaling() && system_uses_frequencyscaling()) {
-	  warnings++;
-	  fprintf(stderr, "\n--------------------------------------------------------------------------------\n");
-	  fprintf(stderr, "WARNING: Your system seems to use frequency scaling.\n\n");
-	  fprintf(stderr, "   This can have a serious impact on audio latency. You have two choices:\n");
-	  fprintf(stderr, "\t(1)turn it off, e.g. by chosing the 'performance' governor.\n");
-	  fprintf(stderr, "\t(2)Use the HPET clocksource by passing \"-c h\" to JACK\n");
-	  fprintf(stderr, "\t   (this second option only works on relatively recent computers)\n");
-	  fprintf(stderr, "--------------------------------------------------------------------------------\n\n");
-  }
-  if (system_memlock_is_unlimited()) {
-	  fprintf(stderr, "\nMemory locking is unlimited - this is dangerous. You should probably alter the line:\n");
-	  fprintf(stderr, "     @audio   -  memlock    unlimited");
-	  fprintf(stderr, "\nin your /etc/limits.conf to read:\n");
-	  fprintf(stderr, "     @audio   -  memlock    %llu\n", (system_available_physical_mem()*3)/4096);
-  } else if (0==system_memlock_amount()) {
-	  errors++;
-	  relogin++;
-	  fprintf(stderr, "\nYou are not allowed to lock memory. Please add a line\n");
-	  fprintf(stderr, "  @audio   -  memlock    %llu\n", (system_available_physical_mem()*3)/4096);
-	  fprintf(stderr, "in your /etc/limits.conf.\n");
-  }
-  
-  if (0<relogin) {
-	  fprintf(stderr, "\nAfter applying these changes, please re-login in order for them to take effect.\n");
-  }
-  
-  if (0<errors) {
-	  fprintf(stderr, "\nYou don't appear to have a sane system configuration. It is very likely that you\n");
-	  fprintf(stderr, "encounter xruns. Please apply all the above mentioned changes and start jack again!\n");
-  }
-  
-  return errors;
-}
diff --git a/config/os/gnu-linux/systemtest.c b/config/os/gnu-linux/systemtest.c
deleted file mode 100644
index 2ea90cb..0000000
--- a/config/os/gnu-linux/systemtest.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Set of functions to gather system information for the jack setup wizard.
- * 
- * TODO: Test for rt prio availability
- *
- * @author Florian Faber, faber at faberman.de
- *
- **/
-
-/** maximum number of groups a user can be a member of **/
-#define MAX_GROUPS 100
-
-#include <fcntl.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <grp.h>
-
-#include <sched.h>
-#include <string.h>
-
-#include <sys/time.h>
-#include <sys/resource.h>
-
-#include <stdio.h>
-#include <errno.h>
-
-#include <jack/systemtest.h>
-
-/**
- * This function checks for the existence of known frequency scaling mechanisms 
- * in this system by testing for the availability of scaling governors/
- *
- * @returns 0 if the system has no frequency scaling capabilities non-0 otherwise.
- **/
-int system_has_frequencyscaling() {
-  int fd;
-
-  fd = open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors", O_RDONLY);
-
-  if (-1==fd) {
-    return 0;
-  }
-
-  (void) close(fd);
-
-  return 1;
-}
-
-
-static int read_string(char* filename, char* buf, size_t buflen) {
-  int fd;
-  ssize_t r=-1;
-
-  memset (buf, 0, buflen);
-
-  fd = open (filename, O_RDONLY);
-  if (-1<fd) {
-    r = read (fd, buf, buflen-1);
-    (void) close(fd);
-    
-    if (-1==r) {
-      fprintf(stderr, "Error while reading \"%s\": %s\n", filename, strerror(errno));
-      exit(EXIT_FAILURE);
-    }
-  }
-  
-  return (int) r;
-}
-
-
-static int read_int(char* filename, int* value) {
-  char buf[20];
-
-  if (0<read_string(filename, buf, 20)) {
-		return (1==sscanf(buf, "%d", value));
-  }
-
-  return 0;
-}
-
-
-/**
- * This function determines wether any CPU core uses a variable clock speed if frequency 
- * scaling is available. If the governor for all cores is either "powersave" or
- * "performance", the CPU frequency can be assumed to be static. This is also the case
- * if scaling_min_freq and scaling_max_freq are set to the same value.
- *
- * @returns 0 if system doesn't use frequency scaling at the moment, non-0 otherwise
- **/
-int system_uses_frequencyscaling() {
-  int cpu=0, done=0, min, max;
-  char filename[256], buf[256];
-
-  while (!done) {
-    (void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", cpu);
-    if (0<read_string(filename, buf, 256)) {
-      if ((0!=strcmp("performance", buf)) && 
-					(0!=strcmp("powersafe", buf))) {
-				// So it's neither the "performance" nor the "powersafe" governor
-				(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq", cpu);
-				if (read_int(filename, &min)) {
-					(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq", cpu);
-					if (read_int(filename, &max)) {
-						if (min!=max) {
-							// wrong governor AND different frequency limits -> scaling
-							return 1;
-						}
-					} 
-				}
-      }
-    } else {
-      // couldn't open file -> no more cores
-      done = 1;
-    }
-    cpu++;
-  }
-  
-  // couldn't find anything that points to scaling
-  return 0;
-}
-
-
-static gid_t get_group_by_name(const char* name) {
-  struct group* grp;
-	gid_t res = 0;
-
-  while ((0==res) && (NULL != (grp = getgrent()))) {
-    if (0==strcmp(name, grp->gr_name)) {
-      res = grp->gr_gid;
-    }
-  }
-
-	endgrent();
-
-  return res;
-}
-
-/***
- * Checks for a definition in /etc/security/limits.conf that looks
- * as if it allows RT scheduling priority.
- *
- * @returns 1 if there appears to be such a line
- **/
-int system_has_rtprio_limits_conf ()
-{
-	const char* limits = "/etc/security/limits.conf";
-	char cmd[100];
-
-	snprintf (cmd, sizeof (cmd), "grep -q 'rtprio *[0-9][0-9]*' %s", limits);
-	if (system (cmd) == 0) {
-		return 1;
-	}
-	return 0;
-}
-
-
-/**
- * Checks for the existence of the 'audio' group on this system
- *
- * @returns 0 is there is no 'audio' group, the group id otherwise
- **/
-int system_has_audiogroup() {
-	return get_group_by_name("audio") || get_group_by_name ("jackuser");
-}
-
-
-/**
- * Tests wether the owner of this process is in the 'audio' group.
- *
- * @returns 0 if the owner of this process is not in the audio group, non-0 otherwise
- **/
-int system_user_in_audiogroup() {
-  gid_t* list = (gid_t*) malloc(MAX_GROUPS * sizeof(gid_t));
-  int num_groups, i=0, found=0;
-	unsigned int gid;
-
-  if (NULL==list) {
-    perror("Cannot allocate group list structure");
-    exit(EXIT_FAILURE);
-  }
-
-  gid = get_group_by_name("audio");
-  if (0==gid) {
-    fprintf(stderr, "No audio group found\n");
-    exit(EXIT_FAILURE);
-  }
-  
-  num_groups = getgroups(MAX_GROUPS, list);
-  
-  while (i<num_groups) {
-    if (list[i]==gid) {
-      found = 1;
-      i = num_groups;
-    }
-    
-    i++;
-  }
-  
-  free(list);
-
-  return found;
-}
-
-
-/**
- * Determines wether the owner of this process can enable rt priority.
- *
- * @returns 0 if this process can not be switched to rt prio, non-0 otherwise
- **/
-int system_user_can_rtprio() {
-  int min_prio;
-  struct sched_param schparam;
-
-  memset(&schparam, 0, sizeof(struct sched_param));
-
-  if (-1 == (min_prio = sched_get_priority_min(SCHED_RR))) {
-    perror("sched_get_priority");
-    exit(EXIT_FAILURE);
-  }
-  schparam.sched_priority = min_prio;  
-
-  if (0 == sched_setscheduler(0, SCHED_RR, &schparam)) {
-    // TODO: restore previous state
-    schparam.sched_priority = 0;
-    if (0 != sched_setscheduler(0, SCHED_OTHER, &schparam)) {
-      perror("sched_setscheduler");
-      exit(EXIT_FAILURE);
-    }
-    return 1;
-  }  
-
-  return 0;
-}
-
-
-long long unsigned int system_memlock_amount() {
-	struct rlimit limits;
-
-	if (-1==getrlimit(RLIMIT_MEMLOCK, &limits)) {
-		perror("getrlimit on RLIMIT_MEMLOCK");
-		exit(EXIT_FAILURE);
-	}
-
-	return limits.rlim_max;
-}
-
-
-/**
- * Checks wether the memlock limit is unlimited
- *
- * @returns - 0 if the memlock limit is limited, non-0 otherwise
- **/
-int system_memlock_is_unlimited() {
-	return ((RLIM_INFINITY==system_memlock_amount())?1:0);
-}
-
-
-long long unsigned int system_available_physical_mem() {
-	char buf[256];
-	long long unsigned int res = 0;
-
-	if (0<read_string("/proc/meminfo", buf, sizeof (buf))) {
-		if (strncmp (buf, "MemTotal:", 9) == 0) {
-			if (sscanf (buf, "%*s %llu", &res) != 1) {
-				perror ("parse error in /proc/meminfo");
-			} 
-		}
-	} else {
-		perror("read from /proc/meminfo");
-	}
-
-	return res*1024;
-}
-
-
-/**
- * Gets the version of the currently running kernel. The string
- * returned has to be freed by the caller.
- *
- * @returns String with the full version of the kernel
- **/
-char* system_kernel_version() {
-  return NULL;
-}
-
-
-
-char* system_get_username() {
-  char* res = NULL;
-  char* name = NULL;
-
-  if ((name = getlogin())) {
-    res = strdup(name);
-  }
-
-  return res;
-}
diff --git a/config/os/gnu-linux/time.c b/config/os/gnu-linux/time.c
deleted file mode 100644
index 0fc6ae6..0000000
--- a/config/os/gnu-linux/time.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2005 Jussi Laako
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include <config.h>
-
-#include <stdint.h>
-
-static jack_time_t __jack_cpu_mhz = 0;
-jack_time_t (*_jack_get_microseconds)(void) = 0;
-
-#if defined(__gnu_linux__) && (defined(__i386__) || defined(__x86_64__))
-#define HPET_SUPPORT
-#define HPET_MMAP_SIZE			1024
-#define HPET_CAPS			0x000
-#define HPET_PERIOD			0x004
-#define HPET_COUNTER			0x0f0
-#define HPET_CAPS_COUNTER_64BIT		(1 << 13)
-#if defined(__x86_64__)
-typedef uint64_t hpet_counter_t;
-#else
-typedef uint32_t hpet_counter_t;
-#endif
-static int hpet_fd;
-static unsigned char *hpet_ptr;
-static uint32_t hpet_period; /* period length in femto secs */
-static uint64_t hpet_offset = 0;
-static uint64_t hpet_wrap;
-static hpet_counter_t hpet_previous = 0;
-#endif /* defined(__gnu_linux__) && (__i386__ || __x86_64__) */
-
-#ifdef HPET_SUPPORT
-int
-jack_hpet_init ()
-{
-	uint32_t hpet_caps;
-
-	hpet_fd = open("/dev/hpet", O_RDONLY);
-	if (hpet_fd < 0) {
-		jack_error ("This system has no accessible HPET device (%s)", strerror (errno));
-		return -1;
-	}
-
-	hpet_ptr = (unsigned char *) mmap(NULL, HPET_MMAP_SIZE,
-					  PROT_READ, MAP_SHARED, hpet_fd, 0);
-	if (hpet_ptr == MAP_FAILED) {
-		jack_error ("This system has no mappable HPET device (%s)", strerror (errno));
-		close (hpet_fd);
-		return -1;
-	}
-
-	/* this assumes period to be constant. if needed,
-	   it can be moved to the clock access function 
-	*/
-	hpet_period = *((uint32_t *) (hpet_ptr + HPET_PERIOD));
-	hpet_caps = *((uint32_t *) (hpet_ptr + HPET_CAPS));
-	hpet_wrap = ((hpet_caps & HPET_CAPS_COUNTER_64BIT) &&
-		(sizeof(hpet_counter_t) == sizeof(uint64_t))) ?
-		0 : ((uint64_t) 1 << 32);
-
-	return 0;
-}
-
-static jack_time_t
-jack_get_microseconds_from_hpet (void) 
-{
-	hpet_counter_t hpet_counter;
-	long double hpet_time;
-
-	hpet_counter = *((hpet_counter_t *) (hpet_ptr + HPET_COUNTER));
-	if (unlikely(hpet_counter < hpet_previous))
-		hpet_offset += hpet_wrap;
-	hpet_previous = hpet_counter;
-	hpet_time = (long double) (hpet_offset + hpet_counter) *
-		(long double) hpet_period * (long double) 1e-9;
-	return ((jack_time_t) (hpet_time + 0.5));
-}
-
-#else
-
-static int
-jack_hpet_init ()
-{
-	jack_error ("This version of JACK or this computer does not have HPET support.\n"
-		    "Please choose a different clock source.");
-	return -1;
-}
-
-static jack_time_t
-jack_get_microseconds_from_hpet (void) 
-{
-	/* never called */
-	return 0;
-}
-
-#endif /* HPET_SUPPORT */
-
-
-jack_time_t 
-jack_get_microseconds_from_cycles (void) {
-	return get_cycles() / __jack_cpu_mhz;
-}
-
-/*
- * This is another kludge.  It looks CPU-dependent, but actually it
- * reflects the lack of standards for the Linux kernel formatting of
- * /proc/cpuinfo.
- */
-
-jack_time_t
-jack_get_mhz (void)
-{
-	FILE *f = fopen("/proc/cpuinfo", "r");
-	if (f == 0)
-	{
-		perror("can't open /proc/cpuinfo\n");
-		exit(1);
-	}
-
-	for ( ; ; )
-	{
-		jack_time_t mhz;
-		int ret;
-		char buf[1000];
-
-		if (fgets(buf, sizeof(buf), f) == NULL) {
-			jack_error ("FATAL: cannot locate cpu MHz in "
-				    "/proc/cpuinfo\n");
-			exit(1);
-		}
-
-#if defined(__powerpc__)
-		ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz);
-#elif defined( __i386__ ) || defined (__hppa__)  || defined (__ia64__) || \
-      defined(__x86_64__)
-		ret = sscanf(buf, "cpu MHz         : %" SCNu64, &mhz);
-#elif defined( __sparc__ )
-		ret = sscanf(buf, "Cpu0Bogo        : %" SCNu64, &mhz);
-#elif defined( __mc68000__ )
-		ret = sscanf(buf, "Clocking:       %" SCNu64, &mhz);
-#elif defined( __s390__  )
-		ret = sscanf(buf, "bogomips per cpu: %" SCNu64, &mhz);
-#else /* MIPS, ARM, alpha */
-		ret = sscanf(buf, "BogoMIPS        : %" SCNu64, &mhz);
-#endif 
-
-		if (ret == 1)
-		{
-			fclose(f);
-			return (jack_time_t)mhz;
-		}
-	}
-}
-
-void
-jack_init_time ()
-{
-	__jack_cpu_mhz = jack_get_mhz ();
-}
-
-void
-jack_set_clock_source (jack_timer_type_t clocksrc)
-{
-	switch (clocksrc)
-	{
-	case JACK_TIMER_CYCLE_COUNTER:
-		_jack_get_microseconds = jack_get_microseconds_from_cycles;
-		break;
-
-	case JACK_TIMER_HPET:
-		if (jack_hpet_init () == 0) {
-			_jack_get_microseconds = jack_get_microseconds_from_hpet;
-		} else {
-			_jack_get_microseconds = jack_get_microseconds_from_system;
-		}
-		break;
-
-	case JACK_TIMER_SYSTEM_CLOCK:
-	default:
-		_jack_get_microseconds = jack_get_microseconds_from_system;
-		break;
-	}
-}
-
diff --git a/config/os/gnu-linux/time.h b/config/os/gnu-linux/time.h
deleted file mode 100644
index 10a2a8c..0000000
--- a/config/os/gnu-linux/time.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2005 Jussi Laako
-
-    This is the GNU/Linux version.
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_time_h__
-#define __jack_time_h__
-
-#include <jack/types.h>
-
-extern jack_time_t (*_jack_get_microseconds)(void);
-
-static inline jack_time_t
-jack_get_microseconds (void) 
-{
-	return _jack_get_microseconds ();
-}
-
-#endif /* __jack_time_h__ */
diff --git a/config/os/macosx/JACK_LOCATION.h b/config/os/macosx/JACK_LOCATION.h
deleted file mode 100644
index 6002391..0000000
--- a/config/os/macosx/JACK_LOCATION.h
+++ /dev/null
@@ -1 +0,0 @@
-#define JACK_LOCATION "/usr/local/bin"
\ No newline at end of file
diff --git a/config/os/macosx/Jackframework-Info.plist b/config/os/macosx/Jackframework-Info.plist
deleted file mode 100644
index 00f363a..0000000
--- a/config/os/macosx/Jackframework-Info.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>Jackmp</string>
-	<key>CFBundleGetInfoString</key>
-	<string>libjack 0.107.5, @03-07 Paul Davis, Grame</string>
-	<key>CFBundleIdentifier</key>
-	<string>com.grame.Jackmp</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundlePackageType</key>
-	<string>FMWK</string>
-	<key>CFBundleShortVersionString</key>
-	<string></string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>0.1</string>
-</dict>
-</plist>
diff --git a/config/os/macosx/Makefile.am b/config/os/macosx/Makefile.am
deleted file mode 100644
index 7b3b435..0000000
--- a/config/os/macosx/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-noinst_HEADERS = sanitycheck.c getopt.h ipc.h JACK_LOCATION.h mach_port.h \
-	poll.h pThreadUtilities.h time.c time.h
-
-EXTRA_DIST = jack.xcode/project.pbxproj
diff --git a/config/os/macosx/README b/config/os/macosx/README
deleted file mode 100644
index 33f5692..0000000
--- a/config/os/macosx/README
+++ /dev/null
@@ -1,183 +0,0 @@
-
-Darwin/MacOSX port for Jack : architecture changes in the implementation
-========================================================================
-
-Build Dependencies
-==================
-
-Apple Developer Tools
-  gcc 2.95.x or 3.x, the standard OSX 10.3 gcc-3.3 compiler works fine
-  MacOSX10.3 SDK package
-
-GNU tools
-  autoconf >= 2.57
-  automake >= 1.6.3
-
-optional tools
-  libtool >= 1.5	(to build from CVS)
-  pkg-config >= 0.15.0  (to build from CVS)
-  doxygen		(to build documentation)
-  libsndfile >= 1.0.0	(for some example-clients)
-  GNU readline		(for some example-clients)
-
-All non-Apple tools are available from `fink' or `darwinports'.
-
-Since fink is not well-integrated with OS X, you must define a bunch
-of environment variables...
-
-  export ACLOCAL_FLAGS="-I /sw/share/aclocal"
-  export CFLAGS="-I/sw/include"
-  export CPPFLAGS=$CFLAGS
-  export LDFLAGS="-L/sw/lib"
-  export PKG_CONFIG_PATH="/sw/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig"
-
-
-Shared memory
-=============
-
-The system V shared memory is not very reliable on Darwin/MacOSX, so
-POSIX shared memory API is the preferred default.  To override, use...
-
-  ./configure --disable-posix-shm
-
-
-Jack server audio cycle
-========================
-
-On Linux, the jack server audio cycle (jack_run_cycle function) is
-called in a real-time SCHED_FIFO thread.  On Darwin/MacOSX, the
-jack_run_cycle is directly called inside the CoreAudio audio callback.
-
-
-External client activation
-===========================
-
-Jack Linux implementation use system fifo/pipe to trigger the clients
-real-time callback from the server : the first client of an external
-subgraph is triggered, does it's job and wakes up the next one in the
-list, and so on until the last client that wakes up the Jack
-server. This avoid uneeded context switches between the server and
-clients and thus is more efficient.
-
-This Linux implementation works also on Darwin/MacOSX but is not very
-efficient : audio gliches occur quite frequently.
-
-A more efficient system for external client activation has been
-developed. It use low-level mach messages system to implement fast IPC
-between the Jack server and the running clients. The Darwin/MacOSX has
-a very efficient Remote Procedure Call (RPC) implementation that can
-be used: the Jack server activate each external client in turn in a
-loop.
-
-On the client side, each client uses an additionnal thread only used
-for the real-time process callback, that will be triggered by the Jack
-server using this fast RPC mechanism.
-
-
-Real-time threads
-==================
-
-The Darwin/MacOSX system use a special class of scheduling for
-real-time threads.
-
-Since the server audio cycle is called directly from the CoreAudio
-callback, there is nothing special to do on the server side. On the
-client side, the thread used to call the "process" callback from the
-server is made real-time, using the mach thread API.
-
-
-Compilation and installation
-=============================
-
-- In the jack/jack folder, you'll have to produce the version.h
-manually from the version.h.in file ): Edit the version.h.in, replace
-the JACK_PROTOCOL_VERSION value with the one found in configure.in and
-save as a new version.h file. You should get something like "#define
-jack_protocol_version 6" in the file.
-
-Several packages need to be installed before compiling Jack :
-
-- Fink dlcompat (fink.sourceforge.net) : this package define the
-dlopen, dlsym... API used in Jack to load drivers and internal
-clients. The package has to be installed before compiling Jack.
-
-- fakepoll is a implementation of the poll function using select. The
-Fink version of poll does not work correctly, thus the public domain
-"fakepoll" code has been used instead. It is directly included in the
-Jack Darwin/MacOSX port.
-
-- PortAudio (www.portaudio.com) : PortAudio is a free, cross platform,
-open-source, audio I/O library. The Jack CoreAudio driver actually is
-implemented using PortAudio. The PortAudio source code for MacOSX has
-to be installed and compiled to produce a framework called
-"PortAudio.framework" that will be used in the Jack link phase.
-
-
-Several targets are available in the Project Builder project :
-
-- jackd :  build the Jack server ("jackd" executable)
-- jack framework : build the "Jack.framework" library.
-- driver :  build the PortAudio driver as a "jack_portaudio.so" shared library.
-- jack_metro :  build the "jack_metro" executable.
-- jack_lsp :  build the "jack_lsp" executable.
-- jack_connect :  build the "jack_connect" executable.
-- jack_disconnect :  build the "jack_disconnect" executable.
-
-Server, driver and library installation :
------------------------------------------
-
-First copy the Jack.framework in /Library/Framework. Then as root : 
-
-  # cp jack_portaudio 	/usr/local/lib
-  # cp jackd 		/usr/local/bin
-
-Launching Jack server :
------------------------
-
-By default buffer size is 128 frames and sample rate is 44100.
-
-  $ jackd  -v -R -d coreaudio 
-
-To setup a 32 frames buffer and a 4800 Hz sample rate : 
-
-  $ jackd  -v -R -d coreaudio -p 32 -r 48000  
-
-Performances
-=============
-
-The Darwin/MacOSX implementation is quite efficient: on a G4/867 Mhz,
-the Jack server can run with a 32 frames buffer size without noticable
-problems.
-
-
-Known problems or unimplemented features
-=========================================
-
-- thread cancellation : the pthread API pthread_cancel is not
-completely available on Darwin/MacOSX. Thread cannot be cancelled in
-the general case: they must use explicit cancelation points like
-"pthread_testcancel" (see the "jack_client_thread" function)
-
-- xruns detection and report: not implemented.
-
-
-Possible improvements
-======================
-
-- The audio driver is built on top of PortAudio. It may be more
-efficient to directly use the CoreAudio API in order to avoid
-additional buffer copy and interleaving/disinterleaving operations.
-
-- The project uses Project Builder.  It would be helpful to work on
-the autoconf and automake tools as the Linux version.  In this case,
-the macosx/config.h file would have to be removed and generated by
-configure, and jack/version.h will be generated automatically from
-jack/version.h.in
-
-- Better separation of Linux and Darwin/MacOSX only code.
-
-The Jack port for Darwin/MacOSX version has be done by:
-
-Grame Research Laboratory
-9, rue du Garet 69001 Lyon - France
-Mail : letz at grame.fr
diff --git a/config/os/macosx/getopt.h b/config/os/macosx/getopt.h
deleted file mode 100644
index 7275c59..0000000
--- a/config/os/macosx/getopt.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-    Copyright © Grame 2003
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-    
-    Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
-    grame at rd.grame.fr
-*/
-
-#include "/Developer/SDKs/MacOSX10.3.0.sdk/usr/include/getopt.h"
diff --git a/config/os/macosx/ipc.h b/config/os/macosx/ipc.h
deleted file mode 100644
index 64bc251..0000000
--- a/config/os/macosx/ipc.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-    Copyright © Grame 2003
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-    
-    Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
-    grame at rd.grame.fr
-*/
-
-#ifndef __ipc__
-#define __ipc__
-
-#include <mach/mach_error.h>
-#include <servers/bootstrap.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <libjack/local.h>		/* JOQ: fix me */
-
-/*
-    RPC without time out can put the jack server in a blocked state
-    (waiting for the client answer) when a client is killed.  The
-    mach_msg function does not return any error in this case. Using
-    time out solve the problem but does not seems really satisfactory.
-*/
-
-#define WAIT 2500 /* in millisecond */
-
-static inline int 
-jack_client_resume(jack_client_internal_t *client)
-{
-        mach_msg_header_t *head =  &client->message.header;
-        int err;
-        
-        if (!client->running) {
-            err = mach_msg (head, MACH_RCV_MSG, 0, sizeof(client->message),
-			    client->serverport, 0, MACH_PORT_NULL);
-            if (err) {
-                jack_error("jack_client_resume: priming receive error: %s\n", 
-			   mach_error_string(err));
-                return -1;
-            }
-            client->running = TRUE;
-        }else {
-            /* remote port is already the send-once he sent us */
-            head->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE, 0);
-            head->msgh_local_port = MACH_PORT_NULL;
-            head->msgh_size = sizeof(mach_msg_header_t);
-    
-            err = mach_msg(head, (MACH_SEND_MSG|MACH_RCV_MSG|
-				  MACH_SEND_TIMEOUT|MACH_RCV_TIMEOUT), 
-			   sizeof(*head), sizeof(client->message),
-			   client->serverport, WAIT, MACH_PORT_NULL);
-                
-            if (err) {
-            
-                    /*
-                    switch(err) {
-                        case MACH_SEND_TIMED_OUT:
-                                 jack_error("MACH_SEND_TIMED_OUT %s\n",
-				            client->control->name);
-                                 break;
-                                 
-                           case MACH_RCV_TIMED_OUT:
-                                 jack_error("MACH_RCV_TIMED_OUT %s\n",
-				            client->control->name);
-                                 break;
-                     
-                         case MACH_SEND_INVALID_DEST:
-                                 jack_error("MACH_SEND_INVALID_DEST %s\n",
-				            client->control->name);
-                                 break;
-                    }
-                    */
-                    
-                    jack_error("jack_client_resume: send error for %s\n",
-			       mach_error_string(err));
-                    return err;
-            }
-        }
-        
-        return 0;
-}
-
-static inline int 
-jack_client_suspend(jack_client_t * client)
-{
-        int err = 0;
-        mach_msg_header_t * head = &client->message.header;
-     
-        head->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND,
-					 MACH_MSG_TYPE_MAKE_SEND_ONCE);
-        head->msgh_remote_port = client->serverport;
-	head->msgh_local_port = client->replyport;
-	head->msgh_size = sizeof(mach_msg_header_t);
-     
-        err = mach_msg(head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_SEND_TIMEOUT, 
-		       sizeof(mach_msg_header_t), sizeof(client->message),
-		       client->replyport, WAIT, MACH_PORT_NULL);
-            
-        if (err) {
-            jack_error("jack_client_suspend: RPC error: %s\n",
-		       mach_error_string(err));
-            return -1;
-        }
-        
-        return 0;
-}
-
-static inline void 
-allocate_mach_serverport(jack_engine_t * engine, jack_client_internal_t *client)
-{
-        char buf[256];
-        snprintf(buf, 256, "JackMachPort_%d", engine->portnum); 
-        
-        if (mach_port_allocate(engine->servertask, MACH_PORT_RIGHT_RECEIVE,
-			       &client->serverport)){
-            jack_error("allocate_mach_serverport: can't allocate mach port");
-        }
-        
-        if (mach_port_insert_right(engine->servertask, client->serverport,
-				   client->serverport, MACH_MSG_TYPE_MAKE_SEND)){
-            jack_error("allocate_mach_serverport: error inserting mach rights");
-        }
-        
-	if (bootstrap_register(engine->bp, buf, client->serverport)){
-            jack_error("allocate_mach_serverport: can't check in mach port");
-        }
-        
-        client->portnum = engine->portnum;
-        engine->portnum++;
-}
-
-static inline int 
-allocate_mach_clientport(jack_client_t * client, int portnum)
-{
-        char buf[256];
-        snprintf(buf, 256, "JackMachPort_%d", portnum); 
-        
-        if (bootstrap_look_up(client->bp, buf, &client->serverport)){
-            jack_error ("allocate_mach_clientport: can't find mach server port");
-            return -1;
-  	}
-        
-        if (mach_port_allocate(client->clienttask, MACH_PORT_RIGHT_RECEIVE,
-			       &client->replyport)){
-            jack_error("allocate_mach_clientport: can't allocate mach port");
-            return -1;
-        }
-        
-        return 0;
-}
-
-#endif /* __ipc__ */
diff --git a/config/os/macosx/jack.xcode/project.pbxproj b/config/os/macosx/jack.xcode/project.pbxproj
deleted file mode 100644
index 09dcbc8..0000000
--- a/config/os/macosx/jack.xcode/project.pbxproj
+++ /dev/null
@@ -1,1688 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 39;
-	objects = {
-		014CEA520018CE5811CA2923 = {
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				OPTIMIZATION_CFLAGS = "-O0";
-				ZERO_LINK = YES;
-			};
-			isa = PBXBuildStyle;
-			name = Development;
-		};
-		014CEA530018CE5811CA2923 = {
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				ZERO_LINK = NO;
-			};
-			isa = PBXBuildStyle;
-			name = Deployment;
-		};
-//010
-//011
-//012
-//013
-//014
-//080
-//081
-//082
-//083
-//084
-		08FB7793FE84155DC02AAC07 = {
-			buildSettings = {
-			};
-			buildStyles = (
-				014CEA520018CE5811CA2923,
-				014CEA530018CE5811CA2923,
-			);
-			hasScannedForEncodings = 1;
-			isa = PBXProject;
-			mainGroup = 08FB7794FE84155DC02AAC07;
-			projectDirPath = "";
-			targets = (
-				4BA1CADE0470D14500053105,
-				4B7F53D00A470FE600075B93,
-				4BCA2602040B8B9400053105,
-				4BF8712F040BDE8200053105,
-				4BA1CB000470D38800053105,
-				4BA1E4570442D99D00053105,
-				4B81402507240F550025D71C,
-				4BBB87300406EF300019BE76,
-			);
-		};
-		08FB7794FE84155DC02AAC07 = {
-			children = (
-				4BA9D903040E0CC200053105,
-				4B6CBA33041F4DDF00053105,
-				4B6AF278041F4DBC00053105,
-				4BA716600408E047004F4E3A,
-				4BA7165F0408DFF5004F4E3A,
-				08FB7795FE84155DC02AAC07,
-				1AB674ADFE9D54B511CA2CBB,
-				4B7F53E90A470FE600075B93,
-			);
-			isa = PBXGroup;
-			name = jackd;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		08FB7795FE84155DC02AAC07 = {
-			children = (
-				4B89C95906F596060003AD09,
-				4B117C6305DD0C8000B5DA5A,
-				4B117C6605DD0C8700B5DA5A,
-				4B117C6905DD0C8D00B5DA5A,
-				4B117C6C05DD0C9400B5DA5A,
-				4B117C6F05DD0C9900B5DA5A,
-				4B117C7205DD0C9D00B5DA5A,
-				4B117C7505DD0CA000B5DA5A,
-				4B6683E30A2D8B2E00E8ADF8,
-				4B6683EC0A2D8C2A00E8ADF8,
-			);
-			isa = PBXGroup;
-			name = Client;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-//080
-//081
-//082
-//083
-//084
-//1A0
-//1A1
-//1A2
-//1A3
-//1A4
-		1AB674ADFE9D54B511CA2CBB = {
-			children = (
-				4BBB87310406EF300019BE76,
-				4BCA2603040B8B9400053105,
-				4BF87130040BDE8200053105,
-				4BA1E4580442D99D00053105,
-				4BA1CADF0470D14500053105,
-				4BA1CB010470D38800053105,
-				4B81402607240F550025D71C,
-				4B7F53EA0A470FE600075B93,
-			);
-			isa = PBXGroup;
-			name = Products;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-//1A0
-//1A1
-//1A2
-//1A3
-//1A4
-//4B0
-//4B1
-//4B2
-//4B3
-//4B4
-		4B099343041FB67A00053105 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = fakepoll.h;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4B117C5805DD0C3600B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = jackd.c;
-			path = ../../../jackd/jackd.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C5A05DD0C4100B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = engine.c;
-			path = ../../../jackd/engine.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C5D05DD0C5B00B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = transengine.c;
-			path = ../../../jackd/transengine.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C6305DD0C8000B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = port.c;
-			path = ../../../libjack/port.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C6505DD0C8000B5DA5A = {
-			fileRef = 4B117C6305DD0C8000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C6605DD0C8700B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = pool.c;
-			path = ../../../libjack/pool.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C6805DD0C8700B5DA5A = {
-			fileRef = 4B117C6605DD0C8700B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C6905DD0C8D00B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = driver.c;
-			path = ../../../libjack/driver.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C6B05DD0C8D00B5DA5A = {
-			fileRef = 4B117C6905DD0C8D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C6C05DD0C9400B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = ringbuffer.c;
-			path = ../../../libjack/ringbuffer.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C6E05DD0C9400B5DA5A = {
-			fileRef = 4B117C6C05DD0C9400B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C6F05DD0C9900B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = transclient.c;
-			path = ../../../libjack/transclient.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C7105DD0C9900B5DA5A = {
-			fileRef = 4B117C6F05DD0C9900B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C7205DD0C9D00B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = shm.c;
-			path = ../../../libjack/shm.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C7405DD0C9D00B5DA5A = {
-			fileRef = 4B117C7205DD0C9D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C7505DD0CA000B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = client.c;
-			path = ../../../libjack/client.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C7705DD0CA000B5DA5A = {
-			fileRef = 4B117C7505DD0CA000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C7A05DD0CC000B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = config.h;
-			path = ../../../config.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C7C05DD0CC000B5DA5A = {
-			fileRef = 4B117C7A05DD0CC000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C7F05DD0D7700B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = portaudio_driver.c;
-			path = ../../../drivers/portaudio/portaudio_driver.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C8005DD0D7700B5DA5A = {
-			fileRef = 4B117C7F05DD0D7700B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C8105DD0D7D00B5DA5A = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = portaudio_driver.h;
-			path = ../../../drivers/portaudio/portaudio_driver.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B117C8205DD0D7D00B5DA5A = {
-			fileRef = 4B117C8105DD0D7D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B117C8305DD0DA700B5DA5A = {
-			fileRef = 4B117C6905DD0C8D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B16FF900467B5A000053105 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = pThreadUtilities.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B1A736907252DDC007105CE = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = coreaudio_driver.h;
-			path = ../../../drivers/coreaudio/coreaudio_driver.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCB9405DD229F00DC3452 = {
-			fileRef = 4B117C6305DD0C8000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCB9505DD22AF00DC3452 = {
-			fileRef = 4B117C6605DD0C8700B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCB9805DD22C300DC3452 = {
-			fileRef = 4B117C7205DD0C9D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCBA105DD234100DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = ringbuffer.h;
-			path = ../../../jack/ringbuffer.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCBA305DD234100DC3452 = {
-			fileRef = 4B4DCBA105DD234100DC3452;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B4DCBA405DD234800DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = transport.h;
-			path = ../../../jack/transport.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCBA605DD234800DC3452 = {
-			fileRef = 4B4DCBA405DD234800DC3452;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B4DCBA705DD235B00DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = types.h;
-			path = ../../../jack/types.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCBA905DD235B00DC3452 = {
-			fileRef = 4B4DCBA705DD235B00DC3452;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B4DCBAE05DD23DE00DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = metro.c;
-			path = "../../../example-clients/metro.c";
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCBAF05DD23DE00DC3452 = {
-			fileRef = 4B4DCBAE05DD23DE00DC3452;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCBB205DD243A00DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = connect.c;
-			path = "../../../example-clients/connect.c";
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCBB305DD243A00DC3452 = {
-			fileRef = 4B4DCBB205DD243A00DC3452;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCBB605DD248300DC3452 = {
-			fileRef = 4B4DCBB205DD243A00DC3452;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCBB905DD249E00DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = lsp.c;
-			path = "../../../example-clients/lsp.c";
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B4DCBBA05DD249E00DC3452 = {
-			fileRef = 4B4DCBB905DD249E00DC3452;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B4DCBBD05DD24CD00DC3452 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = capture_client.c;
-			path = "../../../example-clients/capture_client.c";
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B5B51EA047D353A00053105 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = ipc.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B5B51EC047D353A00053105 = {
-			fileRef = 4B5B51EA047D353A00053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B5B51F0047D353A00053105 = {
-			fileRef = 4B5B51EA047D353A00053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B6683E30A2D8B2E00E8ADF8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = midiport.c;
-			path = ../../../libjack/midiport.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B6683E40A2D8B2E00E8ADF8 = {
-			fileRef = 4B6683E30A2D8B2E00E8ADF8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B6683EC0A2D8C2A00E8ADF8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = time.c;
-			path = ../../../libjack/time.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B6683ED0A2D8C2A00E8ADF8 = {
-			fileRef = 4B6683EC0A2D8C2A00E8ADF8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B6AF278041F4DBC00053105 = {
-			children = (
-				4B4DCBAE05DD23DE00DC3452,
-				4B4DCBB205DD243A00DC3452,
-				4B4DCBB905DD249E00DC3452,
-				4B4DCBBD05DD24CD00DC3452,
-			);
-			isa = PBXGroup;
-			name = Samples;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4B6CBA33041F4DDF00053105 = {
-			children = (
-				4B117C7A05DD0CC000B5DA5A,
-				4B16FF900467B5A000053105,
-				4B099343041FB67A00053105,
-				4B5B51EA047D353A00053105,
-				4BB9E091046FADED00053105,
-				4BAA76A6047E0D5200053105,
-			);
-			isa = PBXGroup;
-			name = Porting_code;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4B776780072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = atomicity.h;
-			path = ../../../jack/atomicity.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776785072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = driver_interface.h;
-			path = ../../../jack/driver_interface.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776786072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = driver_parse.h;
-			path = ../../../jack/driver_parse.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776787072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = driver.h;
-			path = ../../../jack/driver.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776788072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = engine.h;
-			path = ../../../jack/engine.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776789072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = hardware.h;
-			path = ../../../jack/hardware.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B77678A072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = jslist.h;
-			path = ../../../jack/jslist.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B77678E072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = memops.h;
-			path = ../../../jack/memops.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B77678F072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = pool.h;
-			path = ../../../jack/pool.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776790072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = port.h;
-			path = ../../../jack/port.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776791072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = shm.h;
-			path = ../../../jack/shm.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776792072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = start.h;
-			path = ../../../jack/start.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776793072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = thread.h;
-			path = ../../../jack/thread.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776794072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = unlock.h;
-			path = ../../../jack/unlock.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776795072D2B5700F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = version.h;
-			path = ../../../jack/version.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B776799072D2B9500F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = transengine.h;
-			path = ../../../jackd/transengine.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B77679A072D2B9500F14709 = {
-			fileRef = 4B776799072D2B9500F14709;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B77679E072D2BAD00F14709 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = local.h;
-			path = ../../../libjack/local.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B77679F072D2BAD00F14709 = {
-			fileRef = 4B77679E072D2BAD00F14709;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53D00A470FE600075B93 = {
-			buildPhases = (
-				4B7F53D10A470FE600075B93,
-				4B7F53DB0A470FE600075B93,
-				4B7F53DC0A470FE600075B93,
-				4B7F53E70A470FE600075B93,
-				4B7F53E80A470FE600075B93,
-			);
-			buildRules = (
-			);
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				GCC_OPTIMIZATION_LEVEL = 3;
-				GCC_PREFIX_HEADER = ./JACK_LOCATION.h;
-				HEADER_SEARCH_PATHS = "../../ ../../../";
-				INFOPLIST_FILE = "Info-Jack_framework__Upgraded_.plist";
-				LIBRARY_SEARCH_PATHS = "";
-				OTHER_LDFLAGS = "-framework CoreAudio ";
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-				WRAPPER_EXTENSION = framework;
-			};
-			dependencies = (
-			);
-			isa = PBXNativeTarget;
-			name = "Jack framework (Upgraded)";
-			productInstallPath = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-			productName = Jack;
-			productReference = 4B7F53EA0A470FE600075B93;
-			productType = "com.apple.product-type.framework";
-		};
-		4B7F53D10A470FE600075B93 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B7F53D20A470FE600075B93,
-				4B7F53D30A470FE600075B93,
-				4B7F53D40A470FE600075B93,
-				4B7F53D50A470FE600075B93,
-				4B7F53D60A470FE600075B93,
-				4B7F53D70A470FE600075B93,
-				4B7F53D80A470FE600075B93,
-				4B7F53D90A470FE600075B93,
-				4B7F53DA0A470FE600075B93,
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B7F53D20A470FE600075B93 = {
-			fileRef = 4B16FF900467B5A000053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53D30A470FE600075B93 = {
-			fileRef = 4BB9E091046FADED00053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53D40A470FE600075B93 = {
-			fileRef = 4B5B51EA047D353A00053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53D50A470FE600075B93 = {
-			fileRef = 4B117C7A05DD0CC000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53D60A470FE600075B93 = {
-			fileRef = 4B4DCBA105DD234100DC3452;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B7F53D70A470FE600075B93 = {
-			fileRef = 4B4DCBA405DD234800DC3452;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B7F53D80A470FE600075B93 = {
-			fileRef = 4B4DCBA705DD235B00DC3452;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B7F53D90A470FE600075B93 = {
-			fileRef = 4BA39A1E05DD2C63008919E8;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B7F53DA0A470FE600075B93 = {
-			fileRef = 4BA39A2205DD2CA5008919E8;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4B7F53DB0A470FE600075B93 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXResourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B7F53DC0A470FE600075B93 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B7F53DD0A470FE600075B93,
-				4B7F53DE0A470FE600075B93,
-				4B7F53DF0A470FE600075B93,
-				4B7F53E00A470FE600075B93,
-				4B7F53E10A470FE600075B93,
-				4B7F53E20A470FE600075B93,
-				4B7F53E30A470FE600075B93,
-				4B7F53E40A470FE600075B93,
-				4B7F53E50A470FE600075B93,
-				4B7F53E60A470FE600075B93,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B7F53DD0A470FE600075B93 = {
-			fileRef = 4B117C6305DD0C8000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53DE0A470FE600075B93 = {
-			fileRef = 4B117C6605DD0C8700B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53DF0A470FE600075B93 = {
-			fileRef = 4B117C6905DD0C8D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E00A470FE600075B93 = {
-			fileRef = 4B117C6C05DD0C9400B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E10A470FE600075B93 = {
-			fileRef = 4B117C6F05DD0C9900B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E20A470FE600075B93 = {
-			fileRef = 4B117C7205DD0C9D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E30A470FE600075B93 = {
-			fileRef = 4B117C7505DD0CA000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E40A470FE600075B93 = {
-			fileRef = 4B89C95906F596060003AD09;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E50A470FE600075B93 = {
-			fileRef = 4B6683E30A2D8B2E00E8ADF8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E60A470FE600075B93 = {
-			fileRef = 4B6683EC0A2D8C2A00E8ADF8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B7F53E70A470FE600075B93 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B7F53E80A470FE600075B93 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B7F53E90A470FE600075B93 = {
-			isa = PBXFileReference;
-			lastKnownFileType = text.xml;
-			path = "Info-Jack_framework__Upgraded_.plist";
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4B7F53EA0A470FE600075B93 = {
-			explicitFileType = wrapper.framework;
-			includeInIndex = 0;
-			isa = PBXFileReference;
-			name = Jack.framework;
-			path = build/Jack.framework;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4B813FF007240D000025D71C = {
-			fileRef = 4B89C95906F596060003AD09;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81400707240DA30025D71C = {
-			fileRef = 4B117C6F05DD0C9900B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81402107240F550025D71C = {
-			buildActionMask = 2147483647;
-			files = (
-				4B77679A072D2B9500F14709,
-				4B77679F072D2BAD00F14709,
-				4BE7704207A00B15001AA2F0,
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402207240F550025D71C = {
-			buildActionMask = 2147483647;
-			files = (
-				4B81402C07240F650025D71C,
-				4B81402D07240F660025D71C,
-				4B81402E07240F680025D71C,
-				4B81402F07240F690025D71C,
-				4B81403007240F6A0025D71C,
-				4B81409407241E580025D71C,
-				4BE7704107A00B15001AA2F0,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402307240F550025D71C = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402407240F550025D71C = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402507240F550025D71C = {
-			buildPhases = (
-				4B81402107240F550025D71C,
-				4B81402207240F550025D71C,
-				4B81402307240F550025D71C,
-				4B81402407240F550025D71C,
-			);
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				HEADER_SEARCH_PATHS = "../../../ ../../";
-				LIBRARY_STYLE = BUNDLE;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "-ljack  -framework CoreAudio  -framework AudioUnit  -framework CoreServices";
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
-				PRODUCT_NAME = jack_coreaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-			};
-			dependencies = (
-			);
-			isa = PBXLibraryTarget;
-			name = jack_coreaudio;
-			productInstallPath = /usr/local/lib;
-			productName = jack_coreaudio;
-			productReference = 4B81402607240F550025D71C;
-		};
-		4B81402607240F550025D71C = {
-			explicitFileType = "compiled.mach-o.dylib";
-			includeInIndex = 0;
-			isa = PBXFileReference;
-			path = jack_coreaudio.so;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		4B81402C07240F650025D71C = {
-			fileRef = 4B117C6605DD0C8700B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81402D07240F660025D71C = {
-			fileRef = 4B117C6305DD0C8000B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81402E07240F680025D71C = {
-			fileRef = 4B117C7205DD0C9D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81402F07240F690025D71C = {
-			fileRef = 4B89C95906F596060003AD09;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81403007240F6A0025D71C = {
-			fileRef = 4B117C6F05DD0C9900B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B81409407241E580025D71C = {
-			fileRef = 4B117C6905DD0C8D00B5DA5A;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4B8254140779F6AF0016C8D6 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = clientengine.c;
-			path = ../../../jackd/clientengine.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B89C95906F596060003AD09 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = thread.c;
-			path = ../../../libjack/thread.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4B89C95A06F596060003AD09 = {
-			fileRef = 4B89C95906F596060003AD09;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4BA1CAD90470D14500053105 = {
-			buildActionMask = 2147483647;
-			files = (
-				4BA1CAE60470D1FB00053105,
-				4BA1CAEA0470D1FD00053105,
-				4B5B51F0047D353A00053105,
-				4B117C7C05DD0CC000B5DA5A,
-				4B4DCBA305DD234100DC3452,
-				4B4DCBA605DD234800DC3452,
-				4B4DCBA905DD235B00DC3452,
-				4BA39A2005DD2C63008919E8,
-				4BA39A2405DD2CA5008919E8,
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADA0470D14500053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXResourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADB0470D14500053105 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B117C6505DD0C8000B5DA5A,
-				4B117C6805DD0C8700B5DA5A,
-				4B117C6B05DD0C8D00B5DA5A,
-				4B117C6E05DD0C9400B5DA5A,
-				4B117C7105DD0C9900B5DA5A,
-				4B117C7405DD0C9D00B5DA5A,
-				4B117C7705DD0CA000B5DA5A,
-				4B89C95A06F596060003AD09,
-				4B6683E40A2D8B2E00E8ADF8,
-				4B6683ED0A2D8C2A00E8ADF8,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADC0470D14500053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADD0470D14500053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADE0470D14500053105 = {
-			buildPhases = (
-				4BA1CAD90470D14500053105,
-				4BA1CADA0470D14500053105,
-				4BA1CADB0470D14500053105,
-				4BA1CADC0470D14500053105,
-				4BA1CADD0470D14500053105,
-			);
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				HEADER_SEARCH_PATHS = "../../ ../../../";
-				LIBRARY_SEARCH_PATHS = "";
-				OPTIMIZATION_CFLAGS = "-O3";
-				OTHER_LDFLAGS = "-framework CoreAudio ";
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = ./JACK_LOCATION.h;
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-				WRAPPER_EXTENSION = framework;
-			};
-			dependencies = (
-			);
-			isa = PBXFrameworkTarget;
-			name = "Jack framework";
-			productInstallPath = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-			productName = Jack;
-			productReference = 4BA1CADF0470D14500053105;
-			productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
-<plist version=\"1.0\">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>Jack</string>
-	<key>CFBundleGetInfoString</key>
-	<string>Jack Server 0.102.8, @03-06 Paul Davis, Grame</string>
-	<key>CFBundleIconFile</key>
-	<string></string>
-	<key>CFBundleIdentifier</key>
-	<string>com.grame.Jack</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>Jack</string>
-	<key>CFBundlePackageType</key>
-	<string>FMWK</string>
-	<key>CFBundleShortVersionString</key>
-	<string>Jack</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>0.102.8</string>
-</dict>
-</plist>
-";
-		};
-		4BA1CADF0470D14500053105 = {
-			explicitFileType = wrapper.framework;
-			isa = PBXFileReference;
-			path = Jack.framework;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		4BA1CAE60470D1FB00053105 = {
-			fileRef = 4B16FF900467B5A000053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4BA1CAEA0470D1FD00053105 = {
-			fileRef = 4BB9E091046FADED00053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4BA1CAFC0470D38800053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFD0470D38800053105 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBB605DD248300DC3452,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFE0470D38800053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFF0470D38800053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CB000470D38800053105 = {
-			buildPhases = (
-				4BA1CAFC0470D38800053105,
-				4BA1CAFD0470D38800053105,
-				4BA1CAFE0470D38800053105,
-				4BA1CAFF0470D38800053105,
-			);
-			buildSettings = {
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "-framework Jack";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_disconnect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-			};
-			dependencies = (
-			);
-			isa = PBXToolTarget;
-			name = jack_disconnect;
-			productInstallPath = /usr/local/bin;
-			productName = jack_disconnect;
-			productReference = 4BA1CB010470D38800053105;
-		};
-		4BA1CB010470D38800053105 = {
-			explicitFileType = "compiled.mach-o.executable";
-			isa = PBXFileReference;
-			path = jack_disconnect;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		4BA1E4530442D99D00053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4540442D99D00053105 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBBA05DD249E00DC3452,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4550442D99D00053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4560442D99D00053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4570442D99D00053105 = {
-			buildPhases = (
-				4BA1E4530442D99D00053105,
-				4BA1E4540442D99D00053105,
-				4BA1E4550442D99D00053105,
-				4BA1E4560442D99D00053105,
-			);
-			buildSettings = {
-				HEADER_SEARCH_PATHS = ../../;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "-framework Jack";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_lsp;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-			};
-			dependencies = (
-			);
-			isa = PBXToolTarget;
-			name = jack_lsp;
-			productInstallPath = /usr/local/bin;
-			productName = jack_lsp;
-			productReference = 4BA1E4580442D99D00053105;
-		};
-		4BA1E4580442D99D00053105 = {
-			explicitFileType = "compiled.mach-o.executable";
-			isa = PBXFileReference;
-			path = jack_lsp;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		4BA39A1E05DD2C63008919E8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = timestamps.h;
-			path = ../../../jack/timestamps.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4BA39A2005DD2C63008919E8 = {
-			fileRef = 4BA39A1E05DD2C63008919E8;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4BA39A2205DD2CA5008919E8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			name = jack.h;
-			path = ../../../jack/jack.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4BA39A2405DD2CA5008919E8 = {
-			fileRef = 4BA39A2205DD2CA5008919E8;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
-		4BA7165F0408DFF5004F4E3A = {
-			children = (
-				4B117C5805DD0C3600B5DA5A,
-				4B117C5A05DD0C4100B5DA5A,
-				4B8254140779F6AF0016C8D6,
-				4B117C5D05DD0C5B00B5DA5A,
-			);
-			isa = PBXGroup;
-			name = Server;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4BA716600408E047004F4E3A = {
-			children = (
-				4BA736DC079FE7E00041E425,
-				4B1A736907252DDC007105CE,
-				4B117C7F05DD0D7700B5DA5A,
-				4B117C8105DD0D7D00B5DA5A,
-			);
-			isa = PBXGroup;
-			name = Driver;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4BA736DC079FE7E00041E425 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.c;
-			name = coreaudio_driver.c;
-			path = ../../../drivers/coreaudio/coreaudio_driver.c;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4BA9D903040E0CC200053105 = {
-			children = (
-				4B77679E072D2BAD00F14709,
-				4B776799072D2B9500F14709,
-				4B776780072D2B5700F14709,
-				4B776785072D2B5700F14709,
-				4B776786072D2B5700F14709,
-				4B776787072D2B5700F14709,
-				4B776788072D2B5700F14709,
-				4B776789072D2B5700F14709,
-				4B77678A072D2B5700F14709,
-				4B77678E072D2B5700F14709,
-				4B77678F072D2B5700F14709,
-				4B776790072D2B5700F14709,
-				4B776791072D2B5700F14709,
-				4B776792072D2B5700F14709,
-				4B776793072D2B5700F14709,
-				4B776794072D2B5700F14709,
-				4B776795072D2B5700F14709,
-				4BA39A2205DD2CA5008919E8,
-				4BA39A1E05DD2C63008919E8,
-				4B4DCBA105DD234100DC3452,
-				4B4DCBA405DD234800DC3452,
-				4B4DCBA705DD235B00DC3452,
-			);
-			isa = PBXGroup;
-			name = Headers;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4BAA76A6047E0D5200053105 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = getopt.h;
-			refType = 2;
-			sourceTree = SOURCE_ROOT;
-		};
-		4BB9E091046FADED00053105 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.c.h;
-			path = mach_port.h;
-			refType = 4;
-			sourceTree = "<group>";
-		};
-		4BB9E097046FB05700053105 = {
-			fileRef = 4BB9E091046FADED00053105;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4BBB872C0406EF300019BE76 = {
-			buildActionMask = 2147483647;
-			files = (
-				4BB9E097046FB05700053105,
-				4B5B51EC047D353A00053105,
-				4B117C8205DD0D7D00B5DA5A,
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872D0406EF300019BE76 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B117C8005DD0D7700B5DA5A,
-				4B117C8305DD0DA700B5DA5A,
-				4B4DCB9405DD229F00DC3452,
-				4B4DCB9505DD22AF00DC3452,
-				4B4DCB9805DD22C300DC3452,
-				4B813FF007240D000025D71C,
-				4B81400707240DA30025D71C,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872E0406EF300019BE76 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872F0406EF300019BE76 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB87300406EF300019BE76 = {
-			buildPhases = (
-				4BBB872C0406EF300019BE76,
-				4BBB872D0406EF300019BE76,
-				4BBB872E0406EF300019BE76,
-				4BBB872F0406EF300019BE76,
-			);
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				HEADER_SEARCH_PATHS = "../../ ../../../";
-				LIBRARY_SEARCH_PATHS = "";
-				LIBRARY_STYLE = BUNDLE;
-				OPTIMIZATION_CFLAGS = "-O3";
-				OTHER_CFLAGS = "-DJACK_USE_MACH_THREADS";
-				OTHER_LDFLAGS = "-ljack -framework CoreAudio -framework AudioToolbox PortAudioLib ";
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_portaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-			};
-			dependencies = (
-			);
-			isa = PBXLibraryTarget;
-			name = jack_portaudio;
-			productInstallPath = /usr/local/lib;
-			productName = driver;
-			productReference = 4BBB87310406EF300019BE76;
-		};
-		4BBB87310406EF300019BE76 = {
-			explicitFileType = "compiled.mach-o.dylib";
-			isa = PBXFileReference;
-			path = jack_portaudio.so;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		4BCA25FE040B8B9400053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA25FF040B8B9400053105 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBAF05DD23DE00DC3452,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA2600040B8B9400053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA2601040B8B9400053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA2602040B8B9400053105 = {
-			buildPhases = (
-				4BCA25FE040B8B9400053105,
-				4BCA25FF040B8B9400053105,
-				4BCA2600040B8B9400053105,
-				4BCA2601040B8B9400053105,
-			);
-			buildSettings = {
-				HEADER_SEARCH_PATHS = ../../;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "-framework Jack";
-				OTHER_REZFLAGS = "";
-				PREBINDING = NO;
-				PRODUCT_NAME = jack_metro;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-			};
-			dependencies = (
-			);
-			isa = PBXToolTarget;
-			name = jack_metro;
-			productInstallPath = /usr/local/bin;
-			productName = metro;
-			productReference = 4BCA2603040B8B9400053105;
-		};
-		4BCA2603040B8B9400053105 = {
-			explicitFileType = "compiled.mach-o.executable";
-			isa = PBXFileReference;
-			path = jack_metro;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		4BE7704107A00B15001AA2F0 = {
-			fileRef = 4BA736DC079FE7E00041E425;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4BE7704207A00B15001AA2F0 = {
-			fileRef = 4B1A736907252DDC007105CE;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		4BF8712B040BDE8200053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXHeadersBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712C040BDE8200053105 = {
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBB305DD243A00DC3452,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712D040BDE8200053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712E040BDE8200053105 = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			isa = PBXRezBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712F040BDE8200053105 = {
-			buildPhases = (
-				4BF8712B040BDE8200053105,
-				4BF8712C040BDE8200053105,
-				4BF8712D040BDE8200053105,
-				4BF8712E040BDE8200053105,
-			);
-			buildSettings = {
-				HEADER_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "-framework Jack";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_connect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
-			};
-			dependencies = (
-			);
-			isa = PBXToolTarget;
-			name = jack_connect;
-			productInstallPath = /usr/local/bin;
-			productName = connect;
-			productReference = 4BF87130040BDE8200053105;
-		};
-		4BF87130040BDE8200053105 = {
-			explicitFileType = "compiled.mach-o.executable";
-			isa = PBXFileReference;
-			path = jack_connect;
-			refType = 3;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-	};
-	rootObject = 08FB7793FE84155DC02AAC07;
-}
diff --git a/config/os/macosx/jack.xcodeproj/project.pbxproj b/config/os/macosx/jack.xcodeproj/project.pbxproj
deleted file mode 100644
index 7e31d5e..0000000
--- a/config/os/macosx/jack.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,1667 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 42;
-	objects = {
-
-/* Begin PBXBuildFile section */
-		4B117C6505DD0C8000B5DA5A /* port.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6305DD0C8000B5DA5A /* port.c */; };
-		4B117C6805DD0C8700B5DA5A /* pool.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6605DD0C8700B5DA5A /* pool.c */; };
-		4B117C6B05DD0C8D00B5DA5A /* driver.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6905DD0C8D00B5DA5A /* driver.c */; };
-		4B117C6E05DD0C9400B5DA5A /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6C05DD0C9400B5DA5A /* ringbuffer.c */; };
-		4B117C7105DD0C9900B5DA5A /* transclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6F05DD0C9900B5DA5A /* transclient.c */; };
-		4B117C7405DD0C9D00B5DA5A /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7205DD0C9D00B5DA5A /* shm.c */; };
-		4B117C7705DD0CA000B5DA5A /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7505DD0CA000B5DA5A /* client.c */; };
-		4B117C7C05DD0CC000B5DA5A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B117C7A05DD0CC000B5DA5A /* config.h */; };
-		4B117C8005DD0D7700B5DA5A /* portaudio_driver.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7F05DD0D7700B5DA5A /* portaudio_driver.c */; };
-		4B117C8205DD0D7D00B5DA5A /* portaudio_driver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B117C8105DD0D7D00B5DA5A /* portaudio_driver.h */; };
-		4B117C8305DD0DA700B5DA5A /* driver.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6905DD0C8D00B5DA5A /* driver.c */; };
-		4B23C9310CB3B5CC00E87090 /* Jackframework-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4B23C9300CB3B5CC00E87090 /* Jackframework-Info.plist */; };
-		4B23C9320CB3B5CC00E87090 /* Jackframework-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4B23C9300CB3B5CC00E87090 /* Jackframework-Info.plist */; };
-		4B23C9380CB3B63800E87090 /* intclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C9370CB3B63800E87090 /* intclient.c */; };
-		4B23C9390CB3B63800E87090 /* intclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C9370CB3B63800E87090 /* intclient.c */; };
-		4B23C93B0CB3B63F00E87090 /* messagebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C93A0CB3B63F00E87090 /* messagebuffer.c */; };
-		4B23C93C0CB3B63F00E87090 /* messagebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C93A0CB3B63F00E87090 /* messagebuffer.c */; };
-		4B23C93E0CB3B65400E87090 /* simd.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C93D0CB3B65400E87090 /* simd.c */; };
-		4B23C93F0CB3B65400E87090 /* simd.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C93D0CB3B65400E87090 /* simd.c */; };
-		4B23C9410CB3B65F00E87090 /* unlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C9400CB3B65F00E87090 /* unlock.c */; };
-		4B23C9420CB3B65F00E87090 /* unlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B23C9400CB3B65F00E87090 /* unlock.c */; };
-		4B4DCB9405DD229F00DC3452 /* port.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6305DD0C8000B5DA5A /* port.c */; };
-		4B4DCB9505DD22AF00DC3452 /* pool.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6605DD0C8700B5DA5A /* pool.c */; };
-		4B4DCB9805DD22C300DC3452 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7205DD0C9D00B5DA5A /* shm.c */; };
-		4B4DCBA305DD234100DC3452 /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4DCBA105DD234100DC3452 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B4DCBA605DD234800DC3452 /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4DCBA405DD234800DC3452 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B4DCBA905DD235B00DC3452 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4DCBA705DD235B00DC3452 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B4DCBAF05DD23DE00DC3452 /* metro.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DCBAE05DD23DE00DC3452 /* metro.c */; };
-		4B4DCBB305DD243A00DC3452 /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DCBB205DD243A00DC3452 /* connect.c */; };
-		4B4DCBB605DD248300DC3452 /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DCBB205DD243A00DC3452 /* connect.c */; };
-		4B4DCBBA05DD249E00DC3452 /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B4DCBB905DD249E00DC3452 /* lsp.c */; };
-		4B5B51EC047D353A00053105 /* ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5B51EA047D353A00053105 /* ipc.h */; };
-		4B5B51F0047D353A00053105 /* ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5B51EA047D353A00053105 /* ipc.h */; };
-		4B6683E40A2D8B2E00E8ADF8 /* midiport.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B6683E30A2D8B2E00E8ADF8 /* midiport.c */; };
-		4B6683ED0A2D8C2A00E8ADF8 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B6683EC0A2D8C2A00E8ADF8 /* time.c */; };
-		4B77679A072D2B9500F14709 /* transengine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B776799072D2B9500F14709 /* transengine.h */; };
-		4B77679F072D2BAD00F14709 /* local.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B77679E072D2BAD00F14709 /* local.h */; };
-		4B7F53D20A470FE600075B93 /* pThreadUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B16FF900467B5A000053105 /* pThreadUtilities.h */; };
-		4B7F53D30A470FE600075B93 /* mach_port.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB9E091046FADED00053105 /* mach_port.h */; };
-		4B7F53D40A470FE600075B93 /* ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5B51EA047D353A00053105 /* ipc.h */; };
-		4B7F53D50A470FE600075B93 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B117C7A05DD0CC000B5DA5A /* config.h */; };
-		4B7F53D60A470FE600075B93 /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4DCBA105DD234100DC3452 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B7F53D70A470FE600075B93 /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4DCBA405DD234800DC3452 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B7F53D80A470FE600075B93 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4DCBA705DD235B00DC3452 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B7F53D90A470FE600075B93 /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA39A1E05DD2C63008919E8 /* timestamps.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B7F53DA0A470FE600075B93 /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA39A2205DD2CA5008919E8 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4B7F53DD0A470FE600075B93 /* port.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6305DD0C8000B5DA5A /* port.c */; };
-		4B7F53DE0A470FE600075B93 /* pool.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6605DD0C8700B5DA5A /* pool.c */; };
-		4B7F53DF0A470FE600075B93 /* driver.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6905DD0C8D00B5DA5A /* driver.c */; };
-		4B7F53E00A470FE600075B93 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6C05DD0C9400B5DA5A /* ringbuffer.c */; };
-		4B7F53E10A470FE600075B93 /* transclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6F05DD0C9900B5DA5A /* transclient.c */; };
-		4B7F53E20A470FE600075B93 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7205DD0C9D00B5DA5A /* shm.c */; };
-		4B7F53E30A470FE600075B93 /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7505DD0CA000B5DA5A /* client.c */; };
-		4B7F53E40A470FE600075B93 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89C95906F596060003AD09 /* thread.c */; };
-		4B7F53E50A470FE600075B93 /* midiport.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B6683E30A2D8B2E00E8ADF8 /* midiport.c */; };
-		4B7F53E60A470FE600075B93 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B6683EC0A2D8C2A00E8ADF8 /* time.c */; };
-		4B813FF007240D000025D71C /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89C95906F596060003AD09 /* thread.c */; };
-		4B81400707240DA30025D71C /* transclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6F05DD0C9900B5DA5A /* transclient.c */; };
-		4B81402C07240F650025D71C /* pool.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6605DD0C8700B5DA5A /* pool.c */; };
-		4B81402D07240F660025D71C /* port.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6305DD0C8000B5DA5A /* port.c */; };
-		4B81402E07240F680025D71C /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C7205DD0C9D00B5DA5A /* shm.c */; };
-		4B81402F07240F690025D71C /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89C95906F596060003AD09 /* thread.c */; };
-		4B81403007240F6A0025D71C /* transclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6F05DD0C9900B5DA5A /* transclient.c */; };
-		4B81409407241E580025D71C /* driver.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B117C6905DD0C8D00B5DA5A /* driver.c */; };
-		4B89C95A06F596060003AD09 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89C95906F596060003AD09 /* thread.c */; };
-		4BA1CAE60470D1FB00053105 /* pThreadUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B16FF900467B5A000053105 /* pThreadUtilities.h */; };
-		4BA1CAEA0470D1FD00053105 /* mach_port.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB9E091046FADED00053105 /* mach_port.h */; };
-		4BA39A2005DD2C63008919E8 /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA39A1E05DD2C63008919E8 /* timestamps.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4BA39A2405DD2CA5008919E8 /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA39A2205DD2CA5008919E8 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4BB9E097046FB05700053105 /* mach_port.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB9E091046FADED00053105 /* mach_port.h */; };
-		4BBB12790CB3C3DD00764FA8 /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB12780CB3C3DD00764FA8 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4BBB127A0CB3C3DD00764FA8 /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB12780CB3C3DD00764FA8 /* intclient.h */; };
-		4BBB12800CB3C42900764FA8 /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB127F0CB3C42900764FA8 /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4BBB12810CB3C42900764FA8 /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB127F0CB3C42900764FA8 /* midiport.h */; };
-		4BBB12830CB3C43B00764FA8 /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB12820CB3C43B00764FA8 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4BBB12840CB3C43B00764FA8 /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB12820CB3C43B00764FA8 /* statistics.h */; };
-		4BBB12910CB3C4B100764FA8 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B776793072D2B5700F14709 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		4BE7704107A00B15001AA2F0 /* coreaudio_driver.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA736DC079FE7E00041E425 /* coreaudio_driver.c */; };
-		4BE7704207A00B15001AA2F0 /* coreaudio_driver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1A736907252DDC007105CE /* coreaudio_driver.h */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
-		4B117C5805DD0C3600B5DA5A /* jackd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jackd.c; path = ../../../jackd/jackd.c; sourceTree = SOURCE_ROOT; };
-		4B117C5A05DD0C4100B5DA5A /* engine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = engine.c; path = ../../../jackd/engine.c; sourceTree = SOURCE_ROOT; };
-		4B117C5D05DD0C5B00B5DA5A /* transengine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transengine.c; path = ../../../jackd/transengine.c; sourceTree = SOURCE_ROOT; };
-		4B117C6305DD0C8000B5DA5A /* port.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = port.c; path = ../../../libjack/port.c; sourceTree = SOURCE_ROOT; };
-		4B117C6605DD0C8700B5DA5A /* pool.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pool.c; path = ../../../libjack/pool.c; sourceTree = SOURCE_ROOT; };
-		4B117C6905DD0C8D00B5DA5A /* driver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = driver.c; path = ../../../libjack/driver.c; sourceTree = SOURCE_ROOT; };
-		4B117C6C05DD0C9400B5DA5A /* ringbuffer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ringbuffer.c; path = ../../../libjack/ringbuffer.c; sourceTree = SOURCE_ROOT; };
-		4B117C6F05DD0C9900B5DA5A /* transclient.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transclient.c; path = ../../../libjack/transclient.c; sourceTree = SOURCE_ROOT; };
-		4B117C7205DD0C9D00B5DA5A /* shm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = shm.c; path = ../../../libjack/shm.c; sourceTree = SOURCE_ROOT; };
-		4B117C7505DD0CA000B5DA5A /* client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = client.c; path = ../../../libjack/client.c; sourceTree = SOURCE_ROOT; };
-		4B117C7A05DD0CC000B5DA5A /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../../../config.h; sourceTree = SOURCE_ROOT; };
-		4B117C7F05DD0D7700B5DA5A /* portaudio_driver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = portaudio_driver.c; path = ../../../drivers/portaudio/portaudio_driver.c; sourceTree = SOURCE_ROOT; };
-		4B117C8105DD0D7D00B5DA5A /* portaudio_driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = portaudio_driver.h; path = ../../../drivers/portaudio/portaudio_driver.h; sourceTree = SOURCE_ROOT; };
-		4B16FF900467B5A000053105 /* pThreadUtilities.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = pThreadUtilities.h; sourceTree = SOURCE_ROOT; };
-		4B1A736907252DDC007105CE /* coreaudio_driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = coreaudio_driver.h; path = ../../../drivers/coreaudio/coreaudio_driver.h; sourceTree = SOURCE_ROOT; };
-		4B23C9300CB3B5CC00E87090 /* Jackframework-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "Jackframework-Info.plist"; sourceTree = SOURCE_ROOT; };
-		4B23C9370CB3B63800E87090 /* intclient.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = intclient.c; path = ../../../libjack/intclient.c; sourceTree = SOURCE_ROOT; };
-		4B23C93A0CB3B63F00E87090 /* messagebuffer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = messagebuffer.c; path = ../../../libjack/messagebuffer.c; sourceTree = SOURCE_ROOT; };
-		4B23C93D0CB3B65400E87090 /* simd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = simd.c; path = ../../../libjack/simd.c; sourceTree = SOURCE_ROOT; };
-		4B23C9400CB3B65F00E87090 /* unlock.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = unlock.c; path = ../../../libjack/unlock.c; sourceTree = SOURCE_ROOT; };
-		4B4DCBA105DD234100DC3452 /* ringbuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ringbuffer.h; path = ../../../jack/ringbuffer.h; sourceTree = SOURCE_ROOT; };
-		4B4DCBA405DD234800DC3452 /* transport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = transport.h; path = ../../../jack/transport.h; sourceTree = SOURCE_ROOT; };
-		4B4DCBA705DD235B00DC3452 /* types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../../../jack/types.h; sourceTree = SOURCE_ROOT; };
-		4B4DCBAE05DD23DE00DC3452 /* metro.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = metro.c; path = "../../../example-clients/metro.c"; sourceTree = SOURCE_ROOT; };
-		4B4DCBB205DD243A00DC3452 /* connect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = connect.c; path = "../../../example-clients/connect.c"; sourceTree = SOURCE_ROOT; };
-		4B4DCBB905DD249E00DC3452 /* lsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lsp.c; path = "../../../example-clients/lsp.c"; sourceTree = SOURCE_ROOT; };
-		4B4DCBBD05DD24CD00DC3452 /* capture_client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = capture_client.c; path = "../../../example-clients/capture_client.c"; sourceTree = SOURCE_ROOT; };
-		4B5B51EA047D353A00053105 /* ipc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ipc.h; sourceTree = SOURCE_ROOT; };
-		4B6683E30A2D8B2E00E8ADF8 /* midiport.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midiport.c; path = ../../../libjack/midiport.c; sourceTree = SOURCE_ROOT; };
-		4B6683EC0A2D8C2A00E8ADF8 /* time.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = time.c; path = ../../../libjack/time.c; sourceTree = SOURCE_ROOT; };
-		4B776780072D2B5700F14709 /* atomicity.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = atomicity.h; path = ../../../jack/atomicity.h; sourceTree = SOURCE_ROOT; };
-		4B776785072D2B5700F14709 /* driver_interface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = driver_interface.h; path = ../../../jack/driver_interface.h; sourceTree = SOURCE_ROOT; };
-		4B776786072D2B5700F14709 /* driver_parse.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = driver_parse.h; path = ../../../jack/driver_parse.h; sourceTree = SOURCE_ROOT; };
-		4B776787072D2B5700F14709 /* driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = driver.h; path = ../../../jack/driver.h; sourceTree = SOURCE_ROOT; };
-		4B776788072D2B5700F14709 /* engine.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = engine.h; path = ../../../jack/engine.h; sourceTree = SOURCE_ROOT; };
-		4B776789072D2B5700F14709 /* hardware.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hardware.h; path = ../../../jack/hardware.h; sourceTree = SOURCE_ROOT; };
-		4B77678A072D2B5700F14709 /* jslist.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jslist.h; path = ../../../jack/jslist.h; sourceTree = SOURCE_ROOT; };
-		4B77678E072D2B5700F14709 /* memops.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = memops.h; path = ../../../jack/memops.h; sourceTree = SOURCE_ROOT; };
-		4B77678F072D2B5700F14709 /* pool.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pool.h; path = ../../../jack/pool.h; sourceTree = SOURCE_ROOT; };
-		4B776790072D2B5700F14709 /* port.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = port.h; path = ../../../jack/port.h; sourceTree = SOURCE_ROOT; };
-		4B776791072D2B5700F14709 /* shm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shm.h; path = ../../../jack/shm.h; sourceTree = SOURCE_ROOT; };
-		4B776792072D2B5700F14709 /* start.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = start.h; path = ../../../jack/start.h; sourceTree = SOURCE_ROOT; };
-		4B776793072D2B5700F14709 /* thread.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = thread.h; path = ../../../jack/thread.h; sourceTree = SOURCE_ROOT; };
-		4B776794072D2B5700F14709 /* unlock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = unlock.h; path = ../../../jack/unlock.h; sourceTree = SOURCE_ROOT; };
-		4B776795072D2B5700F14709 /* version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = version.h; path = ../../../jack/version.h; sourceTree = SOURCE_ROOT; };
-		4B776799072D2B9500F14709 /* transengine.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = transengine.h; path = ../../../jackd/transengine.h; sourceTree = SOURCE_ROOT; };
-		4B77679E072D2BAD00F14709 /* local.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = local.h; path = ../../../libjack/local.h; sourceTree = SOURCE_ROOT; };
-		4B7F53EA0A470FE600075B93 /* Jack.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jack.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-		4B81402607240F550025D71C /* jack_coreaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_coreaudio.so; sourceTree = BUILT_PRODUCTS_DIR; };
-		4B8254140779F6AF0016C8D6 /* clientengine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = clientengine.c; path = ../../../jackd/clientengine.c; sourceTree = SOURCE_ROOT; };
-		4B89C95906F596060003AD09 /* thread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = thread.c; path = ../../../libjack/thread.c; sourceTree = SOURCE_ROOT; };
-		4BA1CADF0470D14500053105 /* Jack.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Jack.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-		4BA1CB010470D38800053105 /* jack_disconnect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = jack_disconnect; sourceTree = BUILT_PRODUCTS_DIR; };
-		4BA1E4580442D99D00053105 /* jack_lsp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = jack_lsp; sourceTree = BUILT_PRODUCTS_DIR; };
-		4BA39A1E05DD2C63008919E8 /* timestamps.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = timestamps.h; path = ../../../jack/timestamps.h; sourceTree = SOURCE_ROOT; };
-		4BA39A2205DD2CA5008919E8 /* jack.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jack.h; path = ../../../jack/jack.h; sourceTree = SOURCE_ROOT; };
-		4BA736DC079FE7E00041E425 /* coreaudio_driver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = coreaudio_driver.c; path = ../../../drivers/coreaudio/coreaudio_driver.c; sourceTree = SOURCE_ROOT; };
-		4BAA76A6047E0D5200053105 /* getopt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = getopt.h; sourceTree = SOURCE_ROOT; };
-		4BB9E091046FADED00053105 /* mach_port.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mach_port.h; sourceTree = "<group>"; };
-		4BBB12780CB3C3DD00764FA8 /* intclient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = intclient.h; path = ../../../jack/intclient.h; sourceTree = SOURCE_ROOT; };
-		4BBB127F0CB3C42900764FA8 /* midiport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = midiport.h; path = ../../../jack/midiport.h; sourceTree = SOURCE_ROOT; };
-		4BBB12820CB3C43B00764FA8 /* statistics.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = statistics.h; path = ../../../jack/statistics.h; sourceTree = SOURCE_ROOT; };
-		4BBB87310406EF300019BE76 /* jack_portaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; path = jack_portaudio.so; sourceTree = BUILT_PRODUCTS_DIR; };
-		4BCA2603040B8B9400053105 /* jack_metro */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = jack_metro; sourceTree = BUILT_PRODUCTS_DIR; };
-		4BF87130040BDE8200053105 /* jack_connect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = jack_connect; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworkTarget section */
-		4BA1CADE0470D14500053105 /* Jack framework */ = {
-			isa = PBXFrameworkTarget;
-			buildConfigurationList = 4B29A19E0B53A60F00C7ED2F /* Build configuration list for PBXFrameworkTarget "Jack framework" */;
-			buildPhases = (
-				4BA1CAD90470D14500053105 /* Headers */,
-				4BA1CADA0470D14500053105 /* Resources */,
-				4BA1CADB0470D14500053105 /* Sources */,
-				4BA1CADC0470D14500053105 /* Frameworks */,
-				4BA1CADD0470D14500053105 /* Rez */,
-			);
-			dependencies = (
-			);
-			name = "Jack framework";
-			productInstallPath = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-			productName = Jack;
-			productReference = 4BA1CADF0470D14500053105 /* Jack.framework */;
-			productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
-<plist version=\"1.0\">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>Jack</string>
-	<key>CFBundleGetInfoString</key>
-	<string>Jack Server 0.102.8, @03-06 Paul Davis, Grame</string>
-	<key>CFBundleIconFile</key>
-	<string></string>
-	<key>CFBundleIdentifier</key>
-	<string>com.grame.Jack</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>Jack</string>
-	<key>CFBundlePackageType</key>
-	<string>FMWK</string>
-	<key>CFBundleShortVersionString</key>
-	<string>Jack</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>0.102.8</string>
-</dict>
-</plist>
-";
-		};
-/* End PBXFrameworkTarget section */
-
-/* Begin PBXFrameworksBuildPhase section */
-		4B7F53E70A470FE600075B93 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402307240F550025D71C /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADC0470D14500053105 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFE0470D38800053105 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4550442D99D00053105 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872E0406EF300019BE76 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA2600040B8B9400053105 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712D040BDE8200053105 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-		08FB7794FE84155DC02AAC07 /* jackd */ = {
-			isa = PBXGroup;
-			children = (
-				4B23C9300CB3B5CC00E87090 /* Jackframework-Info.plist */,
-				4BA9D903040E0CC200053105 /* Headers */,
-				4B6CBA33041F4DDF00053105 /* Porting_code */,
-				4B6AF278041F4DBC00053105 /* Samples */,
-				4BA716600408E047004F4E3A /* Driver */,
-				4BA7165F0408DFF5004F4E3A /* Server */,
-				08FB7795FE84155DC02AAC07 /* Client */,
-				1AB674ADFE9D54B511CA2CBB /* Products */,
-			);
-			name = jackd;
-			sourceTree = "<group>";
-		};
-		08FB7795FE84155DC02AAC07 /* Client */ = {
-			isa = PBXGroup;
-			children = (
-				4B89C95906F596060003AD09 /* thread.c */,
-				4B23C9370CB3B63800E87090 /* intclient.c */,
-				4B23C93D0CB3B65400E87090 /* simd.c */,
-				4B23C93A0CB3B63F00E87090 /* messagebuffer.c */,
-				4B117C6305DD0C8000B5DA5A /* port.c */,
-				4B117C6605DD0C8700B5DA5A /* pool.c */,
-				4B117C6905DD0C8D00B5DA5A /* driver.c */,
-				4B117C6C05DD0C9400B5DA5A /* ringbuffer.c */,
-				4B117C6F05DD0C9900B5DA5A /* transclient.c */,
-				4B117C7205DD0C9D00B5DA5A /* shm.c */,
-				4B117C7505DD0CA000B5DA5A /* client.c */,
-				4B6683E30A2D8B2E00E8ADF8 /* midiport.c */,
-				4B23C9400CB3B65F00E87090 /* unlock.c */,
-				4B6683EC0A2D8C2A00E8ADF8 /* time.c */,
-			);
-			name = Client;
-			sourceTree = "<group>";
-		};
-		1AB674ADFE9D54B511CA2CBB /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				4BBB87310406EF300019BE76 /* jack_portaudio.so */,
-				4BCA2603040B8B9400053105 /* jack_metro */,
-				4BF87130040BDE8200053105 /* jack_connect */,
-				4BA1E4580442D99D00053105 /* jack_lsp */,
-				4BA1CADF0470D14500053105 /* Jack.framework */,
-				4BA1CB010470D38800053105 /* jack_disconnect */,
-				4B81402607240F550025D71C /* jack_coreaudio.so */,
-				4B7F53EA0A470FE600075B93 /* Jack.framework */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
-		4B6AF278041F4DBC00053105 /* Samples */ = {
-			isa = PBXGroup;
-			children = (
-				4B4DCBAE05DD23DE00DC3452 /* metro.c */,
-				4B4DCBB205DD243A00DC3452 /* connect.c */,
-				4B4DCBB905DD249E00DC3452 /* lsp.c */,
-				4B4DCBBD05DD24CD00DC3452 /* capture_client.c */,
-			);
-			name = Samples;
-			sourceTree = "<group>";
-		};
-		4B6CBA33041F4DDF00053105 /* Porting_code */ = {
-			isa = PBXGroup;
-			children = (
-				4B117C7A05DD0CC000B5DA5A /* config.h */,
-				4B16FF900467B5A000053105 /* pThreadUtilities.h */,
-				4B5B51EA047D353A00053105 /* ipc.h */,
-				4BB9E091046FADED00053105 /* mach_port.h */,
-				4BAA76A6047E0D5200053105 /* getopt.h */,
-			);
-			name = Porting_code;
-			sourceTree = "<group>";
-		};
-		4BA7165F0408DFF5004F4E3A /* Server */ = {
-			isa = PBXGroup;
-			children = (
-				4B117C5805DD0C3600B5DA5A /* jackd.c */,
-				4B117C5A05DD0C4100B5DA5A /* engine.c */,
-				4B8254140779F6AF0016C8D6 /* clientengine.c */,
-				4B117C5D05DD0C5B00B5DA5A /* transengine.c */,
-			);
-			name = Server;
-			sourceTree = "<group>";
-		};
-		4BA716600408E047004F4E3A /* Driver */ = {
-			isa = PBXGroup;
-			children = (
-				4BA736DC079FE7E00041E425 /* coreaudio_driver.c */,
-				4B1A736907252DDC007105CE /* coreaudio_driver.h */,
-				4B117C7F05DD0D7700B5DA5A /* portaudio_driver.c */,
-				4B117C8105DD0D7D00B5DA5A /* portaudio_driver.h */,
-			);
-			name = Driver;
-			sourceTree = "<group>";
-		};
-		4BA9D903040E0CC200053105 /* Headers */ = {
-			isa = PBXGroup;
-			children = (
-				4BBB12820CB3C43B00764FA8 /* statistics.h */,
-				4BBB127F0CB3C42900764FA8 /* midiport.h */,
-				4BBB12780CB3C3DD00764FA8 /* intclient.h */,
-				4B77679E072D2BAD00F14709 /* local.h */,
-				4B776799072D2B9500F14709 /* transengine.h */,
-				4B776780072D2B5700F14709 /* atomicity.h */,
-				4B776785072D2B5700F14709 /* driver_interface.h */,
-				4B776786072D2B5700F14709 /* driver_parse.h */,
-				4B776787072D2B5700F14709 /* driver.h */,
-				4B776788072D2B5700F14709 /* engine.h */,
-				4B776789072D2B5700F14709 /* hardware.h */,
-				4B77678A072D2B5700F14709 /* jslist.h */,
-				4B77678E072D2B5700F14709 /* memops.h */,
-				4B77678F072D2B5700F14709 /* pool.h */,
-				4B776790072D2B5700F14709 /* port.h */,
-				4B776791072D2B5700F14709 /* shm.h */,
-				4B776792072D2B5700F14709 /* start.h */,
-				4B776793072D2B5700F14709 /* thread.h */,
-				4B776794072D2B5700F14709 /* unlock.h */,
-				4B776795072D2B5700F14709 /* version.h */,
-				4BA39A2205DD2CA5008919E8 /* jack.h */,
-				4BA39A1E05DD2C63008919E8 /* timestamps.h */,
-				4B4DCBA105DD234100DC3452 /* ringbuffer.h */,
-				4B4DCBA405DD234800DC3452 /* transport.h */,
-				4B4DCBA705DD235B00DC3452 /* types.h */,
-			);
-			name = Headers;
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
-		4B7F53D10A470FE600075B93 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B7F53D20A470FE600075B93 /* pThreadUtilities.h in Headers */,
-				4B7F53D30A470FE600075B93 /* mach_port.h in Headers */,
-				4B7F53D40A470FE600075B93 /* ipc.h in Headers */,
-				4B7F53D50A470FE600075B93 /* config.h in Headers */,
-				4B7F53D60A470FE600075B93 /* ringbuffer.h in Headers */,
-				4B7F53D70A470FE600075B93 /* transport.h in Headers */,
-				4B7F53D80A470FE600075B93 /* types.h in Headers */,
-				4B7F53D90A470FE600075B93 /* timestamps.h in Headers */,
-				4B7F53DA0A470FE600075B93 /* jack.h in Headers */,
-				4BBB12790CB3C3DD00764FA8 /* intclient.h in Headers */,
-				4BBB12800CB3C42900764FA8 /* midiport.h in Headers */,
-				4BBB12830CB3C43B00764FA8 /* statistics.h in Headers */,
-				4BBB12910CB3C4B100764FA8 /* thread.h in Headers */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402107240F550025D71C /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B77679A072D2B9500F14709 /* transengine.h in Headers */,
-				4B77679F072D2BAD00F14709 /* local.h in Headers */,
-				4BE7704207A00B15001AA2F0 /* coreaudio_driver.h in Headers */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAD90470D14500053105 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4BA1CAE60470D1FB00053105 /* pThreadUtilities.h in Headers */,
-				4BA1CAEA0470D1FD00053105 /* mach_port.h in Headers */,
-				4B5B51F0047D353A00053105 /* ipc.h in Headers */,
-				4B117C7C05DD0CC000B5DA5A /* config.h in Headers */,
-				4B4DCBA305DD234100DC3452 /* ringbuffer.h in Headers */,
-				4B4DCBA605DD234800DC3452 /* transport.h in Headers */,
-				4B4DCBA905DD235B00DC3452 /* types.h in Headers */,
-				4BA39A2005DD2C63008919E8 /* timestamps.h in Headers */,
-				4BA39A2405DD2CA5008919E8 /* jack.h in Headers */,
-				4BBB127A0CB3C3DD00764FA8 /* intclient.h in Headers */,
-				4BBB12810CB3C42900764FA8 /* midiport.h in Headers */,
-				4BBB12840CB3C43B00764FA8 /* statistics.h in Headers */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFC0470D38800053105 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4530442D99D00053105 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872C0406EF300019BE76 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4BB9E097046FB05700053105 /* mach_port.h in Headers */,
-				4B5B51EC047D353A00053105 /* ipc.h in Headers */,
-				4B117C8205DD0D7D00B5DA5A /* portaudio_driver.h in Headers */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA25FE040B8B9400053105 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712B040BDE8200053105 /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXLibraryTarget section */
-		4B81402507240F550025D71C /* jack_coreaudio */ = {
-			isa = PBXLibraryTarget;
-			buildConfigurationList = 4B29A1B60B53A60F00C7ED2F /* Build configuration list for PBXLibraryTarget "jack_coreaudio" */;
-			buildPhases = (
-				4B81402107240F550025D71C /* Headers */,
-				4B81402207240F550025D71C /* Sources */,
-				4B81402307240F550025D71C /* Frameworks */,
-				4B81402407240F550025D71C /* Rez */,
-			);
-			dependencies = (
-			);
-			name = jack_coreaudio;
-			productInstallPath = /usr/local/lib;
-			productName = jack_coreaudio;
-			productReference = 4B81402607240F550025D71C /* jack_coreaudio.so */;
-		};
-		4BBB87300406EF300019BE76 /* jack_portaudio */ = {
-			isa = PBXLibraryTarget;
-			buildConfigurationList = 4B29A1BA0B53A60F00C7ED2F /* Build configuration list for PBXLibraryTarget "jack_portaudio" */;
-			buildPhases = (
-				4BBB872C0406EF300019BE76 /* Headers */,
-				4BBB872D0406EF300019BE76 /* Sources */,
-				4BBB872E0406EF300019BE76 /* Frameworks */,
-				4BBB872F0406EF300019BE76 /* Rez */,
-			);
-			dependencies = (
-			);
-			name = jack_portaudio;
-			productInstallPath = /usr/local/lib;
-			productName = driver;
-			productReference = 4BBB87310406EF300019BE76 /* jack_portaudio.so */;
-		};
-/* End PBXLibraryTarget section */
-
-/* Begin PBXNativeTarget section */
-		4B7F53D00A470FE600075B93 /* Jack framework Universal */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = 4B29A1A20B53A60F00C7ED2F /* Build configuration list for PBXNativeTarget "Jack framework Universal" */;
-			buildPhases = (
-				4B7F53D10A470FE600075B93 /* Headers */,
-				4B7F53DB0A470FE600075B93 /* Resources */,
-				4B7F53DC0A470FE600075B93 /* Sources */,
-				4B7F53E70A470FE600075B93 /* Frameworks */,
-				4B7F53E80A470FE600075B93 /* Rez */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = "Jack framework Universal";
-			productInstallPath = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-			productName = Jack;
-			productReference = 4B7F53EA0A470FE600075B93 /* Jack.framework */;
-			productType = "com.apple.product-type.framework";
-		};
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-		08FB7793FE84155DC02AAC07 /* Project object */ = {
-			isa = PBXProject;
-			buildConfigurationList = 4B29A1BE0B53A60F00C7ED2F /* Build configuration list for PBXProject "jack" */;
-			hasScannedForEncodings = 1;
-			mainGroup = 08FB7794FE84155DC02AAC07 /* jackd */;
-			projectDirPath = "";
-			targets = (
-				4BA1CADE0470D14500053105 /* Jack framework */,
-				4B7F53D00A470FE600075B93 /* Jack framework Universal */,
-				4BCA2602040B8B9400053105 /* jack_metro */,
-				4BF8712F040BDE8200053105 /* jack_connect */,
-				4BA1CB000470D38800053105 /* jack_disconnect */,
-				4BA1E4570442D99D00053105 /* jack_lsp */,
-				4B81402507240F550025D71C /* jack_coreaudio */,
-				4BBB87300406EF300019BE76 /* jack_portaudio */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
-		4B7F53DB0A470FE600075B93 /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B23C9310CB3B5CC00E87090 /* Jackframework-Info.plist in Resources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADA0470D14500053105 /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B23C9320CB3B5CC00E87090 /* Jackframework-Info.plist in Resources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXRezBuildPhase section */
-		4B7F53E80A470FE600075B93 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402407240F550025D71C /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADD0470D14500053105 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFF0470D38800053105 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4560442D99D00053105 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872F0406EF300019BE76 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA2601040B8B9400053105 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712E040BDE8200053105 /* Rez */ = {
-			isa = PBXRezBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXRezBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
-		4B7F53DC0A470FE600075B93 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B7F53DD0A470FE600075B93 /* port.c in Sources */,
-				4B7F53DE0A470FE600075B93 /* pool.c in Sources */,
-				4B7F53DF0A470FE600075B93 /* driver.c in Sources */,
-				4B7F53E00A470FE600075B93 /* ringbuffer.c in Sources */,
-				4B7F53E10A470FE600075B93 /* transclient.c in Sources */,
-				4B7F53E20A470FE600075B93 /* shm.c in Sources */,
-				4B7F53E30A470FE600075B93 /* client.c in Sources */,
-				4B7F53E40A470FE600075B93 /* thread.c in Sources */,
-				4B7F53E50A470FE600075B93 /* midiport.c in Sources */,
-				4B7F53E60A470FE600075B93 /* time.c in Sources */,
-				4B23C9380CB3B63800E87090 /* intclient.c in Sources */,
-				4B23C93B0CB3B63F00E87090 /* messagebuffer.c in Sources */,
-				4B23C93E0CB3B65400E87090 /* simd.c in Sources */,
-				4B23C9410CB3B65F00E87090 /* unlock.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4B81402207240F550025D71C /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B81402C07240F650025D71C /* pool.c in Sources */,
-				4B81402D07240F660025D71C /* port.c in Sources */,
-				4B81402E07240F680025D71C /* shm.c in Sources */,
-				4B81402F07240F690025D71C /* thread.c in Sources */,
-				4B81403007240F6A0025D71C /* transclient.c in Sources */,
-				4B81409407241E580025D71C /* driver.c in Sources */,
-				4BE7704107A00B15001AA2F0 /* coreaudio_driver.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CADB0470D14500053105 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B117C6505DD0C8000B5DA5A /* port.c in Sources */,
-				4B117C6805DD0C8700B5DA5A /* pool.c in Sources */,
-				4B117C6B05DD0C8D00B5DA5A /* driver.c in Sources */,
-				4B117C6E05DD0C9400B5DA5A /* ringbuffer.c in Sources */,
-				4B117C7105DD0C9900B5DA5A /* transclient.c in Sources */,
-				4B117C7405DD0C9D00B5DA5A /* shm.c in Sources */,
-				4B117C7705DD0CA000B5DA5A /* client.c in Sources */,
-				4B89C95A06F596060003AD09 /* thread.c in Sources */,
-				4B6683E40A2D8B2E00E8ADF8 /* midiport.c in Sources */,
-				4B6683ED0A2D8C2A00E8ADF8 /* time.c in Sources */,
-				4B23C9390CB3B63800E87090 /* intclient.c in Sources */,
-				4B23C93C0CB3B63F00E87090 /* messagebuffer.c in Sources */,
-				4B23C93F0CB3B65400E87090 /* simd.c in Sources */,
-				4B23C9420CB3B65F00E87090 /* unlock.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1CAFD0470D38800053105 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBB605DD248300DC3452 /* connect.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BA1E4540442D99D00053105 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBBA05DD249E00DC3452 /* lsp.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BBB872D0406EF300019BE76 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B117C8005DD0D7700B5DA5A /* portaudio_driver.c in Sources */,
-				4B117C8305DD0DA700B5DA5A /* driver.c in Sources */,
-				4B4DCB9405DD229F00DC3452 /* port.c in Sources */,
-				4B4DCB9505DD22AF00DC3452 /* pool.c in Sources */,
-				4B4DCB9805DD22C300DC3452 /* shm.c in Sources */,
-				4B813FF007240D000025D71C /* thread.c in Sources */,
-				4B81400707240DA30025D71C /* transclient.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BCA25FF040B8B9400053105 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBAF05DD23DE00DC3452 /* metro.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		4BF8712C040BDE8200053105 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B4DCBB305DD243A00DC3452 /* connect.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXToolTarget section */
-		4BA1CB000470D38800053105 /* jack_disconnect */ = {
-			isa = PBXToolTarget;
-			buildConfigurationList = 4B29A1AE0B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_disconnect" */;
-			buildPhases = (
-				4BA1CAFC0470D38800053105 /* Headers */,
-				4BA1CAFD0470D38800053105 /* Sources */,
-				4BA1CAFE0470D38800053105 /* Frameworks */,
-				4BA1CAFF0470D38800053105 /* Rez */,
-			);
-			dependencies = (
-			);
-			name = jack_disconnect;
-			productInstallPath = /usr/local/bin;
-			productName = jack_disconnect;
-			productReference = 4BA1CB010470D38800053105 /* jack_disconnect */;
-		};
-		4BA1E4570442D99D00053105 /* jack_lsp */ = {
-			isa = PBXToolTarget;
-			buildConfigurationList = 4B29A1B20B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_lsp" */;
-			buildPhases = (
-				4BA1E4530442D99D00053105 /* Headers */,
-				4BA1E4540442D99D00053105 /* Sources */,
-				4BA1E4550442D99D00053105 /* Frameworks */,
-				4BA1E4560442D99D00053105 /* Rez */,
-			);
-			dependencies = (
-			);
-			name = jack_lsp;
-			productInstallPath = /usr/local/bin;
-			productName = jack_lsp;
-			productReference = 4BA1E4580442D99D00053105 /* jack_lsp */;
-		};
-		4BCA2602040B8B9400053105 /* jack_metro */ = {
-			isa = PBXToolTarget;
-			buildConfigurationList = 4B29A1A60B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_metro" */;
-			buildPhases = (
-				4BCA25FE040B8B9400053105 /* Headers */,
-				4BCA25FF040B8B9400053105 /* Sources */,
-				4BCA2600040B8B9400053105 /* Frameworks */,
-				4BCA2601040B8B9400053105 /* Rez */,
-			);
-			dependencies = (
-			);
-			name = jack_metro;
-			productInstallPath = /usr/local/bin;
-			productName = metro;
-			productReference = 4BCA2603040B8B9400053105 /* jack_metro */;
-		};
-		4BF8712F040BDE8200053105 /* jack_connect */ = {
-			isa = PBXToolTarget;
-			buildConfigurationList = 4B29A1AA0B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_connect" */;
-			buildPhases = (
-				4BF8712B040BDE8200053105 /* Headers */,
-				4BF8712C040BDE8200053105 /* Sources */,
-				4BF8712D040BDE8200053105 /* Frameworks */,
-				4BF8712E040BDE8200053105 /* Rez */,
-			);
-			dependencies = (
-			);
-			name = jack_connect;
-			productInstallPath = /usr/local/bin;
-			productName = connect;
-			productReference = 4BF87130040BDE8200053105 /* jack_connect */;
-		};
-/* End PBXToolTarget section */
-
-/* Begin XCBuildConfiguration section */
-		4B29A19F0B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				LIBRARY_SEARCH_PATHS = "";
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_LDFLAGS = (
-					"-framework",
-					CoreAudio,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = ./JACK_LOCATION.h;
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1A00B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				LIBRARY_SEARCH_PATHS = "";
-				OPTIMIZATION_CFLAGS = "-O3";
-				OTHER_LDFLAGS = (
-					"-framework",
-					CoreAudio,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = ./JACK_LOCATION.h;
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1A10B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				LIBRARY_SEARCH_PATHS = "";
-				OPTIMIZATION_CFLAGS = "-O3";
-				OTHER_LDFLAGS = (
-					"-framework",
-					CoreAudio,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = ./JACK_LOCATION.h;
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-			};
-			name = Default;
-		};
-		4B29A1A30B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = (
-					ppc,
-					i386,
-				);
-				COPY_PHASE_STRIP = NO;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PREFIX_HEADER = ./JACK_LOCATION.h;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				INFOPLIST_FILE = "Jackframework-Info.plist";
-				LIBRARY_SEARCH_PATHS = "";
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_LDFLAGS = (
-					"-framework",
-					CoreAudio,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1A40B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = (
-					ppc,
-					i386,
-				);
-				COPY_PHASE_STRIP = YES;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				GCC_OPTIMIZATION_LEVEL = 3;
-				GCC_PREFIX_HEADER = ./JACK_LOCATION.h;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				INFOPLIST_FILE = "Jackframework-Info.plist";
-				LIBRARY_SEARCH_PATHS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					CoreAudio,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1A50B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = (
-					ppc,
-					i386,
-				);
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_VERSION = A;
-				GCC_OPTIMIZATION_LEVEL = 3;
-				GCC_PREFIX_HEADER = ./JACK_LOCATION.h;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				INFOPLIST_FILE = "Jackframework-Info.plist";
-				LIBRARY_SEARCH_PATHS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					CoreAudio,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRINCIPAL_CLASS = "";
-				PRODUCT_NAME = Jack;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-			};
-			name = Default;
-		};
-		4B29A1A70B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				HEADER_SEARCH_PATHS = ../../;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PREBINDING = NO;
-				PRODUCT_NAME = jack_metro;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1A80B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				HEADER_SEARCH_PATHS = ../../;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PREBINDING = NO;
-				PRODUCT_NAME = jack_metro;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1A90B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				HEADER_SEARCH_PATHS = ../../;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PREBINDING = NO;
-				PRODUCT_NAME = jack_metro;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-			};
-			name = Default;
-		};
-		4B29A1AB0B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				HEADER_SEARCH_PATHS = "";
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_connect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1AC0B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				HEADER_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_connect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1AD0B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				HEADER_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_connect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-			};
-			name = Default;
-		};
-		4B29A1AF0B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_disconnect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1B00B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_disconnect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1B10B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_disconnect;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-			};
-			name = Default;
-		};
-		4B29A1B30B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				HEADER_SEARCH_PATHS = ../../;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_lsp;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1B40B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				HEADER_SEARCH_PATHS = ../../;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_lsp;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1B50B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				HEADER_SEARCH_PATHS = ../../;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-framework",
-					Jack,
-				);
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_lsp;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-			};
-			name = Default;
-		};
-		4B29A1B70B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				HEADER_SEARCH_PATHS = (
-					../../../,
-					../../,
-				);
-				LIBRARY_STYLE = BUNDLE;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-ljack",
-					"-framework",
-					CoreAudio,
-					"-framework",
-					AudioUnit,
-					"-framework",
-					CoreServices,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
-				PRODUCT_NAME = jack_coreaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1B80B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				HEADER_SEARCH_PATHS = (
-					../../../,
-					../../,
-				);
-				LIBRARY_STYLE = BUNDLE;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-ljack",
-					"-framework",
-					CoreAudio,
-					"-framework",
-					AudioUnit,
-					"-framework",
-					CoreServices,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
-				PRODUCT_NAME = jack_coreaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1B90B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				HEADER_SEARCH_PATHS = (
-					../../../,
-					../../,
-				);
-				LIBRARY_STYLE = BUNDLE;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = (
-					"-ljack",
-					"-framework",
-					CoreAudio,
-					"-framework",
-					AudioUnit,
-					"-framework",
-					CoreServices,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
-				PRODUCT_NAME = jack_coreaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-			};
-			name = Default;
-		};
-		4B29A1BB0B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				LIBRARY_SEARCH_PATHS = "";
-				LIBRARY_STYLE = BUNDLE;
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "-DJACK_USE_MACH_THREADS";
-				OTHER_LDFLAGS = (
-					"-ljack",
-					"-framework",
-					CoreAudio,
-					"-framework",
-					AudioToolbox,
-					PortAudioLib,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_portaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		4B29A1BC0B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				LIBRARY_SEARCH_PATHS = "";
-				LIBRARY_STYLE = BUNDLE;
-				OPTIMIZATION_CFLAGS = "-O3";
-				OTHER_CFLAGS = "-DJACK_USE_MACH_THREADS";
-				OTHER_LDFLAGS = (
-					"-ljack",
-					"-framework",
-					CoreAudio,
-					"-framework",
-					AudioToolbox,
-					PortAudioLib,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_portaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-		4B29A1BD0B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				HEADER_SEARCH_PATHS = (
-					../../,
-					../../../,
-				);
-				LIBRARY_SEARCH_PATHS = "";
-				LIBRARY_STYLE = BUNDLE;
-				OPTIMIZATION_CFLAGS = "-O3";
-				OTHER_CFLAGS = "-DJACK_USE_MACH_THREADS";
-				OTHER_LDFLAGS = (
-					"-ljack",
-					"-framework",
-					CoreAudio,
-					"-framework",
-					AudioToolbox,
-					PortAudioLib,
-				);
-				OTHER_LIBTOOL_FLAGS = "";
-				OTHER_REZFLAGS = "";
-				PRODUCT_NAME = jack_portaudio.so;
-				REZ_EXECUTABLE = YES;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-			};
-			name = Default;
-		};
-		4B29A1BF0B53A60F00C7ED2F /* Development */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-			};
-			name = Development;
-		};
-		4B29A1C00B53A60F00C7ED2F /* Deployment */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-			};
-			name = Deployment;
-		};
-		4B29A1C10B53A60F00C7ED2F /* Default */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-			};
-			name = Default;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		4B29A19E0B53A60F00C7ED2F /* Build configuration list for PBXFrameworkTarget "Jack framework" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A19F0B53A60F00C7ED2F /* Development */,
-				4B29A1A00B53A60F00C7ED2F /* Deployment */,
-				4B29A1A10B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1A20B53A60F00C7ED2F /* Build configuration list for PBXNativeTarget "Jack framework Universal" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1A30B53A60F00C7ED2F /* Development */,
-				4B29A1A40B53A60F00C7ED2F /* Deployment */,
-				4B29A1A50B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1A60B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_metro" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1A70B53A60F00C7ED2F /* Development */,
-				4B29A1A80B53A60F00C7ED2F /* Deployment */,
-				4B29A1A90B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1AA0B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_connect" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1AB0B53A60F00C7ED2F /* Development */,
-				4B29A1AC0B53A60F00C7ED2F /* Deployment */,
-				4B29A1AD0B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1AE0B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_disconnect" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1AF0B53A60F00C7ED2F /* Development */,
-				4B29A1B00B53A60F00C7ED2F /* Deployment */,
-				4B29A1B10B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1B20B53A60F00C7ED2F /* Build configuration list for PBXToolTarget "jack_lsp" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1B30B53A60F00C7ED2F /* Development */,
-				4B29A1B40B53A60F00C7ED2F /* Deployment */,
-				4B29A1B50B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1B60B53A60F00C7ED2F /* Build configuration list for PBXLibraryTarget "jack_coreaudio" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1B70B53A60F00C7ED2F /* Development */,
-				4B29A1B80B53A60F00C7ED2F /* Deployment */,
-				4B29A1B90B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1BA0B53A60F00C7ED2F /* Build configuration list for PBXLibraryTarget "jack_portaudio" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1BB0B53A60F00C7ED2F /* Development */,
-				4B29A1BC0B53A60F00C7ED2F /* Deployment */,
-				4B29A1BD0B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-		4B29A1BE0B53A60F00C7ED2F /* Build configuration list for PBXProject "jack" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				4B29A1BF0B53A60F00C7ED2F /* Development */,
-				4B29A1C00B53A60F00C7ED2F /* Deployment */,
-				4B29A1C10B53A60F00C7ED2F /* Default */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
-}
diff --git a/config/os/macosx/mach_port.h b/config/os/macosx/mach_port.h
deleted file mode 100644
index efa4839..0000000
--- a/config/os/macosx/mach_port.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-    Copyright © Grame 2003
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-    
-    Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
-    grame at rd.grame.fr
-*/
-
-#ifndef __mach_port__
-#define __mach_port__
-
-#include <mach/mach.h> 
-#include <mach/mach_types.h>
-#include <mach/message.h>
-    
-/* specific ressources for server/client real-time thread communication */
-typedef struct {
-    mach_msg_header_t header;
-    mach_msg_trailer_t trailer;
-} trivial_message;
-
-#endif
\ No newline at end of file
diff --git a/config/os/macosx/pThreadUtilities.h b/config/os/macosx/pThreadUtilities.h
deleted file mode 100644
index bd1d1e8..0000000
--- a/config/os/macosx/pThreadUtilities.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-	Copyright:	© Copyright 2002 Apple Computer, Inc. All rights
-			reserved.
-
-	Disclaimer:	IMPORTANT:  This Apple software is supplied to
-			you by Apple Computer, Inc.  ("Apple") in
-			consideration of your agreement to the
-			following terms, and your use, installation,
-			modification or redistribution of this Apple
-			software constitutes acceptance of these
-			terms.  If you do not agree with these terms,
-			please do not use, install, modify or
-			redistribute this Apple software.
-
-			In consideration of your agreement to abide by
-			the following terms, and subject to these
-			terms, Apple grants you a personal,
-			non-exclusive license, under AppleÕs
-			copyrights in this original Apple software
-			(the "Apple Software"), to use, reproduce,
-			modify and redistribute the Apple Software,
-			with or without modifications, in source
-			and/or binary forms; provided that if you
-			redistribute the Apple Software in its
-			entirety and without modifications, you must
-			retain this notice and the following text and
-			disclaimers in all such redistributions of the
-			Apple Software.  Neither the name, trademarks,
-			service marks or logos of Apple Computer,
-			Inc. may be used to endorse or promote
-			products derived from the Apple Software
-			without specific prior written permission from
-			Apple.  Except as expressly stated in this
-			notice, no other rights or licenses, express
-			or implied, are granted by Apple herein,
-			including but not limited to any patent rights
-			that may be infringed by your derivative works
-			or by other works in which the Apple Software
-			may be incorporated.
-
-			The Apple Software is provided by Apple on an
-			"AS IS" basis.  APPLE MAKES NO WARRANTIES,
-			EXPRESS OR IMPLIED, INCLUDING WITHOUT
-			LIMITATION THE IMPLIED WARRANTIES OF
-			NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
-			FOR A PARTICULAR PURPOSE, REGARDING THE APPLE
-			SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
-			COMBINATION WITH YOUR PRODUCTS.
-
-			IN NO EVENT SHALL APPLE BE LIABLE FOR ANY
-			SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
-			DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-			PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-			LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-			INTERRUPTION) ARISING IN ANY WAY OUT OF THE
-			USE, REPRODUCTION, MODIFICATION AND/OR
-			DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER
-			CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-			TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY
-			OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED
-			OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-/* pThreadUtilities.h */
-
-#ifndef __PTHREADUTILITIES_H__
-#define __PTHREADUTILITIES_H__
-
-#import "pthread.h"
-#import <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
-
-#define THREAD_SET_PRIORITY			0
-#define THREAD_SCHEDULED_PRIORITY		1
-
-#include <mach/mach_error.h>
-#include <mach/thread_policy.h>
-#include <mach/thread_act.h>
-#include <CoreAudio/HostTime.h>
-
-static inline UInt32
-_getThreadPriority(pthread_t inThread, int inWhichPriority)
-{
-    thread_basic_info_data_t	threadInfo;
-    policy_info_data_t		thePolicyInfo;
-    unsigned int		count;
-    
-    // get basic info
-    count = THREAD_BASIC_INFO_COUNT;
-    thread_info (pthread_mach_thread_np (inThread), THREAD_BASIC_INFO,
-		 (thread_info_t)&threadInfo, &count);
-
-    switch (threadInfo.policy) {
-        case POLICY_TIMESHARE:
-            count = POLICY_TIMESHARE_INFO_COUNT;
-            thread_info(pthread_mach_thread_np (inThread),
-			THREAD_SCHED_TIMESHARE_INFO,
-			(thread_info_t)&(thePolicyInfo.ts), &count);
-            if (inWhichPriority == THREAD_SCHEDULED_PRIORITY) {
-                return thePolicyInfo.ts.cur_priority;
-            } else {
-                return thePolicyInfo.ts.base_priority;
-            }
-        break;
-        
-        case POLICY_FIFO:
-            count = POLICY_FIFO_INFO_COUNT;
-            thread_info(pthread_mach_thread_np (inThread),
-			THREAD_SCHED_FIFO_INFO,
-			(thread_info_t)&(thePolicyInfo.fifo), &count);
-            if ( (thePolicyInfo.fifo.depressed)
-		 && (inWhichPriority == THREAD_SCHEDULED_PRIORITY) ) {
-                return thePolicyInfo.fifo.depress_priority;
-            }
-            return thePolicyInfo.fifo.base_priority;
-        break;
-        
-        case POLICY_RR:
-            count = POLICY_RR_INFO_COUNT;
-            thread_info(pthread_mach_thread_np (inThread),
-			THREAD_SCHED_RR_INFO,
-			(thread_info_t)&(thePolicyInfo.rr), &count);
-            if ( (thePolicyInfo.rr.depressed)
-		 && (inWhichPriority == THREAD_SCHEDULED_PRIORITY) ) {
-                return thePolicyInfo.rr.depress_priority;
-            }
-            return thePolicyInfo.rr.base_priority;
-        break;
-    }
-    
-    return 0;
-}
-
-// returns the thread's priority as it was last set by the API
-static inline UInt32
-getThreadSetPriority(pthread_t inThread)
-{
-    return _getThreadPriority (inThread, THREAD_SET_PRIORITY);
-}
-
-// returns the thread's priority as it was last scheduled by the Kernel
-static inline UInt32
-getThreadScheduledPriority(pthread_t inThread)
-{
-    return _getThreadPriority (inThread, THREAD_SCHEDULED_PRIORITY);
-}
-
-
-static inline void
-setThreadToPriority(pthread_t inThread, UInt32 inPriority, Boolean inIsFixed,
-		    UInt64 inHALIOProcCycleDurationInNanoseconds)
-{
-	if (inPriority == 96)
-	{
-            // REAL-TIME / TIME-CONSTRAINT THREAD
-            thread_time_constraint_policy_data_t	theTCPolicy;
-            UInt64					theComputeQuanta;
-            UInt64					thePeriod;
-            UInt64					thePeriodNanos;
-		
-            thePeriodNanos = inHALIOProcCycleDurationInNanoseconds;
-            theComputeQuanta = AudioConvertNanosToHostTime ( thePeriodNanos * 0.15 );
-            thePeriod = AudioConvertNanosToHostTime (thePeriodNanos);
-        
-            theTCPolicy.period = thePeriod;
-            theTCPolicy.computation = theComputeQuanta;
-            theTCPolicy.constraint = thePeriod;
-            theTCPolicy.preemptible = true;
-            thread_policy_set (pthread_mach_thread_np(inThread),
-			       THREAD_TIME_CONSTRAINT_POLICY,
-			       (thread_policy_t)&theTCPolicy,
-			       THREAD_TIME_CONSTRAINT_POLICY_COUNT);
-	} else {
-            // OTHER THREADS
-            thread_extended_policy_data_t		theFixedPolicy;
-            thread_precedence_policy_data_t		thePrecedencePolicy;
-            SInt32					relativePriority;
-        
-            // [1] SET FIXED / NOT FIXED
-            theFixedPolicy.timeshare = !inIsFixed;
-            thread_policy_set (pthread_mach_thread_np(inThread),
-			       THREAD_EXTENDED_POLICY,
-			       (thread_policy_t)&theFixedPolicy,
-			       THREAD_EXTENDED_POLICY_COUNT);
-        
-            // [2] SET PRECEDENCE N.B.: We expect that if thread A
-            // created thread B, and the program wishes to change the
-            // priority of thread B, then the call to change the
-            // priority of thread B must be made by thread A.  This
-            // assumption allows us to use pthread_self() to correctly
-            // calculate the priority of the feeder thread (since
-            // precedency policy's importance is relative to the
-            // spawning thread's priority.)
-            relativePriority = inPriority -
-		    getThreadSetPriority (pthread_self());
-        
-            thePrecedencePolicy.importance = relativePriority;
-            thread_policy_set (pthread_mach_thread_np(inThread),
-			       THREAD_PRECEDENCE_POLICY,
-			       (thread_policy_t)&thePrecedencePolicy,
-			       THREAD_PRECEDENCE_POLICY_COUNT);
-	}
-}
-
-#endif	/* __PTHREADUTILITIES_H__ */
diff --git a/config/os/macosx/poll.h b/config/os/macosx/poll.h
deleted file mode 100644
index 6a49e0d..0000000
--- a/config/os/macosx/poll.h
+++ /dev/null
@@ -1,162 +0,0 @@
-
-// fakepoll.h
-// poll using select
-// Warning: a call to this poll() takes about 4K of stack space.
-
-// Greg Parker     gparker-web at sealiesoftware.com     December 2000
-// This code is in the public domain and may be copied or modified without 
-// permission. 
-
-// Updated May 2002: 
-// * fix crash when an fd is less than 0
-// * set errno=EINVAL if an fd is greater or equal to FD_SETSIZE
-// * don't set POLLIN or POLLOUT in revents if it wasn't requested 
-//   in events (only happens when an fd is in the poll set twice)
-
-#ifndef _FAKE_POLL_H
-#define _FAKE_POLL_H
-
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-
-typedef struct pollfd {
-    int fd;                         /* file desc to poll */
-    short events;                   /* events of interest on fd */
-    short revents;                  /* events that occurred on fd */
-} pollfd_t;
-
-
-// poll flags
-#define POLLIN  0x0001
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-
-// synonyms
-#define POLLNORM POLLIN
-#define POLLPRI POLLIN
-#define POLLRDNORM POLLIN
-#define POLLRDBAND POLLIN
-#define POLLWRNORM POLLOUT
-#define POLLWRBAND POLLOUT
-
-// ignored
-#define POLLHUP 0x0010
-#define POLLNVAL 0x0020
-
-static inline int 
-poll(struct pollfd *pollSet, int pollCount, int pollTimeout)
-{
-    struct timeval tv;
-    struct timeval *tvp;
-    fd_set readFDs, writeFDs, exceptFDs;
-    fd_set *readp, *writep, *exceptp;
-    struct pollfd *pollEnd, *p;
-    int selected;
-    int result;
-    int maxFD;
-
-    if (!pollSet) {
-        pollEnd = NULL;
-        readp = NULL;
-        writep = NULL;
-        exceptp = NULL;
-        maxFD = 0;
-    } 
-    else {
-        pollEnd = pollSet + pollCount;
-        readp = &readFDs;
-        writep = &writeFDs;
-        exceptp = &exceptFDs;
-
-        FD_ZERO(readp);
-        FD_ZERO(writep);
-        FD_ZERO(exceptp);
-        
-        // Find the biggest fd in the poll set
-        maxFD = 0;
-        for (p = pollSet; p < pollEnd; p++) {
-            if (p->fd > maxFD) maxFD = p->fd;
-        }
-
-        if (maxFD >= FD_SETSIZE) {
-            // At least one fd is too big
-            errno = EINVAL;
-            return -1;
-        }
-        
-        // Transcribe flags from the poll set to the fd sets
-        for (p = pollSet; p < pollEnd; p++) {
-            if (p->fd < 0) {
-                // Negative fd checks nothing and always reports zero
-            } else {
-                if (p->events & POLLIN)  FD_SET(p->fd, readp);
-                if (p->events & POLLOUT) FD_SET(p->fd, writep);
-                if (p->events != 0)     {
-                    FD_SET(p->fd, exceptp);
-                }
-                // POLLERR is never set coming in; poll() always reports errors
-                // But don't report if we're not listening to anything at all.
-            }
-        }
-    }
-        
-    // poll timeout is in milliseconds. Convert to struct timeval.
-    // poll timeout == -1 : wait forever : select timeout of NULL
-    // poll timeout == 0  : return immediately : select timeout of zero
-    if (pollTimeout >= 0) {
-        tv.tv_sec = pollTimeout / 1000;
-        tv.tv_usec = (pollTimeout % 1000) * 1000;
-        tvp = &tv;
-    } else {
-        tvp = NULL;
-    }
-    
-    selected = select(maxFD+1, readp, writep, exceptp, tvp);
- 
-    if (selected < 0) {
-        // Error during select
-        result = -1;
-    } 
-    else if (selected > 0) {
-        // Select found something
-        // Transcribe result from fd sets to poll set.
-        // Also count the number of selected fds. poll returns the 
-        // number of ready fds; select returns the number of bits set.
-        int polled = 0;
-        for (p = pollSet; p < pollEnd; p++) {
-	    p->revents = 0;
-            if (p->fd < 0) {
-                // Negative fd always reports zero
-            } else {
-                if ((p->events & POLLIN)  &&  FD_ISSET(p->fd, readp)) {
-                    p->revents |= POLLIN;
-                }
-                if ((p->events & POLLOUT)  &&  FD_ISSET(p->fd, writep)) {
-                    p->revents |= POLLOUT;
-                }
-                if ((p->events != 0)  &&  FD_ISSET(p->fd, exceptp)) {
-                     p->revents |= POLLERR;
-                }
-
-                if (p->revents) polled++;
-            }
-	}
-        result = polled;
-    }
-    else {
-	// selected == 0, select timed out before anything happened
-        // Clear all result bits and return zero.
-        for (p = pollSet; p < pollEnd; p++) {
-            p->revents = 0;
-        }
-        result = 0;
-    }
-
-    return result;
-}
-
-#endif
diff --git a/config/os/macosx/sanitycheck.c b/config/os/macosx/sanitycheck.c
deleted file mode 100644
index 2f818c7..0000000
--- a/config/os/macosx/sanitycheck.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <jack/sanitycheck.h>
-
-int
-sanitycheck (int a, int b)
-{
-	return 0;
-}
diff --git a/config/os/macosx/time.c b/config/os/macosx/time.c
deleted file mode 100644
index 4c8ebb5..0000000
--- a/config/os/macosx/time.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_time_c__
-#define __jack_time_c__
-
-#include <jack/types.h>
-#include <mach/mach_time.h>
-
-double __jack_time_ratio;
-
-void 
-jack_init_time ()
-{
-        mach_timebase_info_data_t info; 
-        mach_timebase_info(&info);
-        __jack_time_ratio = ((float)info.numer/info.denom) / 1000;
-}
-
-void jack_set_clock_source (jack_timer_type_t clocksrc)
-{
-	/* only one clock source for os x */
-}
-
-#endif /* __jack_time_c__ */
diff --git a/config/os/macosx/time.h b/config/os/macosx/time.h
deleted file mode 100644
index b384098..0000000
--- a/config/os/macosx/time.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_time_h__
-#define __jack_time_h__
-
-#include <jack/types.h>
-#include <mach/mach_time.h>
-
-extern double __jack_time_ratio;
-
-static inline jack_time_t 
-jack_get_microseconds(void) 
-{  
-        return  (jack_time_t) mach_absolute_time () * __jack_time_ratio;
-}
-
-#endif /* __jack_time_h__ */
diff --git a/config/sysdeps/.cvsignore b/config/sysdeps/.cvsignore
deleted file mode 100644
index eb92105..0000000
--- a/config/sysdeps/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-*.h
diff --git a/config/sysdeps/Makefile.am b/config/sysdeps/Makefile.am
deleted file mode 100644
index aa3a725..0000000
--- a/config/sysdeps/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-# systemtest.c and sanitycheck.c are not .h file's 
-# but they behaves like one, and need to be included
-# in the tarball.
-
-noinst_HEADERS =		\
-        systemtest.c            \
-        sanitycheck.c           \
-	atomicity.h		\
-	cycles.h		\
-	getopt.h		\
-	ipc.h			\
-	mach_port.h		\
-	pThreadUtilities.h	\
-	poll.h			\
-	portaudio.h		\
-	time.c			\
-	time.h
diff --git a/config/sysdeps/atomicity.h b/config/sysdeps/atomicity.h
deleted file mode 100644
index 94b5e08..0000000
--- a/config/sysdeps/atomicity.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _jack_sysdep_atomicity_h_
-#define _jack_sysdep_atomicity_h_
-
-#if defined(__i386__)
-
-#include <config/cpu/i386/atomicity.h>
-
-#elif defined(__x86_64)
-
-/* x86_64 can use rdtsc just like i[456]86 */
-
-#include <config/cpu/i386/atomicity.h>
-
-#elif defined(__powerpc__) || defined(__ppc__) /* linux and OSX use different tokens */
-
-#include <config/cpu/powerpc/atomicity.h>
-
-#else
-
-#include <config/cpu/generic/atomicity.h>
-
-#endif /* processor selection */
-
-#endif /* _jack_sysdep_atomicity_h_ */
diff --git a/config/sysdeps/cycles.h b/config/sysdeps/cycles.h
deleted file mode 100644
index eac039e..0000000
--- a/config/sysdeps/cycles.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _jack_sysdep_cycles_h_
-#define _jack_sysdep_cycles_h_
-
-#if defined(__i386__)
-    
-/* technically, i386 doesn't have a cycle counter, but
-   running JACK on a real i386 seems like a ridiculuous
-   target and gcc defines this for the entire x86 family
-   including the [456]86 that do have the counter.
-*/
-
-#include <config/cpu/i386/cycles.h>
-
-#elif defined(__x86_64)
-
-#include <config/cpu/i486/cycles.h>
-
-#elif defined(__powerpc__) || defined(__ppc__)   /* linux and OSX gcc use different tokens */
-
-#include <config/cpu/powerpc/cycles.h>
-
-#else
-
-#include <config/cpu/generic/cycles.h>
-
-#endif /* processor selection */
-
-#endif /* _jack_sysdep_cycles_h_ */
diff --git a/config/sysdeps/getopt.h b/config/sysdeps/getopt.h
deleted file mode 100644
index d790320..0000000
--- a/config/sysdeps/getopt.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _jack_sysdep_getopt_h_
-#define _jack_sysdep_getopt_h_
-
-#if defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/getopt.h>
-#endif
-
-#endif /* _jack_sysdep_getopt_h_ */
diff --git a/config/sysdeps/ipc.h b/config/sysdeps/ipc.h
deleted file mode 100644
index 7c200ac..0000000
--- a/config/sysdeps/ipc.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _jack_sysdep_ipc_h_
-#define _jack_sysdep_ipc_h_
-
-#if defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/ipc.h>
-#else
-#include <config/os/generic/ipc.h>
-#endif
-
-#endif /* _jack_sysdep_ipc_h_ */
diff --git a/config/sysdeps/mach_port.h b/config/sysdeps/mach_port.h
deleted file mode 100644
index af2e0ca..0000000
--- a/config/sysdeps/mach_port.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _jack_sysdep_mach_port_h_
-#define _jack_sysdep_mach_port_h_
-
-#if defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/mach_port.h>
-#endif
-
-#endif /* _jack_sysdep_mach_port_h_ */
diff --git a/config/sysdeps/pThreadUtilities.h b/config/sysdeps/pThreadUtilities.h
deleted file mode 100644
index b0e4e60..0000000
--- a/config/sysdeps/pThreadUtilities.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _jack_sysdep_pThreadUtilities_h_
-#define _jack_sysdep_pThreadUtilities_h_
-
-#if defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/pThreadUtilities.h>
-#endif
-
-#endif /* _jack_sysdep_pThreadUtilities_h_ */
diff --git a/config/sysdeps/poll.h b/config/sysdeps/poll.h
deleted file mode 100644
index 663ac4d..0000000
--- a/config/sysdeps/poll.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _jack_sysdep_poll_h_
-#define _jack_sysdep_poll_h_
-
-#if defined(__MACH__) && defined(__APPLE__)
-
-#include <config/os/macosx/poll.h>
-
-#else
-
-#include <poll.h>
-
-#endif
-
-#endif /* _jack_sysdep_poll_h_ */
diff --git a/config/sysdeps/portaudio.h b/config/sysdeps/portaudio.h
deleted file mode 100644
index 2b3adfe..0000000
--- a/config/sysdeps/portaudio.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _jack_sysdep_portaudio_h_
-#define _jack_sysdep_portaudio_h_
-
-#if defined(__MACH__) && defined(__APPLE__)
-#include <PortAudio.h>
-#endif
-
-#endif /* _jack_sysdep_portaudio_h_ */
diff --git a/config/sysdeps/sanitycheck.c b/config/sysdeps/sanitycheck.c
deleted file mode 100644
index 982e663..0000000
--- a/config/sysdeps/sanitycheck.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _jack_sysdep_sanitycheck_c_
-#define _jack_sysdep_sanitycheck_c_
-
-#if defined(__gnu_linux__)
-#include <config/os/gnu-linux/sanitycheck.c>
-#elif defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/sanitycheck.c>
-#else
-#include <config/os/generic/sanitycheck.c>
-#endif
-
-#endif /* _jack_sysdep_sanitycheck_c_ */
diff --git a/config/sysdeps/systemtest.c b/config/sysdeps/systemtest.c
deleted file mode 100644
index 7afa3ec..0000000
--- a/config/sysdeps/systemtest.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _jack_sysdep_systemtest_c_
-#define _jack_sysdep_systemtest_c_
-
-#if defined(__gnu_linux__)
-#include <config/os/gnu-linux/systemtest.c>
-#elif defined(__MACH__) && defined(__APPLE__)
-/* relax */
-#else
-/* relax */
-#endif
-
-#endif /* _jack_sysdep_systemtest_c_ */
diff --git a/config/sysdeps/time.c b/config/sysdeps/time.c
deleted file mode 100644
index aef49de..0000000
--- a/config/sysdeps/time.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _jack_sysdep_time_c_
-#define _jack_sysdep_time_c_
-
-#if defined(__gnu_linux__)
-#include <config/os/gnu-linux/time.c>
-#elif defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/time.c>
-#else
-#include <config/os/generic/time.c>
-#endif
-
-#endif /* _jack_sysdep_time_c_ */
diff --git a/config/sysdeps/time.h b/config/sysdeps/time.h
deleted file mode 100644
index ff87b53..0000000
--- a/config/sysdeps/time.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _jack_sysdep_time_h_
-#define _jack_sysdep_time_h_
-
-#if defined(__gnu_linux__)
-#include <config/os/gnu-linux/time.h>
-#elif defined(__MACH__) && defined(__APPLE__)
-#include <config/os/macosx/time.h>
-#else
-#include <config/os/generic/time.h>
-#endif
-
-#endif /* _jack_sysdep_time_h_ */
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 8c84a5f..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,979 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-dnl $Id: configure.ac 3792 2009-11-15 22:43:43Z paul $
-
-AC_INIT(jackd/jackd.c)
-
-
-dnl
-dnl Check for existing JACK installs
-dnl 
-
-AC_MSG_CHECKING([existing, conflicting JACK installs])
-not_overwriting=0
-installs=
-for dir in /usr/lib /usr/local/lib /opt/lib ; do
-    if test -d $dir ; then
-	if test $(find $dir/ -name 'libjack.*' 2>/dev/null | wc -l) -gt 0 ; then
-	    if echo $prefix/lib | grep -vs $dir >/dev/null 2>&1 ; then
-		not_overwriting=$(expr $not_overwriting + 1)
-	    fi
-	    installs="$installs $dir"
-	fi	    
-    fi
-done
-
-if test $not_overwriting -gt 0 ; then
-    echo 
-    echo
-    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-    echo "You appear to have at least one existing installation of JACK."
-    echo
-    echo "Complete or partial JACK installs exist in:$installs"
-    echo 
-    echo "Installing this version will leave at least one of these"
-    echo "existing installations installed and this will probably break"
-    echo "JACK on your machine. "
-    echo
-    echo "Before building, you should first remove the existing JACK"
-    echo "installation(s). "
-    echo
-    echo "Alternatively use ./configure --prefix=... to force overwriting"
-    echo "the existing install."
-    echo
-    echo "WARNING: ON ANY DEBIAN-DERIVED DISTRIBUTION (Debian, Ubuntu etc)"
-    echo "CHANGING THE INSTALLATION PREFIX WILL NOT PRODUCE A WORKING JACK"
-    echo "INSTALL. Please contact the distribution packager for JACK and"
-    echo "ask them to fix their packaging."
-    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-    exit 1
-fi
-
-AC_CONFIG_AUX_DIR(config)
-AC_CANONICAL_TARGET
-
-dnl ---
-dnl HOWTO: updating the JACK version number
-dnl
-dnl major version = ask on jackit-devel :)
-dnl minor version = incremented when any of the public or internal
-dnl                 interfaces are changed
-dnl micro version = incremented when implementation-only
-dnl                 changes are made
-dnl ---
-JACK_MAJOR_VERSION=0
-JACK_MINOR_VERSION=118
-JACK_MICRO_VERSION=0
-
-dnl ---
-dnl HOWTO: updating the jack protocol version
-dnl
-dnl increment the protocol version whenever a change is
-dnl made to the way libjack communicates with jackd
-dnl that would break applications statically linked with an older
-dnl version of libjack. NOTE: statically linking to libjack
-dnl is a huge mistake.
-dnl ---
-JACK_PROTOCOL_VERSION=24
-
-dnl ---
-dnl HOWTO: updating the libjack interface version
-dnl
-dnl current = incremented whenever the public libjack API is changed 
-dnl revision = incremented when the libjack implementation is changed
-dnl age = current libjack is both source and binary compatible with
-dnl       libjack interfaces current,current-1,...,current-age
-dnl
-dnl Note! see libtool documentation for detailed documentation
-dnl
-dnl Note Also! until we reach CURRENT>=1, the rules are somewhat
-dnl slacker than this, and closer to those for the JACK version
-dnl number.
-dnl ---
-JACK_API_CURRENT=0
-JACK_API_REVISION=28
-JACK_API_AGE=0
-
-AC_SUBST(JACK_MAJOR_VERSION)
-AC_SUBST(JACK_MINOR_VERSION)
-AC_SUBST(JACK_MICRO_VERSION)
-
-AC_SUBST(JACK_PROTOCOL_VERSION)
-AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "$JACK_PROTOCOL_VERSION", [Protocol version])
-
-AC_SUBST(JACK_API_MAJOR_VERSION)
-AC_SUBST(JACK_API_MINOR_VERSION)
-AC_SUBST(JACK_API_MICRO_VERSION)
-
-JACK_SO_VERSION=${JACK_API_CURRENT}:${JACK_API_REVISION}:${JACK_API_AGE}
-
-JACK_VERSION=$JACK_MAJOR_VERSION.$JACK_MINOR_VERSION.${JACK_MICRO_VERSION}${BETA}
-JACK_RELEASE=$JACK_MAJOR_VERSION-$JACK_MINOR_VERSION-${JACK_MICRO_VERSION}${BETA}
-
-AC_SUBST(JACK_SO_VERSION)
-AC_SUBST(JACK_VERSION)
-AC_SUBST(JACK_RELEASE)
-
-AM_INIT_AUTOMAKE(jack-audio-connection-kit,${JACK_VERSION})
-
-dnl
-dnl save any user-provided CFLAGS so we can forget
-dnl about any nonsense that configure generates
-dnl 
-
-ORIGINAL_CFLAGS="$CFLAGS"
-
-AM_CONFIG_HEADER(config.h)
-AC_ENABLE_STATIC(no)
-AC_ENABLE_SHARED(yes)
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_LD
-AM_PROG_LIBTOOL
-AC_PROG_LN_S
-AM_PROG_CC_C_O
-AC_C_BIGENDIAN
-
-dnl
-dnl now use those user-provided CFLAGS
-dnl and dump whatever nonsense configure generated
-dnl while looking for a compiler
-dnl
-
-CFLAGS="$ORIGINAL_CFLAGS"
-
-AC_MSG_CHECKING([platform dependencies])
-
-HOST_DEFAULT_TMP_DIR=/dev/shm
-case "${host_os}" in
-  freebsd*)
-    # current FreeBSD header files conflict with the OSS driver's
-    # barrier code, this may be fixed in 5.3, stay tuned.
-    USE_BARRIER="no"
-    ;;
-  openbsd*)
-    # pthread_barrier* not implemented
-    USE_BARRIER="no"
-    # need small realtime stack
-    JACK_THREAD_STACK_TOUCH=10000
-    ;;
-  darwin*)
-    JACK_THREAD_STACK_TOUCH=10000	# need small realtime stack
-    JACK_CPP_VARARGS_BROKEN=1
-    JACK_DO_NOT_MLOCK=1
-    JACK_USE_MACH_THREADS=1
-    OS_LDFLAGS="-framework CoreAudio -framework CoreServices -framework AudioUnit"
-    TRY_POSIX_SHM=yes			# POSIX shm works better
-    HOST_DEFAULT_TMP_DIR=/tmp
-    ;;
-esac
-
-AC_SUBST(OS_LDFLAGS)
-
-#
-# We need to establish suitable defaults for a 64-bit OS
-libnn=lib
-case "${host_os}" in
-    linux*)
-    case "${host_cpu}" in
-	x86_64|mips64|ppc64|sparc64|s390x)
-        libnn=lib64
-	;;
-    esac
-    ;;
-    solaris*)
-    ## libnn=lib/sparcv9 ## on 64-bit only, but that's compiler-specific
-    ;;  
-esac
-
-## take care not to  override the command-line setting
-if test "${libdir}" = '${exec_prefix}/lib'; then
-  libdir='${exec_prefix}/'${libnn}
-fi
-
-# system-dependent config.h values
-test "x$JACK_THREAD_STACK_TOUCH" = "x" && JACK_THREAD_STACK_TOUCH=500000
-AC_DEFINE_UNQUOTED(JACK_THREAD_STACK_TOUCH,
-	[$JACK_THREAD_STACK_TOUCH],
-	[Guaranteed size of realtime stack])
-if test "x$JACK_CPP_VARARGS_BROKEN" != "x"; then
-    AC_DEFINE_UNQUOTED(JACK_CPP_VARARGS_BROKEN,
-	[$JACK_CPP_VARARGS_BROKEN],
-	[CPP has a broken varargs implementation])
-fi
-if test "x$JACK_USE_MACH_THREADS" != "x"; then
-    AC_DEFINE_UNQUOTED(JACK_USE_MACH_THREADS,
-	[$JACK_USE_MACH_THREADS],
-	[Use MACH threads where possible])
-fi
-
-# headers
-AC_CHECK_HEADERS(string.h strings.h alloca.h)
-AC_CHECK_HEADERS(getopt.h, [], [
-    for d in /Developer/SDKs/MacOSX10.3.0.sdk/usr/include/ ; do
-	AC_CHECK_HEADERS($d/getopt.h, [], [CFLAGS="$CFLAGS -I$d"])
-    done])
-AC_CHECK_HEADER(/usr/include/nptl/pthread.h,
-	[CFLAGS="$CFLAGS -I/usr/include/nptl"])
-
-# functions and libraries
-AC_CHECK_FUNC(getopt_long, [],
-    AC_MSG_ERROR([*** JACK requires GNU getopt_long]))
-AC_CHECK_FUNC(gethostent, [], AC_CHECK_LIB(nsl, gethostent))
-AC_CHECK_FUNC(setsockopt, [], AC_CHECK_LIB(socket, setsockopt))
-AC_CHECK_FUNC(connect, [], AC_CHECK_LIB(inet, connect))
-AC_CHECK_FUNC(dlopen, [], 
-    AC_CHECK_LIB(dl, dlopen, [],
-	AC_MSG_ERROR([*** JACK requires dynamic load support])))
-AC_CHECK_FUNC(pthread_create, [],
-    AC_CHECK_LIB(pthread, pthread_create, [],
-	AC_MSG_ERROR([*** JACK requires POSIX threads support])))
-AC_CHECK_FUNCS(on_exit atexit)
-AC_CHECK_FUNCS(posix_memalign)
-AC_CHECK_LIB(m, sin)
-
-echo -n "Checking for ppoll()... "
-AC_EGREP_CPP( ppoll,
-[
-#define _GNU_SOURCE
-#include <poll.h>
-], [
-    	AC_DEFINE(HAVE_PPOLL,1,"Whether ppoll is available")
-	echo "yes"
-   ],[
-    	AC_DEFINE(HAVE_PPOLL,0,"Whether ppoll is available")
-	echo "no"
-   ] )
-
-	 
-
-AC_CHECK_FUNC(clock_gettime, 
-       [
-           AC_DEFINE(HAVE_CLOCK_GETTIME,0,"Whether or not clock_gettime can be found in system libraries")
-       ], 
-       #
-       # if not found, check librt specifically
-       #
-       AC_CHECK_LIB(rt, clock_gettime, 
-           [
-              AC_DEFINE(HAVE_CLOCK_GETTIME,1,"Whether or not clock_gettime can be found in system libraries")
-	      OS_LDFLAGS="$OS_LDFLAGS -lrt"
-	   ])
-)	  
-
-# should we use mlockall() on this platform?
-if test "x$JACK_DO_NOT_MLOCK" = "x"; then
-    AC_CHECK_HEADER(sys/mman.h,
-        [AC_CHECK_FUNC(mlockall,
-	    [AC_DEFINE(USE_MLOCK, 1, [Use POSIX memory locking])])])
-fi
-
-# look for system support for POSIX shm API
-AC_ARG_ENABLE(posix-shm,
-	AC_HELP_STRING([--enable-posix-shm], [use POSIX shm API (default=auto)]),
-	[TRY_POSIX_SHM=$enableval])
-if test "x$TRY_POSIX_SHM" = "xyes"
-then
-	AC_CHECK_FUNC(shm_open, [],
-		AC_CHECK_LIB(rt, shm_open, [], [TRY_POSIX_SHM=no]))
-fi
-AC_MSG_CHECKING([shared memory support])
-if test "x$TRY_POSIX_SHM" = "xyes"
-then
-	AC_MSG_RESULT([POSIX shm_open().])
-	AC_DEFINE(USE_POSIX_SHM,1,[Use POSIX shared memory interface])
-	JACK_SHM_TYPE='"POSIX"'
-	USE_POSIX_SHM="true"
-else
-	AC_MSG_RESULT([System V shmget().])
-	JACK_SHM_TYPE='"System V"'
-	USE_POSIX_SHM="false"
-fi
-AC_DEFINE_UNQUOTED(JACK_SHM_TYPE, [$JACK_SHM_TYPE],
-	[JACK shared memory type])
-AM_CONDITIONAL(USE_POSIX_SHM, $USE_POSIX_SHM)
-
-JACK_CORE_CFLAGS="-I\$(top_srcdir)/config -I\$(top_srcdir) \
--I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wall"
-
-JACK_LIBC_HELPER_FLAGS=
-AC_ARG_ENABLE(ancient_libc,
-	AC_HELP_STRING([--enable-ancient-libc],[Add required CFLAGS for libc versions too old to expose PThread R/W Lock and other modern code]),
-	JACK_LIBC_HELPER_FLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE",
-	JACK_LIBC_HELPER_FLAGS=""
-	)
-	 
-JACK_CORE_CFLAGS="$JACK_CORE_CFLAGS $JACK_LIBC_HELPER_FLAGS"   
-
-AC_ARG_WITH(cpu-target,
-            [  --with-cpu-target=cpu-type    explicit, overriding argument for gcc -march= flag])
-
-
-dnl
-dnl figure out how best to optimize
-dnl JOQ: this should be done via config/configure.hosts
-dnl
-
-dnl ----------------------------------------------------------------------
-
-if test "$target_cpu" = "powerpc64" ; then
-
-    AC_ARG_ENABLE(cell,
-	AC_HELP_STRING([--enable-cell],[enable Cell BE support (default=no)]),,
-	[ enable_cell=no ])
-
-    if test "x$enable_cell" = xyes; then
-        AC_DEFINE(ENABLE_CELLBE, 1, [Define to 1 if you need support for the Cell BE.])
-    fi
-
-fi
-
-if test "$target_cpu" = "powerpc" -o "$target_cpu" = "powerpc64" ; then
-
-    AC_DEFINE(POWERPC, 1, "Are we running a ppc CPU?")
-    
-############################
-# Check for Altivec assembly
-############################
-
-    AC_ARG_ENABLE(altivec,
-	AC_HELP_STRING([--enable-altivec],[enable Altivec support (default=auto)]),,
-	[ enable_altivec=yes ])
-    
-    if test "x$enable_altivec" = xyes; then
-	
-	AC_MSG_CHECKING(whether we can compile Altivec code)
-	
-	AC_COMPILE_IFELSE([asm ("vand %v0, %v0, %v0");],
-	    AC_DEFINE(USE_ALTIVEC, 1, [Define to 1 if Altivec assembly is available.])
-	    AC_DEFINE(HAVE_ALTIVEC_LINUX, 1, "Is there Altivec Support ?")
-	    ALTIVEC_OPT_FLAGS="-maltivec -mabi=altivec"
-	    AC_MSG_RESULT(yes)
-	    ,
-	    enable_altivec=no
-	    AC_MSG_RESULT(no)
-	    AC_MSG_WARN([The assembler does not support the Altivec command set.])
-	)
-	
-    fi
-
-    dnl -mcpu=7450 does not reliably work with gcc 3.*
-    
-    JACK_OPT_CFLAGS="-O2 -mcpu=7400 $ALTIVEC_OPT_FLAGS -mhard-float -mpowerpc-gfxopt"
-
-    if test "$target_cpu" = "powerpc64"; then
-	JACK_OPT_CFLAGS="-O2 -mcpu=powerpc64 $ALTIVEC_OPT_FLAGS -mhard-float" 
-    fi
-
-elif echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null; then
-
-    dnl Check for MMX/SSE assembly
-    
-    if test -r /proc/cpuinfo ; then
-	procflags=`grep '^flags' /proc/cpuinfo`
-	if echo $procflags | grep -s mmx ; then
-	    cpu_supports_mmx=yes
-	fi
-	if echo $procflags | grep -s sse ; then
-	    cpu_supports_sse=yes
-	fi
-    else
-	# this is not linux, but assume that if the processor
-	# is x86 then is supports SSE and not MMX
-        cpu_supports_sse=yes
-	AC_MSG_WARN([Assuming your x86/x86_64 system can support SSE. Use --disable-sse if this is not the case])
-        cpu_supports_mmx=no
-	AC_MSG_WARN([Assuming your x86/x86_64 system does not need to use MMX. Use --enable-mmx if this is not the case])
-    fi
-    
-    AC_ARG_ENABLE(optimization-by-compiler,
-	AC_HELP_STRING([--enable-optimization-by-compiler],[use compiler (NOT processor) capabilities to determine optimization flags (default=no)]),
-	optimization_by_compiler=yes,
-	optimization_by_compiler=no
-    )
-    
-    AC_ARG_ENABLE(optimization-by-cpu,
-	AC_HELP_STRING([--enable-optimization-by-cpu],[use processor capabilities to determine optimization flags (default=yes)]),,
-	optimization_by_cpu=yes
-    )
-    
-    AC_ARG_ENABLE(mmx,
-	AC_HELP_STRING([--enable-mmx],[enable MMX support (default=auto)]),,
-	enable_mmx=yes)
-    
-    AC_ARG_ENABLE(sse,
-	AC_HELP_STRING([--enable-sse],[enable SSE support (default=auto)]),,
-	enable_sse=$enable_mmx)
-    
-    if test "x$enable_mmx" = xyes; then
-	
-	AC_MSG_CHECKING(whether we can compile MMX code)
-	
-	AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],
-	    
-	    AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
-	    AC_MSG_RESULT(yes)
-	    
-	    if test x$optimization_by_cpu = xyes ; then
-		if test x$cpu_supports_mmx = xyes ; then
-		    MMX_FLAGS="-mmmx"
-		fi
-	    else 
-		MMX_FLAGS="-mmmx"
-	    fi
-	    
-	    AC_MSG_RESULT(yes)
-	    ,
-	    enable_mmx=no
-	    AC_MSG_RESULT(no)
-	    AC_MSG_WARN([The assembler does not support the MMX command set.])
-	)
-    fi
-
-    if test "x$enable_sse" = xyes; then
-	
-	AC_MSG_CHECKING(whether we can compile SSE code)
-	
-	AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
-	    [
-		if test x$optimization_by_cpu = xyes ; then
-		    if test x$cpu_supports_sse = xyes ; then
-			SSE_FLAGS="-msse -mfpmath=sse"
-			MMX_FLAGS=""
-		    fi
-		else 
-		    SSE_FLAGS="-msse -mfpmath=sse"
-		    MMX_FLAGS=""
-		fi
-		
-		AC_MSG_RESULT(yes)
-		],
-	    [
-		enable_sse=no
-		AC_MSG_RESULT(no)
-		AC_MSG_WARN([The assembler does not support the SSE command set.]) 
-		])
-    fi
-    
-    AC_DEFINE(x86, 1, "Nope it's intel")
-    COMMON_X86_OPT_FLAGS="-O3 -fomit-frame-pointer -ffast-math -funroll-loops"
-
-dnl
-dnl its a little sad that OS X doesn't make it possible to identify 
-dnl the target_cpu a little more precisely. on os x we always get "i386"
-dnl as the CPU type. we miss out on some possible optimizations as 
-dnl a result. oh well.
-dnl     
-    
-    if test x$with_cpu_target != x ; then
-        JACK_OPT_CFLAGS="-march=$with_cpu_target"
-    else
-        if test "$target_cpu" = "i586"; then
-	   JACK_OPT_CFLAGS="-march=i586 "
-	elif test "$target_cpu" = "i686"; then
-	    JACK_OPT_CFLAGS="-march=i686"
-	elif test "$target_cpu" = "x86_64"; then
-	    JACK_OPT_CFLAGS="-march=k8"
-	else
-	    :
-	fi
-    fi
-
-dnl
-dnl do not add h/w specific flags if asked to let compiler
-dnl to the optimization
-dnl    
-
-    if test x$optimization_by_compiler != xyes ; then
-        JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $JACK_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS"
-    else
-       JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS"
-    fi
-
-fi
-
-AC_ARG_ENABLE(dynsimd,
-	AC_HELP_STRING([--enable-dynsimd],[enable dynamic SIMD selection (default=no)]),,
-    enable_dynsimd=no)
-
-if test "x$enable_dynsimd" = xyes; then
-	AC_DEFINE(USE_DYNSIMD, 1, [Define to 1 to use dynamic SIMD selection.])
-	dnl This needs update once there's more than x86/x86-64 supported
-	SIMD_CFLAGS="-O -msse -msse2 -m3dnow"
-	AC_SUBST(SIMD_CFLAGS)
-fi
-
-AC_ARG_ENABLE(optimize,
-    AC_HELP_STRING([--enable-optimize],
-	[optimize code, based on CPU or compiler, as separately selected (default=no)]),
-    [ if test x$enable_optimize != xno ; then
-	AC_MSG_WARN([optimization in use.........................])
-      else
-        # no optimization, so lets get debugging symbols instead
-	JACK_OPT_CFLAGS="-g"
-	AC_MSG_WARN([no optimization.........................])
-      fi 
-    ],
-    [
-        # no optimization, so lets get debugging symbols instead
-	JACK_OPT_CFLAGS="-g"
-	AC_MSG_WARN([no optimization.........................])
-    ]
-)
-
-JACK_CFLAGS="$JACK_CORE_CFLAGS $JACK_OPT_CFLAGS"
-
-dnl
-dnl most makefiles use JACK_CFLAGS, but simd code needs JACK_CORE_CFLAGS
-dnl
-
-AC_SUBST(JACK_CFLAGS)
-AC_SUBST(JACK_CORE_CFLAGS)
-
-dnl
-dnl use JACK_CFLAGS for jackd compilation
-dnl 
-
-CFLAGS="$CFLAGS $JACK_CFLAGS"
-
-# allow buffer resizing unless --disable-resize specified
-buffer_resizing=yes
-AC_ARG_ENABLE(resize,
-	AC_HELP_STRING([--enable-resize], [enable buffer resizing feature (default=yes)]),
-        [ 
-	  if test x$enable_resize = xno ; then
-	  	buffer_resizing=no
-	  fi
-	 ]
-)
-
-if test x$buffer_resizing != xno; then 
-   AC_DEFINE(DO_BUFFER_RESIZE,,[Enable buffer resizing])
-fi
-
-
-AC_ARG_ENABLE(ensure-mlock,
-	AC_HELP_STRING([--enable-ensure-mlock], [server should fail if unable to lock memory (default=no)]),
-        [ 
-	  if test x$enable_ensure_mlock != xno ; then
-	  	AC_DEFINE(ENSURE_MLOCK,,[Ensure that memory locking succeeds])
-	  fi
-	]
-)
-
-AC_ARG_ENABLE(debug,
-	AC_HELP_STRING([--enable-debug],
-		[enable debugging messages in jackd and libjack (default=no)]),
-        [ 
-	  if test x$enable_debug != xno ; then
-	     AC_DEFINE(DEBUG_ENABLED,,[Enable debugging messages])
-          fi
-        ]
-)
-
-AC_ARG_ENABLE(timestamps,
-	AC_HELP_STRING([--enable-timestamps],
-		[allow clients to use the JACK timestamp API (JACK developers only) (default=no)]),
-        [ 
-	  if test x$enable_timestamps != xno ; then
-	  	AC_DEFINE(WITH_TIMESTAMPS,,[Enable JACK timestamp API])
-          fi
-        ]		
-)
-
-AC_ARG_ENABLE(preemption-check,
-	AC_HELP_STRING([--enable-preemption-check],
-		[check for inappropriate realtime preemption (requires a specially built Linux kernel) (default=no)]),
-		[
-		  if test x$enable_preemption_check != xno ; then
-			echo checking for realtime preemption bugs
-			AC_DEFINE(DO_PREEMPTION_CHECKING,,
-				[check realtime preemption])
-		  fi
-		])
-
-USE_CAPABILITIES=false
-
-AC_ARG_ENABLE(capabilities,
-	AC_HELP_STRING([--enable-capabilities],[!!! LINUX 2.4 KERNELS ONLY !!! use libcap to gain realtime scheduling priviledges]),
-              [ if test "x$enable_capabilities" != "xno" ; then
-                    AC_CHECK_LIB(cap, capgetp,
-                                 [AC_CHECK_HEADER(sys/capability.h,
-                                                  [HAVE_CAPABILITIES=true],
-                                                  [AC_MSG_WARN([*** no kernel support for capabilities])
-                                                   HAVE_CAPABILITIES=false]
-                                  )],
-                                 [AC_MSG_WARN([*** no libcap present])
-                                  HAVE_CAPABILITIES=false]
-                    )
-                    if test "x$HAVE_CAPABILITIES" = "xtrue"; then
-                        AC_CHECK_PROG(HAVE_CAPABILITIES, md5sum, true, false)
-                    fi
-                    if test "x$HAVE_CAPABILITIES" = "xfalse"; then
-                        AC_MSG_WARN([*** required program md5sum not found])
-                    fi
-                    if test "x$HAVE_CAPABILITIES" = "xfalse"; then
-                        AC_MSG_ERROR([*** Capabilities support not present. Run configure again without --enable-capabilities.])
-                    fi
-                    USE_CAPABILITIES=true
-                    AC_DEFINE(USE_CAPABILITIES,,[Enable POSIX 1.e capabilities support])
-                fi
-              ]
-)
-
-with_oldtrans=yes
-AC_ARG_ENABLE(oldtrans,
-	AC_HELP_STRING([--disable-oldtrans],[remove old transport interfaces (default=yes)]),
-              [ if test "x$enable_oldtrans" = "xno" ; then
-		    with_oldtrans=no
-		fi 
-	      ]
-)
-if test "x$with_oldtrans" != "xno" ; then
-	AC_DEFINE(OLD_TRANSPORT,,[Include old transport interfaces])
-fi
-
-STRIPPED_JACKD=false
-AC_ARG_ENABLE(stripped-jackd,
-	AC_HELP_STRING([--enable-stripped-jackd],[strip jack before computing its md5 sum (useful only with Linux 2.4 kernel)]),
-              [ if test "x$USE_CAPABILITIES" != "xtrue" ; then	    
-                    AC_MSG_WARN([*** capabilities not enabled, stripped jackd has no effect])
-                elif test "x$enable_stripped_jackd" != "xno"; then
-                    STRIPPED_JACKD=true		    
-                fi  
-              ]	
-)
-
-# plugins go in the addon dir.
-
-ADDON_DIR='${libdir}/jack'
-AC_SUBST(ADDON_DIR)
-AS_AC_EXPAND(ADDON_DIR_EXPANDED,${libdir}/jack)
-AC_DEFINE_UNQUOTED(ADDON_DIR,"$ADDON_DIR_EXPANDED",[Directory for plugins])
-
-AC_ARG_WITH(html-dir,
-		AC_HELP_STRING([--with-html-dir=PATH],[where to install the html documentation]))
-
-if test "x$with_html_dir" = "x" ; then
-    HTML_DIR='${pkgdatadir}'
-else
-    HTML_DIR=$with_html_dir
-fi
-
-AC_SUBST(HTML_DIR)
-
-
-# allow specifying default tmpdir
-AC_ARG_WITH(default-tmpdir,
-            AC_HELP_STRING([--with-default-tmpdir],[where jackd and clients will put tmp files (default=/dev/shm)]))
-
-if test "x$with_default_tmpdir" = "x" ; then
-	DEFAULT_TMP_DIR=$HOST_DEFAULT_TMP_DIR
-else
-	DEFAULT_TMP_DIR=$with_default_tmpdir
-fi
-
-AC_SUBST(DEFAULT_TMP_DIR)
-AC_DEFINE_UNQUOTED(DEFAULT_TMP_DIR,"$DEFAULT_TMP_DIR",[Default tmp directory])
-
-# Check for barrier functions in the pthreads library.  The default
-# option setting may be OS-dependent, otherwise it's "yes".
-test "x$USE_BARRIER" = "x" && USE_BARRIER="yes"
-AC_ARG_WITH(barrier,
-	AC_HELP_STRING([--without-barrier],
-		       [avoid using pthread barrier functions (only used by OSS driver)]),
-	[ USE_BARRIER=$withval ])
-if test "x$USE_BARRIER" = "xyes"; then
-	AC_CHECK_LIB([pthread], [pthread_barrier_init],
-		AC_DEFINE(USE_BARRIER, 1, [Use pthread barrier functions]))
-fi
-
-# some example-clients need libsndfile
-HAVE_SNDFILE=false
-PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0,[HAVE_SNDFILE=true], [true])
-if test x$HAVE_SNDFILE = xfalse; then
-             AC_MSG_WARN([*** the jackrec example client will not be built])
-fi
-
-# NetJack backend and internal client need libsamplerate
-HAVE_SAMPLERATE=false
-PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.2,[HAVE_SAMPLERATE=true], [true])
-if test x$HAVE_SAMPLERATE = xfalse; then
-        AC_MSG_WARN([*** the NetJack backend and internal client will not be built])
-    	AC_DEFINE(HAVE_SAMPLERATE,0,"Whether libsamplerate is available")
-else
-	NETJACK_CFLAGS="$NETJACK_CFLAGS $SAMPLERATE_CFLAGS"
-	NETJACK_LIBS="$NETJACK_LIBS $SAMPLERATE_LIBS"
-    	AC_DEFINE(HAVE_SAMPLERATE,1,"Whether libsamplerate is available")
-fi
-
-# Celt low-latency audio codec. netjack transmission via internet.
-HAVE_CELT=false
-PKG_CHECK_MODULES(CELT, celt >= 0.7.0,[HAVE_CELT=true], [true])
-if test x$HAVE_CELT = xfalse; then
-	PKG_CHECK_MODULES(CELT, celt >= 0.5.0,[HAVE_CELT=true], [true])
-	if test x$HAVE_CELT = xfalse; then
-		AC_DEFINE(HAVE_CELT,0,"Whether CELT is available")
-		AC_MSG_RESULT(no)
-		AC_MSG_WARN([*** NetJack will not be built with celt support])
-	else
-		AC_DEFINE(HAVE_CELT,1,"Whether CELT is available")
-		AC_DEFINE(HAVE_CELT_API_0_5,1,"Whether CELT API is 0.5 API")
-		AC_DEFINE(HAVE_CELT_API_0_7,0,"Whether CELT API is 0.7 API")
-		AC_MSG_RESULT(yes (0.5))
-		NETJACK_LIBS="$NETJACK_LIBS $CELT_LIBS"
-	fi
-else
-    	AC_DEFINE(HAVE_CELT,1,"Whether CELT is available")
-	AC_MSG_RESULT(yes (0.7))
-	AC_DEFINE(HAVE_CELT_API_0_5,0,"Whether CELT API is 0.5 API")
-	AC_DEFINE(HAVE_CELT_API_0_7,1,"Whether CELT API is 0.7 API")
-	NETJACK_LIBS="$NETJACK_LIBS $CELT_LIBS"
-fi
-
-AC_SUBST(NETJACK_LIBS)
-AC_SUBST(NETJACK_CFLAGS)
-
-# Note: A bug in pkg-config causes problems if the first occurence of
-# PKG_CHECK_MODULES can be disabled. So, if you're going to use
-# PKG_CHECK_MODULES inside a --disable-whatever check, you need to
-# do it somewhere *below* this comment.
-
-# Check which backend drivers can be built.  The last one successfully
-# configured becomes the default JACK driver; so the order of
-# precedence is: alsa, sun, oss, coreaudio, portaudio, dummy.
-
-JACK_DEFAULT_DRIVER=\"dummy\"
-
-AC_ARG_ENABLE(portaudio,
-	AC_HELP_STRING([--enable-portaudio],[build PortAudio driver]),
-   TRY_PORTAUDIO=$enableval , TRY_PORTAUDIO=no)
-
-HAVE_PA="false"
-if test "x$TRY_PORTAUDIO" = "xyes"
-then
-	# check for portaudio V18
-	AC_CHECK_LIB(portaudio, Pa_Initialize,
-		[ AC_CHECK_HEADERS(portaudio.h,
-			[ HAVE_PA="true"
-			  PA_LIBS=-lportaudio
-			  JACK_DEFAULT_DRIVER=\"portaudio\"
-			])
-		])
-	AC_SUBST(PA_LIBS)
-fi
-AM_CONDITIONAL(HAVE_PA, $HAVE_PA)
-
-AC_ARG_ENABLE(coreaudio, AC_HELP_STRING([--disable-coreaudio], [ignore CoreAudio driver]),
-			TRY_COREAUDIO=$enableval , TRY_COREAUDIO=yes )
-HAVE_COREAUDIO="false"
-if test "x$TRY_COREAUDIO" = "xyes"
-then
-	# check for coreaudio
-	AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
-		[ HAVE_COREAUDIO="true"
-		  JACK_DEFAULT_DRIVER=\"coreaudio\"
-		])
-fi
-AM_CONDITIONAL(HAVE_COREAUDIO, $HAVE_COREAUDIO)
-
-AC_ARG_ENABLE(oss, AC_HELP_STRING([--disable-oss],[ignore OSS driver ]),
-			TRY_OSS=$enableval , TRY_OSS=yes ) 
-HAVE_OSS="false"
-if test "x$TRY_OSS" = "xyes"
-then
-	# check for Open Sound System
-	AC_CHECK_HEADER([sys/soundcard.h],
-	     [HAVE_OSS="true"
-              JACK_DEFAULT_DRIVER=\"oss\"])
-fi
-AM_CONDITIONAL(HAVE_OSS, $HAVE_OSS)
-
-AC_ARG_ENABLE(sun, AC_HELP_STRING([--disable-sun],[ignore Sun driver ]),
-			TRY_SUN=$enableval , TRY_SUN=yes ) 
-HAVE_SUN="false"
-if test "x$TRY_SUN" = "xyes"
-then
-	# check for Sun audio API
-	AC_CHECK_HEADER([sys/audioio.h],
-	     [HAVE_SUN="true"
-              JACK_DEFAULT_DRIVER=\"sun\"])
-fi
-AM_CONDITIONAL(HAVE_SUN, $HAVE_SUN)
-
-AC_ARG_ENABLE(freebob, AC_HELP_STRING([--disable-freebob],[ignore FreeBob driver ]),
-			TRY_FREEBOB=$enableval , TRY_FREEBOB=yes ) 
-HAVE_FREEBOB="false"
-if test "x$TRY_FREEBOB" = "xyes"
-then
-	# check for FreeBob libraries
-	PKG_CHECK_MODULES(LIBFREEBOB, libfreebob >= 1.0.0,
-	     [HAVE_FREEBOB="true"
-              JACK_DEFAULT_DRIVER=\"freebob\"
-	     ], AC_MSG_RESULT([no]))
-
-	AC_SUBST([LIBFREEBOB_CFLAGS])
-	AC_SUBST([LIBFREEBOB_LIBS])
-
-fi
-AM_CONDITIONAL(HAVE_FREEBOB,$HAVE_FREEBOB)
-
-AC_ARG_ENABLE(firewire, AC_HELP_STRING([--disable-firewire],[ignore FireWire driver (FFADO)]),
-			TRY_FIREWIRE=$enableval , TRY_FIREWIRE=yes ) 
-HAVE_FIREWIRE="false"
-if test "x$TRY_FIREWIRE" = "xyes"
-then
-	# check for FFADO libraries
-	PKG_CHECK_MODULES(LIBFFADO, libffado >= 1.999.17,
-	     [HAVE_FIREWIRE="true"
-              JACK_DEFAULT_DRIVER=\"firewire\"
-	     ], AC_MSG_RESULT([no]))
-
-	AC_SUBST([LIBFFADO_CFLAGS])
-	AC_SUBST([LIBFFADO_LIBS])
-
-fi
-AM_CONDITIONAL(HAVE_FIREWIRE,$HAVE_FIREWIRE)
-
-AC_ARG_ENABLE(alsa, AC_HELP_STRING([--disable-alsa],[ignore ALSA driver ]),
-			TRY_ALSA=$enableval , TRY_ALSA=yes ) 
-HAVE_ALSA="false"
-if test "x$TRY_ALSA" = "xyes"
-then
-	# check for ALSA >= 1.0.18
-	PKG_CHECK_MODULES(ALSA, alsa >= 1.0.18,
-	     [HAVE_ALSA="true"
-              ALSA_LIBS=-lasound
-              JACK_DEFAULT_DRIVER=\"alsa\"
-             ], AC_MSG_RESULT([no]), [-lm]
-	)
-	AC_SUBST(ALSA_LIBS)
-fi
-AM_CONDITIONAL(HAVE_ALSA, $HAVE_ALSA)
-
-HAVE_ALSA_MIDI=$HAVE_ALSA
-AM_CONDITIONAL(HAVE_ALSA_MIDI, $HAVE_ALSA_MIDI)
-
-if test "$JACK_DEFAULT_DRIVER" = \"dummy\"; then
-  AC_MSG_WARN([Only the dummy driver can be built])
-fi
-AC_DEFINE_UNQUOTED(JACK_DEFAULT_DRIVER,
-	[$JACK_DEFAULT_DRIVER],
-	[Default JACK driver])
-
-JACK_SEMAPHORE_KEY=0x282929
-AC_DEFINE_UNQUOTED(JACK_SEMAPHORE_KEY,
-	  [$JACK_SEMAPHORE_KEY],
-	  [ an integer constant used as the semaphore and SysV SHM key. see libjack/shm.c for usage])
-AC_SUBST(JACK_SEMAPHORE_KEY)
-
-# On some systems, readline depends on termcap or ncurses.  But, the
-# MacOSX linker complains bitterly if these libraries are explicitly
-# referenced.  
-#
-# AC_CHECK_LIB() foolishly assumes that checking a library for an entry
-# point always returns the same result regardless of any dependent
-# libraries specified.  The `unset ac_cv_lib_readline_readline' erases
-# the cached result to work around this problem.
-READLINE_DEPS=""
-HAVE_READLINE=true
-AC_CHECK_LIB(readline, readline, [:],
-    [unset ac_cv_lib_readline_readline
-     AC_CHECK_LIB(readline, readline, [READLINE_DEPS="-ltermcap"],
-        [unset ac_cv_lib_readline_readline
-	 AC_CHECK_LIB(readline, readline,
-	    [READLINE_DEPS="-lncurses"], [HAVE_READLINE=false], "-lncurses")],
-	"-ltermcap")])
-AC_CHECK_HEADER(readline/chardefs.h, [], [HAVE_READLINE=false])
-if test x$HAVE_READLINE = xfalse; then
-	AC_MSG_WARN([*** the jack_transport example client will not be built])
-fi
-AC_SUBST(READLINE_DEPS)
-
-# you need doxygen to make dist.
-AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
-if test $HAVE_DOXYGEN = "false"; then
-             AC_MSG_WARN([*** doxygen not found, docs will not be built])
-fi
-
-AM_CONDITIONAL(HAVE_SNDFILE, $HAVE_SNDFILE)
-AM_CONDITIONAL(HAVE_CELT, $HAVE_CELT)
-AM_CONDITIONAL(HAVE_SAMPLERATE, $HAVE_SAMPLERATE)
-AM_CONDITIONAL(HAVE_READLINE, $HAVE_READLINE)
-AM_CONDITIONAL(HAVE_DOXYGEN, $HAVE_DOXYGEN)
-AM_CONDITIONAL(USE_CAPABILITIES, $USE_CAPABILITIES)
-AM_CONDITIONAL(STRIPPED_JACKD, $STRIPPED_JACKD)
-AM_CONDITIONAL(HAVE_PPOLL, $HAVE_PPOLL)
-
-AC_OUTPUT(
-Makefile
-config/Makefile
-config/cpu/Makefile
-config/cpu/alpha/Makefile
-config/cpu/cris/Makefile
-config/cpu/generic/Makefile
-config/cpu/i386/Makefile
-config/cpu/i486/Makefile
-config/cpu/ia64/Makefile
-config/cpu/m68k/Makefile
-config/cpu/mips/Makefile
-config/cpu/powerpc/Makefile
-config/cpu/s390/Makefile
-config/os/Makefile
-config/os/generic/Makefile
-config/os/gnu-linux/Makefile
-config/os/macosx/Makefile
-config/sysdeps/Makefile
-doc/Makefile
-doc/reference.doxygen
-drivers/Makefile
-drivers/alsa/Makefile
-drivers/alsa-midi/Makefile
-drivers/dummy/Makefile
-drivers/oss/Makefile
-drivers/sun/Makefile
-drivers/portaudio/Makefile
-drivers/coreaudio/Makefile
-drivers/freebob/Makefile
-drivers/firewire/Makefile
-drivers/netjack/Makefile
-example-clients/Makefile
-tools/Makefile
-man/Makefile
-jack.pc
-jack.spec
-jack/Makefile
-jack/version.h
-jackd/Makefile
-jackd/jackd.1
-libjack/Makefile
-)
-
-dnl
-dnl Output summary message
-dnl
-
-echo
-echo $PACKAGE $VERSION :
-echo
-echo \| Build with ALSA support............................... : $HAVE_ALSA
-echo \| Build with old FireWire \(FreeBob\) support............. : $HAVE_FREEBOB
-echo \| Build with new FireWire \(FFADO\) support............... : $HAVE_FIREWIRE
-echo \| Build with OSS support................................ : $HAVE_OSS
-echo \| Build with Sun audio support.......................... : $HAVE_SUN
-echo \| Build with CoreAudio support.......................... : $HAVE_COREAUDIO
-echo \| Build with PortAudio support.......................... : $HAVE_PA
-echo \| Build with Celt support............................... : $HAVE_CELT
-echo \| Build with dynamic buffer size support................ : $buffer_resizing
-echo \| Compiler optimization flags........................... : $JACK_OPT_CFLAGS
-echo \| Compiler full flags................................... : $CFLAGS
-echo \| Install dir for libjack + backends.................... : $libdir/jack
-echo \|
-echo \| Default driver backend................................ : $JACK_DEFAULT_DRIVER
-echo \| Shared memory interface............................... : $JACK_SHM_TYPE
-echo \| IPC Temporary directory............................... : $DEFAULT_TMP_DIR
-echo \| Install prefix........................................ : $prefix
-echo \| Default tmp dir....................................... : $DEFAULT_TMP_DIR
-echo
-
-
- 
diff --git a/dbus/audio_reserve.c b/dbus/audio_reserve.c
new file mode 100644
index 0000000..049826a
--- /dev/null
+++ b/dbus/audio_reserve.c
@@ -0,0 +1,128 @@
+/*
+    Copyright (C) 2009 Grame
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdint.h>
+
+#include "reserve.h"
+#include "audio_reserve.h"
+#include "JackError.h"
+
+#define DEVICE_MAX 2
+
+typedef struct reserved_audio_device {
+
+     char device_name[64];
+     rd_device * reserved_device;
+
+} reserved_audio_device;
+
+static DBusConnection* gConnection = NULL;
+static reserved_audio_device gReservedDevice[DEVICE_MAX];
+static int gReserveCount = 0;
+
+SERVER_EXPORT int audio_reservation_init()
+{
+    DBusError error;
+    dbus_error_init(&error);
+
+    if (!(gConnection = dbus_bus_get(DBUS_BUS_SESSION, &error))) {
+        jack_error("Failed to connect to session bus for device reservation %s\n", error.message);
+        return -1;
+    }
+
+    jack_info("audio_reservation_init");
+    return 0;
+}
+
+SERVER_EXPORT int audio_reservation_finish()
+{
+    if (gConnection) {
+        dbus_connection_unref(gConnection);
+        gConnection = NULL;
+	jack_info("audio_reservation_finish");
+    }
+    return 0;
+}
+
+SERVER_EXPORT bool audio_acquire(const char * device_name)
+{
+    DBusError error;   
+    int ret;
+
+    // Open DBus connection first time
+    if (gReserveCount == 0)
+       audio_reservation_init();
+
+    assert(gReserveCount < DEVICE_MAX);
+
+    if ((ret= rd_acquire(
+                 &gReservedDevice[gReserveCount].reserved_device,
+                 gConnection,
+                 device_name,
+                 "Jack audio server",
+                 INT32_MAX,
+                 NULL,
+                 &error)) < 0) {
+
+        jack_error("Failed to acquire device name : %s error : %s", device_name, (error.message ? error.message : strerror(-ret)));
+        return false;
+    }
+
+    strcpy(gReservedDevice[gReserveCount].device_name, device_name);
+    gReserveCount++;
+    jack_info("Acquire audio card %s", device_name);
+    return true;
+}
+
+SERVER_EXPORT void audio_release(const char * device_name)
+{
+    int i;
+
+    // Look for corresponding reserved device
+    for (i = 0; i < DEVICE_MAX; i++) {
+ 	if (strcmp(gReservedDevice[i].device_name, device_name) == 0)  
+	    break;
+    }
+   
+    if (i < DEVICE_MAX) {
+        jack_info("Released audio card %s", device_name);
+        rd_release(gReservedDevice[i].reserved_device);
+    } else {
+        jack_error("Audio card %s not found!!", device_name);
+    }
+
+    // Close DBus connection last time
+    gReserveCount--;
+    if (gReserveCount == 0)
+        audio_reservation_finish();
+}
+
+SERVER_EXPORT void audio_reserve_loop()
+{
+    if (gConnection != NULL) {
+       while (dbus_connection_read_write_dispatch (gConnection, -1))
+         ; // empty loop body
+    }
+}
+
diff --git a/dbus/audio_reserve.h b/dbus/audio_reserve.h
new file mode 100644
index 0000000..db01f1a
--- /dev/null
+++ b/dbus/audio_reserve.h
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2009 Grame
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __audio_reserve__
+#define __audio_reserve__
+
+#include "JackCompilerDeps.h"
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SERVER_EXPORT int audio_reservation_init();
+SERVER_EXPORT int audio_reservation_finish();
+
+SERVER_EXPORT bool audio_acquire(const char * device_name);
+SERVER_EXPORT void audio_release(const char * device_name);
+SERVER_EXPORT void audio_reserve_loop();
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/dbus/controller.c b/dbus/controller.c
new file mode 100644
index 0000000..17b51fd
--- /dev/null
+++ b/dbus/controller.c
@@ -0,0 +1,549 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <dbus/dbus.h>
+
+#include "controller.h"
+#include "controller_internal.h"
+#include "xml.h"
+#include "reserve.h"
+
+struct jack_dbus_interface_descriptor * g_jackcontroller_interfaces[] =
+{
+    &g_jack_controller_iface_introspectable,
+    &g_jack_controller_iface_control,
+    &g_jack_controller_iface_configure,
+    &g_jack_controller_iface_patchbay,
+    &g_jack_controller_iface_transport,
+    NULL
+};
+
+jackctl_driver_t *
+jack_controller_find_driver(
+    jackctl_server_t *server,
+    const char *driver_name)
+{
+    const JSList * node_ptr;
+
+    node_ptr = jackctl_server_get_drivers_list(server);
+
+    while (node_ptr)
+    {
+        if (strcmp(jackctl_driver_get_name((jackctl_driver_t *)node_ptr->data), driver_name) == 0)
+        {
+            return node_ptr->data;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    return NULL;
+}
+
+jackctl_internal_t *
+jack_controller_find_internal(
+    jackctl_server_t *server,
+    const char *internal_name)
+{
+    const JSList * node_ptr;
+
+    node_ptr = jackctl_server_get_internals_list(server);
+
+    while (node_ptr)
+    {
+        if (strcmp(jackctl_internal_get_name((jackctl_internal_t *)node_ptr->data), internal_name) == 0)
+        {
+            return node_ptr->data;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    return NULL;
+}
+
+jackctl_parameter_t *
+jack_controller_find_parameter(
+    const JSList * parameters_list,
+    const char * parameter_name)
+{
+    while (parameters_list)
+    {
+        if (strcmp(jackctl_parameter_get_name((jackctl_parameter_t *)parameters_list->data), parameter_name) == 0)
+        {
+            return parameters_list->data;
+        }
+
+        parameters_list = jack_slist_next(parameters_list);
+    }
+
+    return NULL;
+}
+
+bool
+jack_controller_select_driver(
+    struct jack_controller * controller_ptr,
+    const char * driver_name)
+{
+    jackctl_driver_t *driver;
+
+    driver = jack_controller_find_driver(controller_ptr->server, driver_name);
+    if (driver == NULL)
+    {
+        return false;
+    }
+
+    jack_info("driver \"%s\" selected", driver_name);
+
+    controller_ptr->driver = driver;
+    controller_ptr->driver_set = true;
+
+    return true;
+}
+
+static
+int
+jack_controller_xrun(void * arg)
+{
+	((struct jack_controller *)arg)->xruns++;
+
+	return 0;
+}
+
+bool
+jack_controller_start_server(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    int ret;
+
+    jack_info("Starting jack server...");
+
+    if (controller_ptr->started)
+    {
+        jack_info("Already started.");
+        return TRUE;
+    }
+
+    if (controller_ptr->driver == NULL)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Select driver first!");
+        goto fail;
+    }
+
+    controller_ptr->xruns = 0;
+
+    if (!jackctl_server_start(
+            controller_ptr->server,
+            controller_ptr->driver))
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Failed to start server");
+        goto fail;
+    }
+
+    controller_ptr->client = jack_client_open(
+        "dbusapi",
+        JackNoStartServer,
+        NULL);
+    if (controller_ptr->client == NULL)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to create dbusapi jack client");
+
+        goto fail_stop_server;
+    }
+
+    ret = jack_set_xrun_callback(controller_ptr->client, jack_controller_xrun, controller_ptr);
+    if (ret != 0)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to set xrun callback. error is %d", ret);
+
+        goto fail_close_client;
+    }
+
+    if (!jack_controller_patchbay_init(controller_ptr))
+    {
+        jack_error("Failed to initialize patchbay district");
+        goto fail_close_client;
+    }
+
+    ret = jack_activate(controller_ptr->client);
+    if (ret != 0)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to activate dbusapi jack client. error is %d", ret);
+
+        goto fail_patchbay_uninit;
+    }
+
+    controller_ptr->started = true;
+
+    return TRUE;
+
+fail_patchbay_uninit:
+    jack_controller_patchbay_uninit(controller_ptr);
+
+fail_close_client:
+    ret = jack_client_close(controller_ptr->client);
+    if (ret != 0)
+    {
+        jack_error("jack_client_close() failed with error %d", ret);
+    }
+
+    controller_ptr->client = NULL;
+
+fail_stop_server:
+    if (!jackctl_server_stop(controller_ptr->server))
+    {
+        jack_error("failed to stop jack server");
+    }
+
+fail:
+    return FALSE;
+}
+
+bool
+jack_controller_stop_server(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    int ret;
+
+    jack_info("Stopping jack server...");
+
+    if (!controller_ptr->started)
+    {
+        jack_info("Already stopped.");
+        return TRUE;
+    }
+
+    ret = jack_deactivate(controller_ptr->client);
+    if (ret != 0)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "failed to deactivate dbusapi jack client. error is %d", ret);
+    }
+
+    jack_controller_patchbay_uninit(controller_ptr);
+
+    ret = jack_client_close(controller_ptr->client);
+    if (ret != 0)
+    {
+        jack_error("jack_client_close() failed with error %d", ret);
+    }
+
+    controller_ptr->client = NULL;
+
+    if (!jackctl_server_stop(controller_ptr->server))
+    {
+        return FALSE;
+    }
+
+    controller_ptr->started = false;
+
+    return TRUE;
+}
+
+bool
+jack_controller_switch_master(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    if (!jackctl_server_switch_master(
+            controller_ptr->server,
+            controller_ptr->driver))
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Failed to switch master");
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+#define DEVICE_MAX 2
+
+typedef struct reserved_audio_device {
+
+     char device_name[64];
+     rd_device * reserved_device;
+
+} reserved_audio_device;
+
+
+int g_device_count = 0;
+static reserved_audio_device g_reserved_device[DEVICE_MAX];
+
+static
+bool
+on_device_acquire(const char * device_name)
+{
+    int ret;
+    DBusError error;
+
+    ret = rd_acquire(
+        &g_reserved_device[g_device_count].reserved_device,
+        g_connection,
+        device_name,
+        "Jack audio server",
+        INT32_MAX,
+        NULL,
+        &error);
+    if (ret  < 0)
+    {
+        jack_error("Failed to acquire device name : %s error : %s", device_name, (error.message ? error.message : strerror(-ret)));
+        return false;
+    }
+
+    strcpy(g_reserved_device[g_device_count].device_name, device_name);
+    g_device_count++;
+    jack_info("Acquired audio card %s", device_name);
+    return true;
+}
+
+static
+void
+on_device_release(const char * device_name)
+{
+    int i;
+
+    // Look for corresponding reserved device
+    for (i = 0; i < DEVICE_MAX; i++) {
+ 	if (strcmp(g_reserved_device[i].device_name, device_name) == 0)  
+	    break;
+    }
+   
+    if (i < DEVICE_MAX) {
+	jack_info("Released audio card %s", device_name);
+        rd_release(g_reserved_device[i].reserved_device);
+    } else {
+	jack_error("Audio card %s not found!!", device_name);
+    }
+
+    g_device_count--;
+}
+
+void *
+jack_controller_create(
+        DBusConnection *connection)
+{
+    struct jack_controller *controller_ptr;
+    const JSList * node_ptr;
+    const char ** driver_name_target;
+    const char ** internal_name_target;
+    JSList * drivers;
+    JSList * internals;
+    DBusObjectPathVTable vtable =
+    {
+        jack_dbus_message_handler_unregister,
+        jack_dbus_message_handler,
+        NULL
+    };
+
+    controller_ptr = malloc(sizeof(struct jack_controller));
+    if (!controller_ptr)
+    {
+        jack_error("Ran out of memory trying to allocate struct jack_controller");
+        goto fail;
+    }
+
+    controller_ptr->server = jackctl_server_create(on_device_acquire, on_device_release);
+    if (controller_ptr->server == NULL)
+    {
+        jack_error("Failed to create server object");
+        goto fail_free;
+    }
+
+    controller_ptr->client = NULL;
+    controller_ptr->started = false;
+    controller_ptr->driver = NULL;
+    controller_ptr->driver_set = false;
+
+    drivers = (JSList *)jackctl_server_get_drivers_list(controller_ptr->server);
+    controller_ptr->drivers_count = jack_slist_length(drivers);
+    controller_ptr->driver_names = malloc(controller_ptr->drivers_count * sizeof(const char *));
+    if (controller_ptr->driver_names == NULL)
+    {
+        jack_error("Ran out of memory trying to allocate driver names array");
+        goto fail_destroy_server;
+    }
+
+    driver_name_target = controller_ptr->driver_names;
+    node_ptr = jackctl_server_get_drivers_list(controller_ptr->server);
+    while (node_ptr != NULL)
+    {
+        *driver_name_target = jackctl_driver_get_name((jackctl_driver_t *)node_ptr->data);
+
+        /* select default driver */
+        if (controller_ptr->driver == NULL && strcmp(*driver_name_target, DEFAULT_DRIVER) == 0)
+        {
+            controller_ptr->driver = (jackctl_driver_t *)node_ptr->data;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+        driver_name_target++;
+    }
+    
+    internals = (JSList *)jackctl_server_get_internals_list(controller_ptr->server);
+    controller_ptr->internals_count = jack_slist_length(internals);
+    controller_ptr->internal_names = malloc(controller_ptr->internals_count * sizeof(const char *));
+    if (controller_ptr->internal_names == NULL)
+    {
+        jack_error("Ran out of memory trying to allocate internals names array");
+        goto fail_free_driver_names_array;
+    }
+
+    internal_name_target = controller_ptr->internal_names;
+    node_ptr = jackctl_server_get_internals_list(controller_ptr->server);
+    while (node_ptr != NULL)
+    {
+        *internal_name_target = jackctl_internal_get_name((jackctl_internal_t *)node_ptr->data);
+        node_ptr = jack_slist_next(node_ptr);
+        internal_name_target++;
+    }
+
+    controller_ptr->dbus_descriptor.context = controller_ptr;
+    controller_ptr->dbus_descriptor.interfaces = g_jackcontroller_interfaces;
+
+    if (!dbus_connection_register_object_path(
+            connection,
+            JACK_CONTROLLER_OBJECT_PATH,
+            &vtable,
+            &controller_ptr->dbus_descriptor))
+    {
+        jack_error("Ran out of memory trying to register D-Bus object path");
+        goto fail_free_internal_names_array;
+    }
+
+    jack_controller_settings_load(controller_ptr);
+
+    return controller_ptr;
+
+fail_free_internal_names_array:
+    free(controller_ptr->internal_names);
+
+fail_free_driver_names_array:
+    free(controller_ptr->driver_names);
+
+fail_destroy_server:
+    jackctl_server_destroy(controller_ptr->server);
+
+fail_free:
+    free(controller_ptr);
+
+fail:
+    return NULL;
+}
+
+bool
+jack_controller_add_slave(
+    struct jack_controller *controller_ptr,
+    const char * driver_name)
+{
+    jackctl_driver_t *driver;
+
+    driver = jack_controller_find_driver(controller_ptr->server, driver_name);
+      
+    if (driver == NULL)
+    {
+        return false;
+    }
+
+    jack_info("driver \"%s\" selected", driver_name);
+
+    return jackctl_server_add_slave(controller_ptr->server, driver);
+}
+
+bool
+jack_controller_remove_slave(
+    struct jack_controller *controller_ptr,
+    const char * driver_name)
+{
+    jackctl_driver_t *driver;
+
+    driver = jack_controller_find_driver(controller_ptr->server, driver_name);
+      
+    if (driver == NULL)
+    {
+        return false;
+    }
+
+    jack_info("driver \"%s\" selected", driver_name);
+
+    return jackctl_server_remove_slave(controller_ptr->server, driver);
+}
+
+bool
+jack_controller_load_internal(
+    struct jack_controller *controller_ptr,
+    const char * internal_name)
+{
+    jackctl_internal_t *internal;
+
+    internal = jack_controller_find_internal(controller_ptr->server, internal_name);
+    if (internal == NULL)
+    {
+        return false;
+    }
+
+    jack_info("internal \"%s\" selected", internal_name);
+
+    return jackctl_server_load_internal(controller_ptr->server, internal);
+}
+
+bool
+jack_controller_unload_internal(
+    struct jack_controller *controller_ptr,
+    const char * internal_name)
+{
+    jackctl_internal_t *internal;
+
+    internal = jack_controller_find_internal(controller_ptr->server, internal_name);
+    if (internal == NULL)
+    {
+        return false;
+    }
+
+    jack_info("internal \"%s\" selected", internal_name);
+
+    return jackctl_server_unload_internal(controller_ptr->server, internal);
+}
+
+#define controller_ptr ((struct jack_controller *)context)
+
+void
+jack_controller_destroy(
+        void * context)
+{
+    if (controller_ptr->started)
+    {
+        jack_controller_stop_server(controller_ptr, NULL);
+    }
+
+    free(controller_ptr->driver_names);
+    free(controller_ptr->internal_names);
+
+    jackctl_server_destroy(controller_ptr->server);
+
+    free(controller_ptr);
+}
+
diff --git a/dbus/controller.h b/dbus/controller.h
new file mode 100644
index 0000000..19887b4
--- /dev/null
+++ b/dbus/controller.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+  Copyright (C) 2007 Nedko Arnaudov
+    
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef CONTROLLER_H__2CC80B1E_8D5D_45E3_A9D8_9086DDF68BB5__INCLUDED
+#define CONTROLLER_H__2CC80B1E_8D5D_45E3_A9D8_9086DDF68BB5__INCLUDED
+
+void *
+jack_controller_create(
+    DBusConnection *connection);
+
+void
+jack_controller_destroy(
+    void *controller_ptr);
+
+#endif /* #ifndef CONTROLLER_H__2CC80B1E_8D5D_45E3_A9D8_9086DDF68BB5__INCLUDED */
diff --git a/dbus/controller_iface_configure.c b/dbus/controller_iface_configure.c
new file mode 100644
index 0000000..dfa5670
--- /dev/null
+++ b/dbus/controller_iface_configure.c
@@ -0,0 +1,2230 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <dbus/dbus.h>
+
+#include "jackdbus.h"
+#include "controller_internal.h"
+#include "xml.h"
+
+#define PTNODE_ENGINE    "engine"
+#define PTNODE_DRIVER    "driver"
+#define PTNODE_DRIVERS   "drivers"
+#define PTNODE_INTERNALS "internals"
+
+#define ENGINE_DRIVER_PARAMETER_NAME         "driver"
+#define ENGINE_DRIVER_PARAMETER_TYPE         JackParamString
+#define ENGINE_DRIVER_PARAMETER_SHORT_DESCR  "Driver to use"
+#define ENGINE_DRIVER_PARAMETER_LONG_DESCR   ""
+
+struct parameter_info
+{
+    unsigned char type;
+    const char * name;
+    const char * short_decr;
+    const char * long_descr;
+};
+
+unsigned char jack_controller_dbus_types[JACK_PARAM_MAX] =
+{
+    [JackParamInt] = DBUS_TYPE_INT32,
+    [JackParamUInt] = DBUS_TYPE_UINT32,
+    [JackParamChar] = DBUS_TYPE_BYTE,
+    [JackParamString] = DBUS_TYPE_STRING,
+    [JackParamBool] = DBUS_TYPE_BOOLEAN,
+};
+
+const char *jack_controller_dbus_type_signatures[JACK_PARAM_MAX] =
+{
+    [JackParamInt] = DBUS_TYPE_INT32_AS_STRING,
+    [JackParamUInt] = DBUS_TYPE_UINT32_AS_STRING,
+    [JackParamChar] = DBUS_TYPE_BYTE_AS_STRING,
+    [JackParamString] = DBUS_TYPE_STRING_AS_STRING,
+    [JackParamBool] = DBUS_TYPE_BOOLEAN_AS_STRING,
+};
+
+#define PARAM_TYPE_JACK_TO_DBUS(_) jack_controller_dbus_types[_]
+#define PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(_) jack_controller_dbus_type_signatures[_]
+
+static
+bool
+jack_controller_jack_to_dbus_variant(
+    jackctl_param_type_t type,
+    const union jackctl_parameter_value *value_ptr,
+    message_arg_t  *dbusv_ptr)
+{
+    switch (type)
+    {
+    case JackParamInt:
+        dbusv_ptr->int32 = (dbus_int32_t)value_ptr->i;
+        return true;
+    case JackParamUInt:
+        dbusv_ptr->uint32 = (dbus_uint32_t)value_ptr->ui;
+        return true;
+    case JackParamChar:
+        dbusv_ptr->byte = value_ptr->c;
+        return true;
+    case JackParamString:
+        dbusv_ptr->string = value_ptr->str;
+        return true;
+    case JackParamBool:
+        dbusv_ptr->boolean = (dbus_bool_t)value_ptr->b;
+        return true;
+    }
+
+    jack_error("Unknown JACK parameter type %i", (int)type);
+    assert(0);
+    return false;
+}
+
+static
+bool
+jack_controller_dbus_to_jack_variant(
+    int type,
+    const message_arg_t *dbusv_ptr,
+    union jackctl_parameter_value *value_ptr)
+{
+    size_t len;
+
+    switch (type)
+    {
+    case DBUS_TYPE_INT32:
+        value_ptr->i = dbusv_ptr->int32;
+        return true;
+    case DBUS_TYPE_UINT32:
+        value_ptr->ui = dbusv_ptr->uint32;
+        return true;
+    case DBUS_TYPE_BYTE:
+        value_ptr->c = dbusv_ptr->byte;
+        return true;
+    case DBUS_TYPE_STRING:
+        len = strlen(dbusv_ptr->string);
+        if (len > JACK_PARAM_STRING_MAX)
+        {
+            jack_error("Parameter string value is too long (%u)", (unsigned int)len);
+            return false;
+        }
+        memcpy(value_ptr->str, dbusv_ptr->string, len + 1);
+
+        return true;
+    case DBUS_TYPE_BOOLEAN:
+        value_ptr->b = dbusv_ptr->boolean;
+        return true;
+    }
+
+    jack_error("Unknown D-Bus parameter type %i", (int)type);
+    return false;
+}
+
+/*
+ * Construct a return message for a Get[Driver|Engine]ParameterValue method call.
+ *
+ * The operation can only fail due to lack of memory, in which case
+ * there's no sense in trying to construct an error return. Instead,
+ * call->reply will be set to NULL and handled in send_method_return().
+ */
+static void
+jack_dbus_construct_method_return_parameter(
+    struct jack_dbus_method_call * call,
+    dbus_bool_t is_set,
+    int type,
+    const char *signature,
+    message_arg_t default_value,
+    message_arg_t value)
+{
+    DBusMessageIter iter;
+
+    /* Create a new method return message. */
+    call->reply = dbus_message_new_method_return (call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append (call->reply, &iter);
+
+    /* Append the is_set argument. */
+    if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, (const void *) &is_set))
+    {
+        goto fail_unref;
+    }
+
+    /* Append the 'default' and 'value' arguments. */
+    if (!jack_dbus_message_append_variant(&iter, type, signature, &default_value))
+    {
+        goto fail_unref;
+    }
+    if (!jack_dbus_message_append_variant(&iter, type, signature, &value))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_unref:
+    dbus_message_unref (call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+static
+bool
+jack_controller_dbus_get_parameter_address_ex(
+    struct jack_dbus_method_call * call,
+    DBusMessageIter * iter_ptr,
+    const char ** address_array)
+{
+    const char * signature;
+    DBusMessageIter array_iter;
+    int type;
+    int index;
+
+    if (!dbus_message_iter_init(call->message, iter_ptr))
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Invalid arguments to method '%s'. No input arguments found.",
+            call->method_name);
+        return false;
+    }
+
+    signature = dbus_message_iter_get_signature(iter_ptr);
+    if (signature == NULL)
+    {
+        jack_error("dbus_message_iter_get_signature() failed");
+        return false;
+    }
+
+    if (strcmp(signature, "as") != 0)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Invalid arguments to method '%s'. Input arguments signature '%s', must begin with 'as'.",
+            call->method_name,
+            signature);
+        return false;
+    }
+
+    dbus_message_iter_recurse(iter_ptr, &array_iter);
+
+    index = 0;
+    while ((type = dbus_message_iter_get_arg_type(&array_iter)) != DBUS_TYPE_INVALID)
+    {
+        if (index == 3)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_INVALID_ARGS,
+                "Invalid arguments to method '%s'. Parameter address array must contain not more than three elements.",
+                call->method_name);
+            return false;
+        }
+
+        ;
+        if (type != DBUS_TYPE_STRING)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_FATAL,
+                "Internal error when parsing parameter address of method '%s'. Address array element type '%c' is not string type.",
+                call->method_name,
+                type);
+            return false;
+        }
+
+        dbus_message_iter_get_basic(&array_iter, address_array + index);
+        //jack_info("address component: '%s'", address_array[index]);
+
+        dbus_message_iter_next(&array_iter);
+        index++;
+    }
+
+    while (index < 3)
+    {
+        address_array[index] = NULL;
+        index++;
+    }
+
+    return true;
+}
+
+static
+bool
+jack_controller_dbus_get_parameter_address(
+    struct jack_dbus_method_call * call,
+    const char ** address_array)
+{
+    DBusMessageIter iter;
+    bool ret;
+
+    ret = jack_controller_dbus_get_parameter_address_ex(call, &iter, address_array);
+    if (ret && dbus_message_iter_has_next(&iter))
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Invalid arguments to method '%s'. Input arguments signature must be 'as'.",
+            call->method_name);
+        return false;
+    }
+
+    return ret;
+}
+
+#define controller_ptr ((struct jack_controller *)call->context)
+
+static
+bool
+jack_controller_fill_parameter_names(
+    struct jack_dbus_method_call * call,
+    DBusMessageIter * iter_ptr,
+    const char * special_first,
+    const JSList * parameters_list)
+{
+    DBusMessageIter array_iter;
+    const char * param_name;
+
+    if (!dbus_message_iter_open_container(iter_ptr, DBUS_TYPE_ARRAY, "s", &array_iter))
+    {
+        return false;
+    }
+
+    if (special_first != NULL)
+    {
+        if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &special_first))
+        {
+            dbus_message_iter_close_container(iter_ptr, &array_iter);
+            return false;
+        }
+    }
+
+    /* Append parameter descriptions to the array. */
+    while (parameters_list != NULL)
+    {
+        param_name = jackctl_parameter_get_name(parameters_list->data);
+        if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &param_name))
+        {
+            dbus_message_iter_close_container(iter_ptr, &array_iter);
+            return false;
+        }
+
+        parameters_list = jack_slist_next(parameters_list);
+    }
+
+    return dbus_message_iter_close_container(iter_ptr, &array_iter);
+}
+
+static
+void
+jack_controller_dbus_read_container(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    dbus_bool_t leaf;
+    DBusMessageIter iter;
+    DBusMessageIter array_iter;
+    const char * child_name;
+    unsigned int index;
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+
+    //jack_info("jack_controller_dbus_read_container() called");
+
+    if (!jack_controller_dbus_get_parameter_address(call, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    /* Create a new method return message. */
+    call->reply = dbus_message_new_method_return(call->message);
+    if (!call->reply)
+    {
+        goto oom;
+    }
+
+    dbus_message_iter_init_append(call->reply, &iter);
+
+    if (address[0] == NULL)     /* root node */
+    {
+        //jack_info("reading root container");
+
+        leaf = false;
+        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &leaf))
+        {
+            goto oom_unref;
+        }
+
+        if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &array_iter))
+        {
+            goto oom_unref;
+        }
+
+        child_name = PTNODE_ENGINE;
+        if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &child_name))
+        {
+            goto oom_close_unref;
+        }
+
+        child_name = PTNODE_DRIVER;
+        if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &child_name))
+        {
+            goto oom_close_unref;
+        }
+
+        child_name = PTNODE_DRIVERS;
+        if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &child_name))
+        {
+            goto oom_close_unref;
+        }
+
+        child_name = PTNODE_INTERNALS;
+        if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &child_name))
+        {
+            goto oom_close_unref;
+        }
+
+        dbus_message_iter_close_container(&iter, &array_iter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        //jack_info("reading engine params container");
+
+        leaf = true;
+        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &leaf))
+        {
+            goto oom_unref;
+        }
+
+        if (!jack_controller_fill_parameter_names(
+                call,
+                &iter,
+                ENGINE_DRIVER_PARAMETER_NAME,
+                jackctl_server_get_parameters(controller_ptr->server)))
+        {
+            goto oom_unref;
+        }
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        //jack_info("reading current driver params container");
+
+        leaf = true;
+        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &leaf))
+        {
+            goto oom_unref;
+        }
+
+        if (!jack_controller_fill_parameter_names(
+                call,
+                &iter,
+                NULL,
+                jackctl_driver_get_parameters(controller_ptr->driver)))
+        {
+            goto oom_unref;
+        }
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        leaf = address[1] != NULL;
+        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &leaf))
+        {
+            goto oom_unref;
+        }
+
+        if (!leaf)              /* available drivers requested */
+        {
+            //jack_info("reading drivers container");
+
+            if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &array_iter))
+            {
+                goto oom_unref;
+            }
+
+            for (index = 0; index < controller_ptr->drivers_count; index++)
+            {
+                if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, controller_ptr->driver_names + index))
+                {
+                    goto oom_close_unref;
+                }
+            }
+
+            dbus_message_iter_close_container(&iter, &array_iter);
+        }
+        else                    /* specified driver parameters requested */
+        {
+            //jack_info("reading driver '%s' params container", address[1]);
+
+            driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+            if (driver == NULL)
+            {
+                jack_dbus_error(
+                    call,
+                    JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                    "Unknown driver '%s'",
+                    address[1]);
+                return;
+            }
+
+            if (!jack_controller_fill_parameter_names(
+                    call,
+                    &iter,
+                    NULL,
+                    jackctl_driver_get_parameters(driver)))
+            {
+                goto oom_unref;
+            }
+        }
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        leaf = address[1] != NULL;
+        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &leaf))
+        {
+            goto oom_unref;
+        }
+
+        if (!leaf)              /* available internals requested */
+        {
+            //jack_info("reading internals container");
+
+            if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &array_iter))
+            {
+                goto oom_unref;
+            }
+
+            for (index = 0; index < controller_ptr->internals_count; index++)
+            {
+                if (!dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, controller_ptr->internal_names + index))
+                {
+                    goto oom_close_unref;
+                }
+            }
+
+            dbus_message_iter_close_container(&iter, &array_iter);
+        }
+        else                    /* specified driver parameters requested */
+        {
+            //jack_info("reading internal '%s' params container", address[1]);
+
+            internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+            if (internal == NULL)
+            {
+                jack_dbus_error(
+                    call,
+                    JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                    "Unknown internal '%s'",
+                    address[1]);
+                return;
+            }
+
+            if (!jack_controller_fill_parameter_names(
+                    call,
+                    &iter,
+                    NULL,
+                    jackctl_internal_get_parameters(internal)))
+            {
+                goto oom_unref;
+            }
+        }
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+
+    return;
+
+oom_close_unref:
+    dbus_message_iter_close_container(&iter, &array_iter);
+
+oom_unref:
+    dbus_message_unref(call->reply);
+    call->reply = NULL;
+
+oom:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+static
+void
+jack_controller_get_parameters_info(
+    struct jack_dbus_method_call * call,
+    struct parameter_info * special_parameter_info_ptr,
+    const JSList * parameters_list)
+{
+    DBusMessageIter iter, array_iter, struct_iter;
+    unsigned char type;
+    const char *str;
+
+    call->reply = dbus_message_new_method_return (call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append (call->reply, &iter);
+
+    /* Open the array. */
+    if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "(ysss)", &array_iter))
+    {
+        goto fail_unref;
+    }
+
+    if (special_parameter_info_ptr != NULL)
+    {
+        /* Open the struct. */
+        if (!dbus_message_iter_open_container (&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        /* Append parameter type. */
+        type = PARAM_TYPE_JACK_TO_DBUS(special_parameter_info_ptr->type);
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_BYTE, &type))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Append parameter name. */
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &special_parameter_info_ptr->name))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Append parameter short description. */
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &special_parameter_info_ptr->short_decr))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Append parameter long description. */
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &special_parameter_info_ptr->long_descr))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Close the struct. */
+        if (!dbus_message_iter_close_container (&array_iter, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+    }
+
+    /* Append parameter descriptions to the array. */
+    while (parameters_list != NULL)
+    {
+        /* Open the struct. */
+        if (!dbus_message_iter_open_container (&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        /* Append parameter type. */
+        type = PARAM_TYPE_JACK_TO_DBUS(jackctl_parameter_get_type(parameters_list->data));
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_BYTE, &type))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Append parameter name. */
+        str = jackctl_parameter_get_name(parameters_list->data);
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &str))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Append parameter short description. */
+        str = jackctl_parameter_get_short_description(parameters_list->data);
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &str))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Append parameter long description. */
+        str = jackctl_parameter_get_long_description(parameters_list->data);
+        if (!dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &str))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Close the struct. */
+        if (!dbus_message_iter_close_container (&array_iter, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        parameters_list = jack_slist_next(parameters_list);
+    }
+
+    /* Close the array. */
+    if (!dbus_message_iter_close_container (&iter, &array_iter))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_close2_unref:
+    dbus_message_iter_close_container (&iter, &struct_iter);
+
+fail_close_unref:
+    dbus_message_iter_close_container (&iter, &array_iter);
+
+fail_unref:
+    dbus_message_unref (call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+static
+void
+jack_controller_dbus_get_parameters_info(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+    struct parameter_info driver_parameter_info;
+
+    //jack_info("jack_controller_dbus_get_parameters_info() called");
+
+    if (!jack_controller_dbus_get_parameter_address(call, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    if (address[0] != NULL &&
+        address[1] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        driver_parameter_info.type = ENGINE_DRIVER_PARAMETER_TYPE;
+        driver_parameter_info.name = ENGINE_DRIVER_PARAMETER_NAME;
+        driver_parameter_info.short_decr = ENGINE_DRIVER_PARAMETER_SHORT_DESCR;
+        driver_parameter_info.long_descr = ENGINE_DRIVER_PARAMETER_LONG_DESCR;
+
+        jack_controller_get_parameters_info(
+            call,
+            &driver_parameter_info,
+            jackctl_server_get_parameters(controller_ptr->server));
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        jack_controller_get_parameters_info(
+            call,
+            NULL,
+            jackctl_driver_get_parameters(controller_ptr->driver));
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+        if (driver == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown driver '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameters_info(
+            call,
+            NULL,
+            jackctl_driver_get_parameters(driver));
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+        if (internal == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown internal '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameters_info(
+            call,
+            NULL,
+            jackctl_internal_get_parameters(internal));
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+}
+
+static
+void
+jack_controller_get_parameter_info_ex(
+    struct jack_dbus_method_call * call,
+    struct parameter_info * info_ptr)
+{
+    DBusMessageIter iter, struct_iter;
+    unsigned char type;
+
+    call->reply = dbus_message_new_method_return(call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append(call->reply, &iter);
+
+    /* Open the struct. */
+    if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+    {
+        goto fail_unref;
+    }
+
+    /* Append parameter type. */
+    type = PARAM_TYPE_JACK_TO_DBUS(info_ptr->type);
+    if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_BYTE, &type))
+    {
+        goto fail_close_unref;
+    }
+
+    /* Append parameter name. */
+    if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &info_ptr->name))
+    {
+        goto fail_close_unref;
+    }
+
+    /* Append parameter short description. */
+    if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &info_ptr->short_decr))
+    {
+        goto fail_close_unref;
+    }
+
+    /* Append parameter long description. */
+    if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &info_ptr->long_descr))
+    {
+        goto fail_close_unref;
+    }
+
+    /* Close the struct. */
+    if (!dbus_message_iter_close_container(&iter, &struct_iter))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_close_unref:
+    dbus_message_iter_close_container(&iter, &struct_iter);
+
+fail_unref:
+    dbus_message_unref(call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error("Ran out of memory trying to construct method return");
+}
+
+static
+void
+jack_controller_get_parameter_info(
+    struct jack_dbus_method_call * call,
+    jackctl_parameter_t * parameter)
+{
+    struct parameter_info info;
+
+    info.type = jackctl_parameter_get_type(parameter);
+    info.name = jackctl_parameter_get_name(parameter);
+    info.short_decr = jackctl_parameter_get_short_description(parameter);
+    info.long_descr = jackctl_parameter_get_long_description(parameter);
+
+    jack_controller_get_parameter_info_ex(call, &info);
+}
+
+static
+void
+jack_controller_dbus_get_parameter_info(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+    jackctl_parameter_t * parameter;
+    struct parameter_info driver_parameter_info;
+
+    //jack_info("jack_controller_dbus_get_parameter_info() called");
+
+    if (!jack_controller_dbus_get_parameter_address(call, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        if (strcmp(address[1], ENGINE_DRIVER_PARAMETER_NAME) == 0)
+        {
+            driver_parameter_info.type = ENGINE_DRIVER_PARAMETER_TYPE;
+            driver_parameter_info.name = ENGINE_DRIVER_PARAMETER_NAME;
+            driver_parameter_info.short_decr = ENGINE_DRIVER_PARAMETER_SHORT_DESCR;
+            driver_parameter_info.long_descr = ENGINE_DRIVER_PARAMETER_LONG_DESCR;
+
+            jack_controller_get_parameter_info_ex(call, &driver_parameter_info);
+
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_server_get_parameters(controller_ptr->server), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown engine parameter '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_info(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(controller_ptr->driver), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[1],
+                jackctl_driver_get_name(controller_ptr->driver));
+            return;
+        }
+
+        jack_controller_get_parameter_info(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+        if (driver == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown driver '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(driver), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_info(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+        if (internal == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown internal '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_internal_get_parameters(internal), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for internal '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_info(call, parameter);
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+}
+
+static
+void
+jack_controller_get_parameter_constraint(
+    struct jack_dbus_method_call * call,
+    jackctl_parameter_t * parameter)
+{
+    uint32_t index;
+    uint32_t count;
+	union jackctl_parameter_value min;
+	union jackctl_parameter_value max;
+    union jackctl_parameter_value jackctl_value;
+    DBusMessageIter iter, array_iter, struct_iter;
+    const char * descr;
+    jackctl_param_type_t type;
+    message_arg_t value;
+    bool is_range;
+
+    type = jackctl_parameter_get_type(parameter);
+
+    call->reply = dbus_message_new_method_return(call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append(call->reply, &iter);
+
+    is_range = jackctl_parameter_has_range_constraint(parameter);
+    value.boolean = is_range;
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &value))
+    {
+        goto fail_unref;
+    }
+
+    value.boolean = jackctl_parameter_constraint_is_strict(parameter);
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &value))
+    {
+        goto fail_unref;
+    }
+
+    value.boolean = jackctl_parameter_constraint_is_fake_value(parameter);
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &value))
+    {
+        goto fail_unref;
+    }
+
+    /* Open the array. */
+    if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(vs)", &array_iter))
+    {
+        goto fail_unref;
+    }
+
+    if (is_range)
+    {
+        jackctl_parameter_get_range_constraint(parameter, &min, &max);
+
+        /* Open the struct. */
+        if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        jack_controller_jack_to_dbus_variant(type, &min, &value);
+
+        if (!jack_dbus_message_append_variant(&struct_iter, PARAM_TYPE_JACK_TO_DBUS(type), PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type), &value))
+        {
+            goto fail_close2_unref;
+        }
+
+        descr = "min";
+
+        if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &descr))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Close the struct. */
+        if (!dbus_message_iter_close_container(&array_iter, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        /* Open the struct. */
+        if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        jack_controller_jack_to_dbus_variant(type, &max, &value);
+ 
+        if (!jack_dbus_message_append_variant(&struct_iter, PARAM_TYPE_JACK_TO_DBUS(type), PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type), &value))
+        {
+            goto fail_close2_unref;
+        }
+
+        descr = "max";
+
+        if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &descr))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Close the struct. */
+        if (!dbus_message_iter_close_container(&array_iter, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+    }
+    else
+    {
+        count = jackctl_parameter_get_enum_constraints_count(parameter);
+
+        /* Append enum values to the array. */
+        for (index = 0 ; index < count ; index++)
+        {
+            jackctl_value = jackctl_parameter_get_enum_constraint_value(parameter, index);
+            descr = jackctl_parameter_get_enum_constraint_description(parameter, index);
+
+            jack_controller_jack_to_dbus_variant(type, &jackctl_value, &value);
+
+            /* Open the struct. */
+            if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+            {
+                goto fail_close_unref;
+            }
+
+            if (!jack_dbus_message_append_variant(&struct_iter, PARAM_TYPE_JACK_TO_DBUS(type), PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type), &value))
+            {
+                goto fail_close2_unref;
+            }
+
+            if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &descr))
+            {
+                goto fail_close2_unref;
+            }
+
+            /* Close the struct. */
+            if (!dbus_message_iter_close_container(&array_iter, &struct_iter))
+            {
+                goto fail_close_unref;
+            }
+        }
+    }
+
+    /* Close the array. */
+    if (!dbus_message_iter_close_container(&iter, &array_iter))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_close2_unref:
+    dbus_message_iter_close_container(&array_iter, &struct_iter);
+
+fail_close_unref:
+    dbus_message_iter_close_container(&iter, &array_iter);
+
+fail_unref:
+    dbus_message_unref(call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+static
+void
+jack_controller_get_parameter_constraint_engine_driver(
+    struct jack_dbus_method_call * call)
+{
+    unsigned int index;
+    DBusMessageIter iter, array_iter, struct_iter;
+    jackctl_param_type_t type;
+    dbus_bool_t bval;
+    message_arg_t value;
+
+    type = ENGINE_DRIVER_PARAMETER_TYPE;
+
+    call->reply = dbus_message_new_method_return(call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append(call->reply, &iter);
+
+    /* is_range */
+    bval = false;
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &bval))
+    {
+        goto fail_unref;
+    }
+
+    /* is_strict */
+    bval = true;
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &bval))
+    {
+        goto fail_unref;
+    }
+
+    /* is_fake_value */
+    bval = true;
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &bval))
+    {
+        goto fail_unref;
+    }
+
+    /* Open the array. */
+    if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(vs)", &array_iter))
+    {
+        goto fail_unref;
+    }
+
+    /* Append enum values to the array. */
+    for (index = 0 ; index < controller_ptr->drivers_count ; index++)
+    {
+        /* Open the struct. */
+        if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+
+        value.string = controller_ptr->driver_names[index];
+        if (!jack_dbus_message_append_variant(
+                &struct_iter,
+                PARAM_TYPE_JACK_TO_DBUS(type),
+                PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type),
+                &value))
+        {
+            goto fail_close2_unref;
+        }
+
+        if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &value))
+        {
+            goto fail_close2_unref;
+        }
+
+        /* Close the struct. */
+        if (!dbus_message_iter_close_container(&array_iter, &struct_iter))
+        {
+            goto fail_close_unref;
+        }
+    }
+
+    /* Close the array. */
+    if (!dbus_message_iter_close_container(&iter, &array_iter))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_close2_unref:
+    dbus_message_iter_close_container(&array_iter, &struct_iter);
+
+fail_close_unref:
+    dbus_message_iter_close_container(&iter, &array_iter);
+
+fail_unref:
+    dbus_message_unref(call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+static
+void
+jack_controller_dbus_get_parameter_constraint(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+    jackctl_parameter_t * parameter;
+
+    //jack_info("jack_controller_dbus_get_parameter_constraint() called");
+
+    if (!jack_controller_dbus_get_parameter_address(call, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        if (strcmp(address[1], ENGINE_DRIVER_PARAMETER_NAME) == 0)
+        {
+            jack_controller_get_parameter_constraint_engine_driver(call);
+
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_server_get_parameters(controller_ptr->server), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown engine parameter '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_constraint(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(controller_ptr->driver), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[1],
+                jackctl_driver_get_name(controller_ptr->driver));
+            return;
+        }
+
+        jack_controller_get_parameter_constraint(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+        if (driver == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown driver '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(driver), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_constraint(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+        if (internal == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown internal '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_internal_get_parameters(internal), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for internal '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_constraint(call, parameter);
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+}
+
+static
+void
+jack_controller_get_parameter_value(
+    struct jack_dbus_method_call * call,
+    jackctl_parameter_t * parameter)
+{
+    int type;
+    union jackctl_parameter_value jackctl_value;
+    union jackctl_parameter_value jackctl_default_value;
+    message_arg_t value;
+    message_arg_t default_value;
+
+    type = jackctl_parameter_get_type(parameter);
+    jackctl_default_value = jackctl_parameter_get_default_value(parameter);
+    jackctl_value = jackctl_parameter_get_value(parameter);
+
+    jack_controller_jack_to_dbus_variant(type, &jackctl_value, &value);
+    jack_controller_jack_to_dbus_variant(type, &jackctl_default_value, &default_value);
+
+    /* Construct the reply. */
+    jack_dbus_construct_method_return_parameter(
+        call,
+        (dbus_bool_t)(jackctl_parameter_is_set(parameter) ? TRUE : FALSE),
+        PARAM_TYPE_JACK_TO_DBUS(type),
+        PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type),
+        default_value,
+        value);
+}
+
+static
+void
+jack_controller_get_parameter_value_engine_driver(
+    struct jack_dbus_method_call * call)
+{
+    message_arg_t value;
+    message_arg_t default_value;
+
+    default_value.string = DEFAULT_DRIVER;
+    value.string = jackctl_driver_get_name(controller_ptr->driver);
+
+    /* Construct the reply. */
+    jack_dbus_construct_method_return_parameter(
+        call,
+        controller_ptr->driver_set,
+        DBUS_TYPE_STRING,
+        DBUS_TYPE_STRING_AS_STRING,
+        default_value,
+        value);
+}
+
+
+static void
+jack_controller_dbus_get_parameter_value(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+    jackctl_parameter_t * parameter;
+
+    //jack_info("jack_controller_dbus_get_parameter_value() called");
+
+    if (!jack_controller_dbus_get_parameter_address(call, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        if (strcmp(address[1], ENGINE_DRIVER_PARAMETER_NAME) == 0)
+        {
+            jack_controller_get_parameter_value_engine_driver(call);
+
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_server_get_parameters(controller_ptr->server), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown engine parameter '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_value(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(controller_ptr->driver), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[1],
+                jackctl_driver_get_name(controller_ptr->driver));
+            return;
+        }
+
+        jack_controller_get_parameter_value(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+        if (driver == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown driver '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(driver), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_value(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+        if (internal == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown internal '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_internal_get_parameters(internal), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for internal '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_get_parameter_value(call, parameter);
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+}
+
+static
+void
+jack_controller_set_parameter_value(
+    struct jack_dbus_method_call * call,
+    jackctl_parameter_t * parameter,
+    message_arg_t * arg_ptr,
+    int arg_type)
+{
+    jackctl_param_type_t type;
+    union jackctl_parameter_value value;
+
+    type = jackctl_parameter_get_type(parameter);
+
+    if (PARAM_TYPE_JACK_TO_DBUS(type) != arg_type)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Parameter value type mismatch: was expecting '%c', got '%c'",
+            (char)PARAM_TYPE_JACK_TO_DBUS(type),
+            (char)arg_type);
+        return;
+    }
+
+    if (!jack_controller_dbus_to_jack_variant(
+            arg_type,
+            arg_ptr,
+            &value))
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Cannot convert parameter value");
+        return;
+    }
+
+    jackctl_parameter_set_value(parameter, &value);
+
+    jack_controller_settings_save_auto(controller_ptr);
+
+    jack_dbus_construct_method_return_empty(call);
+}
+
+static
+void
+jack_controller_set_parameter_value_engine_driver(
+    struct jack_dbus_method_call * call,
+    message_arg_t * arg_ptr,
+    int arg_type)
+{
+    union jackctl_parameter_value value;
+
+    if (arg_type != DBUS_TYPE_STRING)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Engine parameter value type mismatch: was expecting '%c', got '%c'",
+            (char)DBUS_TYPE_STRING,
+            (char)arg_type);
+        return;
+    }
+
+    if (!jack_controller_dbus_to_jack_variant(
+            arg_type,
+            arg_ptr,
+            &value))
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Cannot convert engine parameter value");
+        return;
+    }
+
+    if (!jack_controller_select_driver(controller_ptr, value.str))
+    {
+        /* Couldn't find driver with the specified name. */
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_UNKNOWN_DRIVER,
+            "Unknown driver '%s'",
+            value.str);
+        return;
+    }
+
+    jack_controller_settings_save_auto(controller_ptr);
+
+    jack_dbus_construct_method_return_empty(call);
+}
+
+static
+void
+jack_controller_dbus_set_parameter_value(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    DBusMessageIter iter;
+    DBusMessageIter variant_iter;
+    message_arg_t arg;
+    int arg_type;
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+    jackctl_parameter_t * parameter;
+
+    //jack_info("jack_controller_dbus_set_parameter_value() called");
+
+    if (!jack_controller_dbus_get_parameter_address_ex(call, &iter, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    dbus_message_iter_next(&iter);
+
+    if (dbus_message_iter_has_next(&iter))
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Invalid arguments to method '%s'. Too many arguments.",
+            call->method_name);
+        return;
+    }
+
+    if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "Invalid arguments to method '%s'. Value to set must be variant.",
+            call->method_name);
+        return;
+    }
+
+    dbus_message_iter_recurse (&iter, &variant_iter);
+    dbus_message_iter_get_basic(&variant_iter, &arg);
+    arg_type = dbus_message_iter_get_arg_type(&variant_iter);
+
+    //jack_info("argument of type '%c'", arg_type);
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        if (strcmp(address[1], ENGINE_DRIVER_PARAMETER_NAME) == 0)
+        {
+            jack_controller_set_parameter_value_engine_driver(call, &arg, arg_type);
+
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_server_get_parameters(controller_ptr->server), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown engine parameter '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_set_parameter_value(call, parameter, &arg, arg_type);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(controller_ptr->driver), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[1],
+                jackctl_driver_get_name(controller_ptr->driver));
+            return;
+        }
+
+        jack_controller_set_parameter_value(call, parameter, &arg, arg_type);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+        if (driver == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown driver '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(driver), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_set_parameter_value(call, parameter, &arg, arg_type);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+        if (internal == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown internal '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_internal_get_parameters(internal), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for internal '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_set_parameter_value(call, parameter, &arg, arg_type);
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+}
+
+static
+void
+jack_controller_reset_parameter_value(
+    struct jack_dbus_method_call * call,
+    jackctl_parameter_t * parameter)
+{
+    jackctl_parameter_reset(parameter);
+
+    jack_controller_settings_save_auto(controller_ptr);
+
+    jack_dbus_construct_method_return_empty(call);
+}
+
+static
+void
+jack_controller_reset_parameter_value_engine_driver(
+    struct jack_dbus_method_call * call)
+{
+    if (!jack_controller_select_driver(controller_ptr, DEFAULT_DRIVER))
+    {
+        /* Couldn't find driver with the specified name. */
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_UNKNOWN_DRIVER,
+            "Default driver '%s' is unknown",
+            DEFAULT_DRIVER);
+        return;
+    }
+
+    controller_ptr->driver_set = false;
+
+    jack_controller_settings_save_auto(controller_ptr);
+
+    jack_dbus_construct_method_return_empty(call);
+}
+
+static
+void
+jack_controller_dbus_reset_parameter_value(
+    struct jack_dbus_method_call * call)
+{
+    const char * address[3];
+    jackctl_internal_t * internal;
+    jackctl_driver_t * driver;
+    jackctl_parameter_t * parameter;
+
+    //jack_info("jack_controller_dbus_reset_parameter_value() called");
+
+    if (!jack_controller_dbus_get_parameter_address(call, address))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_controller_dbus_get_parameter_address() has
+         * constructed an error for us. */
+        return;
+    }
+
+    //jack_info("address is '%s':'%s':'%s'", address[0], address[1], address[2]);
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_ENGINE) == 0) /* engine parameters requested */
+    {
+        if (strcmp(address[1], ENGINE_DRIVER_PARAMETER_NAME) == 0)
+        {
+            jack_controller_reset_parameter_value_engine_driver(call);
+
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_server_get_parameters(controller_ptr->server), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown engine parameter '%s'",
+                address[1]);
+            return;
+        }
+
+        jack_controller_reset_parameter_value(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] == NULL &&
+        strcmp(address[0], PTNODE_DRIVER) == 0) /* current driver parameters requested */
+    {
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(controller_ptr->driver), address[1]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[1],
+                jackctl_driver_get_name(controller_ptr->driver));
+            return;
+        }
+
+        jack_controller_reset_parameter_value(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_DRIVERS) == 0)
+    {
+        driver = jack_controller_find_driver(controller_ptr->server, address[1]);
+        if (driver == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown driver '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(driver), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for driver '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_reset_parameter_value(call, parameter);
+
+        return;
+    }
+
+    if (address[0] != NULL &&
+        address[1] != NULL &&
+        address[2] != NULL &&
+        strcmp(address[0], PTNODE_INTERNALS) == 0)
+    {
+        internal = jack_controller_find_internal(controller_ptr->server, address[1]);
+        if (internal == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_INTERNAL,
+                "Unknown internal '%s'",
+                address[1]);
+            return;
+        }
+
+        parameter = jack_controller_find_parameter(jackctl_internal_get_parameters(internal), address[2]);
+        if (parameter == NULL)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_UNKNOWN_PARAMETER,
+                "Unknown parameter '%s' for internal '%s'",
+                address[2],
+                address[1]);
+            return;
+        }
+
+        jack_controller_reset_parameter_value(call, parameter);
+
+        return;
+    }
+
+    jack_dbus_error(
+        call,
+        JACK_DBUS_ERROR_INVALID_ARGS,
+        "Invalid container address '%s':'%s':'%s' supplied to method '%s'.",
+        address[0],
+        address[1],
+        address[2],
+        call->method_name);
+}
+
+#undef controller_ptr
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(ReadContainer, "Get names of child parameters or containers")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parent", "as", "Address of parent container")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("leaf", "b", "Whether children are parameters (true) or containers (false)")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("children", "as", "Array of child names")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(GetParametersInfo, "Retrieve info about parameters")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parent", "as", "Address of parameters parent")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("parameter_info_array", "a(ysss)", "Array of parameter info structs. Each info struct contains: type char, name, short and long description")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(GetParameterInfo, "Retrieve info about parameter")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parameter", "as", "Address of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("parameter_info", "(ysss)", "Parameter info struct that contains: type char, name, short and long description")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(GetParameterConstraint, "Get constraint of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parameter", "as", "Address of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("is_range", "b", "Whether constrinat is a range. If so, values parameter will contain two values, min and max")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("is_strict", "b", "Whether enum constraint is strict. I.e. value not listed in values array will not work")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("is_fake_value", "b", "Whether enum values are fake. I.e. have no user meaningful meaning")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("values", "a(vs)", "Values. If there is no constraint, this array will be empty. For range constraint there will be two values, min and max. For enum constraint there will be 2 or more values.")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(GetParameterValue, "Get value of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parameter", "as", "Address of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("is_set", "b", "Whether parameter is set or its default value is used")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("default", "v", "Default value of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_OUT("value", "v", "Actual value of parameter")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(SetParameterValue, "Set value of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parameter", "as", "Address of parameter")
+    JACK_DBUS_METHOD_ARGUMENT_IN("value", "v", "New value for parameter")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(ResetParameterValue, "Reset parameter to default value")
+    JACK_DBUS_METHOD_ARGUMENT_IN("parameter", "as", "Address of parameter")
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHODS_BEGIN
+    JACK_DBUS_METHOD_DESCRIBE(ReadContainer, jack_controller_dbus_read_container)
+    JACK_DBUS_METHOD_DESCRIBE(GetParametersInfo, jack_controller_dbus_get_parameters_info)
+    JACK_DBUS_METHOD_DESCRIBE(GetParameterInfo, jack_controller_dbus_get_parameter_info)
+    JACK_DBUS_METHOD_DESCRIBE(GetParameterConstraint, jack_controller_dbus_get_parameter_constraint)
+    JACK_DBUS_METHOD_DESCRIBE(GetParameterValue, jack_controller_dbus_get_parameter_value)
+    JACK_DBUS_METHOD_DESCRIBE(SetParameterValue, jack_controller_dbus_set_parameter_value)
+    JACK_DBUS_METHOD_DESCRIBE(ResetParameterValue, jack_controller_dbus_reset_parameter_value)
+JACK_DBUS_METHODS_END
+
+/*
+ * Parameter addresses:
+ *
+ * "engine"
+ * "engine", "driver"
+ * "engine", "realtime"
+ * "engine", ...more engine parameters
+ *
+ * "driver", "device"
+ * "driver", ...more driver parameters
+ *
+ * "drivers", "alsa", "device"
+ * "drivers", "alsa", ...more alsa driver parameters
+ *
+ * "drivers", ...more drivers
+ *
+ * "internals", "netmanager", "multicast_ip"
+ * "internals", "netmanager", ...more netmanager parameters
+ *
+ * "internals", ...more internals
+ *
+ */
+
+JACK_DBUS_IFACE_BEGIN(g_jack_controller_iface_configure, "org.jackaudio.Configure")
+    JACK_DBUS_IFACE_EXPOSE_METHODS
+JACK_DBUS_IFACE_END
diff --git a/dbus/controller_iface_control.c b/dbus/controller_iface_control.c
new file mode 100644
index 0000000..ca3ab03
--- /dev/null
+++ b/dbus/controller_iface_control.c
@@ -0,0 +1,392 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <dbus/dbus.h>
+
+#include "jackdbus.h"
+#include "controller_internal.h"
+
+#define JACK_DBUS_IFACE_NAME "org.jackaudio.JackControl"
+
+void
+jack_controller_control_send_signal_server_started()
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "ServerStarted",
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_control_send_signal_server_stopped()
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "ServerStopped",
+        DBUS_TYPE_INVALID);
+}
+
+#define controller_ptr ((struct jack_controller *)call->context)
+
+/*
+ * Check if the supplied method name exists in org.jackaudio.JackControl,
+ * if it does execute it and return true. Otherwise return false.
+ */
+static
+bool
+jack_control_run_method(
+    struct jack_dbus_method_call * call,
+    const struct jack_dbus_interface_method_descriptor * methods)
+{
+    int ret;
+    int type;
+    message_arg_t arg;
+
+    /* use empty reply if not overriden in the code that follows */
+    type = DBUS_TYPE_INVALID;
+
+    if (strcmp (call->method_name, "Exit") == 0)
+    {
+        g_exit_command = TRUE;
+    }
+    else if (strcmp (call->method_name, "IsStarted") == 0)
+    {
+        type = DBUS_TYPE_BOOLEAN;
+        arg.boolean = (dbus_bool_t) (controller_ptr->started ? TRUE : FALSE);
+    }
+    else if (strcmp (call->method_name, "StartServer") == 0)
+    {
+        if (!jack_controller_start_server(controller_ptr, call))
+        {
+            jack_error ("Failed to start server");
+        }
+        else
+        {
+            jack_controller_control_send_signal_server_started();
+        }
+    }
+    else if (strcmp (call->method_name, "StopServer") == 0)
+    {
+        if (!jack_controller_stop_server(controller_ptr, call))
+        {
+            jack_error ("Failed to stop server");
+        }
+        else
+        {
+            jack_controller_control_send_signal_server_stopped();
+        }
+    }
+    else if (strcmp (call->method_name, "SwitchMaster") == 0)
+    {
+        if (!jack_controller_switch_master(controller_ptr, call))
+        {
+            jack_error ("Failed to switch master");
+        }
+        else
+        {
+            jack_controller_control_send_signal_server_stopped();
+        }
+    }
+    else if (strcmp (call->method_name, "GetLoad") == 0)
+    {
+        if (!controller_ptr->started)
+        {
+            goto not_started;
+        }
+
+        type = DBUS_TYPE_DOUBLE;
+        arg.doubl = jack_cpu_load(controller_ptr->client);
+    }
+    else if (strcmp (call->method_name, "GetXruns") == 0)
+    {
+        type = DBUS_TYPE_UINT32;
+        arg.uint32 = controller_ptr->xruns;
+    }
+    else if (strcmp (call->method_name, "GetSampleRate") == 0)
+    {
+        if (!controller_ptr->started)
+        {
+            goto not_started;
+        }
+
+        type = DBUS_TYPE_UINT32;
+        arg.uint32 = jack_get_sample_rate(controller_ptr->client);
+    }
+    else if (strcmp (call->method_name, "GetLatency") == 0)
+    {
+        if (!controller_ptr->started)
+        {
+            goto not_started;
+        }
+
+        type = DBUS_TYPE_DOUBLE;
+        arg.doubl =  ((float)jack_get_buffer_size(controller_ptr->client) / (float)jack_get_sample_rate(controller_ptr->client)) * 1000.0f;
+    }
+    else if (strcmp (call->method_name, "GetBufferSize") == 0)
+    {
+        if (!controller_ptr->started)
+        {
+            goto not_started;
+        }
+
+        type = DBUS_TYPE_UINT32;
+        arg.uint32 = jack_get_buffer_size(controller_ptr->client);
+    }
+    else if (strcmp (call->method_name, "SetBufferSize") == 0)
+    {
+        dbus_uint32_t buffer_size;
+
+        if (!controller_ptr->started)
+        {
+            goto not_started;
+        }
+
+        if (!jack_dbus_get_method_args(call, DBUS_TYPE_UINT32, &buffer_size, DBUS_TYPE_INVALID))
+        {
+            /* jack_dbus_get_method_args() has set reply for us */
+            goto exit;
+        }
+
+        ret = jack_set_buffer_size(controller_ptr->client, buffer_size);
+        if (ret != 0)
+        {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_GENERIC,
+                "jack_set_buffer_size(%u) failed with error %d", (unsigned int)buffer_size, ret);
+
+            goto exit;
+        }
+    }
+    else if (strcmp (call->method_name, "IsRealtime") == 0)
+    {
+        type = DBUS_TYPE_BOOLEAN;
+        arg.boolean = jack_is_realtime(controller_ptr->client) ? TRUE : FALSE;
+    }
+    else if (strcmp (call->method_name, "ResetXruns") == 0)
+    {
+        controller_ptr->xruns = 0;
+    }
+    else if (strcmp (call->method_name, "LoadInternal") == 0)
+    {
+        const char *internal_name;
+
+        if (!jack_dbus_get_method_args(call, DBUS_TYPE_STRING, &internal_name, DBUS_TYPE_INVALID))
+        {
+            /* The method call had invalid arguments meaning that
+            * get_method_args() has constructed an error for us.
+            */
+            goto exit;
+        }
+    
+        if (!jack_controller_load_internal(controller_ptr, internal_name)) {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_GENERIC,
+                "jack_controller_load_internal failed for internal (%s)", internal_name);
+        }
+    }
+    else if (strcmp (call->method_name, "AddSlave") == 0)
+    {
+        const char *driver_name;
+
+        if (!jack_dbus_get_method_args(call, DBUS_TYPE_STRING, &driver_name, DBUS_TYPE_INVALID))
+        {
+            /* The method call had invalid arguments meaning that
+            * get_method_args() has constructed an error for us.
+            */
+            goto exit;
+        }
+        
+        if (!jack_controller_add_slave(controller_ptr, driver_name)) {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_GENERIC,
+                "jack_controller_add_slave failed for driver (%s)", driver_name);
+        }
+    }
+    else if (strcmp (call->method_name, "RemoveSlave") == 0)
+    {
+        const char *driver_name;
+
+        if (!jack_dbus_get_method_args(call, DBUS_TYPE_STRING, &driver_name, DBUS_TYPE_INVALID))
+        {
+            /* The method call had invalid arguments meaning that
+            * get_method_args() has constructed an error for us.
+            */
+            goto exit;
+        }
+        
+        if (!jack_controller_remove_slave(controller_ptr, driver_name)) {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_GENERIC,
+                "jack_controller_remove_slave failed for driver (%s)", driver_name);
+        }
+    }
+    else if (strcmp (call->method_name, "UnloadInternal") == 0)
+    {
+        const char *internal_name;
+
+        if (!jack_dbus_get_method_args(call, DBUS_TYPE_STRING, &internal_name, DBUS_TYPE_INVALID))
+        {
+            /* The method call had invalid arguments meaning that
+            * get_method_args() has constructed an error for us.
+            */
+            goto exit;
+        }
+        
+        if (!jack_controller_unload_internal(controller_ptr, internal_name)) {
+            jack_dbus_error(
+                call,
+                JACK_DBUS_ERROR_GENERIC,
+                "jack_controller_unload_internal failed for internal (%s)", internal_name);
+        }
+    }
+
+    else
+    {
+        return false;
+    }
+
+    jack_dbus_construct_method_return_single(call, type, arg);
+
+    return true;
+
+not_started:
+    jack_dbus_only_error(
+        call,
+        JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+        "Can't execute method '%s' with stopped JACK server",
+        call->method_name);
+
+exit:
+    return true;
+}
+
+#undef controller_ptr
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(IsStarted)
+    JACK_DBUS_METHOD_ARGUMENT("started", "b", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(StartServer)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(StopServer)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(SwitchMaster)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetLoad)
+    JACK_DBUS_METHOD_ARGUMENT("load", "d", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetXruns)
+    JACK_DBUS_METHOD_ARGUMENT("xruns_count", "u", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetSampleRate)
+    JACK_DBUS_METHOD_ARGUMENT("sample_rate", "u", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetLatency)
+    JACK_DBUS_METHOD_ARGUMENT("latency_ms", "d", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetBufferSize)
+    JACK_DBUS_METHOD_ARGUMENT("buffer_size_frames", "u", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(SetBufferSize)
+    JACK_DBUS_METHOD_ARGUMENT("buffer_size_frames", "u", false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(IsRealtime)
+    JACK_DBUS_METHOD_ARGUMENT("realtime", "b", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(ResetXruns)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(LoadInternal)
+    JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(UnloadInternal)
+    JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(AddSlave)
+    JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(RemoveSlave)
+    JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHODS_BEGIN
+    JACK_DBUS_METHOD_DESCRIBE(IsStarted, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(StartServer, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(StopServer, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(SwitchMaster, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(GetLoad, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(GetXruns, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(GetSampleRate, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(GetLatency, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(GetBufferSize, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(SetBufferSize, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(IsRealtime, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(ResetXruns, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(LoadInternal, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(UnloadInternal, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(AddSlave, NULL)
+    JACK_DBUS_METHOD_DESCRIBE(RemoveSlave, NULL)
+JACK_DBUS_METHODS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(ServerStarted)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(ServerStopped)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNALS_BEGIN
+    JACK_DBUS_SIGNAL_DESCRIBE(ServerStarted)
+    JACK_DBUS_SIGNAL_DESCRIBE(ServerStopped)
+JACK_DBUS_SIGNALS_END
+
+JACK_DBUS_IFACE_BEGIN(g_jack_controller_iface_control, JACK_DBUS_IFACE_NAME)
+    JACK_DBUS_IFACE_HANDLER(jack_control_run_method)
+    JACK_DBUS_IFACE_EXPOSE_METHODS
+    JACK_DBUS_IFACE_EXPOSE_SIGNALS
+JACK_DBUS_IFACE_END
diff --git a/dbus/controller_iface_introspectable.c b/dbus/controller_iface_introspectable.c
new file mode 100644
index 0000000..8b1a644
--- /dev/null
+++ b/dbus/controller_iface_introspectable.c
@@ -0,0 +1,156 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007-2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <dbus/dbus.h>
+
+#include "jackdbus.h"
+
+static char g_xml_data[102400];
+
+static
+void
+jack_controller_dbus_introspect(
+    struct jack_dbus_method_call * call)
+{
+    jack_dbus_construct_method_return_single(
+        call,
+        DBUS_TYPE_STRING,
+        (message_arg_t)(const char *)g_xml_data);
+}
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(Introspect)
+    JACK_DBUS_METHOD_ARGUMENT("xml_data", "s", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHODS_BEGIN
+    JACK_DBUS_METHOD_DESCRIBE(Introspect, jack_controller_dbus_introspect)
+JACK_DBUS_METHODS_END
+
+JACK_DBUS_IFACE_BEGIN(g_jack_controller_iface_introspectable, "org.freedesktop.DBus.Introspectable")
+    JACK_DBUS_IFACE_EXPOSE_METHODS
+JACK_DBUS_IFACE_END
+
+static char * g_buffer_ptr;
+
+static
+void
+write_line_format(const char * format, ...)
+{
+    va_list ap;
+
+    va_start(ap, format);
+    g_buffer_ptr += vsprintf(g_buffer_ptr, format, ap);
+    va_end(ap);
+}
+
+static
+void
+write_line(const char * line)
+{
+    write_line_format("%s\n", line);
+}
+
+void jack_controller_introspect_init() __attribute__((constructor));
+
+void
+jack_controller_introspect_init()
+{
+    struct jack_dbus_interface_descriptor ** interface_ptr_ptr;
+    const struct jack_dbus_interface_method_descriptor * method_ptr;
+    const struct jack_dbus_interface_method_argument_descriptor * method_argument_ptr;
+    const struct jack_dbus_interface_signal_descriptor * signal_ptr;
+    const struct jack_dbus_interface_signal_argument_descriptor * signal_argument_ptr;
+
+    g_buffer_ptr = g_xml_data;
+
+    write_line("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"");
+    write_line("\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">");
+
+    write_line("<node name=\"" JACK_CONTROLLER_OBJECT_PATH "\">");
+
+    interface_ptr_ptr = g_jackcontroller_interfaces;
+
+    while (*interface_ptr_ptr != NULL)
+    {
+        write_line_format("  <interface name=\"%s\">\n", (*interface_ptr_ptr)->name);
+
+        if ((*interface_ptr_ptr)->methods != NULL)
+        {
+            method_ptr = (*interface_ptr_ptr)->methods;
+            while (method_ptr->name != NULL)
+            {
+                write_line_format("    <method name=\"%s\">\n", method_ptr->name);
+
+                method_argument_ptr = method_ptr->arguments;
+
+                while (method_argument_ptr->name != NULL)
+                {
+                    write_line_format(
+                        "      <arg name=\"%s\" type=\"%s\" direction=\"%s\" />\n",
+                        method_argument_ptr->name,
+                        method_argument_ptr->type,
+                        method_argument_ptr->direction_out ? "out" : "in");
+                    method_argument_ptr++;
+                }
+
+                write_line("    </method>");
+                method_ptr++;
+            }
+        }
+
+        if ((*interface_ptr_ptr)->signals != NULL)
+        {
+            signal_ptr = (*interface_ptr_ptr)->signals;
+            while (signal_ptr->name != NULL)
+            {
+                write_line_format("    <signal name=\"%s\">\n", signal_ptr->name);
+
+                signal_argument_ptr = signal_ptr->arguments;
+
+                while (signal_argument_ptr->name != NULL)
+                {
+                    write_line_format(
+                        "      <arg name=\"%s\" type=\"%s\" />\n",
+                        signal_argument_ptr->name,
+                        signal_argument_ptr->type);
+                    signal_argument_ptr++;
+                }
+
+                write_line("    </signal>");
+                signal_ptr++;
+            }
+        }
+
+        write_line("  </interface>");
+        interface_ptr_ptr++;
+    }
+
+    write_line("</node>");
+
+    *g_buffer_ptr = 0;
+}
diff --git a/dbus/controller_iface_patchbay.c b/dbus/controller_iface_patchbay.c
new file mode 100644
index 0000000..ed477d7
--- /dev/null
+++ b/dbus/controller_iface_patchbay.c
@@ -0,0 +1,1959 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2008 Nedko Arnaudov
+    Copyright (C) 2008 Juuso Alasuutari
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#define _GNU_SOURCE            /* PTHREAD_MUTEX_RECURSIVE */
+
+#include <stdint.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <dbus/dbus.h>
+#include <pthread.h>
+
+#include "jackdbus.h"
+#include "controller_internal.h"
+#include "list.h"
+
+#define JACK_DBUS_IFACE_NAME "org.jackaudio.JackPatchbay"
+
+/* FIXME: these need to be retrieved from common headers */
+#define JACK_CLIENT_NAME_SIZE 64
+#define JACK_PORT_NAME_SIZE 256
+
+struct jack_graph
+{
+    uint64_t version;
+    struct list_head clients;
+    struct list_head ports;
+    struct list_head connections;
+};
+
+struct jack_graph_client
+{
+    uint64_t id;
+    char * name;
+    int pid;
+    struct list_head siblings;
+    struct list_head ports;
+};
+
+struct jack_graph_port
+{
+    uint64_t id;
+    char * name;
+    uint32_t flags;
+    uint32_t type;
+    struct list_head siblings_graph;
+    struct list_head siblings_client;
+    struct jack_graph_client * client;
+};
+
+struct jack_graph_connection
+{
+    uint64_t id;
+    struct jack_graph_port * port1;
+    struct jack_graph_port * port2;
+    struct list_head siblings;
+};
+
+struct jack_controller_patchbay
+{
+    pthread_mutex_t lock;
+    struct jack_graph graph;
+    uint64_t next_client_id;
+    uint64_t next_port_id;
+    uint64_t next_connection_id;
+};
+
+void
+jack_controller_patchbay_send_signal_graph_changed(
+    dbus_uint64_t new_graph_version)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "GraphChanged",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_client_appeared(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client_id,
+    const char * client_name)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "ClientAppeared",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client_id,
+        DBUS_TYPE_STRING,
+        &client_name,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_client_disappeared(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client_id,
+    const char * client_name)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "ClientDisappeared",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client_id,
+        DBUS_TYPE_STRING,
+        &client_name,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_port_appeared(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client_id,
+    const char * client_name,
+    dbus_uint64_t port_id,
+    const char * port_name,
+    dbus_uint32_t port_flags,
+    dbus_uint32_t port_type)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "PortAppeared",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client_id,
+        DBUS_TYPE_STRING,
+        &client_name,
+        DBUS_TYPE_UINT64,
+        &port_id,
+        DBUS_TYPE_STRING,
+        &port_name,
+        DBUS_TYPE_UINT32,
+        &port_flags,
+        DBUS_TYPE_UINT32,
+        &port_type,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_port_disappeared(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client_id,
+    const char * client_name,
+    dbus_uint64_t port_id,
+    const char * port_name)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "PortDisappeared",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client_id,
+        DBUS_TYPE_STRING,
+        &client_name,
+        DBUS_TYPE_UINT64,
+        &port_id,
+        DBUS_TYPE_STRING,
+        &port_name,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_ports_connected(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client1_id,
+    const char * client1_name,
+    dbus_uint64_t port1_id,
+    const char * port1_name,
+    dbus_uint64_t client2_id,
+    const char * client2_name,
+    dbus_uint64_t port2_id,
+    const char * port2_name,
+    dbus_uint64_t connection_id)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "PortsConnected",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client1_id,
+        DBUS_TYPE_STRING,
+        &client1_name,
+        DBUS_TYPE_UINT64,
+        &port1_id,
+        DBUS_TYPE_STRING,
+        &port1_name,
+        DBUS_TYPE_UINT64,
+        &client2_id,
+        DBUS_TYPE_STRING,
+        &client2_name,
+        DBUS_TYPE_UINT64,
+        &port2_id,
+        DBUS_TYPE_STRING,
+        &port2_name,
+        DBUS_TYPE_UINT64,
+        &connection_id,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_ports_disconnected(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client1_id,
+    const char * client1_name,
+    dbus_uint64_t port1_id,
+    const char * port1_name,
+    dbus_uint64_t client2_id,
+    const char * client2_name,
+    dbus_uint64_t port2_id,
+    const char * port2_name,
+    dbus_uint64_t connection_id)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "PortsDisconnected",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client1_id,
+        DBUS_TYPE_STRING,
+        &client1_name,
+        DBUS_TYPE_UINT64,
+        &port1_id,
+        DBUS_TYPE_STRING,
+        &port1_name,
+        DBUS_TYPE_UINT64,
+        &client2_id,
+        DBUS_TYPE_STRING,
+        &client2_name,
+        DBUS_TYPE_UINT64,
+        &port2_id,
+        DBUS_TYPE_STRING,
+        &port2_name,
+        DBUS_TYPE_UINT64,
+        &connection_id,
+        DBUS_TYPE_INVALID);
+}
+
+void
+jack_controller_patchbay_send_signal_port_renamed(
+    dbus_uint64_t new_graph_version,
+    dbus_uint64_t client_id,
+    const char * client_name,
+    dbus_uint64_t port_id,
+    const char * port_old_name,
+    const char * port_new_name)
+{
+
+    jack_dbus_send_signal(
+        JACK_CONTROLLER_OBJECT_PATH,
+        JACK_DBUS_IFACE_NAME,
+        "PortRenamed",
+        DBUS_TYPE_UINT64,
+        &new_graph_version,
+        DBUS_TYPE_UINT64,
+        &client_id,
+        DBUS_TYPE_STRING,
+        &client_name,
+        DBUS_TYPE_UINT64,
+        &port_id,
+        DBUS_TYPE_STRING,
+        &port_old_name,
+        DBUS_TYPE_STRING,
+        &port_new_name,
+        DBUS_TYPE_INVALID);
+}
+
+static
+struct jack_graph_client *
+jack_controller_patchbay_find_client(
+    struct jack_controller_patchbay *patchbay_ptr,
+    const char *client_name,    /* not '\0' terminated */
+    size_t client_name_len)     /* without terminating '\0' */
+{
+    struct list_head *node_ptr;
+    struct jack_graph_client *client_ptr;
+
+    list_for_each(node_ptr, &patchbay_ptr->graph.clients)
+    {
+        client_ptr = list_entry(node_ptr, struct jack_graph_client, siblings);
+        if (strncmp(client_ptr->name, client_name, client_name_len) == 0)
+        {
+            return client_ptr;
+        }
+    }
+
+    return NULL;
+}
+
+static
+struct jack_graph_client *
+jack_controller_patchbay_find_client_by_id(
+    struct jack_controller_patchbay *patchbay_ptr,
+    uint64_t id)
+{
+    struct list_head *node_ptr;
+    struct jack_graph_client *client_ptr;
+
+    list_for_each(node_ptr, &patchbay_ptr->graph.clients)
+    {
+        client_ptr = list_entry(node_ptr, struct jack_graph_client, siblings);
+        if (client_ptr->id == id)
+        {
+            return client_ptr;
+        }
+    }
+
+    return NULL;
+}
+
+static
+struct jack_graph_client *
+jack_controller_patchbay_create_client(
+    struct jack_controller_patchbay *patchbay_ptr,
+    const char *client_name,    /* not '\0' terminated */
+    size_t client_name_len)     /* without terminating '\0' */
+{
+    struct jack_graph_client * client_ptr;
+
+    client_ptr = malloc(sizeof(struct jack_graph_client));
+    if (client_ptr == NULL)
+    {
+        jack_error("Memory allocation of jack_graph_client structure failed.");
+        goto fail;
+    }
+
+    client_ptr->name = malloc(client_name_len + 1);
+    if (client_ptr->name == NULL)
+    {
+        jack_error("malloc() failed to allocate memory for client name.");
+        goto fail_free_client;
+    }
+
+    memcpy(client_ptr->name, client_name, client_name_len);
+    client_ptr->name[client_name_len] = 0;
+
+    client_ptr->pid = jack_get_client_pid(client_ptr->name);
+    jack_info("New client '%s' with PID %d", client_ptr->name, client_ptr->pid);
+
+    client_ptr->id = patchbay_ptr->next_client_id++;
+    INIT_LIST_HEAD(&client_ptr->ports);
+
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    list_add_tail(&client_ptr->siblings, &patchbay_ptr->graph.clients);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_client_appeared(patchbay_ptr->graph.version, client_ptr->id, client_ptr->name);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    return client_ptr;
+
+fail_free_client:
+    free(client_ptr);
+
+fail:
+    return NULL;
+}
+
+static
+void
+jack_controller_patchbay_destroy_client(
+    struct jack_controller_patchbay *patchbay_ptr,
+    struct jack_graph_client *client_ptr)
+{
+    jack_info("Client '%s' with PID %d is out", client_ptr->name, client_ptr->pid);
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    list_del(&client_ptr->siblings);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_client_disappeared(patchbay_ptr->graph.version, client_ptr->id, client_ptr->name);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    free(client_ptr->name);
+    free(client_ptr);
+}
+
+static
+void
+jack_controller_patchbay_destroy_client_by_name(
+    struct jack_controller_patchbay *patchbay_ptr,
+    const char *client_name)    /* '\0' terminated */
+{
+    struct jack_graph_client *client_ptr;
+
+    client_ptr = jack_controller_patchbay_find_client(patchbay_ptr, client_name, strlen(client_name));
+    if (client_ptr == NULL)
+    {
+        jack_error("Cannot destroy unknown client '%s'", client_name);
+        return;
+    }
+
+    jack_controller_patchbay_destroy_client(patchbay_ptr, client_ptr);
+}
+
+static
+void
+jack_controller_patchbay_new_port(
+    struct jack_controller_patchbay *patchbay_ptr,
+    const char *port_full_name,
+    uint32_t port_flags,
+    uint32_t port_type)
+{
+    struct jack_graph_client *client_ptr;
+    struct jack_graph_port *port_ptr;
+    const char *port_short_name;
+    size_t client_name_len;
+
+    //jack_info("new port: %s", port_full_name);
+
+    port_short_name = strchr(port_full_name, ':');
+    if (port_short_name == NULL)
+    {
+        jack_error("port name '%s' does not contain ':' separator char", port_full_name);
+        return;
+    }
+
+    port_short_name++;          /* skip ':' separator char */
+
+    client_name_len = port_short_name - port_full_name - 1; /* without terminating '\0' */
+
+    client_ptr = jack_controller_patchbay_find_client(patchbay_ptr, port_full_name, client_name_len);
+    if (client_ptr == NULL)
+    {
+        client_ptr = jack_controller_patchbay_create_client(patchbay_ptr, port_full_name, client_name_len);
+        if (client_ptr == NULL)
+        {
+            jack_error("Creation of new jack_graph client failed.");
+            return;
+        }
+    }
+
+    port_ptr = malloc(sizeof(struct jack_graph_port));
+    if (port_ptr == NULL)
+    {
+        jack_error("Memory allocation of jack_graph_port structure failed.");
+        return;
+    }
+
+    port_ptr->name = strdup(port_short_name);
+    if (port_ptr->name == NULL)
+    {
+        jack_error("strdup() call for port name '%s' failed.", port_short_name);
+        free(port_ptr);
+        return;
+    }
+
+    port_ptr->id = patchbay_ptr->next_port_id++;
+    port_ptr->flags = port_flags;
+    port_ptr->type = port_type;
+    port_ptr->client = client_ptr;
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    list_add_tail(&port_ptr->siblings_client, &client_ptr->ports);
+    list_add_tail(&port_ptr->siblings_graph, &patchbay_ptr->graph.ports);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_port_appeared(
+        patchbay_ptr->graph.version,
+        client_ptr->id,
+        client_ptr->name,
+        port_ptr->id,
+        port_ptr->name,
+        port_ptr->flags,
+        port_ptr->type);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+static
+void
+jack_controller_patchbay_remove_port(
+    struct jack_controller_patchbay *patchbay_ptr,
+    struct jack_graph_port *port_ptr)
+{
+    //jack_info("remove port: %s", port_ptr->name);
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    list_del(&port_ptr->siblings_client);
+    list_del(&port_ptr->siblings_graph);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_port_disappeared(patchbay_ptr->graph.version, port_ptr->client->id, port_ptr->client->name, port_ptr->id, port_ptr->name);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    free(port_ptr->name);
+    free(port_ptr);
+}
+
+static
+struct jack_graph_port *
+jack_controller_patchbay_find_port_by_id(
+    struct jack_controller_patchbay *patchbay_ptr,
+    uint64_t port_id)
+{
+    struct list_head *node_ptr;
+    struct jack_graph_port *port_ptr;
+
+    list_for_each(node_ptr, &patchbay_ptr->graph.ports)
+    {
+        port_ptr = list_entry(node_ptr, struct jack_graph_port, siblings_graph);
+        if (port_ptr->id == port_id)
+        {
+            return port_ptr;
+        }
+    }
+
+    return NULL;
+}
+
+static
+struct jack_graph_port *
+jack_controller_patchbay_find_client_port_by_name(
+    struct jack_controller_patchbay *patchbay_ptr,
+    struct jack_graph_client *client_ptr,
+    const char *port_name)
+{
+    struct list_head *node_ptr;
+    struct jack_graph_port *port_ptr;
+
+    list_for_each(node_ptr, &client_ptr->ports)
+    {
+        port_ptr = list_entry(node_ptr, struct jack_graph_port, siblings_client);
+        if (strcmp(port_ptr->name, port_name) == 0)
+        {
+            return port_ptr;
+        }
+    }
+
+    return NULL;
+}
+
+static
+struct jack_graph_port *
+jack_controller_patchbay_find_port_by_full_name(
+    struct jack_controller_patchbay *patchbay_ptr,
+    const char *port_full_name)
+{
+    const char *port_short_name;
+    size_t client_name_len;
+    struct jack_graph_client *client_ptr;
+
+    //jack_info("name: %s", port_full_name);
+
+    port_short_name = strchr(port_full_name, ':');
+    if (port_short_name == NULL)
+    {
+        jack_error("port name '%s' does not contain ':' separator char", port_full_name);
+        return NULL;
+    }
+
+    port_short_name++;          /* skip ':' separator char */
+
+    client_name_len = port_short_name - port_full_name - 1; /* without terminating '\0' */
+
+    client_ptr = jack_controller_patchbay_find_client(patchbay_ptr, port_full_name, client_name_len);
+    if (client_ptr == NULL)
+    {
+        jack_error("cannot find client of port '%s'", port_full_name);
+        return NULL;
+    }
+
+    return jack_controller_patchbay_find_client_port_by_name(patchbay_ptr, client_ptr, port_short_name);
+}
+
+static
+struct jack_graph_port *
+jack_controller_patchbay_find_port_by_names(
+    struct jack_controller_patchbay *patchbay_ptr,
+    const char *client_name,
+    const char *port_name)
+{
+    struct jack_graph_client *client_ptr;
+
+    client_ptr = jack_controller_patchbay_find_client(patchbay_ptr, client_name, strlen(client_name));
+    if (client_ptr == NULL)
+    {
+        jack_error("cannot find client '%s'", client_name);
+        return NULL;
+    }
+
+    return jack_controller_patchbay_find_client_port_by_name(patchbay_ptr, client_ptr, port_name);
+}
+
+static
+struct jack_graph_connection *
+jack_controller_patchbay_create_connection(
+    struct jack_controller_patchbay *patchbay_ptr,
+    struct jack_graph_port *port1_ptr,
+    struct jack_graph_port *port2_ptr)
+{
+    struct jack_graph_connection * connection_ptr;
+
+    connection_ptr = malloc(sizeof(struct jack_graph_connection));
+    if (connection_ptr == NULL)
+    {
+        jack_error("Memory allocation of jack_graph_connection structure failed.");
+        return NULL;
+    }
+
+    connection_ptr->id = patchbay_ptr->next_connection_id++;
+    connection_ptr->port1 = port1_ptr;
+    connection_ptr->port2 = port2_ptr;
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    list_add_tail(&connection_ptr->siblings, &patchbay_ptr->graph.connections);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_ports_connected(
+        patchbay_ptr->graph.version,
+        port1_ptr->client->id,
+        port1_ptr->client->name,
+        port1_ptr->id,
+        port1_ptr->name,
+        port2_ptr->client->id,
+        port2_ptr->client->name,
+        port2_ptr->id,
+        port2_ptr->name,
+        connection_ptr->id);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    return connection_ptr;
+}
+
+static
+void
+jack_controller_patchbay_destroy_connection(
+    struct jack_controller_patchbay *patchbay_ptr,
+    struct jack_graph_connection *connection_ptr)
+{
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    list_del(&connection_ptr->siblings);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_ports_disconnected(
+        patchbay_ptr->graph.version,
+        connection_ptr->port1->client->id,
+        connection_ptr->port1->client->name,
+        connection_ptr->port1->id,
+        connection_ptr->port1->name,
+        connection_ptr->port2->client->id,
+        connection_ptr->port2->client->name,
+        connection_ptr->port2->id,
+        connection_ptr->port2->name,
+        connection_ptr->id);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    free(connection_ptr);
+}
+
+static
+struct jack_graph_connection *
+jack_controller_patchbay_find_connection(
+    struct jack_controller_patchbay *patchbay_ptr,
+    struct jack_graph_port *port1_ptr,
+    struct jack_graph_port *port2_ptr)
+{
+    struct list_head *node_ptr;
+    struct jack_graph_connection *connection_ptr;
+
+    list_for_each(node_ptr, &patchbay_ptr->graph.connections)
+    {
+        connection_ptr = list_entry(node_ptr, struct jack_graph_connection, siblings);
+        if ((connection_ptr->port1 == port1_ptr &&
+             connection_ptr->port2 == port2_ptr) ||
+            (connection_ptr->port1 == port2_ptr &&
+             connection_ptr->port2 == port1_ptr))
+        {
+            return connection_ptr;
+        }
+    }
+
+    return NULL;
+}
+
+static
+struct jack_graph_connection *
+jack_controller_patchbay_find_connection_by_id(
+    struct jack_controller_patchbay *patchbay_ptr,
+    uint64_t connection_id)
+{
+    struct list_head *node_ptr;
+    struct jack_graph_connection *connection_ptr;
+
+    list_for_each(node_ptr, &patchbay_ptr->graph.connections)
+    {
+        connection_ptr = list_entry(node_ptr, struct jack_graph_connection, siblings);
+        if (connection_ptr->id == connection_id)
+        {
+            return connection_ptr;
+        }
+    }
+
+    return NULL;
+}
+
+static
+bool
+jack_controller_patchbay_connect(
+    struct jack_dbus_method_call *dbus_call_ptr,
+    struct jack_controller *controller_ptr,
+    struct jack_graph_port *port1_ptr,
+    struct jack_graph_port *port2_ptr)
+{
+    int ret;
+    char port1_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char port2_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+
+    sprintf(port1_name, "%s:%s", port1_ptr->client->name, port1_ptr->name);
+    sprintf(port2_name, "%s:%s", port2_ptr->client->name, port2_ptr->name);
+
+    ret = jack_connect(controller_ptr->client, port1_name, port2_name);
+    if (ret != 0)
+    {
+        jack_dbus_error(dbus_call_ptr, JACK_DBUS_ERROR_GENERIC, "jack_connect() failed with %d", ret);
+        return false;
+    }
+
+    return true;
+}
+
+static
+bool
+jack_controller_patchbay_disconnect(
+    struct jack_dbus_method_call *dbus_call_ptr,
+    struct jack_controller *controller_ptr,
+    struct jack_graph_port *port1_ptr,
+    struct jack_graph_port *port2_ptr)
+{
+    int ret;
+    char port1_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char port2_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+
+    sprintf(port1_name, "%s:%s", port1_ptr->client->name, port1_ptr->name);
+    sprintf(port2_name, "%s:%s", port2_ptr->client->name, port2_ptr->name);
+
+    ret = jack_disconnect(controller_ptr->client, port1_name, port2_name);
+    if (ret != 0)
+    {
+        jack_dbus_error(dbus_call_ptr, JACK_DBUS_ERROR_GENERIC, "jack_connect() failed with %d", ret);
+        return false;
+    }
+
+    return true;
+}
+
+#define controller_ptr ((struct jack_controller *)call->context)
+#define patchbay_ptr ((struct jack_controller_patchbay *)controller_ptr->patchbay_context)
+
+static
+void
+jack_controller_dbus_get_all_ports(
+    struct jack_dbus_method_call * call)
+{
+    struct list_head * client_node_ptr;
+    struct list_head * port_node_ptr;
+    struct jack_graph_client * client_ptr;
+    struct jack_graph_port * port_ptr;
+    DBusMessageIter iter, sub_iter;
+    char fullname[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char *fullname_var = fullname;
+
+    if (!controller_ptr->started)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+            "Can't execute this method with stopped JACK server");
+        return;
+    }
+
+    call->reply = dbus_message_new_method_return (call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append (call->reply, &iter);
+
+    if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "s", &sub_iter))
+    {
+        goto fail_unref;
+    }
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    list_for_each(client_node_ptr, &patchbay_ptr->graph.clients)
+    {
+        client_ptr = list_entry(client_node_ptr, struct jack_graph_client, siblings);
+
+        list_for_each(port_node_ptr, &client_ptr->ports)
+        {
+            port_ptr = list_entry(port_node_ptr, struct jack_graph_port, siblings_client);
+
+            jack_info("%s:%s", client_ptr->name, port_ptr->name);
+            sprintf(fullname, "%s:%s", client_ptr->name, port_ptr->name);
+            if (!dbus_message_iter_append_basic (&sub_iter, DBUS_TYPE_STRING, &fullname_var))
+            {
+                pthread_mutex_unlock(&patchbay_ptr->lock);
+                dbus_message_iter_close_container (&iter, &sub_iter);
+                goto fail_unref;
+            }
+        }
+    }
+
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    if (!dbus_message_iter_close_container (&iter, &sub_iter))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_unref:
+    dbus_message_unref (call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+static
+void
+jack_controller_dbus_get_graph(
+    struct jack_dbus_method_call * call)
+{
+    struct list_head * client_node_ptr;
+    struct list_head * port_node_ptr;
+    struct list_head * connection_node_ptr;
+    struct jack_graph_client * client_ptr;
+    struct jack_graph_port * port_ptr;
+    struct jack_graph_connection * connection_ptr;
+    DBusMessageIter iter;
+    DBusMessageIter clients_array_iter;
+    DBusMessageIter client_struct_iter;
+    DBusMessageIter ports_array_iter;
+    DBusMessageIter port_struct_iter;
+    dbus_uint64_t version;
+    DBusMessageIter connections_array_iter;
+    DBusMessageIter connection_struct_iter;
+
+    if (!controller_ptr->started)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+            "Can't execute this method with stopped JACK server");
+        return;
+    }
+
+    if (!jack_dbus_get_method_args(call, DBUS_TYPE_UINT64, &version, DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        goto exit;
+    }
+
+    //jack_info("Getting graph, know version is %" PRIu32, version);
+
+    call->reply = dbus_message_new_method_return(call->message);
+    if (!call->reply)
+    {
+        jack_error("Ran out of memory trying to construct method return");
+        goto exit;
+    }
+
+    dbus_message_iter_init_append (call->reply, &iter);
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    if (version > patchbay_ptr->graph.version)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_INVALID_ARGS,
+            "known graph version %" PRIu64 " is newer than actual version %" PRIu64,
+            version,
+            patchbay_ptr->graph.version);
+        pthread_mutex_unlock(&patchbay_ptr->lock);
+        goto exit;
+    }
+
+    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT64, &patchbay_ptr->graph.version))
+    {
+        goto nomem_unlock;
+    }
+
+    if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(tsa(tsuu))", &clients_array_iter))
+    {
+        goto nomem_unlock;
+    }
+
+    if (version < patchbay_ptr->graph.version)
+    {
+        list_for_each(client_node_ptr, &patchbay_ptr->graph.clients)
+        {
+            client_ptr = list_entry(client_node_ptr, struct jack_graph_client, siblings);
+
+            if (!dbus_message_iter_open_container (&clients_array_iter, DBUS_TYPE_STRUCT, NULL, &client_struct_iter))
+            {
+                goto nomem_close_clients_array;
+            }
+
+            if (!dbus_message_iter_append_basic(&client_struct_iter, DBUS_TYPE_UINT64, &client_ptr->id))
+            {
+                goto nomem_close_client_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&client_struct_iter, DBUS_TYPE_STRING, &client_ptr->name))
+            {
+                goto nomem_close_client_struct;
+            }
+
+            if (!dbus_message_iter_open_container(&client_struct_iter, DBUS_TYPE_ARRAY, "(tsuu)", &ports_array_iter))
+            {
+                goto nomem_close_client_struct;
+            }
+
+            list_for_each(port_node_ptr, &client_ptr->ports)
+            {
+                port_ptr = list_entry(port_node_ptr, struct jack_graph_port, siblings_client);
+
+                if (!dbus_message_iter_open_container(&ports_array_iter, DBUS_TYPE_STRUCT, NULL, &port_struct_iter))
+                {
+                    goto nomem_close_ports_array;
+                }
+
+                if (!dbus_message_iter_append_basic(&port_struct_iter, DBUS_TYPE_UINT64, &port_ptr->id))
+                {
+                    goto nomem_close_port_struct;
+                }
+
+                if (!dbus_message_iter_append_basic(&port_struct_iter, DBUS_TYPE_STRING, &port_ptr->name))
+                {
+                    goto nomem_close_port_struct;
+                }
+
+                if (!dbus_message_iter_append_basic(&port_struct_iter, DBUS_TYPE_UINT32, &port_ptr->flags))
+                {
+                    goto nomem_close_port_struct;
+                }
+
+                if (!dbus_message_iter_append_basic(&port_struct_iter, DBUS_TYPE_UINT32, &port_ptr->type))
+                {
+                    goto nomem_close_port_struct;
+                }
+
+                if (!dbus_message_iter_close_container(&ports_array_iter, &port_struct_iter))
+                {
+                    goto nomem_close_ports_array;
+                }
+            }
+
+            if (!dbus_message_iter_close_container(&client_struct_iter, &ports_array_iter))
+            {
+                goto nomem_close_client_struct;
+            }
+
+            if (!dbus_message_iter_close_container(&clients_array_iter, &client_struct_iter))
+            {
+                goto nomem_close_clients_array;
+            }
+        }
+    }
+
+    if (!dbus_message_iter_close_container(&iter, &clients_array_iter))
+    {
+        goto nomem_unlock;
+    }
+
+    if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(tstststst)", &connections_array_iter))
+    {
+        goto nomem_unlock;
+    }
+
+    if (version < patchbay_ptr->graph.version)
+    {
+        list_for_each(connection_node_ptr, &patchbay_ptr->graph.connections)
+        {
+            connection_ptr = list_entry(connection_node_ptr, struct jack_graph_connection, siblings);
+
+            if (!dbus_message_iter_open_container(&connections_array_iter, DBUS_TYPE_STRUCT, NULL, &connection_struct_iter))
+            {
+                goto nomem_close_connections_array;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port1->client->id))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port1->client->name))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port1->id))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port1->name))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port2->client->id))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port2->client->name))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->port2->id))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_STRING, &connection_ptr->port2->name))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_append_basic(&connection_struct_iter, DBUS_TYPE_UINT64, &connection_ptr->id))
+            {
+                goto nomem_close_connection_struct;
+            }
+
+            if (!dbus_message_iter_close_container(&connections_array_iter, &connection_struct_iter))
+            {
+                goto nomem_close_connections_array;
+            }
+        }
+    }
+
+    if (!dbus_message_iter_close_container(&iter, &connections_array_iter))
+    {
+        goto nomem_unlock;
+    }
+
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    return;
+
+nomem_close_connection_struct:
+    dbus_message_iter_close_container(&connections_array_iter, &connection_struct_iter);
+
+nomem_close_connections_array:
+    dbus_message_iter_close_container(&iter, &connections_array_iter);
+    goto nomem_unlock;
+
+nomem_close_port_struct:
+    dbus_message_iter_close_container(&ports_array_iter, &port_struct_iter);
+
+nomem_close_ports_array:
+    dbus_message_iter_close_container(&client_struct_iter, &ports_array_iter);
+
+nomem_close_client_struct:
+    dbus_message_iter_close_container(&clients_array_iter, &client_struct_iter);
+
+nomem_close_clients_array:
+    dbus_message_iter_close_container(&iter, &clients_array_iter);
+
+nomem_unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+//nomem:
+    dbus_message_unref(call->reply);
+    call->reply = NULL;
+    jack_error("Ran out of memory trying to construct method return");
+
+exit:
+    return;
+}
+
+static
+void
+jack_controller_dbus_connect_ports_by_name(
+    struct jack_dbus_method_call * call)
+{
+    const char * client1_name;
+    const char * port1_name;
+    const char * client2_name;
+    const char * port2_name;
+    struct jack_graph_port *port1_ptr;
+    struct jack_graph_port *port2_ptr;
+
+/*  jack_info("jack_controller_dbus_connect_ports_by_name() called."); */
+
+    if (!controller_ptr->started)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+            "Can't execute this method with stopped JACK server");
+        return;
+    }
+
+    if (!jack_dbus_get_method_args(
+            call,
+            DBUS_TYPE_STRING,
+            &client1_name,
+            DBUS_TYPE_STRING,
+            &port1_name,
+            DBUS_TYPE_STRING,
+            &client2_name,
+            DBUS_TYPE_STRING,
+            &port2_name,
+            DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        return;
+    }
+
+/*  jack_info("connecting %s:%s and %s:%s", client1_name, port1_name, client2_name, port2_name); */
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    port1_ptr = jack_controller_patchbay_find_port_by_names(patchbay_ptr, client1_name, port1_name);
+    if (port1_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port '%s':'%s'", client1_name, port1_name);
+        goto unlock;
+    }
+
+    port2_ptr = jack_controller_patchbay_find_port_by_names(patchbay_ptr, client2_name, port2_name);
+    if (port2_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port '%s':'%s'", client2_name, port2_name);
+        goto unlock;
+    }
+
+    if (!jack_controller_patchbay_connect(
+            call,
+            controller_ptr,
+            port1_ptr,
+            port2_ptr))
+    {
+        /* jack_controller_patchbay_connect() constructed error reply */
+        goto unlock;
+    }
+
+    jack_dbus_construct_method_return_empty(call);
+
+unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+static
+void
+jack_controller_dbus_connect_ports_by_id(
+    struct jack_dbus_method_call * call)
+{
+    dbus_uint64_t port1_id;
+    dbus_uint64_t port2_id;
+    struct jack_graph_port *port1_ptr;
+    struct jack_graph_port *port2_ptr;
+
+/*     jack_info("jack_controller_dbus_connect_ports_by_id() called."); */
+
+    if (!controller_ptr->started)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+            "Can't execute this method with stopped JACK server");
+        return;
+    }
+
+    if (!jack_dbus_get_method_args(
+            call,
+            DBUS_TYPE_UINT64,
+            &port1_id,
+            DBUS_TYPE_UINT64,
+            &port2_id,
+            DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        return;
+    }
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    port1_ptr = jack_controller_patchbay_find_port_by_id(patchbay_ptr, port1_id);
+    if (port1_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port1_id);
+        goto unlock;
+    }
+
+    port2_ptr = jack_controller_patchbay_find_port_by_id(patchbay_ptr, port2_id);
+    if (port2_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port2_id);
+        goto unlock;
+    }
+
+    if (!jack_controller_patchbay_connect(
+            call,
+            controller_ptr,
+            port1_ptr,
+            port2_ptr))
+    {
+        /* jack_controller_patchbay_connect() constructed error reply */
+        goto unlock;
+    }
+
+    jack_dbus_construct_method_return_empty(call);
+
+unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+static
+void
+jack_controller_dbus_disconnect_ports_by_name(
+    struct jack_dbus_method_call * call)
+{
+    const char * client1_name;
+    const char * port1_name;
+    const char * client2_name;
+    const char * port2_name;
+    struct jack_graph_port *port1_ptr;
+    struct jack_graph_port *port2_ptr;
+
+/*  jack_info("jack_controller_dbus_disconnect_ports_by_name() called."); */
+
+    if (!controller_ptr->started)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+            "Can't execute this method with stopped JACK server");
+        return;
+    }
+
+    if (!jack_dbus_get_method_args(
+            call,
+            DBUS_TYPE_STRING,
+            &client1_name,
+            DBUS_TYPE_STRING,
+            &port1_name,
+            DBUS_TYPE_STRING,
+            &client2_name,
+            DBUS_TYPE_STRING,
+            &port2_name,
+            DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        return;
+    }
+
+/*  jack_info("disconnecting %s:%s and %s:%s", client1_name, port1_name, client2_name, port2_name); */
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    port1_ptr = jack_controller_patchbay_find_port_by_names(patchbay_ptr, client1_name, port1_name);
+    if (port1_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port '%s':'%s'", client1_name, port1_name);
+        goto unlock;
+    }
+
+    port2_ptr = jack_controller_patchbay_find_port_by_names(patchbay_ptr, client2_name, port2_name);
+    if (port2_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port '%s':'%s'", client2_name, port2_name);
+        goto unlock;
+    }
+
+    if (!jack_controller_patchbay_disconnect(
+            call,
+            controller_ptr,
+            port1_ptr,
+            port2_ptr))
+    {
+        /* jack_controller_patchbay_connect() constructed error reply */
+        goto unlock;
+    }
+
+    jack_dbus_construct_method_return_empty(call);
+
+unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+static
+void
+jack_controller_dbus_disconnect_ports_by_id(
+    struct jack_dbus_method_call * call)
+{
+    dbus_uint64_t port1_id;
+    dbus_uint64_t port2_id;
+    struct jack_graph_port *port1_ptr;
+    struct jack_graph_port *port2_ptr;
+
+/*     jack_info("jack_controller_dbus_disconnect_ports_by_id() called."); */
+
+    if (!controller_ptr->started)
+    {
+        jack_dbus_error(
+            call,
+            JACK_DBUS_ERROR_SERVER_NOT_RUNNING,
+            "Can't execute this method with stopped JACK server");
+        return;
+    }
+
+    if (!jack_dbus_get_method_args(
+            call,
+            DBUS_TYPE_UINT64,
+            &port1_id,
+            DBUS_TYPE_UINT64,
+            &port2_id,
+            DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        return;
+    }
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    port1_ptr = jack_controller_patchbay_find_port_by_id(patchbay_ptr, port1_id);
+    if (port1_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port1_id);
+        goto unlock;
+    }
+
+    port2_ptr = jack_controller_patchbay_find_port_by_id(patchbay_ptr, port2_id);
+    if (port2_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port2_id);
+        goto unlock;
+    }
+
+    if (!jack_controller_patchbay_disconnect(
+            call,
+            controller_ptr,
+            port1_ptr,
+            port2_ptr))
+    {
+        /* jack_controller_patchbay_connect() constructed error reply */
+        goto unlock;
+    }
+
+    jack_dbus_construct_method_return_empty(call);
+
+unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+static
+void
+jack_controller_dbus_disconnect_ports_by_connection_id(
+    struct jack_dbus_method_call * call)
+{
+    dbus_uint64_t connection_id;
+    struct jack_graph_connection *connection_ptr;
+
+/*     jack_info("jack_controller_dbus_disconnect_ports_by_id() called."); */
+
+    if (!jack_dbus_get_method_args(
+            call,
+            DBUS_TYPE_UINT64,
+            &connection_id,
+            DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        return;
+    }
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    connection_ptr = jack_controller_patchbay_find_connection_by_id(patchbay_ptr, connection_id);
+    if (connection_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find connection %" PRIu64, connection_id);
+        goto unlock;
+    }
+
+    if (!jack_controller_patchbay_disconnect(
+            call,
+            controller_ptr,
+            connection_ptr->port1,
+            connection_ptr->port2))
+    {
+        /* jack_controller_patchbay_connect() constructed error reply */
+        goto unlock;
+    }
+
+    jack_dbus_construct_method_return_empty(call);
+
+unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+static
+void
+jack_controller_dbus_get_client_pid(
+    struct jack_dbus_method_call * call)
+{
+    dbus_uint64_t client_id;
+    struct jack_graph_client *client_ptr;
+    message_arg_t arg;
+
+/*     jack_info("jack_controller_dbus_get_client_pid() called."); */
+
+    if (!jack_dbus_get_method_args(
+            call,
+            DBUS_TYPE_UINT64,
+            &client_id,
+            DBUS_TYPE_INVALID))
+    {
+        /* The method call had invalid arguments meaning that
+         * jack_dbus_get_method_args() has constructed an error for us.
+         */
+        return;
+    }
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+
+    client_ptr = jack_controller_patchbay_find_client_by_id(patchbay_ptr, client_id);
+    if (client_ptr == NULL)
+    {
+        jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find client %" PRIu64, client_id);
+        goto unlock;
+    }
+
+    arg.int64 = client_ptr->pid;
+
+    jack_dbus_construct_method_return_single(call, DBUS_TYPE_INT64, arg);
+
+unlock:
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+}
+
+#undef controller_ptr
+#define controller_ptr ((struct jack_controller *)context)
+
+static
+int
+jack_controller_graph_order_callback(
+    void *context)
+{
+    const char **ports;
+    int i;
+    jack_port_t *port_ptr;
+    
+    if (patchbay_ptr->graph.version > 1)
+    {
+        /* we use this only for initial catchup */
+        return 0;
+    }
+    
+    ports = jack_get_ports(controller_ptr->client, NULL, NULL, 0);
+    if (ports)
+    {
+        for (i = 0;  ports[i]; ++i)
+        {
+            jack_info("graph reorder: new port '%s'", ports[i]);
+            port_ptr = jack_port_by_name(controller_ptr->client, ports[i]);;
+            jack_controller_patchbay_new_port(patchbay_ptr, ports[i], jack_port_flags(port_ptr), jack_port_type_id(port_ptr));
+        }
+
+        free(ports);
+    }
+
+    if (patchbay_ptr->graph.version == 1)
+    {
+        /* we have empty initial graph, increment graph version,
+           so we dont do jack_get_ports() again,
+           on next next graph change */
+        patchbay_ptr->graph.version++;
+    }
+
+    return 0;
+}
+
+void
+jack_controller_client_registration_callback(
+    const char *client_name,
+    int created,
+    void *context)
+{
+    if (created)
+    {
+        jack_log("client '%s' created", client_name);
+        jack_controller_patchbay_create_client(patchbay_ptr, client_name, strlen(client_name));
+    }
+    else
+    {
+        jack_log("client '%s' destroyed", client_name);
+        jack_controller_patchbay_destroy_client_by_name(patchbay_ptr, client_name);
+    }
+}
+
+void
+jack_controller_port_registration_callback(
+    jack_port_id_t port_id,
+    int created,
+    void *context)
+{
+    jack_port_t *port_ptr;
+    struct jack_graph_port *graph_port_ptr;
+    const char *port_name;
+
+    port_ptr = jack_port_by_id(controller_ptr->client, port_id);
+    port_name = jack_port_name(port_ptr);
+
+    if (created)
+    {
+        jack_log("port '%s' created", port_name);
+        jack_controller_patchbay_new_port(patchbay_ptr, port_name, jack_port_flags(port_ptr), jack_port_type_id(port_ptr));
+    }
+    else
+    {
+        jack_log("port '%s' destroyed", port_name);
+        graph_port_ptr = jack_controller_patchbay_find_port_by_full_name(patchbay_ptr, port_name);
+        if (graph_port_ptr == NULL)
+        {
+            jack_error("Failed to find port '%s' to destroy", port_name);
+            return;
+        }
+
+        jack_controller_patchbay_remove_port(patchbay_ptr, graph_port_ptr);
+    }
+}
+
+void
+jack_controller_port_connect_callback(
+    jack_port_id_t port1_id,
+    jack_port_id_t port2_id,
+    int connect,
+    void *context)
+{
+    jack_port_t *port1;
+    jack_port_t *port2;
+    const char *port1_name;
+    const char *port2_name;
+    struct jack_graph_port *port1_ptr;
+    struct jack_graph_port *port2_ptr;
+    struct jack_graph_connection *connection_ptr;
+
+    port1 = jack_port_by_id(controller_ptr->client, port1_id);
+    port2 = jack_port_by_id(controller_ptr->client, port2_id);
+
+    port1_name = jack_port_name(port1);
+    port2_name = jack_port_name(port2);
+
+    port1_ptr = jack_controller_patchbay_find_port_by_full_name(patchbay_ptr, port1_name);
+    if (port1_ptr == NULL)
+    {
+        jack_error("Failed to find port '%s' to [dis]connect", port1_name);
+        return;
+    }
+
+    port2_ptr = jack_controller_patchbay_find_port_by_full_name(patchbay_ptr, port2_name);
+    if (port2_ptr == NULL)
+    {
+        jack_error("Failed to find port '%s' to [dis]connect", port2_name);
+        return;
+    }
+
+    if (connect)
+    {
+        jack_info("Connecting '%s' to '%s'", port1_name, port2_name);
+        connection_ptr = jack_controller_patchbay_find_connection(patchbay_ptr, port1_ptr, port2_ptr);
+        if (connection_ptr != NULL)
+        {
+            jack_error("'%s' and '%s' are already connected", port1_name, port2_name);
+            return;
+        }
+
+        jack_controller_patchbay_create_connection(patchbay_ptr, port1_ptr, port2_ptr);
+    }
+    else
+    {
+        jack_info("Disconnecting '%s' from '%s'", port1_name, port2_name);
+        connection_ptr = jack_controller_patchbay_find_connection(patchbay_ptr, port1_ptr, port2_ptr);
+        if (connection_ptr == NULL)
+        {
+            jack_error("Cannot find connection being removed");
+            return;
+        }
+
+        jack_controller_patchbay_destroy_connection(patchbay_ptr, connection_ptr);
+    }
+}
+
+int jack_controller_port_rename_callback(jack_port_id_t port, const char * old_name, const char * new_name, void * context)
+{
+    struct jack_graph_port * port_ptr;
+    const char * port_new_short_name;
+    const char * port_old_short_name;
+    char * name_buffer;
+
+    jack_info("port renamed: '%s' -> '%s'", old_name, new_name);
+
+    port_new_short_name = strchr(new_name, ':');
+    if (port_new_short_name == NULL)
+    {
+        jack_error("renamed port new name '%s' does not contain ':' separator char", new_name);
+        return -1;
+    }
+
+    port_new_short_name++;      /* skip ':' separator char */
+
+    port_old_short_name = strchr(old_name, ':');
+    if (port_old_short_name == NULL)
+    {
+        jack_error("renamed port old name '%s' does not contain ':' separator char", old_name);
+        return -1;
+    }
+
+    port_old_short_name++;      /* skip ':' separator char */
+
+    port_ptr = jack_controller_patchbay_find_port_by_full_name(patchbay_ptr, old_name);
+    if (port_ptr == NULL)
+    {
+        jack_error("renamed port '%s' not found", old_name);
+        return -1;
+    }
+
+    name_buffer = strdup(port_new_short_name);
+    if (name_buffer == NULL)
+    {
+        jack_error("strdup() call for port name '%s' failed.", port_new_short_name);
+        return 1;
+    }
+
+    free(port_ptr->name);
+    port_ptr->name = name_buffer;
+
+    pthread_mutex_lock(&patchbay_ptr->lock);
+    patchbay_ptr->graph.version++;
+    jack_controller_patchbay_send_signal_port_renamed(
+        patchbay_ptr->graph.version,
+        port_ptr->client->id,
+        port_ptr->client->name,
+        port_ptr->id,
+        port_old_short_name,
+        port_ptr->name);
+    jack_controller_patchbay_send_signal_graph_changed(patchbay_ptr->graph.version);
+    pthread_mutex_unlock(&patchbay_ptr->lock);
+
+    return 0;
+}
+
+#undef controller_ptr
+
+void
+jack_controller_patchbay_uninit(
+    struct jack_controller * controller_ptr)
+{
+    struct jack_graph_client *client_ptr;
+    struct jack_graph_port *port_ptr;
+
+/*     jack_info("jack_controller_patchbay_uninit() called"); */
+
+    while (!list_empty(&patchbay_ptr->graph.ports))
+    {
+        port_ptr = list_entry(patchbay_ptr->graph.ports.next, struct jack_graph_port, siblings_graph);
+        jack_controller_patchbay_remove_port(patchbay_ptr, port_ptr);
+    }
+
+    while (!list_empty(&patchbay_ptr->graph.clients))
+    {
+        client_ptr = list_entry(patchbay_ptr->graph.clients.next, struct jack_graph_client, siblings);
+        jack_controller_patchbay_destroy_client(patchbay_ptr, client_ptr);
+    }
+
+    pthread_mutex_destroy(&patchbay_ptr->lock);
+}
+
+#undef patchbay_ptr
+
+bool
+jack_controller_patchbay_init(
+    struct jack_controller * controller_ptr)
+{
+    int ret;
+    struct jack_controller_patchbay * patchbay_ptr;
+    pthread_mutexattr_t attr;
+
+/*     jack_info("jack_controller_patchbay_init() called"); */
+
+    patchbay_ptr = malloc(sizeof(struct jack_controller_patchbay));
+    if (patchbay_ptr == NULL)
+    {
+        jack_error("Memory allocation of jack_controller_patchbay structure failed.");
+        goto fail;
+    }
+
+    ret = pthread_mutexattr_init(&attr);
+    if (ret != 0)
+    {
+        goto fail;
+    }
+
+    ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+    if (ret != 0)
+    {
+        goto fail;
+    }
+
+    pthread_mutex_init(&patchbay_ptr->lock, &attr);
+    INIT_LIST_HEAD(&patchbay_ptr->graph.clients);
+    INIT_LIST_HEAD(&patchbay_ptr->graph.ports);
+    INIT_LIST_HEAD(&patchbay_ptr->graph.connections);
+    patchbay_ptr->graph.version = 1;
+    patchbay_ptr->next_client_id = 1;
+    patchbay_ptr->next_port_id = 1;
+    patchbay_ptr->next_connection_id = 1;
+
+    controller_ptr->patchbay_context = patchbay_ptr;
+
+    ret = jack_set_graph_order_callback(controller_ptr->client, jack_controller_graph_order_callback, controller_ptr);
+    if (ret != 0)
+    {
+        jack_error("jack_set_graph_order_callback() failed with error %d", ret);
+        goto fail_uninit_mutex;
+    }
+
+    ret = jack_set_client_registration_callback(controller_ptr->client, jack_controller_client_registration_callback, controller_ptr);
+    if (ret != 0)
+    {
+        jack_error("jack_set_client_registration_callback() failed with error %d", ret);
+        goto fail_uninit_mutex;
+    }
+
+    ret = jack_set_port_registration_callback(controller_ptr->client, jack_controller_port_registration_callback, controller_ptr);
+    if (ret != 0)
+    {
+        jack_error("jack_set_port_registration_callback() failed with error %d", ret);
+        goto fail_uninit_mutex;
+    }
+
+    ret = jack_set_port_connect_callback(controller_ptr->client, jack_controller_port_connect_callback, controller_ptr);
+    if (ret != 0)
+    {
+        jack_error("jack_set_port_connect_callback() failed with error %d", ret);
+        goto fail_uninit_mutex;
+    }
+
+    ret = jack_set_port_rename_callback(controller_ptr->client, jack_controller_port_rename_callback, controller_ptr);
+    if (ret != 0)
+    {
+        jack_error("jack_set_port_rename_callback() failed with error %d", ret);
+        goto fail_uninit_mutex;
+    }
+
+    return true;
+
+fail_uninit_mutex:
+    pthread_mutex_destroy(&patchbay_ptr->lock);
+
+fail:
+    return false;
+}
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetAllPorts)
+    JACK_DBUS_METHOD_ARGUMENT("ports_list", "as", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetGraph)
+    JACK_DBUS_METHOD_ARGUMENT("known_graph_version", DBUS_TYPE_UINT64_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("current_graph_version", DBUS_TYPE_UINT64_AS_STRING, true)
+    JACK_DBUS_METHOD_ARGUMENT("clients_and_ports", "a(tsa(tsuu))", true)
+    JACK_DBUS_METHOD_ARGUMENT("connections", "a(tstststst)", true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(ConnectPortsByName)
+    JACK_DBUS_METHOD_ARGUMENT("client1_name", DBUS_TYPE_STRING_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("port1_name", DBUS_TYPE_STRING_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("client2_name", DBUS_TYPE_STRING_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("port2_name", DBUS_TYPE_STRING_AS_STRING, false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(ConnectPortsByID)
+    JACK_DBUS_METHOD_ARGUMENT("port1_id", DBUS_TYPE_UINT64_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("port2_id", DBUS_TYPE_UINT64_AS_STRING, false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(DisconnectPortsByName)
+    JACK_DBUS_METHOD_ARGUMENT("client1_name", DBUS_TYPE_STRING_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("port1_name", DBUS_TYPE_STRING_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("client2_name", DBUS_TYPE_STRING_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("port2_name", DBUS_TYPE_STRING_AS_STRING, false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(DisconnectPortsByID)
+    JACK_DBUS_METHOD_ARGUMENT("port1_id", DBUS_TYPE_UINT64_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("port2_id", DBUS_TYPE_UINT64_AS_STRING, false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(DisconnectPortsByConnectionID)
+    JACK_DBUS_METHOD_ARGUMENT("connection_id", DBUS_TYPE_UINT64_AS_STRING, false)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHOD_ARGUMENTS_BEGIN(GetClientPID)
+    JACK_DBUS_METHOD_ARGUMENT("client_id", DBUS_TYPE_UINT64_AS_STRING, false)
+    JACK_DBUS_METHOD_ARGUMENT("process_id", DBUS_TYPE_INT64_AS_STRING, true)
+JACK_DBUS_METHOD_ARGUMENTS_END
+
+JACK_DBUS_METHODS_BEGIN
+    JACK_DBUS_METHOD_DESCRIBE(GetAllPorts, jack_controller_dbus_get_all_ports)
+    JACK_DBUS_METHOD_DESCRIBE(GetGraph, jack_controller_dbus_get_graph)
+    JACK_DBUS_METHOD_DESCRIBE(ConnectPortsByName, jack_controller_dbus_connect_ports_by_name)
+    JACK_DBUS_METHOD_DESCRIBE(ConnectPortsByID, jack_controller_dbus_connect_ports_by_id)
+    JACK_DBUS_METHOD_DESCRIBE(DisconnectPortsByName, jack_controller_dbus_disconnect_ports_by_name)
+    JACK_DBUS_METHOD_DESCRIBE(DisconnectPortsByID, jack_controller_dbus_disconnect_ports_by_id)
+    JACK_DBUS_METHOD_DESCRIBE(DisconnectPortsByConnectionID, jack_controller_dbus_disconnect_ports_by_connection_id)
+    JACK_DBUS_METHOD_DESCRIBE(GetClientPID, jack_controller_dbus_get_client_pid)
+JACK_DBUS_METHODS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(GraphChanged)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(ClientAppeared)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_name", DBUS_TYPE_STRING_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(ClientDisappeared)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_name", DBUS_TYPE_STRING_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(PortAppeared)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_flags", DBUS_TYPE_UINT32_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_type", DBUS_TYPE_UINT32_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(PortDisappeared)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_name", DBUS_TYPE_STRING_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(PortsConnected)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client1_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client1_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port1_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port1_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client2_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client2_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port2_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port2_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("connection_id", DBUS_TYPE_UINT64_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(PortsDisconnected)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client1_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client1_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port1_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port1_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client2_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client2_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port2_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port2_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("connection_id", DBUS_TYPE_UINT64_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(PortRenamed)
+    JACK_DBUS_SIGNAL_ARGUMENT("new_graph_version", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_id", DBUS_TYPE_UINT64_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("client_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_old_name", DBUS_TYPE_STRING_AS_STRING)
+    JACK_DBUS_SIGNAL_ARGUMENT("port_new_name", DBUS_TYPE_STRING_AS_STRING)
+JACK_DBUS_SIGNAL_ARGUMENTS_END
+
+JACK_DBUS_SIGNALS_BEGIN
+    JACK_DBUS_SIGNAL_DESCRIBE(GraphChanged)
+    JACK_DBUS_SIGNAL_DESCRIBE(ClientAppeared)
+    JACK_DBUS_SIGNAL_DESCRIBE(ClientDisappeared)
+    JACK_DBUS_SIGNAL_DESCRIBE(PortAppeared)
+    JACK_DBUS_SIGNAL_DESCRIBE(PortDisappeared)
+    JACK_DBUS_SIGNAL_DESCRIBE(PortsConnected)
+    JACK_DBUS_SIGNAL_DESCRIBE(PortsDisconnected)
+    JACK_DBUS_SIGNAL_DESCRIBE(PortRenamed)
+JACK_DBUS_SIGNALS_END
+
+JACK_DBUS_IFACE_BEGIN(g_jack_controller_iface_patchbay, JACK_DBUS_IFACE_NAME)
+    JACK_DBUS_IFACE_EXPOSE_METHODS
+    JACK_DBUS_IFACE_EXPOSE_SIGNALS
+JACK_DBUS_IFACE_END
diff --git a/dbus/controller_iface_transport.c b/dbus/controller_iface_transport.c
new file mode 100644
index 0000000..546a960
--- /dev/null
+++ b/dbus/controller_iface_transport.c
@@ -0,0 +1,38 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2008 Nedko Arnaudov
+    Copyright (C) 2008 Juuso Alasuutari
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <dbus/dbus.h>
+
+#include "jackdbus.h"
+
+JACK_DBUS_METHODS_BEGIN
+JACK_DBUS_METHODS_END
+
+JACK_DBUS_IFACE_BEGIN(g_jack_controller_iface_transport, "org.jackaudio.JackTransport")
+    JACK_DBUS_IFACE_EXPOSE_METHODS
+JACK_DBUS_IFACE_END
diff --git a/dbus/controller_internal.h b/dbus/controller_internal.h
new file mode 100644
index 0000000..a7711a8
--- /dev/null
+++ b/dbus/controller_internal.h
@@ -0,0 +1,228 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef CONTROLLER_INTERNAL_H__04D54D51_3D79_49A2_A1DA_F8587E9E7F42__INCLUDED
+#define CONTROLLER_INTERNAL_H__04D54D51_3D79_49A2_A1DA_F8587E9E7F42__INCLUDED
+
+#include <stdbool.h>
+#include "jslist.h"
+#include "jack/control.h"
+#include "jack/jack.h"
+#include "jackdbus.h"
+
+struct jack_controller
+{
+    jackctl_server_t *server;
+
+    void *patchbay_context;
+
+    bool started;
+    jack_client_t *client;
+    unsigned int xruns;
+
+    const char **driver_names;
+    unsigned int drivers_count;
+    
+    const char **internal_names;
+    unsigned int internals_count;
+
+    jackctl_driver_t *driver;
+    bool driver_set;            /* whether driver is manually set, if false - DEFAULT_DRIVER is auto set */
+
+    struct jack_dbus_object_descriptor dbus_descriptor;
+};
+
+#define DEFAULT_DRIVER "dummy"
+
+#define JACK_CONF_HEADER_TEXT                       \
+    "JACK settings, as persisted by D-Bus object.\n"        \
+    "You probably don't want to edit this because\n"        \
+    "it will be overwritten next time jackdbus saves.\n"
+
+jackctl_driver_t *
+jack_controller_find_driver(
+    jackctl_server_t *server,
+    const char *driver_name);
+    
+jackctl_internal_t *
+jack_controller_find_internal(
+    jackctl_server_t *server,
+    const char *internal_name);
+
+jackctl_parameter_t *
+jack_controller_find_parameter(
+    const JSList *parameters_list,
+    const char *parameter_name);
+
+bool
+jack_controller_start_server(
+    struct jack_controller *controller_ptr,
+    void *dbus_call_context_ptr);
+
+bool
+jack_controller_stop_server(
+    struct jack_controller *controller_ptr,
+    void *dbus_call_context_ptr);
+
+bool
+jack_controller_switch_master(
+    struct jack_controller *controller_ptr,
+    void *dbus_call_context_ptr);
+    
+bool
+jack_controller_add_slave(
+    struct jack_controller *controller_ptr,
+    const char * driver_name);
+    
+bool
+jack_controller_remove_slave(
+    struct jack_controller *controller_ptr,
+    const char * driver_name);
+
+bool
+jack_controller_select_driver(
+    struct jack_controller *controller_ptr,
+    const char * driver_name);
+
+bool
+jack_controller_load_internal(
+    struct jack_controller *controller_ptr,
+    const char * internal_name);
+
+bool
+jack_controller_unload_internal(
+    struct jack_controller *controller_ptr,
+    const char * internal_name);
+
+void
+jack_controller_settings_set_driver_option(
+    jackctl_driver_t *driver,
+    const char *option_name,
+    const char *option_value);
+
+void
+jack_controller_settings_set_internal_option(
+    jackctl_internal_t *internal,
+    const char *option_name,
+    const char *option_value);
+
+void
+jack_controller_settings_set_engine_option(
+    struct jack_controller *controller_ptr,
+    const char *option_name,
+    const char *option_value);
+
+bool
+jack_controller_settings_save_engine_options(
+    void *context,
+    struct jack_controller *controller_ptr,
+    void *dbus_call_context_ptr);
+
+bool
+jack_controller_settings_write_option(
+    void *context,
+    const char *name,
+    const char *content,
+    void *dbus_call_context_ptr);
+
+bool
+jack_controller_settings_save_driver_options(
+    void *context,
+    jackctl_driver_t *driver,
+    void *dbus_call_context_ptr);
+
+bool
+jack_controller_settings_save_internal_options(
+    void *context,
+    jackctl_internal_t *internal,
+    void *dbus_call_context_ptr);
+
+bool
+jack_controller_patchbay_init(
+    struct jack_controller *controller_ptr);
+
+void
+jack_controller_patchbay_uninit(
+    struct jack_controller *controller_ptr);
+
+void *
+jack_controller_patchbay_client_appeared_callback(
+    void * server_context,
+    uint64_t client_id,
+    const char *client_name);
+
+void
+jack_controller_patchbay_client_disappeared_callback(
+    void *server_context,
+    uint64_t client_id,
+    void *client_context);
+
+void *
+jack_controller_patchbay_port_appeared_callback(
+    void *server_context,
+    uint64_t client_id,
+    void *client_context,
+    uint64_t port_id,
+    const char *port_name,
+    uint32_t port_flags,
+    uint32_t port_type);
+
+void
+jack_controller_patchbay_port_disappeared_callback(
+    void *server_context,
+    uint64_t client_id,
+    void *client_context,
+    uint64_t port_id,
+    void *port_context);
+
+void *
+jack_controller_patchbay_ports_connected_callback(
+    void *server_context,
+    uint64_t client1_id,
+    void *client1_context,
+    uint64_t port1_id,
+    void *port1_context,
+    uint64_t client2_id,
+    void *client2_context,
+    uint64_t port2_id,
+    void *port2_context,
+    uint64_t connection_id);
+
+void
+jack_controller_patchbay_ports_disconnected_callback(
+    void *server_context,
+    uint64_t client1_id,
+    void *client1_context,
+    uint64_t port1_id,
+    void *port1_context,
+    uint64_t client2_id,
+    void *client2_context,
+    uint64_t port2_id,
+    void *port2_context,
+    uint64_t connection_id,
+    void *connection_context);
+
+extern struct jack_dbus_interface_descriptor g_jack_controller_iface_introspectable;
+extern struct jack_dbus_interface_descriptor g_jack_controller_iface_control;
+extern struct jack_dbus_interface_descriptor g_jack_controller_iface_configure;
+extern struct jack_dbus_interface_descriptor g_jack_controller_iface_patchbay;
+extern struct jack_dbus_interface_descriptor g_jack_controller_iface_transport;
+
+#endif /* #ifndef CONTROLLER_INTERNAL_H__04D54D51_3D79_49A2_A1DA_F8587E9E7F42__INCLUDED */
diff --git a/dbus/jackdbus.c b/dbus/jackdbus.c
new file mode 100644
index 0000000..eb86308
--- /dev/null
+++ b/dbus/jackdbus.c
@@ -0,0 +1,919 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+    Copyright (C) 2008 Marc-Olivier Barre
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <dbus/dbus.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include "config.h"
+
+#include "jackdbus.h"
+#include "controller.h"
+#include "jack/jack.h"
+#include "jack/jslist.h"
+#include "jack/control.h"
+#include "sigsegv.h"
+#include "svnversion.h"
+
+FILE *g_logfile;
+char *g_jackdbus_config_dir;
+size_t g_jackdbus_config_dir_len; /* without terminating '\0' char */
+char *g_jackdbus_log_dir;
+size_t g_jackdbus_log_dir_len; /* without terminating '\0' char */
+int g_exit_command;
+DBusConnection *g_connection;
+
+void
+jack_dbus_send_signal(
+    const char *sender_object_path,
+    const char *iface,
+    const char *signal_name,
+    int first_arg_type,
+    ...)
+{
+    DBusMessage *message_ptr;
+    va_list ap;
+
+    va_start(ap, first_arg_type);
+
+    message_ptr = dbus_message_new_signal(sender_object_path, iface, signal_name);
+    if (message_ptr == NULL)
+    {
+        jack_error("dbus_message_new_signal() failed.");
+        goto exit;
+    }
+
+    if (!dbus_message_append_args_valist(message_ptr, first_arg_type, ap))
+    {
+        jack_error("dbus_message_append_args_valist() failed.");
+        goto unref;
+    }
+
+    /* Add message to outgoing message queue */
+    if (!dbus_connection_send(g_connection, message_ptr, NULL))
+    {
+        jack_error("dbus_connection_send() failed.");
+        goto unref;
+    }
+
+unref:
+    dbus_message_unref(message_ptr);
+
+exit:
+    va_end(ap);
+}
+
+/*
+ * Send a method return.
+ *
+ * If call->reply is NULL (i.e. a message construct method failed
+ * due to lack of memory) attempt to send a void method return.
+ */
+static
+void
+jack_dbus_send_method_return(
+    struct jack_dbus_method_call * call)
+{
+    if (call->reply)
+    {
+    retry_send:
+        if (!dbus_connection_send (call->connection, call->reply, NULL))
+        {
+            jack_error ("Ran out of memory trying to queue method return");
+        }
+
+        dbus_connection_flush (call->connection);
+        dbus_message_unref (call->reply);
+        call->reply = NULL;
+    }
+    else
+    {
+        jack_error ("send_method_return() called with a NULL message,"
+                    " trying to construct a void return...");
+
+        if ((call->reply = dbus_message_new_method_return (call->message)))
+        {
+            goto retry_send;
+        }
+        else
+        {
+            jack_error ("Failed to construct method return!");
+        }
+    }
+}
+
+#define object_ptr ((struct jack_dbus_object_descriptor *)data)
+
+/*
+ * The D-Bus message handler for object path /org/jackaudio/Controller.
+ */
+DBusHandlerResult
+jack_dbus_message_handler(
+    DBusConnection *connection,
+    DBusMessage *message,
+    void *data)
+{
+    struct jack_dbus_method_call call;
+    const char *interface_name;
+    struct jack_dbus_interface_descriptor ** interface_ptr_ptr;
+
+    /* Check if the message is a method call. If not, ignore it. */
+    if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
+    {
+        goto handled;
+    }
+
+    /* Get the invoked method's name and make sure it's non-NULL. */
+    if (!(call.method_name = dbus_message_get_member (message)))
+    {
+        jack_dbus_error(
+            &call,
+            JACK_DBUS_ERROR_UNKNOWN_METHOD,
+            "Received method call with empty method name");
+        goto send_return;
+    }
+
+    /* Initialize our data. */
+    call.context = object_ptr->context;
+    call.connection = connection;
+    call.message = message;
+    call.reply = NULL;
+
+    /* Check if there's an interface specified for this method call. */
+    interface_name = dbus_message_get_interface (message);
+    if (interface_name != NULL)
+    {
+        /* Check if we can match the interface and method.
+         * The inteface handler functions only return false if the
+         * method name was unknown, otherwise they run the specified
+         * method and return TRUE.
+         */
+
+        interface_ptr_ptr = object_ptr->interfaces;
+
+        while (*interface_ptr_ptr != NULL)
+        {
+            if (strcmp(interface_name, (*interface_ptr_ptr)->name) == 0)
+            {
+                if (!(*interface_ptr_ptr)->handler(&call, (*interface_ptr_ptr)->methods))
+                {
+                    break;
+                }
+
+                goto send_return;
+            }
+
+            interface_ptr_ptr++;
+        }
+    }
+    else
+    {
+        /* No interface was specified so we have to try them all. This is
+         * dictated by the D-Bus specification which states that method calls
+         * omitting the interface must never be rejected.
+         */
+
+        interface_ptr_ptr = object_ptr->interfaces;
+
+        while (*interface_ptr_ptr != NULL)
+        {
+            if ((*interface_ptr_ptr)->handler(&call, (*interface_ptr_ptr)->methods))
+            {
+                goto send_return;
+            }
+
+            interface_ptr_ptr++;
+        }
+    }
+
+    jack_dbus_error(
+        &call,
+        JACK_DBUS_ERROR_UNKNOWN_METHOD,
+        "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist",
+        call.method_name,
+        dbus_message_get_signature(message),
+        interface_name);
+
+send_return:
+    jack_dbus_send_method_return(&call);
+
+handled:
+    return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+void
+jack_dbus_message_handler_unregister(
+    DBusConnection *connection,
+    void *data)
+{
+    jack_info ("Message handler was unregistered");
+}
+
+#undef object_ptr
+
+/*
+ * Check if the supplied method name exists in org.jackaudio.JackConfigure,
+ * if it does execute it and return TRUE. Otherwise return FALSE.
+ */
+bool
+jack_dbus_run_method(
+    struct jack_dbus_method_call *call,
+    const struct jack_dbus_interface_method_descriptor * methods)
+{
+    const struct jack_dbus_interface_method_descriptor * method_ptr;
+
+    method_ptr = methods;
+
+    while (method_ptr->name != NULL)
+    {
+        if (strcmp(call->method_name, method_ptr->name) == 0)
+        {
+            method_ptr->handler(call);
+            return TRUE;
+        }
+
+        method_ptr++;
+    }
+
+    return FALSE;
+}
+
+/*
+ * Read arguments from a method call.
+ * If the operation fails construct an error and return false,
+ * otherwise return true.
+ */
+bool
+jack_dbus_get_method_args(
+    struct jack_dbus_method_call *call,
+    int type,
+    ...)
+{
+    va_list args;
+    DBusError error;
+    bool retval = true;
+
+    va_start (args, type);
+    dbus_error_init (&error);
+
+    if (!dbus_message_get_args_valist (call->message, &error, type, args))
+    {
+        jack_dbus_error (call, JACK_DBUS_ERROR_INVALID_ARGS,
+                         "Invalid arguments to method \"%s\"",
+                         call->method_name);
+        retval = false;
+    }
+
+    dbus_error_free (&error);
+    va_end (args);
+
+    return retval;
+}
+
+/*
+ * Read a string and a variant argument from a method call.
+ * If the operation fails construct an error and return false,
+ * otherwise return true.
+ */
+bool
+jack_dbus_get_method_args_string_and_variant(
+    struct jack_dbus_method_call *call,
+    const char **arg1,
+    message_arg_t *arg2,
+    int *type_ptr)
+{
+    DBusMessageIter iter, sub_iter;
+
+    /* First we want a string... */
+    if (dbus_message_iter_init (call->message, &iter)
+        && dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_STRING)
+    {
+        dbus_message_iter_get_basic (&iter, arg1);
+        dbus_message_iter_next (&iter);
+
+        /* ...and then a variant. */
+        if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_VARIANT)
+        {
+            dbus_message_iter_recurse (&iter, &sub_iter);
+            dbus_message_iter_get_basic (&sub_iter, arg2);
+            *type_ptr = dbus_message_iter_get_arg_type (&sub_iter);
+
+            /* Got what we wanted. */
+            return true;
+        }
+    }
+
+    jack_dbus_error (call, JACK_DBUS_ERROR_INVALID_ARGS,
+                     "Invalid arguments to method \"%s\"",
+                     call->method_name);
+
+    return false;
+}
+
+/*
+ * Read two strings and a variant argument from a method call.
+ * If the operation fails construct an error and return false,
+ * otherwise return true.
+ */
+bool
+jack_dbus_get_method_args_two_strings_and_variant(
+    struct jack_dbus_method_call *call,
+    const char **arg1,
+    const char **arg2,
+    message_arg_t *arg3,
+    int *type_ptr)
+{
+    DBusMessageIter iter, sub_iter;
+
+    /* First we want a string... */
+    if (dbus_message_iter_init (call->message, &iter)
+        && dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_STRING)
+    {
+        dbus_message_iter_get_basic (&iter, arg1);
+        dbus_message_iter_next (&iter);
+        
+        /* ...and then a second string. */
+        if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING)
+        {
+            return false;
+        }
+        
+        /* Got what we wanted. */
+        dbus_message_iter_get_basic (&iter, arg2);
+        dbus_message_iter_next (&iter);
+
+        /* ...and then a variant. */
+        if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_VARIANT)
+        {
+            dbus_message_iter_recurse (&iter, &sub_iter);
+            dbus_message_iter_get_basic (&sub_iter, arg3);
+            *type_ptr = dbus_message_iter_get_arg_type (&sub_iter);
+
+            /* Got what we wanted. */
+            return true;
+        }
+    }
+
+    jack_dbus_error (call, JACK_DBUS_ERROR_INVALID_ARGS,
+                     "Invalid arguments to method \"%s\"",
+                     call->method_name);
+
+    return false;
+}
+
+/*
+ * Append a variant type to a D-Bus message.
+ * Return false if something fails, true otherwise.
+ */
+bool
+jack_dbus_message_append_variant(
+    DBusMessageIter *iter,
+    int type,
+    const char *signature,
+    message_arg_t *arg)
+{
+    DBusMessageIter sub_iter;
+
+    /* Open a variant container. */
+    if (!dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, signature, &sub_iter))
+    {
+        goto fail;
+    }
+
+    /* Append the supplied value. */
+    if (!dbus_message_iter_append_basic (&sub_iter, type, (const void *) arg))
+    {
+        dbus_message_iter_close_container (iter, &sub_iter);
+        goto fail;
+    }
+
+    /* Close the container. */
+    if (!dbus_message_iter_close_container (iter, &sub_iter))
+    {
+        goto fail;
+    }
+
+    return true;
+
+fail:
+    return false;
+}
+
+/*
+ * Construct an empty method return message.
+ *
+ * The operation can only fail due to lack of memory, in which case
+ * there's no sense in trying to construct an error return. Instead,
+ * call->reply will be set to NULL and handled in send_method_return().
+ */
+void
+jack_dbus_construct_method_return_empty(
+    struct jack_dbus_method_call * call)
+{
+    call->reply = dbus_message_new_method_return (call->message);
+
+    if (call->reply == NULL)
+    {
+        jack_error ("Ran out of memory trying to construct method return");
+    }
+}
+
+/*
+ * Construct a method return which holds a single argument or, if
+ * the type parameter is DBUS_TYPE_INVALID, no arguments at all
+ * (a void message).
+ *
+ * The operation can only fail due to lack of memory, in which case
+ * there's no sense in trying to construct an error return. Instead,
+ * call->reply will be set to NULL and handled in send_method_return().
+ */
+void
+jack_dbus_construct_method_return_single(
+    struct jack_dbus_method_call *call,
+    int type,
+    message_arg_t arg)
+{
+    DBusMessageIter iter;
+    call->reply = dbus_message_new_method_return (call->message);
+
+    if (call->reply == NULL)
+    {
+        goto fail_no_mem;
+    }
+
+    /* Void method return requested by caller. */
+    if (type == DBUS_TYPE_INVALID)
+    {
+        return;
+    }
+
+    /* Prevent crash on NULL input string. */
+    else if (type == DBUS_TYPE_STRING && arg.string == NULL)
+    {
+        arg.string = "";
+    }
+
+    dbus_message_iter_init_append (call->reply, &iter);
+
+    if (!dbus_message_iter_append_basic (&iter, type, (const void *) &arg))
+    {
+        dbus_message_unref (call->reply);
+        call->reply = NULL;
+        goto fail_no_mem;
+    }
+
+    return;
+
+fail_no_mem:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+/*
+ * Construct a method return which holds an array of strings.
+ *
+ * The operation can only fail due to lack of memory, in which case
+ * there's no sense in trying to construct an error return. Instead,
+ * call->reply will be set to NULL and handled in send_method_return().
+ */
+void
+jack_dbus_construct_method_return_array_of_strings(
+    struct jack_dbus_method_call *call,
+    unsigned int num_members,
+    const char **array)
+{
+    DBusMessageIter iter, sub_iter;
+    unsigned int i;
+
+    call->reply = dbus_message_new_method_return (call->message);
+    if (!call->reply)
+    {
+        goto fail;
+    }
+
+    dbus_message_iter_init_append (call->reply, &iter);
+
+    if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "s", &sub_iter))
+    {
+        goto fail_unref;
+    }
+
+    for (i = 0; i < num_members; ++i)
+    {
+        if (!dbus_message_iter_append_basic (&sub_iter, DBUS_TYPE_STRING, (const void *) &array[i]))
+        {
+            dbus_message_iter_close_container (&iter, &sub_iter);
+            goto fail_unref;
+        }
+    }
+
+    if (!dbus_message_iter_close_container (&iter, &sub_iter))
+    {
+        goto fail_unref;
+    }
+
+    return;
+
+fail_unref:
+    dbus_message_unref (call->reply);
+    call->reply = NULL;
+
+fail:
+    jack_error ("Ran out of memory trying to construct method return");
+}
+
+void 
+jack_dbus_info_callback(const char *msg)
+{
+    time_t timestamp;
+    char timestamp_str[26];
+
+    time(&timestamp);
+    ctime_r(&timestamp, timestamp_str);
+    timestamp_str[24] = 0;
+
+    fprintf(g_logfile, "%s: %s\n", timestamp_str, msg);
+    fflush(g_logfile);
+}
+
+#define ANSI_BOLD_ON    "\033[1m"
+#define ANSI_BOLD_OFF   "\033[22m"
+#define ANSI_COLOR_RED  "\033[31m"
+#define ANSI_RESET      "\033[0m"
+
+void 
+jack_dbus_error_callback(const char *msg)
+{
+    time_t timestamp;
+    char timestamp_str[26];
+
+    time(&timestamp);
+    ctime_r(&timestamp, timestamp_str);
+    timestamp_str[24] = 0;
+
+    fprintf(g_logfile, "%s: " ANSI_BOLD_ON ANSI_COLOR_RED "ERROR: %s" ANSI_RESET "\n", timestamp_str, msg);
+    fflush(g_logfile);
+}
+
+bool
+ensure_dir_exist(const char *dirname, int mode)
+{
+    struct stat st;
+    if (stat(dirname, &st) != 0)
+    {
+        if (errno == ENOENT)
+        {
+            printf("Directory \"%s\" does not exist. Creating...\n", dirname);
+            if (mkdir(dirname, mode) != 0)
+            {
+                fprintf(stderr, "Failed to create \"%s\" directory: %d (%s)\n", dirname, errno, strerror(errno));
+                return false;
+            }
+        }
+        else
+        {
+            fprintf(stderr, "Failed to stat \"%s\": %d (%s)\n", dirname, errno, strerror(errno));
+            return false;
+        }
+    }
+    else
+    {
+        if (!S_ISDIR(st.st_mode))
+        {
+            fprintf(stderr, "\"%s\" exists but is not directory.\n", dirname);
+            return false;
+        }
+    }
+    return true;
+}
+
+char *
+pathname_cat(const char *pathname_a, const char *pathname_b)
+{
+    char *pathname;
+    int pathname_a_len, pathname_b_len, pathname_len;
+    pathname_a_len = strlen(pathname_a);
+    pathname_b_len = strlen(pathname_b);
+    pathname = malloc(pathname_a_len + pathname_b_len + 1);
+    if (pathname == NULL)
+    {
+        fprintf(stderr, "Out of memory\n");
+        return NULL;
+    }
+    memcpy(pathname, pathname_a, pathname_a_len);
+    memcpy(pathname + pathname_a_len, pathname_b, pathname_b_len);
+    pathname_len = pathname_a_len + pathname_b_len;
+    pathname[pathname_len] = 0;
+    return pathname;
+}
+
+bool
+paths_init()
+{
+	const char *home_dir, *xdg_config_home, *xdg_log_home;
+    
+    home_dir = getenv("HOME");
+    if (home_dir == NULL)
+    {
+        fprintf(stderr, "Environment variable HOME not set\n");
+        goto fail;
+    }
+
+	xdg_config_home = getenv("XDG_CONFIG_HOME");
+	if (xdg_config_home == NULL)
+	{
+	    if (!(xdg_config_home = pathname_cat(home_dir, DEFAULT_XDG_CONFIG))) goto fail;
+	}
+
+    if (!(xdg_log_home = pathname_cat(home_dir, DEFAULT_XDG_LOG))) goto fail;
+
+	if (!(g_jackdbus_config_dir = pathname_cat(xdg_config_home, JACKDBUS_DIR))) goto fail;
+	if (!(g_jackdbus_log_dir = pathname_cat(xdg_log_home, JACKDBUS_DIR))) goto fail;
+
+    if (!ensure_dir_exist(xdg_config_home, 0700))
+    {
+        goto fail;
+    }
+    
+    if (!ensure_dir_exist(xdg_log_home, 0700))
+    {
+        goto fail;
+    }
+
+    if (!ensure_dir_exist(g_jackdbus_config_dir, 0700))
+    {
+        free(g_jackdbus_config_dir);
+        goto fail;
+    }
+    g_jackdbus_config_dir_len = strlen(g_jackdbus_config_dir);
+    
+    if (!ensure_dir_exist(g_jackdbus_log_dir, 0700))
+    {
+        free(g_jackdbus_log_dir);
+        goto fail;
+    }
+    g_jackdbus_log_dir_len = strlen(g_jackdbus_log_dir);
+
+    return true;
+
+fail:
+    return false;
+}
+
+void
+paths_uninit()
+{
+    free(g_jackdbus_config_dir);
+    free(g_jackdbus_log_dir);
+}
+
+int
+log_init()
+{
+    char *log_filename;
+    size_t log_len;
+
+    log_len = strlen(JACKDBUS_LOG);
+
+    log_filename = malloc(g_jackdbus_log_dir_len + log_len + 1);
+    if (log_filename == NULL)
+    {
+        fprintf(stderr, "Out of memory\n");
+        return FALSE;
+    }
+
+    memcpy(log_filename, g_jackdbus_log_dir, g_jackdbus_log_dir_len);
+    memcpy(log_filename + g_jackdbus_log_dir_len, JACKDBUS_LOG, log_len);
+    log_filename[g_jackdbus_log_dir_len + log_len] = 0;
+
+    g_logfile = fopen(log_filename, "a");
+    if (g_logfile == NULL)
+    {
+        fprintf(stderr, "Cannot open jackdbus log file \"%s\": %d (%s)\n", log_filename, errno, strerror(errno));
+        free(log_filename);
+        return FALSE;
+    }
+
+    free(log_filename);
+
+    return TRUE;
+}
+
+void
+log_uninit()
+{
+    fclose(g_logfile);
+}
+
+void
+jack_dbus_error(
+    void *dbus_call_context_ptr,
+    const char *error_name,
+    const char *format,
+    ...)
+{
+    va_list ap;
+    char buffer[300];
+
+    va_start(ap, format);
+
+    vsnprintf(buffer, sizeof(buffer), format, ap);
+
+    jack_error_callback(buffer);
+    if (dbus_call_context_ptr != NULL)
+    {
+        if (((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply != NULL)
+        {
+            dbus_message_unref(((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply);
+            ((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply = NULL;
+        }
+
+        ((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply = dbus_message_new_error(
+            ((struct jack_dbus_method_call *)dbus_call_context_ptr)->message,
+            error_name,
+            buffer);
+    }
+
+    va_end(ap);
+}
+
+void
+jack_dbus_only_error(
+    void *dbus_call_context_ptr,
+    const char *error_name,
+    const char *format,
+    ...)
+{
+    va_list ap;
+    char buffer[300];
+
+    va_start(ap, format);
+
+    vsnprintf(buffer, sizeof(buffer), format, ap);
+
+    if (((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply != NULL)
+    {
+        dbus_message_unref(((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply);
+        ((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply = NULL;
+    }
+
+    ((struct jack_dbus_method_call *)dbus_call_context_ptr)->reply = dbus_message_new_error(
+        ((struct jack_dbus_method_call *)dbus_call_context_ptr)->message,
+        error_name,
+        buffer);
+
+    va_end(ap);
+}
+
+int
+main (int argc, char **argv)
+{
+    DBusError error;
+    int ret;
+    void *controller_ptr;
+    struct stat st;
+    char timestamp_str[26];
+
+    st.st_mtime = 0;
+    stat(argv[0], &st);
+    ctime_r(&st.st_mtime, timestamp_str);
+    timestamp_str[24] = 0;
+
+    if (!jack_controller_settings_init())
+    {
+        ret = 1;
+        goto fail;
+    }
+
+    if (argc != 2 || strcmp(argv[1], "auto") != 0)
+    {
+        ret = 0;
+        fprintf(
+            stderr,
+            "jackdbus should be auto-executed by D-Bus message bus daemon.\n"
+            "If you want to run it manually anyway, specify \"auto\" as only parameter\n");
+        goto fail_uninit_xml;
+    }
+
+    if (!paths_init())
+    {
+        ret = 1;
+        goto fail_uninit_xml;
+    }
+
+    if (!log_init())
+    {
+        ret = 1;
+        goto fail_uninit_paths;
+    }
+
+#if !defined(DISABLE_SIGNAL_MAGIC)
+    jackctl_setup_signals(0);
+#endif
+
+    jack_set_error_function(jack_dbus_error_callback);
+    jack_set_info_function(jack_dbus_info_callback);
+
+    /* setup our SIGSEGV magic that prints nice stack in our logfile */
+    setup_sigsegv();
+
+    jack_info("------------------");
+    jack_info("Controller activated. Version %s (%s) built on %s", jack_get_version_string(), SVN_VERSION, timestamp_str);
+
+    if (!dbus_threads_init_default())
+    {
+        jack_error("dbus_threads_init_default() failed");
+        ret = 1;
+        goto fail_uninit_log;
+    }
+
+    dbus_error_init (&error);
+    g_connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
+    if (dbus_error_is_set (&error))
+    {
+        jack_error("Cannot connect to D-Bus session bus: %s", error.message);
+        ret = 1;
+        goto fail_uninit_log;
+    }
+
+    ret = dbus_bus_request_name(
+                g_connection,
+                "org.jackaudio.service",
+                DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                &error);
+    if (ret == -1)
+    {
+        jack_error("Cannot request service name: %s", error.message);
+                dbus_error_free(&error);
+        ret = 1;
+        goto fail_unref_connection;
+    }
+    else if (ret == DBUS_REQUEST_NAME_REPLY_EXISTS)
+    {
+        jack_error("Requested D-Bus service name already exists");
+        ret = 1;
+        goto fail_unref_connection;
+    }
+
+    controller_ptr = jack_controller_create(g_connection);
+
+    if (controller_ptr == NULL)
+    {
+        ret = 1;
+        goto fail_unref_connection;
+    }
+
+    jack_info("Listening for D-Bus messages");
+
+    g_exit_command = FALSE;
+    while (!g_exit_command && dbus_connection_read_write_dispatch (g_connection, 200));
+
+    jack_controller_destroy(controller_ptr);
+
+    jack_info("Controller deactivated.");
+
+    ret = 0;
+
+fail_unref_connection:
+    dbus_connection_unref(g_connection);
+
+fail_uninit_log:
+    log_uninit();
+
+fail_uninit_paths:
+    paths_uninit();
+
+fail_uninit_xml:
+    jack_controller_settings_uninit();
+
+fail:
+    return ret;
+}
diff --git a/dbus/jackdbus.h b/dbus/jackdbus.h
new file mode 100644
index 0000000..d920cf0
--- /dev/null
+++ b/dbus/jackdbus.h
@@ -0,0 +1,324 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    Copyright (C) 2007-2008 Juuso Alasuutari
+    Copyright (C) 2008 Marc-Olivier Barre
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef DBUS_H__3DB2458F_44B2_43EA_882A_9F888DF71A88__INCLUDED
+#define DBUS_H__3DB2458F_44B2_43EA_882A_9F888DF71A88__INCLUDED
+
+#include <stdbool.h>
+
+#define JACK_DBUS_DEBUG
+
+//#define DISABLE_SIGNAL_MAGIC
+
+#define DEFAULT_XDG_CONFIG "/.config"
+#define DEFAULT_XDG_LOG "/.log"
+#define JACKDBUS_DIR "/jack"
+#define JACKDBUS_LOG "/jackdbus.log"
+#define JACKDBUS_CONF "/conf.xml"
+
+extern char *g_jackdbus_config_dir;
+extern size_t g_jackdbus_config_dir_len; /* without terminating '\0' char */
+extern int g_exit_command;
+
+bool
+jack_controller_settings_init();
+
+void
+jack_controller_settings_uninit();
+
+#define JACK_DBUS_ERROR_UNKNOWN_METHOD              "org.jackaudio.Error.UnknownMethod"
+#define JACK_DBUS_ERROR_SERVER_NOT_RUNNING          "org.jackaudio.Error.ServerNotRunning"
+#define JACK_DBUS_ERROR_UNKNOWN_DRIVER              "org.jackaudio.Error.UnknownDriver"
+#define JACK_DBUS_ERROR_UNKNOWN_INTERNAL            "org.jackaudio.Error.UnknownInternal"
+#define JACK_DBUS_ERROR_UNKNOWN_PARAMETER           "org.jackaudio.Error.UnknownParameter"
+#define JACK_DBUS_ERROR_INVALID_ARGS                "org.jackaudio.Error.InvalidArgs"
+#define JACK_DBUS_ERROR_GENERIC                     "org.jackaudio.Error.Generic"
+#define JACK_DBUS_ERROR_FATAL                       "org.jackaudio.Error.Fatal"
+
+struct jack_dbus_method_call
+{
+    void *context;
+    DBusConnection *connection;
+    const char *method_name;
+    DBusMessage *message;
+    DBusMessage *reply;
+};
+
+struct jack_dbus_interface_method_argument_descriptor
+{
+    const char * name;
+    const char * type;
+    bool direction_out;     /* true - out, false - in */
+};
+
+struct jack_dbus_interface_method_descriptor
+{
+    const char * name;
+    const struct jack_dbus_interface_method_argument_descriptor * arguments;
+    void (* handler)(struct jack_dbus_method_call * call);
+};
+
+struct jack_dbus_interface_signal_argument_descriptor
+{
+    const char * name;
+    const char * type;
+};
+
+struct jack_dbus_interface_signal_descriptor
+{
+    const char * name;
+    const struct jack_dbus_interface_signal_argument_descriptor * arguments;
+};
+
+struct jack_dbus_interface_descriptor
+{
+    const char * name;
+
+    bool
+    (* handler)(
+        struct jack_dbus_method_call * call,
+        const struct jack_dbus_interface_method_descriptor * methods);
+
+    const struct jack_dbus_interface_method_descriptor * methods;
+    const struct jack_dbus_interface_signal_descriptor * signals;
+};
+
+struct jack_dbus_object_descriptor
+{
+    struct jack_dbus_interface_descriptor ** interfaces;
+    void * context;
+};
+
+typedef union
+{
+    unsigned char byte;
+    dbus_bool_t boolean;
+    dbus_int16_t int16;
+    dbus_uint16_t uint16;
+    dbus_int32_t int32;
+    dbus_uint32_t uint32;
+    dbus_int64_t int64;
+    dbus_uint64_t uint64;
+    double doubl;
+    const char *string;
+} message_arg_t;
+
+#define JACK_DBUS_METHOD_ARGUMENTS_BEGIN(method_name)                                   \
+static const                                                                            \
+struct jack_dbus_interface_method_argument_descriptor method_name ## _arguments[] =     \
+{
+
+#define JACK_DBUS_METHOD_ARGUMENTS_BEGIN_EX(method_name, descr)                         \
+static const                                                                            \
+struct jack_dbus_interface_method_argument_descriptor method_name ## _arguments[] =     \
+{
+
+#define JACK_DBUS_METHOD_ARGUMENT(argument_name, argument_type, argument_direction_out) \
+        {                                                                               \
+                .name = argument_name,                                                  \
+                .type = argument_type,                                                  \
+                .direction_out = argument_direction_out                                 \
+        },
+
+#define JACK_DBUS_METHOD_ARGUMENT_IN(argument_name, argument_type, descr)               \
+        {                                                                               \
+                .name = argument_name,                                                  \
+                .type = argument_type,                                                  \
+                .direction_out = false                                                  \
+        },
+
+#define JACK_DBUS_METHOD_ARGUMENT_OUT(argument_name, argument_type, descr)              \
+        {                                                                               \
+                .name = argument_name,                                                  \
+                .type = argument_type,                                                  \
+                .direction_out = true                                                  \
+        },
+
+#define JACK_DBUS_METHOD_ARGUMENT(argument_name, argument_type, argument_direction_out) \
+        {                                                                               \
+                .name = argument_name,                                                  \
+                .type = argument_type,                                                  \
+                .direction_out = argument_direction_out                                 \
+        },
+
+#define JACK_DBUS_METHOD_ARGUMENTS_END                                                  \
+    JACK_DBUS_METHOD_ARGUMENT(NULL, NULL, false)                                        \
+};
+
+#define JACK_DBUS_METHODS_BEGIN                                                         \
+static const                                                                            \
+struct jack_dbus_interface_method_descriptor methods_dtor[] =                           \
+{
+
+#define JACK_DBUS_METHOD_DESCRIBE(method_name, handler_name)                            \
+        {                                                                               \
+            .name = # method_name,                                                      \
+            .arguments = method_name ## _arguments,                                     \
+            .handler = handler_name                                                     \
+        },
+
+#define JACK_DBUS_METHODS_END                                                           \
+        {                                                                               \
+            .name = NULL,                                                               \
+            .arguments = NULL,                                                          \
+            .handler = NULL                                                             \
+        }                                                                               \
+};
+
+#define JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(signal_name)                                   \
+static const                                                                            \
+struct jack_dbus_interface_signal_argument_descriptor signal_name ## _arguments[] =     \
+{
+
+#define JACK_DBUS_SIGNAL_ARGUMENT(argument_name, argument_type)                         \
+        {                                                                               \
+                .name = argument_name,                                                  \
+                .type = argument_type                                                   \
+        },
+
+#define JACK_DBUS_SIGNAL_ARGUMENTS_END                                                  \
+        JACK_DBUS_SIGNAL_ARGUMENT(NULL, NULL)                                           \
+};
+
+#define JACK_DBUS_SIGNALS_BEGIN                                                         \
+static const                                                                            \
+struct jack_dbus_interface_signal_descriptor signals_dtor[] =                           \
+{
+
+#define JACK_DBUS_SIGNAL_DESCRIBE(signal_name)                                          \
+        {                                                                               \
+                .name = # signal_name,                                                  \
+                .arguments = signal_name ## _arguments                                  \
+        },
+
+#define JACK_DBUS_SIGNALS_END                                                           \
+        {                                                                               \
+                .name = NULL,                                                           \
+                .arguments = NULL,                                                      \
+        }                                                                               \
+};
+
+#define JACK_DBUS_IFACE_BEGIN(iface_var, iface_name)                                    \
+struct jack_dbus_interface_descriptor iface_var =                                       \
+{                                                                                       \
+        .name = iface_name,                                                             \
+        .handler = jack_dbus_run_method,
+
+#define JACK_DBUS_IFACE_HANDLER(handler_func)                                           \
+        .handler = handler_func,
+
+#define JACK_DBUS_IFACE_EXPOSE_METHODS                                                  \
+        .methods = methods_dtor,
+
+#define JACK_DBUS_IFACE_EXPOSE_SIGNALS                                                  \
+        .signals = signals_dtor,
+
+#define JACK_DBUS_IFACE_END                                                             \
+};
+
+DBusHandlerResult
+jack_dbus_message_handler(
+    DBusConnection *connection,
+    DBusMessage *message,
+    void *data);
+
+void
+jack_dbus_message_handler_unregister(
+    DBusConnection *connection,
+    void *data);
+
+bool
+jack_dbus_run_method(
+    struct jack_dbus_method_call * call,
+    const struct jack_dbus_interface_method_descriptor * methods);
+
+void
+jack_dbus_error(
+    void *dbus_call_context_ptr,
+    const char *error_name,
+    const char *format,
+    ...);
+
+void
+jack_dbus_only_error(
+    void *dbus_call_context_ptr,
+    const char *error_name,
+    const char *format,
+    ...);
+
+bool
+jack_dbus_get_method_args(
+    struct jack_dbus_method_call *call,
+    int type,
+    ...);
+
+bool
+jack_dbus_get_method_args_string_and_variant(
+    struct jack_dbus_method_call *call,
+    const char **arg1,
+    message_arg_t *arg2,
+    int *type_ptr);
+
+bool
+jack_dbus_get_method_args_two_strings_and_variant(
+    struct jack_dbus_method_call *call,
+    const char **arg1,
+    const char **arg2,
+    message_arg_t *arg3,
+    int *type_ptr);
+    
+bool
+jack_dbus_message_append_variant(
+    DBusMessageIter *iter,
+    int type,
+    const char *signature,
+    message_arg_t *arg);
+
+void
+jack_dbus_construct_method_return_empty(
+    struct jack_dbus_method_call * call);
+
+void
+jack_dbus_construct_method_return_single(
+    struct jack_dbus_method_call *call,
+    int type,
+    message_arg_t arg);
+
+void
+jack_dbus_construct_method_return_array_of_strings(
+    struct jack_dbus_method_call *call,
+    unsigned int num_members,
+    const char **array);
+
+void
+jack_dbus_send_signal(
+    const char *sender_object_path,
+    const char *iface,
+    const char *signal_name,
+    int first_arg_type,
+    ...);
+
+#define JACK_CONTROLLER_OBJECT_PATH "/org/jackaudio/Controller"
+
+extern struct jack_dbus_interface_descriptor * g_jackcontroller_interfaces[];
+extern DBusConnection * g_connection;
+
+#endif /* #ifndef DBUS_H__3DB2458F_44B2_43EA_882A_9F888DF71A88__INCLUDED */
diff --git a/dbus/list.h b/dbus/list.h
new file mode 100644
index 0000000..fee6e73
--- /dev/null
+++ b/dbus/list.h
@@ -0,0 +1,874 @@
+/* -*- Mode: C ; c-basic-offset: 2 -*- */
+/*****************************************************************************
+ *
+ *   Linux kernel header adapted for user-mode
+ *   The 2.6.17-rt1 version was used.
+ *
+ *   Original copyright holders of this code are unknown, they were not
+ *   mentioned in the original file.
+ *    
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; version 2 of the License
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *****************************************************************************/
+
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
+
+#include <stddef.h>
+
+#if !defined(offsetof)
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:	the pointer to the member.
+ * @type:	the type of the container struct this is embedded in.
+ * @member:	the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({			\
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
+        (type *)( (char *)__mptr - offsetof(type,member) );})
+
+#define prefetch(x) (x = x)
+
+/*
+ * These are non-NULL pointers that will result in page faults
+ * under normal circumstances, used to verify that nobody uses
+ * non-initialized list entries.
+ */
+#define LIST_POISON1  ((void *) 0x00100100)
+#define LIST_POISON2  ((void *) 0x00200200)
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+  struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+  struct list_head name = LIST_HEAD_INIT(name)
+
+static inline void INIT_LIST_HEAD(struct list_head *list)
+{
+  list->next = list;
+  list->prev = list;
+}
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_add(struct list_head *new,
+            struct list_head *prev,
+            struct list_head *next)
+{
+  next->prev = new;
+  new->next = next;
+  new->prev = prev;
+  prev->next = new;
+}
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static inline void list_add(struct list_head *new, struct list_head *head)
+{
+  __list_add(new, head, head->next);
+}
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+  __list_add(new, head->prev, head);
+}
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_add_rcu(struct list_head * new,
+    struct list_head * prev, struct list_head * next)
+{
+  new->next = next;
+  new->prev = prev;
+//  smp_wmb();
+  next->prev = new;
+  prev->next = new;
+}
+
+/**
+ * list_add_rcu - add a new entry to rcu-protected list
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as list_add_rcu()
+ * or list_del_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * list_for_each_entry_rcu().
+ */
+static inline void list_add_rcu(struct list_head *new, struct list_head *head)
+{
+  __list_add_rcu(new, head, head->next);
+}
+
+/**
+ * list_add_tail_rcu - add a new entry to rcu-protected list
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as list_add_tail_rcu()
+ * or list_del_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * list_for_each_entry_rcu().
+ */
+static inline void list_add_tail_rcu(struct list_head *new,
+          struct list_head *head)
+{
+  __list_add_rcu(new, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_del(struct list_head * prev, struct list_head * next)
+{
+  next->prev = prev;
+  prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+static inline void list_del(struct list_head *entry)
+{
+  __list_del(entry->prev, entry->next);
+  entry->next = LIST_POISON1;
+  entry->prev = LIST_POISON2;
+}
+
+/**
+ * list_del_rcu - deletes entry from list without re-initialization
+ * @entry: the element to delete from the list.
+ *
+ * Note: list_empty on entry does not return true after this,
+ * the entry is in an undefined state. It is useful for RCU based
+ * lockfree traversal.
+ *
+ * In particular, it means that we can not poison the forward
+ * pointers that may still be used for walking the list.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as list_del_rcu()
+ * or list_add_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * list_for_each_entry_rcu().
+ *
+ * Note that the caller is not permitted to immediately free
+ * the newly deleted entry.  Instead, either synchronize_rcu()
+ * or call_rcu() must be used to defer freeing until an RCU
+ * grace period has elapsed.
+ */
+static inline void list_del_rcu(struct list_head *entry)
+{
+  __list_del(entry->prev, entry->next);
+  entry->prev = LIST_POISON2;
+}
+
+/*
+ * list_replace_rcu - replace old entry by new one
+ * @old : the element to be replaced
+ * @new : the new element to insert
+ *
+ * The old entry will be replaced with the new entry atomically.
+ */
+static inline void list_replace_rcu(struct list_head *old,
+        struct list_head *new)
+{
+  new->next = old->next;
+  new->prev = old->prev;
+//  smp_wmb();
+  new->next->prev = new;
+  new->prev->next = new;
+  old->prev = LIST_POISON2;
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static inline void list_del_init(struct list_head *entry)
+{
+  __list_del(entry->prev, entry->next);
+  INIT_LIST_HEAD(entry);
+}
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add(list, head);
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static inline void list_move_tail(struct list_head *list,
+          struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add_tail(list, head);
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static inline int list_empty(const struct list_head *head)
+{
+  return head->next == head;
+}
+
+/**
+ * list_empty_careful - tests whether a list is
+ * empty _and_ checks that no other CPU might be
+ * in the process of still modifying either member
+ *
+ * NOTE: using list_empty_careful() without synchronization
+ * can only be safe if the only activity that can happen
+ * to the list entry is list_del_init(). Eg. it cannot be used
+ * if another CPU could re-list_add() it.
+ *
+ * @head: the list to test.
+ */
+static inline int list_empty_careful(const struct list_head *head)
+{
+  struct list_head *next = head->next;
+  return (next == head) && (next == head->prev);
+}
+
+static inline void __list_splice(struct list_head *list,
+         struct list_head *head)
+{
+  struct list_head *first = list->next;
+  struct list_head *last = list->prev;
+  struct list_head *at = head->next;
+
+  first->prev = head;
+  head->next = first;
+
+  last->next = at;
+  at->prev = last;
+}
+
+/**
+ * list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice(struct list_head *list, struct list_head *head)
+{
+  if (!list_empty(list))
+    __list_splice(list, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_init(struct list_head *list,
+            struct list_head *head)
+{
+  if (!list_empty(list)) {
+    __list_splice(list, head);
+    INIT_LIST_HEAD(list);
+  }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr:  the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+  container_of(ptr, type, member)
+
+/**
+ * list_for_each  - iterate over a list
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define list_for_each(pos, head) \
+  for (pos = (head)->next; prefetch(pos->next), pos != (head); \
+          pos = pos->next)
+
+/**
+ * __list_for_each  - iterate over a list
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ *
+ * This variant differs from list_for_each() in that it's the
+ * simplest possible list iteration code, no prefetching is done.
+ * Use this for code that knows the list to be very short (empty
+ * or 1 entry) most of the time.
+ */
+#define __list_for_each(pos, head) \
+  for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_prev - iterate over a list backwards
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+  for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
+          pos = pos->prev)
+
+/**
+ * list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @n:    another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+  for (pos = (head)->next, n = pos->next; pos != (head); \
+    pos = n, n = pos->next)
+
+/**
+ * list_for_each_entry  - iterate over list of given type
+ * @pos:  the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member)        \
+  for (pos = list_entry((head)->next, typeof(*pos), member);  \
+       prefetch(pos->member.next), &pos->member != (head);  \
+       pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_reverse - iterate backwards over list of given type.
+ * @pos:  the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_reverse(pos, head, member)      \
+  for (pos = list_entry((head)->prev, typeof(*pos), member);  \
+       prefetch(pos->member.prev), &pos->member != (head);  \
+       pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_prepare_entry - prepare a pos entry for use as a start point in
+ *      list_for_each_entry_continue
+ * @pos:  the type * to use as a start point
+ * @head: the head of the list
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_prepare_entry(pos, head, member) \
+  ((pos) ? : list_entry(head, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue - iterate over list of given type
+ *      continuing after existing point
+ * @pos:  the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_continue(pos, head, member)     \
+  for (pos = list_entry(pos->member.next, typeof(*pos), member);  \
+       prefetch(pos->member.next), &pos->member != (head);  \
+       pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_from - iterate over list of given type
+ *      continuing from existing point
+ * @pos:  the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_from(pos, head, member)       \
+  for (; prefetch(pos->member.next), &pos->member != (head);  \
+       pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos:  the type * to use as a loop counter.
+ * @n:    another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member)      \
+  for (pos = list_entry((head)->next, typeof(*pos), member),  \
+    n = list_entry(pos->member.next, typeof(*pos), member); \
+       &pos->member != (head);          \
+       pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_continue -  iterate over list of given type
+ *      continuing after existing point safe against removal of list entry
+ * @pos:  the type * to use as a loop counter.
+ * @n:    another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe_continue(pos, n, head, member)     \
+  for (pos = list_entry(pos->member.next, typeof(*pos), member),    \
+    n = list_entry(pos->member.next, typeof(*pos), member);   \
+       &pos->member != (head);            \
+       pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_from - iterate over list of given type
+ *      from existing point safe against removal of list entry
+ * @pos:  the type * to use as a loop counter.
+ * @n:    another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe_from(pos, n, head, member)       \
+  for (n = list_entry(pos->member.next, typeof(*pos), member);    \
+       &pos->member != (head);            \
+       pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
+ *              removal of list entry
+ * @pos:  the type * to use as a loop counter.
+ * @n:    another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe_reverse(pos, n, head, member)    \
+  for (pos = list_entry((head)->prev, typeof(*pos), member),  \
+    n = list_entry(pos->member.prev, typeof(*pos), member); \
+       &pos->member != (head);          \
+       pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+
+/**
+ * list_for_each_rcu  - iterate over an rcu-protected list
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as list_add_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ */
+#define list_for_each_rcu(pos, head) \
+  for (pos = (head)->next; \
+    prefetch(rcu_dereference(pos)->next), pos != (head); \
+          pos = pos->next)
+
+#define __list_for_each_rcu(pos, head) \
+  for (pos = (head)->next; \
+    rcu_dereference(pos) != (head); \
+          pos = pos->next)
+
+/**
+ * list_for_each_safe_rcu - iterate over an rcu-protected list safe
+ *          against removal of list entry
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @n:    another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as list_add_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ */
+#define list_for_each_safe_rcu(pos, n, head) \
+  for (pos = (head)->next; \
+    n = rcu_dereference(pos)->next, pos != (head); \
+    pos = n)
+
+/**
+ * list_for_each_entry_rcu  - iterate over rcu list of given type
+ * @pos:  the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as list_add_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ */
+#define list_for_each_entry_rcu(pos, head, member) \
+  for (pos = list_entry((head)->next, typeof(*pos), member); \
+    prefetch(rcu_dereference(pos)->member.next), \
+      &pos->member != (head); \
+    pos = list_entry(pos->member.next, typeof(*pos), member))
+
+
+/**
+ * list_for_each_continue_rcu - iterate over an rcu-protected list
+ *      continuing after existing point.
+ * @pos:  the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as list_add_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ */
+#define list_for_each_continue_rcu(pos, head) \
+  for ((pos) = (pos)->next; \
+    prefetch(rcu_dereference((pos))->next), (pos) != (head); \
+          (pos) = (pos)->next)
+
+/*
+ * Double linked lists with a single pointer list head.
+ * Mostly useful for hash tables where the two pointer list head is
+ * too wasteful.
+ * You lose the ability to access the tail in O(1).
+ */
+
+struct hlist_head {
+  struct hlist_node *first;
+};
+
+struct hlist_node {
+  struct hlist_node *next, **pprev;
+};
+
+#define HLIST_HEAD_INIT { .first = NULL }
+#define HLIST_HEAD(name) struct hlist_head name = {  .first = NULL }
+#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
+static inline void INIT_HLIST_NODE(struct hlist_node *h)
+{
+  h->next = NULL;
+  h->pprev = NULL;
+}
+
+static inline int hlist_unhashed(const struct hlist_node *h)
+{
+  return !h->pprev;
+}
+
+static inline int hlist_empty(const struct hlist_head *h)
+{
+  return !h->first;
+}
+
+static inline void __hlist_del(struct hlist_node *n)
+{
+  struct hlist_node *next = n->next;
+  struct hlist_node **pprev = n->pprev;
+  *pprev = next;
+  if (next)
+    next->pprev = pprev;
+}
+
+static inline void hlist_del(struct hlist_node *n)
+{
+  __hlist_del(n);
+  n->next = LIST_POISON1;
+  n->pprev = LIST_POISON2;
+}
+
+/**
+ * hlist_del_rcu - deletes entry from hash list without re-initialization
+ * @n: the element to delete from the hash list.
+ *
+ * Note: list_unhashed() on entry does not return true after this,
+ * the entry is in an undefined state. It is useful for RCU based
+ * lockfree traversal.
+ *
+ * In particular, it means that we can not poison the forward
+ * pointers that may still be used for walking the hash list.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as hlist_add_head_rcu()
+ * or hlist_del_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * hlist_for_each_entry().
+ */
+static inline void hlist_del_rcu(struct hlist_node *n)
+{
+  __hlist_del(n);
+  n->pprev = LIST_POISON2;
+}
+
+static inline void hlist_del_init(struct hlist_node *n)
+{
+  if (!hlist_unhashed(n)) {
+    __hlist_del(n);
+    INIT_HLIST_NODE(n);
+  }
+}
+
+/*
+ * hlist_replace_rcu - replace old entry by new one
+ * @old : the element to be replaced
+ * @new : the new element to insert
+ *
+ * The old entry will be replaced with the new entry atomically.
+ */
+static inline void hlist_replace_rcu(struct hlist_node *old,
+          struct hlist_node *new)
+{
+  struct hlist_node *next = old->next;
+
+  new->next = next;
+  new->pprev = old->pprev;
+//  smp_wmb();
+  if (next)
+    new->next->pprev = &new->next;
+  *new->pprev = new;
+  old->pprev = LIST_POISON2;
+}
+
+static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
+{
+  struct hlist_node *first = h->first;
+  n->next = first;
+  if (first)
+    first->pprev = &n->next;
+  h->first = n;
+  n->pprev = &h->first;
+}
+
+
+/**
+ * hlist_add_head_rcu - adds the specified element to the specified hlist,
+ * while permitting racing traversals.
+ * @n: the element to add to the hash list.
+ * @h: the list to add to.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as hlist_add_head_rcu()
+ * or hlist_del_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * hlist_for_each_entry_rcu(), used to prevent memory-consistency
+ * problems on Alpha CPUs.  Regardless of the type of CPU, the
+ * list-traversal primitive must be guarded by rcu_read_lock().
+ */
+static inline void hlist_add_head_rcu(struct hlist_node *n,
+          struct hlist_head *h)
+{
+  struct hlist_node *first = h->first;
+  n->next = first;
+  n->pprev = &h->first;
+//  smp_wmb();
+  if (first)
+    first->pprev = &n->next;
+  h->first = n;
+}
+
+/* next must be != NULL */
+static inline void hlist_add_before(struct hlist_node *n,
+          struct hlist_node *next)
+{
+  n->pprev = next->pprev;
+  n->next = next;
+  next->pprev = &n->next;
+  *(n->pprev) = n;
+}
+
+static inline void hlist_add_after(struct hlist_node *n,
+          struct hlist_node *next)
+{
+  next->next = n->next;
+  n->next = next;
+  next->pprev = &n->next;
+
+  if(next->next)
+    next->next->pprev  = &next->next;
+}
+
+/**
+ * hlist_add_before_rcu - adds the specified element to the specified hlist
+ * before the specified node while permitting racing traversals.
+ * @n: the new element to add to the hash list.
+ * @next: the existing element to add the new element before.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as hlist_add_head_rcu()
+ * or hlist_del_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * hlist_for_each_entry_rcu(), used to prevent memory-consistency
+ * problems on Alpha CPUs.
+ */
+static inline void hlist_add_before_rcu(struct hlist_node *n,
+          struct hlist_node *next)
+{
+  n->pprev = next->pprev;
+  n->next = next;
+//  smp_wmb();
+  next->pprev = &n->next;
+  *(n->pprev) = n;
+}
+
+/**
+ * hlist_add_after_rcu - adds the specified element to the specified hlist
+ * after the specified node while permitting racing traversals.
+ * @prev: the existing element to add the new element after.
+ * @n: the new element to add to the hash list.
+ *
+ * The caller must take whatever precautions are necessary
+ * (such as holding appropriate locks) to avoid racing
+ * with another list-mutation primitive, such as hlist_add_head_rcu()
+ * or hlist_del_rcu(), running on this same list.
+ * However, it is perfectly legal to run concurrently with
+ * the _rcu list-traversal primitives, such as
+ * hlist_for_each_entry_rcu(), used to prevent memory-consistency
+ * problems on Alpha CPUs.
+ */
+static inline void hlist_add_after_rcu(struct hlist_node *prev,
+               struct hlist_node *n)
+{
+  n->next = prev->next;
+  n->pprev = &prev->next;
+//  smp_wmb();
+  prev->next = n;
+  if (n->next)
+    n->next->pprev = &n->next;
+}
+
+#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
+
+#define hlist_for_each(pos, head) \
+  for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
+       pos = pos->next)
+
+#define hlist_for_each_safe(pos, n, head) \
+  for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
+       pos = n)
+
+/**
+ * hlist_for_each_entry - iterate over list of given type
+ * @tpos: the type * to use as a loop counter.
+ * @pos:  the &struct hlist_node to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry(tpos, pos, head, member)      \
+  for (pos = (head)->first;          \
+       pos && ({ prefetch(pos->next); 1;}) &&      \
+    ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+       pos = pos->next)
+
+/**
+ * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point
+ * @tpos: the type * to use as a loop counter.
+ * @pos:  the &struct hlist_node to use as a loop counter.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_continue(tpos, pos, member)     \
+  for (pos = (pos)->next;            \
+       pos && ({ prefetch(pos->next); 1;}) &&      \
+    ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+       pos = pos->next)
+
+/**
+ * hlist_for_each_entry_from - iterate over a hlist continuing from existing point
+ * @tpos: the type * to use as a loop counter.
+ * @pos:  the &struct hlist_node to use as a loop counter.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_from(tpos, pos, member)       \
+  for (; pos && ({ prefetch(pos->next); 1;}) &&      \
+    ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+       pos = pos->next)
+
+/**
+ * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @tpos: the type * to use as a loop counter.
+ * @pos:  the &struct hlist_node to use as a loop counter.
+ * @n:    another &struct hlist_node to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_safe(tpos, pos, n, head, member)      \
+  for (pos = (head)->first;          \
+       pos && ({ n = pos->next; 1; }) &&         \
+    ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+       pos = n)
+
+/**
+ * hlist_for_each_entry_rcu - iterate over rcu list of given type
+ * @tpos: the type * to use as a loop counter.
+ * @pos:  the &struct hlist_node to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the hlist_node within the struct.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as hlist_add_head_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ */
+#define hlist_for_each_entry_rcu(tpos, pos, head, member)    \
+  for (pos = (head)->first;          \
+       rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) &&   \
+    ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+       pos = pos->next)
+
+#endif
diff --git a/dbus/org.jackaudio.service.in b/dbus/org.jackaudio.service.in
new file mode 100644
index 0000000..8cab689
--- /dev/null
+++ b/dbus/org.jackaudio.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.jackaudio.service
+Exec=@BINDIR@/jackdbus auto
diff --git a/dbus/reserve.c b/dbus/reserve.c
new file mode 100644
index 0000000..bc698a6
--- /dev/null
+++ b/dbus/reserve.c
@@ -0,0 +1,635 @@
+/***
+  Copyright 2009 Lennart Poettering
+
+  Permission is hereby granted, free of charge, to any person
+  obtaining a copy of this software and associated documentation files
+  (the "Software"), to deal in the Software without restriction,
+  including without limitation the rights to use, copy, modify, merge,
+  publish, distribute, sublicense, and/or sell copies of the Software,
+  and to permit persons to whom the Software is furnished to do so,
+  subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be
+  included in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+***/
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdint.h>
+
+#include "reserve.h"
+
+struct rd_device {
+	int ref;
+
+	char *device_name;
+	char *application_name;
+	char *application_device_name;
+	char *service_name;
+	char *object_path;
+	int32_t priority;
+
+	DBusConnection *connection;
+
+	int owning:1;
+	int registered:1;
+	int filtering:1;
+	int gave_up:1;
+
+	rd_request_cb_t request_cb;
+	void *userdata;
+};
+
+
+#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1."
+#define OBJECT_PREFIX "/org/freedesktop/ReserveDevice1/"
+
+static const char introspection[] =
+	DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
+	"<node>"
+	" <!-- If you are looking for documentation make sure to check out\n"
+	"      http://git.0pointer.de/?p=reserve.git;a=blob;f=reserve.txt -->\n"
+	" <interface name=\"org.freedesktop.ReserveDevice1\">"
+	"  <method name=\"RequestRelease\">"
+	"   <arg name=\"priority\" type=\"i\" direction=\"in\"/>"
+	"   <arg name=\"result\" type=\"b\" direction=\"out\"/>"
+	"  </method>"
+	"  <property name=\"Priority\" type=\"i\" access=\"read\"/>"
+	"  <property name=\"ApplicationName\" type=\"s\" access=\"read\"/>"
+	"  <property name=\"ApplicationDeviceName\" type=\"s\" access=\"read\"/>"
+	" </interface>"
+	" <interface name=\"org.freedesktop.DBus.Properties\">"
+	"  <method name=\"Get\">"
+	"   <arg name=\"interface\" direction=\"in\" type=\"s\"/>"
+	"   <arg name=\"property\" direction=\"in\" type=\"s\"/>"
+	"   <arg name=\"value\" direction=\"out\" type=\"v\"/>"
+	"  </method>"
+	" </interface>"
+	" <interface name=\"org.freedesktop.DBus.Introspectable\">"
+	"  <method name=\"Introspect\">"
+	"   <arg name=\"data\" type=\"s\" direction=\"out\"/>"
+	"  </method>"
+	" </interface>"
+	"</node>";
+
+static dbus_bool_t add_variant(
+	DBusMessage *m,
+	int type,
+	const void *data) {
+
+	DBusMessageIter iter, sub;
+	char t[2];
+
+	t[0] = (char) type;
+	t[1] = 0;
+
+	dbus_message_iter_init_append(m, &iter);
+
+	if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, t, &sub))
+		return FALSE;
+
+	if (!dbus_message_iter_append_basic(&sub, type, data))
+		return FALSE;
+
+	if (!dbus_message_iter_close_container(&iter, &sub))
+		return FALSE;
+
+	return TRUE;
+}
+
+static DBusHandlerResult object_handler(
+	DBusConnection *c,
+	DBusMessage *m,
+	void *userdata) {
+
+	rd_device *d;
+	DBusError error;
+	DBusMessage *reply = NULL;
+
+	dbus_error_init(&error);
+
+	d = (rd_device*)userdata;
+	assert(d->ref >= 1);
+
+	if (dbus_message_is_method_call(
+		    m,
+		    "org.freedesktop.ReserveDevice1",
+		    "RequestRelease")) {
+
+		int32_t priority;
+		dbus_bool_t ret;
+
+		if (!dbus_message_get_args(
+			    m,
+			    &error,
+			    DBUS_TYPE_INT32, &priority,
+			    DBUS_TYPE_INVALID))
+			goto invalid;
+
+		ret = FALSE;
+
+		if (priority > d->priority && d->request_cb) {
+			d->ref++;
+
+			if (d->request_cb(d, 0) > 0) {
+				ret = TRUE;
+				d->gave_up = 1;
+			}
+
+			rd_release(d);
+		}
+
+		if (!(reply = dbus_message_new_method_return(m)))
+			goto oom;
+
+		if (!dbus_message_append_args(
+			    reply,
+			    DBUS_TYPE_BOOLEAN, &ret,
+			    DBUS_TYPE_INVALID))
+			goto oom;
+
+		if (!dbus_connection_send(c, reply, NULL))
+			goto oom;
+
+		dbus_message_unref(reply);
+
+		return DBUS_HANDLER_RESULT_HANDLED;
+
+	} else if (dbus_message_is_method_call(
+			   m,
+			   "org.freedesktop.DBus.Properties",
+			   "Get")) {
+
+		const char *interface, *property;
+
+		if (!dbus_message_get_args(
+			    m,
+			    &error,
+			    DBUS_TYPE_STRING, &interface,
+			    DBUS_TYPE_STRING, &property,
+			    DBUS_TYPE_INVALID))
+			goto invalid;
+
+		if (strcmp(interface, "org.freedesktop.ReserveDevice1") == 0) {
+			const char *empty = "";
+
+			if (strcmp(property, "ApplicationName") == 0 && d->application_name) {
+				if (!(reply = dbus_message_new_method_return(m)))
+					goto oom;
+
+				if (!add_variant(
+					    reply,
+					    DBUS_TYPE_STRING,
+					    d->application_name ? (const char**) &d->application_name : &empty))
+					goto oom;
+
+			} else if (strcmp(property, "ApplicationDeviceName") == 0) {
+				if (!(reply = dbus_message_new_method_return(m)))
+					goto oom;
+
+				if (!add_variant(
+					    reply,
+					    DBUS_TYPE_STRING,
+					    d->application_device_name ? (const char**) &d->application_device_name : &empty))
+					goto oom;
+
+			} else if (strcmp(property, "Priority") == 0) {
+				if (!(reply = dbus_message_new_method_return(m)))
+					goto oom;
+
+				if (!add_variant(
+					    reply,
+					    DBUS_TYPE_INT32,
+					    &d->priority))
+					goto oom;
+			} else {
+				if (!(reply = dbus_message_new_error_printf(
+					      m,
+					      DBUS_ERROR_UNKNOWN_METHOD,
+					      "Unknown property %s",
+					      property)))
+					goto oom;
+			}
+
+			if (!dbus_connection_send(c, reply, NULL))
+				goto oom;
+
+			dbus_message_unref(reply);
+
+			return DBUS_HANDLER_RESULT_HANDLED;
+		}
+
+	} else if (dbus_message_is_method_call(
+			   m,
+			   "org.freedesktop.DBus.Introspectable",
+			   "Introspect")) {
+			    const char *i = introspection;
+
+		if (!(reply = dbus_message_new_method_return(m)))
+			goto oom;
+
+		if (!dbus_message_append_args(
+			    reply,
+			    DBUS_TYPE_STRING,
+			    &i,
+			    DBUS_TYPE_INVALID))
+			goto oom;
+
+		if (!dbus_connection_send(c, reply, NULL))
+			goto oom;
+
+		dbus_message_unref(reply);
+
+		return DBUS_HANDLER_RESULT_HANDLED;
+	}
+
+	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+invalid:
+	if (reply)
+		dbus_message_unref(reply);
+
+	if (!(reply = dbus_message_new_error(
+		      m,
+		      DBUS_ERROR_INVALID_ARGS,
+		      "Invalid arguments")))
+		goto oom;
+
+	if (!dbus_connection_send(c, reply, NULL))
+		goto oom;
+
+	dbus_message_unref(reply);
+
+	dbus_error_free(&error);
+
+	return DBUS_HANDLER_RESULT_HANDLED;
+
+oom:
+	if (reply)
+		dbus_message_unref(reply);
+
+	dbus_error_free(&error);
+
+	return DBUS_HANDLER_RESULT_NEED_MEMORY;
+}
+
+static DBusHandlerResult filter_handler(
+	DBusConnection *c,
+	DBusMessage *m,
+	void *userdata) {
+
+	DBusMessage *reply;
+	rd_device *d;
+	DBusError error;
+
+	dbus_error_init(&error);
+
+	d = (rd_device*)userdata;
+
+	if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameLost")) {
+		const char *name;
+
+		if (!dbus_message_get_args(
+			    m,
+			    &error,
+			    DBUS_TYPE_STRING, &name,
+			    DBUS_TYPE_INVALID))
+			goto invalid;
+
+		if (strcmp(name, d->service_name) == 0 && d->owning) {
+			d->owning = 0;
+
+			if (!d->gave_up)  {
+				d->ref++;
+
+				if (d->request_cb)
+					d->request_cb(d, 1);
+				d->gave_up = 1;
+
+				rd_release(d);
+			}
+
+			return DBUS_HANDLER_RESULT_HANDLED;
+		}
+	}
+
+	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+invalid:
+	if (!(reply = dbus_message_new_error(
+		      m,
+		      DBUS_ERROR_INVALID_ARGS,
+		      "Invalid arguments")))
+		goto oom;
+
+	if (!dbus_connection_send(c, reply, NULL))
+		goto oom;
+
+	dbus_message_unref(reply);
+
+	dbus_error_free(&error);
+
+	return DBUS_HANDLER_RESULT_HANDLED;
+
+oom:
+	if (reply)
+		dbus_message_unref(reply);
+
+	dbus_error_free(&error);
+
+	return DBUS_HANDLER_RESULT_NEED_MEMORY;
+}
+
+static DBusObjectPathVTable vtable;
+
+int rd_acquire(
+	rd_device **_d,
+	DBusConnection *connection,
+	const char *device_name,
+	const char *application_name,
+	int32_t priority,
+	rd_request_cb_t request_cb,
+	DBusError *error) {
+
+	rd_device *d = NULL;
+	int r, k;
+	DBusError _error;
+	DBusMessage *m = NULL, *reply = NULL;
+	dbus_bool_t good;
+
+        vtable.message_function = object_handler;
+
+	if (!error)
+		error = &_error;
+
+	dbus_error_init(error);
+
+	if (!_d)
+		return -EINVAL;
+
+	if (!connection)
+		return -EINVAL;
+
+	if (!device_name)
+		return -EINVAL;
+
+	if (!request_cb && priority != INT32_MAX)
+		return -EINVAL;
+
+	if (!(d = (rd_device *)calloc(sizeof(rd_device), 1)))
+		return -ENOMEM;
+
+	d->ref = 1;
+
+	if (!(d->device_name = strdup(device_name))) {
+		r = -ENOMEM;
+		goto fail;
+	}
+
+	if (!(d->application_name = strdup(application_name))) {
+		r = -ENOMEM;
+		goto fail;
+	}
+
+	d->priority = priority;
+	d->connection = dbus_connection_ref(connection);
+	d->request_cb = request_cb;
+
+	if (!(d->service_name = (char*)malloc(sizeof(SERVICE_PREFIX) + strlen(device_name)))) {
+		r = -ENOMEM;
+		goto fail;
+	}
+	sprintf(d->service_name, SERVICE_PREFIX "%s", d->device_name);
+
+	if (!(d->object_path = (char*)malloc(sizeof(OBJECT_PREFIX) + strlen(device_name)))) {
+		r = -ENOMEM;
+		goto fail;
+	}
+	sprintf(d->object_path, OBJECT_PREFIX "%s", d->device_name);
+
+	if ((k = dbus_bus_request_name(
+		     d->connection,
+		     d->service_name,
+		     DBUS_NAME_FLAG_DO_NOT_QUEUE|
+		     (priority < INT32_MAX ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT : 0),
+		     error)) < 0) {
+		r = -EIO;
+		goto fail;
+	}
+
+	if (k == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+		goto success;
+
+	if (k != DBUS_REQUEST_NAME_REPLY_EXISTS) {
+		r = -EIO;
+		goto fail;
+	}
+
+	if (priority <= INT32_MIN) {
+		r = -EBUSY;
+		goto fail;
+	}
+
+	if (!(m = dbus_message_new_method_call(
+		      d->service_name,
+		      d->object_path,
+		      "org.freedesktop.ReserveDevice1",
+		      "RequestRelease"))) {
+		r = -ENOMEM;
+		goto fail;
+	}
+
+	if (!dbus_message_append_args(
+		    m,
+		    DBUS_TYPE_INT32, &d->priority,
+		    DBUS_TYPE_INVALID)) {
+		r = -ENOMEM;
+		goto fail;
+	}
+
+	if (!(reply = dbus_connection_send_with_reply_and_block(
+		      d->connection,
+		      m,
+		      5000, /* 5s */
+		      error))) {
+
+		if (dbus_error_has_name(error, DBUS_ERROR_TIMED_OUT) ||
+		    dbus_error_has_name(error, DBUS_ERROR_UNKNOWN_METHOD) ||
+		    dbus_error_has_name(error, DBUS_ERROR_NO_REPLY)) {
+			/* This must be treated as denied. */
+			r = -EBUSY;
+			goto fail;
+		}
+
+		r = -EIO;
+		goto fail;
+	}
+
+	if (!dbus_message_get_args(
+		    reply,
+		    error,
+		    DBUS_TYPE_BOOLEAN, &good,
+		    DBUS_TYPE_INVALID)) {
+		r = -EIO;
+		goto fail;
+	}
+
+	if (!good) {
+		r = -EBUSY;
+		goto fail;
+	}
+
+	if ((k = dbus_bus_request_name(
+		     d->connection,
+		     d->service_name,
+		     DBUS_NAME_FLAG_DO_NOT_QUEUE|
+		     (priority < INT32_MAX ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT : 0)|
+		     DBUS_NAME_FLAG_REPLACE_EXISTING,
+		     error)) < 0) {
+		r = -EIO;
+		goto fail;
+	}
+
+	if (k != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+		r = -EIO;
+		goto fail;
+	}
+
+success:
+	d->owning = 1;
+
+	if (!(dbus_connection_register_object_path(
+		      d->connection,
+		      d->object_path,
+		      &vtable,
+		      d))) {
+		r = -ENOMEM;
+		goto fail;
+	}
+
+	d->registered = 1;
+
+	if (!dbus_connection_add_filter(
+		    d->connection,
+		    filter_handler,
+		    d,
+		    NULL)) {
+		r = -ENOMEM;
+		goto fail;
+	}
+
+	d->filtering = 1;
+
+	*_d = d;
+	return 0;
+
+fail:
+	if (m)
+		dbus_message_unref(m);
+
+	if (reply)
+		dbus_message_unref(reply);
+
+	if (&_error == error)
+		dbus_error_free(&_error);
+
+	if (d)
+		rd_release(d);
+
+	return r;
+}
+
+void rd_release(
+	rd_device *d) {
+
+	if (!d)
+		return;
+
+	assert(d->ref > 0);
+
+	if (--d->ref)
+		return;
+
+
+	if (d->filtering)
+		dbus_connection_remove_filter(
+			d->connection,
+			filter_handler,
+			d);
+
+	if (d->registered)
+		dbus_connection_unregister_object_path(
+			d->connection,
+			d->object_path);
+
+	if (d->owning) {
+		DBusError error;
+		dbus_error_init(&error);
+
+		dbus_bus_release_name(
+			d->connection,
+			d->service_name,
+			&error);
+
+		dbus_error_free(&error);
+	}
+
+	free(d->device_name);
+	free(d->application_name);
+	free(d->application_device_name);
+	free(d->service_name);
+	free(d->object_path);
+
+	if (d->connection)
+		dbus_connection_unref(d->connection);
+
+	free(d);
+}
+
+int rd_set_application_device_name(rd_device *d, const char *n) {
+	char *t;
+
+	if (!d)
+		return -EINVAL;
+
+	assert(d->ref > 0);
+
+	if (!(t = strdup(n)))
+		return -ENOMEM;
+
+	free(d->application_device_name);
+	d->application_device_name = t;
+	return 0;
+}
+
+void rd_set_userdata(rd_device *d, void *userdata) {
+
+	if (!d)
+		return;
+
+	assert(d->ref > 0);
+	d->userdata = userdata;
+}
+
+void* rd_get_userdata(rd_device *d) {
+
+	if (!d)
+		return NULL;
+
+	assert(d->ref > 0);
+
+	return d->userdata;
+}
diff --git a/dbus/reserve.h b/dbus/reserve.h
new file mode 100644
index 0000000..6e16a07
--- /dev/null
+++ b/dbus/reserve.h
@@ -0,0 +1,84 @@
+#ifndef fooreservehfoo
+#define fooreservehfoo
+
+/***
+  Copyright 2009 Lennart Poettering
+
+  Permission is hereby granted, free of charge, to any person
+  obtaining a copy of this software and associated documentation files
+  (the "Software"), to deal in the Software without restriction,
+  including without limitation the rights to use, copy, modify, merge,
+  publish, distribute, sublicense, and/or sell copies of the Software,
+  and to permit persons to whom the Software is furnished to do so,
+  subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be
+  included in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+***/
+
+#include <dbus/dbus.h>
+#include <inttypes.h>
+
+# ifndef INT32_MIN
+# define INT32_MIN     (-2147483647-1)
+# endif
+# ifndef INT32_MAX
+# define INT32_MAX     (2147483647)
+# endif
+
+typedef struct rd_device rd_device;
+
+/* Prototype for a function that is called whenever someone else wants
+ * your application to release the device it has locked. A return
+ * value <= 0 denies the request, a positive return value agrees to
+ * it. Before returning your application should close the device in
+ * question completely to make sure the new application may access
+ * it. */
+typedef int (*rd_request_cb_t)(
+	rd_device *d,
+	int forced);                  /* Non-zero if an application forcibly took the lock away without asking. If this is the case then the return value of this call is ignored. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Try to lock the device. Returns 0 on success, a negative errno
+ * style return value on error. The DBus error might be set as well if
+ * the error was caused D-Bus. */
+int rd_acquire(
+	rd_device **d,                /* On success a pointer to the newly allocated rd_device object will be filled in here */
+	DBusConnection *connection,
+	const char *device_name,      /* The device to lock, e.g. "Audio0" */
+	const char *application_name, /* A human readable name of the application, e.g. "PulseAudio Sound Server" */
+	int32_t priority,             /* The priority for this application. If unsure use 0 */
+	rd_request_cb_t request_cb,   /* Will be called whenever someone requests that this device shall be released. May be NULL if priority is INT32_MAX */
+	DBusError *error);            /* If we fail due to a D-Bus related issue the error will be filled in here. May be NULL. */
+
+/* Unlock (if needed) and destroy an rd_device object again */
+void rd_release(rd_device *d);
+
+/* Set the application device name for an rd_device object. Returns 0
+ * on success, a negative errno style return value on error. */
+int rd_set_application_device_name(rd_device *d, const char *name);
+
+/* Attach a userdata pointer to an rd_device */
+void rd_set_userdata(rd_device *d, void *userdata);
+
+/* Query the userdata pointer from an rd_device. Returns NULL if no
+ * userdata was set. */
+void* rd_get_userdata(rd_device *d);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
new file mode 100644
index 0000000..26bc204
--- /dev/null
+++ b/dbus/sigsegv.c
@@ -0,0 +1,192 @@
+/**
+ * This source file is used to print out a stack-trace when your program
+ * segfaults.  It is relatively reliable and spot-on accurate.
+ *
+ * This code is in the public domain.  Use it as you see fit, some credit
+ * would be appreciated, but is not a prerequisite for usage.  Feedback
+ * on it's use would encourage further development and maintenance.
+ *
+ * Author:  Jaco Kroon <jaco at kroon.co.za>
+ *
+ * Copyright (C) 2005 - 2008 Jaco Kroon
+ */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+//#define NO_CPP_DEMANGLE
+#define SIGSEGV_NO_AUTO_INIT
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include <memory.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#include <dlfcn.h>
+#include <execinfo.h>
+#include <errno.h>
+#ifndef NO_CPP_DEMANGLE
+char * __cxa_demangle(const char * __mangled_name, char * __output_buffer, size_t * __length, int * __status);
+#endif
+
+#include "JackError.h"
+
+#if defined(REG_RIP)
+# define SIGSEGV_STACK_IA64
+# define REGFORMAT "%016lx"
+#elif defined(REG_EIP)
+# define SIGSEGV_STACK_X86
+# define REGFORMAT "%08x"
+#else
+# define SIGSEGV_STACK_GENERIC
+# define REGFORMAT "%x"
+#endif
+
+#ifdef __APPLE__
+
+// TODO : does not compile yet on OSX
+static void signal_segv(int signum, siginfo_t* info, void*ptr) 
+{}
+
+#else
+
+#include <ucontext.h>
+
+static void signal_segv(int signum, siginfo_t* info, void*ptr) {
+    static const char *si_codes[3] = {"", "SEGV_MAPERR", "SEGV_ACCERR"};
+
+    size_t i;
+    ucontext_t *ucontext = (ucontext_t*)ptr;
+
+#if defined(SIGSEGV_STACK_X86) || defined(SIGSEGV_STACK_IA64)
+    int f = 0;
+    Dl_info dlinfo;
+    void **bp = 0;
+    void *ip = 0;
+#else
+    void *bt[20];
+    char **strings;
+    size_t sz;
+#endif
+
+    if (signum == SIGSEGV)
+    {
+        jack_error("Segmentation Fault!");
+    }
+    else if (signum == SIGABRT)
+    {
+        jack_error("Abort!");
+    }
+    else if (signum == SIGILL)
+    {
+        jack_error("Illegal instruction!");
+    }
+    else if (signum == SIGFPE)
+    {
+        jack_error("Floating point exception!");
+    }
+    else
+    {
+        jack_error("Unknown bad signal catched!");
+    }
+
+    jack_error("info.si_signo = %d", signum);
+    jack_error("info.si_errno = %d", info->si_errno);
+    jack_error("info.si_code  = %d (%s)", info->si_code, si_codes[info->si_code]);
+    jack_error("info.si_addr  = %p", info->si_addr);
+    for(i = 0; i < NGREG; i++)
+        jack_error("reg[%02d]       = 0x" REGFORMAT, i, ucontext->uc_mcontext.gregs[i]);
+
+#if defined(SIGSEGV_STACK_X86) || defined(SIGSEGV_STACK_IA64)
+# if defined(SIGSEGV_STACK_IA64)
+    ip = (void*)ucontext->uc_mcontext.gregs[REG_RIP];
+    bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP];
+# elif defined(SIGSEGV_STACK_X86)
+    ip = (void*)ucontext->uc_mcontext.gregs[REG_EIP];
+    bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
+# endif
+
+    jack_error("Stack trace:");
+    while(bp && ip) {
+        if(!dladdr(ip, &dlinfo))
+            break;
+
+        const char *symname = dlinfo.dli_sname;
+#ifndef NO_CPP_DEMANGLE
+        int status;
+        char *tmp = __cxa_demangle(symname, NULL, 0, &status);
+
+        if(status == 0 && tmp)
+            symname = tmp;
+#endif
+
+        jack_error("% 2d: %p <%s+%u> (%s)",
+                ++f,
+                ip,
+                symname,
+                (unsigned)(ip - dlinfo.dli_saddr),
+                dlinfo.dli_fname);
+
+#ifndef NO_CPP_DEMANGLE
+        if(tmp)
+            free(tmp);
+#endif
+
+        if(dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main"))
+            break;
+
+        ip = bp[1];
+        bp = (void**)bp[0];
+    }
+#else
+    jack_error("Stack trace (non-dedicated):");
+    sz = backtrace(bt, 20);
+    strings = backtrace_symbols(bt, sz);
+
+    for(i = 0; i < sz; ++i)
+        jack_error("%s", strings[i]);
+#endif
+    jack_error("End of stack trace");
+    exit (-1);
+}
+
+#endif
+
+int setup_sigsegv() {
+    struct sigaction action;
+
+    memset(&action, 0, sizeof(action));
+    action.sa_sigaction = signal_segv;
+    action.sa_flags = SA_SIGINFO;
+    if(sigaction(SIGSEGV, &action, NULL) < 0) {
+        jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
+        return 0;
+    }
+
+    if(sigaction(SIGILL, &action, NULL) < 0) {
+        jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
+        return 0;
+    }
+
+    if(sigaction(SIGABRT, &action, NULL) < 0) {
+        jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
+        return 0;
+    }
+
+    if(sigaction(SIGFPE, &action, NULL) < 0) {
+        jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
+        return 0;
+    }
+
+    return 1;
+}
+
+#ifndef SIGSEGV_NO_AUTO_INIT
+static void __attribute((constructor)) init(void) {
+    setup_sigsegv();
+}
+#endif
diff --git a/dbus/sigsegv.h b/dbus/sigsegv.h
new file mode 100644
index 0000000..55b4f21
--- /dev/null
+++ b/dbus/sigsegv.h
@@ -0,0 +1,9 @@
+#ifndef __SIGSEGV_H__
+#define __SIGSEGV_H__
+
+#ifdef __cplusplus
+extern "C"
+#endif
+int setup_sigsegv();
+
+#endif
diff --git a/dbus/wscript b/dbus/wscript
new file mode 100644
index 0000000..a4066b5
--- /dev/null
+++ b/dbus/wscript
@@ -0,0 +1,82 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os.path
+import Options
+import re # subst_func
+import Logs
+
+def set_options(opt):
+    opt.add_option('--enable-pkg-config-dbus-service-dir', action='store_true', default=False, help='force D-Bus service install dir to be one returned by pkg-config')
+
+def configure(conf):
+    conf.env['BUILD_JACKDBUS'] = False
+
+    if not conf.check_cfg(package='dbus-1', atleast_version='1.0.0', args='--cflags --libs') or not conf.is_defined('HAVE_DBUS_1'):
+        print Logs.colors.RED + 'WARNING !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL
+        return
+
+    dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir')
+    if not dbus_dir:
+        print Logs.colors.RED + 'WARNING !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL
+        return
+
+    dbus_dir = dbus_dir.strip()
+    conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
+
+    if Options.options.enable_pkg_config_dbus_service_dir:
+        conf.env['DBUS_SERVICES_DIR'] = dbus_dir
+    else:
+        conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
+
+    conf.check_tool('misc')
+
+    conf.check(header_name='expat.h', define_name="HAVE_EXPAT")
+
+    if conf.is_defined('HAVE_EXPAT'):
+        conf.env['LIB_EXPAT'] = ['expat']
+    else:
+        print Logs.colors.RED + 'WARNING !! jackdbus will not be built because of expat is missing' + Logs.colors.NORMAL
+        return
+
+    conf.env['BUILD_JACKDBUS'] = True
+
+def build(bld):
+    obj = bld.new_task_gen('cc', 'program')
+    if bld.env['IS_LINUX']:
+        sysdeps_dbus_include = ['../linux', '../posix']
+    if bld.env['IS_MACOSX']:
+        sysdeps_dbus_include = ['../macosx', '../posix']
+
+    obj.includes = sysdeps_dbus_include + ['.', '../', '../common', '../common/jack']
+    obj.source = [
+        'jackdbus.c',
+        'controller.c',
+        'controller_iface_configure.c',
+        'controller_iface_control.c',
+        'controller_iface_introspectable.c',
+        'controller_iface_patchbay.c',
+        'controller_iface_transport.c',
+        'xml.c',
+        'xml_expat.c',
+        #'xml_libxml.c',
+        #'xml_nop.c',
+        'xml_write_raw.c',
+        'sigsegv.c',
+	'reserve.c',
+        ]
+    if bld.env['IS_LINUX']:
+        obj.uselib = 'PTHREAD DL RT DBUS-1 EXPAT'
+    if bld.env['IS_MACOSX']:
+        obj.uselib = 'PTHREAD DL DBUS-1 EXPAT'
+    obj.uselib_local = 'serverlib'
+    obj.target       = 'jackdbus'
+
+    # process org.jackaudio.service.in -> org.jackaudio.service
+    import misc
+    obj = bld.new_task_gen('subst')
+    obj.source = 'org.jackaudio.service.in'
+    obj.target = 'org.jackaudio.service'
+    obj.dict = {'BINDIR': bld.env['PREFIX'] + '/bin'}
+    obj.install_path = '${DBUS_SERVICES_DIR}/'
+    obj.fun = misc.subst_func
diff --git a/dbus/xml.c b/dbus/xml.c
new file mode 100644
index 0000000..b506c5d
--- /dev/null
+++ b/dbus/xml.c
@@ -0,0 +1,382 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <dbus/dbus.h>
+
+#include "controller_internal.h"
+
+void
+jack_controller_settings_set_bool_option(
+    const char *value_str,
+    int *value_ptr)
+{
+    if (strcmp(value_str, "true") == 0)
+    {
+        *value_ptr = true;
+    }
+    else if (strcmp(value_str, "false") == 0)
+    {
+        *value_ptr = false;
+    }
+    else
+    {
+        jack_error("ignoring unknown bool value \"%s\"", value_str);
+    }
+}
+
+void
+jack_controller_settings_set_sint_option(
+    const char *value_str,
+    int *value_ptr)
+{
+    *value_ptr = atoi(value_str);
+}
+
+void
+jack_controller_settings_set_uint_option(
+    const char *value_str,
+    unsigned int *value_ptr)
+{
+    *value_ptr = strtoul(value_str, NULL, 10);
+}
+
+void
+jack_controller_settings_set_char_option(
+    const char *value_str,
+    char *value_ptr)
+{
+    if (value_str[0] == 0 || value_str[1] != 0)
+    {
+        jack_error("invalid char option value \"%s\"", value_str);
+        return;
+    }
+
+    *value_ptr = *value_str;
+}
+
+void
+jack_controller_settings_set_string_option(
+    const char *value_str,
+    char *value_ptr,
+    size_t max_size)
+{
+    size_t size;
+
+    size = strlen(value_str);
+
+    if (size >= max_size)
+    {
+        jack_error("string option value \"%s\" is too long, max is %u chars (including terminating zero)", value_str, (unsigned int)max_size);
+        return;
+    }
+
+    strcpy(value_ptr, value_str);
+}
+
+void
+jack_controller_settings_set_driver_option(
+    jackctl_driver_t *driver,
+    const char *option_name,
+    const char *option_value)
+{
+    jackctl_parameter_t *parameter;
+    jackctl_param_type_t type;
+    int value_int = 0;
+    unsigned int value_uint = 0;
+    union jackctl_parameter_value value;
+
+    jack_info("setting driver option \"%s\" to value \"%s\"", option_name, option_value);
+
+    parameter = jack_controller_find_parameter(jackctl_driver_get_parameters(driver), option_name);
+    if (parameter == NULL)
+    {
+        jack_error(
+            "Unknown parameter \"%s\" of driver \"%s\"",
+            option_name,
+            jackctl_driver_get_name(driver));
+        return;
+    }
+
+    type = jackctl_parameter_get_type(parameter);
+
+    switch (type)
+    {
+    case JackParamInt:
+        jack_controller_settings_set_sint_option(option_value, &value_int);
+        value.i = value_int;
+        break;
+    case JackParamUInt:
+        jack_controller_settings_set_uint_option(option_value, &value_uint);
+        value.ui = value_uint;
+        break;
+    case JackParamChar:
+        jack_controller_settings_set_char_option(option_value, &value.c);
+        break;
+    case JackParamString:
+        jack_controller_settings_set_string_option(option_value, value.str, sizeof(value.str));
+        break;
+    case JackParamBool:
+        jack_controller_settings_set_bool_option(option_value, &value_int);
+        value.i = value_int;
+        break;
+    default:
+        jack_error("Parameter \"%s\" of driver \"%s\" is of unknown type %d",
+               jackctl_parameter_get_name(parameter),
+               jackctl_driver_get_name(driver),
+               type);
+    }
+
+    jackctl_parameter_set_value(parameter, &value);
+}
+
+void
+jack_controller_settings_set_internal_option(
+    jackctl_internal_t *internal,
+    const char *option_name,
+    const char *option_value)
+{
+    jackctl_parameter_t *parameter;
+    jackctl_param_type_t type;
+    int value_int = 0;
+    unsigned int value_uint = 0;
+    union jackctl_parameter_value value;
+
+    jack_info("setting internal option \"%s\" to value \"%s\"", option_name, option_value);
+
+    parameter = jack_controller_find_parameter(jackctl_internal_get_parameters(internal), option_name);
+    if (parameter == NULL)
+    {
+        jack_error(
+            "Unknown parameter \"%s\" of internal \"%s\"",
+            option_name,
+            jackctl_internal_get_name(internal));
+        return;
+    }
+
+    type = jackctl_parameter_get_type(parameter);
+
+    switch (type)
+    {
+    case JackParamInt:
+        jack_controller_settings_set_sint_option(option_value, &value_int);
+        value.i = value_int;
+        break;
+    case JackParamUInt:
+        jack_controller_settings_set_uint_option(option_value, &value_uint);
+        value.ui = value_uint;
+        break;
+    case JackParamChar:
+        jack_controller_settings_set_char_option(option_value, &value.c);
+        break;
+    case JackParamString:
+        jack_controller_settings_set_string_option(option_value, value.str, sizeof(value.str));
+        break;
+    case JackParamBool:
+        jack_controller_settings_set_bool_option(option_value, &value_int);
+        value.i = value_int;
+        break;
+    default:
+        jack_error("Parameter \"%s\" of internal \"%s\" is of unknown type %d",
+               jackctl_parameter_get_name(parameter),
+               jackctl_internal_get_name(internal),
+               type);
+    }
+
+    jackctl_parameter_set_value(parameter, &value);
+}
+
+void
+jack_controller_settings_set_engine_option(
+    struct jack_controller *controller_ptr,
+    const char *option_name,
+    const char *option_value)
+{
+    jackctl_parameter_t *parameter;
+    jackctl_param_type_t type;
+    int value_int = 0;
+    unsigned int value_uint = 0;
+    union jackctl_parameter_value value;
+
+    jack_info("setting engine option \"%s\" to value \"%s\"", option_name, option_value);
+
+    if (strcmp(option_name, "driver") == 0)
+    {
+        if (!jack_controller_select_driver(controller_ptr, option_value))
+        {
+            jack_error("unknown driver '%s'", option_value);
+        }
+
+        return;
+    }
+
+    parameter = jack_controller_find_parameter(jackctl_server_get_parameters(controller_ptr->server), option_name);
+    if (parameter == NULL)
+    {
+        jack_error(
+            "Unknown engine parameter \"%s\"",
+            option_name);
+        return;
+    }
+
+    type = jackctl_parameter_get_type(parameter);
+
+    switch (type)
+    {
+    case JackParamInt:
+        jack_controller_settings_set_sint_option(option_value, &value_int);
+        value.i = value_int;
+        break;
+    case JackParamUInt:
+        jack_controller_settings_set_uint_option(option_value, &value_uint);
+        value.ui = value_uint;
+        break;
+    case JackParamChar:
+        jack_controller_settings_set_char_option(option_value, &value.c);
+        break;
+    case JackParamString:
+        jack_controller_settings_set_string_option(option_value, value.str, sizeof(value.str));
+        break;
+    case JackParamBool:
+        jack_controller_settings_set_bool_option(option_value, &value_int);
+        value.i = value_int;
+        break;
+    default:
+        jack_error("Engine parameter \"%s\" is of unknown type %d",
+               jackctl_parameter_get_name(parameter),
+               type);
+    }
+
+    jackctl_parameter_set_value(parameter, &value);
+}
+
+static
+bool
+jack_controller_settings_save_options(
+    void *context,
+    const JSList * parameters_list,
+    void *dbus_call_context_ptr)
+{
+    jackctl_parameter_t *parameter;
+    jackctl_param_type_t type;
+    union jackctl_parameter_value value;
+    const char * name;
+    char value_str[50];
+
+    while (parameters_list != NULL)
+    {
+        parameter = (jackctl_parameter_t *)parameters_list->data;
+
+        if (jackctl_parameter_is_set(parameter))
+        {
+            type = jackctl_parameter_get_type(parameter);
+            value = jackctl_parameter_get_value(parameter);
+            name = jackctl_parameter_get_name(parameter);
+        
+            switch (type)
+            {
+            case JackParamInt:
+                sprintf(value_str, "%d", (int)value.i);
+                if (!jack_controller_settings_write_option(context, name, value_str, dbus_call_context_ptr))
+                {
+                    return false;
+                }
+                break;
+            case JackParamUInt:
+                sprintf(value_str, "%u", (unsigned int)value.ui);
+                if (!jack_controller_settings_write_option(context, name, value_str, dbus_call_context_ptr))
+                {
+                    return false;
+                }
+                break;
+            case JackParamChar:
+                sprintf(value_str, "%c", (char)value.c);
+                if (!jack_controller_settings_write_option(context, name, value_str, dbus_call_context_ptr))
+                {
+                    return false;
+                }
+                break;
+            case JackParamString:
+                if (!jack_controller_settings_write_option(context, name, value.str, dbus_call_context_ptr))
+                {
+                    return false;
+                }
+                break;
+            case JackParamBool:
+                if (!jack_controller_settings_write_option(context, name, value.b ? "true" : "false", dbus_call_context_ptr))
+                {
+                    return false;
+                }
+                break;
+            default:
+                jack_error("parameter of unknown type %d", type);
+            }
+        }
+
+        parameters_list = jack_slist_next(parameters_list);
+    }
+
+    return true;
+}
+
+bool
+jack_controller_settings_save_engine_options(
+    void *context,
+    struct jack_controller *controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    if (controller_ptr->driver != NULL)
+    {
+        if (!jack_controller_settings_write_option(
+                context,
+                "driver",
+                jackctl_driver_get_name(controller_ptr->driver),
+                dbus_call_context_ptr))
+        {
+            return false;
+        }
+    }
+
+    return jack_controller_settings_save_options(context, jackctl_server_get_parameters(controller_ptr->server), dbus_call_context_ptr);
+}
+
+bool
+jack_controller_settings_save_driver_options(
+    void *context,
+    jackctl_driver_t *driver,
+    void *dbus_call_context_ptr)
+{
+    return jack_controller_settings_save_options(context, jackctl_driver_get_parameters(driver), dbus_call_context_ptr);
+}
+
+bool
+jack_controller_settings_save_internal_options(
+    void *context,
+    jackctl_internal_t *internal,
+    void *dbus_call_context_ptr)
+{
+    return jack_controller_settings_save_options(context, jackctl_internal_get_parameters(internal), dbus_call_context_ptr);
+}
diff --git a/dbus/xml.h b/dbus/xml.h
new file mode 100644
index 0000000..956e794
--- /dev/null
+++ b/dbus/xml.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef XML_H__4F102BD2_3354_41C9_B842_DC00E1557A0F__INCLUDED
+#define XML_H__4F102BD2_3354_41C9_B842_DC00E1557A0F__INCLUDED
+
+bool
+jack_controller_settings_save(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr);
+
+void
+jack_controller_settings_load(
+    struct jack_controller * controller_ptr);
+
+void
+jack_controller_settings_save_auto(
+    struct jack_controller * controller_ptr);
+
+#endif /* #ifndef XML_H__4F102BD2_3354_41C9_B842_DC00E1557A0F__INCLUDED */
diff --git a/dbus/xml_expat.c b/dbus/xml_expat.c
new file mode 100644
index 0000000..1ee1bd2
--- /dev/null
+++ b/dbus/xml_expat.c
@@ -0,0 +1,369 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <expat.h>
+#include <dbus/dbus.h>
+
+#include "controller_internal.h"
+#include "jackdbus.h"
+
+bool
+jack_controller_settings_init()
+{
+    return true;
+}
+
+void
+jack_controller_settings_uninit()
+{
+}
+
+#define PARSE_CONTEXT_ROOT        0
+#define PARSE_CONTEXT_JACK        1
+#define PARSE_CONTEXT_ENGINE      1
+#define PARSE_CONTEXT_DRIVERS     2
+#define PARSE_CONTEXT_DRIVER      3
+#define PARSE_CONTEXT_OPTION      4
+#define PARSE_CONTEXT_INTERNALS   5
+#define PARSE_CONTEXT_INTERNAL    6
+
+#define MAX_STACK_DEPTH       10
+
+struct parse_context
+{
+    struct jack_controller *controller_ptr;
+    XML_Bool error;
+    unsigned int element[MAX_STACK_DEPTH];
+    signed int depth;
+    jackctl_driver_t *driver;
+    jackctl_internal_t *internal;
+    char option[JACK_PARAM_STRING_MAX+1];
+    int option_used;
+    char *name;
+};
+
+#define context_ptr ((struct parse_context *)data)
+
+void
+jack_controller_settings_callback_chrdata(void *data, const XML_Char *s, int len)
+{
+    if (context_ptr->error)
+    {
+        return;
+    }
+
+    if (context_ptr->element[context_ptr->depth] == PARSE_CONTEXT_OPTION)
+    {
+        if (context_ptr->option_used + len >= JACK_PARAM_STRING_MAX)
+        {
+            jack_error("xml parse max char data length reached");
+            context_ptr->error = XML_TRUE;
+            return;
+        }
+
+        memcpy(context_ptr->option + context_ptr->option_used, s, len);
+        context_ptr->option_used += len;
+    }
+}
+
+void
+jack_controller_settings_callback_elstart(void *data, const char *el, const char **attr)
+{
+    jackctl_driver_t *driver;
+    jackctl_internal_t *internal;
+
+    if (context_ptr->error)
+    {
+        return;
+    }
+
+    if (context_ptr->depth + 1 >= MAX_STACK_DEPTH)
+    {
+        jack_error("xml parse max stack depth reached");
+        context_ptr->error = XML_TRUE;
+        return;
+    }
+
+    if (strcmp(el, "jack") == 0)
+    {
+        //jack_info("<jack>");
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_JACK;
+        return;
+    }
+
+    if (strcmp(el, "engine") == 0)
+    {
+        //jack_info("<engine>");
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_ENGINE;
+        return;
+    }
+
+    if (strcmp(el, "drivers") == 0)
+    {
+        //jack_info("<drivers>");
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_DRIVERS;
+        return;
+    }
+    
+    if (strcmp(el, "internals") == 0)
+    {
+        //jack_info("<internals>");
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_INTERNALS;
+        return;
+    }
+
+    if (strcmp(el, "driver") == 0)
+    {
+        if ((attr[0] == NULL || attr[2] != NULL) || strcmp(attr[0], "name") != 0)
+        {
+            jack_error("<driver> XML element must contain exactly one attribute, named \"name\"");
+            context_ptr->error = XML_TRUE;
+            return;
+        }
+
+        //jack_info("<driver>");
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_DRIVER;
+
+        driver = jack_controller_find_driver(context_ptr->controller_ptr->server, attr[1]);
+        if (driver == NULL)
+        {
+            jack_error("ignoring settings for unknown driver \"%s\"", attr[1]);
+        }
+        else
+        {
+            jack_info("setting for driver \"%s\" found", attr[1]);
+        }
+
+        context_ptr->driver = driver;
+
+        return;
+    }
+    
+    if (strcmp(el, "internal") == 0)
+    {
+        if ((attr[0] == NULL || attr[2] != NULL) || strcmp(attr[0], "name") != 0)
+        {
+            jack_error("<internal> XML element must contain exactly one attribute, named \"name\"");
+            context_ptr->error = XML_TRUE;
+            return;
+        }
+
+        //jack_info("<internal>");
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_INTERNAL;
+
+        internal = jack_controller_find_internal(context_ptr->controller_ptr->server, attr[1]);
+        if (internal == NULL)
+        {
+            jack_error("ignoring settings for unknown internal \"%s\"", attr[1]);
+        }
+        else
+        {
+            jack_info("setting for internal \"%s\" found", attr[1]);
+        }
+
+        context_ptr->internal = internal;
+
+        return;
+    }
+
+
+    if (strcmp(el, "option") == 0)
+    {
+        //jack_info("<option>");
+        if ((attr[0] == NULL || attr[2] != NULL) || strcmp(attr[0], "name") != 0)
+        {
+            jack_error("<option> XML element must contain exactly one attribute, named \"name\"");
+            context_ptr->error = XML_TRUE;
+            return;
+        }
+
+        context_ptr->name = strdup(attr[1]);
+        if (context_ptr->name == NULL)
+        {
+            jack_error("strdup() failed");
+            context_ptr->error = XML_TRUE;
+            return;
+        }
+
+        context_ptr->element[++context_ptr->depth] = PARSE_CONTEXT_OPTION;
+        context_ptr->option_used = 0;
+        return;
+    }
+
+    jack_error("unknown element \"%s\"", el);
+    context_ptr->error = XML_TRUE;
+}
+
+void
+jack_controller_settings_callback_elend(void *data, const char *el)
+{
+    if (context_ptr->error)
+    {
+        return;
+    }
+
+    //jack_info("element end (depth = %d, element = %u)", context_ptr->depth, context_ptr->element[context_ptr->depth]);
+
+    if (context_ptr->element[context_ptr->depth] == PARSE_CONTEXT_OPTION)
+    {
+        context_ptr->option[context_ptr->option_used] = 0;
+
+        if (context_ptr->depth == 2 &&
+            context_ptr->element[0] == PARSE_CONTEXT_JACK &&
+            context_ptr->element[1] == PARSE_CONTEXT_ENGINE)
+        {
+            jack_controller_settings_set_engine_option(context_ptr->controller_ptr, context_ptr->name, context_ptr->option);
+        }
+
+        if (context_ptr->depth == 3 &&
+            context_ptr->element[0] == PARSE_CONTEXT_JACK &&
+            context_ptr->element[1] == PARSE_CONTEXT_DRIVERS &&
+            context_ptr->element[2] == PARSE_CONTEXT_DRIVER &&
+            context_ptr->driver != NULL)
+        {
+            jack_controller_settings_set_driver_option(context_ptr->driver, context_ptr->name, context_ptr->option);
+        }
+        
+        if (context_ptr->depth == 3 &&
+            context_ptr->element[0] == PARSE_CONTEXT_JACK &&
+            context_ptr->element[1] == PARSE_CONTEXT_INTERNALS &&
+            context_ptr->element[2] == PARSE_CONTEXT_INTERNAL &&
+            context_ptr->internal != NULL)
+        {
+            jack_controller_settings_set_internal_option(context_ptr->internal, context_ptr->name, context_ptr->option);
+        }
+    }
+
+    context_ptr->depth--;
+
+    if (context_ptr->name != NULL)
+    {
+        free(context_ptr->name);
+        context_ptr->name = NULL;
+    }
+}
+
+#undef context_ptr
+
+void
+jack_controller_settings_load(
+    struct jack_controller * controller_ptr)
+{
+    XML_Parser parser;
+    int bytes_read;
+    void *buffer;
+    char *filename;
+    size_t conf_len;
+    struct stat st;
+    int fd;
+    enum XML_Status xmls;
+    struct parse_context context;
+
+    conf_len = strlen(JACKDBUS_CONF);
+
+    filename = malloc(g_jackdbus_config_dir_len + conf_len + 1);
+    if (filename == NULL)
+    {
+        jack_error("Out of memory.");
+        goto exit;
+    }
+
+    memcpy(filename, g_jackdbus_config_dir, g_jackdbus_config_dir_len);
+    memcpy(filename + g_jackdbus_config_dir_len, JACKDBUS_CONF, conf_len);
+    filename[g_jackdbus_config_dir_len + conf_len] = 0;
+
+    jack_info("Loading settings from \"%s\" using %s ...", filename, XML_ExpatVersion());
+
+    if (stat(filename, &st) != 0)
+    {
+        jack_error("failed to stat \"%s\", error is %d (%s)", filename, errno, strerror(errno));
+    }
+
+    fd = open(filename, O_RDONLY);
+    if (fd == -1)
+    {
+        jack_error("open() failed to open conf filename.");
+        goto exit_free_filename;
+    }
+
+    parser = XML_ParserCreate(NULL);
+    if (parser == NULL)
+    {
+        jack_error("XML_ParserCreate() failed to create parser object.");
+        goto exit_close_file;
+    }
+
+    //jack_info("conf file size is %llu bytes", (unsigned long long)st.st_size);
+
+    /* we are expecting that conf file has small enough size to fit in memory */
+
+    buffer = XML_GetBuffer(parser, st.st_size);
+    if (buffer == NULL)
+    {
+        jack_error("XML_GetBuffer() failed.");
+        goto exit_free_parser;
+    }
+
+    bytes_read = read(fd, buffer, st.st_size);
+    if (bytes_read != st.st_size)
+    {
+        jack_error("read() returned unexpected result.");
+        goto exit_free_parser;
+    }
+
+    context.controller_ptr = controller_ptr;
+    context.error = XML_FALSE;
+    context.depth = -1;
+    context.name = NULL;
+
+    XML_SetElementHandler(parser, jack_controller_settings_callback_elstart, jack_controller_settings_callback_elend);
+    XML_SetCharacterDataHandler(parser, jack_controller_settings_callback_chrdata);
+    XML_SetUserData(parser, &context);
+
+    xmls = XML_ParseBuffer(parser, bytes_read, XML_TRUE);
+    if (xmls == XML_STATUS_ERROR)
+    {
+        jack_error("XML_ParseBuffer() failed.");
+        goto exit_free_parser;
+    }
+
+exit_free_parser:
+    XML_ParserFree(parser);
+
+exit_close_file:
+    close(fd);
+
+exit_free_filename:
+    free(filename);
+
+exit:
+    return;
+}
diff --git a/dbus/xml_libxml.c b/dbus/xml_libxml.c
new file mode 100644
index 0000000..8644182
--- /dev/null
+++ b/dbus/xml_libxml.c
@@ -0,0 +1,797 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdbool.h>
+#include <string.h>
+#include <dbus/dbus.h>
+
+#include <libxml/xmlwriter.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+
+#include <jack/driver.h>
+#include <jack/engine.h>
+#include "controller_internal.h"
+#include "dbus.h"
+
+/* XPath expression used for engine options selection */
+#define XPATH_ENGINE_OPTIONS_EXPRESSION "/jack/engine/option"
+
+/* XPath expression used for drivers selection */
+#define XPATH_DRIVERS_EXPRESSION "/jack/drivers/driver"
+
+/* XPath expression used for driver options selection */
+#define XPATH_DRIVER_OPTIONS_EXPRESSION "/jack/drivers/driver[@name = '%s']/option"
+
+bool
+jack_controller_settings_init()
+{
+    /*
+     * this initialize the library and check potential ABI mismatches
+     * between the version it was compiled for and the actual shared
+     * library used.
+     */
+    LIBXML_TEST_VERSION;
+
+    return true;
+}
+
+void
+jack_controller_settings_uninit()
+{
+}
+
+#define writer ((xmlTextWriterPtr)context)
+
+bool
+jack_controller_settings_write_option(
+    void *context,
+    const char *name,
+    const char *content,
+    void *dbus_call_context_ptr)
+{
+    if (xmlTextWriterStartElement(writer, BAD_CAST "option") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        return false;
+    }
+
+    if (xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST name) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteAttribute() failed.");
+        return false;
+    }
+
+    if (xmlTextWriterWriteString(writer, BAD_CAST content) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteString() failed.");
+        return false;
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndElement() failed.");
+        return false;
+    }
+
+    return true;
+}
+
+#undef writer
+
+bool
+jack_controller_settings_write_engine(
+    struct jack_controller * controller_ptr,
+    xmlTextWriterPtr writer,
+    void *dbus_call_context_ptr)
+{
+/*  jack_info("engine settings begin"); */
+
+/*  if (xmlTextWriterWriteComment(writer, BAD_CAST "engine parameters") == -1) */
+/*  { */
+/*      jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteComment() failed."); */
+/*      return false; */
+/*  } */
+
+    if (xmlTextWriterStartElement(writer, BAD_CAST "engine") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        return false;
+    }
+
+    if (!jack_controller_settings_save_engine_options(writer, controller_ptr, dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndElement() failed.");
+        return false;
+    }
+
+/*  jack_info("engine settings end"); */
+    return true;
+}
+
+bool
+jack_controller_settings_write_driver(
+    struct jack_controller * controller_ptr,
+    xmlTextWriterPtr writer,
+    jackctl_driver driver,
+    void *dbus_call_context_ptr)
+{
+/*  if (xmlTextWriterWriteComment(writer, BAD_CAST "driver parameters") == -1) */
+/*  { */
+/*      jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteComment() failed."); */
+/*      return false; */
+/*  } */
+
+    if (xmlTextWriterStartElement(writer, BAD_CAST "driver") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        return false;
+    }
+
+    if (xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST jackctl_driver_get_name(driver)) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteAttribute() failed.");
+        return false;
+    }
+
+    if (!jack_controller_settings_save_driver_options(writer, driver, dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndElement() failed.");
+        return false;
+    }
+
+    return true;
+}
+
+bool
+jack_controller_settings_write_drivers(
+    struct jack_controller * controller_ptr,
+    xmlTextWriterPtr writer,
+    void *dbus_call_context_ptr)
+{
+    const JSList * node_ptr;
+    jackctl_driver driver;
+
+    if (xmlTextWriterStartElement(writer, BAD_CAST "drivers") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        return false;
+    }
+
+    node_ptr = jackctl_server_get_drivers_list(controller_ptr->server);
+
+    while (node_ptr != NULL)
+    {
+        driver = (jackctl_driver)node_ptr->data;
+
+        if (!jack_controller_settings_write_driver(
+                controller_ptr,
+                writer,
+                driver,
+                dbus_call_context_ptr))
+        {
+            return false;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndElement() failed.");
+        return false;
+    }
+
+    return true;
+}
+
+bool
+jack_controller_settings_write_internal(
+    struct jack_controller * controller_ptr,
+    xmlTextWriterPtr writer,
+    jackctl_internal internal,
+    void *dbus_call_context_ptr)
+{
+/*  if (xmlTextWriterWriteComment(writer, BAD_CAST "driver parameters") == -1) */
+/*  { */
+/*      jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteComment() failed."); */
+/*      return false; */
+/*  } */
+
+    if (xmlTextWriterStartElement(writer, BAD_CAST "internal") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        return false;
+    }
+
+    if (xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST jackctl_internal_get_name(driver)) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteAttribute() failed.");
+        return false;
+    }
+
+    if (!jack_controller_settings_save_internal_options(writer, internal, dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndElement() failed.");
+        return false;
+    }
+
+    return true;
+}
+
+bool
+jack_controller_settings_write_internals(
+    struct jack_controller * controller_ptr,
+    xmlTextWriterPtr writer,
+    void *dbus_call_context_ptr)
+{
+    const JSList * node_ptr;
+    jackctl_driver internal;
+
+    if (xmlTextWriterStartElement(writer, BAD_CAST "internals") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        return false;
+    }
+
+    node_ptr = jackctl_server_get_internals_list(controller_ptr->server);
+
+    while (node_ptr != NULL)
+    {
+        internal = (jackctl_internal)node_ptr->data;
+
+        if (!jack_controller_settings_write_internal(
+                controller_ptr,
+                writer,
+                internal,
+                dbus_call_context_ptr))
+        {
+            return false;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndElement() failed.");
+        return false;
+    }
+
+    return true;
+}
+
+bool
+jack_controller_settings_save(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    xmlTextWriterPtr writer;
+    char *filename;
+    size_t conf_len;
+    bool ret;
+    time_t timestamp;
+    char timestamp_str[28];
+
+    time(&timestamp);
+    timestamp_str[0] = ' ';
+    ctime_r(&timestamp, timestamp_str + 1);
+    timestamp_str[25] = ' ';
+
+    ret = false;
+
+    conf_len = strlen(JACKDBUS_CONF);
+
+    filename = malloc(g_jackdbus_dir_len + conf_len + 1);
+    if (filename == NULL)
+    {
+        jack_error("Out of memory.");
+        goto fail;
+    }
+
+    memcpy(filename, g_jackdbus_dir, g_jackdbus_dir_len);
+    memcpy(filename + g_jackdbus_dir_len, JACKDBUS_CONF, conf_len);
+    filename[g_jackdbus_dir_len + conf_len] = 0;
+
+    jack_info("saving settings to \"%s\"", filename);
+
+    writer = xmlNewTextWriterFilename(filename, 0);
+    if (writer == NULL)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "Error creating the xml writer.");
+        goto fail_free_filename;
+    }
+
+    if (xmlTextWriterSetIndent(writer, 1) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterSetIndent() failed.");
+        goto fail_free_writter;
+    }
+
+    if (xmlTextWriterStartDocument(writer, NULL, NULL, NULL) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartDocument() failed.");
+        goto fail_free_writter;
+    }
+
+    if (xmlTextWriterWriteComment(writer, BAD_CAST "\n" JACK_CONF_HEADER_TEXT) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteComment() failed.");
+        goto fail_free_writter;
+    }
+
+    if (xmlTextWriterWriteComment(writer, BAD_CAST timestamp_str) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterWriteComment() failed.");
+        goto fail_free_writter;
+    }
+
+    if (xmlTextWriterStartElement(writer, BAD_CAST "jack") == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        goto fail_free_writter;
+    }
+
+    if (!jack_controller_settings_write_engine(controller_ptr, writer, dbus_call_context_ptr))
+    {
+        goto fail_free_writter;
+    }
+
+    if (!jack_controller_settings_write_drivers(controller_ptr, writer, dbus_call_context_ptr))
+    {
+        goto fail_free_writter;
+    }
+    
+    if (!jack_controller_settings_write_internals(controller_ptr, writer, dbus_call_context_ptr))
+    {
+        goto fail_free_writter;
+    }
+
+    if (xmlTextWriterEndElement(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterStartElement() failed.");
+        goto fail_free_writter;
+    }
+
+    if (xmlTextWriterEndDocument(writer) == -1)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "xmlTextWriterEndDocument() failed.");
+        goto fail_free_writter;
+    }
+
+    ret = true;
+
+fail_free_writter:
+    xmlFreeTextWriter(writer);
+
+fail_free_filename:
+    free(filename);
+
+fail:
+    return ret;
+}
+
+void
+jack_controller_settings_read_engine(
+    struct jack_controller * controller_ptr,
+    xmlXPathContextPtr xpath_ctx_ptr)
+{
+    xmlXPathObjectPtr xpath_obj_ptr;
+    xmlBufferPtr content_buffer_ptr;
+    int i;
+    const char *option_name;
+    const char *option_value;
+
+    /* Evaluate xpath expression */
+    xpath_obj_ptr = xmlXPathEvalExpression((const xmlChar *)XPATH_ENGINE_OPTIONS_EXPRESSION, xpath_ctx_ptr);
+    if (xpath_obj_ptr == NULL)
+    {
+        jack_error("Unable to evaluate XPath expression \"%s\"", XPATH_ENGINE_OPTIONS_EXPRESSION);
+        goto exit;
+    }
+
+    if (xpath_obj_ptr->nodesetval == NULL || xpath_obj_ptr->nodesetval->nodeNr == 0)
+    {
+        jack_error("XPath \"%s\" evaluation returned no data", XPATH_ENGINE_OPTIONS_EXPRESSION);
+        goto free_xpath_obj;
+    }
+
+    content_buffer_ptr = xmlBufferCreate();
+    if (content_buffer_ptr == NULL)
+    {
+        jack_error("xmlBufferCreate() failed.");
+        goto free_xpath_obj;
+    }
+
+    for (i = 0 ; i < xpath_obj_ptr->nodesetval->nodeNr ; i++)
+    {
+        //jack_info("engine option \"%s\" at index %d", xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name"), i);
+
+        if (xmlNodeBufGetContent(content_buffer_ptr, xpath_obj_ptr->nodesetval->nodeTab[i]) == -1)
+        {
+            jack_error("xmlNodeBufGetContent() failed.");
+            goto next_option;
+        }
+
+        option_name = (const char *)xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name");
+        option_value = (const char *)xmlBufferContent(content_buffer_ptr);
+
+        jack_controller_settings_set_engine_option(controller_ptr, option_name, option_value);
+
+    next_option:
+        xmlBufferEmpty(content_buffer_ptr);
+    }
+
+//free_buffer:
+    xmlBufferFree(content_buffer_ptr);
+
+free_xpath_obj:
+    xmlXPathFreeObject(xpath_obj_ptr);
+
+exit:
+    return;
+}
+
+void
+jack_controller_settings_read_driver(
+    struct jack_controller * controller_ptr,
+    xmlXPathContextPtr xpath_ctx_ptr,
+    jackctl_driver driver)
+{
+    char *xpath;
+    size_t xpath_len;
+    xmlXPathObjectPtr xpath_obj_ptr;
+    xmlBufferPtr content_buffer_ptr;
+    int i;
+    const char *option_name;
+    const char *option_value;
+    const char *driver_name;
+
+    driver_name = jackctl_driver_get_name(driver);
+
+    jack_info("reading options for driver \"%s\"", driver_name);
+
+    xpath_len = snprintf(NULL, 0, XPATH_DRIVER_OPTIONS_EXPRESSION, driver_name);
+
+    xpath = malloc(xpath_len);
+    if (xpath == NULL)
+    {
+        jack_error("Out of memory.");
+        goto exit;
+    }
+
+    snprintf(xpath, xpath_len, XPATH_DRIVER_OPTIONS_EXPRESSION, driver_name);
+
+    //jack_info("xpath = \"%s\"", xpath);
+
+    /* Evaluate xpath expression */
+    xpath_obj_ptr = xmlXPathEvalExpression((const xmlChar *)xpath, xpath_ctx_ptr);
+    if (xpath_obj_ptr == NULL)
+    {
+        jack_error("Unable to evaluate XPath expression \"%s\"", xpath);
+        goto free_xpath;
+    }
+
+    if (xpath_obj_ptr->nodesetval == NULL || xpath_obj_ptr->nodesetval->nodeNr == 0)
+    {
+        //jack_info("XPath \"%s\" evaluation returned no data", xpath);
+        goto free_xpath_obj;
+    }
+
+    content_buffer_ptr = xmlBufferCreate();
+    if (content_buffer_ptr == NULL)
+    {
+        jack_error("xmlBufferCreate() failed.");
+        goto free_xpath_obj;
+    }
+
+    for (i = 0 ; i < xpath_obj_ptr->nodesetval->nodeNr ; i++)
+    {
+        //jack_info("driver option \"%s\" at index %d", xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name"), i);
+
+        if (xmlNodeBufGetContent(content_buffer_ptr, xpath_obj_ptr->nodesetval->nodeTab[i]) == -1)
+        {
+            jack_error("xmlNodeBufGetContent() failed.");
+            goto next_option;
+        }
+
+        option_name = (const char *)xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name");
+        option_value = (const char *)xmlBufferContent(content_buffer_ptr);
+
+        jack_controller_settings_set_driver_option(driver, option_name, option_value);
+
+    next_option:
+        xmlBufferEmpty(content_buffer_ptr);
+    }
+
+//free_buffer:
+    xmlBufferFree(content_buffer_ptr);
+
+free_xpath_obj:
+    xmlXPathFreeObject(xpath_obj_ptr);
+
+free_xpath:
+    free(xpath);
+
+exit:
+    return;
+}
+
+void
+jack_controller_settings_read_internal(
+    struct jack_controller * controller_ptr,
+    xmlXPathContextPtr xpath_ctx_ptr,
+    jackctl_internal internal)
+{
+    char *xpath;
+    size_t xpath_len;
+    xmlXPathObjectPtr xpath_obj_ptr;
+    xmlBufferPtr content_buffer_ptr;
+    int i;
+    const char *option_name;
+    const char *option_value;
+    const char *internal_name;
+
+    internal_name = jackctl_internal_get_name(internal);
+
+    jack_info("reading options for internal \"%s\"", internal_name);
+
+    xpath_len = snprintf(NULL, 0, XPATH_DRIVER_OPTIONS_EXPRESSION, internal_name);
+
+    xpath = malloc(xpath_len);
+    if (xpath == NULL)
+    {
+        jack_error("Out of memory.");
+        goto exit;
+    }
+
+    snprintf(xpath, xpath_len, XPATH_DRIVER_OPTIONS_EXPRESSION, internal_name);
+
+    //jack_info("xpath = \"%s\"", xpath);
+
+    /* Evaluate xpath expression */
+    xpath_obj_ptr = xmlXPathEvalExpression((const xmlChar *)xpath, xpath_ctx_ptr);
+    if (xpath_obj_ptr == NULL)
+    {
+        jack_error("Unable to evaluate XPath expression \"%s\"", xpath);
+        goto free_xpath;
+    }
+
+    if (xpath_obj_ptr->nodesetval == NULL || xpath_obj_ptr->nodesetval->nodeNr == 0)
+    {
+        //jack_info("XPath \"%s\" evaluation returned no data", xpath);
+        goto free_xpath_obj;
+    }
+
+    content_buffer_ptr = xmlBufferCreate();
+    if (content_buffer_ptr == NULL)
+    {
+        jack_error("xmlBufferCreate() failed.");
+        goto free_xpath_obj;
+    }
+
+    for (i = 0 ; i < xpath_obj_ptr->nodesetval->nodeNr ; i++)
+    {
+        //jack_info("driver option \"%s\" at index %d", xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name"), i);
+
+        if (xmlNodeBufGetContent(content_buffer_ptr, xpath_obj_ptr->nodesetval->nodeTab[i]) == -1)
+        {
+            jack_error("xmlNodeBufGetContent() failed.");
+            goto next_option;
+        }
+
+        option_name = (const char *)xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name");
+        option_value = (const char *)xmlBufferContent(content_buffer_ptr);
+
+        jack_controller_settings_set_internal_option(internal, option_name, option_value);
+
+    next_option:
+        xmlBufferEmpty(content_buffer_ptr);
+    }
+
+//free_buffer:
+    xmlBufferFree(content_buffer_ptr);
+
+free_xpath_obj:
+    xmlXPathFreeObject(xpath_obj_ptr);
+
+free_xpath:
+    free(xpath);
+
+exit:
+    return;
+}
+
+void
+jack_controller_settings_read_drivers(
+    struct jack_controller * controller_ptr,
+    xmlXPathContextPtr xpath_ctx_ptr)
+{
+    xmlXPathObjectPtr xpath_obj_ptr;
+    int i;
+    const char *driver_name;
+    jackctl_driver driver;
+
+    /* Evaluate xpath expression */
+    xpath_obj_ptr = xmlXPathEvalExpression((const xmlChar *)XPATH_DRIVERS_EXPRESSION, xpath_ctx_ptr);
+    if (xpath_obj_ptr == NULL)
+    {
+        jack_error("Unable to evaluate XPath expression \"%s\"", XPATH_DRIVERS_EXPRESSION);
+        goto exit;
+    }
+
+    if (xpath_obj_ptr->nodesetval == NULL || xpath_obj_ptr->nodesetval->nodeNr == 0)
+    {
+        jack_error("XPath \"%s\" evaluation returned no data", XPATH_DRIVERS_EXPRESSION);
+        goto free_xpath_obj;
+    }
+
+    for (i = 0 ; i < xpath_obj_ptr->nodesetval->nodeNr ; i++)
+    {
+        driver_name = (const char *)xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name");
+
+        driver = jack_controller_find_driver(controller_ptr->server, driver_name);
+        if (driver == NULL)
+        {
+            jack_error("ignoring settings for unknown driver \"%s\"", driver_name);
+        }
+        else
+        {
+            jack_info("setting for driver \"%s\" found", driver_name);
+
+            jack_controller_settings_read_driver(controller_ptr, xpath_ctx_ptr, driver);
+        }
+    }
+
+free_xpath_obj:
+    xmlXPathFreeObject(xpath_obj_ptr);
+
+exit:
+    return;
+}
+
+void
+jack_controller_settings_read_internals(
+    struct jack_controller * controller_ptr,
+    xmlXPathContextPtr xpath_ctx_ptr)
+{
+    xmlXPathObjectPtr xpath_obj_ptr;
+    int i;
+    const char *internal_name;
+    jackctl_internal internal;
+
+    /* Evaluate xpath expression */
+    xpath_obj_ptr = xmlXPathEvalExpression((const xmlChar *)XPATH_DRIVERS_EXPRESSION, xpath_ctx_ptr);
+    if (xpath_obj_ptr == NULL)
+    {
+        jack_error("Unable to evaluate XPath expression \"%s\"", XPATH_DRIVERS_EXPRESSION);
+        goto exit;
+    }
+
+    if (xpath_obj_ptr->nodesetval == NULL || xpath_obj_ptr->nodesetval->nodeNr == 0)
+    {
+        jack_error("XPath \"%s\" evaluation returned no data", XPATH_DRIVERS_EXPRESSION);
+        goto free_xpath_obj;
+    }
+
+    for (i = 0 ; i < xpath_obj_ptr->nodesetval->nodeNr ; i++)
+    {
+        internal_name = (const char *)xmlGetProp(xpath_obj_ptr->nodesetval->nodeTab[i], BAD_CAST "name");
+
+        driver = jack_controller_find_internal(controller_ptr->server, driver_name);
+        if (driver == NULL)
+        {
+            jack_error("ignoring settings for unknown internal \"%s\"", internal_name);
+        }
+        else
+        {
+            jack_info("setting for internal \"%s\" found", internal_name);
+
+            jack_controller_settings_read_internal(controller_ptr, xpath_ctx_ptr, driver);
+        }
+    }
+
+free_xpath_obj:
+    xmlXPathFreeObject(xpath_obj_ptr);
+
+exit:
+    return;
+}
+
+
+void
+jack_controller_settings_load(
+    struct jack_controller * controller_ptr)
+{
+    char *filename;
+    size_t conf_len;
+    xmlDocPtr doc_ptr;
+    xmlXPathContextPtr xpath_ctx_ptr;
+
+    conf_len = strlen(JACKDBUS_CONF);
+
+    filename = malloc(g_jackdbus_dir_len + conf_len + 1);
+    if (filename == NULL)
+    {
+        jack_error("Out of memory.");
+        goto exit;
+    }
+
+    memcpy(filename, g_jackdbus_dir, g_jackdbus_dir_len);
+    memcpy(filename + g_jackdbus_dir_len, JACKDBUS_CONF, conf_len);
+    filename[g_jackdbus_dir_len + conf_len] = 0;
+
+    jack_info("loading settings from \"%s\"", filename);
+
+    doc_ptr = xmlParseFile(filename);
+    if (doc_ptr == NULL)
+    {
+        jack_error("Failed to parse \"%s\"", filename);
+        goto free_filename;
+    }
+
+    /* Create xpath evaluation context */
+    xpath_ctx_ptr = xmlXPathNewContext(doc_ptr);
+    if (xpath_ctx_ptr == NULL)
+    {
+        jack_error("Unable to create new XPath context");
+        goto free_doc;
+    }
+
+    jack_controller_settings_read_engine(controller_ptr, xpath_ctx_ptr);
+    jack_controller_settings_read_drivers(controller_ptr, xpath_ctx_ptr);
+    jack_controller_settings_read_internals(controller_ptr, xpath_ctx_ptr);
+
+    xmlXPathFreeContext(xpath_ctx_ptr);
+
+free_doc:
+    xmlFreeDoc(doc_ptr);
+
+free_filename:
+    free(filename);
+
+exit:
+    return;
+}
+
+void
+jack_controller_settings_save_auto(
+    struct jack_controller * controller_ptr)
+{
+    jack_controller_settings_save(controller_ptr, NULL);
+}
diff --git a/dbus/xml_nop.c b/dbus/xml_nop.c
new file mode 100644
index 0000000..e234076
--- /dev/null
+++ b/dbus/xml_nop.c
@@ -0,0 +1,62 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdbool.h>
+#include <dbus/dbus.h>
+
+#include <jack/driver.h>
+#include <jack/engine.h>
+#include "dbus.h"
+#include "controller_internal.h"
+
+bool
+jack_controller_settings_init()
+{
+    return true;
+}
+
+void
+jack_controller_settings_uninit()
+{
+}
+
+bool
+jack_controller_settings_save(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "jackdbus compiled without settings persistence");
+    return true;
+}
+
+void
+jack_controller_settings_load(
+    struct jack_controller * controller_ptr)
+{
+}
+
+void
+jack_controller_settings_save_auto(
+    struct jack_controller * controller_ptr)
+{
+}
diff --git a/dbus/xml_write_raw.c b/dbus/xml_write_raw.c
new file mode 100644
index 0000000..8542c31
--- /dev/null
+++ b/dbus/xml_write_raw.c
@@ -0,0 +1,327 @@
+/* -*- Mode: C ; c-basic-offset: 4 -*- */
+/*
+    Copyright (C) 2007,2008 Nedko Arnaudov
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <dbus/dbus.h>
+#include <time.h>
+
+#include "controller_internal.h"
+#include "jackdbus.h"
+
+bool
+jack_controller_settings_write_string(int fd, const char * string, void *dbus_call_context_ptr)
+{
+    size_t len;
+
+    len = strlen(string);
+
+    if (write(fd, string, len) != len)
+    {
+        jack_dbus_error(dbus_call_context_ptr, JACK_DBUS_ERROR_GENERIC, "write() failed to write config file.");
+        return false;
+    }
+
+    return true;
+}
+
+struct save_context
+{
+    int fd;
+    const char *indent;
+};
+
+#define save_context_ptr ((struct save_context *)context)
+#define fd (save_context_ptr->fd)
+
+bool
+jack_controller_settings_write_option(
+    void *context,
+    const char *name,
+    const char *content,
+    void *dbus_call_context_ptr)
+{
+    if (!jack_controller_settings_write_string(fd, save_context_ptr->indent, dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "<option name=\"", dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (!jack_controller_settings_write_string(fd, name, dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "\">", dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (!jack_controller_settings_write_string(fd, content, dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "</option>\n", dbus_call_context_ptr))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+#undef fd
+
+bool
+jack_controller_settings_save(
+    struct jack_controller * controller_ptr,
+    void *dbus_call_context_ptr)
+{
+    char *filename;
+    size_t conf_len;
+    int fd;
+    bool ret;
+    time_t timestamp;
+    char timestamp_str[26];
+    struct save_context context;
+    const JSList * node_ptr;
+    jackctl_driver_t *driver;
+    jackctl_internal_t *internal;
+
+    time(&timestamp);
+    ctime_r(&timestamp, timestamp_str);
+    timestamp_str[24] = 0;
+
+    ret = false;
+
+    conf_len = strlen(JACKDBUS_CONF);
+
+    filename = malloc(g_jackdbus_config_dir_len + conf_len + 1);
+    if (filename == NULL)
+    {
+        jack_error("Out of memory.");
+        goto exit;
+    }
+
+    memcpy(filename, g_jackdbus_config_dir, g_jackdbus_config_dir_len);
+    memcpy(filename + g_jackdbus_config_dir_len, JACKDBUS_CONF, conf_len);
+    filename[g_jackdbus_config_dir_len + conf_len] = 0;
+
+    jack_info("Saving settings to \"%s\" ...", filename);
+
+    fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+    if (fd == -1)
+    {
+        jack_error("open() failed to open conf filename. error is %d (%s)", errno, strerror(errno));
+        goto exit_free_filename;
+    }
+
+    context.fd = fd;
+
+    if (!jack_controller_settings_write_string(fd, "<?xml version=\"1.0\"?>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "<!--\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, JACK_CONF_HEADER_TEXT, dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "-->\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "<!-- ", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, timestamp_str, dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, " -->\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "<jack>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+    
+    /* engine */
+
+    if (!jack_controller_settings_write_string(fd, " <engine>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    context.indent = "  ";
+    if (!jack_controller_settings_save_engine_options(&context, controller_ptr, dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, " </engine>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    /* drivers */
+    
+    if (!jack_controller_settings_write_string(fd, " <drivers>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    node_ptr = jackctl_server_get_drivers_list(controller_ptr->server);
+
+    while (node_ptr != NULL)
+    {
+        driver = (jackctl_driver_t *)node_ptr->data;
+
+        if (!jack_controller_settings_write_string(fd, "  <driver name=\"", dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        if (!jack_controller_settings_write_string(fd, jackctl_driver_get_name(driver), dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        if (!jack_controller_settings_write_string(fd, "\">\n", dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        context.indent = "   ";
+
+        if (!jack_controller_settings_save_driver_options(&context, driver, dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        if (!jack_controller_settings_write_string(fd, "  </driver>\n", dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    if (!jack_controller_settings_write_string(fd, " </drivers>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+    
+    /* internals */
+    
+    if (!jack_controller_settings_write_string(fd, " <internals>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    node_ptr = jackctl_server_get_internals_list(controller_ptr->server);
+
+    while (node_ptr != NULL)
+    {
+        internal = (jackctl_internal_t *)node_ptr->data;
+
+        if (!jack_controller_settings_write_string(fd, "  <internal name=\"", dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        if (!jack_controller_settings_write_string(fd, jackctl_internal_get_name(internal), dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        if (!jack_controller_settings_write_string(fd, "\">\n", dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        context.indent = "   ";
+
+        if (!jack_controller_settings_save_internal_options(&context, internal, dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        if (!jack_controller_settings_write_string(fd, "  </internal>\n", dbus_call_context_ptr))
+        {
+            goto exit_close;
+        }
+
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    if (!jack_controller_settings_write_string(fd, " </internals>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    if (!jack_controller_settings_write_string(fd, "</jack>\n", dbus_call_context_ptr))
+    {
+        goto exit_close;
+    }
+
+    ret = true;
+
+exit_close:
+    close(fd);
+
+exit_free_filename:
+    free(filename);
+
+exit:
+    return ret;
+}
+
+void
+jack_controller_settings_save_auto(
+    struct jack_controller * controller_ptr)
+{
+    jack_controller_settings_save(controller_ptr, NULL);
+}
diff --git a/doc/.cvsignore b/doc/.cvsignore
deleted file mode 100644
index 45d9e5b..0000000
--- a/doc/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-Makefile.in
-doxygen-build.stamp
-reference.doxygen
-reference
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index 95429ff..0000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1,73 +0,0 @@
-## Process this file with automake to produce Makefile.in
-MAINTAINERCLEANFILES=Makefile.in 
-
-CLEANFILES=doxygen-build.stamp
-
-DOX=reference.doxygen
-DOXSOURCES=mainpage.dox transport.dox porting.dox fsm.png fsm.eps \
-	../example-clients/inprocess.c \
-	../example-clients/simple_client.c \
-	../jack/intclient.h \
-	../jack/jack.h \
-	../jack/port.h \
-	../jack/ringbuffer.h \
-	../jack/thread.h \
-	../jack/transport.h \
-	../jack/types.h \
-	../jack/midiport.h
-
-EXTRA_DIST=mainpage.dox transport.dox fsm.png fsm.eps porting.dox
-
-INSTIMAGES=reference/html/doxygen.png reference/html/fsm.png
-
-DOC_STAMPS=html-build.stamp
-
-DOC_DIR=$(HTML_DIR)
-
-all-local: doxygen-build.stamp
-
-doxygen-build.stamp: $(DOX) $(DOXSOURCES)
-	@echo '*** Running doxygen ***'
-	doxygen $(DOX)
-	touch doxygen-build.stamp
-
-clean-local:
-	rm -f *~ *.bak $(DOC_STAMPS) || true
-	if test -d html; then rm -fr html; fi
-	if test -d latex; then rm -fr latex; fi
-
-distclean-local: clean
-	rm -f *.stamp || true
-	if test -d reference; then rm -rf reference; fi
-
-install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(DOC_DIR)/reference/html
-	(installfiles=`echo reference/html/*.html`; \
-	if test "$$installfiles" = 'reference/html/*.html'; \
-	then echo '-- Nothing to install' ; \
-	else \
-	  for i in $$installfiles $(INSTIMAGES) reference/html/doxygen.css; do \
-	    echo '-- Installing '$$i ; \
-	    $(INSTALL_DATA) $$i $(DESTDIR)$(DOC_DIR)/reference/html; \
-	  done; \
-	fi)
-
-# we need doxygen stuff built so we can know what to uninstall
-uninstall-local: doxygen-build.stamp
-	(installfiles=`echo reference/html/*.html`; \
-	if test "$$installfiles" = 'reference/html/*.html'; \
-	then echo '-- Nothing to uninstall' ; \
-	else \
-	  for i in $$installfiles $(INSTIMAGES) reference/html/doxygen.css; do \
-	    echo '-- Unstalling '$$i ; \
-	    rm $(DESTDIR)$(DOC_DIR)/$$i; \
-	  done; \
-	fi)
-
-dist-hook: dist-hook-local
-	mkdir $(distdir)/reference
-	mkdir $(distdir)/reference/html
-	-cp reference/html/*.html reference/html/*.css \
-	    reference/html/*.png  $(distdir)/reference/html
-
-.PHONY : dist-hook-local
diff --git a/doc/fsm.eps b/doc/fsm.eps
deleted file mode 100644
index ff8bd78..0000000
--- a/doc/fsm.eps
+++ /dev/null
@@ -1,1187 +0,0 @@
-%!PS-Adobe-3.0 EPSF-3.0
-%%Creator: GIMP PostScript file plugin V 1.12 by Peter Kirchgessner
-%%Title: /home/taybin/projects/jack/doc/fsm.eps
-%%CreationDate: Thu Aug 28 21:23:22 2003
-%%DocumentData: Clean7Bit
-%%LanguageLevel: 2
-%%Pages: 1
-%%BoundingBox: 14 14 485 336
-%%EndComments
-%%BeginProlog
-% Use own dictionary to avoid conflicts
-10 dict begin
-%%EndProlog
-%%Page: 1 1
-% Translate for offset
-14.173228 14.173228 translate
-% Translate to begin of first scanline
-0.000000 321.000000 translate
-470.000000 -321.000000 scale
-% Image geometry
-470 321 8
-% Transformation matrix
-[ 470 0 0 321 0 0 ]
-% Strings to hold RGB-samples per scanline
-/rstr 470 string def
-/gstr 470 string def
-/bstr 470 string def
-{currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop}
-{currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop}
-{currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop}
-true 3
-%%BeginData:        41918 ASCII Bytes
-colorimage
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$hu<ZVJcF$qJ,~>
-JcC<$hu<ZVJcF$qJ,~>
-JcC<$hu<ZVJcF$qJ,~>
-JcC<$li6/KJcFI(J,~>
-JcC<$li6/KJcFI(J,~>
-JcC<$li6/KJcFI(J,~>
-JcC<$nGiCdkl:P\JcFX-J,~>
-JcC<$nGiCdkl:P\JcFX-J,~>
-JcC<$nGiCdkl:P\JcFX-J,~>
-JcC<$o`+jihZ*NSJcFd1J,~>
-JcC<$o`+jihZ*NSJcFd1J,~>
-JcC<$o`+jihZ*NSJcFd1J,~>
-JcC<$q#C9mf)P[KJcFp5J,~>
-JcC<$q#C9mf)P[KJcFp5J,~>
-JcC<$q#C9mf)P[KJcFp5J,~>
-JcC<$qZ$Npd/X(FJcG!7J,~>
-JcC<$qZ$Npd/X(FJcG!7J,~>
-JcC<$qZ$Npd/X(FJcG!7J,~>
-JcC<$rVuisb5_G at JcG*:J,~>
-JcC<$rVuisb5_G at JcG*:J,~>
-JcC<$rVuisb5_G at JcG*:J,~>
-JcC<$rr;uu`rH&=JcG-;J,~>
-JcC<$rr;uu`rH&=JcG-;J,~>
-JcC<$rr;uu`rH&=JcG-;J,~>
-JcC<$rW'h8rW%NLnGe"~>
-JcC<$rW'h8rW%NLnGe"~>
-JcC<$rW'h8rW%NLnGe"~>
-JcC?%rrBe5rr at WMnc++~>
-JcC?%rrBe5rr at WMnc++~>
-JcC?%rrBe5rr at WMnc++~>
-JcCE'rrBY1rr at WMoDa=~>
-JcCE'rrBY1rr at WMoDa=~>
-JcCE'rrBY1rr at WMoDa=~>
-JcCH(rrBS/rr at WMo`'F~>
-JcCH(rrBS/rr at WMo`'F~>
-JcCH(rrBS/rr at WMo`'F~>
-JcCK)rrBM-rr at WMp&BO~>
-JcCK)rrBM-rr at WMp&BO~>
-JcCK)rrBM-rr at WMp&BO~>
-JcCN*!!'>)!!%TMpA]X~>
-JcCN*!!'>)!!%TMpA]X~>
-JcCN*!!'>)!!%TMpA]X~>
-JcCQ+rrBA)rr at WMp]#a~>
-JcCQ+rrBA)rr at WMp]#a~>
-JcCQ+rrBA)rr at WMp]#a~>
-JcCT,!!'2%!!%TMq#>j~>
-JcCT,!!'2%!!%TMq#>j~>
-JcCT,!!'2%!!%TMq#>j~>
-JcCW-rrB5%rr at WMq>Ys~>
-JcCW-rrB5%rr at WMq>Ys~>
-JcCW-rrB5%rr at WMq>Ys~>
-JcCW-!!'Y2"5f_85PG*W!.k1Gs*t~>
-JcCW-!!'Y2"5f_85PG*W!.k1Gs*t~>
-JcCW-!!'Y2"5f_85PG*W!.k1Gs*t~>
-JcCZ.!!)Zk!5JIs!M=kdrrV'X5P>$V!.k1Hs*t~>
-JcCZ.!!)Zk!5JIs!M=kdrrV'X5P>$V!.k1Hs*t~>
-JcCZ.!!)Zk!5JIs!M=kdrrV'X5P>$V!.k1Hs*t~>
-JcCZ.!!)]l#G2"2s8Ut at 5Q1T^T@*Z>!'g/V!!%TMqYu'~>
-JcCZ.!!)]l#G2"2s8Ut at 5Q1T^T@*Z>!'g/V!!%TMqYu'~>
-JcCZ.!!)]l#G2"2s8Ut at 5Q1T^T@*Z>!'g/V!!%TMqYu'~>
-JcC]/rrD`l!?XQ)rrM"Arr3#V+4:)h!'g/Vrr at WMqu;0~>
-JcC]/rrD`l!?XQ)rrM"Arr3#V+4:)h!'g/Vrr at WMqu;0~>
-JcC]/rrD`l!?XQ)rrM"Arr3#V+4:)h!'g/Vrr at WMqu;0~>
-JcC]/!!)Zkrr<&6rVlkIrr3!`!7CfI!'g,U!!%TMqu;0~>
-JcC]/!!)Zkrr<&6rVlkIrr3!`!7CfI!'g,U!!%TMqu;0~>
-JcC]/!!)Zkrr<&6rVlkIrr3!`!7CfI!'g,U!!%TMqu;0~>
-JcC]/!!)Zk"()$.J,B6g?QT845QCc@?U#VshuE`6?Q\/i!$@j5s5.0*h`h)_TDecm^HXq)J,K<M
-?U$c)!'g,U!!%TMqu;0~>
-JcC]/!!)Zk"()$.J,B6g?QT845QCc@?U#VshuE`6?Q\/i!$@j5s5.0*h`h)_TDecm^HXq)J,K<M
-?U$c)!'g,U!!%TMqu;0~>
-JcC]/!!)Zk"()$.J,B6g?QT845QCc@?U#VshuE`6?Q\/i!$@j5s5.0*h`h)_TDecm^HXq)J,K<M
-?U$c)!'g,U!!%TMqu;0~>
-JcC]/!!)Zk"lDNE!$AuRrrG=arr48$+.rT559Je_h]Di*^V:ij^]315!+3LU*rs(Us5*gKs5*gK
-rr30e?iU.5!'g,U!!%TMqu;0~>
-JcC]/!!)Zk"lDNE!$AuRrrG=arr48$+.rT559Je_h]Di*^V:ij^]315!+3LU*rs(Us5*gKs5*gK
-rr30e?iU.5!'g,U!!%TMqu;0~>
-JcC]/!!)Zk"lDNE!$AuRrrG=arr48$+.rT559Je_h]Di*^V:ij^]315!+3LU*rs(Us5*gKs5*gK
-rr30e?iU.5!'g,U!!%TMqu;0~>
-JcC`0rrDWi!.XtJ!+5^)!C$S`rrITkrr3no!+5d+560U at s1\Ous8P:`huE_k!'gM`?Q]:I"[=+/
-s.9;jrrV'X5P5!U!.k1Js*t~>
-JcC`0rrDWi!.XtJ!+5^)!C$S`rrITkrr3no!+5d+560U at s1\Ous8P:`huE_k!'gM`?Q]:I"[=+/
-s.9;jrrV'X5P5!U!.k1Js*t~>
-JcC`0rrDWi!.XtJ!+5^)!C$S`rrITkrr3no!+5d+560U at s1\Ous8P:`huE_k!'gM`?Q]:I"[=+/
-s.9;jrrV'X5P5!U!.k1Js*t~>
-JcC]/!!)Qh"Q)ED!$D4?!C$S`rrF3+rVum>s8N*a!<)p$*ru?@561Z^"WmaEruV7?5Q;i*s8P=^
-rrE*ao`"mkJcGWIJ,~>
-JcC]/!!)Qh"Q)ED!$D4?!C$S`rrF3+rVum>s8N*a!<)p$*ru?@561Z^"WmaEruV7?5Q;i*s8P=^
-rrE*ao`"mkJcGWIJ,~>
-JcC]/!!)Qh"Q)ED!$D4?!C$S`rrF3+rVum>s8N*a!<)p$*ru?@561Z^"WmaEruV7?5Q;i*s8P=^
-rrE*ao`"mkJcGWIJ,~>
-JcC]/!!)Kf#G1trJ,fO5!<3!!!'gG^"[<"es$$M^rrkUes8P:`rVm$c!<<'!5PkB\!'gG^!<>@V
-rr<%Ms82hH~>
-JcC]/!!)Kf#G1trJ,fO5!<3!!!'gG^"[<"es$$M^rrkUes8P:`rVm$c!<<'!5PkB\!'gG^!<>@V
-rr<%Ms82hH~>
-JcC]/!!)Kf#G1trJ,fO5!<3!!!'gG^"[<"es$$M^rrkUes8P:`rVm$c!<<'!5PkB\!'gG^!<>@V
-rr<%Ms82hH~>
-JcC]/!!)Zk!.XqH#/:.&s8P:`rr<!?rVm$c+92@*!<)p$59Kq*561Z^#!X40ruV6urr3,Ys8N'@
-rVllu5P4sU!.k1Is*t~>
-JcC]/!!)Zk!.XqH#/:.&s8P:`rr<!?rVm$c+92@*!<)p$59Kq*561Z^#!X40ruV6urr3,Ys8N'@
-rVllu5P4sU!.k1Is*t~>
-JcC]/!!)Zk!.XqH#/:.&s8P:`rr<!?rVm$c+92@*!<)p$59Kq*561Z^#!X40ruV6urr3,Ys8N'@
-rVllu5P4sU!.k1Is*t~>
-JcC]/rrD`l!FNV>rriCPs8P:`rr3%,!5JO5"Wr6os$$M^rriCPs8P:`rVmB.J,fOU!'fB at hd?E`
-560U?rrE*ap&G$lJcGWIJ,~>
-JcC]/rrD`l!FNV>rriCPs8P:`rr3%,!5JO5"Wr6os$$M^rriCPs8P:`rVmB.J,fOU!'fB at hd?E`
-560U?rrE*ap&G$lJcGWIJ,~>
-JcC]/rrD`l!FNV>rriCPs8P:`rr3%,!5JO5"Wr6os$$M^rriCPs8P:`rVmB.J,fOU!'fB at hd?E`
-560U?rrE*ap&G$lJcGWIJ,~>
-JcCZ.!!)]l!ad%arr3md+5d+u?N at j5hqoM?s8ThUhuE^@!2';kIm<r4#!W*[s8RR5rr2uUrW!?K
-!5JR6^ApLus1\OUp&>!lJcGTHJ,~>
-JcCZ.!!)]l!ad%arr3md+5d+u?N at j5hqoM?s8ThUhuE^@!2';kIm<r4#!W*[s8RR5rr2uUrW!?K
-!5JR6^ApLus1\OUp&>!lJcGTHJ,~>
-JcCZ.!!)]l!ad%arr3md+5d+u?N at j5hqoM?s8ThUhuE^@!2';kIm<r4#!W*[s8RR5rr2uUrW!?K
-!5JR6^ApLus1\OUp&>!lJcGTHJ,~>
-JcCZ.!!)]l#Ci at Q5<g5shu<W`^E4Q4s8Ut at +$X,irr3-d!+.rT?iC!.56,%T5@=?g"M[/$+.rN3
-#JV?&?_7<_TD&9b!.k1Hs*t~>
-JcCZ.!!)]l#Ci at Q5<g5shu<W`^E4Q4s8Ut at +$X,irr3-d!+.rT?iC!.56,%T5@=?g"M[/$+.rN3
-#JV?&?_7<_TD&9b!.k1Hs*t~>
-JcCZ.!!)]l#Ci at Q5<g5shu<W`^E4Q4s8Ut at +$X,irr3-d!+.rT?iC!.56,%T5@=?g"M[/$+.rN3
-#JV?&?_7<_TD&9b!.k1Hs*t~>
-JcCW-!!(gS!C$S[rrG=ah>[HTJcGQGJ,~>
-JcCW-!!(gS!C$S[rrG=ah>[HTJcGQGJ,~>
-JcCW-!!(gS!C$S[rrG=ah>[HTJcGQGJ,~>
-JcCW-rrCmT!C$S[rrG=ahZ*TUJcGQGJ,~>
-JcCW-rrCmT!C$S[rrG=ahZ*TUJcGQGJ,~>
-JcCW-rrCmT!C$S[rrG=ahZ*TUJcGQGJ,~>
-JcCT,!!(jT!C$S[rrG=ahZ!QUJcGNFJ,~>
-JcCT,!!(jT!C$S[rrG=ahZ!QUJcGNFJ,~>
-JcCT,!!(jT!C$S[rrG=ahZ!QUJcGNFJ,~>
-JcCQ+rrD!W".oPnJ,B6JT)\k at iW&oXJcGKEJ,~>
-JcCQ+rrD!W".oPnJ,B6JT)\k at iW&oXJcGKEJ,~>
-JcCQ+rrD!W".oPnJ,B6JT)\k at iW&oXJcGKEJ,~>
-JcCN*!!'>)!!%TMpA]X~>
-JcCN*!!'>)!!%TMpA]X~>
-JcCN*!!'>)!!%TMpA]X~>
-JcCK)rrBM-rr at WMp&BO~>
-JcCK)rrBM-rr at WMp&BO~>
-JcCK)rrBM-rr at WMp&BO~>
-JcCH(rrBS/rr at WMo`'F~>
-JcCH(rrBS/rr at WMo`'F~>
-JcCH(rrBS/rr at WMo`'F~>
-JcCK)r;aG/rr at WMoDa=~>
-JcCK)r;aG/rr at WMoDa=~>
-JcCK)r;aG/rr at WMoDa=~>
-JcCQ+q#J//rr at WMnc++~>
-JcCQ+q#J//rr at WMnc++~>
-JcCQ+q#J//rr at WMnc++~>
-JcCW-q#CEprW'h8rW%NLnGe"~>
-JcCW-q#CEprW'h8rW%NLnGe"~>
-JcCW-q#CEprW'h8rW%NLnGe"~>
-JcC]/q#L<lrrC(=rr at WMmJh\~>
-JcC]/q#L<lrrC(=rr at WMmJh\~>
-JcC]/q#L<lrrC(=rr at WMmJh\~>
-JcC`0q>g<jrW(+ at rW%NLm/MS~>
-JcC`0q>g<jrW(+ at rW%NLm/MS~>
-JcC`0q>g<jrW(+ at rW%NLm/MS~>
-JcCc1qZ-6frW(=FrW%NLl2Q8~>
-JcCc1qZ-6frW(=FrW%NLl2Q8~>
-JcCc1qZ-6frW(=FrW%NLl2Q8~>
-JcCi3qZ-*br;bFKr;_EKkPp&~>
-JcCi3qZ-*br;bFKr;_EKkPp&~>
-JcCi3qZ-*br;bFKr;_EKkPp&~>
-JcCo5q>fg\r;b^Sr;_EKj8XW~>
-JcCo5q>fg\r;b^Sr;_EKj8XW~>
-JcCo5q>fg\r;b^Sr;_EKj8XW~>
-JcCr6q>fXWquGs\q#H!Gir=N~>
-JcCr6q>fXWquGs\q#H!Gir=N~>
-JcCr6q>fXWquGs\q#H!Gir=N~>
-JcD#8q>fCPkQ(P\r;_EKj8XW~>
-JcD#8q>fCPkQ(P\r;_EKj8XW~>
-JcD#8q>fCPkQ(P\r;_EKj8XW~>
-JcD):q>f4Kr;ccq!!)NgqZ)3Ijo9i~>
-JcD):q>f4Kr;ccq!!)NgqZ)3Ijo9i~>
-JcD):q>f4Kr;ccq!!)NgqZ)3Ijo9i~>
-JcD,;q>f1Jr;c-_q>c*Hk5Tr~>
-JcD,;q>f1Jr;c-_q>c*Hk5Tr~>
-JcD,;q>f1Jr;c-_q>c*Hk5Tr~>
-JcD2=q>f.IquH!]q>c*HkPp&~>
-JcD2=q>f.IquH!]q>c*HkPp&~>
-JcD2=q>f.IquH!]q>c*HkPp&~>
-JcD5>qZ,4IqZ,m\p],mFl2Q8~>
-JcD5>qZ,4IqZ,m\p],mFl2Q8~>
-JcD5>qZ,4IqZ,m\p],mFl2Q8~>
-JcD8?qZ,1HqZ,j[p],mFlMlA~>
-JcD8?qZ,1HqZ,j[p],mFlMlA~>
-JcD8?qZ,1HqZ,j[p],mFlMlA~>
-JcD>AqZ,.Gq>faZpAfdEli2J~>
-JcD>AqZ,.Gq>faZpAfdEli2J~>
-JcD>AqZ,.Gq>faZpAfdEli2J~>
-JcDDCq>f%Fq#KUXp&K[DmJh\~>
-JcDDCq>f%Fq#KUXp&K[DmJh\~>
-JcDDCq>f%Fq#KUXp&K[DmJh\~>
-JcDGDq>f%Fp]0LWo`0RCmf.e~>
-JcDGDq>f%Fp]0LWo`0RCmf.e~>
-JcDGDq>f%Fp]0LWo`0RCmf.e~>
-JcDJEqZ,(Ep]0LWoDjIBn,In~>
-JcDJEqZ,(Ep]0LWoDjIBn,In~>
-JcDJEqZ,(Ep]0LWoDjIBn,In~>
-JcDMFquG.Ep]0FUo`0RCn,In~>
-JcDMFquG.Ep]0FUo`0RCn,In~>
-JcDMFquG.Ep]0FUo`0RCn,In~>
-JcDPGquG.EpAj=To`0RCn,In~>
-JcDPGquG.EpAj=To`0RCn,In~>
-JcDPGquG.EpAj=To`0RCn,In~>
-JcDSHquG+DpAj:SpAfdEmf.e~>
-JcDSHquG+DpAj:SpAfdEmf.e~>
-JcDSHquG+DpAj:SpAfdEmf.e~>
-JcDVIquG+Dp&O1Rp],mFmJh\~>
-JcDVIquG+Dp&O1Rp],mFmJh\~>
-JcDVIquG+Dp&O1Rp],mFmJh\~>
-JcDYJquG(Cp&O.Qp],mFmf.e~>
-JcDYJquG(Cp&O.Qp],mFmf.e~>
-JcDYJquG(Cp&O.Qp],mFmf.e~>
-JcD\KquG%Bp&O.QrW)uuquD<Jn,In~>
-JcD\KquG%Bp&O.QrW)uuquD<Jn,In~>
-JcD\KquG%Bp&O.QrW)uuquD<Jn,In~>
-JcD_LquFq?p]0.MquD<JnGe"~>
-JcD_LquFq?p]0.MquD<JnGe"~>
-JcD_LquFq?p]0.MquD<JnGe"~>
-JcDbMquFh<q>f=Nr;_EKnGe"~>
-JcDbMquFh<q>f=Nr;_EKnGe"~>
-JcDbMquFh<q>f=Nr;_EKnGe"~>
-JcDeNquFe;q>f:Mr;_EKnc++~>
-JcDeNquFe;q>f:Mr;_EKnc++~>
-JcDeNquFe;q>f:Mr;_EKnc++~>
-JcDhOquFe;r;bILquD<Jo)F4~>
-JcDhOquFe;r;bILquD<Jo)F4~>
-JcDhOquFe;r;bILquD<Jo)F4~>
-JcDkPquFb:r;bFKquD<JoDa=~>
-JcDkPquFb:r;bFKquD<JoDa=~>
-JcDkPquFb:r;bFKquD<JoDa=~>
-JcDnQquFb:r;b at IquD<Jo`'F~>
-JcDnQquFb:r;b at IquD<Jo`'F~>
-JcDnQquFb:r;b at IquD<Jo`'F~>
-JcDqRquF_9r;b=Hr;_EKo`'F~>
-JcDqRquF_9r;b=Hr;_EKo`'F~>
-JcDqRquF_9r;b=Hr;_EKo`'F~>
-JcDqRr;ae9rW(@Gr;_EKp&BO~>
-JcDqRr;ae9rW(@Gr;_EKp&BO~>
-JcDqRr;ae9rW(@Gr;_EKp&BO~>
-JcDtSr;ab8rW(@GquD<JpA]X~>
-JcDtSr;ab8rW(@GquD<JpA]X~>
-JcDtSr;ab8rW(@GquD<JpA]X~>
-JcE"TquF\8r;b4Er;_EKpA]X~>
-JcE"TquF\8r;b4Er;_EKpA]X~>
-JcE"TquF\8r;b4Er;_EKpA]X~>
-JcE"Tr;ab8r;b1Dr;_EKp]#a~>
-JcE"Tr;ab8r;b1Dr;_EKp]#a~>
-JcE"Tr;ab8r;b1Dr;_EKp]#a~>
-JcE%Ur;a_7rW(7Dr;_EKp]#a~>
-JcE%Ur;a_7rW(7Dr;_EKp]#a~>
-JcE%Ur;a_7rW(7Dr;_EKp]#a~>
-JcE(VquFV6rW(4Cr;_EKq#>j~>
-JcE(VquFV6rW(4Cr;_EKq#>j~>
-JcE(VquFV6rW(4Cr;_EKq#>j~>
-JcE(Vr;a_7r;b+Br;_EKq#>j~>
-JcE(Vr;a_7r;b+Br;_EKq#>j~>
-JcE(Vr;a_7r;b+Br;_EKq#>j~>
-JcE+Wr;a\6r;b(Ar;_EKq>Ys~>
-JcE+Wr;a\6r;b(Ar;_EKq>Ys~>
-JcE+Wr;a\6r;b(Ar;_EKq>Ys~>
-JcE+Wr;a_7r;b%@r;_EKq>Ys~>
-JcE+Wr;a_7r;b%@r;_EKq>Ys~>
-JcE+Wr;a_7r;b%@r;_EKq>Ys~>
-JcE.Xr;a\6r;b"?r;_EKqYu'~>
-JcE.Xr;a\6r;b"?r;_EKqYu'~>
-JcE.Xr;a\6r;b"?r;_EKqYu'~>
-JcE.Xr;c3a!2&]Z!2&TWrW)Ee!2&'Hr;_EKqYu'~>
-JcE.Xr;c3a!2&]Z!2&TWrW)Ee!2&'Hr;_EKqYu'~>
-JcE.Xr;c3a!2&]Z!2&TWrW)Ee!2&'Hr;_EKqYu'~>
-JcE1Yr;c3a!T,!frrM"!li6qanG`OH+5?hp!.k1Hs*t~>
-JcE1Yr;c3a!T,!frrM"!li6qanG`OH+5?hp!.k1Hs*t~>
-JcE1Yr;c3a!T,!frrM"!li6qanG`OH+5?hp!.k1Hs*t~>
-JcE4ZquH*`!C$SQrrG=am/R"anG`MR!8IPP!.k1Is*t~>
-JcE4ZquH*`!C$SQrrG=am/R"anG`MR!8IPP!.k1Is*t~>
-JcE4ZquH*`!C$SQrrG=am/R"anG`MR!8IPP!.k1Is*t~>
-JcE4Zr;cHh+5]:I!!(pV?QT845QCaj+!3_^s8Ti@!5BU??QT845OSRM!;QR7h`j=*!8mf`*rnMi
-s8Ut`59E,Is8Ut`+5]9_+.r$%r;_EKqu;0~>
-JcE4Zr;cHh+5]:I!!(pV?QT845QCaj+!3_^s8Ti@!5BU??QT845OSRM!;QR7h`j=*!8mf`*rnMi
-s8Ut`59E,Is8Ut`+5]9_+.r$%r;_EKqu;0~>
-JcE4Zr;cHh+5]:I!!(pV?QT845QCaj+!3_^s8Ti@!5BU??QT845OSRM!;QR7h`j=*!8mf`*rnMi
-s8Ut`59E,Is8Ut`+5]9_+.r$%r;_EKqu;0~>
-JcE7[r;cEg#s[>Ih]LbUs$$M_rt'Y[hu=c?s8ThU!2"aJs$$MMs8E#mrs:pIs5+pUs8P:`rr3Sf
-+.rT559Je_h]Di*^V:ij^[M4$!.k1Js*t~>
-JcE7[r;cEg#s[>Ih]LbUs$$M_rt'Y[hu=c?s8ThU!2"aJs$$MMs8E#mrs:pIs5+pUs8P:`rr3Sf
-+.rT559Je_h]Di*^V:ij^[M4$!.k1Js*t~>
-JcE7[r;cEg#s[>Ih]LbUs$$M_rt'Y[hu=c?s8ThU!2"aJs$$MMs8E#mrs:pIs5+pUs8P:`rr3Sf
-+.rT559Je_h]Di*^V:ij^[M4$!.k1Js*t~>
-JcE7[r;cEg#lqa?s.A3Ks$$M_rrmlos8P:`rr3$a!8meU!C$SOs8;rlrs8\?s8S_Ks8P:`rr3"K
-+9)9KhZ.$`s$$M at s8Th65O\XN!.k1Js*t~>
-JcE7[r;cEg#lqa?s.A3Ks$$M_rrmlos8P:`rr3$a!8meU!C$SOs8;rlrs8\?s8S_Ks8P:`rr3"K
-+9)9KhZ.$`s$$M at s8Th65O\XN!.k1Js*t~>
-JcE7[r;cEg#lqa?s.A3Ks$$M_rrmlos8P:`rr3$a!8meU!C$SOs8;rlrs8\?s8S_Ks8P:`rr3"K
-+9)9KhZ.$`s$$M at s8Th65O\XN!.k1Js*t~>
-JcE7[rW)Kg"$Zd8hu3QU561T\!e29lrr3!`!<)ou561*Nr;cTl"$Zd8hu3QU561]_!?XQ)s8O2@
-rrG=arVlm?!:Kmc!.k1Ks*t~>
-JcE7[rW)Kg"$Zd8hu3QU561T\!e29lrr3!`!<)ou561*Nr;cTl"$Zd8hu3QU561]_!?XQ)s8O2@
-rrG=arVlm?!:Kmc!.k1Ks*t~>
-JcE7[rW)Kg"$Zd8hu3QU561T\!e29lrr3!`!<)ou561*Nr;cTl"$Zd8hu3QU561]_!?XQ)s8O2@
-rrG=arVlm?!:Kmc!.k1Ks*t~>
-JcE:\r;cBf"Q)ED!+5a*!C$S_rrg)$h`h,?rrG=arVlm_!:Kmc!;?Eqh`h)@?iL'+561]_!<>@_
-rrkUes8P:`rVlm_!:Kmc!.k1Ks*t~>
-JcE:\r;cBf"Q)ED!+5a*!C$S_rrg)$h`h,?rrG=arVlm_!:Kmc!;?Eqh`h)@?iL'+561]_!<>@_
-rrkUes8P:`rVlm_!:Kmc!.k1Ks*t~>
-JcE:\r;cBf"Q)ED!+5a*!C$S_rrg)$h`h,?rrG=arVlm_!:Kmc!;?Eqh`h)@?iL'+561]_!<>@_
-rrkUes8P:`rVlm_!:Kmc!.k1Ks*t~>
-JcE:\r;c<d#G3(<5QCaJ!<3!%T)ddK561]_!C$S_rrG=amf34co`#/g*rnP*s$$M_s8O2>rrkV/
-s8P:`rVlm_+79+,!.k1Ls*t~>
-JcE:\r;c<d#G3(<5QCaJ!<3!%T)ddK561]_!C$S_rrG=amf34co`#/g*rnP*s$$M_s8O2>rrkV/
-s8P:`rVlm_+79+,!.k1Ls*t~>
-JcE:\r;c<d#G3(<5QCaJ!<3!%T)ddK561]_!C$S_rrG=amf34co`#/g*rnP*s$$M_s8O2>rrkV/
-s8P:`rVlm_+79+,!.k1Ls*t~>
-JcE:\rW)Hf$%N!Th]Djus$$M_rrjK/s8P:`rr3!`!<)ou561-OrW)Wk$%N!Th]Djus$$M_rrQO-
-^]+6:++O=j561Z^!<@W:s8;qKs8N%K~>
-JcE:\rW)Hf$%N!Th]Djus$$M_rrjK/s8P:`rr3!`!<)ou561-OrW)Wk$%N!Th]Djus$$M_rrQO-
-^]+6:++O=j561Z^!<@W:s8;qKs8N%K~>
-JcE:\rW)Hf$%N!Th]Djus$$M_rrjK/s8P:`rr3!`!<)ou561-OrW)Wk$%N!Th]Djus$$M_rrQO-
-^]+6:++O=j561Z^!<@W:s8;qKs8N%K~>
-JcE=]r;c?e(E_Q7ruXK*s'Gc at TAL_4s5+mus1eRu!<)p#?N at j5ht$gG!;6 at 4+5d+u+$]f*?N at j5
-hqoM?s8ThUhuE^@!2';kIm<9!r;_EKs8RT~>
-JcE=]r;c?e(E_Q7ruXK*s'Gc at TAL_4s5+mus1eRu!<)p#?N at j5ht$gG!;6 at 4+5d+u+$]f*?N at j5
-hqoM?s8ThUhuE^@!2';kIm<9!r;_EKs8RT~>
-JcE=]r;c?e(E_Q7ruXK*s'Gc at TAL_4s5+mus1eRu!<)p#?N at j5ht$gG!;6 at 4+5d+u+$]f*?N at j5
-hqoM?s8ThUhuE^@!2';kIm<9!r;_EKs8RT~>
-JcE=]r;c?err<g!+(*q*s1]Wt^]0o+5C\._?b`35!.Y"J"2>p"^[_@&!;6Bl!"hF;?f1n`^E4Q4
-s8Ut at +$X,irr3-d!+.rT?g@[i!.k1Ms*t~>
-JcE=]r;c?err<g!+(*q*s1]Wt^]0o+5C\._?b`35!.Y"J"2>p"^[_@&!;6Bl!"hF;?f1n`^E4Q4
-s8Ut at +$X,irr3-d!+.rT?g@[i!.k1Ms*t~>
-JcE=]r;c?err<g!+(*q*s1]Wt^]0o+5C\._?b`35!.Y"J"2>p"^[_@&!;6Bl!"hF;?f1n`^E4Q4
-s8Ut at +$X,irr3-d!+.rT?g@[i!.k1Ms*t~>
-JcE@^r;aV4rW(dS!C$SGs8;qKrrE(L~>
-JcE@^r;aV4rW(dS!C$SGs8;qKrrE(L~>
-JcE@^r;aV4rW(dS!C$SGs8;qKrrE(L~>
-JcE@^r;aY5r;b[R!C$SGs8;qKrrE(L~>
-JcE@^r;aY5r;b[R!C$SGs8;qKrrE(L~>
-JcE@^r;aY5r;b[R!C$SGs8;qKrrE(L~>
-JcEC_r;aV4r;b[R!C$SFs8;qKs*t~>
-JcEC_r;aV4r;b[R!C$SFs8;qKs*t~>
-JcEC_r;aV4r;b[R!C$SFs8;qKs*t~>
-JcEC_r;aY5r;b[R".oPnJ*$_/!.k0#~>
-JcEC_r;aY5r;b[R".oPnJ*$_/!.k0#~>
-JcEC_r;aY5r;b[R".oPnJ*$_/!.k0#~>
-JcEC_rW'_5r;aM1r;_HLJ,~>
-JcEC_rW'_5r;aM1r;_HLJ,~>
-JcEC_rW'_5r;aM1r;_HLJ,~>
-JcEC_rW'b6r;aJ0r;_HLJ,~>
-JcEC_rW'b6r;aJ0r;_HLJ,~>
-JcEC_rW'b6r;aJ0r;_HLJ,~>
-JcEF`r;aY5r;aG/r;_KMJ,~>
-JcEF`r;aY5r;aG/r;_KMJ,~>
-JcEF`r;aY5r;aG/r;_KMJ,~>
-JcEF`r;a\6r;aD.r;_KMJ,~>
-JcEF`r;a\6r;aD.r;_KMJ,~>
-JcEF`r;a\6r;aD.r;_KMJ,~>
-JcEF`rW'e7quF8,r;_NNJ,~>
-JcEF`rW'e7quF8,r;_NNJ,~>
-JcEF`rW'e7quF8,r;_NNJ,~>
-JcEF`rW'e7r;a>,r;_NNJ,~>
-JcEF`rW'e7r;a>,r;_NNJ,~>
-JcEF`rW'e7r;a>,r;_NNJ,~>
-JcEIar;a_7r;a8*r;_QOJ,~>
-JcEIar;a_7r;a8*r;_QOJ,~>
-JcEIar;a_7r;a8*r;_QOJ,~>
-JcEIar;ae9qZ+&(r;_QOJ,~>
-JcEIar;ae9qZ+&(r;_QOJ,~>
-JcEIar;ae9qZ+&(r;_QOJ,~>
-JcEIarW'n:qZ*u&r;_TPJ,~>
-JcEIarW'n:qZ*u&r;_TPJ,~>
-JcEIarW'n:qZ*u&r;_TPJ,~>
-JcELbr;ah:qZ*r%r;_TPJ,~>
-JcELbr;ah:qZ*r%r;_TPJ,~>
-JcELbr;ah:qZ*r%r;_TPJ,~>
-JcEXfq#JG7quEr#r;_WQJ,~>
-JcEXfq#JG7quEr#r;_WQJ,~>
-JcEXfq#JG7quEr#r;_WQJ,~>
-JcEXfp&N88quEo"r;_WQJ,~>
-JcEXfp&N88quEo"r;_WQJ,~>
-JcEXfp&N88quEo"r;_WQJ,~>
-JcEXfp&N;9quEhur;_ZRJ,~>
-JcEXfp&N;9quEhur;_ZRJ,~>
-JcEXfp&N;9quEhur;_ZRJ,~>
-JcEXfp&N>:quEetr;_ZRJ,~>
-JcEXfp&N>:quEetr;_ZRJ,~>
-JcEXfp&N>:quEetr;_ZRJ,~>
-JcEXfp&NA;quE_rr;_]SJ,~>
-JcEXfp&NA;quE_rr;_]SJ,~>
-JcEXfp&NA;quE_rr;_]SJ,~>
-JcEXfpAiJ<quE\qr;_]SJ,~>
-JcEXfpAiJ<quE\qr;_]SJ,~>
-JcEXfpAiJ<quE\qr;_]SJ,~>
-JcEUep]/V>quEVor;_`TJ,~>
-JcEUep]/V>quEVor;_`TJ,~>
-JcEUep]/V>quEVor;_`TJ,~>
-JcEUeq#J_?quESnr;_`TJ,~>
-JcEUeq#J_?quESnr;_`TJ,~>
-JcEUeq#J_?quESnr;_`TJ,~>
-JcEUeq#JeAqZ*Dkr;_cUJ,~>
-JcEUeq#JeAqZ*Dkr;_cUJ,~>
-JcEUeq#JeAqZ*Dkr;_cUJ,~>
-JcEUeq#JhBqZ*Ajr;_cUJ,~>
-JcEUeq#JhBqZ*Ajr;_cUJ,~>
-JcEUeq#JhBqZ*Ajr;_cUJ,~>
-JcEUeq>eqCqZ*;hr;_fVJ,~>
-JcEUeq>eqCqZ*;hr;_fVJ,~>
-JcEUeq>eqCqZ*;hr;_fVJ,~>
-JcEUeq>f"EqZ*5fr;_fVJ,~>
-JcEUeq>f"EqZ*5fr;_fVJ,~>
-JcEUeq>f"EqZ*5fr;_fVJ,~>
-JcEUeqZ,+FqZ*/dr;_iWJ,~>
-JcEUeqZ,+FqZ*/dr;_iWJ,~>
-JcEUeqZ,+FqZ*/dr;_iWJ,~>
-JcEUeqZ,.GqZ*,cr;_iWJ,~>
-JcEUeqZ,.GqZ*,cr;_iWJ,~>
-JcEUeqZ,.GqZ*,cr;_iWJ,~>
-JcERdquG=JqZ*#`r;_lXJ,~>
-JcERdquG=JqZ*#`r;_lXJ,~>
-JcERdquG=JqZ*#`r;_lXJ,~>
-JcERdr;bFKqZ)u_quDfXJ,~>
-JcERdr;bFKqZ)u_quDfXJ,~>
-JcERdr;bFKqZ)u_quDfXJ,~>
-JcERdr;bILqZ)o]r;_oYJ,~>
-JcERdr;bILqZ)o]r;_oYJ,~>
-JcERdr;bILqZ)o]r;_oYJ,~>
-JcEUer;bLMqZ)fZr;_rZJ,~>
-JcEUer;bLMqZ)fZr;_rZJ,~>
-JcEUer;bLMqZ)fZr;_rZJ,~>
-JcF$qkQ'ZCq>cZXr;_rZJ,~>
-JcF$qkQ'ZCq>cZXr;_rZJ,~>
-JcF$qkQ'ZCq>cZXr;_rZJ,~>
-JcF4!qZ,p]qZ,m\q>cTVr;_u[J,~>
-JcF4!qZ,p]qZ,m\q>cTVr;_u[J,~>
-JcF4!qZ,p]qZ,m\q>cTVr;_u[J,~>
-JcF=$r;bdUr;c9cq>cNTr;_u[J,~>
-JcF=$r;bdUr;c9cq>cNTr;_u[J,~>
-JcF=$r;bdUr;c9cq>cNTr;_u[J,~>
-JcFF'rW(UNrW)NhqZ)NRr;`#\J,~>
-JcFF'rW(UNrW)NhqZ)NRr;`#\J,~>
-JcFF'rW(UNrW)NhqZ)NRr;`#\J,~>
-JcFO*rW(CHrW)]mq>cBPr;`#\J,~>
-JcFO*rW(CHrW)]mq>cBPr;`#\J,~>
-JcFO*rW(CHrW)]mq>cBPr;`#\J,~>
-JcFU,rrC:CrrDrrq>c9Mr;`&]J,~>
-JcFU,rrC:CrrDrrq>c9Mr;`&]J,~>
-JcFU,rrC:CrrDrrq>c9Mr;`&]J,~>
-JcF[.rrC.?rrE&uq>c6Lr;`&]J,~>
-JcF[.rrC.?rrE&uq>c6Lr;`&]J,~>
-JcF[.rrC.?rrE&uq>c6Lr;`&]J,~>
-JcFa0rrC";rr<'!quD?Kr;`)^J,~>
-JcFa0rrC";rr<'!quD?Kr;`)^J,~>
-JcFa0rrC";rr<'!quD?Kr;`)^J,~>
-JcFg2rrBk7r;_EK!<;utPlH7~>
-JcFg2rrBk7r;_EK!<;utPlH7~>
-JcFg2rrBk7r;_EK!<;utPlH7~>
-JcFj3rrBe5rr at WMrr;osQ2c@~>
-JcFj3rrBe5rr at WMrr;osQ2c@~>
-JcFj3rrBe5rr at WMrr;osQ2c@~>
-JcFm4!!'V1!!%TMs8W#tQ2c@~>
-JcFm4!!'V1!!%TMs8W#tQ2c@~>
-JcFm4!!'V1!!%TMs8W#tQ2c@~>
-JcFs6rrBS/rr at WM!<<#uQ2c@~>
-JcFs6rrBS/rr at WM!<<#uQ2c@~>
-JcFs6rrBS/rr at WM!<<#uQ2c@~>
-JcFs6!!'J-!!%TM!<;utQN)I~>
-JcFs6!!'J-!!%TM!<;utQN)I~>
-JcFs6!!'J-!!%TM!<;utQN)I~>
-JcG!7!!'D+!!%TMr;`/`J,~>
-JcG!7!!'D+!!%TMr;`/`J,~>
-JcG!7!!'D+!!%TMr;`/`J,~>
-JcG$8!!'>)!!%TMrW&8aJ,~>
-JcG$8!!'>)!!%TMrW&8aJ,~>
-JcG$8!!'>)!!%TMrW&8aJ,~>
-JcG'9rrCIH!Im>ps8N(Ns8;qas*t~>
-JcG'9rrCIH!Im>ps8N(Ns8;qas*t~>
-JcG'9rrCIH!Im>ps8N(Ns8;qas*t~>
-JcG*:rrD]k!5JIs!M=l&rrIU6j8],ZKE(lMQiDR~>
-JcG*:rrD]k!5JIs!M=l&rrIU6j8],ZKE(lMQiDR~>
-JcG*:rrD]k!5JIs!M=l&rrIU6j8],ZKE(lMQiDR~>
-JcG*:!!)Zk#G2"2s8Ut at 5Q1T^TC2^ZTA9GH!.t7L!:0XbT<J9F~>
-JcG*:!!)Zk#G2"2s8Ut at 5Q1T^TC2^ZTA9GH!.t7L!:0XbT<J9F~>
-JcG*:!!)Zk#G2"2s8Ut at 5Q1T^TC2^ZTA9GH!.t7L!:0XbT<J9F~>
-JcG*:!!)Zk!?XQ)rrM"Arr3#V+7K41h]LYR!!%WNr;c3a!T,!&s*t~>
-JcG*:!!)Zk!?XQ)rrM"Arr3#V+7K41h]LYR!!%WNr;c3a!T,!&s*t~>
-JcG*:!!)Zk!?XQ)rrM"Arr3#V+7K41h]LYR!!%WNr;c3a!T,!&s*t~>
-JcG-;!!)Wjrr<&6rVlkIrr3!`!:Tpg560I<!!%WNrW)<b!C$Rfs*t~>
-JcG-;!!)Wjrr<&6rVlkIrr3!`!:Tpg560I<!!%WNrW)<b!C$Rfs*t~>
-JcG-;!!)Wjrr<&6rVlkIrr3!`!:Tpg560I<!!%WNrW)<b!C$Rfs*t~>
-JcG-;!!)Wj"()$.J,B6l?QT845QCaj+!3_^s8Ti@!5BU??QT845Q@?_!<9eu!8h-*+2 at dS#(I^Z
-!!#5Jp&>!lK)bcLp&?&i5<f,Jhu@%*!'`^Js5.0J+$\Z_s5.0*h`h)_T>U\Z~>
-JcG-;!!)Wj"()$.J,B6l?QT845QCaj+!3_^s8Ti@!5BU??QT845Q@?_!<9eu!8h-*+2 at dS#(I^Z
-!!#5Jp&>!lK)bcLp&?&i5<f,Jhu@%*!'`^Js5.0J+$\Z_s5.0*h`h)_T>U\Z~>
-JcG-;!!)Wj"()$.J,B6l?QT845QCaj+!3_^s8Ti@!5BU??QT845Q@?_!<9eu!8h-*+2 at dS#(I^Z
-!!#5Jp&>!lK)bcLp&?&i5<f,Jhu@%*!'`^Js5.0J+$\Z_s5.0*h`h)_T>U\Z~>
-JcG-;!!)Wj"lDNE!$AuRrrG=arr3OZ!8meu+92AU*rqp_?iN=jrVm3h!<<'`!2';k+!:L^#%&J0
-s*k#uo`"mkK)bcLp&>=_huDRUhuE^@!<3!1h]JKjs$%U_s5+mu?ba>t!5HJPJ,~>
-JcG-;!!)Wj"lDNE!$AuRrrG=arr3OZ!8meu+92AU*rqp_?iN=jrVm3h!<<'`!2';k+!:L^#%&J0
-s*k#uo`"mkK)bcLp&>=_huDRUhuE^@!<3!1h]JKjs$%U_s5+mu?ba>t!5HJPJ,~>
-JcG-;!!)Wj"lDNE!$AuRrrG=arr3OZ!8meu+92AU*rqp_?iN=jrVm3h!<<'`!2';k+!:L^#%&J0
-s*k#uo`"mkK)bcLp&>=_huDRUhuE^@!<3!1h]JKjs$%U_s5+mu?ba>t!5HJPJ,~>
-JcG-;!!)Qh!.XtJ!+5^)!C$S`rrmlos8P:`rr3$a!8meU!C$S_rrkUes8P:`rr3!`!<3!&!'gM`
-hZ,n5rr<%Ms8E#krs8\?s8S_Ks8P:`rr3"K+9)9KhZ.$`s$$M at s8Th65K*SP~>
-JcG-;!!)Qh!.XtJ!+5^)!C$S`rrmlos8P:`rr3$a!8meU!C$S_rrkUes8P:`rr3!`!<3!&!'gM`
-hZ,n5rr<%Ms8E#krs8\?s8S_Ks8P:`rr3"K+9)9KhZ.$`s$$M at s8Th65K*SP~>
-JcG-;!!)Qh!.XtJ!+5^)!C$S`rrmlos8P:`rr3$a!8meU!C$S_rrkUes8P:`rr3!`!<3!&!'gM`
-hZ,n5rr<%Ms8E#krs8\?s8S_Ks8P:`rr3"K+9)9KhZ.$`s$$M at s8Th65K*SP~>
-JcG0<rrDQg"Q)ED!$D4?!C$S]rrRZl!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3#u+9)9@!+5Bu
-rr at ZNr;cQk"$Zd8hu3QU561]_!?XQ)s8O2 at rrG=arVlm?!6"nf~>
-JcG0<rrDQg"Q)ED!$D4?!C$S]rrRZl!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3#u+9)9@!+5Bu
-rr at ZNr;cQk"$Zd8hu3QU561]_!?XQ)s8O2 at rrG=arVlm?!6"nf~>
-JcG0<rrDQg"Q)ED!$D4?!C$S]rrRZl!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3#u+9)9@!+5Bu
-rr at ZNr;cQk"$Zd8hu3QU561]_!?XQ)s8O2 at rrG=arVlm?!6"nf~>
-JcG-;!!)He#G1trJ,fO5!<)p#^H^U?!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3!&^Au%KT)dd@
-rr<%Ms8;rkrrh4D!!$C*rrG=arr3!!5Q1Tc561``561Z^!C$S&s*t~>
-JcG-;!!)He#G1trJ,fO5!<)p#^H^U?!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3!&^Au%KT)dd@
-rr<%Ms8;rkrrh4D!!$C*rrG=arr3!!5Q1Tc561``561Z^!C$S&s*t~>
-JcG-;!!)He#G1trJ,fO5!<)p#^H^U?!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3!&^Au%KT)dd@
-rr<%Ms8;rkrrh4D!!$C*rrG=arr3!!5Q1Tc561``561Z^!C$S&s*t~>
-JcG-;!!)Wj!.XqH#/:.&s8P:`rr3.o!8mf@!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<)otJ,VY4
-^[qI*!.k.Ms8E#jrs,/<!'gM`561]_ru_4>"[=+/s$$M^rrG>+`;b>~>
-JcG-;!!)Wj!.XqH#/:.&s8P:`rr3.o!8mf@!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<)otJ,VY4
-^[qI*!.k.Ms8E#jrs,/<!'gM`561]_ru_4>"[=+/s$$M^rrG>+`;b>~>
-JcG-;!!)Wj!.XqH#/:.&s8P:`rr3.o!8mf@!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<)otJ,VY4
-^[qI*!.k.Ms8E#jrs,/<!'gM`561]_ru_4>"[=+/s$$M^rrG>+`;b>~>
-JcG-;!!)Wj!FNV>rriCPs8P:`rr3-D5QCaJ!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3!!J)B_p
-!!%TM!<<#upAYGKs8Usu!<<'`!<3!"?N at k?rrjKos8P:`rVlluJ&MA;~>
-JcG-;!!)Wj!FNV>rriCPs8P:`rr3-D5QCaJ!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3!!J)B_p
-!!%TM!<<#upAYGKs8Usu!<<'`!<3!"?N at k?rrjKos8P:`rVlluJ&MA;~>
-JcG-;!!)Wj!FNV>rriCPs8P:`rr3-D5QCaJ!<3!!561Z^!C$S_rrkUes8P:`rr3!`!<3!!J)B_p
-!!%TM!<<#upAYGKs8Usu!<<'`!<3!"?N at k?rrjKos8P:`rVlluJ&MA;~>
-JcG-;!!)Wj!ad%arr3[^+5d+u?N at j5h]Es?h]Dju^]-LurVm74!5G/`s$$M`s$$M_rrG=arr3!@
-!<+&@5C`>*!!%TM!<;utp\u6UhuE]u5QCaj!5G/`h]G)_s1]Z5s8P:`TE"q at 5K!MO~>
-JcG-;!!)Wj!ad%arr3[^+5d+u?N at j5h]Es?h]Dju^]-LurVm74!5G/`s$$M`s$$M_rrG=arr3!@
-!<+&@5C`>*!!%TM!<;utp\u6UhuE]u5QCaj!5G/`h]G)_s1]Z5s8P:`TE"q at 5K!MO~>
-JcG-;!!)Wj!ad%arr3[^+5d+u?N at j5h]Es?h]Dju^]-LurVm74!5G/`s$$M`s$$M_rrG=arr3!@
-!<+&@5C`>*!!%TM!<;utp\u6UhuE]u5QCaj!5G/`h]G)_s1]Z5s8P:`TE"q at 5K!MO~>
-JcG0<r;cNj#Ci at Q5<g5shu<We^E4Q4s.99UIt%H*^RkK+J,]H`^E4Q4s.98kJ"H]@J,c,@!.Y%K
-^E4Qr!!#7Wrr<%Ms8W,t!;HNn!"hF;?f1n`^E4Q4s8Ut at +$X,irr3-d!+.rT?c)hn~>
-JcG0<r;cNj#Ci at Q5<g5shu<We^E4Q4s.99UIt%H*^RkK+J,]H`^E4Q4s.98kJ"H]@J,c,@!.Y%K
-^E4Qr!!#7Wrr<%Ms8W,t!;HNn!"hF;?f1n`^E4Q4s8Ut at +$X,irr3-d!+.rT?c)hn~>
-JcG0<r;cNj#Ci at Q5<g5shu<We^E4Q4s.99UIt%H*^RkK+J,]H`^E4Q4s.98kJ"H]@J,c,@!.Y%K
-^E4Qr!!#7Wrr<%Ms8W,t!;HNn!"hF;?f1n`^E4Q4s8Ut at +$X,irr3-d!+.rT?c)hn~>
-JcG<@q#J;3!C+?trrKk7pAY*mJcG`LrW(mV!C$Rus*t~>
-JcG<@q#J;3!C+?trrKk7pAY*mJcG`LrW(mV!C$Rus*t~>
-JcG<@q#J;3!C+?trrKk7pAY*mJcG`LrW(mV!C$Rus*t~>
-JcGHDo`2o0!Ik+IrrM"Ap](6nJcG`LrW(mV!C$Rus*t~>
-JcGHDo`2o0!Ik+IrrM"Ap](6nJcG`LrW(mV!C$Rus*t~>
-JcGHDo`2o0!Ik+IrrM"Ap](6nJcG`LrW(mV!C$Rus*t~>
-JcGTHo)Jjl!!'t;!ZqDlrVlnJht[6O!.k1Ks8;rVrrG=a^Ai]~>
-JcGTHo)Jjl!!'t;!ZqDlrVlnJht[6O!.k1Ks8;rVrrG=a^Ai]~>
-JcGTHo)Jjl!!'t;!ZqDlrVlnJht[6O!.k1Ks8;rVrrG=a^Ai]~>
-JcG`Lo)S[f!!'t;#2`c0+$X,)pAY*mJcGZJr;bjW".oPnJ%u#6~>
-JcG`Lo)S[f!!'t;#2`c0+$X,)pAY*mJcGZJr;bjW".oPnJ%u#6~>
-JcG`Lo)S[f!!'t;#2`c0+$X,)pAY*mJcGZJr;bjW".oPnJ%u#6~>
-K)bEBpAY*m[/U++JcGTHrW&JgJ,~>
-K)bEBpAY*m[/U++JcGTHrW&JgJ,~>
-K)bEBpAY*m[/U++JcGTHrW&JgJ,~>
-LB$iFnc&Rh[f6=-JcGQGrW&JgJ,~>
-LB$iFnc&Rh[f6=-JcGQGrW&JgJ,~>
-LB$iFnc&Rh[f6=-JcGQGrW&JgJ,~>
-MZ<8JmJm1d\GuR/JcGQGrW&JgJ,~>
-MZ<8JmJm1d\GuR/JcGQGrW&JgJ,~>
-MZ<8JmJm1d\GuR/JcGQGrW&JgJ,~>
-NW8VNkPkM^])Ma1JcGKEr;`DgJ,~>
-NW8VNkPkM^])Ma1JcGKEr;`DgJ,~>
-NW8VNkPkM^])Ma1JcGKEr;`DgJ,~>
-OT4tRirB#Y^An35JcGHDr;`DgJ,~>
-OT4tRirB#Y^An35JcGHDr;`DgJ,~>
-OT4tRirB#Y^An35JcGHDr;`DgJ,~>
-PQ1=Vh>dKT_#OE7JcGBBrW&MhJ,~>
-PQ1=Vh>dKT_#OE7JcGBBrW&MhJ,~>
-PQ1=Vh>dKT_#OE7JcGBBrW&MhJ,~>
-QN-XYf`1sO`;fi;JcG<@rW&MhJ,~>
-QN-XYf`1sO`;fi;JcG<@rW&MhJ,~>
-QN-XYf`1sO`;fi;JcG<@rW&MhJ,~>
-RK)s\e,TFJaT)8?JcG6>rW&MhJ,~>
-RK)s\e,TFJaT)8?JcG6>rW&MhJ,~>
-RK)s\e,TFJaT)8?JcG6>rW&MhJ,~>
-SH&9_cN!nEbl@\CJcG0<rW&MhJ,~>
-SH&9_cN!nEbl@\CJcG0<rW&MhJ,~>
-SH&9_cN!nEbl@\CJcG0<rW&MhJ,~>
-TE"TbaoD>?df91EJcG3=rW&MhJ,~>
-TE"TbaoD>?df91EJcG3=rW&MhJ,~>
-TE"TbaoD>?df91EJcG3=rW&MhJ,~>
-UAsoe_uK]9f`1pNs8VrrJcG9?rW&MhJ,~>
-UAsoe_uK]9f`1pNs8VrrJcG9?rW&MhJ,~>
-UAsoe_uK]9f`1pNs8VrrJcG9?rW&MhJ,~>
-V>p5h^&S$2i;``Ur;ZNlJcGBBrW&MhJ,~>
-V>p5h^&S$2i;``Ur;ZNlJcGBBrW&MhJ,~>
-V>p5h^&S$2i;``Ur;ZNlJcGBBrW&MhJ,~>
-W;lPk\,Z=*lMp_]q#C'gJcGHDr;`GhJ,~>
-W;lPk\,Z=*lMp_]q#C'gJcGHDr;`GhJ,~>
-W;lPk\,Z=*lMp_]q#C'gJcGHDr;`GhJ,~>
-X8hknYQ*edo)J at _JcGQGr;`GhJ,~>
-X8hknYQ*edo)J at _JcGQGr;`GhJ,~>
-X8hknYQ*edo)J at _JcGQGr;`GhJ,~>
-XoJ+qWW2qtqu6Wrjo=rQJcGTHrW&PiJ,~>
-XoJ+qWW2qtqu6Wrjo=rQJcGTHrW&PiJ,~>
-XoJ+qWW2qtqu6Wrjo=rQJcGTHrW&PiJ,~>
-YQ+ at tVuQ\qhZ*-HJcGZJrW&PiJ,~>
-YQ+ at tVuQ\qhZ*-HJcGZJrW&PiJ,~>
-YQ+ at tVuQ\qhZ*-HJcGZJrW&PiJ,~>
-Z2aV"V#UAnh>d'HJcGZJrW&PiJ,~>
-Z2aV"V#UAnh>d'HJcGZJrW&PiJ,~>
-Z2aV"V#UAnh>d'HJcGZJrW&PiJ,~>
-ZiBh$UAt2mg]-mGJcGZJrW&PiJ,~>
-ZiBh$UAt2mg]-mGJcGZJrW&PiJ,~>
-ZiBh$UAt2mg]-mGJcGZJrW&PiJ,~>
-[K$%&T`=ukgAgjHJcGWIrW&PiJ,~>
-[K$%&T`=ukgAgjHJcGWIrW&PiJ,~>
-[K$%&T`=ukgAgjHJcGWIrW&PiJ,~>
-\,Z7(T)\cig&LdHJcGWIrW&PiJ,~>
-\,Z7(T)\cig&LdHJcGWIrW&PiJ,~>
-\,Z7(T)\cig&LdHJcGWIrW&PiJ,~>
-\c;I*ScAWgf`1[GJcGZJrW&PiJ,~>
-\c;I*ScAWgf`1[GJcGZJrW&PiJ,~>
-\c;I*ScAWgf`1[GJcGZJrW&PiJ,~>
-])VU,S,`Eef`1XFJcG]KrW&PiJ,~>
-])VU,S,`Eef`1XFJcG]KrW&PiJ,~>
-])VU,S,`Eef`1XFJcG]KrW&PiJ,~>
-]`7g.RK*6df)PCCJcGcMrW&PiJ,~>
-]`7g.RK*6df)PCCJcGcMrW&PiJ,~>
-]`7g.RK*6df)PCCJcGcMrW&PiJ,~>
-^An$0QiI$bec5OI!<;orJcGZKT)X<~>
-^An$0QiI$bec5OI!<;orJcGZKT)X<~>
-^An$0QiI$bec5OI!<;orJcGZKT)X<~>
-^]4-1QN-paeGoLJrr;iqK)bcLT)X<~>
-^]4-1QN-paeGoLJrr;iqK)bcLT)X<~>
-^]4-1QN-paeGoLJrr;iqK)bcLT)X<~>
-_>j?3Q2gd_bl at S@KE(oNSc=3~>
-_>j?3Q2gd_bl at S@KE(oNSc=3~>
-_>j?3Q2gd_bl at S@KE(oNSc=3~>
-_Z0K5PQ1R]bQ%J?K`D#OSc=3~>
-_Z0K5PQ1R]bQ%J?K`D#OSc=3~>
-_Z0K5PQ1R]bQ%J?K`D#OSc=3~>
-_uKT6P5kL]aoD8=L&_,PSc=3~>
-_uKT6P5kL]aoD8=L&_,PSc=3~>
-_uKT6P5kL]aoD8=L&_,PSc=3~>
-`;f`8OT5:[aT)/<LB%5QSc=3~>
-`;f`8OT5:[aT)/<LB%5QSc=3~>
-`;f`8OT5:[aT)/<LB%5QSc=3~>
-`W,i9O8o1Za8c&;L]@>RSc=3~>
-`W,i9O8o1Za8c&;L]@>RSc=3~>
-`W,i9O8o1Za8c&;L]@>RSc=3~>
-`rGr:O8o.Y`rGr:M?!MSSc=3~>
-`rGr:O8o.Y`rGr:M?!MSSc=3~>
-`rGr:O8o.Y`rGr:M?!MSSc=3~>
-a8c&;NrT%X`W,i9MZ<VTSc=3~>
-a8c&;NrT%X`W,i9MZ<VTSc=3~>
-a8c&;NrT%X`W,i9MZ<VTSc=3~>
-aT)/<NW8tX_uKW7MuWbVSH"*~>
-aT)/<NW8tX_uKW7MuWbVSH"*~>
-aT)/<NW8tX_uKW7MuWbVSH"*~>
-aoD8=N;rkW_Z0Q7MuWbVSH"*~>
-aoD8=N;rkW_Z0Q7MuWbVSH"*~>
-aoD8=N;rkW_Z0Q7MuWbVSH"*~>
-b5_A>MuWbV_>jH6N;rkWSH"*~>
-b5_A>MuWbV_>jH6N;rkWSH"*~>
-b5_A>MuWbV_>jH6N;rkWSH"*~>
-bQ%J?MZ<YU_>jE5NrT%XSH"*~>
-bQ%J?MZ<YU_>jE5NrT%XSH"*~>
-bQ%J?MZ<YU_>jE5NrT%XSH"*~>
-bQ%M at M?!PT_#O<4O8o.YSH"*~>
-bQ%M at M?!PT_#O<4O8o.YSH"*~>
-bQ%M at M?!PT_#O<4O8o.YSH"*~>
-bl at VAM#[GS^]464O8o1ZS,\!~>
-bl at VAM#[GS^]464O8o1ZS,\!~>
-bl at VAM#[GS^]464O8o1ZS,\!~>
-bl at VAM#[GS^An04OT57ZS,\!~>
-bl at VAM#[GS^An04OT57ZS,\!~>
-bl at VAM#[GS^An04OT57ZS,\!~>
-c2[_BL]@>R^An-3OoP@[S,\!~>
-c2[_BL]@>R^An-3OoP@[S,\!~>
-c2[_BL]@>R^An-3OoP@[S,\!~>
-c2[_BL]@>R^An-3OoPC\Rf at m~>
-c2[_BL]@>R^An-3OoPC\Rf at m~>
-c2[_BL]@>R^An-3OoPC\Rf at m~>
-cN!hCL]@;Q^&S$2PQ1R]Rf at m~>
-cN!hCL]@;Q^&S$2PQ1R]Rf at m~>
-cN!hCL]@;Q^&S$2PQ1R]Rf at m~>
-cN!hCL]@;Q^&S$2PQ1R]Rf at m~>
-cN!hCL]@;Q^&S$2PQ1R]Rf at m~>
-cN!hCL]@;Q^&S$2PQ1R]Rf at m~>
-ci<qDLB%5Q]Dqj1PQ1U^RK%d~>
-ci<qDLB%5Q]Dqj1PQ1U^RK%d~>
-ci<qDLB%5Q]Dqj1PQ1U^RK%d~>
-ci<qDmf*<;5F_]P!87AShk*+tkPtM]cMmop5Pb<[Im;E^r;`8cJ,~>
-ci<qDmf*<;5F_]P!87AShk*+tkPtM]cMmop5Pb<[Im;E^r;`8cJ,~>
-ci<qDmf*<;5F_]P!87AShk*+tkPtM]cMmop5Pb<[Im;E^r;`8cJ,~>
-ci<tEmJd3:5F_]P!8.;QhZ,n(s8E#DrrIU6q>UJF5L]Z2!1Ek;~>
-ci<tEmJd3:5F_]P!8.;QhZ,n(s8E#DrrIU6q>UJF5L]Z2!1Ek;~>
-ci<tEmJd3:5F_]P!8.;QhZ,n(s8E#DrrIU6q>UJF5L]Z2!1Ek;~>
-ci<tEo)A]^cMmm:aoD>?fDbjO5Ni(G!6P6 at T?[E8!1<e:~>
-ci<tEo)A]^cMmm:aoD>?fDbjO5Ni(G!6P6 at T?[E8!1<e:~>
-ci<tEo)A]^cMmm:aoD>?fDbjO5Ni(G!6P6 at T?[E8!1<e:~>
-ci<tEoD\jK+4'rfh]Ku?rW(RM!<>@Is8E#@rrM"!cN!hCR/_[~>
-ci<tEoD\jK+4'rfh]Ku?rW(RM!<>@Is8E#@rrM"!cN!hCR/_[~>
-ci<tEoD\jK+4'rfh]Ku?rW(RM!<>@Is8E#@rrM"!cN!hCR/_[~>
-ci<tEoD\hU!71ZG56/h*rW(RM!<>@Is8E#@rrG=acN!hCR/_[~>
-ci<tEoD\hU!71ZG56/h*rW(RM!<>@Is8E#@rrG=acN!hCR/_[~>
-ci<tEoD\hU!71ZG56/h*rW(RM!<>@Is8E#@rrG=acN!hCR/_[~>
-ci<tEo`#\6*rnMis.<Wus*m65^L&')T>+_T+2 at gT"M[/c++O7h(#N at _+$\Z_T-"%ts1]WU5Q>(4
-!'`]ks8E#lrsZYL!5BU?s8Thu59GCRrrc[N+$[O<rrugp5CWYts8E!%+92@*!$Cb2rW)iq(;F2V
-^E5]?s1^c_++O=jhd7J_56)dtrVm&Y?U#Vshu<Wih`j=*!8mhVT3hTu?QT845Q@?_!<3!/hd8Si
-5MuM@^HV_U?QUB)kl:S]QiDR~>
-ci<tEo`#\6*rnMis.<Wus*m65^L&')T>+_T+2 at gT"M[/c++O7h(#N at _+$\Z_T-"%ts1]WU5Q>(4
-!'`]ks8E#lrsZYL!5BU?s8Thu59GCRrrc[N+$[O<rrugp5CWYts8E!%+92@*!$Cb2rW)iq(;F2V
-^E5]?s1^c_++O=jhd7J_56)dtrVm&Y?U#Vshu<Wih`j=*!8mhVT3hTu?QT845Q@?_!<3!/hd8Si
-5MuM@^HV_U?QUB)kl:S]QiDR~>
-ci<tEo`#\6*rnMis.<Wus*m65^L&')T>+_T+2 at gT"M[/c++O7h(#N at _+$\Z_T-"%ts1]WU5Q>(4
-!'`]ks8E#lrsZYL!5BU?s8Thu59GCRrrc[N+$[O<rrugp5CWYts8E!%+92@*!$Cb2rW)iq(;F2V
-^E5]?s1^c_++O=jhd7J_56)dtrVm&Y?U#Vshu<Wih`j=*!8mhVT3hTu?QT845Q@?_!<3!/hd8Si
-5MuM@^HV_U?QUB)kl:S]QiDR~>
-ci<tEoD\hU!<)pN561``*rqr5hZ+aJs8O0*s8UsVTE!dKTE"rK+.rT559Je_hZ,n at s5*f at s8P:`
-aoD>?pAYlB*rqp_?iT!`TE!dKTE"q@!8meu+8u3H5@=Hj?N<=j^An94rr=/1s8E#qs!b])!2"aJ
-s5*gKs5*gKs5+mu?ba>t!5JR6h]JKjs$%U_s8P=@s5+pUrr3-d!<<'`!<)p3561``h]JKjs$%U_
-s8P:`TE"p5+6`b'!13_9~>
-ci<tEoD\hU!<)pN561``*rqr5hZ+aJs8O0*s8UsVTE!dKTE"rK+.rT559Je_hZ,n at s5*f at s8P:`
-aoD>?pAYlB*rqp_?iT!`TE!dKTE"q@!8meu+8u3H5@=Hj?N<=j^An94rr=/1s8E#qs!b])!2"aJ
-s5*gKs5*gKs5+mu?ba>t!5JR6h]JKjs$%U_s8P=@s5+pUrr3-d!<<'`!<)p3561``h]JKjs$%U_
-s8P:`TE"p5+6`b'!13_9~>
-ci<tEoD\hU!<)pN561``*rqr5hZ+aJs8O0*s8UsVTE!dKTE"rK+.rT559Je_hZ,n at s5*f at s8P:`
-aoD>?pAYlB*rqp_?iT!`TE!dKTE"q@!8meu+8u3H5@=Hj?N<=j^An94rr=/1s8E#qs!b])!2"aJ
-s5*gKs5*gKs5+mu?ba>t!5JR6h]JKjs$%U_s8P=@s5+pUrr3-d!<<'`!<)p3561``h]JKjs$%U_
-s8P:`TE"p5+6`b'!13_9~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8QFJrr3-d+92 at j+9)9EhZ.$`rr>:_rriBes8P:`
-aoD;>pAY1Y!8meU!FHrJrs:n3s8RQjs8P:`rr3"k!<3!+hZ,n at s*k$@s8S^@nGiIfqYpU]!8meU
-!FHrJrsq=9s8P:`huE_k!'gM`Iin[i$Jthjs8N)6s8S_Krr3-d!<<'`!<)p$561``Iin[i#2]Df
-s8P:`rr3!`!9sO^!1*Y8~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8QFJrr3-d+92 at j+9)9EhZ.$`rr>:_rriBes8P:`
-aoD;>pAY1Y!8meU!FHrJrs:n3s8RQjs8P:`rr3"k!<3!+hZ,n at s*k$@s8S^@nGiIfqYpU]!8meU
-!FHrJrsq=9s8P:`huE_k!'gM`Iin[i$Jthjs8N)6s8S_Krr3-d!<<'`!<)p$561``Iin[i#2]Df
-s8P:`rr3!`!9sO^!1*Y8~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8QFJrr3-d+92 at j+9)9EhZ.$`rr>:_rriBes8P:`
-aoD;>pAY1Y!8meU!FHrJrs:n3s8RQjs8P:`rr3"k!<3!+hZ,n at s*k$@s8S^@nGiIfqYpU]!8meU
-!FHrJrsq=9s8P:`huE_k!'gM`Iin[i$Jthjs8N)6s8S_Krr3-d!<<'`!<)p$561``Iin[i#2]Df
-s8P:`rr3!`!9sO^!1*Y8~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8O/@r]gE)s8N*A5Q1W^+92?A!'gJ_"TUdes$$M*
-s8;rkrrG=arVlm?!<,4_+8l-?Iie[is8P=^rsA`js8UsV5QCaJhsg[F!;c]r561Z^!?V=@5Q;i*
-rrG=arVm$C!<<'@5Q1W^+92?C56-2jr;Qpb!<<'`!<)p$561``+$]`(ru_:@!C$S`rrG=al2U\^
-QN)I~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8O/@r]gE)s8N*A5Q1W^+92?A!'gJ_"TUdes$$M*
-s8;rkrrG=arVlm?!<,4_+8l-?Iie[is8P=^rsA`js8UsV5QCaJhsg[F!;c]r561Z^!?V=@5Q;i*
-rrG=arVm$C!<<'@5Q1W^+92?C56-2jr;Qpb!<<'`!<)p$561``+$]`(ru_:@!C$S`rrG=al2U\^
-QN)I~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8O/@r]gE)s8N*A5Q1W^+92?A!'gJ_"TUdes$$M*
-s8;rkrrG=arVlm?!<,4_+8l-?Iie[is8P=^rsA`js8UsV5QCaJhsg[F!;c]r561Z^!?V=@5Q;i*
-rrG=arVm$C!<<'@5Q1W^+92?C56-2jr;Qpb!<<'`!<)p$561``+$]`(ru_:@!C$S`rrG=al2U\^
-QN)I~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8N'`qYpQr5Q1Tc561``!'gJ_"TUdes$$M)s8E#l
-rrG=arVllu5Pb<^^H^U?!<3!!!'gG^!<>@`rrdfO^Y_9Es8E#prrG=arVllu5PkB\561Z^"[<"e
-rr>:^rs1ghs8Ut@!!$C)rrkUes8P:`rVm$c!<<'!5Q1Tc561``561]_!C$SLs8;q_s*t~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8N'`qYpQr5Q1Tc561``!'gJ_"TUdes$$M)s8E#l
-rrG=arVllu5Pb<^^H^U?!<3!!!'gG^!<>@`rrdfO^Y_9Es8E#prrG=arVllu5PkB\561Z^"[<"e
-rr>:^rs1ghs8Ut@!!$C)rrkUes8P:`rVm$c!<<'!5Q1Tc561``561]_!C$SLs8;q_s*t~>
-ci<tEoD\hU!<)p$561``561]_!C$S`rrkUes8N'`qYpQr5Q1Tc561``!'gJ_"TUdes$$M)s8E#l
-rrG=arVllu5Pb<^^H^U?!<3!!!'gG^!<>@`rrdfO^Y_9Es8E#prrG=arVllu5PkB\561Z^"[<"e
-rr>:^rs1ghs8Ut@!!$C)rrkUes8P:`rVm$c!<<'!5Q1Tc561``561]_!C$SLs8;q_s*t~>
-ci<qDo`"qV!<)p$561``561]_!C$S`rrt[fs8O/@hu<WYhuE]u+8u3C59Kq*!'gJ_"TUdes$$M)
-s8E#lrrG=arVlp@!8meU#iG[^T)ddK561]_!<=5?rrE*arr3,Y!+15Jn,N at eqYpR\!<)p!*rt3t
-rrh6Zs$$M^rrkV/s8O/_rVlm_+8u3AT-"%trr3-d!<<'`!<)p$561``+!:I]"[=+/s$$M_rrG=a
-li6k_Q2c@~>
-ci<qDo`"qV!<)p$561``561]_!C$S`rrt[fs8O/@hu<WYhuE]u+8u3C59Kq*!'gJ_"TUdes$$M)
-s8E#lrrG=arVlp@!8meU#iG[^T)ddK561]_!<=5?rrE*arr3,Y!+15Jn,N at eqYpR\!<)p!*rt3t
-rrh6Zs$$M^rrkV/s8O/_rVlm_+8u3AT-"%trr3-d!<<'`!<)p$561``+!:I]"[=+/s$$M_rrG=a
-li6k_Q2c@~>
-ci<qDo`"qV!<)p$561``561]_!C$S`rrt[fs8O/@hu<WYhuE]u+8u3C59Kq*!'gJ_"TUdes$$M)
-s8E#lrrG=arVlp@!8meU#iG[^T)ddK561]_!<=5?rrE*arr3,Y!+15Jn,N at eqYpR\!<)p!*rt3t
-rrh6Zs$$M^rrkV/s8O/_rVlm_+8u3AT-"%trr3-d!<<'`!<)p$561``+!:I]"[=+/s$$M_rrG=a
-li6k_Q2c@~>
-ci<qDo`"qV!<)p$561``561]_!C$S`rsq<os8QF+5MuLu?iU.5!5JO5"Wr6orr>:_rriBes8P:`
-aT)5>pAY.X!<)p-?N<=Js5.2`ruXK*s$$M_rrPCbhu<WV!'gG^!e127mf37dqYpR\!<)p)?N<=J
-s5.2`s$$M^rrrIQs8QF+^]+6>++O=jJ,fQ+*ru<?"[<"es$$M^rrt[fs8QF+^]+6:++O=j561]_
-!C$SMs8;q^s*t~>
-ci<qDo`"qV!<)p$561``561]_!C$S`rsq<os8QF+5MuLu?iU.5!5JO5"Wr6orr>:_rriBes8P:`
-aT)5>pAY.X!<)p-?N<=Js5.2`ruXK*s$$M_rrPCbhu<WV!'gG^!e127mf37dqYpR\!<)p)?N<=J
-s5.2`s$$M^rrrIQs8QF+^]+6>++O=jJ,fQ+*ru<?"[<"es$$M^rrt[fs8QF+^]+6:++O=j561]_
-!C$SMs8;q^s*t~>
-ci<qDo`"qV!<)p$561``561]_!C$S`rsq<os8QF+5MuLu?iU.5!5JO5"Wr6orr>:_rriBes8P:`
-aT)5>pAY.X!<)p-?N<=Js5.2`ruXK*s$$M_rrPCbhu<WV!'gG^!e127mf37dqYpR\!<)p)?N<=J
-s5.2`s$$M^rrrIQs8QF+^]+6>++O=jJ,fQ+*ru<?"[<"es$$M^rrt[fs8QF+^]+6:++O=j561]_
-!C$SMs8;q^s*t~>
-cN!hCp&>D,!5G/`s$$M`s$$M_rrG=arr3*c!<<)VrW!o[!5JR6h]G)_s1]Z5s8P:`^V>6u+2 at h_
-!5G/`bQ%PApAY.X!<)othu3Tj*rs(UruW?_h]Dju^]2%K5QCbu!$D1>!oEubmf37dqYpR\!<)ot
-hu3T`*rs(Us$$LUs8RR5rr3Md+$]f*^E;A5ru^.uruXK)ru"$$s8QF+^RsE`561``h]G)_s1]Z5
-s8P:`rr3!`!:9aa!0dG5~>
-cN!hCp&>D,!5G/`s$$M`s$$M_rrG=arr3*c!<<)VrW!o[!5JR6h]G)_s1]Z5s8P:`^V>6u+2 at h_
-!5G/`bQ%PApAY.X!<)othu3Tj*rs(UruW?_h]Dju^]2%K5QCbu!$D1>!oEubmf37dqYpR\!<)ot
-hu3T`*rs(Us$$LUs8RR5rr3Md+$]f*^E;A5ru^.uruXK)ru"$$s8QF+^RsE`561``h]G)_s1]Z5
-s8P:`rr3!`!:9aa!0dG5~>
-cN!hCp&>D,!5G/`s$$M`s$$M_rrG=arr3*c!<<)VrW!o[!5JR6h]G)_s1]Z5s8P:`^V>6u+2 at h_
-!5G/`bQ%PApAY.X!<)othu3Tj*rs(UruW?_h]Dju^]2%K5QCbu!$D1>!oEubmf37dqYpR\!<)ot
-hu3T`*rs(Us$$LUs8RR5rr3Md+$]f*^E;A5ru^.uruXK)ru"$$s8QF+^RsE`561``h]G)_s1]Z5
-s8P:`rr3!`!:9aa!0dG5~>
-cN!hCp&?&I+!88tT)\k at T)\k at s.98kJ,c,@!.Y%K^HV]?TDecnh`i2I?f1k_%)3ka?iL+5^]2%j
-+2>turW)]m".oPnJ,TBM^HV]?TDnj&T)_**IfNijs8ThU+((W?5G.oS!FNV0s8E#qrr\kn!.XtI
-"M[/$+.rQ4"[;uo5<iNQrrq:E+$X,irr;uu-9iSZhuE_K!!%NK^E4Q4s.98kJ,fQ+59E*shuE_K
-!!%NKT)\k at mJm+bPQ-.~>
-cN!hCp&?&I+!88tT)\k at T)\k at s.98kJ,c,@!.Y%K^HV]?TDecnh`i2I?f1k_%)3ka?iL+5^]2%j
-+2>turW)]m".oPnJ,TBM^HV]?TDnj&T)_**IfNijs8ThU+((W?5G.oS!FNV0s8E#qrr\kn!.XtI
-"M[/$+.rQ4"[;uo5<iNQrrq:E+$X,irr;uu-9iSZhuE_K!!%NK^E4Q4s.98kJ,fQ+59E*shuE_K
-!!%NKT)\k at mJm+bPQ-.~>
-cN!hCp&?&I+!88tT)\k at T)\k at s.98kJ,c,@!.Y%K^HV]?TDecnh`i2I?f1k_%)3ka?iL+5^]2%j
-+2>turW)]m".oPnJ,TBM^HV]?TDnj&T)_**IfNijs8ThU+((W?5G.oS!FNV0s8E#qrr\kn!.XtI
-"M[/$+.rQ4"[;uo5<iNQrrq:E+$X,irr;uu-9iSZhuE_K!!%NK^E4Q4s.98kJ,fQ+59E*shuE_K
-!!%NKT)\k at mJm+bPQ-.~>
-c2[_BL]@>RdJj22mJm.cli-uM!42_(!0[A4~>
-c2[_BL]@>RdJj22mJm.cli-uM!42_(!0[A4~>
-c2[_BL]@>RdJj22mJm.cli-uM!42_(!0[A4~>
-c2[\AM#[GSdf9>smJm.cli-uM!4;e(!0[A4~>
-c2[\AM#[GSdf9>smJm.cli-uM!4;e(!0[A4~>
-c2[\AM#[GSdf9>smJm.cli-uM!4;e(!0[A4~>
-bl at VAM#[DRf)Gh:!!",-s8E#arrG=a[/^()OoKq~>
-bl at VAM#[DRf)Gh:!!",-s8E#arrG=a[/^()OoKq~>
-bl at VAM#[DRf)Gh:!!",-s8E#arrG=a[/^()OoKq~>
-bQ%M at M?!MSf)GhZ!+4XNs8;rarr\kn!.VHWr;_rZJ,~>
-bQ%M at M?!MSf)GhZ!+4XNs8;rarr\kn!.VHWr;_rZJ,~>
-bQ%M at M?!MSf)GhZ!+4XNs8;rarr\kn!.VHWr;_rZJ,~>
-bQ%M at M#[DR^]464ScAWgOT0h~>
-bQ%M at M#[DR^]464ScAWgOT0h~>
-bQ%M at M#[DR^]464ScAWgOT0h~>
-b5_D?M?!MS_#O?5ScAWgO8j_~>
-b5_D?M?!MS_#O?5ScAWgO8j_~>
-b5_D?M?!MS_#O?5ScAWgO8j_~>
-b5_A>M?!PT_#O?5T)\]gO8j_~>
-b5_A>M?!PT_#O?5T)\]gO8j_~>
-b5_A>M?!PT_#O?5T)\]gO8j_~>
-aoD8=MZ<YU_#OB6ScAWgNrOV~>
-aoD8=MZ<YU_#OB6ScAWgNrOV~>
-aoD8=MZ<YU_#OB6ScAWgNrOV~>
-aT)/<MuW_U_Z0Q7T)\`hNW4M~>
-aT)/<MuW_U_Z0Q7T)\`hNW4M~>
-aT)/<MuW_U_Z0Q7T)\`hNW4M~>
-a8c#:NW8qW_Z0Q7TE"fhNW4M~>
-a8c#:NW8qW_Z0Q7TE"fhNW4M~>
-a8c#:NW8qW_Z0Q7TE"fhNW4M~>
-`rGl8NrT%X_uK]9TE"fhN;nD~>
-`rGl8NrT%X_uK]9TE"fhN;nD~>
-`rGl8NrT%X_uK]9TE"fhN;nD~>
-`W,`6OT57Z`;fc9TE"iiMuS;~>
-`W,`6OT57Z`;fc9TE"iiMuS;~>
-`W,`6OT57Z`;fc9TE"iiMuS;~>
-_uKN4OoP@[`W,l:T`=rjMZ82~>
-_uKN4OoP@[`W,l:T`=rjMZ82~>
-_uKN4OoP@[`W,l:T`=rjMZ82~>
-_>j<2PQ1R]`rGu;T`=oiMZ82~>
-_>j<2PQ1R]`rGu;T`=oiMZ82~>
-_>j<2PQ1R]`rGu;T`=oiMZ82~>
-^]4'/Q2gd_a8c)<U&Y#jM>r)~>
-^]4'/Q2gd_a8c)<U&Y#jM>r)~>
-^]4'/Q2gd_a8c)<U&Y#jM>r)~>
-^&Rg,R/d*baT)2=T`=rjM#Vu~>
-^&Rg,R/d*baT)2=T`=rjM#Vu~>
-^&Rg,R/d*baT)2=T`=rjM#Vu~>
-]DqR)RfE<ds8W&ucN!hCU&Y&kL];l~>
-]DqR)RfE<ds8W&ucN!hCU&Y&kL];l~>
-]DqR)RfE<ds8W&ucN!hCU&Y&kL];l~>
-\Gu:'SH&?aci<qDU&Y#jL];l~>
-\Gu:'SH&?aci<qDU&Y#jL];l~>
-\Gu:'SH&?aci<qDU&Y#jL];l~>
-[K#t$T)\Qcd/X%EUAt,kLAuc~>
-[K#t$T)\Qcd/X%EUAt,kLAuc~>
-[K#t$T)\Qcd/X%EUAt,kLAuc~>
-ZN'Y!T`=ffdJs.FUAt,kL&ZZ~>
-ZN'Y!T`=ffdJs.FUAt,kL&ZZ~>
-ZN'Y!T`=ffdJs.FUAt,kL&ZZ~>
-YlFCsV#U/hdf97GV#U;lK`?Q~>
-YlFCsV#U/hdf97GV#U;lK`?Q~>
-YlFCsV#U/hdf97GV#U;lK`?Q~>
-XoJ(pW;lPke,T at HV#U;lKE$H~>
-XoJ(pW;lPke,T at HV#U;lKE$H~>
-XoJ(pW;lPke,T at HV#U;lKE$H~>
-WrMbmX8hkne,T at HV>pDmK)^?~>
-WrMbmX8hkne,T at HV>pDmK)^?~>
-WrMbmX8hkne,T at HV>pDmK)^?~>
-VuQGjY5e.pec5RJV>pGnJc>`MJ,~>
-VuQGjY5e.pec5RJV>pGnJc>`MJ,~>
-VuQGjY5e.pec5RJV>pGnJc>`MJ,~>
-V#U,gYlFCsec5RJVZ6PoJcGcMJ,~>
-V#U,gYlFCsec5RJVZ6PoJcGcMJ,~>
-V#U,gYlFCsec5RJVZ6PoJcGcMJ,~>
-U&XccZiBb"f)P[KVZ6PoJcG`LJ,~>
-U&XccZiBb"f)P[KVZ6PoJcG`LJ,~>
-U&XccZiBb"f)P[KVZ6PoJcG`LJ,~>
-T)\H`[K#t$fDkdLVuQYpJcG]KJ,~>
-T)\H`[K#t$fDkdLVuQYpJcG]KJ,~>
-T)\H`[K#t$fDkdLVuQYpJcG]KJ,~>
-S,`-]\,Z4'f`1mMW;l_pJcGZJJ,~>
-S,`-]\,Z4'f`1mMW;l_pJcGZJJ,~>
-S,`-]\,Z4'f`1mMW;l_pJcGZJJ,~>
-QiHaZ\c;F)gAh'NWW2hqJcGWIJ,~>
-QiHaZ\c;F)gAh'NWW2hqJcGWIJ,~>
-QiHaZ\c;F)gAh'NWW2hqJcGWIJ,~>
-PlLCV]`7d-g].0OWW2hqJcGTHJ,~>
-PlLCV]`7d-g].0OWW2hqJcGTHJ,~>
-PlLCV]`7d-g].0OWW2hqJcGTHJ,~>
-OoP(S^&Rs0mf*7en,N=dWW2krJcGNFJ,~>
-OoP(S^&Rs0mf*7en,N=dWW2krJcGNFJ,~>
-OoP(S^&Rs0mf*7en,N=dWW2krJcGNFJ,~>
-NrS_O_#O93qZ#g\qu?TpWrMqrJcGKEJ,~>
-NrS_O_#O93qZ#g\qu?TpWrMqrJcGKEJ,~>
-NrS_O_#O93qZ#g\qu?TpWrMqrJcGKEJ,~>
-MZ<;K_uKW7s8VuslMpSYXT/+sJcGHDJ,~>
-MZ<;K_uKW7s8VuslMpSYXT/+sJcGHDJ,~>
-MZ<;K_uKW7s8VuslMpSYXT/+sJcGHDJ,~>
-L]?oFa8c#:i;``UXoJ1sJcGECJ,~>
-L]?oFa8c#:i;``UXoJ1sJcGECJ,~>
-L]?oFa8c#:i;``UXoJ1sJcGECJ,~>
-KE(KBbQ%M at hZ*HQZ2aV"JcG?AJ,~>
-KE(KBbQ%M at hZ*HQZ2aV"JcG?AJ,~>
-KE(KBbQ%M at hZ*HQZ2aV"JcG?AJ,~>
-JcGcMo)R2<rW(IJrW'G-p],mFnc++~>
-JcGcMo)R2<rW(IJrW'G-p],mFnc++~>
-JcGcMo)R2<rW(IJrW'G-p],mFnc++~>
-JcGTHoDnO`rW)-]rW(=FrW'S1p],mFn,In~>
-JcGTHoDnO`rW)-]rW(=FrW'S1p],mFn,In~>
-JcGTHoDnO`rW)-]rW(=FrW'S1p],mFn,In~>
-JcGHDo`4adquH'_rrC4ArrBh6p],mFmJh\~>
-JcGHDo`4adquH'_rrC4ArrBh6p],mFmJh\~>
-JcGHDo`4adquH'_rrC4ArrBh6p],mFmJh\~>
-JcG?AoDndgq>g!arW(%>rW'k9q#H!GlMlA~>
-JcG?AoDndgq>g!arW(%>rW'k9q#H!GlMlA~>
-JcG?AoDndgq>g!arW(%>rW'k9q#H!GlMlA~>
-JcG3=oDnpkp]0mbrrC";rrC.?pAfdEkl6/~>
-JcG3=oDnpkp]0mbrrC";rrC.?pAfdEkl6/~>
-JcG3=oDnpkp]0mbrrC";rrC.?pAfdEkl6/~>
-JcG*:l2^MW!!'h7!!(:Do`0RCk5Tr~>
-JcG*:l2^MW!!'h7!!(:Do`0RCk5Tr~>
-JcG*:l2^MW!!'h7!!(:Do`0RCk5Tr~>
-JcFs6li?k]rrBe5rrC[Nmf7q=jSs`~>
-JcFs6li?k]rrBe5rrC[Nmf7q=jSs`~>
-JcFs6li?k]rrBe5rrC[Nmf7q=jSs`~>
-JcFg2mK!1brrB_3rrCsVli;V:i;\<~>
-JcFg2mK!1brrB_3rrCsVli;V:i;\<~>
-JcFg2mK!1brrB_3rrCsVli;V:i;\<~>
-JcF^/mf<CfrrBY1rrD0\lMuM9h#Dm~>
-JcF^/mf<CfrrBY1rrD0\lMuM9h#Dm~>
-JcF^/mf<CfrrBY1rrD0\lMuM9h#Dm~>
-JcF^/li=QqrrDKelMuM9eGk%~>
-JcF^/li=QqrrDKelMuM9eGk%~>
-JcF^/li=QqrrDKelMuM9eGk%~>
-JcF^/m/XTp!!)cnkl?;7c2W:~>
-JcF^/m/XTp!!)cnkl?;7c2W:~>
-JcF^/m/XTp!!)cnkl?;7c2W:~>
-JcF^/m/XTprrE&ukQ$26aT$b~>
-JcF^/m/XTprrE&ukQ$26aT$b~>
-JcF^/m/XTprrE&ukQ$26aT$b~>
-JcF*srrCsV!M:J5rrJ`6rr3"K5N;_0!.k0cs*t~>
-JcF*srrCsV!M:J5rrJ`6rr3"K5N;_0!.k0cs*t~>
-JcF*srrCsV!M:J5rrJ`6rr3"K5N;_0!.k0cs*t~>
-JcF*s!!)`m!'gA]!Zte,oD]%[!!*'!56(]_rrIU6iW&TOJcE4ZJ,~>
-JcF*s!!)`m!'gA]!Zte,oD]%[!!*'!56(]_rrIU6iW&TOJcE4ZJ,~>
-JcF*s!!)`m!'gA]!Zte,oD]%[!!*'!56(]_rrIU6iW&TOJcE4ZJ,~>
-JcF*s!!)]l#i>VHhqt%J!8mDJ!?V=@rrF2Ah#I9PJcE"TJ,~>
-JcF*s!!)]l#i>VHhqt%J!8mDJ!?V=@rrF2Ah#I9PJcE"TJ,~>
-JcF*s!!)]l#i>VHhqt%J!8mDJ!?V=@rrF2Ah#I9PJcE"TJ,~>
-JcF-t!!)Wj!<>@`rrTq8?h=9u561]_!C$S=rr<%Ms/uBP~>
-JcF-t!!)Wj!<>@`rrTq8?h=9u561]_!C$S=rr<%Ms/uBP~>
-JcF-t!!)Wj!<>@`rrTq8?h=9u561]_!C$S=rr<%Ms/uBP~>
-JcF-t!!)Wj!<>@_rrE*aoD\hU!<3!!560I<!!%TMY5a"~>
-JcF-t!!)Wj!<>@_rrE*aoD\hU!<3!!560I<!!%TMY5a"~>
-JcF-t!!)Wj!<>@_rrE*aoD\hU!<3!!560I<!!%TMY5a"~>
-JcF-t!!)Wj!<>@`rrTq8J,TBNhd8Si5MuG>!C$S`rsq<os8S]u!<9eu!8h-*+2 at dS#(I^Z!!#5J
-o`"mkJcDnQJ,~>
-JcF-t!!)Wj!<>@`rrTq8J,TBNhd8Si5MuG>!C$S`rsq<os8S]u!<9eu!8h-*+2 at dS#(I^Z!!#5J
-o`"mkJcDnQJ,~>
-JcF-t!!)Wj!<>@`rrTq8J,TBNhd8Si5MuG>!C$S`rsq<os8S]u!<9eu!8h-*+2 at dS#(I^Z!!#5J
-o`"mkJcDnQJ,~>
-JcF-t!!)Wj"opmfs.:AtrVm,[+.rT559Je^rrG=arr3!`!<3!*561``56.>UruW?^rrugPhuA0+
-J+N[?!.k0Qs*t~>
-JcF-t!!)Wj"opmfs.:AtrVm,[+.rT559Je^rrG=arr3!`!<3!*561``56.>UruW?^rrugPhuA0+
-J+N[?!.k0Qs*t~>
-JcF-t!!)Wj"opmfs.:AtrVm,[+.rT559Je^rrG=arr3!`!<3!*561``56.>UruW?^rrugPhuA0+
-J+N[?!.k0Qs*t~>
-JcF0urrDZj"TTW/!$AuRrrITkrr3&W!+5a*!C$S`rrG=arr3-d!<<'`!<3!!561]_"opmfs5*f@
-oDegjJcDqRJ,~>
-JcF0urrDZj"TTW/!$AuRrrITkrr3&W!+5a*!C$S`rrG=arr3-d!<<'`!<3!!561]_"opmfs5*f@
-oDegjJcDqRJ,~>
-JcF0urrDZj"TTW/!$AuRrrITkrr3&W!+5a*!C$S`rrG=arr3-d!<<'`!<3!!561]_"opmfs5*f@
-oDegjJcDqRJ,~>
-JcF-t!!)Wj"TUde*rqr2rrF3+rVum>rr3!`!<3!!561]_"[<"es$$M_rrG=arr<!?rr3!!?h=9t
-!.k0Qs*t~>
-JcF-t!!)Wj"TUde*rqr2rrF3+rVum>rr3!`!<3!!561]_"[<"es$$M_rrG=arr<!?rr3!!?h=9t
-!.k0Qs*t~>
-JcF-t!!)Wj"TUde*rqr2rrF3+rVum>rr3!`!<3!!561]_"[<"es$$M_rrG=arr<!?rr3!!?h=9t
-!.k0Qs*t~>
-JcF-t!!)Wj"opmfhZ*Z6rVllu5Q1T_561]_!C$S`rrG=arr3-d!<<'`!<3!!561]_#/:/Qs.9;K
-oD\djJcDnQJ,~>
-JcF-t!!)Wj"opmfhZ*Z6rVllu5Q1T_561]_!C$S`rrG=arr3-d!<<'`!<3!!561]_#/:/Qs.9;K
-oD\djJcDnQJ,~>
-JcF-t!!)Wj"opmfhZ*Z6rVllu5Q1T_561]_!C$S`rrG=arr3-d!<<'`!<3!!561]_#/:/Qs.9;K
-oD\djJcDnQJ,~>
-JcF-t!!)Wj"opmfs.99UrVum>rVlm_+9)9 at 561]_!C$S`rrkUes8P:`rr3!`!<)otJ,VY4^[hC)
-!.k0Qs*t~>
-JcF-t!!)Wj"opmfs.99UrVum>rVlm_+9)9 at 561]_!C$S`rrkUes8P:`rr3!`!<)otJ,VY4^[hC)
-!.k0Qs*t~>
-JcF-t!!)Wj"opmfs.99UrVum>rVlm_+9)9 at 561]_!C$S`rrkUes8P:`rr3!`!<)otJ,VY4^[hC)
-!.k0Qs*t~>
-JcF-t!!)Wj!<>@`rrQO-J,]HL?N at k?rrF3krr3!`!<3!!561]_"[<"es$$M_rrG=arr3"KhsULE
-!.k0Qs*t~>
-JcF-t!!)Wj!<>@`rrQO-J,]HL?N at k?rrF3krr3!`!<3!!561]_"[<"es$$M_rrG=arr3"KhsULE
-!.k0Qs*t~>
-JcF-t!!)Wj!<>@`rrQO-J,]HL?N at k?rrF3krr3!`!<3!!561]_"[<"es$$M_rrG=arr3"KhsULE
-!.k0Qs*t~>
-JcF*s!!)]l!oEu"rr3Gb*rqr5s5+n_s8ThUhu<WV561]_!C$S`rrkUes8P:`rr3!`!<3!!*ru9^
-!C))+rr<%Ms/l<O~>
-JcF*s!!)]l!oEu"rr3Gb*rqr5s5+n_s8ThUhu<WV561]_!C$S`rrkUes8P:`rr3!`!<3!!*ru9^
-!C))+rr<%Ms/l<O~>
-JcF*s!!)]l!oEu"rr3Gb*rqr5s5+n_s8ThUhu<WV561]_!C$S`rrkUes8P:`rr3!`!<3!!*ru9^
-!C))+rr<%Ms/l<O~>
-JcF*s!!)`m!'gG_!$D4?$blZA+5d+U59E*shu<WpT)\k at s.98kJ,c,@!.UU@!.Y$@!!%NKs1]Wt
-r;Zg^p&>!lJcDkPJ,~>
-JcF*s!!)`m!'gG_!$D4?$blZA+5d+U59E*shu<WpT)\k at s.98kJ,c,@!.UU@!.Y$@!!%NKs1]Wt
-r;Zg^p&>!lJcDkPJ,~>
-JcF*s!!)`m!'gG_!$D4?$blZA+5d+U59E*shu<WpT)\k at s.98kJ,c,@!.UU@!.Y$@!!%NKs1]Wt
-r;Zg^p&>!lJcDkPJ,~>
-JcF*srrC+>!C+?trrKk7pAb-mJcDkPJ,~>
-JcF*srrC+>!C+?trrKk7pAb-mJcDkPJ,~>
-JcF*srrC+>!C+?trrKk7pAb-mJcDkPJ,~>
-JcF'rrrC1@!Ik+IrrM"Ap](6nJcDhOJ,~>
-JcF'rrrC1@!Ik+IrrM"Ap](6nJcDhOJ,~>
-JcF'rrrC1@!Ik+IrrM"Ap](6nJcDhOJ,~>
-JcF$q!!(.@!ZqDlrVlnJhtR-N!.k0Ns*t~>
-JcF$q!!(.@!ZqDlrVlnJhtR-N!.k0Ns*t~>
-JcF$q!!(.@!ZqDlrVlnJhtR-N!.k0Ns*t~>
-JcF$qrrC4A#2`c0+$X,)pAb-mJcDeNJ,~>
-JcF$qrrC4A#2`c0+$X,)pAb-mJcDeNJ,~>
-JcF$qrrC4A#2`c0+$X,)pAb-mJcDeNJ,~>
-JcF!prrBY1rr at WMWrIS~>
-JcF!prrBY1rr at WMWrIS~>
-JcF!prrBY1rr at WMWrIS~>
-JcEsorrB_3rr at WMWW.J~>
-JcEsorrB_3rr at WMWW.J~>
-JcEsorrB_3rr at WMWW.J~>
-JcEpnrrBe5rr at WMW;hA~>
-JcEpnrrBe5rr at WMW;hA~>
-JcEpnrrBe5rr at WMW;hA~>
-JcEjl!!'h7!!%TMVZ2/~>
-JcEjl!!'h7!!%TMVZ2/~>
-JcEjl!!'h7!!%TMVZ2/~>
-JcEgkrrC";rr at WMV>l&~>
-JcEgkrrC";rr at WMV>l&~>
-JcEgkrrC";rr at WMV>l&~>
-JcEdjrW(%>rW%NLV#Pr~>
-JcEdjrW(%>rW%NLV#Pr~>
-JcEdjrW(%>rW%NLV#Pr~>
-JcE^hrrC4Arr at WMUAo`~>
-JcE^hrrC4Arr at WMUAo`~>
-JcE^hrrC4Arr at WMUAo`~>
-JcEXfrW(=FrW%NLT`9N~>
-JcEXfrW(=FrW%NLT`9N~>
-JcEXfrW(=FrW%NLT`9N~>
-JcERdrW(IJrW%NLT)X<~>
-JcERdrW(IJrW%NLT)X<~>
-JcERdrW(IJrW%NLT)X<~>
-JcEIarW([PrW%NLS,\!~>
-JcEIarW([PrW%NLS,\!~>
-JcEIarW([PrW%NLS,\!~>
-JcE@^rW(mVrW%NLR/_[~>
-JcE@^rW(mVrW%NLR/_[~>
-JcE@^rW(mVrW%NLR/_[~>
-JcE7[quH$^quD<JQ2c@~>
-JcE7[quH$^quD<JQ2c@~>
-JcE7[quH$^quD<JQ2c@~>
-JcE(Vl2ZD8OT0h~>
-JcE(Vl2ZD8OT0h~>
-JcE(Vl2ZD8OT0h~>
-JcD\K!!%TML&ZZ~>
-JcD\K!!%TML&ZZ~>
-JcD\K!!%TML&ZZ~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-JcC<$JcDeNJ,~>
-%%EndData
-showpage
-%%Trailer
-end
-%%EOF
diff --git a/doc/fsm.png b/doc/fsm.png
deleted file mode 100644
index 6cb80fe..0000000
Binary files a/doc/fsm.png and /dev/null differ
diff --git a/doc/mainpage.dox b/doc/mainpage.dox
deleted file mode 100644
index 8bdc8b5..0000000
--- a/doc/mainpage.dox
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * This is the main page of the JACK reference manual, built using
- * doxygen.
- */
-
-/**
- at mainpage JACK Audio Connection Kit
-
- at section intro Introduction
-
-JACK is a low-latency audio server, written for any operating system
-that is reasonably POSIX compliant. It currently exists for Linux, OS
-X, Solaris, FreeBSD and Windows. It can connect several client
-applications to an audio device, and allow them to share audio with
-each other.  Clients can run as separate processes like normal
-applications, or within the JACK server as "plugins".
-
-JACK was designed from the ground up for professional audio work, and
-its design focuses on two key areas: synchronous execution of all
-clients, and low latency operation.
-
- at see <http://jackaudio.org>
-
- at section jack_overview JACK Overview
-
-Traditionally it has been hard if not impossible to write audio
-applications that can share data with each other. In addition,
-configuring and managing audio interface hardware has often been one
-of the most complex aspect of writing audio software.
-
-JACK changes all this by providing an API that does several things:
-
-    1. provides a high level abstraction for programmers that
-       removes the audio interface hardware from the picture and
-       allows them to concentrate on the core functionality of
-       their software.
-
-    2. allows applications to send and receive audio data to/from
-       each other as well as the audio interface. There is no
-       difference in how an application sends or receives
-       data regardless of whether it comes from/goes to another application 
-       or an audio interface.
-
-For programmers with experience of several other audio APIs such as
-PortAudio, Apple's CoreAudio, Steinberg's VST and ASIO as well as many
-others, JACK presents a familiar model: your program provides a
-"callback" function that will be executed at the right time. Your
-callback can send and receive data as well as do other signal
-processing tasks. You are not responsible for managing audio
-interfaces or threading, and there is no "format negotiation": all
-audio data within JACK is represented as 32 bit floating point values.
-
-For those with experiences rooted in the Unix world, JACK presents a
-somewhat unfamiliar API. Most Unix APIs are based on the read/write
-model spawned by the "everything is a file" abstraction that Unix is
-rightly famous for. The problem with this design is that it fails to
-take the realtime nature of audio interfaces into account, or more
-precisely, it fails to force application developers to pay sufficient
-attention to this aspect of their task. In addition, it becomes rather
-difficult to facilitate inter-application audio routing when different
-programs are not all running synchronously.
-
-Using JACK within your program is very simple, and typically consists
-of just:
-
-   - calling @ref jack_client_open() to connect to the JACK server.
-   - registering "ports" to enable data to be moved to and from
-       your application.
-   - registering a "process callback" which will be called at the
-       right time by the JACK server.
-   - telling JACK that your application is ready to start processing
-       data.
-
-There is a lot more that you can do with JACK's interfaces, but for
-many applications, this is all that is needed.  The @ref
-simple_client.c example demonstrates a complete (simple!) JACK
-application that just copies the signal arriving at its input port to
-its output port.  Similarly, @ref inprocess.c shows how to write an
-internal client "plugin" that runs within the JACK server process.
-
- at section reference Reference
-
-The JACK programming interfaces are described in several header files.
-We present them here broken into useful categories to make the API a
-little clearer:
-
-    - @ref ClientFunctions
-    - @ref ClientCallbacks
-    - @ref ClientThreads
-    - @ref ServerControl
-    - @ref PortFunctions
-    - @ref PortSearching
-    - @ref TimeFunctions
-    - @ref TransportControl
-    - @ref ErrorOutput
-    - @ref NonCallbackAPI
-    - @ref MIDIAPI
-
-The full API is described in:
-
-  - @ref jack.h "<jack/jack.h>" is the main JACK interface.
-  - @ref statistics.h "<jack/statistics.h>" provides interfaces for
-  monitoring the performance of a running JACK server.
-  - @ref intclient.h "<jack/intclient.h>" allows loading and unloading
-  JACK internal clients.
-  - @ref ringbuffer.h "<jack/ringbuffer.h>" defines a simple API for
-  using lock-free ringbuffers.  These are a good way to pass data
-  between threads, when streaming realtime data to slower media, like
-  audio file playback or recording.
-  - @ref transport.h "<jack/transport.h>" defines a simple transport
-  control mechanism for starting, stopping and repositioning clients.
-  This is described in the @ref transport-design document.
-  - @ref types.h "<jack/types.h>" defines the main JACK data types.
-  - @ref thread.h "<jack/thread.h>" functions standardize thread
-  creation for JACK and its clients.
-  - @ref midiport.h "<jack/midiport.h>" functions to handle reading
-  and writing of MIDI data to a port
-
-In addition, the tools directory provides numerous examples
-of simple JACK clients that nevertheless use the API to do something
-useful.  It includes
-
-  - a metronome.
-  - a recording client that can capture any number of channels
-      from any JACK sources and store them as an audio file.
-  - command line clients to control the transport mechanism,
-       change the buffer size and more.      
-  - commands to load and unload JACK internal clients.
-  - tools for checking the status of a running JACK system.
-
-and many more.
-
- at section porting Porting
-
-JACK is designed to be portable to any system supporting the relevant
-POSIX and ANSI C standards.  It currently runs under GNU/Linux, Mac OS
-X and Berkeley Unix on several different processor architectures.  If
-you want to port JACK to another platform, please read the @ref
-porting-guide document.
-
- at section license License
-
-Copyright (C) 2001-2008 by Paul Davis and others.
-
-JACK is free software; you can redistribute it and/or modify it under
-the terms of the GNU GPL and LGPL licenses as published by the Free
-Software Foundation, <http://www.gnu.org>.  The JACK server uses the
-GPL, as noted in the source file headers.  However, the JACK library
-is licensed under the LGPL, allowing proprietary programs to link with
-it and use JACK services.  You should have received a copy of these
-Licenses along with the program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-*/
diff --git a/doc/porting.dox b/doc/porting.dox
deleted file mode 100644
index 011e2e9..0000000
--- a/doc/porting.dox
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * This file documents the process of porting JACK to new platforms.
- * It is part of the JACK reference manual, built using doxygen.
- */
-
-/**
-
- at page porting-guide Porting JACK
-
-The @ref index is designed to be portable to any system supporting the
-relevant POSIX and C language standards.  It currently works with
-GNU/Linux and Mac OS X on several different processor architectures.
-This document describes the steps needed to port JACK to another
-platform, and the methods used to provide portability.
-
-  - @ref portrequirements
-  - @ref portoverview
-  - @ref portopsys
-  - @ref portcpu
-  - @ref portissues
-
- at section portrequirements Requirements
-
-  - Each platform should build directly from CVS or from a tarball
-  using the GNU @c ./configure tools.  Platform-specific toolsets can
-  by used for development, but the GNU tools should at least work for
-  basic distribution and configuration.
-
-  - For long-term maintainability we want to minimize the use of
-  conditional compilation in source files.
-
-  - We should provide generic versions of all system-dependent
-  headers, so platforms need only provide those they modify.
-
-  - In some cases, operating system-specific information must be able
-  to override processor-specific data.
-
- at section portoverview Overview
-
-JACK relies on two types of platform-specific headers:
-
-  - @ref portopsys
-  - @ref portcpu
-
-OS-specific headers take precedence over CPU-specific headers.
-
-The JACK @c configure.host script and its system-dependent header
-directories were adapted from the @c libstdc++-v3 component of the GNU
-Compiler Collective, <http://gcc.gnu.org>.
-
-
- at section portlang C Language Dependencies
-
-JACK is written to conform with C99, as defined in International
-Standard ISO/IEC 9899:1999.  Because many existing compilers do not
-fully support this standard, some new features should be avoided for
-portablility reasons.  For example, variables should not be declared
-in the middle of a compound statement, because many compilers still
-cannot handle that language extension.
-
-
- at section portopsys Operating System Dependencies
-
-JACK is written for a POSIX environment compliant with IEEE Std
-1003.1-2001, ISO/IEC 9945:2003, including the POSIX Threads Extension
-(1003.1c-1995) and the Realtime and Realtime Threads feature groups.
-When some needed POSIX feature is missing on a platform, the preferred
-solution is to provide a substitute, as with the @c fakepoll.c
-implementation for Mac OS X.
-
-Whenever possible, OS dependencies should be auto-detected by @c
-configure.  Sometimes they can be isolated in OS-specific header
-files, found in subdirectories of @c config/os and referenced with a
- at c <sysdeps/xxx.h> name.
-
-If conditional compilation must be used in mainline
-platform-independent code, avoid using the system name.  Instead, @c
-\#define a descriptive name in @c <config.h>, and test it like this:
-
- at code
-  \#ifdef JACK_USE_MACH_THREADS
-          allocate_mach_serverport(engine, client);
-          client->running = FALSE;
-  \#endif
- at endcode
-
-Be sure to place any generic implementation alternative in the @c
-\#else or use an @c \#ifndef, so no other code needs to know your
-conditional labels.
-
- at section portcpu Processor Dependencies
-
-JACK uses some low-level machine operations for thread-safe updates to
-shared memory.  A low-level implementation of @c <sysdeps/atomicity.h>
-is provided for every target processor architecture.  There is also a
-generic implementation using POSIX spin locks, but that is not a good
-enough solution for serious use.
-
-The GCC package provides versions that work on most modern hardware.
-We've tried to keep things as close to the original as possible, while
-removing a bunch of os-specific files that didn't seem relevant.  A
-primary goal has been to avoid changing the CPU-dependent @c
-<sysdeps/atomicity.h> headers.
-
-The relevant GCC documentation provides some helpful background,
-especially the @c atomicity.h discussion at
-<http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html>.
-
-
- at section portissues Issues Not Addressed
-
-  - Cross-compilation has not been tested, or even thought through in
-  much detail.  The @a host is the system on which JACK will run.
-  This may differ from the @a build system doing the compilation.
-  These are selected using the standard @c ./configure options @c
-  --host and @c --build.  Usually, @c ./config.guess can print the
-  appropriate canonical name for any system on which it runs.
-
-  - Platform-specific build tools like Apple's Project Builder are not
-  well-supported.
-
-*/
diff --git a/doc/reference.doxygen.in b/doc/reference.doxygen.in
deleted file mode 100644
index b000062..0000000
--- a/doc/reference.doxygen.in
+++ /dev/null
@@ -1,1368 +0,0 @@
-# Doxyfile 1.5.5
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file 
-# that follow. The default is UTF-8 which is also the encoding used for all 
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
-# iconv built into libc) for the transcoding. See 
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
-# by quotes) that should identify the project.
-
-PROJECT_NAME           = JACK-AUDIO-CONNECTION-KIT
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
-# if some version control system is used.
-
-PROJECT_NUMBER         = @JACK_VERSION@
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = reference
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
-# 4096 sub-directories (in 2 levels) under the output directory of each output 
-# format and will distribute the generated files over these directories. 
-# Enabling this option can be useful when feeding doxygen a huge amount of 
-# source files, where putting all generated files in the same directory would 
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
-# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, 
-# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), 
-# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, 
-# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, 
-# and Ukrainian.
-
-OUTPUT_LANGUAGE        = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator 
-# that is used to form the text in various listings. Each string 
-# in this list, if found as the leading text of the brief description, will be 
-# stripped from the text and the result after processing the whole list, is 
-# used as the annotated text. Otherwise, the brief description is used as-is. 
-# If left blank, the following values are used ("$name" is automatically 
-# replaced with the name of the entity): "The $name class" "The $name widget" 
-# "The $name file" "is" "provides" "specifies" "contains" 
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       = 
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
-# inherited members of a class in the documentation of that class as if those 
-# members were ordinary class members. Constructors, destructors and assignment 
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
-# can be used to strip a user-defined part of the path. Stripping is 
-# only done if one of the specified strings matches the left-hand part of 
-# the path. The tag can be used to show relative paths in the file list. 
-# If left blank the directory from which doxygen is run is used as the 
-# path to strip.
-
-STRIP_FROM_PATH        = 
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
-# the path mentioned in the documentation of a class, which tells 
-# the reader which header file to include in order to use a class. 
-# If left blank only the name of the header file containing the class 
-# definition is used. Otherwise one should specify the include paths that 
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    = 
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
-# (but less readable) file names. This can be useful is your file systems 
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
-# will interpret the first line (until the first dot) of a JavaDoc-style 
-# comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like regular Qt-style comments 
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF      = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
-# interpret the first line (until the first dot) of a Qt-style 
-# comment as the brief description. If set to NO, the comments 
-# will behave just like regular Qt-style comments (thus requiring 
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF           = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
-# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
-# comments) as a brief description. This used to be the default behaviour. 
-# The new default is to treat a multi-line C++ comment block as a detailed 
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member 
-# documentation.
-
-DETAILS_AT_TOP         = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
-# member inherits the documentation from any documented member that it 
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
-# a new page for each member. If set to NO, the documentation of a member will 
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 8
-
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                = 
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
-# sources only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
-# sources only. Doxygen will then generate output that is more tailored for 
-# Java. For instance, namespaces will be presented as packages, qualified 
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
-# sources only. Doxygen will then generate output that is more tailored for 
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
-# sources. Doxygen will then generate output that is tailored for 
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
-# to include (a tag file for) the STL sources as input, then you should 
-# set this tag to YES in order to let doxygen match functions declarations and 
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
-# func(std::string) {}). This also make the inheritance and collaboration 
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT    = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
-# Doxygen will parse them like normal C++ but will assume all classes use public 
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT            = NO
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
-# tag is set to YES, then doxygen will reuse the documentation of the first 
-# member in the group (if any) for the other members of the group. By default 
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
-# the same type (for instance a group of public functions) to be put as a 
-# subgroup of that type (e.g. under the Public Functions section). Set it to 
-# NO to prevent subgrouping. Alternatively, this can be done per class using 
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
-# is documented as struct, union, or enum with the name of the typedef. So 
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
-# with name TypeT. When disabled the typedef will appear as a member of a file, 
-# namespace, or class. And the struct will be named TypeS. This can typically 
-# be useful for C code in case the coding convention dictates that all compound 
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation.
-
-EXTRACT_STATIC         = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
-# defined locally in source files will be included in the documentation. 
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be 
-# extracted and appear in the documentation as a namespace called 
-# 'anonymous_namespace{file}', where file will be replaced with the base 
-# name of the file that contains the anonymous namespace. By default 
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES   = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these classes will be included in the various 
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
-# friend (class|struct|union) declarations. 
-# If set to NO (the default) these declarations will be included in the 
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
-# documentation blocks found inside the body of a function. 
-# If set to NO (the default) these blocks will be appended to the 
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
-# file names in lower-case letters. If set to YES upper-case letters are also 
-# allowed. This is useful if you have classes or files whose names only differ 
-# in case and if your file system supports case sensitive file names. Windows 
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
-# will show members with their full class and namespace scopes in the 
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
-# will put a list of the files that are included by a file in the documentation 
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
-# declaration order.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
-# brief documentation of file, namespace and class members alphabetically 
-# by member name. If set to NO (the default) the members will appear in 
-# declaration order.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
-# hierarchy of group names into alphabetical order. If set to NO (the default) 
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
-# sorted by fully-qualified names, including namespaces. If set to 
-# NO (the default), the class list will be sorted only by class name, 
-# not including the namespace part. 
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the 
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or 
-# disable (NO) the todo list. This list is created by putting \todo 
-# commands in the documentation.
-
-GENERATE_TODOLIST      = NO
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or 
-# disable (NO) the test list. This list is created by putting \test 
-# commands in the documentation.
-
-GENERATE_TESTLIST      = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or 
-# disable (NO) the bug list. This list is created by putting \bug 
-# commands in the documentation.
-
-GENERATE_BUGLIST       = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
-# disable (NO) the deprecated list. This list is created by putting 
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional 
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       = 
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
-# the initial value of a variable or define consists of for it to appear in 
-# the documentation. If the initializer consists of more lines than specified 
-# here it will be hidden. Use a value of 0 to hide initializers completely. 
-# The appearance of the initializer of individual variables and defines in the 
-# documentation can be controlled using \showinitializer or \hideinitializer 
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
-# at the bottom of the documentation of classes and structs. If set to YES the 
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
-# doxygen should invoke to get the current version for each file (typically from 
-# the version control system). Doxygen will invoke the program by executing (via 
-# popen()) the command <command> <input-file>, where <command> is the value of 
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
-# provided by doxygen. Whatever the program writes to standard output 
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated 
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are 
-# generated by doxygen. Possible values are YES and NO. If left blank 
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
-# potential errors in the documentation, such as not documenting some 
-# parameters in a documented function, or documenting parameters that 
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for 
-# functions that are documented, but have no documentation for their parameters 
-# or return value. If set to NO (the default) doxygen will only warn about 
-# wrong or incomplete parameter documentation, but not about the absence of 
-# documentation.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that 
-# doxygen can produce. The string should contain the $file, $line, and $text 
-# tags, which will be replaced by the file and line number from which the 
-# warning originated and the warning text. Optionally the format may contain 
-# $version, which will be replaced by the version of the file (if it could 
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning 
-# and error messages should be written. If left blank the output is written 
-# to stderr.
-
-WARN_LOGFILE           = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
-# with spaces.
-
-INPUT                  = @top_srcdir@/doc/mainpage.dox \
-                         @top_srcdir@/doc/transport.dox \
-                         @top_srcdir@/doc/porting.dox \
-                         @top_srcdir@/example-clients/inprocess.c \
-                         @top_srcdir@/example-clients/simple_client.c \
-                         @top_srcdir@/jack/intclient.h \
-                         @top_srcdir@/jack/jack.h \
-                         @top_srcdir@/jack/ringbuffer.h \
-                         @top_srcdir@/jack/statistics.h \
-                         @top_srcdir@/jack/thread.h \
-                         @top_srcdir@/jack/transport.h \
-                         @top_srcdir@/jack/types.h \
-                         @top_srcdir@/jack/midiport.h
-
-# This tag can be used to specify the character encoding of the source files 
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
-# also the default input encoding. Doxygen uses libiconv (or the iconv built 
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
-# the list of possible encodings.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the 
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank the following patterns are tested: 
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS          = 
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
-# If left blank NO is used.
-
-RECURSIVE              = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should 
-# excluded from the INPUT source files. This way you can easily exclude a 
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE                = 
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
-# directories that are symbolic links (a Unix filesystem feature) are excluded 
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the 
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
-# certain files from those directories. Note that the wildcards are matched 
-# against the file with absolute path, so to exclude all test directories 
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS       = 
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
-# (namespaces, classes, functions, etc.) that should be excluded from the 
-# output. The symbol name can be a fully qualified name, a word, or if the 
-# wildcard * is used, a substring. Examples: ANamespace, AClass, 
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS        = 
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or 
-# directories that contain example code fragments that are included (see 
-# the \include command).
-
-EXAMPLE_PATH           = 
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank all files are included.
-
-EXAMPLE_PATTERNS       = 
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
-# searched for input files to be used with the \include or \dontinclude 
-# commands irrespective of the value of the RECURSIVE tag. 
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or 
-# directories that contain image that are included in the documentation (see 
-# the \image command).
-
-IMAGE_PATH             = .
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should 
-# invoke to filter for each input file. Doxygen will invoke the filter program 
-# by executing (via popen()) the command <filter> <input-file>, where <filter> 
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
-# input file. Doxygen will then use the output that the filter program writes 
-# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
-# ignored.
-
-INPUT_FILTER           = "sed -e s/POST_PACKED_STRUCTURE//" 
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
-# basis.  Doxygen will compare the file name with each pattern and apply the 
-# filter if there is a match.  The filters are a list of the form: 
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
-# is applied to all files.
-
-FILTER_PATTERNS        = 
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
-# INPUT_FILTER) will be used to filter the input files when producing source 
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
-# be generated. Documented entities will be cross-referenced with these sources. 
-# Note: To get rid of all source code in the generated output, make sure also 
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body 
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
-# doxygen to hide any special comment blocks from generated source code 
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
-# then for each documented function all documented 
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default) 
-# then for each documented function all documented entities 
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.  Otherwise they will link to the documentstion.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code 
-# will point to the HTML generated by the htags(1) tool instead of doxygen 
-# built-in source browser. The htags tool is part of GNU's global source 
-# tagging system (see http://www.gnu.org/software/global/global.html). You 
-# will need version 4.8.6 or higher.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
-# will generate a verbatim copy of the header file for each class for 
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
-# of all compounds will be generated. Enable this if the project 
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all 
-# classes will be put under the same header in the alphabetical index. 
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard header.
-
-HTML_HEADER            = 
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard footer.
-
-HTML_FOOTER            = 
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
-# style sheet that is used by each HTML page. It can be used to 
-# fine-tune the look of the HTML output. If the tag is left blank doxygen 
-# will generate a default style sheet. Note that doxygen will try to copy 
-# the style sheet file to the HTML output directory, so don't put your own 
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET        = 
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
-# will be generated that can be used as input for tools like the 
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files 
-# will be generated that can be used as input for Apple's Xcode 3 
-# integrated development environment, introduced with OSX 10.5 (Leopard). 
-# To create a documentation set, doxygen will generate a Makefile in the 
-# HTML output directory. Running make will produce the docset in that 
-# directory and running "make install" will install the docset in 
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
-# it at startup.
-
-GENERATE_DOCSET        = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
-# feed. A documentation feed provides an umbrella under which multiple 
-# documentation sets from a single provider (such as a company or product suite) 
-# can be grouped.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
-# should uniquely identify the documentation set bundle. This should be a 
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
-# documentation will contain sections that can be hidden and shown after the 
-# page has loaded. For this to work a browser that supports 
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
-# be used to specify the file name of the resulting .chm file. You 
-# can add a path in front of the file if the result should not be 
-# written to the html output directory.
-
-CHM_FILE               = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
-# be used to specify the location (absolute path including file name) of 
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
-# controls if a separate .chi index file is generated (YES) or that 
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
-# controls whether a binary table of contents is generated (YES) or a 
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members 
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it.
-
-DISABLE_INDEX          = YES
-
-# This tag can be used to set the number of enum values (range [1..20]) 
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that 
-# is generated for HTML Help). For this to work a browser that supports 
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW      = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
-# used to set the initial width (in pixels) of the frame in which the tree 
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
-# generate Latex output.
-
-GENERATE_LATEX         = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
-# generate index for LaTeX. If left blank `makeindex' will be used as the 
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
-# LaTeX documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used 
-# by the printer. Possible values are: a4, a4wide, letter, legal and 
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = letter
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         = 
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
-# the generated latex document. The header should contain everything until 
-# the first chapter. If it is left blank doxygen will generate a 
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           = 
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
-# plain latex in the generated Makefile. Set this option to YES to get a 
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
-# command to the generated LaTeX files. This will instruct LaTeX to keep 
-# running if errors occur, instead of asking the user for help. 
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
-# include the index chapters (such as File Index, Compound Index, etc.) 
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
-# The RTF output is optimized for Word 97 and may not look very pretty with 
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
-# RTF documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
-# will contain hyperlink fields. The RTF file will 
-# contain links (just like the HTML output) instead of page references. 
-# This makes the output suitable for online browsing using WORD or other 
-# programs which support those fields. 
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    = 
-
-# Set optional variables used in the generation of an rtf document. 
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to 
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
-# then it will generate one additional man file for each entity 
-# documented in the real man page(s). These additional files 
-# only source the real man page, but without them the man command 
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will 
-# generate an XML file that captures the structure of 
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_SCHEMA             = 
-
-# The XML_DTD tag can be used to specify an XML DTD, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_DTD                = 
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
-# dump the program listings (including syntax highlighting 
-# and cross-referencing information) to the XML output. Note that 
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
-# generate an AutoGen Definitions (see autogen.sf.net) file 
-# that captures the structure of the code including all 
-# documentation. Note that this feature is still experimental 
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
-# generate a Perl module file that captures the structure of 
-# the code including all documentation. Note that this 
-# feature is still experimental and incomplete at the 
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
-# nicely formatted so it can be parsed by a human reader.  This is useful 
-# if you want to understand what is going on.  On the other hand, if this 
-# tag is set to NO the size of the Perl module output will be much smaller 
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file 
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
-# This is useful so different doxyrules.make files included by the same 
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
-# evaluate all C-preprocessor directives found in the sources and include 
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
-# names in the source code. If set to NO (the default) only conditional 
-# compilation will be performed. Macro expansion can be done in a controlled 
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
-# then the macro expansion is limited to the macros specified with the 
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that 
-# contain include files that are not input files but should be processed by 
-# the preprocessor.
-
-INCLUDE_PATH           = 
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
-# patterns (like *.h and *.hpp) to filter out the header-files in the 
-# directories. If left blank, the patterns specified with FILE_PATTERNS will 
-# be used.
-
-INCLUDE_FILE_PATTERNS  = 
-
-# The PREDEFINED tag can be used to specify one or more macro names that 
-# are defined before the preprocessor is started (similar to the -D option of 
-# gcc). The argument of the tag is a list of macros of the form: name 
-# or name=definition (no spaces). If the definition and the = are 
-# omitted =1 is assumed. To prevent a macro definition from being 
-# undefined via #undef or recursively expanded use the := operator 
-# instead of the = operator.
-
-PREDEFINED             = 
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
-# this tag can be used to specify a list of macro names that should be expanded. 
-# The macro definition that is found in the sources will be used. 
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED      = 
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
-# doxygen's preprocessor will remove all function-like macros that are alone 
-# on a line, have an all uppercase name, and do not end with a semicolon. Such 
-# function macros are typically used for boiler-plate code, and will confuse 
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references   
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
-#   TAGFILES = file1 file2 ... 
-# Adding location for the tag files is done as follows: 
-#   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen 
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES               = 
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       = 
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
-# in the class index. If set to NO only the inherited external classes 
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
-# in the modules index. If set to NO, only the current project's groups will 
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script 
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
-# or super classes. Setting the tag to NO turns the diagrams off. Note that 
-# this option is superseded by the HAVE_DOT option below. This is only a 
-# fallback. It is recommended to install and use dot, since it yields more 
-# powerful graphs.
-
-CLASS_DIAGRAMS         = NO
-
-# You can define message sequence charts within doxygen comments using the \msc 
-# command. Doxygen will then run the mscgen tool (see 
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
-# the mscgen tool resides. If left empty the tool is assumed to be found in the 
-# default search path.
-
-MSCGEN_PATH            = 
-
-# If set to YES, the inheritance and collaboration graphs will hide 
-# inheritance and usage relations if the target is undocumented 
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
-# available from the path. This tool is part of Graphviz, a graph visualization 
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect inheritance relations. Setting this tag to YES will force the 
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect implementation dependencies (inheritance, containment, and 
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
-# collaboration diagrams in a style similar to the OMG's Unified Modeling 
-# Language.
-
-UML_LOOK               = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the 
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
-# tags are set to YES then doxygen will generate a graph for each documented 
-# file showing the direct and indirect include dependencies of the file with 
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
-# documented header file showing the documented files that directly or 
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
-# doxygen will generate a call dependency graph for every global function 
-# or class method. Note that enabling this option will significantly increase 
-# the time of a run. So in most cases it will be better to enable call graphs 
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH             = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
-# doxygen will generate a caller dependency graph for every global function 
-# or class method. Note that enabling this option will significantly increase 
-# the time of a run. So in most cases it will be better to enable caller 
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH           = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
-# then doxygen will show the dependencies a directory has on other directories 
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT       = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = 
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that 
-# contain dot files that are included in the documentation (see the 
-# \dotfile command).
-
-DOTFILE_DIRS           = 
-
-# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
-# nodes that will be shown in the graph. If the number of nodes in a graph 
-# becomes larger than this value, doxygen will truncate the graph, which is 
-# visualized by representing a node as a red box. Note that doxygen if the 
-# number of direct children of the root node in a graph is already larger than 
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES    = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
-# graphs generated by dot. A depth value of 3 means that only nodes reachable 
-# from the root by following a path via at most 3 edges will be shown. Nodes 
-# that lay further from the root node will be omitted. Note that setting this 
-# option to 1 or 2 may greatly reduce the computation time needed for large 
-# code bases. Also note that the size of a graph can be further restricted by 
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
-# background. This is enabled by default, which results in a transparent 
-# background. Warning: Depending on the platform used, enabling this option 
-# may lead to badly anti-aliased labels on the edges of a graph (i.e. they 
-# become hard to read).
-
-DOT_TRANSPARENT        = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
-# files in one run (i.e. multiple -o and -T options on the command line). This 
-# makes dot run faster, but since only newer versions of dot (>1.8.10) 
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
-# generate a legend page explaining the meaning of the various boxes and 
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
-# remove the intermediate dot files that are used to generate 
-# the various graphs.
-
-DOT_CLEANUP            = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be 
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE           = NO
diff --git a/doc/transport.dox b/doc/transport.dox
deleted file mode 100644
index a70b9ec..0000000
--- a/doc/transport.dox
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * This file documents the JACK transport design.  It is part of the
- * JACK reference manual, built using doxygen.
- */
-
-/**
-
- at page transport-design JACK Transport Design
-
-The @ref index provides simple transport interfaces for starting,
-stopping and repositioning a set of clients.  This document describes
-the overall design of these interfaces, their detailed specifications
-are in <jack/transport.h>
-
-  - @ref requirements
-  - @ref overview
-  - @ref timebase
-  - @ref transportcontrol
-  - @ref transportclients
-  - @ref compatibility
-  - @ref issues
-
-
- at section requirements Requirements
-
-  - We need sample-level accuracy for transport control.  This implies
-  that the transport client logic has to be part of the realtime
-  process chain.
-
-  - We don't want to add another context switch.  So, the transport
-  client logic has to run in the context of the client's process
-  thread.  To avoid making an extra pass through the process graph, no
-  transport changes take effect until the following process cycle.
-  That way, the transport info is stable throughout each cycle.
-
-  - We want to allow multiple clients to change the transport state.
-  This is mostly a usability issue.  Any client can start or stop
-  playback, or seek to a new location.  The user need not switch
-  windows to accomplish these tasks.
-
-  - We want a way for clients with heavyweight state to sync up when
-  the user presses "play", before the transport starts rolling.
-
-  - We want to provide for ongoing binary compatibility as the
-  transport design evolves.
-
-
- at section overview Overview
-
-The former transport master role has been divided into two layers:
-
-  - @ref timebase - counting beats, frames, etc. on every cycle.
-  - @ref transportcontrol - start, stop and reposition the playback.  
-
-Existing transport clients continue to work in compatibility mode.
-But, old-style timebase masters will no longer control the transport.
-
-
- at section timebase Timebase Master
-
-The timebase master continuously updates extended position
-information, counting beats, timecode, etc.  Without this extended
-information, there is no need for this function.  There is at most one
-master active at a time.  If no client is registered as timebase
-master, frame numbers will be the only position information available.
-
-The timebase master registers a callback that updates position
-information while the transport is rolling.  Its output affects the
-following process cycle.  This function is called immediately after
-the process callback in the same thread whenever the transport is
-rolling, or when any client has set a new position in the previous
-cycle.  The first cycle after jack_set_timebase_callback() is also
-treated as a new position, or the first cycle after jack_activate() if
-the client had been inactive.
-
- at code
-  typedef int  (*JackTimebaseCallback)(jack_transport_state_t state,
-                                       jack_nframes_t nframes,
-                                       jack_position_t *pos,
-                                       int new_pos,
-                                       void *arg);
- at endcode
-
-When a new client takes over, the former timebase callback is no
-longer called.  Taking over the timebase may be done conditionally, in
-which case the takeover fails when there is a master already.  The
-existing master can release it voluntarily, if desired.
-
- at code
-  int  jack_set_timebase_callback (jack_client_t *client,
-                                   int conditional,
-                                   JackTimebaseCallback timebase_callback,
-                                   void *arg);
-
-  int  jack_release_timebase(jack_client_t *client);
- at endcode
-
-If the timebase master releases the timebase or exits the JACK graph
-for any reason, the JACK engine takes over at the start of the next
-process cycle.  The transport state does not change.  If rolling, it
-continues to play, with frame numbers as the only available position
-information.
-
-
- at section transportcontrol Transport Control
-
-The JACK engine itself manages stopping and starting of the transport.
-Any client can make transport control requests at any time.  These
-requests take effect no sooner than the next process cycle, sometimes
-later.  The transport state is always valid, initially it is
-::JackTransportStopped.
-
- at code
-  void jack_transport_start (jack_client_t *client);
-  void jack_transport_stop (jack_client_t *client);
- at endcode
-
-The engine handles polling of slow-sync clients.  When someone calls
-jack_transport_start(), the engine resets the poll bits and changes to
-a new state, ::JackTransportStarting.  The @a sync_callback function
-for each slow-sync client will be invoked in the JACK process thread
-while the transport is starting.  If it has not already done so, the
-client needs to initiate a seek to reach the starting position.  The
- at a sync_callback returns false until the seek completes and the client
-is ready to play.  When all slow-sync clients are ready, the state
-changes to ::JackTransportRolling.
-
- at code
-  typedef int  (*JackSyncCallback)(jack_transport_state_t state,
-                                   jack_position_t *pos, void *arg);
- at endcode
-
-This callback is a realtime function that runs in the JACK process
-thread.
-
- at code
-  int  jack_set_sync_callback (jack_client_t *client,
-                               JackSyncCallback sync_callback, void *arg);
- at endcode
-
-Clients that don't declare a @a sync_callback are assumed to be ready
-immediately, any time the transport wants to start.  If a client no
-longer requires slow-sync processing, it can set its @a sync_callback
-to NULL.
-
- at code
-  int  jack_set_sync_timeout (jack_client_t *client,
-                              jack_time_t usecs);
- at endcode
-
-There must be a @a timeout to prevent unresponsive slow-sync clients
-from completely halting the transport mechanism.  Two seconds is the
-default.  When this @a timeout expires, the transport will start
-rolling, even if some slow-sync clients are still unready.  The @a
-sync_callback for these clients continues being invoked, giving them
-an opportunity to catch up.
-
- at code
-  int  jack_transport_reposition (jack_client_t *client,
-                                  jack_position_t *pos);
-  int  jack_transport_locate (jack_client_t *client,
-                              jack_nframes_t frame);
- at endcode
-
-These request a new transport position.  They can be called at any
-time by any client.  Even the timebase master must use them.  If the
-request is valid, it goes into effect in two process cycles.  If there
-are slow-sync clients and the transport is already rolling, it will
-enter the ::JackTransportStarting state and begin invoking their @a
-sync_callbacks until ready.
-
-
- at image html	fsm.png "Transport State Transition Diagram"
- at image latex    fsm.eps "Transport State Transition Diagram"
-
-
- at section transportclients Transport Clients
-
-Transport clients were formerly known as "transport slaves".  We want
-to make it easy for almost every JACK client to be a transport client.
-
- at code
-   jack_transport_state_t jack_transport_query (jack_client_t *client,
-		                                jack_position_t *pos);
- at endcode
-
-This function can be called from any thread.  If called from the
-process thread, @a pos corresponds to the first frame of the current
-cycle and the state returned is valid for the entire cycle.
-
-
- at section compatibility Compatibility
-
-During the transition period we will support the old-style interfaces
-in compatibility mode as deprecated interfaces.  This compatibility is
-not 100%, there are limitations.  
-
-The main reasons for doing this are:
-
-  - facilitate testing with clients that already have transport
-  support
-  - provide a clean migration path, so application developers are
-  not discouraged from supporting the transport interface
-
-These deprecated interfaces continue to work:
-
- at code
-  typedef struct jack_transport_info_t;
-
-  void jack_get_transport_info (jack_client_t *client,
-                                jack_transport_info_t *tinfo);
- at endcode
-
-Unfortunately, the old-style timebase master interface cannot coexist
-cleanly with such new features as jack_transport_locate() and
-slow-sync clients.  So, these interfaces are only present as stubs:
-
- at code
-  void jack_set_transport_info (jack_client_t *client,
-                                jack_transport_info_t *tinfo);
-  int  jack_engine_takeover_timebase (jack_client_t *);
- at endcode
-
-For compatibility with future changes, it would be good to avoid
-structures entirely.  Nevertheless, the jack_position_t structure
-provides a convenient way to collect timebase information in several
-formats that clearly all refer to a single moment.  To minimize future
-binary compatibility problems, this structure has some padding at the
-end, making it possible to extend it without necessarily breaking
-compatibility.  New fields can be allocated from the padding area,
-with access controlled by newly defined valid bits, all of which are
-currently forced to zero.  That allows the structure size and offsets
-to remain constant.
-
-
- at section issues Issues Not Addressed
-
-This design currently does not address several issues. This means they
-will probably not be included in JACK release 1.0.
-
-  - variable speed
-  - reverse play
-  - looping
-*/
diff --git a/doxyfile b/doxyfile
new file mode 100644
index 0000000..bc5116a
--- /dev/null
+++ b/doxyfile
@@ -0,0 +1,808 @@
+# Doxyfile 1.2.8.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = "Jack2"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.9.5
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = build/default/
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
+# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a class diagram (in Html and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off.
+
+CLASS_DIAGRAMS         = YES
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consist of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+
+WARN_FORMAT            = 
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT    = common posix macosx macosx/coreaudio/ linux linux/alsa windows windows/portaudio common/jack/
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+FILE_PATTERNS          =  *.cpp *.h 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = RPC
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse.
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = 
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Netscape 4.0+ 
+# or Internet explorer 4.0+).
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = 
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = 
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = 
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = 
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH               = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermedate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
+
+# The CGI_NAME tag should be the name of the CGI script that 
+# starts the search engine (doxysearch) with the correct parameters. 
+# A script with this name will be generated by doxygen.
+
+CGI_NAME               = 
+
+# The CGI_URL tag should be the absolute URL to the directory where the 
+# cgi binaries are located. See the documentation of your http daemon for 
+# details.
+
+CGI_URL                = 
+
+# The DOC_URL tag should be the absolute URL to the directory where the 
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL                = 
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the 
+# documentation is located. If left blank the directory on the local machine 
+# will be used.
+
+DOC_ABSPATH            = 
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
+# is installed.
+
+BIN_ABSPATH            = 
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search 
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS          = 
diff --git a/drivers/.cvsignore b/drivers/.cvsignore
deleted file mode 100644
index 282522d..0000000
--- a/drivers/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/drivers/Makefile.am b/drivers/Makefile.am
deleted file mode 100644
index 4d232c2..0000000
--- a/drivers/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-if HAVE_ALSA
-ALSA_DIR = alsa
-else
-ALSA_DIR =
-endif
-
-if HAVE_ALSA_MIDI
-ALSA_MIDI_DIR = alsa-midi
-else
-ALSA_MIDI_DIR =
-endif
-
-if HAVE_OSS
-OSS_DIR = oss
-else
-OSS_DIR =
-endif
-
-if HAVE_SUN
-SUN_DIR = sun
-else
-SUN_DIR =
-endif
-
-if HAVE_PA
-PA_DIR = portaudio
-else
-PA_DIR =
-endif
-
-if HAVE_COREAUDIO
-CA_DIR = coreaudio
-else
-CA_DIR =
-endif
-
-if HAVE_FREEBOB
-FREEBOB_DIR = freebob
-else
-FREEBOB_DIR =
-endif
-
-if HAVE_FIREWIRE
-FIREWIRE_DIR = firewire
-else
-FIREWIRE_DIR =
-endif
-
-SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR) netjack
-DIST_SUBDIRS = alsa alsa-midi dummy oss sun portaudio coreaudio freebob firewire netjack
diff --git a/drivers/alsa-midi/Makefile.am b/drivers/alsa-midi/Makefile.am
deleted file mode 100644
index c499e9c..0000000
--- a/drivers/alsa-midi/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-MAINTAINERCLEANFILES=Makefile.in
-
-noinst_HEADERS = alsa_midi.h \
-		 midi_pack.h \
-		 midi_unpack.h
diff --git a/drivers/alsa-midi/alsa_midi.h b/drivers/alsa-midi/alsa_midi.h
deleted file mode 100644
index 960c30b..0000000
--- a/drivers/alsa-midi/alsa_midi.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2006 Dmitry S. Baikov
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-#ifndef __jack_alsa_midi_h__
-#define __jack_alsa_midi_h__
-
-#include <jack/jack.h>
-
-typedef struct alsa_midi_t alsa_midi_t;
-struct alsa_midi_t {
-	void (*destroy)(alsa_midi_t *amidi);
-	int (*attach)(alsa_midi_t *amidi);
-	int (*detach)(alsa_midi_t *amidi);
-	int (*start)(alsa_midi_t *amidi);
-	int (*stop)(alsa_midi_t *amidi);
-	void (*read)(alsa_midi_t *amidi, jack_nframes_t nframes);
-	void (*write)(alsa_midi_t *amidi, jack_nframes_t nframes);
-};
-
-alsa_midi_t* alsa_rawmidi_new(jack_client_t *jack);
-alsa_midi_t* alsa_seqmidi_new(jack_client_t *jack, const char* alsa_name);
-
-#endif /* __jack_alsa_midi_h__ */
diff --git a/drivers/alsa-midi/alsa_rawmidi.c b/drivers/alsa-midi/alsa_rawmidi.c
deleted file mode 100644
index aa41670..0000000
--- a/drivers/alsa-midi/alsa_rawmidi.c
+++ /dev/null
@@ -1,1204 +0,0 @@
-/*
- * ALSA RAWMIDI < - > JACK MIDI bridge
- *
- * Copyright (c) 2006,2007 Dmitry S. Baikov
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-/* Required for clock_nanosleep(). Thanks, Nedko */
-#define _GNU_SOURCE
-
-#include "alsa_midi.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <pthread.h>
-#include <time.h>
-#include <limits.h>
-#include <ctype.h>
-#include <alsa/asoundlib.h>
-#include <jack/thread.h>
-#include <jack/ringbuffer.h>
-#include <jack/midiport.h>
-#include "midi_pack.h"
-#include "midi_unpack.h"
-
-
-#ifdef STANDALONE
-#define MESSAGE(...) fprintf(stderr, __VA_ARGS__)
-#else
-#include <jack/messagebuffer.h>
-#endif
-
-#define info_log(...)  MESSAGE(__VA_ARGS__)
-#define error_log(...) MESSAGE(__VA_ARGS__)
-
-#ifdef JACK_MIDI_DEBUG
-#define debug_log(...) MESSAGE(__VA_ARGS__)
-#else
-#define debug_log(...)
-#endif
-
-
-enum {
-	NANOSLEEP_RESOLUTION = 7000
-};
-
-#define NFRAMES_INF INT_MAX
-
-enum {
-#ifndef JACK_MIDI_DEBUG
-	MAX_PFDS = 64,
-	MAX_PORTS = MAX_PFDS-1,
-	MAX_EVENTS = 4096,
-	MAX_DATA = 64*1024,
-	MIDI_THREAD_PRIO = 80
-#else
-	MAX_PFDS = 6,
-	MAX_PORTS = MAX_PFDS-1,
-	MAX_EVENTS = 16,
-	MAX_DATA = 64,
-	MIDI_THREAD_PRIO = 80
-#endif
-};
-
-enum PortState {
-	PORT_DESTROYED,
-	PORT_CREATED,
-	PORT_ADDED_TO_JACK,
-	PORT_ADDED_TO_MIDI,
-	PORT_REMOVED_FROM_MIDI,
-	PORT_REMOVED_FROM_JACK,
-	PORT_ZOMBIFIED,
-};
-
-typedef struct {
-	int id[4]; //card, dev, dir, sub;
-} alsa_id_t;
-
-
-typedef struct {
-	jack_time_t time;
-	int size;
-	int overruns;
-} event_head_t;
-
-
-typedef struct midi_port_t midi_port_t;
-struct midi_port_t {
-	midi_port_t *next;
-
-	enum PortState state;
-
-	alsa_id_t id;
-	char dev[16];
-	char name[64];
-
-	jack_port_t *jack;
-	snd_rawmidi_t *rawmidi;
-	int npfds;
-	int is_ready;
-
-	jack_ringbuffer_t *event_ring;
-	jack_ringbuffer_t *data_ring;
-
-};
-
-typedef struct input_port_t {
-	midi_port_t base;
-
-	// jack
-	midi_unpack_t unpack;
-	
-	// midi
-	int overruns;
-} input_port_t;
-
-typedef struct output_port_t {
-	midi_port_t base;
-
-	// jack
-	midi_pack_t packer;
-	
-	// midi
-	event_head_t next_event;
-	int todo;
-} output_port_t;
-
-typedef struct alsa_rawmidi_t alsa_rawmidi_t;
-
-typedef struct {
-	alsa_rawmidi_t *midi;
-	midi_port_t *port;
-	void *buffer;
-	jack_time_t frame_time;
-	jack_nframes_t nframes;
-} process_jack_t;
-
-typedef struct {
-	alsa_rawmidi_t *midi;
-	int mode;
-	midi_port_t *port;
-	struct pollfd *rpfds;
-	struct pollfd *wpfds;
-	int max_pfds;
-	jack_nframes_t cur_frames;
-	jack_time_t cur_time;
-	jack_time_t next_time;
-} process_midi_t;
-
-typedef struct midi_stream_t {
-	alsa_rawmidi_t *owner;
-	int mode;
-	const char *name;
-	pthread_t thread;
-	int wake_pipe[2];
-
-	struct {
-		jack_ringbuffer_t *new_ports;
-		int nports;
-		midi_port_t *ports[MAX_PORTS];
-	} jack, midi;
-
-	size_t port_size;
-	int (*port_init)(alsa_rawmidi_t *midi, midi_port_t *port);
-	void (*port_close)(alsa_rawmidi_t *midi, midi_port_t *port);
-	void (*process_jack)(process_jack_t *j);
-	int (*process_midi)(process_midi_t *m);
-} midi_stream_t;
-
-
-struct alsa_rawmidi_t {
-	alsa_midi_t ops;
-
-	jack_client_t *client;
-	int keep_walking;
-
-	struct {
-		pthread_t thread;
-		midi_port_t *ports;
-		int wake_pipe[2];
-	} scan;
-
-	midi_stream_t in;
-	midi_stream_t out;
-};
-
-static int input_port_init(alsa_rawmidi_t *midi, midi_port_t *port);
-static void input_port_close(alsa_rawmidi_t *midi, midi_port_t *port);
-
-static void do_jack_input(process_jack_t *j);
-static int do_midi_input(process_midi_t *m);
-
-static int output_port_init(alsa_rawmidi_t *midi, midi_port_t *port);
-static void output_port_close(alsa_rawmidi_t *midi, midi_port_t *port);
-
-static void do_jack_output(process_jack_t *j);
-static int do_midi_output(process_midi_t *m);
-
-
-
-static
-int stream_init(midi_stream_t *s, alsa_rawmidi_t *midi, const char *name)
-{
-	s->owner = midi;
-	s->name = name;
-	if (pipe(s->wake_pipe)==-1) {
-		s->wake_pipe[0] = -1;
-		error_log("pipe() in stream_init(%s) failed: %s", name, strerror(errno));
-		return -errno;
-	}
-	s->jack.new_ports = jack_ringbuffer_create(sizeof(midi_port_t*)*MAX_PORTS);
-	s->midi.new_ports = jack_ringbuffer_create(sizeof(midi_port_t*)*MAX_PORTS);
-	if (!s->jack.new_ports || !s->midi.new_ports)
-		return -ENOMEM;
-	return 0;
-}
-
-static
-void stream_close(midi_stream_t *s)
-{
-	if (s->wake_pipe[0] != -1) {
-		close(s->wake_pipe[0]);
-		close(s->wake_pipe[1]);
-	}
-	if (s->jack.new_ports)
-		jack_ringbuffer_free(s->jack.new_ports);
-	if (s->midi.new_ports)
-		jack_ringbuffer_free(s->midi.new_ports);
-}
-
-static void alsa_rawmidi_delete(alsa_midi_t *m);
-static int alsa_rawmidi_attach(alsa_midi_t *m);
-static int alsa_rawmidi_detach(alsa_midi_t *m);
-static int alsa_rawmidi_start(alsa_midi_t *m);
-static int alsa_rawmidi_stop(alsa_midi_t *m);
-static void alsa_rawmidi_read(alsa_midi_t *m, jack_nframes_t nframes);
-static void alsa_rawmidi_write(alsa_midi_t *m, jack_nframes_t nframes);
-
-alsa_midi_t* alsa_rawmidi_new(jack_client_t *jack)
-{
-	alsa_rawmidi_t *midi = calloc(1, sizeof(alsa_rawmidi_t));
-	if (!midi)
-		goto fail_0;
-	midi->client = jack;
-	if (pipe(midi->scan.wake_pipe)==-1) {
-		error_log("pipe() in alsa_midi_new failed: %s", strerror(errno));
-		goto fail_1;
-	}
-
-	if (stream_init(&midi->in, midi, "in"))
-		goto fail_2;
-	midi->in.mode = POLLIN;
-	midi->in.port_size = sizeof(input_port_t);
-	midi->in.port_init = input_port_init;
-	midi->in.port_close = input_port_close;
-	midi->in.process_jack = do_jack_input;
-	midi->in.process_midi = do_midi_input;
-
-	if (stream_init(&midi->out, midi, "out"))
-		goto fail_3;
-	midi->out.mode = POLLOUT;
-	midi->out.port_size = sizeof(output_port_t);
-	midi->out.port_init = output_port_init;
-	midi->out.port_close = output_port_close;
-	midi->out.process_jack = do_jack_output;
-	midi->out.process_midi = do_midi_output;
-
-	midi->ops.destroy = alsa_rawmidi_delete;
-	midi->ops.attach = alsa_rawmidi_attach;
-	midi->ops.detach = alsa_rawmidi_detach;
-	midi->ops.start = alsa_rawmidi_start;
-	midi->ops.stop = alsa_rawmidi_stop;
-	midi->ops.read = alsa_rawmidi_read;
-	midi->ops.write = alsa_rawmidi_write;
-
-	return &midi->ops;
- fail_3:
- 	stream_close(&midi->out);
- fail_2:
- 	stream_close(&midi->in);
- 	close(midi->scan.wake_pipe[1]);
- 	close(midi->scan.wake_pipe[0]);
- fail_1:
- 	free(midi);
- fail_0:
-	return NULL;
-}
-
-static
-midi_port_t** scan_port_del(alsa_rawmidi_t *midi, midi_port_t **list);
-
-static
-void alsa_rawmidi_delete(alsa_midi_t *m)
-{
-	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
-
-	alsa_rawmidi_detach(m);
-
-	stream_close(&midi->out);
-	stream_close(&midi->in);
-	close(midi->scan.wake_pipe[0]);
-	close(midi->scan.wake_pipe[1]);
-
-	free(midi);
-}
-
-static void* scan_thread(void *);
-static void *midi_thread(void *arg);
-
-static
-int alsa_rawmidi_attach(alsa_midi_t *m)
-{
-	return 0;
-}
-
-static
-int alsa_rawmidi_detach(alsa_midi_t *m)
-{
-	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
-	midi_port_t **list;
-
-	alsa_rawmidi_stop(m);
-
-	list = &midi->scan.ports;
-	while (*list) {
-		(*list)->state = PORT_REMOVED_FROM_JACK;
-		list = scan_port_del(midi, list);
-	}
-	return 0;
-}
-
-static
-int alsa_rawmidi_start(alsa_midi_t *m)
-{
-	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
-	int err;
-	char c = 'q';
-	if (midi->keep_walking == 1)
-		return -EALREADY;
-
-	midi->keep_walking = 1;
-	if ((err = jack_client_create_thread(midi->client, &midi->in.thread, MIDI_THREAD_PRIO, jack_is_realtime(midi->client), midi_thread, &midi->in))) {
-		midi->keep_walking = 0;
-		return err;
-	}
-	if ((err = jack_client_create_thread(midi->client, &midi->out.thread, MIDI_THREAD_PRIO, jack_is_realtime(midi->client), midi_thread, &midi->out))) {
-		midi->keep_walking = 0;
-		write(midi->in.wake_pipe[1], &c, 1);
-		pthread_join(midi->in.thread, NULL);
-		return err;
-	}
-	if ((err = jack_client_create_thread(midi->client, &midi->scan.thread, 0, 0, scan_thread, midi))) {
-		midi->keep_walking = 0;
-		write(midi->in.wake_pipe[1], &c, 1);
-		write(midi->out.wake_pipe[1], &c, 1);
-		pthread_join(midi->in.thread, NULL);
-		pthread_join(midi->out.thread, NULL);
-		return err;
-	}
-	return 0;
-}
-
-static
-int alsa_rawmidi_stop(alsa_midi_t *m)
-{
-	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
-	char c = 'q';
-	if (midi->keep_walking == 0)
-		return -EALREADY;
-	midi->keep_walking = 0;
-	write(midi->in.wake_pipe[1], &c, 1);
-	write(midi->out.wake_pipe[1], &c, 1);
-	write(midi->scan.wake_pipe[1], &c, 1);
-	pthread_join(midi->in.thread, NULL);
-	pthread_join(midi->out.thread, NULL);
-	pthread_join(midi->scan.thread, NULL);
-	// ports are freed in alsa_midi_detach()
-	return 0;
-}
-
-static void jack_process(midi_stream_t *str, jack_nframes_t nframes);
-
-static
-void alsa_rawmidi_read(alsa_midi_t *m, jack_nframes_t nframes)
-{
-	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
-	jack_process(&midi->in, nframes);
-}
-
-static
-void alsa_rawmidi_write(alsa_midi_t *m, jack_nframes_t nframes)
-{
-	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
-	jack_process(&midi->out, nframes);
-}
-
-/*
- * -----------------------------------------------------------------------------
- */
-static inline
-int can_pass(size_t sz, jack_ringbuffer_t *in, jack_ringbuffer_t *out)
-{
-	return jack_ringbuffer_read_space(in) >= sz && jack_ringbuffer_write_space(out) >= sz;
-}
-
-static
-void midi_port_init(const alsa_rawmidi_t *midi, midi_port_t *port, snd_rawmidi_info_t *info, const alsa_id_t *id)
-{
-	const char *name;
-	char *c;
-
-	port->id = *id;
-	snprintf(port->dev, sizeof(port->dev), "hw:%d,%d,%d", id->id[0], id->id[1], id->id[3]);
-	name = snd_rawmidi_info_get_subdevice_name(info);
-	if (!strlen(name))
-		name = snd_rawmidi_info_get_name(info);
-	snprintf(port->name, sizeof(port->name), "%s %s %s", port->id.id[2] ? "out":"in", port->dev, name);
-
-	// replace all offending characters with '-'
-	for (c=port->name; *c; ++c)
-	        if (!isalnum(*c))
-			*c = '-';
-
-	port->state = PORT_CREATED;
-}
-
-static
-inline int midi_port_open_jack(const alsa_rawmidi_t *midi, midi_port_t *port, int type, const char *name)
-{
-	port->jack = jack_port_register(midi->client, name, JACK_DEFAULT_MIDI_TYPE,
-		type | JackPortIsPhysical|JackPortIsTerminal, 0);
-	return port->jack == NULL;
-}
-
-static
-int midi_port_open(const alsa_rawmidi_t *midi, midi_port_t *port)
-{
-	int err;
-	int type;
-	char name[64];
-	snd_rawmidi_t **in = NULL;
-	snd_rawmidi_t **out = NULL;
-
-	if (port->id.id[2] == 0) {
-		in = &port->rawmidi;
-		type = JackPortIsOutput;
-	} else {
-		out = &port->rawmidi;
-		type = JackPortIsInput;
-	}
-	
-	if ((err = snd_rawmidi_open(in, out, port->dev, SND_RAWMIDI_NONBLOCK))<0)
-		return err;
-
-	/* Some devices (emu10k1) have subdevs with the same name,
-	 * and we need to generate unique port name for jack */
-	snprintf(name, sizeof(name), "%s", port->name);
-	if (midi_port_open_jack(midi, port, type, name)) {
-		int num;
-		num = port->id.id[3] ? port->id.id[3] : port->id.id[1];
-		snprintf(name, sizeof(name), "%s %d", port->name, num);
-		if (midi_port_open_jack(midi, port, type, name))
-			return 2;
-	}
-	if ((port->event_ring = jack_ringbuffer_create(MAX_EVENTS*sizeof(event_head_t)))==NULL)
-		return 3;
-	if ((port->data_ring = jack_ringbuffer_create(MAX_DATA))==NULL)
-		return 4;
-
-	return 0;
-}
-
-static
-void midi_port_close(const alsa_rawmidi_t *midi, midi_port_t *port)
-{
-	if (port->data_ring) {
-		jack_ringbuffer_free(port->data_ring);
-		port->data_ring = NULL;
-	}
-	if (port->event_ring) {
-		jack_ringbuffer_free(port->event_ring);
-		port->event_ring = NULL;
-	}
-	if (port->jack) {
-		jack_port_unregister(midi->client, port->jack);
-		port->jack = NULL;
-	}
-	if (port->rawmidi) {
-		snd_rawmidi_close(port->rawmidi);
-		port->rawmidi = NULL;
-	}
-}
-
-/*
- * ------------------------- Port scanning -------------------------------
- */
-
-static
-int alsa_id_before(const alsa_id_t *p1, const alsa_id_t *p2)
-{
-	int i;
-	for (i=0; i<4; ++i) {
-		if (p1->id[i] < p2->id[i])
-			return 1;
-		else if (p1->id[i] > p2->id[i])
-			return 0;
-	}
-	return 0;
-}
-
-static
-void alsa_get_id(alsa_id_t *id, snd_rawmidi_info_t *info)
-{
-	id->id[0] = snd_rawmidi_info_get_card(info);
-	id->id[1] = snd_rawmidi_info_get_device(info);
-	id->id[2] = snd_rawmidi_info_get_stream(info) == SND_RAWMIDI_STREAM_OUTPUT ? 1 : 0;
-	id->id[3] = snd_rawmidi_info_get_subdevice(info);
-}
-
-static inline
-void alsa_error(const char *func, int err)
-{
-	error_log("%s() failed", snd_strerror(err));
-}
-
-typedef struct {
-	alsa_rawmidi_t *midi;
-	midi_port_t **iterator;
-	snd_ctl_t *ctl;
-	snd_rawmidi_info_t *info;
-} scan_t;
-
-static midi_port_t** scan_port_del(alsa_rawmidi_t *midi, midi_port_t **list);
-
-static
-void scan_cleanup(alsa_rawmidi_t *midi)
-{
-	midi_port_t **list = &midi->scan.ports;
-	while (*list)
-		list = scan_port_del(midi, list);
-}
-
-static void scan_card(scan_t *scan);
-static midi_port_t** scan_port_open(alsa_rawmidi_t *midi, midi_port_t **list);
-
-void scan_cycle(alsa_rawmidi_t *midi)
-{
-	int card = -1, err;
-	scan_t scan;
-	midi_port_t **ports;
-
-	//debug_log("scan: cleanup");
-	scan_cleanup(midi);
-
-	scan.midi = midi;
-	scan.iterator = &midi->scan.ports;
-	snd_rawmidi_info_alloca(&scan.info);
-
-	//debug_log("scan: rescan");
-	while ((err = snd_card_next(&card))>=0 && card>=0) {
-		char name[32];
-		snprintf(name, sizeof(name), "hw:%d", card);
-		if ((err = snd_ctl_open(&scan.ctl, name, SND_CTL_NONBLOCK))>=0) {
-			scan_card(&scan);
-			snd_ctl_close(scan.ctl);
-		} else
-			alsa_error("scan: snd_ctl_open", err);
-	}
-
-	// delayed open to workaround alsa<1.0.14 bug (can't open more than 1 subdevice if ctl is opened).
-	ports = &midi->scan.ports;
-	while (*ports) {
-		midi_port_t *port = *ports;
-		if (port->state == PORT_CREATED)
-			ports = scan_port_open(midi, ports);
-		else
-			ports = &port->next;
-	}
-}
-
-static void scan_device(scan_t *scan);
-
-static
-void scan_card(scan_t *scan)
-{
-	int device = -1;
-	int err;
-
-	while ((err = snd_ctl_rawmidi_next_device(scan->ctl, &device))>=0 && device >=0) {
-		snd_rawmidi_info_set_device(scan->info, device);
-
-		snd_rawmidi_info_set_stream(scan->info, SND_RAWMIDI_STREAM_INPUT);
-		snd_rawmidi_info_set_subdevice(scan->info, 0);
-		if ((err = snd_ctl_rawmidi_info(scan->ctl, scan->info))>=0)
-			scan_device(scan);
-		else if (err != -ENOENT)
-			alsa_error("scan: snd_ctl_rawmidi_info on device", err);
-
-		snd_rawmidi_info_set_stream(scan->info, SND_RAWMIDI_STREAM_OUTPUT);
-		snd_rawmidi_info_set_subdevice(scan->info, 0);
-		if ((err = snd_ctl_rawmidi_info(scan->ctl, scan->info))>=0)
-			scan_device(scan);
-		else if (err != -ENOENT)
-			alsa_error("scan: snd_ctl_rawmidi_info on device", err);
-	}
-}
-
-static void scan_port_update(scan_t *scan);
-
-static
-void scan_device(scan_t *scan)
-{
-	int err;
-	int sub, nsubs = 0;
-	nsubs = snd_rawmidi_info_get_subdevices_count(scan->info);
-
-	for (sub=0; sub<nsubs; ++sub) {
-		snd_rawmidi_info_set_subdevice(scan->info, sub);
-		if ((err = snd_ctl_rawmidi_info(scan->ctl, scan->info)) < 0) {
-			alsa_error("scan: snd_ctl_rawmidi_info on subdevice", err);
-			continue;
-		}
-		scan_port_update(scan);
-	}
-}
-
-static midi_port_t** scan_port_add(scan_t *scan, const alsa_id_t *id, midi_port_t **list);
-
-static
-void scan_port_update(scan_t *scan)
-{
-	midi_port_t **list = scan->iterator;
-	alsa_id_t id;
-	alsa_get_id(&id, scan->info);
-
-	while (*list && alsa_id_before(&(*list)->id, &id))
-		list = scan_port_del(scan->midi, list);
-
-	if (!*list || alsa_id_before(&id, &(*list)->id))
-		list = scan_port_add(scan, &id, list);
-	else if (*list)
-		list = &(*list)->next;
-
-	scan->iterator = list;
-}
-
-static
-midi_port_t** scan_port_add(scan_t *scan, const alsa_id_t *id, midi_port_t **list)
-{
-	midi_port_t *port;
-	midi_stream_t *str = id->id[2] ? &scan->midi->out : &scan->midi->in;
-
-	port = calloc(1, str->port_size);
-	if (!port)
-		return list;
-	midi_port_init(scan->midi, port, scan->info, id);
-
-	port->next = *list;
-	*list = port;
-	error_log("scan: added port %s %s", port->dev, port->name);
-	return &port->next;
-}
-
-static
-midi_port_t** scan_port_open(alsa_rawmidi_t *midi, midi_port_t **list)
-{
-	midi_stream_t *str;
-	midi_port_t *port;
-
-	port = *list;
-	str = port->id.id[2] ? &midi->out : &midi->in;
-
-	if (jack_ringbuffer_write_space(str->jack.new_ports) < sizeof(port))
-		goto fail_0;
-
-	if (midi_port_open(midi, port))
-		goto fail_1;
-	if ((str->port_init)(midi, port))
-		goto fail_2;
-
-	port->state = PORT_ADDED_TO_JACK;
-	jack_ringbuffer_write(str->jack.new_ports, (char*) &port, sizeof(port));
-
-	error_log("scan: opened port %s %s", port->dev, port->name);
-	return &port->next;
-
- fail_2:
- 	(str->port_close)(midi, port);
- fail_1:
-	midi_port_close(midi, port);
-	port->state = PORT_ZOMBIFIED;
- fail_0:
-	error_log("scan: can't open port %s %s", port->dev, port->name);
-	return &port->next;
-}
-
-static
-midi_port_t** scan_port_del(alsa_rawmidi_t *midi, midi_port_t **list)
-{
-	midi_port_t *port = *list;
-	if (port->state == PORT_REMOVED_FROM_JACK) {
-		error_log("scan: deleted port %s %s", port->dev, port->name);
-		*list = port->next;
-		if (port->id.id[2] )
-			(midi->out.port_close)(midi, port);
-		else
-			(midi->in.port_close)(midi, port);
-		midi_port_close(midi, port);
-		free(port);
-		return list;
-	} else {
-		//debug_log("can't delete port %s, wrong state: %d", port->name, (int)port->state);
-		return &port->next;
-	}
-}
-
-void* scan_thread(void *arg)
-{
-	alsa_rawmidi_t *midi = arg;
-	struct pollfd wakeup;
-
-	wakeup.fd = midi->scan.wake_pipe[0];
-	wakeup.events = POLLIN|POLLERR|POLLNVAL;
-	while (midi->keep_walking) {
-		int res;
-		//error_log("scanning....");
-		scan_cycle(midi);
-		res = poll(&wakeup, 1, 2000);
-		if (res>0) {
-			char c;
-			read(wakeup.fd, &c, 1);
-		} else if (res<0 && errno != EINTR)
-			break;
-	}
-	return NULL;
-}
-
-
-/* 
- * ------------------------------- Input/Output  ------------------------------
- */
-
-static
-void jack_add_ports(midi_stream_t *str)
-{
-	midi_port_t *port;
-	while (can_pass(sizeof(port), str->jack.new_ports, str->midi.new_ports) && str->jack.nports < MAX_PORTS) {
-		jack_ringbuffer_read(str->jack.new_ports, (char*)&port, sizeof(port));
-		str->jack.ports[str->jack.nports++] = port;
-		port->state = PORT_ADDED_TO_MIDI;
-		jack_ringbuffer_write(str->midi.new_ports, (char*)&port, sizeof(port));
-	}
-}
-
-static
-void jack_process(midi_stream_t *str, jack_nframes_t nframes)
-{
-	int r, w;
-	process_jack_t proc;
-	jack_nframes_t cur_frames;
-
-	if (!str->owner->keep_walking)
-		return;
-
-	proc.midi = str->owner;
-	proc.nframes = nframes;
-	proc.frame_time = jack_last_frame_time(proc.midi->client);
-	cur_frames = jack_frame_time(proc.midi->client);
-	if (proc.frame_time + proc.nframes < cur_frames) {
-		int periods_lost = (cur_frames - proc.frame_time) / proc.nframes;
-		proc.frame_time += periods_lost * proc.nframes;
-		debug_log("xrun detected: %d periods lost", periods_lost);
-	}
-
-	// process existing ports
-	for (r=0, w=0; r<str->jack.nports; ++r) {
-		midi_port_t *port = str->jack.ports[r];
-		proc.port = port;
-
-		assert (port->state > PORT_ADDED_TO_JACK && port->state < PORT_REMOVED_FROM_JACK);
-
-		proc.buffer = jack_port_get_buffer(port->jack, nframes);
-		if (str->mode == POLLIN)
-			jack_midi_clear_buffer(proc.buffer);
-
-		if (port->state == PORT_REMOVED_FROM_MIDI) {
-			port->state = PORT_REMOVED_FROM_JACK; // this signals to scan thread
-			continue; // this effectively removes port from the midi->in.jack.ports[]
-		}
-
-		(str->process_jack)(&proc);
-
-		if (r != w)
-			str->jack.ports[w] = port;
-		++w;
-	}
-	if (str->jack.nports != w)
-		debug_log("jack_%s: nports %d -> %d", str->name, str->jack.nports, w);
-	str->jack.nports = w;
-
-	jack_add_ports(str); // it makes no sense to add them earlier since they have no data yet
-
-	// wake midi thread
-	write(str->wake_pipe[1], &r, 1);
-}
-
-static
-void *midi_thread(void *arg)
-{
-	midi_stream_t *str = arg;
-	alsa_rawmidi_t *midi = str->owner;
-	struct pollfd pfds[MAX_PFDS];
-	int npfds;
-	jack_time_t wait_nsec = 1000*1000*1000; // 1 sec
-	process_midi_t proc;
-
-	proc.midi = midi;
-	proc.mode = str->mode;
-
-	pfds[0].fd = str->wake_pipe[0];
-	pfds[0].events = POLLIN|POLLERR|POLLNVAL;
-	npfds = 1;
-
-	//debug_log("midi_thread(%s): enter", str->name);
-
-	while (midi->keep_walking) {
-		int poll_timeout;
-		int wait_nanosleep;
-		int r=1, w=1; // read,write pos in pfds
-		int rp=0, wp=0; // read, write pos in ports
-
-		// sleep
-		//if (wait_nsec != 1000*1000*1000) {
-		//	debug_log("midi_thread(%s): ", str->name);
-		//	assert (wait_nsec == 1000*1000*1000);
-		//}
-		poll_timeout = wait_nsec / (1000*1000);
-		wait_nanosleep = wait_nsec % (1000*1000);
-		if (wait_nanosleep > NANOSLEEP_RESOLUTION) {
-			struct timespec ts;
-			ts.tv_sec = 0;
-			ts.tv_nsec = wait_nanosleep;
-			clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
-		}
-		int res = poll((struct pollfd*)&pfds, npfds, poll_timeout);
-		//debug_log("midi_thread(%s): poll exit: %d", str->name, res);
-		if (!midi->keep_walking)
-			break;
-		if (res < 0) {
-			if (errno == EINTR)
-				continue;
-			error_log("midi_thread(%s) poll failed: %s", str->name, strerror(errno));
-			break;
-		}
-
-		// check wakeup pipe
-		if (pfds[0].revents & ~POLLIN)
-			break;
-		if (pfds[0].revents & POLLIN) {
-			char c;
-			read(pfds[0].fd, &c, 1);
-		}
-
-		// add new ports
-		while (jack_ringbuffer_read_space(str->midi.new_ports) >= sizeof(midi_port_t*) && str->midi.nports < MAX_PORTS) {
-			midi_port_t *port;
-			jack_ringbuffer_read(str->midi.new_ports, (char*)&port, sizeof(port));
-			str->midi.ports[str->midi.nports++] = port;
-			debug_log("midi_thread(%s): added port %s", str->name, port->name);
-		}
-
-//		if (res == 0)
-//			continue;
-
-		// process ports
-		proc.cur_time = 0; //jack_frame_time(midi->client);
-		proc.next_time = NFRAMES_INF;
-
-		for (rp = 0; rp < str->midi.nports; ++rp) {
-			midi_port_t *port = str->midi.ports[rp];
-			proc.cur_time = jack_frame_time(midi->client);
-			proc.port = port;
-			proc.rpfds = &pfds[r];
-			proc.wpfds = &pfds[w];
-			proc.max_pfds = MAX_PFDS - w;
-			r += port->npfds;
-			if (!(str->process_midi)(&proc)) {
-				port->state = PORT_REMOVED_FROM_MIDI; // this signals to jack thread
-				continue; // this effectively removes port from array
-			}
-			w += port->npfds;
-			if (rp != wp)
-				str->midi.ports[wp] = port;
-			++wp;
-		}
-		if (str->midi.nports != wp)
-			debug_log("midi_%s: nports %d -> %d", str->name, str->midi.nports, wp);
-		str->midi.nports = wp;
-		if (npfds != w)
-			debug_log("midi_%s: npfds %d -> %d", str->name, npfds, w);
-		npfds = w;
-
-		/*
-		 * Input : ports do not set proc.next_time.
-		 * Output: port sets proc.next_time ONLY if it does not have queued data.
-		 * So, zero timeout will not cause busy-looping.
-		 */
-		if (proc.next_time < proc.cur_time) {
-			debug_log("%s: late: next_time = %d, cur_time = %d", str->name, (int)proc.next_time, (int)proc.cur_time);
-			wait_nsec = 0; // we are late
-		} else if (proc.next_time != NFRAMES_INF) {
-			jack_time_t wait_frames = proc.next_time - proc.cur_time;
-			jack_nframes_t rate = jack_get_sample_rate(midi->client);
-			wait_nsec = (wait_frames * (1000*1000*1000)) / rate;
-			debug_log("midi_%s: timeout = %d", str->name, (int)wait_frames);
-		} else
-			wait_nsec = 1000*1000*1000;
-		//debug_log("midi_thread(%s): wait_nsec = %lld", str->name, wait_nsec);
-	}
-	return NULL;
-}
-
-static
-int midi_is_ready(process_midi_t *proc)
-{
-	midi_port_t *port = proc->port;
-	if (port->npfds) {
-		unsigned short revents = 0;
-		int res = snd_rawmidi_poll_descriptors_revents(port->rawmidi, proc->rpfds, port->npfds, &revents);
-		if (res) {
-			error_log("snd_rawmidi_poll_descriptors_revents failed on port %s with: %s", port->name, snd_strerror(res));
-			return 0;
-		}
-
-		if (revents & ~proc->mode) {
-			debug_log("midi: port %s failed", port->name);
-			return 0;
-		}
-		if (revents & proc->mode) {
-			port->is_ready = 1;
-			debug_log("midi: is_ready %s", port->name);
-		}
-	}
-	return 1;
-}
-
-static
-int midi_update_pfds(process_midi_t *proc)
-{
-	midi_port_t *port = proc->port;
-	if (port->npfds == 0) {
-		port->npfds = snd_rawmidi_poll_descriptors_count(port->rawmidi);
-		if (port->npfds > proc->max_pfds) {
-			debug_log("midi: not enough pfds for port %s", port->name);
-			return 0;
-		}
-		snd_rawmidi_poll_descriptors(port->rawmidi, proc->wpfds, port->npfds);
-	} else if (proc->rpfds != proc->wpfds) {
-		memmove(proc->wpfds, proc->rpfds, sizeof(struct pollfd) * port->npfds);
-	}
-	return 1;
-}
-
-/* 
- * ------------------------------------ Input ------------------------------
- */
-
-static
-int input_port_init(alsa_rawmidi_t *midi, midi_port_t *port)
-{
-	input_port_t *in = (input_port_t*)port;
-	midi_unpack_init(&in->unpack);
-	return 0;
-}
-
-static
-void input_port_close(alsa_rawmidi_t *midi, midi_port_t *port)
-{
-}
-
-/*
- * Jack-level input.
- */
-
-static
-void do_jack_input(process_jack_t *p)
-{
-	input_port_t *port = (input_port_t*) p->port;
-	event_head_t event;
-	while (jack_ringbuffer_read_space(port->base.event_ring) >= sizeof(event)) {
-		jack_ringbuffer_data_t vec[2];
-		jack_nframes_t time;
-		int i, todo;
-
-		jack_ringbuffer_read(port->base.event_ring, (char*)&event, sizeof(event));
-		// TODO: take into account possible warping
-		if ((event.time + p->nframes) < p->frame_time)
-			time = 0;
-		else if (event.time >= p->frame_time)
-			time = p->nframes -1;
-		else
-			time = event.time + p->nframes - p->frame_time;
-
-		jack_ringbuffer_get_read_vector(port->base.data_ring, vec);
-		assert ((vec[0].len + vec[1].len) >= event.size);
-
-		if (event.overruns)
-			midi_unpack_reset(&port->unpack);
-
-		todo = event.size;
-		for (i=0; i<2 && todo>0; ++i) {
-			int avail = todo < vec[i].len ? todo : vec[i].len;
-			int done = midi_unpack_buf(&port->unpack, (unsigned char*)vec[i].buf, avail, p->buffer, time);
-			if (done != avail) {
-				debug_log("jack_in: buffer overflow in port %s", port->base.name);
-				break;
-			}
-			todo -= done;
-		}
-		jack_ringbuffer_read_advance(port->base.data_ring, event.size);
-	}
-}
-
-/*
- * Low level input.
- */
-static
-int do_midi_input(process_midi_t *proc)
-{
-	input_port_t *port = (input_port_t*) proc->port;
-	if (!midi_is_ready(proc))
-		return 0;
-
-	if (port->base.is_ready) {
-		jack_ringbuffer_data_t vec[2];
-		int res;
-
-		jack_ringbuffer_get_write_vector(port->base.data_ring, vec);
-		if (jack_ringbuffer_write_space(port->base.event_ring) < sizeof(event_head_t) || vec[0].len < 1) {
-			port->overruns++;
-			if (port->base.npfds)
-				debug_log("midi_in: internal overflow on %s", port->base.name);
-			// remove from poll to prevent busy-looping
-			port->base.npfds = 0;
-			return 1;
-		}
-		res = snd_rawmidi_read(port->base.rawmidi, vec[0].buf, vec[0].len);
-		if (res < 0 && res != -EWOULDBLOCK) {
-			error_log("midi_in: reading from port %s failed: %s", port->base.name, snd_strerror(res));
-			return 0;
-		} else if (res > 0) {
-			event_head_t event;
-			event.time = proc->cur_time;
-			event.size = res;
-			event.overruns = port->overruns;
-			port->overruns = 0;
-			debug_log("midi_in: read %d bytes at %d", (int)event.size, (int)event.time);
-			jack_ringbuffer_write_advance(port->base.data_ring, event.size);
-			jack_ringbuffer_write(port->base.event_ring, (char*)&event, sizeof(event));
-		}
-		port->base.is_ready = 0;
-	}
-
-	if (!midi_update_pfds(proc))
-		return 0;
-
-	return 1;
-}
-
-/* 
- * ------------------------------------ Output ------------------------------
- */
-
-static int output_port_init(alsa_rawmidi_t *midi, midi_port_t *port)
-{
-	output_port_t *out = (output_port_t*)port;
-	midi_pack_reset(&out->packer);
-	out->next_event.time = 0;
-	out->next_event.size = 0;
-	out->todo = 0;
-	return 0;
-}
-
-static void output_port_close(alsa_rawmidi_t *midi, midi_port_t *port)
-{
-}
-
-static
-void do_jack_output(process_jack_t *proc)
-{
-	output_port_t *port = (output_port_t*) proc->port;
-	int nevents = jack_midi_get_event_count(proc->buffer);
-	int i;
-	if (nevents)
-		debug_log("jack_out: %d events in %s", nevents, port->base.name);
-	for (i=0; i<nevents; ++i) {
-		jack_midi_event_t event;
-		event_head_t hdr;
-
-		jack_midi_event_get(&event, proc->buffer, i);
-
-		if (jack_ringbuffer_write_space(port->base.data_ring) < event.size || jack_ringbuffer_write_space(port->base.event_ring) < sizeof(hdr)) {
-			debug_log("jack_out: output buffer overflow on %s", port->base.name);
-			break;
-		}
-
-		midi_pack_event(&port->packer, &event);
-
-		jack_ringbuffer_write(port->base.data_ring, (char*)event.buffer, event.size);
-
-		hdr.time = proc->frame_time + event.time + proc->nframes;
-		hdr.size = event.size;
-		jack_ringbuffer_write(port->base.event_ring, (char*)&hdr, sizeof(hdr));
-		debug_log("jack_out: sent %d-byte event at %ld", (int)event.size, (long)event.time);
-	}
-}
-
-static
-int do_midi_output(process_midi_t *proc)
-{
-	int worked = 0;
-	output_port_t *port = (output_port_t*) proc->port;
-
-	if (!midi_is_ready(proc))
-		return 0;
-
-	// eat events
-	while (port->next_event.time <= proc->cur_time) {
-		port->todo += port->next_event.size;
-		if (jack_ringbuffer_read(port->base.event_ring, (char*)&port->next_event, sizeof(port->next_event))!=sizeof(port->next_event)) {
-			port->next_event.time = 0;
-			port->next_event.size = 0;
-			break;
-		} else
-			debug_log("midi_out: at %ld got %d bytes for %ld", (long)proc->cur_time, (int)port->next_event.size, (long)port->next_event.time);
-	}
-	
-	if (port->todo)
-		debug_log("midi_out: todo = %d at %ld", (int)port->todo, (long)proc->cur_time);
-
-	// calc next wakeup time
-	if (!port->todo && port->next_event.time && port->next_event.time < proc->next_time) {
-		proc->next_time = port->next_event.time;
-		debug_log("midi_out: next_time = %ld", (long)proc->next_time);
-	}
-
-	if (port->todo && port->base.is_ready) {
-		// write data
-		int size = port->todo;
-		int res;
-		jack_ringbuffer_data_t vec[2];
-
-		jack_ringbuffer_get_read_vector(port->base.data_ring, vec);
-		if (size > vec[0].len) {
-			size = vec[0].len;
-			assert (size > 0);
-		}
-		res = snd_rawmidi_write(port->base.rawmidi, vec[0].buf, size);
-		if (res > 0) {
-			jack_ringbuffer_read_advance(port->base.data_ring, res);
-			debug_log("midi_out: written %d bytes to %s", res, port->base.name);
-			port->todo -= res;
-			worked = 1;
-		} else if (res == -EWOULDBLOCK) {
-			port->base.is_ready = 0;
-			debug_log("midi_out: -EWOULDBLOCK on %s", port->base.name);
-			return 1;
-		} else {
-			error_log("midi_out: writing to port %s failed: %s", port->base.name, snd_strerror(res));
-			return 0;
-		}
-		snd_rawmidi_drain(port->base.rawmidi);
-	}
-
-	// update pfds for this port
-	if (!midi_update_pfds(proc))
-		return 0;
-
-	if (!port->todo) {
-		int i;
-		if (worked)
-			debug_log("midi_out: relaxing on %s", port->base.name);
-		for (i=0; i<port->base.npfds; ++i)
-			proc->wpfds[i].events &= ~POLLOUT;
-	} else {
-		int i;
-		for (i=0; i<port->base.npfds; ++i)
-			proc->wpfds[i].events |= POLLOUT;
-	}
-	return 1;
-}
diff --git a/drivers/alsa-midi/alsa_seqmidi.c b/drivers/alsa-midi/alsa_seqmidi.c
deleted file mode 100644
index 6b4d667..0000000
--- a/drivers/alsa-midi/alsa_seqmidi.c
+++ /dev/null
@@ -1,925 +0,0 @@
-/*
- * ALSA SEQ < - > JACK MIDI bridge
- *
- * Copyright (c) 2006,2007 Dmitry S. Baikov <c0ff at konstruktiv.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-/*
- * alsa_seqmidi_read:
- *	add new ports
- * 	reads queued snd_seq_event's
- * 	if PORT_EXIT: mark port as dead
- * 	if PORT_ADD, PORT_CHANGE: send addr to port_thread (it also may mark port as dead)
- * 	else process input event
- * 	remove dead ports and send them to port_thread
- *
- * alsa_seqmidi_write:
- * 	remove dead ports and send them to port_thread
- * 	add new ports
- * 	queue output events
- *
- * port_thread:
- * 	wait for port_sem
- * 	free deleted ports
- * 	create new ports or mark existing as dead
- */
-#include <alsa/asoundlib.h>
-#include <jack/jack.h>
-#include <jack/midiport.h>
-#include <jack/ringbuffer.h>
-#include <jack/thread.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <signal.h>
-#include <semaphore.h>
-#include <time.h>
-#include <ctype.h>
-
-#include "alsa_midi.h"
-
-#ifndef SND_SEQ_PORT_TYPE_PORT
-#define SND_SEQ_PORT_TYPE_PORT (1<<19)  /* Appears in version 1.0.12rc1 */
-#endif
-
-#ifndef SND_SEQ_PORT_TYPE_HARDWARE
-#define SND_SEQ_PORT_TYPE_HARDWARE (1<<16)  /* Appears in version 1.0.12rc1 */
-#endif
-
-#ifdef STANDALONE
-#define MESSAGE(...) fprintf(stderr, __VA_ARGS__)
-#else
-#include <jack/messagebuffer.h>
-#endif
-
-#define info_log(...)  MESSAGE(__VA_ARGS__)
-#define error_log(...) MESSAGE(__VA_ARGS__)
-
-#ifdef JACK_MIDI_DEBUG
-#define debug_log(...) MESSAGE(__VA_ARGS__)
-#else
-#define debug_log(...)
-#endif
-
-#define NSEC_PER_SEC ((int64_t)1000*1000*1000)
-
-enum {
-	MAX_PORTS = 64,
-	MAX_EVENT_SIZE = 1024,
-};
-
-typedef struct port_t port_t;
-
-enum {
-	PORT_HASH_BITS = 4,
-	PORT_HASH_SIZE = 1 << PORT_HASH_BITS
-};
-
-typedef port_t* port_hash_t[PORT_HASH_SIZE];
-
-struct port_t {
-	port_t *next;
-	int is_dead;
-	char name[64];
-	snd_seq_addr_t remote;
-	jack_port_t *jack_port;
-
-	jack_ringbuffer_t *early_events; // alsa_midi_event_t + data
-	int64_t last_out_time;
-
-	void *jack_buf;
-};
-
-typedef struct {
-	snd_midi_event_t *codec;
-
-	jack_ringbuffer_t *new_ports;
-
-	port_t *ports[MAX_PORTS];
-} stream_t;
-
-typedef struct alsa_seqmidi {
-	alsa_midi_t ops;
-	jack_client_t *jack;
-
-	snd_seq_t *seq;
-	int client_id;
-	int port_id;
-	int queue;
-
-	int keep_walking;
-
-	pthread_t port_thread;
-	sem_t port_sem;
-	jack_ringbuffer_t *port_add; // snd_seq_addr_t
-	jack_ringbuffer_t *port_del; // port_t*
-
-	stream_t stream[2];
-
-	char alsa_name[32];
-} alsa_seqmidi_t;
-
-struct alsa_midi_event {
-	int64_t time;
-	int size;
-};
-typedef struct alsa_midi_event alsa_midi_event_t;
-
-struct process_info {
-	int dir;
-	jack_nframes_t nframes;
-	jack_nframes_t period_start;
-	jack_nframes_t sample_rate;
-	jack_nframes_t cur_frames;
-	int64_t alsa_time;
-};
-
-
-enum PortType { PORT_INPUT = 0, PORT_OUTPUT = 1 };
-
-typedef void (*port_jack_func)(alsa_seqmidi_t *self, port_t *port,struct process_info* info);
-static void do_jack_input(alsa_seqmidi_t *self, port_t *port, struct process_info* info);
-static void do_jack_output(alsa_seqmidi_t *self, port_t *port, struct process_info* info);
-
-typedef struct {
-	int alsa_mask;
-	int jack_caps;
-	char name[9];
-	port_jack_func jack_func;
-} port_type_t;
-
-static port_type_t port_type[2] = {
-	{
-		SND_SEQ_PORT_CAP_SUBS_READ,
-		JackPortIsOutput,
-		"capture",
-		do_jack_input
-	},
-	{
-		SND_SEQ_PORT_CAP_SUBS_WRITE,
-		JackPortIsInput,
-		"playback",
-		do_jack_output
-	}
-};
-
-
-static void alsa_seqmidi_delete(alsa_midi_t *m);
-static int alsa_seqmidi_attach(alsa_midi_t *m);
-static int alsa_seqmidi_detach(alsa_midi_t *m);
-static int alsa_seqmidi_start(alsa_midi_t *m);
-static int alsa_seqmidi_stop(alsa_midi_t *m);
-static void alsa_seqmidi_read(alsa_midi_t *m, jack_nframes_t nframes);
-static void alsa_seqmidi_write(alsa_midi_t *m, jack_nframes_t nframes);
-
-static
-void stream_init(alsa_seqmidi_t *self, int dir)
-{
-	stream_t *str = &self->stream[dir];
-
-	str->new_ports = jack_ringbuffer_create(MAX_PORTS*sizeof(port_t*));
-	snd_midi_event_new(MAX_EVENT_SIZE, &str->codec);
-}
-
-static void port_free(alsa_seqmidi_t *self, port_t *port);
-static void free_ports(alsa_seqmidi_t *self, jack_ringbuffer_t *ports);
-
-static
-void stream_attach(alsa_seqmidi_t *self, int dir)
-{
-}
-
-static
-void stream_detach(alsa_seqmidi_t *self, int dir)
-{
-	stream_t *str = &self->stream[dir];
-	int i;
-
-	free_ports(self, str->new_ports);
-
-	// delete all ports from hash
-	for (i=0; i<PORT_HASH_SIZE; ++i) {
-		port_t *port = str->ports[i];
-		while (port) {
-			port_t *next = port->next;
-			port_free(self, port);
-			port = next;
-		}
-		str->ports[i] = NULL;
-	}
-}
-
-static
-void stream_close(alsa_seqmidi_t *self, int dir)
-{
-	stream_t *str = &self->stream[dir];
-
-	if (str->codec)
-		snd_midi_event_free(str->codec);
-	if (str->new_ports)
-		jack_ringbuffer_free(str->new_ports);
-}
-
-alsa_midi_t* alsa_seqmidi_new(jack_client_t *client, const char* alsa_name)
-{
-	alsa_seqmidi_t *self = calloc(1, sizeof(alsa_seqmidi_t));
-	debug_log("midi: new\n");
-	if (!self)
-		return NULL;
-	self->jack = client;
-	if (!alsa_name)
-		alsa_name = "jack_midi";
-	snprintf(self->alsa_name, sizeof(self->alsa_name), "%s", alsa_name);
-
-	self->port_add = jack_ringbuffer_create(2*MAX_PORTS*sizeof(snd_seq_addr_t));
-	self->port_del = jack_ringbuffer_create(2*MAX_PORTS*sizeof(port_t*));
-	sem_init(&self->port_sem, 0, 0);
-
-	stream_init(self, PORT_INPUT);
-	stream_init(self, PORT_OUTPUT);
-
-	self->ops.destroy = alsa_seqmidi_delete;
-	self->ops.attach = alsa_seqmidi_attach;
-	self->ops.detach = alsa_seqmidi_detach;
-	self->ops.start = alsa_seqmidi_start;
-	self->ops.stop = alsa_seqmidi_stop;
-	self->ops.read = alsa_seqmidi_read;
-	self->ops.write = alsa_seqmidi_write;
-	return &self->ops;
-}
-
-static
-void alsa_seqmidi_delete(alsa_midi_t *m)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-
-	debug_log("midi: delete\n");
-	alsa_seqmidi_detach(m);
-
-	stream_close(self, PORT_OUTPUT);
-	stream_close(self, PORT_INPUT);
-
-	jack_ringbuffer_free(self->port_add);
-	jack_ringbuffer_free(self->port_del);
-	sem_close(&self->port_sem);
-
-	free(self);
-}
-
-static
-int alsa_seqmidi_attach(alsa_midi_t *m)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-	int err;
-
-	debug_log("midi: attach\n");
-
-	if (self->seq)
-		return -EALREADY;
-
-	if ((err = snd_seq_open(&self->seq, "hw", SND_SEQ_OPEN_DUPLEX, 0)) < 0) {
-		error_log("failed to open alsa seq");
-		return err;
-	}
-	snd_seq_set_client_name(self->seq, self->alsa_name);
-	self->port_id = snd_seq_create_simple_port(self->seq, "port",
-		SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_WRITE
-#ifndef JACK_MIDI_DEBUG
-		|SND_SEQ_PORT_CAP_NO_EXPORT
-#endif
-		,SND_SEQ_PORT_TYPE_APPLICATION);
-	self->client_id = snd_seq_client_id(self->seq);
-
-  	self->queue = snd_seq_alloc_queue(self->seq);
-  	snd_seq_start_queue(self->seq, self->queue, 0); 
-
-	stream_attach(self, PORT_INPUT);
-	stream_attach(self, PORT_OUTPUT);
-
-	snd_seq_nonblock(self->seq, 1);
-
-	return 0;
-}
-
-static
-int alsa_seqmidi_detach(alsa_midi_t *m)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-
-	debug_log("midi: detach\n");
-
-	if (!self->seq)
-		return -EALREADY;
-
-	alsa_seqmidi_stop(m);
-
-	jack_ringbuffer_reset(self->port_add);
-	free_ports(self, self->port_del);
-
-	stream_detach(self, PORT_INPUT);
-	stream_detach(self, PORT_OUTPUT);
-
-	snd_seq_close(self->seq);
-	self->seq = NULL;
-
-	return 0;
-}
-
-static void* port_thread(void *);
-
-static void add_existing_ports(alsa_seqmidi_t *self);
-static void update_ports(alsa_seqmidi_t *self);
-static void add_ports(stream_t *str);
-
-static
-int alsa_seqmidi_start(alsa_midi_t *m)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-	int err;
-
-	debug_log("midi: start\n");
-
-	if (!self->seq)
-		return -EBADF;
-
-	if (self->keep_walking)
-		return -EALREADY;
-
-	snd_seq_connect_from(self->seq, self->port_id, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
-	snd_seq_drop_input(self->seq);
-
-	add_existing_ports(self);
-	update_ports(self);
-	add_ports(&self->stream[PORT_INPUT]);
-	add_ports(&self->stream[PORT_OUTPUT]);
-
-	self->keep_walking = 1;
-
-	if ((err = pthread_create(&self->port_thread, NULL, port_thread, self))) {
-		self->keep_walking = 0;
-		return -errno;
-	}
-
-	return 0;
-}
-
-static
-int alsa_seqmidi_stop(alsa_midi_t *m)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-
-	debug_log("midi: stop\n");
-
-	if (!self->keep_walking)
-		return -EALREADY;
-
-	snd_seq_disconnect_from(self->seq, self->port_id, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
-
-	self->keep_walking = 0;
-
-	sem_post(&self->port_sem);
-	pthread_join(self->port_thread, NULL);
-	self->port_thread = 0;
-
-	return 0;
-}
-
-static
-int alsa_connect_from(alsa_seqmidi_t *self, int client, int port)
-{
-	snd_seq_port_subscribe_t* sub;
-	snd_seq_addr_t seq_addr;
-	int err;
-
-	snd_seq_port_subscribe_alloca(&sub);
-	seq_addr.client = client;
-	seq_addr.port = port;
-	snd_seq_port_subscribe_set_sender(sub, &seq_addr);
-	seq_addr.client = self->client_id;
-	seq_addr.port = self->port_id;
-	snd_seq_port_subscribe_set_dest(sub, &seq_addr);
-
-	snd_seq_port_subscribe_set_time_update(sub, 1);
-	snd_seq_port_subscribe_set_queue(sub, self->queue);
-	snd_seq_port_subscribe_set_time_real(sub, 1);
-
-	if ((err=snd_seq_subscribe_port(self->seq, sub)))
-		error_log("can't subscribe to %d:%d - %s\n", client, port, snd_strerror(err));
-	return err;
-}
-
-/*
- * ==================== Port routines =============================
- */
-static inline
-int port_hash(snd_seq_addr_t addr)
-{
-	return (addr.client + addr.port) % PORT_HASH_SIZE;
-}
-
-static
-port_t* port_get(port_hash_t hash, snd_seq_addr_t addr)
-{
-	port_t **pport = &hash[port_hash(addr)];
-	while (*pport) {
-		port_t *port = *pport;
-		if (port->remote.client == addr.client && port->remote.port == addr.port)
-			return port;
-		pport = &port->next;
-	}
-	return NULL;
-}
-
-static
-void port_insert(port_hash_t hash, port_t *port)
-{
-	port_t **pport = &hash[port_hash(port->remote)];
-	port->next = *pport;
-	*pport = port;
-}
-
-static
-void port_setdead(port_hash_t hash, snd_seq_addr_t addr)
-{
-	port_t *port = port_get(hash, addr);
-	if (port)
-		port->is_dead = 1; // see jack_process
-	else
-		debug_log("port_setdead: not found (%d:%d)\n", addr.client, addr.port);
-}
-
-static
-void port_free(alsa_seqmidi_t *self, port_t *port)
-{
-	//snd_seq_disconnect_from(self->seq, self->port_id, port->remote.client, port->remote.port);
-	//snd_seq_disconnect_to(self->seq, self->port_id, port->remote.client, port->remote.port);
-	if (port->early_events)
-		jack_ringbuffer_free(port->early_events);
-	if (port->jack_port)
-		jack_port_unregister(self->jack, port->jack_port);
-	// info_log("port deleted: %s\n", port->name);
-
-	free(port);
-}
-
-static
-port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const snd_seq_port_info_t *info)
-{
-	snd_seq_client_info_t* client_info;
-	port_t *port;
-	char *c;
-	int err;
-	int jack_caps;
-
-	port = calloc(1, sizeof(port_t));
-	if (!port)
-		return NULL;
-
-	port->remote = addr;
-
-	snd_seq_client_info_alloca (&client_info);
-	snd_seq_get_any_client_info (self->seq, addr.client, client_info);
-
-	snprintf(port->name, sizeof(port->name), "%s/midi_%s_%d",
-		 snd_seq_client_info_get_name(client_info), port_type[type].name, addr.port+1);
-
-	// replace all offending characters by -
-	for (c = port->name; *c; ++c)
-		if (!isalnum(*c) && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')')
-			*c = '-';
-
-	jack_caps = port_type[type].jack_caps;
-
-	/* mark anything that looks like a hardware port as physical&terminal */
-
-	if (snd_seq_port_info_get_type (info) & (SND_SEQ_PORT_TYPE_HARDWARE|SND_SEQ_PORT_TYPE_PORT|SND_SEQ_PORT_TYPE_SPECIFIC)) {
-		jack_caps |= (JackPortIsPhysical|JackPortIsTerminal);
-	}
-			
-	port->jack_port = jack_port_register(self->jack,
-		port->name, JACK_DEFAULT_MIDI_TYPE, jack_caps, 0);
-	if (!port->jack_port)
-		goto failed;
-
-	/* generate an alias */
-
-	snprintf(port->name, sizeof(port->name), "%s:midi/%s_%d",
-		 snd_seq_client_info_get_name (client_info), port_type[type].name, addr.port+1);
-
-	// replace all offending characters by -
-	for (c = port->name; *c; ++c)
-		if (!isalnum(*c) && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')')
-			*c = '-';
-
-	jack_port_set_alias (port->jack_port, port->name);
-
-	if (type == PORT_INPUT)
-		err = alsa_connect_from(self, port->remote.client, port->remote.port);
-	else
-		err = snd_seq_connect_to(self->seq, self->port_id, port->remote.client, port->remote.port);
-	if (err)
-		goto failed;
-
-	port->early_events = jack_ringbuffer_create(MAX_EVENT_SIZE*16);
-
-	// info_log("port created: %s\n", port->name);
-	return port;
-
- failed:
- 	port_free(self, port);
-	return NULL;
-}
-
-/*
- * ==================== Port add/del handling thread ==============================
- */
-static
-void update_port_type(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, int caps, const snd_seq_port_info_t *info)
-{
-	stream_t *str = &self->stream[type];
-	int alsa_mask = port_type[type].alsa_mask;
-	port_t *port = port_get(str->ports, addr);
-
-	debug_log("update_port_type(%d:%d)\n", addr.client, addr.port);
-
-	if (port && (caps & alsa_mask)!=alsa_mask) {
-		debug_log("setdead: %s\n", port->name);
-		port->is_dead = 1;
-	}
-
-	if (!port && (caps & alsa_mask)==alsa_mask) {
-		assert (jack_ringbuffer_write_space(str->new_ports) >= sizeof(port));
-		port = port_create(self, type, addr, info);
-		if (port)
-			jack_ringbuffer_write(str->new_ports, (char*)&port, sizeof(port));
-	}
-}
-
-static
-void update_port(alsa_seqmidi_t *self, snd_seq_addr_t addr, const snd_seq_port_info_t *info)
-{
-	unsigned int port_caps = snd_seq_port_info_get_capability(info);
-	if (port_caps & SND_SEQ_PORT_CAP_NO_EXPORT)
-		return;
-	update_port_type(self, PORT_INPUT, addr, port_caps, info);
-	update_port_type(self, PORT_OUTPUT,addr, port_caps, info);
-}
-
-static
-void free_ports(alsa_seqmidi_t *self, jack_ringbuffer_t *ports)
-{
-	port_t *port;
-	int sz;
-	while ((sz = jack_ringbuffer_read(ports, (char*)&port, sizeof(port)))) {
-		assert (sz == sizeof(port));
-		port_free(self, port);
-	}
-}
-
-static
-void update_ports(alsa_seqmidi_t *self)
-{
-	snd_seq_addr_t addr;
-	snd_seq_port_info_t *info;
-	int size;
-
-	snd_seq_port_info_alloca(&info);
-
-	while ((size = jack_ringbuffer_read(self->port_add, (char*)&addr, sizeof(addr)))) {
-		
-		int err;
-
-		assert (size == sizeof(addr));
-		assert (addr.client != self->client_id);
-		if ((err=snd_seq_get_any_port_info(self->seq, addr.client, addr.port, info))>=0) {
-			update_port(self, addr, info);
-		} else {
-			//port_setdead(self->stream[PORT_INPUT].ports, addr);
-			//port_setdead(self->stream[PORT_OUTPUT].ports, addr);
-		}
-	}
-}
-
-static
-void* port_thread(void *arg)
-{
-	alsa_seqmidi_t *self = arg;
-
-	while (self->keep_walking) {
-		sem_wait(&self->port_sem);
-		free_ports(self, self->port_del);
-		update_ports(self);
-	}
-	debug_log("port_thread exited\n");
-	return NULL;
-}
-
-static
-void add_existing_ports(alsa_seqmidi_t *self)
-{
-	snd_seq_addr_t addr;
-	snd_seq_client_info_t *client_info;
-	snd_seq_port_info_t *port_info;
-
-	snd_seq_client_info_alloca(&client_info);
-	snd_seq_port_info_alloca(&port_info);
-	snd_seq_client_info_set_client(client_info, -1);
-	while (snd_seq_query_next_client(self->seq, client_info) >= 0)
-	{
-		addr.client = snd_seq_client_info_get_client(client_info);
-		if (addr.client == SND_SEQ_CLIENT_SYSTEM || addr.client == self->client_id)
-			continue;
-		snd_seq_port_info_set_client(port_info, addr.client);
-		snd_seq_port_info_set_port(port_info, -1);
-		while (snd_seq_query_next_port(self->seq, port_info) >= 0)
-		{
-			addr.port = snd_seq_port_info_get_port(port_info);
-			update_port(self, addr, port_info);
-		}
-	}
-}
-
-/*
- * =================== Input/output port handling =========================
- */
-static
-void set_process_info(struct process_info *info, alsa_seqmidi_t *self, int dir, jack_nframes_t nframes)
-{
-	const snd_seq_real_time_t* alsa_time;
-	snd_seq_queue_status_t *status;
-
-	snd_seq_queue_status_alloca(&status);
-
-	info->dir = dir;
-
-	info->period_start = jack_last_frame_time(self->jack);
-	info->nframes = nframes;
-	info->sample_rate = jack_get_sample_rate(self->jack);
-
-	info->cur_frames = jack_frame_time(self->jack);
-
-	// immediately get alsa'a real time (uhh, why everybody has their on 'real' time)
-	snd_seq_get_queue_status(self->seq, self->queue, status);
-	alsa_time = snd_seq_queue_status_get_real_time(status);
-	info->alsa_time = alsa_time->tv_sec * NSEC_PER_SEC + alsa_time->tv_nsec;
-
-	if (info->period_start + info->nframes < info->cur_frames) {
-		int periods_lost = (info->cur_frames - info->period_start) / info->nframes; 
-		info->period_start += periods_lost * info->nframes;
-		debug_log("xrun detected: %d periods lost\n", periods_lost);
-	}
-}
-
-static
-void add_ports(stream_t *str)
-{
-	port_t *port;
-	while (jack_ringbuffer_read(str->new_ports, (char*)&port, sizeof(port))) {
-		debug_log("jack: inserted port %s\n", port->name);
-		port_insert(str->ports, port);
-	}
-}
-
-static
-void jack_process(alsa_seqmidi_t *self, struct process_info *info)
-{
-	stream_t *str = &self->stream[info->dir];
-	port_jack_func process = port_type[info->dir].jack_func;
-	int i, del=0;
-
-	add_ports(str);
-
-	// process ports
-	for (i=0; i<PORT_HASH_SIZE; ++i) {
-		port_t **pport = &str->ports[i];
-		while (*pport) {
-			port_t *port = *pport;
-			port->jack_buf = jack_port_get_buffer(port->jack_port, info->nframes);
-			if (info->dir == PORT_INPUT)
-				jack_midi_clear_buffer(port->jack_buf);
-
-			if (!port->is_dead)
-				(*process)(self, port, info);
-			else if (jack_ringbuffer_write_space(self->port_del) >= sizeof(port)) {
-				debug_log("jack: removed port %s\n", port->name);
-				*pport = port->next;
-				jack_ringbuffer_write(self->port_del, (char*)&port, sizeof(port));
-				del++;
-				continue;
-			}
-
-			pport = &port->next;
-		}
-	}
-
-	if (del)
-		sem_post(&self->port_sem);
-}
-
-/*
- * ============================ Input ==============================
- */
-static
-void do_jack_input(alsa_seqmidi_t *self, port_t *port, struct process_info *info)
-{
-	// process port->early_events
-	alsa_midi_event_t ev;
-	while (jack_ringbuffer_read(port->early_events, (char*)&ev, sizeof(ev))) {
-		jack_midi_data_t* buf;
-		jack_nframes_t time = ev.time - info->period_start;
-		if (time < 0)
-			time = 0;
-		else if (time >= info->nframes)
-			time = info->nframes - 1;
-		buf = jack_midi_event_reserve(port->jack_buf, time, ev.size);
-		if (buf)
-			jack_ringbuffer_read(port->early_events, (char*)buf, ev.size);
-		else
-			jack_ringbuffer_read_advance(port->early_events, ev.size);
-		debug_log("input: it's time for %d bytes at %d\n", ev.size, time);
-	}
-}
-
-static
-void port_event(alsa_seqmidi_t *self, snd_seq_event_t *ev)
-{
-	const snd_seq_addr_t addr = ev->data.addr;
-
-	if (addr.client == self->client_id)
-		return;
-
-	if (ev->type == SND_SEQ_EVENT_PORT_START || ev->type == SND_SEQ_EVENT_PORT_CHANGE) {
-		assert (jack_ringbuffer_write_space(self->port_add) >= sizeof(addr));
-
-		debug_log("port_event: add/change %d:%d\n", addr.client, addr.port);
-		jack_ringbuffer_write(self->port_add, (char*)&addr, sizeof(addr));
-		sem_post(&self->port_sem);
-	} else if (ev->type == SND_SEQ_EVENT_PORT_EXIT) {
-		debug_log("port_event: del %d:%d\n", addr.client, addr.port);
-		port_setdead(self->stream[PORT_INPUT].ports, addr);
-		port_setdead(self->stream[PORT_OUTPUT].ports, addr);
-	}
-}
-
-static
-void input_event(alsa_seqmidi_t *self, snd_seq_event_t *alsa_event, struct process_info* info)
-{
-	jack_midi_data_t data[MAX_EVENT_SIZE];
-	stream_t *str = &self->stream[PORT_INPUT];
-	long size;
-	int64_t alsa_time, time_offset;
-	int64_t frame_offset, event_frame;
-	port_t *port;
-
-	port = port_get(str->ports, alsa_event->source);
-	if (!port)
-		return;
-
-	/*
-	 * RPNs, NRPNs, Bank Change, etc. need special handling
-	 * but seems, ALSA does it for us already.
-	 */
-	snd_midi_event_reset_decode(str->codec);
-	if ((size = snd_midi_event_decode(str->codec, data, sizeof(data), alsa_event))<0)
-		return;
-
-	// fixup NoteOn with vel 0
-	if ((data[0] & 0xF0) == 0x90 && data[2] == 0x00) {
-		data[0] = 0x80 + (data[0] & 0x0F);
-		data[2] = 0x40;
-	}
-
-	alsa_time = alsa_event->time.time.tv_sec * NSEC_PER_SEC + alsa_event->time.time.tv_nsec;
-	time_offset = info->alsa_time - alsa_time;
-	frame_offset = (info->sample_rate * time_offset) / NSEC_PER_SEC;
-	event_frame = (int64_t)info->cur_frames - info->period_start - frame_offset + info->nframes;
-
-	debug_log("input: %d bytes at event_frame=%d\n", (int)size, (int)event_frame);
-
-	if (event_frame >= info->nframes &&
-	    jack_ringbuffer_write_space(port->early_events) >= (sizeof(alsa_midi_event_t) + size)) {
-		alsa_midi_event_t ev;
-		ev.time = event_frame + info->period_start;
-		ev.size = size;
-		jack_ringbuffer_write(port->early_events, (char*)&ev, sizeof(ev));
-		jack_ringbuffer_write(port->early_events, (char*)data, size);
-		debug_log("postponed to next frame +%d\n", (int) (event_frame - info->nframes)); 
-		return;
-	}
-
-	if (event_frame < 0)
-		event_frame = 0;
-	else if (event_frame >= info->nframes)
-		event_frame = info->nframes - 1;
-
-	jack_midi_event_write(port->jack_buf, event_frame, data, size);
-}
-
-static
-void alsa_seqmidi_read(alsa_midi_t *m, jack_nframes_t nframes)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-	int res;
-	snd_seq_event_t *event;
-	struct process_info info;
-
-	if (!self->keep_walking)
-		return;
-
-	set_process_info(&info, self, PORT_INPUT, nframes);
-	jack_process(self, &info); 
-
-	while ((res = snd_seq_event_input(self->seq, &event))>0) {
-		if (event->source.client == SND_SEQ_CLIENT_SYSTEM)
-			port_event(self, event);
-		else
-			input_event(self, event, &info);
-	}
-}
-
-/*
- * ============================ Output ==============================
- */
-
-static
-void do_jack_output(alsa_seqmidi_t *self, port_t *port, struct process_info* info)
-{
-	stream_t *str = &self->stream[info->dir];
-	int nevents = jack_midi_get_event_count(port->jack_buf);
-	int i;
-	for (i=0; i<nevents; ++i) {
-		jack_midi_event_t jack_event;
-		snd_seq_event_t alsa_event;
-		int64_t frame_offset;
-		int64_t out_time;
-		snd_seq_real_time_t out_rt;
-		int err;
-
-		jack_midi_event_get(&jack_event, port->jack_buf, i);
-
-		snd_seq_ev_clear(&alsa_event);
-		snd_midi_event_reset_encode(str->codec);
-		if (!snd_midi_event_encode(str->codec, jack_event.buffer, jack_event.size, &alsa_event))
-			continue; // invalid event
-
-		snd_seq_ev_set_source(&alsa_event, self->port_id);
-		snd_seq_ev_set_dest(&alsa_event, port->remote.client, port->remote.port);
-
-		/* NOTE: in case of xrun it could become negative, so it is essential to use signed type! */
-		frame_offset = (int64_t)jack_event.time + info->period_start + info->nframes - info->cur_frames;
-		if (frame_offset < 0) {
-			frame_offset = info->nframes + jack_event.time;
-			error_log("internal xrun detected: frame_offset = %"PRId64"\n", frame_offset);
-		}
-		/* Ken Ellinwood reported problems with this assert.
-		 * Seems, magic 2 should be replaced with nperiods. */
-		//FIXME: assert (frame_offset < info->nframes*2);
-		//if (frame_offset < info->nframes * info->nperiods)
-		//        debug_log("alsa_out: BLAH-BLAH-BLAH");
-
-		out_time = info->alsa_time + (frame_offset * NSEC_PER_SEC) / info->sample_rate;
-
-		// we should use absolute time to prevent reordering caused by rounding errors
-		if (out_time < port->last_out_time) {
-			debug_log("alsa_out: limiting out_time %lld at %lld\n", out_time, port->last_out_time);
-			out_time = port->last_out_time;
-		} else
-			port->last_out_time = out_time;
-
-		out_rt.tv_nsec = out_time % NSEC_PER_SEC;
-		out_rt.tv_sec = out_time / NSEC_PER_SEC;
-		snd_seq_ev_schedule_real(&alsa_event, self->queue, 0, &out_rt);
-
-		err = snd_seq_event_output(self->seq, &alsa_event);
-
-		debug_log("alsa_out: written %d bytes to %s at %d (%lld): %d %s\n",
-			jack_event.size, port->name, (int)frame_offset, out_time - info->alsa_time, err, err < 0 ? snd_strerror(err) : "bytes queued");
-	}
-}
-
-static
-void alsa_seqmidi_write(alsa_midi_t *m, jack_nframes_t nframes)
-{
-	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
-	struct process_info info;
-
-	if (!self->keep_walking)
-		return;
-
-	set_process_info(&info, self, PORT_OUTPUT, nframes);
-	jack_process(self, &info);
-	snd_seq_drain_output(self->seq);
-}
diff --git a/drivers/alsa-midi/midi_pack.h b/drivers/alsa-midi/midi_pack.h
deleted file mode 100644
index 1688e89..0000000
--- a/drivers/alsa-midi/midi_pack.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2006,2007 Dmitry S. Baikov
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-#ifndef __jack_midi_pack_h__
-#define __jack_midi_pack_h__
-
-#include <jack/midiport.h>
-#include <jack/engine.h>
-
-typedef struct {
-	int running_status;
-} midi_pack_t;
-
-static inline
-void midi_pack_reset(midi_pack_t *p)
-{
-	p->running_status = 0;
-}
-
-static
-void midi_pack_event(midi_pack_t *p, jack_midi_event_t *e)
-{
-	if (e->buffer[0] >= 0x80 && e->buffer[0] < 0xF0) { // Voice Message
-		if (e->buffer[0] == p->running_status) {
-			e->buffer++;
-			e->size--;
-		} else
-			p->running_status = e->buffer[0];
-	} else if (e->buffer[0] < 0xF8) { // not System Realtime
-		p->running_status = 0;
-	}
-}
-
-#endif /* __jack_midi_pack_h__ */
diff --git a/drivers/alsa-midi/midi_unpack.h b/drivers/alsa-midi/midi_unpack.h
deleted file mode 100644
index e464e75..0000000
--- a/drivers/alsa-midi/midi_unpack.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2006,2007 Dmitry S. Baikov
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-#ifndef __jack_midi_unpack_h__
-#define __jack_midi_unpack_h__
-
-#include <jack/midiport.h>
-#include <jack/engine.h>
-
-enum {
-	MIDI_UNPACK_MAX_MSG = 1024
-};
-
-typedef struct {
-	int pos, need, size;
-	unsigned char data[MIDI_UNPACK_MAX_MSG];
-} midi_unpack_t;
-
-static inline
-void midi_unpack_init(midi_unpack_t *u)
-{
-	u->pos = 0;
-	u->size = sizeof(u->data);
-	u->need = u->size;
-}
-
-static inline
-void midi_unpack_reset(midi_unpack_t *u)
-{
-	u->pos = 0;
-	u->need = u->size;
-}
-
-static const unsigned char midi_voice_len[] = {
-	3, /*0x80 Note Off*/
-	3, /*0x90 Note On*/
-	3, /*0xA0 Aftertouch*/
-	3, /*0xB0 Control Change*/
-	2, /*0xC0 Program Change*/
-	2, /*0xD0 Channel Pressure*/
-	3, /*0xE0 Pitch Wheel*/
-	1  /*0xF0 System*/
-};
-
-static const unsigned char midi_system_len[] = {
-	0, /*0xF0 System Exclusive Start*/
-	2, /*0xF1 MTC Quarter Frame*/
-	3, /*0xF2 Song Postion*/
-	2, /*0xF3 Song Select*/
-	0, /*0xF4 undefined*/
-	0, /*0xF5 undefined*/
-	1, /*0xF6 Tune Request*/
-	1  /*0xF7 System Exlusive End*/
-};
-
-static
-int midi_unpack_buf(midi_unpack_t *buf, const unsigned char *data, int len, void *jack_port_buf, jack_nframes_t time)
-{
-	int i;
-	for (i=0; i<len; ++i)
-	{
-		const unsigned char byte = data[i];
-		if (byte >= 0xF8) // system realtime
-		{
-			jack_midi_event_write(jack_port_buf, time, &data[i], 1);
-			//jack_error("midi_unpack: written system relatime event\n");
-			//midi_input_write(in, &data[i], 1);
-		}
-		else if (byte < 0x80) // data
-		{
-			assert (buf->pos < buf->size);
-			buf->data[buf->pos++] = byte;
-		}
-		else if (byte < 0xF0) // voice
-		{
-			assert (byte >= 0x80 && byte < 0xF0);
-			//buf->need = ((byte|0x0F) == 0xCF || (byte|0x0F)==0xDF) ? 2 : 3;
-			buf->need = midi_voice_len[(byte-0x80)>>4];
-			buf->data[0] = byte;
-			buf->pos = 1;
-		}
-		else if (byte == 0xF7) // sysex end
-		{
-			assert (buf->pos < buf->size);
-			buf->data[buf->pos++] = byte;
-			buf->need = buf->pos;
-		}
-		else
-		{
-			assert (byte >= 0xF0 && byte < 0xF8);
-			buf->pos = 1;
-			buf->data[0] = byte;
-			buf->need = midi_system_len[byte - 0xF0];
-			if (!buf->need)
-				buf->need = buf->size;
-		}
-		if (buf->pos == buf->need)
-		{
-			// TODO: deal with big sysex'es (they are silently dropped for now)
-			if (buf->data[0] >= 0x80 || (buf->data[0]==0xF0 && buf->data[buf->pos-1] == 0xF7)) {
-				/* convert Note On with velocity 0 to Note Off */
-				if ((buf->data[0] & 0xF0) == 0x90 && buf->data[2] == 0) {
-					// we use temp array here to keep running status in sync
-					jack_midi_data_t temp[3] = { 0x80, 0, 0x40 };
-					temp[0] |= buf->data[0] & 0x0F;
-					temp[1] = buf->data[1];
-					jack_midi_event_write(jack_port_buf, time, temp, 3);
-				} else
-					jack_midi_event_write(jack_port_buf, time, &buf->data[0], buf->pos);
-				//jack_error("midi_unpack: written %d-byte event\n", buf->pos);
-				//midi_input_write(in, &buf->data[0], buf->pos);
-			}
-			/* keep running status */
-			if (buf->data[0] >= 0x80 && buf->data[0] < 0xF0)
-				buf->pos = 1;
-			else
-			{
-				buf->pos = 0;
-				buf->need = buf->size;
-			}
-		}
-	}
-	assert (i==len);
-	return i;
-}
-
-#endif /* __jack_midi_unpack_h__ */
diff --git a/drivers/alsa/.cvsignore b/drivers/alsa/.cvsignore
deleted file mode 100644
index 9f99dba..0000000
--- a/drivers/alsa/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-jack_alsa.la
-jack_alsa_pcm.la
diff --git a/drivers/alsa/Makefile.am b/drivers/alsa/Makefile.am
deleted file mode 100644
index f0058a2..0000000
--- a/drivers/alsa/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-MAINTAINERCLEANFILES=Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS)
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_alsa.la
-
-jack_alsa_la_LDFLAGS = -module -avoid-version
-jack_alsa_la_SOURCES = alsa_driver.c generic_hw.c memops.c \
-		       hammerfall.c hdsp.c ice1712.c usx2y.c \
-                       ../alsa-midi/alsa_rawmidi.c ../alsa-midi/alsa_seqmidi.c
-
-jack_alsa_la_CFLAGS = -I../alsa-midi
-
-noinst_HEADERS = alsa_driver.h \
-		generic.h \
-		hammerfall.h \
-		hdsp.h \
-		ice1712.h \
-		usx2y.h
-
-jack_alsa_la_LIBADD = $(ALSA_LIBS) 
diff --git a/drivers/alsa/alsa_driver.c b/drivers/alsa/alsa_driver.c
deleted file mode 100644
index 51009fa..0000000
--- a/drivers/alsa/alsa_driver.c
+++ /dev/null
@@ -1,2662 +0,0 @@
-/* -*- mode: c; c-file-style: "linux"; -*- */
-/*
-    Copyright (C) 2001 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <string.h>
- 
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/messagebuffer.h>
-
-#include <sysdeps/time.h>
-
-#include "alsa_driver.h"
-#include "hammerfall.h"
-#include "hdsp.h"
-#include "ice1712.h"
-#include "usx2y.h"
-#include "generic.h"
-
-extern void store_work_time (int);
-extern void store_wait_time (int);
-extern void show_wait_times ();
-extern void show_work_times ();
-
-#undef DEBUG_WAKEUP
-
-/* Delay (in process calls) before jackd will report an xrun */
-#define XRUN_REPORT_DELAY 0
-
-static void
-alsa_driver_release_channel_dependent_memory (alsa_driver_t *driver)
-{
-	bitset_destroy (&driver->channels_done);
-	bitset_destroy (&driver->channels_not_done);
-
-	if (driver->playback_addr) {
-		free (driver->playback_addr);
-		driver->playback_addr = 0;
-	}
-
-	if (driver->capture_addr) {
-		free (driver->capture_addr);
-		driver->capture_addr = 0;
-	}
-
-	if (driver->playback_interleave_skip) {
-		free (driver->playback_interleave_skip);
-		driver->playback_interleave_skip = NULL;
-	}
-
-	if (driver->capture_interleave_skip) {
-		free (driver->capture_interleave_skip);
-		driver->capture_interleave_skip = NULL;
-	}
-
-	if (driver->silent) {
-		free (driver->silent);
-		driver->silent = 0;
-	}
-
-	if (driver->dither_state) {
-		free (driver->dither_state);
-		driver->dither_state = 0;
-	}
-}
-
-static int
-alsa_driver_check_capabilities (alsa_driver_t *driver)
-{
-	return 0;
-}
-
-static int
-alsa_driver_check_card_type (alsa_driver_t *driver)
-{
-	int err;
-	snd_ctl_card_info_t *card_info;
-	char * ctl_name;
-	regex_t expression;
-
-	snd_ctl_card_info_alloca (&card_info);
-
-	regcomp(&expression,"(plug)?hw:[0-9](,[0-9])?",REG_ICASE|REG_EXTENDED);
-	
-       	if (!regexec(&expression,driver->alsa_name_playback,0,NULL,0)) {
-		/* the user wants a hw or plughw device, the ctl name
-		 * should be hw:x where x is the card number */
-	
-		char tmp[5];
-		strncpy(tmp,strstr(driver->alsa_name_playback,"hw"),4);
-		tmp[4]='\0';
-		jack_info("control device %s",tmp);
-		ctl_name = strdup(tmp);
-	} else {
-		ctl_name = strdup(driver->alsa_name_playback);
-	}
-
-	// XXX: I don't know the "right" way to do this. Which to use
-	// driver->alsa_name_playback or driver->alsa_name_capture.
-	if ((err = snd_ctl_open (&driver->ctl_handle, ctl_name, 0)) < 0) {
-		jack_error ("control open \"%s\" (%s)", ctl_name,
-			    snd_strerror(err));
-	} else if ((err = snd_ctl_card_info(driver->ctl_handle, card_info)) < 0) {
-		jack_error ("control hardware info \"%s\" (%s)",
-			    driver->alsa_name_playback, snd_strerror (err));
-		snd_ctl_close (driver->ctl_handle);
-	}
-
-	driver->alsa_driver = strdup(snd_ctl_card_info_get_driver (card_info));
-
-	regfree(&expression);
-	free(ctl_name);
-
-	return alsa_driver_check_capabilities (driver);
-}
-
-static int
-alsa_driver_hammerfall_hardware (alsa_driver_t *driver)
-{
-	driver->hw = jack_alsa_hammerfall_hw_new (driver);
-	return 0;
-}
-
-static int
-alsa_driver_hdsp_hardware (alsa_driver_t *driver)
-{
-	driver->hw = jack_alsa_hdsp_hw_new (driver);
-	return 0;
-}
-
-static int
-alsa_driver_ice1712_hardware (alsa_driver_t *driver)
-{
-        driver->hw = jack_alsa_ice1712_hw_new (driver);
-        return 0;
-}
-
-static int
-alsa_driver_usx2y_hardware (alsa_driver_t *driver)
-{
-	driver->hw = jack_alsa_usx2y_hw_new (driver);
-	return 0;
-}
-
-static int
-alsa_driver_generic_hardware (alsa_driver_t *driver)
-{
-	driver->hw = jack_alsa_generic_hw_new (driver);
-	return 0;
-}
-
-static int
-alsa_driver_hw_specific (alsa_driver_t *driver, int hw_monitoring,
-			 int hw_metering)
-{
-	int err;
-
-	if (!strcmp(driver->alsa_driver, "RME9652")) {
-		if ((err = alsa_driver_hammerfall_hardware (driver)) != 0) {
-			return err;
-		}
-	} else if (!strcmp(driver->alsa_driver, "H-DSP")) {
-                if ((err = alsa_driver_hdsp_hardware (driver)) !=0) {
-                        return err;
-                }
-	} else if (!strcmp(driver->alsa_driver, "ICE1712")) {
-                if ((err = alsa_driver_ice1712_hardware (driver)) !=0) {
-                        return err;
-                }
-	} else if (!strcmp(driver->alsa_driver, "USB US-X2Y")) {
-		if ((err = alsa_driver_usx2y_hardware (driver)) !=0) {
-				return err;
-		}
-	} else {
-	        if ((err = alsa_driver_generic_hardware (driver)) != 0) {
-			return err;
-		}
-	}
-
-	if (driver->hw->capabilities & Cap_HardwareMonitoring) {
-		driver->has_hw_monitoring = TRUE;
-		/* XXX need to ensure that this is really FALSE or
-		 * TRUE or whatever*/
-		driver->hw_monitoring = hw_monitoring;
-	} else {
-		driver->has_hw_monitoring = FALSE;
-		driver->hw_monitoring = FALSE;
-	}
-
-	if (driver->hw->capabilities & Cap_ClockLockReporting) {
-		driver->has_clock_sync_reporting = TRUE;
-	} else {
-		driver->has_clock_sync_reporting = FALSE;
-	}
-
-	if (driver->hw->capabilities & Cap_HardwareMetering) {
-		driver->has_hw_metering = TRUE;
-		driver->hw_metering = hw_metering;
-	} else {
-		driver->has_hw_metering = FALSE;
-		driver->hw_metering = FALSE;
-	}
-
-	return 0;
-}
-
-static void
-alsa_driver_setup_io_function_pointers (alsa_driver_t *driver)
-{
-	if (SND_PCM_FORMAT_FLOAT_LE == driver->playback_sample_format) {
-		if (driver->playback_interleaved) {
-			driver->channel_copy = memcpy_interleave_d32_s32;
-		} else {
-			driver->channel_copy = memcpy_fake;
-		}
-		driver->read_via_copy = sample_move_floatLE_sSs;
-		driver->write_via_copy = sample_move_dS_floatLE;
-	} else {
-
-		switch (driver->playback_sample_bytes) {
-		case 2:
-			if (driver->playback_interleaved) {
-				driver->channel_copy = memcpy_interleave_d16_s16;
-			} else {
-				driver->channel_copy = memcpy_fake;
-			}
-			
-			switch (driver->dither) {
-			case Rectangular:
-				jack_info("Rectangular dithering at 16 bits");
-				driver->write_via_copy = driver->quirk_bswap?
-                                        sample_move_dither_rect_d16_sSs:
-                                        sample_move_dither_rect_d16_sS;
-				break;
-				
-			case Triangular:
-				jack_info("Triangular dithering at 16 bits");
-				driver->write_via_copy = driver->quirk_bswap?
-                                        sample_move_dither_tri_d16_sSs:
-                                        sample_move_dither_tri_d16_sS;
-				break;
-				
-			case Shaped:
-				jack_info("Noise-shaped dithering at 16 bits");
-				driver->write_via_copy = driver->quirk_bswap?
-                                        sample_move_dither_shaped_d16_sSs:
-                                        sample_move_dither_shaped_d16_sS;
-				break;
-				
-			default:
-				driver->write_via_copy = driver->quirk_bswap?
-                                        sample_move_d16_sSs : 
-        				sample_move_d16_sS;
-				break;
-			}
-			break;
-			
-		case 3: /* NO DITHER */
-			if (driver->playback_interleaved) {
-				driver->channel_copy = memcpy_interleave_d24_s24;
-			} else {
-				driver->channel_copy = memcpy_fake;
-			}
-			
-			driver->write_via_copy = driver->quirk_bswap?
-				sample_move_d24_sSs: 
-				sample_move_d24_sS;
-
-			break;
-									
-	 	case 4: /* NO DITHER */
-			if (driver->playback_interleaved) {
-				driver->channel_copy = memcpy_interleave_d32_s32;
-			} else {
-				driver->channel_copy = memcpy_fake;
-			}
-
-			driver->write_via_copy = driver->quirk_bswap?
-				sample_move_d32u24_sSs: 
-				sample_move_d32u24_sS;
-		    break;
-
-		default:
-			jack_error ("impossible sample width (%d) discovered!",
-				    driver->playback_sample_bytes);
-			exit (1);
-		}
-	}
-	
-	switch (driver->capture_sample_bytes) {
-	case 2:
-		driver->read_via_copy = driver->quirk_bswap?
-			sample_move_dS_s16s: 
-		        sample_move_dS_s16;
-		break;
-	case 3:
-		driver->read_via_copy = driver->quirk_bswap?
-			sample_move_dS_s24s: 
-		        sample_move_dS_s24;
-		break;
-	case 4:
-		driver->read_via_copy = driver->quirk_bswap?
-		 	sample_move_dS_s32u24s: 
-		        sample_move_dS_s32u24;
-		break;
-	}
-}
-
-static int
-alsa_driver_configure_stream (alsa_driver_t *driver, char *device_name,
-			      const char *stream_name,
-			      snd_pcm_t *handle, 
-			      snd_pcm_hw_params_t *hw_params, 
-			      snd_pcm_sw_params_t *sw_params, 
-			      unsigned int *nperiodsp,
-			      channel_t *nchns,
-			      unsigned long sample_width)
-{
-	int err, format;
-	unsigned int frame_rate;
-	snd_pcm_uframes_t stop_th;
-	static struct {
-		char Name[32];
-		snd_pcm_format_t format;
-		int swapped;
-	} formats[] = {
- 	    {"32bit float little-endian", SND_PCM_FORMAT_FLOAT_LE},
-		{"32bit integer little-endian", SND_PCM_FORMAT_S32_LE, IS_LE},
-		{"32bit integer big-endian", SND_PCM_FORMAT_S32_BE, IS_BE},
-		{"24bit little-endian", SND_PCM_FORMAT_S24_3LE, IS_LE},
-		{"24bit big-endian", SND_PCM_FORMAT_S24_3BE, IS_BE},
-		{"16bit little-endian", SND_PCM_FORMAT_S16_LE, IS_LE},
-		{"16bit big-endian", SND_PCM_FORMAT_S16_BE, IS_BE},
-	};
-#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
-#define FIRST_16BIT_FORMAT 5
-
-	if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0)  {
-		jack_error ("ALSA: no playback configurations available (%s)",
-			    snd_strerror (err));
-		return -1;
-	}
-
-	if ((err = snd_pcm_hw_params_set_periods_integer (handle, hw_params))
-	    < 0) {
-		jack_error ("ALSA: cannot restrict period size to integral"
-			    " value.");
-		return -1;
-	}
-
-	if ((err = snd_pcm_hw_params_set_access (handle, hw_params, SND_PCM_ACCESS_MMAP_NONINTERLEAVED)) < 0) {
-		if ((err = snd_pcm_hw_params_set_access (handle, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0) {
-			if ((err = snd_pcm_hw_params_set_access (
-				     handle, hw_params,
-				     SND_PCM_ACCESS_MMAP_COMPLEX)) < 0) {
-				jack_error ("ALSA: mmap-based access is not possible"
-					    " for the %s "
-					    "stream of this audio interface",
-					    stream_name);
-				return -1;
-			}
-		}
-	}
-	
-	format = (sample_width == 4) ? 0 : NUMFORMATS - 1;
-
-	while (1) {
-		if ((err = snd_pcm_hw_params_set_format (
-			     handle, hw_params, formats[format].format)) < 0) {
-
-			if ((sample_width == 4
-			     ? format++ >= NUMFORMATS - 1
-			     : format-- <= 0)) {
-				jack_error ("Sorry. The audio interface \"%s\""
-					    " doesn't support any of the"
-					    " hardware sample formats that"
-					    " JACK's alsa-driver can use.",
-					    device_name);
-				return -1;
-			}
-		} else {
-			if (formats[format].swapped) {
-				driver->quirk_bswap = 1;
-			} else {
-				driver->quirk_bswap = 0;
-			}
-			jack_info ("ALSA: final selected sample format for %s: %s", stream_name, formats[format].Name);
-			break;
-		}
-	} 
-
-	frame_rate = driver->frame_rate ;
-	err = snd_pcm_hw_params_set_rate_near (handle, hw_params,
-					       &frame_rate, NULL) ;
-	driver->frame_rate = frame_rate ;
-	if (err < 0) {
-		jack_error ("ALSA: cannot set sample/frame rate to %"
-			    PRIu32 " for %s", driver->frame_rate,
-			    stream_name);
-		return -1;
-	}
-	if (!*nchns) {
-		/*if not user-specified, try to find the maximum
-		 * number of channels */
-		unsigned int channels_max ;
-		err = snd_pcm_hw_params_get_channels_max (hw_params,
-							  &channels_max);
-		*nchns = channels_max ;
-
-		if (*nchns > 1024) { 
-
-			/* the hapless user is an unwitting victim of
-			   the "default" ALSA PCM device, which can
-			   support up to 16 million channels. since
-			   they can't be bothered to set up a proper
-			   default device, limit the number of
-			   channels for them to a sane default.
-			*/
-
-			jack_error (
-"You appear to be using the ALSA software \"plug\" layer, probably\n"
-"a result of using the \"default\" ALSA device. This is less\n"
-"efficient than it could be. Consider using a hardware device\n"
-"instead rather than using the plug layer. Usually the name of the\n"
-"hardware device that corresponds to the first sound card is hw:0\n"
-				);
-			*nchns = 2;  
-		}
-	}				
-
-	if ((err = snd_pcm_hw_params_set_channels (handle, hw_params,
-						   *nchns)) < 0) {
-		jack_error ("ALSA: cannot set channel count to %u for %s",
-			    *nchns, stream_name);
-		return -1;
-	}
-	
-	if ((err = snd_pcm_hw_params_set_period_size (handle, hw_params,
-						      driver->frames_per_cycle,
-						      0))
-	    < 0) {
-		jack_error ("ALSA: cannot set period size to %" PRIu32
-			    " frames for %s", driver->frames_per_cycle,
-			    stream_name);
-		return -1;
-	}
-
-	*nperiodsp = driver->user_nperiods;
-	snd_pcm_hw_params_set_periods_min (handle, hw_params, nperiodsp, NULL);
-	if (*nperiodsp < driver->user_nperiods)
-		*nperiodsp = driver->user_nperiods;
-	if (snd_pcm_hw_params_set_periods_near (handle, hw_params,
-						nperiodsp, NULL) < 0) {
-		jack_error ("ALSA: cannot set number of periods to %u for %s",
-			    *nperiodsp, stream_name);
-		return -1;
-	}
-
-	if (*nperiodsp < driver->user_nperiods) {
-		jack_error ("ALSA: got smaller periods %u than %u for %s",
-			    *nperiodsp, (unsigned int) driver->user_nperiods,
-			    stream_name);
-		return -1;
-	}
-	jack_info ("ALSA: use %d periods for %s", *nperiodsp, stream_name);
-#if 0	
-	if (!jack_power_of_two(driver->frames_per_cycle)) {
-		jack_error("JACK: frames must be a power of two "
-			   "(64, 512, 1024, ...)\n");
-		return -1;
-	}
-#endif
-
-	if ((err = snd_pcm_hw_params_set_buffer_size (handle, hw_params,
-						      *nperiodsp *
-						      driver->frames_per_cycle))
-	    < 0) {
-		jack_error ("ALSA: cannot set buffer length to %" PRIu32
-			    " for %s",
-			    *nperiodsp * driver->frames_per_cycle,
-			    stream_name);
-		return -1;
-	}
-
-	if ((err = snd_pcm_hw_params (handle, hw_params)) < 0) {
-		jack_error ("ALSA: cannot set hardware parameters for %s",
-			    stream_name);
-		return -1;
-	}
-
-	snd_pcm_sw_params_current (handle, sw_params);
-
-	if ((err = snd_pcm_sw_params_set_start_threshold (handle, sw_params,
-							  0U)) < 0) {
-		jack_error ("ALSA: cannot set start mode for %s", stream_name);
-		return -1;
-	}
-
-	stop_th = *nperiodsp * driver->frames_per_cycle;
-	if (driver->soft_mode) {
-		stop_th = (snd_pcm_uframes_t)-1;
-	}
-	
-	if ((err = snd_pcm_sw_params_set_stop_threshold (
-		     handle, sw_params, stop_th)) < 0) {
-		jack_error ("ALSA: cannot set stop mode for %s",
-			    stream_name);
-		return -1;
-	}
-
-	if ((err = snd_pcm_sw_params_set_silence_threshold (
-		     handle, sw_params, 0)) < 0) {
-		jack_error ("ALSA: cannot set silence threshold for %s",
-			    stream_name);
-		return -1;
-	}
-
-#if 0
-	jack_info ("set silence size to %lu * %lu = %lu",
-		 driver->frames_per_cycle, *nperiodsp,
-		 driver->frames_per_cycle * *nperiodsp);
-
-	if ((err = snd_pcm_sw_params_set_silence_size (
-		     handle, sw_params,
-		     driver->frames_per_cycle * *nperiodsp)) < 0) {
-		jack_error ("ALSA: cannot set silence size for %s",
-			    stream_name);
-		return -1;
-	}
-#endif
-
-	if (handle == driver->playback_handle)
-		err = snd_pcm_sw_params_set_avail_min (
-			handle, sw_params,
-			driver->frames_per_cycle
-			* (*nperiodsp - driver->user_nperiods + 1));
-	else
-		err = snd_pcm_sw_params_set_avail_min (
-			handle, sw_params, driver->frames_per_cycle);
-			
-	if (err < 0) {
-		jack_error ("ALSA: cannot set avail min for %s", stream_name);
-		return -1;
-	}
-
-	if ((err = snd_pcm_sw_params (handle, sw_params)) < 0) {
-		jack_error ("ALSA: cannot set software parameters for %s\n",
-			    stream_name);
-		return -1;
-	}
-
-	return 0;
-}
-
-static int 
-alsa_driver_set_parameters (alsa_driver_t *driver,
-			    jack_nframes_t frames_per_cycle,
-			    jack_nframes_t user_nperiods,
-			    jack_nframes_t rate)
-{
-	int dir;
-	snd_pcm_uframes_t p_period_size = 0;
-	snd_pcm_uframes_t c_period_size = 0;
-	channel_t chn;
-	unsigned int pr = 0;
-	unsigned int cr = 0;
-	int err;
-
-	driver->frame_rate = rate;
-	driver->frames_per_cycle = frames_per_cycle;
-	driver->user_nperiods = user_nperiods;
-
-	jack_info ("configuring for %" PRIu32 "Hz, period = %"
-		 PRIu32 " frames (%.1f ms), buffer = %" PRIu32 " periods",
-		 rate, frames_per_cycle, (((float)frames_per_cycle / (float) rate) * 1000.0f), user_nperiods);
-	
-	if (driver->capture_handle) {
-		if (alsa_driver_configure_stream (
-			    driver,
-			    driver->alsa_name_capture,
-			    "capture", 
-			    driver->capture_handle,
-			    driver->capture_hw_params,
-			    driver->capture_sw_params,
-			    &driver->capture_nperiods,
-			    &driver->capture_nchannels,
-			    driver->capture_sample_bytes)) {
-			jack_error ("ALSA: cannot configure capture channel");
-			return -1;
-		}
-	}
-
-	if (driver->playback_handle) {
-		if (alsa_driver_configure_stream (
-			    driver,
-			    driver->alsa_name_playback,
-			    "playback",
-			    driver->playback_handle,
-			    driver->playback_hw_params,
-			    driver->playback_sw_params,
-			    &driver->playback_nperiods,
-			    &driver->playback_nchannels,
-			    driver->playback_sample_bytes)) {
-			jack_error ("ALSA: cannot configure playback channel");
-			return -1;
-		}
-	}
-	
-	/* check the rate, since thats rather important */
-
-	if (driver->playback_handle) {
-		snd_pcm_hw_params_get_rate (driver->playback_hw_params,
-					    &pr, &dir);
-	}
-
-	if (driver->capture_handle) {
-		snd_pcm_hw_params_get_rate (driver->capture_hw_params,
-					    &cr, &dir);
-	}
-
-	if (driver->capture_handle && driver->playback_handle) {
-		if (cr != pr) {
-			jack_error ("playback and capture sample rates do "
-				    "not match (%d vs. %d)", pr, cr);
-		}
-
-		/* only change if *both* capture and playback rates
-		 * don't match requested certain hardware actually
-		 * still works properly in full-duplex with slightly
-		 * different rate values between adc and dac
-		 */
-		if (cr != driver->frame_rate && pr != driver->frame_rate) {
-			jack_error ("sample rate in use (%d Hz) does not "
-				    "match requested rate (%d Hz)",
-				    cr, driver->frame_rate);
-			driver->frame_rate = cr;
-		}
-		
-	}
-	else if (driver->capture_handle && cr != driver->frame_rate) {
-		jack_error ("capture sample rate in use (%d Hz) does not "
-			    "match requested rate (%d Hz)",
-			    cr, driver->frame_rate);
-		driver->frame_rate = cr;
-	}
-	else if (driver->playback_handle && pr != driver->frame_rate) {
-		jack_error ("playback sample rate in use (%d Hz) does not "
-			    "match requested rate (%d Hz)",
-			    pr, driver->frame_rate);
-		driver->frame_rate = pr;
-	}
-
-
-	/* check the fragment size, since thats non-negotiable */
-	
-	if (driver->playback_handle) {
- 		snd_pcm_access_t access;
-
- 		err = snd_pcm_hw_params_get_period_size (
- 			driver->playback_hw_params, &p_period_size, &dir);
- 		err = snd_pcm_hw_params_get_format (
- 			driver->playback_hw_params,
-			&(driver->playback_sample_format));
- 		err = snd_pcm_hw_params_get_access (driver->playback_hw_params,
-						    &access);
- 		driver->playback_interleaved =
-			(access == SND_PCM_ACCESS_MMAP_INTERLEAVED) 
-			|| (access == SND_PCM_ACCESS_MMAP_COMPLEX);
-
-		if (p_period_size != driver->frames_per_cycle) {
-			jack_error ("alsa_pcm: requested an interrupt every %"
-				    PRIu32
-				    " frames but got %u frames for playback",
-				    driver->frames_per_cycle, p_period_size);
-			return -1;
-		}
-	}
-
-	if (driver->capture_handle) {
- 		snd_pcm_access_t access;
-
- 		err = snd_pcm_hw_params_get_period_size (
- 			driver->capture_hw_params, &c_period_size, &dir);
- 		err = snd_pcm_hw_params_get_format (
- 			driver->capture_hw_params,
-			&(driver->capture_sample_format));
- 		err = snd_pcm_hw_params_get_access (driver->capture_hw_params,
-						    &access);
- 		driver->capture_interleaved =
-			(access == SND_PCM_ACCESS_MMAP_INTERLEAVED) 
-			|| (access == SND_PCM_ACCESS_MMAP_COMPLEX);
-	
-		if (c_period_size != driver->frames_per_cycle) {
-			jack_error ("alsa_pcm: requested an interrupt every %"
-				    PRIu32
-				    " frames but got %uc frames for capture",
-				    driver->frames_per_cycle, p_period_size);
-			return -1;
-		}
-	}
-
-	driver->playback_sample_bytes =
-		snd_pcm_format_physical_width (driver->playback_sample_format)
-		/ 8;
-	driver->capture_sample_bytes =
-		snd_pcm_format_physical_width (driver->capture_sample_format)
-		/ 8;
-
-	if (driver->playback_handle) {
-		switch (driver->playback_sample_format) {
-        case SND_PCM_FORMAT_FLOAT_LE:
-		case SND_PCM_FORMAT_S32_LE:
-		case SND_PCM_FORMAT_S24_3LE:
-		case SND_PCM_FORMAT_S24_3BE:
-		case SND_PCM_FORMAT_S16_LE:
-		case SND_PCM_FORMAT_S32_BE:
-		case SND_PCM_FORMAT_S16_BE:
-			break;
-
-		default:
-			jack_error ("programming error: unhandled format "
-				    "type for playback");
-			exit (1);
-		}
-	}
-
-	if (driver->capture_handle) {
-		switch (driver->capture_sample_format) {
-        case SND_PCM_FORMAT_FLOAT_LE:
-		case SND_PCM_FORMAT_S32_LE:
-		case SND_PCM_FORMAT_S24_3LE:
-		case SND_PCM_FORMAT_S24_3BE:
-		case SND_PCM_FORMAT_S16_LE:
-		case SND_PCM_FORMAT_S32_BE:
-		case SND_PCM_FORMAT_S16_BE:
-			break;
-
-		default:
-			jack_error ("programming error: unhandled format "
-				    "type for capture");
-			exit (1);
-		}
-	}
-
-	if (driver->playback_interleaved) {
-		const snd_pcm_channel_area_t *my_areas;
-		snd_pcm_uframes_t offset, frames;
-		if (snd_pcm_mmap_begin(driver->playback_handle,
-				       &my_areas, &offset, &frames) < 0) {
-			jack_error ("ALSA: %s: mmap areas info error",
-				    driver->alsa_name_playback);
-			return -1;
-		}
-		driver->interleave_unit =
-			snd_pcm_format_physical_width (
-				driver->playback_sample_format) / 8;
-	} else {
-		driver->interleave_unit = 0;  /* NOT USED */
-	}
-
-	if (driver->capture_interleaved) {
-		const snd_pcm_channel_area_t *my_areas;
-		snd_pcm_uframes_t offset, frames;
-		if (snd_pcm_mmap_begin(driver->capture_handle,
-				       &my_areas, &offset, &frames) < 0) {
-			jack_error ("ALSA: %s: mmap areas info error",
-				    driver->alsa_name_capture);
-			return -1;
-		}
-	}
-
-	if (driver->playback_nchannels > driver->capture_nchannels) {
-		driver->max_nchannels = driver->playback_nchannels;
-		driver->user_nchannels = driver->capture_nchannels;
-	} else {
-		driver->max_nchannels = driver->capture_nchannels;
-		driver->user_nchannels = driver->playback_nchannels;
-	}
-
-	alsa_driver_setup_io_function_pointers (driver);
-
-	/* Allocate and initialize structures that rely on the
-	   channels counts.
-
-	   Set up the bit pattern that is used to record which
-	   channels require action on every cycle. any bits that are
-	   not set after the engine's process() call indicate channels
-	   that potentially need to be silenced.
-	*/
-
-	bitset_create (&driver->channels_done, driver->max_nchannels);
-	bitset_create (&driver->channels_not_done, driver->max_nchannels);
-
-	if (driver->playback_handle) {
-		driver->playback_addr = (char **)
-			malloc (sizeof (char *) * driver->playback_nchannels);
-		memset (driver->playback_addr, 0,
-			sizeof (char *) * driver->playback_nchannels);
-		driver->playback_interleave_skip = (unsigned long *)
-			malloc (sizeof (unsigned long *) * driver->playback_nchannels);
-		memset (driver->playback_interleave_skip, 0,
-			sizeof (unsigned long *) * driver->playback_nchannels);
-		driver->silent = (unsigned long *)
-			malloc (sizeof (unsigned long)
-				* driver->playback_nchannels);
-		
-		for (chn = 0; chn < driver->playback_nchannels; chn++) {
-			driver->silent[chn] = 0;
-		}
-
-		for (chn = 0; chn < driver->playback_nchannels; chn++) {
-			bitset_add (driver->channels_done, chn);
-		}
-
-		driver->dither_state = (dither_state_t *)
-			calloc ( driver->playback_nchannels,
-				 sizeof (dither_state_t));
-	}
-
-	if (driver->capture_handle) {
-		driver->capture_addr = (char **)
-			malloc (sizeof (char *) * driver->capture_nchannels);
-		memset (driver->capture_addr, 0,
-			sizeof (char *) * driver->capture_nchannels);
-		driver->capture_interleave_skip = (unsigned long *)
-			malloc (sizeof (unsigned long *) * driver->capture_nchannels);
-		memset (driver->capture_interleave_skip, 0,
-			sizeof (unsigned long *) * driver->capture_nchannels);
-	}
-
-	driver->clock_sync_data = (ClockSyncStatus *)
-		malloc (sizeof (ClockSyncStatus) * driver->max_nchannels);
-
-	driver->period_usecs =
-		(jack_time_t) floor ((((float) driver->frames_per_cycle) /
-				      driver->frame_rate) * 1000000.0f);
-	driver->poll_timeout = (int) floor (1.5f * driver->period_usecs);
-
-	if (driver->engine) {
-		driver->engine->set_buffer_size (driver->engine,
-						 driver->frames_per_cycle);
-	}
-
-	return 0;
-}	
-
-static int
-alsa_driver_reset_parameters (alsa_driver_t *driver,
-			      jack_nframes_t frames_per_cycle,
-			      jack_nframes_t user_nperiods,
-			      jack_nframes_t rate)
-{
-	/* XXX unregister old ports ? */
-	alsa_driver_release_channel_dependent_memory (driver);
-	return alsa_driver_set_parameters (driver,
-					   frames_per_cycle,
-					   user_nperiods, rate);
-}
-
-static int
-alsa_driver_get_channel_addresses (alsa_driver_t *driver,
-				   snd_pcm_uframes_t *capture_avail,
-				   snd_pcm_uframes_t *playback_avail,
-				   snd_pcm_uframes_t *capture_offset,
-				   snd_pcm_uframes_t *playback_offset)
-{
-	unsigned long err;
-	channel_t chn;
-
-	if (capture_avail) {
-		if ((err = snd_pcm_mmap_begin (
-			     driver->capture_handle, &driver->capture_areas,
-			     (snd_pcm_uframes_t *) capture_offset, 
-			     (snd_pcm_uframes_t *) capture_avail)) < 0) {
-			jack_error ("ALSA: %s: mmap areas info error",
-				    driver->alsa_name_capture);
-			return -1;
-		}
-		
-		for (chn = 0; chn < driver->capture_nchannels; chn++) {
-			const snd_pcm_channel_area_t *a =
-				&driver->capture_areas[chn];
-			driver->capture_addr[chn] = (char *) a->addr
-				+ ((a->first + a->step * *capture_offset) / 8);
-			driver->capture_interleave_skip[chn] = (unsigned long ) (a->step / 8);
-		}
-	} 
-
-	if (playback_avail) {
-		if ((err = snd_pcm_mmap_begin (
-			     driver->playback_handle, &driver->playback_areas, 
-			     (snd_pcm_uframes_t *) playback_offset, 
-			     (snd_pcm_uframes_t *) playback_avail)) < 0) {
-			jack_error ("ALSA: %s: mmap areas info error ",
-				    driver->alsa_name_playback);
-			return -1;
-		}
-		
-		for (chn = 0; chn < driver->playback_nchannels; chn++) {
-			const snd_pcm_channel_area_t *a =
-				&driver->playback_areas[chn];
-			driver->playback_addr[chn] = (char *) a->addr
-				+ ((a->first + a->step * *playback_offset) / 8);
-			driver->playback_interleave_skip[chn] = (unsigned long ) (a->step / 8);
-		}
-	} 
-	
-	return 0;
-}
-
-static int
-alsa_driver_start (alsa_driver_t *driver)
-{
-	int err;
-	snd_pcm_uframes_t poffset, pavail;
-	channel_t chn;
-
-	driver->poll_last = 0;
-	driver->poll_next = 0;
-
-	if (driver->playback_handle) {
-		if ((err = snd_pcm_prepare (driver->playback_handle)) < 0) {
-			jack_error ("ALSA: prepare error for playback on "
-				    "\"%s\" (%s)", driver->alsa_name_playback,
-				    snd_strerror(err));
-			return -1;
-		}
-	}
-
-	if ((driver->capture_handle && driver->capture_and_playback_not_synced)
-	    || !driver->playback_handle) {
-		if ((err = snd_pcm_prepare (driver->capture_handle)) < 0) {
-			jack_error ("ALSA: prepare error for capture on \"%s\""
-				    " (%s)", driver->alsa_name_capture,
-				    snd_strerror(err));
-			return -1;
-		}
-	}
-
-	if (driver->hw_monitoring) {
-		if (driver->input_monitor_mask || driver->all_monitor_in) {
-			if (driver->all_monitor_in) {
-				driver->hw->set_input_monitor_mask (driver->hw, ~0U);
-			} else {
-				driver->hw->set_input_monitor_mask (
-					driver->hw, driver->input_monitor_mask);
-			}
-		} else {
-			driver->hw->set_input_monitor_mask (driver->hw,
-							    driver->input_monitor_mask);
-		}
-	}
-
-	if (driver->playback_handle) {
-		driver->playback_nfds =
-			snd_pcm_poll_descriptors_count (driver->playback_handle);
-	} else {
-		driver->playback_nfds = 0;
-	}
-
-	if (driver->capture_handle) {
-		driver->capture_nfds =
-			snd_pcm_poll_descriptors_count (driver->capture_handle);
-	} else {
-		driver->capture_nfds = 0;
-	}
-
-	if (driver->pfd) {
-		free (driver->pfd);
-	}
-
-	driver->pfd = (struct pollfd *)
-		malloc (sizeof (struct pollfd) * 
-			(driver->playback_nfds + driver->capture_nfds + 2));
-
-	if (driver->midi && !driver->xrun_recovery)
-		(driver->midi->start)(driver->midi);
-
-	if (driver->playback_handle) {
-		/* fill playback buffer with zeroes, and mark 
-		   all fragments as having data.
-		*/
-		
-		pavail = snd_pcm_avail_update (driver->playback_handle);
-
-		if (pavail !=
-		    driver->frames_per_cycle * driver->playback_nperiods) {
-			jack_error ("ALSA: full buffer not available at start");
-			return -1;
-		}
-	
-		if (alsa_driver_get_channel_addresses (driver,
-					0, &pavail, 0, &poffset)) {
-			return -1;
-		}
-
-		/* XXX this is cheating. ALSA offers no guarantee that
-		   we can access the entire buffer at any one time. It
-		   works on most hardware tested so far, however, buts
-		   its a liability in the long run. I think that
-		   alsa-lib may have a better function for doing this
-		   here, where the goal is to silence the entire
-		   buffer.
-		*/
-		
-		for (chn = 0; chn < driver->playback_nchannels; chn++) {
-			alsa_driver_silence_on_channel (
-				driver, chn,
-				driver->user_nperiods
-				* driver->frames_per_cycle);
-		}
-		
-		snd_pcm_mmap_commit (driver->playback_handle, poffset,
-				     driver->user_nperiods
-				     * driver->frames_per_cycle);
-		
-		if ((err = snd_pcm_start (driver->playback_handle)) < 0) {
-			jack_error ("ALSA: could not start playback (%s)",
-				    snd_strerror (err));
-			return -1;
-		}
-	}
-
-	if ((driver->capture_handle && driver->capture_and_playback_not_synced)
-	    || !driver->playback_handle) {
-		if ((err = snd_pcm_start (driver->capture_handle)) < 0) {
-			jack_error ("ALSA: could not start capture (%s)",
-				    snd_strerror (err));
-			return -1;
-		}
-	}
-			
-	return 0;
-}
-
-static int
-alsa_driver_stop (alsa_driver_t *driver)
-{
-	int err;
-	JSList* node;
-	int chn;
-
-	/* silence all capture port buffers, because we might
-	   be entering offline mode.
-	*/
-
-	for (chn = 0, node = driver->capture_ports; node;
-	     node = jack_slist_next (node), chn++) {
-
-		jack_port_t* port;
-		char* buf;
-		jack_nframes_t nframes = driver->engine->control->buffer_size;
-
-		port = (jack_port_t *) node->data;
-		buf = jack_port_get_buffer (port, nframes);
-		memset (buf, 0, sizeof (jack_default_audio_sample_t) * nframes);
-	}
-		
-	if (driver->playback_handle) {
-		if ((err = snd_pcm_drop (driver->playback_handle)) < 0) {
-			jack_error ("ALSA: channel flush for playback "
-				    "failed (%s)", snd_strerror (err));
-			return -1;
-		}
-	}
-
-	if (!driver->playback_handle
-	    || driver->capture_and_playback_not_synced) {
-		if (driver->capture_handle) {
-			if ((err = snd_pcm_drop (driver->capture_handle)) < 0) {
-				jack_error ("ALSA: channel flush for "
-					    "capture failed (%s)",
-					    snd_strerror (err));
-				return -1;
-			}
-		}
-	}
-	
-	if (driver->hw_monitoring) {
-		driver->hw->set_input_monitor_mask (driver->hw, 0);
-	}
-
-	if (driver->midi && !driver->xrun_recovery)
-		(driver->midi->stop)(driver->midi);
-
-	return 0;
-}
-
-static int
-alsa_driver_restart (alsa_driver_t *driver)
-{
-	int res;
-
-	driver->xrun_recovery = 1;
- 	if ((res = driver->nt_stop((struct _jack_driver_nt *) driver))==0)
-		res = driver->nt_start((struct _jack_driver_nt *) driver);
-	driver->xrun_recovery = 0;
-
-	if (res && driver->midi)
-		(driver->midi->stop)(driver->midi);
-
-	return res;
-}
-
-static int
-alsa_driver_xrun_recovery (alsa_driver_t *driver, float *delayed_usecs)
-{
-	snd_pcm_status_t *status;
-	int res;
-
-	snd_pcm_status_alloca(&status);
-
-	if (driver->capture_handle) {
-		if ((res = snd_pcm_status(driver->capture_handle, status))
-		    < 0) {
-			jack_error("status error: %s", snd_strerror(res));
-		}
-	} else {
-		if ((res = snd_pcm_status(driver->playback_handle, status))
-		    < 0) {
-			jack_error("status error: %s", snd_strerror(res));
-		}
-	}
-
-	if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN
-	    && driver->process_count > XRUN_REPORT_DELAY) {
-		struct timeval now, diff, tstamp;
-		driver->xrun_count++;
-		snd_pcm_status_get_tstamp(status,&now);
-		snd_pcm_status_get_trigger_tstamp(status, &tstamp);
-		timersub(&now, &tstamp, &diff);
-		*delayed_usecs = diff.tv_sec * 1000000.0 + diff.tv_usec;
-		MESSAGE("\n\n**** alsa_pcm: xrun of at least %.3f "
-			"msecs\n\n",
-			*delayed_usecs / 1000.0);
-	}
-
-	if (alsa_driver_restart (driver)) {
-		return -1;
-	}
-	return 0;
-}	
-
-void
-alsa_driver_silence_untouched_channels (alsa_driver_t *driver,
-					jack_nframes_t nframes)
-{
-	channel_t chn;
-	jack_nframes_t buffer_frames =
-		driver->frames_per_cycle * driver->playback_nperiods;
-
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		if (bitset_contains (driver->channels_not_done, chn)) { 
-			if (driver->silent[chn] < buffer_frames) {
-				alsa_driver_silence_on_channel_no_mark (
-					driver, chn, nframes);
-				driver->silent[chn] += nframes;
-			}
-		}
-	}
-}
-
-void 
-alsa_driver_set_clock_sync_status (alsa_driver_t *driver, channel_t chn,
-				   ClockSyncStatus status)
-{
-	driver->clock_sync_data[chn] = status;
-	alsa_driver_clock_sync_notify (driver, chn, status);
-}
-
-static int under_gdb = FALSE;
-
-static jack_nframes_t 
-alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float
-		  *delayed_usecs)
-{
-	snd_pcm_sframes_t avail = 0;
-	snd_pcm_sframes_t capture_avail = 0;
-	snd_pcm_sframes_t playback_avail = 0;
-	int xrun_detected = FALSE;
-	int need_capture;
-	int need_playback;
-	unsigned int i;
-	jack_time_t poll_enter;
-	jack_time_t poll_ret = 0;
-
-	*status = -1;
-	*delayed_usecs = 0;
-
-	need_capture = driver->capture_handle ? 1 : 0;
-
-	if (extra_fd >= 0) {
-		need_playback = 0;
-	} else {
-		need_playback = driver->playback_handle ? 1 : 0;
-	}
-
-  again:
-	
-	while (need_playback || need_capture) {
-
-		int poll_result;
-		unsigned int ci = 0;
-		unsigned int nfds;
-		unsigned short revents;
-
-		nfds = 0;
-
-		if (need_playback) {
-			snd_pcm_poll_descriptors (driver->playback_handle,
-						  &driver->pfd[0],
-						  driver->playback_nfds);
-			nfds += driver->playback_nfds;
-		}
-		
-		if (need_capture) {
-			snd_pcm_poll_descriptors (driver->capture_handle,
-						  &driver->pfd[nfds],
-						  driver->capture_nfds);
-			ci = nfds;
-			nfds += driver->capture_nfds;
-		}
-
-		/* ALSA doesn't set POLLERR in some versions of 0.9.X */
-		
-		for (i = 0; i < nfds; i++) {
-			driver->pfd[i].events |= POLLERR;
-		}
-
-		if (extra_fd >= 0) {
-			driver->pfd[nfds].fd = extra_fd;
-			driver->pfd[nfds].events =
-				POLLIN|POLLERR|POLLHUP|POLLNVAL;
-			nfds++;
-		}
-
-		poll_enter = jack_get_microseconds ();
-
-		if (poll_enter > driver->poll_next) {
-			/*
-			 * This processing cycle was delayed past the
-			 * next due interrupt!  Do not account this as
-			 * a wakeup delay:
-			 */
-			driver->poll_next = 0;
-			driver->poll_late++;
-		}
-
-		poll_result = poll (driver->pfd, nfds, driver->poll_timeout);
-		if (poll_result < 0) {
-
-			if (errno == EINTR) {
-				jack_info ("poll interrupt");
-				// this happens mostly when run
-				// under gdb, or when exiting due to a signal
-				if (under_gdb) {
-					goto again;
-				}
-				*status = -2;
-				return 0;
-			}
-			
-			jack_error ("ALSA: poll call failed (%s)",
-				    strerror (errno));
-			*status = -3;
-			return 0;
-
-			
-		}
-
-		poll_ret = jack_get_microseconds ();
-
-		if (extra_fd < 0) {
-			if (driver->poll_next && poll_ret > driver->poll_next) {
-				*delayed_usecs = poll_ret - driver->poll_next;
-			} 
-			driver->poll_last = poll_ret;
-			driver->poll_next = poll_ret + driver->period_usecs;
-			driver->engine->transport_cycle_start (driver->engine, 
-							       poll_ret);
-		}
-
-#ifdef DEBUG_WAKEUP
-		fprintf (stderr, "%" PRIu64 ": checked %d fds, started at %" PRIu64 " %" PRIu64 "  usecs since poll entered\n", 
-			 poll_ret, nfds, poll_enter, poll_ret - poll_enter);
-#endif
-
-		/* check to see if it was the extra FD that caused us
-		 * to return from poll */
-
-		if (extra_fd >= 0) {
-
-			if (driver->pfd[nfds-1].revents == 0) {
-				/* we timed out on the extra fd */
-
-				*status = -4;
-				return -1;
-			} 
-
-			/* if POLLIN was the only bit set, we're OK */
-
-			*status = 0;
-			return (driver->pfd[nfds-1].revents == POLLIN) ? 0 : -1;
-		}
-
-		if (need_playback) {
-			if (snd_pcm_poll_descriptors_revents
-			    (driver->playback_handle, &driver->pfd[0],
-			     driver->playback_nfds, &revents) < 0) {
-				jack_error ("ALSA: playback revents failed");
-				*status = -6;
-				return 0;
-			}
-
-			if (revents & POLLERR) {
-				xrun_detected = TRUE;
-			}
-
-			if (revents & POLLOUT) {
-				need_playback = 0;
-#ifdef DEBUG_WAKEUP
-				fprintf (stderr, "%" PRIu64
-					 " playback stream ready\n",
-					 poll_ret);
-#endif
-			}
-		}
-
-		if (need_capture) {
-			if (snd_pcm_poll_descriptors_revents
-			    (driver->capture_handle, &driver->pfd[ci],
-			     driver->capture_nfds, &revents) < 0) {
-				jack_error ("ALSA: capture revents failed");
-				*status = -6;
-				return 0;
-			}
-
-			if (revents & POLLERR) {
-				xrun_detected = TRUE;
-			}
-
-			if (revents & POLLIN) {
-				need_capture = 0;
-#ifdef DEBUG_WAKEUP
-				fprintf (stderr, "%" PRIu64
-					 " capture stream ready\n",
-					 poll_ret);
-#endif
-			}
-		}
-		
-		if (poll_result == 0) {
-			jack_error ("ALSA: poll time out, polled for %" PRIu64
-				    " usecs",
-				    poll_ret - poll_enter);
-			*status = -5;
-			return 0;
-		}		
-
-	}
-
-	if (driver->capture_handle) {
-		if ((capture_avail = snd_pcm_avail_update (
-			     driver->capture_handle)) < 0) {
-			if (capture_avail == -EPIPE) {
-				xrun_detected = TRUE;
-			} else {
-				jack_error ("unknown ALSA avail_update return"
-					    " value (%u)", capture_avail);
-			}
-		}
-	} else {
-		/* odd, but see min() computation below */
-		capture_avail = INT_MAX; 
-	}
-
-	if (driver->playback_handle) {
-		if ((playback_avail = snd_pcm_avail_update (
-			     driver->playback_handle)) < 0) {
-			if (playback_avail == -EPIPE) {
-				xrun_detected = TRUE;
-			} else {
-				jack_error ("unknown ALSA avail_update return"
-					    " value (%u)", playback_avail);
-			}
-		}
-	} else {
-		/* odd, but see min() computation below */
-		playback_avail = INT_MAX; 
-	}
-
-	if (xrun_detected) {
-		*status = alsa_driver_xrun_recovery (driver, delayed_usecs);
-		return 0;
-	}
-
-	*status = 0;
-	driver->last_wait_ust = poll_ret;
-
-	avail = capture_avail < playback_avail ? capture_avail : playback_avail;
-
-#ifdef DEBUG_WAKEUP
-	fprintf (stderr, "wakeup complete, avail = %lu, pavail = %lu "
-		 "cavail = %lu\n",
-		 avail, playback_avail, capture_avail);
-#endif
-
-	/* mark all channels not done for now. read/write will change this */
-
-	bitset_copy (driver->channels_not_done, driver->channels_done);
-
-	/* constrain the available count to the nearest (round down) number of
-	   periods.
-	*/
-
-	return avail - (avail % driver->frames_per_cycle);
-}
-
-static int
-alsa_driver_null_cycle (alsa_driver_t* driver, jack_nframes_t nframes)
-{
-	jack_nframes_t nf;
-	snd_pcm_uframes_t offset;
-	snd_pcm_uframes_t contiguous;
-	int chn;
-
-	if (nframes > driver->frames_per_cycle) {
-		return -1;
-	}
-	
-	if (driver->capture_handle) {
-		nf = nframes;
-		offset = 0;
-		while (nf) {
-			contiguous = nf;
-			
-			if (snd_pcm_mmap_begin (
-				    driver->capture_handle,
-				    &driver->capture_areas,
-				    (snd_pcm_uframes_t *) &offset, 
-				    (snd_pcm_uframes_t *) &contiguous)) {
-				return -1;
-			}
-		
-			if (snd_pcm_mmap_commit (driver->capture_handle,
-						 offset, contiguous) < 0) {
-				return -1;
-			}
-
-			nf -= contiguous;
-		}
-	}
-
-	if (driver->playback_handle) {
-		nf = nframes;
-		offset = 0;
-		while (nf) {
-			contiguous = nf;
-			
-			if (snd_pcm_mmap_begin (
-				    driver->playback_handle,
-				    &driver->playback_areas,
-				    (snd_pcm_uframes_t *) &offset, 
-				    (snd_pcm_uframes_t *) &contiguous)) {
-				return -1;
-			}
-			
-			for (chn = 0; chn < driver->playback_nchannels; chn++) {
-				alsa_driver_silence_on_channel (driver, chn,
-								contiguous);
-			}
-		
-			if (snd_pcm_mmap_commit (driver->playback_handle,
-						 offset, contiguous) < 0) {
-				return -1;
-			}
-
-			nf -= contiguous;
-		}
-	}
-
-	return 0;
-}
-
-static int
-alsa_driver_bufsize (alsa_driver_t* driver, jack_nframes_t nframes)
-{
-	return alsa_driver_reset_parameters (driver, nframes,
-					     driver->user_nperiods,
-					     driver->frame_rate);
-}
-
-static int
-alsa_driver_read (alsa_driver_t *driver, jack_nframes_t nframes)
-{
-	snd_pcm_sframes_t contiguous;
-	snd_pcm_sframes_t nread;
-	snd_pcm_uframes_t offset;
-	jack_nframes_t  orig_nframes;
-	jack_default_audio_sample_t* buf;
-	channel_t chn;
-	JSList *node;
-	jack_port_t* port;
-	int err;
-
-	if (nframes > driver->frames_per_cycle) {
-		return -1;
-	}
-	
-	if (driver->engine->freewheeling) {
-		return 0;
-	}
-
-	if (driver->midi)
-		(driver->midi->read)(driver->midi, nframes);
-	
-	if (!driver->capture_handle) {
-		return 0;
-	}
-
-	nread = 0;
-	contiguous = 0;
-	orig_nframes = nframes;
-	
-	while (nframes) {
-		
-		contiguous = nframes;
-		
-		if (alsa_driver_get_channel_addresses (
-			    driver, 
-			    (snd_pcm_uframes_t *) &contiguous, 
-			    (snd_pcm_uframes_t *) 0,
-			    &offset, 0) < 0) {
-			return -1;
-		}
-			
-		for (chn = 0, node = driver->capture_ports; node;
-		     node = jack_slist_next (node), chn++) {
-			
-			port = (jack_port_t *) node->data;
-			
-			if (!jack_port_connected (port)) {
-				/* no-copy optimization */
-				continue;
-			}
-			buf = jack_port_get_buffer (port, orig_nframes);
-			alsa_driver_read_from_channel (driver, chn,
-				buf + nread, contiguous);
-		}
-		
-		if ((err = snd_pcm_mmap_commit (driver->capture_handle,
-				offset, contiguous)) < 0) {
-			jack_error ("ALSA: could not complete read of %"
-				PRIu32 " frames: error = %d", contiguous, err);
-			return -1;
-		}
-
-		nframes -= contiguous;
-		nread += contiguous;
-	}
-
-	return 0;
-}
-
-static int
-alsa_driver_write (alsa_driver_t* driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	JSList *node;
-	JSList *mon_node;
-	jack_default_audio_sample_t* buf;
-	jack_default_audio_sample_t* monbuf;
-	jack_nframes_t orig_nframes;
-	snd_pcm_sframes_t nwritten;
-	snd_pcm_sframes_t contiguous;
-	snd_pcm_uframes_t offset;
-	jack_port_t *port;
-	int err;
-
-	driver->process_count++;
-
-	if (!driver->playback_handle || driver->engine->freewheeling) {
-		return 0;
-	}
-	if (nframes > driver->frames_per_cycle) {
-		return -1;
-	}
-
-	if (driver->midi)
-		(driver->midi->write)(driver->midi, nframes);
-	
-	nwritten = 0;
-	contiguous = 0;
-	orig_nframes = nframes;
-	
-	/* check current input monitor request status */
-	
-	driver->input_monitor_mask = 0;
-	
-	for (chn = 0, node = driver->capture_ports; node;
-	     node = jack_slist_next (node), chn++) {
-		if (((jack_port_t *) node->data)->shared->monitor_requests) {
-			driver->input_monitor_mask |= (1<<chn);
-		}
-	}
-
-	if (driver->hw_monitoring) {
-		if ((driver->hw->input_monitor_mask
-		     != driver->input_monitor_mask)
-		    && !driver->all_monitor_in) {
-			driver->hw->set_input_monitor_mask (
-				driver->hw, driver->input_monitor_mask);
-		}
-	}
-	
-	while (nframes) {
-		
-		contiguous = nframes;
-		
-		if (alsa_driver_get_channel_addresses (
-			    driver, 
-			    (snd_pcm_uframes_t *) 0,
-			    (snd_pcm_uframes_t *) &contiguous, 
-			    0, &offset) < 0) {
-			return -1;
-		}
-		
-		for (chn = 0, node = driver->playback_ports, mon_node=driver->monitor_ports;
-		     node;
-		     node = jack_slist_next (node), chn++) {
-
-			port = (jack_port_t *) node->data;
-
-			if (!jack_port_connected (port)) {
-				continue;
-			}
-			buf = jack_port_get_buffer (port, orig_nframes);
-			alsa_driver_write_to_channel (driver, chn,
-				buf + nwritten, contiguous);
-
-			if (mon_node) {
-				port = (jack_port_t *) mon_node->data;
-				if (!jack_port_connected (port)) {
-					continue;
-				}
-				monbuf = jack_port_get_buffer (port, orig_nframes);
-				memcpy (monbuf + nwritten, buf + nwritten, contiguous * sizeof(jack_default_audio_sample_t));
-				mon_node = jack_slist_next (mon_node);				
-			}
-		}
-
-		
-		if (!bitset_empty (driver->channels_not_done)) {
-			alsa_driver_silence_untouched_channels (driver,
-								contiguous);
-		}
-		
-		if ((err = snd_pcm_mmap_commit (driver->playback_handle,
-				offset, contiguous)) < 0) {
-			jack_error ("ALSA: could not complete playback of %"
-				PRIu32 " frames: error = %d", contiguous, err);
-			if (err != EPIPE && err != ESTRPIPE)
-				return -1;
-		}
-
-		nframes -= contiguous;
-		nwritten += contiguous;
-	}
-
-	return 0;
-}
-
-static inline int
-alsa_driver_run_cycle (alsa_driver_t *driver)
-{
-	jack_engine_t *engine = driver->engine;
-	int wait_status;
-	float delayed_usecs;
-	jack_nframes_t nframes;
-
-	DEBUG ("alsa run cycle wait\n");
-
-	nframes = alsa_driver_wait (driver, -1, &wait_status, &delayed_usecs);
-
-	DEBUG ("alsaback from wait, nframes = %lu", nframes);
-
-	if (unlikely(wait_status < 0))
-		return -1;		/* driver failed */
-
-	if (unlikely(nframes == 0)) {
-
-		/* we detected an xrun and restarted: notify
-		 * clients about the delay. 
-		 */
-		engine->delay (engine, delayed_usecs);
-		return 0;
-	} 
-
-	return engine->run_cycle (engine, nframes, delayed_usecs);
-}
-
-static int
-alsa_driver_attach (alsa_driver_t *driver)
-{
-	char buf[32];
-	channel_t chn;
-	jack_port_t *port;
-	int port_flags;
-
-	driver->engine->set_buffer_size (driver->engine, driver->frames_per_cycle);
-	driver->engine->set_sample_rate (driver->engine, driver->frame_rate);
-
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-
-	if (driver->has_hw_monitoring) {
-		port_flags |= JackPortCanMonitor;
-	}
-
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-
-		snprintf (buf, sizeof(buf), "capture_%lu", chn+1);
-
-		if ((port = jack_port_register (driver->client, buf,
-						JACK_DEFAULT_AUDIO_TYPE,
-						port_flags, 0)) == NULL) {
-			jack_error ("ALSA: cannot register port for %s", buf);
-			break;
-		}
-
-		jack_port_set_latency (port, driver->frames_per_cycle + driver->capture_frame_latency);
-
-		driver->capture_ports =
-			jack_slist_append (driver->capture_ports, port);
-	}
-	
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		jack_port_t *monitor_port;
-
-		snprintf (buf, sizeof(buf) - 1, "playback_%lu", chn+1);
-
-		if ((port = jack_port_register (driver->client, buf,
-						JACK_DEFAULT_AUDIO_TYPE,
-						port_flags, 0)) == NULL) {
-			jack_error ("ALSA: cannot register port for %s", buf);
-			break;
-		}
-		
-		jack_port_set_latency (port, (driver->frames_per_cycle * (driver->user_nperiods - 1)) + driver->playback_frame_latency);
-
-		driver->playback_ports =
-			jack_slist_append (driver->playback_ports, port);
-
-		if (driver->with_monitor_ports) {
-			snprintf (buf, sizeof(buf) - 1, "monitor_%lu", chn+1);
-			
-			if ((monitor_port = jack_port_register (
-				     driver->client, buf,
-				     JACK_DEFAULT_AUDIO_TYPE,
-				     JackPortIsOutput, 0)) == NULL) {
-				jack_error ("ALSA: cannot register monitor "
-					    "port for %s", buf);
-			} else {
-
-				jack_port_set_latency (monitor_port, driver->frames_per_cycle);
-				
-				driver->monitor_ports =
-					jack_slist_append (driver->monitor_ports, monitor_port);
-			}
-			
-		}
-	}
-
-	if (driver->midi) {
-		int err = (driver->midi->attach)(driver->midi);
-		if (err)
-			jack_error("ALSA: cannot attach midi: %d", err);
-	}
-	
-
-	return jack_activate (driver->client);
-}
-
-static int
-alsa_driver_detach (alsa_driver_t *driver)
-{
-	JSList *node;
-
-	if (driver->engine == NULL) {
-		return 0;
-	}
-
-	if (driver->midi)
-		(driver->midi->detach)(driver->midi);
-	
-	for (node = driver->capture_ports; node;
-	     node = jack_slist_next (node)) {
-		jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-	}
-
-	jack_slist_free (driver->capture_ports);
-	driver->capture_ports = 0;
-		
-	for (node = driver->playback_ports; node;
-	     node = jack_slist_next (node)) {
-		jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-	}
-
-	jack_slist_free (driver->playback_ports);
-	driver->playback_ports = 0;
-
-	if (driver->monitor_ports) {
-		for (node = driver->monitor_ports; node;
-		     node = jack_slist_next (node)) {
-			jack_port_unregister (driver->client,
-					      ((jack_port_t *) node->data));
-		}
-		
-		jack_slist_free (driver->monitor_ports);
-		driver->monitor_ports = 0;
-	}
-	
-	return 0;
-}
-
-#if 0
-static int  /* UNUSED */
-alsa_driver_change_sample_clock (alsa_driver_t *driver, SampleClockMode mode)
-
-{
-	return driver->hw->change_sample_clock (driver->hw, mode);
-}
-
-static void  /* UNUSED */
-alsa_driver_request_all_monitor_input (alsa_driver_t *driver, int yn)
-
-{
-	if (driver->hw_monitoring) {
-		if (yn) {
-			driver->hw->set_input_monitor_mask (driver->hw, ~0U);
-		} else {
-			driver->hw->set_input_monitor_mask (
-				driver->hw, driver->input_monitor_mask);
-		}
-	}
-
-	driver->all_monitor_in = yn;
-}
-
-static void  /* UNUSED */
-alsa_driver_set_hw_monitoring (alsa_driver_t *driver, int yn)
-{
-	if (yn) {
-		driver->hw_monitoring = TRUE;
-		
-		if (driver->all_monitor_in) {
-			driver->hw->set_input_monitor_mask (driver->hw, ~0U);
-		} else {
-			driver->hw->set_input_monitor_mask (
-				driver->hw, driver->input_monitor_mask);
-		}
-	} else {
-		driver->hw_monitoring = FALSE;
-		driver->hw->set_input_monitor_mask (driver->hw, 0);
-	}
-}
-
-static ClockSyncStatus  /* UNUSED */
-alsa_driver_clock_sync_status (channel_t chn)
-{
-	return Lock;
-}
-#endif
-
-static void
-alsa_driver_delete (alsa_driver_t *driver)
-{
-	JSList *node;
-
-	if (driver->midi)
-		(driver->midi->destroy)(driver->midi);
-
-	for (node = driver->clock_sync_listeners; node;
-	     node = jack_slist_next (node)) {
-		free (node->data);
-	}
-	jack_slist_free (driver->clock_sync_listeners);
-
-	if (driver->ctl_handle) {
-		snd_ctl_close (driver->ctl_handle);
-		driver->ctl_handle = 0;
-	} 
-
-	if (driver->capture_handle) {
-		snd_pcm_close (driver->capture_handle);
-		driver->capture_handle = 0;
-	} 
-
-	if (driver->playback_handle) {
-		snd_pcm_close (driver->playback_handle);
-		driver->capture_handle = 0;
-	}
-	
-	if (driver->capture_hw_params) {
-		snd_pcm_hw_params_free (driver->capture_hw_params);
-		driver->capture_hw_params = 0;
-	}
-
-	if (driver->playback_hw_params) {
-		snd_pcm_hw_params_free (driver->playback_hw_params);
-		driver->playback_hw_params = 0;
-	}
-	
-	if (driver->capture_sw_params) {
-		snd_pcm_sw_params_free (driver->capture_sw_params);
-		driver->capture_sw_params = 0;
-	}
-	
-	if (driver->playback_sw_params) {
-		snd_pcm_sw_params_free (driver->playback_sw_params);
-		driver->playback_sw_params = 0;
-	}
-
-	if (driver->pfd) {
-		free (driver->pfd);
-	}
-	
-	if (driver->hw) {
-		driver->hw->release (driver->hw);
-		driver->hw = 0;
-	}
-	free(driver->alsa_name_playback);
-	free(driver->alsa_name_capture);
-	free(driver->alsa_driver);
-
-	alsa_driver_release_channel_dependent_memory (driver);
-        jack_driver_nt_finish ((jack_driver_nt_t *) driver);
-	free (driver);
-}
-
-static jack_driver_t *
-alsa_driver_new (char *name, char *playback_alsa_device,
-		 char *capture_alsa_device,
-		 jack_client_t *client, 
-		 jack_nframes_t frames_per_cycle,
-		 jack_nframes_t user_nperiods,
-		 jack_nframes_t rate,
-		 int hw_monitoring,
-		 int hw_metering,
-		 int capturing,
-		 int playing,
-		 DitherAlgorithm dither,
-		 int soft_mode, 
-		 int monitor,
-		 int user_capture_nchnls,
-		 int user_playback_nchnls,
-		 int shorts_first,
-		 jack_nframes_t capture_latency,
-		 jack_nframes_t playback_latency,
-		 alsa_midi_t *midi_driver
-		 )
-{
-	int err;
-
-	alsa_driver_t *driver;
-
-	jack_info ("creating alsa driver ... %s|%s|%" PRIu32 "|%" PRIu32
-		"|%" PRIu32"|%" PRIu32"|%" PRIu32 "|%s|%s|%s|%s",
-		playing ? playback_alsa_device : "-",
-		capturing ? capture_alsa_device : "-", 
-		frames_per_cycle, user_nperiods, rate,
-		user_capture_nchnls,user_playback_nchnls,
-		hw_monitoring ? "hwmon": "nomon",
-		hw_metering ? "hwmeter":"swmeter",
-		soft_mode ? "soft-mode":"-",
-		shorts_first ? "16bit":"32bit");
-
-	driver = (alsa_driver_t *) calloc (1, sizeof (alsa_driver_t));
-
-	jack_driver_nt_init ((jack_driver_nt_t *) driver);
-
-	driver->nt_attach = (JackDriverNTAttachFunction) alsa_driver_attach;
-        driver->nt_detach = (JackDriverNTDetachFunction) alsa_driver_detach;
-	driver->read = (JackDriverReadFunction) alsa_driver_read;
-	driver->write = (JackDriverReadFunction) alsa_driver_write;
-	driver->null_cycle =
-		(JackDriverNullCycleFunction) alsa_driver_null_cycle;
-	driver->nt_bufsize = (JackDriverNTBufSizeFunction) alsa_driver_bufsize;
-	driver->nt_start = (JackDriverNTStartFunction) alsa_driver_start;
-	driver->nt_stop = (JackDriverNTStopFunction) alsa_driver_stop;
-	driver->nt_run_cycle = (JackDriverNTRunCycleFunction) alsa_driver_run_cycle;
-
-	driver->playback_handle = NULL;
-	driver->capture_handle = NULL;
-	driver->ctl_handle = 0;
-	driver->hw = 0;
-	driver->capture_and_playback_not_synced = FALSE;
-	driver->max_nchannels = 0;
-	driver->user_nchannels = 0;
-	driver->playback_nchannels = user_playback_nchnls;
-	driver->capture_nchannels = user_capture_nchnls;
-	driver->playback_sample_bytes = (shorts_first ? 2:4);
-	driver->capture_sample_bytes = (shorts_first ? 2:4);
-	driver->capture_frame_latency = capture_latency;
-	driver->playback_frame_latency = playback_latency;
-
-	driver->playback_addr = 0;
-	driver->capture_addr = 0;
-	driver->playback_interleave_skip = NULL;
-	driver->capture_interleave_skip = NULL;
-
-
-	driver->silent = 0;
-	driver->all_monitor_in = FALSE;
-	driver->with_monitor_ports = monitor;
-
-	driver->clock_mode = ClockMaster; /* XXX is it? */
-	driver->input_monitor_mask = 0;   /* XXX is it? */
-
-	driver->capture_ports = 0;
-	driver->playback_ports = 0;
-	driver->monitor_ports = 0;
-	
-	driver->pfd = 0;
-	driver->playback_nfds = 0;
-	driver->capture_nfds = 0;
-
-	driver->dither = dither;
-	driver->soft_mode = soft_mode;
-
-	driver->quirk_bswap = 0;
-
-	pthread_mutex_init (&driver->clock_sync_lock, 0);
-	driver->clock_sync_listeners = 0;
-
-	driver->poll_late = 0;
-	driver->xrun_count = 0;
-	driver->process_count = 0;
-
-	driver->alsa_name_playback = strdup (playback_alsa_device);
-	driver->alsa_name_capture = strdup (capture_alsa_device);
-
-	driver->midi = midi_driver;
-	driver->xrun_recovery = 0;
-
-	if (alsa_driver_check_card_type (driver)) {
-		alsa_driver_delete (driver);
-		return NULL;
-	}
-
-	alsa_driver_hw_specific (driver, hw_monitoring, hw_metering);
-
-	if (playing) {
-		if (snd_pcm_open (&driver->playback_handle,
-				  playback_alsa_device,
-				  SND_PCM_STREAM_PLAYBACK,
-				  SND_PCM_NONBLOCK) < 0) {
-			switch (errno) {
-			case EBUSY:
-				jack_error ("the playback device \"%s\" is "
-					    "already in use. Please stop the"
-					    " application using it and "
-					    "run JACK again",
-					    playback_alsa_device);
-				alsa_driver_delete (driver);
-				return NULL;
-				break;
-
-			case EPERM:
-				jack_error ("you do not have permission to open "
-					    "the audio device \"%s\" for playback",
-					    playback_alsa_device);
-				alsa_driver_delete (driver);
-				return NULL;
-				break;
-			} 
-			
-			driver->playback_handle = NULL;
-		} 
-
-		if (driver->playback_handle) {
-			snd_pcm_nonblock (driver->playback_handle, 0);
-		}
-	} 
-
-	if (capturing) {
-		if (snd_pcm_open (&driver->capture_handle,
-				  capture_alsa_device,
-				  SND_PCM_STREAM_CAPTURE,
-				  SND_PCM_NONBLOCK) < 0) {
-			switch (errno) {
-			case EBUSY:
-				jack_error ("the capture device \"%s\" is "
-					    "already in use. Please stop the"
-					    " application using it and "
-					    "run JACK again",
-					    capture_alsa_device);
-				alsa_driver_delete (driver);
-				return NULL;
-				break;
-
-			case EPERM:
-				jack_error ("you do not have permission to open "
-					    "the audio device \"%s\" for capture",
-					    capture_alsa_device);
-				alsa_driver_delete (driver);
-				return NULL;
-				break;
-			} 
-
-			driver->capture_handle = NULL;
-		}
-
-		if (driver->capture_handle) {
-			snd_pcm_nonblock (driver->capture_handle, 0);
-		}
-	}
-
-	if (driver->playback_handle == NULL) {
-		if (playing) {
-
-			/* they asked for playback, but we can't do it */
-
-			jack_error ("ALSA: Cannot open PCM device %s for "
-				    "playback. Falling back to capture-only"
-				    " mode", name);
-
-			if (driver->capture_handle == NULL) {
-				/* can't do anything */
-				alsa_driver_delete (driver);
-				return NULL;
-			}
-			
-			playing = FALSE;
-		}
-	}
-
-	if (driver->capture_handle == NULL) {
-		if (capturing) {
-
-			/* they asked for capture, but we can't do it */
-			
-			jack_error ("ALSA: Cannot open PCM device %s for "
-				    "capture. Falling back to playback-only"
-				    " mode", name);
-			
-			if (driver->playback_handle == NULL) {
-				/* can't do anything */
-				alsa_driver_delete (driver);
-				return NULL;
-			}
-
-			capturing = FALSE;
-		}
-	}
-
-	driver->playback_hw_params = 0;
-	driver->capture_hw_params = 0;
-	driver->playback_sw_params = 0;
-	driver->capture_sw_params = 0;
-
-	if (driver->playback_handle) {
-		if ((err = snd_pcm_hw_params_malloc (
-			     &driver->playback_hw_params)) < 0) {
-			jack_error ("ALSA: could not allocate playback hw"
-				    " params structure");
-			alsa_driver_delete (driver);
-			return NULL;
-		}
-
-		if ((err = snd_pcm_sw_params_malloc (
-			     &driver->playback_sw_params)) < 0) {
-			jack_error ("ALSA: could not allocate playback sw"
-				    " params structure");
-			alsa_driver_delete (driver);
-			return NULL;
-		}
-	}
-
-	if (driver->capture_handle) {
-		if ((err = snd_pcm_hw_params_malloc (
-			     &driver->capture_hw_params)) < 0) {
-			jack_error ("ALSA: could not allocate capture hw"
-				    " params structure");
-			alsa_driver_delete (driver);
-			return NULL;
-		}
-
-		if ((err = snd_pcm_sw_params_malloc (
-			     &driver->capture_sw_params)) < 0) {
-			jack_error ("ALSA: could not allocate capture sw"
-				    " params structure");
-			alsa_driver_delete (driver);
-			return NULL;
-		}
-	}
-
-	if (alsa_driver_set_parameters (driver, frames_per_cycle,
-					user_nperiods, rate)) {
-		alsa_driver_delete (driver);
-		return NULL;
-	}
-
-	driver->capture_and_playback_not_synced = FALSE;
-
-	if (driver->capture_handle && driver->playback_handle) {
-		if (snd_pcm_link (driver->playback_handle,
-				  driver->capture_handle) != 0) {
-			driver->capture_and_playback_not_synced = TRUE;
-		} 
-	}
-
-	driver->client = client;
-
-	return (jack_driver_t *) driver;
-}
-
-int
-alsa_driver_listen_for_clock_sync_status (alsa_driver_t *driver, 
-					  ClockSyncListenerFunction func,
-					  void *arg)
-{
-	ClockSyncListener *csl;
-
-	csl = (ClockSyncListener *) malloc (sizeof (ClockSyncListener));
-	csl->function = func;
-	csl->arg = arg;
-	csl->id = driver->next_clock_sync_listener_id++;
-	
-	pthread_mutex_lock (&driver->clock_sync_lock);
-	driver->clock_sync_listeners =
-		jack_slist_prepend (driver->clock_sync_listeners, csl);
-	pthread_mutex_unlock (&driver->clock_sync_lock);
-	return csl->id;
-}
-
-int
-alsa_driver_stop_listening_to_clock_sync_status (alsa_driver_t *driver,
-						 unsigned int which)
-
-{
-	JSList *node;
-	int ret = -1;
-	pthread_mutex_lock (&driver->clock_sync_lock);
-	for (node = driver->clock_sync_listeners; node;
-	     node = jack_slist_next (node)) {
-		if (((ClockSyncListener *) node->data)->id == which) {
-			driver->clock_sync_listeners =
-				jack_slist_remove_link (
-					driver->clock_sync_listeners, node);
-			free (node->data);
-			jack_slist_free_1 (node);
-			ret = 0;
-			break;
-		}
-	}
-	pthread_mutex_unlock (&driver->clock_sync_lock);
-	return ret;
-}
-
-void 
-alsa_driver_clock_sync_notify (alsa_driver_t *driver, channel_t chn,
-			       ClockSyncStatus status)
-{
-	JSList *node;
-
-	pthread_mutex_lock (&driver->clock_sync_lock);
-	for (node = driver->clock_sync_listeners; node;
-	     node = jack_slist_next (node)) {
-		ClockSyncListener *csl = (ClockSyncListener *) node->data;
-		csl->function (chn, status, csl->arg);
-	}
-	pthread_mutex_unlock (&driver->clock_sync_lock);
-
-}
-
-static int
-dither_opt (char c, DitherAlgorithm* dither)
-{
-	switch (c) {
-	case '-':
-	case 'n':
-		*dither = None;
-		break;
-		
-	case 'r':
-		*dither = Rectangular;
-		break;
-		
-	case 's':
-		*dither = Shaped;
-		break;
-		
-	case 't':
-		*dither = Triangular;
-		break;
-		
-	default:
-		jack_error ("ALSA driver: illegal dithering mode %c", c);
-		return -1;
-	}
-	return 0;
-}
-
-
-/* DRIVER "PLUGIN" INTERFACE */
-
-const char driver_client_name[] = "alsa_pcm";
-
-const jack_driver_desc_t *
-driver_get_descriptor ()
-{
-	jack_driver_desc_t * desc;
-	jack_driver_param_desc_t * params;
-	unsigned int i;
-
-	desc = calloc (1, sizeof (jack_driver_desc_t));
-
-	strcpy (desc->name,"alsa");
-	desc->nparams = 18;
-  
-	params = calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
-
-	i = 0;
-	strcpy (params[i].name, "capture");
-	params[i].character  = 'C';
-	params[i].type       = JackDriverParamString;
-	strcpy (params[i].value.str, "none");
-	strcpy (params[i].short_desc,
-		"Provide capture ports.  Optionally set device");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "playback");
-	params[i].character  = 'P';
-	params[i].type       = JackDriverParamString;
-	strcpy (params[i].value.str, "none");
-	strcpy (params[i].short_desc,
-		"Provide playback ports.  Optionally set device");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "device");
-	params[i].character  = 'd';
-	params[i].type       = JackDriverParamString;
-	strcpy (params[i].value.str,  "hw:0");
-	strcpy (params[i].short_desc, "ALSA device name");
-	strcpy (params[i].long_desc,  params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "rate");
-	params[i].character  = 'r';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 48000U;
-	strcpy (params[i].short_desc, "Sample rate");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "period");
-	params[i].character  = 'p';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 1024U;
-	strcpy (params[i].short_desc, "Frames per period");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "nperiods");
-	params[i].character  = 'n';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 2U;
-	strcpy (params[i].short_desc, "Number of periods of playback latency");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "hwmon");
-	params[i].character  = 'H';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc,"Hardware monitoring, if available");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "hwmeter");
-	params[i].character  = 'M';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Hardware metering, if available");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "duplex");
-	params[i].character  = 'D';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 1;
-	strcpy (params[i].short_desc,
-		"Provide both capture and playback ports");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "softmode");
-	params[i].character  = 's';
- 	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Soft-mode, no xrun handling");
-	strcpy (params[i].long_desc,  params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "monitor");
-	params[i].character  = 'm';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Provide monitor ports for the output");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "dither");
-	params[i].character  = 'z';
-	params[i].type       = JackDriverParamChar;
-	params[i].value.c    = 'n';
-	strcpy (params[i].short_desc, "Dithering mode");
-	strcpy (params[i].long_desc,
-		"Dithering mode:\n"
-		"  n - none\n"
-		"  r - rectangular\n"
-		"  s - shaped\n"
-		"  t - triangular");
-
-	i++;
-	strcpy (params[i].name, "inchannels");
-	params[i].character  = 'i';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc,
-		"Number of capture channels (defaults to hardware max)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "outchannels");
-	params[i].character  = 'o';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc,
-		"Number of playback channels (defaults to hardware max)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "shorts");
-	params[i].character  = 'S';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = FALSE;
-	strcpy (params[i].short_desc, "Try 16-bit samples before 32-bit");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-
-	i++;
-	strcpy (params[i].name, "input-latency");
-	params[i].character  = 'I';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Extra input latency (frames)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "output-latency");
-	params[i].character  = 'O';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Extra output latency (frames)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "midi");
-	params[i].character  = 'X';
-	params[i].type       = JackDriverParamString;
-	strcpy (params[i].value.str,  "none");
-	strcpy (params[i].short_desc, "ALSA MIDI driver (seq|raw)");
-	strcpy (params[i].long_desc,
-		"ALSA MIDI driver:\n"
-		" none - no MIDI driver\n"
-		" seq - ALSA Sequencer driver\n"
-		" raw - ALSA RawMIDI driver\n");
-
-	desc->params = params;
-
-	return desc;
-}
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, const JSList * params)
-{
-        jack_nframes_t srate = 48000;
-	jack_nframes_t frames_per_interrupt = 1024;
-	unsigned long user_nperiods = 2;
-	char *playback_pcm_name = "hw:0";
-	char *capture_pcm_name = "hw:0";
-	int hw_monitoring = FALSE;
-	int hw_metering = FALSE;
-	int capture = FALSE;
-	int playback = FALSE;
-	int soft_mode = FALSE;
-	int monitor = FALSE;
-	DitherAlgorithm dither = None;
-	int user_capture_nchnls = 0;
-	int user_playback_nchnls = 0;
-	int shorts_first = FALSE;
-	jack_nframes_t systemic_input_latency = 0;
-	jack_nframes_t systemic_output_latency = 0;
-	char *midi_driver_name = "none";
-	alsa_midi_t *midi = NULL;
-	const JSList * node;
-	const jack_driver_param_t * param;
-
-	for (node = params; node; node = jack_slist_next (node)) {
-  	        param = (const jack_driver_param_t *) node->data;
-
-		switch (param->character) {
-
-		case 'C':
-			capture = TRUE;
-			if (strcmp (param->value.str, "none") != 0) {
-				capture_pcm_name = strdup (param->value.str);
-			}
-			break;
-
-		case 'P':
-			playback = TRUE;
-			if (strcmp (param->value.str, "none") != 0) {
-				playback_pcm_name = strdup (param->value.str);
-			}
-			break;
-
-		case 'D':
-			playback = TRUE;
-			capture = TRUE;
-			break;
-
-		case 'd':
-			playback_pcm_name = strdup (param->value.str);
-			capture_pcm_name  = strdup (param->value.str);
-			break;
-
-		case 'H':
-			hw_monitoring = param->value.i;
-			break;
-
-		case 'm':
-			monitor = param->value.i;
-			break;
-
-		case 'M':
-			hw_metering = param->value.i;
-			break;
-
-		case 'r':
-		        srate = param->value.ui;
-			jack_info ("apparent rate = %d", srate);
-		        break;
-			
-		case 'p':
-			frames_per_interrupt = param->value.ui;
-			break;
-				
-		case 'n':
-			user_nperiods = param->value.ui;
-			if (user_nperiods < 2)	/* enforce minimum value */
-				user_nperiods = 2;
-			break;
-				
-		case 's':
-			soft_mode = param->value.i;
-			break;
-
-		case 'z':
-			if (dither_opt (param->value.c, &dither)) {
-			  return NULL;
-			}
-			break;
-
-		case 'i':
-			user_capture_nchnls = param->value.ui;
-			break;
-		case 'o':
-		        user_playback_nchnls = param->value.ui;
-			break;
-
-		case 'S':
-			shorts_first = param->value.i;
-			break;
-
-		case 'I':
-			systemic_input_latency = param->value.ui;
-			break;
-
-		case 'O':
-			systemic_output_latency = param->value.ui;
-			break;
-
-		case 'X':
-			midi_driver_name = strdup (param->value.str);
-			break;
-
-		}
-	}
-			
-	/* duplex is the default */
-	if (!capture && !playback) {
-		capture = TRUE;
-		playback = TRUE;
-	}
-
-	if (strcmp(midi_driver_name, "seq")==0) {
-		midi = alsa_seqmidi_new(client, NULL);
-	} else if (strcmp(midi_driver_name, "raw")==0) {
-		midi = alsa_rawmidi_new(client);
-	}
-
-	return alsa_driver_new ("alsa_pcm", playback_pcm_name,
-				capture_pcm_name, client,
-				frames_per_interrupt, 
-				user_nperiods, srate, hw_monitoring,
-				hw_metering, capture, playback, dither,
-				soft_mode, monitor, 
-				user_capture_nchnls, user_playback_nchnls,
-				shorts_first, 
-				systemic_input_latency,
-				systemic_output_latency, midi);
-}
-
-void
-driver_finish (jack_driver_t *driver)
-{
-	alsa_driver_delete ((alsa_driver_t *) driver);
-}
diff --git a/drivers/alsa/alsa_driver.h b/drivers/alsa/alsa_driver.h
deleted file mode 100644
index a70a40a..0000000
--- a/drivers/alsa/alsa_driver.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_alsa_driver_h__
-#define __jack_alsa_driver_h__
-
-#include <alsa/asoundlib.h>
-#include <alsa/pcm.h>
-#include <jack/bitset.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define IS_LE 0
-#define IS_BE 1
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define IS_LE 1
-#define IS_BE 0
-#endif
-
-#include <jack/types.h>
-#include <jack/hardware.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-#include <jack/memops.h>
-
-#include "../alsa-midi/alsa_midi.h"
-
-typedef void (*ReadCopyFunction)  (jack_default_audio_sample_t *dst, char *src,
-				   unsigned long src_bytes,
-				   unsigned long src_skip_bytes);
-typedef void (*WriteCopyFunction) (char *dst, jack_default_audio_sample_t *src,
-				   unsigned long src_bytes,
-				   unsigned long dst_skip_bytes,
-				   dither_state_t *state);
-typedef void (*CopyCopyFunction)  (char *dst, char *src,
-				   unsigned long src_bytes,
-				   unsigned long dst_skip_bytes,
-				   unsigned long src_skip_byte);
-
-typedef struct _alsa_driver {
-
-    JACK_DRIVER_NT_DECL
-
-    int                           poll_timeout;
-    jack_time_t                   poll_last;
-    jack_time_t                   poll_next;
-    char                        **playback_addr;
-    char                        **capture_addr;
-    const snd_pcm_channel_area_t *capture_areas;
-    const snd_pcm_channel_area_t *playback_areas;
-    struct pollfd                *pfd;
-    unsigned int                  playback_nfds;
-    unsigned int                  capture_nfds;
-    unsigned long                 interleave_unit;
-    unsigned long                *capture_interleave_skip;
-    unsigned long                *playback_interleave_skip;
-    channel_t                     max_nchannels;
-    channel_t                     user_nchannels;
-    channel_t                     playback_nchannels;
-    channel_t                     capture_nchannels;
-    unsigned long                 playback_sample_bytes;
-    unsigned long                 capture_sample_bytes;
-
-    jack_nframes_t                frame_rate;
-    jack_nframes_t                frames_per_cycle;
-    jack_nframes_t                capture_frame_latency;
-    jack_nframes_t                playback_frame_latency;
-
-    unsigned long                *silent;
-    char                         *alsa_name_playback;
-    char                         *alsa_name_capture;
-    char                         *alsa_driver;
-    bitset_t			  channels_not_done;
-    bitset_t			  channels_done;
-    snd_pcm_format_t              playback_sample_format;
-    snd_pcm_format_t              capture_sample_format;
-    float                         max_sample_val;
-    unsigned long                 user_nperiods;
-    unsigned int                  playback_nperiods;
-    unsigned int                  capture_nperiods;
-    unsigned long                 last_mask;
-    snd_ctl_t                    *ctl_handle;
-    snd_pcm_t                    *playback_handle;
-    snd_pcm_t                    *capture_handle;
-    snd_pcm_hw_params_t          *playback_hw_params;
-    snd_pcm_sw_params_t          *playback_sw_params;
-    snd_pcm_hw_params_t          *capture_hw_params;
-    snd_pcm_sw_params_t          *capture_sw_params;
-    jack_hardware_t              *hw;  
-    ClockSyncStatus              *clock_sync_data;
-    jack_client_t                *client;
-    JSList                       *capture_ports;
-    JSList                       *playback_ports;
-    JSList                       *monitor_ports;
-
-    unsigned long input_monitor_mask;
-
-    char soft_mode;
-    char hw_monitoring;
-    char hw_metering;
-    char all_monitor_in;
-    char capture_and_playback_not_synced;
-    char playback_interleaved;
-    char capture_interleaved;
-    char with_monitor_ports;
-    char has_clock_sync_reporting;
-    char has_hw_monitoring;
-    char has_hw_metering;
-    char quirk_bswap;
-
-    ReadCopyFunction read_via_copy;
-    WriteCopyFunction write_via_copy;
-    CopyCopyFunction channel_copy;
-
-    int             dither;
-    dither_state_t *dither_state;
-
-    SampleClockMode clock_mode;
-    JSList *clock_sync_listeners;
-    pthread_mutex_t clock_sync_lock;
-    unsigned long next_clock_sync_listener_id;
-
-    int running;
-    int run;
-
-    int poll_late;
-    int xrun_count;
-    int process_count;
-
-    alsa_midi_t *midi;
-    int xrun_recovery;
-
-} alsa_driver_t;
-
-static inline void 
-alsa_driver_mark_channel_done (alsa_driver_t *driver, channel_t chn) {
-	bitset_remove (driver->channels_not_done, chn);
-	driver->silent[chn] = 0;
-}
-
-static inline void 
-alsa_driver_silence_on_channel (alsa_driver_t *driver, channel_t chn,
-				jack_nframes_t nframes) {
-	if (driver->playback_interleaved) {
-		memset_interleave 
-			(driver->playback_addr[chn],
-			 0, nframes * driver->playback_sample_bytes,
-			 driver->interleave_unit,
-			 driver->playback_interleave_skip[chn]);
-	} else {
-		memset (driver->playback_addr[chn], 0,
-			nframes * driver->playback_sample_bytes);
-	}
-	alsa_driver_mark_channel_done (driver,chn);
-}
-
-static inline void 
-alsa_driver_silence_on_channel_no_mark (alsa_driver_t *driver, channel_t chn,
-					jack_nframes_t nframes) {
-	if (driver->playback_interleaved) {
-		memset_interleave 
-			(driver->playback_addr[chn],
-			 0, nframes * driver->playback_sample_bytes,
-			 driver->interleave_unit,
-			 driver->playback_interleave_skip[chn]);
-	} else {
-		memset (driver->playback_addr[chn], 0,
-			nframes * driver->playback_sample_bytes);
-	}
-}
-
-static inline void 
-alsa_driver_read_from_channel (alsa_driver_t *driver,
-			       channel_t channel,
-			       jack_default_audio_sample_t *buf,
-			       jack_nframes_t nsamples)
-{
-	driver->read_via_copy (buf, 
-			       driver->capture_addr[channel],
-			       nsamples, 
-			       driver->capture_interleave_skip[channel]);
-}
-
-static inline void 
-alsa_driver_write_to_channel (alsa_driver_t *driver,
-			      channel_t channel, 
-			      jack_default_audio_sample_t *buf, 
-			      jack_nframes_t nsamples)
-{
-	driver->write_via_copy (driver->playback_addr[channel],
-				buf, 
-				nsamples, 
-				driver->playback_interleave_skip[channel],
-				driver->dither_state+channel);
-	alsa_driver_mark_channel_done (driver, channel);
-}
-
-static inline void 
-alsa_driver_copy_channel (alsa_driver_t *driver, 
-			  channel_t input_channel, 
-			  channel_t output_channel,
-			  jack_nframes_t nsamples) {
-
-	driver->channel_copy (driver->playback_addr[output_channel],
-			      driver->capture_addr[input_channel],
-			      nsamples * driver->playback_sample_bytes,
-			      driver->playback_interleave_skip[output_channel],
-			      driver->capture_interleave_skip[input_channel]);
-	alsa_driver_mark_channel_done (driver, output_channel);
-}
-
-void  alsa_driver_silence_untouched_channels (alsa_driver_t *driver,
-					      jack_nframes_t nframes);
-void  alsa_driver_set_clock_sync_status (alsa_driver_t *driver, channel_t chn,
-					 ClockSyncStatus status);
-int   alsa_driver_listen_for_clock_sync_status (alsa_driver_t *,
-						ClockSyncListenerFunction,
-						void *arg);
-int   alsa_driver_stop_listen_for_clock_sync_status (alsa_driver_t *,
-						     unsigned int);
-void  alsa_driver_clock_sync_notify (alsa_driver_t *, channel_t chn,
-				     ClockSyncStatus);
-
-#endif /* __jack_alsa_driver_h__ */
diff --git a/drivers/alsa/generic.h b/drivers/alsa/generic.h
deleted file mode 100644
index 73dc593..0000000
--- a/drivers/alsa/generic.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_generic_h__
-#define __jack_generic_h__
-
-jack_hardware_t *
-jack_alsa_generic_hw_new (alsa_driver_t *driver);
-
-#endif /* __jack_generic_h__*/
diff --git a/drivers/alsa/generic_hw.c b/drivers/alsa/generic_hw.c
deleted file mode 100644
index 7b3291f..0000000
--- a/drivers/alsa/generic_hw.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <jack/hardware.h>
-#include "alsa_driver.h"
-
-static int generic_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
-{
-	return -1;
-}
-
-static int generic_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
-{
-	return -1;
-}
-
-static void
-generic_release (jack_hardware_t *hw)
-{
-	return;
-}
-
-jack_hardware_t *
-jack_alsa_generic_hw_new (alsa_driver_t *driver)
-
-{
-	jack_hardware_t *hw;
-
-	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
-
-	hw->capabilities = 0;
-	hw->input_monitor_mask = 0;
-	
-	hw->set_input_monitor_mask = generic_set_input_monitor_mask;
-	hw->change_sample_clock = generic_change_sample_clock;
-	hw->release = generic_release;
-
-	return hw;
-}
diff --git a/drivers/alsa/hammerfall.c b/drivers/alsa/hammerfall.c
deleted file mode 100644
index 814a464..0000000
--- a/drivers/alsa/hammerfall.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <jack/hardware.h>
-#include "alsa_driver.h"
-#include "hammerfall.h"
-#include <jack/internal.h>
-
-/* Set this to 1 if you want this compile error:
- *   warning: `hammerfall_monitor_controls' defined but not used */
-#define HAMMERFALL_MONITOR_CONTROLS 0
-
-static void 
-set_control_id (snd_ctl_elem_id_t *ctl, const char *name)
-{
-	snd_ctl_elem_id_set_name (ctl, name);
-	snd_ctl_elem_id_set_numid (ctl, 0);
-	snd_ctl_elem_id_set_interface (ctl, SND_CTL_ELEM_IFACE_MIXER);
-	snd_ctl_elem_id_set_device (ctl, 0);
-	snd_ctl_elem_id_set_subdevice (ctl, 0);
-	snd_ctl_elem_id_set_index (ctl, 0);
-}
-
-#if HAMMERFALL_MONITOR_CONTROLS
-static void
-hammerfall_broadcast_channel_status_change (hammerfall_t *h, int lock, int sync, channel_t lowchn, channel_t highchn)
-
-{
-	channel_t chn;
-	ClockSyncStatus status = 0;
-
-	if (lock) {
-		status |= Lock;
-	} else {
-		status |= NoLock;
-	}
-
-	if (sync) {
-		status |= Sync;
-	} else {
-		status |= NoSync;
-	}
-
-	for (chn = lowchn; chn < highchn; chn++) {
-		alsa_driver_set_clock_sync_status (h->driver, chn, status);
-	}
-}
-
-static void
-hammerfall_check_sync_state (hammerfall_t *h, int val, int adat_id)
-
-{
-	int lock;
-	int sync;
-
-	/* S/PDIF channel is always locked and synced, but we only
-	   need tell people once that this is TRUE.
-
-	   XXX - maybe need to make sure that the rate matches our
-	   idea of the current rate ?
-	*/
-
-	if (!h->said_that_spdif_is_fine) {
-		ClockSyncStatus status;
-		
-		status = Lock|Sync;
-
-		/* XXX broken! fix for hammerfall light ! */
-
-		alsa_driver_set_clock_sync_status (h->driver, 24, status);
-		alsa_driver_set_clock_sync_status (h->driver, 25, status);
-
-		h->said_that_spdif_is_fine = TRUE;
-	}
-
-	lock = (val & 0x1) ? TRUE : FALSE;
-	sync = (val & 0x2) ? TRUE : FALSE;
-	
-	if (h->lock_status[adat_id] != lock ||
-	    h->sync_status[adat_id] != sync) {
-		hammerfall_broadcast_channel_status_change (h, lock, sync, adat_id*8, (adat_id*8)+8);
-	}
-
-	h->lock_status[adat_id] = lock;
-	h->sync_status[adat_id] = sync;
-}
-
-static void
-hammerfall_check_sync (hammerfall_t *h, snd_ctl_elem_value_t *ctl)
-
-{
-	const char *name;
-	int val;
-	snd_ctl_elem_id_t *ctl_id;
-	
-	jack_info ("check sync");
-
-	snd_ctl_elem_id_alloca (&ctl_id);
-	snd_ctl_elem_value_get_id (ctl, ctl_id);
-
-	name = snd_ctl_elem_id_get_name (ctl_id);
-
-	if (strcmp (name, "ADAT1 Sync Check") == 0) {
-		val = snd_ctl_elem_value_get_enumerated (ctl, 0);
-		hammerfall_check_sync_state (h, val, 0);
-	} else if (strcmp (name, "ADAT2 Sync Check") == 0) {
-		val = snd_ctl_elem_value_get_enumerated (ctl, 0);
-		hammerfall_check_sync_state (h, val, 1);
-	} else if (strcmp (name, "ADAT3 Sync Check") == 0) {
-		val = snd_ctl_elem_value_get_enumerated (ctl, 0);
-		hammerfall_check_sync_state (h, val, 2);
-	} else {
-		jack_error ("Hammerfall: unknown control \"%s\"", name);
-	}
-}
-#endif /* HAMMERFALL_MONITOR_CONTROLS */
-
-static int 
-hammerfall_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
-{
-	hammerfall_t *h = (hammerfall_t *) hw->private;
-	snd_ctl_elem_value_t *ctl;
-	snd_ctl_elem_id_t *ctl_id;
-	int err;
-	int i;
-	
-	snd_ctl_elem_value_alloca (&ctl);
-	snd_ctl_elem_id_alloca (&ctl_id);
-	set_control_id (ctl_id, "Channels Thru");
-	snd_ctl_elem_value_set_id (ctl, ctl_id);
-	
-	for (i = 0; i < 26; i++) {
-		snd_ctl_elem_value_set_integer (ctl, i, (mask & (1<<i)) ? 1 : 0);
-	}
-	
-	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, ctl)) != 0) {
-		jack_error ("ALSA/Hammerfall: cannot set input monitoring (%s)", snd_strerror (err));
-		return -1;
-	}
-	
-	hw->input_monitor_mask = mask;
-
-	return 0;
-}
-
-static int 
-hammerfall_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
-{
-	hammerfall_t *h = (hammerfall_t *) hw->private;
-	snd_ctl_elem_value_t *ctl;
-	snd_ctl_elem_id_t *ctl_id;
-	int err;
-
-	snd_ctl_elem_value_alloca (&ctl);
-	snd_ctl_elem_id_alloca (&ctl_id);
-	set_control_id (ctl_id, "Sync Mode");
-	snd_ctl_elem_value_set_id (ctl, ctl_id);
-
-	switch (mode) {
-	case AutoSync:
-		snd_ctl_elem_value_set_enumerated (ctl, 0, 0);
-		break;
-	case ClockMaster:
-		snd_ctl_elem_value_set_enumerated (ctl, 0, 1);
-		break;
-	case WordClock:
-		snd_ctl_elem_value_set_enumerated (ctl, 0, 2);
-		break;
-	}
-
-	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, ctl)) < 0) {
-		jack_error ("ALSA-Hammerfall: cannot set clock mode");
-	}
-
-	return 0;
-}
-
-static void
-hammerfall_release (jack_hardware_t *hw)
-
-{
-	hammerfall_t *h = (hammerfall_t *) hw->private;
-	void *status;
-
-	if (h == 0) {
-		return;
-	}
-
-	pthread_cancel (h->monitor_thread);
-	pthread_join (h->monitor_thread, &status);
-
-	free (h);
-}
-
-#if HAMMERFALL_MONITOR_CONTROLS
-static void *
-hammerfall_monitor_controls (void *arg)
-{
-	jack_hardware_t *hw = (jack_hardware_t *) arg;
-	hammerfall_t *h = (hammerfall_t *) hw->private;
-	snd_ctl_elem_id_t *switch_id[3];
-	snd_ctl_elem_value_t *sw[3];
-
-	pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
-
-	snd_ctl_elem_id_malloc (&switch_id[0]);
-	snd_ctl_elem_id_malloc (&switch_id[1]);
-	snd_ctl_elem_id_malloc (&switch_id[2]);
-
-	snd_ctl_elem_value_malloc (&sw[0]);
-	snd_ctl_elem_value_malloc (&sw[1]);
-	snd_ctl_elem_value_malloc (&sw[2]);
-
-	set_control_id (switch_id[0], "ADAT1 Sync Check");
-	set_control_id (switch_id[1], "ADAT2 Sync Check");
-	set_control_id (switch_id[2], "ADAT3 Sync Check");
-
-	snd_ctl_elem_value_set_id (sw[0], switch_id[0]);
-	snd_ctl_elem_value_set_id (sw[1], switch_id[1]);
-	snd_ctl_elem_value_set_id (sw[2], switch_id[2]);
-
-	while (1) {
-		if (snd_ctl_elem_read (h->driver->ctl_handle, sw[0])) {
-			jack_error ("cannot read control switch 0 ...");
-		}
-		hammerfall_check_sync (h, sw[0]);
-
-		if (snd_ctl_elem_read (h->driver->ctl_handle, sw[1])) {
-			jack_error ("cannot read control switch 0 ...");
-		}
-		hammerfall_check_sync (h, sw[1]);
-
-		if (snd_ctl_elem_read (h->driver->ctl_handle, sw[2])) {
-			jack_error ("cannot read control switch 0 ...");
-		}
-		hammerfall_check_sync (h, sw[2]);
-		
-		if (nanosleep (&h->monitor_interval, 0)) {
-			break;
-		}
-	}
-
-	pthread_exit (0);
-}
-#endif /* HAMMERFALL_MONITOR_CONTROLS */
-
-jack_hardware_t *
-jack_alsa_hammerfall_hw_new (alsa_driver_t *driver)
-
-{
-	jack_hardware_t *hw;
-	hammerfall_t *h;
-
-	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
-
-	hw->capabilities = Cap_HardwareMonitoring|Cap_AutoSync|Cap_WordClock|Cap_ClockMaster|Cap_ClockLockReporting;
-	hw->input_monitor_mask = 0;
-	hw->private = 0;
-
-	hw->set_input_monitor_mask = hammerfall_set_input_monitor_mask;
-	hw->change_sample_clock = hammerfall_change_sample_clock;
-	hw->release = hammerfall_release;
-
-	h = (hammerfall_t *) malloc (sizeof (hammerfall_t));
-
-	h->lock_status[0] = FALSE;
-	h->sync_status[0] = FALSE;
-	h->lock_status[1] = FALSE;
-	h->sync_status[1] = FALSE;
-	h->lock_status[2] = FALSE;
-	h->sync_status[2] = FALSE;
-	h->said_that_spdif_is_fine = FALSE;
-	h->driver = driver;
-
-	h->monitor_interval.tv_sec = 1;
-	h->monitor_interval.tv_nsec = 0;
-
-	hw->private = h;
-
-#if 0
-	if (pthread_create (&h->monitor_thread, 0, hammerfall_monitor_controls, hw)) {
-		jack_error ("ALSA/Hammerfall: cannot create sync monitor thread");
-	}
-#endif
-
-	return hw;
-}
diff --git a/drivers/alsa/hammerfall.h b/drivers/alsa/hammerfall.h
deleted file mode 100644
index b10ce6a..0000000
--- a/drivers/alsa/hammerfall.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_hammerfall_h__
-#define __jack_hammerfall_h__
-
-#include <sys/time.h>
-
-typedef struct {
-    int lock_status[3];
-    int sync_status[3];
-    int said_that_spdif_is_fine;
-    pthread_t monitor_thread;
-    alsa_driver_t *driver;
-    struct timespec monitor_interval;
-} hammerfall_t;
-
-jack_hardware_t *jack_alsa_hammerfall_hw_new (alsa_driver_t *driver);
-
-#endif /* __jack_hammerfall_h__*/
diff --git a/drivers/alsa/hdsp.c b/drivers/alsa/hdsp.c
deleted file mode 100644
index 059c2bd..0000000
--- a/drivers/alsa/hdsp.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis 
-    Copyright (C) 2002 Dave LaRose
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <jack/hardware.h>
-#include "alsa_driver.h"
-#include "hdsp.h"
-#include <jack/internal.h>
-
-/* Constants to make working with the hdsp matrix mixer easier */
-static const int HDSP_MINUS_INFINITY_GAIN = 0;
-static const int HDSP_UNITY_GAIN = 32768;
-static const int HDSP_MAX_GAIN = 65535;
-
-/*
- * Use these two arrays to choose the value of the input_channel 
- * argument to hsdp_set_mixer_gain().  hdsp_physical_input_index[n] 
- * selects the nth optical/analog input.  audio_stream_index[n] 
- * selects the nth channel being received from the host via pci/pccard.
- */
-static const int hdsp_num_input_channels = 52;
-static const int hdsp_physical_input_index[] = {
-  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
-  12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
-static const int hdsp_audio_stream_index[] = {
-  26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
-  38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
-
-/*
- * Use this array to choose the value of the output_channel 
- * argument to hsdp_set_mixer_gain().  hdsp_physical_output_index[26]
- * and hdsp_physical_output_index[27] refer to the two "line out"
- * channels (1/4" phone jack on the front of digiface/multiface).
- */
-static const int hdsp_num_output_channels = 28;
-static const int hdsp_physical_output_index[] = {
-  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
-  12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
-
-
-/* Function for checking argument values */
-static int clamp_int(int value, int lower_bound, int upper_bound)
-{
-  if(value < lower_bound) {
-    return lower_bound;
-  }
-  if(value > upper_bound) {
-    return upper_bound;
-  }
-  return value;
-}
-
-/* Note(XXX): Maybe should share this code with hammerfall.c? */
-static void 
-set_control_id (snd_ctl_elem_id_t *ctl, const char *name)
-{
-	snd_ctl_elem_id_set_name (ctl, name);
-	snd_ctl_elem_id_set_numid (ctl, 0);
-	snd_ctl_elem_id_set_interface (ctl, SND_CTL_ELEM_IFACE_HWDEP);
-	snd_ctl_elem_id_set_device (ctl, 0);
-	snd_ctl_elem_id_set_subdevice (ctl, 0);
-	snd_ctl_elem_id_set_index (ctl, 0);
-}
-
-/* The hdsp matrix mixer lets you connect pretty much any input to */
-/* any output with gain from -inf to about +2dB. Pretty slick. */
-/* This routine makes a convenient way to set the gain from */
-/* input_channel to output_channel (see hdsp_physical_input_index */
-/* etc. above. */
-/* gain is an int from 0 to 65535, with 0 being -inf gain, and */
-/* 65535 being about +2dB. */
-
-static int hdsp_set_mixer_gain(jack_hardware_t *hw, int input_channel,
-			       int output_channel, int gain)
-{
-	hdsp_t *h = (hdsp_t *) hw->private;
-	snd_ctl_elem_value_t *ctl;
-	snd_ctl_elem_id_t *ctl_id;
-	int err;
-
-	/* Check args */
-	input_channel = clamp_int(input_channel, 0, hdsp_num_input_channels);
-	output_channel = clamp_int(output_channel, 0, hdsp_num_output_channels);
-	gain = clamp_int(gain, HDSP_MINUS_INFINITY_GAIN, HDSP_MAX_GAIN);
-
-	/* Allocate control element and select "Mixer" control */
-	snd_ctl_elem_value_alloca (&ctl);
-	snd_ctl_elem_id_alloca (&ctl_id);
-	set_control_id (ctl_id, "Mixer");
-	snd_ctl_elem_value_set_id (ctl, ctl_id);
-
-	/* Apparently non-standard and unstable interface for the */
-        /* mixer control. */
-	snd_ctl_elem_value_set_integer (ctl, 0, input_channel);
-	snd_ctl_elem_value_set_integer (ctl, 1, output_channel);
-	snd_ctl_elem_value_set_integer (ctl, 2, gain);
-
-	/* Commit the mixer value and check for errors */
-	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, ctl)) != 0) {
-	  jack_error ("ALSA/HDSP: cannot set mixer gain (%s)", snd_strerror (err));
-	  return -1;
-	}
-
-	/* Note (XXX): Perhaps we should maintain a cache of the current */
-	/* mixer values, since it's not clear how to query them from the */
-	/* hdsp hardware.  We'll leave this out until a little later. */
-	return 0;
-}
-  
-static int hdsp_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
-{
-	int i;
-
-	/* For each input channel */
-	for (i = 0; i < 26; i++) {
-		/* Monitoring requested for this channel? */
-		if(mask & (1<<i)) {
-			/* Yes.  Connect physical input to output */
-
-			if(hdsp_set_mixer_gain (hw, hdsp_physical_input_index[i],
-						hdsp_physical_output_index[i],
-						HDSP_UNITY_GAIN) != 0) {
-			  return -1;
-			}
-
-#ifdef CANNOT_HEAR_SOFTWARE_STREAM_WHEN_MONITORING
-			/* ...and disconnect the corresponding software */
-			/* channel */
-			if(hdsp_set_mixer_gain (hw, hdsp_audio_stream_index[i],
-						hdsp_physical_output_index[i],
-						HDSP_MINUS_INFINITY_GAIN) != 0) {
-			  return -1;
-			}
-#endif
-
-		} else {
-			/* No.  Disconnect physical input from output */
-			if(hdsp_set_mixer_gain (hw, hdsp_physical_input_index[i],
-						hdsp_physical_output_index[i],
-						HDSP_MINUS_INFINITY_GAIN) != 0) {
-			  return -1;
-			}
-
-#ifdef CANNOT_HEAR_SOFTWARE_STREAM_WHEN_MONITORING
-			/* ...and connect the corresponding software */
-			/* channel */
-			if(hdsp_set_mixer_gain (hw, hdsp_audio_stream_index[i],
-						hdsp_physical_output_index[i],
-						HDSP_UNITY_GAIN) != 0) {
-			  return -1;
-			}
-#endif
-		}
-	}
-	/* Cache the monitor mask */
-	hw->input_monitor_mask = mask;
-	return 0;
-}
-
-
-static int hdsp_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
-{
-  // Empty for now, until Dave understands more about clock sync so
-  // he can test.
-  return -1;
-}
-
-static double hdsp_get_hardware_peak (jack_port_t *port, jack_nframes_t frame)
-{
-	return 0;
-}
-
-static double hdsp_get_hardware_power (jack_port_t *port, jack_nframes_t frame)
-{
-	return 0;
-}
-
-static void
-hdsp_release (jack_hardware_t *hw)
-{
-	hdsp_t *h = (hdsp_t *) hw->private;
-
-	if (h != 0) {
-	  free (h);
-	}
-}
-
-/* Mostly copied directly from hammerfall.c */
-jack_hardware_t *
-jack_alsa_hdsp_hw_new (alsa_driver_t *driver)
-
-{
-	jack_hardware_t *hw;
-	hdsp_t *h;
-
-	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
-
-	/* Not using clock lock-sync-whatever in home hardware setup */
-	/* yet.  Will write this code when can test it. */
-	/* hw->capabilities = Cap_HardwareMonitoring|Cap_AutoSync|Cap_WordClock|Cap_ClockMaster|Cap_ClockLockReporting; */
-	hw->capabilities = Cap_HardwareMonitoring | Cap_HardwareMetering;
-	hw->input_monitor_mask = 0;
-	hw->private = 0;
-
-	hw->set_input_monitor_mask = hdsp_set_input_monitor_mask;
-	hw->change_sample_clock = hdsp_change_sample_clock;
-	hw->release = hdsp_release;
-	hw->get_hardware_peak = hdsp_get_hardware_peak;
-	hw->get_hardware_power = hdsp_get_hardware_power;
-	
-	h = (hdsp_t *) malloc (sizeof (hdsp_t));
-	h->driver = driver;
-	hw->private = h;
-
-	return hw;
-}
diff --git a/drivers/alsa/hdsp.h b/drivers/alsa/hdsp.h
deleted file mode 100644
index cc2ad04..0000000
--- a/drivers/alsa/hdsp.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_hdsp_h__
-#define __jack_hdsp_h__
-
-#include <sys/time.h>
-
-typedef struct {
-    alsa_driver_t *driver;
-} hdsp_t;
-
-jack_hardware_t *
-jack_alsa_hdsp_hw_new (alsa_driver_t *driver);
-
-#endif /* __jack_hdsp_h__*/
diff --git a/drivers/alsa/ice1712.c b/drivers/alsa/ice1712.c
deleted file mode 100644
index 5cfe365..0000000
--- a/drivers/alsa/ice1712.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-    Copyright (C) 2002 Anthony Van Groningen
-
-    Parts based on source code taken from the 
-    "Env24 chipset (ICE1712) control utility" that is
-
-    Copyright (C) 2000 by Jaroslav Kysela <perex at suse.cz>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <jack/hardware.h>
-#include "alsa_driver.h"
-#include "ice1712.h"
-#include <jack/internal.h>
-
-static int
-ice1712_hw_monitor_toggle(jack_hardware_t *hw, int idx, int onoff)
-
-{
-        ice1712_t *h = (ice1712_t *) hw->private;
-	snd_ctl_elem_value_t *val;
-	int err;
-	
-	snd_ctl_elem_value_alloca (&val);
-	snd_ctl_elem_value_set_interface (val, SND_CTL_ELEM_IFACE_MIXER);
-	if (idx >= 8) {
-		snd_ctl_elem_value_set_name (val, SPDIF_PLAYBACK_ROUTE_NAME);
-		snd_ctl_elem_value_set_index (val, idx - 8);
-	} else {
-		snd_ctl_elem_value_set_name (val, ANALOG_PLAYBACK_ROUTE_NAME);
-		snd_ctl_elem_value_set_index (val, idx);
-	}
-	if (onoff) {
-		snd_ctl_elem_value_set_enumerated (val, 0, idx + 1);
-	} else {
-		snd_ctl_elem_value_set_enumerated (val, 0, 0);
-	}
-	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, val)) != 0) {
-		jack_error ("ALSA/ICE1712: (%d) cannot set input monitoring (%s)",
-			    idx,snd_strerror (err));
-		return -1;
-	}
-
-	return 0;
-}
-
-static int 
-ice1712_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
-     
-{
-	int idx;
-	ice1712_t *h = (ice1712_t *) hw->private;
-	
-	for (idx = 0; idx < 10; idx++) {
-		if (h->active_channels & (1<<idx)) {
-			ice1712_hw_monitor_toggle (hw, idx, mask & (1<<idx) ? 1 : 0);
-		}
-	}
-	hw->input_monitor_mask = mask;
-	
-	return 0;
-}
-
-static int 
-ice1712_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
-     
-{
-	return -1;
-}
-
-static void
-ice1712_release (jack_hardware_t *hw)
-{
-	ice1712_t *h = (ice1712_t *) hw->private;
-	
-	if (h == 0)
-	return;
-
-	if (h->eeprom)
-		free(h->eeprom);
-
-	free(h);
-}
-
-
-jack_hardware_t *
-jack_alsa_ice1712_hw_new (alsa_driver_t *driver)
-
-{
-	jack_hardware_t *hw;
-	ice1712_t *h;
-	snd_ctl_elem_value_t *val;	
-	int err;
-
-	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
-
-	hw->capabilities = Cap_HardwareMonitoring;
-	hw->input_monitor_mask = 0;
-	hw->private = 0;
-
-	hw->set_input_monitor_mask = ice1712_set_input_monitor_mask;
-	hw->change_sample_clock = ice1712_change_sample_clock;
-	hw->release = ice1712_release;
-
-	h = (ice1712_t *) malloc (sizeof (ice1712_t));
-
-	h->driver = driver;
-
-	/* Get the EEPROM (adopted from envy24control) */
-	h->eeprom = (ice1712_eeprom_t *) malloc (sizeof (ice1712_eeprom_t));
-	snd_ctl_elem_value_alloca (&val);
-	snd_ctl_elem_value_set_interface (val, SND_CTL_ELEM_IFACE_CARD);
-        snd_ctl_elem_value_set_name (val, "ICE1712 EEPROM");
-        if ((err = snd_ctl_elem_read (driver->ctl_handle, val)) < 0) {
-                jack_error( "ALSA/ICE1712: Unable to read EEPROM contents (%s)\n", snd_strerror (err));
-                /* Recover? */
-        }
-        memcpy(h->eeprom, snd_ctl_elem_value_get_bytes(val), 32);
-
-	/* determine number of pro ADC's. We're asumming that there is at least one stereo pair. 
-	   Should check this first, but how?  */
-	switch((h->eeprom->codec & 0xCU) >> 2) {
-	case 0:
-	        h->active_channels = 0x3U;
-	        break;
-	case 1:
-	        h->active_channels = 0xfU;
-	        break;
-	case 2:
-	        h->active_channels = 0x3fU;
-	        break;
-	case 3:
-	        h->active_channels = 0xffU;
-	        break;
-	}
-	/* check for SPDIF In's */
-	if (h->eeprom->spdif & 0x1U) {
-	        h->active_channels |= 0x300U;
-	}
-	
-	hw->private = h;
-
-	return hw;
-}
diff --git a/drivers/alsa/ice1712.h b/drivers/alsa/ice1712.h
deleted file mode 100644
index 8dab29f..0000000
--- a/drivers/alsa/ice1712.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-    Copyright (C) 2002 Anthony Van Groningen
-
-    Parts based on source code taken from the 
-    "Env24 chipset (ICE1712) control utility" that is
-
-    Copyright (C) 2000 by Jaroslav Kysela <perex at suse.cz>
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_ice1712_h__
-#define __jack_ice1712_h__
-
-#define ICE1712_SUBDEVICE_DELTA44       0x121433d6
-#define ICE1712_SUBDEVICE_DELTA66       0x121432d6
-#define ICE1712_SUBDEVICE_DELTA1010     0x121430d6
-#define ICE1712_SUBDEVICE_DELTADIO2496  0x121431d6
-#define ICE1712_SUBDEVICE_AUDIOPHILE    0x121434d6
-
-#define SPDIF_PLAYBACK_ROUTE_NAME       "IEC958 Playback Route"
-#define ANALOG_PLAYBACK_ROUTE_NAME      "H/W Playback Route"
-#define MULTITRACK_PEAK_NAME            "Multi Track Peak"
-
-typedef struct {
-        unsigned int subvendor; /* PCI[2c-2f] */
-        unsigned char size;     /* size of EEPROM image in bytes */
-        unsigned char version;  /* must be 1 */
-        unsigned char codec;    /* codec configuration PCI[60] */
-        unsigned char aclink;   /* ACLink configuration PCI[61] */
-        unsigned char i2sID;    /* PCI[62] */
-        unsigned char spdif;    /* S/PDIF configuration PCI[63] */
-        unsigned char gpiomask; /* GPIO initial mask, 0 = write, 1 = don't */
-        unsigned char gpiostate; /* GPIO initial state */
-        unsigned char gpiodir;  /* GPIO direction state */
-        unsigned short ac97main;
-        unsigned short ac97pcm;
-        unsigned short ac97rec;
-        unsigned char ac97recsrc;
-        unsigned char dacID[4]; /* I2S IDs for DACs */
-        unsigned char adcID[4]; /* I2S IDs for ADCs */
-        unsigned char extra[4];
-} ice1712_eeprom_t;
-
-typedef struct {
-        alsa_driver_t *driver;
-        ice1712_eeprom_t *eeprom;
-        unsigned long active_channels;
-} ice1712_t;
-
-jack_hardware_t *jack_alsa_ice1712_hw_new (alsa_driver_t *driver);
-
-#endif /* __jack_ice1712_h__*/
diff --git a/drivers/alsa/memops.c b/drivers/alsa/memops.c
deleted file mode 100644
index 0f6ed05..0000000
--- a/drivers/alsa/memops.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
-    Copyright (C) 2000 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#define _ISOC9X_SOURCE  1
-#define _ISOC99_SOURCE  1
-
-#define __USE_ISOC9X    1
-#define __USE_ISOC99    1
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <memory.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <limits.h>
-#include <endian.h>
-
-#include <jack/memops.h>
-
-/* Notes about these *_SCALING values.
-
-   the MAX_<N>BIT values are floating point. when multiplied by
-   a full-scale normalized floating point sample value (-1.0..+1.0)
-   they should give the maxium value representable with an integer
-   sample type of N bits. Note that this is asymmetric. Sample ranges 
-   for signed integer, 2's complement values are -(2^(N-1) to +(2^(N-1)-1)
-
-   Complications
-   -------------
-   If we use +2^(N-1) for the scaling factors, we run into a problem:
-
-   if we start with a normalized float value of -1.0, scaling
-   to 24 bits would give -8388608 (-2^23), which is ideal.
-   But with +1.0, we get +8388608, which is technically out of range.
-
-   We never multiply a full range normalized value by this constant,
-   but we could multiply it by a positive value that is close enough to +1.0
-   to produce a value > +(2^(N-1)-1.
-
-   There is no way around this paradox without wasting CPU cycles to determine
-   which scaling factor to use (i.e. determine if its negative or not,
-   use the right factor).
-
-   So, for now (October 2008) we use 2^(N-1)-1 as the scaling factor.
-*/
-
-#define SAMPLE_24BIT_SCALING  8388607.0f
-#define SAMPLE_16BIT_SCALING  32767.0f
-
-/* these are just values to use if the floating point value was out of range
-   
-   advice from Fons Adriaensen: make the limits symmetrical
- */
-
-#define SAMPLE_24BIT_MAX  8388607  
-#define SAMPLE_24BIT_MIN  -8388607 
-#define SAMPLE_24BIT_MAX_F  8388607.0f  
-#define SAMPLE_24BIT_MIN_F  -8388607.0f 
-
-#define SAMPLE_16BIT_MAX  32767
-#define SAMPLE_16BIT_MIN  -32767
-#define SAMPLE_16BIT_MAX_F  32767.0f
-#define SAMPLE_16BIT_MIN_F  -32767.0f
-
-/* these mark the outer edges of the range considered "within" range
-   for a floating point sample value. values outside (and on the boundaries) 
-   of this range will be clipped before conversion; values within this 
-   range will be scaled to appropriate values for the target sample
-   type.
-*/
-
-#define NORMALIZED_FLOAT_MIN -1.0f
-#define NORMALIZED_FLOAT_MAX  1.0f
-
-/* define this in case we end up on a platform that is missing
-   the real lrintf functions
-*/
-
-#define f_round(f) lrintf(f)
-
-#define float_16(s, d)\
-	if ((s) <= NORMALIZED_FLOAT_MIN) {\
-		(d) = SAMPLE_16BIT_MIN;\
-	} else if ((s) >= NORMALIZED_FLOAT_MAX) {\
-		(d) = SAMPLE_16BIT_MAX;\
-	} else {\
-		(d) = f_round ((s) * SAMPLE_16BIT_SCALING);\
-	}
-
-/* call this when "s" has already been scaled (e.g. when dithering)
- */
-
-#define float_16_scaled(s, d)\
-        if ((s) <= SAMPLE_16BIT_MIN_F) {\
-		(d) = SAMPLE_16BIT_MIN_F;\
-	} else if ((s) >= SAMPLE_16BIT_MAX_F) {	\
-		(d) = SAMPLE_16BIT_MAX;\
-	} else {\
-	        (d) = f_round ((s));\
-	}
-
-#define float_24u32(s, d) \
-	if ((s) <= NORMALIZED_FLOAT_MIN) {\
-		(d) = SAMPLE_24BIT_MIN << 8;\
-	} else if ((s) >= NORMALIZED_FLOAT_MAX) {\
-		(d) = SAMPLE_24BIT_MAX << 8;\
-	} else {\
-		(d) = f_round ((s) * SAMPLE_24BIT_SCALING) << 8;\
-	}
-
-/* call this when "s" has already been scaled (e.g. when dithering)
- */
-
-#define float_24u32_scaled(s, d)\
-        if ((s) <= SAMPLE_24BIT_MIN_F) {\
-		(d) = SAMPLE_24BIT_MIN << 8;\
-	} else if ((s) >= SAMPLE_24BIT_MAX_F) {	\
-		(d) = SAMPLE_24BIT_MAX << 8;		\
-	} else {\
-		(d) = f_round ((s)) << 8; \
-	}
-
-#define float_24(s, d) \
-	if ((s) <= NORMALIZED_FLOAT_MIN) {\
-		(d) = SAMPLE_24BIT_MIN;\
-	} else if ((s) >= NORMALIZED_FLOAT_MAX) {\
-		(d) = SAMPLE_24BIT_MAX;\
-	} else {\
-		(d) = f_round ((s) * SAMPLE_24BIT_SCALING);\
-	}
-
-/* call this when "s" has already been scaled (e.g. when dithering)
- */
-
-#define float_24_scaled(s, d)\
-        if ((s) <= SAMPLE_24BIT_MIN_F) {\
-		(d) = SAMPLE_24BIT_MIN;\
-	} else if ((s) >= SAMPLE_24BIT_MAX_F) {	\
-		(d) = SAMPLE_24BIT_MAX;		\
-	} else {\
-		(d) = f_round ((s)); \
-	}
-
-
-/* Linear Congruential noise generator. From the music-dsp list
- * less random than rand(), but good enough and 10x faster 
- */
-
-inline unsigned int fast_rand() {
-	static unsigned int seed = 22222;
-	seed = (seed * 96314165) + 907633515;
-
-	return seed;
-}
-
-
-/* functions for native float sample data */
-
-void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) {
-	while (nsamples--) {
-		*dst = *((float *) src);
-		dst++;
-		src += src_skip;
-	}
-}
-
-void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) {
-	while (nsamples--) {
-		*((float *) dst) = *src;
-		dst += dst_skip;
-		src++;
-	}
-}
-
-/* NOTES on function naming:
-
-   foo_bar_d<TYPE>_s<TYPE>
-
-   the "d<TYPE>" component defines the destination type for the operation
-   the "s<TYPE>" component defines the source type for the operation
-
-   TYPE can be one of:
-   
-   S      - sample is a jack_default_audio_sample_t, currently (October 2008) a 32 bit floating point value
-   Ss     - like S but reverse endian from the host CPU
-   32u24  - sample is an signed 32 bit integer value, but data is in upper 24 bits only
-   32u24s - like 32u24 but reverse endian from the host CPU
-   24     - sample is an signed 24 bit integer value
-   24s    - like 24 but reverse endian from the host CPU
-   16     - sample is an signed 16 bit integer value
-   16s    - like 16 but reverse endian from the host CPU
-
-   For obvious reasons, the reverse endian versions only show as source types.
-
-   This covers all known sample formats at 16 bits or larger.
-*/   
-
-/* functions for native integer sample data */
-
-void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
-{
-	int32_t z;
-
-	while (nsamples--) {
-
-		float_24u32 (*src, z);
-
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		dst[0]=(char)(z>>24);
-		dst[1]=(char)(z>>16);
-		dst[2]=(char)(z>>8);
-		dst[3]=(char)(z);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		dst[0]=(char)(z);
-		dst[1]=(char)(z>>8);
-		dst[2]=(char)(z>>16);
-		dst[3]=(char)(z>>24);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-}	
-
-void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
-{
-	while (nsamples--) {
-		float_24u32 (*src, *((int32_t*) dst));
-		dst += dst_skip;
-		src++;
-	}
-}	
-
-void sample_move_dS_s32u24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
-{
-	/* ALERT: signed sign-extension portability !!! */
-
-	while (nsamples--) {
-		int x;
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		x = (unsigned char)(src[0]);
-		x <<= 8;
-		x |= (unsigned char)(src[1]);
-		x <<= 8;
-		x |= (unsigned char)(src[2]);
-		x <<= 8;
-		x |= (unsigned char)(src[3]);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		x = (unsigned char)(src[3]);
-		x <<= 8;
-		x |= (unsigned char)(src[2]);
-		x <<= 8;
-		x |= (unsigned char)(src[1]);
-		x <<= 8;
-		x |= (unsigned char)(src[0]);
-#endif
-		*dst = (x >> 8) / SAMPLE_24BIT_SCALING;
-		dst++;
-		src += src_skip;
-	}
-}	
-
-void sample_move_dS_s32u24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
-{
-	/* ALERT: signed sign-extension portability !!! */
-
-	while (nsamples--) {
-		*dst = (*((int *) src) >> 8) / SAMPLE_24BIT_SCALING;
-		dst++;
-		src += src_skip;
-	}
-}	
-
-void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
-{
-	int32_t z;
-
-	while (nsamples--) {
-		float_24 (*src, z);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		dst[0]=(char)(z>>16);
-		dst[1]=(char)(z>>8);
-		dst[2]=(char)(z);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		dst[0]=(char)(z);
-		dst[1]=(char)(z>>8);
-		dst[2]=(char)(z>>16);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-}	
-
-void sample_move_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
-{
-        int32_t z;
-	
-	while (nsamples--) {
-		float_24 (*src, z);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		memcpy (dst, &z, 3);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		memcpy (dst, (char *)&z + 1, 3);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-}	
-
-void sample_move_dS_s24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
-{
-	/* ALERT: signed sign-extension portability !!! */
-
-	while (nsamples--) {
-		int x;
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		x = (unsigned char)(src[0]);
-		x <<= 8;
-		x |= (unsigned char)(src[1]);
-		x <<= 8;
-		x |= (unsigned char)(src[2]);
-		/* correct sign bit and the rest of the top byte */
-		if (src[0] & 0x80) {
-			x |= 0xff << 24;
-		}
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		x = (unsigned char)(src[2]);
-		x <<= 8;
-		x |= (unsigned char)(src[1]);
-		x <<= 8;
-		x |= (unsigned char)(src[0]);
-		/* correct sign bit and the rest of the top byte */
-		if (src[0] & 0x80) {
-			x |= 0xff << 24;
-		}
-#endif
-		*dst = x / SAMPLE_24BIT_SCALING;
-		dst++;
-		src += src_skip;
-	}
-}	
-
-void sample_move_dS_s24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip)
-{
-	/* ALERT: signed sign-extension portability !!! */
-
-	while (nsamples--) {
-		int x;
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		memcpy((char*)&x + 1, src, 3);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		memcpy(&x, src, 3);
-#endif
-		x >>= 8;
-		*dst = x / SAMPLE_24BIT_SCALING;
-		dst++;
-		src += src_skip;
-	}
-}	
-
-
-void sample_move_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	int16_t tmp;
-
-	while (nsamples--) {
-		// float_16 (*src, tmp);
-
-		if (*src <= NORMALIZED_FLOAT_MIN) {
-			tmp = SAMPLE_16BIT_MIN;
-		} else if (*src >= NORMALIZED_FLOAT_MAX) {
-			tmp = SAMPLE_16BIT_MAX;
-		} else {
-			tmp = (int16_t) f_round (*src * SAMPLE_16BIT_SCALING);
-		}
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		dst[0]=(char)(tmp>>8);
-		dst[1]=(char)(tmp);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		dst[0]=(char)(tmp);
-		dst[1]=(char)(tmp>>8);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-}
-
-void sample_move_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	while (nsamples--) {
-		float_16 (*src, *((int16_t*) dst));
-		dst += dst_skip;
-		src++;
-	}
-}
-
-void sample_move_dither_rect_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	jack_default_audio_sample_t val;
-	int16_t      tmp;
-
-	while (nsamples--) {
-		val = (*src * SAMPLE_16BIT_SCALING) + fast_rand() / (float) UINT_MAX - 0.5f;
-		float_16_scaled (val, tmp);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		dst[0]=(char)(tmp>>8);
-		dst[1]=(char)(tmp);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		dst[0]=(char)(tmp);
-		dst[1]=(char)(tmp>>8);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-}
-
-void sample_move_dither_rect_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	jack_default_audio_sample_t val;
-
-	while (nsamples--) {
-		val = (*src * SAMPLE_16BIT_SCALING) + fast_rand() / (float)UINT_MAX - 0.5f;
-		float_16_scaled (val, *((int16_t*) dst));
-		dst += dst_skip;
-		src++;
-	}
-}
-
-void sample_move_dither_tri_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	jack_default_audio_sample_t val;
-	int16_t      tmp;
-
-	while (nsamples--) {
-		val = (*src * SAMPLE_16BIT_SCALING) + ((float)fast_rand() + (float)fast_rand()) / (float)UINT_MAX - 1.0f;
-		float_16_scaled (val, tmp);
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		dst[0]=(char)(tmp>>8);
-		dst[1]=(char)(tmp);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		dst[0]=(char)(tmp);
-		dst[1]=(char)(tmp>>8);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-}
-
-void sample_move_dither_tri_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	jack_default_audio_sample_t val;
-
-	while (nsamples--) {
-		val = (*src * SAMPLE_16BIT_SCALING) + ((float)fast_rand() + (float)fast_rand()) / (float)UINT_MAX - 1.0f;
-		float_16_scaled (val, *((int16_t*) dst));
-		dst += dst_skip;
-		src++;
-	}
-}
-
-void sample_move_dither_shaped_d16_sSs (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	jack_default_audio_sample_t     x;
-	jack_default_audio_sample_t     xe; /* the innput sample - filtered error */
-	jack_default_audio_sample_t     xp; /* x' */
-	float        r;
-	float        rm1 = state->rm1;
-	unsigned int idx = state->idx;
-	int16_t      tmp;
-
-	while (nsamples--) {
-		x = *src * SAMPLE_16BIT_SCALING;
-		r = ((float)fast_rand() + (float)fast_rand())  / (float)UINT_MAX - 1.0f;
-		/* Filter the error with Lipshitz's minimally audible FIR:
-		   [2.033 -2.165 1.959 -1.590 0.6149] */
-		xe = x
-		     - state->e[idx] * 2.033f
-		     + state->e[(idx - 1) & DITHER_BUF_MASK] * 2.165f
-		     - state->e[(idx - 2) & DITHER_BUF_MASK] * 1.959f
-		     + state->e[(idx - 3) & DITHER_BUF_MASK] * 1.590f
-		     - state->e[(idx - 4) & DITHER_BUF_MASK] * 0.6149f;
-		xp = xe + r - rm1;
-		rm1 = r;
-
-		float_16_scaled (xp, tmp);
-
-		/* Intrinsic z^-1 delay */
-		idx = (idx + 1) & DITHER_BUF_MASK;
-		state->e[idx] = xp - xe;
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		dst[0]=(char)(tmp>>8);
-		dst[1]=(char)(tmp);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		dst[0]=(char)(tmp);
-		dst[1]=(char)(tmp>>8);
-#endif
-		dst += dst_skip;
-		src++;
-	}
-	state->rm1 = rm1;
-	state->idx = idx;
-}
-
-void sample_move_dither_shaped_d16_sS (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)	
-{
-	jack_default_audio_sample_t     x;
-	jack_default_audio_sample_t     xe; /* the innput sample - filtered error */
-	jack_default_audio_sample_t     xp; /* x' */
-	float        r;
-	float        rm1 = state->rm1;
-	unsigned int idx = state->idx;
-
-	while (nsamples--) {
-		x = *src * SAMPLE_16BIT_SCALING;
-		r = ((float)fast_rand() + (float)fast_rand()) / (float)UINT_MAX - 1.0f;
-		/* Filter the error with Lipshitz's minimally audible FIR:
-		   [2.033 -2.165 1.959 -1.590 0.6149] */
-		xe = x
-		     - state->e[idx] * 2.033f
-		     + state->e[(idx - 1) & DITHER_BUF_MASK] * 2.165f
-		     - state->e[(idx - 2) & DITHER_BUF_MASK] * 1.959f
-		     + state->e[(idx - 3) & DITHER_BUF_MASK] * 1.590f
-		     - state->e[(idx - 4) & DITHER_BUF_MASK] * 0.6149f;
-		xp = xe + r - rm1;
-		rm1 = r;
-
-		float_16_scaled (xp, *((int16_t*) dst));
-
-		/* Intrinsic z^-1 delay */
-		idx = (idx + 1) & DITHER_BUF_MASK;
-		state->e[idx] = *((int16_t*) dst) - xe;
-
-		dst += dst_skip;
-		src++;
-	}
-	state->rm1 = rm1;
-	state->idx = idx;
-}
-
-void sample_move_dS_s16s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) 	
-{
-	short z;
-
-	/* ALERT: signed sign-extension portability !!! */
-	while (nsamples--) {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-		z = (unsigned char)(src[0]);
-		z <<= 8;
-		z |= (unsigned char)(src[1]);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-		z = (unsigned char)(src[1]);
-		z <<= 8;
-		z |= (unsigned char)(src[0]);
-#endif
-		*dst = z / SAMPLE_16BIT_SCALING;
-		dst++;
-		src += src_skip;
-	}
-}	
-
-void sample_move_dS_s16 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) 
-	
-{
-	/* ALERT: signed sign-extension portability !!! */
-	while (nsamples--) {
-		*dst = (*((short *) src)) / SAMPLE_16BIT_SCALING;
-		dst++;
-		src += src_skip;
-	}
-}	
-
-void memset_interleave (char *dst, char val, unsigned long bytes, 
-			unsigned long unit_bytes, 
-			unsigned long skip_bytes) 
-{
-	switch (unit_bytes) {
-	case 1:
-		while (bytes--) {
-			*dst = val;
-			dst += skip_bytes;
-		}
-		break;
-	case 2:
-		while (bytes) {
-			*((short *) dst) = (short) val;
-			dst += skip_bytes;
-			bytes -= 2;
-		}
-		break;
-	case 4:		    
-		while (bytes) {
-			*((int *) dst) = (int) val;
-			dst += skip_bytes;
-			bytes -= 4;
-		}
-		break;
-	default:
-		while (bytes) {
-			memset(dst, val, unit_bytes);
-			dst += skip_bytes;
-			bytes -= unit_bytes;
-		}
-		break;
-	}
-}
-
-/* COPY FUNCTIONS: used to move data from an input channel to an
-   output channel. Note that we assume that the skip distance
-   is the same for both channels. This is completely fine
-   unless the input and output were on different audio interfaces that
-   were interleaved differently. We don't try to handle that.
-*/
-
-void 
-memcpy_fake (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar)
-{
-	memcpy (dst, src, src_bytes);
-}
-
-void 
-memcpy_interleave_d16_s16 (char *dst, char *src, unsigned long src_bytes,
-			   unsigned long dst_skip_bytes, unsigned long src_skip_bytes)
-{
-	while (src_bytes) {
-		*((short *) dst) = *((short *) src);
-		dst += dst_skip_bytes;
-		src += src_skip_bytes;
-		src_bytes -= 2;
-	}
-}
-
-void 
-memcpy_interleave_d24_s24 (char *dst, char *src, unsigned long src_bytes,
-			   unsigned long dst_skip_bytes, unsigned long src_skip_bytes)
-
-{
-	while (src_bytes) {
-		memcpy(dst, src, 3);
-		dst += dst_skip_bytes;
-		src += src_skip_bytes;
-		src_bytes -= 3;
-	}
-}
-
-void 
-memcpy_interleave_d32_s32 (char *dst, char *src, unsigned long src_bytes,
-			   unsigned long dst_skip_bytes, unsigned long src_skip_bytes)
-
-{
-	while (src_bytes) {
-		*((int *) dst) = *((int *) src);
-		dst += dst_skip_bytes;
-		src += src_skip_bytes;
-		src_bytes -= 4;
-	}
-}
-
diff --git a/drivers/alsa/usx2y.c b/drivers/alsa/usx2y.c
deleted file mode 100644
index 7328b90..0000000
--- a/drivers/alsa/usx2y.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis 
-    Copyright (C) 2005 Karsten Wiese, Rui Nuno Capela
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <jack/hardware.h>
-#include "alsa_driver.h"
-#include "usx2y.h"
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/messagebuffer.h>
-#include <sys/mman.h>
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
-//#define DBGHWDEP
-
-#ifdef DBGHWDEP
-int dbg_offset;
-char dbg_buffer[8096];
-#endif
-static 
-int usx2y_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
-{
-	return -1;
-}
-
-static
-int usx2y_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
-{
-	return -1;
-}
-
-static void
-usx2y_release (jack_hardware_t *hw)
-{
-	usx2y_t *h = (usx2y_t *) hw->private;
-
-	if (h == 0)
-		return;
-        
-	if (h->hwdep_handle)
-		snd_hwdep_close(h->hwdep_handle);
-
-	free(h);
-}
-
-static int
-usx2y_driver_get_channel_addresses_playback (alsa_driver_t *driver,
-					snd_pcm_uframes_t *playback_avail)
-{
-	channel_t chn;
-	int iso;
-	snd_pcm_uframes_t playback_iso_avail;
-	char *playback;
-
-	usx2y_t *h = (usx2y_t *) driver->hw->private;
-
-	if (0 > h->playback_iso_start) {
-		int bytes = driver->playback_sample_bytes * 2 * driver->frames_per_cycle *
-			driver->user_nperiods;
-		iso = h->hwdep_pcm_shm->playback_iso_start;
-		if (0 > iso)
-			return 0; /* FIXME: return -1; */
-		if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
-			iso = 0;
-		while((bytes -= h->hwdep_pcm_shm->captured_iso[iso].length) > 0)
-			if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
-				iso = 0;
-		h->playback_iso_bytes_done = h->hwdep_pcm_shm->captured_iso[iso].length + bytes;
-#ifdef DBGHWDEP
-		dbg_offset = sprintf(dbg_buffer, "first iso = %i %i@%p:%i\n",
-					iso, h->hwdep_pcm_shm->captured_iso[iso].length,
-					h->hwdep_pcm_shm->playback,
-					h->hwdep_pcm_shm->captured_iso[iso].offset);
-#endif
-	} else {
-		iso = h->playback_iso_start;
-	}
-#ifdef DBGHWDEP
-	dbg_offset += sprintf(dbg_buffer + dbg_offset, "iso = %i(%i;%i); ", iso,
-				h->hwdep_pcm_shm->captured_iso[iso].offset,
-				h->hwdep_pcm_shm->captured_iso[iso].frame);
-#endif
-	playback = h->hwdep_pcm_shm->playback +
-		h->hwdep_pcm_shm->captured_iso[iso].offset +
-		h->playback_iso_bytes_done;
-	playback_iso_avail = (h->hwdep_pcm_shm->captured_iso[iso].length -
-		h->playback_iso_bytes_done) /
-		(driver->playback_sample_bytes * 2);
-	if (*playback_avail >= playback_iso_avail) {
-		*playback_avail = playback_iso_avail;
-		if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
-			iso = 0;
-		h->playback_iso_bytes_done = 0;
-	} else
-		h->playback_iso_bytes_done =
-			*playback_avail * (driver->playback_sample_bytes * 2);
-	h->playback_iso_start = iso;
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		const snd_pcm_channel_area_t *a = &driver->playback_areas[chn];
-		driver->playback_addr[chn] = playback + a->first / 8;
-	}
-#ifdef DBGHWDEP
-	if (dbg_offset < (sizeof(dbg_buffer) - 256))
-		dbg_offset += sprintf(dbg_buffer + dbg_offset, "avail %li@%p\n", *playback_avail, driver->playback_addr[0]);
-	else {
-		printf(dbg_buffer);
-		return -1;
-	}
-#endif
-
-	return 0;
-}
-
-static int
-usx2y_driver_get_channel_addresses_capture (alsa_driver_t *driver,
-					snd_pcm_uframes_t *capture_avail)
-{
-	channel_t chn;
-	int iso;
-	snd_pcm_uframes_t capture_iso_avail;
-	int capture_offset;
-
-	usx2y_t *h = (usx2y_t *) driver->hw->private;
-
-	if (0 > h->capture_iso_start) {
-		iso = h->hwdep_pcm_shm->capture_iso_start;
-		if (0 > iso)
-			return 0; /* FIXME: return -1; */
-		h->capture_iso_bytes_done = 0;
-#ifdef DBGHWDEP
-		dbg_offset = sprintf(dbg_buffer, "cfirst iso = %i %i@%p:%i\n",
-					iso, h->hwdep_pcm_shm->captured_iso[iso].length,
-					h->hwdep_pcm_shm->capture0x8,
-					h->hwdep_pcm_shm->captured_iso[iso].offset);
-#endif
-	} else {
-		iso = h->capture_iso_start;
-	}
-#ifdef DBGHWDEP
-	dbg_offset += sprintf(dbg_buffer + dbg_offset, "ciso = %i(%i;%i); ", iso,
-				h->hwdep_pcm_shm->captured_iso[iso].offset,
-				h->hwdep_pcm_shm->captured_iso[iso].frame);
-#endif
-	capture_offset =
-		h->hwdep_pcm_shm->captured_iso[iso].offset +
-			h->capture_iso_bytes_done;
-	capture_iso_avail = (h->hwdep_pcm_shm->captured_iso[iso].length -
-		h->capture_iso_bytes_done) /
-		(driver->capture_sample_bytes * 2);
-	if (*capture_avail >= capture_iso_avail) {
-		*capture_avail = capture_iso_avail;
-		if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
-			iso = 0;
-		h->capture_iso_bytes_done = 0;
-	} else
-		h->capture_iso_bytes_done =
-			*capture_avail * (driver->capture_sample_bytes * 2);
-	h->capture_iso_start = iso;
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-		driver->capture_addr[chn] =
-			(chn < 2 ? h->hwdep_pcm_shm->capture0x8 : h->hwdep_pcm_shm->capture0xA)
-			+ capture_offset +
-			((chn & 1) ? driver->capture_sample_bytes : 0);
-	}
-#ifdef DBGHWDEP
- {
-	int f = 0;
-	unsigned *u = driver->capture_addr[0];
-	static unsigned last;
-	dbg_offset += sprintf(dbg_buffer + dbg_offset, "\nvon %6u  bis %6u\n", last, u[0]);
-	while (f < *capture_avail && dbg_offset < (sizeof(dbg_buffer) - 256)) {
-		if (u[f] != last + 1)
-			 dbg_offset += sprintf(dbg_buffer + dbg_offset, "\nooops %6u  %6u\n", last, u[f]);
-		last = u[f++];
-	}
- }
-	if (dbg_offset < (sizeof(dbg_buffer) - 256))
-		dbg_offset += sprintf(dbg_buffer + dbg_offset, "avail %li@%p\n", *capture_avail, driver->capture_addr[0]);
-	else {
-		printf(dbg_buffer);
-		return -1;
-	}
-#endif
-
-	return 0;
-}
-
-static int
-usx2y_driver_start (alsa_driver_t *driver)
-{
-	int err, i;
-	snd_pcm_uframes_t poffset, pavail;
-
-	usx2y_t *h = (usx2y_t *) driver->hw->private;
-
-	for (i = 0; i < driver->capture_nchannels; i++)
-		// US428 channels 3+4 are on a seperate 2 channel stream.
-		// ALSA thinks its 1 stream with 4 channels.
-		driver->capture_interleave_skip[i] = 2 * driver->capture_sample_bytes;
-
-
-	driver->playback_interleave_skip[0] = 2 * driver->playback_sample_bytes;
-	driver->playback_interleave_skip[1] = 2 * driver->playback_sample_bytes;
-
-	driver->poll_last = 0;
-	driver->poll_next = 0;
-
-	if ((err = snd_pcm_prepare (driver->playback_handle)) < 0) {
-		jack_error ("ALSA/USX2Y: prepare error for playback: %s", snd_strerror(err));
-		return -1;
-	}
-
-	if (driver->midi && !driver->xrun_recovery)
-		(driver->midi->start)(driver->midi);
-
-	if (driver->playback_handle) {
-/* 		int i, j; */
-/* 		char buffer[2000]; */
-		h->playback_iso_start =
-			h->capture_iso_start = -1;
-		snd_hwdep_poll_descriptors(h->hwdep_handle, &h->pfds, 1);
-		h->hwdep_pcm_shm = (snd_usX2Y_hwdep_pcm_shm_t*)
-			mmap(NULL, sizeof(snd_usX2Y_hwdep_pcm_shm_t),
-			     PROT_READ,
-			     MAP_SHARED, h->pfds.fd,
-			     0);
-		if (MAP_FAILED == h->hwdep_pcm_shm) {
-			perror("ALSA/USX2Y: mmap");
-			return -1;
-		}
-		if (mprotect(h->hwdep_pcm_shm->playback,
-					sizeof(h->hwdep_pcm_shm->playback),
-					PROT_READ|PROT_WRITE)) {
-			perror("ALSA/USX2Y: mprotect");
-			return -1;
-		}
-		memset(h->hwdep_pcm_shm->playback, 0, sizeof(h->hwdep_pcm_shm->playback));
-/* 		for (i = 0, j = 0; i < 2000;) { */
-/* 			j += sprintf(buffer + j, "%04hX ", */
-/* 				     *(unsigned short*)(h->hwdep_pcm_shm->capture + i)); */
-/* 			if (((i += 2) % 32) == 0) { */
-/* 				jack_error(buffer); */
-/* 				j = 0; */
-/* 			} */
-/* 		} */
-	}
-
-	if (driver->hw_monitoring) {
-		driver->hw->set_input_monitor_mask (driver->hw,
-						    driver->input_monitor_mask);
-	}
-
-	if (driver->playback_handle) {
-		/* fill playback buffer with zeroes, and mark
-		   all fragments as having data.
-		*/
-
-		pavail = snd_pcm_avail_update (driver->playback_handle);
-
-		if (pavail != driver->frames_per_cycle * driver->playback_nperiods) {
-			jack_error ("ALSA/USX2Y: full buffer not available at start");
-			return -1;
-		}
-
-		if (snd_pcm_mmap_begin(
-					driver->playback_handle,
-					&driver->playback_areas,
-					&poffset, &pavail) < 0) {
-			return -1;
-		}
-
-		/* XXX this is cheating. ALSA offers no guarantee that
-		   we can access the entire buffer at any one time. It
-		   works on most hardware tested so far, however, buts
-		   its a liability in the long run. I think that
-		   alsa-lib may have a better function for doing this
-		   here, where the goal is to silence the entire
-		   buffer.
-		*/
-		{
-/* 			snd_pcm_uframes_t frag, nframes = driver->buffer_frames; */
-/* 			while (nframes) { */
-/* 				frag = nframes; */
-/* 				if (usx2y_driver_get_channel_addresses_playback(driver, &frag) < 0) */
-/* 					return -1; */
-
-/* 				for (chn = 0; chn < driver->playback_nchannels; chn++) */
-/* 					alsa_driver_silence_on_channel (driver, chn, frag); */
-/* 				nframes -= frag; */
-/* 			} */
-		}
-
-		snd_pcm_mmap_commit (driver->playback_handle, poffset,
-						driver->user_nperiods * driver->frames_per_cycle);
-
-		if ((err = snd_pcm_start (driver->playback_handle)) < 0) {
-			jack_error ("ALSA/USX2Y: could not start playback (%s)",
-				    snd_strerror (err));
-			return -1;
-		}
-	}
-
-	if (driver->hw_monitoring &&
-	    (driver->input_monitor_mask || driver->all_monitor_in)) {
-		if (driver->all_monitor_in) {
-			driver->hw->set_input_monitor_mask (driver->hw, ~0U);
-		} else {
-			driver->hw->set_input_monitor_mask (
-				driver->hw, driver->input_monitor_mask);
-		}
-	}
-
-	driver->playback_nfds =	snd_pcm_poll_descriptors_count (driver->playback_handle);
-	driver->capture_nfds = snd_pcm_poll_descriptors_count (driver->capture_handle);
-
-	if (driver->pfd) {
-		free (driver->pfd);
-	}
-
-	driver->pfd = (struct pollfd *)
-		malloc (sizeof (struct pollfd) *
-			(driver->playback_nfds + driver->capture_nfds + 2));
-
-	return 0;
-}
-
-static int
-usx2y_driver_stop (alsa_driver_t *driver)
-{
-	int err;
-	JSList* node;
-	int chn;
-
-	usx2y_t *h = (usx2y_t *) driver->hw->private;
-
-	/* silence all capture port buffers, because we might
-	   be entering offline mode.
-	*/
-
-	for (chn = 0, node = driver->capture_ports; node;
-		node = jack_slist_next (node), chn++) {
-
-		jack_port_t* port;
-		char* buf;
-		jack_nframes_t nframes = driver->engine->control->buffer_size;
-
-		port = (jack_port_t *) node->data;
-		buf = jack_port_get_buffer (port, nframes);
-		memset (buf, 0, sizeof (jack_default_audio_sample_t) * nframes);
-	}
-
-	if (driver->playback_handle) {
-		if ((err = snd_pcm_drop (driver->playback_handle)) < 0) {
-			jack_error ("ALSA/USX2Y: channel flush for playback "
-					"failed (%s)", snd_strerror (err));
-			return -1;
-		}
-	}
-
-	if (driver->hw_monitoring) {
-		driver->hw->set_input_monitor_mask (driver->hw, 0);
-	}
-
-	munmap(h->hwdep_pcm_shm, sizeof(snd_usX2Y_hwdep_pcm_shm_t));
-
-	if (driver->midi && !driver->xrun_recovery)
-		(driver->midi->stop)(driver->midi);
-
-	return 0;
-}
-
-static int
-usx2y_driver_null_cycle (alsa_driver_t* driver, jack_nframes_t nframes)
-{
-	jack_nframes_t nf;
-	snd_pcm_uframes_t offset;
-	snd_pcm_uframes_t contiguous, contiguous_;
-	int chn;
-
-	VERBOSE(driver->engine,
-		"usx2y_driver_null_cycle (%p, %i)", driver, nframes);
-
-	if (driver->capture_handle) {
-		nf = nframes;
-		offset = 0;
-		while (nf) {
-
-			contiguous = (nf > driver->frames_per_cycle) ?
-				driver->frames_per_cycle : nf;
-
-			if (snd_pcm_mmap_begin (
-					driver->capture_handle,
-					&driver->capture_areas,
-					(snd_pcm_uframes_t *) &offset,
-					(snd_pcm_uframes_t *) &contiguous)) {
-				return -1;
-			}
-			contiguous_ = contiguous;
-			while (contiguous_) {
-				snd_pcm_uframes_t frag = contiguous_;
-				if (usx2y_driver_get_channel_addresses_capture(driver, &frag) < 0)
-					return -1;
-				contiguous_ -= frag;
-			}
-
-			if (snd_pcm_mmap_commit (driver->capture_handle,
-						offset, contiguous) < 0) {
-				return -1;
-			}
-
-			nf -= contiguous;
-		}
-	}
-
-	if (driver->playback_handle) {
-		nf = nframes;
-		offset = 0;
-		while (nf) {
-			contiguous = (nf > driver->frames_per_cycle) ?
-				driver->frames_per_cycle : nf;
-
-			if (snd_pcm_mmap_begin (
-				    driver->playback_handle,
-				    &driver->playback_areas,
-				    (snd_pcm_uframes_t *) &offset,
-				    (snd_pcm_uframes_t *) &contiguous)) {
-				return -1;
-			}
-
-			{
-				snd_pcm_uframes_t frag, nframes = contiguous;
-				while (nframes) {
-					frag = nframes;
-					if (usx2y_driver_get_channel_addresses_playback(driver, &frag) < 0)
-						return -1;
-					for (chn = 0; chn < driver->playback_nchannels; chn++)
-						alsa_driver_silence_on_channel (driver, chn, frag);
-					nframes -= frag;
-				}
-			}
-
-			if (snd_pcm_mmap_commit (driver->playback_handle,
-						offset, contiguous) < 0) {
-				return -1;
-			}
-
-			nf -= contiguous;
-		}
-	}
-
-	return 0;
-}
-
-static int
-usx2y_driver_read (alsa_driver_t *driver, jack_nframes_t nframes)
-{
-	snd_pcm_uframes_t contiguous;
-	snd_pcm_sframes_t nread;
-	snd_pcm_uframes_t offset;
-	jack_default_audio_sample_t* buf[4];
-	channel_t chn;
-	JSList *node;
-	jack_port_t* port;
-	int err;
-	snd_pcm_uframes_t nframes_ = nframes;
-
-	if (!driver->capture_handle || driver->engine->freewheeling) {
-		return 0;
-	}
-
-    if (driver->midi)
-        (driver->midi->read)(driver->midi, nframes);
-
-	nread = 0;
-
-	if (snd_pcm_mmap_begin (driver->capture_handle,
-				&driver->capture_areas,
-				&offset, &nframes_) < 0) {
-		jack_error ("ALSA/USX2Y: %s: mmap areas info error",
-			    driver->alsa_name_capture);
-		return -1;
-	}
-
-	for (chn = 0, node = driver->capture_ports;
-	     node; node = jack_slist_next (node), chn++) {
-		port = (jack_port_t *) node->data;
-		if (!jack_port_connected (port)) {
-			continue;
-		}
-		buf[chn] = jack_port_get_buffer (port, nframes_);
-	}
-
-	while (nframes) {
-
-		contiguous = nframes;
-		if (usx2y_driver_get_channel_addresses_capture (
-			    driver, &contiguous) < 0) {
-			return -1;
-		}
-		for (chn = 0, node = driver->capture_ports;
-		     node; node = jack_slist_next (node), chn++) {
-			port = (jack_port_t *) node->data;
-			if (!jack_port_connected (port)) {
-				/* no-copy optimization */
-				continue;
-			}
-			alsa_driver_read_from_channel (driver, chn,
-						       buf[chn] + nread,
-						       contiguous);
-/* 			sample_move_dS_s24(buf[chn] + nread, */
-/* 					   driver->capture_addr[chn], */
-/* 					   contiguous, */
-/* 					   driver->capture_interleave_skip); */
-		}
-		nread += contiguous;
-		nframes -= contiguous;
-	}
-
-	if ((err = snd_pcm_mmap_commit (driver->capture_handle,
-					offset, nframes_)) < 0) {
-		jack_error ("ALSA/USX2Y: could not complete read of %"
-			    PRIu32 " frames: error = %d", nframes_, err);
-		return -1;
-	}
-
-	return 0;
-}
-
-static int
-usx2y_driver_write (alsa_driver_t* driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	JSList *node;
-	jack_default_audio_sample_t* buf[2];
-	snd_pcm_sframes_t nwritten;
-	snd_pcm_uframes_t contiguous;
-	snd_pcm_uframes_t offset;
-	jack_port_t *port;
-	int err;
-	snd_pcm_uframes_t nframes_ = nframes;
-
-	driver->process_count++;
-
-	if (!driver->playback_handle || driver->engine->freewheeling) {
-		return 0;
-	}
-
-    if (driver->midi)
-        (driver->midi->write)(driver->midi, nframes);
-
-	nwritten = 0;
-
-	/* check current input monitor request status */
-
-	driver->input_monitor_mask = 0;
-
-	for (chn = 0, node = driver->capture_ports; node;
-		node = jack_slist_next (node), chn++) {
-		if (((jack_port_t *) node->data)->shared->monitor_requests) {
-			driver->input_monitor_mask |= (1<<chn);
-		}
-	}
-
-	if (driver->hw_monitoring) {
-		if ((driver->hw->input_monitor_mask
-			!= driver->input_monitor_mask)
-			&& !driver->all_monitor_in) {
-			driver->hw->set_input_monitor_mask (
-				driver->hw, driver->input_monitor_mask);
-		}
-	}
-
-	if (snd_pcm_mmap_begin(driver->playback_handle,
-			       &driver->playback_areas,
-			       &offset, &nframes_) < 0) {
-		jack_error ("ALSA/USX2Y: %s: mmap areas info error",
-			    driver->alsa_name_capture);
-		return -1;
-	}
-
-	for (chn = 0, node = driver->playback_ports;
-	     node; node = jack_slist_next (node), chn++) {
-		port = (jack_port_t *) node->data;
-		buf[chn] = jack_port_get_buffer (port, nframes_);
-	}
-
-	while (nframes) {
-
-		contiguous = nframes;
-		if (usx2y_driver_get_channel_addresses_playback (
-			    driver, &contiguous) < 0) {
-			return -1;
-		}
-		for (chn = 0, node = driver->playback_ports;
-		     node; node = jack_slist_next (node), chn++) {
-			port = (jack_port_t *) node->data;
-			alsa_driver_write_to_channel (driver, chn,
-						      buf[chn] + nwritten,
-						      contiguous);
-		}
-		nwritten += contiguous;
-		nframes -= contiguous;
-	}
-
-	if ((err = snd_pcm_mmap_commit (driver->playback_handle,
-					offset, nframes_)) < 0) {
-		jack_error ("ALSA/USX2Y: could not complete playback of %"
-			    PRIu32 " frames: error = %d", nframes_, err);
-		if (err != EPIPE && err != ESTRPIPE)
-			return -1;
-	}
-
-	return 0;
-}
-
-static void
-usx2y_driver_setup (alsa_driver_t *driver)
-{
-	driver->nt_start = (JackDriverNTStartFunction) usx2y_driver_start;
-	driver->nt_stop = (JackDriverNTStopFunction) usx2y_driver_stop;
-	driver->read = (JackDriverReadFunction) usx2y_driver_read;
-	driver->write = (JackDriverReadFunction) usx2y_driver_write;
-	driver->null_cycle =
-		(JackDriverNullCycleFunction) usx2y_driver_null_cycle;
-}
-
-
-jack_hardware_t *
-jack_alsa_usx2y_hw_new (alsa_driver_t *driver)
-{
-	jack_hardware_t *hw;
-	usx2y_t *h;
-
-	int   hwdep_cardno;
-    int   hwdep_devno;
-	char *hwdep_colon;
-	char  hwdep_name[9];
-	snd_hwdep_t *hwdep_handle;
-
-    hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
-
-	hw->capabilities = 0;
-	hw->input_monitor_mask = 0;
-	hw->private = 0;
-
-	hw->set_input_monitor_mask = usx2y_set_input_monitor_mask;
-	hw->change_sample_clock = usx2y_change_sample_clock;
-	hw->release = usx2y_release;
-
-	/* Derive the special USB US-X2Y hwdep pcm device name from
-	 * the playback one, thus allowing the use of the "rawusb"
-	 * experimental stuff if, and only if, the "hw:n,2" device
-	 * name is specified. Otherwise, fallback to generic backend.
-	 */
-	hwdep_handle = NULL;
-	hwdep_cardno = hwdep_devno = 0;
-	if ((hwdep_colon = strrchr(driver->alsa_name_playback, ':')) != NULL)
-		sscanf(hwdep_colon, ":%d,%d", &hwdep_cardno, &hwdep_devno);
-	if (hwdep_devno == 2) {
-		snprintf(hwdep_name, sizeof(hwdep_name), "hw:%d,1", hwdep_cardno);
-		if (snd_hwdep_open (&hwdep_handle, hwdep_name, O_RDWR) < 0) {
-			jack_error ("ALSA/USX2Y: Cannot open hwdep device \"%s\"", hwdep_name);
-		} else {
-			/* Allocate specific USX2Y hwdep pcm struct. */
-			h = (usx2y_t *) malloc (sizeof (usx2y_t));
-			h->driver = driver;
-			h->hwdep_handle = hwdep_handle;
-			hw->private = h;
-			/* Set our own operational function pointers. */
-			usx2y_driver_setup(driver);
-			jack_info("ALSA/USX2Y: EXPERIMENTAL hwdep pcm device %s"
-				" (aka \"rawusb\")", driver->alsa_name_playback);
-		}
-	}
-
-	return hw;
-}
diff --git a/drivers/alsa/usx2y.h b/drivers/alsa/usx2y.h
deleted file mode 100644
index 8876d94..0000000
--- a/drivers/alsa/usx2y.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Copyright (C) 2004 Karsten Wiese, Rui Nuno Capela
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_usx2y_h__
-#define __jack_usx2y_h__
-
-#define USX2Y_MAXPACK		50
-#define USX2Y_MAXBUFFERMS	100
-#define USX2Y_MAXSTRIDE	3
-
-#define USX2Y_SSS (((USX2Y_MAXPACK * USX2Y_MAXBUFFERMS * USX2Y_MAXSTRIDE + 4096) / 4096) * 4096)
-
-struct snd_usX2Y_hwdep_pcm_shm {
-	char playback[USX2Y_SSS];
-	char capture0x8[USX2Y_SSS];
-	char capture0xA[USX2Y_SSS];
-	volatile int playback_iso_head;
-	int playback_iso_start;
-	struct {
-		int	frame,
-			offset,
-			length;
-	} captured_iso[128];
-	volatile int captured_iso_head;
-	volatile unsigned captured_iso_frames;
-	int capture_iso_start;
-};
-typedef struct snd_usX2Y_hwdep_pcm_shm snd_usX2Y_hwdep_pcm_shm_t;
-
-typedef struct {
-	alsa_driver_t *driver;
-	snd_hwdep_t *hwdep_handle;
-	struct pollfd pfds;
-	struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
-	int playback_iso_start;
-	int playback_iso_bytes_done;
-	int capture_iso_start;
-	int capture_iso_bytes_done;
-} usx2y_t;
-
-jack_hardware_t *
-jack_alsa_usx2y_hw_new (alsa_driver_t *driver);
-
-#endif /* __jack_usx2y_h__*/
diff --git a/drivers/coreaudio/.cvsignore b/drivers/coreaudio/.cvsignore
deleted file mode 100644
index 0d0371d..0000000
--- a/drivers/coreaudio/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-*.lo
-*.la
-.deps
-.libs
diff --git a/drivers/coreaudio/Makefile.am b/drivers/coreaudio/Makefile.am
deleted file mode 100644
index 68b8c9f..0000000
--- a/drivers/coreaudio/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-MAINTAINERCLEANFILES=Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS) -include /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_coreaudio.la
-
-jack_coreaudio_la_LDFLAGS = -module -avoid-version @OS_LDFLAGS@
-jack_coreaudio_la_SOURCES = coreaudio_driver.c coreaudio_driver.h 
-
-noinst_HEADERS = coreaudio_driver.h 
diff --git a/drivers/coreaudio/coreaudio_driver.c b/drivers/coreaudio/coreaudio_driver.c
deleted file mode 100755
index 9a49a22..0000000
--- a/drivers/coreaudio/coreaudio_driver.c
+++ /dev/null
@@ -1,1207 +0,0 @@
-/*
- Copyright � Grame, 2003.
- Copyright � Johnny Petrantoni, 2003.
- 
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- 
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
- 
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- 
- Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
- grame at rd.grame.fr
-	
- Johnny Petrantoni, johnny at lato-b.com - Italy, Rome.
- 
- Jan 30, 2004: Johnny Petrantoni: first code of the coreaudio driver, based on portaudio driver by Stephane Letz.
- Feb 02, 2004: Johnny Petrantoni: fixed null cycle, removed double copy of buffers in AudioRender, the driver works fine (tested with Built-in Audio and Hammerfall RME), but no cpu load is displayed.
- Feb 03, 2004: Johnny Petrantoni: some little fix.
- Feb 03, 2004: Stephane Letz: some fix in AudioRender.cpp code.
- Feb 03, 2004: Johnny Petrantoni: removed the default device stuff (useless, in jackosx, because JackPilot manages this behavior), the device must be specified. and all parameter must be correct.
- Feb 04, 2004: Johnny Petrantoni: now the driver supports interfaces with multiple interleaved streams (such as the MOTU 828).
- Nov 05, 2004: S.Letz: correct management of -I option for use with JackPilot.
- Nov 15, 2004: S.Letz: Set a default value for deviceID.
- Nov 30, 2004: S.Letz: In coreaudio_driver_write : clear to avoid playing dirty buffers when the client does not produce output anymore.
- Dec 05, 2004: S.Letz: XRun detection 
- Dec 09, 2004: S.Letz: Dynamic buffer size change
- Dec 23, 2004: S.Letz: Correct bug in dynamic buffer size change : update period_usecs
- Jan 20, 2005: S.Letz: Almost complete rewrite using AUHAL.
- May 20, 2005: S.Letz: Add "systemic" latencies management.
- Jun 06, 2005: S.Letz: Remove the "-I" parameter, change the semantic of "-n" parameter : -n (driver name) now correctly uses the PropertyDeviceUID
-					   (persistent accross reboot...) as the identifier for the used coreaudio driver.
- Jun 14, 2005: S.Letz: Since the "-I" parameter is not used anymore, rename the "systemic" latencies management parametes "-I" and "-O" like for the ALSA driver.
- Aug 16, 2005: S.Letz: Remove get_device_id_from_num, use get_default_device instead. If the -n option is not used or the device name cannot
-					   be found, the default device is used. Note: the default device can be used only if both default input and default output are the same.
- Dec 19, 2005: S.Letz: Add -d option (display_device_names).
- Apri 7, 2006: S.Letz: Synchronization with the jackdmp coreaudio driver version: improve half-duplex management.
- May 17, 2006: S.Letz: Minor fix in driver_initialize.
- May 18, 2006: S.Letz: Document sample rate default value.
- May 31, 2006: S.Letz: Apply Rui patch for more consistent driver parameter naming.
- Dec 04, 2007: S.Letz: Fix a bug in sample rate management (occuring in particular with "aggregate" devices).
- Dec 05, 2007: S.Letz: Correct sample_rate management in Open. Better handling in sample_rate change listener.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <jack/engine.h>
-#include "coreaudio_driver.h"
-
-const int CAVersion = 3;
-
-//#define PRINTDEBUG 1
-
-static void JCALog(char *fmt, ...)
-{
-#ifdef PRINTDEBUG
-    va_list ap;
-    va_start(ap, fmt);
-    fprintf(stderr, "JCA: ");
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-#endif
-}
-
-static void printError(OSStatus err)
-{
-#ifdef DEBUG
-    switch (err) {
-        case kAudioHardwareNoError:
-            JCALog("error code : kAudioHardwareNoError\n");
-            break;
-        case kAudioHardwareNotRunningError:
-            JCALog("error code : kAudioHardwareNotRunningError\n");
-            break;
-        case kAudioHardwareUnspecifiedError:
-            JCALog("error code : kAudioHardwareUnspecifiedError\n");
-            break;
-        case kAudioHardwareUnknownPropertyError:
-            JCALog("error code : kAudioHardwareUnknownPropertyError\n");
-            break;
-        case kAudioHardwareBadPropertySizeError:
-            JCALog("error code : kAudioHardwareBadPropertySizeError\n");
-            break;
-        case kAudioHardwareIllegalOperationError:
-            JCALog("error code : kAudioHardwareIllegalOperationError\n");
-            break;
-        case kAudioHardwareBadDeviceError:
-            JCALog("error code : kAudioHardwareBadDeviceError\n");
-            break;
-        case kAudioHardwareBadStreamError:
-            JCALog("error code : kAudioHardwareBadStreamError\n");
-            break;
-        case kAudioDeviceUnsupportedFormatError:
-            JCALog("error code : kAudioDeviceUnsupportedFormatError\n");
-            break;
-        case kAudioDevicePermissionsError:
-            JCALog("error code : kAudioDevicePermissionsError\n");
-            break;
-        default:
-            JCALog("error code : unknown %ld\n", err);
-            break;
-    }
-#endif
-}
-
-static OSStatus get_device_name_from_id(AudioDeviceID id, char name[256])
-{
-    UInt32 size = sizeof(char) * 256;
-    OSStatus res = AudioDeviceGetProperty(id, 0, false,
-					   kAudioDevicePropertyDeviceName,
-					   &size,
-					   &name[0]);
-    return res;
-}
-
-static OSStatus get_device_id_from_uid(char* UID, AudioDeviceID* id)
-{
-	UInt32 size = sizeof(AudioValueTranslation);
-	CFStringRef inIUD = CFStringCreateWithCString(NULL, UID, CFStringGetSystemEncoding());
-	AudioValueTranslation value = { &inIUD, sizeof(CFStringRef), id, sizeof(AudioDeviceID) };
-	if (inIUD == NULL) {
-		return kAudioHardwareUnspecifiedError;
-	} else {
-		OSStatus res = AudioHardwareGetProperty(kAudioHardwarePropertyDeviceForUID, &size, &value);
-		CFRelease(inIUD);
-		JCALog("get_device_id_from_uid %s %ld \n", UID, *id);
-		return (*id == kAudioDeviceUnknown) ? kAudioHardwareBadDeviceError : res;
-	}
-}
-
-static OSStatus get_default_device(AudioDeviceID * id)
-{
-    OSStatus res;
-    UInt32 theSize = sizeof(UInt32);
-	AudioDeviceID inDefault;
-	AudioDeviceID outDefault;
-  
-	if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, 
-					&theSize, &inDefault)) != noErr)
-		return res;
-	
-	if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, 
-					&theSize, &outDefault)) != noErr)
-		return res;
-		
-	JCALog("get_default_device: input %ld output %ld\n", inDefault, outDefault);
-	
-	// Get the device only if default input and ouput are the same
-	if (inDefault == outDefault) {
-		*id = inDefault;
-		return noErr;
-	} else {
-		jack_error("Default input and output devices are not the same !!");
-		return kAudioHardwareBadDeviceError;
-	}
-}
-
-static OSStatus get_default_input_device(AudioDeviceID* id)
-{
-    OSStatus res;
-    UInt32 theSize = sizeof(UInt32);
-    AudioDeviceID inDefault;
-  
-    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
-                                        &theSize, &inDefault)) != noErr)
-        return res;
-
-    JCALog("get_default_input_device: input = %ld \n", inDefault);
-    *id = inDefault;
-	return noErr;
-}
-
-static OSStatus get_default_output_device(AudioDeviceID* id)
-{
-    OSStatus res;
-    UInt32 theSize = sizeof(UInt32);
-    AudioDeviceID outDefault;
-
-    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
-                                        &theSize, &outDefault)) != noErr)
-        return res;
-
-    JCALog("get_default_output_device: output = %ld\n", outDefault);
-	*id = outDefault;
-	return noErr;
-}
-
-OSStatus get_total_channels(AudioDeviceID device, int* channelCount, bool isInput) 
-{
-    OSStatus			err = noErr;
-    UInt32				outSize;
-    Boolean				outWritable;
-    AudioBufferList*	bufferList = 0;
-	AudioStreamID*		streamList = 0;
-    int					i, numStream;
-	
-	err = AudioDeviceGetPropertyInfo(device, 0, isInput, kAudioDevicePropertyStreams, &outSize, &outWritable);
-	if (err == noErr) {
-		streamList = (AudioStreamID*)malloc(outSize);
-		numStream = outSize/sizeof(AudioStreamID);
-		JCALog("get_total_channels device stream number = %ld numStream = %ld\n", device, numStream);
-		err = AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyStreams, &outSize, streamList);
-		if (err == noErr) {
-			AudioStreamBasicDescription streamDesc;
-			outSize = sizeof(AudioStreamBasicDescription);
-			for (i = 0; i < numStream; i++) {
-				err = AudioStreamGetProperty(streamList[i], 0, kAudioDevicePropertyStreamFormat, &outSize, &streamDesc);
-				JCALog("get_total_channels streamDesc mFormatFlags = %ld mChannelsPerFrame = %ld\n", streamDesc.mFormatFlags, streamDesc.mChannelsPerFrame);
-			}
-		}
-	}
-	
-    *channelCount = 0;
-    err = AudioDeviceGetPropertyInfo(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, &outWritable);
-    if (err == noErr) {
-        bufferList = (AudioBufferList*)malloc(outSize);
-        err = AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, bufferList);
-        if (err == noErr) {								
-            for (i = 0; i < bufferList->mNumberBuffers; i++) 
-                *channelCount += bufferList->mBuffers[i].mNumberChannels;
-        }
-    }
-	
-	if (streamList) 
-		free(streamList);
-	if (bufferList) 
-		free(bufferList);	
-		
-    return err;
-}
-
-static OSStatus display_device_names()
-{
-	UInt32 size;
-	Boolean isWritable;
-	int i, deviceNum;
-	OSStatus err;
-	CFStringRef UIname;
-	
-	err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, &isWritable);
-    if (err != noErr) 
-		return err;
-		
-	deviceNum = size/sizeof(AudioDeviceID);
-	AudioDeviceID devices[deviceNum];
-	
-	err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, devices);
-    if (err != noErr) 
-		return err;
-	
-	for (i = 0; i < deviceNum; i++) {
-        char device_name[256];
-		char internal_name[256];
-		
-		size = sizeof(CFStringRef);
-		UIname = NULL;
-		err = AudioDeviceGetProperty(devices[i], 0, false, kAudioDevicePropertyDeviceUID, &size, &UIname);
-		if (err == noErr) {
-			CFStringGetCString(UIname, internal_name, 256, CFStringGetSystemEncoding());
-		} else {
-			goto error;
-		}
-		
-		size = 256;
-		err = AudioDeviceGetProperty(devices[i], 0, false, kAudioDevicePropertyDeviceName, &size, device_name);
-		if (err != noErr) 
-			return err; 
-		jack_info("ICI");
-		jack_info("Device name = \'%s\', internal_name = \'%s\' (to be used as -d parameter)", device_name, internal_name); 
-	}
-	
-	return noErr;
-
-error:
-	if (UIname != NULL)
-		CFRelease(UIname);
-	return err;
-}
-
-static OSStatus render(void *inRefCon, 
-						AudioUnitRenderActionFlags 	*ioActionFlags, 
-						const AudioTimeStamp 		*inTimeStamp, 
-						UInt32 						inBusNumber, 
-						UInt32 						inNumberFrames, 
-						AudioBufferList 			*ioData)
-{
-	int res, i;
-	JSList *node;
-	coreaudio_driver_t* ca_driver = (coreaudio_driver_t*)inRefCon;
-	AudioUnitRender(ca_driver->au_hal, ioActionFlags, inTimeStamp, 1, inNumberFrames, ca_driver->input_list);
-	
-	if (ca_driver->xrun_detected > 0) { /* XRun was detected */
-		jack_time_t current_time = jack_get_microseconds();
-		ca_driver->engine->delay(ca_driver->engine, current_time - 
-			(ca_driver->last_wait_ust + ca_driver->period_usecs));
-		ca_driver->last_wait_ust = current_time;
-		ca_driver->xrun_detected = 0;
-		return 0;
-    } else {
-		ca_driver->last_wait_ust = jack_get_microseconds();
-		ca_driver->engine->transport_cycle_start(ca_driver->engine,
-					  jack_get_microseconds());
-		res = ca_driver->engine->run_cycle(ca_driver->engine, inNumberFrames, 0);
-	}
-	
-	if (ca_driver->null_cycle_occured) {
-		ca_driver->null_cycle_occured = 0;
-		for (i = 0; i < ca_driver->playback_nchannels; i++) {
-			memset((float*)ioData->mBuffers[i].mData, 0, sizeof(float) * inNumberFrames);
-		}
-	} else {
-		for (i = 0, node = ca_driver->playback_ports; i < ca_driver->playback_nchannels; i++, node = jack_slist_next(node)) {
-			memcpy((float*)ioData->mBuffers[i].mData,
-					(jack_default_audio_sample_t*)jack_port_get_buffer(((jack_port_t *) node->data), inNumberFrames), 
-					sizeof(float) * inNumberFrames);
-		}
-	}
-	
-	return res;
-}
-
-static OSStatus render_input(void *inRefCon, 
-							AudioUnitRenderActionFlags 	*ioActionFlags, 
-							const AudioTimeStamp 		*inTimeStamp, 
-							UInt32 						inBusNumber, 
-							UInt32 						inNumberFrames, 
-							AudioBufferList 			*ioData)
-
-{
-	coreaudio_driver_t* ca_driver = (coreaudio_driver_t*)inRefCon;
-	AudioUnitRender(ca_driver->au_hal, ioActionFlags, inTimeStamp, 1, inNumberFrames, ca_driver->input_list);
-	if (ca_driver->xrun_detected > 0) { /* XRun was detected */
-		jack_time_t current_time = jack_get_microseconds();
-		ca_driver->engine->delay(ca_driver->engine, current_time - 
-			(ca_driver->last_wait_ust + ca_driver->period_usecs));
-		ca_driver->last_wait_ust = current_time;
-		ca_driver->xrun_detected = 0;
-		return 0;
-    } else {
-		ca_driver->last_wait_ust = jack_get_microseconds();
-		ca_driver->engine->transport_cycle_start(ca_driver->engine,
-					  jack_get_microseconds());
-		return ca_driver->engine->run_cycle(ca_driver->engine, inNumberFrames, 0);
-	}
-}
-
-
-static OSStatus sr_notification(AudioDeviceID inDevice,
-        UInt32 inChannel,
-        Boolean	isInput,
-        AudioDevicePropertyID inPropertyID,
-        void* inClientData)
-{
-	coreaudio_driver_t* driver = (coreaudio_driver_t*)inClientData;
-	
-	switch (inPropertyID) {
-
-		case kAudioDevicePropertyNominalSampleRate: {
-			JCALog("JackCoreAudioDriver::SRNotificationCallback kAudioDevicePropertyNominalSampleRate \n");
-			driver->state = 1;
-			break;
-		}
-	}
-	
-	return noErr;
-}
-
-static OSStatus notification(AudioDeviceID inDevice,
-							UInt32 inChannel,
-							Boolean	isInput,
-							AudioDevicePropertyID inPropertyID,
-							void* inClientData)
-{
-    coreaudio_driver_t* driver = (coreaudio_driver_t*)inClientData;
-    switch (inPropertyID) {
-	
-		case kAudioDeviceProcessorOverload:
-			driver->xrun_detected = 1;
-			break;
-			
-		case kAudioDevicePropertyNominalSampleRate: {
-			UInt32 outSize =  sizeof(Float64);
-			Float64 sampleRate;
-			AudioStreamBasicDescription srcFormat, dstFormat;
-			OSStatus err = AudioDeviceGetProperty(driver->device_id, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outSize, &sampleRate);
-			if (err != noErr) {
-				jack_error("Cannot get current sample rate");
-				return kAudioHardwareUnsupportedOperationError;
-			}
-			JCALog("JackCoreAudioDriver::NotificationCallback kAudioDevicePropertyNominalSampleRate %ld\n", (long)sampleRate);
-			outSize = sizeof(AudioStreamBasicDescription);
-			
-			// Update SR for input
-			err = AudioUnitGetProperty(driver->au_hal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &srcFormat, &outSize);
-			if (err != noErr) {
-				jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
-			}
-			srcFormat.mSampleRate = sampleRate;
-			err = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &srcFormat, outSize);
-			if (err != noErr) {
-				jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
-			}
-		
-			// Update SR for output
-			err = AudioUnitGetProperty(driver->au_hal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &dstFormat, &outSize);
-			if (err != noErr) {
-				jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
-			}
-			dstFormat.mSampleRate = sampleRate;
-			err = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &dstFormat, outSize);
-			if (err != noErr) {
-				jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
-			}
-			break;
-		}
-    }
-    return noErr;
-}
-
-static int
-coreaudio_driver_attach(coreaudio_driver_t * driver, jack_engine_t * engine)
-{
-    jack_port_t *port;
-	JSList *node;
-    int port_flags;
-    channel_t chn;
-    char buf[JACK_PORT_NAME_SIZE];
-	char channel_name[64];
-	OSStatus err;
-	UInt32 size;
-	UInt32 value1,value2;
-    Boolean isWritable;
-	
-    driver->engine = engine;
-
-    driver->engine->set_buffer_size(engine, driver->frames_per_cycle);
-    driver->engine->set_sample_rate(engine, driver->frame_rate);
-
-    port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
-
-    /*
-       if (driver->has_hw_monitoring) {
-			port_flags |= JackPortCanMonitor;
-       }
-	*/
-
-    for (chn = 0; chn < driver->capture_nchannels; chn++) {
-		err = AudioDeviceGetPropertyInfo(driver->device_id, chn + 1, true, kAudioDevicePropertyChannelName, &size, &isWritable);
-		if (err == noErr && size > 0)  {
-			err = AudioDeviceGetProperty(driver->device_id, chn + 1, true, kAudioDevicePropertyChannelName, &size, channel_name);	
-			if (err != noErr) 
-				JCALog("AudioDeviceGetProperty kAudioDevicePropertyChannelName error \n");
-			snprintf(buf, sizeof(buf) - 1, "%s:out_%s%lu", driver->capture_driver_name, channel_name, chn + 1);
-		} else {
-			snprintf(buf, sizeof(buf) - 1, "%s:out%lu", driver->capture_driver_name, chn + 1);
-		}
-	
-		if ((port = jack_port_register(driver->client, buf,
-					JACK_DEFAULT_AUDIO_TYPE, port_flags,
-					0)) == NULL) {
-			jack_error("coreaudio: cannot register port for %s", buf);
-			break;
-		}
-
-		size = sizeof(UInt32);
-		value1 = value2 = 0;
-		err = AudioDeviceGetProperty(driver->device_id, 0, true, kAudioDevicePropertyLatency, &size, &value1);	
-		if (err != noErr) 
-			JCALog("AudioDeviceGetProperty kAudioDevicePropertyLatency error \n");
-		err = AudioDeviceGetProperty(driver->device_id, 0, true, kAudioDevicePropertySafetyOffset, &size, &value2);	
-		if (err != noErr) 
-			JCALog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n");
-		
-		jack_port_set_latency(port, driver->frames_per_cycle + value1 + value2 + driver->capture_frame_latency);
-		driver->capture_ports =
-			jack_slist_append(driver->capture_ports, port);
-    }
-
-    port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
-
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		err = AudioDeviceGetPropertyInfo(driver->device_id, chn + 1, false, kAudioDevicePropertyChannelName, &size, &isWritable);
-		if (err == noErr && size > 0)  {
-			err = AudioDeviceGetProperty(driver->device_id, chn + 1, false, kAudioDevicePropertyChannelName, &size, channel_name);	
-			if (err != noErr) 
-				JCALog("AudioDeviceGetProperty kAudioDevicePropertyChannelName error \n");
-			snprintf(buf, sizeof(buf) - 1, "%s:in_%s%lu", driver->playback_driver_name, channel_name, chn + 1);
-		} else {
-			snprintf(buf, sizeof(buf) - 1, "%s:in%lu", driver->playback_driver_name, chn + 1);
-		}
-
-		if ((port = jack_port_register(driver->client, buf,
-					JACK_DEFAULT_AUDIO_TYPE, port_flags,
-					0)) == NULL) {
-			jack_error("coreaudio: cannot register port for %s", buf);
-			break;
-		}
-
-		size = sizeof(UInt32);
-		value1 = value2 = 0;
-		err = AudioDeviceGetProperty(driver->device_id, 0, false, kAudioDevicePropertyLatency, &size, &value1);	
-		if (err != noErr) 
-			JCALog("AudioDeviceGetProperty kAudioDevicePropertyLatency error \n");
-		err = AudioDeviceGetProperty(driver->device_id, 0, false, kAudioDevicePropertySafetyOffset, &size, &value2);	
-		if (err != noErr) 
-			JCALog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n");
-	
-		jack_port_set_latency(port, driver->frames_per_cycle + value1 + value2 + driver->playback_frame_latency);
-		driver->playback_ports =
-			jack_slist_append(driver->playback_ports, port);
-	}
-	
-	// Input buffers do no change : prepare them only once
-	for (chn = 0, node = driver->capture_ports; chn < driver->capture_nchannels; chn++, node = jack_slist_next(node)) {
-		driver->input_list->mBuffers[chn].mData 
-			= (jack_default_audio_sample_t*)jack_port_get_buffer(((jack_port_t *) node->data), driver->frames_per_cycle);
-    }
-
-    jack_activate(driver->client);
-    return 0;
-}
-
-static int
-coreaudio_driver_detach(coreaudio_driver_t * driver, jack_engine_t * engine)
-{
-    JSList *node;
-
-    if (driver->engine == 0) {
-		return -1;
-    }
-
-    for (node = driver->capture_ports; node; node = jack_slist_next(node)) {
-		jack_port_unregister(driver->client, ((jack_port_t *) node->data));
-    }
-
-    jack_slist_free(driver->capture_ports);
-    driver->capture_ports = 0;
-
-    for (node = driver->playback_ports; node; node = jack_slist_next(node)) {
-		jack_port_unregister(driver->client, ((jack_port_t *) node->data));
-    }
-
-    jack_slist_free(driver->playback_ports);
-    driver->playback_ports = 0;
-
-    driver->engine = 0;
-    return 0;
-}
-
-static int
-coreaudio_driver_null_cycle(coreaudio_driver_t * driver, jack_nframes_t nframes)
-{
-	driver->null_cycle_occured = 1;
-    return 0;
-}
-
-static int
-coreaudio_driver_read(coreaudio_driver_t * driver, jack_nframes_t nframes)
-{
-    return 0;
-}
-
-static int
-coreaudio_driver_write(coreaudio_driver_t * driver, jack_nframes_t nframes)
-{
-	return 0;
-}
-
-static int coreaudio_driver_audio_start(coreaudio_driver_t * driver)
-{
-	return (AudioOutputUnitStart(driver->au_hal) == noErr) ? 0 : -1;
-}
-
-static int coreaudio_driver_audio_stop(coreaudio_driver_t * driver)
-{
-	return (AudioOutputUnitStop(driver->au_hal) == noErr) ? 0 : -1;
-}
-
-static int
-coreaudio_driver_bufsize(coreaudio_driver_t * driver,
-			 jack_nframes_t nframes)
-{
-
-    /* This gets called from the engine server thread, so it must
-     * be serialized with the driver thread. Stopping the audio
-     * also stops that thread. */
-	/*
-	TO DO
-	*/
-	return 0;
-}
-
-/** create a new driver instance
-*/
-static jack_driver_t *coreaudio_driver_new(char* name,
-										   jack_client_t* client,
-										   jack_nframes_t nframes,
-										   jack_nframes_t samplerate,
-										   int capturing,
-										   int playing,
-										   int inchannels,
-										   int outchannels,
-										   char* capture_driver_uid,
-										   char* playback_driver_uid,
-										   jack_nframes_t capture_latency, 
-										   jack_nframes_t playback_latency)
-{
-    coreaudio_driver_t *driver;
-	OSStatus err = noErr;
-	ComponentResult err1;
-    UInt32 outSize;
-	UInt32 enableIO;
-	AudioStreamBasicDescription srcFormat, dstFormat;
-	Float64 sampleRate;
-	int in_nChannels = 0;
-	int out_nChannels = 0;
-	int i;
-	
-    driver = (coreaudio_driver_t *) calloc(1, sizeof(coreaudio_driver_t));
-    jack_driver_init((jack_driver_t *) driver);
-
-    if (!jack_power_of_two(nframes)) {
-		jack_error("CA: -p must be a power of two.");
-		goto error;
-    }
-
-	driver->state = 0;
-    driver->frames_per_cycle = nframes;
-    driver->frame_rate = samplerate;
-    driver->capturing = capturing;
-    driver->playing = playing;
-	driver->xrun_detected = 0;
-	driver->null_cycle = 0;
-
-    driver->attach = (JackDriverAttachFunction) coreaudio_driver_attach;
-    driver->detach = (JackDriverDetachFunction) coreaudio_driver_detach;
-    driver->read = (JackDriverReadFunction) coreaudio_driver_read;
-    driver->write = (JackDriverReadFunction) coreaudio_driver_write;
-    driver->null_cycle =
-	(JackDriverNullCycleFunction) coreaudio_driver_null_cycle;
-    driver->bufsize = (JackDriverBufSizeFunction) coreaudio_driver_bufsize;
-    driver->start = (JackDriverStartFunction) coreaudio_driver_audio_start;
-    driver->stop = (JackDriverStopFunction) coreaudio_driver_audio_stop;
-	driver->capture_frame_latency = capture_latency;
-	driver->playback_frame_latency = playback_latency;
-	
-	// Duplex
-    if (strcmp(capture_driver_uid, "") != 0 && strcmp(playback_driver_uid, "") != 0) {
-		JCALog("Open duplex \n");
-        if (get_device_id_from_uid(playback_driver_uid, &driver->device_id) != noErr) {
-            if (get_default_device(&driver->device_id) != noErr) {
-				jack_error("Cannot open default device");
-				goto error;
-			}
-		}
-		if (get_device_name_from_id(driver->device_id, driver->capture_driver_name) != noErr || get_device_name_from_id(driver->device_id, driver->playback_driver_name) != noErr) {
-			jack_error("Cannot get device name from device ID");
-			goto error;
-		}
-		
-	// Capture only
-	} else if (strcmp(capture_driver_uid, "") != 0) {
-		JCALog("Open capture only \n");
-		if (get_device_id_from_uid(capture_driver_uid, &driver->device_id) != noErr) {
-            if (get_default_input_device(&driver->device_id) != noErr) {
-				jack_error("Cannot open default device");
-                goto error;
-			}
-		}
-		if (get_device_name_from_id(driver->device_id, driver->capture_driver_name) != noErr) {
-			jack_error("Cannot get device name from device ID");
-			goto error;
-		}
-		
-  	// Playback only
-	} else if (playback_driver_uid != NULL) {
-		JCALog("Open playback only \n");
-		if (get_device_id_from_uid(playback_driver_uid, &driver->device_id) != noErr) {
-            if (get_default_output_device(&driver->device_id) != noErr) {
-				jack_error("Cannot open default device");
-                goto error;
-			}
-        }
-		if (get_device_name_from_id(driver->device_id, driver->playback_driver_name) != noErr) {
-			jack_error("Cannot get device name from device ID");
-			goto error;
-		}
-		
-	// Use default driver in duplex mode
-	} else {
-		JCALog("Open default driver \n");
-		if (get_default_device(&driver->device_id) != noErr) {
-			jack_error("Cannot open default device");
-			goto error;
-		}
-		if (get_device_name_from_id(driver->device_id, driver->capture_driver_name) != noErr || get_device_name_from_id(driver->device_id, driver->playback_driver_name) != noErr) {
-			jack_error("Cannot get device name from device ID");
-			goto error;
-		}
-	}
-	
-	driver->client = client;
-    driver->period_usecs =
-		(((float) driver->frames_per_cycle) / driver->frame_rate) *
-		1000000.0f;
-	
-	if (capturing) {
-		err = get_total_channels(driver->device_id, &in_nChannels, true);
-		if (err != noErr) { 
-			jack_error("Cannot get input channel number");
-			printError(err);
-			goto error;
-		} 
-	}
-	
-	if (playing) {
-		err = get_total_channels(driver->device_id, &out_nChannels, false);
-		if (err != noErr) { 
-			jack_error("Cannot get output channel number");
-			printError(err);
-			goto error;
-		} 
-	}
-	
-	if (inchannels > in_nChannels) {
-        jack_error("This device hasn't required input channels inchannels = %ld in_nChannels = %ld", inchannels, in_nChannels);
-		goto error;
-    }
-	
-	if (outchannels > out_nChannels) {
-        jack_error("This device hasn't required output channels outchannels = %ld out_nChannels = %ld", outchannels, out_nChannels);
-		goto error;
-    }
-
-	if (inchannels == 0) {
-		JCALog("Setup max in channels = %ld\n", in_nChannels);
-		inchannels = in_nChannels; 
-	}
-		
-	if (outchannels == 0) {
-		JCALog("Setup max out channels = %ld\n", out_nChannels);
-		outchannels = out_nChannels; 
-	}
-
-    // Setting buffer size
-    outSize = sizeof(UInt32);
-    err = AudioDeviceSetProperty(driver->device_id, NULL, 0, false, kAudioDevicePropertyBufferFrameSize, outSize, &nframes);
-    if (err != noErr) {
-        jack_error("Cannot set buffer size %ld", nframes);
-        printError(err);
-		goto error;
-    }
-
-	// Set sample rate
-	outSize =  sizeof(Float64);
-	err = AudioDeviceGetProperty(driver->device_id, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outSize, &sampleRate);
-	if (err != noErr) {
-		jack_error("Cannot get current sample rate");
-		printError(err);
-		goto error;
-	}
-
-	if (samplerate != (jack_nframes_t)sampleRate) {
-		sampleRate = (Float64)samplerate;
-		
-		// To get SR change notification
-		err = AudioDeviceAddPropertyListener(driver->device_id, 0, true, kAudioDevicePropertyNominalSampleRate, sr_notification, driver);
-		if (err != noErr) {
-			jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyNominalSampleRate");
-			printError(err);
-			return -1;
-		}
-		err = AudioDeviceSetProperty(driver->device_id, NULL, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, outSize, &sampleRate);
-		if (err != noErr) {
-			jack_error("Cannot set sample rate = %ld", samplerate);
-			printError(err);
-			return -1;
-		}
-		
-		// Waiting for SR change notification
-		int count = 0;
-		while (!driver->state && count++ < 100) {
-			usleep(100000);
-			JCALog("Wait count = %ld\n", count);
-		}
-		
-		// Remove SR change notification
-		AudioDeviceRemovePropertyListener(driver->device_id, 0, true, kAudioDevicePropertyNominalSampleRate, sr_notification);
-	}
-
-    // AUHAL
-    ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0};
-    Component HALOutput = FindNextComponent(NULL, &cd);
-
-    err1 = OpenAComponent(HALOutput, &driver->au_hal);
-    if (err1 != noErr) {
-		jack_error("Error calling OpenAComponent");
-        printError(err1);
-        goto error;
-	}
-
-    err1 = AudioUnitInitialize(driver->au_hal);
-    if (err1 != noErr) {
-		jack_error("Cannot initialize AUHAL unit");
-		printError(err1);
-        goto error;
-	}
-
- 	// Start I/O
-	enableIO = 1;
-	if (capturing && inchannels > 0) {
-		JCALog("Setup AUHAL input\n");
-        err1 = AudioUnitSetProperty(driver->au_hal, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(enableIO));
-        if (err1 != noErr) {
-            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input");
-            printError(err1);
-            goto error;
-        }
-    }
-	
-	if (playing && outchannels > 0) {
-		JCALog("Setup AUHAL output\n");
-		err1 = AudioUnitSetProperty(driver->au_hal, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(enableIO));
-		if (err1 != noErr) {
-			jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_EnableIO,kAudioUnitScope_Output");
-			printError(err1);
-			goto error;
-		}
-	}
-	
-	// Setup up choosen device, in both input and output cases
-	err1 = AudioUnitSetProperty(driver->au_hal, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &driver->device_id, sizeof(AudioDeviceID));
-	if (err1 != noErr) {
-		jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_CurrentDevice");
-		printError(err1);
-		goto error;
-	}
-
-	// Set buffer size
-	if (capturing && inchannels > 0) {
-		err1 = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 1, (UInt32*)&nframes, sizeof(UInt32));
-		if (err1 != noErr) {
-			jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_MaximumFramesPerSlice");
-			printError(err1);
-			goto error;
-		}
-	}
-	
-	if (playing && outchannels > 0) {
-		err1 = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, (UInt32*)&nframes, sizeof(UInt32));
-		if (err1 != noErr) {
-			jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_MaximumFramesPerSlice");
-			printError(err1);
-			goto error;
-		}
-	}
-
-	// Setup channel map
-	if (capturing && inchannels > 0 && inchannels < in_nChannels) {
-        SInt32 chanArr[in_nChannels];
-        for (i = 0; i < in_nChannels; i++) {
-            chanArr[i] = -1;
-        }
-        for (i = 0; i < inchannels; i++) {
-            chanArr[i] = i;
-        }
-        AudioUnitSetProperty(driver->au_hal, kAudioOutputUnitProperty_ChannelMap , kAudioUnitScope_Input, 1, chanArr, sizeof(SInt32) * in_nChannels);
-        if (err1 != noErr) {
-            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 1");
-            printError(err1);
-        }
-    }
-
-    if (playing && outchannels > 0 && outchannels < out_nChannels) {
-        SInt32 chanArr[out_nChannels];
-        for (i = 0;	i < out_nChannels; i++) {
-            chanArr[i] = -1;
-        }
-        for (i = 0; i < outchannels; i++) {
-            chanArr[i] = i;
-        }
-        err1 = AudioUnitSetProperty(driver->au_hal, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, chanArr, sizeof(SInt32) * out_nChannels);
-        if (err1 != noErr) {
-            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 0");
-            printError(err1);
-        }
-    }
-
-	// Setup stream converters
-  	srcFormat.mSampleRate = samplerate;
-	srcFormat.mFormatID = kAudioFormatLinearPCM;
-	srcFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
-	srcFormat.mBytesPerPacket = sizeof(float);
-	srcFormat.mFramesPerPacket = 1;
-	srcFormat.mBytesPerFrame = sizeof(float);
-	srcFormat.mChannelsPerFrame = outchannels;
-	srcFormat.mBitsPerChannel = 32;
-
-	err1 = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &srcFormat, sizeof(AudioStreamBasicDescription));
-	if (err1 != noErr) {
-		jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
-		printError(err1);
-	}
-
-	dstFormat.mSampleRate = samplerate;
-	dstFormat.mFormatID = kAudioFormatLinearPCM;
-	dstFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
-	dstFormat.mBytesPerPacket = sizeof(float);
-	dstFormat.mFramesPerPacket = 1;
-	dstFormat.mBytesPerFrame = sizeof(float);
-	dstFormat.mChannelsPerFrame = inchannels;
-	dstFormat.mBitsPerChannel = 32;
-
-	err1 = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &dstFormat, sizeof(AudioStreamBasicDescription));
-	if (err1 != noErr) {
-		jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
-		printError(err1);
-	}
-
-	// Setup callbacks
-    if (inchannels > 0 && outchannels == 0) {
-        AURenderCallbackStruct output;
-        output.inputProc = render_input;
-        output.inputProcRefCon = driver;
-    	err1 = AudioUnitSetProperty(driver->au_hal, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &output, sizeof(output));
-        if (err1 != noErr) {
-            jack_error("Error calling  AudioUnitSetProperty - kAudioUnitProperty_SetRenderCallback 1");
-            printError(err1);
-            goto error;
-        }
-    } else {
-        AURenderCallbackStruct output;
-        output.inputProc = render;
-        output.inputProcRefCon = driver;
-        err1 = AudioUnitSetProperty(driver->au_hal, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &output, sizeof(output));
-        if (err1 != noErr) {
-            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_SetRenderCallback 0");
-            printError(err1);
-            goto error;
-        }
-    }
-
-	if (capturing && inchannels > 0) {
-		driver->input_list = (AudioBufferList*)malloc(sizeof(UInt32) + inchannels * sizeof(AudioBuffer));
-		if (driver->input_list == 0)
-			goto error;
-		driver->input_list->mNumberBuffers = inchannels;
-		
-		// Prepare buffers
-		for (i = 0; i < driver->capture_nchannels; i++) {
-			driver->input_list->mBuffers[i].mNumberChannels = 1;
-			driver->input_list->mBuffers[i].mDataByteSize = nframes * sizeof(float);
-		}
-	}
-
-	err = AudioDeviceAddPropertyListener(driver->device_id, 0, true, kAudioDeviceProcessorOverload, notification, driver);
-    if (err != noErr) {
-		jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDeviceProcessorOverload");
-        goto error;
-	}
-		
-	err = AudioDeviceAddPropertyListener(driver->device_id, 0, true, kAudioDevicePropertyNominalSampleRate, notification, driver);
-    if (err != noErr) {
-        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyNominalSampleRate");
-        goto error;
-    }
- 
-	driver->playback_nchannels = outchannels;
-    driver->capture_nchannels = inchannels;
-	return ((jack_driver_t *) driver);
-
-  error:
-	AudioUnitUninitialize(driver->au_hal);
-	CloseComponent(driver->au_hal);
-    jack_error("Cannot open the coreaudio driver");
-    free(driver);
-    return NULL;
-}
-
-/** free all memory allocated by a driver instance
-*/
-static void coreaudio_driver_delete(coreaudio_driver_t * driver)
-{
- 	AudioDeviceRemovePropertyListener(driver->device_id, 0, true, kAudioDeviceProcessorOverload, notification);
-    free(driver->input_list);
- 	AudioUnitUninitialize(driver->au_hal);
-	CloseComponent(driver->au_hal);
-    free(driver);
-}
-
-//== driver "plugin" interface =================================================
-
-/* DRIVER "PLUGIN" INTERFACE */
-
-const char driver_client_name[] = "coreaudio";
-
-jack_driver_desc_t *driver_get_descriptor()
-{
-    jack_driver_desc_t *desc;
-    unsigned int i;
-    desc = calloc(1, sizeof(jack_driver_desc_t));
-
-    strcpy(desc->name, "coreaudio");
-    desc->nparams = 12;
-    desc->params = calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
-
-    i = 0;
-    strcpy(desc->params[i].name, "channels");
-    desc->params[i].character = 'c';
-    desc->params[i].type = JackDriverParamInt;
-    desc->params[i].value.ui = 2;
-    strcpy(desc->params[i].short_desc, "Maximum number of channels");
-    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-    strcpy(desc->params[i].name, "inchannels");
-    desc->params[i].character = 'i';
-    desc->params[i].type = JackDriverParamInt;
-    desc->params[i].value.ui = 2;
-    strcpy(desc->params[i].short_desc, "Maximum number of input channels");
-    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-    strcpy(desc->params[i].name, "outchannels");
-    desc->params[i].character = 'o';
-    desc->params[i].type = JackDriverParamInt;
-    desc->params[i].value.ui = 2;
-    strcpy(desc->params[i].short_desc, "Maximum number of output channels");
-    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-	strcpy(desc->params[i].name, "capture");
-	desc->params[i].character = 'C';
-	desc->params[i].type = JackDriverParamString;
-	strcpy(desc->params[i].value.str, "will take default CoreAudio input device");
-	strcpy(desc->params[i].short_desc, "Provide capture ports. Optionally set CoreAudio device name");
-	strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy(desc->params[i].name, "playback");
-	desc->params[i].character = 'P';
-	desc->params[i].type = JackDriverParamString;
-	strcpy(desc->params[i].value.str, "will take default CoreAudio output device");
-	strcpy(desc->params[i].short_desc, "Provide playback ports. Optionally set CoreAudio device name");
-	strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-    strcpy(desc->params[i].name, "duplex");
-    desc->params[i].character = 'D';
-    desc->params[i].type = JackDriverParamBool;
-    desc->params[i].value.i = TRUE;
-    strcpy(desc->params[i].short_desc, "Capture and playback");
-    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-    strcpy(desc->params[i].name, "rate");
-    desc->params[i].character = 'r';
-    desc->params[i].type = JackDriverParamUInt;
-    desc->params[i].value.ui = 44100U;
-    strcpy(desc->params[i].short_desc, "Sample rate");
-    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-    strcpy(desc->params[i].name, "period");
-    desc->params[i].character = 'p';
-    desc->params[i].type = JackDriverParamUInt;
-    desc->params[i].value.ui = 128U;
-    strcpy(desc->params[i].short_desc, "Frames per period");
-    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-    i++;
-	strcpy(desc->params[i].name, "device");
-	desc->params[i].character = 'd';
-	desc->params[i].type = JackDriverParamString;
-	desc->params[i].value.ui = 128U;
-	strcpy(desc->params[i].value.str, "will take default CoreAudio device name");
-	strcpy(desc->params[i].short_desc, "CoreAudio device name");
-	strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
- 	i++;
-	strcpy(desc->params[i].name, "input-latency");
-	desc->params[i].character  = 'I';
-	desc->params[i].type = JackDriverParamUInt;
-	desc->params[i].value.i = 0;
-	strcpy(desc->params[i].short_desc, "Extra input latency");
-	strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy(desc->params[i].name, "output-latency");
-	desc->params[i].character  = 'O';
-	desc->params[i].type = JackDriverParamUInt;
-	desc->params[i].value.i  = 0;
-	strcpy(desc->params[i].short_desc, "Extra output latency");
-	strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-	
-	i++;
-	strcpy(desc->params[i].name, "list-devices");
-	desc->params[i].character  = 'l';
-	desc->params[i].type = JackDriverParamBool;
-	desc->params[i].value.i  = FALSE;
-	strcpy(desc->params[i].short_desc, "Display available CoreAudio devices");
-	strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
-	
-    return desc;
-}
-
-jack_driver_t *driver_initialize(jack_client_t * client,
-				 const JSList * params)
-{
-    jack_nframes_t srate = 44100; /* Some older Mac models only support this value */
-    jack_nframes_t frames_per_interrupt = 128;
-    int capture = FALSE;
-    int playback = FALSE;
-    int chan_in = 0;
-    int chan_out = 0;
-    char* capture_pcm_name = "";
-	char* playback_pcm_name = "";
-    const JSList *node;
-    const jack_driver_param_t *param;
-	jack_nframes_t systemic_input_latency = 0;
-	jack_nframes_t systemic_output_latency = 0;
-
-    for (node = params; node; node = jack_slist_next(node)) {
-	param = (const jack_driver_param_t *) node->data;
-
-	switch (param->character) {
-
-		case 'd':
-			capture_pcm_name = strdup(param->value.str);
-			playback_pcm_name = strdup(param->value.str);
-			break;
-
-		case 'D':
-			capture = TRUE;
-			playback = TRUE;
-			break;
-
-		case 'c':
-			chan_in = chan_out = (int) param->value.ui;
-			break;
-
-		case 'i':
-			chan_in = (int) param->value.ui;
-			break;
-
-		case 'o':
-			chan_out = (int) param->value.ui;
-			break;
-
-		case 'C':
-			capture = TRUE;
-			if (strcmp(param->value.str, "none") != 0) {
-				capture_pcm_name = strdup(param->value.str);
-			}
-			break;
-
-		case 'P':
-			playback = TRUE;
-			if (strcmp(param->value.str, "none") != 0) {
-				playback_pcm_name = strdup(param->value.str);
-			}
-			break;
-
-		case 'r':
-			srate = param->value.ui;
-			break;
-
-		case 'p':
-			frames_per_interrupt = (unsigned int) param->value.ui;
-			break;
-
-		case 'I':
-			systemic_input_latency = param->value.ui;
-			break;
-
-		case 'O':
-			systemic_output_latency = param->value.ui;
-			break;
-			
-		case 'l':
-			display_device_names();
-			break;
-		}
-    }
-
-    /* duplex is the default */
-    if (!capture && !playback) {
-		capture = TRUE;
-		playback = TRUE;
-    }
-	
-	return coreaudio_driver_new("coreaudio", client, frames_per_interrupt,
-								srate, capture, playback, chan_in,
-								chan_out, capture_pcm_name, playback_pcm_name, systemic_input_latency, systemic_output_latency);
-}
-
-void driver_finish(jack_driver_t * driver)
-{
-    coreaudio_driver_delete((coreaudio_driver_t *) driver);
-}
diff --git a/drivers/coreaudio/coreaudio_driver.h b/drivers/coreaudio/coreaudio_driver.h
deleted file mode 100755
index 7d53de0..0000000
--- a/drivers/coreaudio/coreaudio_driver.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-    Copyright � Grame, 2003.
-    Copyright � Johnny Petrantoni, 2003.
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
-    grame at rd.grame.fr
-	
-	Johnny Petrantoni, johnny at lato-b.com - Italy, Rome.
-    
-	30-01-04, Johnny Petrantoni: first code of the coreaudio driver.
-   
-*/
-
-#ifndef __jack_coreaudio_driver_h__
-#define __jack_coreaudio_driver_h__
-
-#include <CoreAudio/CoreAudio.h>
-#include <AudioToolbox/AudioConverter.h>
-#include <AudioUnit/AudioUnit.h>
-
-#include <jack/types.h>
-#include <jack/hardware.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-#include <jack/internal.h>
-
-typedef struct {
-
-    JACK_DRIVER_DECL struct _jack_engine *engine;
-
-    jack_nframes_t frame_rate;
-    jack_nframes_t frames_per_cycle;
-    unsigned long user_nperiods;
-    int capturing;
-    int playing;
-
-    channel_t playback_nchannels;
-    channel_t capture_nchannels;
-
-    jack_client_t *client;
-    JSList *capture_ports;
-    JSList *playback_ports;
-
-	char capture_driver_name[256];
-	char playback_driver_name[256];
- 	
-	AudioUnit au_hal;
-	AudioBufferList* input_list;
-	AudioDeviceID device_id;
-	int state;
-	
-	jack_nframes_t capture_frame_latency;
-	jack_nframes_t playback_frame_latency;
-	
-	int xrun_detected;
-	int null_cycle_occured;
-
-} coreaudio_driver_t;
-
-#define kVersion 01
-
-typedef	UInt8	CAAudioHardwareDeviceSectionID;
-#define	kAudioDeviceSectionInput	((CAAudioHardwareDeviceSectionID)0x01)
-#define	kAudioDeviceSectionOutput	((CAAudioHardwareDeviceSectionID)0x00)
-#define	kAudioDeviceSectionGlobal	((CAAudioHardwareDeviceSectionID)0x00)
-#define	kAudioDeviceSectionWildcard	((CAAudioHardwareDeviceSectionID)0xFF)
-
-#endif /* __jack_coreaudio_driver_h__ */
diff --git a/drivers/dummy/.cvsignore b/drivers/dummy/.cvsignore
deleted file mode 100644
index 6e5ca7e..0000000
--- a/drivers/dummy/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-*.lo
-*.la
diff --git a/drivers/dummy/Makefile.am b/drivers/dummy/Makefile.am
deleted file mode 100644
index 015da92..0000000
--- a/drivers/dummy/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-MAINTAINERCLEANFILES=Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS)
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_dummy.la
-
-jack_dummy_la_LDFLAGS = -module -avoid-version
-jack_dummy_la_SOURCES = dummy_driver.c dummy_driver.h
-
-noinst_HEADERS = dummy_driver.h
-
-# jack_alsa_la_LIBADD = 
diff --git a/drivers/dummy/dummy_driver.c b/drivers/dummy/dummy_driver.c
deleted file mode 100644
index ea840ae..0000000
--- a/drivers/dummy/dummy_driver.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* -*- mode: c; c-file-style: "linux"; -*- */
-/*
-    Copyright (C) 2003 Robert Ham <rah at bash.sh>
-    Copyright (C) 2001 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <sysdeps/time.h>
-
-#include "dummy_driver.h"
-
-#undef DEBUG_WAKEUP
-
-/* this is used for calculate what counts as an xrun */
-#define PRETEND_BUFFER_SIZE 4096
-
-void
-FakeVideoSync( dummy_driver_t *driver )
-{
-        #define VIDEO_SYNC_PERIOD (48000 / 30)
-        static int vidCounter = VIDEO_SYNC_PERIOD;
-        
-        int period = driver->period_size;
-        jack_position_t *position = &driver->engine->control->current_time;
-
-        if ( period >= VIDEO_SYNC_PERIOD ) {
-                jack_error("JACK driver period size too large for simple video sync emulation. Halting.");
-                exit(0);
-        }
-
-        //enable video sync, whether it occurs in this period or not
-        position->audio_frames_per_video_frame = VIDEO_SYNC_PERIOD;
-        position->valid = (jack_position_bits_t) (position->valid | JackAudioVideoRatio);
-
-        //no video pulse found in this period, just decrement the counter
-        if ( vidCounter > period ) {
-                vidCounter -= period;
-        }
-
-        //video pulse occurs in this period
-        if ( vidCounter <= period ) {
-                int remainder = period - vidCounter;
-                vidCounter = VIDEO_SYNC_PERIOD - remainder;
-
-                position->video_offset = vidCounter;
-                position->valid = (jack_position_bits_t) (position->valid | JackVideoFrameOffset);
-        }
-}
-
-#ifdef HAVE_CLOCK_GETTIME
-static inline unsigned long long ts_to_nsec(struct timespec ts)
-{
-    return ts.tv_sec * 1000000000LL + ts.tv_nsec;
-}
-
-static inline struct timespec nsec_to_ts(unsigned long long nsecs)
-{
-    struct timespec ts;
-    ts.tv_sec = nsecs / (1000000000LL);
-    ts.tv_nsec = nsecs % (1000000000LL);
-    return ts;
-}
-
-static inline struct timespec add_ts(struct timespec ts, unsigned int usecs)
-{
-    unsigned long long nsecs = ts_to_nsec(ts);
-    nsecs += usecs * 1000LL;
-    return nsec_to_ts(nsecs);
-}
-
-static inline int cmp_lt_ts(struct timespec ts1, struct timespec ts2)
-{
-    if(ts1.tv_sec < ts2.tv_sec) {
-        return 1;
-    } else if (ts1.tv_sec == ts2.tv_sec && ts1.tv_nsec < ts2.tv_nsec) {
-        return 1;
-    } else return 0;
-}
-
-static jack_nframes_t 
-dummy_driver_wait (dummy_driver_t *driver, int extra_fd, int *status,
-		   float *delayed_usecs)
-{
-	jack_nframes_t nframes = driver->period_size;
-	struct timespec now;
-
-	*status = 0;
-	/* this driver doesn't work so well if we report a delay */
-	*delayed_usecs = 0;		/* lie about it */
-
-	clock_gettime(CLOCK_REALTIME, &now);
-	
-	if (cmp_lt_ts(driver->next_wakeup, now)) {
-		if (driver->next_wakeup.tv_sec == 0) {
-			/* first time through */
-			clock_gettime(CLOCK_REALTIME, &driver->next_wakeup);
-		}  else if ((ts_to_nsec(now) - ts_to_nsec(driver->next_wakeup))/1000LL
-			    > (PRETEND_BUFFER_SIZE * 1000000LL
-			       / driver->sample_rate)) {
-			/* xrun */
-			jack_error("**** dummy: xrun of %ju usec",
-				(uintmax_t)(ts_to_nsec(now) - ts_to_nsec(driver->next_wakeup))/1000LL);
-			nframes = 0;
-		} else {
-			/* late, but handled by our "buffer"; try to
-			 * get back on track */
-		}
-		driver->next_wakeup = add_ts(driver->next_wakeup, driver->wait_time);
-	} else {
-		if(clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &driver->next_wakeup, NULL)) {
-			jack_error("error while sleeping");
-			*status = -1;
-		} else {
-			clock_gettime(CLOCK_REALTIME, &now);
-			// guaranteed to sleep long enough for this to be correct
-			*delayed_usecs = (ts_to_nsec(now) - ts_to_nsec(driver->next_wakeup));
-			*delayed_usecs /= 1000.0;
-		}
-		driver->next_wakeup = add_ts(driver->next_wakeup, driver->wait_time);
-	}
-
-	driver->last_wait_ust = jack_get_microseconds ();
-	driver->engine->transport_cycle_start (driver->engine,
-					       driver->last_wait_ust);
-
-	return nframes;
-}
-
-#else
-
-static jack_nframes_t 
-dummy_driver_wait (dummy_driver_t *driver, int extra_fd, int *status,
-		   float *delayed_usecs)
-{
-	jack_time_t now = jack_get_microseconds();
-
-	if (driver->next_time < now) {
-		if (driver->next_time == 0) {
-			/* first time through */
-			driver->next_time = now + driver->wait_time;
-		}  else if (now - driver->next_time
-			    > (PRETEND_BUFFER_SIZE * 1000000LL
-			       / driver->sample_rate)) {
-			/* xrun */
-			jack_error("**** dummy: xrun of %ju usec",
-				(uintmax_t)now - driver->next_time);
-			driver->next_time = now + driver->wait_time;
-		} else {
-			/* late, but handled by our "buffer"; try to
-			 * get back on track */
-			driver->next_time += driver->wait_time;
-		}
-	} else {
-		jack_time_t wait = driver->next_time - now;
-		struct timespec ts = { .tv_sec = wait / 1000000,
-				       .tv_nsec = (wait % 1000000) * 1000 };
-		nanosleep(&ts,NULL);
-		driver->next_time += driver->wait_time;
-	}
-
-	driver->last_wait_ust = jack_get_microseconds ();
-	driver->engine->transport_cycle_start (driver->engine,
-					       driver->last_wait_ust);
-
-	/* this driver doesn't work so well if we report a delay */
-	*delayed_usecs = 0;		/* lie about it */
-	*status = 0;
-	return driver->period_size;
-}
-#endif
-
-static inline int
-dummy_driver_run_cycle (dummy_driver_t *driver)
-{
-	jack_engine_t *engine = driver->engine;
-	int wait_status;
-	float delayed_usecs;
-
-	jack_nframes_t nframes = dummy_driver_wait (driver, -1, &wait_status,
-						   &delayed_usecs);
-	if (nframes == 0) {
-		/* we detected an xrun and restarted: notify
-		 * clients about the delay. */
-		engine->delay (engine, delayed_usecs);
-		return 0;
-	} 
-
-	// FakeVideoSync (driver);
-
-	if (wait_status == 0)
-		return engine->run_cycle (engine, nframes, delayed_usecs);
-
-	if (wait_status < 0)
-		return -1;
-	else
-		return 0;
-}
-
-static int
-dummy_driver_null_cycle (dummy_driver_t* driver, jack_nframes_t nframes)
-{
-	return 0;
-}
-
-static int
-dummy_driver_bufsize (dummy_driver_t* driver, jack_nframes_t nframes)
-{
-	driver->period_size = nframes;  
-	driver->period_usecs = driver->wait_time =
-		(jack_time_t) floor ((((float) nframes) / driver->sample_rate)
-				     * 1000000.0f);
-
-	/* tell the engine to change its buffer size */
-	driver->engine->set_buffer_size (driver->engine, nframes);
-
-	return 0;
-}
-
-static int
-dummy_driver_write (dummy_driver_t* driver, jack_nframes_t nframes)
-{
-	return 0;
-}
-
-
-static int
-dummy_driver_attach (dummy_driver_t *driver)
-{
-	jack_port_t * port;
-	char buf[32];
-	unsigned int chn;
-	int port_flags;
-
-	driver->engine->set_buffer_size (driver->engine, driver->period_size);
-	driver->engine->set_sample_rate (driver->engine, driver->sample_rate);
-
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-
-	for (chn = 0; chn < driver->capture_channels; chn++)
-	{
-		snprintf (buf, sizeof(buf) - 1, "capture_%u", chn+1);
-
-		port = jack_port_register (driver->client, buf,
-					   JACK_DEFAULT_AUDIO_TYPE,
-					   port_flags, 0);
-		if (!port)
-		{
-			jack_error ("DUMMY: cannot register port for %s", buf);
-			break;
-		}
-
-		driver->capture_ports =
-			jack_slist_append (driver->capture_ports, port);
-	}
-	
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-
-	for (chn = 0; chn < driver->playback_channels; chn++)
-	{
-		snprintf (buf, sizeof(buf) - 1, "playback_%u", chn+1);
-
-		port = jack_port_register (driver->client, buf,
-					   JACK_DEFAULT_AUDIO_TYPE,
-					   port_flags, 0);
-
-		if (!port)
-		{
-			jack_error ("DUMMY: cannot register port for %s", buf);
-			break;
-		}
-
-		driver->playback_ports =
-			jack_slist_append (driver->playback_ports, port);
-	}
-
-	jack_activate (driver->client);
-
-	return 0;
-}
-
-static int
-dummy_driver_detach (dummy_driver_t *driver)
-{
-	JSList * node;
-
-	if (driver->engine == 0)
-		return 0;
-
-	for (node = driver->capture_ports; node; node = jack_slist_next (node))
-		jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-
-	jack_slist_free (driver->capture_ports);
-	driver->capture_ports = NULL;
-
-		
-	for (node = driver->playback_ports; node; node = jack_slist_next (node))
-		jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-
-	jack_slist_free (driver->playback_ports);
-	driver->playback_ports = NULL;
-
-	return 0;
-}
-
-
-static void
-dummy_driver_delete (dummy_driver_t *driver)
-{
-	jack_driver_nt_finish ((jack_driver_nt_t *) driver);
-	free (driver);
-}
-
-static jack_driver_t *
-dummy_driver_new (jack_client_t * client,
-		  char *name,
-		  unsigned int capture_ports,
-		  unsigned int playback_ports,
-		  jack_nframes_t sample_rate,
-		  jack_nframes_t period_size,
-		  unsigned long wait_time)
-{
-	dummy_driver_t * driver;
-
-	jack_info ("creating dummy driver ... %s|%" PRIu32 "|%" PRIu32
-		"|%lu|%u|%u", name, sample_rate, period_size, wait_time,
-		capture_ports, playback_ports);
-
-	driver = (dummy_driver_t *) calloc (1, sizeof (dummy_driver_t));
-
-	jack_driver_nt_init ((jack_driver_nt_t *) driver);
-
-	driver->write         = (JackDriverReadFunction)       dummy_driver_write;
-	driver->null_cycle    = (JackDriverNullCycleFunction)  dummy_driver_null_cycle;
-	driver->nt_attach     = (JackDriverNTAttachFunction)   dummy_driver_attach;
-	driver->nt_detach     = (JackDriverNTDetachFunction)   dummy_driver_detach;
-	driver->nt_bufsize    = (JackDriverNTBufSizeFunction)  dummy_driver_bufsize;
-	driver->nt_run_cycle  = (JackDriverNTRunCycleFunction) dummy_driver_run_cycle;
-
-	driver->period_usecs =
-		(jack_time_t) floor ((((float) period_size) / sample_rate)
-				     * 1000000.0f);
-	driver->sample_rate = sample_rate;
-	driver->period_size = period_size;
-	driver->wait_time   = wait_time;
-	//driver->next_time   = 0; // not needed since calloc clears the memory
-	driver->last_wait_ust = 0;
-
-	driver->capture_channels  = capture_ports;
-	driver->capture_ports     = NULL;
-	driver->playback_channels = playback_ports;
-	driver->playback_ports    = NULL;
-
-	driver->client = client;
-	driver->engine = NULL;
-
-	return (jack_driver_t *) driver;
-}
-
-
-/* DRIVER "PLUGIN" INTERFACE */
-
-jack_driver_desc_t *
-driver_get_descriptor ()
-{
-	jack_driver_desc_t * desc;
-	jack_driver_param_desc_t * params;
-	unsigned int i;
-
-	desc = calloc (1, sizeof (jack_driver_desc_t));
-	strcpy (desc->name, "dummy");
-	desc->nparams = 5;
-
-	params = calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
-
-	i = 0;
-	strcpy (params[i].name, "capture");
-	params[i].character  = 'C';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 2U;
-	strcpy (params[i].short_desc, "Number of capture ports");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "playback");
-	params[i].character  = 'P';
-	params[i].type       = JackDriverParamUInt;
-	params[1].value.ui   = 2U;
-	strcpy (params[i].short_desc, "Number of playback ports");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "rate");
-	params[i].character  = 'r';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 48000U;
-	strcpy (params[i].short_desc, "Sample rate");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "period");
-	params[i].character  = 'p';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 1024U;
-	strcpy (params[i].short_desc, "Frames per period");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "wait");
-	params[i].character  = 'w';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 21333U;
-	strcpy (params[i].short_desc,
-		"Number of usecs to wait between engine processes");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	desc->params = params;
-
-	return desc;
-}
-
-const char driver_client_name[] = "dummy_pcm";
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, const JSList * params)
-{
-	jack_nframes_t sample_rate = 48000;
-	jack_nframes_t period_size = 1024;
-	unsigned int capture_ports = 2;
-	unsigned int playback_ports = 2;
-	int wait_time_set = 0;
-	unsigned long wait_time = 0;
-	const JSList * node;
-	const jack_driver_param_t * param;
-
-	for (node = params; node; node = jack_slist_next (node)) {
-  	        param = (const jack_driver_param_t *) node->data;
-
-		switch (param->character) {
-
-		case 'C':
-		  capture_ports = param->value.ui;
-		  break;
-
-		case 'P':
-		  playback_ports = param->value.ui;
-		  break;
-
-		case 'r':
-		  sample_rate = param->value.ui;
-		  break;
-
-		case 'p':
-		  period_size = param->value.ui;
-		  break;
-
-		case 'w':
-		  wait_time = param->value.ui;
-		  wait_time_set = 1;
-		  break;
-				
-		}
-	}
-
-        if (!wait_time_set)
-	  wait_time = (((float)period_size) / ((float)sample_rate)) * 1000000.0;
-
-	return dummy_driver_new (client, "dummy_pcm", capture_ports,
-				 playback_ports, sample_rate, period_size,
-				 wait_time);
-}
-
-void
-driver_finish (jack_driver_t *driver)
-{
-	dummy_driver_delete ((dummy_driver_t *) driver);
-}
-
diff --git a/drivers/dummy/dummy_driver.h b/drivers/dummy/dummy_driver.h
deleted file mode 100644
index 2c376f8..0000000
--- a/drivers/dummy/dummy_driver.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-    Copyright (C) 2003 Robert Ham <rah at bash.sh>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-
-#ifndef __JACK_DUMMY_DRIVER_H__
-#define __JACK_DUMMY_DRIVER_H__
-
-#include <unistd.h>
-
-#include <jack/types.h>
-#include <jack/jslist.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-#include <config.h>
-
-// needed for clock_nanosleep
-#ifndef _GNU_SOURCE
-    #define _GNU_SOURCE
-#endif
-#include <time.h>
-
-typedef struct _dummy_driver dummy_driver_t;
-
-struct _dummy_driver
-{
-    JACK_DRIVER_NT_DECL;
-
-    jack_nframes_t  sample_rate;
-    jack_nframes_t  period_size;
-    unsigned long   wait_time;
-
-#ifdef HAVE_CLOCK_GETTIME
-    struct timespec next_wakeup;
-#else
-    jack_time_t     next_time;
-#endif
-
-    unsigned int    capture_channels;
-    unsigned int    playback_channels;
-
-    JSList	   *capture_ports;
-    JSList	   *playback_ports;
-
-    jack_client_t  *client;
-};
-
-#endif /* __JACK_DUMMY_DRIVER_H__ */
diff --git a/drivers/firewire/Makefile.am b/drivers/firewire/Makefile.am
deleted file mode 100644
index ec505e2..0000000
--- a/drivers/firewire/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# plugin is called 'firewire',
-# driver code is called 'ffado*' because it is an implementation
-# of a firewire backend
-
-MAINTAINERCLEANFILES=Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS) $(LIBFFADO_CFLAGS) $(ALSA_CFLAGS)
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_firewire.la
-
-jack_firewire_la_SOURCES = ffado_driver.c
-
-jack_firewire_la_LIBADD = $(LIBFFADO_LIBS) $(ALSA_LIBS)
-
-jack_firewire_la_LDFLAGS = -module -avoid-version
-
-noinst_HEADERS = ffado_driver.h
-
diff --git a/drivers/firewire/ffado_driver.c b/drivers/firewire/ffado_driver.c
deleted file mode 100644
index bafe6c0..0000000
--- a/drivers/firewire/ffado_driver.c
+++ /dev/null
@@ -1,973 +0,0 @@
-/*
- *   FireWire Backend for Jack
- *   using FFADO
- *   FFADO = Firewire (pro-)audio for linux
- *
- *   http://www.ffado.org
- *   http://www.jackaudio.org
- *
- *   Copyright (C) 2005-2007 Pieter Palmers
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* 
- * Main Jack driver entry routines
- *
- */ 
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <sysdeps/time.h>
-#include <assert.h>
-
-#include "ffado_driver.h"
-
-#define SAMPLE_MAX_24BIT  8388608.0f
-#define SAMPLE_MAX_16BIT  32768.0f
-
-static int ffado_driver_stop (ffado_driver_t *driver);
-
-#define FIREWIRE_REQUIRED_FFADO_API_VERSION 8
-
-// enable verbose messages
-static int g_verbose=0;
-
-static int
-ffado_driver_attach (ffado_driver_t *driver)
-{
-	char buf[64];
-	char buf2[64];
-	channel_t chn;
-	jack_port_t *port=NULL;
-	int port_flags;
-
-	g_verbose=driver->engine->verbose;
-
-	driver->engine->set_buffer_size (driver->engine, driver->period_size);
-	driver->engine->set_sample_rate (driver->engine, driver->sample_rate);
-
-	/* preallocate some buffers such that they don't have to be allocated
-	   in RT context (or from the stack)
-	 */
-	/* the null buffer is a buffer that contains one period of silence */
-	driver->nullbuffer = calloc(driver->period_size, sizeof(ffado_sample_t));
-	if(driver->nullbuffer == NULL) {
-		printError("could not allocate memory for null buffer");
-		return -1;
-	}
-	/* calloc should do this, but it can't hurt to be sure */
-	memset(driver->nullbuffer, 0, driver->period_size*sizeof(ffado_sample_t));
-	
-	/* the scratch buffer is a buffer of one period that can be used as dummy memory */
-	driver->scratchbuffer = calloc(driver->period_size, sizeof(ffado_sample_t));
-	if(driver->scratchbuffer == NULL) {
-		printError("could not allocate memory for scratch buffer");
-		return -1;
-	}
-	
-	/* packetizer thread options */
-	driver->device_options.realtime=(driver->engine->control->real_time? 1 : 0);
-	
-	driver->device_options.packetizer_priority = driver->engine->rtpriority;
-	if (driver->device_options.packetizer_priority > 98) {
-		driver->device_options.packetizer_priority = 98;
-	}
-	if (driver->device_options.packetizer_priority < 1) {
-		driver->device_options.packetizer_priority = 1;
-	}
-
-	driver->dev = ffado_streaming_init(driver->device_info, driver->device_options);
-
-	if(!driver->dev) {
-		printError("Error creating FFADO streaming device");
-		return -1;
-	}
-
-	if (driver->device_options.realtime) {
-		printMessage("Streaming thread running with Realtime scheduling, priority %d",
-		           driver->device_options.packetizer_priority);
-	} else {
-		printMessage("Streaming thread running without Realtime scheduling");
-	}
-
-	ffado_streaming_set_audio_datatype(driver->dev, ffado_audio_datatype_float);
-	
-	/* ports */
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-
-	driver->capture_nchannels=ffado_streaming_get_nb_capture_streams(driver->dev);
-	driver->capture_channels=calloc(driver->capture_nchannels, sizeof(ffado_capture_channel_t));
-	if(driver->capture_channels==NULL) {
-		printError("could not allocate memory for capture channel list");
-		return -1;
-	}
-	
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-		ffado_streaming_get_capture_stream_name(driver->dev, chn, buf, sizeof(buf) - 1);
-		driver->capture_channels[chn].stream_type=ffado_streaming_get_capture_stream_type(driver->dev, chn);
-
-		if(driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
-			snprintf(buf2, 64, "C%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering audio capture port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_AUDIO_TYPE,
-							port_flags, 0)) == NULL) {
-				printError (" cannot register port for %s", buf2);
-				break;
-			}
-			driver->capture_ports =
-				jack_slist_append (driver->capture_ports, port);
-			// setup port parameters
-			if (ffado_streaming_set_capture_stream_buffer(driver->dev, chn, NULL)) {
-				printError(" cannot configure initial port buffer for %s", buf2);
-			}
-			if(ffado_streaming_capture_stream_onoff(driver->dev, chn, 1)) {
-				printError(" cannot enable port %s", buf2);
-			}
-		} else if(driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
-			snprintf(buf2, 64, "C%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering midi capture port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_MIDI_TYPE,
-							port_flags, 0)) == NULL) {
-				printError (" cannot register port for %s", buf2);
-				break;
-			}
-			driver->capture_ports =
-				jack_slist_append (driver->capture_ports, port);
-			// setup port parameters
-			if (ffado_streaming_set_capture_stream_buffer(driver->dev, chn, NULL)) {
-				printError(" cannot configure initial port buffer for %s", buf2);
-			}
-			if(ffado_streaming_capture_stream_onoff(driver->dev, chn, 1)) {
-				printError(" cannot enable port %s", buf2);
-			}
-			// setup midi unpacker
-			midi_unpack_init(&driver->capture_channels[chn].midi_unpack);
-			midi_unpack_reset(&driver->capture_channels[chn].midi_unpack);
-			// setup the midi buffer
-			driver->capture_channels[chn].midi_buffer = calloc(driver->period_size, sizeof(uint32_t));
-		} else {
-			printMessage ("Don't register capture port %s", buf);
-
-			// we have to add a NULL entry in the list to be able to loop over the channels in the read/write routines
-			driver->capture_ports =
-				jack_slist_append (driver->capture_ports, NULL);
-		}
-		jack_port_set_latency (port, driver->period_size + driver->capture_frame_latency);
-	}
-	
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-
-	driver->playback_nchannels=ffado_streaming_get_nb_playback_streams(driver->dev);
-	driver->playback_channels=calloc(driver->playback_nchannels, sizeof(ffado_playback_channel_t));
-	if(driver->playback_channels==NULL) {
-		printError("could not allocate memory for playback channel list");
-		return -1;
-	}
-
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		ffado_streaming_get_playback_stream_name(driver->dev, chn, buf, sizeof(buf) - 1);
-		driver->playback_channels[chn].stream_type=ffado_streaming_get_playback_stream_type(driver->dev, chn);
-		
-		if(driver->playback_channels[chn].stream_type == ffado_stream_type_audio) {
-			snprintf(buf2, 64, "P%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering audio playback port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_AUDIO_TYPE,
-							port_flags, 0)) == NULL) {
-				printError(" cannot register port for %s", buf2);
-				break;
-			}
-			driver->playback_ports =
-				jack_slist_append (driver->playback_ports, port);
-
-			// setup port parameters
-			if (ffado_streaming_set_playback_stream_buffer(driver->dev, chn, NULL)) {
-				printError(" cannot configure initial port buffer for %s", buf2);
-			}
-			if(ffado_streaming_playback_stream_onoff(driver->dev, chn, 1)) {
-				printError(" cannot enable port %s", buf2);
-			}
-		} else if(driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
-			snprintf(buf2, 64, "P%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering midi playback port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_MIDI_TYPE,
-							port_flags, 0)) == NULL) {
-				printError(" cannot register port for %s", buf2);
-				break;
-			}
-			driver->playback_ports =
-				jack_slist_append (driver->playback_ports, port);
-
-			// setup port parameters
-			if (ffado_streaming_set_playback_stream_buffer(driver->dev, chn, NULL)) {
-				printError(" cannot configure initial port buffer for %s", buf2);
-			}
-			if(ffado_streaming_playback_stream_onoff(driver->dev, chn, 1)) {
-				printError(" cannot enable port %s", buf2);
-			}
-			// setup midi packer
-			midi_pack_reset(&driver->playback_channels[chn].midi_pack);
-			// setup the midi buffer
-			driver->playback_channels[chn].midi_buffer = calloc(driver->period_size, sizeof(uint32_t));
-		} else {
-			printMessage ("Don't register playback port %s", buf);
-
-			// we have to add a NULL entry in the list to be able to loop over the channels in the read/write routines
-			driver->playback_ports =
-				jack_slist_append (driver->playback_ports, NULL);
-		}
-		jack_port_set_latency (port, (driver->period_size * (driver->device_options.nb_buffers - 1)) + driver->playback_frame_latency);
-	}
-
-	if(ffado_streaming_prepare(driver->dev)) {
-		printError("Could not prepare streaming device!");
-		return -1;
-	}
-
-	return jack_activate (driver->client);
-}
-
-static int 
-ffado_driver_detach (ffado_driver_t *driver)
-{
-	JSList *node;
-	unsigned int chn;
-
-	if (driver->engine == NULL) {
-		return 0;
-	}
-
-	for (node = driver->capture_ports; node;
-	     node = jack_slist_next (node)) {
-		// Don't try to unregister NULL entries added for non-audio
-		// ffado ports by ffado_driver_attach().
-		if (node->data != NULL) {
-			jack_port_unregister (driver->client,
-					      ((jack_port_t *) node->data));
-		}
-	}
-
-	jack_slist_free (driver->capture_ports);
-	driver->capture_ports = 0;
-		
-	for (node = driver->playback_ports; node;
-	     node = jack_slist_next (node)) {
-        if (node->data != NULL) {
-    		jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-        }
-	}
-
-	jack_slist_free (driver->playback_ports);
-	driver->playback_ports = 0;
-
-	ffado_streaming_finish(driver->dev);
-	driver->dev=NULL;
-
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-		if(driver->capture_channels[chn].midi_buffer)
-			free(driver->capture_channels[chn].midi_buffer);
-	}
-	free(driver->capture_channels);
-	
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		if(driver->playback_channels[chn].midi_buffer)
-			free(driver->playback_channels[chn].midi_buffer);
-	}
-	free(driver->playback_channels);
-	
-	free(driver->nullbuffer);
-	free(driver->scratchbuffer);
-	return 0;
-}
-
-static int
-ffado_driver_read (ffado_driver_t * driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	int nb_connections;
-	JSList *node;
-	jack_port_t* port;
-	
-	printEnter();
-	for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) {
-		if(driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
-			port = (jack_port_t *) node->data;
-			nb_connections = jack_port_connected (port);
-
-			/* if there are no connections, use the dummy buffer and disable the stream */
-			if(nb_connections) {
-				ffado_streaming_capture_stream_onoff(driver->dev, chn, 1);
-				ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(jack_port_get_buffer (port, nframes)));
-			} else {
-				ffado_streaming_capture_stream_onoff(driver->dev, chn, 0);
-				ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(driver->scratchbuffer));
-			}
-		} else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
-			port = (jack_port_t *) node->data;
-			nb_connections = jack_port_connected (port);
-			if(nb_connections) {
-				ffado_streaming_capture_stream_onoff(driver->dev, chn, 1);
-			} else {
-				ffado_streaming_capture_stream_onoff(driver->dev, chn, 0);
-			}
-			/* always set a buffer */
-			ffado_streaming_set_capture_stream_buffer(driver->dev, chn, 
-			                                          (char *)(driver->capture_channels[chn].midi_buffer));
-		} else { /* ensure a valid buffer */
-			ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(driver->scratchbuffer));
-			ffado_streaming_capture_stream_onoff(driver->dev, chn, 0);
-		}
-	}
-
-	/* now transfer the buffers */
-	ffado_streaming_transfer_capture_buffers(driver->dev);
-
-	/* process the midi data */
-	for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) {
-		if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
-			jack_default_audio_sample_t* buf;
-			int i;
-			int done;
-			uint32_t *midi_buffer = driver->capture_channels[chn].midi_buffer;
-			midi_unpack_t *midi_unpack = &driver->capture_channels[chn].midi_unpack;
-			port = (jack_port_t *) node->data;
-			nb_connections = jack_port_connected (port);
-			buf = jack_port_get_buffer (port, nframes);
-
-			/* if the returned buffer is invalid, discard the midi data */
-			jack_midi_clear_buffer(buf);
-
-			/* no connections means no processing */
-			if(nb_connections == 0) continue;
-
-			/* else unpack
-			   note that libffado guarantees that midi bytes are on 8-byte aligned indexes */
-			for(i = 0; i < nframes; i += 8) {
-				if(midi_buffer[i] & 0xFF000000) {
-					done = midi_unpack_buf(midi_unpack, (unsigned char *)(midi_buffer+i), 1, buf, i);
-					if (done != 1) {
-						printError("MIDI buffer overflow in channel %d\n", chn);
-						break;
-					}
-				}
-			}
-		}
-	}
-
-	printExit();
-	return 0;
-}
-
-static int
-ffado_driver_write (ffado_driver_t * driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	int nb_connections;
-	JSList *node;
-	jack_port_t *port;
-	printEnter();
-	
-	driver->process_count++;
-	if (driver->engine->freewheeling) {
-		return 0;
-	}
-
-	for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) {
-		if(driver->playback_channels[chn].stream_type == ffado_stream_type_audio) {
-			port = (jack_port_t *) node->data;
-			nb_connections = jack_port_connected (port);
-
-			/* use the silent buffer + disable if there are no connections */
-			if(nb_connections) {
-				ffado_streaming_playback_stream_onoff(driver->dev, chn, 1);
-				ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(jack_port_get_buffer (port, nframes)));
-			} else {
-				ffado_streaming_playback_stream_onoff(driver->dev, chn, 0);
-				ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(driver->nullbuffer));
-			}
-		} else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
-			jack_default_audio_sample_t* buf;
-			int nevents;
-			int i;
-			midi_pack_t *midi_pack = &driver->playback_channels[chn].midi_pack;
-			uint32_t *midi_buffer = driver->playback_channels[chn].midi_buffer;
-			int min_next_pos = 0;
-
-			port = (jack_port_t *) node->data;
-			nb_connections = jack_port_connected (port);
-
-			/* skip if no connections */
-			if(nb_connections == 0) {
-				ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(driver->nullbuffer));
-				ffado_streaming_playback_stream_onoff(driver->dev, chn, 0);
-				continue;
-			}
-
-			memset(midi_buffer, 0, nframes * sizeof(uint32_t));
-			ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(midi_buffer));
-			ffado_streaming_playback_stream_onoff(driver->dev, chn, 1);
-
-			/* check if we still have to process bytes from the previous period */
-			/*
-			if(driver->playback_channels[chn].nb_overflow_bytes) {
-				printMessage("have to process %d bytes from previous period", driver->playback_channels[chn].nb_overflow_bytes);
-			}
-			*/
-			for (i=0; i<driver->playback_channels[chn].nb_overflow_bytes; ++i) {
-				midi_buffer[min_next_pos] = 0x01000000 | (driver->playback_channels[chn].overflow_buffer[i] & 0xFF);
-				min_next_pos += 8;
-			}
-			driver->playback_channels[chn].nb_overflow_bytes=0;
-			
-			/* process the events in this period */
-			buf = jack_port_get_buffer (port, nframes);
-			nevents = jack_midi_get_event_count(buf);
-
-			for (i=0; i<nevents; ++i) {
-				int j;
-				jack_midi_event_t event;
-				jack_midi_event_get(&event, buf, i);
-
-				midi_pack_event(midi_pack, &event);
-
-				/* floor the initial position to be a multiple of 8 */
-				int pos = event.time & 0xFFFFFFF8;
-				for(j = 0; j < event.size; j++) {
-					/* make sure we don't overwrite a previous byte */
-					while(pos < min_next_pos && pos < nframes) {
-						/* printMessage("have to correct pos to %d", pos); */
-						pos += 8;
-					}
-
-					if(pos >= nframes) {
-						int f;
-						/* printMessage("midi message crosses period boundary"); */
-						driver->playback_channels[chn].nb_overflow_bytes = event.size - j;
-						if(driver->playback_channels[chn].nb_overflow_bytes > MIDI_OVERFLOW_BUFFER_SIZE) {
-							printError("too much midi bytes cross period boundary");
-							driver->playback_channels[chn].nb_overflow_bytes = MIDI_OVERFLOW_BUFFER_SIZE;
-						}
-						/* save the bytes that still have to be transmitted in the next period */
-						for(f = 0; f < driver->playback_channels[chn].nb_overflow_bytes; f++) {
-							driver->playback_channels[chn].overflow_buffer[f] = event.buffer[j+f];
-						}
-						/* exit since we can't transmit anything anymore.
-						   the rate should be controlled */
-						if(i < nevents-1) {
-							printError("%d midi events lost due to period crossing", nevents-i-1);
-						}
-						break;
-					} else {
-						midi_buffer[pos] = 0x01000000 | (event.buffer[j] & 0xFF);
-						pos += 8;
-						min_next_pos = pos;
-					}
-				}
-			}
-		} else { /* ensure a valid buffer */
-			ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(driver->nullbuffer));
-			ffado_streaming_playback_stream_onoff(driver->dev, chn, 0);
-		}
-	}
-
-	ffado_streaming_transfer_playback_buffers(driver->dev);
-
-	printExit();
-	return 0;
-}
-
-//static inline jack_nframes_t 
-static jack_nframes_t 
-ffado_driver_wait (ffado_driver_t *driver, int extra_fd, int *status,
-		   float *delayed_usecs)
-{
-	jack_time_t                   wait_enter;
-	jack_time_t                   wait_ret;
-	ffado_wait_response           response;
-	
-	printEnter();
-
-	wait_enter = jack_get_microseconds ();
-	if (wait_enter > driver->wait_next) {
-		/*
-			* This processing cycle was delayed past the
-			* next due interrupt!  Do not account this as
-			* a wakeup delay:
-			*/
-		driver->wait_next = 0;
-		driver->wait_late++;
-	}
-// *status = -2; interrupt
-// *status = -3; timeout
-// *status = -4; extra FD
-
-	response = ffado_streaming_wait(driver->dev);
-	
-	wait_ret = jack_get_microseconds ();
-	
-	if (driver->wait_next && wait_ret > driver->wait_next) {
-		*delayed_usecs = wait_ret - driver->wait_next;
-	}
-	driver->wait_last = wait_ret;
-	driver->wait_next = wait_ret + driver->period_usecs;
-	driver->engine->transport_cycle_start (driver->engine, wait_ret);
-	if (response == ffado_wait_ok) {
-		// all good
-		*status=0;
-	} else if (response == ffado_wait_xrun) {
-		// xrun happened, but it's handled
-		*status=0;
-		return 0;
-	} else if (response == ffado_wait_error) {
-		// an error happened (unhandled xrun)
-		// this should be fatal
-		*status=-1;
-		return 0;
-	} else if (response == ffado_wait_shutdown) {
-		// we are to shutdown the ffado system
-		// this should be fatal
-		*status=-1;
-		return 0;
-	} else {
-		// we don't know about this response code
-		printError("unknown wait response (%d) from ffado", response);
-		// this should be fatal
-		*status=-1;
-		return 0;
-	}
-
-	driver->last_wait_ust = wait_ret;
-
-	// FIXME: this should do something more useful
-	*delayed_usecs = 0;
-	
-	printExit();
-
-	return driver->period_size;
-}
-
-static int
-ffado_driver_run_cycle (ffado_driver_t *driver)
-{
-	jack_engine_t *engine = driver->engine;
-	int wait_status=0;
-	float delayed_usecs=0.0;
-
-	jack_nframes_t nframes = ffado_driver_wait (driver, -1,
-	   &wait_status, &delayed_usecs);
-	
-	if ((wait_status < 0)) {
-		printError( "wait status < 0! (= %d)",wait_status);
-		return -1;
-	}
-		
-	if ((nframes == 0)) {
-		/* we detected an xrun and restarted: notify
-		 * clients about the delay. */
-		printMessage("xrun detected");
-		engine->delay (engine, delayed_usecs);
-		return 0;
-	} 
-	
-	return engine->run_cycle (engine, nframes, delayed_usecs);
-
-}
-/*
- * in a null cycle we should discard the input and write silence to the outputs
- */
-static int
-ffado_driver_null_cycle (ffado_driver_t* driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	JSList *node;
-	ffado_streaming_stream_type stream_type;
-
-	printEnter();
-	
-	if (driver->engine->freewheeling) {
-		return 0;
-	}
-
-	// write silence to buffer
-	for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) {
-		stream_type=ffado_streaming_get_playback_stream_type(driver->dev, chn);
-
-		if(stream_type == ffado_stream_type_audio) {
-			ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(driver->nullbuffer));
-		}
-	}
-	ffado_streaming_transfer_playback_buffers(driver->dev);
-	
-	// read & discard from input ports
-	for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) {
-		stream_type=ffado_streaming_get_capture_stream_type(driver->dev, chn);
-		if(stream_type == ffado_stream_type_audio) {
-			ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(driver->scratchbuffer));
-		}
-	}
-	ffado_streaming_transfer_capture_buffers(driver->dev);
-
-	printExit();
-	return 0;
-}
-
-static int
-ffado_driver_start (ffado_driver_t *driver)
-{
-	int retval=0;
-
-	if((retval=ffado_streaming_start(driver->dev))) {
-		printError("Could not start streaming threads: %d", retval);
-		return retval;
-	}
-
-	return 0;
-
-}
-
-static int
-ffado_driver_stop (ffado_driver_t *driver)
-{
-	int retval=0;
-	
-	if((retval=ffado_streaming_stop(driver->dev))) {
-		printError("Could not stop streaming threads");
-		return retval;
-	}
-
-	return 0;
-}
-
-
-static int
-ffado_driver_bufsize (ffado_driver_t* driver, jack_nframes_t nframes)
-{
-	printError("Buffer size change requested but not supported!!!");
-
-	/*
-	 driver->period_size = nframes;  
-	driver->period_usecs =
-		(jack_time_t) floor ((((float) nframes) / driver->sample_rate)
-				     * 1000000.0f);
-	*/
-	
-	/* tell the engine to change its buffer size */
-	//driver->engine->set_buffer_size (driver->engine, nframes);
-
-	return -1; // unsupported
-}
-
-typedef void (*JackDriverFinishFunction) (jack_driver_t *);
-
-ffado_driver_t *
-ffado_driver_new (jack_client_t * client,
-		  char *name,
-		  ffado_jack_settings_t *params)
-{
-	ffado_driver_t *driver;
-
-	if(ffado_get_api_version() != FIREWIRE_REQUIRED_FFADO_API_VERSION) {
-		printError("Incompatible libffado version! (%s)", ffado_get_version());
-		return NULL;
-	}
-
-	printMessage("Starting firewire backend (%s)", ffado_get_version());
-
-	driver = calloc (1, sizeof (ffado_driver_t));
-
-	/* Setup the jack interfaces */  
-	jack_driver_nt_init ((jack_driver_nt_t *) driver);
-
-	driver->nt_attach    = (JackDriverNTAttachFunction)   ffado_driver_attach;
-	driver->nt_detach    = (JackDriverNTDetachFunction)   ffado_driver_detach;
-	driver->nt_start     = (JackDriverNTStartFunction)    ffado_driver_start;
-	driver->nt_stop      = (JackDriverNTStopFunction)     ffado_driver_stop;
-	driver->nt_run_cycle = (JackDriverNTRunCycleFunction) ffado_driver_run_cycle;
-	driver->null_cycle   = (JackDriverNullCycleFunction)  ffado_driver_null_cycle;
-	driver->write        = (JackDriverReadFunction)       ffado_driver_write;
-	driver->read         = (JackDriverReadFunction)       ffado_driver_read;
-	driver->nt_bufsize   = (JackDriverNTBufSizeFunction)  ffado_driver_bufsize;
-	
-	/* copy command line parameter contents to the driver structure */
-	memcpy(&driver->settings,params,sizeof(ffado_jack_settings_t));
-	
-	/* prepare all parameters */
-	driver->sample_rate = params->sample_rate;
-	driver->period_size = params->period_size;
-	driver->last_wait_ust = 0;
-	
-	driver->period_usecs =
-		(jack_time_t) floor ((((float) driver->period_size) * 1000000.0f) / driver->sample_rate);
-
-	driver->client = client;
-	driver->engine = NULL;
-
-	memset(&driver->device_options,0,sizeof(driver->device_options));	
-	driver->device_options.sample_rate=params->sample_rate;
-	driver->device_options.period_size=params->period_size;
-	driver->device_options.nb_buffers=params->buffer_size;
-	driver->capture_frame_latency = params->capture_frame_latency;
-	driver->playback_frame_latency = params->playback_frame_latency;
-	driver->device_options.slave_mode=params->slave_mode;
-	driver->device_options.snoop_mode=params->snoop_mode;
-	driver->device_options.verbose=params->verbose_level;
-	
-	driver->device_info.nb_device_spec_strings=1;
-	driver->device_info.device_spec_strings=calloc(1, sizeof(char *));
-	driver->device_info.device_spec_strings[0]=strdup(params->device_info);
-	
-	debugPrint(DEBUG_LEVEL_STARTUP, " Driver compiled on %s %s for FFADO %s (API version %d)",
-	                                __DATE__, __TIME__, ffado_get_version(), ffado_get_api_version());
-	debugPrint(DEBUG_LEVEL_STARTUP, " Created driver %s", name);
-	debugPrint(DEBUG_LEVEL_STARTUP, "            period_size: %d", driver->period_size);
-	debugPrint(DEBUG_LEVEL_STARTUP, "            period_usecs: %d", driver->period_usecs);
-	debugPrint(DEBUG_LEVEL_STARTUP, "            sample rate: %d", driver->sample_rate);
-
-	return (ffado_driver_t *) driver;
-
-}
-
-static void
-ffado_driver_delete (ffado_driver_t *driver)
-{
-	unsigned int i;
-	jack_driver_nt_finish ((jack_driver_nt_t *) driver);
-	for (i=0; i < driver->device_info.nb_device_spec_strings; i++) {
-		free (driver->device_info.device_spec_strings[i]);
-	}
-	free (driver->device_info.device_spec_strings);
-	free (driver);
-}
-
-/*
- * dlopen plugin stuff
- */
-
-const char driver_client_name[] = "firewire_pcm";
-
-const jack_driver_desc_t *
-driver_get_descriptor ()
-{
-	jack_driver_desc_t * desc;
-	jack_driver_param_desc_t * params;
-	unsigned int i;
-
-	desc = calloc (1, sizeof (jack_driver_desc_t));
-
-	strcpy (desc->name, "firewire");
-	desc->nparams = 11;
-  
-	params = calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
-	desc->params = params;
-
-	i = 0;
-	strcpy (params[i].name, "device");
-	params[i].character  = 'd';
-	params[i].type       = JackDriverParamString;
-	strcpy (params[i].value.str,  "hw:0");
-	strcpy (params[i].short_desc, "The FireWire device to use.");
-	strcpy (params[i].long_desc,  "The FireWire device to use. Please consult the FFADO documentation for more info.");
-	
-	i++;
-	strcpy (params[i].name, "period");
-	params[i].character  = 'p';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 1024;
-	strcpy (params[i].short_desc, "Frames per period");
-	strcpy (params[i].long_desc, params[i].short_desc);
-	
-	i++;
-	strcpy (params[i].name, "nperiods");
-	params[i].character  = 'n';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 3;
-	strcpy (params[i].short_desc, "Number of periods of playback latency");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "rate");
-	params[i].character  = 'r';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 48000U;
-	strcpy (params[i].short_desc, "Sample rate");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "capture");
-	params[i].character  = 'i';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 1U;
-	strcpy (params[i].short_desc, "Provide capture ports.");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "playback");
-	params[i].character  = 'o';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 1U;
-	strcpy (params[i].short_desc, "Provide playback ports.");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "input-latency");
-	params[i].character  = 'I';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui    = 0;
-	strcpy (params[i].short_desc, "Extra input latency (frames)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "output-latency");
-	params[i].character  = 'O';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui    = 0;
-	strcpy (params[i].short_desc, "Extra output latency (frames)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "slave");
-	params[i].character  = 'x';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 0U;
-	strcpy (params[i].short_desc, "Act as a BounceDevice slave");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "slave");
-	params[i].character  = 'X';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 0U;
-	strcpy (params[i].short_desc, "Operate in snoop mode");
-	strcpy (params[i].long_desc, params[i].short_desc);
-	
-	i++;
-	strcpy (params[i].name, "verbose");
-	params[i].character  = 'v';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 0U;
-	strcpy (params[i].short_desc, "Verbose level for the firewire backend");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	return desc;
-}
-
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, JSList * params)
-{
-	jack_driver_t *driver;
-
-	const JSList * node;
-	const jack_driver_param_t * param;
-
-	ffado_jack_settings_t cmlparams;
-
-	char *device_name="hw:0"; 
-
-	cmlparams.period_size_set=0;
-	cmlparams.sample_rate_set=0;
-	cmlparams.buffer_size_set=0;
-
-	/* default values */
-	cmlparams.period_size=1024;
-	cmlparams.sample_rate=48000;
-	cmlparams.buffer_size=3;
-	cmlparams.playback_ports=1;
-	cmlparams.capture_ports=1;
-	cmlparams.playback_frame_latency=0;
-	cmlparams.capture_frame_latency=0;
-	cmlparams.slave_mode=0;
-	cmlparams.snoop_mode=0;
-	cmlparams.verbose_level=0;
-
-	for (node = params; node; node = jack_slist_next (node))
-	{
-		param = (jack_driver_param_t *) node->data;
-
-		switch (param->character)
-		{
-		case 'd':
-			device_name = strdup (param->value.str);
-			break;
-		case 'p':
-			cmlparams.period_size = param->value.ui;
-			cmlparams.period_size_set = 1;
-			break;
-		case 'n':
-			cmlparams.buffer_size = param->value.ui;
-			cmlparams.buffer_size_set = 1;
-			break;
-		case 'r':
-			cmlparams.sample_rate = param->value.ui;
-			cmlparams.sample_rate_set = 1;
-			break;
-		case 'i':
-			cmlparams.capture_ports = param->value.ui;
-			break;
-		case 'o':
-			cmlparams.playback_ports = param->value.ui;
-			break;
-		case 'I':
-			cmlparams.capture_frame_latency = param->value.ui;
-			break;
-		case 'O':
-			cmlparams.playback_frame_latency = param->value.ui;
-			break;
-		case 'x':
-			cmlparams.slave_mode = param->value.ui;
-			break;
-		case 'X':
-			cmlparams.snoop_mode = param->value.ui;
-			break;
-		case 'v':
-			cmlparams.verbose_level = param->value.ui;
-			break;
-		}
-	}
-
-        // temporary
-        cmlparams.device_info = device_name;
-
-	driver=(jack_driver_t *)ffado_driver_new (client, "ffado_pcm", &cmlparams);
-
-	return driver;
-}
-
-void
-driver_finish (jack_driver_t *driver)
-{
-	ffado_driver_t *drv=(ffado_driver_t *) driver;
-	// If jack hasn't called the detach method, do it now.  As of jack 0.101.1
-	// the detach method was not being called explicitly on closedown, and 
-	// we need it to at least deallocate the iso resources.
-	if (drv->dev != NULL)
-		ffado_driver_detach(drv);
-	ffado_driver_delete (drv);
-}
diff --git a/drivers/firewire/ffado_driver.h b/drivers/firewire/ffado_driver.h
deleted file mode 100644
index a407f76..0000000
--- a/drivers/firewire/ffado_driver.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- *   FireWire Backend for Jack
- *   using FFADO
- *   FFADO = Firewire (pro-)audio for linux
- *
- *   http://www.ffado.org
- *   http://www.jackaudio.org
- *
- *   Copyright (C) 2005-2007 Pieter Palmers
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* 
- * Main Jack driver entry routines
- *
- */ 
- 
-#ifndef __JACK_FFADO_DRIVER_H__
-#define __JACK_FFADO_DRIVER_H__
-
-#include <assert.h>
-
-#include <libffado/ffado.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdio.h>
-#include <poll.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <endian.h>
-
-#include <pthread.h>
-#include <semaphore.h>
-
-#include <jack/driver.h>
-#include <jack/engine.h>
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/types.h>
-#include <jack/ringbuffer.h>
-#include <jack/thread.h>
-
-#include <../alsa-midi/midi_pack.h>
-#include <../alsa-midi/midi_unpack.h>
-
-// debug print control flags
-#define DEBUG_LEVEL_BUFFERS           	(1<<0)
-#define DEBUG_LEVEL_HANDLERS			(1<<1)
-#define DEBUG_LEVEL_XRUN_RECOVERY     	(1<<2)
-#define DEBUG_LEVEL_WAIT     			(1<<3)
-
-#define DEBUG_LEVEL_RUN_CYCLE         	(1<<8)
-
-#define DEBUG_LEVEL_PACKETCOUNTER		(1<<16)
-#define DEBUG_LEVEL_STARTUP				(1<<17)
-#define DEBUG_LEVEL_THREADS				(1<<18)
-
-//#define DEBUG_ENABLED
-#ifdef DEBUG_ENABLED
-
-	// default debug level
-	#define DEBUG_LEVEL (  DEBUG_LEVEL_RUN_CYCLE | \
-	(DEBUG_LEVEL_XRUN_RECOVERY)| DEBUG_LEVEL_STARTUP | DEBUG_LEVEL_WAIT | DEBUG_LEVEL_PACKETCOUNTER)
-
-	#warning Building debug build!
-
-	#define printMessage(format, args...) jack_error( "firewire MSG: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
-	#define printError(format, args...) jack_error( "firewire ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
-	
-	#define printEnter() jack_error( "FWDRV ENTERS: %s (%s)\n", __FUNCTION__,  __FILE__)
-	#define printExit() jack_error( "FWDRV EXITS: %s (%s)\n", __FUNCTION__,  __FILE__)
-	#define printEnter() 
-	#define printExit() 
-	
-	#define debugError(format, args...) jack_error( "firewire ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
-	#define debugPrint(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error("DEBUG %s:%d (%s) :"  format, __FILE__, __LINE__, __FUNCTION__, ##args );
-	#define debugPrintShort(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error( format,##args );
-	#define debugPrintWithTimeStamp(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( "%16lu: "format, debugGetCurrentUTime(),##args );
-	#define SEGFAULT int *test=NULL;	*test=1;
-#else
-	#define DEBUG_LEVEL
-	
-	#define printMessage(format, args...) if(g_verbose) \
-	                                         jack_error("firewire MSG: " format, ##args )
-	#define printError(format, args...)   jack_error("firewire ERR: " format, ##args )
-	
-	#define printEnter() 
-	#define printExit() 
-	
-	#define debugError(format, args...) 
-	#define debugPrint(Level, format, args...) 
-	#define debugPrintShort(Level, format, args...)	
-	#define debugPrintWithTimeStamp(Level, format, args...)
-#endif
-
-typedef struct _ffado_driver ffado_driver_t;
-
-/*
- * Jack Driver command line parameters
- */
-
-typedef struct _ffado_jack_settings ffado_jack_settings_t;
-struct _ffado_jack_settings {
-    int verbose_level;
-
-    int period_size_set;
-    jack_nframes_t period_size;
-    
-    int sample_rate_set;
-    int sample_rate;
-    
-    int buffer_size_set;
-    jack_nframes_t buffer_size;
-
-    int playback_ports;
-    int capture_ports;
-    
-    jack_nframes_t capture_frame_latency;
-    jack_nframes_t playback_frame_latency;
-    
-    int slave_mode;
-    int snoop_mode;
-    
-    char *device_info;
-};
-
-typedef struct _ffado_capture_channel
-{
-	ffado_streaming_stream_type stream_type;
-	midi_unpack_t midi_unpack;
-	uint32_t *midi_buffer;
-} ffado_capture_channel_t;
-
-#define MIDI_OVERFLOW_BUFFER_SIZE 4
-typedef struct _ffado_playback_channel
-{
-	ffado_streaming_stream_type stream_type;
-	midi_pack_t midi_pack;
-	uint32_t *midi_buffer;
-	// to hold the midi bytes that couldn't be transferred
-	// during the previous period
-	char overflow_buffer[MIDI_OVERFLOW_BUFFER_SIZE];
-	unsigned int nb_overflow_bytes;
-} ffado_playback_channel_t;
-
-/*
- * JACK driver structure
- */
-struct _ffado_driver
-{
-	JACK_DRIVER_NT_DECL;
-	
-	jack_nframes_t  sample_rate;
-	jack_nframes_t  period_size;
-	unsigned long   wait_time;
-
-    jack_time_t                   wait_last;
-    jack_time_t                   wait_next;
-	int wait_late;
-	
-	jack_client_t  *client;
-	
-	int		xrun_detected;
-	int		xrun_count;
-	
-	int process_count;
-	
-	/* settings from the command line */
-	ffado_jack_settings_t settings;
-	
-	/* the firewire virtual device */
-	ffado_device_t *dev;
-
-	ffado_sample_t *nullbuffer;
-	ffado_sample_t *scratchbuffer;
-
-    JSList                       *capture_ports;
-    JSList                       *playback_ports;
-    JSList                       *monitor_ports;
-    channel_t                     playback_nchannels;
-    channel_t                     capture_nchannels;
-
-	ffado_playback_channel_t *playback_channels;
-	ffado_capture_channel_t  *capture_channels;
-
-	jack_nframes_t  playback_frame_latency;
-	jack_nframes_t  capture_frame_latency;
-    	
-	ffado_device_info_t device_info;
-	ffado_options_t device_options;
-
-}; 
-
-
-
-#endif /* __JACK_FFADO_DRIVER_H__ */
-
-
diff --git a/drivers/freebob/.cvsignore b/drivers/freebob/.cvsignore
deleted file mode 100644
index 7bbdc20..0000000
--- a/drivers/freebob/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.lo
-.deps
-.libs
-Makefile
-Makefile.in
-jack_freebob.la
-
diff --git a/drivers/freebob/Makefile.am b/drivers/freebob/Makefile.am
deleted file mode 100644
index db022c5..0000000
--- a/drivers/freebob/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-MAINTAINERCLEANFILES=Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS) $(LIBFREEBOB_CFLAGS) $(ALSA_CFLAGS)
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_freebob.la
-
-jack_freebob_la_SOURCES = freebob_driver.c
-
-jack_freebob_la_LIBADD = $(LIBFREEBOB_LIBS) $(ALSA_LIBS) 
-
-if HAVE_ALSA_MIDI
-jack_freebob_la_SOURCES += ../alsa-midi/alsa_rawmidi.c ../alsa-midi/alsa_seqmidi.c
-jack_freebob_la_CFLAGS = -I../alsa-midi
-endif
-
-jack_freebob_la_LDFLAGS = -module -avoid-version
-
-noinst_HEADERS = freebob_driver.h
-
diff --git a/drivers/freebob/freebob_driver.c b/drivers/freebob/freebob_driver.c
deleted file mode 100644
index d419e50..0000000
--- a/drivers/freebob/freebob_driver.c
+++ /dev/null
@@ -1,1329 +0,0 @@
-/*
- *   FreeBob Backend for Jack
- *   FreeBob = Firewire (pro-)audio for linux
- *
- *   http://freebob.sf.net
- *   http://jackit.sf.net
- *
- *   Copyright (C) 2005-2007 Pieter Palmers <pieter.palmers at ffado.org>
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* 
- * Main Jack driver entry routines
- *
- */ 
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-
-#include <assert.h>
-
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <sysdeps/time.h>
-
-#include "freebob_driver.h"
-
-#define SAMPLE_MAX_24BIT  8388608.0f
-#define SAMPLE_MAX_16BIT  32768.0f
-
-static int freebob_driver_stop (freebob_driver_t *driver);
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	static freebob_driver_midi_handle_t *freebob_driver_midi_init(freebob_driver_t *driver);
-	static void freebob_driver_midi_finish (freebob_driver_midi_handle_t *m);
-	static int freebob_driver_midi_start (freebob_driver_midi_handle_t *m);
-	static int freebob_driver_midi_stop (freebob_driver_midi_handle_t *m);
-#endif
-
-// enable verbose messages
-static int g_verbose=0;
-
-static int
-freebob_driver_attach (freebob_driver_t *driver)
-{
-	char buf[64];
-	char buf2[64];
-
-	channel_t chn;
-	jack_port_t *port=NULL;
-	int port_flags;
-	int error=0;
-
-	g_verbose=driver->engine->verbose;
-	driver->device_options.verbose=g_verbose;
-
-	driver->engine->set_buffer_size (driver->engine, driver->period_size);
-	driver->engine->set_sample_rate (driver->engine, driver->sample_rate);
-
-	/* packetizer thread options */
-	driver->device_options.realtime=(driver->engine->control->real_time? 1 : 0);
-	
-	driver->device_options.packetizer_priority=driver->engine->control->client_priority +
-		FREEBOB_RT_PRIORITY_PACKETIZER_RELATIVE;
-	if (driver->device_options.packetizer_priority>98) {
-		driver->device_options.packetizer_priority=98;
-	}
-
-	driver->dev=freebob_streaming_init(&driver->device_info,driver->device_options);
-
-	if(!driver->dev) {
-		printError("FREEBOB: Error creating virtual device");
-		return -1;
-	}
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	driver->midi_handle=freebob_driver_midi_init(driver);
-	if(!driver->midi_handle) {
-		printError("-----------------------------------------------------------");
-		printError("Error creating midi device!");
-		printError("FreeBob will run without MIDI support.");
-		printError("Consult the above error messages to solve the problem. ");
-		printError("-----------------------------------------------------------\n\n");
-	}
-#endif
-
-	if (driver->device_options.realtime) {
-		printMessage("Streaming thread running with Realtime scheduling, priority %d",
-		           driver->device_options.packetizer_priority);
-	} else {
-		printMessage("Streaming thread running without Realtime scheduling");
-	}
-
-	/* ports */
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-
-	driver->capture_nchannels=freebob_streaming_get_nb_capture_streams(driver->dev);
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-	// allocate midi structures
-	driver->midi_in_ports=calloc(driver->capture_nchannels, sizeof(freebob_midi_input_port_t));
-	if (driver->midi_in_ports == NULL) return -ENOMEM;
-#endif
-
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-		error=0;
-
-		freebob_streaming_get_capture_stream_name(driver->dev, chn, buf, sizeof(buf) - 1);
-		switch(freebob_streaming_get_capture_stream_type(driver->dev, chn)) {
-		case freebob_stream_type_audio:
-			snprintf(buf2, 64, "C%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering audio capture port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_AUDIO_TYPE,
-							port_flags, 0)) == NULL) {
-				printError (" cannot register port for %s", buf2);
-				error=1;
-				break;
-			}
-			driver->capture_ports =
-				jack_slist_append (driver->capture_ports, port);
-			break;
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-		case freebob_stream_type_midi:
-			snprintf(buf2, 64, "CM%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering midi capture port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_MIDI_TYPE,
-							port_flags, 0)) == NULL) {
-				printError (" cannot register port for %s", buf2);
-				error=1;
-				break;
-			}
-
-			// init the midi unpacker for this port
-			midi_unpack_init(&driver->midi_in_ports[chn].unpack);
-
-			driver->capture_ports =
-				jack_slist_append (driver->capture_ports, port);
-			break;
-#endif
-
-		default:
-			printMessage ("Don't register capture port for %s", buf);
-			// we have to add a NULL entry in the list to be able to loop over the channels in the read/write routines
-			driver->capture_ports =
-				jack_slist_append (driver->capture_ports, NULL);
-			break;
-		}
-
-		if(error) break;
-
-		jack_port_set_latency (port, driver->period_size + driver->capture_frame_latency);
-	}
-	
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-
-	driver->playback_nchannels=freebob_streaming_get_nb_playback_streams(driver->dev);
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-	// allocate midi structures
-	driver->midi_out_ports=calloc(driver->playback_nchannels, sizeof(freebob_midi_output_port_t));
-	if (driver->midi_out_ports == NULL) return -ENOMEM;
-#endif
-
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		error=0;
-
-		freebob_streaming_get_playback_stream_name(driver->dev, chn, buf, sizeof(buf) - 1);
-		
-		switch(freebob_streaming_get_playback_stream_type(driver->dev, chn)){
-		case freebob_stream_type_audio:
-			snprintf(buf2, 64, "P%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering playback audio port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_AUDIO_TYPE,
-							port_flags, 0)) == NULL) {
-				printError(" cannot register port for %s", buf2);
-				error=1;
-				break;
-			}
-			driver->playback_ports =
-				jack_slist_append (driver->playback_ports, port);
-			break;
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-		case freebob_stream_type_midi:
-			snprintf(buf2, 64, "PM%d_%s",(int)chn,buf); // needed to avoid duplicate names
-			printMessage ("Registering playback midi port %s", buf2);
-			if ((port = jack_port_register (driver->client, buf2,
-							JACK_DEFAULT_MIDI_TYPE,
-							port_flags, 0)) == NULL) {
-				printError(" cannot register port for %s", buf2);
-				error=1;
-				break;
-			}
-
-			driver->playback_ports =
-				jack_slist_append (driver->playback_ports, port);
-			break;
-#endif
-		default:
-			printMessage ("Don't register playback port %s", buf);
-			// we have to add a NULL entry in the list to be able to loop over the channels in the read/write routines
-			driver->playback_ports =
-				jack_slist_append (driver->playback_ports, NULL);
-		}
-
-		if(error) break;
-
-		jack_port_set_latency (port, (driver->period_size * (driver->device_options.nb_buffers - 1)) + driver->playback_frame_latency); 
-	}
-
-	return jack_activate (driver->client);
-}
-
-static int
-freebob_driver_detach (freebob_driver_t *driver)
-{
-	JSList *node;
-
-	if (driver->engine == NULL) {
-		return 0;
-	}
-
-	for (node = driver->capture_ports; node && node->data;
-	     node = jack_slist_next (node)) {
-		if(node->data != NULL) {
-			jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-		}
-	}
-
-	jack_slist_free (driver->capture_ports);
-	driver->capture_ports = 0;
-		
-	for (node = driver->playback_ports; node && node->data;
-	     node = jack_slist_next (node)) {
-		if(node->data != NULL) {
-			jack_port_unregister (driver->client,
-				      ((jack_port_t *) node->data));
-		}
-	}
-
-	jack_slist_free (driver->playback_ports);
-	driver->playback_ports = 0;
-
-	freebob_streaming_finish(driver->dev);
-	driver->dev=NULL;
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	if(driver->midi_handle) {
-		freebob_driver_midi_finish(driver->midi_handle);	
-	}
-	driver->midi_handle=NULL;
-#endif
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-	free(driver->midi_in_ports);
-	free(driver->midi_out_ports);
-#endif
-	return 0;
-}
-
-static int
-freebob_driver_read (freebob_driver_t * driver, jack_nframes_t nframes)
-{
-	jack_default_audio_sample_t* buf;
-	channel_t chn;
-	JSList *node;
-	jack_port_t* port;
-	
-	freebob_sample_t nullbuffer[nframes];
-	void *addr_of_nullbuffer=(void *)nullbuffer;
-
-	freebob_streaming_stream_type stream_type;
-	
-	printEnter();
-	
-	for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) {
-		stream_type = freebob_streaming_get_capture_stream_type(driver->dev, chn);
-		if(stream_type == freebob_stream_type_audio) {
-			port = (jack_port_t *) node->data;
-			buf = jack_port_get_buffer (port, nframes);
-
-			if(!buf) buf=(jack_default_audio_sample_t *)addr_of_nullbuffer;
-				
-			freebob_streaming_set_capture_stream_buffer(
-				driver->dev, chn, (char *)(buf), freebob_buffer_type_float);
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-		} else if(stream_type == freebob_stream_type_midi) {
-			unsigned int midibuff[64];
-			unsigned char midibuff2[64];
-			int samples_read;
-
-			port = (jack_port_t *) node->data;
-			buf = jack_port_get_buffer (port, nframes);
-
-			jack_midi_clear_buffer(buf);
-
-			samples_read=freebob_streaming_read(
-				driver->dev, chn, midibuff, 64);
-
-			while(samples_read) {
-				int idx;
-				int done;
-				//printMessage("MIDI: ");
-				for (idx=0;idx<samples_read;idx++) {
-					midibuff2[idx]=(unsigned char)(midibuff[idx] & 0xFF);
-					//printMessage(" %02X", midibuff2[idx]);
-				}
-
-				done = midi_unpack_buf(
-					&driver->midi_in_ports[chn].unpack,
-					midibuff2, samples_read, buf, 0 /* time */);
-
-				samples_read=freebob_streaming_read(
-					driver->dev, chn, midibuff, 64);
-			}
-#endif
-		} else { // empty other buffers without doing something with them
-			freebob_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(nullbuffer), freebob_buffer_type_uint24);
-		}
-	}
-
-	// now transfer the buffers
-	freebob_streaming_transfer_capture_buffers(driver->dev);
-	
-	printExit();
-	
-	return 0;
-}
-
-static int
-freebob_driver_write (freebob_driver_t * driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	JSList *node;
-	jack_default_audio_sample_t* buf;
-
-	jack_port_t *port;
-
-	freebob_streaming_stream_type stream_type;
-
-	freebob_sample_t nullbuffer[nframes];
-	void *addr_of_nullbuffer = (void*)nullbuffer;
-
-	memset(&nullbuffer,0,nframes*sizeof(freebob_sample_t));
-
-	printEnter();
-
-	driver->process_count++;
-
-	assert(driver->dev);
-
- 	if (driver->engine->freewheeling) {
- 		return 0;
- 	}
-
-	for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) {
-		stream_type=freebob_streaming_get_playback_stream_type(driver->dev, chn);
-		if(stream_type == freebob_stream_type_audio) {
-			port = (jack_port_t *) node->data;
-
-			buf = jack_port_get_buffer (port, nframes);
-			if(!buf) buf=(jack_default_audio_sample_t*)addr_of_nullbuffer;
-				
-			freebob_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(buf), freebob_buffer_type_float);
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-		} else if(stream_type == freebob_stream_type_midi) {
-			int i,idx;
-			int samples_written;
-
-			port = (jack_port_t *) node->data;
-			buf = jack_port_get_buffer (port, nframes);
-
-			int nevents = jack_midi_get_event_count(buf);
-
-			if (nevents)
-				printMessage("jack_out: %d events\n", nevents);
-			for (i=0; i<nevents; ++i) {
-				jack_midi_event_t event;
-		
-				jack_midi_event_get(&event, buf, i);
-		
-				midi_pack_event(&driver->midi_out_ports[chn].packer, &event);
-
-				freebob_sample_t midibuff[event.size];
-				for (idx=0;idx<event.size;idx++) {
-					midibuff[idx]=(freebob_sample_t)(event.buffer[idx]);
-				}
-
-				samples_written=freebob_streaming_write(
-					driver->dev, chn, midibuff, event.size);
-
-				if (samples_written!=event.size) {
-					printMessage("midi out: buffer overrun\n");
-					break;
-				} else {
-					printMessage("midi out: sent %d-byte event at %ld\n", (int)event.size, (long)event.time);
-				}
-			}
-#endif
-		} else { // empty other buffers without doing something with them
-			freebob_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(nullbuffer), freebob_buffer_type_uint24);
-		}
-	}
-
-	freebob_streaming_transfer_playback_buffers(driver->dev);
-
-	printExit();
-	
-	return 0;
-}
-
-//static inline jack_nframes_t 
-static jack_nframes_t 
-freebob_driver_wait (freebob_driver_t *driver, int extra_fd, int *status,
-		   float *delayed_usecs)
-{
-	int nframes;
-	jack_time_t                   wait_enter;
-	jack_time_t                   wait_ret;
-	
-	printEnter();
-
-	wait_enter = jack_get_microseconds ();
-	if (wait_enter > driver->wait_next) {
-		/*
-			* This processing cycle was delayed past the
-			* next due interrupt!  Do not account this as
-			* a wakeup delay:
-			*/
-		driver->wait_next = 0;
-		driver->wait_late++;
-	}
-// *status = -2; interrupt
-// *status = -3; timeout
-// *status = -4; extra FD
-
-	nframes=freebob_streaming_wait(driver->dev);
-	
-	wait_ret = jack_get_microseconds ();
-	
-	if (driver->wait_next && wait_ret > driver->wait_next) {
-		*delayed_usecs = wait_ret - driver->wait_next;
-	}
-	driver->wait_last = wait_ret;
-	driver->wait_next = wait_ret + driver->period_usecs;
-	driver->engine->transport_cycle_start (driver->engine, wait_ret);
-	
-	// transfer the streaming buffers
-	// we now do this in the read/write functions
-// 	freebob_streaming_transfer_buffers(driver->dev);
-	
-	if (nframes < 0) {
-		*status=0;
-		
-		return 0;
-		//nframes=driver->period_size; //debug
-	}
-
-	*status = 0;
-	driver->last_wait_ust = wait_ret;
-
-	// FIXME: this should do something more usefull
-	*delayed_usecs = 0;
-	
-	printExit();
-
-	return nframes - nframes % driver->period_size;
-	
-}
-
-static int
-freebob_driver_run_cycle (freebob_driver_t *driver)
-{
-	jack_engine_t *engine = driver->engine;
-	int wait_status=0;
-	float delayed_usecs=0.0;
-
-	jack_nframes_t nframes = freebob_driver_wait (driver, -1, &wait_status,
-						   &delayed_usecs);
-	
-	if ((wait_status < 0)) {
-		printError( "wait status < 0! (= %d)",wait_status);
-		return -1;
-	}
-		
-	if ((nframes == 0)) {
-		int chn;
-		chn=0; // avoid unused variable warning when compiling without jack midi
-
-		/* we detected an xrun and restarted: notify
-		 * clients about the delay. */
-		printMessage("xrun detected");
-		engine->delay (engine, delayed_usecs);
-
-		// reset the midi stuff
-		#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-			for (chn = 0; chn < driver->capture_nchannels; chn++) {
-				// init the midi unpacker for this port
-				midi_unpack_reset(&driver->midi_in_ports[chn].unpack);
-			}
-			
-			for (chn = 0; chn < driver->playback_nchannels; chn++) {
-				// init the midi unpacker for this port
-				midi_pack_reset(&driver->midi_out_ports[chn].packer);
-			}
-		#endif
-
-		return 0;
-	} 
-	
-	return engine->run_cycle (engine, nframes, delayed_usecs);
-
-}
-/*
- * in a null cycle we should discard the input and write silence to the outputs
- */
-static int
-freebob_driver_null_cycle (freebob_driver_t* driver, jack_nframes_t nframes)
-{
-	channel_t chn;
-	JSList *node;
-	jack_nframes_t nwritten;
-
-	freebob_streaming_stream_type stream_type;
-
-	jack_default_audio_sample_t buff[nframes];
-	jack_default_audio_sample_t* buffer=(jack_default_audio_sample_t*)buff;
-	
-	printEnter();
-
-	memset(buffer,0,nframes*sizeof(jack_default_audio_sample_t));
-	
-	assert(driver->dev);
-
- 	if (driver->engine->freewheeling) {
- 		return 0;
- 	}
-
-	// write silence to buffer
-	nwritten = 0;
-
-	for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) {
-		stream_type=freebob_streaming_get_playback_stream_type(driver->dev, chn);
-
-		if(stream_type == freebob_stream_type_audio) {
-			freebob_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(buffer), freebob_buffer_type_float);
-
-		} else if(stream_type == freebob_stream_type_midi) {
-			// these should be read/written with the per-stream functions
-
-		} else { // empty other buffers without doing something with them
-			freebob_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(buffer), freebob_buffer_type_uint24);
-		}
-	}
-
-	freebob_streaming_transfer_playback_buffers(driver->dev);
-	
-	// read & discard from input ports
-	for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) {
-		stream_type=freebob_streaming_get_capture_stream_type(driver->dev, chn);
-		if(stream_type == freebob_stream_type_audio) {
-			freebob_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(buffer), freebob_buffer_type_float);
-
-		} else if(stream_type == freebob_stream_type_midi) {
-
-		} else { // empty other buffers without doing something with them
-		}
-	}
-
-	// now transfer the buffers
-	freebob_streaming_transfer_capture_buffers(driver->dev);
-		
-	printExit();
-	return 0;
-}
-
-static int
-freebob_driver_start (freebob_driver_t *driver)
-{
-	int retval=0;
-	int chn;
-	chn=0; // avoid unused variable warning when compiling without jack midi
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	if(driver->midi_handle) {
-		if((retval=freebob_driver_midi_start(driver->midi_handle))) {
-			printError("Could not start MIDI threads");
-			return retval;
-		}
-	}
-#endif	
-
-	// reset the midi stuff
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-		// init the midi unpacker for this port
-		midi_unpack_reset(&driver->midi_in_ports[chn].unpack);
-	}
-	
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-		// init the midi unpacker for this port
-		midi_pack_reset(&driver->midi_out_ports[chn].packer);
-	}
-#endif
-
-	if((retval=freebob_streaming_start(driver->dev))) {
-		printError("Could not start streaming threads");
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-		if(driver->midi_handle) {
-			freebob_driver_midi_stop(driver->midi_handle);
-		}
-#endif
-		return retval;
-	}
-
-	return 0;
-
-}
-
-static int
-freebob_driver_stop (freebob_driver_t *driver)
-{
-	int retval=0;
-	
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	if(driver->midi_handle) {
-		if((retval=freebob_driver_midi_stop(driver->midi_handle))) {
-			printError("Could not stop MIDI threads");
-			return retval;
-		}
-	}
-#endif	
-	if((retval=freebob_streaming_stop(driver->dev))) {
-		printError("Could not stop streaming threads");
-		return retval;
-	}
-
-	return 0;
-}
-
-
-static int
-freebob_driver_bufsize (freebob_driver_t* driver, jack_nframes_t nframes)
-{
-	printError("Buffer size change requested but not supported!!!");
-
-	/*
-	 driver->period_size = nframes;  
-	driver->period_usecs =
-		(jack_time_t) floor ((((float) nframes) / driver->sample_rate)
-				     * 1000000.0f);
-	*/
-	
-	/* tell the engine to change its buffer size */
-	//driver->engine->set_buffer_size (driver->engine, nframes);
-
-	return -1; // unsupported
-}
-
-typedef void (*JackDriverFinishFunction) (jack_driver_t *);
-
-freebob_driver_t *
-freebob_driver_new (jack_client_t * client,
-		  char *name,
-		  freebob_jack_settings_t *params)
-{
-	freebob_driver_t *driver;
-
-	assert(params);
-
-	if(freebob_get_api_version() != 1) {
-		printMessage("Incompatible libfreebob version! (%s)", freebob_get_version());
-		return NULL;
-	}
-
-	printMessage("Starting Freebob backend (%s)", freebob_get_version());
-
-	driver = calloc (1, sizeof (freebob_driver_t));
-
-	/* Setup the jack interfaces */  
-	jack_driver_nt_init ((jack_driver_nt_t *) driver);
-
-	driver->nt_attach    = (JackDriverNTAttachFunction)   freebob_driver_attach;
-	driver->nt_detach    = (JackDriverNTDetachFunction)   freebob_driver_detach;
-	driver->nt_start     = (JackDriverNTStartFunction)    freebob_driver_start;
-	driver->nt_stop      = (JackDriverNTStopFunction)     freebob_driver_stop;
-	driver->nt_run_cycle = (JackDriverNTRunCycleFunction) freebob_driver_run_cycle;
-	driver->null_cycle   = (JackDriverNullCycleFunction)  freebob_driver_null_cycle;
-	driver->write        = (JackDriverReadFunction)       freebob_driver_write;
-	driver->read         = (JackDriverReadFunction)       freebob_driver_read;
-	driver->nt_bufsize   = (JackDriverNTBufSizeFunction)  freebob_driver_bufsize;
-	
-	/* copy command line parameter contents to the driver structure */
-	memcpy(&driver->settings,params,sizeof(freebob_jack_settings_t));
-	
-	/* prepare all parameters */
-	driver->sample_rate = params->sample_rate;
-	driver->period_size = params->period_size;
-	driver->last_wait_ust = 0;
-	
-	driver->period_usecs =
-		(jack_time_t) floor ((((float) driver->period_size) * 1000000.0f) / driver->sample_rate);
-
-	driver->client = client;
-	driver->engine = NULL;
-
-	memset(&driver->device_options,0,sizeof(driver->device_options));	
-	driver->device_options.sample_rate=params->sample_rate;
-	driver->device_options.period_size=params->period_size;
-	driver->device_options.nb_buffers=params->buffer_size;
-	driver->device_options.node_id=params->node_id;
-	driver->device_options.port=params->port;
-	driver->capture_frame_latency = params->capture_frame_latency;
-	driver->playback_frame_latency = params->playback_frame_latency;
-
-	if(!params->capture_ports) {
-		driver->device_options.directions |= FREEBOB_IGNORE_CAPTURE;
-	}
-
-	if(!params->playback_ports) {
-		driver->device_options.directions |= FREEBOB_IGNORE_PLAYBACK;
-	}
-
-	debugPrint(DEBUG_LEVEL_STARTUP, " Driver compiled on %s %s", __DATE__, __TIME__);
-	debugPrint(DEBUG_LEVEL_STARTUP, " Created driver %s", name);
-	debugPrint(DEBUG_LEVEL_STARTUP, "            period_size: %d", driver->period_size);
-	debugPrint(DEBUG_LEVEL_STARTUP, "            period_usecs: %d", driver->period_usecs);
-	debugPrint(DEBUG_LEVEL_STARTUP, "            sample rate: %d", driver->sample_rate);
-
-	return (freebob_driver_t *) driver;
-
-}
-
-static void
-freebob_driver_delete (freebob_driver_t *driver)
-{
-	if(driver->dev) {
-		freebob_driver_detach(driver);
-	}
-
-	jack_driver_nt_finish ((jack_driver_nt_t *) driver);
-	free (driver);
-}
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-/*
- * MIDI support
- */ 
-
-// the thread that will queue the midi events from the seq to the stream buffers
-
-void * freebob_driver_midi_queue_thread(void *arg)
-{
-	freebob_driver_midi_handle_t *m=(freebob_driver_midi_handle_t *)arg;
-	assert(m);
-	snd_seq_event_t *ev;
-	unsigned char work_buffer[MIDI_TRANSMIT_BUFFER_SIZE];
-	int bytes_to_send;
-	int b;
-	int i;
-
-	printMessage("MIDI queue thread started");
-
-	while(1) {
-		// get next event, if one is present
-		while ((snd_seq_event_input(m->seq_handle, &ev) > 0)) {
-			if (ev->source.client == SND_SEQ_CLIENT_SYSTEM)
-				continue;
-
-			// get the port this event is originated from
-			freebob_midi_port_t *port=NULL;
-			for (i=0;i<m->nb_output_ports;i++) {
-				if(m->output_ports[i]->seq_port_nr == ev->dest.port) {
-					port=m->output_ports[i];
-					break;
-				}
-			}
-	
-			if(!port) {
-				printError(" Could not find target port for event: dst=%d src=%d", ev->dest.port, ev->source.port);
-
-				break;
-			}
-			
-			// decode it to the work buffer
-			if((bytes_to_send = snd_midi_event_decode ( port->parser, 
-				work_buffer,
-				MIDI_TRANSMIT_BUFFER_SIZE, 
-				ev))<0) 
-			{ // failed
-				printError(" Error decoding event for port %d (errcode=%d)", port->seq_port_nr,bytes_to_send);
-				bytes_to_send=0;
-				//return -1;
-			}
-	
-			for(b=0;b<bytes_to_send;b++) {
-				freebob_sample_t tmp_event=work_buffer[b];
-				if(freebob_streaming_write(m->dev, port->stream_nr, &tmp_event, 1)<1) {
-					printError(" Midi send buffer overrun");
-				}
-			}
-	
-		}
-
-		// sleep for some time
-		usleep(MIDI_THREAD_SLEEP_TIME_USECS);
-	}
-	return NULL;
-}
-
-// the dequeue thread (maybe we need one thread per stream)
-void *freebob_driver_midi_dequeue_thread (void *arg) {
-	freebob_driver_midi_handle_t *m=(freebob_driver_midi_handle_t *)arg;
-
-	int i;
-	int s;
-	
-	int samples_read;
-
-	assert(m);
-
-	while(1) {
-		// read incoming events
-	
-		for (i=0;i<m->nb_input_ports;i++) {
-			unsigned int buff[64];
-	
-			freebob_midi_port_t *port=m->input_ports[i];
-		
-			if(!port) {
-				printError(" something went wrong when setting up the midi input port map (%d)",i);
-			}
-		
-			do {
-				samples_read=freebob_streaming_read(m->dev, port->stream_nr, buff, 64);
-			
-				for (s=0;s<samples_read;s++) {
-					unsigned int *byte=(buff+s) ;
-					snd_seq_event_t ev;
-					if ((snd_midi_event_encode_byte(port->parser,(*byte) & 0xFF, &ev)) > 0) {
-						// a midi message is complete, send it out to ALSA
-						snd_seq_ev_set_subs(&ev);  
-						snd_seq_ev_set_direct(&ev);
-						snd_seq_ev_set_source(&ev, port->seq_port_nr);
-						snd_seq_event_output_direct(port->seq_handle, &ev);						
-					}
-				}
-			} while (samples_read>0);
-		}
-
-		// sleep for some time
-		usleep(MIDI_THREAD_SLEEP_TIME_USECS);
-	}
-	return NULL;
-}
-
-static freebob_driver_midi_handle_t *freebob_driver_midi_init(freebob_driver_t *driver) {
-// 	int err;
-
-	char buf[256];
-	channel_t chn;
-	int nchannels;
-	int i=0;
-
-	freebob_device_t *dev=driver->dev;
-
-	assert(dev);
-
-	freebob_driver_midi_handle_t *m=calloc(1,sizeof(freebob_driver_midi_handle_t));
-	if (!m) {
-		printError("not enough memory to create midi structure");
-		return NULL;
-	}
-
-	if (snd_seq_open(&m->seq_handle, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK) < 0) {
-		printError("Error opening ALSA sequencer.");
-		free(m);
-		return NULL;
-	}
-
-	snd_seq_set_client_name(m->seq_handle, "FreeBoB Jack MIDI");
-
-	// find out the number of midi in/out ports we need to setup
-	nchannels=freebob_streaming_get_nb_capture_streams(dev);
-
-	m->nb_input_ports=0;
-
-	for (chn = 0; chn < nchannels; chn++) {	
-		if(freebob_streaming_get_capture_stream_type(dev, chn) == freebob_stream_type_midi) {
-			m->nb_input_ports++;
-		}
-	}
-
-	m->input_ports=calloc(m->nb_input_ports,sizeof(freebob_midi_port_t *));
-	if(!m->input_ports) {
-		printError("not enough memory to create midi structure");
-		free(m);
-		return NULL;
-	}
-
-	i=0;
-	for (chn = 0; chn < nchannels; chn++) {
-		if(freebob_streaming_get_capture_stream_type(dev, chn) == freebob_stream_type_midi) {
-			m->input_ports[i]=calloc(1,sizeof(freebob_midi_port_t));
-			if(!m->input_ports[i]) {
-				// fixme
-				printError("Could not allocate memory for seq port");
-				continue;
-			}
-
-	 		freebob_streaming_get_capture_stream_name(dev, chn, buf, sizeof(buf) - 1);
-			printMessage("Register MIDI IN port %s", buf);
-
-			m->input_ports[i]->seq_port_nr=snd_seq_create_simple_port(m->seq_handle, buf,
-				SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ,
-				SND_SEQ_PORT_TYPE_MIDI_GENERIC);
-
-			if(m->input_ports[i]->seq_port_nr<0) {
-				printError("Could not create seq port");
-				m->input_ports[i]->stream_nr=-1;
-				m->input_ports[i]->seq_port_nr=-1;
-			} else {
-				m->input_ports[i]->stream_nr=chn;
-				m->input_ports[i]->seq_handle=m->seq_handle;
-				if (snd_midi_event_new  ( ALSA_SEQ_BUFF_SIZE, &(m->input_ports[i]->parser)) < 0) {
-					printError("could not init parser for MIDI IN port %d",i);
-					m->input_ports[i]->stream_nr=-1;
-					m->input_ports[i]->seq_port_nr=-1;
-				}
-			}
-
-			i++;
-		}
-	}
-
-	// playback
-	nchannels=freebob_streaming_get_nb_playback_streams(dev);
-
-	m->nb_output_ports=0;
-
-	for (chn = 0; chn < nchannels; chn++) {	
-		if(freebob_streaming_get_playback_stream_type(dev, chn) == freebob_stream_type_midi) {
-			m->nb_output_ports++;
-		}
-	}
-
-	m->output_ports=calloc(m->nb_output_ports,sizeof(freebob_midi_port_t *));
-	if(!m->output_ports) {
-		printError("not enough memory to create midi structure");
-		for (i = 0; i < m->nb_input_ports; i++) {	
-			free(m->input_ports[i]);
-		}
-		free(m->input_ports);
-		free(m);
-		return NULL;
-	}
-
-	i=0;
-	for (chn = 0; chn < nchannels; chn++) {
-		if(freebob_streaming_get_playback_stream_type(dev, chn) == freebob_stream_type_midi) {
-			m->output_ports[i]=calloc(1,sizeof(freebob_midi_port_t));
-			if(!m->output_ports[i]) {
-				// fixme
-				printError("Could not allocate memory for seq port");
-				continue;
-			}
-
-	 		freebob_streaming_get_playback_stream_name(dev, chn, buf, sizeof(buf) - 1);
-			printMessage("Register MIDI OUT port %s", buf);
-
-			m->output_ports[i]->seq_port_nr=snd_seq_create_simple_port(m->seq_handle, buf,
-				SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
-              			SND_SEQ_PORT_TYPE_MIDI_GENERIC);
-
-
-			if(m->output_ports[i]->seq_port_nr<0) {
-				printError("Could not create seq port");
-				m->output_ports[i]->stream_nr=-1;
-				m->output_ports[i]->seq_port_nr=-1;
-			} else {
-				m->output_ports[i]->stream_nr=chn;
-				m->output_ports[i]->seq_handle=m->seq_handle;
-				if (snd_midi_event_new  ( ALSA_SEQ_BUFF_SIZE, &(m->output_ports[i]->parser)) < 0) {
-					printError("could not init parser for MIDI OUT port %d",i);
-					m->output_ports[i]->stream_nr=-1;
-					m->output_ports[i]->seq_port_nr=-1;
-				}
-			}
-
-			i++;
-		}
-	}
-
-	m->dev=dev;
-	m->driver=driver;
-
-	return m;
-}
-
-static int
-freebob_driver_midi_start (freebob_driver_midi_handle_t *m)
-{
-	assert(m);
-	// start threads
-
-	m->queue_thread_realtime=(m->driver->engine->control->real_time? 1 : 0);
- 	m->queue_thread_priority=
-		m->driver->engine->control->client_priority +
-		FREEBOB_RT_PRIORITY_MIDI_RELATIVE;
-
-	if (m->queue_thread_priority>98) {
-		m->queue_thread_priority=98;
-	}
-	if (m->queue_thread_realtime) {
-		printMessage("MIDI threads running with Realtime scheduling, priority %d",
-		           m->queue_thread_priority);
-	} else {
-		printMessage("MIDI threads running without Realtime scheduling");
-	}
-
-	if (jack_client_create_thread(NULL, &m->queue_thread, m->queue_thread_priority, m->queue_thread_realtime, freebob_driver_midi_queue_thread, (void *)m)) {
-		printError(" cannot create midi queueing thread");
-		return -1;
-	}
-
-	if (jack_client_create_thread(NULL, &m->dequeue_thread, m->queue_thread_priority, m->queue_thread_realtime, freebob_driver_midi_dequeue_thread, (void *)m)) {
-		printError(" cannot create midi dequeueing thread");
-		return -1;
-	}
-	return 0;
-}
-
-static int
-freebob_driver_midi_stop (freebob_driver_midi_handle_t *m)
-{
-	assert(m);
-
-	pthread_cancel (m->queue_thread);
-	pthread_join (m->queue_thread, NULL);
-
-	pthread_cancel (m->dequeue_thread);
-	pthread_join (m->dequeue_thread, NULL);
-	return 0;
-
-}
-
-static void
-freebob_driver_midi_finish (freebob_driver_midi_handle_t *m)
-{
-	assert(m);
-
-	int i;
-	// TODO: add state info here, if not stopped then stop
-
-	for (i=0;i<m->nb_input_ports;i++) {
-		free(m->input_ports[i]);
-
-	}
-	free(m->input_ports);
-
-	for (i=0;i<m->nb_output_ports;i++) {
-		free(m->output_ports[i]);
-	}
-	free(m->output_ports);
-
-	free(m);
-}
-#endif	
-/*
- * dlopen plugin stuff
- */
-
-const char driver_client_name[] = "freebob_pcm";
-
-const jack_driver_desc_t *
-driver_get_descriptor ()
-{
-	jack_driver_desc_t * desc;
-	jack_driver_param_desc_t * params;
-	unsigned int i;
-
-	desc = calloc (1, sizeof (jack_driver_desc_t));
-
-	strcpy (desc->name, "freebob");
-	desc->nparams = 11;
-  
-	params = calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
-	desc->params = params;
-
-	i = 0;
-	strcpy (params[i].name, "device");
-	params[i].character  = 'd';
-	params[i].type       = JackDriverParamString;
-	strcpy (params[i].value.str,  "hw:0");
-	strcpy (params[i].short_desc, "The FireWire device to use. Format is: 'hw:port[,node]'.");
-	strcpy (params[i].long_desc,  params[i].short_desc);
-	
-	i++;
-	strcpy (params[i].name, "period");
-	params[i].character  = 'p';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 1024;
-	strcpy (params[i].short_desc, "Frames per period");
-	strcpy (params[i].long_desc, params[i].short_desc);
-	
-	i++;
-	strcpy (params[i].name, "nperiods");
-	params[i].character  = 'n';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 3;
-	strcpy (params[i].short_desc, "Number of periods of playback latency");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "rate");
-	params[i].character  = 'r';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui   = 48000U;
-	strcpy (params[i].short_desc, "Sample rate");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "capture");
-	params[i].character  = 'C';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Provide capture ports.");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "playback");
-	params[i].character  = 'P';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 0;
-	strcpy (params[i].short_desc, "Provide playback ports.");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "duplex");
-	params[i].character  = 'D';
-	params[i].type       = JackDriverParamBool;
-	params[i].value.i    = 1;
-	strcpy (params[i].short_desc, "Provide both capture and playback ports.");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "input-latency");
-	params[i].character  = 'I';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui    = 0;
-	strcpy (params[i].short_desc, "Extra input latency (frames)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-	
-	i++;
-	strcpy (params[i].name, "output-latency");
-	params[i].character  = 'O';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui    = 0;
-	strcpy (params[i].short_desc, "Extra output latency (frames)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-
-	i++;
-	strcpy (params[i].name, "inchannels");
-	params[i].character  = 'i';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui    = 0;
-	strcpy (params[i].short_desc, "Number of input channels to provide (note: currently ignored)");
-	strcpy (params[i].long_desc, params[i].short_desc);
-	
-	i++;
-	strcpy (params[i].name, "outchannels");
-	params[i].character  = 'o';
-	params[i].type       = JackDriverParamUInt;
-	params[i].value.ui    = 0;
-	strcpy (params[i].short_desc, "Number of output channels to provide (note: currently ignored)");
-	strcpy (params[i].long_desc, params[i].short_desc); 
-
-	return desc;
-}
-
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, JSList * params)
-{
-	jack_driver_t *driver;
-
-    unsigned int port=0;
-    unsigned int node_id=-1;
-    int nbitems;
-      
-	const JSList * node;
-	const jack_driver_param_t * param;
-
-	freebob_jack_settings_t cmlparams;
-	
-    char *device_name="hw:0"; 
-      
-	cmlparams.period_size_set=0;
-	cmlparams.sample_rate_set=0;
-	cmlparams.buffer_size_set=0;
-	cmlparams.port_set=0;
-	cmlparams.node_id_set=0;
-
-	/* default values */
-	cmlparams.period_size=1024;
-	cmlparams.sample_rate=48000;
-	cmlparams.buffer_size=3;
-	cmlparams.port=0;
-	cmlparams.node_id=-1;
-	cmlparams.playback_ports=0;
-	cmlparams.capture_ports=0;
-	cmlparams.playback_frame_latency=0;
-	cmlparams.capture_frame_latency=0;
-	
-	for (node = params; node; node = jack_slist_next (node))
-	{
-		param = (jack_driver_param_t *) node->data;
-
-		switch (param->character)
-		{
-		case 'd':
-			device_name = strdup (param->value.str);
-			break;
-		case 'p':
-			cmlparams.period_size = param->value.ui;
-			cmlparams.period_size_set = 1;
-			break;
-		case 'n':
-			cmlparams.buffer_size = param->value.ui;
-			cmlparams.buffer_size_set = 1;
-			break;        
-		case 'r':
-			cmlparams.sample_rate = param->value.ui;
-			cmlparams.sample_rate_set = 1;
-			break;
-		case 'C':
-			cmlparams.capture_ports = 1;
-			break;
-		case 'P':
-			cmlparams.playback_ports = 1;
-			break;
-		case 'D':
-			cmlparams.capture_ports = 1;
-			cmlparams.playback_ports = 1;
-			break;
-		case 'I':
-			cmlparams.capture_frame_latency = param->value.ui;
-			break;
-		case 'O':
-			cmlparams.playback_frame_latency = param->value.ui;
-			break;
-		// ignore these for now
-		case 'i':
-			break;
-		case 'o':
-			break;
-		}
-	}
-
-	/* duplex is the default */
-	if (!cmlparams.playback_ports && !cmlparams.capture_ports) {
-		cmlparams.playback_ports = TRUE;
-		cmlparams.capture_ports = TRUE;
-	}
-
-    nbitems=sscanf(device_name,"hw:%u,%u",&port,&node_id);
-    if (nbitems<2) {
-        nbitems=sscanf(device_name,"hw:%u",&port);
-      
-        if(nbitems < 1) {
-            free(device_name);
-            printError("device (-d) argument not valid\n");
-            return NULL;
-        } else {
-            cmlparams.port = port;
-            cmlparams.port_set=1;
-            
-            cmlparams.node_id = -1;
-            cmlparams.node_id_set=0;
-        }
-     } else {
-        cmlparams.port = port;
-        cmlparams.port_set=1;
-        
-        cmlparams.node_id = node_id;
-        cmlparams.node_id_set=1;
-     }
-
-    jack_error("Freebob using Firewire port %d, node %d",cmlparams.port,cmlparams.node_id);
-    
-	driver=(jack_driver_t *)freebob_driver_new (client, "freebob_pcm", &cmlparams);
-
-	return driver;
-}
-
-void
-driver_finish (jack_driver_t *driver)
-{
-	freebob_driver_t *drv=(freebob_driver_t *) driver;
-	
-	freebob_driver_delete (drv);
-
-}
diff --git a/drivers/freebob/freebob_driver.h b/drivers/freebob/freebob_driver.h
deleted file mode 100644
index fcaf374..0000000
--- a/drivers/freebob/freebob_driver.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/* freebob_driver.h
- *
- *   FreeBob Backend for Jack
- *   FreeBob = Firewire (pro-)audio for linux
- *
- *   http://freebob.sf.net
- *   http://jackit.sf.net
- *
- *   Copyright (C) 2005-2007 Pieter Palmers <pieter.palmers at ffado.org>
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* 
- * Main Jack driver entry routines
- *
- */ 
- 
-#ifndef __JACK_FREEBOB_DRIVER_H__
-#define __JACK_FREEBOB_DRIVER_H__
-
-// Only one of these !
-#define FREEBOB_DRIVER_WITH_ALSA_MIDI
-//#define FREEBOB_DRIVER_WITH_JACK_MIDI
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-		#error "Can't have both ALSA midi and JACK midi defined for the FreeBoB backend"
-	#endif
-#endif
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-	#warning "JACK midi for FreeBoB is experimental and has severe jitter issues."
-#endif
-
-#include <libfreebob/freebob.h>
-#include <libfreebob/freebob_streaming.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdio.h>
-#include <poll.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <endian.h>
-
-#include <pthread.h>
-#include <semaphore.h>
-
-#include <jack/driver.h>
-#include <jack/engine.h>
-#include <jack/types.h>
-
-// debug print control flags
-#define DEBUG_LEVEL_BUFFERS           	(1<<0)
-#define DEBUG_LEVEL_HANDLERS			(1<<1)
-#define DEBUG_LEVEL_XRUN_RECOVERY     	(1<<2)
-#define DEBUG_LEVEL_WAIT     			(1<<3)
-
-#define DEBUG_LEVEL_RUN_CYCLE         	(1<<8)
-
-#define DEBUG_LEVEL_PACKETCOUNTER		(1<<16)
-#define DEBUG_LEVEL_STARTUP				(1<<17)
-#define DEBUG_LEVEL_THREADS				(1<<18)
-
-
-#ifdef DEBUG_ENABLED
-
-	// default debug level
-	#define DEBUG_LEVEL (  DEBUG_LEVEL_RUN_CYCLE | \
-	(DEBUG_LEVEL_XRUN_RECOVERY)| DEBUG_LEVEL_STARTUP | DEBUG_LEVEL_WAIT | DEBUG_LEVEL_PACKETCOUNTER)
-
-	#warning Building debug build!
-
-	#define printMessage(format, args...) jack_error( "FreeBoB MSG: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
-	#define printError(format, args...) jack_error( "FreeBoB ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
-	
-	//#define printEnter() jack_error( "FBDRV ENTERS: %s (%s)\n", __FUNCTION__,  __FILE__)
-	//#define printExit() jack_error( "FBDRV EXITS: %s (%s)\n", __FUNCTION__,  __FILE__)
-	#define printEnter() 
-	#define printExit() 
-	
-	#define debugError(format, args...) jack_error( "FREEBOB ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
-	#define debugPrint(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error("DEBUG %s:%d (%s) :"  format, __FILE__, __LINE__, __FUNCTION__, ##args );
-	#define debugPrintShort(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error( format,##args );
-	#define debugPrintWithTimeStamp(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( "%16lu: "format, debugGetCurrentUTime(),##args );
-	#define SEGFAULT int *test=NULL;	*test=1;
-#else
-	#define DEBUG_LEVEL
-	
-	#define printMessage(format, args...) if(g_verbose) \
-	                                         jack_error("FreeBoB MSG: " format, ##args )
-	#define printError(format, args...)   jack_error("FreeBoB ERR: " format, ##args )
-	
-	#define printEnter() 
-	#define printExit() 
-	
-	#define debugError(format, args...) 
-	#define debugPrint(Level, format, args...) 
-	#define debugPrintShort(Level, format, args...)	
-	#define debugPrintWithTimeStamp(Level, format, args...)
-#endif
-
-// thread priority setup
-#define FREEBOB_RT_PRIORITY_PACKETIZER_RELATIVE	5
-
-// MIDI 
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-
-#include <jack/thread.h>
-#include <alsa/asoundlib.h>
-
-#define ALSA_SEQ_BUFF_SIZE 1024
-#define MIDI_TRANSMIT_BUFFER_SIZE 1024
-#define MIDI_THREAD_SLEEP_TIME_USECS 100
-// midi priority should be higher than the audio priority in order to
-// make sure events are not only delivered on period boundarys
-// but I think it should be smaller than the packetizer thread in order not 
-// to lose any packets
-#define FREEBOB_RT_PRIORITY_MIDI_RELATIVE 	4
-
-#endif // FREEBOB_DRIVER_WITH_ALSA_MIDI
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-
-#include "../alsa-midi/midi_pack.h"
-#include "../alsa-midi/midi_unpack.h"
-#include <jack/midiport.h>
-
-typedef struct freebob_midi_input_port_t {
-	// jack
-	midi_unpack_t unpack;
-	
-	// midi
-	int overruns;
-} freebob_midi_input_port_t;
-
-typedef struct freebob_midi_output_port_t {
-	// jack
-	midi_pack_t packer;
-} freebob_midi_output_port_t;
-
-#endif // FREEBOB_DRIVER_WITH_JACK_MIDI
-
-
-typedef struct _freebob_driver freebob_driver_t;
-
-/*
- * Jack Driver command line parameters
- */
-
-typedef struct _freebob_jack_settings freebob_jack_settings_t;
-struct _freebob_jack_settings {
-	int period_size_set;
-	jack_nframes_t period_size;
-	
-	int sample_rate_set;
-	int sample_rate;
-	
-	int buffer_size_set;
-	jack_nframes_t buffer_size;
-
-	int port_set;
-	int port;
-	
-	int node_id_set;
-	int node_id;
-
-	int playback_ports;
-	int capture_ports;
-	
-	jack_nframes_t capture_frame_latency;
-	jack_nframes_t playback_frame_latency;
-
-	freebob_handle_t fb_handle;
-};
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-
-
-typedef struct {
-	int stream_nr;
-	int seq_port_nr;
-	snd_midi_event_t *parser;
-	snd_seq_t *seq_handle;
-} freebob_midi_port_t;
-
-typedef struct _freebob_driver_midi_handle {
-	freebob_device_t *dev;
-	freebob_driver_t *driver;
-
-	snd_seq_t *seq_handle;
-	
-	pthread_t queue_thread;
-	pthread_t dequeue_thread;
-	int queue_thread_realtime;
-	int queue_thread_priority;
-
-	int nb_input_ports;
-	int nb_output_ports;
-
-	freebob_midi_port_t **input_ports;
-	freebob_midi_port_t **output_ports;
-
-	freebob_midi_port_t **input_stream_port_map;
-	int *output_port_stream_map;
-
-
-} freebob_driver_midi_handle_t;
-
-#endif
-/*
- * JACK driver structure
- */
- 
-
-struct _freebob_driver
-{
-	JACK_DRIVER_NT_DECL
-	
-	jack_nframes_t  sample_rate;
-	jack_nframes_t  period_size;
-	unsigned long   wait_time;
-
-	jack_time_t                   wait_last;
-	jack_time_t                   wait_next;
-	int wait_late;
-	
-	jack_client_t  *client;
-	
-	int		xrun_detected;
-	int		xrun_count;
-	
-	int process_count;
-	
-	/* settings from the command line */
-	freebob_jack_settings_t settings;
-	
-	/* the freebob virtual device */
-	freebob_device_t *dev;
-	
-	JSList                       *capture_ports;
-	JSList                       *playback_ports;
-	JSList                       *monitor_ports;
-	channel_t                     playback_nchannels;
-	channel_t                     capture_nchannels;
-
-	jack_nframes_t  playback_frame_latency;
-	jack_nframes_t  capture_frame_latency;
-
-	freebob_device_info_t device_info;
-	freebob_options_t device_options;
-
-#ifdef FREEBOB_DRIVER_WITH_ALSA_MIDI
-	freebob_driver_midi_handle_t *midi_handle;
-#endif
-
-#ifdef FREEBOB_DRIVER_WITH_JACK_MIDI
-	freebob_midi_input_port_t  *midi_in_ports;
-	freebob_midi_output_port_t *midi_out_ports;
-#endif
-
-
-}; 
-
-
-
-#endif /* __JACK_FREEBOB_DRIVER_H__ */
-
-
diff --git a/drivers/netjack/Makefile.am b/drivers/netjack/Makefile.am
deleted file mode 100644
index e969011..0000000
--- a/drivers/netjack/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-MAINTAINCLEANFILES = Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS) 
-
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_net.la
-
-jack_net_la_LDFLAGS = -module -avoid-version @NETJACK_LIBS@
-jack_net_la_CFLAGS = @NETJACK_CFLAGS@
-jack_net_la_SOURCES = net_driver.c netjack_packet.c netjack.c
-
-noinst_HEADERS = netjack.h net_driver.h netjack_packet.h
-
diff --git a/drivers/netjack/README b/drivers/netjack/README
deleted file mode 100644
index 21777bc..0000000
--- a/drivers/netjack/README
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-see the updated docs on http://netjack.sf.net please.
-
-or mail me (torbenh at gmx.de) if you have questions.
-this Release has the tightest jack sync ever :)
-                       
-                        ---  netJack    ---
-                        -   v0.5pre1 2005    -
-
-|| AUTHORS(s):
-
-Torben Hohn
-Dan Mills
-Robert Jonsson
-
-
-|| CHANGES
-
-cvs -th-
-    fixed hardcoeded number of channels.
-    started 
-
-cvs -th-
-    added packet_hdr
-    which needs to be htonled..
-
-cvs -rj-
-    added Sconstruct
-    added htonl() usage for crossplatform communication.
-
-0.41   - rj -
-    added missing Makefile.am
-    added some configurability to udpsync_source
-    
-0.4    - rj - 
-    support for stereo
-    support for duplex
-... older ... lost in time
-       
-|| WHAT IS THIS?
-
-jack_net is a backend driver for Jack that takes on the role of a
-sound card. This machine is generally designated as the slave machine.
-
-jacknet_client is a jack application that shall be run from another
-computer with the ip adress of the other machine as argument. This
-machine is generalled designated as the master machine.
-
-
-|| PREREQUISITES
-
-Two machines with a _good_ network connection between them.
-A Jack (http://jackit.sf.net) source package.
-
-
-|| INSTALLATION:
-
-compile with 
-scons jack_source_dir='path/to/jack-src'
-
-this creates jack_net.so.
-copy this to /lib/jack/drivers or wherever jack looks for driver.so`s
-
-it also creates jacknet_client. a normal program.
-
-if you build on OSX you need to add 
-
-with_alsa=0 
-
-
-|| USAGE
-
-The programs will open a bidirectional connection between the two
-machines (using UDP). Exposing a stereopair both ways.
-
-The udpsync_source needs the slave machine as a parameter.
-
-The alsa-client is a nice thing also, it makes a not jack related 
-alsa-card available for capturing under jack.
-
-Best performance is achieved if connecting the machines with an
- XOVER cable, omitting switches / hubs / other nasty things.
-
-|| KNOWN ISSUES
-
-While running with full duplex, utilizing the slave machine as an
-outboard effect it seems very hard (atleast with my network with a
-cheap switch inbetween) to use buffers below 512. Sometimes 256 
-is usable for a while. 
-While connecting ports on the slave side it is very prone to 
-crash if the buffers are small.
-
-The jitter of a wlan network is a little too hard for the current 
-sync code. A delay locked loop might be used soon.
-
-There is always atleast one buffers delay if a port is routed back
-through the connection. This is a design issue that might be hard
-to remedy.
-
-
-|| LICENSE
-
-this is free software under the GPL license, see the file COPYING.
-
diff --git a/drivers/netjack/net_driver.c b/drivers/netjack/net_driver.c
deleted file mode 100644
index f3ea260..0000000
--- a/drivers/netjack/net_driver.c
+++ /dev/null
@@ -1,681 +0,0 @@
-/* -*- mode: c; c-file-style: "linux"; -*- */
-/*
-NetJack Driver
-
-Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
-Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
-Copyright (C) 2003 Robert Ham <rah at bash.sh>
-Copyright (C) 2001 Paul Davis
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-$Id: net_driver.c,v 1.17 2006/04/16 20:16:10 torbenh Exp $
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-
-#include <jack/types.h>
-#include <jack/engine.h>
-#include <sysdeps/time.h>
-
-#include <sys/types.h>
-
-#include "config.h"
-
-
-#include "netjack.h"
-#include "netjack_packet.h"
-#include "net_driver.h"
-
-#undef DEBUG_WAKEUP
-
-
-#define MIN(x,y) ((x)<(y) ? (x) : (y))
-
-static jack_transport_state_t last_transport_state;
-static int sync_state = TRUE;
-
-static jack_nframes_t
-net_driver_wait (net_driver_t *driver, int extra_fd, int *status, float *delayed_usecs)
-{
-    netjack_driver_state_t *netj = &( driver->netj );
-    int delay;
-
-    delay = netjack_wait( netj );
-    if( delay ) {
-	    //driver->engine->delay( driver->engine, (float)delay );
-	    jack_error( "netxruns amount: %dms", delay/1000 );
-    }
-
-    
-    driver->last_wait_ust = jack_get_microseconds ();
-    driver->engine->transport_cycle_start (driver->engine, driver->last_wait_ust);
-
-    /* this driver doesn't work so well if we report a delay */
-    /* XXX: this might not be the case anymore */
-    /*      the delayed _usecs is a resync or something. */
-    *delayed_usecs = 0;		/* lie about it */
-    *status = 0;
-    return netj->period_size;
-}
-
-static int
-net_driver_run_cycle (net_driver_t *driver)
-{
-    jack_engine_t *engine = driver->engine;
-    //netjack_driver_state_t *netj = &(driver->netj);
-    int wait_status = -1;
-    float delayed_usecs;
-
-    jack_nframes_t nframes = net_driver_wait (driver, -1, &wait_status,
-                             &delayed_usecs);
-
-    // XXX: xrun code removed.
-    //      especially with celt there are no real xruns anymore.
-    //      things are different on the net.
-
-    if (wait_status == 0)
-        return engine->run_cycle (engine, nframes, delayed_usecs);
-
-    if (wait_status < 0)
-        return -1;
-    else
-        return 0;
-}
-
-static int
-net_driver_null_cycle (net_driver_t* driver, jack_nframes_t nframes)
-{
-    // TODO: talk to paul about this.
-    //       do i wait here ?
-    //       just sending out a packet marked with junk ?
-
-    netjack_driver_state_t *netj = &(driver->netj);
-    int sync_state = (driver->engine->control->sync_remain <= 1);
-    netjack_send_silence( netj, sync_state );
-
-    return 0;
-}
-
-static int
-net_driver_bufsize (net_driver_t* driver, jack_nframes_t nframes)
-{
-    netjack_driver_state_t *netj = &(driver->netj);
-    if (nframes != netj->period_size)
-        return EINVAL;
-
-    return 0;
-}
-
-static int
-net_driver_read (net_driver_t* driver, jack_nframes_t nframes)
-{
-    netjack_driver_state_t *netj = &(driver->netj);
-
-    jack_position_t local_trans_pos;
-    jack_transport_state_t local_trans_state;
-
-    unsigned int *packet_buf, *packet_bufX;
-
-    if( ! netj->packet_data_valid ) {
-	render_payload_to_jack_ports (netj->bitdepth, NULL, netj->net_period_down, netj->capture_ports, netj->capture_srcs, nframes, netj->dont_htonl_floats );
-	return 0;
-    }
-    packet_buf = netj->rx_buf;
-
-    jacknet_packet_header *pkthdr = (jacknet_packet_header *)packet_buf;
-
-    packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
-
-    netj->reply_port = pkthdr->reply_port;
-    netj->latency = pkthdr->latency;
-
-    // Special handling for latency=0
-    if( netj->latency == 0 )
-	netj->resync_threshold = 0;
-    else
-	netj->resync_threshold = MIN( 15, pkthdr->latency-1 );
-
-    // check whether, we should handle the transport sync stuff, or leave trnasports untouched.
-    if (netj->handle_transport_sync) {
-	int compensated_tranport_pos = (pkthdr->transport_frame + (pkthdr->latency * nframes) + netj->codec_latency);
-
-        // read local transport info....
-        local_trans_state = jack_transport_query(netj->client, &local_trans_pos);
-
-        // Now check if we have to start or stop local transport to sync to remote...
-        switch (pkthdr->transport_state) {
-            case JackTransportStarting:
-                // the master transport is starting... so we set our reply to the sync_callback;
-                if (local_trans_state == JackTransportStopped) {
-                    jack_transport_start(netj->client);
-                    last_transport_state = JackTransportStopped;
-                    sync_state = FALSE;
-                    jack_info("locally stopped... starting...");
-                }
-
-                if (local_trans_pos.frame != compensated_tranport_pos)
-		{
-                    jack_transport_locate(netj->client, compensated_tranport_pos);
-                    last_transport_state = JackTransportRolling;
-                    sync_state = FALSE;
-                    jack_info("starting locate to %d", compensated_tranport_pos );
-                }
-                break;
-            case JackTransportStopped:
-                sync_state = TRUE;
-                if (local_trans_pos.frame != (pkthdr->transport_frame)) {
-                    jack_transport_locate(netj->client, (pkthdr->transport_frame));
-                    jack_info("transport is stopped locate to %d", pkthdr->transport_frame);
-                }
-                if (local_trans_state != JackTransportStopped)
-                    jack_transport_stop(netj->client);
-                break;
-            case JackTransportRolling:
-                sync_state = TRUE;
-//		    		if(local_trans_pos.frame != (pkthdr->transport_frame + (pkthdr->latency) * nframes)) {
-//				    jack_transport_locate(netj->client, (pkthdr->transport_frame + (pkthdr->latency + 2) * nframes));
-//				    jack_info("running locate to %d", pkthdr->transport_frame + (pkthdr->latency)*nframes);
-//		    		}
-                if (local_trans_state != JackTransportRolling)
-                    jack_transport_start (netj->client);
-                break;
-
-            case JackTransportLooping:
-                break;
-        }
-    }
-
-    render_payload_to_jack_ports (netj->bitdepth, packet_bufX, netj->net_period_down, netj->capture_ports, netj->capture_srcs, nframes, netj->dont_htonl_floats );
-    packet_cache_release_packet(global_packcache, netj->expected_framecnt );
-
-    return 0;
-}
-
-static int
-net_driver_write (net_driver_t* driver, jack_nframes_t nframes)
-{
-    netjack_driver_state_t *netj = &(driver->netj);
-
-    int sync_state = (driver->engine->control->sync_remain <= 1);;
-
-    uint32_t *packet_buf, *packet_bufX;
-
-    int packet_size = get_sample_size(netj->bitdepth) * netj->playback_channels * netj->net_period_up + sizeof(jacknet_packet_header);
-    jacknet_packet_header *pkthdr; 
-
-    packet_buf = alloca(packet_size);
-    pkthdr = (jacknet_packet_header *)packet_buf;
-
-    if( netj->running_free ) {
-	return 0;
-    }
-
-    // offset packet_bufX by the packetheader.
-    packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
-
-    pkthdr->sync_state = sync_state;
-    pkthdr->latency = netj->time_to_deadline;
-    //printf( "time to deadline = %d  goodness=%d\n", (int)netj->time_to_deadline, netj->deadline_goodness );
-    pkthdr->framecnt = netj->expected_framecnt;
-
-
-    render_jack_ports_to_payload(netj->bitdepth, netj->playback_ports, netj->playback_srcs, nframes, packet_bufX, netj->net_period_up, netj->dont_htonl_floats );
-
-    packet_header_hton(pkthdr);
-    if (netj->srcaddress_valid)
-    {
-	int r;
-
-#ifndef MSG_CONFIRM
-	static const int flag = 0;
-#else
-	static const int flag = MSG_CONFIRM;
-#endif
-
-        if (netj->reply_port)
-            netj->syncsource_address.sin_port = htons(netj->reply_port);
-
-	for( r=0; r<netj->redundancy; r++ )
-	    netjack_sendto(netj->sockfd, (char *)packet_buf, packet_size,
-			   flag, (struct sockaddr*)&(netj->syncsource_address), sizeof(struct sockaddr_in), netj->mtu);
-    }
-
-    return 0;
-}
-
-
-static int
-net_driver_attach (net_driver_t *driver)
-{
-    netjack_driver_state_t *netj = &( driver->netj );
-    driver->engine->set_buffer_size (driver->engine, netj->period_size);
-    driver->engine->set_sample_rate (driver->engine, netj->sample_rate);
-
-    netjack_attach( netj );
-    return 0;
-}
-
-static int
-net_driver_detach (net_driver_t *driver)
-{
-    netjack_driver_state_t *netj = &( driver->netj );
-
-    if (driver->engine == 0)
-        return 0;
-
-    netjack_detach( netj );
-    return 0;
-}
-
-static void
-net_driver_delete (net_driver_t *driver)
-{
-    netjack_driver_state_t *netj = &( driver->netj );
-    netjack_release( netj );
-    jack_driver_nt_finish ((jack_driver_nt_t *) driver);
-    free (driver);
-}
-
-static jack_driver_t *
-net_driver_new (jack_client_t * client,
-                char *name,
-                unsigned int capture_ports,
-                unsigned int playback_ports,
-                unsigned int capture_ports_midi,
-                unsigned int playback_ports_midi,
-                jack_nframes_t sample_rate,
-                jack_nframes_t period_size,
-                unsigned int listen_port,
-                unsigned int transport_sync,
-                unsigned int resample_factor,
-                unsigned int resample_factor_up,
-                unsigned int bitdepth,
-		unsigned int use_autoconfig,
-		unsigned int latency,
-		unsigned int redundancy,
-		int dont_htonl_floats,
-		int always_deadline,
-		int jitter_val)
-{
-    net_driver_t * driver;
-
-    jack_info ("creating net driver ... %s|%" PRIu32 "|%" PRIu32
-            "|%u|%u|%u|transport_sync:%u", name, sample_rate, period_size, listen_port,
-            capture_ports, playback_ports, transport_sync);
-
-    driver = (net_driver_t *) calloc (1, sizeof (net_driver_t));
-
-    jack_driver_nt_init ((jack_driver_nt_t *) driver);
-
-    driver->write         = (JackDriverWriteFunction)      net_driver_write;
-    driver->read          = (JackDriverReadFunction)       net_driver_read;
-    driver->null_cycle    = (JackDriverNullCycleFunction)  net_driver_null_cycle;
-    driver->nt_attach     = (JackDriverNTAttachFunction)   net_driver_attach;
-    driver->nt_detach     = (JackDriverNTDetachFunction)   net_driver_detach;
-    driver->nt_bufsize    = (JackDriverNTBufSizeFunction)  net_driver_bufsize;
-    driver->nt_run_cycle  = (JackDriverNTRunCycleFunction) net_driver_run_cycle;
-
-    driver->last_wait_ust = 0;
-    driver->engine = NULL;
-
-    netjack_driver_state_t *netj = &(driver->netj);
-
-    netjack_init ( netj,
-		client,
-                name,
-                capture_ports,
-                playback_ports,
-                capture_ports_midi,
-                playback_ports_midi,
-                sample_rate,
-                period_size,
-                listen_port,
-                transport_sync,
-                resample_factor,
-                resample_factor_up,
-                bitdepth,
-		use_autoconfig,
-		latency,
-		redundancy,
-		dont_htonl_floats,
-	        always_deadline, 
-		jitter_val	);
-
-    netjack_startup( netj );
-
-    jack_info ("netjack: period   : up: %d / dn: %d", netj->net_period_up, netj->net_period_down);
-    jack_info ("netjack: framerate: %d", netj->sample_rate);
-    jack_info ("netjack: audio    : cap: %d / pbk: %d)", netj->capture_channels_audio, netj->playback_channels_audio);
-    jack_info ("netjack: midi     : cap: %d / pbk: %d)", netj->capture_channels_midi, netj->playback_channels_midi);
-    jack_info ("netjack: buffsize : rx: %d)", netj->rx_bufsize);
-    driver->period_usecs = netj->period_usecs;
-
-    return (jack_driver_t *) driver;
-}
-
-/* DRIVER "PLUGIN" INTERFACE */
-
-jack_driver_desc_t *
-driver_get_descriptor ()
-{
-    jack_driver_desc_t * desc;
-    jack_driver_param_desc_t * params;
-    unsigned int i;
-
-    desc = calloc (1, sizeof (jack_driver_desc_t));
-    strcpy (desc->name, "net");
-    desc->nparams = 18;
-
-    params = calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
-
-    i = 0;
-    strcpy (params[i].name, "audio-ins");
-    params[i].character  = 'i';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 2U;
-    strcpy (params[i].short_desc, "Number of capture channels (defaults to 2)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "audio-outs");
-    params[i].character  = 'o';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 2U;
-    strcpy (params[i].short_desc, "Number of playback channels (defaults to 2)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "midi-ins");
-    params[i].character  = 'I';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1U;
-    strcpy (params[i].short_desc, "Number of midi capture channels (defaults to 1)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "midi-outs");
-    params[i].character  = 'O';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1U;
-    strcpy (params[i].short_desc, "Number of midi playback channels (defaults to 1)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "rate");
-    params[i].character  = 'r';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 48000U;
-    strcpy (params[i].short_desc, "Sample rate");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "period");
-    params[i].character  = 'p';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1024U;
-    strcpy (params[i].short_desc, "Frames per period");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "num-periods");
-    params[i].character  = 'n';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 5U;
-    strcpy (params[i].short_desc,
-            "Network latency setting in no. of periods");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "listen-port");
-    params[i].character  = 'l';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 3000U;
-    strcpy (params[i].short_desc,
-            "The socket port we are listening on for sync packets");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "factor");
-    params[i].character  = 'f';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1U;
-    strcpy (params[i].short_desc,
-            "Factor for sample rate reduction (deprecated)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "upstream-factor");
-    params[i].character  = 'u';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 0U;
-    strcpy (params[i].short_desc,
-            "Factor for sample rate reduction on the upstream (deprecated)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "celt");
-    params[i].character  = 'c';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 0U;
-    strcpy (params[i].short_desc,
-            "sets celt encoding and kbits value one channel is encoded at");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "bit-depth");
-    params[i].character  = 'b';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 0U;
-    strcpy (params[i].short_desc,
-            "Sample bit-depth (0 for float, 8 for 8bit and 16 for 16bit)");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "transport-sync");
-    params[i].character  = 't';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1U;
-    strcpy (params[i].short_desc,
-            "Whether to slave the transport to the master transport");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "autoconf");
-    params[i].character  = 'a';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1U;
-    strcpy (params[i].short_desc,
-            "Whether to use Autoconfig, or just start.");
-    strcpy (params[i].long_desc, params[i].short_desc);
-    i++;
-    strcpy (params[i].name, "redundancy");
-    params[i].character  = 'R';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 1U;
-    strcpy (params[i].short_desc,
-            "Send packets N times");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "native-endian");
-    params[i].character  = 'e';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 0U;
-    strcpy (params[i].short_desc,
-            "Don't convert samples to network byte order.");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "jitterval");
-    params[i].character  = 'J';
-    params[i].type       = JackDriverParamInt;
-    params[i].value.i   = 0;
-    strcpy (params[i].short_desc,
-            "attempted jitterbuffer microseconds on master");
-    strcpy (params[i].long_desc, params[i].short_desc);
-
-    i++;
-    strcpy (params[i].name, "always-deadline");
-    params[i].character  = 'D';
-    params[i].type       = JackDriverParamUInt;
-    params[i].value.ui   = 0U;
-    strcpy (params[i].short_desc,
-            "Always wait until deadline");
-    strcpy (params[i].long_desc, params[i].short_desc);
-    desc->params = params;
-
-    return desc;
-}
-
-const char driver_client_name[] = "net_pcm";
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, const JSList * params)
-{
-    jack_nframes_t sample_rate = 48000;
-    jack_nframes_t resample_factor = 1;
-    jack_nframes_t period_size = 1024;
-    unsigned int capture_ports = 2;
-    unsigned int playback_ports = 2;
-    unsigned int capture_ports_midi = 1;
-    unsigned int playback_ports_midi = 1;
-    unsigned int listen_port = 3000;
-    unsigned int resample_factor_up = 0;
-    unsigned int bitdepth = 0;
-    unsigned int handle_transport_sync = 1;
-    unsigned int use_autoconfig = 1;
-    unsigned int latency = 5;
-    unsigned int redundancy = 1;
-    int dont_htonl_floats = 0;
-    int always_deadline = 0;
-    int jitter_val = 0;
-    const JSList * node;
-    const jack_driver_param_t * param;
-
-    for (node = params; node; node = jack_slist_next (node)) {
-        param = (const jack_driver_param_t *) node->data;
-
-        switch (param->character) {
-
-            case 'i':
-                capture_ports = param->value.ui;
-                break;
-
-            case 'o':
-                playback_ports = param->value.ui;
-                break;
-
-            case 'I':
-                capture_ports_midi = param->value.ui;
-                break;
-
-            case 'O':
-                playback_ports_midi = param->value.ui;
-                break;
-
-            case 'r':
-                sample_rate = param->value.ui;
-                break;
-
-            case 'p':
-                period_size = param->value.ui;
-                break;
-
-            case 'l':
-                listen_port = param->value.ui;
-                break;
-
-            case 'f':
-#if HAVE_SAMPLERATE
-                resample_factor = param->value.ui;
-#else
-		printf( "not built with libsamplerate support\n" );
-		exit(10);
-#endif
-                break;
-
-            case 'u':
-#if HAVE_SAMPLERATE
-                resample_factor_up = param->value.ui;
-#else
-		printf( "not built with libsamplerate support\n" );
-		exit(10);
-#endif
-                break;
-
-            case 'b':
-                bitdepth = param->value.ui;
-                break;
-
-	    case 'c':
-#if HAVE_CELT
-		bitdepth = 1000;
-		resample_factor = param->value.ui;
-#else
-		printf( "not built with celt support\n" );
-		exit(10);
-#endif
-		break;
-
-            case 't':
-                handle_transport_sync = param->value.ui;
-                break;
-
-            case 'a':
-                use_autoconfig = param->value.ui;
-                break;
-
-            case 'n':
-                latency = param->value.ui;
-                break;
-
-            case 'R':
-                redundancy = param->value.ui;
-                break;
-
-            case 'e':
-                dont_htonl_floats = param->value.ui;
-                break;
-            case 'J':
-                jitter_val = param->value.i;
-                break;
-            case 'D':
-                always_deadline = param->value.ui;
-                break;
-        }
-    }
-
-    return net_driver_new (client, "net_pcm", capture_ports, playback_ports,
-                           capture_ports_midi, playback_ports_midi,
-                           sample_rate, period_size,
-                           listen_port, handle_transport_sync,
-                           resample_factor, resample_factor_up, bitdepth,
-			   use_autoconfig, latency, redundancy,
-			   dont_htonl_floats, always_deadline, jitter_val);
-}
-
-void
-driver_finish (jack_driver_t *driver)
-{
-    net_driver_delete ((net_driver_t *) driver);
-}
diff --git a/drivers/netjack/net_driver.h b/drivers/netjack/net_driver.h
deleted file mode 100644
index 9f12882..0000000
--- a/drivers/netjack/net_driver.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-    Copyright (C) 2003 Robert Ham <rah at bash.sh>
-    Copyright (C) 2005 Torben Hohn <torbenh at gmx.de>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-
-#ifndef __JACK_NET_DRIVER_H__
-#define __JACK_NET_DRIVER_H__
-
-#include <unistd.h>
-
-#include <jack/types.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-#include <jack/transport.h>
-
-#include <netinet/in.h>
-
-#include "netjack.h"
-
-typedef struct _net_driver net_driver_t;
-
-struct _net_driver
-{
-    JACK_DRIVER_NT_DECL;
-
-    netjack_driver_state_t netj;
-};
-
-#endif /* __JACK_NET_DRIVER_H__ */
diff --git a/drivers/netjack/netjack.c b/drivers/netjack/netjack.c
deleted file mode 100644
index 468bd58..0000000
--- a/drivers/netjack/netjack.c
+++ /dev/null
@@ -1,753 +0,0 @@
-
-/* -*- mode: c; c-file-style: "linux"; -*- */
-/*
-NetJack Abstraction.
-
-Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
-Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
-Copyright (C) 2003 Robert Ham <rah at bash.sh>
-Copyright (C) 2001 Paul Davis
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-$Id: net_driver.c,v 1.17 2006/04/16 20:16:10 torbenh Exp $
-*/
-
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-
-#include <jack/types.h>
-// for jack_error in jack1
-#include <jack/internal.h>
-
-#include "jack/jslist.h"
-
-#include <sys/types.h>
-
-#ifdef WIN32
-#include <winsock.h>
-#include <malloc.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#endif
-
-#include "netjack.h"
-
-#include "config.h"
-
-#if HAVE_SAMPLERATE
-#include <samplerate.h>
-#endif
-
-#if HAVE_CELT
-#include <celt/celt.h>
-#endif
-
-#include "netjack.h"
-#include "netjack_packet.h"
-
-// JACK2
-//#include "jack/control.h"
-
-#define MIN(x,y) ((x)<(y) ? (x) : (y))
-
-static int sync_state = 1;
-static jack_transport_state_t last_transport_state;
-
-static int
-net_driver_sync_cb(jack_transport_state_t state, jack_position_t *pos, void *data)
-{
-    int retval = sync_state;
-
-    if (state == JackTransportStarting && last_transport_state != JackTransportStarting) {
-        retval = 0;
-    }
-//    if (state == JackTransportStarting)
-//		jack_info("Starting sync_state = %d", sync_state);
-    last_transport_state = state;
-    return retval;
-}
-
-int netjack_wait( netjack_driver_state_t *netj )
-{
-    int we_have_the_expected_frame = 0;
-    jack_nframes_t next_frame_avail;
-    jack_time_t packet_recv_time_stamp;
-    jacknet_packet_header *pkthdr;
-
-    if( !netj->next_deadline_valid ) {
-	    netj->next_deadline = jack_get_time() + netj->deadline_offset;
-	    netj->next_deadline_valid = 1;
-    }
-
-    // Increment expected frame here.
-
-    if( netj->expected_framecnt_valid ) {
-	netj->expected_framecnt += 1;
-    } else {
-	// starting up.... lets look into the packetcache, and fetch the highest packet.
-	packet_cache_drain_socket( global_packcache, netj->sockfd );
-	if( packet_cache_get_highest_available_framecnt( global_packcache, &next_frame_avail ) ) {
-	    netj->expected_framecnt = next_frame_avail;
-	    netj->expected_framecnt_valid = 1;
-	} else {
-	    // no packets there... start normally.
-	    netj->expected_framecnt = 0;
-	    netj->expected_framecnt_valid = 1;
-	}
-
-    }
-
-    //jack_log( "expect %d", netj->expected_framecnt );
-    // Now check if required packet is already in the cache.
-    // then poll (have deadline calculated)
-    // then drain socket, rinse and repeat.
-    while(1) {
-	if( packet_cache_get_next_available_framecnt( global_packcache, netj->expected_framecnt, &next_frame_avail) ) {
-	    if( next_frame_avail == netj->expected_framecnt ) {
-		we_have_the_expected_frame = 1;
-		if( !netj->always_deadline )
-			break;
-	    }
-	}
-	if( ! netjack_poll_deadline( netj->sockfd, netj->next_deadline ) ) {
-	    break;
-	}
-
-	packet_cache_drain_socket( global_packcache, netj->sockfd );
-    }
-
-    // check if we know who to send our packets too.
-    if (!netj->srcaddress_valid)
-	if( global_packcache->master_address_valid ) {
-	    memcpy (&(netj->syncsource_address), &(global_packcache->master_address), sizeof( struct sockaddr_in ) );
-	    netj->srcaddress_valid = 1;
-	}
-
-    // XXX: switching mode unconditionally is stupid.
-    //      if we were running free perhaps we like to behave differently
-    //      ie. fastforward one packet etc.
-    //      well... this is the first packet we see. hmm.... dunno ;S
-    //      it works... so...
-    netj->running_free = 0;
-
-    //if( !we_have_the_expected_frame )
-    //    jack_error( "netxrun... %d", netj->expected_framecnt );
-
-    if( we_have_the_expected_frame ) {
-
-	jack_time_t now =  jack_get_time();
-	if( now < netj->next_deadline )
-		netj->time_to_deadline = netj->next_deadline - now;
-	else
-		netj->time_to_deadline = 0;
-
-	packet_cache_retreive_packet_pointer( global_packcache, netj->expected_framecnt, (char **) &(netj->rx_buf), netj->rx_bufsize , &packet_recv_time_stamp);
-	pkthdr = (jacknet_packet_header *) netj->rx_buf;
-	packet_header_ntoh(pkthdr);
-	netj->deadline_goodness = (int)pkthdr->sync_state;
-	netj->packet_data_valid = 1;
-
-	int want_deadline;
-	if( netj->jitter_val != 0 ) 
-		want_deadline = netj->jitter_val;
-	else if( netj->latency < 4 )
-		want_deadline = -netj->period_usecs/2;
-	else
-		want_deadline = (netj->period_usecs/4+10*(int)netj->period_usecs*netj->latency/100);
-
-	if( netj->deadline_goodness != MASTER_FREEWHEELS ) {
-		if( netj->deadline_goodness < want_deadline ) {
-			netj->deadline_offset -= netj->period_usecs/100;
-			//jack_log( "goodness: %d, Adjust deadline: --- %d\n", netj->deadline_goodness, (int) netj->period_usecs*netj->latency/100 );
-		}
-		if( netj->deadline_goodness > want_deadline ) {
-			netj->deadline_offset += netj->period_usecs/100;
-			//jack_log( "goodness: %d, Adjust deadline: +++ %d\n", netj->deadline_goodness, (int) netj->period_usecs*netj->latency/100 );
-		}
-	}
-	if( netj->deadline_offset < (netj->period_usecs*70/100) ) {
-		jack_error( "master is forcing deadline_offset to below 70%% of period_usecs... increase latency setting on master" );
-		netj->deadline_offset = (netj->period_usecs*90/100);
-	}
-
-	netj->next_deadline = jack_get_time() + netj->deadline_offset;
-    } else {
-	netj->time_to_deadline = 0;
-	netj->next_deadline = jack_get_time() + netj->deadline_offset;
-	// bah... the packet is not there.
-	// either
-	// - it got lost.
-	// - its late
-	// - sync source is not sending anymore.
-
-	// lets check if we have the next packets, we will just run a cycle without data.
-	// in that case.
-
-	if( packet_cache_get_next_available_framecnt( global_packcache, netj->expected_framecnt, &next_frame_avail) )
-	{
-	    jack_nframes_t offset = next_frame_avail - netj->expected_framecnt;
-
-	    //XXX: hmm... i need to remember why resync_threshold wasnt right.
-	    //if( offset < netj->resync_threshold )
-	    if( offset < 10 ) {
-		// ok. dont do nothing. we will run without data.
-		// this seems to be one or 2 lost packets.
-		//
-		// this can also be reordered packet jitter.
-		// (maybe this is not happening in real live)
-		//  but it happens in netem.
-
-		netj->packet_data_valid = 0;
-
-		// I also found this happening, when the packet queue, is too full.
-		// but wtf ? use a smaller latency. this link can handle that ;S
-		if( packet_cache_get_fill( global_packcache, netj->expected_framecnt ) > 80.0 )
-		    netj->next_deadline -= netj->period_usecs/2;
-
-
-	    } else {
-		// the diff is too high. but we have a packet in the future.
-		// lets resync.
-		netj->expected_framecnt = next_frame_avail;
-		packet_cache_retreive_packet_pointer( global_packcache, netj->expected_framecnt, (char **) &(netj->rx_buf), netj->rx_bufsize, NULL );
-		pkthdr = (jacknet_packet_header *) netj->rx_buf;
-		packet_header_ntoh(pkthdr);
-		//netj->deadline_goodness = 0;
-		netj->deadline_goodness = (int)pkthdr->sync_state - (int)netj->period_usecs * offset;
-		netj->next_deadline_valid = 0;
-		netj->packet_data_valid = 1;
-	    }
-
-	} else {
-	    // no packets in buffer.
-	    netj->packet_data_valid = 0;
-
-	    //printf( "frame %d No Packet in queue. num_lost_packets = %d \n", netj->expected_framecnt, netj->num_lost_packets );
-	    if( netj->num_lost_packets < 5 ) {
-		// ok. No Packet in queue. The packet was either lost,
-		// or we are running too fast.
-		//
-		// Adjusting the deadline unconditionally resulted in
-		// too many xruns on master.
-		// But we need to adjust for the case we are running too fast.
-		// So lets check if the last packet is there now.
-		//
-		// It would not be in the queue anymore, if it had been
-		// retrieved. This might break for redundancy, but
-		// i will make the packet cache drop redundant packets,
-		// that have already been retreived.
-		//
-		if( packet_cache_get_highest_available_framecnt( global_packcache, &next_frame_avail) ) {
-		    if( next_frame_avail == (netj->expected_framecnt - 1) ) {
-			// Ok. the last packet is there now.
-			// and it had not been retrieved.
-			//
-			// TODO: We are still dropping 2 packets.
-			//       perhaps we can adjust the deadline
-			//       when (num_packets lost == 0)
-
-			// This might still be too much.
-			netj->next_deadline += netj->period_usecs;
-		    }
-		}
-	    } else if( (netj->num_lost_packets <= 100) ) {
-		// lets try adjusting the deadline harder, for some packets, we might have just ran 2 fast.
-		netj->next_deadline += netj->period_usecs*netj->latency/8;
-	    } else {
-
-		// But now we can check for any new frame available.
-		//
-		if( packet_cache_get_highest_available_framecnt( global_packcache, &next_frame_avail) ) {
-		    netj->expected_framecnt = next_frame_avail;
-		    packet_cache_retreive_packet_pointer( global_packcache, netj->expected_framecnt, (char **) &(netj->rx_buf), netj->rx_bufsize, NULL );
-		    pkthdr = (jacknet_packet_header *) netj->rx_buf;
-		    packet_header_ntoh(pkthdr);
-		    netj->deadline_goodness = pkthdr->sync_state;
-		    netj->next_deadline_valid = 0;
-		    netj->packet_data_valid = 1;
-		    netj->running_free = 0;
-		    jack_info( "resync after freerun... %d", netj->expected_framecnt );
-		} else {
-		    if( netj->num_lost_packets == 101 ) {
-			jack_info( "master seems gone... entering freerun mode", netj->expected_framecnt );
-		    }
-
-		    netj->running_free = 1;
-
-		    // when we really dont see packets.
-		    // reset source address. and open possibility for new master.
-		    // maybe dsl reconnect. Also restart of netsource without fix
-		    // reply address changes port.
-		    if (netj->num_lost_packets > 200 ) {
-			netj->srcaddress_valid = 0;
-			packet_cache_reset_master_address( global_packcache );
-		    }
-		}
-	    }
-	}
-    }
-
-    int retval = 0;
-
-    if( !netj->packet_data_valid ) {
-	netj->num_lost_packets += 1;
-	if( netj->num_lost_packets == 1 )
-	    retval = netj->period_usecs;
-    } else {
-	if( (netj->num_lost_packets>1) && !netj->running_free )
-	    retval = (netj->num_lost_packets-1) * netj->period_usecs;
-
-	netj->num_lost_packets = 0;
-    }
-
-    return retval;
-}
-
-void netjack_send_silence( netjack_driver_state_t *netj, int syncstate )
-{
-    int tx_size = get_sample_size(netj->bitdepth) * netj->playback_channels * netj->net_period_up + sizeof(jacknet_packet_header);
-    unsigned int *packet_buf, *packet_bufX;
-
-    packet_buf = alloca( tx_size);
-    jacknet_packet_header *tx_pkthdr = (jacknet_packet_header *)packet_buf;
-    jacknet_packet_header *rx_pkthdr = (jacknet_packet_header *)netj->rx_buf;
-
-    //framecnt = rx_pkthdr->framecnt;
-
-    netj->reply_port = rx_pkthdr->reply_port;
-
-    // offset packet_bufX by the packetheader.
-    packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
-
-    tx_pkthdr->sync_state = syncstate;
-    tx_pkthdr->framecnt = netj->expected_framecnt;
-
-    // memset 0 the payload.
-    int payload_size = get_sample_size(netj->bitdepth) * netj->playback_channels * netj->net_period_up;
-    memset(packet_bufX, 0, payload_size);
-
-    packet_header_hton(tx_pkthdr);
-    if (netj->srcaddress_valid)
-    {
-	int r;
-	if (netj->reply_port)
-	    netj->syncsource_address.sin_port = htons(netj->reply_port);
-
-	for( r=0; r<netj->redundancy; r++ )
-	    netjack_sendto(netj->outsockfd, (char *)packet_buf, tx_size,
-		    0, (struct sockaddr*)&(netj->syncsource_address), sizeof(struct sockaddr_in), netj->mtu);
-    }
-}
-
-
-void netjack_attach( netjack_driver_state_t *netj )
-{
-    //puts ("net_driver_attach");
-    jack_port_t * port;
-    char buf[32];
-    unsigned int chn;
-    int port_flags;
-
-
-    if (netj->handle_transport_sync)
-        jack_set_sync_callback(netj->client, (JackSyncCallback) net_driver_sync_cb, NULL);
-
-    port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
-
-    for (chn = 0; chn < netj->capture_channels_audio; chn++) {
-        snprintf (buf, sizeof(buf) - 1, "capture_%u", chn + 1);
-
-        port = jack_port_register (netj->client, buf,
-                                   JACK_DEFAULT_AUDIO_TYPE,
-                                   port_flags, 0);
-        if (!port) {
-            jack_error ("NET: cannot register port for %s", buf);
-            break;
-        }
-
-        netj->capture_ports =
-            jack_slist_append (netj->capture_ports, port);
-
-	if( netj->bitdepth == CELT_MODE ) {
-#if HAVE_CELT
-#if HAVE_CELT_API_0_7
-	    celt_int32 lookahead;
-	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL );
-	    netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
-#else
-	    celt_int32_t lookahead;
-	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, 1, netj->period_size, NULL );
-	    netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( celt_mode ) );
-#endif
-	    celt_mode_info( celt_mode, CELT_GET_LOOKAHEAD, &lookahead );
-	    netj->codec_latency = 2*lookahead;
-#endif
-	} else {
-#if HAVE_SAMPLERATE
-	    netj->capture_srcs = jack_slist_append(netj->capture_srcs, src_new(SRC_LINEAR, 1, NULL));
-#endif
-	}
-    }
-    for (chn = netj->capture_channels_audio; chn < netj->capture_channels; chn++) {
-        snprintf (buf, sizeof(buf) - 1, "capture_%u", chn + 1);
-
-        port = jack_port_register (netj->client, buf,
-                                   JACK_DEFAULT_MIDI_TYPE,
-                                   port_flags, 0);
-        if (!port) {
-            jack_error ("NET: cannot register port for %s", buf);
-            break;
-        }
-
-        netj->capture_ports =
-            jack_slist_append (netj->capture_ports, port);
-    }
-
-    port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
-
-    for (chn = 0; chn < netj->playback_channels_audio; chn++) {
-        snprintf (buf, sizeof(buf) - 1, "playback_%u", chn + 1);
-
-        port = jack_port_register (netj->client, buf,
-                                   JACK_DEFAULT_AUDIO_TYPE,
-                                   port_flags, 0);
-
-        if (!port) {
-            jack_error ("NET: cannot register port for %s", buf);
-            break;
-        }
-
-        netj->playback_ports =
-            jack_slist_append (netj->playback_ports, port);
-	if( netj->bitdepth == CELT_MODE ) {
-#if HAVE_CELT
-#if HAVE_CELT_API_0_7
-	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL );
-	    netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
-#else
-	    CELTMode *celt_mode = celt_mode_create( netj->sample_rate, 1, netj->period_size, NULL );
-	    netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_encoder_create( celt_mode ) );
-#endif
-#endif
-	} else {
-#if HAVE_SAMPLERATE
-	    netj->playback_srcs = jack_slist_append(netj->playback_srcs, src_new(SRC_LINEAR, 1, NULL));
-#endif
-	}
-    }
-    for (chn = netj->playback_channels_audio; chn < netj->playback_channels; chn++) {
-        snprintf (buf, sizeof(buf) - 1, "playback_%u", chn + 1);
-
-        port = jack_port_register (netj->client, buf,
-                                   JACK_DEFAULT_MIDI_TYPE,
-                                   port_flags, 0);
-
-        if (!port) {
-            jack_error ("NET: cannot register port for %s", buf);
-            break;
-        }
-
-        netj->playback_ports =
-            jack_slist_append (netj->playback_ports, port);
-    }
-
-    jack_activate (netj->client);
-}
-
-
-void netjack_detach( netjack_driver_state_t *netj )
-{
-    JSList * node;
-
-
-    for (node = netj->capture_ports; node; node = jack_slist_next (node))
-        jack_port_unregister (netj->client,
-                              ((jack_port_t *) node->data));
-
-    jack_slist_free (netj->capture_ports);
-    netj->capture_ports = NULL;
-
-    for (node = netj->playback_ports; node; node = jack_slist_next (node))
-        jack_port_unregister (netj->client,
-                              ((jack_port_t *) node->data));
-
-    jack_slist_free (netj->playback_ports);
-    netj->playback_ports = NULL;
-}
-
-
-netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
-		jack_client_t * client,
-                const char *name,
-                unsigned int capture_ports,
-                unsigned int playback_ports,
-                unsigned int capture_ports_midi,
-                unsigned int playback_ports_midi,
-                jack_nframes_t sample_rate,
-                jack_nframes_t period_size,
-                unsigned int listen_port,
-                unsigned int transport_sync,
-                unsigned int resample_factor,
-                unsigned int resample_factor_up,
-                unsigned int bitdepth,
-		unsigned int use_autoconfig,
-		unsigned int latency,
-		unsigned int redundancy,
-		int dont_htonl_floats,
-		int always_deadline,
-		int jitter_val )
-{
-
-    // Fill in netj values.
-    // might be subject to autoconfig...
-    // so dont calculate anything with them...
-
-
-    netj->sample_rate = sample_rate;
-    netj->period_size = period_size;
-    netj->dont_htonl_floats = dont_htonl_floats;
-
-    netj->listen_port   = listen_port;
-
-    netj->capture_channels  = capture_ports + capture_ports_midi;
-    netj->capture_channels_audio  = capture_ports;
-    netj->capture_channels_midi   = capture_ports_midi;
-    netj->capture_ports     = NULL;
-    netj->playback_channels = playback_ports + playback_ports_midi;
-    netj->playback_channels_audio = playback_ports;
-    netj->playback_channels_midi = playback_ports_midi;
-    netj->playback_ports    = NULL;
-    netj->codec_latency = 0;
-
-    netj->handle_transport_sync = transport_sync;
-    netj->mtu = 1400;
-    netj->latency = latency;
-    netj->redundancy = redundancy;
-    netj->use_autoconfig = use_autoconfig;
-    netj->always_deadline = always_deadline;
-
-
-    netj->client = client;
-
-
-    if ((bitdepth != 0) && (bitdepth != 8) && (bitdepth != 16) && (bitdepth != CELT_MODE))
-    {
-        jack_info ("Invalid bitdepth: %d (8, 16 or 0 for float) !!!", bitdepth);
-        return NULL;
-    }
-    netj->bitdepth = bitdepth;
-
-
-    if (resample_factor_up == 0)
-        resample_factor_up = resample_factor;
-
-    netj->resample_factor = resample_factor;
-    netj->resample_factor_up = resample_factor_up;
-
-
-    return netj;
-}
-
-void netjack_release( netjack_driver_state_t *netj )
-{
-    close( netj->sockfd );
-    close( netj->outsockfd );
-
-    packet_cache_free( global_packcache );
-    global_packcache = NULL;
-}
-
-int
-netjack_startup( netjack_driver_state_t *netj )
-{
-    int first_pack_len;
-    struct sockaddr_in address;
-    // Now open the socket, and wait for the first packet to arrive...
-    netj->sockfd = socket (AF_INET, SOCK_DGRAM, 0);
-#ifdef WIN32
-    if (netj->sockfd == INVALID_SOCKET)
-#else
-    if (netj->sockfd == -1)
-#endif
-    {
-        jack_info ("socket error");
-        return -1;
-    }
-    address.sin_family = AF_INET;
-    address.sin_port = htons(netj->listen_port);
-    address.sin_addr.s_addr = htonl(INADDR_ANY);
-    if (bind (netj->sockfd, (struct sockaddr *) &address, sizeof (address)) < 0)
-    {
-        jack_info("bind error");
-        return -1;
-    }
-
-    netj->outsockfd = socket (AF_INET, SOCK_DGRAM, 0);
-#ifdef WIN32
-    if (netj->outsockfd == INVALID_SOCKET)
-#else
-    if (netj->outsockfd == -1)
-#endif
-    {
-        jack_info ("socket error");
-        return -1;
-    }
-    netj->srcaddress_valid = 0;
-    if (netj->use_autoconfig)
-    {
-	jacknet_packet_header *first_packet = alloca (sizeof (jacknet_packet_header));
-#ifdef WIN32
-    int address_size = sizeof( struct sockaddr_in );
-#else
-	socklen_t address_size = sizeof (struct sockaddr_in);
-#endif
-	//jack_info ("Waiting for an incoming packet !!!");
-	//jack_info ("*** IMPORTANT *** Dont connect a client to jackd until the driver is attached to a clock source !!!");
-
-    while(1) {
-    if( ! netjack_poll( netj->sockfd, 1000 ) ) {
-	    jack_info ("Waiting aborted");
-	    return -1;
-    }
-    first_pack_len = recvfrom (netj->sockfd, (char *)first_packet, sizeof (jacknet_packet_header), 0, (struct sockaddr*) & netj->syncsource_address, &address_size);
-#ifdef WIN32
-        if( first_pack_len == -1 ) {
-            first_pack_len = sizeof(jacknet_packet_header);
-            break;
-        }
-#else
-        if (first_pack_len == sizeof (jacknet_packet_header))
-            break;
-#endif
-    }
-	netj->srcaddress_valid = 1;
-
-	if (first_pack_len == sizeof (jacknet_packet_header))
-	{
-	    packet_header_ntoh (first_packet);
-
-	    jack_info ("AutoConfig Override !!!");
-	    if (netj->sample_rate != first_packet->sample_rate)
-	    {
-		jack_info ("AutoConfig Override: Master JACK sample rate = %d", first_packet->sample_rate);
-		netj->sample_rate = first_packet->sample_rate;
-	    }
-
-	    if (netj->period_size != first_packet->period_size)
-	    {
-		jack_info ("AutoConfig Override: Master JACK period size is %d", first_packet->period_size);
-		netj->period_size = first_packet->period_size;
-	    }
-	    if (netj->capture_channels_audio != first_packet->capture_channels_audio)
-	    {
-		jack_info ("AutoConfig Override: capture_channels_audio = %d", first_packet->capture_channels_audio);
-		netj->capture_channels_audio = first_packet->capture_channels_audio;
-	    }
-	    if (netj->capture_channels_midi != first_packet->capture_channels_midi)
-	    {
-		jack_info ("AutoConfig Override: capture_channels_midi = %d", first_packet->capture_channels_midi);
-		netj->capture_channels_midi = first_packet->capture_channels_midi;
-	    }
-	    if (netj->playback_channels_audio != first_packet->playback_channels_audio)
-	    {
-		jack_info ("AutoConfig Override: playback_channels_audio = %d", first_packet->playback_channels_audio);
-		netj->playback_channels_audio = first_packet->playback_channels_audio;
-	    }
-	    if (netj->playback_channels_midi != first_packet->playback_channels_midi)
-	    {
-		jack_info ("AutoConfig Override: playback_channels_midi = %d", first_packet->playback_channels_midi);
-		netj->playback_channels_midi = first_packet->playback_channels_midi;
-	    }
-
-	    netj->mtu = first_packet->mtu;
-	    jack_info ("MTU is set to %d bytes", first_packet->mtu);
-	    netj->latency = first_packet->latency;
-	}
-    }
-    netj->capture_channels  = netj->capture_channels_audio + netj->capture_channels_midi;
-    netj->playback_channels = netj->playback_channels_audio + netj->playback_channels_midi;
-
-    if( (netj->capture_channels * netj->period_size * netj->latency * 4) > 100000000 ) {
-	    jack_error( "autoconfig requests more than 100MB packet cache... bailing out" );
-	    exit(1);
-    }
-
-    if( netj->playback_channels > 1000 ) {
-	    jack_error( "autoconfig requests more than 1000 playback channels... bailing out" );
-	    exit(1);
-    }
-
-
-    if( netj->mtu < (2*sizeof( jacknet_packet_header )) ) {
-	    jack_error( "bullshit mtu requested by autoconfig" );
-	    exit(1);
-    }
-
-    if( netj->sample_rate == 0 ) {
-	    jack_error( "sample_rate 0 requested by autoconfig" );
-	    exit(1);
-    }
-
-    // After possible Autoconfig: do all calculations...
-    netj->period_usecs =
-        (jack_time_t) floor ((((float) netj->period_size) / (float)netj->sample_rate)
-                             * 1000000.0f);
-    
-    if( netj->latency == 0 )
-	netj->deadline_offset = 50*netj->period_usecs;
-    else
-	netj->deadline_offset = netj->period_usecs + 10*netj->latency*netj->period_usecs/100;
-
-    if( netj->bitdepth == CELT_MODE ) {
-	// celt mode.
-	// TODO: this is a hack. But i dont want to change the packet header.
-	netj->resample_factor = (netj->resample_factor * netj->period_size * 1024 / netj->sample_rate / 8)&(~1);
-	netj->resample_factor_up = (netj->resample_factor_up * netj->period_size * 1024 / netj->sample_rate / 8)&(~1);
-	
-	netj->net_period_down = netj->resample_factor;
-	netj->net_period_up = netj->resample_factor_up;
-    } else {
-	netj->net_period_down = (float) netj->period_size / (float) netj->resample_factor;
-	netj->net_period_up = (float) netj->period_size / (float) netj->resample_factor_up;
-    }
-
-    netj->rx_bufsize = sizeof (jacknet_packet_header) + netj->net_period_down * netj->capture_channels * get_sample_size (netj->bitdepth);
-    netj->pkt_buf = malloc (netj->rx_bufsize);
-    global_packcache = packet_cache_new (netj->latency + 50, netj->rx_bufsize, netj->mtu);
-
-    netj->expected_framecnt_valid = 0;
-    netj->num_lost_packets = 0;
-    netj->next_deadline_valid = 0;
-    netj->deadline_goodness = 0;
-    netj->time_to_deadline = 0;
-
-    // Special handling for latency=0
-    if( netj->latency == 0 )
-	netj->resync_threshold = 0;
-    else
-	netj->resync_threshold = MIN( 15, netj->latency-1 );
-
-    netj->running_free = 0;
-
-    return 0;
-}
diff --git a/drivers/netjack/netjack.h b/drivers/netjack/netjack.h
deleted file mode 100644
index 7ec7d6b..0000000
--- a/drivers/netjack/netjack.h
+++ /dev/null
@@ -1,147 +0,0 @@
-
-/*
-    Copyright (C) 2003 Robert Ham <rah at bash.sh>
-    Copyright (C) 2005 Torben Hohn <torbenh at gmx.de>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __NETJACK_H__
-#define __NETJACK_H__
-
-#include <unistd.h>
-
-#include <jack/types.h>
-//#include <jack/driver.h>
-#include <jack/jack.h>
-#include <jack/transport.h>
-
-#include "jack/jslist.h"
-
-#include <netinet/in.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef struct _netjack_driver_state netjack_driver_state_t;
-
-struct _netjack_driver_state {
-    jack_nframes_t  net_period_up;
-    jack_nframes_t  net_period_down;
-
-    jack_nframes_t  sample_rate;
-    jack_nframes_t  bitdepth;
-    jack_nframes_t  period_size;
-    jack_time_t	    period_usecs;
-    int		    dont_htonl_floats;
-    int		    always_deadline;
-
-    jack_nframes_t  codec_latency;
-
-    unsigned int    listen_port;
-
-    unsigned int    capture_channels;
-    unsigned int    playback_channels;
-    unsigned int    capture_channels_audio;
-    unsigned int    playback_channels_audio;
-    unsigned int    capture_channels_midi;
-    unsigned int    playback_channels_midi;
-
-    JSList	    *capture_ports;
-    JSList	    *playback_ports;
-    JSList	    *playback_srcs;
-    JSList	    *capture_srcs;
-
-    jack_client_t   *client;
-
-#ifdef WIN32
-    SOCKET	    sockfd;
-    SOCKET	    outsockfd;
-#else
-    int		    sockfd;
-    int		    outsockfd;
-#endif
-
-    struct sockaddr_in syncsource_address;
-
-    int		    reply_port;
-    int		    srcaddress_valid;
-
-    int sync_state;
-    unsigned int handle_transport_sync;
-
-    unsigned int *rx_buf;
-    unsigned int *pkt_buf;
-    unsigned int rx_bufsize;
-    //unsigned int tx_bufsize;
-    unsigned int mtu;
-    unsigned int latency;
-    unsigned int redundancy;
-
-    jack_nframes_t expected_framecnt;
-    int		   expected_framecnt_valid;
-    unsigned int   num_lost_packets;
-    jack_time_t	   next_deadline;
-    jack_time_t	   deadline_offset;
-    int		   next_deadline_valid;
-    int		   packet_data_valid;
-    int		   resync_threshold;
-    int		   running_free;
-    int		   deadline_goodness;
-    jack_time_t	   time_to_deadline;
-    unsigned int   use_autoconfig;
-    unsigned int   resample_factor;
-    unsigned int   resample_factor_up;
-    int		   jitter_val;
-};
-
-int netjack_wait( netjack_driver_state_t *netj );
-void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
-void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
-void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
-void netjack_attach( netjack_driver_state_t *netj );
-void netjack_detach( netjack_driver_state_t *netj );
-
-netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
-		jack_client_t * client,
-                const char *name,
-                unsigned int capture_ports,
-                unsigned int playback_ports,
-                unsigned int capture_ports_midi,
-                unsigned int playback_ports_midi,
-                jack_nframes_t sample_rate,
-                jack_nframes_t period_size,
-                unsigned int listen_port,
-                unsigned int transport_sync,
-                unsigned int resample_factor,
-                unsigned int resample_factor_up,
-                unsigned int bitdepth,
-		unsigned int use_autoconfig,
-		unsigned int latency,
-		unsigned int redundancy,
-		int dont_htonl_floats,
-		int always_deadline,
-		int jitter_val );
-
-void netjack_release( netjack_driver_state_t *netj );
-int netjack_startup( netjack_driver_state_t *netj );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/drivers/netjack/netjack_packet.c b/drivers/netjack/netjack_packet.c
deleted file mode 100644
index ac3a410..0000000
--- a/drivers/netjack/netjack_packet.c
+++ /dev/null
@@ -1,1523 +0,0 @@
-
-/*
- * NetJack - Packet Handling functions
- *
- * used by the driver and the jacknet_client
- *
- * Copyright (C) 2008 Marc-Olivier Barre <marco at marcochapeau.org>
- * Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
- * Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: net_driver.c,v 1.16 2006/03/20 19:41:37 torbenh Exp $
- *
- */
-
-#include "config.h"
-
-#ifdef __APPLE__
-#define _DARWIN_C_SOURCE
-#endif
-
-#if HAVE_PPOLL
-#define _GNU_SOURCE
-#endif
-
-#include <math.h>
-#include <stdio.h>
-#include <memory.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-
-#include <jack/types.h>
-
-// for jack_error in jack1
-#include <jack/internal.h>
-
-#include <sys/types.h>
-
-#ifdef WIN32
-#include <winsock2.h>
-#include <malloc.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <poll.h>
-#endif
-
-#include <errno.h>
-#include <signal.h>
-
-#if HAVE_SAMPLERATE
-#include <samplerate.h>
-#endif
-
-#if HAVE_CELT
-#include <celt/celt.h>
-#endif
-
-#include "netjack_packet.h"
-
-// JACK2 specific.
-//#include "jack/control.h"
-
-#ifdef NO_JACK_ERROR
-#define jack_error printf
-#endif
-
-int fraggo = 0;
-
-packet_cache *global_packcache = NULL;
-
-void
-packet_header_hton (jacknet_packet_header *pkthdr)
-{
-    pkthdr->capture_channels_audio = htonl(pkthdr->capture_channels_audio);
-    pkthdr->playback_channels_audio = htonl(pkthdr->playback_channels_audio);
-    pkthdr->capture_channels_midi = htonl(pkthdr->capture_channels_midi);
-    pkthdr->playback_channels_midi = htonl(pkthdr->playback_channels_midi);
-    pkthdr->period_size = htonl(pkthdr->period_size);
-    pkthdr->sample_rate = htonl(pkthdr->sample_rate);
-    pkthdr->sync_state = htonl(pkthdr->sync_state);
-    pkthdr->transport_frame = htonl(pkthdr->transport_frame);
-    pkthdr->transport_state = htonl(pkthdr->transport_state);
-    pkthdr->framecnt = htonl(pkthdr->framecnt);
-    pkthdr->latency = htonl(pkthdr->latency);
-    pkthdr->reply_port = htonl(pkthdr->reply_port);
-    pkthdr->mtu = htonl(pkthdr->mtu);
-    pkthdr->fragment_nr = htonl(pkthdr->fragment_nr);
-}
-
-void
-packet_header_ntoh (jacknet_packet_header *pkthdr)
-{
-    pkthdr->capture_channels_audio = ntohl(pkthdr->capture_channels_audio);
-    pkthdr->playback_channels_audio = ntohl(pkthdr->playback_channels_audio);
-    pkthdr->capture_channels_midi = ntohl(pkthdr->capture_channels_midi);
-    pkthdr->playback_channels_midi = ntohl(pkthdr->playback_channels_midi);
-    pkthdr->period_size = ntohl(pkthdr->period_size);
-    pkthdr->sample_rate = ntohl(pkthdr->sample_rate);
-    pkthdr->sync_state = ntohl(pkthdr->sync_state);
-    pkthdr->transport_frame = ntohl(pkthdr->transport_frame);
-    pkthdr->transport_state = ntohl(pkthdr->transport_state);
-    pkthdr->framecnt = ntohl(pkthdr->framecnt);
-    pkthdr->latency = ntohl(pkthdr->latency);
-    pkthdr->reply_port = ntohl(pkthdr->reply_port);
-    pkthdr->mtu = ntohl(pkthdr->mtu);
-    pkthdr->fragment_nr = ntohl(pkthdr->fragment_nr);
-}
-
-int get_sample_size (int bitdepth)
-{
-    if (bitdepth == 8)
-        return sizeof (int8_t);
-    if (bitdepth == 16)
-        return sizeof (int16_t);
-    //JN: why? is this for buffer sizes before or after encoding?
-    //JN: if the former, why not int16_t, if the latter, shouldn't it depend on -c N?    
-    if( bitdepth == CELT_MODE )
-	return sizeof( unsigned char );
-    return sizeof (int32_t);
-}
-
-int jack_port_is_audio(const char *porttype)
-{
-    return (strncmp (porttype, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0);
-}
-
-int jack_port_is_midi(const char *porttype)
-{
-    return (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0);
-}
-
-
-// fragment management functions.
-
-packet_cache
-*packet_cache_new (int num_packets, int pkt_size, int mtu)
-{
-    int fragment_payload_size = mtu - sizeof (jacknet_packet_header);
-    int i, fragment_number;
-
-    if( pkt_size == sizeof(jacknet_packet_header) )
-	    fragment_number = 1;
-    else
-	    fragment_number = (pkt_size - sizeof (jacknet_packet_header) - 1) / fragment_payload_size + 1;
-
-    packet_cache *pcache = malloc (sizeof (packet_cache));
-    if (pcache == NULL)
-    {
-        jack_error ("could not allocate packet cache (1)");
-        return NULL;
-    }
-
-    pcache->size = num_packets;
-    pcache->packets = malloc (sizeof (cache_packet) * num_packets);
-    pcache->master_address_valid = 0;
-    pcache->last_framecnt_retreived = 0;
-    pcache->last_framecnt_retreived_valid = 0;
-
-    if (pcache->packets == NULL)
-    {
-        jack_error ("could not allocate packet cache (2)");
-        return NULL;
-    }
-
-    for (i = 0; i < num_packets; i++)
-    {
-        pcache->packets[i].valid = 0;
-        pcache->packets[i].num_fragments = fragment_number;
-        pcache->packets[i].packet_size = pkt_size;
-        pcache->packets[i].mtu = mtu;
-        pcache->packets[i].framecnt = 0;
-        pcache->packets[i].fragment_array = malloc (sizeof (char) * fragment_number);
-        pcache->packets[i].packet_buf = malloc (pkt_size);
-        if ((pcache->packets[i].fragment_array == NULL) || (pcache->packets[i].packet_buf == NULL))
-        {
-            jack_error ("could not allocate packet cache (3)");
-            return NULL;
-        }
-    }
-    pcache->mtu = mtu;
-
-    return pcache;
-}
-
-void
-packet_cache_free (packet_cache *pcache)
-{
-    int i;
-    if( pcache == NULL )
-	return;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-        free (pcache->packets[i].fragment_array);
-        free (pcache->packets[i].packet_buf);
-    }
-
-    free (pcache->packets);
-    free (pcache);
-}
-
-cache_packet
-*packet_cache_get_packet (packet_cache *pcache, jack_nframes_t framecnt)
-{
-    int i;
-    cache_packet *retval;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-        if (pcache->packets[i].valid && (pcache->packets[i].framecnt == framecnt))
-            return &(pcache->packets[i]);
-    }
-
-    // The Packet is not in the packet cache.
-    // find a free packet.
-
-    retval = packet_cache_get_free_packet (pcache);
-    if (retval != NULL)
-    {
-        cache_packet_set_framecnt (retval, framecnt);
-        return retval;
-    }
-
-    // No Free Packet available
-    // Get The Oldest packet and reset it.
-
-    retval = packet_cache_get_oldest_packet (pcache);
-    //printf( "Dropping %d from Cache :S\n", retval->framecnt );
-    cache_packet_reset (retval);
-    cache_packet_set_framecnt (retval, framecnt);
-
-    return retval;
-}
-
-// TODO: fix wrapping case... need to pass
-//       current expected frame here.
-//
-//       or just save framecount into packet_cache.
-
-cache_packet
-*packet_cache_get_oldest_packet (packet_cache *pcache)
-{
-    jack_nframes_t minimal_frame = JACK_MAX_FRAMES;
-    cache_packet *retval = &(pcache->packets[0]);
-    int i;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-        if (pcache->packets[i].valid && (pcache->packets[i].framecnt < minimal_frame))
-        {
-            minimal_frame = pcache->packets[i].framecnt;
-            retval = &(pcache->packets[i]);
-        }
-    }
-
-    return retval;
-}
-
-cache_packet
-*packet_cache_get_free_packet (packet_cache *pcache)
-{
-    int i;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-        if (pcache->packets[i].valid == 0)
-            return &(pcache->packets[i]);
-    }
-
-    return NULL;
-}
-
-void
-cache_packet_reset (cache_packet *pack)
-{
-    int i;
-    pack->valid = 0;
-
-    // XXX: i dont think this is necessary here...
-    //      fragement array is cleared in _set_framecnt()
-
-    for (i = 0; i < pack->num_fragments; i++)
-        pack->fragment_array[i] = 0;
-}
-
-void
-cache_packet_set_framecnt (cache_packet *pack, jack_nframes_t framecnt)
-{
-    int i;
-
-    pack->framecnt = framecnt;
-
-    for (i = 0; i < pack->num_fragments; i++)
-        pack->fragment_array[i] = 0;
-
-    pack->valid = 1;
-}
-
-void
-cache_packet_add_fragment (cache_packet *pack, char *packet_buf, int rcv_len)
-{
-    jacknet_packet_header *pkthdr = (jacknet_packet_header *) packet_buf;
-    int fragment_payload_size = pack->mtu - sizeof (jacknet_packet_header);
-    char *packet_bufX = pack->packet_buf + sizeof (jacknet_packet_header);
-    char *dataX = packet_buf + sizeof (jacknet_packet_header);
-
-    jack_nframes_t fragment_nr = ntohl (pkthdr->fragment_nr);
-    jack_nframes_t framecnt    = ntohl (pkthdr->framecnt);
-
-    if (framecnt != pack->framecnt)
-    {
-        jack_error ("errror. framecnts dont match");
-        return;
-    }
-
-
-    if (fragment_nr == 0)
-    {
-        memcpy (pack->packet_buf, packet_buf, rcv_len);
-        pack->fragment_array[0] = 1;
-
-        return;
-    }
-
-    if ((fragment_nr < pack->num_fragments) && (fragment_nr > 0))
-    {
-        if ((fragment_nr * fragment_payload_size + rcv_len - sizeof (jacknet_packet_header)) <= (pack->packet_size - sizeof (jacknet_packet_header)))
-        {
-            memcpy (packet_bufX + fragment_nr * fragment_payload_size, dataX, rcv_len - sizeof (jacknet_packet_header));
-            pack->fragment_array[fragment_nr] = 1;
-        }
-        else
-            jack_error ("too long packet received...");
-    }
-}
-
-int
-cache_packet_is_complete (cache_packet *pack)
-{
-    int i;
-    for (i = 0; i < pack->num_fragments; i++)
-        if (pack->fragment_array[i] == 0)
-            return 0;
-
-    return 1;
-}
-
-#ifndef WIN32
-// new poll using nanoseconds resolution and
-// not waiting forever.
-int
-netjack_poll_deadline (int sockfd, jack_time_t deadline)
-{
-    struct pollfd fds;
-    int poll_err = 0;
-#if HAVE_PPOLL
-    struct timespec timeout_spec = { 0, 0 };
-#else
-    int timeout;
-#endif
-
-
-    jack_time_t now = jack_get_time();
-    if( now >= deadline )
-	return 0;
-
-    if( (deadline-now) >= 1000000 ) {
-	    jack_error( "deadline more than 1 second in the future, trimming it." );
-	    deadline = now+500000;
-    }
-#if HAVE_PPOLL
-    timeout_spec.tv_nsec = (deadline - now) * 1000;
-#else
-    timeout = lrintf( (float)(deadline - now) / 1000.0 );
-#endif
-
-
-    fds.fd = sockfd;
-    fds.events = POLLIN;
-
-#if HAVE_PPOLL
-    poll_err = ppoll (&fds, 1, &timeout_spec, NULL);
-#else
-    poll_err = poll (&fds, 1, timeout);
-#endif
-
-    if (poll_err == -1)
-    {
-        switch (errno)
-        {
-            case EBADF:
-            jack_error ("Error %d: An invalid file descriptor was given in one of the sets", errno);
-            break;
-            case EFAULT:
-            jack_error ("Error %d: The array given as argument was not contained in the calling program's address space", errno);
-            break;
-            case EINTR:
-            jack_error ("Error %d: A signal occurred before any requested event", errno);
-            break;
-            case EINVAL:
-            jack_error ("Error %d: The nfds value exceeds the RLIMIT_NOFILE value", errno);
-            break;
-            case ENOMEM:
-            jack_error ("Error %d: There was no space to allocate file descriptor tables", errno);
-            break;
-        }
-    }
-    return poll_err;
-}
-
-int
-netjack_poll (int sockfd, int timeout)
-{
-    struct pollfd fds;
-    int i, poll_err = 0;
-    sigset_t sigmask, rsigmask;
-    struct sigaction action;
-
-    sigemptyset(&sigmask);
-	sigaddset(&sigmask, SIGHUP);
-	sigaddset(&sigmask, SIGINT);
-	sigaddset(&sigmask, SIGQUIT);
-	sigaddset(&sigmask, SIGPIPE);
-	sigaddset(&sigmask, SIGTERM);
-	sigaddset(&sigmask, SIGUSR1);
-	sigaddset(&sigmask, SIGUSR2);
-
-	action.sa_handler = SIG_DFL;
-	action.sa_mask = sigmask;
-	action.sa_flags = SA_RESTART;
-
-    for (i = 1; i < NSIG; i++)
-        if (sigismember (&sigmask, i))
-            sigaction (i, &action, 0);
-
-    fds.fd = sockfd;
-    fds.events = POLLIN;
-
-    sigprocmask(SIG_UNBLOCK, &sigmask, &rsigmask);
-    while (poll_err == 0)
-    {
-        poll_err = poll (&fds, 1, timeout);
-    }
-    sigprocmask(SIG_SETMASK, &rsigmask, NULL);
-
-    if (poll_err == -1)
-    {
-        switch (errno)
-        {
-            case EBADF:
-            jack_error ("Error %d: An invalid file descriptor was given in one of the sets", errno);
-            break;
-            case EFAULT:
-            jack_error ("Error %d: The array given as argument was not contained in the calling program's address space", errno);
-            break;
-            case EINTR:
-            jack_error ("Error %d: A signal occurred before any requested event", errno);
-            break;
-            case EINVAL:
-            jack_error ("Error %d: The nfds value exceeds the RLIMIT_NOFILE value", errno);
-            break;
-            case ENOMEM:
-            jack_error ("Error %d: There was no space to allocate file descriptor tables", errno);
-            break;
-        }
-        return 0;
-    }
-    return 1;
-}
-
-#else
-int
-netjack_poll (int sockfd, int timeout)
-{
-    jack_error( "netjack_poll not implemented" );
-    return 0;
-}
-int
-netjack_poll_deadline (int sockfd, jack_time_t deadline)
-{
-    fd_set fds;
-    FD_ZERO( &fds );
-    FD_SET( sockfd, &fds );
-
-    struct timeval timeout;
-    while( 1 ) {
-        jack_time_t now = jack_get_time();
-        if( now >= deadline )
-                return 0;
-
-        int timeout_usecs = (deadline - now);
-    //jack_error( "timeout = %d", timeout_usecs );
-        timeout.tv_sec = 0;
-        timeout.tv_usec = (timeout_usecs < 500) ? 500 : timeout_usecs;
-        timeout.tv_usec = (timeout_usecs > 1000000) ? 500000 : timeout_usecs;
-
-        int poll_err = select (0, &fds, NULL, NULL, &timeout);
-        if( poll_err != 0 )
-            return poll_err;
-    }
-
-    return 0;
-}
-#endif
-// This now reads all a socket has into the cache.
-// replacing netjack_recv functions.
-
-void
-packet_cache_drain_socket( packet_cache *pcache, int sockfd )
-{
-    char *rx_packet = alloca (pcache->mtu);
-    jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
-    int rcv_len;
-    jack_nframes_t framecnt;
-    cache_packet *cpack;
-    struct sockaddr_in sender_address;
-#ifdef WIN32
-    size_t senderlen = sizeof( struct sockaddr_in );
-    u_long parm = 1;
-    ioctlsocket( sockfd, FIONBIO, &parm );
-#else
-    socklen_t senderlen = sizeof( struct sockaddr_in );
-#endif
-    while (1)
-    {
-#ifdef WIN32
-        rcv_len = recvfrom (sockfd, rx_packet, pcache->mtu, 0,
-			    (struct sockaddr*) &sender_address, &senderlen);
-#else
-        rcv_len = recvfrom (sockfd, rx_packet, pcache->mtu, MSG_DONTWAIT,
-			    (struct sockaddr*) &sender_address, &senderlen);
-#endif
-        if (rcv_len < 0)
-            return;
-
-	if (pcache->master_address_valid) {
-	    // Verify its from our master.
-	    if (memcmp (&sender_address, &(pcache->master_address), senderlen) != 0)
-		continue;
-	} else {
-	    // Setup this one as master
-	    //printf( "setup master...\n" );
-	    memcpy ( &(pcache->master_address), &sender_address, senderlen );
-	    pcache->master_address_valid = 1;
-	}
-
-        framecnt = ntohl (pkthdr->framecnt);
-	if( pcache->last_framecnt_retreived_valid && (framecnt <= pcache->last_framecnt_retreived ))
-	    continue;
-
-        cpack = packet_cache_get_packet (global_packcache, framecnt);
-        cache_packet_add_fragment (cpack, rx_packet, rcv_len);
-	cpack->recv_timestamp = jack_get_time();
-    }
-}
-
-void
-packet_cache_reset_master_address( packet_cache *pcache )
-{
-    pcache->master_address_valid = 0;
-    pcache->last_framecnt_retreived = 0;
-    pcache->last_framecnt_retreived_valid = 0;
-}
-
-void
-packet_cache_clear_old_packets (packet_cache *pcache, jack_nframes_t framecnt )
-{
-    int i;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-        if (pcache->packets[i].valid && (pcache->packets[i].framecnt < framecnt))
-        {
-            cache_packet_reset (&(pcache->packets[i]));
-        }
-    }
-}
-
-int
-packet_cache_retreive_packet_pointer( packet_cache *pcache, jack_nframes_t framecnt, char **packet_buf, int pkt_size, jack_time_t *timestamp )
-{
-    int i;
-    cache_packet *cpack = NULL;
-
-
-    for (i = 0; i < pcache->size; i++) {
-        if (pcache->packets[i].valid && (pcache->packets[i].framecnt == framecnt)) {
-	    cpack = &(pcache->packets[i]);
-            break;
-	}
-    }
-
-    if( cpack == NULL ) {
-	//printf( "retreive packet: %d....not found\n", framecnt );
-	return -1;
-    }
-
-    if( !cache_packet_is_complete( cpack ) ) {
-	return -1;
-    }
-
-    // ok. cpack is the one we want and its complete.
-    *packet_buf = cpack->packet_buf;
-    if( timestamp )
-	*timestamp = cpack->recv_timestamp;
-
-    pcache->last_framecnt_retreived_valid = 1;
-    pcache->last_framecnt_retreived = framecnt;
-
-    return pkt_size;
-}
-
-int
-packet_cache_release_packet( packet_cache *pcache, jack_nframes_t framecnt )
-{
-    int i;
-    cache_packet *cpack = NULL;
-
-
-    for (i = 0; i < pcache->size; i++) {
-        if (pcache->packets[i].valid && (pcache->packets[i].framecnt == framecnt)) {
-	    cpack = &(pcache->packets[i]);
-            break;
-	}
-    }
-
-    if( cpack == NULL ) {
-	//printf( "retreive packet: %d....not found\n", framecnt );
-	return -1;
-    }
-
-    if( !cache_packet_is_complete( cpack ) ) {
-	return -1;
-    }
-
-    cache_packet_reset (cpack);
-    packet_cache_clear_old_packets( pcache, framecnt );
-
-    return 0;
-}
-float
-packet_cache_get_fill( packet_cache *pcache, jack_nframes_t expected_framecnt )
-{
-    int num_packets_before_us = 0;
-    int i;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-	cache_packet *cpack = &(pcache->packets[i]);
-        if (cpack->valid && cache_packet_is_complete( cpack ))
-	    if( cpack->framecnt >= expected_framecnt )
-		num_packets_before_us += 1;
-    }
-
-    return 100.0 * (float)num_packets_before_us / (float)( pcache->size ) ;
-}
-
-// Returns 0 when no valid packet is inside the cache.
-int
-packet_cache_get_next_available_framecnt( packet_cache *pcache, jack_nframes_t expected_framecnt, jack_nframes_t *framecnt )
-{
-    int i;
-    jack_nframes_t best_offset = JACK_MAX_FRAMES/2-1;
-    int retval = 0;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-	cache_packet *cpack = &(pcache->packets[i]);
-	//printf( "p%d: valid=%d, frame %d\n", i, cpack->valid, cpack->framecnt );
-
-        if (!cpack->valid || !cache_packet_is_complete( cpack )) {
-	    //printf( "invalid\n" );
-	    continue;
-	}
-
-	if( cpack->framecnt < expected_framecnt )
-	    continue;
-
-	if( (cpack->framecnt - expected_framecnt) > best_offset ) {
-	    continue;
-	}
-
-	best_offset = cpack->framecnt - expected_framecnt;
-	retval = 1;
-
-	if( best_offset == 0 )
-	    break;
-    }
-    if( retval && framecnt )
-	*framecnt = expected_framecnt + best_offset;
-
-    return retval;
-}
-
-int
-packet_cache_get_highest_available_framecnt( packet_cache *pcache, jack_nframes_t *framecnt )
-{
-    int i;
-    jack_nframes_t best_value = 0;
-    int retval = 0;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-	cache_packet *cpack = &(pcache->packets[i]);
-	//printf( "p%d: valid=%d, frame %d\n", i, cpack->valid, cpack->framecnt );
-
-        if (!cpack->valid || !cache_packet_is_complete( cpack )) {
-	    //printf( "invalid\n" );
-	    continue;
-	}
-
-	if (cpack->framecnt < best_value) {
-	    continue;
-	}
-
-	best_value = cpack->framecnt;
-	retval = 1;
-
-    }
-    if( retval && framecnt )
-	*framecnt = best_value;
-
-    return retval;
-}
-
-// Returns 0 when no valid packet is inside the cache.
-int
-packet_cache_find_latency( packet_cache *pcache, jack_nframes_t expected_framecnt, jack_nframes_t *framecnt )
-{
-    int i;
-    jack_nframes_t best_offset = 0;
-    int retval = 0;
-
-    for (i = 0; i < pcache->size; i++)
-    {
-	cache_packet *cpack = &(pcache->packets[i]);
-	//printf( "p%d: valid=%d, frame %d\n", i, cpack->valid, cpack->framecnt );
-
-        if (!cpack->valid || !cache_packet_is_complete( cpack )) {
-	    //printf( "invalid\n" );
-	    continue;
-	}
-
-	if( (cpack->framecnt - expected_framecnt) < best_offset ) {
-	    continue;
-	}
-
-	best_offset = cpack->framecnt - expected_framecnt;
-	retval = 1;
-
-	if( best_offset == 0 )
-	    break;
-    }
-    if( retval && framecnt )
-	*framecnt = JACK_MAX_FRAMES - best_offset;
-
-    return retval;
-}
-// fragmented packet IO
-int
-netjack_recvfrom (int sockfd, char *packet_buf, int pkt_size, int flags, struct sockaddr *addr, size_t *addr_size, int mtu)
-{
-    int retval;
-    socklen_t from_len = *addr_size;
-    if (pkt_size <= mtu) {
-        retval = recvfrom (sockfd, packet_buf, pkt_size, flags, addr, &from_len);
-	*addr_size = from_len;
-	return retval;
-    }
-
-    char *rx_packet = alloca (mtu);
-    jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
-    int rcv_len;
-    jack_nframes_t framecnt;
-    cache_packet *cpack;
-    do
-    {
-        rcv_len = recvfrom (sockfd, rx_packet, mtu, 0, addr, &from_len);
-        if (rcv_len < 0)
-            return rcv_len;
-        framecnt = ntohl (pkthdr->framecnt);
-        cpack = packet_cache_get_packet (global_packcache, framecnt);
-        cache_packet_add_fragment (cpack, rx_packet, rcv_len);
-    } while (!cache_packet_is_complete (cpack));
-    memcpy (packet_buf, cpack->packet_buf, pkt_size);
-    cache_packet_reset (cpack);
-    *addr_size = from_len;
-    return pkt_size;
-}
-
-int
-netjack_recv (int sockfd, char *packet_buf, int pkt_size, int flags, int mtu)
-{
-    if (pkt_size <= mtu)
-        return recv (sockfd, packet_buf, pkt_size, flags);
-    char *rx_packet = alloca (mtu);
-    jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
-    int rcv_len;
-    jack_nframes_t framecnt;
-    cache_packet *cpack;
-    do
-    {
-        rcv_len = recv (sockfd, rx_packet, mtu, flags);
-        if (rcv_len < 0)
-            return rcv_len;
-        framecnt = ntohl (pkthdr->framecnt);
-        cpack = packet_cache_get_packet (global_packcache, framecnt);
-        cache_packet_add_fragment (cpack, rx_packet, rcv_len);
-    } while (!cache_packet_is_complete (cpack));
-    memcpy (packet_buf, cpack->packet_buf, pkt_size);
-    cache_packet_reset (cpack);
-    return pkt_size;
-}
-
-void
-netjack_sendto (int sockfd, char *packet_buf, int pkt_size, int flags, struct sockaddr *addr, int addr_size, int mtu)
-{
-    int frag_cnt = 0;
-    char *tx_packet, *dataX;
-    jacknet_packet_header *pkthdr;
-
-    tx_packet = alloca (mtu + 10);
-    dataX = tx_packet + sizeof (jacknet_packet_header);
-    pkthdr = (jacknet_packet_header *) tx_packet;
-
-    int fragment_payload_size = mtu - sizeof (jacknet_packet_header);
-
-    if (pkt_size <= mtu) {
-	int err;
-	pkthdr = (jacknet_packet_header *) packet_buf;
-        pkthdr->fragment_nr = htonl (0);
-        err = sendto(sockfd, packet_buf, pkt_size, flags, addr, addr_size);
-	if( err<0 ) {
-	    //printf( "error in send\n" );
-	    perror( "send" );
-	}
-    }
-    else
-    {
-	int err;
-        // Copy the packet header to the tx pack first.
-        memcpy(tx_packet, packet_buf, sizeof (jacknet_packet_header));
-
-        // Now loop and send all
-        char *packet_bufX = packet_buf + sizeof (jacknet_packet_header);
-
-        while (packet_bufX < (packet_buf + pkt_size - fragment_payload_size))
-        {
-            pkthdr->fragment_nr = htonl (frag_cnt++);
-            memcpy (dataX, packet_bufX, fragment_payload_size);
-            sendto (sockfd, tx_packet, mtu, flags, addr, addr_size);
-            packet_bufX += fragment_payload_size;
-        }
-
-        int last_payload_size = packet_buf + pkt_size - packet_bufX;
-        memcpy (dataX, packet_bufX, last_payload_size);
-        pkthdr->fragment_nr = htonl (frag_cnt);
-        //jack_log("last fragment_count = %d, payload_size = %d\n", fragment_count, last_payload_size);
-
-        // sendto(last_pack_size);
-        err = sendto(sockfd, tx_packet, last_payload_size + sizeof(jacknet_packet_header), flags, addr, addr_size);
-	if( err<0 ) {
-	    //printf( "error in send\n" );
-	    perror( "send" );
-	}
-    }
-}
-
-
-void
-decode_midi_buffer (uint32_t *buffer_uint32, unsigned int buffer_size_uint32, jack_default_audio_sample_t* buf)
-{
-    int i;
-    jack_midi_clear_buffer (buf);
-    for (i = 0; i < buffer_size_uint32 - 3;)
-    {
-        uint32_t payload_size;
-        payload_size = buffer_uint32[i];
-        payload_size = ntohl (payload_size);
-        if (payload_size)
-        {
-            jack_midi_event_t event;
-            event.time = ntohl (buffer_uint32[i+1]);
-            event.size = ntohl (buffer_uint32[i+2]);
-            event.buffer = (jack_midi_data_t*) (&(buffer_uint32[i+3]));
-            jack_midi_event_write (buf, event.time, event.buffer, event.size);
-
-            // skip to the next event
-            unsigned int nb_data_quads = (((event.size-1) & ~0x3) >> 2)+1;
-            i += 3+nb_data_quads;
-        }
-        else
-            break; // no events can follow an empty event, we're done
-    }
-}
-
-void
-encode_midi_buffer (uint32_t *buffer_uint32, unsigned int buffer_size_uint32, jack_default_audio_sample_t* buf)
-{
-    int i;
-    unsigned int written = 0;
-    // midi port, encode midi events
-    unsigned int nevents = jack_midi_get_event_count (buf);
-    for (i = 0; i < nevents; ++i)
-    {
-        jack_midi_event_t event;
-        jack_midi_event_get (&event, buf, i);
-        unsigned int nb_data_quads = (((event.size - 1) & ~0x3) >> 2) + 1;
-        unsigned int payload_size = 3 + nb_data_quads;
-        // only write if we have sufficient space for the event
-        // otherwise drop it
-        if (written + payload_size < buffer_size_uint32 - 1)
-        {
-            // write header
-            buffer_uint32[written]=htonl (payload_size);
-            written++;
-            buffer_uint32[written]=htonl (event.time);
-            written++;
-            buffer_uint32[written]=htonl (event.size);
-            written++;
-
-            // write data
-            jack_midi_data_t* tmpbuff = (jack_midi_data_t*)(&(buffer_uint32[written]));
-            memcpy (tmpbuff, event.buffer, event.size);
-            written += nb_data_quads;
-        }
-        else
-        {
-            // buffer overflow
-            jack_error ("midi buffer overflow");
-            break;
-        }
-    }
-    // now put a netjack_midi 'no-payload' event, signaling EOF
-    buffer_uint32[written]=0;
-}
-
-// render functions for float
-void
-render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
-{
-    int chn = 0;
-    JSList *node = capture_ports;
-#if HAVE_SAMPLERATE
-    JSList *src_node = capture_srcs;
-#endif
-
-    uint32_t *packet_bufX = (uint32_t *)packet_payload;
-
-    if( !packet_payload )
-	return;
-
-    while (node != NULL)
-    {
-        int i;
-        int_float_t val;
-#if HAVE_SAMPLERATE
-        SRC_DATA src;
-#endif
-
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-#if HAVE_SAMPLERATE
-            // audio port, resample if necessary
-            if (net_period_down != nframes)
-            {
-                SRC_STATE *src_state = src_node->data;
-                for (i = 0; i < net_period_down; i++)
-                {
-                    packet_bufX[i] = ntohl (packet_bufX[i]);
-                }
-
-                src.data_in = (float *) packet_bufX;
-                src.input_frames = net_period_down;
-
-                src.data_out = buf;
-                src.output_frames = nframes;
-
-                src.src_ratio = (float) nframes / (float) net_period_down;
-                src.end_of_input = 0;
-
-                src_set_ratio (src_state, src.src_ratio);
-                src_process (src_state, &src);
-                src_node = jack_slist_next (src_node);
-            }
-            else
-#endif
-            {
-		if( dont_htonl_floats )
-		{
-		    memcpy( buf, packet_bufX, net_period_down*sizeof(jack_default_audio_sample_t));
-		}
-		else
-		{
-		    for (i = 0; i < net_period_down; i++)
-		    {
-			val.i = packet_bufX[i];
-			val.i = ntohl (val.i);
-			buf[i] = val.f;
-		    }
-		}
-            }
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // midi port, decode midi events
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_down;
-            uint32_t * buffer_uint32 = (uint32_t*)packet_bufX;
-            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_down);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-void
-render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats )
-{
-    int chn = 0;
-    JSList *node = playback_ports;
-#if HAVE_SAMPLERATE
-    JSList *src_node = playback_srcs;
-#endif
-
-    uint32_t *packet_bufX = (uint32_t *) packet_payload;
-
-    while (node != NULL)
-    {
-#if HAVE_SAMPLERATE
-        SRC_DATA src;
-#endif
-        int i;
-        int_float_t val;
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-            // audio port, resample if necessary
-
-#if HAVE_SAMPLERATE
-            if (net_period_up != nframes) {
-                SRC_STATE *src_state = src_node->data;
-                src.data_in = buf;
-                src.input_frames = nframes;
-
-                src.data_out = (float *) packet_bufX;
-                src.output_frames = net_period_up;
-
-                src.src_ratio = (float) net_period_up / (float) nframes;
-                src.end_of_input = 0;
-
-                src_set_ratio (src_state, src.src_ratio);
-                src_process (src_state, &src);
-
-                for (i = 0; i < net_period_up; i++)
-                {
-                    packet_bufX[i] = htonl (packet_bufX[i]);
-                }
-                src_node = jack_slist_next (src_node);
-            }
-            else
-#endif
-            {
-		if( dont_htonl_floats )
-		{
-		    memcpy( packet_bufX, buf, net_period_up*sizeof(jack_default_audio_sample_t) );
-		}
-		else
-		{
-		    for (i = 0; i < net_period_up; i++)
-		    {
-			val.f = buf[i];
-			val.i = htonl (val.i);
-			packet_bufX[i] = val.i;
-		    }
-		}
-            }
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // encode midi events from port to packet
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_up;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_up);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-// render functions for 16bit
-void
-render_payload_to_jack_ports_16bit (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
-{
-    int chn = 0;
-    JSList *node = capture_ports;
-#if HAVE_SAMPLERATE
-    JSList *src_node = capture_srcs;
-#endif
-
-    uint16_t *packet_bufX = (uint16_t *)packet_payload;
-
-    if( !packet_payload )
-	return;
-
-    while (node != NULL)
-    {
-        int i;
-        //uint32_t val;
-#if HAVE_SAMPLERATE
-        SRC_DATA src;
-#endif
-
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-
-#if HAVE_SAMPLERATE
-        float *floatbuf = alloca (sizeof(float) * net_period_down);
-#endif
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-            // audio port, resample if necessary
-
-#if HAVE_SAMPLERATE
-            if (net_period_down != nframes)
-            {
-                SRC_STATE *src_state = src_node->data;
-                for (i = 0; i < net_period_down; i++)
-                {
-                    floatbuf[i] = ((float) ntohs(packet_bufX[i])) / 32767.0 - 1.0;
-                }
-
-                src.data_in = floatbuf;
-                src.input_frames = net_period_down;
-
-                src.data_out = buf;
-                src.output_frames = nframes;
-
-                src.src_ratio = (float) nframes / (float) net_period_down;
-                src.end_of_input = 0;
-
-                src_set_ratio (src_state, src.src_ratio);
-                src_process (src_state, &src);
-                src_node = jack_slist_next (src_node);
-            }
-            else
-#endif
-                for (i = 0; i < net_period_down; i++)
-                    buf[i] = ((float) ntohs (packet_bufX[i])) / 32768.0 - 1.0;
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // midi port, decode midi events
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_down / 2;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_down);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-void
-render_jack_ports_to_payload_16bit (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
-{
-    int chn = 0;
-    JSList *node = playback_ports;
-#if HAVE_SAMPLERATE
-    JSList *src_node = playback_srcs;
-#endif
-
-    uint16_t *packet_bufX = (uint16_t *)packet_payload;
-
-    while (node != NULL)
-    {
-#if HAVE_SAMPLERATE
-        SRC_DATA src;
-#endif
-        int i;
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-            // audio port, resample if necessary
-
-#if HAVE_SAMPLERATE
-            if (net_period_up != nframes)
-            {
-                SRC_STATE *src_state = src_node->data;
-
-                float *floatbuf = alloca (sizeof(float) * net_period_up);
-
-                src.data_in = buf;
-                src.input_frames = nframes;
-
-                src.data_out = floatbuf;
-                src.output_frames = net_period_up;
-
-                src.src_ratio = (float) net_period_up / (float) nframes;
-                src.end_of_input = 0;
-
-                src_set_ratio (src_state, src.src_ratio);
-                src_process (src_state, &src);
-
-                for (i = 0; i < net_period_up; i++)
-                {
-                    packet_bufX[i] = htons (((uint16_t)((floatbuf[i] + 1.0) * 32767.0)));
-                }
-                src_node = jack_slist_next (src_node);
-            }
-            else
-#endif
-                for (i = 0; i < net_period_up; i++)
-                    packet_bufX[i] = htons(((uint16_t)((buf[i] + 1.0) * 32767.0)));
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // encode midi events from port to packet
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_up / 2;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_up);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-// render functions for 8bit
-void
-render_payload_to_jack_ports_8bit (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
-{
-    int chn = 0;
-    JSList *node = capture_ports;
-
-#if HAVE_SAMPLERATE
-    JSList *src_node = capture_srcs;
-#endif
-
-    int8_t *packet_bufX = (int8_t *)packet_payload;
-
-    if( !packet_payload )
-	return;
-
-    while (node != NULL)
-    {
-        int i;
-        //uint32_t val;
-#if HAVE_SAMPLERATE
-        SRC_DATA src;
-#endif
-
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-
-#if HAVE_SAMPLERATE
-        float *floatbuf = alloca (sizeof (float) * net_period_down);
-#endif
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio(porttype))
-        {
-#if HAVE_SAMPLERATE
-            // audio port, resample if necessary
-            if (net_period_down != nframes)
-            {
-                SRC_STATE *src_state = src_node->data;
-                for (i = 0; i < net_period_down; i++)
-                    floatbuf[i] = ((float) packet_bufX[i]) / 127.0;
-
-                src.data_in = floatbuf;
-                src.input_frames = net_period_down;
-
-                src.data_out = buf;
-                src.output_frames = nframes;
-
-                src.src_ratio = (float) nframes / (float) net_period_down;
-                src.end_of_input = 0;
-
-                src_set_ratio (src_state, src.src_ratio);
-                src_process (src_state, &src);
-                src_node = jack_slist_next (src_node);
-            }
-            else
-#endif
-                for (i = 0; i < net_period_down; i++)
-                    buf[i] = ((float) packet_bufX[i]) / 127.0;
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // midi port, decode midi events
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_down / 2;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-            decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_down);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-void
-render_jack_ports_to_payload_8bit (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
-{
-    int chn = 0;
-    JSList *node = playback_ports;
-#if HAVE_SAMPLERATE
-    JSList *src_node = playback_srcs;
-#endif
-
-    int8_t *packet_bufX = (int8_t *)packet_payload;
-
-    while (node != NULL)
-    {
-#if HAVE_SAMPLERATE
-        SRC_DATA src;
-#endif
-        int i;
-        jack_port_t *port = (jack_port_t *) node->data;
-
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-#if HAVE_SAMPLERATE
-            // audio port, resample if necessary
-            if (net_period_up != nframes)
-            {
-
-                SRC_STATE *src_state = src_node->data;
-
-                float *floatbuf = alloca (sizeof (float) * net_period_up);
-
-                src.data_in = buf;
-                src.input_frames = nframes;
-
-                src.data_out = floatbuf;
-                src.output_frames = net_period_up;
-
-                src.src_ratio = (float) net_period_up / (float) nframes;
-                src.end_of_input = 0;
-
-                src_set_ratio (src_state, src.src_ratio);
-                src_process (src_state, &src);
-
-                for (i = 0; i < net_period_up; i++)
-                    packet_bufX[i] = floatbuf[i] * 127.0;
-                src_node = jack_slist_next (src_node);
-            }
-            else
-#endif
-                for (i = 0; i < net_period_up; i++)
-                    packet_bufX[i] = buf[i] * 127.0;
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // encode midi events from port to packet
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_up / 4;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_up);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-#if HAVE_CELT
-// render functions for celt.
-void
-render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
-{
-    int chn = 0;
-    JSList *node = capture_ports;
-    JSList *src_node = capture_srcs;
-
-    unsigned char *packet_bufX = (unsigned char *)packet_payload;
-
-    while (node != NULL)
-    {
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-            // audio port, decode celt data.
-
-	    CELTDecoder *decoder = src_node->data;
-	    if( !packet_payload )
-		celt_decode_float( decoder, NULL, net_period_down, buf );
-	    else
-		celt_decode_float( decoder, packet_bufX, net_period_down, buf );
-
-	    src_node = jack_slist_next (src_node);
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // midi port, decode midi events
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_down / 2;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-	    if( packet_payload )
-		decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_down);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-void
-render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
-{
-    int chn = 0;
-    JSList *node = playback_ports;
-    JSList *src_node = playback_srcs;
-
-    unsigned char *packet_bufX = (unsigned char *)packet_payload;
-
-    while (node != NULL)
-    {
-        jack_port_t *port = (jack_port_t *) node->data;
-        jack_default_audio_sample_t* buf = jack_port_get_buffer (port, nframes);
-        const char *porttype = jack_port_type (port);
-
-        if (jack_port_is_audio (porttype))
-        {
-            // audio port, encode celt data.
-
-	    int encoded_bytes;
-	    float *floatbuf = alloca (sizeof(float) * nframes );
-	    memcpy( floatbuf, buf, nframes*sizeof(float) );
-	    CELTEncoder *encoder = src_node->data;
-	    encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up );
-	    if( encoded_bytes != net_period_up )
-		printf( "something in celt changed. netjack needs to be changed to handle this.\n" );
-	    src_node = jack_slist_next( src_node );
-        }
-        else if (jack_port_is_midi (porttype))
-        {
-            // encode midi events from port to packet
-            // convert the data buffer to a standard format (uint32_t based)
-            unsigned int buffer_size_uint32 = net_period_up / 2;
-            uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
-            encode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
-        }
-        packet_bufX = (packet_bufX + net_period_up);
-        node = jack_slist_next (node);
-        chn++;
-    }
-}
-
-#endif
-/* Wrapper functions with bitdepth argument... */
-void
-render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
-{
-    if (bitdepth == 8)
-        render_payload_to_jack_ports_8bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
-    else if (bitdepth == 16)
-        render_payload_to_jack_ports_16bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
-#if HAVE_CELT
-    else if (bitdepth == CELT_MODE)
-        render_payload_to_jack_ports_celt (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
-#endif
-    else
-        render_payload_to_jack_ports_float (packet_payload, net_period_down, capture_ports, capture_srcs, nframes, dont_htonl_floats);
-}
-
-void
-render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats)
-{
-    if (bitdepth == 8)
-        render_jack_ports_to_payload_8bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
-    else if (bitdepth == 16)
-        render_jack_ports_to_payload_16bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
-#if HAVE_CELT
-    else if (bitdepth == CELT_MODE)
-        render_jack_ports_to_payload_celt (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
-#endif
-    else
-        render_jack_ports_to_payload_float (playback_ports, playback_srcs, nframes, packet_payload, net_period_up, dont_htonl_floats);
-}
diff --git a/drivers/oss/.cvsignore b/drivers/oss/.cvsignore
deleted file mode 100644
index 6e5ca7e..0000000
--- a/drivers/oss/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-*.lo
-*.la
diff --git a/drivers/oss/Makefile.am b/drivers/oss/Makefile.am
deleted file mode 100644
index 0055520..0000000
--- a/drivers/oss/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-MAINTAINCLEANFILES = Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS) -I/usr/lib/oss/include
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_oss.la
-
-jack_oss_la_LDFLAGS = -module -avoid-version
-jack_oss_la_SOURCES = oss_driver.c oss_driver.h
-
-noinst_HEADERS = oss_driver.h
diff --git a/drivers/oss/oss_driver.c b/drivers/oss/oss_driver.c
deleted file mode 100644
index 42226e9..0000000
--- a/drivers/oss/oss_driver.c
+++ /dev/null
@@ -1,1305 +0,0 @@
-/*
-
-	OSS driver for Jack
-	Copyright (C) 2003-2007 Jussi Laako <jussi at sonarnerd.net>
-
-	This program is free software; you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation; either version 2 of the License, or
-	(at your option) any later version.
-
-	This program is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-
-	You should have received a copy of the GNU General Public License
-	along with this program; if not, write to the Free Software
-	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-	MA  02111-1307  USA
-
-*/
-
-
-#include <config.h>
-
-#ifdef USE_BARRIER
-/*
- * POSIX conformance level should be globally defined somewhere, possibly
- * in config.h? Otherwise it's pre 1993/09 level, which leaves out significant
- * parts of threading and realtime stuff. Note: most of the parts are still
- * defined as optional by the standard, so OS conformance to this level
- * doesn't necessarily mean everything exists.
- */
-#define _XOPEN_SOURCE	600
-#endif
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-#ifndef _THREAD_SAFE
-#define _THREAD_SAFE
-#endif
-#include <unistd.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <float.h>
-#include <stdarg.h>
-#include <getopt.h>
-#include <semaphore.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/thread.h>
-#include <sysdeps/time.h>
-
-#include "oss_driver.h"
-
-
-#ifndef SNDCTL_DSP_COOKEDMODE
-#ifdef _SIOWR
-#define SNDCTL_DSP_COOKEDMODE _SIOWR('P', 30, int)
-#else  /* _SIOWR */
-#warning "Unable to define cooked mode!"
-#define OSS_NO_COOKED_MODE
-#endif  /* _SIOWR */
-#endif  /* SNDCTL_DSP_COOKEDMODE */
-
-#define OSS_DRIVER_N_PARAMS	11
-const static jack_driver_param_desc_t oss_params[OSS_DRIVER_N_PARAMS] = {
-	{ "rate",
-	  'r',
-	  JackDriverParamUInt,
-	  { .ui = OSS_DRIVER_DEF_FS },
-	  "sample rate",
-	  "sample rate"
-	},
-	{ "period",
-	  'p',
-	  JackDriverParamUInt,
-	  { .ui = OSS_DRIVER_DEF_BLKSIZE },
-	  "period size",
-	  "period size"
-	},
-	{ "nperiods",
-	  'n',
-	  JackDriverParamUInt,
-	  { .ui = OSS_DRIVER_DEF_NPERIODS },
-	  "number of periods in buffer",
-	  "number of periods in buffer"
-	},
-	{ "wordlength",
-	  'w',
-	  JackDriverParamInt,
-	  { .i = OSS_DRIVER_DEF_BITS },
-	  "word length",
-	  "word length"
-	},
-	{ "inchannels",
-	  'i',
-	  JackDriverParamUInt,
-	  { .ui = OSS_DRIVER_DEF_INS },
-	  "capture channels",
-	  "capture channels"
-	},
-	{ "outchannels",
-	  'o',
-	  JackDriverParamUInt,
-	  { .ui = OSS_DRIVER_DEF_OUTS },
-	  "playback channels",
-	  "playback channels"
-	},
-	{ "capture",
-	  'C',
-	  JackDriverParamString,
-	  { .str = OSS_DRIVER_DEF_DEV },
-	  "input device",
-	  "input device"
-	},
-	{ "playback",
-	  'P',
-	  JackDriverParamString,
-	  { .str = OSS_DRIVER_DEF_DEV },
-	  "output device",
-	  "output device"
-	},
-	{ "ignorehwbuf",
-	  'b',
-	  JackDriverParamBool,
-	  { },
-	  "ignore hardware period size",
-	  "ignore hardware period size"
-	},
-	{ "input latency",
-	  'I',
-	  JackDriverParamUInt,
-	  { .ui = 0 },
-	  "system input latency",
-	  "system input latency"
-	},
-	{ "output latency",
-	  'O',
-	  JackDriverParamUInt,
-	  { .ui = 0 },
-	  "system output latency",
-	  "system output latency"
-	}
-};
-
-
-
-/* internal functions */
-
-
-static void set_period_size (oss_driver_t *driver, 
-	jack_nframes_t new_period_size)
-{
-	driver->period_size = new_period_size;
-
-	driver->period_usecs = 
-		((double) driver->period_size /
-		(double) driver->sample_rate) * 1e6;
-	driver->last_wait_ust = 0;
-	driver->last_periodtime = jack_get_microseconds();
-	driver->next_periodtime = 0;
-	driver->iodelay = 0.0F;
-}
-
-
-static inline void update_times (oss_driver_t *driver)
-{
-	driver->last_periodtime = jack_get_microseconds();
-	if (driver->next_periodtime > 0)
-	{
-		driver->iodelay = (float)
-			((long double) driver->last_periodtime - 
-			(long double) driver->next_periodtime);
-	}
-	else driver->iodelay = 0.0F;
-	driver->next_periodtime = 
-		driver->last_periodtime +
-		driver->period_usecs;
-}
-
-
-static inline void driver_cycle (oss_driver_t *driver)
-{
-	update_times(driver);
-	driver->engine->transport_cycle_start(driver->engine,
-		driver->last_periodtime);
-
-	driver->last_wait_ust = driver->last_periodtime;
-	driver->engine->run_cycle(driver->engine, 
-		driver->period_size, driver->iodelay);
-}
-
-
-static void copy_and_convert_in (jack_sample_t *dst, void *src, 
-	size_t nframes,	int channel, int chcount, int bits)
-{
-	int srcidx;
-	int dstidx;
-	signed short *s16src = (signed short *) src;
-	signed int *s32src = (signed int *) src;
-	double *f64src = (double *) src;
-	jack_sample_t scale;
-
-	srcidx = channel;
-	switch (bits)
-	{
-		case 16:
-			scale = 1.0f / 0x7fff;
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t) 
-					s16src[srcidx] * scale;
-				srcidx += chcount;
-			}
-			break;
-		case 24:
-			scale = 1.0f / 0x7fffff;
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t)
-					s32src[srcidx] * scale;
-				srcidx += chcount;
-			}
-			break;
-		case 32:
-			scale = 1.0f / 0x7fffffff;
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t)
-					s32src[srcidx] * scale;
-				srcidx += chcount;
-			}
-			break;
-		case 64:
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t) f64src[srcidx];
-				srcidx += chcount;
-			}
-			break;
-	}
-}
-
-
-static void copy_and_convert_out (void *dst, jack_sample_t *src, 
-	size_t nframes,	int channel, int chcount, int bits)
-{
-	int srcidx;
-	int dstidx;
-	signed short *s16dst = (signed short *) dst;
-	signed int *s32dst = (signed int *) dst;
-	double *f64dst = (double *) dst;
-	jack_sample_t scale;
-
-	dstidx = channel;
-	switch (bits)
-	{
-		case 16:
-			scale = 0x7fff;
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				s16dst[dstidx] = (signed short)
-					(src[srcidx] >= 0.0f) ?
-					(src[srcidx] * scale + 0.5f) :
-					(src[srcidx] * scale - 0.5f);
-				dstidx += chcount;
-			}
-			break;
-		case 24:
-			scale = 0x7fffff;
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				s32dst[dstidx] = (signed int)
-					(src[srcidx] >= 0.0f) ?
-					(src[srcidx] * scale + 0.5f) :
-					(src[srcidx] * scale - 0.5f);
-				dstidx += chcount;
-			}
-			break;
-		case 32:
-			scale = 0x7fffffff;
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				s32dst[dstidx] = (signed int)
-					(src[srcidx] >= 0.0f) ?
-					(src[srcidx] * scale + 0.5f) :
-					(src[srcidx] * scale - 0.5f);
-				dstidx += chcount;
-			}
-			break;
-		case 64:
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				f64dst[dstidx] = (double) src[srcidx];
-				dstidx += chcount;
-			}
-			break;
-	}
-}
-
-
-static void set_fragment (int fd, size_t fragsize, unsigned int fragcount)
-{
-	int fragsize_2p;
-	int fragments;
-
-	fragsize_2p = (int) (log(fragsize) / log(2.0) + 0.5);
-	fragments = ((fragcount << 16) | (fragsize_2p & 0xffff));
-	if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fragments) < 0)
-	{
-		jack_error("OSS: failed to set fragment size: %s@%i, errno=%d",
-			__FILE__, __LINE__, errno);
-	}
-}
-
-
-static int get_fragment (int fd)
-{
-	int fragsize;
-
-	if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &fragsize) < 0)
-	{
-		jack_error("OSS: failed to get fragment size: %s@%i, errno=%d",
-			__FILE__, __LINE__, errno);
-		return 0;
-	}
-	return fragsize;
-}
-
-
-static void *io_thread (void *);
-
-
-/* jack driver interface */
-
-
-static int oss_driver_attach (oss_driver_t *driver, jack_engine_t *engine)
-{
-	int port_flags;
-	unsigned int channel;
-	char channel_name[64];
-	jack_port_t *port;
-
-	driver->engine = engine;
-
-	engine->set_buffer_size(engine, driver->period_size);
-	engine->set_sample_rate(engine, driver->sample_rate);
-
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-	for (channel = 0; channel < driver->capture_channels; channel++)
-	{
-		snprintf(channel_name, sizeof(channel_name), 
-			"capture_%u", channel + 1);
-		port = jack_port_register(driver->client, channel_name,
-			JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
-		if (port == NULL)
-		{
-			jack_error("OSS: cannot register port for %s: %s@%i",
-				channel_name, __FILE__, __LINE__);
-			break;
-		}
-		jack_port_set_latency(port,
-			driver->period_size + driver->sys_in_latency);
-		driver->capture_ports = 
-			jack_slist_append(driver->capture_ports, port);
-	}
-
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-	for (channel = 0; channel < driver->playback_channels; channel++)
-	{
-		snprintf(channel_name, sizeof(channel_name),
-			"playback_%u", channel + 1);
-		port = jack_port_register(driver->client, channel_name,
-			JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
-		if (port == NULL)
-		{
-			jack_error("OSS: cannot register port for %s: %s@%i",
-				channel_name, __FILE__, __LINE__);
-			break;
-		}
-		jack_port_set_latency(port,
-			driver->period_size + driver->sys_out_latency);
-		driver->playback_ports =
-			jack_slist_append(driver->playback_ports, port);
-	}
-
-	jack_activate(driver->client);
-
-	return 0;
-}
-
-
-static int oss_driver_detach (oss_driver_t *driver, jack_engine_t *engine)
-{
-	JSList *node;
-
-	if (driver->engine == NULL)
-		return -1;
-
-	/*jack_deactivate(driver->client);*/	/* ? */
-
-	node = driver->capture_ports;
-	while (node != NULL)
-	{
-		jack_port_unregister(driver->client, 
-			((jack_port_t *) node->data));
-		node = jack_slist_next(node);
-	}
-	jack_slist_free(driver->capture_ports);
-	driver->capture_ports = NULL;
-
-	node = driver->playback_ports;
-	while (node != NULL)
-	{
-		jack_port_unregister(driver->client,
-			((jack_port_t *) node->data));
-		node = jack_slist_next(node);
-	}
-	jack_slist_free(driver->playback_ports);
-	driver->playback_ports = NULL;
-
-	driver->engine = NULL;
-
-	return 0;
-}
-
-
-static int oss_driver_start (oss_driver_t *driver)
-{
-	int flags = 0;
-	int format;
-	int channels;
-	int samplerate;
-	int infd = driver->infd;
-	int outfd = driver->outfd;
-	unsigned int period_size;
-	size_t samplesize;
-	size_t fragsize;
-	const char *indev = driver->indev;
-	const char *outdev = driver->outdev;
-
-	switch (driver->bits)
-	{
-		case 24:
-		case 32:
-			samplesize = sizeof(int);
-			break;
-		case 64:
-			samplesize = sizeof(double);
-			break;
-		case 16:
-		default:
-			samplesize = sizeof(short);
-			break;
-	}
-	driver->trigger = 0;
-	if (strcmp(indev, outdev) != 0)
-	{
-		if (driver->capture_channels > 0)
-		{
-			infd = open(indev, O_RDONLY|O_EXCL);
-			if (infd < 0)
-			{
-				jack_error(
-					"OSS: failed to open input device %s: %s@%i, errno=%d",
-					indev, __FILE__, __LINE__, errno);
-			}
-#ifndef OSS_NO_COOKED_MODE
-			ioctl(infd, SNDCTL_DSP_COOKEDMODE, &flags);
-#endif
-			fragsize = driver->period_size * 
-				driver->capture_channels * samplesize;
-			set_fragment(infd, fragsize, driver->nperiods);
-		}
-		else infd = -1;
-
-		if (driver->playback_channels > 0)
-		{
-			outfd = open(outdev, O_WRONLY|O_EXCL);
-			if (outfd < 0)
-			{
-				jack_error(
-					"OSS: failed to open output device %s: %s@%i, errno=%d",
-					outdev, __FILE__, __LINE__, errno);
-			}
-#ifndef OSS_NO_COOKED_MODE
-			ioctl(outfd, SNDCTL_DSP_COOKEDMODE, &flags);
-#endif
-			fragsize = driver->period_size * 
-				driver->playback_channels * samplesize;
-			set_fragment(outfd, fragsize, driver->nperiods);
-		}
-		else outfd = -1;
-	}
-	else
-	{
-		if (driver->capture_channels != 0 &&
-			driver->playback_channels == 0)
-		{
-			infd = open(indev, O_RDWR|O_EXCL);
-			outfd = -1;
-			if (infd < 0)
-			{
-				jack_error(
-					"OSS: failed to open device %s: %s@%i, errno=%d",
-					indev, __FILE__, __LINE__, errno);
-				return -1;
-			}
-#ifndef OSS_NO_COOKED_MODE
-			ioctl(infd, SNDCTL_DSP_COOKEDMODE, &flags);
-#endif
-		}
-		else if (driver->capture_channels == 0 &&
-			driver->playback_channels != 0)
-		{
-			infd = -1;
-			outfd = open(outdev, O_RDWR|O_EXCL);
-			if (outfd < 0)
-			{
-				jack_error(
-					"OSS: failed to open device %s: %s@%i, errno=%d",
-					outdev, __FILE__, __LINE__, errno);
-				return -1;
-			}
-#ifndef OSS_NO_COOKED_MODE
-			ioctl(outfd, SNDCTL_DSP_COOKEDMODE, &flags);
-#endif
-		}
-		else
-		{
-			infd = outfd = open(indev, O_RDWR|O_EXCL);
-			if (infd < 0)
-			{
-				jack_error(
-					"OSS: failed to open device %s: %s@%i, errno=%d",
-					indev, __FILE__, __LINE__, errno);
-				return -1;
-			}
-#ifndef OSS_NO_COOKED_MODE
-			ioctl(infd, SNDCTL_DSP_COOKEDMODE, &flags);
-#endif
-		}
-		if (infd >= 0 && outfd >= 0)
-		{
-			ioctl(outfd, SNDCTL_DSP_SETTRIGGER, &driver->trigger);
-			driver->trigger = (PCM_ENABLE_INPUT|PCM_ENABLE_OUTPUT);
-			if (ioctl(infd, SNDCTL_DSP_SETDUPLEX, 0) < 0)
-			{
-				if (errno != EINVAL) /* Dont care */
-					jack_error(
-						"OSS: failed to enable full duplex for %s: %s@%i, errno=%d",
-						indev, __FILE__, __LINE__,
-						errno);
-			}
-		}
-		if (infd >= 0)
-		{
-			fragsize = driver->period_size * 
-				driver->capture_channels * samplesize;
-			set_fragment(infd, fragsize, driver->nperiods);
-		}
-		if (outfd >= 0 && infd < 0)
-		{
-			fragsize = driver->period_size * 
-				driver->playback_channels * samplesize;
-			set_fragment(outfd, fragsize, driver->nperiods);
-		}
-	}
-	driver->infd = infd;
-	driver->outfd = outfd;
-	
-	if (infd >= 0)
-	{
-		format = driver->format;
-		if (ioctl(infd, SNDCTL_DSP_SETFMT, &format) < 0)
-			jack_error(
-				"OSS: failed to set format for %s: %s@%i, errno=%d", 
-				indev, __FILE__, __LINE__, errno);
-		channels = driver->capture_channels;
-		if (ioctl(infd, SNDCTL_DSP_CHANNELS, &channels) < 0)
-			jack_error(
-				"OSS: failed to set channels for %s: %s@%i, errno=%d", 
-				indev, __FILE__, __LINE__, errno);
-		samplerate = driver->sample_rate;
-		if (ioctl(infd, SNDCTL_DSP_SPEED, &samplerate) < 0)
-			jack_error(
-				"OSS: failed to set samplerate for %s: %s@%i, errno=%d", 
-				indev, __FILE__, __LINE__, errno);
-		jack_info("oss_driver: %s : 0x%x/%i/%i (%i)", indev, 
-			format, channels, samplerate, get_fragment(infd));
-		
-		period_size = get_fragment(infd) / samplesize / channels;
-		if (period_size != driver->period_size && 
-			!driver->ignorehwbuf)
-		{
-			jack_info("oss_driver: period size update: %u",
-				period_size);
-			driver->period_size = period_size;
-			driver->period_usecs = 
-				((double) driver->period_size / 
-				 (double) driver->sample_rate) * 1e6;
-			driver->engine->set_buffer_size(driver->engine, 
-				driver->period_size);
-		}
-	}
-
-	if (outfd >= 0 && infd != outfd)
-	{
-		format = driver->format;
-		if (ioctl(outfd, SNDCTL_DSP_SETFMT, &format) < 0)
-			jack_error(
-				"OSS: failed to set format for %s: %s@%i, errno=%d", 
-				outdev, __FILE__, __LINE__, errno);
-		channels = driver->playback_channels;
-		if (ioctl(outfd, SNDCTL_DSP_CHANNELS, &channels) < 0)
-			jack_error(
-				"OSS: failed to set channels for %s: %s@%i, errno=%d", 
-				outdev, __FILE__, __LINE__, errno);
-		samplerate = driver->sample_rate;
-		if (ioctl(outfd, SNDCTL_DSP_SPEED, &samplerate) < 0)
-			jack_error(
-				"OSS: failed to set samplerate for %s: %s@%i, errno=%d", 
-				outdev, __FILE__, __LINE__, errno);
-		jack_info("oss_driver: %s : 0x%x/%i/%i (%i)", outdev, 
-			format, channels, samplerate, 
-			get_fragment(outfd));
-
-		period_size = get_fragment(outfd) / samplesize / channels;
-		if (period_size != driver->period_size &&
-			!driver->ignorehwbuf)
-		{
-			jack_info("oss_driver: period size update: %u",
-				period_size);
-			driver->period_size = period_size;
-			driver->period_usecs = 
-				((double) driver->period_size / 
-				 (double) driver->sample_rate) * 1e6;
-			driver->engine->set_buffer_size(driver->engine, 
-				driver->period_size);
-		}
-	}
-
-	if (driver->capture_channels > 0)
-	{
-		driver->indevbufsize = driver->period_size * 
-			driver->capture_channels * samplesize;
-		driver->indevbuf = malloc(driver->indevbufsize);
-		if (driver->indevbuf == NULL)
-		{
-			jack_error( "OSS: malloc() failed: %s@%i", 
-				__FILE__, __LINE__);
-			return -1;
-		}
-		memset(driver->indevbuf, 0x00, driver->indevbufsize);
-	}
-	else
-	{
-		driver->indevbufsize = 0;
-		driver->indevbuf = NULL;
-	}
-
-	if (driver->playback_channels > 0)
-	{
-		driver->outdevbufsize = driver->period_size * 
-			driver->playback_channels * samplesize;
-		driver->outdevbuf = malloc(driver->outdevbufsize);
-		if (driver->outdevbuf == NULL)
-		{
-			jack_error("OSS: malloc() failed: %s@%i", 
-				__FILE__, __LINE__);
-			return -1;
-		}
-		memset(driver->outdevbuf, 0x00, driver->outdevbufsize);
-	}
-	else
-	{
-		driver->outdevbufsize = 0;
-		driver->outdevbuf = NULL;
-	}
-
-	jack_info("oss_driver: indevbuf %zd B, outdevbuf %zd B",
-		driver->indevbufsize, driver->outdevbufsize);
-
-	pthread_mutex_init(&driver->mutex_in, NULL);
-	pthread_mutex_init(&driver->mutex_out, NULL);
-#	ifdef USE_BARRIER
-	puts("oss_driver: using barrier mode, (dual thread)");
-	pthread_barrier_init(&driver->barrier, NULL, 2);
-#	else
-	puts("oss_driver: not using barrier mode, (single thread)");
-#	endif
-	sem_init(&driver->sem_start, 0, 0);
-	driver->run = 1;
-	driver->threads = 0;
-	if (infd >= 0)
-	{
-		if (jack_client_create_thread(NULL, &driver->thread_in, 
-			driver->engine->rtpriority, 
-			driver->engine->control->real_time, 
-			io_thread, driver) < 0)
-		{
-			jack_error("OSS: jack_client_create_thread() failed: %s@%i",
-				__FILE__, __LINE__);
-			return -1;
-		}
-		driver->threads |= 1;
-	}
-#	ifdef USE_BARRIER
-	if (outfd >= 0)
-	{
-		if (jack_client_create_thread(NULL, &driver->thread_out, 
-			driver->engine->rtpriority, 
-			driver->engine->control->real_time, 
-			io_thread, driver) < 0)
-		{
-			jack_error("OSS: jack_client_create_thread() failed: %s@%i",
-				__FILE__, __LINE__);
-			return -1;
-		}
-		driver->threads |= 2;
-	}
-#	endif
-
-	if (driver->threads & 1) sem_post(&driver->sem_start);
-	if (driver->threads & 2) sem_post(&driver->sem_start);
-
-	driver->last_periodtime = jack_get_microseconds();
-	driver->next_periodtime = 0;
-	driver->iodelay = 0.0F;
-
-	return 0;
-}
-
-
-static int oss_driver_stop (oss_driver_t *driver)
-{
-	void *retval;
-
-	driver->run = 0;
-	if (driver->threads & 1)
-	{
-		if (pthread_join(driver->thread_in, &retval) < 0)
-		{
-			jack_error("OSS: pthread_join() failed: %s@%i",
-				__FILE__, __LINE__);
-			return -1;
-		}
-	}
-	if (driver->threads & 2)
-	{
-		if (pthread_join(driver->thread_out, &retval) < 0)
-		{
-			jack_error("OSS: pthread_join() failed: %s@%i",
-				__FILE__, __LINE__);
-			return -1;
-		}
-	}
-	sem_destroy(&driver->sem_start);
-#	ifdef USE_BARRIER
-	pthread_barrier_destroy(&driver->barrier);
-#	endif
-	pthread_mutex_destroy(&driver->mutex_in);
-	pthread_mutex_destroy(&driver->mutex_out);
-
-	if (driver->outfd >= 0 && driver->outfd != driver->infd)
-	{
-		close(driver->outfd);
-		driver->outfd = -1;
-	}
-	if (driver->infd >= 0)
-	{
-		close(driver->infd);
-		driver->infd = -1;
-	}
-
-	if (driver->indevbuf != NULL)
-	{
-		free(driver->indevbuf);
-		driver->indevbuf = NULL;
-	}
-	if (driver->outdevbuf != NULL)
-	{
-		free(driver->outdevbuf);
-		driver->outdevbuf = NULL;
-	}
-
-	return 0;
-}
-
-
-static int oss_driver_read (oss_driver_t *driver, jack_nframes_t nframes)
-{
-	int channel;
-	jack_sample_t *portbuf;
-	JSList *node;
-	jack_port_t *port;
-
-	if (!driver->run) return 0;
-	if (nframes != driver->period_size)
-	{
-		jack_error(
-			"OSS: read failed nframes != period_size  (%u/%u): %s@%i",
-			nframes, driver->period_size, __FILE__, __LINE__);
-		return -1;
-	}
-
-	pthread_mutex_lock(&driver->mutex_in);
-
-	node = driver->capture_ports;
-	channel = 0;
-	while (node != NULL)
-	{
-		port = (jack_port_t *) node->data;
-
-		if (jack_port_connected(port))
-		{
-			portbuf = jack_port_get_buffer(port, nframes);
-			copy_and_convert_in(portbuf, driver->indevbuf, 
-				nframes, channel, 
-				driver->capture_channels,
-				driver->bits);
-		}
-
-		node = jack_slist_next(node);
-		channel++;
-	}
-
-	pthread_mutex_unlock(&driver->mutex_in);
-
-	return 0;
-}
-
-
-static int oss_driver_write (oss_driver_t *driver, jack_nframes_t nframes)
-{
-	int channel;
-	jack_sample_t *portbuf;
-	JSList *node;
-	jack_port_t *port;
-
-	if (!driver->run) return 0;
-	if (nframes != driver->period_size)
-	{
-		jack_error(
-			"OSS: write failed nframes != period_size  (%u/%u): %s@%i",
-			nframes, driver->period_size, __FILE__, __LINE__);
-		return -1;
-	}
-
-	pthread_mutex_lock(&driver->mutex_out);
-
-	node = driver->playback_ports;
-	channel = 0;
-	while (node != NULL)
-	{
-		port = (jack_port_t *) node->data;
-
-		if (jack_port_connected(port))
-		{
-			portbuf = jack_port_get_buffer(port, nframes);
-			copy_and_convert_out(driver->outdevbuf, portbuf, 
-				nframes, channel,
-				driver->playback_channels,
-				driver->bits);
-		}
-
-		node = jack_slist_next(node);
-		channel++;
-	}
-
-	pthread_mutex_unlock(&driver->mutex_out);
-
-	return 0;
-}
-
-
-static int oss_driver_null_cycle (oss_driver_t *driver, jack_nframes_t nframes)
-{
-	pthread_mutex_lock(&driver->mutex_in);
-	memset(driver->indevbuf, 0x00, driver->indevbufsize);
-	pthread_mutex_unlock(&driver->mutex_in);
-
-	pthread_mutex_lock(&driver->mutex_out);
-	memset(driver->outdevbuf, 0x00, driver->outdevbufsize);
-	pthread_mutex_unlock(&driver->mutex_out);
-
-	return 0;
-}
-
-
-static int oss_driver_bufsize (oss_driver_t *driver, jack_nframes_t nframes)
-{
-	oss_driver_stop(driver);
-
-	set_period_size(driver, nframes);
-	driver->engine->set_buffer_size(driver->engine, driver->period_size);
-	jack_info("oss_driver: period size update: %u", nframes);
-
-	oss_driver_start(driver);
-
-	return 0;
-}
-
-
-/* internal driver thread */
-
-
-#ifdef USE_BARRIER
-static inline void synchronize (oss_driver_t *driver)
-{
-	if (driver->threads == 3)
-	{
-		if (pthread_barrier_wait(&driver->barrier) ==
-			PTHREAD_BARRIER_SERIAL_THREAD)
-		{
-			driver_cycle(driver);
-		}
-	}
-	else
-	{
-		driver_cycle(driver);
-	}
-}
-#endif
-
-
-static void *io_thread (void *param)
-{
-	size_t localsize;
-	ssize_t io_res;
-	void *localbuf;
-	oss_driver_t *driver = (oss_driver_t *) param;
-
-	sem_wait(&driver->sem_start);
-
-#	ifdef USE_BARRIER
-	if (pthread_self() == driver->thread_in)
-	{
-		localsize = driver->indevbufsize;
-		localbuf = malloc(localsize);
-		if (localbuf == NULL)
-		{
-			jack_error("OSS: malloc() failed: %s@%i",
-				__FILE__, __LINE__);
-			return NULL;
-		}
-
-		while (driver->run)
-		{
-			io_res = read(driver->infd, localbuf, localsize);
-			if (io_res < (ssize_t) localsize)
-			{
-				jack_error(
-					"OSS: read() failed: %s@%i, count=%d/%d, errno=%d",
-					__FILE__, __LINE__, io_res, localsize,
-					errno);
-				break;
-			}
-
-			pthread_mutex_lock(&driver->mutex_in);
-			memcpy(driver->indevbuf, localbuf, localsize);
-			pthread_mutex_unlock(&driver->mutex_in);
-
-			synchronize(driver);
-		}
-
-		free(localbuf);
-	}
-	else if (pthread_self() == driver->thread_out)
-	{
-		localsize = driver->outdevbufsize;
-		localbuf = malloc(localsize);
-		if (localbuf == NULL)
-		{
-			jack_error("OSS: malloc() failed: %s@%i",
-				__FILE__, __LINE__);
-			return NULL;
-		}
-		if (driver->trigger)
-		{
-			/* don't care too much if this fails */
-			memset(localbuf, 0x00, localsize);
-			write(driver->outfd, localbuf, localsize);
-			ioctl(driver->outfd, SNDCTL_DSP_SETTRIGGER, &driver->trigger);
-		}
-
-		while (driver->run)
-		{
-			pthread_mutex_lock(&driver->mutex_out);
-			memcpy(localbuf, driver->outdevbuf, localsize);
-			pthread_mutex_unlock(&driver->mutex_out);
-
-			io_res = write(driver->outfd, localbuf, localsize);
-			if (io_res < (ssize_t) localsize)
-			{
-				jack_error(
-					"OSS: write() failed: %s@%i, count=%d/%d, errno=%d",
-					__FILE__, __LINE__, io_res, localsize,
-					errno);
-				break;
-			}
-
-			synchronize(driver);
-		}
-
-		free(localbuf);
-	}
-#	else
-	localsize = (driver->indevbufsize >= driver->outdevbufsize) ?
-		driver->indevbufsize : driver->outdevbufsize;
-	localbuf = malloc(localsize);
-	if (localbuf == NULL)
-	{
-		jack_error("OSS: malloc() failed: %s@%i", __FILE__, __LINE__);
-		return NULL;
-	}
-	if (driver->trigger)
-	{
-		/* don't care too much if this fails */
-		memset(localbuf, 0x00, localsize);
-		write(driver->outfd, localbuf, driver->outdevbufsize);
-		ioctl(driver->outfd, SNDCTL_DSP_SETTRIGGER, &driver->trigger);
-	}
-
-	while (driver->run)
-	{
-		if (driver->playback_channels > 0)
-		{
-			pthread_mutex_lock(&driver->mutex_out);
-			memcpy(localbuf, driver->outdevbuf, 
-				driver->outdevbufsize);
-			pthread_mutex_unlock(&driver->mutex_out);
-
-			io_res = write(driver->outfd, localbuf, 
-				driver->outdevbufsize);
-			if (io_res < (ssize_t) driver->outdevbufsize)
-			{
-				jack_error(
-					"OSS: write() failed: %s@%i, count=%d/%d, errno=%d",
-					__FILE__, __LINE__, io_res,
-					driver->outdevbufsize, errno);
-				break;
-			}
-		}
-
-		if (driver->capture_channels > 0)
-		{
-			io_res = read(driver->infd, localbuf, 
-				driver->indevbufsize);
-			if (io_res < (ssize_t) driver->indevbufsize)
-			{
-				jack_error(
-					"OSS: read() failed: %s@%i, count=%d/%d, errno=%d",
-					__FILE__, __LINE__, io_res,
-					driver->indevbufsize, errno);
-				break;
-			}
-
-			pthread_mutex_lock(&driver->mutex_in);
-			memcpy(driver->indevbuf, localbuf, 
-				driver->indevbufsize);
-			pthread_mutex_unlock(&driver->mutex_in);
-		}
-
-		driver_cycle(driver);
-	}
-
-	free(localbuf);
-#	endif
-
-	return NULL;
-}
-
-
-/* jack driver published interface */
-
-
-const char driver_client_name[] = "oss";
-
-
-void driver_finish (jack_driver_t *);
-
-
-jack_driver_desc_t * driver_get_descriptor ()
-{
-	jack_driver_desc_t *desc;
-	jack_driver_param_desc_t *params;
-
-	desc = (jack_driver_desc_t *) calloc(1, sizeof(jack_driver_desc_t));
-	if (desc == NULL)
-	{
-		jack_error("oss_driver: calloc() failed: %s@%i, errno=%d",
-			__FILE__, __LINE__, errno);
-		return NULL;
-	}
-	strcpy(desc->name, driver_client_name);
-	desc->nparams = OSS_DRIVER_N_PARAMS;
-
-	params = calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
-	if (params == NULL)
-	{
-		jack_error("oss_driver: calloc() failed: %s@%i, errno=%d",
-			__FILE__, __LINE__, errno);
-		return NULL;
-	}
-	memcpy(params, oss_params, 
-		desc->nparams * sizeof(jack_driver_param_desc_t));
-	desc->params = params;
-
-	return desc;
-}
-
-
-jack_driver_t * driver_initialize (jack_client_t *client, 
-	JSList * params)
-{
-	int bits = OSS_DRIVER_DEF_BITS;
-	jack_nframes_t sample_rate = OSS_DRIVER_DEF_FS;
-	jack_nframes_t period_size = OSS_DRIVER_DEF_BLKSIZE;
-	jack_nframes_t in_latency = 0;
-	jack_nframes_t out_latency = 0;
-	unsigned int nperiods = OSS_DRIVER_DEF_NPERIODS;
-	unsigned int capture_channels = OSS_DRIVER_DEF_INS;
-	unsigned int playback_channels = OSS_DRIVER_DEF_OUTS;
-	const JSList *pnode;
-	const jack_driver_param_t *param;
-	oss_driver_t *driver;
-
-	driver = (oss_driver_t *) malloc(sizeof(oss_driver_t));
-	if (driver == NULL)
-	{
-		jack_error("OSS: malloc() failed: %s@%i, errno=%d",
-			__FILE__, __LINE__, errno);
-		return NULL;
-	}
-	jack_driver_init((jack_driver_t *) driver);
-
-	driver->attach = (JackDriverAttachFunction) oss_driver_attach;
-	driver->detach = (JackDriverDetachFunction) oss_driver_detach;
-	driver->start = (JackDriverStartFunction) oss_driver_start;
-	driver->stop = (JackDriverStopFunction) oss_driver_stop;
-	driver->read = (JackDriverReadFunction) oss_driver_read;
-	driver->write = (JackDriverWriteFunction) oss_driver_write;
-	driver->null_cycle = (JackDriverNullCycleFunction) 
-		oss_driver_null_cycle;
-	driver->bufsize = (JackDriverBufSizeFunction) oss_driver_bufsize;
-
-	driver->indev = NULL;
-	driver->outdev = NULL;
-	driver->ignorehwbuf = 0;
-	driver->trigger = 0;
-
-	pnode = params;
-	while (pnode != NULL)
-	{
-		param = (const jack_driver_param_t *) pnode->data;
-
-		switch (param->character)
-		{
-			case 'r':
-				sample_rate = param->value.ui;
-				break;
-			case 'p':
-				period_size = param->value.ui;
-				break;
-			case 'n':
-				nperiods = param->value.ui;
-				break;
-			case 'w':
-				bits = param->value.i;
-				break;
-			case 'i':
-				capture_channels = param->value.ui;
-				break;
-			case 'o':
-				playback_channels = param->value.ui;
-				break;
-			case 'C':
-				driver->indev = strdup(param->value.str);
-				break;
-			case 'P':
-				driver->outdev = strdup(param->value.str);
-				break;
-			case 'b':
-				driver->ignorehwbuf = 1;
-				break;
-			case 'I':
-				in_latency = param->value.ui;
-				break;
-			case 'O':
-				out_latency = param->value.ui;
-				break;
-		}
-		pnode = jack_slist_next(pnode);
-	}
-	
-	driver->sample_rate = sample_rate;
-	driver->period_size = period_size;
-	driver->nperiods = nperiods;
-	driver->bits = bits;
-	driver->capture_channels = capture_channels;
-	driver->playback_channels = playback_channels;
-	driver->sys_in_latency = in_latency;
-	driver->sys_out_latency = out_latency;
-
-	set_period_size(driver, period_size);
-	
-	driver->finish = driver_finish;
-
-	if (driver->indev == NULL)
-		driver->indev = strdup(OSS_DRIVER_DEF_DEV);
-	if (driver->outdev == NULL)
-		driver->outdev = strdup(OSS_DRIVER_DEF_DEV);
-	driver->infd = -1;
-	driver->outfd = -1;
-	switch (driver->bits)
-	{
-#		ifndef OSS_ENDIAN
-#		ifdef __GNUC__
-#		if (defined(__i386__) || defined(__alpha__) || defined(__arm__) || defined(__x86_64__))
-#		define OSS_LITTLE_ENDIAN 1234
-#		define OSS_ENDIAN OSS_LITTLE_ENDIAN
-#		else
-#		define OSS_BIG_ENDIAN 4321
-#		define OSS_ENDIAN OSS_BIG_ENDIAN
-#		endif
-#		else /* __GNUC__ */
-#		if (defined(_AIX) || defined(AIX) || defined(sparc) || defined(__hppa) || defined(PPC) || defined(__powerpc__) && !defined(i386) && !defined(__i386) && !defined(__i386__))
-#		define OSS_BIG_ENDIAN 4321
-#		define OSS_ENDIAN OSS_BIG_ENDIAN
-#		else
-#		define OSS_LITTLE_ENDIAN 1234
-#		define OSS_ENDIAN OSS_LITTLE_ENDIAN
-#		endif
-#		endif /* __GNUC__ */
-#		endif /* OSS_ENDIAN */
-#		if (OSS_ENDIAN == 1234)
-		/* little-endian architectures */
-		case 24:	/* little-endian LSB aligned 24-bits in 32-bits  integer */
-			driver->format = 0x00008000;
-			break;
-		case 32:	/* little-endian 32-bit integer */
-			driver->format = 0x00001000;
-			break;
-		case 64:	/* native-endian 64-bit float */
-			driver->format = 0x00004000;
-			break;
-		case 16:	/* little-endian 16-bit integer */
-		default:
-			driver->format = 0x00000010;
-			break;
-		/* big-endian architectures */
-#		else
-		case 24:	/* big-endian LSB aligned 24-bits in 32-bits integer */
-			break;
-			driver->format = 0x00010000;
-		case 32:	/* big-endian 32-bit integer */
-			driver->format = 0x00002000;
-			break;
-		case 64:	/* native-endian 64-bit float */
-			driver->format = 0x00004000;
-			break;
-		case 16:	/* big-endian 16-bit integer */
-		default:
-			driver->format = 0x00000020;
-#		endif
-	}
-
-	driver->indevbuf = driver->outdevbuf = NULL;
-
-	driver->capture_ports = NULL;
-	driver->playback_ports = NULL;
-
-	driver->engine = NULL;
-	driver->client = client;
-
-	return ((jack_driver_t *) driver);
-}
-
-
-void driver_finish (jack_driver_t *driver)
-{
-	oss_driver_t *oss_driver = (oss_driver_t *) driver;
-
-	oss_driver = (oss_driver_t *) driver;
-	if (oss_driver->indev != NULL)
-		free(oss_driver->indev);
-	if (oss_driver->outdev != NULL)
-		free(oss_driver->outdev);
-	free(driver);
-}
-
diff --git a/drivers/oss/oss_driver.h b/drivers/oss/oss_driver.h
deleted file mode 100644
index bcb2bd3..0000000
--- a/drivers/oss/oss_driver.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-	OSS driver for Jack
-	Copyright (C) 2003-2007 Jussi Laako <jussi at sonarnerd.net>
-
-	This program is free software; you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation; either version 2 of the License, or
-	(at your option) any later version.
-
-	This program is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-
-	You should have received a copy of the GNU General Public License
-	along with this program; if not, write to the Free Software
-	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-	MA  02111-1307  USA
-
-*/
-
-
-#ifndef __JACK_OSS_DRIVER_H__
-#define __JACK_OSS_DRIVER_H__
-
-#include <sys/types.h>
-#include <pthread.h>
-#include <semaphore.h>
-
-#include <jack/types.h>
-#include <jack/jslist.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-
-
-#define OSS_DRIVER_DEF_DEV	"/dev/dsp"
-#define OSS_DRIVER_DEF_FS	48000
-#define OSS_DRIVER_DEF_BLKSIZE	1024
-#define OSS_DRIVER_DEF_NPERIODS	2
-#define OSS_DRIVER_DEF_BITS	16
-#define OSS_DRIVER_DEF_INS	2
-#define OSS_DRIVER_DEF_OUTS	2
-
-
-typedef jack_default_audio_sample_t jack_sample_t;
-
-typedef struct _oss_driver
-{
-	JACK_DRIVER_DECL
-
-	jack_nframes_t sample_rate;
-	jack_nframes_t period_size;
-	unsigned int nperiods;
-	int bits;
-	unsigned int capture_channels;
-	unsigned int playback_channels;
-
-	char *indev;
-	char *outdev;
-	int infd;
-	int outfd;
-	int format;
-	int ignorehwbuf;
-	int trigger;
-
-	size_t indevbufsize;
-	size_t outdevbufsize;
-	size_t portbufsize;
-	void *indevbuf;
-	void *outdevbuf;
-
-	float iodelay;
-	jack_time_t last_periodtime;
-	jack_time_t next_periodtime;
-	jack_nframes_t sys_in_latency;
-	jack_nframes_t sys_out_latency;
-
-	JSList *capture_ports;
-	JSList *playback_ports;
-
-	jack_engine_t *engine;
-	jack_client_t *client;
-
-	volatile int run;
-	volatile int threads;
-	pthread_t thread_in;
-	pthread_t thread_out;
-	pthread_mutex_t mutex_in;
-	pthread_mutex_t mutex_out;
-#	ifdef USE_BARRIER
-	pthread_barrier_t barrier;
-#	endif
-	sem_t sem_start;
-} oss_driver_t;
-
-
-#endif
-
diff --git a/drivers/portaudio/.cvsignore b/drivers/portaudio/.cvsignore
deleted file mode 100644
index c5d084f..0000000
--- a/drivers/portaudio/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-*.lo
-*.la
-*.loT
diff --git a/drivers/portaudio/Makefile.am b/drivers/portaudio/Makefile.am
deleted file mode 100644
index a60eb5f..0000000
--- a/drivers/portaudio/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-MAINTAINERCLEANFILES=Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS)
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_portaudio.la
-
-jack_portaudio_la_LDFLAGS = -module -avoid-version
-jack_portaudio_la_SOURCES = portaudio_driver.c portaudio_driver.h
-
-noinst_HEADERS = portaudio_driver.h
-
-jack_portaudio_la_LIBADD = $(PA_LIBS)
diff --git a/drivers/portaudio/portaudio_driver.c b/drivers/portaudio/portaudio_driver.c
deleted file mode 100644
index c11aee9..0000000
--- a/drivers/portaudio/portaudio_driver.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright © Grame 2003
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
-    grame at rd.grame.fr
-    
-    02-09-03 : Modify jack port naming : add the name of the used driver
-               Add the -n option to load a specific driver using it's name
-    04-09-03 : Correct bug in -n option management : input and ouput have to be treated separately
-    08-09-03 : More robust driver loading code : new portaudio_load_default and portaudio_load_driver functions.
-    24-09-03 : Does not tries to load default device if the required one is not found, returns and error.
-    14-10-03 : After jack port name size extension, does not use fixed length for CoreAudio driver name anymore
-	09-01-04 : Handle different value for channel in and channel out (using -i and -o)
-	12-01-04 : Connect port names (inverse "in" and "out")    	
-	13-01-04 : Correct the length of jack port : use JACK_PORT_NAME_SIZE
-	22-03-04 : Remove jack_init_time, rename input and ouput ports using "capture" and "playback" 
-    10-11-04 : S. Letz: Add management of -I option for use with JackPilot.
-	17-11-04 : S. Letz: Better debug code.
-	03-02-05 : S. Letz: fix several driver detection bugs on OSX.
-	06-08-05 : S.Letz: Remove the "-I" parameter, change the semantic of "-n" parameter on OSX : -n (driver name) now correctly uses the PropertyDeviceUID
-			  (persistent accross reboot...) as the identifier for the used coreaudio driver.
-
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include <jack/engine.h>
-#include "portaudio_driver.h"
-
-#ifdef JACK_USE_MACH_THREADS
-
-#include <CoreAudio/CoreAudio.h>
-#include <CoreFoundation/CFString.h>
-
-static OSStatus get_device_name_from_id(AudioDeviceID id, char name[60])
-{
-    UInt32 size = sizeof(char) * 60;
-	OSStatus stat = AudioDeviceGetProperty(id, 0, false,
-					   kAudioDevicePropertyDeviceName,
-					   &size,
-					   &name[0]);
-    return stat;
-}
-
-static OSStatus get_device_id_from_num(int i, AudioDeviceID * id)
-{
-    OSStatus theStatus;
-    UInt32 theSize;
-    int nDevices;
-    AudioDeviceID *theDeviceList;
-
-    theStatus =
-	AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices,
-				     &theSize, NULL);
-    nDevices = theSize / sizeof(AudioDeviceID);
-    theDeviceList =
-	(AudioDeviceID *) malloc(nDevices * sizeof(AudioDeviceID));
-    theStatus =
-	AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &theSize,
-				 theDeviceList);
-
-    *id = theDeviceList[i];
-    return theStatus;
-}
-
-static OSStatus get_device_id_from_uid(char* UID, AudioDeviceID* id)
-{
-	UInt32 size = sizeof(AudioValueTranslation);
-	CFStringRef inIUD = CFStringCreateWithCString(NULL, UID, CFStringGetSystemEncoding());
-	AudioValueTranslation value = { &inIUD, sizeof(CFStringRef), id, sizeof(AudioDeviceID) };
-	if (inIUD == NULL) {
-		return kAudioHardwareUnspecifiedError;
-	} else {
-		OSStatus res = AudioHardwareGetProperty(kAudioHardwarePropertyDeviceForUID, &size, &value);
-		CFRelease(inIUD);
-		return res;
-	}
-}
-
-#else
-typedef unsigned int AudioDeviceID;
-#endif
-
-#define PRINTDEBUG 1
-
-void PALog(char *fmt, ...)
-{
-#ifdef PRINTDEBUG
-    va_list ap;
-    va_start(ap, fmt);
-    fprintf(stderr, "JCA: ");
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-#endif
-}
-
-static int
-paCallback(void *inputBuffer, void *outputBuffer,
-                             unsigned long framesPerBuffer,
-                             PaTimestamp outTime, void *userData)
-{
-	portaudio_driver_t * driver = (portaudio_driver_t*)userData;
-
-	driver->inPortAudio = (float*)inputBuffer;
-	driver->outPortAudio = (float*)outputBuffer;
-	driver->last_wait_ust = jack_get_microseconds();
-	return driver->engine->run_cycle(driver->engine, framesPerBuffer, 0);
-}
-
-static int
-portaudio_driver_attach (portaudio_driver_t *driver, jack_engine_t *engine)
-{
-	jack_port_t *port;
-	int port_flags;
-	channel_t chn;
-	char buf[JACK_PORT_NAME_SIZE];
-		
-	driver->engine = engine;
-	
-	driver->engine->set_buffer_size (engine, driver->frames_per_cycle);
-	driver->engine->set_sample_rate (engine, driver->frame_rate);
-	
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-
-	/*
-	if (driver->has_hw_monitoring) {
-			port_flags |= JackPortCanMonitor;
-	}
-	*/
-
-	for (chn = 0; chn < driver->capture_nchannels; chn++) {
-			//snprintf (buf, sizeof(buf) - 1, "%s:capture%lu", driver->driver_name, chn+1);
-			snprintf (buf, sizeof(buf) - 1, "%s:out%lu", driver->driver_name, chn+1);
-
-			if ((port = jack_port_register (driver->client, buf, JACK_DEFAULT_AUDIO_TYPE, port_flags, 0)) == NULL) {
-					jack_error ("portaudio: cannot register port for %s", buf);
-					break;
-			}
-
-			/* XXX fix this so that it can handle: systemic (external) latency
-			*/
-
-			jack_port_set_latency (port, driver->frames_per_cycle);
-			driver->capture_ports = jack_slist_append (driver->capture_ports, port);
-	}
-	
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-
-	for (chn = 0; chn < driver->playback_nchannels; chn++) {
-			//snprintf (buf, sizeof(buf) - 1, "%s:playback%lu", driver->driver_name, chn+1);
-			snprintf (buf, sizeof(buf) - 1, "%s:in%lu", driver->driver_name, chn+1);
-
-			if ((port = jack_port_register (driver->client, buf, JACK_DEFAULT_AUDIO_TYPE, port_flags, 0)) == NULL) {
-					jack_error ("portaudio: cannot register port for %s", buf);
-					break;
-			}
-			
-			/* XXX fix this so that it can handle: systemic (external) latency
-			*/
-	
-			jack_port_set_latency (port, driver->frames_per_cycle);
-			driver->playback_ports = jack_slist_append (driver->playback_ports, port);
-	}
-
-	jack_activate (driver->client);
-	return 0; 
-}
-
-static int
-portaudio_driver_detach (portaudio_driver_t *driver, jack_engine_t *engine)
-{
-	JSList *node;
-
-	if (driver->engine == 0) {
-			return -1;
-	}
-
-	for (node = driver->capture_ports; node; node = jack_slist_next (node)) {
-			jack_port_unregister (driver->client, ((jack_port_t *) node->data));
-	}
-
-	jack_slist_free (driver->capture_ports);
-	driver->capture_ports = 0;
-			
-	for (node = driver->playback_ports; node; node = jack_slist_next (node)) {
-			jack_port_unregister (driver->client, ((jack_port_t *) node->data));
-	}
-
-	jack_slist_free (driver->playback_ports);
-	driver->playback_ports = 0;
-	
-	driver->engine = 0;
-	return 0; 
-}
-
-static int
-portaudio_driver_null_cycle (portaudio_driver_t* driver, jack_nframes_t nframes)
-{
-	memset(driver->outPortAudio, 0, (driver->playback_nchannels * nframes * sizeof(float)));
-	return 0;
-}
-
-static int
-portaudio_driver_read (portaudio_driver_t *driver, jack_nframes_t nframes)
-{
-	jack_default_audio_sample_t *buf;
-	channel_t chn;
-	jack_port_t *port;
-	JSList *node;
-	int i;
-
-	for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) {
-			
-			port = (jack_port_t *)node->data;
-			
-			if (jack_port_connected (port) && (driver->inPortAudio != NULL)) {
-				int channels = driver->capture_nchannels;
-				float* in = driver->inPortAudio;
-				buf = jack_port_get_buffer (port, nframes); 
-				for (i = 0; i< nframes; i++) buf[i] = in[channels*i+chn];
-			}
-
-	}
-   
-	driver->engine->transport_cycle_start (driver->engine,
-					   jack_get_microseconds ());
-	return 0;
-}          
-
-
-static int
-portaudio_driver_write (portaudio_driver_t *driver, jack_nframes_t nframes)
-{
-	jack_default_audio_sample_t *buf;
-	channel_t chn;
-	jack_port_t *port;
-	JSList *node;
-	int i,bytes = nframes*sizeof(float);
-	
-	/* Clear in case of nothing is connected */
-	memset(driver->outPortAudio, 0, driver->playback_nchannels*bytes);
-			
-	for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) {
-			
-			port = (jack_port_t *)node->data;
-			
-			if (jack_port_connected (port) && (driver->outPortAudio != NULL)) {
-					int channels = driver->playback_nchannels;
-					float* out = driver->outPortAudio;
-					buf = jack_port_get_buffer (port, nframes);
-					for (i = 0; i< nframes; i++) out[channels*i+chn] = buf[i];
-			}
-	}
-	
-	return 0;
-}
-
-static int
-portaudio_driver_audio_start (portaudio_driver_t *driver)
-{
-	PaError err = Pa_StartStream(driver->stream);
-	return (err != paNoError) ? -1 : 0;
-}
-
-static int
-portaudio_driver_audio_stop (portaudio_driver_t *driver)
-{
-	PaError err = Pa_StopStream(driver->stream);
-	return (err != paNoError) ? -1 : 0;
-}
-
-static int
-portaudio_driver_set_parameters (portaudio_driver_t* driver,
-				   jack_nframes_t nframes,
-				   jack_nframes_t rate)
-{
-	int capturing = driver->capturing;
-	int playing = driver->playing;
-
-	int err = Pa_OpenStream(
-		&driver->stream,
-		((capturing) ? Pa_GetDefaultInputDeviceID() : paNoDevice),	
-		((capturing) ? driver->capture_nchannels : 0),             
-		paFloat32,		/* 32-bit float input */
-		NULL,
-		((playing) ? Pa_GetDefaultOutputDeviceID() : paNoDevice),
-		((playing) ?  driver->playback_nchannels : 0),        
-		paFloat32,		/* 32-bit float output */
-		NULL,
-		rate,			/* sample rate */
-		nframes,		/* frames per buffer */
-		0,				/* number of buffers = default min */
-		paClipOff,		/* we won't output out of
-						* range samples so don't
-						* bother clipping them */
-		paCallback,
-		driver);
-    
-	if (err == paNoError) {
-        
-		driver->period_usecs = (((float) driver->frames_per_cycle)
-					/ driver->frame_rate) * 1000000.0f;
-		driver->frame_rate = rate;
-		driver->frames_per_cycle = nframes;
-
-		/* tell engine about buffer size */
-		if (driver->engine) {
-			driver->engine->set_buffer_size (
-				driver->engine, driver->frames_per_cycle);
-		}
-		return 0;
-
-	} else { 
-
-		// JOQ: this driver is dead.  How do we terminate it?
-		Pa_Terminate();
-		jack_error("Unable to set portaudio parameters");
-		jack_error("Error number: %d", err);
-		jack_error("Error message: %s", Pa_GetErrorText(err));
-		return EIO;
-	}
-}
-
-static int
-portaudio_driver_reset_parameters (portaudio_driver_t* driver,
-				   jack_nframes_t nframes,
-				   jack_nframes_t rate)
-{
-	if (!jack_power_of_two(nframes)) {
-		jack_error("PA: frames must be a power of two "
-			 "(64, 512, 1024, ...)");
-		return EINVAL;
-	}
-
-	Pa_CloseStream(driver->stream);
-	return portaudio_driver_set_parameters (driver, nframes, rate);
-}
-
-static int
-portaudio_driver_bufsize (portaudio_driver_t* driver, jack_nframes_t nframes)
-{
-	int rc;
-
-	/* This gets called from the engine server thread, so it must
-	 * be serialized with the driver thread.  Stopping the audio
-	 * also stops that thread. */
-
-	if (portaudio_driver_audio_stop (driver)) {
-		jack_error ("PA: cannot stop to set buffer size");
-		return EIO;
-	}
-
-	rc = portaudio_driver_reset_parameters (driver, nframes,
-						driver->frame_rate);
-
-	if (portaudio_driver_audio_start (driver)) {
-		jack_error ("PA: cannot restart after setting buffer size");
-		rc = EIO;
-	}
-
-	return rc;
-}
-
-//== instance creation/destruction =============================================
-
-static int portaudio_load_default (portaudio_driver_t *driver, 
-                                    int numDevices, 
-                                    int capturing, 
-                                    int playing, 
-                                    int* inputDeviceID,
-                                    int* outputDeviceID)
-{
-    const PaDeviceInfo *pdi;
-    int i,j;
-    int found = 0;
-    
-    PALog("Look for default driver\n");
-    
-    *inputDeviceID = Pa_GetDefaultInputDeviceID();
-    *outputDeviceID = Pa_GetDefaultOutputDeviceID();
-
-    for(i=0; i<numDevices; i++)
-    {
-        pdi = Pa_GetDeviceInfo(i);
-        PALog("---------------------------------------------- #%d\n", i);
-        
-        if (i == Pa_GetDefaultInputDeviceID()) {
-            driver->capture_nchannels = (capturing) ? pdi->maxInputChannels : 0;
-            strcpy (driver->driver_name,pdi->name);
-            found = 1;
-        }
-        
-        if (i == Pa_GetDefaultOutputDeviceID()){
-            driver->playback_nchannels = (playing) ? pdi->maxOutputChannels : 0;
-            strcpy (driver->driver_name,pdi->name);
-            found = 1;
-        }
-        
-        PALog("\nName         = %s\n", pdi->name);
-        PALog("Max Inputs = %d ", pdi->maxInputChannels);
-        PALog("Max Outputs = %d\n", pdi->maxOutputChannels);
-        if( pdi->numSampleRates == -1 ){
-            PALog("Sample Rate Range = %f to %f\n", pdi->sampleRates[0], pdi->sampleRates[1]);
-        }else{
-            PALog("Sample Rates =");
-            for(j=0; j<pdi->numSampleRates; j++){
-                PALog(" %8.2f,", pdi->sampleRates[j]);
-            }
-            PALog("\n");
-        }
-        
-        PALog("Native Sample Formats = ");
-        if (pdi->nativeSampleFormats & paInt8)        PALog("paInt8, ");
-        if (pdi->nativeSampleFormats & paUInt8)       PALog("paUInt8, ");
-        if (pdi->nativeSampleFormats & paInt16)       PALog("paInt16, ");
-        if (pdi->nativeSampleFormats & paInt32)       PALog("paInt32, ");
-        if (pdi->nativeSampleFormats & paFloat32)     PALog("paFloat32, ");
-        if (pdi->nativeSampleFormats & paInt24)       PALog("paInt24, ");
-        if (pdi->nativeSampleFormats & paPackedInt24) PALog("paPackedInt24, ");
-        PALog("\n");
-    }
-    
-    return found;
-}
-
-static int portaudio_load_driver (portaudio_driver_t *driver, 
-                                    int numDevices, 
-                                    int capturing, 
-                                    int playing, 
-                                    int* inputDeviceID,
-                                    int* outputDeviceID,
-                                    char* driver_name)
-{
-    const PaDeviceInfo *pdi;
-    int found = 0;
-    int i,j;
-    
-    PALog("Look for %s driver\n",driver_name);
-      
-    for(i=0; i<numDevices; i++)
-    {
-        pdi = Pa_GetDeviceInfo(i);
-        PALog("---------------------------------------------- #%d\n", i);
-        
-		// compare the first character
-		if (strncmp (driver_name, pdi->name,
-		     JACK_DRIVER_PARAM_STRING_MAX) == 0) {
-		if (pdi->maxInputChannels > 0) {
-			*inputDeviceID = i;
-			driver->capture_nchannels =
-			(capturing) ? pdi->maxInputChannels : 0;
-			strcpy(driver->driver_name,pdi->name);
-			PALog("Found input driver = %s\n", driver_name);
-			found = 1;
-		}
-	    if (pdi->maxOutputChannels > 0) {
-			*outputDeviceID = i;
-			driver->playback_nchannels =
-			(playing) ? pdi->maxOutputChannels : 0;
-			strcpy (driver->driver_name,pdi->name);
-			PALog("Found output driver = %s\n", driver_name);
-			found = 1;
-		} else {
-			PALog("Found driver without input or ouput = %s\n",
-		       driver_name);
-            }
-        }
-                        
-        PALog("\nName         = %s\n", pdi->name);
-        PALog("Max Inputs = %d ", pdi->maxInputChannels);
-        PALog("Max Outputs = %d\n", pdi->maxOutputChannels);
-        if( pdi->numSampleRates == -1 ){
-            PALog("Sample Rate Range = %f to %f\n", pdi->sampleRates[0],
-			pdi->sampleRates[1]);
-        }else{
-            PALog("Sample Rates =");
-            for(j=0; j<pdi->numSampleRates; j++){
-                PALog(" %8.2f,", pdi->sampleRates[j]);
-            }
-            PALog("\n");
-        }
-        
-        PALog("Native Sample Formats = ");
-        if (pdi->nativeSampleFormats & paInt8)        PALog("paInt8, ");
-        if (pdi->nativeSampleFormats & paUInt8)       PALog("paUInt8, ");
-        if (pdi->nativeSampleFormats & paInt16)       PALog("paInt16, ");
-        if (pdi->nativeSampleFormats & paInt32)       PALog("paInt32, ");
-        if (pdi->nativeSampleFormats & paFloat32)     PALog("paFloat32, ");
-        if (pdi->nativeSampleFormats & paInt24)       PALog("paInt24, ");
-        if (pdi->nativeSampleFormats & paPackedInt24) PALog("paPackedInt24, ");
-        PALog("\n");
-    }
-    
-    return found;
-}
-
-/** create a new driver instance
- */
-static jack_driver_t *
-portaudio_driver_new (char *name, 
-				jack_client_t* client,
-				jack_nframes_t frames_per_cycle,
-				jack_nframes_t rate,
-				int capturing,
-				int playing,
-				int chan_in, 
-				int chan_out,
-				DitherAlgorithm dither,
-				char* driver_name)
-{
-	portaudio_driver_t *driver;
-	PaError err = paNoError;
-	int numDevices;
-	int inputDeviceID,outputDeviceID;
-	int found;
-	
-	PALog("portaudio driver version : %d\n", kVersion);
-	PALog("creating portaudio driver ... %" PRIu32 "|%" PRIu32 "\n",
-		frames_per_cycle, rate);
-
-	driver = (portaudio_driver_t *) calloc (1, sizeof (portaudio_driver_t));
-
-	jack_driver_init ((jack_driver_t *) driver);
-
-	if (!jack_power_of_two(frames_per_cycle)) {
-		jack_error ("PA: -p must be a power of two.");
-		goto error;
-	}
-
-	driver->frames_per_cycle = frames_per_cycle;
-	driver->frame_rate = rate;
-	driver->capturing = capturing;
-	driver->playing = playing;
-
-	driver->attach = (JackDriverAttachFunction) portaudio_driver_attach;
-	driver->detach = (JackDriverDetachFunction) portaudio_driver_detach;
-	driver->read = (JackDriverReadFunction) portaudio_driver_read;
-	driver->write = (JackDriverReadFunction) portaudio_driver_write;
-	driver->null_cycle = (JackDriverNullCycleFunction) portaudio_driver_null_cycle;
-	driver->bufsize = (JackDriverBufSizeFunction) portaudio_driver_bufsize;
-	driver->start = (JackDriverStartFunction) portaudio_driver_audio_start;
-	driver->stop = (JackDriverStopFunction) portaudio_driver_audio_stop;
-	driver->stream = NULL;
-
-#ifdef JACK_USE_MACH_THREADS	
-	AudioDeviceID device_id;
-	if (driver_name) {
-		if (get_device_id_from_uid(driver_name, &device_id) != noErr)
-			goto error;
-		if (get_device_name_from_id(device_id, driver->driver_name) != noErr)
-			goto error;
-	} else {
-		if (get_device_id_from_num(0, &device_id) != noErr)
-			goto error; 
-		if (get_device_name_from_id(device_id, driver->driver_name) != noErr)
-			goto error;
-	}
-#endif
-       
-	err = Pa_Initialize();
-	PALog("Pa_Initialize OK \n");
-	
-	PALog("Driver name required %s\n",driver->driver_name);
-	numDevices = Pa_CountDevices();
-	
-	if( numDevices < 0 ){
-		PALog("ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
-		err = numDevices;
-		goto error;
-	}
-	
-	PALog("Number of devices = %d\n", numDevices);
-
-	if (strcmp(driver->driver_name,"") == 0) {
-		found = portaudio_load_default(driver,numDevices,capturing,playing,&inputDeviceID,&outputDeviceID);
-		if (!found) {
-			PALog("ERROR : default driver has not been found\n");
-			err = paHostError;
-			goto error;
-		}
-	}else{
-		found = portaudio_load_driver(driver,numDevices,capturing,playing,&inputDeviceID,&outputDeviceID,driver->driver_name);
-		if (!found) {
-			 PALog("ERROR : driver %s has not been found \n",driver->driver_name);
-			 err = paHostError;
-			 goto error;
-		}
-	}
-
-	if (err != paNoError) goto error;
-	
-	PALog("Pa_GetDefaultOutputDeviceID() %ld\n", (long)Pa_GetDefaultOutputDeviceID());
-	PALog("Pa_GetDefaultInputDeviceID() %ld\n",  (long)Pa_GetDefaultInputDeviceID());
-	
-	PALog("--------------------------------------------------\n");
-	PALog("CoreAudio driver %s will be loaded\n", driver->driver_name);
-	PALog("inputDeviceID %ld\n",  (long)inputDeviceID);
-	PALog("outputDeviceID %ld\n",  (long)outputDeviceID);
-	PALog("driver->capture_nchannels %ld\n", driver->capture_nchannels);
-	PALog("driver->playback_nchannels %ld\n", driver->playback_nchannels);
-	
-	PALog("chan_in, chan_out %ld %ld\n",  (long)chan_in,  (long)chan_out);
-        
-	if (chan_in > 0) 
-		driver->capture_nchannels = (driver->capture_nchannels < chan_in) ? driver->capture_nchannels : chan_in;
-	
-	if (chan_out > 0) 
-		driver->playback_nchannels = (driver->playback_nchannels < chan_out) ? driver->playback_nchannels : chan_out;
-		
-	PALog("driver->capture_nchannels %ld\n", driver->capture_nchannels);
-	PALog("driver->playback_nchannels %ld\n", driver->playback_nchannels);
-	
-	err = Pa_OpenStream(&driver->stream,
-						((capturing && (driver->capture_nchannels > 0)) ? inputDeviceID : paNoDevice),
-						((capturing) ? driver->capture_nchannels : 0),             
-						paFloat32,	// 32 bit floating point input 
-						NULL,
-						((playing && (driver->playback_nchannels > 0)) ? outputDeviceID : paNoDevice),
-						((playing) ? driver->playback_nchannels : 0),        
-						paFloat32,  // 32 bit floating point output 
-						NULL,
-						rate,
-						frames_per_cycle,            // frames per buffer 
-						0,              // number of buffers, if zero then use default minimum 
-						paClipOff,      // we won't output out of range samples so don't bother clipping them 
-						paCallback,
-						driver);
-	
-	if (err != paNoError) goto error;
-	
-	driver->client = client; 
-	driver->period_usecs = (((float) driver->frames_per_cycle) / driver->frame_rate) * 1000000.0f;
-	return((jack_driver_t *) driver);
-
-error:
-
-	Pa_Terminate();
-	jack_error("An error occured while using the portaudio stream");
-	jack_error("Error number: %d", err);
-	jack_error("Error message: %s", Pa_GetErrorText(err));
-	free(driver);
-	return NULL;
-}
-
-/** free all memory allocated by a driver instance
- */
-static void
-portaudio_driver_delete (portaudio_driver_t *driver)
-{
-	/* Close PortAudio stream and terminate */
-	Pa_CloseStream(driver->stream);
-	Pa_Terminate();
-	free(driver);
-}
-
-//== driver "plugin" interface =================================================
-
-/* DRIVER "PLUGIN" INTERFACE */
-
-jack_driver_desc_t *
-driver_get_descriptor ()
-{
-	jack_driver_desc_t * desc;
-	unsigned int i;
-	desc = calloc (1, sizeof (jack_driver_desc_t));
-
-	strcpy (desc->name, "portaudio");
-	desc->nparams = 10;
-	desc->params = calloc (desc->nparams,
-			       sizeof (jack_driver_param_desc_t));
-
-	i = 0;
-	strcpy (desc->params[i].name, "channel");
-	desc->params[i].character  = 'c';
-	desc->params[i].type       = JackDriverParamInt;
-	desc->params[i].value.ui   = 0;
-	strcpy (desc->params[i].short_desc, "Maximum number of channels");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-	
-	i++;
-	strcpy (desc->params[i].name, "channelin");
-	desc->params[i].character  = 'i';
-	desc->params[i].type       = JackDriverParamInt;
-	desc->params[i].value.ui   = 0;
-	strcpy (desc->params[i].short_desc, "Maximum number of input channels");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "channelout");
-	desc->params[i].character  = 'o';
-	desc->params[i].type       = JackDriverParamInt;
-	desc->params[i].value.ui   = 0;
-	strcpy (desc->params[i].short_desc, "Maximum number of ouput channels");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "capture");
-	desc->params[i].character  = 'C';
-	desc->params[i].type       = JackDriverParamBool;
-	desc->params[i].value.i    = TRUE;
-	strcpy (desc->params[i].short_desc, "Whether or not to capture");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "playback");
-	desc->params[i].character  = 'P';
-	desc->params[i].type       = JackDriverParamBool;
-	desc->params[i].value.i    = TRUE;
-	strcpy (desc->params[i].short_desc, "Whether or not to playback");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "duplex");
-	desc->params[i].character  = 'D';
-	desc->params[i].type       = JackDriverParamBool;
-	desc->params[i].value.i    = TRUE;
-	strcpy (desc->params[i].short_desc, "Capture and playback");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "rate");
-	desc->params[i].character  = 'r';
-	desc->params[i].type       = JackDriverParamUInt;
-	desc->params[i].value.ui   = 48000U;
-	strcpy (desc->params[i].short_desc, "Sample rate");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "period");
-	desc->params[i].character  = 'p';
-	desc->params[i].type       = JackDriverParamUInt;
-	desc->params[i].value.ui   = 1024U;
-	strcpy (desc->params[i].short_desc, "Frames per period");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-	
-	i++;
-	strcpy (desc->params[i].name, "name");
-	desc->params[i].character  = 'n';
-	desc->params[i].type       = JackDriverParamString;
-	desc->params[i].value.ui   = 128U;
-	strcpy (desc->params[i].short_desc, "Driver name");
-	strcpy (desc->params[i].long_desc, desc->params[i].short_desc);
-
-	i++;
-	strcpy (desc->params[i].name, "dither");
-	desc->params[i].character  = 'z';
-	desc->params[i].type       = JackDriverParamChar;
-	desc->params[i].value.c    = '-';
-	strcpy (desc->params[i].short_desc, "Dithering mode");
-	strcpy (desc->params[i].long_desc,
-		"  Dithering Mode:\n"
-		"    r : rectangular\n"
-		"    t : triangular\n"
-		"    s : shaped\n"
-		"    - : no dithering");
-	
-    return desc;
-}
-
-const char driver_client_name[] = "portaudio";
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, const JSList * params)
-{
-	jack_nframes_t srate = 48000;
-	jack_nframes_t frames_per_interrupt = 1024;
-	AudioDeviceID deviceID = 0;
-	int capture = FALSE;
-	int playback = FALSE;
-	int chan_in = -1;
-	int chan_out = -1;
-	DitherAlgorithm dither = None;
-	const JSList * node;
-	const jack_driver_param_t * param;
-	char *name = NULL;
-
-#ifdef JACK_USE_MACH_THREADS	
-	get_device_id_from_num(0,&deviceID); // takes a default value (first device)
-#endif
-	
-	for (node = params; node; node = jack_slist_next (node)) {
-		param = (const jack_driver_param_t *) node->data;
-
-		switch (param->character) {
-                
-		case 'n':
-			name = (char *) param->value.str;
-			PALog("Driver name found %s\n",name);
-			break;
-                        
-		case 'D':
-			capture = TRUE;
-			playback = TRUE;
-			break;
-                                    
-		case 'c':
-			chan_in = (int) param->value.ui;
-			chan_out = (int) param->value.ui;
-			break;
-			
-		case 'i':
-			chan_in = (int) param->value.ui;
-			break;
-		
-		case 'o':
-			chan_out = (int) param->value.ui;
-			break;
-    
-		case 'C':
-			capture = param->value.i;
-			break;
-    
-		case 'P':
-			playback = param->value.i;
-			break;
-
-		case 'r':
-			srate = param->value.ui;
-			break;
-                                    
-		case 'p':
-			frames_per_interrupt = (unsigned int) param->value.ui;
-			break;
-			
-		case 'z':
-			switch ((int) param->value.c) {
-			case '-':
-				dither = None;
-				break;
-    
-			case 'r':
-				dither = Rectangular;
-				break;
-    
-			case 's':
-				dither = Shaped;
-				break;
-    
-			case 't':
-			default:
-				dither = Triangular;
-				break;
-			}
-			break;
-		}
-	}
-
-	/* duplex is the default */
-	if (!capture && !playback) {
-		capture = TRUE;
-		playback = TRUE;
-	}
-
-	return portaudio_driver_new ("portaudio", client, frames_per_interrupt,
-				     srate, capture, playback, chan_in,
-				     chan_out, dither, name);
-}
-
-void
-driver_finish (jack_driver_t *driver)
-{
-	portaudio_driver_delete ((portaudio_driver_t *) driver);
-}
-
diff --git a/drivers/portaudio/portaudio_driver.h b/drivers/portaudio/portaudio_driver.h
deleted file mode 100644
index 8dd0640..0000000
--- a/drivers/portaudio/portaudio_driver.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-    Copyright © Grame 2003
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-    
-    Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
-    grame at rd.grame.fr
-*/
-
-#ifndef __jack_portaudio_driver_h__
-#define __jack_portaudio_driver_h__
-
-
-#include <portaudio.h>
-
-#include <jack/types.h>
-#include <jack/hardware.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-#include <jack/internal.h>
-#include <jack/memops.h>
-
-typedef struct {
-
-        JACK_DRIVER_DECL
-
-        struct _jack_engine *engine;
-
-        jack_nframes_t    frame_rate;
-        jack_nframes_t    frames_per_cycle;
-        unsigned long     user_nperiods;
-	int		  capturing;
-	int		  playing;
-
-        channel_t    playback_nchannels;
-        channel_t    capture_nchannels;
-
-        jack_client_t *client;
-        JSList   *capture_ports;
-        JSList   *playback_ports;
-
-        float *inPortAudio;
-		float *outPortAudio;
-        char driver_name[256];
-        PortAudioStream*   stream;
-
-} portaudio_driver_t;
-
-#define kVersion 101
-
-#endif /* __jack_portaudio_driver_h__ */
diff --git a/drivers/sun/Makefile.am b/drivers/sun/Makefile.am
deleted file mode 100644
index e91d0fc..0000000
--- a/drivers/sun/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-MAINTAINCLEANFILES = Makefile.in
-
-AM_CFLAGS = $(JACK_CFLAGS)
-
-plugindir = $(ADDON_DIR)
-
-plugin_LTLIBRARIES = jack_sun.la
-
-jack_sun_la_LDFLAGS = -module -avoid-version
-jack_sun_la_SOURCES = sun_driver.c sun_driver.h
-
-noinst_HEADERS = sun_driver.h
diff --git a/drivers/sun/sun_driver.c b/drivers/sun/sun_driver.c
deleted file mode 100644
index 88a81e1..0000000
--- a/drivers/sun/sun_driver.c
+++ /dev/null
@@ -1,1468 +0,0 @@
-/*
-	Sun Audio API driver for Jack
-	Copyright (C) 2008 Jacob Meuser <jakemsr at sdf.lonestar.org>
-	Based heavily on oss_driver.c which came with the following
-	copyright notice.
-
-	Copyright (C) 2003-2007 Jussi Laako <jussi at sonarnerd.net>
-
-	This program is free software; you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation; either version 2 of the License, or
-	(at your option) any later version.
-
-	This program is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-
-	You should have received a copy of the GNU General Public License
-	along with this program; if not, write to the Free Software
-	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-	MA  02111-1307  USA
-
-*/
-
-
-#include <config.h>
-
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-#ifndef _THREAD_SAFE
-#define _THREAD_SAFE
-#endif
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/audioio.h>
-
-#include <poll.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <float.h>
-#include <stdarg.h>
-#include <getopt.h>
-
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/thread.h>
-#include <sysdeps/time.h>
-
-#include "sun_driver.h"
-
-
-#define SUN_DRIVER_N_PARAMS	11
-const static jack_driver_param_desc_t sun_params[SUN_DRIVER_N_PARAMS] = {
-	{ "rate",
-	  'r',
-	  JackDriverParamUInt,
-	  { .ui = SUN_DRIVER_DEF_FS },
-	  "sample rate",
-	  "sample rate"
-	},
-	{ "period",
-	  'p',
-	  JackDriverParamUInt,
-	  { .ui = SUN_DRIVER_DEF_BLKSIZE },
-	  "period size",
-	  "period size"
-	},
-	{ "nperiods",
-	  'n',
-	  JackDriverParamUInt,
-	  { .ui = SUN_DRIVER_DEF_NPERIODS },
-	  "number of periods in buffer",
-	  "number of periods in buffer"
-	},
-	{ "wordlength",
-	  'w',
-	  JackDriverParamInt,
-	  { .i = SUN_DRIVER_DEF_BITS },
-	  "word length",
-	  "word length"
-	},
-	{ "inchannels",
-	  'i',
-	  JackDriverParamUInt,
-	  { .ui = SUN_DRIVER_DEF_INS },
-	  "capture channels",
-	  "capture channels"
-	},
-	{ "outchannels",
-	  'o',
-	  JackDriverParamUInt,
-	  { .ui = SUN_DRIVER_DEF_OUTS },
-	  "playback channels",
-	  "playback channels"
-	},
-	{ "capture",
-	  'C',
-	  JackDriverParamString,
-	  { .str = SUN_DRIVER_DEF_DEV },
-	  "input device",
-	  "input device"
-	},
-	{ "playback",
-	  'P',
-	  JackDriverParamString,
-	  { .str = SUN_DRIVER_DEF_DEV },
-	  "output device",
-	  "output device"
-	},
-	{ "ignorehwbuf",
-	  'b',
-	  JackDriverParamBool,
-	  { },
-	  "ignore hardware period size",
-	  "ignore hardware period size"
-	},
-	{ "input latency",
-	  'I',
-	  JackDriverParamUInt,
-	  { .ui = 0 },
-	  "system input latency",
-	  "system input latency"
-	},
-	{ "output latency",
-	  'O',
-	  JackDriverParamUInt,
-	  { .ui = 0 },
-	  "system output latency",
-	  "system output latency"
-	}
-};
-
-
-/* internal functions */
-
-
-static void
-set_period_size (sun_driver_t *driver, jack_nframes_t new_period_size)
-{
-	driver->period_size = new_period_size;
-
-	driver->period_usecs = 
-		((double) driver->period_size /
-		(double) driver->sample_rate) * 1e6;
-	driver->last_wait_ust = 0;
-	driver->iodelay = 0.0F;
-	driver->poll_timeout = (int)(driver->period_usecs / 666);
-}
-
-
-static void
-sun_driver_write_silence (sun_driver_t *driver, jack_nframes_t nframes)
-{
-	size_t localsize;
-	ssize_t io_res;
-	void *localbuf;
-
-	localsize = nframes * driver->sample_bytes * driver->playback_channels;
-	localbuf = malloc(localsize);
-	if (localbuf == NULL)
-	{
-		jack_error("sun_driver: malloc() failed: %s@%i",
-			__FILE__, __LINE__);
-		return;
-	}
-
-	bzero(localbuf, localsize);
-	io_res = write(driver->outfd, localbuf, localsize);
-	if (io_res < (ssize_t) localsize)
-	{
-		jack_error("sun_driver: write() failed: %s: "
-			"count=%d/%d: %s@%i", strerror(errno), io_res,
-			localsize, __FILE__, __LINE__);
-	}
-	free(localbuf);
-}
-
-
-static void
-sun_driver_read_silence (sun_driver_t *driver, jack_nframes_t nframes)
-{
-	size_t localsize;
-	ssize_t io_res;
-	void *localbuf;
-
-	localsize = nframes * driver->sample_bytes * driver->capture_channels;
-	localbuf = malloc(localsize);
-	if (localbuf == NULL)
-	{
-		jack_error("sun_driver: malloc() failed: %s@%i",
-			__FILE__, __LINE__);
-		return;
-	}
-
-	io_res = read(driver->infd, localbuf, localsize);
-	if (io_res < (ssize_t) localsize)
-	{
-		jack_error("sun_driver: read() failed: %s: "
-			"count=%d/%d: %s@%i", strerror(errno), io_res,
-			localsize, __FILE__, __LINE__);
-	}
-	free(localbuf);
-}
-
-
-static jack_nframes_t
-sun_driver_wait (sun_driver_t *driver, int *status, float *iodelay)
-{
-	audio_info_t auinfo;
-	struct pollfd pfd[2];
-	nfds_t nfds;
-	float delay;
-	jack_time_t poll_enter;
-	jack_time_t poll_ret;
-	int need_capture = 0;
-	int need_playback = 0;
-	int capture_errors = 0;
-	int playback_errors = 0;
-	int capture_seek;
-	int playback_seek;
-
-	*status = -1;
-	*iodelay = 0;
-
-	pfd[0].fd = driver->infd;
-	pfd[0].events = POLLIN;
-	if (driver->infd >= 0)
-		need_capture = 1;
-
-	pfd[1].fd = driver->outfd;
-	pfd[1].events = POLLOUT;
-	if (driver->outfd >= 0)
-		need_playback = 1;
-
-	poll_enter = jack_get_microseconds();
-	if (poll_enter > driver->poll_next)
-	{
-		/* late. don't count as wakeup delay. */
-		driver->poll_next = 0;
-	}
-
-	while (need_capture || need_playback)
-	{
-		nfds = poll(pfd, 2, driver->poll_timeout);
-		if ( nfds == -1 ||
-		    ((pfd[0].revents | pfd[1].revents) &
-		     (POLLERR | POLLHUP | POLLNVAL)) )
-		{
-			jack_error("sun_driver: poll() error: %s: %s@%i",  
-				strerror(errno), __FILE__, __LINE__);
-			*status = -3;
-			return 0;
-		}
-
-		if (nfds == 0)
-		{
-			jack_error("sun_driver: poll() timeout: %s@%i",
-				__FILE__, __LINE__);
-			*status = -5;
-			return 0;
-		}
-
-		if (need_capture && (pfd[0].revents & POLLIN))
-		{
-			need_capture = 0;
-			pfd[0].fd = -1;
-		}
-
-		if (need_playback && (pfd[1].revents & POLLOUT))
-		{
-			need_playback = 0;
-			pfd[1].fd = -1;
-		}
-	}
-
-	poll_ret = jack_get_microseconds();
-
-	if (driver->poll_next && poll_ret > driver->poll_next)
-		*iodelay = poll_ret - driver->poll_next;
-
-	driver->poll_last = poll_ret;
-	driver->poll_next = poll_ret + driver->period_usecs;
-	driver->engine->transport_cycle_start(driver->engine, poll_ret);
-
-#if defined(AUDIO_RERROR) && defined(AUDIO_PERROR)
-
-	/* low level error reporting and recovery.  recovery is necessary
-	 * when doing both playback and capture and using AUMODE_PLAY,
-	 * because we process one period of both playback and capture data
-	 * in each cycle, and we wait in each cycle for that to be possible.
-	 * for example, playback will continuously underrun if it underruns
-	 * and we have to wait for capture data to become available
-	 * before we can write enough playback data to catch up.
-	 */
-
-	if (driver->infd >= 0)
-	{
-		if (ioctl(driver->infd, AUDIO_RERROR, &capture_errors) < 0)
-		{
-			jack_error("sun_driver: AUDIO_RERROR failed: %s: %s@%i",
-				strerror(errno), __FILE__, __LINE__);
-			return 0;
-		}
-		capture_errors -= driver->capture_drops;
-		driver->capture_drops += capture_errors;
-	}
-	if (capture_errors > 0)
-	{
-		delay = (capture_errors * 1000.0) / driver->sample_rate;
-		printf("sun_driver: capture xrun of %d frames (%f msec)\n",
-			capture_errors, delay);
-	}
-
-	if (driver->outfd >= 0)
-	{
-		if (ioctl(driver->outfd, AUDIO_PERROR, &playback_errors) < 0)
-		{
-			jack_error("sun_driver: AUDIO_PERROR failed: %s: %s@%i",
-				strerror(errno), __FILE__, __LINE__);
-			return 0;
-		}
-		playback_errors -= driver->playback_drops;
-		driver->playback_drops += playback_errors;
-	}
-	if (playback_errors > 0)
-	{
-		delay = (playback_errors * 1000.0) / driver->sample_rate;
-		printf("sun_driver: playback xrun of %d frames (%f msec)\n",
-			playback_errors, delay);
-	}
-
-	if ((driver->outfd >= 0 && driver->infd >= 0) &&
-		(capture_errors || playback_errors))
-	{
-		if (ioctl(driver->infd, AUDIO_GETINFO, &auinfo) < 0)
-		{
-			jack_error("sun_driver: AUDIO_GETINFO failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return 0;
-		}
-		capture_seek = auinfo.record.seek;
-
-		if (driver->infd == driver->outfd)
-			playback_seek = auinfo.play.seek;
-		else
-		{
-			if (ioctl(driver->outfd, AUDIO_GETINFO, &auinfo) < 0)
-			{
-				jack_error("sun_driver: AUDIO_GETINFO failed: "
-					"%s: %s@%i", strerror(errno),
-					__FILE__, __LINE__);
-				return 0;
-			}
-			playback_seek = auinfo.play.seek;
-		}
-
-		capture_seek /= driver->capture_channels *
-			driver->sample_bytes;
-		playback_seek /= driver->playback_channels *
-			driver->sample_bytes;
-
-		if (playback_seek == driver->period_size &&
-			capture_seek == driver->period_size  &&
-			playback_errors)
-		{
-			/* normally, 1 period in each buffer is exactly
-			 * what we want, but if there was an error then
-			 * we effectively have 0 periods in the playback
-			 * buffer, because the period in the buffer will
-			 * be used to catch up to realtime.
-			 */
-			printf("sun_driver: writing %d frames of silence "
-				"to correct I/O sync\n", driver->period_size);
-			sun_driver_write_silence(driver, driver->period_size);
-		}
-		else if (capture_errors && playback_errors)
-		{
-			/* serious delay.  we've lost the ability to
-			 * write capture_errors frames to catch up on
-			 * playback.
-			 */
-			printf("sun_driver: writing %d frames of silence "
-				"to correct I/O sync\n", capture_errors);
-			sun_driver_write_silence(driver, capture_errors);
-		}
-	}
-
-#endif  // AUDIO_RERROR && AUDIO_PERROR
-
-	driver->last_wait_ust = poll_ret;
-
-	*status = 0;
-
-	return driver->period_size;
-}
-
-
-static inline int
-sun_driver_run_cycle (sun_driver_t *driver)
-{
-	jack_nframes_t nframes;
-	jack_time_t now;
-	int wait_status;
-	float iodelay;
-
-	nframes = sun_driver_wait (driver, &wait_status, &iodelay);
-
-	if (wait_status < 0)
-	{
-		switch (wait_status)
-		{
-		case -3:
-			/* poll() error */
-			return -1;
-		case -5:
-			/* poll() timeout */
-			now = jack_get_microseconds();
-			if (now > driver->poll_next)
-			{
-				iodelay = now - driver->poll_next;
-				driver->poll_next = now + driver->period_usecs;
-				driver->engine->delay(driver->engine, iodelay);
-				printf("sun_driver: iodelay = %f\n", iodelay);
-			}
-			break;
-		default:
-			/* any other fatal error */
-			return -1;
-		}
-	}
-
-	return driver->engine->run_cycle(driver->engine, nframes, iodelay);
-}
-
-
-static void
-copy_and_convert_in (jack_sample_t *dst, void *src, 
-	size_t nframes,	int channel, int chcount, int bits)
-{
-	int srcidx;
-	int dstidx;
-	signed short *s16src = (signed short *) src;
-	signed int *s32src = (signed int *) src;
-	double *f64src = (double *) src;
-	jack_sample_t scale;
-
-	srcidx = channel;
-	switch (bits)
-	{
-		case 16:
-			scale = 1.0f / 0x7fff;
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t) 
-					s16src[srcidx] * scale;
-				srcidx += chcount;
-			}
-			break;
-		case 24:
-			scale = 1.0f / 0x7fffff;
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t)
-					s32src[srcidx] * scale;
-				srcidx += chcount;
-			}
-			break;
-		case 32:
-			scale = 1.0f / 0x7fffffff;
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t)
-					s32src[srcidx] * scale;
-				srcidx += chcount;
-			}
-			break;
-		case 64:
-			for (dstidx = 0; dstidx < nframes; dstidx++)
-			{
-				dst[dstidx] = (jack_sample_t) f64src[srcidx];
-				srcidx += chcount;
-			}
-			break;
-	}
-}
-
-
-static void
-copy_and_convert_out (void *dst, jack_sample_t *src, 
-	size_t nframes,	int channel, int chcount, int bits)
-{
-	int srcidx;
-	int dstidx;
-	signed short *s16dst = (signed short *) dst;
-	signed int *s32dst = (signed int *) dst;
-	double *f64dst = (double *) dst;
-	jack_sample_t scale;
-
-	dstidx = channel;
-	switch (bits)
-	{
-		case 16:
-			scale = 0x7fff;
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				s16dst[dstidx] = (signed short)
-					(src[srcidx] >= 0.0f) ?
-					(src[srcidx] * scale + 0.5f) :
-					(src[srcidx] * scale - 0.5f);
-				dstidx += chcount;
-			}
-			break;
-		case 24:
-			scale = 0x7fffff;
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				s32dst[dstidx] = (signed int)
-					(src[srcidx] >= 0.0f) ?
-					(src[srcidx] * scale + 0.5f) :
-					(src[srcidx] * scale - 0.5f);
-				dstidx += chcount;
-			}
-			break;
-		case 32:
-			scale = 0x7fffffff;
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				s32dst[dstidx] = (signed int)
-					(src[srcidx] >= 0.0f) ?
-					(src[srcidx] * scale + 0.5f) :
-					(src[srcidx] * scale - 0.5f);
-				dstidx += chcount;
-			}
-			break;
-		case 64:
-			for (srcidx = 0; srcidx < nframes; srcidx++)
-			{
-				f64dst[dstidx] = (double) src[srcidx];
-				dstidx += chcount;
-			}
-			break;
-	}
-}
-
-
-/* jack driver interface */
-
-
-static int
-sun_driver_attach (sun_driver_t *driver)
-{
-	int port_flags;
-	int channel;
-	char channel_name[64];
-	jack_port_t *port;
-
-	driver->engine->set_buffer_size(driver->engine, driver->period_size);
-	driver->engine->set_sample_rate(driver->engine, driver->sample_rate);
-
-	port_flags = JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal;
-
-	for (channel = 0; channel < driver->capture_channels; channel++)
-	{
-		snprintf(channel_name, sizeof(channel_name), 
-			"capture_%u", channel + 1);
-		port = jack_port_register(driver->client, channel_name,
-			JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
-		if (port == NULL)
-		{
-			jack_error("sun_driver: cannot register port for %s: "
-				"%s@%i", channel_name, __FILE__, __LINE__);
-			break;
-		}
-		jack_port_set_latency(port,
-			driver->period_size + driver->sys_in_latency);
-		driver->capture_ports = 
-			jack_slist_append(driver->capture_ports, port);
-	}
-
-	port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal;
-	for (channel = 0; channel < driver->playback_channels; channel++)
-	{
-		snprintf(channel_name, sizeof(channel_name),
-			"playback_%u", channel + 1);
-		port = jack_port_register(driver->client, channel_name,
-			JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
-		if (port == NULL)
-		{
-			jack_error("sun_driver: cannot register port for "
-				"%s: %s@%i", channel_name, __FILE__, __LINE__);
-			break;
-		}
-		jack_port_set_latency(port,
-			driver->period_size + driver->sys_out_latency);
-		driver->playback_ports =
-			jack_slist_append(driver->playback_ports, port);
-	}
-
-	return jack_activate(driver->client);
-}
-
-
-static int
-sun_driver_detach (sun_driver_t *driver)
-{
-	JSList *node;
-
-	if (driver->engine == NULL)
-		return 0;
-
-	node = driver->capture_ports;
-	while (node != NULL)
-	{
-		jack_port_unregister(driver->client, 
-			((jack_port_t *) node->data));
-		node = jack_slist_next(node);
-	}
-	jack_slist_free(driver->capture_ports);
-	driver->capture_ports = NULL;
-
-	node = driver->playback_ports;
-	while (node != NULL)
-	{
-		jack_port_unregister(driver->client,
-			((jack_port_t *) node->data));
-		node = jack_slist_next(node);
-	}
-	jack_slist_free(driver->playback_ports);
-	driver->playback_ports = NULL;
-
-	return 0;
-}
-
-
-static int
-sun_driver_start (sun_driver_t *driver)
-{
-	audio_info_t audio_if;
-
-	if (driver->infd >= 0)
-	{
-#if defined(AUDIO_FLUSH)
-		if (ioctl(driver->infd, AUDIO_FLUSH, NULL) < 0)
-		{
-			jack_error("sun_driver: capture flush failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-#endif
-		AUDIO_INITINFO(&audio_if);
-		audio_if.record.pause = 1;
-		if (driver->outfd == driver->infd)
-			audio_if.play.pause = 1;
-		if (ioctl(driver->infd, AUDIO_SETINFO, &audio_if) < 0)
-		{
-			jack_error("sun_driver: pause capture failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-	}
-	if ((driver->outfd >= 0) && (driver->outfd != driver->infd))
-	{
-#if defined(AUDIO_FLUSH)
-		if (ioctl(driver->outfd, AUDIO_FLUSH, NULL) < 0)
-		{
-			jack_error("sun_driver: playback flush failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-#endif
-		AUDIO_INITINFO(&audio_if);
-		audio_if.play.pause = 1;
-		if (ioctl(driver->outfd, AUDIO_SETINFO, &audio_if) < 0)
-		{
-			jack_error("sun_driver: pause playback failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-	}
-
-	/* AUDIO_FLUSH resets the counters these work with */
-	driver->playback_drops = driver->capture_drops = 0;
-
-	if (driver->outfd >= 0)
-	{
-		/* "prime" the playback buffer.  if we don't do this, we'll
-		 * end up underrunning.  it would get really ugly in duplex
-		 * mode, for example, where we have to wait for a period to
-		 * be available to read before we can write.  also helps to
-		 * keep constant latency from the beginning.
-		 */
-		sun_driver_write_silence(driver,
-			driver->nperiods * driver->period_size);
-	}
-
-	if (driver->infd >= 0)
-	{
-		AUDIO_INITINFO(&audio_if);
-		audio_if.record.pause = 0;
-		if (driver->outfd == driver->infd)
-			audio_if.play.pause = 0;
-		if (ioctl(driver->infd, AUDIO_SETINFO, &audio_if) < 0)
-		{
-			jack_error("sun_driver: start capture failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-	}
-	if ((driver->outfd >= 0) && (driver->outfd != driver->infd))
-	{
-		AUDIO_INITINFO(&audio_if);
-		audio_if.play.pause = 0;
-		if (ioctl(driver->outfd, AUDIO_SETINFO, &audio_if) < 0)
-		{
-			jack_error("sun_driver: trigger playback failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-
-static int
-enc_equal(int a, int b)
-{
-	if (a == b)
-		return 1;
-
-#if defined(AUDIO_ENCODING_SLINEAR)	
-#if BYTE_ORDER == LITTLE_ENDIAN
-	if ((a == AUDIO_ENCODING_SLINEAR && b == AUDIO_ENCODING_SLINEAR_LE) ||
-	    (a == AUDIO_ENCODING_SLINEAR_LE && b == AUDIO_ENCODING_SLINEAR) ||
-	    (a == AUDIO_ENCODING_ULINEAR && b == AUDIO_ENCODING_ULINEAR_LE) ||
-	    (a == AUDIO_ENCODING_ULINEAR_LE && b == AUDIO_ENCODING_ULINEAR))
-		return 1;
-#elif BYTE_ORDER == BIG_ENDIAN
-	if ((a == AUDIO_ENCODING_SLINEAR && b == AUDIO_ENCODING_SLINEAR_BE) ||
-	    (a == AUDIO_ENCODING_SLINEAR_BE && b == AUDIO_ENCODING_SLINEAR) ||
-	    (a == AUDIO_ENCODING_ULINEAR && b == AUDIO_ENCODING_ULINEAR_BE) ||
-	    (a == AUDIO_ENCODING_ULINEAR_BE && b == AUDIO_ENCODING_ULINEAR))
-		return 1;
-#endif
-#endif  // AUDIO_ENCODING_SLINEAR
-	return 0;
-}
-
-
-static int
-sun_driver_set_parameters (sun_driver_t *driver)
-{
-	audio_info_t audio_if_in, audio_if_out;
-	int infd = -1;
-	int outfd = -1;
-	int s = 1;
-	unsigned int cap_period = 0, play_period = 0, period_size = 0;
-	const char *indev = driver->indev;
-	const char *outdev = driver->outdev;
-
-	driver->indevbuf = NULL;
-	driver->outdevbuf = NULL;
-	driver->sample_bytes = driver->bits / 8;
-
-	if ((strcmp(indev, outdev) == 0) &&
-	    ((driver->capture_channels > 0) && (driver->playback_channels > 0)))
-	{
-		infd = outfd = open(indev, O_RDWR);
-		if (infd < 0)
-		{
-			jack_error("sun_driver: failed to open duplex device "
-				"%s: %s: %s@%i", indev, strerror(errno),
-				__FILE__, __LINE__);
-			return -1;
-		}
-#if defined(AUDIO_SETFD)
-		if (ioctl(infd, AUDIO_SETFD, &s) < 0)
-		{
-			jack_error("sun_driver: failed to enable full duplex: "
-				"%s: %s@%i", strerror(errno),
-				__FILE__, __LINE__);
-			return -1;
-		}
-#endif
-	}
-	else
-	{
-		if (driver->capture_channels > 0)
-		{
-			infd = open(indev, O_RDONLY);
-			if (infd < 0)
-			{
-				jack_error("sun_driver: failed to open input "
-					"device %s: %s: %s@%i", indev,
-					strerror(errno), __FILE__, __LINE__);
-				return -1;
-			}
-		}
-		if (driver->playback_channels > 0)
-		{
-			outfd = open(outdev, O_WRONLY);
-			if (outfd < 0)
-			{
-				jack_error("sun_driver: failed to open output "
-					"device %s: %s: %s@%i", outdev,
-					strerror(errno), __FILE__, __LINE__);
-				return -1;
-			}
-		}
-	}
-	if (infd == -1 && outfd == -1)
-	{
-		jack_error("sun_driver: no device was opened: %s@%i",
-			__FILE__, __LINE__);
-		return -1;
-	}
-
-	driver->infd = infd;
-	driver->outfd = outfd;
-	
-	AUDIO_INITINFO(&audio_if_in);
-	AUDIO_INITINFO(&audio_if_out);
-
-	if (infd >= 0)
-	{
-		audio_if_in.record.encoding = driver->format;
-		audio_if_in.record.precision = driver->bits;
-		audio_if_in.record.channels = driver->capture_channels;
-		audio_if_in.record.sample_rate = driver->sample_rate;
-		audio_if_in.record.pause = 1;
-	}
-	if (outfd >= 0)
-	{
-		audio_if_out.play.encoding = driver->format;
-		audio_if_out.play.precision = driver->bits;
-		audio_if_out.play.channels = driver->playback_channels;
-		audio_if_out.play.sample_rate = driver->sample_rate;
-		audio_if_out.play.pause = 1;
-	}
-
-#if defined(__OpenBSD__) || defined(__NetBSD__)
-#if defined(__OpenBSD__)
-	if (driver->infd >= 0)
-		audio_if_in.record.block_size = driver->capture_channels *
-		driver->period_size * driver->sample_bytes;
-	if (driver->outfd >= 0)
-		audio_if_out.play.block_size = driver->playback_channels *
-		driver->period_size * driver->sample_bytes; 
-#else
-	if (driver->infd >= 0)
-		audio_if_in.blocksize = driver->capture_channels *
-		driver->period_size * driver->sample_bytes;
-	if (driver->outfd >= 0)
-		audio_if_out.blocksize =  driver->playback_channels *
-		driver->period_size * driver->sample_bytes;
-#endif
-	if (infd == outfd)
-		audio_if_in.play = audio_if_out.play;
-
-	/* this only affects playback.  the capture buffer is
-	 * always the max (64k on OpenBSD).
-	 */
-	audio_if_in.hiwat = audio_if_out.hiwat = driver->nperiods;
-
-	/* AUMODE_PLAY makes us "catch up to realtime" if we underrun
-	 * playback.  that means, if we are N frames late, the next
-	 * N frames written will be discarded.  this keeps playback
-	 * time from expanding with each underrun.
-	 */ 
-	if (infd == outfd)
-	{
-		audio_if_in.mode = AUMODE_PLAY | AUMODE_RECORD;
-	}
-	else
-	{
-		if (infd >= 0)
-			audio_if_in.mode = AUMODE_RECORD;
-
-		if (outfd >= 0)
-			audio_if_out.mode = AUMODE_PLAY;
-	}
-
-#endif  // OpenBSD || NetBSD
-
-	if (infd >= 0)
-	{
-		if (ioctl(infd, AUDIO_SETINFO, &audio_if_in) < 0)
-		{
-			jack_error("sun_driver: failed to set parameters for "
-				"%s: %s: %s@%i", indev, strerror(errno),
-				__FILE__, __LINE__);
-			return -1;
-		}
-	}
-
-	if (outfd >= 0 && outfd != infd)
-	{
-		if (ioctl(outfd, AUDIO_SETINFO, &audio_if_out) < 0)
-		{
-			jack_error("sun_driver: failed to set parameters for "
-				"%s: %s: %s@%i", outdev, strerror(errno),
-				__FILE__, __LINE__);
-			return -1;
-		}
-	}
-
-	if (infd >= 0)
-	{
-		if (ioctl(infd, AUDIO_GETINFO, &audio_if_in) < 0)
-		{
-			jack_error("sun_driver: AUDIO_GETINFO failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-
-		if (!enc_equal(audio_if_in.record.encoding, driver->format) ||
-		    audio_if_in.record.precision != driver->bits ||
-		    audio_if_in.record.channels != driver->capture_channels ||
-		    audio_if_in.record.sample_rate != driver->sample_rate)
-		{
-			jack_error("sun_driver: setting capture parameters "
-				"failed: %s@%i", __FILE__, __LINE__);
-			return -1;
-		}
-#if defined(__OpenBSD__)
-		cap_period = audio_if_in.record.block_size /
-			driver->capture_channels / driver->sample_bytes;
-#elif defined(__NetBSD__)
-		cap_period = audio_if_in.blocksize /
-			driver->capture_channels / driver->sample_bytes;
-#else
-		/* how is this done on Solaris? */
-		cap_period = driver->period_size;
-#endif
-	}
-
-	if (outfd >= 0)
-	{
-		if (outfd == infd)
-		{
-			audio_if_out.play = audio_if_in.play;
-		}
-		else
-		{
-			if (ioctl(outfd, AUDIO_GETINFO, &audio_if_out) < 0)
-			{
-				jack_error("sun_driver: AUDIO_GETINFO failed: "
-					"%s: %s@%i", strerror(errno),
-					__FILE__, __LINE__);
-				return -1;
-			}
-		}
-
-		if (!enc_equal(audio_if_out.play.encoding, driver->format) ||
-		    audio_if_out.play.precision != driver->bits ||
-		    audio_if_out.play.channels != driver->playback_channels ||
-		    audio_if_out.play.sample_rate != driver->sample_rate)
-		{
-			jack_error("sun_driver: playback settings failed: "
-				"%s@%i", __FILE__, __LINE__);
-			return -1;
-		}
-#if defined(__OpenBSD__)
-		play_period = audio_if_out.play.block_size /
-			driver->playback_channels / driver->sample_bytes;
-#elif defined(__NetBSD__)
-		play_period = audio_if_out.blocksize /
-			driver->playback_channels / driver->sample_bytes;
-#else
-		/* how is this done on Solaris? */
-		play_period = driver->period_size;
-#endif
-	}
-
-	if (infd >= 0 && outfd >= 0 && play_period != cap_period)
-	{
-		jack_error("sun_driver: play and capture periods differ: "
-		    "%s@%i", __FILE__, __LINE__);
-		return -1;
-	}
-	if (infd >= 0)
-		period_size = cap_period;
-	else if (outfd >= 0)
-		period_size = play_period;
-
-	if (period_size != 0 && period_size != driver->period_size && 
-	    !driver->ignorehwbuf)
-	{
-		printf("sun_driver: period size update: %u\n", period_size);
-
-		set_period_size (driver, period_size);
-
-		if (driver->engine)
-			driver->engine->set_buffer_size(driver->engine, 
-				driver->period_size);
-	}
-
-	if (driver->infd >= 0 && driver->capture_channels > 0)
-	{
-		driver->indevbufsize = driver->period_size * 
-			driver->capture_channels * driver->sample_bytes;
-		driver->indevbuf = malloc(driver->indevbufsize);
-		if (driver->indevbuf == NULL)
-		{
-			jack_error( "sun_driver: malloc() failed: %s@%i", 
-				__FILE__, __LINE__);
-			return -1;
-		}
-		bzero(driver->indevbuf, driver->indevbufsize);
-	}
-	else
-	{
-		driver->indevbufsize = 0;
-		driver->indevbuf = NULL;
-	}
-
-	if (driver->outfd >= 0 && driver->playback_channels > 0)
-	{
-		driver->outdevbufsize = driver->period_size * 
-			driver->playback_channels * driver->sample_bytes;
-		driver->outdevbuf = malloc(driver->outdevbufsize);
-		if (driver->outdevbuf == NULL)
-		{
-			jack_error("sun_driver: malloc() failed: %s@%i", 
-				__FILE__, __LINE__);
-			return -1;
-		}
-		bzero(driver->outdevbuf, driver->outdevbufsize);
-	}
-	else
-	{
-		driver->outdevbufsize = 0;
-		driver->outdevbuf = NULL;
-	}
-
-	printf("sun_driver: indevbuf %zd B, outdevbuf %zd B\n",
-		driver->indevbufsize, driver->outdevbufsize);
-
-	return 0;
-}
-
-
-static int
-sun_driver_stop (sun_driver_t *driver)
-{
-	audio_info_t audio_if;
-
-	if (driver->infd >= 0)
-	{
-		AUDIO_INITINFO(&audio_if);
-		audio_if.record.pause = 1;
-		if (driver->outfd == driver->infd)
-			audio_if.play.pause = 1;
-		if (ioctl(driver->infd, AUDIO_SETINFO, &audio_if) < 0)
-		{
-			jack_error("sun_driver: capture pause failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-	}
-
-	if ((driver->outfd >= 0) && (driver->outfd != driver->infd))
-	{
-		AUDIO_INITINFO(&audio_if);
-		audio_if.play.pause = 1;
-		if (ioctl(driver->outfd, AUDIO_SETINFO, &audio_if) < 0)
-		{
-			jack_error("sun_driver: playback pause failed: %s: "
-				"%s@%i", strerror(errno), __FILE__, __LINE__);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-
-static int
-sun_driver_read (sun_driver_t *driver, jack_nframes_t nframes)
-{
-	jack_nframes_t nbytes;
-	int channel;
-	ssize_t io_res;
-	jack_sample_t *portbuf;
-	JSList *node;
-	jack_port_t *port;
-
-	if (driver->engine->freewheeling || driver->infd < 0)
-		return 0;
-
-	if (nframes > driver->period_size)
-	{
-		jack_error("sun_driver: read failed: nframes > period_size: "
-			"(%u/%u): %s@%i", nframes, driver->period_size,
-			__FILE__, __LINE__);
-		return -1;
-	}
-
-	node = driver->capture_ports;
-	channel = 0;
-	while (node != NULL)
-	{
-		port = (jack_port_t *) node->data;
-
-		if (jack_port_connected(port))
-		{
-			portbuf = jack_port_get_buffer(port, nframes);
-			copy_and_convert_in(portbuf, driver->indevbuf, 
-				nframes, channel, 
-				driver->capture_channels,
-				driver->bits);
-		}
-
-		node = jack_slist_next(node);
-		channel++;
-	}
-
-	nbytes = nframes * driver->capture_channels * driver->sample_bytes;
-	io_res = 0;
-	while (nbytes)
-	{
-		io_res = read(driver->infd, driver->indevbuf, nbytes);
-		if (io_res < 0)
-		{
-			jack_error("sun_driver: read() failed: %s: %s@%i",
-				strerror(errno), __FILE__, __LINE__);
-			break;
-		}
-		else
-			nbytes -= io_res;
-	}
-
-	return 0;
-}
-
-
-static int
-sun_driver_write (sun_driver_t *driver, jack_nframes_t nframes)
-{
-	jack_nframes_t nbytes;
-	int channel;
-	ssize_t io_res;
-	jack_sample_t *portbuf;
-	JSList *node;
-	jack_port_t *port;
-
-
-	if (driver->engine->freewheeling || driver->outfd < 0)
-		return 0;
-
-	if (nframes > driver->period_size)
-	{
-		jack_error("sun_driver: write failed: nframes > period_size "
-			"(%u/%u): %s@%i", nframes, driver->period_size,
-			__FILE__, __LINE__);
-		return -1;
-	}
-
-	bzero(driver->outdevbuf, driver->outdevbufsize);
-
-	node = driver->playback_ports;
-	channel = 0;
-	while (node != NULL)
-	{
-		port = (jack_port_t *) node->data;
-
-		if (jack_port_connected(port))
-		{
-			portbuf = jack_port_get_buffer(port, nframes);
-			copy_and_convert_out(driver->outdevbuf, portbuf, 
-				nframes, channel,
-				driver->playback_channels,
-				driver->bits);
-		}
-
-		node = jack_slist_next(node);
-		channel++;
-	}
-
-	nbytes = nframes * driver->playback_channels * driver->sample_bytes;
-	io_res = 0;
-	while (nbytes)
-	{
-		io_res = write(driver->outfd, driver->outdevbuf, nbytes);
-		if (io_res < 0)
-		{
-			jack_error("sun_driver: write() failed: %s: %s@%i",
-				strerror(errno), __FILE__, __LINE__);
-			break;
-		}
-		else
-			nbytes -= io_res;
-	}
-
-	return 0;
-}
-
-
-static int
-sun_driver_null_cycle (sun_driver_t *driver, jack_nframes_t nframes)
-{
-	if (nframes > driver->period_size)
-	{
-		jack_error("sun_driver: null cycle failed: "
-			"nframes > period_size (%u/%u): %s@%i", nframes,
-			driver->period_size, __FILE__, __LINE__);
-		return -1;
-	}
-
-	printf("sun_driver: running null cycle\n");
-
-	if (driver->outfd >= 0)
-		sun_driver_write_silence (driver, nframes);
-
-	if (driver->infd >= 0)
-		sun_driver_read_silence (driver, nframes);
-
-	return 0;
-}
-
-
-static int
-sun_driver_bufsize (sun_driver_t *driver, jack_nframes_t nframes)
-{
-	return sun_driver_set_parameters(driver);
-}
-
-
-static void
-sun_driver_delete (sun_driver_t *driver)
-{
-	if (driver->outfd >= 0 && driver->outfd != driver->infd)
-	{
-		close(driver->outfd);
-		driver->outfd = -1;
-	}
-	if (driver->infd >= 0)
-	{
-		close(driver->infd);
-		driver->infd = -1;
-	}
-
-	if (driver->indevbuf != NULL)
-	{
-		free(driver->indevbuf);
-		driver->indevbuf = NULL;
-	}
-	if (driver->outdevbuf != NULL)
-	{
-		free(driver->outdevbuf);
-		driver->outdevbuf = NULL;
-	}
-
-	if (driver->indev != NULL)
-		free(driver->indev);
-
-	if (driver->outdev != NULL)
-		free(driver->outdev);
-
-	jack_driver_nt_finish((jack_driver_nt_t *) driver);
-
-	free(driver);
-}
-
-
-void
-driver_finish (jack_driver_t *driver)
-{
-	sun_driver_delete ((sun_driver_t *)driver);
-}
-
-
-static jack_driver_t *
-sun_driver_new (char *indev, char *outdev, jack_client_t *client,
-	jack_nframes_t sample_rate, jack_nframes_t period_size,
-	jack_nframes_t nperiods, int bits,
-	int capture_channels, int playback_channels,
-	jack_nframes_t in_latency, jack_nframes_t out_latency,
-	int ignorehwbuf)
-{
-	sun_driver_t *driver;
-
-	driver = (sun_driver_t *) malloc(sizeof(sun_driver_t));
-	if (driver == NULL)
-	{
-		jack_error("sun_driver: malloc() failed: %s: %s@%i",
-			strerror(errno), __FILE__, __LINE__);
-		return NULL;
-	}
-	driver->engine = NULL;
-	jack_driver_nt_init((jack_driver_nt_t *) driver);
-
-	driver->nt_attach = (JackDriverNTAttachFunction) sun_driver_attach;
-	driver->nt_detach = (JackDriverNTDetachFunction) sun_driver_detach;
-	driver->read = (JackDriverReadFunction) sun_driver_read;
-	driver->write = (JackDriverWriteFunction) sun_driver_write;
-	driver->null_cycle = (JackDriverNullCycleFunction) 
-		sun_driver_null_cycle;
-	driver->nt_bufsize = (JackDriverNTBufSizeFunction) sun_driver_bufsize;
-	driver->nt_start = (JackDriverNTStartFunction) sun_driver_start;
-	driver->nt_stop = (JackDriverNTStopFunction) sun_driver_stop;
-	driver->nt_run_cycle = (JackDriverNTRunCycleFunction) sun_driver_run_cycle;
-
-	if (indev != NULL)
-		driver->indev = strdup(indev);
-	if (outdev != NULL)
-		driver->outdev = strdup(outdev);
-
-	driver->ignorehwbuf = ignorehwbuf;
-
-	driver->sample_rate = sample_rate;
-	driver->period_size = period_size;
-	driver->nperiods = nperiods;
-	driver->bits = bits;
-	driver->capture_channels = capture_channels;
-	driver->playback_channels = playback_channels;
-	driver->sys_in_latency = in_latency;
-	driver->sys_out_latency = out_latency;
-
-	set_period_size(driver, period_size);
-	
-	if (driver->indev == NULL)
-		driver->indev = strdup(SUN_DRIVER_DEF_DEV);
-	if (driver->outdev == NULL)
-		driver->outdev = strdup(SUN_DRIVER_DEF_DEV);
-	driver->infd = -1;
-	driver->outfd = -1;
-#if defined(AUDIO_ENCODING_SLINEAR)
-	driver->format = AUDIO_ENCODING_SLINEAR;
-#else
-	driver->format = AUDIO_ENCODING_LINEAR;
-#endif
-	driver->indevbuf = driver->outdevbuf = NULL;
-
-	driver->capture_ports = NULL;
-	driver->playback_ports = NULL;
-
-	driver->iodelay = 0.0F;
-	driver->poll_last = driver->poll_next = 0;
-
-	if (sun_driver_set_parameters (driver) < 0)
-	{
-		free(driver);
-		return NULL;
-	}
-
-	driver->client = client;
-
-	return (jack_driver_t *) driver;
-}
-
-
-/* jack driver published interface */
-
-
-const char driver_client_name[] = "sun";
-
-
-jack_driver_desc_t *
-driver_get_descriptor ()
-{
-	jack_driver_desc_t *desc;
-	jack_driver_param_desc_t *params;
-
-	desc = (jack_driver_desc_t *) calloc(1, sizeof(jack_driver_desc_t));
-	if (desc == NULL)
-	{
-		jack_error("sun_driver: calloc() failed: %s: %s@%i",
-			strerror(errno), __FILE__, __LINE__);
-		return NULL;
-	}
-	strcpy(desc->name, driver_client_name);
-	desc->nparams = SUN_DRIVER_N_PARAMS;
-
-	params = calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
-	if (params == NULL)
-	{
-		jack_error("sun_driver: calloc() failed: %s: %s@%i",
-			strerror(errno), __FILE__, __LINE__);
-		return NULL;
-	}
-	memcpy(params, sun_params, 
-		desc->nparams * sizeof(jack_driver_param_desc_t));
-	desc->params = params;
-
-	return desc;
-}
-
-
-jack_driver_t *
-driver_initialize (jack_client_t *client, JSList * params)
-{
-	int bits = SUN_DRIVER_DEF_BITS;
-	jack_nframes_t sample_rate = SUN_DRIVER_DEF_FS;
-	jack_nframes_t period_size = SUN_DRIVER_DEF_BLKSIZE;
-	jack_nframes_t in_latency = 0;
-	jack_nframes_t out_latency = 0;
-	unsigned int nperiods = SUN_DRIVER_DEF_NPERIODS;
-	unsigned int capture_channels = SUN_DRIVER_DEF_INS;
-	unsigned int playback_channels = SUN_DRIVER_DEF_OUTS;
-	const JSList *pnode;
-	const jack_driver_param_t *param;
-	char *indev;
-	char *outdev;
-	int ignorehwbuf = 0;
-
-	indev = strdup(SUN_DRIVER_DEF_DEV);
-	outdev = strdup(SUN_DRIVER_DEF_DEV);
-
-	pnode = params;
-	while (pnode != NULL)
-	{
-		param = (const jack_driver_param_t *) pnode->data;
-
-		switch (param->character)
-		{
-			case 'r':
-				sample_rate = param->value.ui;
-				break;
-			case 'p':
-				period_size = param->value.ui;
-				break;
-			case 'n':
-				nperiods = param->value.ui;
-				break;
-			case 'w':
-				bits = param->value.i;
-				break;
-			case 'i':
-				capture_channels = param->value.ui;
-				break;
-			case 'o':
-				playback_channels = param->value.ui;
-				break;
-			case 'C':
-				indev = strdup(param->value.str);
-				break;
-			case 'P':
-				outdev = strdup(param->value.str);
-				break;
-			case 'b':
-				ignorehwbuf = 1;
-				break;
-			case 'I':
-				in_latency = param->value.ui;
-				break;
-			case 'O':
-				out_latency = param->value.ui;
-				break;
-		}
-		pnode = jack_slist_next(pnode);
-	}
-	
-	return sun_driver_new (indev, outdev, client, sample_rate, period_size,
-		nperiods, bits, capture_channels, playback_channels, in_latency,
-		out_latency, ignorehwbuf);
-}
diff --git a/drivers/sun/sun_driver.h b/drivers/sun/sun_driver.h
deleted file mode 100644
index f40158e..0000000
--- a/drivers/sun/sun_driver.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-
-	Sun Audio API driver for Jack
-	Copyright (C) 2008 Jacob Meuser <jakemsr at sdf.lonestar.org>
-	Based heavily on oss_driver.h which came with the following
-	copyright notice.
-
-	Copyright (C) 2003-2007 Jussi Laako <jussi at sonarnerd.net>
-
-	This program is free software; you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation; either version 2 of the License, or
-	(at your option) any later version.
-
-	This program is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-
-	You should have received a copy of the GNU General Public License
-	along with this program; if not, write to the Free Software
-	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-	MA  02111-1307  USA
-
-*/
-
-
-#ifndef __JACK_SUN_DRIVER_H__
-#define __JACK_SUN_DRIVER_H__
-
-#include <sys/types.h>
-#include <pthread.h>
-#include <semaphore.h>
-
-#include <jack/types.h>
-#include <jack/jslist.h>
-#include <jack/driver.h>
-#include <jack/jack.h>
-
-
-#define SUN_DRIVER_DEF_DEV	"/dev/audio"
-#define SUN_DRIVER_DEF_FS	48000
-#define SUN_DRIVER_DEF_BLKSIZE	1024
-#define SUN_DRIVER_DEF_NPERIODS	2
-#define SUN_DRIVER_DEF_BITS	16
-#define SUN_DRIVER_DEF_INS	2
-#define SUN_DRIVER_DEF_OUTS	2
-
-
-typedef jack_default_audio_sample_t jack_sample_t;
-
-typedef struct _sun_driver
-{
-	JACK_DRIVER_NT_DECL
-
-	jack_nframes_t sample_rate;
-	jack_nframes_t period_size;
-	unsigned int nperiods;
-	int bits;
-	int sample_bytes;
-	unsigned int capture_channels;
-	unsigned int playback_channels;
-
-	char *indev;
-	char *outdev;
-	int infd;
-	int outfd;
-	int format;
-	int ignorehwbuf;
-
-	size_t indevbufsize;
-	size_t outdevbufsize;
-	size_t portbufsize;
-	void *indevbuf;
-	void *outdevbuf;
-
-	int poll_timeout;
-	jack_time_t poll_last;
-	jack_time_t poll_next;
-	float iodelay;
-
-	jack_nframes_t sys_in_latency;
-	jack_nframes_t sys_out_latency;
-
-	JSList *capture_ports;
-	JSList *playback_ports;
-
-	jack_client_t *client;
-
-	int playback_drops;
-	int capture_drops;
-
-} sun_driver_t;
-
-
-#endif
-
diff --git a/example-clients/.cvsignore b/example-clients/.cvsignore
deleted file mode 100644
index 6fa658f..0000000
--- a/example-clients/.cvsignore
+++ /dev/null
@@ -1,26 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-jack_cache_killer
-jack_connect
-jack_disconnect
-jack_freewheel
-jack_impulse_grabber
-jack_monitor_client
-jack_simple_client
-jackrec
-jack_bufsize
-jack_showtime
-jack_lsp
-jack_metro
-jack_unload
-jack_load
-jack_transport
-inprocess.la
-inprocess.lo
-intime.la
-intime.lo
-jack_alias
-jack_evmon
-jack_thread_wait
diff --git a/example-clients/Makefile.am b/example-clients/Makefile.am
deleted file mode 100644
index 03fda4b..0000000
--- a/example-clients/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-MAINTAINERCLEANFILES    = Makefile.in
-
-if HAVE_SNDFILE
-JACKREC = jackrec
-dist-check-sndfile:
-else
-JACKREC =
-dist-check-sndfile:
-	@echo
-	@echo ' ******' You need sndfile installed to make dist.' ******'
-	@echo
-	@false
-endif
-
-bin_PROGRAMS = jack_simple_client \
-	       jack_transport_client \
-	       jack_impulse_grabber \
-	       jack_metro \
-	       jack_showtime \
-	       jack_midisine \
-	       jack_midiseq \
-	       $(JACKREC)
-
-AM_CFLAGS = -I.. $(JACK_CFLAGS)
-AM_CXXFLAGS = -I.. $(JACK_CFLAGS)
-
-jack_simple_client_SOURCES = simple_client.c
-jack_simple_client_LDFLAGS = @OS_LDFLAGS@
-jack_simple_client_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_transport_client_SOURCES = transport_client.c
-jack_transport_client_LDFLAGS = @OS_LDFLAGS@
-jack_transport_client_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_metro_SOURCES = metro.c
-jack_metro_LDFLAGS = @OS_LDFLAGS@
-jack_metro_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_showtime_SOURCES = showtime.c
-jack_showtime_LDFLAGS = @OS_LDFLAGS@
-jack_showtime_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_impulse_grabber_SOURCES = impulse_grabber.c
-jack_impulse_grabber_LDFLAGS = @OS_LDFLAGS@
-jack_impulse_grabber_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_midiseq_SOURCES = midiseq.c
-jack_midiseq_LDFLAGS = @OS_LDFLAGS@
-jack_midiseq_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_midisine_SOURCES = midisine.c
-jack_midisine_LDFLAGS = @OS_LDFLAGS@
-jack_midisine_LDADD = $(top_builddir)/libjack/libjack.la
-
-if HAVE_SNDFILE
-jackrec_SOURCES = capture_client.c
-jackrec_LDFLAGS = @SNDFILE_LIBS@ @OS_LDFLAGS@
-jackrec_LDADD = $(top_builddir)/libjack/libjack.la
-endif
-
-#
-# sample in-process client(s)
-#
-ip_clientdir = $(ADDON_DIR)
-
-ip_client_LTLIBRARIES = inprocess.la intime.la
-
-inprocess_la_LDFLAGS = -module -avoid-version @OS_LDFLAGS@
-inprocess_la_SOURCES = inprocess.c
-
-intime_la_LDFLAGS = -module -avoid-version @OS_LDFLAGS@
-intime_la_SOURCES = intime.c
diff --git a/example-clients/alias.c b/example-clients/alias.c
new file mode 100644
index 0000000..87a19b8
--- /dev/null
+++ b/example-clients/alias.c
@@ -0,0 +1,133 @@
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <getopt.h>
+#include <jack/jack.h>
+
+char * my_name;
+
+void
+show_version (void)
+{
+	//fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n", my_name);
+}
+
+void
+show_usage (void)
+{
+	show_version ();
+	fprintf (stderr, "\nUsage: %s [options] portname alias\n", my_name);
+	fprintf (stderr, "List active Jack ports, and optionally display extra information.\n\n");
+	fprintf (stderr, "Display options:\n");
+	fprintf (stderr, "        -u, --unalias         remove `alias' as an alias for `port'\n");
+	fprintf (stderr, "        -h, --help            Display this help message\n");
+	fprintf (stderr, "        --version             Output version information and exit\n\n");
+	fprintf (stderr, "For more information see http://jackaudio.org/\n");
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_client_t *client;
+	jack_status_t status;
+	char* portname;
+	char* alias;
+	int unset = 0;
+	int ret;
+	int c;
+	int option_index;
+	extern int optind;
+	jack_port_t* port;
+	
+	struct option long_options[] = {
+		{ "unalias", 0, 0, 'u' },
+		{ "help", 0, 0, 'h' },
+		{ "version", 0, 0, 'v' },
+		{ 0, 0, 0, 0 }
+	};
+
+	if (argc < 3) {
+		show_usage ();
+		return 1;
+	}
+
+	my_name = strrchr(argv[0], '/');
+	if (my_name == 0) {
+		my_name = argv[0];
+	} else {
+		my_name ++;
+	}
+
+	while ((c = getopt_long (argc, argv, "uhv", long_options, &option_index)) >= 0) {
+		switch (c) {
+		case 'u':
+			unset = 1;
+			break;
+		case 'h':
+			show_usage ();
+			return 1;
+			break;
+		case 'v':
+			show_version ();
+			return 1;
+			break;
+		default:
+			show_usage ();
+			return 1;
+			break;
+		}
+	}
+
+	portname = argv[optind++];
+	alias = argv[optind];
+
+	/* Open a client connection to the JACK server.  Starting a
+	 * new server only to list its ports seems pointless, so we
+	 * specify JackNoStartServer. */
+	//JOQ: need a new server name option
+
+	client = jack_client_open ("lsp", JackNoStartServer, &status);
+
+	if (client == NULL) {
+		if (status & JackServerFailed) {
+			fprintf (stderr, "JACK server not running\n");
+		} else {
+			fprintf (stderr, "jack_client_open() failed, "
+				 "status = 0x%2.0x\n", status);
+		}
+		return 1;
+	}
+
+	if ((port = jack_port_by_name (client, portname)) == 0) {
+		fprintf (stderr, "No port named \"%s\"\n", portname);
+		return 1;
+	}
+
+	if (!unset) {
+		ret = jack_port_set_alias (port, alias);
+	} else {
+		ret = jack_port_unset_alias (port, alias);
+	}
+
+	jack_client_close (client);
+
+	return ret;
+	
+}
diff --git a/example-clients/alsa_in.c b/example-clients/alsa_in.c
new file mode 100644
index 0000000..a04271e
--- /dev/null
+++ b/example-clients/alsa_in.c
@@ -0,0 +1,757 @@
+/** @file simple_client.c
+ *
+ * @brief This simple client demonstrates the basic features of JACK
+ * as they would be used by many applications.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include <alloca.h>
+#include <math.h>
+
+#include <jack/jack.h>
+#include <jack/jslist.h>
+#include <memops.h>
+
+#include "alsa/asoundlib.h"
+
+#include <samplerate.h>
+
+// Here are the lists of the jack ports...
+
+JSList	   *capture_ports = NULL;
+JSList	   *capture_srcs = NULL;
+JSList	   *playback_ports = NULL;
+JSList	   *playback_srcs = NULL;
+jack_client_t *client;
+
+snd_pcm_t *alsa_handle;
+
+int jack_sample_rate;
+int jack_buffer_size;
+
+int quit = 0;
+double resample_mean = 1.0;
+double static_resample_factor = 1.0;
+
+double *offset_array;
+double *window_array;
+int offset_differential_index = 0;
+
+double offset_integral = 0;
+
+// ------------------------------------------------------ commandline parameters
+
+int sample_rate = 0;				 /* stream rate */
+int num_channels = 2;				 /* count of channels */
+int period_size = 1024;
+int num_periods = 2;
+
+int target_delay = 0;	    /* the delay which the program should try to approach. */
+int max_diff = 0;	    /* the diff value, when a hard readpointer skip should occur */
+int catch_factor = 100000;
+int catch_factor2 = 10000;
+double pclamp = 15.0;
+double controlquant = 10000.0;
+int smooth_size = 256;
+int good_window=0;
+int verbose = 0;
+int instrument = 0;
+int samplerate_quality = 2;
+
+// Debug stuff:
+
+volatile float output_resampling_factor = 1.0;
+volatile int output_new_delay = 0;
+volatile float output_offset = 0.0;
+volatile float output_integral = 0.0;
+volatile float output_diff = 0.0;
+
+snd_pcm_uframes_t real_buffer_size;
+snd_pcm_uframes_t real_period_size;
+
+// format selection, and corresponding functions from memops in a nice set of structs.
+
+typedef struct alsa_format {
+	snd_pcm_format_t format_id;
+	size_t sample_size;
+	void (*jack_to_soundcard) (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+	void (*soundcard_to_jack) (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+	const char *name;
+} alsa_format_t;
+
+alsa_format_t formats[] = {
+	{ SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" },
+	{ SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" },
+	{ SND_PCM_FORMAT_S24_3LE, 3, sample_move_d24_sS, sample_move_dS_s24, "24bit - real" },
+	{ SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" },
+	{ SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" }
+};
+#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
+int format=0;
+
+// Alsa stuff... i dont want to touch this bullshit in the next years.... please...
+
+static int xrun_recovery(snd_pcm_t *handle, int err) {
+//    printf( "xrun !!!.... %d\n", err );
+	if (err == -EPIPE) {	/* under-run */
+		err = snd_pcm_prepare(handle);
+		if (err < 0)
+			printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
+		return 0;
+	} else if (err == -EAGAIN) {
+		while ((err = snd_pcm_resume(handle)) == -EAGAIN)
+			usleep(100);	/* wait until the suspend flag is released */
+		if (err < 0) {
+			err = snd_pcm_prepare(handle);
+			if (err < 0)
+				printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
+		}
+		return 0;
+	}
+	return err;
+}
+
+static int set_hwformat( snd_pcm_t *handle, snd_pcm_hw_params_t *params )
+{
+	int i;
+	int err;
+
+	for( i=0; i<NUMFORMATS; i++ ) {
+		/* set the sample format */
+		err = snd_pcm_hw_params_set_format(handle, params, formats[i].format_id);
+		if (err == 0) {
+			format = i;
+			return 0;
+		}
+	}
+
+	return err;
+}
+
+static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access, int rate, int channels, int period, int nperiods ) {
+	int err, dir=0;
+	unsigned int buffer_time;
+	unsigned int period_time;
+	unsigned int rrate;
+	unsigned int rchannels;
+
+	/* choose all parameters */
+	err = snd_pcm_hw_params_any(handle, params);
+	if (err < 0) {
+		printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* set the interleaved read/write format */
+	err = snd_pcm_hw_params_set_access(handle, params, access);
+	if (err < 0) {
+		printf("Access type not available for playback: %s\n", snd_strerror(err));
+		return err;
+	}
+
+	/* set the sample format */
+	err = set_hwformat(handle, params);
+	if (err < 0) {
+		printf("Sample format not available for playback: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* set the count of channels */
+	rchannels = channels;
+	err = snd_pcm_hw_params_set_channels_near(handle, params, &rchannels);
+	if (err < 0) {
+		printf("Channels count (%i) not available for record: %s\n", channels, snd_strerror(err));
+		return err;
+	}
+	if (rchannels != channels) {
+		printf("WARNING: chennel count does not match (requested %d got %d)\n", channels, rchannels);
+		num_channels = rchannels;
+	}
+	/* set the stream rate */
+	rrate = rate;
+	err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
+	if (err < 0) {
+		printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
+		return err;
+	}
+	if (rrate != rate) {
+		printf("WARNING: Rate doesn't match (requested %iHz, get %iHz)\n", rate, rrate);
+		sample_rate = rrate;
+	}
+	/* set the buffer time */
+
+	buffer_time = 1000000*(uint64_t)period*nperiods/rate;
+	err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir);
+	if (err < 0) {
+		printf("Unable to set buffer time %i for playback: %s\n",  1000000*period*nperiods/rate, snd_strerror(err));
+		return err;
+	}
+	err = snd_pcm_hw_params_get_buffer_size( params, &real_buffer_size );
+	if (err < 0) {
+		printf("Unable to get buffer size back: %s\n", snd_strerror(err));
+		return err;
+	}
+	if( real_buffer_size != nperiods * period ) {
+	    printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size );
+	}
+	/* set the period time */
+	period_time = 1000000*(uint64_t)period/rate;
+	err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
+	if (err < 0) {
+		printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err));
+		return err;
+	}
+	err = snd_pcm_hw_params_get_period_size(params, &real_period_size, NULL );
+	if (err < 0) {
+		printf("Unable to get period size back: %s\n", snd_strerror(err));
+		return err;
+	}
+	if( real_period_size != period ) {
+	    printf( "WARNING: period size does not match: (requested %i, got %i)\n", period, (int)real_period_size );
+	}
+	/* write the parameters to device */
+	err = snd_pcm_hw_params(handle, params);
+	if (err < 0) {
+		printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
+		return err;
+	}
+	return 0;
+}
+
+static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, int period) {
+	int err;
+
+	/* get the current swparams */
+	err = snd_pcm_sw_params_current(handle, swparams);
+	if (err < 0) {
+		printf("Unable to determine current swparams for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* start the transfer when the buffer is full */
+	err = snd_pcm_sw_params_set_start_threshold(handle, swparams, period );
+	if (err < 0) {
+		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, -1 );
+	if (err < 0) {
+		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* allow the transfer when at least period_size samples can be processed */
+	err = snd_pcm_sw_params_set_avail_min(handle, swparams, 2*period );
+	if (err < 0) {
+		printf("Unable to set avail min for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* align all transfers to 1 sample */
+	err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
+	if (err < 0) {
+		printf("Unable to set transfer align for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* write the parameters to the playback device */
+	err = snd_pcm_sw_params(handle, swparams);
+	if (err < 0) {
+		printf("Unable to set sw params for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	return 0;
+}
+
+// ok... i only need this function to communicate with the alsa bloat api...
+
+static snd_pcm_t *open_audiofd( char *device_name, int capture, int rate, int channels, int period, int nperiods ) {
+  int err;
+  snd_pcm_t *handle;
+  snd_pcm_hw_params_t *hwparams;
+  snd_pcm_sw_params_t *swparams;
+
+  snd_pcm_hw_params_alloca(&hwparams);
+  snd_pcm_sw_params_alloca(&swparams);
+
+  if ((err = snd_pcm_open(&(handle), device_name, capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK )) < 0) {
+      printf("Capture open error: %s\n", snd_strerror(err));
+      return NULL;
+  }
+
+  if ((err = set_hwparams(handle, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED, rate, channels, period, nperiods )) < 0) {
+      printf("Setting of hwparams failed: %s\n", snd_strerror(err));
+      return NULL;
+  }
+  if ((err = set_swparams(handle, swparams, period)) < 0) {
+      printf("Setting of swparams failed: %s\n", snd_strerror(err));
+      return NULL;
+  }
+
+  snd_pcm_start( handle );
+  snd_pcm_wait( handle, 200 );
+
+  return handle;
+}
+
+double hann( double x )
+{
+	return 0.5 * (1.0 - cos( 2*M_PI * x ) );
+}
+
+/**
+ * The process callback for this JACK application.
+ * It is called by JACK at the appropriate times.
+ */
+int process (jack_nframes_t nframes, void *arg) {
+
+    char *outbuf;
+    float *resampbuf;
+    int rlen;
+    int err;
+    snd_pcm_sframes_t delay = target_delay;
+    int put_back_samples=0;
+    int i;
+
+    delay = snd_pcm_avail( alsa_handle );
+
+    delay -= jack_frames_since_cycle_start( client );
+    // Do it the hard way.
+    // this is for compensating xruns etc...
+
+    if( delay > (target_delay+max_diff) ) {
+	char *tmp = alloca( (delay-target_delay) * formats[format].sample_size * num_channels ); 
+	snd_pcm_readi( alsa_handle, tmp, delay-target_delay );
+	output_new_delay = (int) delay;
+
+	delay = target_delay;
+
+	// Set the resample_rate... we need to adjust the offset integral, to do this.
+	// first look at the PI controller, this code is just a special case, which should never execute once
+	// everything is swung in. 
+	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
+	// Also clear the array. we are beginning a new control cycle.
+	for( i=0; i<smooth_size; i++ )
+		offset_array[i] = 0.0;
+    }
+    if( delay < (target_delay-max_diff) ) {
+	snd_pcm_rewind( alsa_handle, target_delay - delay );
+	output_new_delay = (int) delay;
+	delay = target_delay;
+
+	// Set the resample_rate... we need to adjust the offset integral, to do this.
+	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
+	// Also clear the array. we are beginning a new control cycle.
+	for( i=0; i<smooth_size; i++ )
+		offset_array[i] = 0.0;
+    }
+    /* ok... now we should have target_delay +- max_diff on the alsa side.
+     *
+     * calculate the number of frames, we want to get.
+     */
+
+    double offset = delay - target_delay;
+
+    // Save offset.
+    offset_array[(offset_differential_index++)% smooth_size ] = offset;
+
+    // Build the mean of the windowed offset array
+    // basically fir lowpassing.
+    double smooth_offset = 0.0;
+    for( i=0; i<smooth_size; i++ )
+	    smooth_offset +=
+		    offset_array[ (i + offset_differential_index-1) % smooth_size] * window_array[i];
+    smooth_offset /= (double) smooth_size;
+
+    // this is the integral of the smoothed_offset
+    offset_integral += smooth_offset;
+
+    // Clamp offset.
+    // the smooth offset still contains unwanted noise
+    // which would go straigth onto the resample coeff.
+    // it only used in the P component and the I component is used for the fine tuning anyways.
+    if( fabs( smooth_offset ) < pclamp )
+	    smooth_offset = 0.0;
+
+    // ok. now this is the PI controller. 
+    // u(t) = K * ( e(t) + 1/T \int e(t') dt' )
+    // K = 1/catch_factor and T = catch_factor2
+    double current_resample_factor = static_resample_factor - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2;
+
+    // now quantize this value around resample_mean, so that the noise which is in the integral component doesnt hurt.
+    current_resample_factor = floor( (current_resample_factor - resample_mean) * controlquant + 0.5 ) / controlquant + resample_mean;
+
+    // Output "instrumentatio" gonna change that to real instrumentation in a few.
+    output_resampling_factor = (float) current_resample_factor;
+    output_diff = (float) smooth_offset;
+    output_integral = (float) offset_integral;
+    output_offset = (float) offset;
+
+    // Clamp a bit.
+    if( current_resample_factor < 0.25 ) current_resample_factor = 0.25;
+    if( current_resample_factor > 4 ) current_resample_factor = 4;
+
+    // Now Calculate how many samples we need.
+    rlen = ceil( ((double)nframes) / current_resample_factor )+2;
+    assert( rlen > 2 );
+
+    // Calculate resample_mean so we can init ourselves to saner values.
+    resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor;
+    /*
+     * now this should do it...
+     */
+
+    outbuf = alloca( rlen * formats[format].sample_size * num_channels );
+
+    resampbuf = alloca( rlen * sizeof( float ) );
+
+    // get the data...
+again:
+    err = snd_pcm_readi(alsa_handle, outbuf, rlen);
+    if( err < 0 ) {
+	printf( "err = %d\n", err );
+	if (xrun_recovery(alsa_handle, err) < 0) {
+	    //printf("Write error: %s\n", snd_strerror(err));
+	    //exit(EXIT_FAILURE);
+	}
+	goto again;
+    }
+    if( err != rlen ) {
+	//printf( "read = %d\n", rlen );
+    }
+
+    /*
+     * render jack ports to the outbuf...
+     */
+
+    int chn = 0;
+    JSList *node = capture_ports;
+    JSList *src_node = capture_srcs;
+    SRC_DATA src;
+
+    while ( node != NULL)
+    {
+	jack_port_t *port = (jack_port_t *) node->data;
+	float *buf = jack_port_get_buffer (port, nframes);
+
+	SRC_STATE *src_state = src_node->data;
+
+	formats[format].soundcard_to_jack( resampbuf, outbuf + format[formats].sample_size * chn, rlen, num_channels*format[formats].sample_size );
+
+	src.data_in = resampbuf;
+	src.input_frames = rlen;
+
+	src.data_out = buf;
+	src.output_frames = nframes;
+	src.end_of_input = 0;
+
+	src.src_ratio = current_resample_factor;
+
+	src_process( src_state, &src );
+
+	put_back_samples = rlen-src.input_frames_used;
+
+	src_node = jack_slist_next (src_node);
+	node = jack_slist_next (node);
+	chn++;
+    }
+
+    // Put back the samples libsamplerate did not consume.
+    //printf( "putback = %d\n", put_back_samples );
+    snd_pcm_rewind( alsa_handle, put_back_samples );
+
+    return 0;      
+}
+
+
+/**
+ * Allocate the necessary jack ports...
+ */
+
+void alloc_ports( int n_capture, int n_playback ) {
+
+    int port_flags = JackPortIsOutput;
+    int chn;
+    jack_port_t *port;
+    char buf[32];
+
+    capture_ports = NULL;
+    for (chn = 0; chn < n_capture; chn++)
+    {
+	snprintf (buf, sizeof(buf) - 1, "capture_%u", chn+1);
+
+	port = jack_port_register (client, buf,
+		JACK_DEFAULT_AUDIO_TYPE,
+		port_flags, 0);
+
+	if (!port)
+	{
+	    printf( "jacknet_client: cannot register port for %s", buf);
+	    break;
+	}
+
+	capture_srcs = jack_slist_append( capture_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
+	capture_ports = jack_slist_append (capture_ports, port);
+    }
+
+    port_flags = JackPortIsInput;
+
+    playback_ports = NULL;
+    for (chn = 0; chn < n_playback; chn++)
+    {
+	snprintf (buf, sizeof(buf) - 1, "playback_%u", chn+1);
+
+	port = jack_port_register (client, buf,
+		JACK_DEFAULT_AUDIO_TYPE,
+		port_flags, 0);
+
+	if (!port)
+	{
+	    printf( "jacknet_client: cannot register port for %s", buf);
+	    break;
+	}
+
+	playback_srcs = jack_slist_append( playback_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
+	playback_ports = jack_slist_append (playback_ports, port);
+    }
+}
+
+/**
+ * This is the shutdown callback for this JACK application.
+ * It is called by JACK if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+
+void jack_shutdown (void *arg) {
+
+	exit (1);
+}
+
+/**
+ * be user friendly.
+ * be user friendly.
+ * be user friendly.
+ */
+
+void printUsage() {
+fprintf(stderr, "usage: alsa_out [options]\n"
+		"\n"
+		"  -j <jack name> - client name\n"
+		"  -d <alsa_device> \n"
+		"  -c <channels> \n"
+		"  -p <period_size> \n"
+		"  -n <num_period> \n"
+		"  -r <sample_rate> \n"
+		"  -q <sample_rate quality [0..4]\n"
+		"  -m <max_diff> \n"
+		"  -t <target_delay> \n"
+		"  -i  turns on instrumentation\n"
+		"  -v  turns on printouts\n"
+		"\n");
+}
+
+
+/**
+ * the main function....
+ */
+
+void
+sigterm_handler( int signal )
+{
+	quit = 1;
+}
+
+
+int main (int argc, char *argv[]) {
+    char jack_name[30] = "alsa_in";
+    char alsa_device[30] = "hw:0";
+
+    extern char *optarg;
+    extern int optind, optopt;
+    int errflg=0;
+    int c;
+
+    while ((c = getopt(argc, argv, "ivj:r:c:p:n:d:q:m:t:f:F:C:Q:s:")) != -1) {
+	switch(c) {
+	    case 'j':
+		strcpy(jack_name,optarg);
+		break;
+	    case 'r':
+		sample_rate = atoi(optarg);
+		break;
+	    case 'c':
+		num_channels = atoi(optarg);
+		break;
+	    case 'p':
+		period_size = atoi(optarg);
+		break;
+	    case 'n':
+		num_periods = atoi(optarg);
+		break;
+	    case 'd':
+		strcpy(alsa_device,optarg);
+		break;
+	    case 't':
+		target_delay = atoi(optarg);
+		break;
+	    case 'q':
+		samplerate_quality = atoi(optarg);
+		break;
+	    case 'm':
+		max_diff = atoi(optarg);
+		break;
+	    case 'f':
+		catch_factor = atoi(optarg);
+		break;
+	    case 'F':
+		catch_factor2 = atoi(optarg);
+		break;
+	    case 'C':
+		pclamp = (double) atoi(optarg);
+		break;
+	    case 'Q':
+		controlquant = (double) atoi(optarg);
+		break;
+	    case 'v':
+		verbose = 1;
+		break;
+	    case 'i':
+		instrument = 1;
+		break;
+	    case 's':
+		smooth_size = atoi(optarg);
+		break;
+	    case ':':
+		fprintf(stderr,
+			"Option -%c requires an operand\n", optopt);
+		errflg++;
+		break;
+	    case '?':
+		fprintf(stderr,
+			"Unrecognized option: -%c\n", optopt);
+		errflg++;
+	}
+    }
+    if (errflg) {
+	printUsage();
+	exit(2);
+    }
+
+    if( (samplerate_quality < 0) || (samplerate_quality > 4) ) {
+	fprintf (stderr, "invalid samplerate quality\n");
+	return 1;
+    }
+    if ((client = jack_client_open (jack_name, 0, NULL)) == 0) {
+	fprintf (stderr, "jack server not running?\n");
+	return 1;
+    }
+
+    /* tell the JACK server to call `process()' whenever
+       there is work to be done.
+       */
+
+    jack_set_process_callback (client, process, 0);
+
+    /* tell the JACK server to call `jack_shutdown()' if
+       it ever shuts down, either entirely, or if it
+       just decides to stop calling us.
+       */
+
+    jack_on_shutdown (client, jack_shutdown, 0);
+
+
+    // get jack sample_rate
+    
+    jack_sample_rate = jack_get_sample_rate( client );
+
+    if( !sample_rate )
+	sample_rate = jack_sample_rate;
+
+    // now open the alsa fd...
+    alsa_handle = open_audiofd( alsa_device, 1, sample_rate, num_channels, period_size, num_periods);
+    if( alsa_handle == 0 )
+	exit(20);
+
+    printf( "selected sample format: %s\n", formats[format].name );
+
+    static_resample_factor = (double) jack_sample_rate / (double) sample_rate;
+    resample_mean = static_resample_factor;
+
+    offset_array = malloc( sizeof(double) * smooth_size );
+    if( offset_array == NULL ) {
+	    fprintf( stderr, "no memory for offset_array !!!\n" );
+	    exit(20);
+    }
+    window_array = malloc( sizeof(double) * smooth_size );
+    if( window_array == NULL ) {
+	    fprintf( stderr, "no memory for window_array !!!\n" );
+	    exit(20);
+    }
+    int i;
+    for( i=0; i<smooth_size; i++ ) {
+	    offset_array[i] = 0.0;
+	    window_array[i] = hann( (double) i / ((double) smooth_size - 1.0) );
+    }
+
+    jack_buffer_size = jack_get_buffer_size( client );
+    // Setup target delay and max_diff for the normal user, who does not play with them...
+    if( !target_delay ) 
+	target_delay = (num_periods*period_size / 2) + jack_buffer_size/2;
+
+    if( !max_diff )
+	max_diff = num_periods*period_size - target_delay ;	
+
+    if( max_diff > target_delay ) {
+	    fprintf( stderr, "target_delay (%d) cant be smaller than max_diff(%d)\n", target_delay, max_diff );
+	    exit(20);
+    }
+    if( (target_delay+max_diff) > (num_periods*period_size) ) {
+	    fprintf( stderr, "target_delay+max_diff (%d) cant be bigger than buffersize(%d)\n", target_delay+max_diff, num_periods*period_size );
+	    exit(20);
+    }
+    // alloc input ports, which are blasted out to alsa...
+    alloc_ports( num_channels, 0 );
+
+
+    /* tell the JACK server that we are ready to roll */
+
+    if (jack_activate (client)) {
+	fprintf (stderr, "cannot activate client");
+	return 1;
+    }
+
+    signal( SIGTERM, sigterm_handler );
+    signal( SIGINT, sigterm_handler );
+
+    if( verbose ) {
+	    while(!quit) {
+		    usleep(500000);
+		    if( output_new_delay ) {
+			    printf( "delay = %d\n", output_new_delay );
+			    output_new_delay = 0;
+		    }
+		    printf( "res: %f, \tdiff = %f, \toffset = %f \n", output_resampling_factor, output_diff, output_offset );
+	    }
+    } else if( instrument ) {
+	    printf( "# n\tresamp\tdiff\toffseti\tintegral\n");
+	    int n=0;
+	    while(!quit) {
+		    usleep(1000);
+		    printf( "%d\t%f\t%f\t%f\t%f\n", n++, output_resampling_factor, output_diff, output_offset, output_integral );
+	    }
+    } else {
+	    while(!quit)
+	    {
+		    usleep(500000);
+		    if( output_new_delay ) {
+			    printf( "delay = %d\n", output_new_delay );
+			    output_new_delay = 0;
+		    }
+	    }
+    }
+
+    jack_deactivate( client );
+    jack_client_close (client);
+    exit (0);
+}
+
diff --git a/example-clients/alsa_out.c b/example-clients/alsa_out.c
new file mode 100644
index 0000000..852e978
--- /dev/null
+++ b/example-clients/alsa_out.c
@@ -0,0 +1,755 @@
+/** @file simple_client.c
+ *
+ * @brief This simple client demonstrates the basic features of JACK
+ * as they would be used by many applications.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include <alloca.h>
+#include <math.h>
+
+#include <jack/jack.h>
+#include <jack/jslist.h>
+#include <memops.h>
+
+#include "alsa/asoundlib.h"
+
+#include <samplerate.h>
+
+// Here are the lists of the jack ports...
+
+JSList	   *capture_ports = NULL;
+JSList	   *capture_srcs = NULL;
+JSList	   *playback_ports = NULL;
+JSList	   *playback_srcs = NULL;
+jack_client_t *client;
+
+snd_pcm_t *alsa_handle;
+
+int jack_sample_rate;
+int jack_buffer_size;
+
+double resample_mean = 1.0;
+double static_resample_factor = 1.0;
+
+double *offset_array;
+double *window_array;
+int offset_differential_index = 0;
+
+double offset_integral = 0;
+int quit = 0;
+
+// ------------------------------------------------------ commandline parameters
+
+int sample_rate = 0;				 /* stream rate */
+int num_channels = 2;				 /* count of channels */
+int period_size = 1024;
+int num_periods = 2;
+
+int target_delay = 0;	    /* the delay which the program should try to approach. */
+int max_diff = 0;	    /* the diff value, when a hard readpointer skip should occur */
+int catch_factor = 100000;
+int catch_factor2 = 10000;
+double pclamp = 15.0;
+double controlquant = 10000.0;
+int smooth_size = 256;
+int good_window=0;
+int verbose = 0;
+int instrument = 0;
+int samplerate_quality = 2;
+
+// Debug stuff:
+
+volatile float output_resampling_factor = 1.0;
+volatile int output_new_delay = 0;
+volatile float output_offset = 0.0;
+volatile float output_integral = 0.0;
+volatile float output_diff = 0.0;
+
+snd_pcm_uframes_t real_buffer_size;
+snd_pcm_uframes_t real_period_size;
+
+// format selection, and corresponding functions from memops in a nice set of structs.
+
+typedef struct alsa_format {
+	snd_pcm_format_t format_id;
+	size_t sample_size;
+	void (*jack_to_soundcard) (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+	void (*soundcard_to_jack) (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+	const char *name;
+} alsa_format_t;
+
+alsa_format_t formats[] = {
+	{ SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" },
+	{ SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" },
+	{ SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" },
+	{ SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" }
+};
+#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
+int format=0;
+
+// Alsa stuff... i dont want to touch this bullshit in the next years.... please...
+
+static int xrun_recovery(snd_pcm_t *handle, int err) {
+//    printf( "xrun !!!.... %d\n", err );
+	if (err == -EPIPE) {	/* under-run */
+		err = snd_pcm_prepare(handle);
+		if (err < 0)
+			printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
+		return 0;
+	} else if (err == -EAGAIN) {
+		while ((err = snd_pcm_resume(handle)) == -EAGAIN)
+			usleep(100);	/* wait until the suspend flag is released */
+		if (err < 0) {
+			err = snd_pcm_prepare(handle);
+			if (err < 0)
+				printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
+		}
+		return 0;
+	}
+	return err;
+}
+
+static int set_hwformat( snd_pcm_t *handle, snd_pcm_hw_params_t *params )
+{
+	int i;
+	int err;
+
+	for( i=0; i<NUMFORMATS; i++ ) {
+		/* set the sample format */
+		err = snd_pcm_hw_params_set_format(handle, params, formats[i].format_id);
+		if (err == 0) {
+			format = i;
+			return 0;
+		}
+	}
+
+	return err;
+}
+
+static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access, int rate, int channels, int period, int nperiods ) {
+	int err, dir=0;
+	unsigned int buffer_time;
+	unsigned int period_time;
+	unsigned int rrate;
+	unsigned int rchannels;
+
+	/* choose all parameters */
+	err = snd_pcm_hw_params_any(handle, params);
+	if (err < 0) {
+		printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* set the interleaved read/write format */
+	err = snd_pcm_hw_params_set_access(handle, params, access);
+	if (err < 0) {
+		printf("Access type not available for playback: %s\n", snd_strerror(err));
+		return err;
+	}
+
+	/* set the sample format */
+	err = set_hwformat(handle, params);
+	if (err < 0) {
+		printf("Sample format not available for playback: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* set the count of channels */
+	rchannels = channels;
+	err = snd_pcm_hw_params_set_channels_near(handle, params, &rchannels);
+	if (err < 0) {
+		printf("Channels count (%i) not available for record: %s\n", channels, snd_strerror(err));
+		return err;
+	}
+	if (rchannels != channels) {
+		printf("WARNING: chennel count does not match (requested %d got %d)\n", channels, rchannels);
+		num_channels = rchannels;
+	}
+	/* set the stream rate */
+	rrate = rate;
+	err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
+	if (err < 0) {
+		printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
+		return err;
+	}
+	if (rrate != rate) {
+		printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, rrate);
+		return -EINVAL;
+	}
+	/* set the buffer time */
+
+	buffer_time = 1000000*(uint64_t)period*nperiods/rate;
+	err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir);
+	if (err < 0) {
+		printf("Unable to set buffer time %i for playback: %s\n",  1000000*period*nperiods/rate, snd_strerror(err));
+		return err;
+	}
+	err = snd_pcm_hw_params_get_buffer_size( params, &real_buffer_size );
+	if (err < 0) {
+		printf("Unable to get buffer size back: %s\n", snd_strerror(err));
+		return err;
+	}
+	if( real_buffer_size != nperiods * period ) {
+	    printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size );
+	}
+	/* set the period time */
+	period_time = 1000000*(uint64_t)period/rate;
+	err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
+	if (err < 0) {
+		printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err));
+		return err;
+	}
+	err = snd_pcm_hw_params_get_period_size(params, &real_period_size, NULL );
+	if (err < 0) {
+		printf("Unable to get period size back: %s\n", snd_strerror(err));
+		return err;
+	}
+	if( real_period_size != period ) {
+	    printf( "WARNING: period size does not match: (requested %i, got %i)\n", period, (int)real_period_size );
+	}
+	/* write the parameters to device */
+	err = snd_pcm_hw_params(handle, params);
+	if (err < 0) {
+		printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
+		return err;
+	}
+	return 0;
+}
+
+static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, int period, int nperiods) {
+	int err;
+
+	/* get the current swparams */
+	err = snd_pcm_sw_params_current(handle, swparams);
+	if (err < 0) {
+		printf("Unable to determine current swparams for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* start the transfer when the buffer is full */
+	err = snd_pcm_sw_params_set_start_threshold(handle, swparams, period );
+	if (err < 0) {
+		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, -1 );
+	if (err < 0) {
+		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* allow the transfer when at least period_size samples can be processed */
+	err = snd_pcm_sw_params_set_avail_min(handle, swparams, 1 );
+	if (err < 0) {
+		printf("Unable to set avail min for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* align all transfers to 1 sample */
+	err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
+	if (err < 0) {
+		printf("Unable to set transfer align for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	/* write the parameters to the playback device */
+	err = snd_pcm_sw_params(handle, swparams);
+	if (err < 0) {
+		printf("Unable to set sw params for capture: %s\n", snd_strerror(err));
+		return err;
+	}
+	return 0;
+}
+
+// ok... i only need this function to communicate with the alsa bloat api...
+
+static snd_pcm_t *open_audiofd( char *device_name, int capture, int rate, int channels, int period, int nperiods ) {
+  int err;
+  snd_pcm_t *handle;
+  snd_pcm_hw_params_t *hwparams;
+  snd_pcm_sw_params_t *swparams;
+
+  snd_pcm_hw_params_alloca(&hwparams);
+  snd_pcm_sw_params_alloca(&swparams);
+
+  if ((err = snd_pcm_open(&(handle), device_name, capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK )) < 0) {
+      printf("Capture open error: %s\n", snd_strerror(err));
+      return NULL;
+  }
+
+  if ((err = set_hwparams(handle, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED, rate, channels, period, nperiods )) < 0) {
+      printf("Setting of hwparams failed: %s\n", snd_strerror(err));
+      return NULL;
+  }
+  if ((err = set_swparams(handle, swparams, period, nperiods)) < 0) {
+      printf("Setting of swparams failed: %s\n", snd_strerror(err));
+      return NULL;
+  }
+
+  //snd_pcm_start( handle );
+  //snd_pcm_wait( handle, 200 );
+  int num_null_samples = nperiods * period * channels;
+  char *tmp = alloca( num_null_samples * formats[format].sample_size ); 
+  memset( tmp, 0, num_null_samples * formats[format].sample_size );
+  snd_pcm_writei( handle, tmp, num_null_samples );
+  
+
+  return handle;
+}
+
+double hann( double x )
+{
+	return 0.5 * (1.0 - cos( 2*M_PI * x ) );
+}
+
+/**
+ * The process callback for this JACK application.
+ * It is called by JACK at the appropriate times.
+ */
+int process (jack_nframes_t nframes, void *arg) {
+
+    char *outbuf;
+    float *resampbuf;
+    int rlen;
+    int err;
+    snd_pcm_sframes_t delay = target_delay;
+    int i;
+
+    delay = (num_periods*period_size)-snd_pcm_avail( alsa_handle ) ;
+
+    delay -= jack_frames_since_cycle_start( client );
+    delay += jack_get_buffer_size( client ) / 2;
+    // Do it the hard way.
+    // this is for compensating xruns etc...
+
+    if( delay > (target_delay+max_diff) ) {
+	snd_pcm_rewind( alsa_handle, delay - target_delay );
+	output_new_delay = (int) delay;
+
+	delay = target_delay;
+
+	// Set the resample_rate... we need to adjust the offset integral, to do this.
+	// first look at the PI controller, this code is just a special case, which should never execute once
+	// everything is swung in. 
+	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
+	// Also clear the array. we are beginning a new control cycle.
+	for( i=0; i<smooth_size; i++ )
+		offset_array[i] = 0.0;
+    }
+    if( delay < (target_delay-max_diff) ) {
+	char *tmp = alloca( (target_delay-delay) * formats[format].sample_size * num_channels ); 
+	memset( tmp, 0,  formats[format].sample_size * num_channels * (target_delay-delay) );
+	snd_pcm_writei( alsa_handle, tmp, target_delay-delay );
+
+	output_new_delay = (int) delay;
+
+	delay = target_delay;
+
+	// Set the resample_rate... we need to adjust the offset integral, to do this.
+	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
+	// Also clear the array. we are beginning a new control cycle.
+	for( i=0; i<smooth_size; i++ )
+		offset_array[i] = 0.0;
+    }
+    /* ok... now we should have target_delay +- max_diff on the alsa side.
+     *
+     * calculate the number of frames, we want to get.
+     */
+
+    double offset = delay - target_delay;
+
+    // Save offset.
+    offset_array[(offset_differential_index++)% smooth_size ] = offset;
+
+    // Build the mean of the windowed offset array
+    // basically fir lowpassing.
+    double smooth_offset = 0.0;
+    for( i=0; i<smooth_size; i++ )
+	    smooth_offset +=
+		    offset_array[ (i + offset_differential_index-1) % smooth_size] * window_array[i];
+    smooth_offset /= (double) smooth_size;
+
+    // this is the integral of the smoothed_offset
+    offset_integral += smooth_offset;
+
+    // Clamp offset.
+    // the smooth offset still contains unwanted noise
+    // which would go straigth onto the resample coeff.
+    // it only used in the P component and the I component is used for the fine tuning anyways.
+    if( fabs( smooth_offset ) < pclamp )
+	    smooth_offset = 0.0;
+
+    // ok. now this is the PI controller. 
+    // u(t) = K * ( e(t) + 1/T \int e(t') dt' )
+    // K = 1/catch_factor and T = catch_factor2
+    double current_resample_factor = static_resample_factor - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2;
+
+    // now quantize this value around resample_mean, so that the noise which is in the integral component doesnt hurt.
+    current_resample_factor = floor( (current_resample_factor - resample_mean) * controlquant + 0.5 ) / controlquant + resample_mean;
+
+    // Output "instrumentatio" gonna change that to real instrumentation in a few.
+    output_resampling_factor = (float) current_resample_factor;
+    output_diff = (float) smooth_offset;
+    output_integral = (float) offset_integral;
+    output_offset = (float) offset;
+
+    // Clamp a bit.
+    if( current_resample_factor < 0.25 ) current_resample_factor = 0.25;
+    if( current_resample_factor > 4 ) current_resample_factor = 4;
+
+    // Now Calculate how many samples we need.
+    rlen = ceil( ((double)nframes) * current_resample_factor )+2;
+    assert( rlen > 2 );
+
+    // Calculate resample_mean so we can init ourselves to saner values.
+    resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor;
+    /*
+     * now this should do it...
+     */
+
+    outbuf = alloca( rlen * formats[format].sample_size * num_channels );
+
+    resampbuf = alloca( rlen * sizeof( float ) );
+    /*
+     * render jack ports to the outbuf...
+     */
+
+    int chn = 0;
+    JSList *node = playback_ports;
+    JSList *src_node = playback_srcs;
+    SRC_DATA src;
+
+    while ( node != NULL)
+    {
+	jack_port_t *port = (jack_port_t *) node->data;
+	float *buf = jack_port_get_buffer (port, nframes);
+
+	SRC_STATE *src_state = src_node->data;
+
+	src.data_in = buf;
+	src.input_frames = nframes;
+
+	src.data_out = resampbuf;
+	src.output_frames = rlen;
+	src.end_of_input = 0;
+
+	src.src_ratio = current_resample_factor;
+
+	src_process( src_state, &src );
+
+	formats[format].jack_to_soundcard( outbuf + format[formats].sample_size * chn, resampbuf, src.output_frames_gen, num_channels*format[formats].sample_size, NULL);
+
+	src_node = jack_slist_next (src_node);
+	node = jack_slist_next (node);
+	chn++;
+    }
+
+    // now write the output...
+again:
+  err = snd_pcm_writei(alsa_handle, outbuf, src.output_frames_gen);
+  //err = snd_pcm_writei(alsa_handle, outbuf, src.output_frames_gen);
+  if( err < 0 ) {
+      printf( "err = %d\n", err );
+      if (xrun_recovery(alsa_handle, err) < 0) {
+	  printf("Write error: %s\n", snd_strerror(err));
+	  exit(EXIT_FAILURE);
+      }
+      goto again;
+  }
+
+    return 0;      
+}
+
+
+/**
+ * Allocate the necessary jack ports...
+ */
+
+void alloc_ports( int n_capture, int n_playback ) {
+
+    int port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
+    int chn;
+    jack_port_t *port;
+    char buf[32];
+
+    capture_ports = NULL;
+    for (chn = 0; chn < n_capture; chn++)
+    {
+	snprintf (buf, sizeof(buf) - 1, "capture_%u", chn+1);
+
+	port = jack_port_register (client, buf,
+		JACK_DEFAULT_AUDIO_TYPE,
+		port_flags, 0);
+
+	if (!port)
+	{
+	    printf( "jacknet_client: cannot register port for %s", buf);
+	    break;
+	}
+
+	capture_srcs = jack_slist_append( capture_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
+	capture_ports = jack_slist_append (capture_ports, port);
+    }
+
+    port_flags = JackPortIsInput;
+
+    playback_ports = NULL;
+    for (chn = 0; chn < n_playback; chn++)
+    {
+	snprintf (buf, sizeof(buf) - 1, "playback_%u", chn+1);
+
+	port = jack_port_register (client, buf,
+		JACK_DEFAULT_AUDIO_TYPE,
+		port_flags, 0);
+
+	if (!port)
+	{
+	    printf( "jacknet_client: cannot register port for %s", buf);
+	    break;
+	}
+
+	playback_srcs = jack_slist_append( playback_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
+	playback_ports = jack_slist_append (playback_ports, port);
+    }
+}
+
+/**
+ * This is the shutdown callback for this JACK application.
+ * It is called by JACK if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+
+void jack_shutdown (void *arg) {
+
+	exit (1);
+}
+
+/**
+ * be user friendly.
+ * be user friendly.
+ * be user friendly.
+ */
+
+void printUsage() {
+fprintf(stderr, "usage: alsa_out [options]\n"
+		"\n"
+		"  -j <jack name> - client name\n"
+		"  -d <alsa_device> \n"
+		"  -c <channels> \n"
+		"  -p <period_size> \n"
+		"  -n <num_period> \n"
+		"  -r <sample_rate> \n"
+		"  -q <sample_rate quality [0..4]\n"
+		"  -m <max_diff> \n"
+		"  -t <target_delay> \n"
+		"  -i  turns on instrumentation\n"
+		"  -v  turns on printouts\n"
+		"\n");
+}
+
+
+/**
+ * the main function....
+ */
+
+void
+sigterm_handler( int signal )
+{
+	quit = 1;
+}
+
+
+int main (int argc, char *argv[]) {
+    char jack_name[30] = "alsa_out";
+    char alsa_device[30] = "hw:0";
+
+    extern char *optarg;
+    extern int optind, optopt;
+    int errflg=0;
+    int c;
+
+    while ((c = getopt(argc, argv, "ivj:r:c:p:n:d:q:m:t:f:F:C:Q:s:")) != -1) {
+	switch(c) {
+	    case 'j':
+		strcpy(jack_name,optarg);
+		break;
+	    case 'r':
+		sample_rate = atoi(optarg);
+		break;
+	    case 'c':
+		num_channels = atoi(optarg);
+		break;
+	    case 'p':
+		period_size = atoi(optarg);
+		break;
+	    case 'n':
+		num_periods = atoi(optarg);
+		break;
+	    case 'd':
+		strcpy(alsa_device,optarg);
+		break;
+	    case 't':
+		target_delay = atoi(optarg);
+		break;
+	    case 'q':
+		samplerate_quality = atoi(optarg);
+		break;
+	    case 'm':
+		max_diff = atoi(optarg);
+		break;
+	    case 'f':
+		catch_factor = atoi(optarg);
+		break;
+	    case 'F':
+		catch_factor2 = atoi(optarg);
+		break;
+	    case 'C':
+		pclamp = (double) atoi(optarg);
+		break;
+	    case 'Q':
+		controlquant = (double) atoi(optarg);
+		break;
+	    case 'v':
+		verbose = 1;
+		break;
+	    case 'i':
+		instrument = 1;
+		break;
+	    case 's':
+		smooth_size = atoi(optarg);
+		break;
+	    case ':':
+		fprintf(stderr,
+			"Option -%c requires an operand\n", optopt);
+		errflg++;
+		break;
+	    case '?':
+		fprintf(stderr,
+			"Unrecognized option: -%c\n", optopt);
+		errflg++;
+	}
+    }
+    if (errflg) {
+	printUsage();
+	exit(2);
+    }
+
+    if( (samplerate_quality < 0) || (samplerate_quality > 4) ) {
+	fprintf (stderr, "invalid samplerate quality\n");
+	return 1;
+    }
+    if ((client = jack_client_open (jack_name, 0, NULL)) == 0) {
+	fprintf (stderr, "jack server not running?\n");
+	return 1;
+    }
+
+    /* tell the JACK server to call `process()' whenever
+       there is work to be done.
+       */
+
+    jack_set_process_callback (client, process, 0);
+
+    /* tell the JACK server to call `jack_shutdown()' if
+       it ever shuts down, either entirely, or if it
+       just decides to stop calling us.
+       */
+
+    jack_on_shutdown (client, jack_shutdown, 0);
+
+
+    // get jack sample_rate
+    
+    jack_sample_rate = jack_get_sample_rate( client );
+
+    if( !sample_rate )
+	sample_rate = jack_sample_rate;
+
+    static_resample_factor =  (double) sample_rate / (double) jack_sample_rate;
+    resample_mean = static_resample_factor;
+
+    offset_array = malloc( sizeof(double) * smooth_size );
+    if( offset_array == NULL ) {
+	    fprintf( stderr, "no memory for offset_array !!!\n" );
+	    exit(20);
+    }
+    window_array = malloc( sizeof(double) * smooth_size );
+    if( window_array == NULL ) {
+	    fprintf( stderr, "no memory for window_array !!!\n" );
+	    exit(20);
+    }
+    int i;
+    for( i=0; i<smooth_size; i++ ) {
+	    offset_array[i] = 0.0;
+	    window_array[i] = hann( (double) i / ((double) smooth_size - 1.0) );
+    }
+
+    jack_buffer_size = jack_get_buffer_size( client );
+    // Setup target delay and max_diff for the normal user, who does not play with them...
+    if( !target_delay ) 
+	target_delay = (num_periods*period_size / 2) - jack_buffer_size/2;
+
+    if( !max_diff )
+	max_diff = target_delay;	
+
+    if( max_diff > target_delay ) {
+	    fprintf( stderr, "target_delay (%d) cant be smaller than max_diff(%d)\n", target_delay, max_diff );
+	    exit(20);
+    }
+    if( (target_delay+max_diff) > (num_periods*period_size) ) {
+	    fprintf( stderr, "target_delay+max_diff (%d) cant be bigger than buffersize(%d)\n", target_delay+max_diff, num_periods*period_size );
+	    exit(20);
+    }
+    // now open the alsa fd...
+    alsa_handle = open_audiofd( alsa_device, 0, sample_rate, num_channels, period_size, num_periods);
+    if( alsa_handle == 0 )
+	exit(20);
+
+    printf( "selected sample format: %s\n", formats[format].name );
+
+    // alloc input ports, which are blasted out to alsa...
+    alloc_ports( 0, num_channels );
+
+
+    /* tell the JACK server that we are ready to roll */
+
+    if (jack_activate (client)) {
+	fprintf (stderr, "cannot activate client");
+	return 1;
+    }
+
+    signal( SIGTERM, sigterm_handler );
+    signal( SIGINT, sigterm_handler );
+
+    if( verbose ) {
+	    while(!quit) {
+		    usleep(500000);
+		    if( output_new_delay ) {
+			    printf( "delay = %d\n", output_new_delay );
+			    output_new_delay = 0;
+		    }
+		    printf( "res: %f, \tdiff = %f, \toffset = %f \n", output_resampling_factor, output_diff, output_offset );
+	    }
+    } else if( instrument ) {
+	    printf( "# n\tresamp\tdiff\toffseti\tintegral\n");
+	    int n=0;
+	    while(!quit) {
+		    usleep(1000);
+		    printf( "%d\t%f\t%f\t%f\t%f\n", n++, output_resampling_factor, output_diff, output_offset, output_integral );
+	    }
+    } else {
+	    while(!quit)
+	    {
+		    usleep(500000);
+		    if( output_new_delay ) {
+			    printf( "delay = %d\n", output_new_delay );
+			    output_new_delay = 0;
+		    }
+	    }
+    }
+
+    jack_deactivate( client );
+    jack_client_close (client);
+    exit (0);
+}
+
diff --git a/example-clients/bufsize.c b/example-clients/bufsize.c
new file mode 100644
index 0000000..72a0f9e
--- /dev/null
+++ b/example-clients/bufsize.c
@@ -0,0 +1,107 @@
+/*
+ *  bufsize.c -- change JACK buffer size.
+ *
+ *  Copyright (C) 2003 Jack O'Quin.
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+char *package;				/* program name */
+jack_client_t *client;
+jack_nframes_t nframes;
+int just_print_bufsize=0;
+
+void jack_shutdown(void *arg)
+{
+	fprintf(stderr, "JACK shut down, exiting ...\n");
+	exit(1);
+}
+
+void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+void parse_arguments(int argc, char *argv[])
+{
+
+	/* basename $0 */
+	package = strrchr(argv[0], '/');
+	if (package == 0)
+		package = argv[0];
+	else
+		package++;
+
+	if (argc==1) {
+		just_print_bufsize = 1;
+		return;
+	}
+	if (argc < 2) {
+		fprintf(stderr, "usage: %s <bufsize>\n", package);
+		exit(9);
+	}
+
+	nframes = strtoul(argv[1], NULL, 0);
+	if (errno == ERANGE) {
+		fprintf(stderr, "%s: invalid buffer size: %s\n",
+			package, argv[1]);
+		exit(2);
+	}
+}
+
+int main(int argc, char *argv[])
+{
+	int rc;
+
+	parse_arguments(argc, argv);
+
+	/* become a JACK client */
+    if ((client = jack_client_open(package, JackNullOption, NULL)) == 0) {
+		fprintf(stderr, "JACK server not running?\n");
+		exit(1);
+	}
+
+	signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+
+	jack_on_shutdown(client, jack_shutdown, 0);
+
+	if (just_print_bufsize) {
+		fprintf(stdout, "%d\n", jack_get_buffer_size( client ) );
+		rc=0;
+	}
+	else
+	{
+		rc = jack_set_buffer_size(client, nframes);
+		if (rc)
+			fprintf(stderr, "jack_set_buffer_size(): %s\n", strerror(rc));
+	}
+	jack_client_close(client);
+
+	return rc;
+}
diff --git a/example-clients/capture_client.c b/example-clients/capture_client.c
index bcbc951..72a2467 100644
--- a/example-clients/capture_client.c
+++ b/example-clients/capture_client.c
@@ -18,7 +18,6 @@
 
     * 2002/08/23 - modify for libsndfile 1.0.0 <andy at alsaplayer.org>
     * 2003/05/26 - use ringbuffers - joq
-    
 */
 
 #include <stdio.h>
@@ -28,6 +27,7 @@
 #include <unistd.h>
 #include <sndfile.h>
 #include <pthread.h>
+#include <signal.h>
 #include <getopt.h>
 #include <jack/jack.h>
 #include <jack/ringbuffer.h>
@@ -59,9 +59,16 @@ jack_ringbuffer_t *rb;
 pthread_mutex_t disk_thread_lock = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t  data_ready = PTHREAD_COND_INITIALIZER;
 long overruns = 0;
+jack_client_t *client;
 
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
 
-void *
+static void *
 disk_thread (void *arg)
 {
 	jack_thread_info_t *info = (jack_thread_info_t *) arg;
@@ -110,7 +117,7 @@ disk_thread (void *arg)
 	return 0;
 }
 	
-int
+static int
 process (jack_nframes_t nframes, void *arg)
 {
 	int chn;
@@ -148,7 +155,7 @@ process (jack_nframes_t nframes, void *arg)
 	return 0;
 }
 
-void
+static void
 jack_shutdown (void *arg)
 {
 	fprintf (stderr, "JACK shutdown\n");
@@ -156,7 +163,7 @@ jack_shutdown (void *arg)
 	abort();
 }
 
-void
+static void
 setup_disk_thread (jack_thread_info_t *info)
 {
 	SF_INFO sf_info;
@@ -187,18 +194,13 @@ setup_disk_thread (jack_thread_info_t *info)
 		exit (1);
 	}
 
-	if (info->duration == 0) {
-		info->duration = JACK_MAX_FRAMES;
-	} else {
-		info->duration *= sf_info.samplerate;
-	}
-
+	info->duration *= sf_info.samplerate;
 	info->can_capture = 0;
 
 	pthread_create (&info->thread_id, NULL, disk_thread, info);
 }
 
-void
+static void
 run_disk_thread (jack_thread_info_t *info)
 {
 	info->can_capture = 1;
@@ -213,7 +215,7 @@ run_disk_thread (jack_thread_info_t *info)
 	}
 }
 
-void
+static void
 setup_ports (int sources, char *source_names[], jack_thread_info_t *info)
 {
 	unsigned int i;
@@ -259,10 +261,8 @@ setup_ports (int sources, char *source_names[], jack_thread_info_t *info)
 
 int
 main (int argc, char *argv[])
-
 {
-	jack_client_t *client;
-	jack_thread_info_t thread_info;
+    jack_thread_info_t thread_info;
 	int c;
 	int longopt_index = 0;
 	extern int optind, opterr;
@@ -314,7 +314,7 @@ main (int argc, char *argv[])
 		exit (1);
 	}
 
-	if ((client = jack_client_new ("jackrec")) == 0) {
+	if ((client = jack_client_open ("jackrec", JackNullOption, NULL)) == 0) {
 		fprintf (stderr, "jack server not running?\n");
 		exit (1);
 	}
@@ -333,6 +333,12 @@ main (int argc, char *argv[])
 	}
 
 	setup_ports (argc - optind, &argv[optind], &thread_info);
+    
+     /* install a signal handler to properly quits jack client */
+    signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
 
 	run_disk_thread (&thread_info);
 
diff --git a/example-clients/connect.c b/example-clients/connect.c
new file mode 100644
index 0000000..a89e538
--- /dev/null
+++ b/example-clients/connect.c
@@ -0,0 +1,121 @@
+/*
+    Copyright (C) 2002 Jeremy Hall
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <jack/jack.h>
+
+jack_port_t *input_port;
+jack_port_t *output_port;
+int connecting, disconnecting;
+#define TRUE 1
+#define FALSE 0
+
+int
+main (int argc, char *argv[])
+{
+	jack_client_t* client = NULL;
+	char *my_name = strrchr(argv[0], '/');
+	connecting = disconnecting = FALSE;
+	if (my_name == 0) {
+		my_name = argv[0];
+	} else {
+		my_name ++;
+	}
+    
+    printf("name %s\n", my_name);
+
+	if (strstr(my_name, "jack_disconnect")) {
+		disconnecting = TRUE;
+	} else
+	if (strstr(my_name, "jack_connect")) {
+		connecting = TRUE;
+	} else {
+		fprintf(stderr, "ERROR! client should be called jack_connect or jack_disconnect. client is called %s\n", my_name);
+		return 1;
+	}
+
+	if (argc != 3) {
+		fprintf (stderr, "usage: %s <src_port> <dst_port>\n", my_name);
+		fprintf(stderr, "The source port must be an output port of the source client.\n");
+		fprintf (stderr, "The destination port must be an input port of the destination client.\n");
+		return 1;
+	}
+
+	/* try to become a client of the JACK server */
+
+	if ((client = jack_client_open (my_name, JackNullOption, NULL)) == 0) {
+		fprintf (stderr, "jack server not running?\n");
+		return 1;
+	}
+
+	/* display the current sample rate. once the client is activated 
+	   (see below), you should rely on your own sample rate
+	   callback (see above) for this value.
+	*/
+
+	/* find the two ports */
+
+	if ((input_port = jack_port_by_name(client, argv[1])) == 0) {
+		fprintf (stderr, "ERROR %s not a valid port\n", argv[1]);
+		goto error;
+	}
+	if ((output_port = jack_port_by_name(client, argv[2])) == 0) {
+		fprintf (stderr, "ERROR %s not a valid port\n", argv[2]);
+		goto error;
+	}
+	
+	/* tell the JACK server that we are ready to roll */
+
+	if (jack_activate (client)) {
+		fprintf (stderr, "cannot activate client");
+		goto error;
+	}
+
+	/* connect the ports. Note: you can't do this before
+	   the client is activated (this may change in the future).
+	*/
+
+ 	if (connecting) {
+		if (jack_connect(client, jack_port_name(input_port), jack_port_name(output_port))) {
+			fprintf (stderr, "cannot connect ports\n");
+			goto error;
+        }
+	}
+	if (disconnecting) {
+     	if (jack_disconnect(client, jack_port_name(input_port), jack_port_name(output_port))) {
+			fprintf (stderr, "cannot disconnect ports\n");
+            goto error;
+        }
+	}
+    jack_deactivate (client);
+	jack_client_close (client);
+	return 0;
+    
+error:
+    if (client) 
+		jack_client_close (client);
+    return 1;
+}
+
diff --git a/example-clients/control.c b/example-clients/control.c
new file mode 100644
index 0000000..363b6b2
--- /dev/null
+++ b/example-clients/control.c
@@ -0,0 +1,75 @@
+/** @file simple_client.c
+ *
+ * @brief This simple client demonstrates the basic features of JACK
+ * as they would be used by many applications.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <math.h>
+#include <jack/jack.h>
+
+jack_client_t *client;
+static int reorder = 0;
+   
+static int Jack_Graph_Order_Callback(void *arg)
+{
+    const char **ports;
+    int i;
+	
+    printf("Jack_Graph_Order_Callback count = %d\n", reorder++);
+    
+    ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
+    if (ports) {
+        for (i = 0;  ports[i]; ++i) {
+            printf("name: %s\n", ports[i]);
+        }
+        free(ports);
+    }
+    
+    ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
+    if (ports) { 
+        for (i = 0;  ports[i]; ++i) {
+            printf("name: %s\n", ports[i]);
+        }
+        free(ports);
+    }
+	
+    return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_options_t options = JackNullOption;
+	jack_status_t status;
+	
+	/* open a client connection to the JACK server */
+
+	client = jack_client_open("control_client", options, &status);
+	if (client == NULL) {
+		printf("jack_client_open() failed \n");
+		exit(1);
+	}
+	
+	if (jack_set_graph_order_callback(client, Jack_Graph_Order_Callback, 0) != 0) {
+        printf("Error when calling jack_set_graph_order_callback() !\n");
+    }
+
+	/* Tell the JACK server that we are ready to roll.  Our
+	 * process() callback will start running now. */
+
+	if (jack_activate(client)) {
+		printf("cannot activate client");
+		exit(1);
+	}
+	
+    printf("Type 'q' to quit\n");	
+    while ((getchar() != 'q')) {}
+  
+	jack_client_close(client);
+	exit (0);
+}
diff --git a/example-clients/cpu_load.c b/example-clients/cpu_load.c
new file mode 100644
index 0000000..1d5787a
--- /dev/null
+++ b/example-clients/cpu_load.c
@@ -0,0 +1,92 @@
+/** @file cpu_load.c
+ *
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <signal.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <jack/jack.h>
+
+
+jack_client_t *client;
+
+static void signal_handler ( int sig )
+{
+    jack_client_close ( client );
+    fprintf ( stderr, "signal received, exiting ...\n" );
+    exit ( 0 );
+}
+
+
+/**
+ * JACK calls this shutdown_callback if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+void
+jack_shutdown ( void *arg )
+{
+     exit ( 1 );
+}
+
+int
+main ( int argc, char *argv[] )
+{
+    jack_options_t options = JackNullOption;
+    jack_status_t status;
+
+    /* open a client connection to the JACK server */
+
+    client = jack_client_open ("jack_cpu_load", options, &status);
+    if ( client == NULL )
+    {
+        fprintf ( stderr, "jack_client_open() failed, "
+                  "status = 0x%2.0x\n", status );
+        if ( status & JackServerFailed )
+        {
+            fprintf ( stderr, "Unable to connect to JACK server\n" );
+        }
+        exit ( 1 );
+    }
+  
+    jack_on_shutdown ( client, jack_shutdown, 0 );
+
+    /* Tell the JACK server that we are ready to roll.  Our
+     * process() callback will start running now. */
+
+    if ( jack_activate ( client ) )
+    {
+        fprintf ( stderr, "cannot activate client" );
+        exit ( 1 );
+    }
+
+    /* install a signal handler to properly quits jack client */
+#ifdef WIN32
+    signal ( SIGINT, signal_handler );
+    signal ( SIGABRT, signal_handler );
+    signal ( SIGTERM, signal_handler );
+#else
+    signal ( SIGQUIT, signal_handler );
+    signal ( SIGTERM, signal_handler );
+    signal ( SIGHUP, signal_handler );
+    signal ( SIGINT, signal_handler );
+#endif
+
+     while (1)
+    {
+        printf("jack DSP load %f\n", jack_cpu_load(client));
+#ifdef WIN32
+        Sleep ( 1000 );
+#else
+        sleep ( 1 );
+#endif
+    }
+
+    jack_client_close ( client );
+    exit ( 0 );
+}
diff --git a/example-clients/evmon.c b/example-clients/evmon.c
new file mode 100644
index 0000000..67a75e9
--- /dev/null
+++ b/example-clients/evmon.c
@@ -0,0 +1,114 @@
+/*
+    Copyright (C) 2007 Paul Davis
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
+
+#include <jack/jack.h>
+
+jack_client_t *client;
+
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+static void
+port_callback (jack_port_id_t port, int yn, void* arg)
+{
+	printf ("Port %d %s\n", port, (yn ? "registered" : "unregistered"));
+}
+
+static void
+connect_callback (jack_port_id_t a, jack_port_id_t b, int yn, void* arg)
+{
+	printf ("Ports %d and %d %s\n", a, b, (yn ? "connected" : "disconnected"));
+}
+
+static void
+client_callback (const char* client, int yn, void* arg)
+{
+	printf ("Client %s %s\n", client, (yn ? "registered" : "unregistered"));
+}
+
+static int
+graph_callback (void* arg)
+{
+	printf ("Graph reordered\n");
+	return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_options_t options = JackNullOption;
+	jack_status_t status;
+
+	if ((client = jack_client_open ("event-monitor", options, &status, NULL)) == 0) {
+		fprintf (stderr, "jack_client_open() failed, "
+			 "status = 0x%2.0x\n", status);
+		if (status & JackServerFailed) {
+			fprintf (stderr, "Unable to connect to JACK server\n");
+		}
+		return 1;
+	}
+	
+	if (jack_set_port_registration_callback (client, port_callback, NULL)) {
+		fprintf (stderr, "cannot set port registration callback\n");
+		return 1;
+	}
+	if (jack_set_port_connect_callback (client, connect_callback, NULL)) {
+		fprintf (stderr, "cannot set port connect callback\n");
+		return 1;
+	}
+	if (jack_set_client_registration_callback (client, client_callback, NULL)) {
+		fprintf (stderr, "cannot set client registration callback\n");
+		return 1;
+	}
+	if (jack_set_graph_order_callback (client, graph_callback, NULL)) {
+		fprintf (stderr, "cannot set graph order registration callback\n");
+		return 1;
+	}
+	if (jack_activate (client)) {
+		fprintf (stderr, "cannot activate client");
+		return 1;
+	}
+    
+#ifdef WIN32
+	signal(SIGINT, signal_handler);
+    signal(SIGABRT, signal_handler);
+	signal(SIGTERM, signal_handler);
+#else
+	signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+#endif
+
+	sleep (-1);
+	exit (0);
+}
+
diff --git a/example-clients/freewheel.c b/example-clients/freewheel.c
new file mode 100644
index 0000000..c089283
--- /dev/null
+++ b/example-clients/freewheel.c
@@ -0,0 +1,85 @@
+/*
+ *  freewheel - start/stop JACK "freewheeling" mode
+ *
+ *  Copyright (C) 2003 Paul Davis.
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+char *package;				/* program name */
+jack_client_t *client;
+int onoff;
+
+static void jack_shutdown(void *arg)
+{
+	fprintf(stderr, "JACK shut down, exiting ...\n");
+	exit(1);
+}
+
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+static void parse_arguments(int argc, char *argv[])
+{
+	if (argc < 2) {
+		fprintf(stderr, "usage: %s y|n\n", package);
+		exit(9);
+	}
+
+	if (argv[1][0] == 'y' || argv[1][0] == 'Y' || argv[1][0] == '1') {
+		onoff = 1;
+	} else {
+		onoff = 0;
+	}
+}
+
+int 
+main (int argc, char *argv[])
+{
+	parse_arguments (argc, argv);
+
+	/* become a JACK client */
+	if ((client = jack_client_open ("freewheel", JackNullOption, NULL)) == 0) {
+		fprintf (stderr, "JACK server not running?\n");
+		exit(1);
+	}
+
+	signal (SIGQUIT, signal_handler);
+	signal (SIGTERM, signal_handler);
+	signal (SIGHUP, signal_handler);
+	signal (SIGINT, signal_handler);
+
+	jack_on_shutdown (client, jack_shutdown, 0);
+
+	if (jack_set_freewheel (client, onoff)) {
+		fprintf (stderr, "failed to reset freewheel mode\n");
+	}
+
+	jack_client_close(client);
+	return 0;
+}
diff --git a/example-clients/impulse_grabber.c b/example-clients/impulse_grabber.c
index e4b60f8..0a1fd70 100644
--- a/example-clients/impulse_grabber.c
+++ b/example-clients/impulse_grabber.c
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <signal.h>
 #include <math.h>
 #include <getopt.h>
 
@@ -34,8 +35,16 @@ float *response;
 unsigned long response_duration;
 unsigned long response_pos;
 int grab_finished = 0;
+jack_client_t *client;
+	
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
 
-int
+static int
 process (jack_nframes_t nframes, void *arg)
 
 {
@@ -66,7 +75,7 @@ process (jack_nframes_t nframes, void *arg)
 	return 0;      
 }
 
-void
+static void
 jack_shutdown (void *arg)
 {
 	exit (1);
@@ -74,9 +83,7 @@ jack_shutdown (void *arg)
 
 int
 main (int argc, char *argv[])
-
 {
-	jack_client_t *client;
 	const char **ports;
 	float fs;		// The sample rate
 	float peak;
@@ -124,7 +131,7 @@ main (int argc, char *argv[])
 
 	/* try to become a client of the JACK server */
 
-	if ((client = jack_client_new("impulse_grabber")) == 0) {
+	if ((client = jack_client_open("impulse_grabber", JackNullOption, NULL)) == 0) {
 		fprintf (stderr, "jack server not running?\n");
 		return 1;
 	}
@@ -191,6 +198,12 @@ main (int argc, char *argv[])
 	}
 
 	free (ports);
+    
+    /* install a signal handler to properly quits jack client */
+    signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
 
 	/* Wait for grab to finish */
 	while (!grab_finished) {
diff --git a/example-clients/inprocess.c b/example-clients/inprocess.c
index 93258ca..c650f41 100644
--- a/example-clients/inprocess.c
+++ b/example-clients/inprocess.c
@@ -60,6 +60,7 @@ int
 jack_initialize (jack_client_t *client, const char *load_init)
 {
 	port_pair_t *pp = malloc (sizeof (port_pair_t));
+	const char **ports;
 
 	if (pp == NULL)
 		return 1;		/* heap exhausted */
@@ -76,20 +77,32 @@ jack_initialize (jack_client_t *client, const char *load_init)
 
 	/* join the process() cycle */
 	jack_activate (client);
-
-	/* try to connect to the first physical input & output ports */
-
-	if (jack_connect (client, "system:capture_1",
-			  jack_port_name (pp->input_port))) {
-		fprintf (stderr, "cannot connect input port\n");
+	
+	ports = jack_get_ports (client, NULL, NULL,
+				JackPortIsPhysical|JackPortIsOutput);
+	if (ports == NULL) {
+		fprintf(stderr, "no physical capture ports\n");
 		return 1;		/* terminate client */
 	}
 
-	if (jack_connect (client, jack_port_name (pp->output_port),
-			  "system:playback_1")) {
-		fprintf (stderr, "cannot connect output port\n");
+	if (jack_connect (client, ports[0], jack_port_name (pp->input_port))) {
+		fprintf (stderr, "cannot connect input ports\n");
+	}
+	
+	free (ports);
+	
+	ports = jack_get_ports (client, NULL, NULL,
+				JackPortIsPhysical|JackPortIsInput);
+	if (ports == NULL) {
+		fprintf(stderr, "no physical playback ports\n");
 		return 1;		/* terminate client */
 	}
+	
+	if (jack_connect (client, jack_port_name (pp->output_port), ports[0])) {
+		fprintf (stderr, "cannot connect output ports\n");
+	}
+	
+	free (ports);
 
 	return 0;			/* success */
 }
diff --git a/example-clients/internal_metro.cpp b/example-clients/internal_metro.cpp
new file mode 100644
index 0000000..59806c7
--- /dev/null
+++ b/example-clients/internal_metro.cpp
@@ -0,0 +1,123 @@
+/*
+ Copyright (C) 2002 Anthony Van Groningen
+ Copyright (C) 2005 Grame
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "internal_metro.h"
+
+typedef jack_default_audio_sample_t sample_t;
+
+const double PI = 3.14;
+
+static int process_audio (jack_nframes_t nframes, void* arg)
+{
+    InternalMetro* metro = (InternalMetro*)arg;
+    sample_t *buffer = (sample_t *) jack_port_get_buffer (metro->output_port, nframes);
+    jack_nframes_t frames_left = nframes;
+
+    while (metro->wave_length - metro->offset < frames_left) {
+        memcpy (buffer + (nframes - frames_left), metro->wave + metro->offset, sizeof (sample_t) * (metro->wave_length - metro->offset));
+        frames_left -= metro->wave_length - metro->offset;
+        metro->offset = 0;
+    }
+    if (frames_left > 0) {
+        memcpy (buffer + (nframes - frames_left), metro->wave + metro->offset, sizeof (sample_t) * frames_left);
+        metro->offset += frames_left;
+    }
+
+    return 0;
+}
+
+InternalMetro::InternalMetro(int freq, double max_amp, int dur_arg, int bpm, char* client_name)
+{
+    sample_t scale;
+    int i, attack_length, decay_length;
+    double *amp;
+    int attack_percent = 1, decay_percent = 10;
+    const char *bpm_string = "bpm";
+
+    offset = 0;
+
+    /* Initial Jack setup, get sample rate */
+    if (!client_name) {
+        client_name = (char *) malloc (9 * sizeof (char));
+        strcpy (client_name, "metro");
+    }
+    if ((client = jack_client_open (client_name, JackNullOption, NULL)) == 0) {
+        fprintf (stderr, "jack server not running?\n");
+        return ;
+    }
+
+    jack_set_process_callback (client, process_audio, this);
+    output_port = jack_port_register (client, bpm_string, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+    input_port = jack_port_register (client, "metro_in", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+
+    sr = jack_get_sample_rate (client);
+
+    /* setup wave table parameters */
+    wave_length = 60 * sr / bpm;
+    tone_length = sr * dur_arg / 1000;
+    attack_length = tone_length * attack_percent / 100;
+    decay_length = tone_length * decay_percent / 100;
+    scale = 2 * PI * freq / sr;
+
+    if (tone_length >= wave_length) {
+        /*
+        fprintf (stderr, "invalid duration (tone length = %" PRIu32
+        	 ", wave length = %" PRIu32 "\n", tone_length,
+        	 wave_length);
+        */ 
+        return ;
+    }
+    if (attack_length + decay_length > (int)tone_length) {
+        fprintf (stderr, "invalid attack/decay\n");
+        return ;
+    }
+
+    /* Build the wave table */
+    wave = (sample_t *) malloc (wave_length * sizeof(sample_t));
+    amp = (double *) malloc (tone_length * sizeof(double));
+
+    for (i = 0; i < attack_length; i++) {
+        amp[i] = max_amp * i / ((double) attack_length);
+    }
+    for (i = attack_length; i < (int) tone_length - decay_length; i++) {
+        amp[i] = max_amp;
+    }
+    for (i = (int)tone_length - decay_length; i < (int)tone_length; i++) {
+        amp[i] = - max_amp * (i - (double) tone_length) / ((double) decay_length);
+    }
+    for (i = 0; i < (int) tone_length; i++) {
+        wave[i] = amp[i] * sin (scale * i);
+    }
+    for (i = tone_length; i < (int) wave_length; i++) {
+        wave[i] = 0;
+    }
+
+    if (jack_activate (client)) {
+        fprintf(stderr, "cannot activate client");
+        return;
+    }
+}
+
+InternalMetro::~InternalMetro()
+{
+    jack_deactivate(client);
+    jack_port_unregister(client, input_port);
+    jack_port_unregister(client, output_port);
+    jack_client_close(client);
+}
diff --git a/example-clients/internal_metro.h b/example-clients/internal_metro.h
new file mode 100644
index 0000000..bbe156a
--- /dev/null
+++ b/example-clients/internal_metro.h
@@ -0,0 +1,67 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software 
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __internal_metro__
+#define __internal_metro__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <math.h>
+#include <getopt.h>
+#include <string.h>
+
+#include "jack.h"
+#include "transport.h"
+
+
+    typedef jack_default_audio_sample_t sample_t;
+
+    /*!
+    \brief A class to test internal clients
+    */
+
+    struct InternalMetro {
+
+        jack_client_t *client;
+        jack_port_t *input_port;
+        jack_port_t *output_port;
+
+        unsigned long sr;
+        int freq;
+        int bpm;
+        jack_nframes_t tone_length, wave_length;
+        sample_t *wave;
+        long offset ;
+
+        InternalMetro(int freq, double max_amp, int dur_arg, int bpm, char* client_name);
+        virtual ~InternalMetro();
+
+    };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/example-clients/intime.c b/example-clients/intime.c
deleted file mode 100644
index 838eb9a..0000000
--- a/example-clients/intime.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  intime.c -- JACK internal timebase master example client.
- *
- *  To run: first start `jackd', then `jack_load intime intime 6/8,180bpm'.
- */
-
-/*  Copyright (C) 2003 Jack O'Quin.
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <jack/jack.h>
-
-/* Time and tempo variables, global to the entire transport timeline.
- * There is no attempt to keep a true tempo map.  The default time
- * signature is "march time": 4/4, 120bpm
- */
-float time_beats_per_bar = 4.0;
-float time_beat_type = 4.0;
-double time_ticks_per_beat = 1920.0;
-double time_beats_per_minute = 120.0;
-
-/* BBT timebase callback.
- *
- * Runs in the process thread.  Realtime, must not wait.
- */
-void 
-timebbt (jack_transport_state_t state, jack_nframes_t nframes, 
-	 jack_position_t *pos, int new_pos, void *arg)
-{
-	double min;			/* minutes since frame 0 */
-	long abs_tick;			/* ticks since frame 0 */
-	long abs_beat;			/* beats since frame 0 */
-
-	if (new_pos) {
-
-		pos->valid = JackPositionBBT;
-		pos->beats_per_bar = time_beats_per_bar;
-		pos->beat_type = time_beat_type;
-		pos->ticks_per_beat = time_ticks_per_beat;
-		pos->beats_per_minute = time_beats_per_minute;
-
-		/* Compute BBT info from frame number.  This is
-		 * relatively simple here, but would become complex if
-		 * we supported tempo or time signature changes at
-		 * specific locations in the transport timeline.  I
-		 * make no claims for the numerical accuracy or
-		 * efficiency of these calculations. */
-
-		min = pos->frame / ((double) pos->frame_rate * 60.0);
-		abs_tick = min * pos->beats_per_minute * pos->ticks_per_beat;
-		abs_beat = abs_tick / pos->ticks_per_beat;
-
-		pos->bar = abs_beat / pos->beats_per_bar;
-		pos->beat = abs_beat - (pos->bar * pos->beats_per_bar) + 1;
-		pos->tick = abs_tick - (abs_beat * pos->ticks_per_beat);
-		pos->bar_start_tick = pos->bar * pos->beats_per_bar *
-			pos->ticks_per_beat;
-		pos->bar++;		/* adjust start to bar 1 */
-
-		/* some debug code... */
-		fprintf(stderr, "\nnew position: %" PRIu32 "\tBBT: %3"
-			PRIi32 "|%" PRIi32 "|%04" PRIi32 "\n",
-			pos->frame, pos->bar, pos->beat, pos->tick);
-
-	} else {
-
-		/* Compute BBT info based on previous period. */
-		pos->tick += (nframes * pos->ticks_per_beat *
-			      pos->beats_per_minute / (pos->frame_rate * 60));
-
-		while (pos->tick >= pos->ticks_per_beat) {
-			pos->tick -= pos->ticks_per_beat;
-			if (++pos->beat > pos->beats_per_bar) {
-				pos->beat = 1;
-				++pos->bar;
-				pos->bar_start_tick += (pos->beats_per_bar *
-							pos->ticks_per_beat);
-			}
-		}
-	}
-}
-
-/* experimental timecode callback
- *
- * Fill in extended timecode fields using the trivial assumption that
- * we are running at nominal speed, hence with no drift.
- *
- * It would probably be faster to compute frame_time without the
- * conditional expression.  But, this demonstrates the invariant:
- * next_time[i] == frame_time[i+1], unless a reposition occurs.
- *
- * Runs in the process thread.  Realtime, must not wait.
- */
-void 
-timecode (jack_transport_state_t state, jack_nframes_t nframes, 
-	  jack_position_t *pos, int new_pos, void *arg)
-{
-	/* nominal transport speed */
-	double seconds_per_frame = 1.0 / (double) pos->frame_rate;
-
-	pos->valid = JackPositionTimecode;
-	pos->frame_time = (new_pos?
-			   pos->frame * seconds_per_frame:
-			   pos->next_time);
-	pos->next_time = (pos->frame + nframes) * seconds_per_frame;
-}
-
-/* after internal client loaded */
-int
-jack_initialize (jack_client_t *client, const char *load_init)
-{
-	JackTimebaseCallback callback = timebbt;
-
-	int rc = sscanf(load_init, " %f/%f, %lf bpm ", &time_beats_per_bar,
-			&time_beat_type, &time_beats_per_minute);
-
-	if (rc > 0) {
-		fprintf (stderr, "counting %.1f/%.1f at %.2f bpm\n",
-			 time_beats_per_bar, time_beat_type,
-			 time_beats_per_minute);
-	} else {
-		int len = strlen(load_init);
-		if ((len > 0) && (strncmp(load_init, "timecode", len) == 0))
-			callback = timecode;
-	}
-
-	if (jack_set_timebase_callback(client, 0, callback, NULL) != 0) {
-		fprintf (stderr, "Unable to take over timebase.\n");
-		return 1;		/* terminate */
-	}
-
-	fprintf (stderr, "Internal timebase master defined.\n");
-	jack_activate (client);
-	return 0;			/* success */
-}
-
-/* before unloading */
-void
-jack_finish (void *arg)
-{
-	fprintf (stderr, "Internal timebase client exiting.\n");
-}
diff --git a/example-clients/ipload.c b/example-clients/ipload.c
new file mode 100644
index 0000000..49810a4
--- /dev/null
+++ b/example-clients/ipload.c
@@ -0,0 +1,205 @@
+/*
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <getopt.h>
+#include <jack/jack.h>
+#include <jack/intclient.h>
+
+jack_client_t *client;
+jack_intclient_t intclient;
+char *client_name;
+char *intclient_name;
+char *load_name;
+char *load_init = "";
+char *server_name = NULL;
+int wait_opt = 0;
+
+static void
+signal_handler (int sig)
+{
+	jack_status_t status;
+
+	fprintf (stderr, "signal received, unloading...");
+	status = jack_internal_client_unload (client, intclient);
+	if (status & JackFailure)
+		fprintf (stderr, "(failed), status = 0x%2.0x\n", status);
+	else
+		fprintf (stderr, "(succeeded)\n");
+	jack_client_close (client);
+	exit (0);
+}
+
+static void
+show_usage ()
+{
+	fprintf (stderr, "usage: %s [ options ] client-name [ load-name "
+		 "[ init-string]]\n\noptions:\n", client_name);
+	fprintf (stderr,
+		 "\t-h, --help \t\t print help message\n"
+		 "\t-i, --init string\t initialize string\n"
+		 "\t-s, --server name\t select JACK server\n"
+		 "\t-w, --wait \t\t wait for signal, then unload\n"
+		 "\n"
+		);
+}
+
+static int
+parse_args (int argc, char *argv[])
+{
+	int c;
+	int option_index = 0;
+	char *short_options = "hi:s:w";
+	struct option long_options[] = {
+		{ "help", 0, 0, 'h' },
+		{ "init", required_argument, 0, 'i' },
+		{ "server", required_argument, 0, 's' },
+		{ "wait", 0, 0, 'w' },
+		{ 0, 0, 0, 0 }
+	};
+
+	client_name = strrchr(argv[0], '/');
+	if (client_name == NULL) {
+		client_name = argv[0];
+	} else {
+		client_name++;
+	}
+
+	while ((c = getopt_long (argc, argv, short_options, long_options,
+				 &option_index)) >= 0) {
+		switch (c) {
+		case 'i':
+			load_init = optarg;
+			break;
+		case 's':
+			server_name = optarg;
+			break;
+		case 'w':
+			wait_opt = 1;
+			break;
+		case 'h':
+		default:
+			show_usage ();
+			return 1;
+		}
+	}
+
+	if (optind == argc) {		/* no positional args? */
+		show_usage ();
+		return 1;
+	}
+	if (optind < argc)
+		load_name = intclient_name = argv[optind++];
+
+	if (optind < argc)
+		load_name = argv[optind++];
+
+	if (optind < argc)
+		load_init = argv[optind++];
+
+	//fprintf (stderr, "client-name = `%s', load-name = `%s', "
+	//	 "load-init = `%s', wait = %d\n",
+	//	 intclient_name, load_name, load_init, wait_opt);
+
+	return 0;			/* args OK */
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_status_t status;
+	char* name;
+
+	/* parse and validate command arguments */
+	if (parse_args (argc, argv))
+		exit (1);		/* invalid command line */
+
+	/* first, become a JACK client */
+	client = jack_client_open (client_name, JackServerName,
+				   &status, server_name);
+	if (client == NULL) {
+		fprintf (stderr, "jack_client_open() failed, "
+			 "status = 0x%2.0x\n", status);
+		if (status & JackServerFailed) {
+			fprintf (stderr, "Unable to connect to JACK server\n");
+		}
+		exit (1);
+	}
+	if (status & JackServerStarted) {
+		fprintf (stderr, "JACK server started\n");
+	}
+	if (status & JackNameNotUnique) {
+		client_name = jack_get_client_name(client);
+		fprintf (stderr, "unique name `%s' assigned\n", client_name);
+	}
+
+	/* then, load the internal client */
+	intclient = jack_internal_client_load (client, intclient_name,
+					       (JackLoadName|JackLoadInit),
+					       &status, load_name, load_init);
+	if (status & JackFailure) {
+		fprintf (stderr, "could not load %s, status = 0x%2.0x\n",
+			 load_name, status);
+		return 2;
+	}
+	if (status & JackNameNotUnique) {
+		intclient_name =
+			jack_get_internal_client_name (client, intclient);
+		fprintf (stderr, "unique internal client name `%s' assigned\n",
+			 intclient_name);
+	}
+
+	fprintf (stdout, "%s is running.\n", load_name);
+
+	name = jack_get_internal_client_name(client, intclient);
+	if (name) {
+		printf("client name = %s\n", name);
+		free(name);
+	}
+
+	if (wait_opt) {
+		/* define a signal handler to unload the client, then
+		 * wait for it to exit */
+	#ifdef WIN32
+		signal(SIGINT, signal_handler);
+		signal(SIGABRT, signal_handler);
+		signal(SIGTERM, signal_handler);
+	#else
+		signal(SIGQUIT, signal_handler);
+		signal(SIGTERM, signal_handler);
+		signal(SIGHUP, signal_handler);
+		signal(SIGINT, signal_handler);
+	#endif
+
+		while (1) {
+			#ifdef WIN32
+				Sleep(1000);
+			#else
+				sleep (1);
+			#endif
+		}
+	}
+
+    jack_client_close(client);
+	return 0;
+}
+
diff --git a/example-clients/ipunload.c b/example-clients/ipunload.c
new file mode 100644
index 0000000..baedfc1
--- /dev/null
+++ b/example-clients/ipunload.c
@@ -0,0 +1,93 @@
+/*
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <jack/jack.h>
+#include <jack/intclient.h>
+
+int
+main (int argc, char *argv[])
+{
+	char *my_name;
+	char *client_name;
+	jack_client_t *client;
+	jack_status_t status;
+	jack_intclient_t intclient;
+
+	/* validate args */
+	if ((argc < 2) || (argc > 3)) {
+		fprintf (stderr, "usage: %s client-name [ server-name ]]\n",
+			 argv[0]);
+		return 1;
+	}
+
+	/* use `basename $0` for my own client name */
+	my_name = strrchr(argv[0], '/');
+	if (my_name == 0) {
+		my_name = argv[0];
+	} else {
+		my_name++;
+	}
+
+	/* first, become a JACK client */
+	if (argc > 2) {
+		client = jack_client_open (my_name,
+					   (JackServerName|JackNoStartServer),
+					   &status, argv[2]);
+	} else {
+		client = jack_client_open (my_name, JackNoStartServer, &status);
+	}
+
+	if (client == NULL) {
+		if (status & JackServerFailed) {
+			fprintf (stderr, "JACK server not running.\n");
+		} else {
+			fprintf (stderr, "JACK open failed, "
+				 "status = 0x%2.0x\n", status);
+		}
+		exit (1);
+	}
+
+	/* then, get the internal client handle */
+	client_name = argv[1];
+	intclient = jack_internal_client_handle (client, client_name, &status);
+	if (status & JackFailure) {
+		fprintf (stderr, "client %s not found.\n", client_name);
+		exit (2);
+	}
+
+	/* now, unload the internal client */
+	status = jack_internal_client_unload (client, intclient);
+	if (status & JackFailure) {
+		if (status & JackNoSuchClient) {
+			fprintf (stderr, "client %s is gone.\n",
+				 client_name);
+		} else {
+			fprintf (stderr, "could not unload %s, "
+				 "returns 0x%2.0x\n", client_name, status);
+		}
+		exit (3);
+	} else {
+		fprintf (stdout, "%s unloaded.\n", client_name);
+	}
+    
+    jack_client_close(client);
+	return 0;
+}
+	
+		
diff --git a/example-clients/jack_control b/example-clients/jack_control
new file mode 100755
index 0000000..1d06436
--- /dev/null
+++ b/example-clients/jack_control
@@ -0,0 +1,314 @@
+#!/usr/bin/env python
+
+name_base = 'org.jackaudio'
+control_interface_name = name_base + '.JackControl'
+configure_interface_name = name_base + '.Configure'
+service_name = name_base + '.service'
+
+import sys
+import os
+from traceback import print_exc
+
+import dbus
+
+def bool_convert(str_value):
+    if str_value.lower() == "false":
+        return False
+
+    if str_value.lower() == "off":
+        return False
+
+    if str_value.lower() == "no":
+        return False
+
+    if str_value == "0":
+        return False
+
+    if str_value.lower() == "(null)":
+        return False
+
+    return bool(str_value)
+
+def dbus_type_to_python_type(dbus_value):
+    if type(dbus_value) == dbus.Boolean:
+        return bool(dbus_value)
+    if type(dbus_value) == dbus.Int32 or type(dbus_value) == dbus.UInt32:
+        return int(dbus_value)
+    return dbus_value
+
+def python_type_to_jackdbus_type(value, type_char):
+    type_char = str(type_char)
+
+    if type_char == "b":
+        return bool_convert(value);
+    elif type_char == "y":
+        return dbus.Byte(value);
+    elif type_char == "i":
+        return dbus.Int32(value)
+    elif type_char == "u":
+        return dbus.UInt32(value)
+
+    return value
+
+def dbus_type_to_type_string(dbus_value):
+    if type(dbus_value) == dbus.Boolean:
+        return "bool"
+    if type(dbus_value) == dbus.Int32:
+        return "sint"
+    if type(dbus_value) == dbus.UInt32:
+        return "uint"
+    if type(dbus_value) == dbus.Byte:
+        return "char"
+    if type(dbus_value) == dbus.String:
+        return "str"
+
+    return None                         # throw exception here?
+
+def dbus_typesig_to_type_string(type_char):
+    type_char = str(type_char)
+    if type_char == 'i':
+        return "sint"
+    if type_char == 'u':
+        return "uint"
+    if type_char == 'y':
+        return "char"
+    if type_char == 's':
+        return "str"
+    if type_char == 'b':
+        return "bool"
+
+    print 'shit'
+    return None                         # throw exception here?
+
+def get_parameters(iface, path):
+    params = iface.GetParametersInfo(path)
+                
+    #print params
+    for param in params:
+        typestr = dbus_typesig_to_type_string(param[0])
+        name = param[1]
+        #print name
+        descr = param[2]
+        #print descr
+        isset, default, value = iface.GetParameterValue(path + [name])
+        #print typestr
+        if bool(isset):
+            isset = "set"
+        else:
+            isset = "notset"
+        value = dbus_type_to_python_type(value)
+        default = dbus_type_to_python_type(default)
+
+        print "%20s: %s (%s:%s:%s:%s)" %(name, descr, typestr, isset, default, value)
+
+def main():
+    if len(sys.argv) == 1:
+        print "Usage: %s [command] [command] ..." % os.path.basename(sys.argv[0])
+        print "Commands:"
+        print "    exit                       - exit jack dbus service (stops jack server if currently running)"
+        print "    status                     - check whether jack server is started, return value is 0 if running and 1 otherwise"
+        print "    start                      - start jack server if not currently started"
+        print "    stop                       - stop jack server if currently started"
+	print "    sm                         - switch master to currently selected driver"
+        print "    dl                         - get list of available drivers"
+        print "    dg                         - get currently selected driver"
+        print "    ds <driver>                - select driver"
+        print "    dp                         - get parameters of currently selected driver"
+        print "    dpd <param>                - get long description for driver parameter"
+        print "    dps <param> <value>        - set driver parameter"
+        print "    il                         - get list of available internals"
+        print "    ip <name>                  - get parameters of given internal"
+        print "    ipd <name> <param>         - get long description for internal parameter"
+        print "    ips <name> <param> <value> - set internal parameter"
+        print "    iload <name>               - load internal"
+        print "    iunload <name>             - unload internal"
+        print "    ep                         - get engine parameters"
+        print "    epd <param>                - get long description for engine parameter"
+        print "    eps <param> <value>        - set engine parameter"
+        sys.exit(0)
+    
+    bus = dbus.SessionBus()
+
+    controller = bus.get_object(service_name, "/org/jackaudio/Controller")
+    control_iface = dbus.Interface(controller, control_interface_name)
+    configure_iface = dbus.Interface(controller, configure_interface_name)
+
+    # check arguments
+    index = 1
+    while index < len(sys.argv):
+        arg = sys.argv[index]
+        index += 1
+        try:
+            if arg == "exit":
+                print "--- exit"
+                control_iface.Exit()
+            elif arg == "status":
+                print "--- status"
+                if control_iface.IsStarted():
+                    print "started"
+                    sys.exit(0)
+                else:
+                    print "stopped"
+                    sys.exit(1)
+            elif arg == 'start':
+                print "--- start"
+                control_iface.StartServer()
+            elif arg == 'stop':
+                print "--- stop"
+                control_iface.StopServer()
+	    elif arg == 'sm':
+                print "--- switch master driver"
+                control_iface.SwitchMaster()
+            elif arg == 'ism':
+                if control_iface.IsManuallyActivated():
+                    print "Manually activated"
+                else:
+                    print "Automatically activated"
+            elif arg == 'dl':
+                print "--- drivers list"
+                is_range, is_strict, is_fake_values, values = configure_iface.GetParameterConstraint(['engine', 'driver'])
+                for value in values:
+                    print value[1]
+            elif arg == 'dg':
+                print "--- get selected driver"
+                isset, default, value = configure_iface.GetParameterValue(['engine', 'driver'])
+                print value
+            elif arg == 'ds':
+                if index >= len(sys.argv):
+                    print "driver select command requires driver name argument"
+                    sys.exit()
+
+                arg = sys.argv[index]
+                index += 1
+
+                print "--- driver select \"%s\"" % arg
+                configure_iface.SetParameterValue(['engine', 'driver'], dbus.String(arg))
+            elif arg == 'dp':
+                print "--- get driver parameters (type:isset:default:value)"
+                get_parameters(configure_iface, ['driver'])
+            elif arg == 'dpd':
+                if index >= len(sys.argv):
+                    print "get driver parameter long description command requires parameter name argument"
+                    sys.exit()
+
+                param = sys.argv[index]
+                index += 1
+
+                print "--- get driver parameter description (%s)" % param
+                type_char, name, short_descr, long_descr = configure_iface.GetParameterInfo(['driver', param])
+                print long_descr,
+            elif arg == 'dps':
+                if index + 1 >= len(sys.argv):
+                    print "driver parameter set command requires parameter name and value arguments"
+                    sys.exit()
+
+                param = sys.argv[index]
+                index += 1
+                value = sys.argv[index]
+                index += 1
+
+                print "--- driver param set \"%s\" -> \"%s\"" % (param, value)
+
+                type_char, name, short_descr, long_descr = configure_iface.GetParameterInfo(['driver', param])
+                configure_iface.SetParameterValue(['driver', param], python_type_to_jackdbus_type(value, type_char))
+            elif arg == 'ep':
+                print "--- get engine parameters (type:isset:default:value)"
+                get_parameters(configure_iface, ['engine'])
+            elif arg == 'epd':
+                if index >= len(sys.argv):
+                    print "get engine parameter long description command requires parameter name argument"
+                    sys.exit()
+
+                param_name = sys.argv[index]
+                index += 1
+
+                print "--- get engine parameter description (%s)" % param_name
+
+                type_char, name, short_descr, long_descr = configure_iface.GetParameterInfo(['engine', param_name])
+                print long_descr,
+            elif arg == 'eps':
+                if index + 1 >= len(sys.argv):
+                    print "engine parameter set command requires parameter name and value arguments"
+                    sys.exit()
+
+                param = sys.argv[index]
+                index += 1
+                value = sys.argv[index]
+                index += 1
+
+                print "--- engine param set \"%s\" -> \"%s\"" % (param, value)
+
+                type_char, name, short_descr, long_descr = configure_iface.GetParameterInfo(['engine', param])
+                configure_iface.SetParameterValue(['engine', param], python_type_to_jackdbus_type(value, type_char))
+            elif arg == 'il':
+                print "--- internals list"
+                is_leaf, internals = configure_iface.ReadContainer(['internals'])
+                for internal in internals:
+                    print internal
+            elif arg == 'ip':
+                print "--- get internal parameters (type:isset:default:value)"
+
+                if index >= len(sys.argv):
+                    print "internal parameters command requires internal name argument"
+                    sys.exit()
+
+                internal_name = sys.argv[index]
+                index += 1
+
+                get_parameters(configure_iface, ['internals', internal_name])
+            elif arg == 'ipd':
+                if index + 1 >= len(sys.argv):
+                    print "get internal parameter long description command requires internal and parameter name arguments"
+                    sys.exit()
+
+                name = sys.argv[index]
+                index += 1
+                param = sys.argv[index]
+                index += 1
+
+                print "--- get internal parameter description (%s)" % param
+                type_char, name, short_descr, long_descr = configure_iface.GetParameterInfo(['internals', name, param])
+                print long_descr
+            elif arg == 'ips':
+                if index + 2 >= len(sys.argv):
+                    print "get internal parameter long description command requires internal, parameter name and value arguments"
+                    sys.exit()
+
+                internal_name = sys.argv[index]
+                index += 1
+                param = sys.argv[index]
+                index += 1
+                value = sys.argv[index]
+                index += 1
+                
+                print "--- internal param set \"%s\" -> \"%s\"" % (param, value)
+
+                type_char, name, short_descr, long_descr = configure_iface.GetParameterInfo(['internals', internal_name, param])
+                configure_iface.SetParameterValue(['internals', internal_name, param], python_type_to_jackdbus_type(value, type_char))
+            elif arg == 'iload':
+                print "--- load internal"
+
+                if index >= len(sys.argv):
+                    print "load internal command requires internal name argument"
+                    sys.exit()
+
+                name = sys.argv[index]
+                index += 1
+                result = control_iface.LoadInternal(name)
+            elif arg == 'iunload':
+                print "--- unload internal"
+
+                if index >= len(sys.argv):
+                    print "unload internal command requires internal name argument"
+                    sys.exit()
+
+                name = sys.argv[index]
+                index += 1
+                result = control_iface.UnloadInternal(name)
+            else:
+                print "Unknown command '%s'" % arg
+        except dbus.DBusException, e:
+            print "DBus exception: %s" % str(e)
+
+if __name__ == '__main__':
+    main()
diff --git a/example-clients/lsp.c b/example-clients/lsp.c
new file mode 100644
index 0000000..5a3362f
--- /dev/null
+++ b/example-clients/lsp.c
@@ -0,0 +1,232 @@
+/*
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <getopt.h>
+#include <jack/jack.h>
+
+char * my_name;
+
+static void
+show_version (void)
+{
+	//fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n", my_name);
+}
+
+static void
+show_usage (void)
+{
+	show_version ();
+	fprintf (stderr, "\nUsage: %s [options] [filter string]\n", my_name);
+	fprintf (stderr, "List active Jack ports, and optionally display extra information.\n");
+	fprintf (stderr, "Optionally filter ports which match ALL strings provided after any options.\n\n");
+	fprintf (stderr, "Display options:\n");
+	fprintf (stderr, "        -A, --aliases         List aliases for each port\n");
+	fprintf (stderr, "        -c, --connections     List connections to/from each port\n");
+	fprintf (stderr, "        -l, --latency         Display per-port latency in frames at each port\n");
+	fprintf (stderr, "        -L, --latency         Display total latency in frames at each port\n");
+	fprintf (stderr, "        -p, --properties      Display port properties. Output may include:\n"
+			 "                              input|output, can-monitor, physical, terminal\n\n");
+	fprintf (stderr, "        -t, --type            Display port type\n");
+	fprintf (stderr, "        -h, --help            Display this help message\n");
+	fprintf (stderr, "        --version             Output version information and exit\n\n");
+	fprintf (stderr, "For more information see http://jackaudio.org/\n");
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_client_t *client;
+	jack_status_t status;
+	const char **ports, **connections;
+	unsigned int i, j, k;
+	int skip_port;
+	int show_aliases = 0;
+	int show_con = 0;
+	int show_port_latency = 0;
+	int show_total_latency = 0;
+	int show_properties = 0;
+	int show_type = 0;
+	int c;
+	int option_index;
+	char* aliases[2];
+	jack_port_t *port;
+	
+	struct option long_options[] = {
+		{ "aliases", 0, 0, 'A' },
+		{ "connections", 0, 0, 'c' },
+		{ "port-latency", 0, 0, 'l' },
+		{ "total-latency", 0, 0, 'L' },
+		{ "properties", 0, 0, 'p' },
+		{ "type", 0, 0, 't' },
+		{ "help", 0, 0, 'h' },
+		{ "version", 0, 0, 'v' },
+		{ 0, 0, 0, 0 }
+	};
+
+	my_name = strrchr(argv[0], '/');
+	if (my_name == 0) {
+		my_name = argv[0];
+	} else {
+		my_name ++;
+	}
+
+	while ((c = getopt_long (argc, argv, "AclLphvt", long_options, &option_index)) >= 0) {
+		switch (c) {
+		case 'A':
+			aliases[0] = (char *) malloc (jack_port_name_size());
+			aliases[1] = (char *) malloc (jack_port_name_size());
+			show_aliases = 1;
+			break;
+		case 'c':
+			show_con = 1;
+			break;
+		case 'l':
+			show_port_latency = 1;
+			break;
+		case 'L':
+			show_total_latency = 1;
+			break;
+		case 'p':
+			show_properties = 1;
+			break;
+		case 't':
+			show_type = 1;
+			break;
+		case 'h':
+			show_usage ();
+			return 1;
+			break;
+		case 'v':
+			show_version ();
+			return 1;
+			break;
+		default:
+			show_usage ();
+			return 1;
+			break;
+		}
+	}
+
+	/* Open a client connection to the JACK server.  Starting a
+	 * new server only to list its ports seems pointless, so we
+	 * specify JackNoStartServer. */
+	//JOQ: need a new server name option
+
+	client = jack_client_open ("lsp", JackNoStartServer, &status);
+	if (client == NULL) {
+		if (status & JackServerFailed) {
+			fprintf (stderr, "JACK server not running\n");
+		} else {
+			fprintf (stderr, "jack_client_open() failed, "
+				 "status = 0x%2.0x\n", status);
+		}
+		return 1;
+	}
+
+	ports = jack_get_ports (client, NULL, NULL, 0);
+    if (!ports) 
+        goto error;
+
+	for (i = 0; ports[i]; ++i) {
+		// skip over any that don't match ALL of the strings presented at command line
+		skip_port = 0;
+		for(k = optind; k < argc; k++){
+			if(strstr(ports[i], argv[k]) == NULL ){
+				skip_port = 1;
+			}
+		}
+		if (skip_port) continue;
+
+		printf ("%s\n", ports[i]);
+		port = jack_port_by_name (client, ports[i]);
+
+		if (show_aliases) {
+			int cnt;
+			int i;
+
+			cnt = jack_port_get_aliases (port, aliases);
+			for (i = 0; i < cnt; ++i) {
+				printf ("   %s\n", aliases[i]);
+			}
+		}
+				
+		if (show_con) {
+			if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) {
+				for (j = 0; connections[j]; j++) {
+					printf ("   %s\n", connections[j]);
+				}
+				free (connections);
+			} 
+		}
+		if (show_port_latency) {
+			if (port) {
+				printf ("	port latency = %d frames\n",
+					jack_port_get_latency (port));
+			}
+		}
+		if (show_total_latency) {
+			if (port) {
+				printf ("	total latency = %d frames\n",
+					jack_port_get_total_latency (client, port));
+			}
+		}
+		if (show_properties) {
+			if (port) {
+				int flags = jack_port_flags (port);
+				printf ("	properties: ");
+				if (flags & JackPortIsInput) {
+					fputs ("input,", stdout);
+				}
+				if (flags & JackPortIsOutput) {
+					fputs ("output,", stdout);
+				}
+				if (flags & JackPortCanMonitor) {
+					fputs ("can-monitor,", stdout);
+				}
+				if (flags & JackPortIsPhysical) {
+					fputs ("physical,", stdout);
+				}
+				if (flags & JackPortIsTerminal) {
+					fputs ("terminal,", stdout);
+				}
+                
+                if (flags & JackPortIsActive) {
+                    fputs ("active,", stdout);
+                } else {
+                    fputs ("non-active,", stdout);
+                }
+				putc ('\n', stdout);
+			}
+		}
+		if (show_type) {
+			if (port) {
+				putc ('\t', stdout);
+				fputs (jack_port_type (port), stdout);
+				putc ('\n', stdout);
+			}
+		}
+	}
+    
+error:
+	jack_client_close (client);
+	exit (0);
+}
diff --git a/example-clients/metro.c b/example-clients/metro.c
index 56578b6..9afc58b 100644
--- a/example-clients/metro.c
+++ b/example-clients/metro.c
@@ -19,8 +19,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <math.h>
+#include <signal.h>
 #include <getopt.h>
 #include <string.h>
 
@@ -42,9 +45,15 @@ long offset = 0;
 int transport_aware = 0;
 jack_transport_state_t transport_state;
 
-void
-usage ()
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
 
+static void
+usage ()
 {
 	fprintf (stderr, "\n"
 "usage: jack_metro \n"
@@ -59,17 +68,16 @@ usage ()
 );
 }
 
-void
+static void
 process_silence (jack_nframes_t nframes) 
 {
 	sample_t *buffer = (sample_t *) jack_port_get_buffer (output_port, nframes);
 	memset (buffer, 0, sizeof (jack_default_audio_sample_t) * nframes);
 }
 
-void
+static void
 process_audio (jack_nframes_t nframes) 
 {
-
 	sample_t *buffer = (sample_t *) jack_port_get_buffer (output_port, nframes);
 	jack_nframes_t frames_left = nframes;
 		
@@ -84,7 +92,7 @@ process_audio (jack_nframes_t nframes)
 	}
 }
 
-int
+static int
 process (jack_nframes_t nframes, void *arg)
 {
 	if (transport_aware) {
@@ -103,15 +111,8 @@ process (jack_nframes_t nframes, void *arg)
 }
 
 int
-sample_rate_change () {
-	printf("Sample rate has changed! Exiting...\n");
-	exit(-1);
-}
-
-int
 main (int argc, char *argv[])
 {
-	
 	sample_t scale;
 	int i, attack_length, decay_length;
 	double *amp;
@@ -226,9 +227,7 @@ main (int argc, char *argv[])
 	scale = 2 * PI * freq / sr;
 
 	if (tone_length >= wave_length) {
-		fprintf (stderr, "invalid duration (tone length = %" PRIu32
-			 ", wave length = %" PRIu32 "\n", tone_length,
-			 wave_length);
+		fprintf (stderr, "invalid duration (tone length = %u, wave length = %u\n", tone_length, wave_length);
 		return -1;
 	}
 	if (attack_length + decay_length > (int)tone_length) {
@@ -257,12 +256,31 @@ main (int argc, char *argv[])
 	}
 
 	if (jack_activate (client)) {
-		fprintf (stderr, "cannot activate client");
+		fprintf (stderr, "cannot activate client\n");
 		return 1;
 	}
+    
+    /* install a signal handler to properly quits jack client */
+#ifdef WIN32
+	signal(SIGINT, signal_handler);
+    signal(SIGABRT, signal_handler);
+	signal(SIGTERM, signal_handler);
+#else
+	signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+#endif
 
+    /* run until interrupted */
 	while (1) {
+	#ifdef WIN32
+		Sleep(1000);
+	#else
 		sleep(1);
+	#endif
 	};
 	
+    jack_client_close(client);
+    exit (0);
 }
diff --git a/example-clients/midiseq.c b/example-clients/midiseq.c
index 072b00e..10a37b2 100644
--- a/example-clients/midiseq.c
+++ b/example-clients/midiseq.c
@@ -19,6 +19,7 @@
 #include <jack/jack.h>
 #include <jack/midiport.h>
 #include <stdio.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
 
@@ -32,7 +33,14 @@ jack_nframes_t num_notes;
 jack_nframes_t loop_nsamp;
 jack_nframes_t loop_index;
 
-void usage()
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+static void usage()
 {
 	fprintf(stderr, "usage: jack_midiseq name nsamp [startindex note nsamp] ...... [startindex note nsamp]\n");
 	fprintf(stderr, "eg: jack_midiseq Sequencer 24000 0 60 8000 12000 63 8000\n");
@@ -40,7 +48,7 @@ void usage()
 	fprintf(stderr, "that lasts for 12000 samples, then a d4# that starts at 1/4 sec that lasts for 800 samples\n");
 }
 
-int process(jack_nframes_t nframes, void *arg)
+static int process(jack_nframes_t nframes, void *arg)
 {
 	int i,j;
 	void* port_buf = jack_port_get_buffer(output_port, nframes);
@@ -83,7 +91,7 @@ int main(int narg, char **args)
 		usage();
 		exit(1);
 	}
-	if((client = jack_client_new (args[1])) == 0)
+	if((client = jack_client_open (args[1], JackNullOption, NULL)) == 0)
 	{
 		fprintf (stderr, "jack server not running?\n");
 		return 1;
@@ -109,10 +117,18 @@ int main(int narg, char **args)
 		fprintf (stderr, "cannot activate client");
 		return 1;
 	}
+    
+    /* install a signal handler to properly quits jack client */
+    signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
 
-	while (1)
-	{
+    /* run until interrupted */
+	while (1) {
 		sleep(1);
 	};
-	
+    
+    jack_client_close(client);
+	exit (0);
 }
diff --git a/example-clients/midisine.c b/example-clients/midisine.c
index 871d4e8..89ff7f7 100644
--- a/example-clients/midisine.c
+++ b/example-clients/midisine.c
@@ -21,6 +21,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#include <signal.h>
 #include <math.h>
 
 #include <jack/jack.h>
@@ -33,7 +34,16 @@ jack_default_audio_sample_t note_on;
 unsigned char note = 0;
 jack_default_audio_sample_t note_frqs[128];
 
-void calc_note_frqs(jack_default_audio_sample_t srate)
+jack_client_t *client;
+
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+static void calc_note_frqs(jack_default_audio_sample_t srate)
 {
 	int i;
 	for(i=0; i<128; i++)
@@ -42,7 +52,7 @@ void calc_note_frqs(jack_default_audio_sample_t srate)
 	}
 }
 
-int process(jack_nframes_t nframes, void *arg)
+static int process(jack_nframes_t nframes, void *arg)
 {
 	int i;
 	void* port_buf = jack_port_get_buffer(input_port, nframes);
@@ -61,17 +71,21 @@ int process(jack_nframes_t nframes, void *arg)
 /*		printf("1st byte of 1st event addr is %p\n", in_events[0].buffer);*/
 	}
 	jack_midi_event_get(&in_event, port_buf, 0);
-	for(i=0; i<nframes; i++)
+	for(i = 0; i < nframes; i++)
 	{
-		if((in_event.time == i) && (event_index < event_count))
+		if ((in_event.time == i) && (event_index < event_count))
 		{
-			if( ((*(in_event.buffer) & 0xf0)) == 0x90 )
-			{
-				/* note on */
-				note = *(in_event.buffer + 1);
-				note_on = 1.0;
+			if (((*(in_event.buffer) & 0xf0)) == 0x90)
+			{   
+                /* note on */
+                note = *(in_event.buffer + 1);
+                if (*(in_event.buffer + 2) == 0) {
+                    note_on = 0.0;
+                } else {
+                    note_on = (float)(*(in_event.buffer + 2)) / 127.f;
+                }
 			}
-			else if( ((*(in_event.buffer)) & 0xf0) == 0x80 )
+			else if (((*(in_event.buffer)) & 0xf0) == 0x80)
 			{
 				/* note off */
 				note = *(in_event.buffer + 1);
@@ -88,23 +102,21 @@ int process(jack_nframes_t nframes, void *arg)
 	return 0;      
 }
 
-int srate(jack_nframes_t nframes, void *arg)
+static int srate(jack_nframes_t nframes, void *arg)
 {
 	printf("the sample rate is now %" PRIu32 "/sec\n", nframes);
 	calc_note_frqs((jack_default_audio_sample_t)nframes);
 	return 0;
 }
 
-void jack_shutdown(void *arg)
+static void jack_shutdown(void *arg)
 {
 	exit(1);
 }
 
 int main(int narg, char **args)
 {
-	jack_client_t *client;
-
-	if ((client = jack_client_new("midisine")) == 0)
+	if ((client = jack_client_open("midisine", JackNullOption, NULL)) == 0)
 	{
 		fprintf(stderr, "jack server not running?\n");
 		return 1;
@@ -126,10 +138,15 @@ int main(int narg, char **args)
 		fprintf(stderr, "cannot activate client");
 		return 1;
 	}
+    
+    /* install a signal handler to properly quits jack client */
+    signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
 
 	/* run until interrupted */
-	while(1)
-	{
+	while(1) {
 		sleep(1);
 	}
 	jack_client_close(client);
diff --git a/example-clients/monitor_client.c b/example-clients/monitor_client.c
new file mode 100644
index 0000000..0a89b17
--- /dev/null
+++ b/example-clients/monitor_client.c
@@ -0,0 +1,61 @@
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <jack/jack.h>
+
+#define TRUE 1
+#define FALSE 0
+
+int
+main (int argc, char *argv[])
+{
+	jack_client_t *client;
+	char *my_name = strrchr(argv[0], '/');
+
+	if (my_name == 0) {
+		my_name = argv[0];
+	} else {
+		my_name ++;
+	}
+
+	if (argc != 2) {
+		fprintf (stderr, "Usage: %s client\n", my_name);
+		return 1;
+	}
+
+	if ((client = jack_client_open ("input monitoring", JackNullOption, NULL)) == 0) {
+		fprintf (stderr, "jack server not running?\n");
+		return 1;
+	}
+
+	if (jack_port_request_monitor_by_name (client, argv[1], TRUE)) {
+		fprintf (stderr, "could not enable monitoring for %s\n", argv[1]);
+		jack_client_close (client);
+		return 1;
+	}
+	sleep (30);
+	if (jack_port_request_monitor_by_name (client, argv[1], FALSE)) {
+		fprintf (stderr, "could not disable monitoring for %s\n", argv[1]);
+	}
+	jack_client_close (client);
+	exit (0);
+}
+
diff --git a/example-clients/netsource.c b/example-clients/netsource.c
new file mode 100644
index 0000000..d6d252c
--- /dev/null
+++ b/example-clients/netsource.c
@@ -0,0 +1,785 @@
+/*
+NetJack Client
+
+Copyright (C) 2008 Marc-Olivier Barre <marco at marcochapeau.org>
+Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
+Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file netsource.c
+ *
+ * @brief This client connects a remote slave JACK to a local JACK server assumed to be the master
+ */
+
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#ifdef __linux__
+#include "config.h"
+#endif
+
+#ifdef WIN32
+#include <winsock2.h>
+#define socklen_t int
+#include <malloc.h>
+#else
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#endif
+
+/* These two required by FreeBSD. */
+#include <sys/types.h>
+
+
+#include <jack/jack.h>
+
+//#include <net_driver.h>
+#include <netjack_packet.h>
+#if HAVE_SAMPLERATE
+#include <samplerate.h>
+#endif
+
+#if HAVE_CELT
+#include <celt/celt.h>
+#endif
+
+#include <math.h>
+
+JSList *capture_ports = NULL;
+JSList *capture_srcs = NULL;
+int capture_channels = 0;
+int capture_channels_audio = 2;
+int capture_channels_midi = 1;
+JSList *playback_ports = NULL;
+JSList *playback_srcs = NULL;
+int playback_channels = 0;
+int playback_channels_audio = 2;
+int playback_channels_midi = 1;
+int dont_htonl_floats = 0;
+
+int latency = 5;
+jack_nframes_t factor = 1;
+int bitdepth = 0;
+int mtu = 1400;
+int reply_port = 0;
+int bind_port = 0;
+int redundancy = 1;
+jack_client_t *client;
+
+int state_connected = 0;
+int state_latency = 0;
+int state_netxruns = 0;
+int state_currentframe = 0;
+int state_recv_packet_queue_time = 0;
+
+int quit=0;
+
+
+int outsockfd;
+int insockfd;
+#ifdef WIN32
+struct sockaddr_in destaddr;
+struct sockaddr_in bindaddr;
+#else
+struct sockaddr destaddr;
+struct sockaddr bindaddr;
+#endif
+
+int sync_state;
+jack_transport_state_t last_transport_state;
+
+int framecnt = 0;
+
+int cont_miss = 0;
+
+int freewheeling = 0;
+
+/**
+ * This Function allocates all the I/O Ports which are added the lists.
+ */
+void
+alloc_ports (int n_capture_audio, int n_playback_audio, int n_capture_midi, int n_playback_midi)
+{
+
+    int port_flags = JackPortIsOutput;
+    int chn;
+    jack_port_t *port;
+    char buf[32];
+
+    capture_ports = NULL;
+    /* Allocate audio capture channels */
+    for (chn = 0; chn < n_capture_audio; chn++)
+    {
+        snprintf (buf, sizeof (buf) - 1, "capture_%u", chn + 1);
+        port = jack_port_register (client, buf, JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
+        if (!port)
+        {
+            printf( "jack_netsource: cannot register %s port\n", buf);
+            break;
+        }
+	if( bitdepth == 1000 ) {
+#if HAVE_CELT
+#if HAVE_CELT_API_0_7
+	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate( client ), jack_get_buffer_size(client), NULL );
+	    capture_srcs = jack_slist_append(capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
+#else
+	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate( client ), 1, jack_get_buffer_size(client), NULL );
+	    capture_srcs = jack_slist_append(capture_srcs, celt_decoder_create( celt_mode ) );
+#endif
+#endif
+	} else {
+#if HAVE_SAMPLERATE
+	    capture_srcs = jack_slist_append (capture_srcs, src_new (SRC_LINEAR, 1, NULL));
+#endif
+	}
+        capture_ports = jack_slist_append (capture_ports, port);
+    }
+
+    /* Allocate midi capture channels */
+    for (chn = n_capture_audio; chn < n_capture_midi + n_capture_audio; chn++)
+    {
+        snprintf (buf, sizeof (buf) - 1, "capture_%u", chn + 1);
+        port = jack_port_register (client, buf, JACK_DEFAULT_MIDI_TYPE, port_flags, 0);
+        if (!port)
+        {
+            printf ("jack_netsource: cannot register %s port\n", buf);
+            break;
+        }
+        capture_ports = jack_slist_append(capture_ports, port);
+    }
+
+    /* Allocate audio playback channels */
+    port_flags = JackPortIsInput;
+    playback_ports = NULL;
+    for (chn = 0; chn < n_playback_audio; chn++)
+    {
+        snprintf (buf, sizeof (buf) - 1, "playback_%u", chn + 1);
+        port = jack_port_register (client, buf, JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
+        if (!port)
+        {
+            printf ("jack_netsource: cannot register %s port\n", buf);
+            break;
+        }
+	if( bitdepth == 1000 ) {
+#if HAVE_CELT
+#if HAVE_CELT_API_0_7
+	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate (client), jack_get_buffer_size(client), NULL );
+	    playback_srcs = jack_slist_append(playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
+#else
+	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate (client), 1, jack_get_buffer_size(client), NULL );
+	    playback_srcs = jack_slist_append(playback_srcs, celt_encoder_create( celt_mode ) );
+#endif
+#endif
+	} else {
+#if HAVE_SAMPLERATE
+	    playback_srcs = jack_slist_append (playback_srcs, src_new (SRC_LINEAR, 1, NULL));
+#endif
+	}
+	playback_ports = jack_slist_append (playback_ports, port);
+    }
+
+    /* Allocate midi playback channels */
+    for (chn = n_playback_audio; chn < n_playback_midi + n_playback_audio; chn++)
+    {
+        snprintf (buf, sizeof (buf) - 1, "playback_%u", chn + 1);
+        port = jack_port_register (client, buf, JACK_DEFAULT_MIDI_TYPE, port_flags, 0);
+        if (!port)
+        {
+            printf ("jack_netsource: cannot register %s port\n", buf);
+            break;
+        }
+        playback_ports = jack_slist_append (playback_ports, port);
+    }
+}
+
+/**
+ * The Sync callback... sync state is set elsewhere...
+ * we will see if this is working correctly.
+ * i dont really believe in it yet.
+ */
+int
+sync_cb (jack_transport_state_t state, jack_position_t *pos, void *arg)
+{
+    static int latency_count = 0;
+    int retval = sync_state;
+
+    if (latency_count) {
+        latency_count--;
+        retval = 0;
+    }
+
+    else if (state == JackTransportStarting && last_transport_state != JackTransportStarting)
+    {
+        retval = 0;
+        latency_count = latency - 1;
+    }
+
+    last_transport_state = state;
+    return retval;
+}
+
+void
+freewheel_cb (int starting, void *arg)
+{
+	freewheeling = starting;
+}
+
+    int deadline_goodness=0;
+/**
+ * The process callback for this JACK application.
+ * It is called by JACK at the appropriate times.
+ */
+int
+process (jack_nframes_t nframes, void *arg)
+{
+    jack_nframes_t net_period;
+    int rx_bufsize, tx_bufsize;
+
+    jack_default_audio_sample_t *buf;
+    jack_port_t *port;
+    JSList *node;
+    int chn;
+    int size, i;
+    const char *porttype;
+    int input_fd;
+
+    jack_position_t local_trans_pos;
+
+    uint32_t *packet_buf, *packet_bufX;
+    uint32_t *rx_packet_ptr;
+    jack_time_t packet_recv_timestamp;
+
+    if( bitdepth == 1000 )
+	net_period = (factor * jack_get_buffer_size(client) * 1024 / jack_get_sample_rate(client) / 8)&(~1) ;
+    else
+	net_period = (float) nframes / (float) factor;
+
+    rx_bufsize =  get_sample_size (bitdepth) * capture_channels * net_period + sizeof (jacknet_packet_header);
+    tx_bufsize =  get_sample_size (bitdepth) * playback_channels * net_period + sizeof (jacknet_packet_header);
+
+
+    /* Allocate a buffer where both In and Out Buffer will fit */
+    packet_buf = alloca ((rx_bufsize > tx_bufsize) ? rx_bufsize : tx_bufsize);
+
+    jacknet_packet_header *pkthdr = (jacknet_packet_header *) packet_buf;
+
+    /*
+     * for latency==0 we need to send out the packet before we wait on the reply.
+     * but this introduces a cycle of latency, when netsource is connected to itself.
+     * so we send out before read only in zero latency mode.
+     *
+     */
+
+    if( latency == 0 ) {
+	    /* reset packet_bufX... */
+	    packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
+
+	    /* ---------- Send ---------- */
+	    render_jack_ports_to_payload (bitdepth, playback_ports, playback_srcs, nframes,
+			    packet_bufX, net_period, dont_htonl_floats);
+
+	    /* fill in packet hdr */
+	    pkthdr->transport_state = jack_transport_query (client, &local_trans_pos);
+	    pkthdr->transport_frame = local_trans_pos.frame;
+	    pkthdr->framecnt = framecnt;
+	    pkthdr->latency = latency;
+	    pkthdr->reply_port = reply_port;
+	    pkthdr->sample_rate = jack_get_sample_rate (client);
+	    pkthdr->period_size = nframes;
+
+	    /* playback for us is capture on the other side */
+	    pkthdr->capture_channels_audio = playback_channels_audio;
+	    pkthdr->playback_channels_audio = capture_channels_audio;
+	    pkthdr->capture_channels_midi = playback_channels_midi;
+	    pkthdr->playback_channels_midi = capture_channels_midi;
+	    pkthdr->mtu = mtu;
+	    if( freewheeling!= 0 )
+		    pkthdr->sync_state = (jack_nframes_t)MASTER_FREEWHEELS;
+	    else
+		    pkthdr->sync_state = (jack_nframes_t)deadline_goodness;
+	    //printf("goodness=%d\n", deadline_goodness );
+
+	    packet_header_hton (pkthdr);
+	    if (cont_miss < 3*latency+5) {
+		    int r;
+		    for( r=0; r<redundancy; r++ )
+			    netjack_sendto (outsockfd, (char *) packet_buf, tx_bufsize, 0, &destaddr, sizeof (destaddr), mtu);
+	    }
+	    else if (cont_miss > 50+5*latency)
+	    {
+		    state_connected = 0;
+		    packet_cache_reset_master_address( global_packcache );
+		    //printf ("Frame %d  \tRealy too many packets missed (%d). Let's reset the counter\n", framecnt, cont_miss);
+		    cont_miss = 0;
+	    }
+    }
+
+    /*
+     * ok... now the RECEIVE code.
+     *
+     */
+
+    /* reset packet_bufX... */
+    packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
+
+    if( reply_port )
+	input_fd = insockfd;
+    else
+	input_fd = outsockfd;
+
+    // for latency == 0 we can poll.
+    if( (latency == 0) || (freewheeling!=0)  ) {
+	jack_time_t deadline = jack_get_time() + 1000000 * jack_get_buffer_size(client)/jack_get_sample_rate(client);
+	// Now loop until we get the right packet.
+	while(1) {
+	    jack_nframes_t got_frame;
+	    if ( ! netjack_poll_deadline( input_fd, deadline ) )
+		break;
+
+	    packet_cache_drain_socket(global_packcache, input_fd);
+
+	    if (packet_cache_get_next_available_framecnt( global_packcache, framecnt - latency, &got_frame ))
+		if( got_frame == (framecnt - latency) )
+		    break;
+	}
+    } else {
+	// normally:
+	// only drain socket.
+	packet_cache_drain_socket(global_packcache, input_fd);
+    }
+
+    size = packet_cache_retreive_packet_pointer( global_packcache, framecnt - latency, (char**)&rx_packet_ptr, rx_bufsize, &packet_recv_timestamp );
+    /* First alternative : we received what we expected. Render the data
+     * to the JACK ports so it can be played. */
+    if (size == rx_bufsize)
+    {
+	packet_buf = rx_packet_ptr;
+	pkthdr = (jacknet_packet_header *) packet_buf;
+	packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
+	// calculate how much time there would have been, if this packet was sent at the deadline.
+
+	int recv_time_offset = (int) (jack_get_time() - packet_recv_timestamp);
+	packet_header_ntoh (pkthdr);
+	deadline_goodness = recv_time_offset - (int)pkthdr->latency;
+	//printf( "deadline goodness = %d ---> off: %d\n", deadline_goodness, recv_time_offset );
+
+        if (cont_miss)
+        {
+            //printf("Frame %d  \tRecovered from dropouts\n", framecnt);
+            cont_miss = 0;
+        }
+        render_payload_to_jack_ports (bitdepth, packet_bufX, net_period,
+		capture_ports, capture_srcs, nframes, dont_htonl_floats);
+
+	state_currentframe = framecnt;
+	state_recv_packet_queue_time = recv_time_offset;
+	state_connected = 1;
+        sync_state = pkthdr->sync_state;
+	packet_cache_release_packet( global_packcache, framecnt - latency );
+    }
+    /* Second alternative : we've received something that's not
+     * as big as expected or we missed a packet. We render silence
+     * to the ouput ports */
+    else
+    {
+	jack_nframes_t latency_estimate;
+	if( packet_cache_find_latency( global_packcache, framecnt, &latency_estimate ) )
+	    //if( (state_latency == 0) || (latency_estimate < state_latency) )
+		state_latency = latency_estimate;
+
+	// Set the counters up.
+	state_currentframe = framecnt;
+	//state_latency = framecnt - pkthdr->framecnt;
+	state_netxruns += 1;
+
+        //printf ("Frame %d  \tPacket missed or incomplete (expected: %d bytes, got: %d bytes)\n", framecnt, rx_bufsize, size);
+        //printf ("Frame %d  \tPacket missed or incomplete\n", framecnt);
+        cont_miss += 1;
+        chn = 0;
+        node = capture_ports;
+        while (node != NULL)
+        {
+            port = (jack_port_t *) node->data;
+            buf = jack_port_get_buffer (port, nframes);
+            porttype = jack_port_type (port);
+            if (strncmp (porttype, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size ()) == 0)
+                for (i = 0; i < nframes; i++)
+                    buf[i] = 0.0;
+            else if (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size ()) == 0)
+                jack_midi_clear_buffer (buf);
+            node = jack_slist_next (node);
+            chn++;
+        }
+    }
+    if( latency != 0 ) {
+	    /* reset packet_bufX... */
+	    packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
+
+	    /* ---------- Send ---------- */
+	    render_jack_ports_to_payload (bitdepth, playback_ports, playback_srcs, nframes,
+			    packet_bufX, net_period, dont_htonl_floats);
+
+	    /* fill in packet hdr */
+	    pkthdr->transport_state = jack_transport_query (client, &local_trans_pos);
+	    pkthdr->transport_frame = local_trans_pos.frame;
+	    pkthdr->framecnt = framecnt;
+	    pkthdr->latency = latency;
+	    pkthdr->reply_port = reply_port;
+	    pkthdr->sample_rate = jack_get_sample_rate (client);
+	    pkthdr->period_size = nframes;
+
+	    /* playback for us is capture on the other side */
+	    pkthdr->capture_channels_audio = playback_channels_audio;
+	    pkthdr->playback_channels_audio = capture_channels_audio;
+	    pkthdr->capture_channels_midi = playback_channels_midi;
+	    pkthdr->playback_channels_midi = capture_channels_midi;
+	    pkthdr->mtu = mtu;
+	    if( freewheeling!= 0 )
+		    pkthdr->sync_state = (jack_nframes_t)MASTER_FREEWHEELS;
+	    else
+		    pkthdr->sync_state = (jack_nframes_t)deadline_goodness;
+	    //printf("goodness=%d\n", deadline_goodness );
+
+	    packet_header_hton (pkthdr);
+	    if (cont_miss < 3*latency+5) {
+		    int r;
+		    for( r=0; r<redundancy; r++ )
+			    netjack_sendto (outsockfd, (char *) packet_buf, tx_bufsize, 0, &destaddr, sizeof (destaddr), mtu);
+	    }
+	    else if (cont_miss > 50+5*latency)
+	    {
+		    state_connected = 0;
+		    packet_cache_reset_master_address( global_packcache );
+		    //printf ("Frame %d  \tRealy too many packets missed (%d). Let's reset the counter\n", framecnt, cont_miss);
+		    cont_miss = 0;
+	    }
+    }
+
+    framecnt++;
+    return 0;
+}
+
+/**
+ * This is the shutdown callback for this JACK application.
+ * It is called by JACK if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+
+void
+jack_shutdown (void *arg)
+{
+    exit (1);
+}
+
+void
+init_sockaddr_in (struct sockaddr_in *name , const char *hostname , uint16_t port)
+{
+    name->sin_family = AF_INET ;
+    name->sin_port = htons (port);
+    if (hostname)
+    {
+        struct hostent *hostinfo = gethostbyname (hostname);
+        if (hostinfo == NULL) {
+            fprintf (stderr, "init_sockaddr_in: unknown host: %s.\n", hostname);
+	    fflush( stderr );
+	}
+#ifdef WIN32
+        name->sin_addr.s_addr = inet_addr( hostname );
+#else
+        name->sin_addr = *(struct in_addr *) hostinfo->h_addr ;
+#endif
+    }
+    else
+        name->sin_addr.s_addr = htonl (INADDR_ANY) ;
+
+}
+
+void
+printUsage ()
+{
+fprintf (stderr, "usage: jack_netsource [options]\n"
+        "\n"
+        "  -h this help text\n"
+        "  -H <slave host> - Host name of the slave JACK\n"
+        "  -o <num channels> - Number of audio playback channels\n"
+        "  -i <num channels> - Number of audio capture channels\n"
+        "  -O <num channels> - Number of midi playback channels\n"
+        "  -I <num channels> - Number of midi capture channels\n"
+        "  -n <periods> - Network latency in JACK periods\n"
+        "  -p <port> - UDP port that the slave is listening on\n"
+        "  -r <reply port> - UDP port that we are listening on\n"
+	"  -B <bind port> - reply port, for use in NAT environments\n"
+        "  -b <bitdepth> - Set transport to use 16bit or 8bit\n"
+	"  -c <kbits> - Use CELT encoding with <kbits> kbits per channel\n"
+        "  -m <mtu> - Assume this mtu for the link\n"
+	"  -R <N> - Redundancy: send out packets N times.\n"
+	"  -e - skip host-to-network endianness conversion\n"
+        "  -N <jack name> - Reports a different name to jack\n"
+        "  -s <server name> - The name of the local jack server\n"
+        "\n");
+}
+
+void
+sigterm_handler( int signal )
+{
+	quit = 1;
+}
+
+int
+main (int argc, char *argv[])
+{
+    /* Some startup related basics */
+    char *client_name, *server_name = NULL, *peer_ip;
+    int peer_port = 3000;
+    jack_options_t options = JackNullOption;
+    jack_status_t status;
+#ifdef WIN32
+    WSADATA wsa;
+    int rc = WSAStartup(MAKEWORD(2,0),&wsa);
+#endif
+    /* Torben's famous state variables, aka "the reporting API" ! */
+    /* heh ? these are only the copies of them ;)                 */
+    int statecopy_connected, statecopy_latency, statecopy_netxruns;
+    jack_nframes_t net_period;
+    /* Argument parsing stuff */
+    extern char *optarg;
+    extern int optind, optopt;
+    int errflg=0, c;
+
+    if (argc < 3)
+    {
+        printUsage ();
+        return 1;
+    }
+
+    client_name = (char *) malloc (sizeof (char) * 10);
+    peer_ip = (char *) malloc (sizeof (char) * 10);
+    sprintf(client_name, "netjack");
+    sprintf(peer_ip, "localhost");
+
+    while ((c = getopt (argc, argv, ":h:H:o:i:O:I:n:p:r:B:b:c:m:R:e:N:s:")) != -1)
+    {
+        switch (c)
+        {
+            case 'h':
+                printUsage();
+                exit (0);
+                break;
+            case 'H':
+                free(peer_ip);
+                peer_ip = (char *) malloc (sizeof (char) * strlen (optarg)+1);
+                strcpy (peer_ip, optarg);
+                break;
+            case 'o':
+                playback_channels_audio = atoi (optarg);
+                break;
+            case 'i':
+                capture_channels_audio = atoi (optarg);
+                break;
+            case 'O':
+                playback_channels_midi = atoi (optarg);
+                break;
+            case 'I':
+                capture_channels_midi = atoi (optarg);
+                break;
+            case 'n':
+                latency = atoi (optarg);
+                break;
+            case 'p':
+                peer_port = atoi (optarg);
+                break;
+            case 'r':
+                reply_port = atoi (optarg);
+                break;
+            case 'B':
+                bind_port = atoi (optarg);
+                break;
+            case 'f':
+                factor = atoi (optarg);
+                printf("This feature is deprecated and will be removed in future netjack versions. CELT offers a superiour way to conserve bandwidth");
+                break;
+            case 'b':
+                bitdepth = atoi (optarg);
+                break;
+	    case 'c':
+#if HAVE_CELT
+	        bitdepth = 1000;
+                factor = atoi (optarg);
+#else
+                printf( "not built with celt supprt\n" );
+                exit(10);
+#endif
+	        break;
+            case 'm':
+                mtu = atoi (optarg);
+                break;
+            case 'R':
+                redundancy = atoi (optarg);
+                break;
+            case 'e':
+                dont_htonl_floats = 1;
+                break;
+            case 'N':
+                free(client_name);
+                client_name = (char *) malloc (sizeof (char) * strlen (optarg)+1);
+                strcpy (client_name, optarg);
+                break;
+            case 's':
+                server_name = (char *) malloc (sizeof (char) * strlen (optarg)+1);
+                strcpy (server_name, optarg);
+                options |= JackServerName;
+                break;
+            case ':':
+                fprintf (stderr, "Option -%c requires an operand\n", optopt);
+                errflg++;
+                break;
+            case '?':
+                fprintf (stderr, "Unrecognized option: -%c\n", optopt);
+                errflg++;
+        }
+    }
+    if (errflg)
+    {
+        printUsage ();
+        exit (2);
+    }
+
+    capture_channels = capture_channels_audio + capture_channels_midi;
+    playback_channels = playback_channels_audio + playback_channels_midi;
+
+    outsockfd = socket (AF_INET, SOCK_DGRAM, 0);
+    insockfd = socket (AF_INET, SOCK_DGRAM, 0);
+
+    if( (outsockfd == -1) || (insockfd == -1) ) {
+        fprintf (stderr, "cant open sockets\n" );
+        return 1;
+    }
+
+    init_sockaddr_in ((struct sockaddr_in *) &destaddr, peer_ip, peer_port);
+    if(bind_port) {
+        init_sockaddr_in ((struct sockaddr_in *) &bindaddr, NULL, bind_port);
+        if( bind (outsockfd, &bindaddr, sizeof (bindaddr)) ) {
+		fprintf (stderr, "bind failure\n" );
+	}
+    }
+    if(reply_port)
+    {
+        init_sockaddr_in ((struct sockaddr_in *) &bindaddr, NULL, reply_port);
+        if( bind (insockfd, &bindaddr, sizeof (bindaddr)) ) {
+		fprintf (stderr, "bind failure\n" );
+	}
+    }
+
+    /* try to become a client of the JACK server */
+    client = jack_client_open (client_name, options, &status, server_name);
+    if (client == NULL)
+    {
+        fprintf (stderr, "jack_client_open() failed, status = 0x%2.0x\n"
+                         "Is the JACK server running ?\n", status);
+        return 1;
+    }
+
+    /* Set up jack callbacks */
+    jack_set_process_callback (client, process, 0);
+    jack_set_sync_callback (client, sync_cb, 0);
+    jack_set_freewheel_callback (client, freewheel_cb, 0);
+    jack_on_shutdown (client, jack_shutdown, 0);
+
+    alloc_ports (capture_channels_audio, playback_channels_audio, capture_channels_midi, playback_channels_midi);
+
+    if( bitdepth == 1000 )
+	net_period = (factor * jack_get_buffer_size(client) * 1024 / jack_get_sample_rate(client) / 8)&(~1) ;
+    else
+	net_period = ceilf((float) jack_get_buffer_size (client) / (float) factor);
+
+    int rx_bufsize =  get_sample_size (bitdepth) * capture_channels * net_period + sizeof (jacknet_packet_header);
+    global_packcache = packet_cache_new (latency + 50, rx_bufsize, mtu);
+
+    /* tell the JACK server that we are ready to roll */
+    if (jack_activate (client))
+    {
+        fprintf (stderr, "Cannot activate client");
+        return 1;
+    }
+
+    /* Now sleep forever... and evaluate the state_ vars */
+
+    signal( SIGTERM, sigterm_handler );
+    signal( SIGINT, sigterm_handler );
+
+    statecopy_connected = 2; // make it report unconnected on start.
+    statecopy_latency = state_latency;
+    statecopy_netxruns = state_netxruns;
+
+    while ( !quit )
+    {
+#ifdef WIN32
+        Sleep (1000);
+#else
+        sleep(1);
+#endif
+        if (statecopy_connected != state_connected)
+        {
+            statecopy_connected = state_connected;
+            if (statecopy_connected)
+            {
+                state_netxruns = 1; // We want to reset the netxrun count on each new connection
+                printf ("Connected :-)\n");
+            }
+            else
+                printf ("Not Connected\n");
+
+	    fflush(stdout);
+        }
+
+	if (statecopy_connected)
+	{
+            if (statecopy_netxruns != state_netxruns) {
+		statecopy_netxruns = state_netxruns;
+		printf ("%s: at frame %06d -> total netxruns %d  (%d%%) queue time= %d\n",
+				client_name,
+				state_currentframe,
+				statecopy_netxruns,
+				100*statecopy_netxruns/state_currentframe,
+				state_recv_packet_queue_time);
+
+		fflush(stdout);
+            }
+        }
+        else
+        {
+            if (statecopy_latency != state_latency)
+            {
+                statecopy_latency = state_latency;
+                if (statecopy_latency > 1)
+                printf ("current latency %d\n", statecopy_latency);
+		fflush(stdout);
+            }
+        }
+    }
+
+    jack_client_close (client);
+    packet_cache_free (global_packcache);
+    exit (0);
+}
diff --git a/example-clients/samplerate.c b/example-clients/samplerate.c
new file mode 100644
index 0000000..e8b77ec
--- /dev/null
+++ b/example-clients/samplerate.c
@@ -0,0 +1,85 @@
+/*
+ *  smaplerate.c -- get current samplerate
+ *
+ *  Copyright (C) 2003 Jack O'Quin.
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+char *package;				/* program name */
+jack_client_t *client;
+
+void jack_shutdown(void *arg)
+{
+	fprintf(stderr, "JACK shut down, exiting ...\n");
+	exit(1);
+}
+
+void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+void parse_arguments(int argc, char *argv[])
+{
+
+	/* basename $0 */
+	package = strrchr(argv[0], '/');
+	if (package == 0)
+		package = argv[0];
+	else
+		package++;
+
+	if (argc==1) {
+		return;
+	}
+	fprintf(stderr, "usage: %s [bufsize]\n", package);
+	exit(9);
+}
+
+int main(int argc, char *argv[])
+{
+	parse_arguments(argc, argv);
+
+	/* become a JACK client */
+	if ((client = jack_client_open(package, JackNullOption, NULL)) == 0) {
+		fprintf(stderr, "JACK server not running?\n");
+		exit(1);
+	}
+
+	signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+
+	jack_on_shutdown(client, jack_shutdown, 0);
+
+	fprintf(stdout, "%d\n", jack_get_sample_rate( client ) );
+
+	jack_client_close(client);
+
+	return 0;
+}
diff --git a/example-clients/server_control.cpp b/example-clients/server_control.cpp
new file mode 100644
index 0000000..64ec977
--- /dev/null
+++ b/example-clients/server_control.cpp
@@ -0,0 +1,236 @@
+/*
+ 	Copyright (C) 2008 Grame
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <jack/jack.h>
+#include <jack/control.h>
+
+static jackctl_driver_t * jackctl_server_get_driver(jackctl_server_t *server, const char *driver_name)
+{
+    const JSList * node_ptr = jackctl_server_get_drivers_list(server);
+
+    while (node_ptr) {
+        if (strcmp(jackctl_driver_get_name((jackctl_driver_t *)node_ptr->data), driver_name) == 0) {
+            return (jackctl_driver_t *)node_ptr->data;
+        }
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    return NULL;
+}
+
+static jackctl_internal_t * jackctl_server_get_internal(jackctl_server_t *server, const char *internal_name)
+{
+    const JSList * node_ptr = jackctl_server_get_internals_list(server);
+
+    while (node_ptr) {
+        if (strcmp(jackctl_internal_get_name((jackctl_internal_t *)node_ptr->data), internal_name) == 0) {
+            return (jackctl_internal_t *)node_ptr->data;
+        }
+        node_ptr = jack_slist_next(node_ptr);
+    }
+
+    return NULL;
+}
+
+static jackctl_parameter_t *
+jackctl_get_parameter(
+    const JSList * parameters_list,
+    const char * parameter_name)
+{
+    while (parameters_list)
+    {
+        if (strcmp(jackctl_parameter_get_name((jackctl_parameter_t *)parameters_list->data), parameter_name) == 0)
+        {
+            return (jackctl_parameter_t *)parameters_list->data;
+        }
+
+        parameters_list = jack_slist_next(parameters_list);
+    }
+
+    return NULL;
+}
+
+static void print_value(union jackctl_parameter_value value, jackctl_param_type_t type)
+{
+    switch (type) {
+    
+        case JackParamInt:
+            printf("parameter value = %d\n", value.i);
+            break;
+            
+         case JackParamUInt:
+            printf("parameter value = %u\n", value.ui);
+            break;
+            
+         case JackParamChar:
+            printf("parameter value = %c\n", value.c);
+            break;
+        
+         case JackParamString:
+            printf("parameter value = %s\n", value.str);
+            break;
+            
+         case JackParamBool:
+            printf("parameter value = %d\n", value.b);
+            break;
+     }
+}
+
+static void print_parameters(const JSList * node_ptr)
+{
+    while (node_ptr != NULL) {
+        jackctl_parameter_t * parameter = (jackctl_parameter_t *)node_ptr->data;
+        printf("\nparameter name = %s\n", jackctl_parameter_get_name(parameter));
+        printf("parameter id = %c\n", jackctl_parameter_get_id(parameter));
+        printf("parameter short decs = %s\n", jackctl_parameter_get_short_description(parameter));
+        printf("parameter long decs = %s\n", jackctl_parameter_get_long_description(parameter));
+        print_value(jackctl_parameter_get_default_value(parameter), jackctl_parameter_get_type(parameter));
+        node_ptr = jack_slist_next(node_ptr);
+    }
+}
+
+static void print_driver(jackctl_driver_t * driver)
+{
+    printf("\n--------------------------\n");
+    printf("driver = %s\n", jackctl_driver_get_name(driver));
+    printf("-------------------------- \n");
+    print_parameters(jackctl_driver_get_parameters(driver)); 
+}
+
+static void print_internal(jackctl_internal_t * internal)
+{
+    printf("\n-------------------------- \n");
+    printf("internal = %s\n", jackctl_internal_get_name(internal));
+    printf("-------------------------- \n");
+    print_parameters(jackctl_internal_get_parameters(internal));
+}
+
+static void usage()
+{
+	fprintf (stderr, "\n"
+					"usage: jack_server_control \n"
+					"              [ --driver OR -d driver_name ]\n"
+					"              [ --client OR -c client_name ]\n"
+	);
+}
+
+int main(int argc, char *argv[])
+{
+    jackctl_server_t * server;
+    const JSList * parameters;
+    const JSList * drivers;
+    const JSList * internals;
+    const JSList * node_ptr;
+    sigset_t signals;
+    int opt, option_index;
+    const char* driver_name = "dummy";
+    const char* client_name = "audioadapter";
+
+    const char *options = "d:c:";
+	struct option long_options[] = {
+		{"driver", 1, 0, 'd'},
+		{"client", 1, 0, 'c'},
+	};
+    
+ 	while ((opt = getopt_long (argc, argv, options, long_options, &option_index)) != EOF) {
+		switch (opt) {
+			case 'd':
+				driver_name = optarg;
+				break;
+			case 'c':
+				client_name = optarg;
+				break;
+            default:
+				usage();
+                exit(0);
+		}
+	}
+    
+	server = jackctl_server_create(NULL, NULL);
+    parameters = jackctl_server_get_parameters(server);
+    
+    /*
+    jackctl_parameter_t* param;
+    union jackctl_parameter_value value;
+    param = jackctl_get_parameter(parameters, "verbose");
+    if (param != NULL) {
+        value.b = true;
+        jackctl_parameter_set_value(param, &value);
+    }
+    */
+    
+    printf("\n========================== \n");
+    printf("List of server parameters \n");
+    printf("========================== \n");
+    
+    print_parameters(parameters);
+    
+    printf("\n========================== \n");
+    printf("List of drivers \n");
+    printf("========================== \n");
+    
+    drivers = jackctl_server_get_drivers_list(server);
+    node_ptr = drivers;
+    while (node_ptr != NULL) {
+        print_driver((jackctl_driver_t *)node_ptr->data);
+        node_ptr = jack_slist_next(node_ptr);
+    }
+    
+    printf("\n========================== \n");
+    printf("List of internal clients \n");
+    printf("========================== \n");
+    
+    internals = jackctl_server_get_internals_list(server);
+    node_ptr = internals;
+    while (node_ptr != NULL) {
+        print_internal((jackctl_internal_t *)node_ptr->data);
+        node_ptr = jack_slist_next(node_ptr);
+    }
+    
+    jackctl_server_start(server, jackctl_server_get_driver(server, driver_name));
+    jackctl_server_load_internal(server, jackctl_server_get_internal(server, client_name));
+    
+    /*
+    // Switch master test
+    
+    jackctl_driver_t* master;
+    
+    usleep(5000000);
+    printf("jackctl_server_load_master\n");
+    master = jackctl_server_get_driver(server, "coreaudio");
+    jackctl_server_switch_master(server, master);
+    
+    usleep(5000000);
+    printf("jackctl_server_load_master\n");
+    master = jackctl_server_get_driver(server, "dummy");
+    jackctl_server_switch_master(server, master);
+    
+    */
+      
+    signals = jackctl_setup_signals(0);
+    jackctl_wait_signals(signals);
+     
+    jackctl_server_destroy(server);
+    return 0;
+}
diff --git a/example-clients/showtime.c b/example-clients/showtime.c
index e97da09..af413e8 100644
--- a/example-clients/showtime.c
+++ b/example-clients/showtime.c
@@ -1,3 +1,19 @@
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
@@ -9,8 +25,7 @@
 
 jack_client_t *client;
 
-
-void
+static void
 showtime ()
 {
 	jack_position_t current;
@@ -20,7 +35,7 @@ showtime ()
 	transport_state = jack_transport_query (client, &current);
 	frame_time = jack_frame_time (client);
 	
-	printf ("frame: %7" PRIu32 " @ %" PRIu32 "\t", current.frame, frame_time);
+	printf ("frame = %u  frame_time = %u usecs = %lld \t",  current.frame, frame_time, current.usecs);
 
 	switch (transport_state) {
 	case JackTransportStopped:
@@ -43,27 +58,10 @@ showtime ()
 	if (current.valid & JackPositionTimecode)
 		printf ("\tTC: (%.6f, %.6f)",
 			current.frame_time, current.next_time);
-
-	if (current.valid & JackBBTFrameOffset)
-		printf ("\tBBT offset: (%" PRIi32 ")",
-			current.bbt_offset);
-
-	if (current.valid & JackAudioVideoRatio)
-		printf ("\taudio/video: (%f)",
-			current.audio_frames_per_video_frame);
-
-	if (current.valid & JackVideoFrameOffset) {
-		if (current.video_offset) {
-			printf ("\t video@: (%" PRIi32 ")", current.video_offset);
-		} else {
-			printf ("\t no video");
-		}
-	}
-	
 	printf ("\n");
 }
 
-void
+static void
 jack_shutdown (void *arg)
 {
 	exit (1);
@@ -79,11 +77,10 @@ signal_handler (int sig)
 
 int
 main (int argc, char *argv[])
-
 {
 	/* try to become a client of the JACK server */
 
-	if ((client = jack_client_new ("showtime")) == 0) {
+	if ((client = jack_client_open ("showtime", JackNullOption, NULL)) == 0) {
 		fprintf (stderr, "jack server not running?\n");
 		return 1;
 	}
diff --git a/example-clients/simple_client.c b/example-clients/simple_client.c
index 79ca4fa..9e90fcd 100644
--- a/example-clients/simple_client.c
+++ b/example-clients/simple_client.c
@@ -1,39 +1,71 @@
 /** @file simple_client.c
  *
- * @brief This simple client demonstrates the most basic features of JACK
+ * @brief This simple client demonstrates the basic features of JACK
  * as they would be used by many applications.
  */
 
 #include <stdio.h>
 #include <errno.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
-
+#include <math.h>
+#include <signal.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
 #include <jack/jack.h>
 
-jack_port_t *input_port;
-jack_port_t *output_port;
+jack_port_t *output_port1, *output_port2;
 jack_client_t *client;
 
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+
+#define TABLE_SIZE   (200)
+typedef struct
+{
+    float sine[TABLE_SIZE];
+    int left_phase;
+    int right_phase;
+}
+paTestData;
+
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
 /**
  * The process callback for this JACK application is called in a
  * special realtime thread once for each audio cycle.
  *
- * This client does nothing more than copy data from its input
- * port to its output port. It will exit when stopped by 
- * the user (e.g. using Ctrl-C on a unix-ish operating system)
+ * This client follows a simple rule: when the JACK transport is
+ * running, copy the input port to the output.  When it stops, exit.
  */
+
 int
 process (jack_nframes_t nframes, void *arg)
 {
-	jack_default_audio_sample_t *in, *out;
-	
-	in = jack_port_get_buffer (input_port, nframes);
-	out = jack_port_get_buffer (output_port, nframes);
-	memcpy (out, in,
-		sizeof (jack_default_audio_sample_t) * nframes);
-
+	jack_default_audio_sample_t *out1, *out2;
+	paTestData *data = (paTestData*)arg;
+	int i;
+
+	out1 = (jack_default_audio_sample_t*)jack_port_get_buffer (output_port1, nframes);
+	out2 = (jack_default_audio_sample_t*)jack_port_get_buffer (output_port2, nframes);
+
+	for( i=0; i<nframes; i++ )
+    {
+        out1[i] = data->sine[data->left_phase];  /* left */
+        out2[i] = data->sine[data->right_phase];  /* right */
+        data->left_phase += 1;
+        if( data->left_phase >= TABLE_SIZE ) data->left_phase -= TABLE_SIZE;
+        data->right_phase += 3; /* higher pitch so we can distinguish left and right. */
+        if( data->right_phase >= TABLE_SIZE ) data->right_phase -= TABLE_SIZE;
+    }
+    
 	return 0;      
 }
 
@@ -51,11 +83,36 @@ int
 main (int argc, char *argv[])
 {
 	const char **ports;
-	const char *client_name = "simple";
+	const char *client_name;
 	const char *server_name = NULL;
 	jack_options_t options = JackNullOption;
 	jack_status_t status;
-	
+	paTestData data;
+	int i;
+
+	if (argc >= 2) {		/* client name specified? */
+		client_name = argv[1];
+		if (argc >= 3) {	/* server name specified? */
+			server_name = argv[2];
+            int my_option = JackNullOption | JackServerName;
+			options = (jack_options_t)my_option;
+		}
+	} else {			/* use basename of argv[0] */
+		client_name = strrchr(argv[0], '/');
+		if (client_name == 0) {
+			client_name = argv[0];
+		} else {
+			client_name++;
+		}
+	}
+
+	for( i=0; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = 0.2 * (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+    data.left_phase = data.right_phase = 0;
+  
+
 	/* open a client connection to the JACK server */
 
 	client = jack_client_open (client_name, options, &status, server_name);
@@ -79,7 +136,7 @@ main (int argc, char *argv[])
 	   there is work to be done.
 	*/
 
-	jack_set_process_callback (client, process, 0);
+	jack_set_process_callback (client, process, &data);
 
 	/* tell the JACK server to call `jack_shutdown()' if
 	   it ever shuts down, either entirely, or if it
@@ -88,22 +145,17 @@ main (int argc, char *argv[])
 
 	jack_on_shutdown (client, jack_shutdown, 0);
 
-	/* display the current sample rate. 
-	 */
-
-	printf ("engine sample rate: %" PRIu32 "\n",
-		jack_get_sample_rate (client));
-
 	/* create two ports */
 
-	input_port = jack_port_register (client, "input",
-					 JACK_DEFAULT_AUDIO_TYPE,
-					 JackPortIsInput, 0);
-	output_port = jack_port_register (client, "output",
+	output_port1 = jack_port_register (client, "output1",
 					  JACK_DEFAULT_AUDIO_TYPE,
 					  JackPortIsOutput, 0);
 
-	if ((input_port == NULL) || (output_port == NULL)) {
+	output_port2 = jack_port_register (client, "output2",
+					  JACK_DEFAULT_AUDIO_TYPE,
+					  JackPortIsOutput, 0);
+
+	if ((output_port1 == NULL) || (output_port2 == NULL)) {
 		fprintf(stderr, "no more JACK ports available\n");
 		exit (1);
 	}
@@ -123,20 +175,7 @@ main (int argc, char *argv[])
 	 * "input" to the backend, and capture ports are "output" from
 	 * it.
 	 */
-
-	ports = jack_get_ports (client, NULL, NULL,
-				JackPortIsPhysical|JackPortIsOutput);
-	if (ports == NULL) {
-		fprintf(stderr, "no physical capture ports\n");
-		exit (1);
-	}
-
-	if (jack_connect (client, ports[0], jack_port_name (input_port))) {
-		fprintf (stderr, "cannot connect input ports\n");
-	}
-
-	free (ports);
-	
+ 	
 	ports = jack_get_ports (client, NULL, NULL,
 				JackPortIsPhysical|JackPortIsInput);
 	if (ports == NULL) {
@@ -144,20 +183,37 @@ main (int argc, char *argv[])
 		exit (1);
 	}
 
-	if (jack_connect (client, jack_port_name (output_port), ports[0])) {
+	if (jack_connect (client, jack_port_name (output_port1), ports[0])) {
 		fprintf (stderr, "cannot connect output ports\n");
 	}
 
-	free (ports);
-
-	/* keep running until stopped by the user */
-
-	sleep (-1);
+	if (jack_connect (client, jack_port_name (output_port2), ports[1])) {
+		fprintf (stderr, "cannot connect output ports\n");
+	}
 
-	/* this is never reached but if the program
-	   had some other way to exit besides being killed,
-	   they would be important to call.
-	*/
+	free (ports);
+    
+    /* install a signal handler to properly quits jack client */
+#ifdef WIN32
+	signal(SIGINT, signal_handler);
+    signal(SIGABRT, signal_handler);
+	signal(SIGTERM, signal_handler);
+#else
+	signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+#endif
+
+	/* keep running until the Ctrl+C */
+
+	while (1) {
+	#ifdef WIN32 
+		Sleep(1000);
+	#else
+		sleep (1);
+	#endif
+	}
 
 	jack_client_close (client);
 	exit (0);
diff --git a/example-clients/thru_client.c b/example-clients/thru_client.c
new file mode 100644
index 0000000..426fa6b
--- /dev/null
+++ b/example-clients/thru_client.c
@@ -0,0 +1,217 @@
+/** @file simple_client.c
+ *
+ * @brief This simple through client demonstrates the basic features of JACK
+ * as they would be used by many applications.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <signal.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <jack/jack.h>
+
+jack_port_t **input_ports;
+jack_port_t **output_ports;
+jack_client_t *client;
+
+static void signal_handler ( int sig )
+{
+    jack_client_close ( client );
+    fprintf ( stderr, "signal received, exiting ...\n" );
+    exit ( 0 );
+}
+
+/**
+ * The process callback for this JACK application is called in a
+ * special realtime thread once for each audio cycle.
+ *
+ * This client follows a simple rule: when the JACK transport is
+ * running, copy the input port to the output.  When it stops, exit.
+ */
+
+int
+process ( jack_nframes_t nframes, void *arg )
+{
+    int i;
+    jack_default_audio_sample_t *in, *out;
+    for ( i = 0; i < 2; i++ )
+    {
+        in = jack_port_get_buffer ( input_ports[i], nframes );
+        out = jack_port_get_buffer ( output_ports[i], nframes );
+        memcpy ( out, in, nframes * sizeof ( jack_default_audio_sample_t ) );
+    }
+    return 0;
+}
+
+/**
+ * JACK calls this shutdown_callback if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+void
+jack_shutdown ( void *arg )
+{
+    free ( input_ports );
+    free ( output_ports );
+    exit ( 1 );
+}
+
+int
+main ( int argc, char *argv[] )
+{
+    int i;
+    const char **ports;
+    const char *client_name;
+    const char *server_name = NULL;
+    jack_options_t options = JackNullOption;
+    jack_status_t status;
+
+    if ( argc >= 2 )        /* client name specified? */
+    {
+        client_name = argv[1];
+        if ( argc >= 3 )    /* server name specified? */
+        {
+            server_name = argv[2];
+            options |= JackServerName;
+        }
+    }
+    else              /* use basename of argv[0] */
+    {
+        client_name = strrchr ( argv[0], '/' );
+        if ( client_name == 0 )
+        {
+            client_name = argv[0];
+        }
+        else
+        {
+            client_name++;
+        }
+    }
+
+    /* open a client connection to the JACK server */
+
+    client = jack_client_open ( client_name, options, &status, server_name );
+    if ( client == NULL )
+    {
+        fprintf ( stderr, "jack_client_open() failed, "
+                  "status = 0x%2.0x\n", status );
+        if ( status & JackServerFailed )
+        {
+            fprintf ( stderr, "Unable to connect to JACK server\n" );
+        }
+        exit ( 1 );
+    }
+    if ( status & JackServerStarted )
+    {
+        fprintf ( stderr, "JACK server started\n" );
+    }
+    if ( status & JackNameNotUnique )
+    {
+        client_name = jack_get_client_name ( client );
+        fprintf ( stderr, "unique name `%s' assigned\n", client_name );
+    }
+
+    /* tell the JACK server to call `process()' whenever
+       there is work to be done.
+    */
+
+    jack_set_process_callback ( client, process, 0 );
+
+    /* tell the JACK server to call `jack_shutdown()' if
+       it ever shuts down, either entirely, or if it
+       just decides to stop calling us.
+    */
+
+    jack_on_shutdown ( client, jack_shutdown, 0 );
+
+    /* create two ports pairs*/
+    input_ports = ( jack_port_t** ) calloc ( 2, sizeof ( jack_port_t* ) );
+    output_ports = ( jack_port_t** ) calloc ( 2, sizeof ( jack_port_t* ) );
+
+    char port_name[16];
+    for ( i = 0; i < 2; i++ )
+    {
+        sprintf ( port_name, "input_%d", i + 1 );
+        input_ports[i] = jack_port_register ( client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0 );
+        sprintf ( port_name, "output_%d", i + 1 );
+        output_ports[i] = jack_port_register ( client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0 );
+        if ( ( input_ports[i] == NULL ) || ( output_ports[i] == NULL ) )
+        {
+            fprintf ( stderr, "no more JACK ports available\n" );
+            exit ( 1 );
+        }
+    }
+
+    /* Tell the JACK server that we are ready to roll.  Our
+     * process() callback will start running now. */
+
+    if ( jack_activate ( client ) )
+    {
+        fprintf ( stderr, "cannot activate client" );
+        exit ( 1 );
+    }
+
+    /* Connect the ports.  You can't do this before the client is
+     * activated, because we can't make connections to clients
+     * that aren't running.  Note the confusing (but necessary)
+     * orientation of the driver backend ports: playback ports are
+     * "input" to the backend, and capture ports are "output" from
+     * it.
+     */
+
+    ports = jack_get_ports ( client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput );
+    if ( ports == NULL )
+    {
+        fprintf ( stderr, "no physical capture ports\n" );
+        exit ( 1 );
+    }
+
+    for ( i = 0; i < 2; i++ )
+        if ( jack_connect ( client, ports[i], jack_port_name ( input_ports[i] ) ) )
+            fprintf ( stderr, "cannot connect input ports\n" );
+
+    free ( ports );
+
+    ports = jack_get_ports ( client, NULL, NULL, JackPortIsPhysical|JackPortIsInput );
+    if ( ports == NULL )
+    {
+        fprintf ( stderr, "no physical playback ports\n" );
+        exit ( 1 );
+    }
+
+    for ( i = 0; i < 2; i++ )
+        if ( jack_connect ( client, jack_port_name ( output_ports[i] ), ports[i] ) )
+            fprintf ( stderr, "cannot connect input ports\n" );
+
+    free ( ports );
+
+    /* install a signal handler to properly quits jack client */
+#ifdef WIN32
+    signal ( SIGINT, signal_handler );
+    signal ( SIGABRT, signal_handler );
+    signal ( SIGTERM, signal_handler );
+#else
+    signal ( SIGQUIT, signal_handler );
+    signal ( SIGTERM, signal_handler );
+    signal ( SIGHUP, signal_handler );
+    signal ( SIGINT, signal_handler );
+#endif
+
+    /* keep running until the transport stops */
+
+    while (1)
+    {
+#ifdef WIN32
+        Sleep ( 1000 );
+#else
+        sleep ( 1 );
+#endif
+    }
+
+    jack_client_close ( client );
+    exit ( 0 );
+}
diff --git a/example-clients/transport.c b/example-clients/transport.c
new file mode 100644
index 0000000..a2ff0ee
--- /dev/null
+++ b/example-clients/transport.c
@@ -0,0 +1,459 @@
+/*
+ *  transport.c -- JACK transport master example client.
+ *
+ *  Copyright (C) 2003 Jack O'Quin.
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+
+char *package;				/* program name */
+int done = 0;
+jack_client_t *client;
+
+/* Time and tempo variables.  These are global to the entire,
+ * transport timeline.  There is no attempt to keep a true tempo map.
+ * The default time signature is: "march time", 4/4, 120bpm
+ */
+float time_beats_per_bar = 4.0;
+float time_beat_type = 4.0;
+double time_ticks_per_beat = 1920.0;
+double time_beats_per_minute = 120.0;
+volatile int time_reset = 1;		/* true when time values change */
+
+/* JACK timebase callback.
+ *
+ * Runs in the process thread.  Realtime, must not wait.
+ */
+static void timebase(jack_transport_state_t state, jack_nframes_t nframes, 
+	      jack_position_t *pos, int new_pos, void *arg)
+{
+	double min;			/* minutes since frame 0 */
+	long abs_tick;			/* ticks since frame 0 */
+	long abs_beat;			/* beats since frame 0 */
+
+	if (new_pos || time_reset) {
+
+		pos->valid = JackPositionBBT;
+		pos->beats_per_bar = time_beats_per_bar;
+		pos->beat_type = time_beat_type;
+		pos->ticks_per_beat = time_ticks_per_beat;
+		pos->beats_per_minute = time_beats_per_minute;
+
+		time_reset = 0;		/* time change complete */
+
+		/* Compute BBT info from frame number.  This is relatively
+		 * simple here, but would become complex if we supported tempo
+		 * or time signature changes at specific locations in the
+		 * transport timeline. */
+
+		min = pos->frame / ((double) pos->frame_rate * 60.0);
+		abs_tick = min * pos->beats_per_minute * pos->ticks_per_beat;
+		abs_beat = abs_tick / pos->ticks_per_beat;
+
+		pos->bar = abs_beat / pos->beats_per_bar;
+		pos->beat = abs_beat - (pos->bar * pos->beats_per_bar) + 1;
+		pos->tick = abs_tick - (abs_beat * pos->ticks_per_beat);
+		pos->bar_start_tick = pos->bar * pos->beats_per_bar *
+			pos->ticks_per_beat;
+		pos->bar++;		/* adjust start to bar 1 */
+
+#if 0
+		/* some debug code... */
+		fprintf(stderr, "\nnew position: %" PRIu32 "\tBBT: %3"
+			PRIi32 "|%" PRIi32 "|%04" PRIi32 "\n",
+			pos->frame, pos->bar, pos->beat, pos->tick);
+#endif
+
+	} else {
+
+		/* Compute BBT info based on previous period. */
+		pos->tick +=
+			nframes * pos->ticks_per_beat * pos->beats_per_minute
+			/ (pos->frame_rate * 60);
+
+		while (pos->tick >= pos->ticks_per_beat) {
+			pos->tick -= pos->ticks_per_beat;
+			if (++pos->beat > pos->beats_per_bar) {
+				pos->beat = 1;
+				++pos->bar;
+				pos->bar_start_tick +=
+					pos->beats_per_bar
+					* pos->ticks_per_beat;
+			}
+		}
+	}
+}
+
+static void jack_shutdown(void *arg)
+{
+#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0400
+	rl_cleanup_after_signal();
+#endif
+	fprintf(stderr, "JACK shut down, exiting ...\n");
+	exit(1);
+}
+
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+/* Command functions: see commands[] table following. */
+
+static void com_activate(char *arg)
+{
+	if (jack_activate(client)) {
+		fprintf(stderr, "cannot activate client");
+	}
+}
+
+static void com_deactivate(char *arg)
+{
+	if (jack_deactivate(client)) {
+		fprintf(stderr, "cannot deactivate client");
+	}
+}
+
+static void com_exit(char *arg)
+{
+	done = 1;
+}
+
+static void com_help(char *);			/* forward declaration */
+
+static void com_locate(char *arg)
+{
+	jack_nframes_t frame = 0;
+
+	if (*arg != '\0')
+		frame = atoi(arg);
+
+	jack_transport_locate(client, frame);
+}
+
+static void com_master(char *arg)
+{
+	int cond = (*arg != '\0');
+	if (jack_set_timebase_callback(client, cond, timebase, NULL) != 0)
+		fprintf(stderr, "Unable to take over timebase.\n");
+}
+
+static void com_play(char *arg)
+{
+	jack_transport_start(client);
+}
+
+static void com_release(char *arg)
+{
+	jack_release_timebase(client);
+}
+
+static void com_stop(char *arg)
+{
+	jack_transport_stop(client);
+}
+
+/* Change the tempo for the entire timeline, not just from the current
+ * location. */
+static void com_tempo(char *arg)
+{
+	float tempo = 120.0;
+
+	if (*arg != '\0')
+		tempo = atof(arg);
+
+	time_beats_per_minute = tempo;
+	time_reset = 1;
+}
+
+/* Set sync timeout in seconds. */
+static void com_timeout(char *arg)
+{
+	double timeout = 2.0;
+
+	if (*arg != '\0')
+		timeout = atof(arg);
+
+	jack_set_sync_timeout(client, (jack_time_t) (timeout*1000000));
+}
+
+
+/* Command parsing based on GNU readline info examples. */
+
+typedef void cmd_function_t(char *);	/* command function type */
+
+/* Transport command table. */
+typedef struct {
+	char *name;			/* user printable name */
+	cmd_function_t *func;		/* function to call */
+	char *doc;			/* documentation  */
+} command_t;
+
+/* command table must be in alphabetical order */
+command_t commands[] = {
+	{"activate",	com_activate,	"Call jack_activate()"},
+	{"exit",	com_exit,	"Exit transport program"},
+	{"deactivate",	com_deactivate,	"Call jack_deactivate()"},
+	{"help",	com_help,	"Display help text [<command>]"},
+	{"locate",	com_locate,	"Locate to frame <position>"},
+	{"master",	com_master,	"Become timebase master "
+					"[<conditionally>]"},
+	{"play",	com_play,	"Start transport rolling"},
+	{"quit",	com_exit,	"Synonym for `exit'"},
+	{"release",	com_release,	"Release timebase"},
+	{"stop",	com_stop,	"Stop transport"},
+	{"tempo",	com_tempo,	"Set beat tempo <beats_per_min>"},
+	{"timeout",	com_timeout,	"Set sync timeout in <seconds>"},
+	{"?",		com_help,	"Synonym for `help'" },
+	{(char *)NULL, (cmd_function_t *)NULL, (char *)NULL }
+};
+     
+static command_t *find_command(char *name)
+{
+	register int i;
+	size_t namelen;
+
+	if ((name == NULL) || (*name == '\0'))
+		return ((command_t *)NULL);
+
+	namelen = strlen(name);
+	for (i = 0; commands[i].name; i++)
+		if (strncmp(name, commands[i].name, namelen) == 0) {
+
+			/* make sure the match is unique */
+			if ((commands[i+1].name) &&
+			    (strncmp(name, commands[i+1].name, namelen) == 0))
+				return ((command_t *)NULL);
+			else
+				return (&commands[i]);
+		}
+     
+	return ((command_t *)NULL);
+}
+
+static void com_help(char *arg)
+{
+	register int i;
+	command_t *cmd;
+
+	if (!*arg) {
+		/* print help for all commands */
+		for (i = 0; commands[i].name; i++) {
+			printf("%s\t\t%s.\n", commands[i].name,
+			       commands[i].doc);
+		}
+
+	} else if ((cmd = find_command(arg))) {
+		printf("%s\t\t%s.\n", cmd->name, cmd->doc);
+
+	} else {
+		int printed = 0;
+
+		printf("No `%s' command.  Valid command names are:\n", arg);
+
+		for (i = 0; commands[i].name; i++) {
+			/* Print in six columns. */
+			if (printed == 6) {
+				printed = 0;
+				printf ("\n");
+			}
+
+			printf ("%s\t", commands[i].name);
+			printed++;
+		}
+
+		printf("\n\nTry `help [command]\' for more information.\n");
+	}
+}
+
+static void execute_command(char *line)
+{
+	register int i;
+	command_t *command;
+	char *word;
+     
+	/* Isolate the command word. */
+	i = 0;
+	while (line[i] && whitespace(line[i]))
+		i++;
+	word = line + i;
+     
+	while (line[i] && !whitespace(line[i]))
+		i++;
+     
+	if (line[i])
+		line[i++] = '\0';
+     
+	command = find_command(word);
+     
+	if (!command) {
+		fprintf(stderr, "%s: No such command.  There is `help\'.\n",
+			word);
+		return;
+	}
+     
+	/* Get argument to command, if any. */
+	while (whitespace(line[i]))
+		i++;
+     
+	word = line + i;
+     
+	/* invoke the command function. */
+	(*command->func)(word);
+}
+
+
+/* Strip whitespace from the start and end of string. */
+static char *stripwhite(char *string)
+{
+	register char *s, *t;
+
+	s = string;
+	while (whitespace(*s))
+		s++;
+
+	if (*s == '\0')
+		return s;
+     
+	t = s + strlen (s) - 1;
+	while (t > s && whitespace(*t))
+		t--;
+	*++t = '\0';
+     
+	return s;
+}
+     
+static char *dupstr(char *s)
+{
+	char *r = malloc(strlen(s) + 1);
+	strcpy(r, s);
+	return r;
+}
+     
+/* Readline generator function for command completion. */
+static char *command_generator (const char *text, int state)
+{
+	static int list_index, len;
+	char *name;
+     
+	/* If this is a new word to complete, initialize now.  This
+	   includes saving the length of TEXT for efficiency, and
+	   initializing the index variable to 0. */
+	if (!state) {
+		list_index = 0;
+		len = strlen (text);
+	}
+     
+	/* Return the next name which partially matches from the
+	   command list. */
+	while ((name = commands[list_index].name)) {
+		list_index++;
+     
+		if (strncmp(name, text, len) == 0)
+			return dupstr(name);
+	}
+     
+	return (char *) NULL;		/* No names matched. */
+}
+
+static void command_loop()
+{
+	char *line, *cmd;
+	char prompt[32];
+
+	snprintf(prompt, sizeof(prompt), "%s> ", package);
+
+	/* Allow conditional parsing of the ~/.inputrc file. */
+	rl_readline_name = package;
+     
+	/* Define a custom completion function. */
+	rl_completion_entry_function = command_generator;
+
+	/* Read and execute commands until the user quits. */
+	while (!done) {
+
+		line = readline(prompt);
+     
+		if (line == NULL) {	/* EOF? */
+			printf("\n");	/* close out prompt */
+			done = 1;
+			break;
+		}
+     
+		/* Remove leading and trailing whitespace from the line. */
+		cmd = stripwhite(line);
+
+		/* If anything left, add to history and execute it. */
+		if (*cmd)
+		{
+			add_history(cmd);
+			execute_command(cmd);
+		}
+     
+		free(line);		/* realine() called malloc() */
+	}
+}
+
+int main(int argc, char *argv[])
+{
+	jack_status_t status;
+
+	/* basename $0 */
+	package = strrchr(argv[0], '/');
+	if (package == 0)
+		package = argv[0];
+	else
+		package++;
+
+	/* open a connection to the JACK server */
+	client = jack_client_open (package, JackNullOption, &status);
+	if (client == NULL) {
+		fprintf (stderr, "jack_client_open() failed, "
+			 "status = 0x%2.0x\n", status);
+		return 1;
+	}
+
+	signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+
+	jack_on_shutdown(client, jack_shutdown, 0);
+
+	if (jack_activate(client)) {
+		fprintf(stderr, "cannot activate client");
+		return 1;
+	}
+
+	/* execute commands until done */
+	command_loop();
+
+	jack_client_close(client);
+	exit(0);
+}
diff --git a/example-clients/transport_client.c b/example-clients/transport_client.c
deleted file mode 100644
index d5a7147..0000000
--- a/example-clients/transport_client.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/** @file transport_client.c
- *
- * @brief This client demonstrates very simple use of the JACK
- * transport API. Compare it with the simple_client example,
- * which is even simpler. It also demonstrates taking a client
- * name and optionally server name from the command line, rather 
- * than hard-coding either of these names.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <jack/jack.h>
-
-jack_port_t *input_port;
-jack_port_t *output_port;
-jack_client_t *client;
-
-/* a simple state machine for this client */
-volatile enum {
-	Init,
-	Run,
-	Exit
-} client_state = Init;
-
-/**
- * The process callback for this JACK application is called in a
- * special realtime thread once for each audio cycle.
- *
- * This client follows a simple rule: when the JACK transport is
- * running, copy the input port to the output.  When it stops, exit.
- */
-int
-process (jack_nframes_t nframes, void *arg)
-{
-	jack_default_audio_sample_t *in, *out;
-	jack_transport_state_t ts = jack_transport_query(client, NULL);
-
-	if (ts == JackTransportRolling) {
-
-		if (client_state == Init)
-			client_state = Run;
-
-		in = jack_port_get_buffer (input_port, nframes);
-		out = jack_port_get_buffer (output_port, nframes);
-		memcpy (out, in,
-			sizeof (jack_default_audio_sample_t) * nframes);
-
-	} else if (ts == JackTransportStopped) {
-
-		if (client_state == Run)
-			client_state = Exit;
-	}
-
-	return 0;      
-}
-
-/**
- * JACK calls this shutdown_callback if the server ever shuts down or
- * decides to disconnect the client.
- */
-void
-jack_shutdown (void *arg)
-{
-	exit (1);
-}
-
-int
-main (int argc, char *argv[])
-{
-	const char **ports;
-	const char *client_name;
-	const char *server_name = NULL;
-	jack_options_t options = JackNullOption;
-	jack_status_t status;
-
-	if (argc >= 2) {		/* client name specified? */
-		client_name = argv[1];
-		if (argc >= 3) {	/* server name specified? */
-			server_name = argv[2];
-			options |= JackServerName;
-		}
-	} else {			/* use basename of argv[0] */
-		client_name = strrchr(argv[0], '/');
-		if (client_name == 0) {
-			client_name = argv[0];
-		} else {
-			client_name++;
-		}
-	}
-
-	/* open a client connection to the JACK server */
-
-	client = jack_client_open (client_name, options, &status, server_name);
-	if (client == NULL) {
-		fprintf (stderr, "jack_client_open() failed, "
-			 "status = 0x%2.0x\n", status);
-		if (status & JackServerFailed) {
-			fprintf (stderr, "Unable to connect to JACK server\n");
-		}
-		exit (1);
-	}
-	if (status & JackServerStarted) {
-		fprintf (stderr, "JACK server started\n");
-	}
-	if (status & JackNameNotUnique) {
-		client_name = jack_get_client_name(client);
-		fprintf (stderr, "unique name `%s' assigned\n", client_name);
-	}
-
-	/* tell the JACK server to call `process()' whenever
-	   there is work to be done.
-	*/
-
-	jack_set_process_callback (client, process, 0);
-
-	/* tell the JACK server to call `jack_shutdown()' if
-	   it ever shuts down, either entirely, or if it
-	   just decides to stop calling us.
-	*/
-
-	jack_on_shutdown (client, jack_shutdown, 0);
-
-	/* display the current sample rate. 
-	 */
-
-	printf ("engine sample rate: %" PRIu32 "\n",
-		jack_get_sample_rate (client));
-
-	/* create two ports */
-
-	input_port = jack_port_register (client, "input",
-					 JACK_DEFAULT_AUDIO_TYPE,
-					 JackPortIsInput, 0);
-	output_port = jack_port_register (client, "output",
-					  JACK_DEFAULT_AUDIO_TYPE,
-					  JackPortIsOutput, 0);
-
-	if ((input_port == NULL) || (output_port == NULL)) {
-		fprintf(stderr, "no more JACK ports available\n");
-		exit (1);
-	}
-
-	/* Tell the JACK server that we are ready to roll.  Our
-	 * process() callback will start running now. */
-
-	if (jack_activate (client)) {
-		fprintf (stderr, "cannot activate client");
-		exit (1);
-	}
-
-	/* Connect the ports.  You can't do this before the client is
-	 * activated, because we can't make connections to clients
-	 * that aren't running.  Note the confusing (but necessary)
-	 * orientation of the driver backend ports: playback ports are
-	 * "input" to the backend, and capture ports are "output" from
-	 * it.
-	 */
-
-	ports = jack_get_ports (client, NULL, NULL,
-				JackPortIsPhysical|JackPortIsOutput);
-	if (ports == NULL) {
-		fprintf(stderr, "no physical capture ports\n");
-		exit (1);
-	}
-
-	if (jack_connect (client, ports[0], jack_port_name (input_port))) {
-		fprintf (stderr, "cannot connect input ports\n");
-	}
-
-	free (ports);
-	
-	ports = jack_get_ports (client, NULL, NULL,
-				JackPortIsPhysical|JackPortIsInput);
-	if (ports == NULL) {
-		fprintf(stderr, "no physical playback ports\n");
-		exit (1);
-	}
-
-	if (jack_connect (client, jack_port_name (output_port), ports[0])) {
-		fprintf (stderr, "cannot connect output ports\n");
-	}
-
-	free (ports);
-
-	/* keep running until the transport stops */
-
-	while (client_state != Exit) {
-		sleep (1);
-	}
-
-	jack_client_close (client);
-	exit (0);
-}
diff --git a/example-clients/tw.c b/example-clients/tw.c
new file mode 100644
index 0000000..b583720
--- /dev/null
+++ b/example-clients/tw.c
@@ -0,0 +1,262 @@
+/** @file simple_client.c
+ *
+ * @brief This simple client demonstrates the basic features of JACK
+ * as they would be used by many applications.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <jack/jack.h>
+
+jack_port_t *input_port;
+jack_port_t *output_port;
+jack_client_t *client;
+
+/* a simple state machine for this client */
+volatile enum {
+	Init,
+	Run,
+	Exit
+} client_state = Init;
+
+static void signal_handler(int sig)
+{
+	jack_client_close(client);
+	fprintf(stderr, "signal received, exiting ...\n");
+	exit(0);
+}
+
+/**
+ * The process callback for this JACK application is called in a
+ * special realtime thread once for each audio cycle.
+ *
+ * This client follows a simple rule: when the JACK transport is
+ * running, copy the input port to the output.  When it stops, exit.
+ */
+static int
+_process (jack_nframes_t nframes)
+{
+	jack_default_audio_sample_t *in, *out;
+	jack_transport_state_t ts = jack_transport_query(client, NULL);
+	
+	if (ts == JackTransportRolling) {
+		
+		if (client_state == Init)
+			client_state = Run;
+		
+		in = jack_port_get_buffer (input_port, nframes);
+		out = jack_port_get_buffer (output_port, nframes);
+		memcpy (out, in,
+			sizeof (jack_default_audio_sample_t) * nframes);
+		
+	} else if (ts == JackTransportStopped) {
+		
+		if (client_state == Run) {
+			client_state = Exit;
+			return -1;  // to stop the thread
+		}
+	}
+
+	return 0;      
+}
+
+static void* jack_thread(void *arg) 
+{
+	jack_client_t* client = (jack_client_t*) arg;
+	
+	while (1) {
+    
+		jack_nframes_t frames = jack_cycle_wait (client);
+		int status = _process(frames);
+		jack_cycle_signal (client, status);
+        
+        /*
+            Possibly do something else after signaling next clients in the graph
+        */
+        
+        /* End condition */
+        if (status != 0)
+            return 0;  
+	}
+    
+    /* not reached*/
+	return 0;
+}
+
+/*
+static void* jack_thread(void *arg) 
+{
+	jack_client_t* client = (jack_client_t*) arg;
+	
+	while (1) {
+		jack_nframes_t frames;
+		int status;
+		// cycle 1
+		frames = jack_cycle_wait (client);
+		status = _process(frames);
+		jack_cycle_signal (client, status);
+		// cycle 2
+		frames = jack_cycle_wait (client);
+		status = _process(frames);
+		jack_cycle_signal (client, status);
+		// cycle 3		
+		frames = jack_cycle_wait (client);
+		status = _process(frames);
+		jack_cycle_signal (client, status);
+		// cycle 4
+		frames = jack_cycle_wait (client);
+		status = _process(frames);
+		jack_cycle_signal (client, status);
+	}
+	
+	return 0;
+}
+*/
+
+/**
+ * JACK calls this shutdown_callback if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+static void
+jack_shutdown (void *arg)
+{
+	exit (1);
+}
+
+int
+main (int argc, char *argv[])
+{
+	const char **ports;
+	const char *client_name;
+	const char *server_name = NULL;
+	jack_options_t options = JackNullOption;
+	jack_status_t status;
+
+	if (argc >= 2) {		/* client name specified? */
+		client_name = argv[1];
+		if (argc >= 3) {	/* server name specified? */
+			server_name = argv[2];
+			options |= JackServerName;
+		}
+	} else {			/* use basename of argv[0] */
+		client_name = strrchr(argv[0], '/');
+		if (client_name == 0) {
+			client_name = argv[0];
+		} else {
+			client_name++;
+		}
+	}
+
+	/* open a client connection to the JACK server */
+
+	client = jack_client_open (client_name, options, &status, server_name);
+	if (client == NULL) {
+		fprintf (stderr, "jack_client_open() failed, "
+			 "status = 0x%2.0x\n", status);
+		if (status & JackServerFailed) {
+			fprintf (stderr, "Unable to connect to JACK server\n");
+		}
+		exit (1);
+	}
+	if (status & JackServerStarted) {
+		fprintf (stderr, "JACK server started\n");
+	}
+	if (status & JackNameNotUnique) {
+		client_name = jack_get_client_name(client);
+		fprintf (stderr, "unique name `%s' assigned\n", client_name);
+	}
+
+	/* tell the JACK server to call `process()' whenever
+	   there is work to be done.
+	*/    
+    if (jack_set_process_thread(client, jack_thread, client) < 0) 
+		exit(1);
+
+	/* tell the JACK server to call `jack_shutdown()' if
+	   it ever shuts down, either entirely, or if it
+	   just decides to stop calling us.
+	*/
+
+	jack_on_shutdown (client, jack_shutdown, 0);
+
+	/* display the current sample rate. 
+	 */
+
+	printf ("engine sample rate: %" PRIu32 "\n",
+		jack_get_sample_rate (client));
+
+	/* create two ports */
+
+	input_port = jack_port_register (client, "input",
+					 JACK_DEFAULT_AUDIO_TYPE,
+					 JackPortIsInput, 0);
+	output_port = jack_port_register (client, "output",
+					  JACK_DEFAULT_AUDIO_TYPE,
+					  JackPortIsOutput, 0);
+
+	if ((input_port == NULL) || (output_port == NULL)) {
+		fprintf(stderr, "no more JACK ports available\n");
+		exit (1);
+	}
+
+	/* Tell the JACK server that we are ready to roll.  Our
+	 * process() callback will start running now. */
+
+	if (jack_activate (client)) {
+		fprintf (stderr, "cannot activate client");
+		exit (1);
+	}
+
+	/* Connect the ports.  You can't do this before the client is
+	 * activated, because we can't make connections to clients
+	 * that aren't running.  Note the confusing (but necessary)
+	 * orientation of the driver backend ports: playback ports are
+	 * "input" to the backend, and capture ports are "output" from
+	 * it.
+	 */
+
+	ports = jack_get_ports (client, NULL, NULL,
+				JackPortIsPhysical|JackPortIsOutput);
+	if (ports == NULL) {
+		fprintf(stderr, "no physical capture ports\n");
+		exit (1);
+	}
+
+	if (jack_connect (client, ports[0], jack_port_name (input_port))) {
+		fprintf (stderr, "cannot connect input ports\n");
+	}
+
+	free (ports);
+	
+	ports = jack_get_ports (client, NULL, NULL,
+				JackPortIsPhysical|JackPortIsInput);
+	if (ports == NULL) {
+		fprintf(stderr, "no physical playback ports\n");
+		exit (1);
+	}
+
+	if (jack_connect (client, jack_port_name (output_port), ports[0])) {
+		fprintf (stderr, "cannot connect output ports\n");
+	}
+
+	free (ports);
+    
+    /* install a signal handler to properly quits jack client */
+    signal(SIGQUIT, signal_handler);
+	signal(SIGTERM, signal_handler);
+	signal(SIGHUP, signal_handler);
+	signal(SIGINT, signal_handler);
+
+	/* keep running until the transport stops */
+
+	while (client_state != Exit) {
+		sleep (1);
+	}
+
+	jack_client_close (client);
+	exit (0);
+}
diff --git a/example-clients/wait.c b/example-clients/wait.c
new file mode 100644
index 0000000..8187032
--- /dev/null
+++ b/example-clients/wait.c
@@ -0,0 +1,136 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <getopt.h>
+
+#include <time.h>
+
+#include <jack/jack.h>
+
+char * my_name;
+
+void
+show_usage (void)
+{
+	fprintf (stderr, "\nUsage: %s [options]\n", my_name);
+	fprintf (stderr, "Check for jack existence, or wait, until it either quits, or gets started\n");
+	fprintf (stderr, "options:\n");
+	fprintf (stderr, "        -s, --server <name>   Connect to the jack server named <name>\n");
+	fprintf (stderr, "        -w, --wait            Wait for server to become available\n");
+	fprintf (stderr, "        -q, --quit            Wait until server is quit\n");
+	fprintf (stderr, "        -c, --check           Check wether server is running\n");
+	fprintf (stderr, "        -t, --timeout         Wait timeout in seconds\n");
+	fprintf (stderr, "        -h, --help            Display this help message\n");
+	fprintf (stderr, "For more information see http://jackaudio.org/\n");
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_client_t *client;
+	jack_status_t status;
+	jack_options_t options = JackNoStartServer;
+	int c;
+	int option_index;
+	char *server_name = NULL;
+	int wait_for_start = 0;
+	int wait_for_quit = 0;
+	int just_check = 0;
+	int wait_timeout = 0;
+	time_t start_timestamp;
+
+	
+	struct option long_options[] = {
+		{ "server", 1, 0, 's' },
+		{ "wait", 0, 0, 'w' },
+		{ "quit", 0, 0, 'q' },
+		{ "check", 0, 0, 'c' },
+		{ "timeout", 1, 0, 't' },
+		{ "help", 0, 0, 'h' },
+		{ 0, 0, 0, 0 }
+	};
+
+	my_name = strrchr(argv[0], '/');
+	if (my_name == 0) {
+		my_name = argv[0];
+	} else {
+		my_name ++;
+	}
+
+	while ((c = getopt_long (argc, argv, "s:wqct:hv", long_options, &option_index)) >= 0) {
+		switch (c) {
+		case 's':
+			server_name = (char *) malloc (sizeof (char) * strlen(optarg));
+			strcpy (server_name, optarg);
+			options |= JackServerName;
+			break;
+		case 'w':
+			wait_for_start = 1;
+			break;
+		case 'q':
+			wait_for_quit = 1;
+			break;
+		case 'c':
+			just_check = 1;
+			break;
+		case 't':
+			wait_timeout = atoi(optarg);
+			break;
+		case 'h':
+			show_usage ();
+			return 1;
+			break;
+		default:
+			show_usage ();
+			return 1;
+			break;
+		}
+	}
+
+	/* try to open server in a loop. breaking under certein conditions */
+
+	start_timestamp = time( NULL );
+
+	while(1) {
+		client = jack_client_open ("wait", options, &status, server_name);
+		/* check for some real error and bail out */
+		if( (client == NULL) && !(status & JackServerFailed) ) {
+			fprintf (stderr, "jack_client_open() failed, "
+					"status = 0x%2.0x\n", status);
+			return 1;
+		}
+
+		if( client == NULL ) {
+			if( wait_for_quit ) {
+				fprintf( stdout, "server is gone\n" );
+				break;
+			}
+			if( just_check ) {
+				fprintf( stdout, "not running\n" );
+				break;
+			}
+		} else {
+			jack_client_close( client );
+			if( wait_for_start ) {
+				fprintf( stdout, "server is available\n" );
+				break;
+			}
+			if( just_check ) {
+				fprintf( stdout, "running\n" );
+				break;
+			}
+		}
+		if( wait_timeout ) {
+		       if( (time( NULL ) - start_timestamp) > wait_timeout ) {
+			       fprintf( stdout, "timeout\n" );
+			       break;
+		       }
+		}
+
+		// Wait a second, and repeat
+		sleep(1);
+	}
+
+	exit (0);
+}
diff --git a/example-clients/wscript b/example-clients/wscript
new file mode 100644
index 0000000..4cf08d1
--- /dev/null
+++ b/example-clients/wscript
@@ -0,0 +1,168 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+example_programs = {
+    'jack_freewheel' : 'freewheel.c',
+    'jack_connect' : 'connect.c',
+    'jack_lsp' : 'lsp.c',
+    'jack_metro' : 'metro.c',
+    'jack_midiseq' : 'midiseq.c',
+    'jack_midisine' : 'midisine.c',
+    'jack_showtime' : 'showtime.c',
+    'jack_simple_client' : 'simple_client.c',
+    'jack_zombie' : 'zombie.c',
+    'jack_load' : 'ipload.c',
+    'jack_unload' : 'ipunload.c',
+    'jack_showtime' : 'showtime.c',
+    'jack_alias' : 'alias.c',
+    'jack_bufsize' : 'bufsize.c',
+    'jack_wait' : 'wait.c',
+    'jack_samplerate' : 'samplerate.c',
+    'jack_evmon' : 'evmon.c',
+    'jack_monitor_client' : 'monitor_client.c',
+    'jack_thru' : 'thru_client.c',
+    'jack_cpu_load' : 'cpu_load.c',
+    'jack_server_control' : 'server_control.cpp',
+    }
+
+example_libs = {
+    'inprocess' : 'inprocess.c',
+    }
+
+def configure(conf):
+    e = conf.check_cc(header_name='sndfile.h', define_name="HAVE_SNDFILE")
+ 
+    conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
+   
+    if conf.is_defined('HAVE_SAMPLERATE'):
+        conf.env['LIB_SAMPLERATE'] = ['samplerate']
+
+    if conf.is_defined('HAVE_SNDFILE'):
+        conf.env['LIB_SNDFILE'] = ['sndfile']
+
+    conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs')
+
+    e = conf.check_cc(header_name='ncurses.h', define_name="HAVE_NCURSES")
+
+    if conf.is_defined('HAVE_NCURSES'):
+        conf.env['LIB_NCURSES'] = ['ncurses']
+
+    e = conf.check_cc(lib='readline', define_name="HAVE_READLINE")
+
+    # define_name="HAVE_READLINE" has no effect, LIB_READLINE is defined if readline is available
+    #if conf.is_defined('HAVE_READLINE'):
+    #    conf.env['LIB_READLINE'] = ['readline']
+
+    conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = bool(conf.env['LIB_READLINE']) and bool(conf.env['LIB_NCURSES'])
+
+    conf.env['BUILD_EXAMPLE_CLIENT_REC'] = conf.is_defined('HAVE_SNDFILE')
+
+    conf.env['BUILD_EXAMPLE_ALSA_IO'] = conf.is_defined('HAVE_SAMPLERATE')
+
+def build(bld):
+    if bld.env['IS_LINUX']:
+        os_incdir = ['../linux', '../posix']
+    if bld.env['IS_MACOSX']:
+        os_incdir = ['../macosx', '../posix']
+    if bld.env['IS_SUN']:
+        os_incdir = ['../solaris', '../posix']
+    for example_program, example_program_source in example_programs.items():
+        prog = bld.new_task_gen('cxx', 'program')
+        prog.features.append('cc')
+        prog.includes = os_incdir + ['../common/jack', '../common']
+        prog.source = example_program_source
+        if bld.env['IS_MACOSX']:
+            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
+            prog.env.append_value("LINKFLAGS", "")
+        if bld.env['IS_LINUX']:
+            prog.uselib = 'RT'
+        if bld.env['IS_SUN']:
+            prog.env.append_value("LINKFLAGS", "-lm")
+        if example_program == 'jack_server_control':
+            prog.uselib_local = 'serverlib'
+        else:
+            prog.uselib_local = 'clientlib'              
+        prog.target = example_program
+   
+    if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT']:
+        prog = bld.new_task_gen('cc', 'program')
+        prog.includes = os_incdir + ['../common/jack', '../common']
+        prog.source = 'transport.c'
+        if bld.env['IS_MACOSX']:
+            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
+            prog.env.append_value("LINKFLAGS", "")
+        if bld.env['IS_LINUX']:
+            prog.uselib = 'RT READLINE NCURSES'
+        if bld.env['IS_MACOSX']:
+	    prog.uselib = 'READLINE NCURSES'
+        prog.uselib_local = 'clientlib'
+        prog.target = 'jack_transport'
+
+    if bld.env['BUILD_EXAMPLE_CLIENT_REC']:
+        prog = bld.new_task_gen('cc', 'program')
+        prog.includes = os_incdir + ['../common/jack', '../common']
+        prog.source = 'capture_client.c'
+        if bld.env['IS_MACOSX']:
+            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
+            prog.env.append_value("LINKFLAGS", "")
+            prog.uselib = 'SNDFILE'
+        if bld.env['IS_LINUX']:
+            prog.uselib = 'RT SNDFILE'
+        if bld.env['IS_SUN']:
+            prog.uselib = 'RT SNDFILE'
+        prog.uselib_local = 'clientlib'
+        prog.target = 'jack_rec'
+
+    if bld.env['IS_LINUX'] or bld.env['IS_MACOSX']:
+        prog = bld.new_task_gen('cc', 'program')
+        prog.includes = os_incdir + ['../common/jack', '../common']
+        prog.source = ['netsource.c', '../common/netjack_packet.c']
+        prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
+        # Seems uneeded here...
+        #if bld.env['HAVE_CELT']:
+	    #if bld.env['HAVE_CELT_API_0_5']:
+	    #    prog.defines = ['HAVE_CELT', 'HAVE_CELT_API_0_5']
+	    #elif bld.env['HAVE_CELT_API_0_7']:
+	    #    prog.defines = ['HAVE_CELT', 'HAVE_CELT_API_0_7']
+        prog.uselib = 'CELT SAMPLERATE'
+        prog.uselib_local = 'clientlib'
+        prog.target = 'jack_netsource'
+
+    if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']:
+	    prog = bld.new_task_gen('cc', 'program')
+	    prog.includes = os_incdir + ['../common/jack', '../common']
+	    prog.source = ['alsa_in.c', '../common/memops.c']
+	    prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
+	    prog.uselib = 'ALSA SAMPLERATE'
+	    prog.uselib_local = 'clientlib'
+	    prog.target = 'alsa_in'
+
+	    prog = bld.new_task_gen('cc', 'program')
+	    prog.includes = os_incdir + ['../common/jack', '../common']
+	    prog.source = ['alsa_out.c', '../common/memops.c']
+	    prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
+	    prog.uselib = 'ALSA SAMPLERATE'
+	    prog.uselib_local = 'clientlib'
+	    prog.target = 'alsa_out'
+
+    for example_lib, example_lib_source in example_libs.items():
+        lib = bld.new_task_gen('cc', 'shlib')
+        lib.env['shlib_PATTERN'] = '%s.so'
+        lib.includes = os_incdir + ['../common/jack', '../common']
+        lib.target = example_lib
+        lib.source = example_lib_source
+        if bld.env['IS_MACOSX']:
+            lib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+            #lib.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
+            lib.env.append_value("LINKFLAGS", "")
+        if bld.env['IS_SUN']:
+	        lib.env.append_value("LINKFLAGS", "-lm")
+        lib.uselib_local = 'serverlib'
+        lib.install_path = '${ADDON_DIR}/'
+
+    bld.symlink_as('${PREFIX}/bin/jack_disconnect', 'jack_connect')
+
+    bld.install_files('${PREFIX}/bin', 'jack_control', chmod=0755)
diff --git a/example-clients/zombie.c b/example-clients/zombie.c
new file mode 100644
index 0000000..a3a2dad
--- /dev/null
+++ b/example-clients/zombie.c
@@ -0,0 +1,87 @@
+/*
+    Copyright (C) 2002 Jeremy Hall
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: zombie.c,v 1.1 2005/08/18 11:42:08 letz Exp $
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <jack/jack.h>
+
+int running = 1;
+int count = 0;
+jack_port_t* output_port;
+
+static int
+process(jack_nframes_t nframes, void* arg) 
+{
+	if (count++ == 1000) {
+        printf("process block\n");
+        //while (1) {}
+        sleep(1);
+    }
+    
+    return 0;
+}
+
+static void 
+shutdown (void *arg)
+{
+    printf("shutdown \n");
+    running = 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+	jack_client_t* client = NULL;
+    /* try to become a client of the JACK server */
+	if ((client = jack_client_open ("zombie", JackNullOption, NULL)) == 0) {
+		fprintf (stderr, "jack server not running?\n");
+		goto error;
+	}
+    
+    jack_set_process_callback (client, process, NULL);
+    jack_on_shutdown(client, shutdown, NULL);
+    output_port = jack_port_register (client, "port1", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+	/* tell the JACK server that we are ready to roll */
+	if (jack_activate (client)) {
+		fprintf (stderr, "cannot activate client");
+		goto error;
+	}
+    
+    jack_connect(client, jack_port_name(output_port), "coreaudio:Built-in Audio:in2");
+    
+    while (running) {
+        sleep(1);
+        printf ("run\n");
+    }
+
+    jack_deactivate (client);
+	jack_client_close (client);
+	return 0;
+    
+error:
+    if (client) 
+        jack_client_close (client);
+    return 1;
+}
+
diff --git a/jack.pc.in b/jack.pc.in
index ebc9159..fbda3a4 100644
--- a/jack.pc.in
+++ b/jack.pc.in
@@ -1,10 +1,11 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@PREFIX@
+exec_prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+server_libs=-L at LIBDIR@ -l at SERVERLIB@
 
 Name: jack
 Description: the Jack Audio Connection Kit: a low-latency synchronous callback-based media server
 Version: @JACK_VERSION@
-Libs: -L${libdir} -ljack -lpthread @OS_LDFLAGS@
-Cflags: -I${includedir}
+Libs: -L at LIBDIR@ -ljack
+Cflags: -I at INCLUDEDIR@
diff --git a/jack.spec.in b/jack.spec.in
deleted file mode 100644
index 5bd9522..0000000
--- a/jack.spec.in
+++ /dev/null
@@ -1,254 +0,0 @@
-# $Id: jack.spec.in 3158 2008-12-03 19:10:18Z rncbc $
-# set to 0 to build rpms without capabilities support
-%define enable_capabilities 0
-# strip binaries 
-%define strip_jackd 1
-# set to 1 to enable alternate jack temporary
-# directory mounted as tmpfs
-%define enable_tmpdir 1
-%if %{enable_tmpdir}
-%define jack_tmpdir /dev/shm
-%endif
-# use oss
-%define oss 1
-# use portaudio
-%define portaudio 0
-# use freebob
-%define freebob 1
-# use dynamic SIMD (ix86)
-%define dynsimd 1
-
-Summary:	The Jack Audio Connection Kit
-Name:		@PACKAGE@
-Version:	@VERSION@
-Release:	8
-License:	GPL
-Group:		System Environment/Daemons
-Source0:	%{name}-%{version}.tar.gz
-URL:		http://jackaudio.org
-BuildRoot:	%{_tmppath}/%{name}-%{version}-root-%(id -u -n)
-
-BuildRequires: automake >= 1.6
-BuildRequires: libsndfile-devel >= 1.0.11
-BuildRequires: libsamplerate-devel >= 0.1.2
-BuildRequires: pkgconfig
-BuildRequires: doxygen
-
-%if %{portaudio}
-BuildRequires: portaudio >= 18.1
-%endif
-%if %{freebob}
-BuildRequires: libfreebob >= 1.0.0
-%endif
-
-%description
-JACK is a low-latency audio server, written primarily for the Linux
-operating system. It can connect a number of different applications to
-an audio device, as well as allowing them to share audio between
-themselves. Its clients can run in their own processes (ie. as a
-normal application), or can they can run within a JACK server (ie. a
-"plugin").
-
-JACK is different from other audio server efforts in that it has been
-designed from the ground up to be suitable for professional audio
-work. This means that it focuses on two key areas: synchronous
-execution of all clients, and low latency operation.
-
-
-%package -n libjack0
-Summary:	Shared library to access JACK
-Group:		System/Libraries
-Requires:	%{name} = %{version}
-
-%description -n libjack0
-Shared library to access JACK (Jack Audio Connection Kit).
-
-
-%package -n libjack-devel
-Summary:	Development package for JACK
-Group:		Development/Libraries/C and C++
-Requires:	libjack0 = %{version}
-
-%description -n libjack-devel
-Files needed for JACK application development (Jack Audio Connection Kit).
-
-
-%package example-clients
-Summary:	Example clients that use JACK
-Group:		Applications/Multimedia
-Requires:	%{name} = %{version}
-
-%description example-clients
-Small example clients that use JACK (Jack Audio Connection Kit).
-
-
-%prep
-
-%setup -q
-
-%build
-%configure \
-%if %{enable_capabilities}
-	--enable-capabilities \
-%if %{strip_jackd}
-	--enable-stripped-jackd \
-%endif
-%endif
-%if %{enable_tmpdir}
-	--with-default-tmpdir=%{jack_tmpdir} \
-%endif
-%if ! %{oss}
-	--disable-oss \
-%endif
-%if ! %{portaudio}
-	--disable-portaudio \
-%endif
-%if ! %{freebob}
-	--disable-freebob \
-%endif
-%if %{dynsimd}
-	--enable-dynsimd \
-%endif
-	--enable-optimize
-make
-
-
-%install
-%makeinstall
-
-%if %{enable_capabilities}
-# make jackstart suid root
-chmod 04755 $RPM_BUILD_ROOT%{_bindir}/jackstart
-%endif
-
-# remove extra install of the documentation
-rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/*
-
-%post -n libjack0 -p /sbin/ldconfig
-
-%postun -n libjack0 -p /sbin/ldconfig
-
-%clean
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
-
-%files 
-%defattr(-,root,root)
-%doc AUTHORS TODO COPYING*
-%doc %{_mandir}/man1/*
-%if %{enable_capabilities}
-%attr(4755, root, root) %{_bindir}/jackstart
-%doc %{_mandir}/man1/jackstart*
-%endif
-%{_bindir}/jackd
-#{_bindir}/jack_bufsize
-%{_bindir}/jack_freewheel
-%{_bindir}/jack_load
-%{_bindir}/jack_netsource
-%{_bindir}/jack_transport
-%{_bindir}/jack_unload
-%{_bindir}/alsa_in
-%{_bindir}/alsa_out
-%dir %{_libdir}/%{name}
-%{_libdir}/%{name}/*.so
-
-%files -n libjack0
-%defattr(-,root,root)
-%{_libdir}/lib*.so.*
-
-%files -n libjack-devel
-%defattr(-,root,root)
-%doc doc/reference
-%{_libdir}/lib*.so
-%{_libdir}/lib*.la
-%{_libdir}/%{name}/*.*a
-%{_libdir}/pkgconfig/*
-%{_includedir}/%{name}
-
-%files example-clients
-%defattr(-,root,root)
-%{_bindir}/jackrec
-%{_bindir}/jack_alias
-#{_bindir}/jack_bufsize
-%{_bindir}/jack_connect
-%{_bindir}/jack_disconnect
-%{_bindir}/jack_evmon
-#{_bindir}/jack_freewheel
-%{_bindir}/jack_impulse_grabber
-%{_bindir}/jack_lsp
-#{_bindir}/jack_load
-%{_bindir}/jack_metro
-%{_bindir}/jack_midiseq
-%{_bindir}/jack_midisine
-%{_bindir}/jack_monitor_client
-#{_bindir}/jack_netsource
-%{_bindir}/jack_showtime
-%{_bindir}/jack_simple_client
-#{_bindir}/jack_transport
-%{_bindir}/jack_transport_client
-#{_bindir}/jack_unload
-#{_bindir}/alsa_in
-#{_bindir}/alsa_out
-
-
-%changelog
-
-* Wed Dec  3 2008 Rui Nuno Capela <rncbc at rncbc.org> - 0.116.0-8
-- enable dynamic SIMD optimizations by default
-- dropped preemption check option
-- added jack_transport_client to example-clients package
-
-* Tue Jul  8 2008 Rui Nuno Capela <rncbc at rncbc.org> - 0.112.0-7
-- refactored packaging to accomodate libjack0 and libjack-devel
-
-* Mon Apr 28 2008 Rui Nuno Capela <rncbc at rncbc.org> - 0.111.4-6
-- moved all bin tools from example-clients to nominal package
-
-* Sat Jan  5 2008 Rui Nuno Capela <rncbc at rncbc.org> - 0.108.1-5
-- added jack_alias and jack_evmon to example-clients package
-
-* Sun Jun 18 2006 Rui Nuno Capela <rncbc at rncbc.org> - 0.102.15-4
-- enable freebob backend drivers whenever available 
-
-* Sun May  7 2006 Rui Nuno Capela <rncbc at rncbc.org> - 0.102.1-3
-- new JACK MIDI files on devel and example-clients
-- set default tmpdir to /dev/shm
-
-* Thu Oct 30 2005 Rui Nuno Capela <rncbc at rncbc.org> - 0.100.7-2
-- omitted enable-capabilities, stripped-binaries and preemption
-  check from default.
-
-* Thu Jan  3 2005 Rui Nuno Capela <rncbc at rncbc.org> - 0.99.44-1
-- add jack/statistics.h to devel package
-
-* Thu Dec 28 2004 Rui Nuno Capela <rncbc at rncbc.org> - 0.99.41-1
-- merge integration of usx2y (rawusb) driver into alsa backend
-- enable preemption check feature of 2.6 RT kernels
-- add jack/intclient.h to devel package
-- add jack/thread.h to devel package
-- moved doc/reference to devel package
-- set default tmpdir to /var/lib/jack/tmp
-- include oss backend driver if available
-
-* Sat May 22 2004 Pete Bessman <ninjadroid at gazuga.net> - 0.98.1-1
-- changes to accomodate jack_oss and RPM's fascist build policy
-
-* Mon Nov 13  2003 Lawrie Abbott <lawrieabbott at iinet.net.au>      
-- update based on Planet CCRMA 0.80.0 release
-
-* Thu May 23 2002 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu>
-- added configuration variable to build with/without capabilities
-
-* Tue May 21 2002 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu>
-- split the examples into a different package so that the base
-  package does not depend on, for example, fltk. 
-- disable stripping of binaries
-
-* Mon May 13 2002 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu>
-- do not compress documentation, added doxygen docs directory
-- changed defattr directives
-- added libdir/jack*, libdir/*.a and libdir/*.so.* to files
-- moved all so's to libs, jack will not start without jack_alsa.so
-- merged base and libs packages
-
-* Sat May  4 2002 Christian Fredrik Kalager Schaller <uraeus at linuxrising.org> 
-- initial release of jack sound server package for GStreamer
diff --git a/jack/.cvsignore b/jack/.cvsignore
deleted file mode 100644
index 9ba20bc..0000000
--- a/jack/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-version.h
diff --git a/jack/Makefile.am b/jack/Makefile.am
deleted file mode 100644
index e31a432..0000000
--- a/jack/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in version.h
-
-libjackincludedir = $(includedir)/jack
-
-libjackinclude_HEADERS = 	\
-	intclient.h		\
-	jack.h			\
-	ringbuffer.h		\
-	statistics.h            \
-	thread.h                \
-	timestamps.h		\
-	transport.h		\
-	types.h	\
-	midiport.h
-
-noinst_HEADERS =		\
-	atomicity.h		\
-	bitset.h		\
-	driver.h 		\
-	driver_interface.h	\
-	driver_parse.h	        \
-	engine.h		\
-	hardware.h 		\
-	internal.h 		\
-	intsimd.h 		\
-	jslist.h		\
-	memops.h		\
-	messagebuffer.h		\
-	pool.h			\
-	port.h			\
-	ringbuffer.h	        \
-	sanitycheck.h           \
-	shm.h			\
-	start.h			\
-	systemtest.h            \
-	unlock.h		\
-	varargs.h		\
-	version.h
diff --git a/jack/atomicity.h b/jack/atomicity.h
deleted file mode 100644
index fb625ec..0000000
--- a/jack/atomicity.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    Copyright (C) 2004 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_atomicity_h__
-#define __jack_atomicity_h__
-
-/*
- * Interface with various machine-dependent headers derived from the
- * gcc/libstdc++.v3 sources.  We try to modify the GCC sources as
- * little as possible.  The following include is resolved using the
- * config/configure.hosts mechanism.  It will use an OS-dependent
- * version if available, otherwise the one for this CPU.  Some of
- * these files might not work with older GCC compilers.
- */
-#include <sysdeps/atomicity.h>
-
-/* These functions are defined for each platform.  The C++ library
- * function names start with "__" to avoid namespace pollution. */
-#define exchange_and_add __exchange_and_add
-#define atomic_add __atomic_add
-
-#endif /* __jack_atomicity_h__ */
diff --git a/jack/bitset.h b/jack/bitset.h
deleted file mode 100644
index f607815..0000000
--- a/jack/bitset.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * bitset.h -- some simple bit vector set operations.
- *
- * This is useful for sets of small non-negative integers.  There are
- * some obvious set operations that are not implemented because I
- * don't need them right now.
- *
- * These functions represent sets as arrays of unsigned 32-bit
- * integers allocated on the heap.  The first entry contains the set
- * cardinality (number of elements allowed), followed by one or more
- * words containing bit vectors.
- *
- */
-
-/*
- *  Copyright (C) 2005 Jack O'Quin
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __bitset_h__
-#define __bitset_h__
-
-#include <inttypes.h>			/* POSIX standard fixed-size types */
-#include <assert.h>			/* `#define NDEBUG' to disable */
-
-/* On some 64-bit machines, this implementation may be slightly
- * inefficient, depending on how compilers allocate space for
- * uint32_t.  For the set sizes I currently need, this is acceptable.
- * It should not be hard to pack the bits better, if that becomes
- * worthwhile.
- */
-typedef uint32_t _bitset_word_t;
-typedef _bitset_word_t *bitset_t;
-
-#define WORD_SIZE(cardinality) (1+((cardinality)+31)/32)
-#define BYTE_SIZE(cardinality) (WORD_SIZE(cardinality)*sizeof(_bitset_word_t))
-#define WORD_INDEX(element) (1+(element)/32)
-#define BIT_INDEX(element) ((element)&037)
-
-static inline void
-bitset_add(bitset_t set, unsigned int element)
-{
-	assert(element < set[0]);
-	set[WORD_INDEX(element)] |= (1 << BIT_INDEX(element));
-}
-
-static inline void
-bitset_copy(bitset_t to_set, bitset_t from_set)
-{
-	assert(to_set[0] == from_set[0]);
-	memcpy(to_set, from_set, BYTE_SIZE(to_set[0]));
-}
-
-static inline void
-bitset_create(bitset_t *set, unsigned int cardinality)
-{
-	*set = (bitset_t) calloc(WORD_SIZE(cardinality),
-				 sizeof(_bitset_word_t));
-	assert(*set);
-	*set[0] = cardinality;
-}
-
-static inline void
-bitset_destroy(bitset_t *set)
-{
-	if (*set) {
-		free(*set);
-		*set = (bitset_t) 0;
-	}
-}
-
-static inline int
-bitset_empty(bitset_t set)
-{
-	int i;
-	_bitset_word_t result = 0;
-	int nwords = WORD_SIZE(set[0]);
-	for (i = 1; i < nwords; i++) {
-		result |= set[i];
-	}
-	return (result == 0);
-}
-
-static inline int
-bitset_contains(bitset_t set, unsigned int element)
-{
-	assert(element < set[0]);
-	return (0 != (set[WORD_INDEX(element)] & (1<<BIT_INDEX(element))));
-}
-
-static inline void
-bitset_remove(bitset_t set, unsigned int element)
-{
-	assert(element < set[0]);
-	set[WORD_INDEX(element)] &= ~(1<<BIT_INDEX(element));
-}
-
-#endif /* __bitset_h__ */
diff --git a/jack/driver.h b/jack/driver.h
deleted file mode 100644
index ec1eea9..0000000
--- a/jack/driver.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_driver_h__
-#define __jack_driver_h__
-
-#include <pthread.h>
-#include <jack/types.h>
-#include <jack/port.h>
-#include <jack/driver_interface.h>
-
-typedef float         gain_t;
-typedef unsigned long channel_t;
-
-typedef	enum  {
-	Lock = 0x1,
-	NoLock = 0x2,
-	Sync = 0x4,
-	NoSync = 0x8
-} ClockSyncStatus;
-
-typedef void (*ClockSyncListenerFunction)(channel_t,ClockSyncStatus,void*);
-
-typedef struct {
-    unsigned long id;
-    ClockSyncListenerFunction function;
-    void *arg;
-} ClockSyncListener;
-
-struct _jack_engine;
-struct _jack_driver;
-
-typedef int       (*JackDriverAttachFunction)(struct _jack_driver *,
-					      struct _jack_engine *);
-typedef int       (*JackDriverDetachFunction)(struct _jack_driver *,
-					      struct _jack_engine *);
-typedef int       (*JackDriverReadFunction)(struct _jack_driver *,
-					    jack_nframes_t nframes);
-typedef int       (*JackDriverWriteFunction)(struct _jack_driver *,
-					     jack_nframes_t nframes);
-typedef int       (*JackDriverNullCycleFunction)(struct _jack_driver *,
-						 jack_nframes_t nframes);
-typedef int       (*JackDriverStopFunction)(struct _jack_driver *);
-typedef int       (*JackDriverStartFunction)(struct _jack_driver *);
-typedef int	  (*JackDriverBufSizeFunction)(struct _jack_driver *,
-					       jack_nframes_t nframes);
-/* 
-   Call sequence summary:
-
-     1) engine loads driver via runtime dynamic linking
-	 - calls jack_driver_load
-	 - we call dlsym for "driver_initialize" and execute it
-     2) engine attaches to driver
-     3) engine starts driver
-     4) driver runs its own thread, calling
-         while () {
-          driver->wait ();
-	  driver->engine->run_cycle ()
-         }
-     5) engine stops driver
-     6) engine detaches from driver
-     7) engine calls driver `finish' routine
-
-     Note that stop/start may be called multiple times in the event of an
-     error return from the `wait' function.
-*/
-
-typedef struct _jack_driver {
-
-/* The _jack_driver structure fields are included at the beginning of
-   each driver-specific structure using the JACK_DRIVER_DECL macro,
-   which is defined below.  The comments that follow describe each
-   common field.
-  
-   The driver should set this to be the interval it expects to elapse
-   between returning from the `wait' function. if set to zero, it
-   implies that the driver does not expect regular periodic wakeups.
-
-    jack_time_t period_usecs;
-
-
-   The driver should set this within its "wait" function to indicate
-   the UST of the most recent determination that the engine cycle
-   should run. it should not be set if the "extra_fd" argument of
-   the wait function is set to a non-zero value.
-
-    jack_time_t last_wait_ust;
-
-
-   These are not used by the driver.  They should not be written to or
-   modified in any way
- 
-    void *handle;
-    struct _jack_internal_client *internal_client;
-
-   This should perform any cleanup associated with the driver. it will
-   be called when jack server process decides to get rid of the
-   driver. in some systems, it may not be called at all, so the driver
-   should never rely on a call to this. it can set it to NULL if
-   it has nothing do do.
-
-    void (*finish)(struct _jack_driver *);
-
-
-   The JACK engine will call this when it wishes to attach itself to
-   the driver. the engine will pass a pointer to itself, which the driver
-   may use in anyway it wishes to. the driver may assume that this
-   is the same engine object that will make `wait' calls until a
-   `detach' call is made.
-
-    JackDriverAttachFunction attach;
-
-
-   The JACK engine will call this when it is finished using a driver.
-
-    JackDriverDetachFunction detach;
-
-
-   The JACK engine will call this when it wants to wait until the 
-   driver decides that its time to process some data. the driver returns
-   a count of the number of audioframes that can be processed. 
-
-   it should set the variable pointed to by `status' as follows:
-
-   zero: the wait completed normally, processing may begin
-   negative: the wait failed, and recovery is not possible
-   positive: the wait failed, and the driver stopped itself.
-	       a call to `start' will return the driver to	
-	       a correct and known state.
-
-   the driver should also fill out the `delayed_usecs' variable to
-   indicate any delay in its expected periodic execution. for example,
-   if it discovers that its return from poll(2) is later than it
-   expects it to be, it would place an estimate of the delay
-   in this variable. the engine will use this to decide if it 
-   plans to continue execution.
-
-    JackDriverWaitFunction wait;
-
-
-   The JACK engine will call this to ask the driver to move
-   data from its inputs to its output port buffers. it should
-   return 0 to indicate successful completion, negative otherwise. 
- 
-   This function will always be called after the wait function (above).
-
-    JackDriverReadFunction read;
-
-
-   The JACK engine will call this to ask the driver to move
-   data from its input port buffers to its outputs. it should
-   return 0 to indicate successful completion, negative otherwise. 
- 
-   this function will always be called after the read function (above).
-
-    JackDriverWriteFunction write;
-
-
-   The JACK engine will call this after the wait function (above) has
-   been called, but for some reason the engine is unable to execute
-   a full "cycle". the driver should do whatever is necessary to
-   keep itself running correctly, but cannot reference ports
-   or other JACK data structures in any way.
-
-    JackDriverNullCycleFunction null_cycle;
-
-    
-   The engine will call this when it plans to stop calling the `wait'
-   function for some period of time. the driver should take
-   appropriate steps to handle this (possibly no steps at all).
-   NOTE: the driver must silence its capture buffers (if any)
-   from within this function or the function that actually
-   implements the change in state.
-
-    JackDriverStopFunction stop;
-
-
-   The engine will call this to let the driver know that it plans
-   to start calling the `wait' function on a regular basis. the driver
-   should take any appropriate steps to handle this (possibly no steps
-   at all). NOTE: The driver may wish to silence its playback buffers
-   (if any) from within this function or the function that actually
-   implements the change in state.
-   
-    JackDriverStartFunction start;
-
-   The engine will call this to let the driver know that some client
-   has requested a new buffer size.  The stop function will be called
-   prior to this, and the start function after this one has returned.
-
-    JackDriverBufSizeFunction bufsize;
-*/
-
-/* define the fields here... */	
-#define JACK_DRIVER_DECL \
-    jack_time_t period_usecs; \
-    jack_time_t last_wait_ust; \
-    void *handle; \
-    struct _jack_client_internal * internal_client; \
-    void (*finish)(struct _jack_driver *);\
-    JackDriverAttachFunction attach; \
-    JackDriverDetachFunction detach; \
-    JackDriverReadFunction read; \
-    JackDriverWriteFunction write; \
-    JackDriverNullCycleFunction null_cycle; \
-    JackDriverStopFunction stop; \
-    JackDriverStartFunction start; \
-    JackDriverBufSizeFunction bufsize;
-
-    JACK_DRIVER_DECL			/* expand the macro */
-
-} jack_driver_t;
-
-
-typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
-
-void jack_driver_init (jack_driver_t *);
-void jack_driver_release (jack_driver_t *);
-
-jack_driver_t *jack_driver_load (int argc, char **argv);
-void jack_driver_unload (jack_driver_t *);
-
-
-/****************************
- *** Non-Threaded Drivers ***
- ****************************/
-
-/* 
-   Call sequence summary:
-
-     1) engine loads driver via runtime dynamic linking
-	 - calls jack_driver_load
-	 - we call dlsym for "driver_initialize" and execute it
-         - driver_initialize calls jack_driver_nt_init
-     2) nt layer attaches to driver
-     3) nt layer starts driver
-     4) nt layer runs a thread, calling
-         while () {
-           driver->nt_run_ctcle();
-         }
-     5) nt layer stops driver
-     6) nt layer detaches driver
-     7) engine calls driver `finish' routine which calls jack_driver_nt_finish
-
-     Note that stop/start may be called multiple times in the event of an
-     error return from the `wait' function.
-
-
-*/
-
-struct _jack_driver_nt;
-
-typedef int       (*JackDriverNTAttachFunction)(struct _jack_driver_nt *);
-typedef int       (*JackDriverNTDetachFunction)(struct _jack_driver_nt *);
-typedef int       (*JackDriverNTStopFunction)(struct _jack_driver_nt *);
-typedef int       (*JackDriverNTStartFunction)(struct _jack_driver_nt *);
-typedef int	  (*JackDriverNTBufSizeFunction)(struct _jack_driver_nt *,
-					       jack_nframes_t nframes);
-typedef int       (*JackDriverNTRunCycleFunction)(struct _jack_driver_nt *);
-
-typedef struct _jack_driver_nt {
-
-#define JACK_DRIVER_NT_DECL \
-    JACK_DRIVER_DECL \
-    struct _jack_engine * engine; \
-    volatile int nt_run; \
-    pthread_t nt_thread; \
-    pthread_mutex_t nt_run_lock; \
-    JackDriverNTAttachFunction nt_attach; \
-    JackDriverNTDetachFunction nt_detach; \
-    JackDriverNTStopFunction nt_stop; \
-    JackDriverNTStartFunction nt_start; \
-    JackDriverNTBufSizeFunction nt_bufsize; \
-    JackDriverNTRunCycleFunction nt_run_cycle;
-#define nt_read read
-#define nt_write write
-#define nt_null_cycle null_cycle
-
-    JACK_DRIVER_NT_DECL
-
-
-} jack_driver_nt_t;
-
-void jack_driver_nt_init   (jack_driver_nt_t * driver);
-void jack_driver_nt_finish (jack_driver_nt_t * driver);
-
-
-#endif /* __jack_driver_h__ */
diff --git a/jack/driver_interface.h b/jack/driver_interface.h
deleted file mode 100644
index 1112ac9..0000000
--- a/jack/driver_interface.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-    Copyright (C) 2003 Bob Ham <rah at bash.sh>
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_driver_interface_h__
-#define __jack_driver_interface_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <limits.h>
-
-#include <jack/jack.h>
-#include <jack/internal.h>
-
-#define JACK_DRIVER_NAME_MAX          15
-#define JACK_DRIVER_PARAM_NAME_MAX    15
-#define JACK_DRIVER_PARAM_STRING_MAX  63
-
-
-/** Driver parameter types */
-typedef enum
-{
-  JackDriverParamInt = 1,
-  JackDriverParamUInt,
-  JackDriverParamChar,
-  JackDriverParamString,
-  JackDriverParamBool
-
-} jack_driver_param_type_t;
-
-/** Driver parameter value */
-typedef union
-{
-  uint32_t  ui;
-  int32_t   i;
-  char      c;
-  char      str[JACK_DRIVER_PARAM_STRING_MAX+1];
-} jack_driver_param_value_t;
-
-
-/** A driver parameter descriptor */
-typedef struct
-{
-  char name[JACK_DRIVER_NAME_MAX+1]; /**< The parameter's name */
-  char character;                    /**< The parameter's character (for getopt, etc) */
-  jack_driver_param_type_t type;     /**< The parameter's type */
-  jack_driver_param_value_t value;   /**< The parameter's (default) value */
-  char short_desc[64];               /**< A short (~30 chars) description for the user */
-  char long_desc[1024];              /**< A longer description for the user */
-
-} jack_driver_param_desc_t;
-
-/** A driver parameter */
-typedef struct
-{
-  char character;
-  jack_driver_param_value_t value;
-} jack_driver_param_t;
-
-
-/** A struct for describing a jack driver */
-typedef struct
-{
-  char name[JACK_DRIVER_NAME_MAX+1];        /**< The driver's canonical name */
-  char file[PATH_MAX+1];                    /**< The filename of the driver's shared object file */
-  uint32_t nparams;                         /**< The number of parameters the driver has */
-  jack_driver_param_desc_t * params;        /**< An array of parameter descriptors */
-  
-} jack_driver_desc_t;
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_driver_interface_h__ */
-
-
diff --git a/jack/driver_parse.h b/jack/driver_parse.h
deleted file mode 100644
index d6d63b7..0000000
--- a/jack/driver_parse.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- mode: c; c-file-style: "linux"; -*- */
-/*
-  Copyright (C) 2003 Bob Ham <rah at bash.sh
-    
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_driver_parse_h__
-#define __jack_driver_parse_h__
-
-#include <jack/jslist.h>
-#include <jack/driver_interface.h>
-
-static void
-jack_print_driver_options (jack_driver_desc_t * desc, FILE *file)
-{
-	unsigned long i;
-	char arg_default[JACK_DRIVER_PARAM_STRING_MAX + 1];
-
-	for (i = 0; i < desc->nparams; i++) {
-		switch (desc->params[i].type) {
-		case JackDriverParamInt:
-			sprintf (arg_default, "%" PRId32, desc->params[i].value.i);
-			break;
-		case JackDriverParamUInt:
-			sprintf (arg_default, "%" PRIu32, desc->params[i].value.ui);
-			break;
-		case JackDriverParamChar:
-			sprintf (arg_default, "%c", desc->params[i].value.c);
-			break;
-		case JackDriverParamString:
-			if (desc->params[i].value.str &&
-			    strcmp (desc->params[i].value.str, "") != 0)
-				sprintf (arg_default, "%s", desc->params[i].value.str);
-			else
-				sprintf (arg_default, "none");
-			break;
-		case JackDriverParamBool:
-			sprintf (arg_default, "%s", desc->params[i].value.i ? "true" : "false");
-			break;
-		}
-
-		fprintf (file, "\t-%c, --%s \t%s (default: %s)\n",
-			 desc->params[i].character,
-			 desc->params[i].name,
-			 desc->params[i].short_desc,
-			 arg_default);
-	}
-}
-
-static void
-jack_print_driver_param_usage (jack_driver_desc_t * desc, unsigned long param, FILE *file)
-{
-	fprintf (file, "Usage information for the '%s' parameter for driver '%s':\n",
-		 desc->params[param].name, desc->name);
- 
-	fprintf (file, "%s\n", desc->params[param].long_desc);
-}
-
-
-static int
-jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSList ** param_ptr)
-{
-	struct option * long_options;
-	char * options, * options_ptr;
-	unsigned long i;
-	int opt, param_index;
-	JSList * params = NULL;
-	jack_driver_param_t * driver_param;
-
-	if (argc <= 1) {
-		*param_ptr = NULL;
-		return 0;
-	}
-
-	/* check for help */
-	if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
-		if (argc > 2) {
-			for (i = 0; i < desc->nparams; i++) {
-				if (strcmp (desc->params[i].name, argv[2]) == 0) {
-					jack_print_driver_param_usage (desc, i, stdout);
-					return 1;
-				}
-			}
-
-			fprintf (stderr, "jackd: unknown option '%s' "
-				 "for driver '%s'\n", argv[2],
-				 desc->name);
-		}
-
-		printf ("Parameters for driver '%s' (all parameters are optional):\n", desc->name);
-		jack_print_driver_options (desc, stdout);
-		return 1;
-	}
-
-
-	/* set up the stuff for getopt */
-	options = calloc (desc->nparams*3 + 1, sizeof (char));
-	long_options = calloc (desc->nparams + 1, sizeof (struct option));
-
-	options_ptr = options;
-	for (i = 0; i < desc->nparams; i++) {
-		sprintf (options_ptr, "%c::", desc->params[i].character);
-		options_ptr += 3;
-		
-		long_options[i].name    = desc->params[i].name;
-		long_options[i].flag    = NULL;
-		long_options[i].val     = desc->params[i].character;
-		long_options[i].has_arg = optional_argument;
-	}
-
-	/* create the params */
-	optind = 0;
-	opterr = 0;
-	while ((opt = getopt_long(argc, argv, options, long_options, NULL)) != -1) {
-
-		if (opt == ':' || opt == '?') {
-			if (opt == ':') {
-				fprintf (stderr, "Missing option to argument '%c'\n", optopt);
-			} else {
-				fprintf (stderr, "Unknownage with option '%c'\n", optopt);
-			}
-
-			fprintf (stderr, "Options for driver '%s':\n", desc->name);
-			jack_print_driver_options (desc, stderr);
-			exit (1);
-		}
-
-		for (param_index = 0; param_index < desc->nparams; param_index++) {
-			if (opt == desc->params[param_index].character) {
-				break;
-			}
-		}
-
-		driver_param = calloc (1, sizeof (jack_driver_param_t));
-
-		driver_param->character = desc->params[param_index].character;
-
-		if (!optarg && optind < argc &&
-		    strlen(argv[optind]) &&
-		    argv[optind][0] != '-') {
-			optarg = argv[optind];
-		}
-
-		if (optarg) {
-			switch (desc->params[param_index].type) {
-			case JackDriverParamInt:
-				driver_param->value.i = atoi (optarg);
-				break;
-			case JackDriverParamUInt:
-				driver_param->value.ui = strtoul (optarg, NULL, 10);
-				break;
-			case JackDriverParamChar:
-				driver_param->value.c = optarg[0];
-				break;
-			case JackDriverParamString:
-				strncpy (driver_param->value.str, optarg, JACK_DRIVER_PARAM_STRING_MAX);
-				break;
-			case JackDriverParamBool:
-
-				if (strcasecmp ("false",  optarg) == 0 ||
-				    strcasecmp ("off",    optarg) == 0 ||
-				    strcasecmp ("no",     optarg) == 0 ||
-				    strcasecmp ("0",      optarg) == 0 ||
-				    strcasecmp ("(null)", optarg) == 0   ) {
-
-					driver_param->value.i = FALSE;
-
-				} else {
-
-					driver_param->value.i = TRUE;
-
-				}
-				break;
-			}
-                } else {
-			if (desc->params[param_index].type == JackDriverParamBool) {
-				driver_param->value.i = TRUE;
-			} else {
-				driver_param->value = desc->params[param_index].value;
-			}
-		}
-
-		params = jack_slist_append (params, driver_param);
-	}
-
-	free (options);
-	free (long_options);
-
-	if (param_ptr)
-		*param_ptr = params;
-
-	return 0;
-}
-
-
-#endif /* __jack_driver_parse_h__ */
-
-
diff --git a/jack/engine.h b/jack/engine.h
deleted file mode 100644
index 23f7ee1..0000000
--- a/jack/engine.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_engine_h__
-#define __jack_engine_h__
-
-#include <jack/jack.h>
-#include <jack/internal.h>
-#include <jack/driver_interface.h>
-
-struct _jack_driver;
-struct _jack_client_internal;
-struct _jack_port_internal;
-
-/* Structures is allocated by the engine in local memory to keep track
- * of port buffers and connections. 
- */
-typedef struct {
-    jack_shm_info_t* shm_info;
-    jack_shmsize_t   offset;
-} jack_port_buffer_info_t;
-
-/* The engine keeps an array of these in its local memory. */
-typedef struct _jack_port_internal {
-    struct _jack_port_shared *shared;
-    JSList                   *connections;
-    jack_port_buffer_info_t  *buffer_info;
-} jack_port_internal_t;
-
-/* The engine's internal port type structure. */
-typedef struct _jack_port_buffer_list {
-    pthread_mutex_t          lock;	/* only lock within server */
-    JSList	            *freelist;	/* list of free buffers */
-    jack_port_buffer_info_t *info;	/* jack_buffer_info_t array */
-} jack_port_buffer_list_t;
-
-#define JACKD_WATCHDOG_TIMEOUT 10000
-#define JACKD_CLIENT_EVENT_TIMEOUT 2000
-
-/* The main engine structure in local memory. */
-struct _jack_engine {
-    jack_control_t        *control;
-
-    JSList                *drivers;
-    struct _jack_driver   *driver;
-    jack_driver_desc_t    *driver_desc;
-    JSList                *driver_params;
-
-    /* these are "callbacks" made by the driver backend */
-    int  (*set_buffer_size) (struct _jack_engine *, jack_nframes_t frames);
-    int  (*set_sample_rate) (struct _jack_engine *, jack_nframes_t frames);
-    int  (*run_cycle)	    (struct _jack_engine *, jack_nframes_t nframes,
-			     float delayed_usecs);
-    void (*delay)	    (struct _jack_engine *, float delayed_usecs);
-    void (*transport_cycle_start) (struct _jack_engine *, jack_time_t time);
-    void (*driver_exit)     (struct _jack_engine *);
-
-    /* "private" sections starts here */
-
-    /* engine serialization -- use precedence for deadlock avoidance */
-    pthread_mutex_t request_lock; /* precedes client_lock */
-    pthread_rwlock_t client_lock;
-    pthread_mutex_t port_lock;
-    pthread_mutex_t problem_lock; /* must hold write lock on client_lock */
-    int		    process_errors;
-    int		    period_msecs;
-
-    /* Time to wait for clients in msecs.  Used when jackd is run
-     * without realtime priority enabled. */
-    int		    client_timeout_msecs;
-
-    /* info on the shm segment containing this->control */
-
-    jack_shm_info_t control_shm;
-
-    /* address-space local port buffer and segment info, 
-       indexed by the port type_id 
-    */
-    jack_port_buffer_list_t port_buffers[JACK_MAX_PORT_TYPES];
-    jack_shm_info_t         port_segment[JACK_MAX_PORT_TYPES];
-
-    unsigned int    port_max;
-    pthread_t	    server_thread;
-    pthread_t	    watchdog_thread;
-
-    int		    fds[2];
-    int		    cleanup_fifo[2];
-    jack_client_id_t next_client_id;
-    size_t	    pfd_size;
-    size_t	    pfd_max;
-    struct pollfd  *pfd;
-    char	    fifo_prefix[PATH_MAX+1];
-    int		   *fifo;
-    unsigned long   fifo_size;
-    unsigned long   external_client_cnt;
-    int		    rtpriority;
-    char	    freewheeling;
-    char	    verbose;
-    char	    do_munlock;
-    const char	   *server_name;
-    char	    temporary;
-    int		    reordered;
-    int		    watchdog_check;
-    int		    feedbackcount;
-    int             removing_clients;
-    pid_t           wait_pid;
-    pthread_t       freewheel_thread;
-    int             nozombies;
-    volatile int    problems;
-
-    /* these lists are protected by `client_lock' */
-    JSList	   *clients;
-    JSList	   *clients_waiting;
-
-    jack_port_internal_t    *internal_ports;
-    jack_client_internal_t  *timebase_client;
-    jack_port_buffer_info_t *silent_buffer;
-    jack_client_internal_t  *current_client;
-
-#define JACK_ENGINE_ROLLING_COUNT 32
-#define JACK_ENGINE_ROLLING_INTERVAL 1024
-
-    jack_time_t rolling_client_usecs[JACK_ENGINE_ROLLING_COUNT];
-    int		    rolling_client_usecs_cnt;
-    int		    rolling_client_usecs_index;
-    int		    rolling_interval;
-    float	    max_usecs;
-    float	    spare_usecs;
-
-    int first_wakeup;
-    
-#ifdef JACK_USE_MACH_THREADS
-    /* specific resources for server/client real-time thread communication */
-    mach_port_t servertask, bp;
-    int portnum;
-#endif
-
-    /* used for port names munging */
-    int audio_out_cnt;
-    int audio_in_cnt;
-    int midi_out_cnt;
-    int midi_in_cnt;
-};
-
-/* public functions */
-
-jack_engine_t  *jack_engine_new (int real_time, int real_time_priority,
-				 int do_mlock, int do_unlock,
-				 const char *server_name, int temporary,
-				 int verbose, int client_timeout,
-				 unsigned int port_max,
-                                 pid_t waitpid, jack_nframes_t frame_time_offset, int nozombies, 
-				 JSList *drivers);
-void		jack_engine_delete (jack_engine_t *);
-int		jack_run (jack_engine_t *engine);
-int		jack_wait (jack_engine_t *engine);
-int		jack_engine_load_driver (jack_engine_t *engine,
-					 jack_driver_desc_t * driver_desc,
-					 JSList * driver_params);
-void		jack_dump_configuration(jack_engine_t *engine, int take_lock);
-
-/* private engine functions */
-void		jack_engine_reset_rolling_usecs (jack_engine_t *engine);
-int		internal_client_request (void* ptr, jack_request_t *request);
-int		jack_get_fifo_fd (jack_engine_t *engine,
-				  unsigned int which_fifo);
-
-extern jack_timer_type_t clock_source;
-
-extern jack_client_internal_t *
-jack_client_internal_by_id (jack_engine_t *engine, jack_client_id_t id);
-
-#define jack_rdlock_graph(e) { DEBUG ("acquiring graph read lock"); if (pthread_rwlock_rdlock (&e->client_lock)) abort(); }
-#define jack_lock_graph(e) { DEBUG ("acquiring graph write lock"); if (pthread_rwlock_wrlock (&e->client_lock)) abort(); }
-#define jack_try_rdlock_graph(e) pthread_rwlock_tryrdlock (&e->client_lock)
-#define jack_unlock_graph(e) { DEBUG ("release graph lock"); if (pthread_rwlock_unlock (&e->client_lock)) abort(); }
-
-#define jack_trylock_problems(e) pthread_mutex_trylock (&e->problem_lock)
-#define jack_lock_problems(e) { DEBUG ("acquiring problem lock"); if (pthread_mutex_lock (&e->problem_lock)) abort(); }
-#define jack_unlock_problems(e) { DEBUG ("release problem lock"); if (pthread_mutex_unlock (&e->problem_lock)) abort(); }
-
-#if 0
-static inline void jack_rdlock_graph (jack_engine_t* engine) {
-	DEBUG ("acquiring graph read lock");
-	pthread_rwlock_rdlock (&engine->client_lock);
-}
-
-static inline void jack_lock_graph (jack_engine_t* engine) {
-	DEBUG ("acquiring graph lock");
-	pthread_rwlock_wrlock (&engine->client_lock);
-}
-
-static inline int jack_try_rdlock_graph (jack_engine_t *engine)
-{
-	DEBUG ("TRYING to acquiring graph read lock");
-	return pthread_rwlock_tryrdlock (&engine->client_lock);
-}
-
-static inline void jack_unlock_graph (jack_engine_t* engine) 
-{
-	DEBUG ("releasing graph lock");
-	pthread_rwlock_unlock (&engine->client_lock);
-}
-#endif
-
-static inline unsigned int jack_power_of_two (unsigned int n)
-{
-	return !(n & (n - 1));
-}
-
-/* Internal port handling interfaces for JACK engine. */
-void	jack_port_clear_connections (jack_engine_t *engine,
-				     jack_port_internal_t *port);
-void	jack_port_registration_notify (jack_engine_t *, jack_port_id_t, int);
-void	jack_port_release (jack_engine_t *engine, jack_port_internal_t *);
-void	jack_sort_graph (jack_engine_t *engine);
-
-#endif /* __jack_engine_h__ */
diff --git a/jack/hardware.h b/jack/hardware.h
deleted file mode 100644
index 01aefca..0000000
--- a/jack/hardware.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_hardware_h__
-#define __jack_hardware_h__
-
-#include <jack/types.h>
-
-typedef	enum  {
-	AutoSync,
-	WordClock,
-	ClockMaster
-} SampleClockMode;
-
-typedef enum {
-	Cap_HardwareMonitoring = 0x1,
-	Cap_AutoSync = 0x2,
-	Cap_WordClock = 0x4,
-	Cap_ClockMaster = 0x8,
-	Cap_ClockLockReporting = 0x10,
-	Cap_HardwareMetering = 0x20
-} Capabilities;
-
-struct _jack_hardware;
-
-typedef void (*JackHardwareReleaseFunction)(struct _jack_hardware *);
-typedef int (*JackHardwareSetInputMonitorMaskFunction)(struct _jack_hardware *, unsigned long);
-typedef int (*JackHardwareChangeSampleClockFunction)(struct _jack_hardware *, SampleClockMode);
-typedef double (*JackHardwareGetHardwarePeak)(jack_port_t *port, jack_nframes_t frames);
-typedef double (*JackHardwareGetHardwarePower)(jack_port_t *port, jack_nframes_t frames);
-
-
-typedef struct _jack_hardware {
-
-    unsigned long capabilities;
-    unsigned long input_monitor_mask;
-
-    JackHardwareChangeSampleClockFunction change_sample_clock;
-    JackHardwareSetInputMonitorMaskFunction set_input_monitor_mask;
-    JackHardwareReleaseFunction release;
-    JackHardwareGetHardwarePeak get_hardware_peak;
-    JackHardwareGetHardwarePower get_hardware_power;
-    void *private;
-
-} jack_hardware_t;
-
-jack_hardware_t * jack_hardware_new ();
-
-#endif /* __jack_hardware_h__ */
diff --git a/jack/intclient.h b/jack/intclient.h
deleted file mode 100644
index 36883de..0000000
--- a/jack/intclient.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Copyright (C) 2004 Jack O'Quin
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation; either version 2.1 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *  
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software 
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __jack_intclient_h__
-#define __jack_intclient_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <jack/types.h>
-
-/**
- * Get an internal client's name.  This is useful when @ref
- * JackUseExactName was not specified on jack_internal_client_load()
- * and @ref JackNameNotUnique status was returned.  In that case, the
- * actual name will differ from the @a client_name requested.
- *
- * @param client requesting JACK client's handle.
- *
- * @param intclient handle returned from jack_internal_client_load()
- * or jack_internal_client_handle().
- *
- * @return NULL if unsuccessful, otherwise pointer to the internal
- * client name obtained from the heap via malloc().  The caller should
- * free() this storage when no longer needed.
- */
-char *jack_get_internal_client_name (jack_client_t *client,
-				     jack_intclient_t intclient);
-
-/**
- * Return the @ref jack_intclient_t handle for an internal client
- * running in the JACK server.
- *
- * @param client requesting JACK client's handle.
- *
- * @param client_name for the internal client of no more than
- * jack_client_name_size() characters.  The name scope is local to the
- * current server.
- *
- * @param status (if non-NULL) an address for JACK to return
- * information from this operation.  This status word is formed by
- * OR-ing together the relevant @ref JackStatus bits.
- *
- * @return Opaque internal client handle if successful.  If 0, the
- * internal client was not found, and @a *status includes the @ref
- * JackNoSuchClient and @ref JackFailure bits.
- */
-jack_intclient_t jack_internal_client_handle (jack_client_t *client,
-					      const char *client_name,
-					      jack_status_t *status);
-
-/**
- * Load an internal client into the JACK server.
- *
- * Internal clients run inside the JACK server process.  They can use
- * most of the same functions as external clients.  Each internal
- * client is built as a shared object module, which must declare
- * jack_initialize() and jack_finish() entry points called at load and
- * unload times.  See @ref inprocess.c for an example.
- *
- * @param client loading JACK client's handle.
- *
- * @param client_name of at most jack_client_name_size() characters
- * for the internal client to load.  The name scope is local to the
- * current server.
- *
- * @param options formed by OR-ing together @ref JackOptions bits.
- * Only the @ref JackLoadOptions bits are valid.
- *
- * @param status (if non-NULL) an address for JACK to return
- * information from the load operation.  This status word is formed by
- * OR-ing together the relevant @ref JackStatus bits.
- *
- * <b>Optional parameters:</b> depending on corresponding [@a options
- * bits] additional parameters may follow @a status (in this order).
- *
- * @arg [@ref JackLoadName] <em>(char *) load_name</em> is the shared
- * object file from which to load the new internal client (otherwise
- * use the @a client_name).
- *
- * @arg [@ref JackLoadInit] <em>(char *) load_init</em> an arbitary
- * string passed to the internal client's jack_initialize() routine
- * (otherwise NULL), of no more than @ref JACK_LOAD_INIT_LIMIT bytes.
- *
- * @return Opaque internal client handle if successful.  If this is 0,
- * the load operation failed, the internal client was not loaded, and
- * @a *status includes the @ref JackFailure bit.
- */
-jack_intclient_t jack_internal_client_load (jack_client_t *client,
-					    const char *client_name,
-					    jack_options_t options,
-					    jack_status_t *status, ...);
-/**
- * Unload an internal client from a JACK server.  This calls the
- * intclient's jack_finish() entry point then removes it.  See @ref
- * inprocess.c for an example.
- *
- * @param client unloading JACK client's handle.
- *
- * @param intclient handle returned from jack_internal_client_load() or
- * jack_internal_client_handle().
- *
- * @return 0 if successful, otherwise @ref JackStatus bits.
- */
-jack_status_t jack_internal_client_unload (jack_client_t *client,
-					   jack_intclient_t intclient);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_intclient_h__ */
diff --git a/jack/internal.h b/jack/internal.h
deleted file mode 100644
index b51ef44..0000000
--- a/jack/internal.h
+++ /dev/null
@@ -1,526 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Internal shared data and functions.
-
-    If you edit this file, you should carefully consider changing the
-    JACK_PROTOCOL_VERSION in configure.in.
-
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_internal_h__
-#define __jack_internal_h__
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <dlfcn.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#ifndef POST_PACKED_STRUCTURE
-#ifdef __GNUC__
-/* POST_PACKED_STRUCTURE needs to be a macro which
-   expands into a compiler directive. The directive must
-   tell the compiler to arrange the preceding structure
-   declaration so that it is packed on byte-boundaries rather 
-   than use the natural alignment of the processor and/or
-   compiler.
-*/
-#define POST_PACKED_STRUCTURE __attribute__((__packed__))
-#else
-/* Add other things here for non-gcc platforms */
-#endif
-#endif
-
-/* Needed by <sysdeps/time.h> */
-extern void jack_error (const char *fmt, ...);
-
-extern void jack_info (const char *fmt, ...);
-
-#include <jack/jack.h>
-#include <jack/types.h>
-#include <jack/port.h>
-#include <jack/transport.h>
-#include <jack/thread.h>
-
-extern jack_thread_creator_t jack_thread_creator;
-
-typedef enum {
-	JACK_TIMER_SYSTEM_CLOCK,
-	JACK_TIMER_CYCLE_COUNTER,
-	JACK_TIMER_HPET,
-} jack_timer_type_t;
-
-void        jack_init_time ();
-void        jack_set_clock_source (jack_timer_type_t);
-const char* jack_clock_source_name (jack_timer_type_t);
-
-#include <sysdeps/time.h>
-#include <sysdeps/atomicity.h>
-
-#ifdef JACK_USE_MACH_THREADS
-#include <sysdeps/mach_port.h>
-#endif
-
-#include <jack/messagebuffer.h>
-
-#ifndef PATH_MAX
-    #ifdef MAXPATHLEN
-	#define PATH_MAX MAXPATHLEN
-    #else
-	#define PATH_MAX 1024
-    #endif /* MAXPATHLEN */
-#endif /* !PATH_MAX */
-
-#ifdef DEBUG_ENABLED
-
-/* grab thread id instead of PID on linux */
-#if defined(__gnu_linux__)
-    #ifdef gettid  /* glibc has a version */
-        #define GETTID() gettid()
-    #else /* use our own version */
-        #include <sys/syscall.h>
-        #define GETTID() syscall(__NR_gettid)
-    #endif
-#else
-    #define GETTID() getpid()
-#endif
-
-#define DEBUG(format,args...) \
-	MESSAGE("jack:%5d:%" PRIu64 " %s:%s:%d: " format "", GETTID(), jack_get_microseconds(), __FILE__, __FUNCTION__, __LINE__ , ## args)
-
-#else
-#if JACK_CPP_VARARGS_BROKEN
-    #define DEBUG(format...)
-#else
-    #define DEBUG(format,args...)
-#endif
-#endif
-
-/* Enable preemption checking for Linux Realtime Preemption kernels.
- *
- * This checks if any RT-safe code section does anything to cause CPU
- * preemption.  Examples are sleep() or other system calls that block.
- * If a problem is detected, the kernel writes a syslog entry, and
- * sends SIGUSR2 to the client.
- */
-#ifdef DO_PREEMPTION_CHECKING
-#define CHECK_PREEMPTION(engine, onoff) \
-	if ((engine)->real_time) gettimeofday (1, (onoff))
-#else
-#define CHECK_PREEMPTION(engine, onoff)
-#endif
-
-#ifndef	FALSE
-#define	FALSE	(0)
-#endif
-
-#ifndef	TRUE
-#define	TRUE	(1)
-#endif
-
-typedef struct _jack_engine  jack_engine_t;
-typedef struct _jack_request jack_request_t;
-
-typedef void * dlhandle;
-
-typedef enum {
-    TransportCommandNone = 0,
-    TransportCommandStart = 1,
-    TransportCommandStop = 2,
-} transport_command_t;
-
-typedef struct {
-
-	volatile uint32_t       guard1;
-	volatile jack_nframes_t frames;  
-	volatile jack_time_t    current_wakeup;
-	volatile jack_time_t    next_wakeup;
-	volatile float          second_order_integrator;
-	volatile int32_t        initialized;
-	volatile uint32_t       guard2;
-	
-	/* not accessed by clients */
-
-	int32_t  reset_pending;      /* xrun happened, deal with it */
-	float    filter_coefficient; /* set once, never altered */
-
-} POST_PACKED_STRUCTURE jack_frame_timer_t;
-
-/* JACK engine shared memory data structure. */
-typedef struct {
-
-    jack_transport_state_t transport_state;
-    volatile transport_command_t transport_cmd;
-    transport_command_t	  previous_cmd;	/* previous transport_cmd */
-    jack_position_t	  current_time;	/* position for current cycle */
-    jack_position_t	  pending_time;	/* position for next cycle */
-    jack_position_t	  request_time;	/* latest requested position */
-    jack_unique_t	  prev_request; /* previous request unique ID */
-    volatile _Atomic_word seq_number;	/* unique ID sequence number */
-    int8_t		  new_pos;	/* new position this cycle */
-    int8_t		  pending_pos;	/* new position request pending */
-    jack_nframes_t	  pending_frame; /* pending frame number */
-    int32_t		  sync_clients;	/* number of active_slowsync clients */
-    int32_t		  sync_remain;	/* number of them with sync_poll */
-    jack_time_t           sync_timeout;
-    jack_time_t           sync_time_left;
-    jack_frame_timer_t    frame_timer;
-    int32_t		  internal;
-    jack_timer_type_t     clock_source;
-    pid_t                 engine_pid;
-    jack_nframes_t	  buffer_size;
-    int8_t		  real_time;
-    int8_t		  do_mlock;
-    int8_t		  do_munlock;
-    int32_t		  client_priority;
-    int32_t		  max_client_priority;
-    int32_t		  has_capabilities;
-    float                 cpu_load;
-    float		  xrun_delayed_usecs;
-    float		  max_delayed_usecs;
-    uint32_t		  port_max;
-    int32_t		  engine_ok;
-    jack_port_type_id_t	  n_port_types;
-    jack_port_type_info_t port_types[JACK_MAX_PORT_TYPES];
-    jack_port_shared_t    ports[0];
-
-} POST_PACKED_STRUCTURE jack_control_t;
-
-typedef enum  {
-  BufferSizeChange,
-  SampleRateChange,
-  AttachPortSegment,
-  PortConnected,
-  PortDisconnected,
-  GraphReordered,
-  PortRegistered,
-  PortUnregistered,
-  XRun,
-  StartFreewheel,
-  StopFreewheel,
-  ClientRegistered,
-  ClientUnregistered
-} JackEventType;
-
-typedef struct {
-    JackEventType type;
-    union {
-	uint32_t n;
-        char name[JACK_CLIENT_NAME_SIZE];    
-	jack_port_id_t port_id;
-	jack_port_id_t self_id;
-    } x;
-    union {
-	uint32_t n;
-	jack_port_type_id_t ptid;
-	jack_port_id_t other_id;
-    } y;
-} POST_PACKED_STRUCTURE jack_event_t;
-
-typedef enum {
-	ClientInternal, /* connect request just names .so */
-	ClientDriver,   /* code is loaded along with driver */
-	ClientExternal  /* client is in another process */
-} ClientType;
-
-typedef enum {
-	NotTriggered,
-	Triggered,
-	Running,
-	Finished
-} jack_client_state_t;
-
-/* JACK client shared memory data structure. */
-typedef volatile struct {
-
-    volatile jack_client_id_t id;         /* w: engine r: engine and client */
-    volatile jack_nframes_t  nframes;     /* w: engine r: client */
-    volatile jack_client_state_t state;   /* w: engine and client r: engine */
-    volatile char	name[JACK_CLIENT_NAME_SIZE];
-    volatile ClientType type;             /* w: engine r: engine and client */
-    volatile int8_t     active;           /* w: engine r: engine and client */
-    volatile int8_t     dead;             /* r/w: engine */
-    volatile int8_t	timed_out;        /* r/w: engine */
-    volatile int8_t     is_timebase;	  /* w: engine, r: engine and client */
-    volatile int8_t     timebase_new;	  /* w: engine and client, r: engine */
-    volatile int8_t     is_slowsync;	  /* w: engine, r: engine and client */
-    volatile int8_t     active_slowsync;  /* w: engine, r: engine and client */
-    volatile int8_t     sync_poll;        /* w: engine and client, r: engine */
-    volatile int8_t     sync_new;         /* w: engine and client, r: engine */
-    volatile pid_t      pid;              /* w: client r: engine; client pid */
-    volatile pid_t      pgrp;             /* w: client r: engine; client pgrp */
-    volatile uint64_t	signalled_at;
-    volatile uint64_t	awake_at;
-    volatile uint64_t	finished_at;
-    volatile int32_t	last_status;         /* w: client, r: engine and client */
-
-    /* indicators for whether callbacks have been set for this client.
-       We do not include ptrs to the callbacks here (or their arguments)
-       so that we can avoid 32/64 bit pointer size mismatches between
-       the jack server and a client. The pointers are in the client-
-       local structure which is part of the libjack compiled for
-       either 32 bit or 64 bit clients.
-     */
-    volatile uint8_t	process_cbset;
-    volatile uint8_t	thread_init_cbset;
-    volatile uint8_t	bufsize_cbset;
-    volatile uint8_t	srate_cbset;
-    volatile uint8_t	port_register_cbset;
-    volatile uint8_t	port_connect_cbset;
-    volatile uint8_t	graph_order_cbset;
-    volatile uint8_t	xrun_cbset;
-    volatile uint8_t	sync_cb_cbset;
-    volatile uint8_t	timebase_cb_cbset;
-    volatile uint8_t	freewheel_cb_cbset;
-    volatile uint8_t	client_register_cbset;
-    volatile uint8_t	thread_cb_cbset;
-
-} POST_PACKED_STRUCTURE jack_client_control_t;
-
-typedef struct {
-    
-    uint32_t	protocol_v;		/* protocol version, must go first */
-    int32_t    load;
-    ClientType type;
-    jack_options_t options;
-
-    char name[JACK_CLIENT_NAME_SIZE];
-    char object_path[PATH_MAX+1];
-    char object_data[1024];
-
-} POST_PACKED_STRUCTURE jack_client_connect_request_t;
-
-typedef struct {
-
-    jack_status_t status;
-
-    jack_shm_registry_index_t client_shm_index;
-    jack_shm_registry_index_t engine_shm_index;
-
-    char	fifo_prefix[PATH_MAX+1];
-
-    int32_t	realtime;
-    int32_t	realtime_priority;
-
-    char name[JACK_CLIENT_NAME_SIZE];	/* unique name, if assigned */
-
-    /* these are actually pointers, but they must
-       be the same size regardless of whether the
-       server and/or client are 64 bit or 32 bit.
-       force them to be 64 bit.
-    */
-
-    uint64_t client_control;
-    uint64_t engine_control;
-
-#ifdef JACK_USE_MACH_THREADS
-    /* specific resources for server/client real-time thread communication */
-    int32_t	portnum;
-#endif
-
-} POST_PACKED_STRUCTURE jack_client_connect_result_t;
-
-typedef struct {
-    jack_client_id_t client_id;
-} POST_PACKED_STRUCTURE jack_client_connect_ack_request_t;
-
-typedef struct {
-    int8_t status;
-} POST_PACKED_STRUCTURE jack_client_connect_ack_result_t;
-
-typedef enum {
-	RegisterPort = 1,
-	UnRegisterPort = 2,
-	ConnectPorts = 3,
-	DisconnectPorts = 4, 
-	SetTimeBaseClient = 5,
-	ActivateClient = 6,
-	DeactivateClient = 7,
-	DisconnectPort = 8,
-	SetClientCapabilities = 9,
-	GetPortConnections = 10,
-	GetPortNConnections = 11,
-	ResetTimeBaseClient = 12,
-	SetSyncClient = 13,
-	ResetSyncClient = 14,
-	SetSyncTimeout = 15,
-	SetBufferSize = 16,
-	FreeWheel = 17,
-	StopFreeWheel = 18,
-	IntClientHandle = 19,
-	IntClientLoad = 20,
-	IntClientName = 21,
-	IntClientUnload = 22,
-	RecomputeTotalLatencies = 23,
-	RecomputeTotalLatency = 24
-} RequestType;
-
-struct _jack_request {
-    
-    //RequestType type;
-    uint32_t type;
-    union {
-	struct {
-	    char name[JACK_PORT_NAME_SIZE];
-	    char type[JACK_PORT_TYPE_SIZE];
-	    uint32_t         flags;
-	    jack_shmsize_t   buffer_size;
-	    jack_port_id_t   port_id;
-	    jack_client_id_t client_id;
-	} POST_PACKED_STRUCTURE port_info;
-	struct {
-	    char source_port[JACK_PORT_NAME_SIZE];
-	    char destination_port[JACK_PORT_NAME_SIZE];
-	} POST_PACKED_STRUCTURE connect;
-	struct {
-	    int32_t nports;
-	    const char **ports;	/* this is only exposed to internal clients, so there
-				   is no 64/32 issue. external clients read the ports
-				   one by one from the server, and allocate their
-				   own "ports" array in their own address space.
-
-				   we are lucky, because this is part of a union
-				   whose other components are bigger than this one.
-				   otherwise it would change structure size when
-				   comparing the 64 and 32 bit versions.
-				*/
-	} POST_PACKED_STRUCTURE port_connections;
-	struct {
-	    jack_client_id_t client_id;
-	    int32_t conditional;
-	} POST_PACKED_STRUCTURE timebase;
-	struct {
-	    //jack_options_t options;
-	    uint32_t options;
-	    jack_client_id_t id;
-	    char name[JACK_CLIENT_NAME_SIZE];
-	    char path[PATH_MAX+1];
-	    char init[JACK_LOAD_INIT_LIMIT];
-	} POST_PACKED_STRUCTURE intclient;
-	jack_client_id_t client_id;
-	jack_nframes_t nframes;
-	jack_time_t timeout;
-        pid_t cap_pid;
-    } POST_PACKED_STRUCTURE x;
-    int32_t status;
-} POST_PACKED_STRUCTURE;
-
-/* Per-client structure allocated in the server's address space.
- * It's here because its not part of the engine structure.
- */
-
-typedef struct _jack_client_internal {
-
-    jack_client_control_t *control;
-
-    int        request_fd;
-    int        event_fd;
-    int        subgraph_start_fd;
-    int        subgraph_wait_fd;
-    JSList    *ports;    /* protected by engine->client_lock */
-    JSList    *truefeeds;    /* protected by engine->client_lock */
-    JSList    *sortfeeds;    /* protected by engine->client_lock */
-    int	       fedcount;
-    int	       tfedcount;
-    jack_shm_info_t control_shm;
-    unsigned long execution_order;
-    struct  _jack_client_internal *next_client; /* not a linked list! */
-    dlhandle handle;
-    int     (*initialize)(jack_client_t*, const char*); /* int. clients only */
-    void    (*finish)(void *);		/* internal clients only */
-    int      error;
-    
-#ifdef JACK_USE_MACH_THREADS
-    /* specific resources for server/client real-time thread communication */
-    mach_port_t serverport;
-    trivial_message message;
-    int running;
-    int portnum;
-#endif /* JACK_USE_MACH_THREADS */
-   
-    /* external clients: set by libjack
-     * internal clients: set by engine */
-    //int (*deliver_request)(void*, jack_request_t*); /* JOQ: 64/32 bug! */
-    //void *deliver_arg;
-    jack_client_t *private_client;
-} jack_client_internal_t;
-
-typedef struct _jack_thread_arg {
-	jack_client_t* client;
-	void* (*work_function)(void*);
-	int priority;
-	int realtime;
-	void* arg;
-	pid_t cap_pid;
-} jack_thread_arg_t;
-
-extern int  jack_client_handle_port_connection (jack_client_t *client,
-						jack_event_t *event);
-extern jack_client_t *jack_driver_client_new (jack_engine_t *,
-					      const char *client_name);
-extern jack_client_t *jack_client_alloc_internal (jack_client_control_t*,
-						  jack_engine_t*);
-
-/* internal clients call this. it's defined in jack/engine.c */
-void handle_internal_client_request (jack_control_t*, jack_request_t*);
-
-extern char *jack_tmpdir;
-
-extern char *jack_user_dir (void);
-
-extern char *jack_server_dir (const char *server_name, char *server_dir);
-
-extern void *jack_zero_filled_buffer;
-
-extern jack_port_functions_t jack_builtin_audio_functions;
-
-extern jack_port_type_info_t jack_builtin_port_types[];
-
-extern void jack_client_invalidate_port_buffers (jack_client_t *client);
-
-extern void jack_transport_copy_position (jack_position_t *from,
-					  jack_position_t *to);
-extern void jack_call_sync_client (jack_client_t *client);
-
-extern void jack_call_timebase_master (jack_client_t *client);
-
-extern char *jack_default_server_name (void);
-
-void silent_jack_error_callback (const char *desc);
-
-/* needed for port management */
-jack_port_t *jack_port_by_id_int (const jack_client_t *client,
-				  jack_port_id_t id, int* free);
-
-jack_port_t *jack_port_by_name_int (jack_client_t *client,
-				    const char *port_name);
-int jack_port_name_equals (jack_port_shared_t* port, const char* target);
-
-#ifdef __GNUC__
-#  define likely(x)	__builtin_expect((x),1)
-#  define unlikely(x)	__builtin_expect((x),0)
-#else
-#  define likely(x)	(x)
-#  define unlikely(x)	(x)
-#endif
-
-#endif /* __jack_internal_h__ */
-
diff --git a/jack/intsimd.h b/jack/intsimd.h
deleted file mode 100644
index 2377bd1..0000000
--- a/jack/intsimd.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2005-2007 Jussi Laako
-     
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
- 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- 
-*/
-
-#ifndef __jack_intsimd_h__
-#define __jack_intsimd_h__
-
-#ifdef USE_DYNSIMD
-#if (defined(__i386__) || defined(__x86_64__))
-#define ARCH_X86
-#endif /* __i386__ || __x86_64__ */
-#endif /* USE_DYNSIMD */
-
-#ifdef ARCH_X86
-#define ARCH_X86_SSE(x)		((x) & 0xff)
-#define ARCH_X86_HAVE_SSE2(x)	(ARCH_X86_SSE(x) >= 2)
-#define ARCH_X86_3DNOW(x)	((x) >> 8)
-#define ARCH_X86_HAVE_3DNOW(x)	(ARCH_X86_3DNOW(x))
-
-typedef float v2sf __attribute__((vector_size(8)));
-typedef float v4sf __attribute__((vector_size(16)));
-typedef v2sf * pv2sf;
-typedef v4sf * pv4sf;
-
-extern int cpu_type;
-
-int have_3dnow (void);
-int have_sse (void);
-void x86_3dnow_copyf (float *, const float *, int);
-void x86_3dnow_add2f (float *, const float *, int);
-void x86_sse_copyf (float *, const float *, int);
-void x86_sse_add2f (float *, const float *, int);
-void x86_sse_f2i (int *, const float *, int, float);
-void x86_sse_i2f (float *, const int *, int, float);
-
-#endif /* ARCH_X86 */
-
-void jack_port_set_funcs (void);
-
-#endif /* __jack_intsimd_h__ */
-
diff --git a/jack/jack.h b/jack/jack.h
deleted file mode 100644
index b76cdc1..0000000
--- a/jack/jack.h
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Copyright (C) 2004 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_h__
-#define __jack_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <pthread.h>
-
-#include <jack/types.h>
-#include <jack/transport.h>
-
-/**
- * Note: More documentation can be found in jack/types.h.
-
- */
-
-/*************************************************************
- * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
- * added to the JACK API after the 0.116.2 release.
- *************************************************************/
-
-#ifndef JACK_WEAK_EXPORT
-#ifdef __GNUC__
-/* JACK_WEAK_EXPORT needs to be a macro which
-   expands into a compiler directive. If non-null, the directive 
-   must tell the compiler to arrange for weak linkage of 
-   the symbol it used with. For this to work full may
-   require linker arguments in the client as well.
-*/
-#define JACK_WEAK_EXPORT __attribute__((weak))
-#else
-/* Add other things here for non-gcc platforms */
-#endif
-#endif
-
-
-/**
- * @defgroup ClientFunctions Creating & manipulating clients
- * @{
- */
-
-/**
- * Open an external client session with a JACK server.  This interface
- * is more complex but more powerful than jack_client_new().  With it,
- * clients may choose which of several servers to connect, and control
- * whether and how to start the server automatically, if it was not
- * already running.  There is also an option for JACK to generate a
- * unique client name, when necessary.
- *
- * @param client_name of at most jack_client_name_size() characters.
- * The name scope is local to each server.  Unless forbidden by the
- * @ref JackUseExactName option, the server will modify this name to
- * create a unique variant, if needed.
- *
- * @param options formed by OR-ing together @ref JackOptions bits.
- * Only the @ref JackOpenOptions bits are allowed.
- *
- * @param status (if non-NULL) an address for JACK to return
- * information from the open operation.  This status word is formed by
- * OR-ing together the relevant @ref JackStatus bits.
- *
- *
- * <b>Optional parameters:</b> depending on corresponding [@a options
- * bits] additional parameters may follow @a status (in this order).
- *
- * @arg [@ref JackServerName] <em>(char *) server_name</em> selects
- * from among several possible concurrent server instances.  Server
- * names are unique to each user.  If unspecified, use "default"
- * unless \$JACK_DEFAULT_SERVER is defined in the process environment.
- *
- * @return Opaque client handle if successful.  If this is NULL, the
- * open operation failed, @a *status includes @ref JackFailure and the
- * caller is not a JACK client.
- */
-jack_client_t *jack_client_open (const char *client_name,
-				 jack_options_t options,
-				 jack_status_t *status, ...);
-
-/**
- * <b>THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
- *  NEW JACK CLIENTS</b>
- *
- */
-jack_client_t *jack_client_new (const char *client_name);
-
-/**
- * Disconnects an external client from a JACK server.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_client_close (jack_client_t *client);
-
-/**
- * @return the maximum number of characters in a JACK client name
- * including the final NULL character.  This value is a constant.
- */
-int jack_client_name_size (void);
-
-/**
- * @return pointer to actual client name.  This is useful when @ref
- * JackUseExactName is not specified on open and @ref
- * JackNameNotUnique status was returned.  In that case, the actual
- * name will differ from the @a client_name requested.
- */
-char *jack_get_client_name (jack_client_t *client);
-
-/**
- * Load an internal client into the Jack server.
- *
- * Internal clients run inside the JACK server process.  They can use
- * most of the same functions as external clients.  Each internal
- * client must declare jack_initialize() and jack_finish() entry
- * points, called at load and unload times.  See inprocess.c for an
- * example of how to write an internal client.
- *
- * @deprecated Please use jack_internal_client_load().
- *
- * @param client_name of at most jack_client_name_size() characters.
- *
- * @param load_name of a shared object file containing the code for
- * the new client.
- *
- * @param load_init an arbitary string passed to the jack_initialize()
- * routine of the new client (may be NULL).
- *
- * @return 0 if successful.
- */
-int jack_internal_client_new (const char *client_name,
-			      const char *load_name,
-			      const char *load_init);
-
-/**
- * Remove an internal client from a JACK server.
- *
- * @deprecated Please use jack_internal_client_load().
- */
-void jack_internal_client_close (const char *client_name);
-
-/**
- * Tell the Jack server that the program is ready to start processing
- * audio.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_activate (jack_client_t *client);
-
-/**
- * Tell the Jack server to remove this @a client from the process
- * graph.  Also, disconnect all ports belonging to it, since inactive
- * clients have no port connections.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_deactivate (jack_client_t *client);
-
-/**
- * @return the pthread ID of the thread running the JACK client side
- * code.
- */
-pthread_t jack_client_thread_id (jack_client_t *);
-
-/*@}*/
-
-/**
- * @param client pointer to JACK client structure.
- *
- * Check if the JACK subsystem is running with -R (--realtime).
- *
- * @return 1 if JACK is running realtime, 0 otherwise
- */
-int jack_is_realtime (jack_client_t *client);
-
-/**
- * @defgroup NonCallbackAPI The non-callback API
- * @{
- */
-
-/**
- * <b>THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
- * NEW JACK CLIENTS</b>
- *
- * It should be replace by use of @ jack_cycle_wait and @ jack_cycle_signal functions.
- *
- */
-jack_nframes_t jack_thread_wait (jack_client_t*, int status);
-
-/**
- * Wait until this JACK client should process data.
- * 
- * @param client - pointer to a JACK client structure
- *
- * @return the number of frames of data to process
- */
-jack_nframes_t jack_cycle_wait (jack_client_t* client);
-	
-/**
- * Signal next clients in the graph.
- * 
- * @param client - pointer to a JACK client structure
- * @param status - if non-zero, calling thread should exit
- */
-void jack_cycle_signal (jack_client_t* client, int status);
-	
-/**
- * Tell the Jack server to call @a thread_callback in the RT thread.
- * Typical use are in conjunction with @a jack_cycle_wait and @ jack_cycle_signal functions.
- * The code in the supplied function must be suitable for real-time
- * execution. That means that it cannot call functions that might
- * block for a long time. This includes malloc, free, printf,
- * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
- * pthread_cond_wait, etc, etc. 
- *
- * @return 0 on success, otherwise a non-zero error code.
-*/    
-int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg);
-
-/*@}*/
-
-/**
- * @defgroup ClientCallbacks Setting Client Callbacks
- * @{
- */
-
-/**
- * Tell JACK to call @a thread_init_callback once just after
- * the creation of the thread in which all other callbacks 
- * will be handled.
- *
- * The code in the supplied function does not need to be
- * suitable for real-time execution.
- *
- * @return 0 on success, otherwise a non-zero error code, causing JACK
- * to remove that client from the process() graph.
- */
-int jack_set_thread_init_callback (jack_client_t *client,
-				   JackThreadInitCallback thread_init_callback,
-				   void *arg);
-
-/** 
- * @param client pointer to JACK client structure.
- * @param function The jack_shutdown function pointer.
- * @param arg The arguments for the jack_shutdown function.
- *
- * Register a function (and argument) to be called if and when the
- * JACK server shuts down the client thread.  The function must
- * be written as if it were an asynchonrous POSIX signal
- * handler --- use only async-safe functions, and remember that it
- * is executed from another thread.  A typical function might
- * set a flag or write to a pipe so that the rest of the
- * application knows that the JACK client thread has shut
- * down.
- *
- * NOTE: clients do not need to call this.  It exists only
- * to help more complex clients understand what is going
- * on.  It should be called before jack_client_activate().
- * 
- * NOTE: if a client calls this AND jack_on_info_shutdown(), then
- * the event of a client thread shutdown, the callback 
- * passed to this function will not be called, and the one passed to
- * jack_on_info_shutdown() will.
- */
-void jack_on_shutdown (jack_client_t *client,
-		       JackShutdownCallback function, void *arg);
-
-/**
- * @param client pointer to JACK client structure.
- * @param function The jack_shutdown function pointer.
- * @param arg The arguments for the jack_shutdown function.
- *
- * Register a function (and argument) to be called if and when the
- * JACK server shuts down the client thread.  The function must
- * be written as if it were an asynchonrous POSIX signal
- * handler --- use only async-safe functions, and remember that it
- * is executed from another thread.  A typical function might
- * set a flag or write to a pipe so that the rest of the
- * application knows that the JACK client thread has shut
- * down.
- *
- * NOTE: clients do not need to call this.  It exists only
- * to help more complex clients understand what is going
- * on.  It should be called before jack_client_activate().
- *
- * NOTE: if a client calls this AND jack_on_shutdown(), then in the
- * event of a client thread shutdown, the callback   passed to 
- * this function will be called, and the one passed to
- * jack_on_shutdown() will not.
- */
-void jack_on_info_shutdown (jack_client_t *client,
-			    JackInfoShutdownCallback function, void *arg) JACK_WEAK_EXPORT;
-
-/**
- * Tell the Jack server to call @a process_callback whenever there is
- * work be done, passing @a arg as the second argument.
- *
- * The code in the supplied function must be suitable for real-time
- * execution. That means that it cannot call functions that might
- * block for a long time. This includes malloc, free, printf,
- * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
- * pthread_cond_wait, etc, etc. 
- *
- * @return 0 on success, otherwise a non-zero error code, causing JACK
- * to remove that client from the process() graph.
- */
-int jack_set_process_callback (jack_client_t *client,
-			       JackProcessCallback process_callback,
-			       void *arg);
-
-/**
- * Tell the Jack server to call @a freewheel_callback
- * whenever we enter or leave "freewheel" mode, passing @a
- * arg as the second argument. The first argument to the
- * callback will be non-zero if JACK is entering freewheel
- * mode, and zero otherwise.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int jack_set_freewheel_callback (jack_client_t *client,
-				 JackFreewheelCallback freewheel_callback,
-				 void *arg);
-
-/**
- * Tell JACK to call @a bufsize_callback whenever the size of the the
- * buffer that will be passed to the @a process_callback is about to
- * change.  Clients that depend on knowing the buffer size must supply
- * a @a bufsize_callback before activating themselves.
- *
- * @param client pointer to JACK client structure.
- * @param bufsize_callback function to call when the buffer size changes.
- * @param arg argument for @a bufsize_callback.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_buffer_size_callback (jack_client_t *client,
-				   JackBufferSizeCallback bufsize_callback,
-				   void *arg);
-
-/**
- * Tell the Jack server to call @a srate_callback whenever the system
- * sample rate changes.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_sample_rate_callback (jack_client_t *client,
-				   JackSampleRateCallback srate_callback,
-				   void *arg);
-
-/**
- * Tell the JACK server to call @a registration_callback whenever a
- * port is registered or unregistered, passing @a arg as a parameter.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_client_registration_callback (jack_client_t *,
-					   JackClientRegistrationCallback
-					   registration_callback, void *arg);
-	
-/**
- * Tell the JACK server to call @a registration_callback whenever a
- * port is registered or unregistered, passing @a arg as a parameter.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_port_registration_callback (jack_client_t *,
-					 JackPortRegistrationCallback
-					 registration_callback, void *arg);
-
-/**
- * Tell the JACK server to call @a connect_callback whenever a
- * port is connected or disconnected, passing @a arg as a parameter.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_port_connect_callback (jack_client_t *,
-				    JackPortConnectCallback
-				    connect_callback, void *arg);
-/**
- * Tell the JACK server to call @a graph_callback whenever the
- * processing graph is reordered, passing @a arg as a parameter.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_graph_order_callback (jack_client_t *,
-				   JackGraphOrderCallback graph_callback,
-				   void *);
-
-/**
- * Tell the JACK server to call @a xrun_callback whenever there is a
- * xrun, passing @a arg as a parameter.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_xrun_callback (jack_client_t *,
-			    JackXRunCallback xrun_callback, void *arg);
-
-/*@}*/
-
-/**
- * @defgroup ServerControl Controlling & querying JACK server operation
- * @{
- */
-
-/**
- * Start/Stop JACK's "freewheel" mode.
- *
- * When in "freewheel" mode, JACK no longer waits for
- * any external event to begin the start of the next process
- * cycle. 
- *
- * As a result, freewheel mode causes "faster than realtime"
- * execution of a JACK graph. If possessed, real-time
- * scheduling is dropped when entering freewheel mode, and
- * if appropriate it is reacquired when stopping.
- * 
- * IMPORTANT: on systems using capabilities to provide real-time
- * scheduling (i.e. Linux kernel 2.4), if onoff is zero, this function
- * must be called from the thread that originally called jack_activate(). 
- * This restriction does not apply to other systems (e.g. Linux kernel 2.6 
- * or OS X).
- * 
- * @param client pointer to JACK client structure
- * @param onoff  if non-zero, freewheel mode starts. Otherwise
- *                  freewheel mode ends.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int jack_set_freewheel(jack_client_t* client, int onoff);
-
-/**
- * Change the buffer size passed to the @a process_callback.
- *
- * This operation stops the JACK engine process cycle, then calls all
- * registered @a bufsize_callback functions before restarting the
- * process cycle.  This will cause a gap in the audio flow, so it
- * should only be done at appropriate stopping points.
- *
- * @see jack_set_buffer_size_callback()
- *
- * @param client pointer to JACK client structure.
- * @param nframes new buffer size.  Must be a power of two.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
-
-/**
- * @return the sample rate of the jack system, as set by the user when
- * jackd was started.
- */
-jack_nframes_t jack_get_sample_rate (jack_client_t *);
-
-/**
- * @return the current maximum size that will ever be passed to the @a
- * process_callback.  It should only be used *before* the client has
- * been activated.  This size may change, clients that depend on it
- * must register a @a bufsize_callback so they will be notified if it
- * does.
- *
- * @see jack_set_buffer_size_callback()
- */
-jack_nframes_t jack_get_buffer_size (jack_client_t *);
-
-/**
- * Old-style interface to become the timebase for the entire JACK
- * subsystem.
- *
- * @deprecated This function still exists for compatibility with the
- * earlier transport interface, but it does nothing.  Instead, see
- * transport.h and use jack_set_timebase_callback().
- *
- * @return ENOSYS, function not implemented.
- */
-int  jack_engine_takeover_timebase (jack_client_t *);
-
-/**
- * @return the current CPU load estimated by JACK.  This is a running
- * average of the time it takes to execute a full process cycle for
- * all clients as a percentage of the real time available per cycle
- * determined by the buffer size and sample rate.
- */
-float jack_cpu_load (jack_client_t *client);
-	
-
-/*@}*/
-
-/**
- * @defgroup PortFunctions Creating & manipulating ports
- * @{
- */
-
-/**
- * Create a new port for the client. This is an object used for moving
- * data of any type in or out of the client.  Ports may be connected
- * in various ways.
- *
- * Each port has a short name.  The port's full name contains the name
- * of the client concatenated with a colon (:) followed by its short
- * name.  The jack_port_name_size() is the maximum length of this full
- * name.  Exceeding that will cause the port registration to fail and
- * return NULL.
- *
- * All ports have a type, which may be any non-NULL and non-zero
- * length string, passed as an argument.  Some port types are built
- * into the JACK API, like JACK_DEFAULT_AUDIO_TYPE or JACK_DEFAULT_MIDI_TYPE
- *
- * @param client pointer to JACK client structure.
- * @param port_name non-empty short name for the new port (not
- * including the leading @a "client_name:").
- * @param port_type port type name.  If longer than
- * jack_port_type_size(), only that many characters are significant.
- * @param flags @ref JackPortFlags bit mask.
- * @param buffer_size must be non-zero if this is not a built-in @a
- * port_type.  Otherwise, it is ignored.
- *
- * @return jack_port_t pointer on success, otherwise NULL.
- */
-jack_port_t *jack_port_register (jack_client_t *client,
-                                 const char *port_name,
-                                 const char *port_type,
-                                 unsigned long flags,
-                                 unsigned long buffer_size);
-
-/** 
- * Remove the port from the client, disconnecting any existing
- * connections.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_port_unregister (jack_client_t *, jack_port_t *);
-
-/**
- * This returns a pointer to the memory area associated with the
- * specified port. For an output port, it will be a memory area
- * that can be written to; for an input port, it will be an area
- * containing the data from the port's connection(s), or
- * zero-filled. if there are multiple inbound connections, the data
- * will be mixed appropriately.  
- *
- * Do not cache the returned address across process() callbacks.
- * Port buffers have to be retrieved in each callback for proper functionning.
- */
-void *jack_port_get_buffer (jack_port_t *, jack_nframes_t);
-
-/**
- * @return the full name of the jack_port_t (including the @a
- * "client_name:" prefix).
- *
- * @see jack_port_name_size().
- */
-const char *jack_port_name (const jack_port_t *port);
-
-/**
- * @return the short name of the jack_port_t (not including the @a
- * "client_name:" prefix).
- *
- * @see jack_port_name_size().
- */
-const char *jack_port_short_name (const jack_port_t *port);
-
-/**
- * @return the @ref JackPortFlags of the jack_port_t.
- */
-int jack_port_flags (const jack_port_t *port);
-
-/**
- * @return the @a port type, at most jack_port_type_size() characters
- * including a final NULL.
- */
-const char *jack_port_type (const jack_port_t *port);
-
-/** 
- * @return TRUE if the jack_port_t belongs to the jack_client_t.
- */
-int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
-
-/** 
- * @return number of connections to or from @a port.
- *
- * @pre The calling client must own @a port.
- */
-int jack_port_connected (const jack_port_t *port);
-
-/**
- * @return TRUE if the locally-owned @a port is @b directly connected
- * to the @a port_name.
- *
- * @see jack_port_name_size()
- */
-int jack_port_connected_to (const jack_port_t *port,
-			    const char *port_name);
-
-/**
- * @return a null-terminated array of full port names to which the @a
- * port is connected.  If none, returns NULL.
- *
- * The caller is responsible for calling free(3) on any non-NULL
- * returned value.
- *
- * @param port locally owned jack_port_t pointer.
- *
- * @see jack_port_name_size(), jack_port_get_all_connections()
- */   
-const char **jack_port_get_connections (const jack_port_t *port);
-
-/**
- * @return a null-terminated array of full port names to which the @a
- * port is connected.  If none, returns NULL.
- *
- * The caller is responsible for calling free(3) on any non-NULL
- * returned value.
- *
- * This differs from jack_port_get_connections() in two important
- * respects:
- *
- *     1) You may not call this function from code that is
- *          executed in response to a JACK event. For example,
- *          you cannot use it in a GraphReordered handler.
- *
- *     2) You need not be the owner of the port to get information
- *          about its connections. 
- *
- * @see jack_port_name_size()
- */   
-const char **jack_port_get_all_connections (const jack_client_t *client,
-					    const jack_port_t *port);
-
-/**
- *
- * @deprecated This function will be removed from a future version 
- * of JACK. Do not use it. There is no replacement. It has 
- * turned out to serve essentially no purpose in real-life
- * JACK clients.
- */
-int  jack_port_tie (jack_port_t *src, jack_port_t *dst);
-
-/**
- *
- * @deprecated This function will be removed from a future version 
- * of JACK. Do not use it. There is no replacement. It has 
- * turned out to serve essentially no purpose in real-life
- * JACK clients.
- */
-int  jack_port_untie (jack_port_t *port);
-
-/** 
- * @return the time (in frames) between data being available or
- * delivered at/to a port, and the time at which it arrived at or is
- * delivered to the "other side" of the port.  E.g. for a physical
- * audio output port, this is the time between writing to the port and
- * when the signal will leave the connector.  For a physical audio
- * input port, this is the time between the sound arriving at the
- * connector and the corresponding frames being readable from the
- * port.
- */
-jack_nframes_t jack_port_get_latency (jack_port_t *port);
-
-/**
- * The maximum of the sum of the latencies in every
- * connection path that can be drawn between the port and other
- * ports with the @ref JackPortIsTerminal flag set.
- */
-jack_nframes_t jack_port_get_total_latency (jack_client_t *,
-					    jack_port_t *port);
-
-/**
- * The port latency is zero by default. Clients that control
- * physical hardware with non-zero latency should call this
- * to set the latency to its correct value. Note that the value
- * should include any systemic latency present "outside" the
- * physical hardware controlled by the client. For example,
- * for a client controlling a digital audio interface connected
- * to an external digital converter, the latency setting should
- * include both buffering by the audio interface *and* the converter. 
- */
-void jack_port_set_latency (jack_port_t *, jack_nframes_t);
-	
-/**
- * Request a complete recomputation of a port's total latency. This
- * can be called by a client that has just changed the internal
- * latency of its port using  jack_port_set_latency
- * and wants to ensure that all signal pathways in the graph
- * are updated with respect to the values that will be returned
- * by  jack_port_get_total_latency. 
- * 
- * @return zero for successful execution of the request. non-zero
- *         otherwise.
- */
-int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
-
-/**
- * Request a complete recomputation of all port latencies. This
- * can be called by a client that has just changed the internal
- * latency of its port using  jack_port_set_latency
- * and wants to ensure that all signal pathways in the graph
- * are updated with respect to the values that will be returned
- * by  jack_port_get_total_latency. It allows a client 
- * to change multiple port latencies without triggering a 
- * recompute for each change.
- * 
- * @return zero for successful execution of the request. non-zero
- *         otherwise.
- */
-int jack_recompute_total_latencies (jack_client_t*);
-
-/**
- * Modify a port's short name.  May be called at any time.  If the
- * resulting full name (including the @a "client_name:" prefix) is
- * longer than jack_port_name_size(), it will be truncated.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int jack_port_set_name (jack_port_t *port, const char *port_name);
-
-/**
- * Set @a alias as an alias for @a port.  May be called at any time.
- * If the alias is longer than jack_port_name_size(), it will be truncated.
- * 
- * After a successful call, and until JACK exits or
- * jack_port_unset_alias() is called, may be
- * used as a alternate name for the port.
- *
- * Ports can have up to two aliases - if both are already 
- * set, this function will return an error.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int jack_port_set_alias (jack_port_t *port, const char *alias);
-
-/**
- * Remove @a alias as an alias for @a port.  May be called at any time.
- * 
- * After a successful call, @a alias can no longer be 
- * used as a alternate name for the port.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int jack_port_unset_alias (jack_port_t *port, const char *alias);
-
-/*
- * Get any aliases known for @port.
- *
- * @return the number of aliases discovered for the port
- */
-int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
-
-/**
- * If @ref JackPortCanMonitor is set for this @a port, turn input
- * monitoring on or off.  Otherwise, do nothing.
- */
-int jack_port_request_monitor (jack_port_t *port, int onoff);
-
-/**
- * If @ref JackPortCanMonitor is set for this @a port_name, turn input
- * monitoring on or off.  Otherwise, do nothing.
- *
- * @return 0 on success, otherwise a non-zero error code.
- *
- * @see jack_port_name_size()
- */
-int jack_port_request_monitor_by_name (jack_client_t *client,
-				       const char *port_name, int onoff);
-
-/**
- * If @ref JackPortCanMonitor is set for a port, this function turns
- * on input monitoring if it was off, and turns it off if only one
- * request has been made to turn it on.  Otherwise it does nothing.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_port_ensure_monitor (jack_port_t *port, int onoff);
-
-/**
- * @return TRUE if input monitoring has been requested for @a port.
- */
-int jack_port_monitoring_input (jack_port_t *port);
-
-/**
- * Establish a connection between two ports.
- *
- * When a connection exists, data written to the source port will
- * be available to be read at the destination port.
- *
- * @pre The port types must be identical.
- *
- * @pre The @ref JackPortFlags of the @a source_port must include @ref
- * JackPortIsOutput.
- *
- * @pre The @ref JackPortFlags of the @a destination_port must include
- * @ref JackPortIsInput.
- *
- * @return 0 on success, EEXIST if the connection is already made,
- * otherwise a non-zero error code
- */
-int jack_connect (jack_client_t *,
-		  const char *source_port,
-		  const char *destination_port);
-
-/**
- * Remove a connection between two ports.
- *
- * @pre The port types must be identical.
- *
- * @pre The @ref JackPortFlags of the @a source_port must include @ref
- * JackPortIsOutput.
- *
- * @pre The @ref JackPortFlags of the @a destination_port must include
- * @ref JackPortIsInput.
- *
- * @return 0 on success, otherwise a non-zero error code
- */
-int jack_disconnect (jack_client_t *,
-		     const char *source_port,
-		     const char *destination_port);
-
-/**
- * Perform the same function as jack_disconnect() using port handles
- * rather than names.  This avoids the name lookup inherent in the
- * name-based version.
- *
- * Clients connecting their own ports are likely to use this function,
- * while generic connection clients (e.g. patchbays) would use
- * jack_disconnect().
- */
-int jack_port_disconnect (jack_client_t *, jack_port_t *);
-
-/**
- * @return the maximum number of characters in a full JACK port name
- * including the final NULL character.  This value is a constant.
- *
- * A port's full name contains the owning client name concatenated
- * with a colon (:) followed by its short name and a NULL
- * character.
- */
-int jack_port_name_size(void);
-
-/**
- * @return the maximum number of characters in a JACK port type name
- * including the final NULL character.  This value is a constant.
- */
-int jack_port_type_size(void);
-/*@}*/
-
-/**
- * @defgroup PortSearching Looking up ports
- * @{
- */
-
-/**
- * @param port_name_pattern A regular expression used to select 
- * ports by name.  If NULL or of zero length, no selection based 
- * on name will be carried out.
- * @param type_name_pattern A regular expression used to select 
- * ports by type.  If NULL or of zero length, no selection based 
- * on type will be carried out.
- * @param flags A value used to select ports by their flags.  
- * If zero, no selection based on flags will be carried out.
- *
- * @return a NULL-terminated array of ports that match the specified
- * arguments.  The caller is responsible for calling free(3) any
- * non-NULL returned value.
- *
- * @see jack_port_name_size(), jack_port_type_size()
- */
-const char **jack_get_ports (jack_client_t *, 
-			     const char *port_name_pattern, 
-			     const char *type_name_pattern, 
-			     unsigned long flags);
-
-/**
- * @return address of the jack_port_t named @a port_name.
- *
- * @see jack_port_name_size()
- */
-jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name);
-
-/**
- * @return address of the jack_port_t of a @a port_id.
- */
-jack_port_t *jack_port_by_id (jack_client_t *client,
-			      jack_port_id_t port_id);
-
-/*@}*/
-
-
-/**
- * @defgroup TimeFunctions Handling time
- * @{
- *
- * JACK time is in units of 'frames', according to the current sample rate.
- * The absolute value of frame times is meaningless, frame times have meaning
- * only relative to each other.
- */
-
-/**
- * @return the estimated time in frames that has passed since the JACK
- * server began the current process cycle.
- */
-jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
-
-/**
- * @return the estimated current time in frames.
- * This function is intended for use in other threads (not the process
- * callback).  The return value can be compared with the value of
- * jack_last_frame_time to relate time in other threads to JACK time.
- */
-jack_nframes_t jack_frame_time (const jack_client_t *);
-
-/**
- * @return the precise time at the start of the current process cycle.
- * This function may only be used from the process callback, and can
- * be used to interpret timestamps generated by jack_frame_time() in
- * other threads with respect to the current process cycle.
- * 
- * This is the only jack time function that returns exact time:
- * when used during the process callback it always returns the same
- * value (until the next process callback, where it will return
- * that value + nframes, etc).  The return value is guaranteed to be
- * monotonic and linear in this fashion unless an xrun occurs.
- * If an xrun occurs, clients must check this value again, as time
- * may have advanced in a non-linear way (e.g. cycles may have been skipped).
- */
-jack_nframes_t jack_last_frame_time (const jack_client_t *client);
-
-/**
- * @return the estimated time in microseconds of the specified frame time
- */
-jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t);
-
-/**
- * @return the estimated time in frames for the specified system time.
- */
-jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t);
-
-/**
- * @return return JACK's current system time in microseconds,
- *         using the JACK clock source. 
- * 
- * The value returned is guaranteed to be monotonic, but not linear.
- */
-jack_time_t jack_get_time();
-
-/*@}*/
-
-/**
- * @defgroup ErrorOutput Controlling error/information output
- */
-/*@{*/
-
-/**
- * Display JACK error message.
- *
- * Set via jack_set_error_function(), otherwise a JACK-provided
- * default will print @a msg (plus a newline) to stderr.
- *
- * @param msg error message text (no newline at end).
- */
-extern void (*jack_error_callback)(const char *msg);
-
-/**
- * Set the @ref jack_error_callback for error message display.
- *
- * The JACK library provides two built-in callbacks for this purpose:
- * default_jack_error_callback() and silent_jack_error_callback().
- */
-void jack_set_error_function (void (*func)(const char *));
-
-/**
- * Display JACK info message.
- *
- * Set via jack_set_info_function(), otherwise a JACK-provided
- * default will print @a msg (plus a newline) to stdout.
- *
- * @param msg info message text (no newline at end).
- */
-extern void (*jack_info_callback)(const char *msg);
-
-/**
- * Set the @ref jack_info_callback for info message display.
- */
-void jack_set_info_function (void (*func)(const char *));
-/*@}*/
-
-/**
- * The free function to be used on memory returned by jack_port_get_connections, 
- * jack_port_get_all_connections and jack_get_ports functions.
- * This is MANDATORY on Windows when otherwise all nasty runtime version related crashes can occur.
- * Developers are strongly encouraged to use this function instead of the standard "free" function in new code.
- *
- */
-void jack_free(void* ptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_h__ */
diff --git a/jack/jslist.h b/jack/jslist.h
deleted file mode 100644
index 9c91540..0000000
--- a/jack/jslist.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
-    Based on gslist.c from glib-1.2.9 (LGPL).
- 
-    Adaption to JACK, Copyright (C) 2002 Kai Vehmanen.
-      - replaced use of gtypes with normal ANSI C types
-      - glib's memery allocation routines replaced with
-        malloc/free calls
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_jslist_h__
-#define __jack_jslist_h__
-
-#include <stdlib.h>
-
-typedef struct _JSList JSList;
-
-typedef int		(*JCompareFunc)		(void*	a,
-						 void*	b);
-struct _JSList
-{
-  void *data;
-  JSList *next;
-};
-
-static __inline__
-JSList*
-jack_slist_alloc (void)
-{
-  JSList *new_list;
-
-  new_list = malloc(sizeof(JSList));
-  new_list->data = NULL;
-  new_list->next = NULL;
-
-  return new_list;
-}
-
-static __inline__ 
-JSList*
-jack_slist_prepend (JSList   *list,
-		    void     *data)
-{
-  JSList *new_list;
-
-  new_list = malloc(sizeof(JSList));
-  new_list->data = data;
-  new_list->next = list;
-
-  return new_list;
-}
-
-#define jack_slist_next(slist)	((slist) ? (((JSList *)(slist))->next) : NULL)
-static __inline__ 
-JSList*
-jack_slist_last (JSList *list)
-{
-  if (list)
-    {
-      while (list->next)
-	list = list->next;
-    }
-
-  return list;
-}
-
-static __inline__ 
-JSList*
-jack_slist_remove_link (JSList *list,
-		     JSList *link)
-{
-  JSList *tmp;
-  JSList *prev;
-
-  prev = NULL;
-  tmp = list;
-
-  while (tmp)
-    {
-      if (tmp == link)
-	{
-	  if (prev)
-	    prev->next = tmp->next;
-	  if (list == tmp)
-	    list = list->next;
-
-	  tmp->next = NULL;
-	  break;
-	}
-
-      prev = tmp;
-      tmp = tmp->next;
-    }
-
-  return list;
-}
-
-static __inline__ 
-void
-jack_slist_free (JSList *list)
-{
-  while (list)
-    {
-	    JSList *next = list->next;
-	    free(list);
-	    list = next;
-    }
-}
-
-static __inline__ 
-void
-jack_slist_free_1 (JSList *list)
-{
-  if (list)
-    {
-      free(list);
-    }
-}
-
-static __inline__ 
-JSList*
-jack_slist_remove (JSList   *list,
-		   void     *data)
-{
-  JSList *tmp;
-  JSList *prev;
-
-  prev = NULL;
-  tmp = list;
-
-  while (tmp)
-    {
-      if (tmp->data == data)
-	{
-	  if (prev)
-	    prev->next = tmp->next;
-	  if (list == tmp)
-	    list = list->next;
-
-	  tmp->next = NULL;
-	  jack_slist_free (tmp);
-
-	  break;
-	}
-
-      prev = tmp;
-      tmp = tmp->next;
-    }
-
-  return list;
-}
-
-static __inline__ 
-unsigned int
-jack_slist_length (JSList *list)
-{
-  unsigned int length;
-
-  length = 0;
-  while (list)
-    {
-      length++;
-      list = list->next;
-    }
-
-  return length;
-}
-
-static __inline__ 
-JSList*
-jack_slist_find (JSList   *list,
-		 void     *data)
-{
-  while (list)
-    {
-      if (list->data == data)
-	break;
-      list = list->next;
-    }
-
-  return list;
-}
-
-static __inline__ 
-JSList*
-jack_slist_copy (JSList *list)
-{
-  JSList *new_list = NULL;
-
-  if (list)
-    {
-      JSList *last;
-
-      new_list = jack_slist_alloc ();
-      new_list->data = list->data;
-      last = new_list;
-      list = list->next;
-      while (list)
-	{
-	  last->next = jack_slist_alloc ();
-	  last = last->next;
-	  last->data = list->data;
-	  list = list->next;
-	}
-    }
-
-  return new_list;
-}
-
-static __inline__ 
-JSList*
-jack_slist_append (JSList   *list,
-		   void     *data)
-{
-  JSList *new_list;
-  JSList *last;
-
-  new_list = jack_slist_alloc ();
-  new_list->data = data;
-
-  if (list)
-    {
-      last = jack_slist_last (list);
-      last->next = new_list;
-
-      return list;
-    }
-  else
-      return new_list;
-}
-
-static __inline__ 
-JSList* 
-jack_slist_sort_merge  (JSList      *l1, 
-			JSList      *l2,
-			JCompareFunc compare_func)
-{
-  JSList list, *l;
-
-  l=&list;
-
-  while (l1 && l2)
-    {
-      if (compare_func(l1->data,l2->data) < 0)
-        {
-	  l=l->next=l1;
-	  l1=l1->next;
-        } 
-      else 
-	{
-	  l=l->next=l2;
-	  l2=l2->next;
-        }
-    }
-  l->next= l1 ? l1 : l2;
-  
-  return list.next;
-}
-
-static __inline__ 
-JSList* 
-jack_slist_sort (JSList       *list,
-		 JCompareFunc compare_func)
-{
-  JSList *l1, *l2;
-
-  if (!list) 
-    return NULL;
-  if (!list->next) 
-    return list;
-
-  l1 = list; 
-  l2 = list->next;
-
-  while ((l2 = l2->next) != NULL)
-    {
-      if ((l2 = l2->next) == NULL) 
-	break;
-      l1=l1->next;
-    }
-  l2 = l1->next; 
-  l1->next = NULL;
-
-  return jack_slist_sort_merge (jack_slist_sort (list, compare_func),
-				jack_slist_sort (l2,   compare_func),
-				compare_func);
-}
-
-#endif /* __jack_jslist_h__ */
diff --git a/jack/memops.h b/jack/memops.h
deleted file mode 100644
index a5582bf..0000000
--- a/jack/memops.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-    Copyright (C) 1999-2000 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __jack_memops_h__
-#define __jack_memops_h__
-
-#include <jack/types.h>
-
-typedef	enum  {
-	None,
-	Rectangular,
-	Triangular,
-	Shaped
-} DitherAlgorithm;
-
-#define DITHER_BUF_SIZE 8
-#define DITHER_BUF_MASK 7
-
-typedef struct {
-    unsigned int depth;
-    float rm1;
-    unsigned int idx;
-    float e[DITHER_BUF_SIZE];
-} dither_state_t;
-
-/* float functions */
-void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long dst_skip);
-void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-
-/* integer functions */
-void sample_move_d32u24_sSs          (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d32u24_sS           (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d24_sSs             (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d24_sS              (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d16_sSs             (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d16_sS              (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-
-void sample_move_dither_rect_d32u24_sSs   (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d32u24_sS    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d32u24_sSs    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d32u24_sS     (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d32u24_sS  (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d24_sSs      (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d24_sS       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d24_sSs       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d24_sS        (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d24_sSs    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d24_sS     (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d16_sSs      (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d16_sS       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d16_sSs       (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d16_sS        (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d16_sSs    (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d16_sS     (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-
-void sample_move_dS_s32u24s          (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s32u24           (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s24s             (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s24              (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s16s             (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s16              (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-
-void sample_merge_d16_sS             (char *dst,  jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_merge_d32u24_sS          (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-
-static __inline__ void
-sample_merge (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt)
-
-{
-	while (cnt--) {
-		*dst += *src;
-		dst++;
-		src++;
-	}
-}
-
-static __inline__ void
-sample_memcpy (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt)
-
-{
-	memcpy (dst, src, cnt * sizeof (jack_default_audio_sample_t));
-}
-
-void memset_interleave               (char *dst, char val, unsigned long bytes, unsigned long unit_bytes, unsigned long skip_bytes);
-void memcpy_fake                     (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
-
-void memcpy_interleave_d16_s16       (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void memcpy_interleave_d24_s24       (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void memcpy_interleave_d32_s32       (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-
-void merge_memcpy_interleave_d16_s16 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void merge_memcpy_interleave_d24_s24 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void merge_memcpy_interleave_d32_s32 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-
-void merge_memcpy_d16_s16            (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
-void merge_memcpy_d32_s32            (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
-
-#endif /* __jack_memops_h__ */
diff --git a/jack/messagebuffer.h b/jack/messagebuffer.h
deleted file mode 100644
index 93f876b..0000000
--- a/jack/messagebuffer.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * messagebuffer.h -- realtime-safe message interface for jackd.
- *
- *  This function is included in libjack so backend drivers can use
- *  it, *not* for external client processes.  The VERBOSE() and
- *  MESSAGE() macros are realtime-safe.
- */
-
-/*
- *  Copyright (C) 2004 Rui Nuno Capela, Steve Harris
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation; either version 2.1 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *  
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software 
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __jack_messagebuffer_h__
-#define __jack_messagebuffer_h__
-
-#define MESSAGE(fmt,args...) jack_messagebuffer_add(fmt , ##args)
-#define VERBOSE(engine,fmt,args...)	\
-	if ((engine)->verbose)		\
-		jack_messagebuffer_add(fmt , ##args)
-
-void jack_messagebuffer_init();
-void jack_messagebuffer_exit();
-
-void jack_messagebuffer_add(const char *fmt, ...);
-
-#endif /* __jack_messagebuffer_h__ */
diff --git a/jack/midiport.h b/jack/midiport.h
deleted file mode 100644
index 69f1afb..0000000
--- a/jack/midiport.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-    Copyright (C) 2004 Ian Esten
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-
-#ifndef __JACK_MIDIPORT_H
-#define __JACK_MIDIPORT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-	
-#include <jack/types.h>
-#include <stdlib.h>
-
-	
-/** Type for raw event data contained in @ref jack_midi_event_t. */
-typedef unsigned char jack_midi_data_t;
-
-
-/** A Jack MIDI event. */
-typedef struct _jack_midi_event
-{
-	jack_nframes_t    time;   /**< Sample index at which event is valid */
-	size_t            size;   /**< Number of bytes of data in \a buffer */
-	jack_midi_data_t *buffer; /**< Raw MIDI data */
-} jack_midi_event_t;
-
-
-/**
- * @defgroup MIDIAPI Reading and writing MIDI data 
- * @{
- */
-
-/* Get number of events in a port buffer.
- *
- * @param port_buffer Port buffer from which to retrieve event.
- * @return number of events inside @a port_buffer
- */
-jack_nframes_t
-jack_midi_get_event_count(void*          port_buffer);
-
-
-/** Get a MIDI event from an event port buffer.
- * 
- * Jack MIDI is normalised, the MIDI event returned by this function is
- * guaranteed to be a complete MIDI event (the status byte will always be
- * present, and no realtime events will interspered with the event).
- *
- * @param event Event structure to store retrieved event in.
- * @param port_buffer Port buffer from which to retrieve event.
- * @param event_index Index of event to retrieve.
- * @return 0 on success, ENODATA if buffer is empty.
- */
-int
-jack_midi_event_get(jack_midi_event_t *event,
-                    void              *port_buffer,
-                    jack_nframes_t     event_index);
-
-
-/** Clear an event buffer.
- * 
- * This should be called at the beginning of each process cycle before calling
- * @ref jack_midi_event_reserve or @ref jack_midi_event_write. This
- * function may not be called on an input port's buffer.
- *
- * @param port_buffer Port buffer to clear (must be an output port buffer).
- */
-void
-jack_midi_clear_buffer(void           *port_buffer);
-
-
-/** Get the size of the largest event that can be stored by the port.
- *
- * This function returns the current space available, taking into account
- * events already stored in the port.
- *
- * @param port_buffer Port buffer to check size of.
- */
-size_t
-jack_midi_max_event_size(void* port_buffer);
-
-
-/** Allocate space for an event to be written to an event port buffer.
- *
- * Clients are to write the actual event data to be written starting at the
- * pointer returned by this function. Clients must not write more than
- * @a data_size bytes into this buffer.  Clients must write normalised
- * MIDI data to the port - no running status and no (1-byte) realtime
- * messages interspersed with other messages (realtime messages are fine
- * when they occur on their own, like other messages).
- *
- * @param port_buffer Buffer to write event to.
- * @param time Sample offset of event.
- * @param data_size Length of event's raw data in bytes.
- * @return Pointer to the beginning of the reserved event's data buffer, or
- * NULL on error (ie not enough space).
- */
-jack_midi_data_t*
-jack_midi_event_reserve(void           *port_buffer,
-                        jack_nframes_t  time, 
-                        size_t          data_size);
-
-
-/** Write an event into an event port buffer.
- *
- * This function is simply a wrapper for @ref jack_midi_event_reserve
- * which writes the event data into the space reserved in the buffer.
- * The same restrictions on the MIDI data apply.
- * 
- * @param port_buffer Buffer to write event to.
- * @param time Sample offset of event.
- * @param data Message data to be written.
- * @param data_size Length of @a data in bytes.
- * @return 0 on success, ENOBUFS if there's not enough space in buffer for event.
- */
-int
-jack_midi_event_write(void                   *port_buffer,
-                      jack_nframes_t          time,
-                      const jack_midi_data_t *data,
-                      size_t                  data_size);
-
-
-/** Get the number of events that could not be written to @a port_buffer.
- *
- * This function returning a non-zero value implies @a port_buffer is full.
- * Currently the only way this can happen is if events are lost on port mixdown.
- *
- * @param port_buffer Port to receive count for.
- * @returns Number of events that could not be written to @a port_buffer.
- */
-jack_nframes_t
-jack_midi_get_lost_event_count(void           *port_buffer);
-
-/*@}*/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __JACK_MIDIPORT_H */
-
-
diff --git a/jack/pool.h b/jack/pool.h
deleted file mode 100644
index 41ad618..0000000
--- a/jack/pool.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_pool_h__
-#define __jack_pool_h__
-
-#include <sys/types.h>
-
-void * jack_pool_alloc (size_t bytes);
-void   jack_pool_release (void *);
-
-#endif /* __jack_pool_h__ */
diff --git a/jack/port.h b/jack/port.h
deleted file mode 100644
index 9ee069d..0000000
--- a/jack/port.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_port_h__
-#define __jack_port_h__
-
-#include <pthread.h>
-#include <jack/types.h>
-#include <jack/jslist.h>
-#include <jack/shm.h>
-
-#define JACK_PORT_NAME_SIZE 256
-#define JACK_PORT_TYPE_SIZE 32
-
-/* The relatively low value of this constant reflects the fact that
- * JACK currently only knows about *2* port types.  (May 2006)
- *
- * Further, the 4 covers:
- *   - a single non-negotiated audio format
- *   - music data (ie. MIDI)
- *   - video
- *   - one other
- *
- * which is probably enough for more than just the foreseeable future.
- */              
-#define JACK_MAX_PORT_TYPES 4
-#define JACK_AUDIO_PORT_TYPE 0
-#define JACK_MIDI_PORT_TYPE 1
-
-/* these should probably go somewhere else, but not in <jack/types.h> */
-#define JACK_CLIENT_NAME_SIZE 33
-typedef uint32_t jack_client_id_t;
-
-/* JACK shared memory segments are limited to MAX_INT32, they can be
- * shared between 32-bit and 64-bit clients. 
- */
-#define JACK_SHM_MAX (MAX_INT32)
-typedef int32_t jack_port_type_id_t;
-
-#define JACK_BACKEND_ALIAS "system"
-
-#ifndef POST_PACKED_STRUCTURE
-#ifdef __GNUC__
-/* POST_PACKED_STRUCTURE needs to be a macro which
-   expands into a compiler directive. The directive must
-   tell the compiler to arrange the preceding structure
-   declaration so that it is packed on byte-boundaries rather 
-   than use the natural alignment of the processor and/or
-   compiler.
-*/
-#define POST_PACKED_STRUCTURE __attribute__((__packed__))
-#else
-/* Add other things here for non-gcc platforms */
-#endif
-#endif
-
-/* Port type structure.  
- *
- *  (1) One for each port type is part of the engine's jack_control_t
- *  shared memory structure.
- *
- *  (2) One for each port type is appended to the engine's
- *  jack_client_connect_result_t response.  The client reads them into
- *  its local memory, using them to attach the corresponding shared
- *  memory segments.
- */
-typedef struct _jack_port_type_info {
-
-    jack_port_type_id_t ptype_id;
-    const char     type_name[JACK_PORT_TYPE_SIZE];      
-
-    /* If == 1, then a buffer to handle nframes worth of data has
-     * sizeof(jack_default_audio_sample_t) * nframes bytes.  
-     *
-     * If > 1, the buffer allocated for input mixing will be
-     * this value times sizeof(jack_default_audio_sample_t)
-     * * nframes bytes in size.  For non-audio data types,
-     * it may have a different value.
-     *
-     * If < 0, the value should be ignored, and buffer_size
-     * should be used.
-     */
-    int32_t buffer_scale_factor;
-
-    /* ignored unless buffer_scale_factor is < 0. see above */
-    jack_shmsize_t buffer_size;
-
-    jack_shm_registry_index_t shm_registry_index;
-
-    jack_shmsize_t zero_buffer_offset;
-
-} POST_PACKED_STRUCTURE jack_port_type_info_t;
-
-/* Allocated by the engine in shared memory. */
-typedef struct _jack_port_shared {
-
-    jack_port_type_id_t      ptype_id;	/* index into port type array */
-    jack_shmsize_t           offset;	/* buffer offset in shm segment */
-    jack_port_id_t           id;	/* index into engine port array */
-    uint32_t			     flags;    
-    char                     name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE];
-    char                     alias1[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE];
-    char                     alias2[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE];
-    jack_client_id_t         client_id;	/* who owns me */
-
-    volatile jack_nframes_t  latency;
-    volatile jack_nframes_t  total_latency;
-    volatile uint8_t	     monitor_requests;
-
-    char		     has_mixdown; /* port has a mixdown function */
-    char                     in_use;
-    char                     unused; /* legacy locked field */
-
-} POST_PACKED_STRUCTURE jack_port_shared_t;
-
-typedef struct _jack_port_functions {
-
-    /* Function to initialize port buffer. Cannot be NULL.
-     * NOTE: This must take a buffer rather than jack_port_t as it is called
-     * in jack_engine_place_buffers() before any port creation.
-     * A better solution is to make jack_engine_place_buffers to be type-specific,
-     * but this works.
-     */
-    void (*buffer_init)(void *buffer, size_t size, jack_nframes_t);
-
-    /* Function to mixdown multiple inputs to a buffer.  Can be NULL,
-     * indicating that multiple input connections are not legal for
-     * this data type. 
-     */
-    void (*mixdown)(jack_port_t *, jack_nframes_t);
-
-} jack_port_functions_t;
-
-/**
- * Get port functions.
- * @param ptid port type id.
- *
- * @return pointer to port type functions or NULL if port type is unknown.
- */
-/*const*/ jack_port_functions_t *
-jack_get_port_functions(jack_port_type_id_t ptid);
-
-
-/* Allocated by the client in local memory. */
-struct _jack_port {
-    void                    **client_segment_base;
-    void                     *mix_buffer;
-    jack_port_type_info_t    *type_info; /* shared memory type info */
-    struct _jack_port_shared *shared;	 /* corresponding shm struct */
-    struct _jack_port        *tied;	 /* locally tied source port */
-    jack_port_functions_t    fptr;
-    pthread_mutex_t          connection_lock;
-    JSList                   *connections;
-};
-
-/*  Inline would be cleaner, but it needs to be fast even in
- *  non-optimized code.  jack_output_port_buffer() only handles output
- *  ports.  jack_port_buffer() works for both input and output ports.
- */
-#define jack_port_buffer(p) \
-  ((void *) ((p)->mix_buffer? (p)->mix_buffer: \
-   *(p)->client_segment_base + (p)->shared->offset))
-#define jack_output_port_buffer(p) \
-  ((void *) (*(p)->client_segment_base + (p)->shared->offset))
-
-#endif /* __jack_port_h__ */
-
diff --git a/jack/ringbuffer.h b/jack/ringbuffer.h
deleted file mode 100644
index 2662d9c..0000000
--- a/jack/ringbuffer.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
-    Copyright (C) 2000 Paul Davis
-    Copyright (C) 2003 Rohan Drape
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef _RINGBUFFER_H
-#define _RINGBUFFER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/types.h>
-
-/** @file ringbuffer.h
- *
- * A set of library functions to make lock-free ringbuffers available
- * to JACK clients.  The `capture_client.c' (in the example_clients
- * directory) is a fully functioning user of this API.
- *
- * The key attribute of a ringbuffer is that it can be safely accessed
- * by two threads simultaneously -- one reading from the buffer and
- * the other writing to it -- without using any synchronization or
- * mutual exclusion primitives.  For this to work correctly, there can
- * only be a single reader and a single writer thread.  Their
- * identities cannot be interchanged.
- */
-
-typedef struct  
-{
-  char  *buf;
-  size_t len;
-} 
-jack_ringbuffer_data_t ;
-
-typedef struct
-{
-  char		 *buf;
-  volatile size_t write_ptr;
-  volatile size_t read_ptr;
-  size_t	  size;
-  size_t	  size_mask;
-  int		  mlocked;
-} 
-jack_ringbuffer_t ;
-
-/**
- * Allocates a ringbuffer data structure of a specified size. The
- * caller must arrange for a call to jack_ringbuffer_free() to release
- * the memory associated with the ringbuffer.
- *
- * @param sz the ringbuffer size in bytes.
- *
- * @return a pointer to a new jack_ringbuffer_t, if successful; NULL
- * otherwise.
- */
-jack_ringbuffer_t *jack_ringbuffer_create(size_t sz);
-
-/**
- * Frees the ringbuffer data structure allocated by an earlier call to
- * jack_ringbuffer_create().
- *
- * @param rb a pointer to the ringbuffer structure.
- */
-void jack_ringbuffer_free(jack_ringbuffer_t *rb);
-
-/**
- * Fill a data structure with a description of the current readable
- * data held in the ringbuffer.  This description is returned in a two
- * element array of jack_ringbuffer_data_t.  Two elements are needed
- * because the data to be read may be split across the end of the
- * ringbuffer.
- *
- * The first element will always contain a valid @a len field, which
- * may be zero or greater.  If the @a len field is non-zero, then data
- * can be read in a contiguous fashion using the address given in the
- * corresponding @a buf field.
- *
- * If the second element has a non-zero @a len field, then a second
- * contiguous stretch of data can be read from the address given in
- * its corresponding @a buf field.
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param vec a pointer to a 2 element array of jack_ringbuffer_data_t.
- *
- */
-void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb,
-				     jack_ringbuffer_data_t *vec);
-
-/**
- * Fill a data structure with a description of the current writable
- * space in the ringbuffer.  The description is returned in a two
- * element array of jack_ringbuffer_data_t.  Two elements are needed
- * because the space available for writing may be split across the end
- * of the ringbuffer.
- *
- * The first element will always contain a valid @a len field, which
- * may be zero or greater.  If the @a len field is non-zero, then data
- * can be written in a contiguous fashion using the address given in
- * the corresponding @a buf field.
- *
- * If the second element has a non-zero @a len field, then a second
- * contiguous stretch of data can be written to the address given in
- * the corresponding @a buf field.
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param vec a pointer to a 2 element array of jack_ringbuffer_data_t.
- */
-void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb,
-				      jack_ringbuffer_data_t *vec);
-
-/**
- * Read data from the ringbuffer.
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param dest a pointer to a buffer where data read from the
- * ringbuffer will go.
- * @param cnt the number of bytes to read.
- *
- * @return the number of bytes read, which may range from 0 to cnt.
- */
-size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt);
-
-/**
- * Read data from the ringbuffer. Opposed to jack_ringbuffer_read()
- * this function does not move the read pointer. Thus it's
- * a convenient way to inspect data in the ringbuffer in a
- * continous fashion. The price is that the data is copied
- * into a user provided buffer. For "raw" non-copy inspection
- * of the data in the ringbuffer use jack_ringbuffer_get_read_vector().
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param dest a pointer to a buffer where data read from the
- * ringbuffer will go.
- * @param cnt the number of bytes to read.
- *
- * @return the number of bytes read, which may range from 0 to cnt.
- */
-size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt);
-
-/**
- * Advance the read pointer.
- *
- * After data have been read from the ringbuffer using the pointers
- * returned by jack_ringbuffer_get_read_vector(), use this function to
- * advance the buffer pointers, making that space available for future
- * write operations.
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param cnt the number of bytes read.
- */
-void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt);
-
-/**
- * Return the number of bytes available for reading.
- *
- * @param rb a pointer to the ringbuffer structure.
- *
- * @return the number of bytes available to read.
- */
-size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb);
-
-/**
- * Lock a ringbuffer data block into memory.
- *
- * Uses the mlock() system call.  This is not a realtime operation.
- *
- * @param rb a pointer to the ringbuffer structure.
- */
-int jack_ringbuffer_mlock(jack_ringbuffer_t *rb);
-
-/**
- * Reset the read and write pointers, making an empty buffer.
- *
- * This is not thread safe.
- *
- * @param rb a pointer to the ringbuffer structure.
- */
-void jack_ringbuffer_reset(jack_ringbuffer_t *rb);
-
-/**
- * Write data into the ringbuffer.
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param src a pointer to the data to be written to the ringbuffer.
- * @param cnt the number of bytes to write.
- *
- * @return the number of bytes write, which may range from 0 to cnt
- */
-size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src,
-			     size_t cnt);
-
-/**
- * Advance the write pointer.
- *
- * After data have been written the ringbuffer using the pointers
- * returned by jack_ringbuffer_get_write_vector(), use this function
- * to advance the buffer pointer, making the data available for future
- * read operations.
- *
- * @param rb a pointer to the ringbuffer structure.
- * @param cnt the number of bytes written.
- */
-void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt);
-
-/**
- * Return the number of bytes available for writing.
- *
- * @param rb a pointer to the ringbuffer structure.
- *
- * @return the amount of free space (in bytes) available for writing.
- */
-size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/jack/sanitycheck.h b/jack/sanitycheck.h
deleted file mode 100644
index 5c98896..0000000
--- a/jack/sanitycheck.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef __jack_sanitycheck_h__
-#define __jack_sanitycheck_h__
-
-/**
- * GPL etc.
- *
- * @author Florian Faber
- *
- * @version 0.1 (2009-01-17) [FF]
- *              - initial version
- **/
-
-/**
- * Performs a range of sanity checks on the system. The number of
- * found problems is returned.
- *
- **/
-
-int sanitycheck (int do_realtime_check,
-		 int do_freqscaling_check);
-
-#endif /* __jack_sanitycheck_h__ */
diff --git a/jack/shm.h b/jack/shm.h
deleted file mode 100644
index 8103ce9..0000000
--- a/jack/shm.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef __jack_shm_h__
-#define __jack_shm_h__
-
-#include <limits.h>
-#include <sys/types.h>
-#include <jack/types.h>
-
-#define MAX_SERVERS 8			/* maximum concurrent servers */
-#define MAX_SHM_ID 256			/* generally about 16 per server */
-#define JACK_SERVER_NAME_SIZE 256	/* maximum length of server name */
-#define JACK_SHM_MAGIC 0x4a41434b	/* shm magic number: "JACK" */
-#define JACK_SHM_NULL_INDEX -1		/* NULL SHM index */
-#define JACK_SHM_REGISTRY_INDEX -2	/* pseudo SHM index for registry */
-
-
-/* On Mac OS X, SHM_NAME_MAX is the maximum length of a shared memory
- * segment name (instead of NAME_MAX or PATH_MAX as defined by the
- * standard).
- */
-#ifdef USE_POSIX_SHM
-#ifndef SHM_NAME_MAX
-#define SHM_NAME_MAX NAME_MAX
-#endif
-typedef char	   shm_name_t[SHM_NAME_MAX];
-typedef shm_name_t jack_shm_id_t;
-#else /* System V SHM */
-typedef int	   jack_shm_id_t;
-#endif /* SHM type */
-
-/* shared memory type */
-typedef enum {
-	shm_POSIX = 1,			/* POSIX shared memory */
-	shm_SYSV = 2			/* System V shared memory */
-} jack_shmtype_t;
-
-typedef int16_t jack_shm_registry_index_t;
-
-/** 
- * A structure holding information about shared memory allocated by
- * JACK. this persists across invocations of JACK, and can be used by
- * multiple JACK servers.  It contains no pointers and is valid across
- * address spaces.
- *
- * The registry consists of two parts: a header including an array of
- * server names, followed by an array of segment registry entries.
- */
-typedef struct _jack_shm_server {
-    pid_t                     pid;	/* process ID */
-    char		      name[JACK_SERVER_NAME_SIZE];
-} jack_shm_server_t;
-
-typedef struct _jack_shm_header {
-    uint32_t		      magic;	/* magic number */
-    uint16_t		      protocol;	/* JACK protocol version */
-    jack_shmtype_t	      type;	/* shm type */
-    jack_shmsize_t	      size;	/* total registry segment size */
-    jack_shmsize_t	      hdr_len;	/* size of header */
-    jack_shmsize_t	      entry_len; /* size of registry entry */
-    jack_shm_server_t server[MAX_SERVERS]; /* current server array */
-} jack_shm_header_t;
-
-typedef struct _jack_shm_registry {
-    jack_shm_registry_index_t index;     /* offset into the registry */
-    pid_t                     allocator; /* PID that created shm segment */
-    jack_shmsize_t            size;      /* for POSIX unattach */
-    jack_shm_id_t             id;        /* API specific, see above */
-} jack_shm_registry_t;
-
-#define JACK_SHM_REGISTRY_SIZE (sizeof (jack_shm_header_t) \
-				+ sizeof (jack_shm_registry_t) * MAX_SHM_ID)
-
-/** 
- * a structure holding information about shared memory
- * allocated by JACK. this version is valid only
- * for a given address space. It contains a pointer
- * indicating where the shared memory has been
- * attached to the address space.
- */
-typedef struct _jack_shm_info {
-    jack_shm_registry_index_t index;       /* offset into the registry */
-    void		     *attached_at; /* address where attached */
-} jack_shm_info_t;
-
-/* utility functions used only within JACK */
-
-extern void jack_shm_copy_from_registry (jack_shm_info_t*, 
-					 jack_shm_registry_index_t);
-extern void jack_shm_copy_to_registry (jack_shm_info_t*,
-				       jack_shm_registry_index_t*);
-extern void jack_release_shm_info (jack_shm_registry_index_t);
-
-static inline char* jack_shm_addr (jack_shm_info_t* si) {
-	return si->attached_at;
-}
-
-/* here beginneth the API */
-
-extern int  jack_register_server (const char *server_name, int new_registry);
-extern void jack_unregister_server (const char *server_name);
-
-extern int  jack_initialize_shm (const char *server_name);
-extern int  jack_cleanup_shm (void);
-
-extern int  jack_shmalloc (jack_shmsize_t size, jack_shm_info_t* result);
-extern void jack_release_shm (jack_shm_info_t*);
-extern void jack_destroy_shm (jack_shm_info_t*);
-extern int  jack_attach_shm (jack_shm_info_t*);
-extern int  jack_resize_shm (jack_shm_info_t*, jack_shmsize_t size);
-
-#endif /* __jack_shm_h__ */
diff --git a/jack/start.h b/jack/start.h
deleted file mode 100644
index 00212e4..0000000
--- a/jack/start.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-    Copyright (C) 2002 Fernando Lopez-Lezcano
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#define PIPE_READ_FD (3)
-#define PIPE_WRITE_FD (4)
diff --git a/jack/statistics.h b/jack/statistics.h
deleted file mode 100644
index c834662..0000000
--- a/jack/statistics.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Copyright (C) 2004 Rui Nuno Capela, Lee Revell
- *  
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public License
- *  as published by the Free Software Foundation; either version 2.1
- *  of the License, or (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *  
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this program; if not, write to the Free
- *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- */
-
-#ifndef __statistics_h__
-#define __statistics_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <jack/types.h>
-
-/**
- * @return the maximum delay reported by the backend since
- * startup or reset.  When compared to the period size in usecs, this
- * can be used to estimate the ideal period size for a given setup.
- */
-float jack_get_max_delayed_usecs (jack_client_t *client);
-
-/**
- * @return the delay in microseconds due to the most recent XRUN
- * occurrence.  This probably only makes sense when called from a @ref
- * JackXRunCallback defined using jack_set_xrun_callback().
- */
-float jack_get_xrun_delayed_usecs (jack_client_t *client);
-
-/**
- * Reset the maximum delay counter.  This would be useful
- * to estimate the effect that a change to the configuration of a running
- * system (e.g. toggling kernel preemption) has on the delay
- * experienced by JACK, without having to restart the JACK engine.
- */
-void jack_reset_max_delayed_usecs (jack_client_t *client);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __statistics_h__ */
diff --git a/jack/systemtest.h b/jack/systemtest.h
deleted file mode 100644
index 27e0ae7..0000000
--- a/jack/systemtest.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef __jack_systemtest_h__
-#define __jack_systemtest_h__
-
-/**
- * GPL, yabbadabba
- *
- * Set of functions to gather system information for the jack setup wizard.
- * 
- * @author Florian Faber, faber at faberman.de
- * 
- * @version 0.1 (2009-01-15) [FF]
- *              - initial version
- *
- **/
-
-
-/**
- * This function checks for the existence of known frequency scaling mechanisms 
- * in this system.
- *
- * @returns 0 if the system has no frequency scaling capabilities non-0 otherwise.
- **/
-int system_has_frequencyscaling();
-
-
-/**
- * This function determines wether the CPU has a variable clock speed if frequency 
- * scaling is available. 
- *
- * @returns 0 if system doesn't use frequency scaling at the moment, non-0 otherwise
- **/
-int system_uses_frequencyscaling();
-
-
-/***
- * Checks for a definition in /etc/security/limits.conf that looks
- * as if it allows RT scheduling priority.
- *
- * @returns 1 if there appears to be such a line
- **/
-int system_has_rtprio_limits_conf ();
-
-/**
- * Checks for the existence of the 'audio' group on this system
- *
- * @returns 0 is there is no 'audio' group, non-0 otherwise
- **/
-int system_has_audiogroup();
-
-
-/**
- * Tests wether the owner of this process is in the 'audio' group.
- *
- * @returns 0 if the owner of this process is not in the audio group, non-0 otherwise
- **/
-int system_user_in_audiogroup();
-
-
-/**
- * Determines wether the owner of this process can enable rt priority.
- *
- * @returns 0 if this process can not be switched to rt prio, non-0 otherwise
- **/
-int system_user_can_rtprio();
-
-
-long long unsigned int system_memlock_amount();
-
-
-/**
- * Checks wether the memlock limit is unlimited
- *
- * @returns 0 if the memlock limit is limited, non-0 otherwise
- **/
-int system_memlock_is_unlimited();
-
-
-long long unsigned int system_available_physical_mem();
-
-
-/**
- * Gets the version of the currently running kernel
- *
- * @returns String with the full version of the kernel
- **/
-char* system_kernel_version();
-
-
-/**
- * Returns the username. The caller is in charge of disposal of
- * the returned name.
- *
- * @returns Pointer to a username or NULL
- **/
-char* system_get_username();
-
-#endif /* __jack_systemtest_h__ */
diff --git a/jack/thread.h b/jack/thread.h
deleted file mode 100644
index d54d5b5..0000000
--- a/jack/thread.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-    Copyright (C) 2004 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_thread_h__
-#define __jack_thread_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <pthread.h>
-
-/* use 512KB stack per thread - the default is way too high to be feasible 
- * with mlockall() on many systems */
-#define THREAD_STACK 524288
-       
-/** @file thread.h
- *
- * Library functions to standardize thread creation for JACK and its
- * clients.  These interfaces hide some system variations in the
- * handling of realtime scheduling and associated privileges.
- */
-
-/**
- * @defgroup ClientThreads Creating and managing client threads
- * @{
- */
-
-/**
- * @returns if JACK is running with realtime scheduling, this returns
- * the priority that any JACK-created client threads will run at. 
- * Otherwise returns -1.
- */
-
-int jack_client_real_time_priority (jack_client_t*);
-
-/**
- * @returns if JACK is running with realtime scheduling, this returns
- * the maximum priority that a JACK client thread should use if the thread
- * is subject to realtime scheduling. Otherwise returns -1.
- */
-
-int jack_client_max_real_time_priority (jack_client_t*);
-
-/**
- * Attempt to enable realtime scheduling for a thread.  On some
- * systems that may require special privileges.
- *
- * @param thread POSIX thread ID.
- * @param priority requested thread priority.
- *
- * @returns 0, if successful; EPERM, if the calling process lacks
- * required realtime privileges; otherwise some other error number.
- */
-int jack_acquire_real_time_scheduling (pthread_t thread, int priority);
-
-/**
- * Create a thread for JACK or one of its clients.  The thread is
- * created executing @a start_routine with @a arg as its sole
- * argument.
- *
- * @param client the JACK client for whom the thread is being created. May be
- * NULL if the client is being created within the JACK server.
- * @param thread place to return POSIX thread ID.
- * @param priority thread priority, if realtime.
- * @param realtime true for the thread to use realtime scheduling.  On
- * some systems that may require special privileges.
- * @param start_routine function the thread calls when it starts.
- * @param arg parameter passed to the @a start_routine.
- *
- * @returns 0, if successful; otherwise some error number.
- */
-int jack_client_create_thread (jack_client_t* client,
-			       pthread_t *thread,
-			       int priority,
-			       int realtime,	/* boolean */
-			       void *(*start_routine)(void*),
-			       void *arg);
-
-/**
- * Drop realtime scheduling for a thread.
- *
- * @param thread POSIX thread ID.
- *
- * @returns 0, if successful; otherwise an error number.
- */
-int jack_drop_real_time_scheduling (pthread_t thread);
-
-typedef int (*jack_thread_creator_t)(pthread_t*,
-				     const pthread_attr_t*,
-				     void* (*function)(void*),
-				     void* arg);
-/**
- * This function can be used in very very specialized cases
- * where it is necessary that client threads created by JACK
- * are created by something other than pthread_create(). After
- * it is used, any threads that JACK needs for the client will
- * will be created by calling the function passed to this
- * function. 
- *
- * No normal application/client should consider calling this.
- * The specific case for which it was created involves running
- * win32/x86 plugins under Wine on Linux, where it is necessary
- * that all threads that might call win32 functions are known
- * to Wine.
- * 
- * @param creator a function that creates a new thread
- * 
- */
-void jack_set_thread_creator (jack_thread_creator_t creator);
-
-/* @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_thread_h__ */
diff --git a/jack/timestamps.h b/jack/timestamps.h
deleted file mode 100644
index cbef55f..0000000
--- a/jack/timestamps.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-    Copyright (C) 2002 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_timestamps_h__
-#define __jack_timestamps_h__
-
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void jack_init_timestamps (unsigned long howmany);
-void jack_timestamp (const char *what);
-void jack_dump_timestamps (FILE *out);
-void jack_reset_timestamps ();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_timestamps_h__ */
-
-
diff --git a/jack/transport.h b/jack/transport.h
deleted file mode 100644
index 69e70e2..0000000
--- a/jack/transport.h
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
-    Copyright (C) 2002 Paul Davis
-    Copyright (C) 2003 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_transport_h__
-#define __jack_transport_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <jack/types.h>
-
-#ifndef POST_PACKED_STRUCTURE
-#ifdef __GNUC__
-/* POST_PACKED_STRUCTURE needs to be a macro which
-   expands into a compiler directive. The directive must
-   tell the compiler to arrange the preceding structure
-   declaration so that it is packed on byte-boundaries rather 
-   than use the natural alignment of the processor and/or
-   compiler.
-*/
-#define POST_PACKED_STRUCTURE __attribute__((__packed__))
-#else
-/* Add other things here for non-gcc platforms */
-#endif
-#endif
-
-
-/**
- * Transport states.
- */
-typedef enum {
-
-	/* the order matters for binary compatibility */
-	JackTransportStopped = 0,	/**< Transport halted */
-	JackTransportRolling = 1,	/**< Transport playing */
-	JackTransportLooping = 2,	/**< For OLD_TRANSPORT, now ignored */
-	JackTransportStarting = 3	/**< Waiting for sync ready */
-
-} jack_transport_state_t;
-
-typedef uint64_t jack_unique_t;		/**< Unique ID (opaque) */
-
-/**
- * Optional struct jack_position_t fields.
- */
-typedef enum {
-
-	JackPositionBBT =	  0x10,	/**< Bar, Beat, Tick */
-	JackPositionTimecode =	  0x20,	/**< External timecode */
-	JackBBTFrameOffset =      0x40,	/**< Frame offset of BBT information */
-	JackAudioVideoRatio =     0x80, /**< audio frames per video frame */
-	JackVideoFrameOffset =   0x100  /**< frame offset of first video frame */
-} jack_position_bits_t;
-
-/** all valid position bits */
-#define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode|JackBBTFrameOffset|JackAudioVideoRatio|JackVideoFrameOffset)
-#define EXTENDED_TIME_INFO
-
-/**
- * Struct for transport position information.
- */
-typedef struct {
-    
-    /* these four cannot be set from clients: the server sets them */
-    jack_unique_t	unique_1;	/**< unique ID */
-    jack_time_t		usecs;		/**< monotonic, free-rolling */
-    jack_nframes_t	frame_rate;	/**< current frame rate (per second) */
-    jack_nframes_t	frame;		/**< frame number, always present */
-
-    jack_position_bits_t valid;		/**< which other fields are valid */
-
-    /* JackPositionBBT fields: */
-    int32_t		bar;		/**< current bar */
-    int32_t		beat;		/**< current beat-within-bar */
-    int32_t		tick;		/**< current tick-within-beat */
-    double		bar_start_tick;            
-
-    float		beats_per_bar;	/**< time signature "numerator" */
-    float		beat_type;	/**< time signature "denominator" */
-    double		ticks_per_beat;
-    double		beats_per_minute;
-
-    /* JackPositionTimecode fields:	(EXPERIMENTAL: could change) */
-    double		frame_time;	/**< current time in seconds */
-    double		next_time;	/**< next sequential frame_time
-					     (unless repositioned) */
-  
-    /* JackBBTFrameOffset fields: */
-    jack_nframes_t	bbt_offset;	/**< frame offset for the BBT fields
-					     (the given bar, beat, and tick
-					     values actually refer to a time
-					     frame_offset frames before the
-					     start of the cycle), should 
-					     be assumed to be 0 if 
-					     JackBBTFrameOffset is not 
-					     set. If JackBBTFrameOffset is
-					     set and this value is zero, the BBT
-					     time refers to the first frame of this
-					     cycle. If the value is positive,
-					     the BBT time refers to a frame that
-					     many frames before the start of the
-					     cycle. */
-
-    /* JACK video positional data (experimental) */
-
-    float               audio_frames_per_video_frame; /**< number of audio frames
-					     per video frame. Should be assumed
-					     zero if JackAudioVideoRatio is not
-					     set. If JackAudioVideoRatio is set
-					     and the value is zero, no video
-					     data exists within the JACK graph */
-
-    jack_nframes_t      video_offset;   /**< audio frame at which the first video
-					     frame in this cycle occurs. Should
-					     be assumed to be 0 if JackVideoFrameOffset
-					     is not set. If JackVideoFrameOffset is
-					     set, but the value is zero, there is
-					     no video frame within this cycle. */
-
-    /* For binary compatibility, new fields should be allocated from
-     * this padding area with new valid bits controlling access, so
-     * the existing structure size and offsets are preserved. */
-    int32_t		padding[7];
-
-    /* When (unique_1 == unique_2) the contents are consistent. */
-    jack_unique_t	unique_2;	/**< unique ID */
-
-} POST_PACKED_STRUCTURE jack_position_t;
-
-/**
- * @defgroup TransportControl Transport and Timebase control
- * @{
- */
-
-/**
- * Called by the timebase master to release itself from that
- * responsibility.
- *
- * If the timebase master releases the timebase or leaves the JACK
- * graph for any reason, the JACK engine takes over at the start of
- * the next process cycle.  The transport state does not change.  If
- * rolling, it continues to play, with frame numbers as the only
- * available position information.
- *
- * @see jack_set_timebase_callback
- *
- * @param client the JACK client structure.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int  jack_release_timebase (jack_client_t *client);
-
-/**
- * Prototype for the @a sync_callback defined by slow-sync clients.
- * When the client is active, this callback is invoked just before
- * process() in the same thread.  This occurs once after registration,
- * then subsequently whenever some client requests a new position, or
- * the transport enters the ::JackTransportStarting state.  This
- * realtime function must not wait.
- *
- * The transport @a state will be:
- *
- *   - ::JackTransportStopped when a new position is requested;
- *   - ::JackTransportStarting when the transport is waiting to start;
- *   - ::JackTransportRolling when the timeout has expired, and the
- *   position is now a moving target.
- *
- * @param state current transport state.
- * @param pos new transport position.
- * @param arg the argument supplied by jack_set_sync_callback().
- *
- * @return TRUE (non-zero) when ready to roll.
- */ 
-typedef int  (*JackSyncCallback)(jack_transport_state_t state,
-				 jack_position_t *pos,
-				 void *arg);
-
-/**
- * Register (or unregister) as a slow-sync client, one that cannot
- * respond immediately to transport position changes.
- *
- * The @a sync_callback will be invoked at the first available
- * opportunity after its registration is complete.  If the client is
- * currently active this will be the following process cycle,
- * otherwise it will be the first cycle after calling jack_activate().
- * After that, it runs according to the ::JackSyncCallback rules.
- * Clients that don't set a @a sync_callback are assumed to be ready
- * immediately any time the transport wants to start.
- *
- * @param client the JACK client structure.
- * @param sync_callback is a realtime function that returns TRUE when
- * the client is ready.  Setting @a sync_callback to NULL declares that
- * this client no longer requires slow-sync processing.
- * @param arg an argument for the @a sync_callback function.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int  jack_set_sync_callback (jack_client_t *client,
-			     JackSyncCallback sync_callback,
-			     void *arg);
-
-/**
- * Set the timeout value for slow-sync clients.
- *
- * This timeout prevents unresponsive slow-sync clients from
- * completely halting the transport mechanism.  The default is two
- * seconds.  When the timeout expires, the transport starts rolling,
- * even if some slow-sync clients are still unready.  The @a
- * sync_callbacks of these clients continue being invoked, giving them
- * a chance to catch up.
- *
- * @see jack_set_sync_callback
- *
- * @param client the JACK client structure.
- * @param timeout is delay (in microseconds) before the timeout expires.
- *
- * @return 0 on success, otherwise a non-zero error code.
- */
-int  jack_set_sync_timeout (jack_client_t *client,
-			    jack_time_t timeout);
-
-/**
- * Prototype for the @a timebase_callback used to provide extended
- * position information.  Its output affects all of the following
- * process cycle.  This realtime function must not wait.
- *
- * This function is called immediately after process() in the same
- * thread whenever the transport is rolling, or when any client has
- * requested a new position in the previous cycle.  The first cycle
- * after jack_set_timebase_callback() is also treated as a new
- * position, or the first cycle after jack_activate() if the client
- * had been inactive.
- *
- * The timebase master may not use its @a pos argument to set @a
- * pos->frame.  To change position, use jack_transport_reposition() or
- * jack_transport_locate().  These functions are realtime-safe, the @a
- * timebase_callback can call them directly.
- *
- * @param state current transport state.
- * @param nframes number of frames in current period.
- * @param pos address of the position structure for the next cycle; @a
- * pos->frame will be its frame number.  If @a new_pos is FALSE, this
- * structure contains extended position information from the current
- * cycle.  If TRUE, it contains whatever was set by the requester.
- * The @a timebase_callback's task is to update the extended
- * information here.
- * @param new_pos TRUE (non-zero) for a newly requested @a pos, or for
- * the first cycle after the @a timebase_callback is defined.
- * @param arg the argument supplied by jack_set_timebase_callback().
- */ 
-typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
-				     jack_nframes_t nframes, 
-				     jack_position_t *pos,
-				     int new_pos,
-				     void *arg);
-
-/**
- * Register as timebase master for the JACK subsystem.
- *
- * The timebase master registers a callback that updates extended
- * position information such as beats or timecode whenever necessary.
- * Without this extended information, there is no need for this
- * function.
- *
- * There is never more than one master at a time.  When a new client
- * takes over, the former @a timebase_callback is no longer called.
- * Taking over the timebase may be done conditionally, so it fails if
- * there was a master already.
- *
- * @param client the JACK client structure.
- * @param conditional non-zero for a conditional request.
- * @param timebase_callback is a realtime function that returns
- * position information.
- * @param arg an argument for the @a timebase_callback function.
- *
- * @return
- *   - 0 on success;
- *   - EBUSY if a conditional request fails because there was already a
- *   timebase master;
- *   - other non-zero error code.
- */
-int  jack_set_timebase_callback (jack_client_t *client,
-				 int conditional,
-				 JackTimebaseCallback timebase_callback,
-				 void *arg);
-
-/**
- * Reposition the transport to a new frame number.
- *
- * May be called at any time by any client.  The new position takes
- * effect in two process cycles.  If there are slow-sync clients and
- * the transport is already rolling, it will enter the
- * ::JackTransportStarting state and begin invoking their @a
- * sync_callbacks until ready.  This function is realtime-safe.
- *
- * @see jack_transport_reposition, jack_set_sync_callback
- * 
- * @param client the JACK client structure.
- * @param frame frame number of new transport position.
- *
- * @return 0 if valid request, non-zero otherwise.
- */
-int  jack_transport_locate (jack_client_t *client,
-			    jack_nframes_t frame);
-
-/**
- * Query the current transport state and position.
- *
- * This function is realtime-safe, and can be called from any thread.
- * If called from the process thread, @a pos corresponds to the first
- * frame of the current cycle and the state returned is valid for the
- * entire cycle.
- *
- * @param client the JACK client structure.
- * @param pos pointer to structure for returning current transport
- * position; @a pos->valid will show which fields contain valid data.
- * If @a pos is NULL, do not return position information.
- *
- * @return Current transport state.
- */
-jack_transport_state_t jack_transport_query (const jack_client_t *client,
-					     jack_position_t *pos);
-
-/**
- * Return an estimate of the current transport frame,
- * including any time elapsed since the last transport
- * positional update.
- *
- * @param client the JACK client structure
- */
-jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
-						 
-/**
- * Request a new transport position.
- *
- * May be called at any time by any client.  The new position takes
- * effect in two process cycles.  If there are slow-sync clients and
- * the transport is already rolling, it will enter the
- * ::JackTransportStarting state and begin invoking their @a
- * sync_callbacks until ready.  This function is realtime-safe.
- *
- * @see jack_transport_locate, jack_set_sync_callback
- * 
- * @param client the JACK client structure.
- * @param pos requested new transport position.
- *
- * @return 0 if valid request, EINVAL if position structure rejected.
- */
-int  jack_transport_reposition (jack_client_t *client,
-				jack_position_t *pos);
-
-/**
- * Start the JACK transport rolling.
- *
- * Any client can make this request at any time.  It takes effect no
- * sooner than the next process cycle, perhaps later if there are
- * slow-sync clients.  This function is realtime-safe.
- *
- * @see jack_set_sync_callback
- *
- * @param client the JACK client structure.
- */
-void jack_transport_start (jack_client_t *client);
-
-/**
- * Stop the JACK transport.
- *
- * Any client can make this request at any time.  It takes effect on
- * the next process cycle.  This function is realtime-safe.
- *
- * @param client the JACK client structure.
- */
-void jack_transport_stop (jack_client_t *client);
-
-/*@}*/
-
-/*********************************************************************
- * The following interfaces are DEPRECATED.  They are only provided
- * for compatibility with the earlier JACK transport implementation.
- *********************************************************************/
-
-/**
- * Optional struct jack_transport_info_t fields.
- *
- * @see jack_position_bits_t.
- */
-typedef enum {
-
-	JackTransportState =    0x1,	/**< Transport state */
-	JackTransportPosition = 0x2,	/**< Frame number */
-	JackTransportLoop =     0x4,	/**< Loop boundaries (ignored) */
-	JackTransportSMPTE =    0x8,	/**< SMPTE (ignored) */
-	JackTransportBBT =      0x10	/**< Bar, Beat, Tick */
-
-} jack_transport_bits_t;
-
-/**
- * Deprecated struct for transport position information.
- *
- * @deprecated This is for compatibility with the earlier transport
- * interface.  Use the jack_position_t struct, instead.
- */
-typedef struct {
-    
-    /* these two cannot be set from clients: the server sets them */
-
-    jack_nframes_t frame_rate;		/**< current frame rate (per second) */
-    jack_time_t    usecs;		/**< monotonic, free-rolling */
-
-    jack_transport_bits_t  valid;	/**< which fields are legal to read */
-    jack_transport_state_t transport_state;         
-    jack_nframes_t         frame;
-    jack_nframes_t         loop_start;
-    jack_nframes_t         loop_end;
-
-    long           smpte_offset;	/**< SMPTE offset (from frame 0) */
-    float          smpte_frame_rate;	/**< 29.97, 30, 24 etc. */
-
-    int            bar;
-    int            beat;
-    int            tick;
-    double         bar_start_tick;            
-
-    float          beats_per_bar;
-    float          beat_type;
-    double         ticks_per_beat;
-    double         beats_per_minute;
-
-} jack_transport_info_t;
-	
-/**
- * Gets the current transport info structure (deprecated).
- *
- * @param client the JACK client structure.
- * @param tinfo current transport info structure.  The "valid" field
- * describes which fields contain valid data.
- *
- * @deprecated This is for compatibility with the earlier transport
- * interface.  Use jack_transport_query(), instead.
- *
- * @pre Must be called from the process thread.
- */
-void jack_get_transport_info (jack_client_t *client,
-			      jack_transport_info_t *tinfo);
-
-/**
- * Set the transport info structure (deprecated).
- *
- * @deprecated This function still exists for compatibility with the
- * earlier transport interface, but it does nothing.  Instead, define
- * a ::JackTimebaseCallback.
- */
-void jack_set_transport_info (jack_client_t *client,
-			      jack_transport_info_t *tinfo);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_transport_h__ */
diff --git a/jack/types.h b/jack/types.h
deleted file mode 100644
index f3afe9e..0000000
--- a/jack/types.h
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
-    Copyright (C) 2001 Paul Davis
-    Copyright (C) 2004 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_types_h__
-#define __jack_types_h__
-
-#include <inttypes.h>
-
-typedef int32_t jack_shmsize_t;
-
-/**
- * Type used to represent sample frame counts.
- */
-typedef uint32_t	     jack_nframes_t;
-
-/**
- * Maximum value that can be stored in jack_nframes_t
- */
-#define JACK_MAX_FRAMES (4294967295U)	/* This should be UINT32_MAX, but
-					   C++ has a problem with that. */
-
-/**
- * Type used to represent the value of free running
- * monotonic clock with units of microseconds.
- */
-typedef uint64_t jack_time_t;
-
-/**
- *  Maximum size of @a load_init string passed to an internal client
- *  jack_initialize() function via jack_internal_client_load().
- */
-#define JACK_LOAD_INIT_LIMIT 1024
-
-/**
- *  jack_intclient_t is an opaque type representing a loaded internal
- *  client.  You may only access it using the API provided in @ref
- *  intclient.h "<jack/intclient.h>".
- */
-typedef uint64_t jack_intclient_t;
-
-/**
- *  jack_port_t is an opaque type.  You may only access it using the
- *  API provided.
- */
-typedef struct _jack_port    jack_port_t;
-
-/**
- *  jack_client_t is an opaque type.  You may only access it using the
- *  API provided.
- */
-typedef struct _jack_client  jack_client_t;
-
-/**
- *  Ports have unique ids. A port registration callback is the only
- *  place you ever need to know their value.
- */
-typedef uint32_t	     jack_port_id_t;
-
-
-/**
- *  @ref jack_options_t bits
- */
-enum JackOptions {
-
-     /**
-      * Null value to use when no option bits are needed.
-      */
-     JackNullOption = 0x00,
-
-     /**
-      * Do not automatically start the JACK server when it is not
-      * already running.  This option is always selected if
-      * \$JACK_NO_START_SERVER is defined in the calling process
-      * environment.
-      */
-     JackNoStartServer = 0x01,
-
-     /**
-      * Use the exact client name requested.  Otherwise, JACK
-      * automatically generates a unique one, if needed.
-      */
-     JackUseExactName = 0x02,
-
-     /**
-      * Open with optional <em>(char *) server_name</em> parameter.
-      */
-     JackServerName = 0x04,
-
-     /**
-      * Load internal client from optional <em>(char *)
-      * load_name</em>.  Otherwise use the @a client_name.
-      */
-     JackLoadName = 0x08,
-
-     /**
-      * Pass optional <em>(char *) load_init</em> string to the
-      * jack_initialize() entry point of an internal client.
-      */
-     JackLoadInit = 0x10
-};
-
-/** Valid options for opening an external client. */
-#define JackOpenOptions (JackServerName|JackNoStartServer|JackUseExactName)
-
-/** Valid options for loading an internal client. */
-#define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
-
-/**
- *  Options for several JACK operations, formed by OR-ing together the
- *  relevant @ref JackOptions bits.
- */
-typedef enum JackOptions jack_options_t;
-
-/**
- *  @ref jack_status_t bits
- */
-enum JackStatus {
-
-     /**
-      * Overall operation failed.
-      */
-     JackFailure = 0x01,
-
-     /**
-      * The operation contained an invalid or unsupported option.
-      */
-     JackInvalidOption = 0x02,
-
-     /**
-      * The desired client name was not unique.  With the @ref
-      * JackUseExactName option this situation is fatal.  Otherwise,
-      * the name was modified by appending a dash and a two-digit
-      * number in the range "-01" to "-99".  The
-      * jack_get_client_name() function will return the exact string
-      * that was used.  If the specified @a client_name plus these
-      * extra characters would be too long, the open fails instead.
-      */
-     JackNameNotUnique = 0x04,
-
-     /**
-      * The JACK server was started as a result of this operation.
-      * Otherwise, it was running already.  In either case the caller
-      * is now connected to jackd, so there is no race condition.
-      * When the server shuts down, the client will find out.
-      */
-     JackServerStarted = 0x08,
-
-     /**
-      * Unable to connect to the JACK server.
-      */
-     JackServerFailed = 0x10,
-
-     /**
-      * Communication error with the JACK server.
-      */
-     JackServerError = 0x20,
-
-     /**
-      * Requested client does not exist.
-      */
-     JackNoSuchClient = 0x40,
-
-     /**
-      * Unable to load internal client
-      */
-     JackLoadFailure = 0x80,
-
-     /**
-      * Unable to initialize client
-      */
-     JackInitFailure = 0x100,
-
-     /**
-      * Unable to access shared memory
-      */
-     JackShmFailure = 0x200,
-
-     /**
-      * Client's protocol version does not match
-      */
-     JackVersionError = 0x400,
-
-     /*
-      * BackendError
-      */
-     JackBackendError = 0x800,
-
-     /*
-      * Client is being shutdown against its will
-      */
-     JackClientZombie = 0x1000
-};
-
-/**
- *  Status word returned from several JACK operations, formed by
- *  OR-ing together the relevant @ref JackStatus bits.
- */
-typedef enum JackStatus jack_status_t;
-
-/**
- * Prototype for the client supplied function that is called 
- * by the engine anytime there is work to be done.
- *
- * @pre nframes == jack_get_buffer_size()
- * @pre nframes == pow(2,x)
- *
- * @param nframes number of frames to process
- * @param arg pointer to a client supplied data
- *
- * @return zero on success, non-zero on error
- */ 
-typedef int  (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * once after the creation of the thread in which other
- * callbacks will be made. Special thread characteristics
- * can be set from this callback, for example. This is a
- * highly specialized callback and most clients will not
- * and should not use it.
- *
- * @param arg pointer to a client supplied structure
- *
- * @return void
- */ 
-typedef void  (*JackThreadInitCallback)(void *arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * whenever the processing graph is reordered.
- *
- * @param arg pointer to a client supplied data
- *
- * @return zero on success, non-zero on error
- */ 
-typedef int  (*JackGraphOrderCallback)(void *arg);
-
-/**
- * Prototype for the client-supplied function that is called whenever
- * an xrun has occured.
- *
- * @see jack_get_xrun_delayed_usecs()
- *
- * @param arg pointer to a client supplied data
- *
- * @return zero on success, non-zero on error
- */ 
-typedef int  (*JackXRunCallback)(void *arg);
-
-/**
- * Prototype for the @a bufsize_callback that is invoked whenever the
- * JACK engine buffer size changes.  Although this function is called
- * in the JACK process thread, the normal process cycle is suspended
- * during its operation, causing a gap in the audio flow.  So, the @a
- * bufsize_callback can allocate storage, touch memory not previously
- * referenced, and perform other operations that are not realtime
- * safe.
- *
- * @param nframes buffer size
- * @param arg pointer supplied by jack_set_buffer_size_callback().
- *
- * @return zero on success, non-zero on error
- */ 
-typedef int  (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * when the engine sample rate changes.
- *
- * @param nframes new engine sample rate
- * @param arg pointer to a client supplied data
- *
- * @return zero on success, non-zero on error
- */ 
-typedef int  (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * whenever a port is registered or unregistered.
- *
- * @param port the ID of the port 
- * @param arg pointer to a client supplied data
- * @param register non-zero if the port is being registered,
- *                     zero if the port is being unregistered
- */ 
-typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int register, void *arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * whenever a client is registered or unregistered.
- *
- * @param name a null-terminated string containing the client name 
- * @param register non-zero if the client is being registered,
- *                     zero if the client is being unregistered
- * @param arg pointer to a client supplied data
- */ 
-typedef void (*JackClientRegistrationCallback)(const char* name, int register, void *arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * whenever a client is registered or unregistered.
- *
- * @param a one of two ports connected or disconnected
- * @param b one of two ports connected or disconnected
- * @param connect non-zero if ports were connected
- *                    zero if ports were disconnected
- * @param arg pointer to a client supplied data
- */ 
-typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
-
-/**
- * Prototype for the client supplied function that is called 
- * whenever jackd starts or stops freewheeling.
- *
- * @param starting non-zero if we start starting to freewheel, zero otherwise
- * @param arg pointer to a client supplied structure
- */ 
-typedef void (*JackFreewheelCallback)(int starting, void *arg);
-
-typedef void *(*JackThreadCallback)(void* arg);
-
-/**
- * Prototype for the client supplied function that is called
- * whenever jackd is shutdown. Note that after server shutdown, 
- * the client pointer is *not* deallocated by libjack,
- * the application is responsible to properly use jack_client_close()
- * to release client ressources. Warning: jack_client_close() cannot be
- * safely used inside the shutdown callback and has to be called outside of
- * the callback context.
- *
- * @param arg pointer to a client supplied structure
- */
-typedef void (*JackShutdownCallback)(void *arg);
-
-/**
- * Prototype for the client supplied function that is called
- * whenever jackd is shutdown. Note that after server shutdown, 
- * the client pointer is *not* deallocated by libjack,
- * the application is responsible to properly use jack_client_close()
- * to release client ressources. Warning: jack_client_close() cannot be
- * safely used inside the shutdown callback and has to be called outside of
- * the callback context.
- 
- * @param code a shuntdown code
- * @param reason a string discribing the shuntdown reason (backend failure, server crash... etc...)
- * @param arg pointer to a client supplied structure
- */
-typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
-
-/**
- * Used for the type argument of jack_port_register() for default
- * audio and midi ports.
- */
-#define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
-#define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
-
-/**
- * For convenience, use this typedef if you want to be able to change
- * between float and double. You may want to typedef sample_t to
- * jack_default_audio_sample_t in your application.
- */
-typedef float jack_default_audio_sample_t;
-
-/**
- *  A port has a set of flags that are formed by AND-ing together the
- *  desired values from the list below. The flags "JackPortIsInput" and
- *  "JackPortIsOutput" are mutually exclusive and it is an error to use
- *  them both.
- */
-enum JackPortFlags {
-
-     /**
-      * if JackPortIsInput is set, then the port can receive
-      * data.
-      */
-     JackPortIsInput = 0x1,
-
-     /**
-      * if JackPortIsOutput is set, then data can be read from
-      * the port.
-      */
-     JackPortIsOutput = 0x2,
-
-     /**
-      * if JackPortIsPhysical is set, then the port corresponds
-      * to some kind of physical I/O connector.
-      */
-     JackPortIsPhysical = 0x4, 
-
-     /**
-      * if JackPortCanMonitor is set, then a call to
-      * jack_port_request_monitor() makes sense.
-      *
-      * Precisely what this means is dependent on the client. A typical
-      * result of it being called with TRUE as the second argument is
-      * that data that would be available from an output port (with
-      * JackPortIsPhysical set) is sent to a physical output connector
-      * as well, so that it can be heard/seen/whatever.
-      * 
-      * Clients that do not control physical interfaces
-      * should never create ports with this bit set.
-      */
-     JackPortCanMonitor = 0x8,
-
-     /**
-      * JackPortIsTerminal means:
-      *
-      *	for an input port: the data received by the port
-      *                    will not be passed on or made
-      *		           available at any other port
-      *
-      * for an output port: the data available at the port
-      *                    does not originate from any other port
-      *
-      * Audio synthesizers, I/O hardware interface clients, HDR
-      * systems are examples of clients that would set this flag for
-      * their ports.
-      */
-     JackPortIsTerminal = 0x10
-};	    
-
-
-#endif /* __jack_types_h__ */
diff --git a/jack/unlock.h b/jack/unlock.h
deleted file mode 100644
index 3979efb..0000000
--- a/jack/unlock.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jack_mlock_h__
-#define __jack_mlock_h__
-
-extern void cleanup_mlock (void);
-
-#endif /* __jack_mlock_h__ */
diff --git a/jack/varargs.h b/jack/varargs.h
deleted file mode 100644
index a2e6a91..0000000
--- a/jack/varargs.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Copyright (C) 2004 Jack O'Quin
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation; either version 2.1 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *  
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software 
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __jack_varargs_h__
-#define __jack_varargs_h__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* variable argument structure */
-typedef struct {
-	char *server_name;		/* server name */
-	char *load_name;		/* load module name */
-	char *load_init;		/* initialization string */
-} jack_varargs_t;
-
-static inline void
-jack_varargs_init (jack_varargs_t *va)
-{
-	memset (va, 0, sizeof(jack_varargs_t));
-	va->server_name = jack_default_server_name ();
-}
-
-static inline void
-jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va)
-{
-	/* initialize default settings */
-	jack_varargs_init (va);
-
-	if ((options & JackServerName)) {
-		char *sn = va_arg(ap, char *);
-		if (sn)
-			va->server_name = sn;
-	}
-	if ((options & JackLoadName))
-		va->load_name = va_arg(ap, char *);
-	if ((options & JackLoadInit))
-		va->load_init = va_arg(ap, char *);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __jack_varargs_h__ */
diff --git a/jack/version.h.in b/jack/version.h.in
deleted file mode 100644
index d262665..0000000
--- a/jack/version.h.in
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-    Copyright (C) 2003 Paul Davis
-
-    @configure_input@
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-#define jack_protocol_version @JACK_PROTOCOL_VERSION@
diff --git a/jackd/.cvsignore b/jackd/.cvsignore
deleted file mode 100644
index 549546f..0000000
--- a/jackd/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-jack_md5.h
-jackd
-jackd.1
-jackstart
diff --git a/jackd/ChangeLog b/jackd/ChangeLog
deleted file mode 100644
index 5a71f6e..0000000
--- a/jackd/ChangeLog
+++ /dev/null
@@ -1,14 +0,0 @@
-2004-09-08  Taybin Rutkin  <taybin>
-	* jackd.c: Better error reporting if/when dlopen() fails.
-
-2003-03-05  Taybin Rutkin  <taybin>
-	* jackd.c: added version flag.  -V and --version are accepted.
-
-2003-02-21  Paul Davis  <paul>
-	* jackd.c: modified signal catching design to actually follow
-	sigwait() specifications (ie. install handlers for all blocked
-	signals). also removed some dead code from benchmarking/debugging.
-
-2003-2-10 Taybin Rutkin <trutkin at physics.clarku.edu>
-	* Initial Changelog
-	* engine.c (handle_new_client): Returns protocol version for checking.
diff --git a/jackd/Makefile.am b/jackd/Makefile.am
deleted file mode 100644
index adf5be5..0000000
--- a/jackd/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in jackd.1 jack_md5.h 
-
-if USE_CAPABILITIES
-CAP_PROGS = jackstart
-CAP_LIBS = -lcap
-install-exec-hook:
-	if [ "`id -u`" = "0" ]; \
-	then	chown root.root $(DESTDIR)$(bindir)/jackd; \
-			chmod 555 $(DESTDIR)$(bindir)/jackd; \
-			chown root.root $(DESTDIR)$(bindir)/jackstart; \
-			chmod 4555 $(DESTDIR)$(bindir)/jackstart; \
-	else    echo "You must be root to set ownership and permissions"; \
-			echo " for jackd and jackstart."; \
-	fi
-else
-CAP_PROGS =
-CAP_LIBS =
-install-exec-hook:
-	@echo "Nothing to make for $@."
-endif
-
-bin_PROGRAMS = jackd $(CAP_PROGS)
-
-AM_CFLAGS = $(JACK_CFLAGS) -DJACK_LOCATION=\"$(bindir)\"
-
-jackd_SOURCES = jackd.c
-jackd_LDADD = libjackserver.la $(CAP_LIBS) @OS_LDFLAGS@
-
-noinst_HEADERS = jack_md5.h md5.h md5_loc.h \
-		 clientengine.h transengine.h
-
-BUILT_SOURCES = jack_md5.h
-
-jack_md5.h: jackd
-if STRIPPED_JACKD
-	strip -R .note -R .comment .libs/jackd
-endif
-	echo "#define JACKD_MD5_SUM \"`md5sum .libs/jackd | awk '{print $$1}'`\"" > jack_md5.h
-
-jackstart_SOURCES = jackstart.c md5.c
-jackstart_LDFLAGS = -lcap
-
-lib_LTLIBRARIES	= libjackserver.la
-
-libjackserver_la_CFLAGS = $(AM_CFLAGS)
-
-libjackserver_la_SOURCES = engine.c clientengine.c transengine.c \
-	../libjack/systemtest.c ../libjack/sanitycheck.c \
-	../libjack/client.c ../libjack/driver.c ../libjack/intclient.c \
-        ../libjack/messagebuffer.c ../libjack/pool.c ../libjack/port.c \
-        ../libjack/midiport.c ../libjack/ringbuffer.c ../libjack/shm.c \
-        ../libjack/thread.c ../libjack/time.c  ../libjack/transclient.c \
-        ../libjack/unlock.c
-libjackserver_la_LIBADD  = simd.lo @OS_LDFLAGS@
-libjackserver_la_LDFLAGS  = -export-dynamic -version-info @JACK_SO_VERSION@
-
-simd.lo: $(srcdir)/../libjack/simd.c
-	$(LIBTOOL) --mode=compile $(CC) -I$(top_builddir) $(JACK_CORE_CFLAGS) $(SIMD_CFLAGS) -c -o simd.lo $(srcdir)/../libjack/simd.c
-
-man_MANS = jackd.1 jackstart.1
-EXTRA_DIST = $(man_MANS)
-
-dist-hook:
-	rm -f $(distdir)/jack_md5.h
-distclean-local:
-	rm -f $(top_builddir)/jackd/jack_md5.h
diff --git a/jackd/clientengine.c b/jackd/clientengine.c
deleted file mode 100644
index 4e245ca..0000000
--- a/jackd/clientengine.c
+++ /dev/null
@@ -1,1015 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
- *  Client creation and destruction interfaces for JACK engine.
- *
- *  Copyright (C) 2001-2003 Paul Davis
- *  Copyright (C) 2004 Jack O'Quin
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/messagebuffer.h>
-#include <jack/version.h>
-#include <sysdeps/poll.h>
-#include <sysdeps/ipc.h>
-
-#include "clientengine.h"
-#include "transengine.h"
-
-#include "libjack/local.h"
-
-static void
-jack_client_disconnect_ports (jack_engine_t *engine,
-			      jack_client_internal_t *client)
-{
-	JSList *node;
-	jack_port_internal_t *port;
-
-	/* call tree **** MUST HOLD *** engine->client_lock */
-
-	for (node = client->ports; node; node = jack_slist_next (node)) {
-		port = (jack_port_internal_t *) node->data;
-		jack_port_clear_connections (engine, port);
-		jack_port_registration_notify (engine, port->shared->id, FALSE);
-		jack_port_release (engine, port);
-	}
-
-	jack_slist_free (client->ports);
-	jack_slist_free (client->truefeeds);
-	jack_slist_free (client->sortfeeds);
-	client->truefeeds = 0;
-	client->sortfeeds = 0;
-	client->ports = 0;
-}			
-
-int
-jack_client_do_deactivate (jack_engine_t *engine,
-			   jack_client_internal_t *client, int sort_graph)
-{
-	/* caller must hold engine->client_lock and must have checked for and/or
-	 *   cleared all connections held by client. 
-	 */
-	VERBOSE(engine,"+++ deactivate %s", client->control->name);
-
-	client->control->active = FALSE;
-
-	jack_transport_client_exit (engine, client);
-
-	if (!jack_client_is_internal (client) &&
-	    engine->external_client_cnt > 0) {	
-		engine->external_client_cnt--;
-	}
-	
-	if (sort_graph) {
-		jack_sort_graph (engine);
-	}
-	return 0;
-}
-
-static void
-jack_zombify_client (jack_engine_t *engine, jack_client_internal_t *client)
-{
-	VERBOSE (engine, "removing client \"%s\" from the processing chain",
-		 client->control->name);
-
-	/* caller must hold the client_lock */
-
-	/* this stops jack_deliver_event() from contacing this client */
-
-	client->control->dead = TRUE;
-
-	jack_client_disconnect_ports (engine, client);
-	jack_client_do_deactivate (engine, client, FALSE);
-}
-
-static void
-jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client)
-{
-	JSList *node;
-
-	/* caller must write-hold the client lock */
-
-	VERBOSE (engine, "removing client \"%s\"", client->control->name);
-
-	/* if its not already a zombie, make it so */
-
-	if (!client->control->dead) {
-		jack_zombify_client (engine, client);
-	}
-
-	if (client->control->type == ClientExternal) {
-
-		/* try to force the server thread to return from poll */
-	
-		close (client->event_fd);
-		close (client->request_fd);
-	}
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		if (((jack_client_internal_t *) node->data)->control->id
-		    == client->control->id) {
-			engine->clients =
-				jack_slist_remove_link (engine->clients, node);
-			jack_slist_free_1 (node);
-			break;
-		}
-	}
-
-	jack_client_delete (engine, client);
-
-	/* ignore the driver, which counts as a client. */
-
-	if (engine->temporary && (jack_slist_length(engine->clients) <= 1)) {
-		if (engine->wait_pid >= 0) {
-			/* tell the waiter we're done
-			   to initiate a normal shutdown.
-			*/
-			VERBOSE (engine, "Kill wait pid to stop");
-			kill (engine->wait_pid, SIGUSR2);
-			sleep (-1);
-		} else {
-			exit (0);
-		}
-
-	}
-}
-
-static void
-jack_wake_server_thread (jack_engine_t* engine)
-{
-	char c = 0;
-	/* we don't actually care if this fails */
-	VERBOSE (engine, "waking server thread");
-	write (engine->cleanup_fifo[1], &c, 1);
-}
-
-void
-jack_check_clients (jack_engine_t* engine, int with_timeout_check)
-{
-	/* CALLER MUST HOLD graph read lock */
-
-	JSList* node;
-	jack_client_internal_t* client;
-	int errs = 0;
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-
-		client = (jack_client_internal_t *) node->data;
-
-		if (client->error) {
-			errs++;
-			continue;
-		}
-
-		if (with_timeout_check) {
-
-			/* we can only consider the timeout a client error if
-			 * it actually woke up.  its possible that the kernel
-			 * scheduler screwed us up and never woke up the
-			 * client in time. sigh.
-			 */
-			
-			VERBOSE (engine, "checking client %s: awake at %" PRIu64 " finished at %" PRIu64, 
-				 client->control->name,
-				 client->control->awake_at,
-				 client->control->finished_at);
-			
-			if (client->control->awake_at > 0) {
-				if (client->control->finished_at == 0) {
-					client->control->timed_out++;
-					client->error++;
-					VERBOSE (engine, "client %s has timed out", client->control->name);
-				}
-			}
-		}
-	}
-		
-	if (errs) {
-		jack_lock_problems (engine);
-		engine->problems++;
-		jack_unlock_problems (engine);
-		jack_wake_server_thread (engine);
-	}
-}
-
-void
-jack_remove_clients (jack_engine_t* engine)
-{
-	JSList *tmp, *node;
-	int need_sort = FALSE;
-	jack_client_internal_t *client;
-
-	/* CALLER MUST HOLD GRAPH LOCK */
-
-	VERBOSE (engine, "++ Removing failed clients ...");
-
-	/* remove all dead clients */
-
-	for (node = engine->clients; node; ) {
-		
-		tmp = jack_slist_next (node);
-		
-		client = (jack_client_internal_t *) node->data;
-
-		VERBOSE(engine, "client %s error status %d", client->control->name, client->error);
-		
-		if (client->error) {
-			
-			/* if we have a communication problem with the
-			   client, remove it. otherwise, turn it into
-			   a zombie. the client will/should realize
-			   this and will close its sockets.  then
-			   we'll end up back here again and will
-			   finally remove the client.
-			*/
-			if (client->error >= JACK_ERROR_WITH_SOCKETS) {
-				VERBOSE (engine, "removing failed "
-					 "client %s state = %s errors"
-					 " = %d", 
-					 client->control->name,
-					 jack_client_state_name (client),
-					 client->error);
-				jack_remove_client (engine,
-						    (jack_client_internal_t *)
-						    node->data);
-			} else {
-				VERBOSE (engine, "client failure: "
-					 "client %s state = %s errors"
-					 " = %d", 
-					 client->control->name,
-					 jack_client_state_name (client),
-					 client->error);
-				if (!engine->nozombies) {
-					jack_zombify_client (engine,
-							     (jack_client_internal_t *)
-							     node->data);
-					client->error = 0;
-				}
-			}
-			
-			need_sort = TRUE;
-		}
-		
-		node = tmp;
-	}
-
-	if (need_sort) {
-		jack_sort_graph (engine);
-	}
-	
-	jack_engine_reset_rolling_usecs (engine);
-
-	VERBOSE (engine, "-- Removing failed clients ...");
-}
-
-static int
-jack_load_client (jack_engine_t *engine, jack_client_internal_t *client,
-		  const char *so_name)
-{
-	const char *errstr;
-	char path_to_so[PATH_MAX+1];
-
-	snprintf (path_to_so, sizeof (path_to_so), ADDON_DIR "/%s.so", so_name);
-	client->handle = dlopen (path_to_so, RTLD_NOW|RTLD_GLOBAL);
-	
-	if (client->handle == 0) {
-		if ((errstr = dlerror ()) != 0) {
-			jack_error ("%s", errstr);
-		} else {
-			jack_error ("bizarre error loading %s", so_name);
-		}
-		return -1;
-	}
-
-	client->initialize = dlsym (client->handle, "jack_initialize");
-
-	if ((errstr = dlerror ()) != 0) {
-		jack_error ("%s has no initialize() function\n", so_name);
-		dlclose (client->handle);
-		client->handle = 0;
-		return -1;
-	}
-
-	client->finish = (void (*)(void *)) dlsym (client->handle,
-						   "jack_finish");
-	
-	if ((errstr = dlerror ()) != 0) {
-		jack_error ("%s has no finish() function", so_name);
-		dlclose (client->handle);
-		client->handle = 0;
-		return -1;
-	}
-
-	return 0;
-}
-
-static void
-jack_client_unload (jack_client_internal_t *client)
-{
-	if (client->handle) {
-		if (client->finish) {
-			client->finish (client->private_client->process_arg);
-		}
-		dlclose (client->handle);
-	}
-}
-
-static jack_client_internal_t *
-jack_client_by_name (jack_engine_t *engine, const char *name)
-{
-	jack_client_internal_t *client = NULL;
-	JSList *node;
-
-	jack_rdlock_graph (engine);
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		if (strcmp ((const char *) ((jack_client_internal_t *)
-					    node->data)->control->name,
-			    name) == 0) {
-			client = (jack_client_internal_t *) node->data;
-			break;
-		}
-	}
-
-	jack_unlock_graph (engine);
-	return client;
-}
-
-static jack_client_id_t
-jack_client_id_by_name (jack_engine_t *engine, const char *name)
-{
-	jack_client_id_t id = 0;	/* NULL client ID */
-	JSList *node;
-
-	jack_rdlock_graph (engine);
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		if (strcmp ((const char *) ((jack_client_internal_t *)
-					    node->data)->control->name,
-			    name) == 0) {
-			jack_client_internal_t *client = 
-				(jack_client_internal_t *) node->data;
-			id = client->control->id;
-			break;
-		}
-	}
-
-	jack_unlock_graph (engine);
-	return id;
-}
-
-jack_client_internal_t *
-jack_client_internal_by_id (jack_engine_t *engine, jack_client_id_t id)
-{
-	jack_client_internal_t *client = NULL;
-	JSList *node;
-
-	/* call tree ***MUST HOLD*** the graph lock */
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-
-		if (((jack_client_internal_t *) node->data)->control->id
-		    == id) {
-			client = (jack_client_internal_t *) node->data;
-			break;
-		}
-	}
-
-	return client;
-}
-
-/* generate a unique client name
- *
- * returns 0 if successful, updates name in place
- */
-static inline int
-jack_generate_unique_name (jack_engine_t *engine, char *name)
-{
-	int tens, ones;
-	int length = strlen (name);
-
-	if (length > JACK_CLIENT_NAME_SIZE - 4) {
-		jack_error ("%s exists and is too long to make unique", name);
-		return 1;		/* failure */
-	}
-
-	/*  generate a unique name by appending "-01".."-99" */
-	name[length++] = '-';
-	tens = length++;
-	ones = length++;
-	name[tens] = '0';
-	name[ones] = '1';
-	name[length] = '\0';
-	while (jack_client_by_name (engine, name)) {
-		if (name[ones] == '9') {
-			if (name[tens] == '9') {
-				jack_error ("client %s has 99 extra"
-					    " instances already", name);
-				return 1; /* give up */
-			}
-			name[tens]++;
-			name[ones] = '0';
-		} else {
-			name[ones]++;
-		}
-	}
-	return 0;
-}
-
-static int
-jack_client_name_invalid (jack_engine_t *engine, char *name,
-			  jack_options_t options, jack_status_t *status)
-{
-	/* Since this is always called from the server thread, no
-	 * other new client will be created at the same time.  So,
-	 * testing a name for uniqueness is valid here.  When called
-	 * from jack_engine_load_driver() this is not strictly true,
-	 * but that seems to be adequately serialized due to engine
-	 * startup.  There are no other clients at that point, anyway.
-	 */
-
-	if (jack_client_by_name (engine, name)) {
-
-		*status |= JackNameNotUnique;
-
-		if (options & JackUseExactName) {
-			jack_error ("cannot create new client; %s already"
-				    " exists", name);
-			*status |= JackFailure;
-			return TRUE;
-		}
-
-		if (jack_generate_unique_name(engine, name)) {
-			*status |= JackFailure;
-			return TRUE;
-		}
-	}
-
-	return FALSE;
-}
-
-/* Set up the engine's client internal and control structures for both
- * internal and external clients. */
-static jack_client_internal_t *
-jack_setup_client_control (jack_engine_t *engine, int fd,
-			   ClientType type, const char *name)
-{
-	jack_client_internal_t *client;
-
-	client = (jack_client_internal_t *)
-		malloc (sizeof (jack_client_internal_t));
-
-	client->request_fd = fd;
-	client->event_fd = -1;
-	client->ports = 0;
-	client->truefeeds = 0;
-	client->sortfeeds = 0;
-	client->execution_order = UINT_MAX;
-	client->next_client = NULL;
-	client->handle = NULL;
-	client->finish = NULL;
-	client->error = 0;
-
-	if (type != ClientExternal) {
-		
-		client->control = (jack_client_control_t *)
-			malloc (sizeof (jack_client_control_t));		
-
-	} else {
-
-                if (jack_shmalloc (sizeof (jack_client_control_t), 
-				   &client->control_shm)) {
-                        jack_error ("cannot create client control block for %s",
-				    name);
-			free (client);
-                        return 0;
-                }
-
-		if (jack_attach_shm (&client->control_shm)) {
-			jack_error ("cannot attach to client control block "
-				    "for %s (%s)", name, strerror (errno));
-			jack_destroy_shm (&client->control_shm);
-			free (client);
-			return 0;
-		}
-
-		client->control = (jack_client_control_t *)
-			jack_shm_addr (&client->control_shm);
-	}
-
-	client->control->type = type;
-	client->control->active = 0;
-	client->control->dead = FALSE;
-	client->control->timed_out = 0;
-	client->control->id = engine->next_client_id++;
-	strcpy ((char *) client->control->name, name);
-	client->subgraph_start_fd = -1;
-	client->subgraph_wait_fd = -1;
-
-	client->control->process_cbset = FALSE;
-	client->control->bufsize_cbset = FALSE;
-	client->control->srate_cbset = FALSE;
-	client->control->xrun_cbset = FALSE;
-	client->control->port_register_cbset = FALSE;
-	client->control->port_connect_cbset = FALSE;
-	client->control->graph_order_cbset = FALSE;
-	client->control->client_register_cbset = FALSE;
-	client->control->thread_cb_cbset = FALSE;
-
-#if 0
-	if (type != ClientExternal) {
-	    client->process = NULL;
-	    client->process_arg = NULL;
-	    client->bufsize = NULL;
-	    client->bufsize_arg = NULL;
-	    client->srate = NULL;
-	    client->srate_arg = NULL;
-	    client->xrun = NULL;
-	    client->xrun_arg = NULL;
-	    client->port_register = NULL;
-	    client->port_register_arg = NULL;
-	    client->port_connect = NULL;
-	    client->port_connect_arg = NULL;
-	    client->graph_order = NULL;
-	    client->graph_order_arg = NULL;
-	    client->client_register = NULL;
-	    client->client_register_arg = NULL;
-	    client->thread_cb = NULL;
-	    client->thread_cb_arg = NULL;
-	}
-#endif
-	jack_transport_client_new (client);
-        
-#ifdef JACK_USE_MACH_THREADS
-        /* specific resources for server/client real-time thread
-	 * communication */
-        allocate_mach_serverport(engine, client);
-        client->running = FALSE;
-#endif
-
-	return client;
-}
-
-/* set up all types of clients */
-static jack_client_internal_t *
-setup_client (jack_engine_t *engine, ClientType type, char *name,
-	      jack_options_t options, jack_status_t *status, int client_fd,
-	      const char *object_path, const char *object_data)
-{
-	/* called with the request_lock */
-	jack_client_internal_t *client;
-
-	/* validate client name, generate a unique one if appropriate */
-	if (jack_client_name_invalid (engine, name, options, status))
-		return NULL;
-
-	/* create a client struct for this name */
-	if ((client = jack_setup_client_control (engine, client_fd,
-						 type, name)) == NULL) {
-		*status |= (JackFailure|JackInitFailure);
-		jack_error ("cannot create new client object");
-		return NULL;
-	}
-
-	/* only for internal clients, driver is already loaded */
-	if (type == ClientInternal) {
-		if (jack_load_client (engine, client, object_path)) {
-			jack_error ("cannot dynamically load client from"
-				    " \"%s\"", object_path);
-			jack_client_delete (engine, client);
-			*status |= (JackFailure|JackLoadFailure);
-			return NULL;
-		}
-	}
-
-	VERBOSE (engine, "new client: %s, id = %" PRIu32
-		 " type %d @ %p fd = %d", 
-		 client->control->name, client->control->id, 
-		 type, client->control, client_fd);
-
-	if (jack_client_is_internal(client)) {
-
-	    // XXX: do i need to lock the graph here ?
-	    // i moved this one up in the init process, lets see what happens.
-
-		/* Internal clients need to make regular JACK API
-		 * calls, which need a jack_client_t structure.
-		 * Create one here.
-		 */
-		client->private_client =
-			jack_client_alloc_internal (client->control, engine);
-
-		/* Set up the pointers necessary for the request
-		 * system to work.  The client is in the same address
-		 * space */
-
-		client->private_client->deliver_request = internal_client_request;
-		client->private_client->deliver_arg = engine;
-	}
-
-	/* add new client to the clients list */
-	jack_lock_graph (engine);
- 	engine->clients = jack_slist_prepend (engine->clients, client);
-	jack_engine_reset_rolling_usecs (engine);
-	
-	if (jack_client_is_internal(client)) {
-
-
-		jack_unlock_graph (engine);
-
-		/* Call its initialization function.  This function
-		 * may make requests of its own, so we temporarily
-		 * release and then reacquire the request_lock.  */
-		if (client->control->type == ClientInternal) {
-
-			pthread_mutex_unlock (&engine->request_lock);
-			if (client->initialize (client->private_client,
-						object_data)) {
-
-				/* failed: clean up client data */
-				VERBOSE (engine,
-					 "%s jack_initialize() failed!",
-					 client->control->name);
-				jack_lock_graph (engine);
-				jack_remove_client (engine, client);
-				jack_unlock_graph (engine);
-				*status |= (JackFailure|JackInitFailure);
-				client = NULL;
-				//JOQ: not clear that all allocated
-				//storage has been cleaned up properly.
-			}
-			pthread_mutex_lock (&engine->request_lock);
-		}
-
-	} else {			/* external client */
-
-		jack_unlock_graph (engine);
-	}
-	
-	return client;
-}
-
-jack_client_internal_t *
-jack_create_driver_client (jack_engine_t *engine, char *name)
-{
-	jack_client_connect_request_t req;
-	jack_status_t status;
-	jack_client_internal_t *client;
-
-	snprintf (req.name, sizeof (req.name), "%s", name);
-
-	pthread_mutex_lock (&engine->request_lock);
-	client = setup_client (engine, ClientDriver, name, JackUseExactName,
-			       &status, -1, NULL, NULL);
-	pthread_mutex_unlock (&engine->request_lock);
-
-	return client;
-}
-
-static jack_status_t
-handle_unload_client (jack_engine_t *engine, jack_client_id_t id)
-{
-	/* called *without* the request_lock */
-	jack_client_internal_t *client;
-	jack_status_t status = (JackNoSuchClient|JackFailure);
-
-	jack_lock_graph (engine);
-
-	if ((client = jack_client_internal_by_id (engine, id))) {
-		VERBOSE (engine, "unloading client \"%s\"",
-			 client->control->name);
-		jack_remove_client (engine, client);
-		status = 0;
-	}
-
-	jack_unlock_graph (engine);
-
-	return status;
-}
-
-int
-jack_client_create (jack_engine_t *engine, int client_fd)
-{
-	/* called *without* the request_lock */
-	jack_client_internal_t *client;
-	jack_client_connect_request_t req;
-	jack_client_connect_result_t res;
-	ssize_t nbytes;
-
-	res.status = 0;
-
-	nbytes = read (client_fd, &req, sizeof (req));
-
-	if (nbytes == 0) {		/* EOF? */
-		jack_error ("cannot read connection request from client");
-		return -1;
-	}
-
-	/* First verify protocol version (first field of request), if
-	 * present, then make sure request has the expected length. */
-	if ((nbytes < sizeof (req.protocol_v))
-	    || (req.protocol_v != jack_protocol_version)
-	    || (nbytes != sizeof (req))) {
-
-		/* JACK protocol incompatibility */
-		res.status |= (JackFailure|JackVersionError);
-		jack_error ("JACK protocol mismatch (%d vs %d)", req.protocol_v, jack_protocol_version);
-		if (write (client_fd, &res, sizeof (res)) != sizeof (res)) {
-			jack_error ("cannot write client connection response");
-		}
-		return -1;
-	}
-
-	if (!req.load) {		/* internal client close? */
-
-		int rc = -1;
-		jack_client_id_t id;
-
-		if ((id = jack_client_id_by_name(engine, req.name))) {
-			rc = handle_unload_client (engine, id);
-		}
-		
-		/* close does not send a reply */
-		return rc;
-	}
-	
-	pthread_mutex_lock (&engine->request_lock);
-	client = setup_client (engine, req.type, req.name,
-			       req.options, &res.status, client_fd,
-			       req.object_path, req.object_data);
-	pthread_mutex_unlock (&engine->request_lock);
-	if (client == NULL) {
-		res.status |= JackFailure; /* just making sure */
-		return -1;
-	}
-	res.client_shm_index = client->control_shm.index;
-	res.engine_shm_index = engine->control_shm.index;
-	res.realtime = engine->control->real_time;
-	res.realtime_priority = engine->rtpriority - 1;
-	strncpy (res.name, req.name, sizeof(res.name));
-
-#ifdef JACK_USE_MACH_THREADS
-	/* Mach port number for server/client communication */
-	res.portnum = client->portnum;
-#endif
-	
-	if (jack_client_is_internal(client)) {
-		/* the ->control pointers are for an internal client
-		   so we know they are the right sized pointers
-		   for this server. however, to keep the result
-		   structure the same size for both 32 and 64 bit
-		   clients/servers, the result structure stores
-		   them as 64 bit integer, so we have to do a slightly
-		   forced cast here.
-		*/
-		res.client_control = (uint64_t) ((intptr_t) client->control);
-		res.engine_control = (uint64_t) ((intptr_t) engine->control);
-	} else {
-		strcpy (res.fifo_prefix, engine->fifo_prefix);
-	}
-
-	if (write (client_fd, &res, sizeof (res)) != sizeof (res)) {
-		jack_error ("cannot write connection response to client");
-		jack_lock_graph (engine);
-		client->control->dead = 1;
-		jack_remove_client (engine, client);
-		jack_unlock_graph (engine);
-		return -1;
-	}
-
-	if (jack_client_is_internal (client)) {
-		close (client_fd);
-	}
-
-	jack_client_registration_notify (engine, (const char*) client->control->name, 1);
-
-	return 0;
-}
-
-int
-jack_client_activate (jack_engine_t *engine, jack_client_id_t id)
-{
-	jack_client_internal_t *client;
-	JSList *node;
-	int ret = -1;
-
-	jack_lock_graph (engine);
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-
-		if (((jack_client_internal_t *) node->data)->control->id
-		    == id) {
-		       
-			client = (jack_client_internal_t *) node->data;
-			client->control->active = TRUE;
-
-			jack_transport_activate(engine, client);
-
-			/* we call this to make sure the FIFO is
-			 * built+ready by the time the client needs
-			 * it. we don't care about the return value at
-			 * this point.
-			 */
-
-			jack_get_fifo_fd (engine,
-					  ++engine->external_client_cnt);
-			jack_sort_graph (engine);
-
-			ret = 0;
-			break;
-		}
-	}
-
-	jack_unlock_graph (engine);
-	return ret;
-}	
-
-int
-jack_client_deactivate (jack_engine_t *engine, jack_client_id_t id)
-{
-	JSList *node;
-	int ret = -1;
-
-	jack_lock_graph (engine);
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-
-		jack_client_internal_t *client =
-			(jack_client_internal_t *) node->data;
-
-		if (client->control->id == id) {
-		        
-	        	JSList *portnode;
-			jack_port_internal_t *port;
-
-			for (portnode = client->ports; portnode;
-			     portnode = jack_slist_next (portnode)) {
-				port = (jack_port_internal_t *) portnode->data;
-				jack_port_clear_connections (engine, port);
- 			}
-
-			ret = jack_client_do_deactivate (engine, client, TRUE);
-			break;
-		}
-	}
-
-	jack_unlock_graph (engine);
-
-	return ret;
-}	
-
-int
-jack_mark_client_socket_error (jack_engine_t *engine, int fd)
-{
-	/* CALLER MUST HOLD GRAPH LOCK */
-
-	jack_client_internal_t *client = 0;
-	JSList *node;
-
-        for (node = engine->clients; node; node = jack_slist_next (node)) {
-
-                if (jack_client_is_internal((jack_client_internal_t *)
-					    node->data)) {
-                        continue;
-                }
-
-                if (((jack_client_internal_t *) node->data)->request_fd == fd) {
-                        client = (jack_client_internal_t *) node->data;
-                        break;
-                }
-        }
-
-        if (client) {
-		VERBOSE (engine, "marking client %s with SOCKET error state = "
-			 "%s errors = %d", client->control->name,
-			 jack_client_state_name (client),
-			 client->error);
-		client->error += JACK_ERROR_WITH_SOCKETS;
-	}
-
-	return 0;
-}
-
-void
-jack_client_delete (jack_engine_t *engine, jack_client_internal_t *client)
-{
-	jack_client_registration_notify (engine, (const char*) client->control->name, 0);
-
-	if (jack_client_is_internal (client)) {
-
-		jack_client_unload (client);
-		free (client->private_client);
-		free ((void *) client->control);
-
-	} else {
-		
-		/* release the client segment, mark it for
-		   destruction, and free up the shm registry
-		   information so that it can be reused.
-		*/
-
-		jack_release_shm (&client->control_shm);
-		jack_destroy_shm (&client->control_shm);
-	}
-
-	free (client);
-}
-
-void
-jack_intclient_handle_request (jack_engine_t *engine, jack_request_t *req)
-{
-	jack_client_internal_t *client;
-
-	req->status = 0;
-	if ((client = jack_client_by_name (engine, req->x.intclient.name))) {
-		req->x.intclient.id = client->control->id;
-	} else {
-		req->status |= (JackNoSuchClient|JackFailure);
-	}
-}
-
-void
-jack_intclient_load_request (jack_engine_t *engine, jack_request_t *req)
-{
-	/* called with the request_lock */
-	jack_client_internal_t *client;
-	jack_status_t status = 0;
-
-	VERBOSE (engine, "load internal client %s from %s, init `%s', "
-		 "options: 0x%x", req->x.intclient.name,
-		 req->x.intclient.path, req->x.intclient.init,
-		 req->x.intclient.options);
-
-	client = setup_client (engine, ClientInternal, req->x.intclient.name,
-			       req->x.intclient.options, &status, -1,
-			       req->x.intclient.path, req->x.intclient.init);
-
-	if (client == NULL) {
-		status |= JackFailure;	/* just making sure */
-		req->x.intclient.id = 0;
-		VERBOSE (engine, "load failed, status = 0x%x", status);
-	} else {
-		req->x.intclient.id = client->control->id;
-	}
-
-	req->status = status;
-}
-
-void
-jack_intclient_name_request (jack_engine_t *engine, jack_request_t *req)
-{
-	jack_client_internal_t *client;
-
-	jack_rdlock_graph (engine);
-	if ((client = jack_client_internal_by_id (engine,
-						  req->x.intclient.id))) {
-		strncpy ((char *) req->x.intclient.name,
-			 (char *) client->control->name,
-			 sizeof (req->x.intclient.name));
-		req->status = 0;
-	} else {
-		req->status = (JackNoSuchClient|JackFailure);
-	}
-	jack_unlock_graph (engine);
-}
-
-void
-jack_intclient_unload_request (jack_engine_t *engine, jack_request_t *req)
-{
-	/* Called with the request_lock, but we need to call
-	 * handle_unload_client() *without* it. */
-
-	if (req->x.intclient.id) {
-		pthread_mutex_unlock (&engine->request_lock);
-		req->status =
-			handle_unload_client (engine, req->x.intclient.id);
-		pthread_mutex_lock (&engine->request_lock);
-	} else {
-		VERBOSE (engine, "invalid unload request");
-		req->status = JackFailure;
-	}
-}
-
diff --git a/jackd/clientengine.h b/jackd/clientengine.h
deleted file mode 100644
index c04d7a5..0000000
--- a/jackd/clientengine.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Client creation and destruction interfaces for JACK engine.
- *
- *  Copyright (C) 2001-2003 Paul Davis
- *  Copyright (C) 2004 Jack O'Quin
- *  
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-static inline int 
-jack_client_is_internal (jack_client_internal_t *client)
-{
-	return (client->control->type == ClientInternal) ||
-		(client->control->type == ClientDriver);
-}
-
-static inline char *
-jack_client_state_name (jack_client_internal_t *client)
-{
-	static char *client_state_names[] = {
-		"Not triggered",
-		"Triggered",
-		"Running",
-		"Finished"
-	};
-
-	return client_state_names[client->control->state];
-}
-
-#define JACK_ERROR_WITH_SOCKETS 10000000
-
-int	jack_client_activate (jack_engine_t *engine, jack_client_id_t id);
-int	jack_client_deactivate (jack_engine_t *engine, jack_client_id_t id);
-int	jack_client_create (jack_engine_t *engine, int client_fd);
-void	jack_client_delete (jack_engine_t *engine,
-			    jack_client_internal_t *client);
-int	jack_mark_client_socket_error (jack_engine_t *engine, int fd);
-jack_client_internal_t *
-	jack_create_driver_client (jack_engine_t *engine, char *name);
-void	jack_intclient_handle_request (jack_engine_t *engine,
-				       jack_request_t *req);
-void	jack_intclient_load_request (jack_engine_t *engine,
-				     jack_request_t *req);
-void	jack_intclient_name_request (jack_engine_t *engine,
-				     jack_request_t *req);
-void	jack_intclient_unload_request (jack_engine_t *engine,
-				       jack_request_t *req);
-void	jack_check_clients (jack_engine_t* engine, int with_timeout_check);
-void	jack_remove_clients (jack_engine_t* engine);
-void    jack_client_registration_notify (jack_engine_t *engine,
-					 const char* name, int yn);
diff --git a/jackd/engine.c b/jackd/engine.c
deleted file mode 100644
index 70f61a6..0000000
--- a/jackd/engine.c
+++ /dev/null
@@ -1,4160 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2004 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <config.h>
-
-#include <math.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdarg.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <dirent.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <string.h>
-#include <limits.h>
-
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/messagebuffer.h>
-#include <jack/driver.h>
-#include <jack/shm.h>
-#include <jack/thread.h>
-#include <sysdeps/poll.h>
-#include <sysdeps/ipc.h>
-
-#ifdef USE_MLOCK
-#include <sys/mman.h>
-#endif /* USE_MLOCK */
-
-#ifdef USE_CAPABILITIES
-/* capgetp and capsetp are linux only extensions, not posix */
-#undef _POSIX_SOURCE
-#include <sys/capability.h>
-#endif
-
-#include "clientengine.h"
-#include "transengine.h"
-
-#include "libjack/local.h"
-
-typedef struct {
-
-    jack_port_internal_t *source;
-    jack_port_internal_t *destination;
-    signed int dir; /* -1 = feedback, 0 = self, 1 = forward */
-    jack_client_internal_t *srcclient;
-    jack_client_internal_t *dstclient;
-} jack_connection_internal_t;
-
-typedef struct _jack_driver_info {
-    jack_driver_t *(*initialize)(jack_client_t*, const JSList *);
-    void           (*finish);
-    char           (*client_name);
-    dlhandle       handle;
-} jack_driver_info_t;
-
-jack_timer_type_t clock_source = JACK_TIMER_SYSTEM_CLOCK;
-
-static int                    jack_port_assign_buffer (jack_engine_t *,
-						       jack_port_internal_t *);
-static jack_port_internal_t *jack_get_port_by_name (jack_engine_t *,
-						    const char *name);
-static int  jack_rechain_graph (jack_engine_t *engine);
-static void jack_clear_fifos (jack_engine_t *engine);
-static int  jack_port_do_connect (jack_engine_t *engine,
-				  const char *source_port,
-				  const char *destination_port);
-static int  jack_port_do_disconnect (jack_engine_t *engine,
-				     const char *source_port,
-				     const char *destination_port);
-static int  jack_port_do_disconnect_all (jack_engine_t *engine,
-					 jack_port_id_t);
-static int  jack_port_do_unregister (jack_engine_t *engine, jack_request_t *);
-static int  jack_port_do_register (jack_engine_t *engine, jack_request_t *, int);
-static int  jack_do_get_port_connections (jack_engine_t *engine,
-					  jack_request_t *req, int reply_fd);
-static int  jack_port_disconnect_internal (jack_engine_t *engine,
-					   jack_port_internal_t *src, 
-					   jack_port_internal_t *dst);
-static int  jack_send_connection_notification (jack_engine_t *,
-					       jack_client_id_t,
-					       jack_port_id_t,
-					       jack_port_id_t, int);
-static int  jack_deliver_event (jack_engine_t *, jack_client_internal_t *,
-				jack_event_t *);
-static void jack_deliver_event_to_all (jack_engine_t *engine,
-				       jack_event_t *event);
-static void jack_notify_all_port_interested_clients (jack_engine_t *engine,
-						     jack_client_id_t exclude_src_id,
-						     jack_client_id_t exclude_dst_id,
-						     jack_port_id_t a,
-						     jack_port_id_t b,
-						     int connect);
-static void jack_engine_post_process (jack_engine_t *);
-static int  jack_use_driver (jack_engine_t *engine, jack_driver_t *driver);
-static int  jack_run_cycle (jack_engine_t *engine, jack_nframes_t nframes,
-			    float delayed_usecs);
-static void jack_engine_delay (jack_engine_t *engine,
-			       float delayed_usecs);
-static void jack_engine_driver_exit (jack_engine_t* engine);
-static int  jack_start_freewheeling (jack_engine_t* engine);
-static int  jack_stop_freewheeling (jack_engine_t* engine);
-static int jack_client_feeds_transitive (jack_client_internal_t *source,
-					 jack_client_internal_t *dest);
-static int jack_client_sort (jack_client_internal_t *a,
-			     jack_client_internal_t *b);
-static void jack_check_acyclic (jack_engine_t* engine);
-static void jack_compute_all_port_total_latencies (jack_engine_t *engine);
-static void jack_compute_port_total_latency (jack_engine_t *engine, jack_port_shared_t*);
-static void jack_engine_signal_problems (jack_engine_t* engine);
-
-static inline int 
-jack_rolling_interval (jack_time_t period_usecs)
-{
-	return floor ((JACK_ENGINE_ROLLING_INTERVAL * 1000.0f) / period_usecs);
-}
-
-void
-jack_engine_reset_rolling_usecs (jack_engine_t *engine)
-{
-	memset (engine->rolling_client_usecs, 0,
-		sizeof (engine->rolling_client_usecs));
-	engine->rolling_client_usecs_index = 0;
-	engine->rolling_client_usecs_cnt = 0;
-
-	if (engine->driver) {
-		engine->rolling_interval =
-			jack_rolling_interval (engine->driver->period_usecs);
-	} else {
-		engine->rolling_interval = JACK_ENGINE_ROLLING_INTERVAL;
-	}
-
-	engine->spare_usecs = 0;
-}
-
-static inline jack_port_type_info_t *
-jack_port_type_info (jack_engine_t *engine, jack_port_internal_t *port)
-{
-	/* Returns a pointer to the port type information in the
-	   engine's shared control structure. 
-	*/
-	return &engine->control->port_types[port->shared->ptype_id];
-}
-
-static inline jack_port_buffer_list_t *
-jack_port_buffer_list (jack_engine_t *engine, jack_port_internal_t *port)
-{
-	/* Points to the engine's private port buffer list struct. */
-	return &engine->port_buffers[port->shared->ptype_id];
-}
-
-static int
-make_directory (const char *path)
-{
-	struct stat statbuf;
-
-	if (stat (path, &statbuf)) {
-
-		if (errno == ENOENT) {
-			int mode;
-
-			if (getenv ("JACK_PROMISCUOUS_SERVER")) {
-				mode = 0777;
-			} else {
-				mode = 0700;
-			}
-
-			if (mkdir (path, mode) < 0){
-				jack_error ("cannot create %s directory (%s)\n",
-					    path, strerror (errno));
-				return -1;
-			}
-		} else {
-			jack_error ("cannot stat() %s\n", path);
-			return -1;
-		}
-
-	} else {
-
-		if (!S_ISDIR (statbuf.st_mode)) {
-			jack_error ("%s already exists, but is not"
-				    " a directory!\n", path);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-static int
-make_socket_subdirectories (const char *server_name)
-{
-	struct stat statbuf;
-        char server_dir[PATH_MAX+1] = "";
-
-	/* check tmpdir directory */
-	if (stat (jack_tmpdir, &statbuf)) {
-		jack_error ("cannot stat() %s (%s)\n",
-			    jack_tmpdir, strerror (errno));
-		return -1;
-	} else {
-		if (!S_ISDIR(statbuf.st_mode)) {
-			jack_error ("%s exists, but is not a directory!\n",
-				    jack_tmpdir);
-			return -1;
-		}
-	}
-
-	/* create user subdirectory */
-	if (make_directory (jack_user_dir ()) < 0) {
-		return -1;
-	}
-
-	/* create server_name subdirectory */
-	if (make_directory (jack_server_dir (server_name, server_dir)) < 0) {
-		return -1;
-	}
-
-	return 0;
-}
-
-static int
-make_sockets (const char *server_name, int fd[2])
-{
-	struct sockaddr_un addr;
-	int i;
-        char server_dir[PATH_MAX+1] = "";
-
-	if (make_socket_subdirectories (server_name) < 0) {
-		return -1;
-	}
-
-	/* First, the master server socket */
-
-	if ((fd[0] = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
-		jack_error ("cannot create server socket (%s)",
-			    strerror (errno));
-		return -1;
-	}
-
-	addr.sun_family = AF_UNIX;
-	for (i = 0; i < 999; i++) {
-		snprintf (addr.sun_path, sizeof (addr.sun_path) - 1,
-			  "%s/jack_%d", jack_server_dir (server_name, server_dir), i);
-		if (access (addr.sun_path, F_OK) != 0) {
-			break;
-		}
-	}
-
-	if (i == 999) {
-		jack_error ("all possible server socket names in use!!!");
-		close (fd[0]);
-		return -1;
-	}
-
-	if (bind (fd[0], (struct sockaddr *) &addr, sizeof (addr)) < 0) {
-		jack_error ("cannot bind server to socket (%s)",
-			    strerror (errno));
-		close (fd[0]);
-		return -1;
-	}
-
-	if (listen (fd[0], 1) < 0) {
-		jack_error ("cannot enable listen on server socket (%s)",
-			    strerror (errno));
-		close (fd[0]);
-		return -1;
-	}
-
-	/* Now the client/server event ack server socket */
-
-	if ((fd[1] = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
-		jack_error ("cannot create event ACK socket (%s)",
-			    strerror (errno));
-		close (fd[0]);
-		return -1;
-	}
-
-	addr.sun_family = AF_UNIX;
-	for (i = 0; i < 999; i++) {
-		snprintf (addr.sun_path, sizeof (addr.sun_path) - 1,
-			  "%s/jack_ack_%d", jack_server_dir (server_name, server_dir), i);
-		if (access (addr.sun_path, F_OK) != 0) {
-			break;
-		}
-	}
-
-	if (i == 999) {
-		jack_error ("all possible server ACK socket names in use!!!");
-		close (fd[0]);
-		close (fd[1]);
-		return -1;
-	}
-
-	if (bind (fd[1], (struct sockaddr *) &addr, sizeof (addr)) < 0) {
-		jack_error ("cannot bind server to socket (%s)",
-			    strerror (errno));
-		close (fd[0]);
-		close (fd[1]);
-		return -1;
-	}
-
-	if (listen (fd[1], 1) < 0) {
-		jack_error ("cannot enable listen on server socket (%s)",
-			    strerror (errno));
-		close (fd[0]);
-		close (fd[1]);
-		return -1;
-	}
-
-	return 0;
-}
-
-void
-jack_engine_place_port_buffers (jack_engine_t* engine, 
-				jack_port_type_id_t ptid,
-				jack_shmsize_t one_buffer,
-				jack_shmsize_t size,
-				unsigned long nports,
-				jack_nframes_t nframes)
-{
-	jack_shmsize_t offset;		/* shared memory offset */
-	jack_port_buffer_info_t *bi;
-	jack_port_buffer_list_t* pti = &engine->port_buffers[ptid];
-	jack_port_functions_t *pfuncs = jack_get_port_functions(ptid);
-
-	pthread_mutex_lock (&pti->lock);
-	offset = 0;
-	
-	if (pti->info) {
-
-		/* Buffer info array already allocated for this port
-		 * type.  This must be a resize operation, so
-		 * recompute the buffer offsets, but leave the free
-		 * list alone.
-		 */
-		int i;
-
-		bi = pti->info;
-		while (offset < size) {
-			bi->offset = offset;
-			offset += one_buffer;
-			++bi;
-		}
-
-		/* update any existing output port offsets */
-		for (i = 0; i < engine->port_max; i++) {
-			jack_port_shared_t *port = &engine->control->ports[i];
-			if (port->in_use &&
-			    (port->flags & JackPortIsOutput) &&
-			    port->ptype_id == ptid) {
-				bi = engine->internal_ports[i].buffer_info;
-				if (bi) {
-					port->offset = bi->offset;
-				}
-			}
-		}
-
-	} else {
-		jack_port_type_info_t* port_type = &engine->control->port_types[ptid];
-
-		/* Allocate an array of buffer info structures for all
-		 * the buffers in the segment.  Chain them to the free
-		 * list in memory address order, offset zero must come
-		 * first.
-		 */
-		bi = pti->info = (jack_port_buffer_info_t *)
-			malloc (nports * sizeof (jack_port_buffer_info_t));
-
-		while (offset < size) {
-			bi->offset = offset;
-			pti->freelist = jack_slist_append (pti->freelist, bi);
-			offset += one_buffer;
-			++bi;
-		}
-
-		/* Allocate the first buffer of the port segment
-		 * for an empy buffer area.
-		 * NOTE: audio buffer is zeroed in its buffer_init function.
-		 */
-		bi = (jack_port_buffer_info_t *) pti->freelist->data;
-		pti->freelist = jack_slist_remove_link (pti->freelist,
-							pti->freelist);
-		port_type->zero_buffer_offset = bi->offset;
-		if (ptid == JACK_AUDIO_PORT_TYPE)
-			engine->silent_buffer = bi;
-	}
-	/* initialize buffers */
-	{
-		int i;
-		jack_shm_info_t *shm_info = &engine->port_segment[ptid];
-		char* shm_segment = (char *) jack_shm_addr(shm_info);
-
-		bi = pti->info;
-		for (i=0; i<nports; ++i, ++bi)
-			pfuncs->buffer_init(shm_segment + bi->offset, one_buffer, nframes);
-	}
-
-	pthread_mutex_unlock (&pti->lock);
-}
-
-// JOQ: this should have a return code...
-static void
-jack_resize_port_segment (jack_engine_t *engine,
-			  jack_port_type_id_t ptid,
-			  unsigned long nports)
-{
-	jack_event_t event;
-	jack_shmsize_t one_buffer;	/* size of one buffer */
-	jack_shmsize_t size;		/* segment size */
-	jack_port_type_info_t* port_type = &engine->control->port_types[ptid];
-	jack_shm_info_t* shm_info = &engine->port_segment[ptid];
-
-	if (port_type->buffer_scale_factor < 0) {
-		one_buffer = port_type->buffer_size;
-	} else {
-		one_buffer = sizeof (jack_default_audio_sample_t)
-			* port_type->buffer_scale_factor
-			* engine->control->buffer_size;
-	}
-
-	size = nports * one_buffer;
-
-	if (shm_info->attached_at == 0) {
-
-		if (jack_shmalloc (size, shm_info)) {
-			jack_error ("cannot create new port segment of %d"
-				    " bytes (%s)", 
-				    size,
-				    strerror (errno));
-			return;
-		}
-		
-		if (jack_attach_shm (shm_info)) {
-			jack_error ("cannot attach to new port segment "
-				    "(%s)", strerror (errno));
-			return;
-		}
-
-		engine->control->port_types[ptid].shm_registry_index =
-			shm_info->index;
-
-	} else {
-
-		/* resize existing buffer segment */
-		if (jack_resize_shm (shm_info, size)) {
-			jack_error ("cannot resize port segment to %d bytes,"
-				    " (%s)", size,
-				    strerror (errno));
-			return;
-		}
-	}
-
-	jack_engine_place_port_buffers (engine, ptid, one_buffer, size, nports, engine->control->buffer_size);
-
-#ifdef USE_MLOCK
-	if (engine->control->real_time) {
-
-	/* Although we've called mlockall(CURRENT|FUTURE), the
-		 * Linux VM manager still allows newly allocated pages
-		 * to fault on first reference.  This mlock() ensures
-		 * that any new pages are present before restarting
-		 * the process cycle.  Since memory locks do not
-		 * stack, they can still be unlocked with a single
-		 * munlockall().
-		 */
-
-		int rc = mlock (jack_shm_addr (shm_info), size);
-		if (rc < 0) {
-			jack_error("JACK: unable to mlock() port buffers: "
-				   "%s", strerror(errno));
-		}
-	}
-#endif /* USE_MLOCK */
-
-	/* Tell everybody about this segment. */
-	event.type = AttachPortSegment;
-	event.y.ptid = ptid;
-	jack_deliver_event_to_all (engine, &event);
-}
-
-/* The driver invokes this callback both initially and whenever its
- * buffer size changes. 
- */
-static int
-jack_driver_buffer_size (jack_engine_t *engine, jack_nframes_t nframes)
-{
-	int i;
-	jack_event_t event;
-	JSList *node;
-
-	VERBOSE (engine, "new buffer size %" PRIu32, nframes);
-
-	engine->control->buffer_size = nframes;
-	if (engine->driver)
-		engine->rolling_interval =
-			jack_rolling_interval (engine->driver->period_usecs);
-
-	for (i = 0; i < engine->control->n_port_types; ++i) {
-		jack_resize_port_segment (engine, i, engine->control->port_max);
-	}
-
-	/* update shared client copy of nframes */
-	jack_lock_graph (engine);
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		jack_client_internal_t *client = node->data;
-		client->control->nframes = nframes;
-	}
-	jack_unlock_graph (engine);
-
-	event.type = BufferSizeChange;
-	jack_deliver_event_to_all (engine, &event);
-
-	return 0;
-}
-
-/* handle client SetBufferSize request */
-int
-jack_set_buffer_size_request (jack_engine_t *engine, jack_nframes_t nframes)
-{
-	/* precondition: caller holds the request_lock */
-	int rc;
-	jack_driver_t* driver = engine->driver;
-
-	if (driver == NULL)
-		return ENXIO;		/* no such device */
-
-	if (!jack_power_of_two(nframes)) {
-  		jack_error("buffer size %" PRIu32 " not a power of 2",
-			   nframes);
-		return EINVAL;
-	}
-
-	rc = driver->bufsize(driver, nframes);
-	if (rc != 0)
-		jack_error("driver does not support %" PRIu32
-			   "-frame buffers", nframes);
-
-	return rc;
-}
-
-
-static JSList * 
-jack_process_internal(jack_engine_t *engine, JSList *node,
-		      jack_nframes_t nframes)
-{
-	jack_client_internal_t *client;
-	jack_client_control_t *ctl;
-	
-	client = (jack_client_internal_t *) node->data;
-	ctl = client->control;
-	
-	/* internal client */
-
-	DEBUG ("invoking an internal client's callbacks");
-	ctl->state = Running;
-	engine->current_client = client;
-
-	/* XXX how to time out an internal client? */
-
-	if (ctl->sync_cb_cbset)
-		jack_call_sync_client (client->private_client);
-
-	if (ctl->process_cbset)
-		if (client->private_client->process (nframes, client->private_client->process_arg)) {
-			jack_error ("internal client %s failed", ctl->name);
-			engine->process_errors++;
-		}
-
-	if (ctl->timebase_cb_cbset)
-		jack_call_timebase_master (client->private_client);
-		
-	ctl->state = Finished;
-
-	if (engine->process_errors)
-		return NULL;		/* will stop the loop */
-	else
-		return jack_slist_next (node);
-}
-
-#ifdef __linux
-
-/* Linux kernels somewhere between 2.6.18 and 2.6.24 had a bug
-   in poll(2) that led poll to return early. To fix it, we need
-   to know that that jack_get_microseconds() is monotonic.
-*/
-
-#ifdef HAVE_CLOCK_GETTIME
-static const int system_clock_monotonic = 1;
-#else
-static const int system_clock_monotonic = 0;
-#endif
-
-static int
-linux_poll_bug_encountered (jack_engine_t* engine, jack_time_t then, jack_time_t *required)
-{
-	if (engine->control->clock_source != JACK_TIMER_SYSTEM_CLOCK || system_clock_monotonic) {
-		jack_time_t now = jack_get_microseconds ();
-
-		if ((now - then) < *required) {
-			
-			/*
-			   So, adjust poll timeout to account for time already spent waiting.
-			*/
-			
-			VERBOSE (engine, "FALSE WAKEUP (%lldusecs vs. %lld usec)", (now - then), *required);
-			*required -= (now - then);
-
-			/* allow 0.25msec slop */
-			return 1;
-		}
-	}
-	return 0;
-}
-#endif
-
-#ifdef JACK_USE_MACH_THREADS
-static JSList * 
-jack_process_external(jack_engine_t *engine, JSList *node)
-{
-        jack_client_internal_t * client = (jack_client_internal_t *) node->data;
-        jack_client_control_t *ctl;
-        
-        client = (jack_client_internal_t *) node->data;
-        ctl = client->control;
-        
-        engine->current_client = client;
-
-	// a race exists if we do this after the write(2) 
-        ctl->state = Triggered; 
-        ctl->signalled_at = jack_get_microseconds();
-        
-        if (jack_client_resume(client) < 0) {
-            jack_error("Client will be removed\n");
-            ctl->state = Finished;
-        }
-        
-        return jack_slist_next (node);
-}
-#else /* !JACK_USE_MACH_THREADS */
-static JSList * 
-jack_process_external(jack_engine_t *engine, JSList *node)
-{
-	int status = 0;
-	char c = 0;
-	struct pollfd pfd[1];
-	int poll_timeout;
-	jack_time_t poll_timeout_usecs;
-	jack_client_internal_t *client;
-	jack_client_control_t *ctl;
-	jack_time_t now, then;
-	int pollret;
-
-	client = (jack_client_internal_t *) node->data;
-	
-	ctl = client->control;
-
-	/* external subgraph */
-
-	/* a race exists if we do this after the write(2) */
-	ctl->state = Triggered; 
-
-	ctl->signalled_at = jack_get_microseconds();
-
-	engine->current_client = client;
-
-	DEBUG ("calling process() on an external subgraph, fd==%d",
-	       client->subgraph_start_fd);
-
-	if (write (client->subgraph_start_fd, &c, sizeof (c)) != sizeof (c)) {
-		jack_error ("cannot initiate graph processing (%s)",
-			    strerror (errno));
-		engine->process_errors++;
-		jack_engine_signal_problems (engine);
-		return NULL; /* will stop the loop */
-	} 
-
-	then = jack_get_microseconds ();
-
-	if (engine->freewheeling) {
-		poll_timeout_usecs = 10000000; /* 10 seconds */
-	} else {
-		poll_timeout_usecs = (engine->client_timeout_msecs > 0 ?
-				engine->client_timeout_msecs * 1000 :
-				engine->driver->period_usecs);
-	}
-
-     again:
-	poll_timeout = 1 + poll_timeout_usecs / 1000;
-	pfd[0].fd = client->subgraph_wait_fd;
-	pfd[0].events = POLLERR|POLLIN|POLLHUP|POLLNVAL;
-
-	DEBUG ("waiting on fd==%d for process() subgraph to finish (timeout = %d, period_usecs = %d)",
-	       client->subgraph_wait_fd, poll_timeout, engine->driver->period_usecs);
-
-	if ((pollret = poll (pfd, 1, poll_timeout)) < 0) {
-		jack_error ("poll on subgraph processing failed (%s)",
-			    strerror (errno));
-		status = -1; 
-	}
-
-	DEBUG ("\n\n\n\n\n back from subgraph poll, revents = 0x%x\n\n\n", pfd[0].revents);
-
-	if (pfd[0].revents & ~POLLIN) {
-		jack_error ("subgraph starting at %s lost client",
-			    client->control->name);
-		status = -2; 
-	}
-
-	if (pfd[0].revents & POLLIN) {
-
-		status = 0;
-
-	} else if (status == 0) {
-
-		/* no events, no errors, we woke up because poll()
-		   decided that time was up ...
-		*/
-
-#ifdef __linux		
-		if (linux_poll_bug_encountered (engine, then, &poll_timeout_usecs)) {
-			goto again;
-		}
-
-		if (poll_timeout_usecs < 200) {
-			VERBOSE (engine, "FALSE WAKEUP skipped, remaining = %lld usec", poll_timeout_usecs);
-		} else {
-#endif
-			
-		jack_error ("subgraph starting at %s timed out "
-			    "(subgraph_wait_fd=%d, status = %d, state = %s, pollret = %d revents = 0x%x)", 
-			    client->control->name,
-			    client->subgraph_wait_fd, status, 
-			    jack_client_state_name (client),
-			    pollret, pfd[0].revents);
-		status = 1;
-#ifdef __linux
-		}
-#endif
-	}
-
-	now = jack_get_microseconds ();
-
-	if (status != 0) {
-		VERBOSE (engine, "at %" PRIu64
-			 " waiting on %d for %" PRIu64
-			 " usecs, status = %d sig = %" PRIu64
-			 " awa = %" PRIu64 " fin = %" PRIu64
-			 " dur=%" PRIu64,
-			 now,
-			 client->subgraph_wait_fd,
-			 now - then,
-			 status,
-			 ctl->signalled_at,
-			 ctl->awake_at,
-			 ctl->finished_at,
-			 ctl->finished_at? (ctl->finished_at -
-					    ctl->signalled_at): 0);
-
-		jack_check_clients (engine, 1);
-
-		engine->process_errors++;
-		return NULL;		/* will stop the loop */
-
-	} else {
-
-		DEBUG ("reading byte from subgraph_wait_fd==%d",
-		       client->subgraph_wait_fd);
-
-		if (read (client->subgraph_wait_fd, &c, sizeof(c))
-		    != sizeof (c)) {
-			jack_error ("pp: cannot clean up byte from graph wait "
-				    "fd (%s)", strerror (errno));
-			client->error++;
-			return NULL;	/* will stop the loop */
-		}
-	}
-
-	/* Move to next internal client (or end of client list) */
-	while (node) {
-		if (jack_client_is_internal ((jack_client_internal_t *)
-					     node->data)) {
-			break;
-		}
-		node = jack_slist_next (node);
-	}
-	
-	return node;
-}
-
-#endif /* JACK_USE_MACH_THREADS */
-
-static int
-jack_engine_process (jack_engine_t *engine, jack_nframes_t nframes)
-{
-	/* precondition: caller has graph_lock */
-	jack_client_internal_t *client;
-	JSList *node;
-
-	engine->process_errors = 0;
-	engine->watchdog_check = 1;
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		jack_client_control_t *ctl =
-			((jack_client_internal_t *) node->data)->control;
-		ctl->state = NotTriggered;
-		ctl->nframes = nframes;
-		ctl->timed_out = 0;
-		ctl->awake_at = 0;
-		ctl->finished_at = 0;
-	}
-
-	for (node = engine->clients; engine->process_errors == 0 && node; ) {
-
-		client = (jack_client_internal_t *) node->data;
-		
-		DEBUG ("considering client %s for processing",
-		       client->control->name);
-
-		if (!client->control->active || client->control->dead) {
-			node = jack_slist_next (node);
-		} else if (jack_client_is_internal (client)) {
-			node = jack_process_internal (engine, node, nframes);
-		} else {
-			node = jack_process_external (engine, node);
-		}
-	}
-
-	return engine->process_errors > 0;
-}
-
-static void 
-jack_calc_cpu_load(jack_engine_t *engine)
-{
-	jack_time_t cycle_end = jack_get_microseconds ();
-	
-	/* store the execution time for later averaging */
-
-	engine->rolling_client_usecs[engine->rolling_client_usecs_index++] = 
-		cycle_end - engine->control->current_time.usecs;
-
-	//jack_info ("cycle_end - engine->control->current_time.usecs %ld",
-	//	(long) (cycle_end - engine->control->current_time.usecs));
-
-	if (engine->rolling_client_usecs_index >= JACK_ENGINE_ROLLING_COUNT) {
-		engine->rolling_client_usecs_index = 0;
-	}
-
-	/* every so often, recompute the current maximum use over the
-	   last JACK_ENGINE_ROLLING_COUNT client iterations.
-	*/
-
-	if (++engine->rolling_client_usecs_cnt
-	    % engine->rolling_interval == 0) {
-		float max_usecs = 0.0f;
-		int i;
-
-		for (i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++) {
-			if (engine->rolling_client_usecs[i] > max_usecs) {
-				max_usecs = engine->rolling_client_usecs[i];
-			}
-		}
-
-		if (max_usecs > engine->max_usecs) {
-			engine->max_usecs = max_usecs;
-		}
-
-		if (max_usecs < engine->driver->period_usecs) {
-			engine->spare_usecs =
-				engine->driver->period_usecs - max_usecs;
-		} else {
-			engine->spare_usecs = 0;
-		}
-
-		engine->control->cpu_load =
-			(1.0f - (engine->spare_usecs /
-				 engine->driver->period_usecs)) * 50.0f
-			+ (engine->control->cpu_load * 0.5f);
-
-		VERBOSE (engine, "load = %.4f max usecs: %.3f, "
-			 "spare = %.3f", engine->control->cpu_load,
-			 max_usecs, engine->spare_usecs);
-	}
-
-}
-
-static void
-jack_engine_post_process (jack_engine_t *engine)
-{
-	/* precondition: caller holds the graph lock. */
-
-	jack_transport_cycle_end (engine);
-	jack_calc_cpu_load (engine);
-	jack_check_clients (engine, 0);
-}
-
-#ifdef JACK_USE_MACH_THREADS
-
-static int
-jack_start_watchdog (jack_engine_t *engine)
-{
-	/* Stephane Letz : letz at grame.fr Watch dog thread is
-	 * not needed on MacOSX since CoreAudio drivers
-	 * already contains a similar mechanism.
-	 */
-	return 0;
-}
-
-#else
-
-static void *
-jack_watchdog_thread (void *arg)
-{
-	jack_engine_t *engine = (jack_engine_t *) arg;
-	struct timespec timo;
-
-	timo.tv_sec = JACKD_WATCHDOG_TIMEOUT / 1000;
-	timo.tv_nsec = (JACKD_WATCHDOG_TIMEOUT - (timo.tv_sec * 1000)) * 1000;
-	engine->watchdog_check = 0;
-
-	while (1) {
-        nanosleep (&timo, NULL);
-		if (!engine->freewheeling && engine->watchdog_check == 0) {
-
-			jack_error ("jackd watchdog: timeout - killing jackd");
-
-			/* Kill the current client (guilt by association). */
-			if (engine->current_client) {
-					kill (engine->current_client->
-					      control->pid, SIGKILL);
-			}
-
-			/* kill our process group, try to get a dump */
-			kill (-getpgrp(), SIGABRT);
-			/*NOTREACHED*/
-			exit (1);
-		}
-		engine->watchdog_check = 0;
-	}
-}
-
-static int
-jack_start_watchdog (jack_engine_t *engine)
-{
-	int watchdog_priority = engine->rtpriority + 10;
-#ifndef __OpenBSD__
-	int max_priority = sched_get_priority_max (SCHED_FIFO);
-#else
-	int max_priority = -1;
-#endif
-
-	if ((max_priority != -1) &&
-	    (max_priority < watchdog_priority))
-		watchdog_priority = max_priority;
-	
-	if (jack_client_create_thread (NULL, &engine->watchdog_thread, watchdog_priority,
-				       TRUE, jack_watchdog_thread, engine)) {
-		jack_error ("cannot start watchdog thread");
-		return -1;
-	}
-
-	return 0;
-}
-#endif /* !JACK_USE_MACH_THREADS */
-
-
-static jack_driver_info_t *
-jack_load_driver (jack_engine_t *engine, jack_driver_desc_t * driver_desc)
-{
-	const char *errstr;
-	jack_driver_info_t *info;
-
-	info = (jack_driver_info_t *) calloc (1, sizeof (*info));
-
-	info->handle = dlopen (driver_desc->file, RTLD_NOW|RTLD_GLOBAL);
-	
-	if (info->handle == NULL) {
-		if ((errstr = dlerror ()) != 0) {
-			jack_error ("can't load \"%s\": %s", driver_desc->file,
-				    errstr);
-		} else {
-			jack_error ("bizarre error loading driver shared "
-				    "object %s", driver_desc->file);
-		}
-		goto fail;
-	}
-
-	info->initialize = dlsym (info->handle, "driver_initialize");
-
-	if ((errstr = dlerror ()) != 0) {
-		jack_error ("no initialize function in shared object %s\n",
-			    driver_desc->file);
-		goto fail;
-	}
-
-	info->finish = dlsym (info->handle, "driver_finish");
-
-	if ((errstr = dlerror ()) != 0) {
-		jack_error ("no finish function in in shared driver object %s",
-			    driver_desc->file);
-		goto fail;
-	}
-
-	info->client_name = (char *) dlsym (info->handle, "driver_client_name");
-
-	if ((errstr = dlerror ()) != 0) {
-		jack_error ("no client name in in shared driver object %s",
-			    driver_desc->file);
-		goto fail;
-	}
-
-	return info;
-
-  fail:
-	if (info->handle) {
-		dlclose (info->handle);
-	}
-	free (info);
-	return NULL;
-	
-}
-
-void
-jack_driver_unload (jack_driver_t *driver)
-{
-	void* handle = driver->handle;
-	driver->finish (driver);
-	dlclose (handle);
-}
-
-int
-jack_engine_load_driver (jack_engine_t *engine,
-			 jack_driver_desc_t * driver_desc,
-			 JSList * driver_params)
-{
-	jack_client_internal_t *client;
-	jack_driver_t *driver;
-	jack_driver_info_t *info;
-
-	if ((info = jack_load_driver (engine, driver_desc)) == NULL) {
-		return -1;
-	}
-
-	if ((client = jack_create_driver_client (engine, info->client_name)
-		    ) == NULL) {
-		return -1;
-	}
-
-	if ((driver = info->initialize (client->private_client,
-					driver_params)) == NULL) {
-		free (info);
-		return -1;
-	}
-
-	driver->handle = info->handle;
-	driver->finish = info->finish;
-	driver->internal_client = client;
-	free (info);
-
-	if (jack_use_driver (engine, driver) < 0) {
-		jack_client_delete (engine, client);
-		return -1;
-	}
-
-	engine->driver_desc   = driver_desc;
-	engine->driver_params = driver_params;
-
-	if (engine->control->real_time) {
-		if (jack_start_watchdog (engine)) {
-			return -1;
-		}
-		engine->watchdog_check = 1;
-	}
-	return 0;
-}
-
-#ifdef USE_CAPABILITIES
-
-static int check_capabilities (jack_engine_t *engine)
-{
-	cap_t caps = cap_init();
-	cap_flag_value_t cap;
-	pid_t pid;
-	int have_all_caps = 1;
-
-	if (caps == NULL) {
-		VERBOSE (engine, "check: could not allocate capability"
-			 " working storage");
-		return 0;
-	}
-	pid = getpid ();
-	cap_clear (caps);
-	if (capgetp (pid, caps)) {
-		VERBOSE (engine, "check: could not get capabilities "
-			 "for process %d", pid);
-		return 0;
-	}
-	/* check that we are able to give capabilites to other processes */
-	cap_get_flag(caps, CAP_SETPCAP, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-	/* check that we have the capabilities we want to transfer */
-	cap_get_flag(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-	cap_get_flag(caps, CAP_SYS_RESOURCE, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-	cap_get_flag(caps, CAP_IPC_LOCK, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-  done:
-	cap_free (caps);
-	return have_all_caps;
-}
-
-
-static int give_capabilities (jack_engine_t *engine, pid_t pid)
-{
-	cap_t caps = cap_init();
-	const unsigned caps_size = 3;
-	cap_value_t cap_list[] = {CAP_SYS_NICE, CAP_SYS_RESOURCE, CAP_IPC_LOCK};
-
-	if (caps == NULL) {
-		VERBOSE (engine, "give: could not allocate capability"
-			 " working storage");
-		return -1;
-	}
-	cap_clear(caps);
-	if (capgetp (pid, caps)) {
-		VERBOSE (engine, "give: could not get current "
-			 "capabilities for process %d", pid);
-		cap_clear(caps);
-	}
-	cap_set_flag(caps, CAP_EFFECTIVE, caps_size, cap_list , CAP_SET);
-	cap_set_flag(caps, CAP_INHERITABLE, caps_size, cap_list , CAP_SET);
-	cap_set_flag(caps, CAP_PERMITTED, caps_size, cap_list , CAP_SET);
-	if (capsetp (pid, caps)) {
-		cap_free (caps);
-		return -1;
-	}
-	cap_free (caps);
-	return 0;
-}
-
-static int
-jack_set_client_capabilities (jack_engine_t *engine, pid_t cap_pid)
-{
-	int ret = -1;
-
-	/* before sending this request the client has
-	   already checked that the engine has
-	   realtime capabilities, that it is running
-	   realtime and that the pid is defined
-	*/
-
-	if ((ret = give_capabilities (engine, cap_pid)) != 0) {
-		jack_error ("could not give capabilities to "
-			    "process %d",
-			    cap_pid);
-	} else {
-		VERBOSE (engine, "gave capabilities to"
-			 " process %d",
-			 cap_pid);
-	}
-
-	return ret;
-}	
-
-#endif /* USE_CAPABILITIES */
-
-/* perform internal or external client request
- *
- * reply_fd is NULL for internal requests
- */
-static void
-do_request (jack_engine_t *engine, jack_request_t *req, int *reply_fd)
-{
-	/* The request_lock serializes internal requests (from any
-	 * thread in the server) with external requests (always from "the"
-	 * server thread). 
-	 */
-	pthread_mutex_lock (&engine->request_lock);
-
-	DEBUG ("got a request of type %d", req->type);
-
-	switch (req->type) {
-	case RegisterPort:
-		req->status = jack_port_do_register (engine, req, reply_fd ? FALSE : TRUE);
-		break;
-
-	case UnRegisterPort:
-		req->status = jack_port_do_unregister (engine, req);
-		break;
-
-	case ConnectPorts:
-		req->status = jack_port_do_connect
-			(engine, req->x.connect.source_port,
-			 req->x.connect.destination_port);
-		break;
-
-	case DisconnectPort:
-		req->status = jack_port_do_disconnect_all
-			(engine, req->x.port_info.port_id);
-		break;
-
-	case DisconnectPorts:
-		req->status = jack_port_do_disconnect
-			(engine, req->x.connect.source_port,
-			 req->x.connect.destination_port);
-		break;
-
-	case ActivateClient:
-		req->status = jack_client_activate (engine, req->x.client_id);
-		break;
-
-	case DeactivateClient:
-		req->status = jack_client_deactivate (engine, req->x.client_id);
-		break;
-
-	case SetTimeBaseClient:
-		req->status = jack_timebase_set (engine,
-						 req->x.timebase.client_id,
-						 req->x.timebase.conditional);
-		break;
-
-	case ResetTimeBaseClient:
-		req->status = jack_timebase_reset (engine, req->x.client_id);
-		break;
-
-	case SetSyncClient:
-		req->status =
-			jack_transport_client_set_sync (engine,
-							req->x.client_id);
-		break;
-
-	case ResetSyncClient:
-		req->status =
-			jack_transport_client_reset_sync (engine,
-							  req->x.client_id);
-		break;
-
-	case SetSyncTimeout:
-		req->status = jack_transport_set_sync_timeout (engine,
-							       req->x.timeout);
-		break;
-
-#ifdef USE_CAPABILITIES
-	case SetClientCapabilities:
-		req->status = jack_set_client_capabilities (engine,
-							    req->x.cap_pid);
-		break;
-#endif /* USE_CAPABILITIES */
-		
-	case GetPortConnections:
-	case GetPortNConnections:
-		//JOQ bug: reply_fd may be NULL if internal request
-		if ((req->status =
-		     jack_do_get_port_connections (engine, req, *reply_fd))
-		    == 0) {
-			/* we have already replied, don't do it again */
-			*reply_fd = -1;
-		}
-		break;
-
-	case FreeWheel:
-		req->status = jack_start_freewheeling (engine);
-		break;
-
-	case StopFreeWheel:
-		req->status = jack_stop_freewheeling (engine);
-		break;
-
-	case SetBufferSize:
-		req->status = jack_set_buffer_size_request (engine,
-							   req->x.nframes);
-		break;
-
-	case IntClientHandle:
-		jack_intclient_handle_request (engine, req);
-		break;
-
-	case IntClientLoad:
-		jack_intclient_load_request (engine, req);
-		break;
-
-	case IntClientName:
-		jack_intclient_name_request (engine, req);
-		break;
-
-	case IntClientUnload:
-		jack_intclient_unload_request (engine, req);
-		break;
-
-	case RecomputeTotalLatencies:
-		jack_lock_graph (engine);
-		jack_compute_all_port_total_latencies (engine);
-		jack_unlock_graph (engine);
-		req->status = 0;
-		break;
-
-	case RecomputeTotalLatency:
-		jack_lock_graph (engine);
-		jack_compute_port_total_latency (engine, &engine->control->ports[req->x.port_info.port_id]);
-		jack_unlock_graph (engine);
-		req->status = 0;
-		break;
-
-	default:
-		/* some requests are handled entirely on the client
-		 * side, by adjusting the shared memory area(s) */
-		break;
-	}
-
-	pthread_mutex_unlock (&engine->request_lock);
-
-	DEBUG ("status of request: %d", req->status);
-}
-
-int
-internal_client_request (void* ptr, jack_request_t *request)
-{
-	do_request ((jack_engine_t*) ptr, request, NULL);
-	return request->status;
-}
-
-static int
-handle_external_client_request (jack_engine_t *engine, int fd)
-{
-	/* CALLER holds read lock on graph */
-
-	jack_request_t req;
-	jack_client_internal_t *client = 0;
-	int reply_fd;
-	JSList *node;
-	ssize_t r;
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		if (((jack_client_internal_t *) node->data)->request_fd == fd) {
-			client = (jack_client_internal_t *) node->data;
-			break;
-		}
-	}
-
-	if (client == NULL) {
-		jack_error ("client input on unknown fd %d!", fd);
-		return -1;
-	}
-
-	if ((r = read (client->request_fd, &req, sizeof (req)))
-	    < (ssize_t) sizeof (req)) {
-		if (r == 0) {
-#ifdef JACK_USE_MACH_THREADS
-			/* poll is implemented using
-			   select (see the macosx/fakepoll
-			   code). When the socket is closed
-			   select does not return any error,
-			   POLLIN is true and the next read
-			   will return 0 bytes. This
-			   behaviour is diffrent from the
-			   Linux poll behaviour. Thus we use
-			   this condition as a socket error
-			   and remove the client.
-			*/
-			jack_mark_client_socket_error (engine, fd);
-#endif /* JACK_USE_MACH_THREADS */
-			return 1;
-		} else {
-			jack_error ("cannot read request from client (%d/%d/%s)",
-				    r, sizeof(req), strerror (errno));
-			// XXX: shouldnt we mark this client as error now ?
-
-			return -1;
-		}
-	}
-
-	reply_fd = client->request_fd;
-	
-	jack_unlock_graph (engine);
-	do_request (engine, &req, &reply_fd);
-	jack_lock_graph (engine);
-
-	if (reply_fd >= 0) {
-		DEBUG ("replying to client");
-		if (write (reply_fd, &req, sizeof (req))
-		    < (ssize_t) sizeof (req)) {
-			jack_error ("cannot write request result to client");
-			return -1;
-		}
-	} else {
-		DEBUG ("*not* replying to client");
-        }
-
-	return 0;
-}
-
-static int
-handle_client_ack_connection (jack_engine_t *engine, int client_fd)
-{
-	jack_client_internal_t *client;
-	jack_client_connect_ack_request_t req;
-	jack_client_connect_ack_result_t res;
-
-	if (read (client_fd, &req, sizeof (req)) != sizeof (req)) {
-		jack_error ("cannot read ACK connection request from client");
-		return -1;
-	}
-
-	if ((client = jack_client_internal_by_id (engine, req.client_id))
-	    == NULL) {
-		jack_error ("unknown client ID in ACK connection request");
-		return -1;
-	}
-
-	client->event_fd = client_fd;
-	VERBOSE (engine, "new client %s using %d for events", client->control->name,
-		 client->event_fd);
-
-	res.status = 0;
-
-	if (write (client->event_fd, &res, sizeof (res)) != sizeof (res)) {
-		jack_error ("cannot write ACK connection response to client");
-		return -1;
-	}
-
-	return 0;
-}
-
-
-static void *
-jack_server_thread (void *arg)
-
-{
-	jack_engine_t *engine = (jack_engine_t *) arg;
-	struct sockaddr_un client_addr;
-	socklen_t client_addrlen;
-	int problemsProblemsPROBLEMS = 0;
-	int client_socket;
-	int done = 0;
-	int i;
-	const int fixed_fd_cnt = 3;
-
-	while (!done) {
-		JSList* node;
-		int clients;
-
-		jack_rdlock_graph (engine);
-
-		clients = jack_slist_length (engine->clients);
-
-		if (engine->pfd_size < fixed_fd_cnt + clients) {
-			if (engine->pfd) {
-				free (engine->pfd);
-			}
-			engine->pfd = (struct pollfd *) malloc (sizeof(struct pollfd) * (fixed_fd_cnt + clients));
-		}
-
-		engine->pfd[0].fd = engine->fds[0];
-		engine->pfd[0].events = POLLIN|POLLERR;
-		engine->pfd[1].fd = engine->fds[1];
-		engine->pfd[1].events = POLLIN|POLLERR;
-		engine->pfd[2].fd = engine->cleanup_fifo[0];
-		engine->pfd[2].events = POLLIN|POLLERR;
-		engine->pfd_max = fixed_fd_cnt;
-		
-		for (node = engine->clients; node; node = node->next) {
-
-			jack_client_internal_t* client = (jack_client_internal_t*)(node->data);
-
-			if (client->request_fd < 0 || client->error >= JACK_ERROR_WITH_SOCKETS) {
-				continue;
-			}
-			if( client->control->dead ) {
-				engine->pfd[engine->pfd_max].fd = client->request_fd;
-				engine->pfd[engine->pfd_max].events = POLLHUP|POLLNVAL;
-				engine->pfd_max++;
-				continue;
-			}
-			engine->pfd[engine->pfd_max].fd = client->request_fd;
-			engine->pfd[engine->pfd_max].events = POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL;
-			engine->pfd_max++;
-		}
-
-		jack_unlock_graph (engine);
-		
-		VERBOSE (engine, "start poll on %d fd's", engine->pfd_max);
-		
-		/* go to sleep for a long, long time, or until a request
-		   arrives, or until a communication channel is broken
-		*/
-
-		if (poll (engine->pfd, engine->pfd_max, -1) < 0) {
-			if (errno == EINTR) {
-				continue;
-			}
-			jack_error ("poll failed (%s)", strerror (errno));
-			break;
-		}
-		
-		VERBOSE(engine, "server thread back from poll");
-		
-		/* Stephane Letz: letz at grame.fr : has to be added
-		 * otherwise pthread_cancel() does not work on MacOSX */
-		pthread_testcancel();
-
-
-		/* empty cleanup FIFO if necessary */
-
-		if (engine->pfd[2].revents & ~POLLIN) {
-			/* time to die */
-			break;
-		}
-
-		if (engine->pfd[2].revents & POLLIN) {
-			char c;
-			while (read (engine->cleanup_fifo[0], &c, 1) == 1);
-		}
-
-		/* check each client socket before handling other request*/
-		
-		jack_rdlock_graph (engine);
-
-		for (i = fixed_fd_cnt; i < engine->pfd_max; i++) {
-
-			if (engine->pfd[i].fd < 0) {
-				continue;
-			}
-
-			if (engine->pfd[i].revents & ~POLLIN) {
-
-				jack_mark_client_socket_error (engine, engine->pfd[i].fd);
-				jack_engine_signal_problems (engine);
-
-			} else if (engine->pfd[i].revents & POLLIN) {
-
-				if (handle_external_client_request (engine, engine->pfd[i].fd)) {
-					jack_error ("could not handle external"
-						    " client request");
-					jack_engine_signal_problems (engine);
-				}
-			}
-		}
-
-		problemsProblemsPROBLEMS = engine->problems;
-
-		jack_unlock_graph (engine);
-
-		/* need to take write lock since we may/will rip out some clients,
-		   and reset engine->problems
-		 */
-
-		while (problemsProblemsPROBLEMS) {
-			
-			VERBOSE (engine, "trying to lock graph to remove %d problems", problemsProblemsPROBLEMS);
-			jack_lock_graph (engine);
-			VERBOSE (engine, "we have problem clients (problems = %d", problemsProblemsPROBLEMS);
-			jack_remove_clients (engine);
-			jack_unlock_graph (engine);
-
-			jack_lock_problems (engine);
-			engine->problems -= problemsProblemsPROBLEMS;
-			problemsProblemsPROBLEMS = engine->problems;
-			jack_unlock_problems (engine);
-
-			VERBOSE (engine, "after removing clients, problems = %d", problemsProblemsPROBLEMS);
-		}
-		
-			
-		/* check the master server socket */
-
-		if (engine->pfd[0].revents & POLLERR) {
-			jack_error ("error on server socket");
-			break;
-		}
-	
-		if (engine->control->engine_ok && engine->pfd[0].revents & POLLIN) {
-			DEBUG ("pfd[0].revents & POLLIN");
-
-			memset (&client_addr, 0, sizeof (client_addr));
-			client_addrlen = sizeof (client_addr);
-
-			if ((client_socket =
-			     accept (engine->fds[0],
-				     (struct sockaddr *) &client_addr,
-				     &client_addrlen)) < 0) {
-				jack_error ("cannot accept new connection (%s)",
-					    strerror (errno));
-			} else if (jack_client_create (engine, client_socket) < 0) {
-				jack_error ("cannot complete client "
-					    "connection process");
-				close (client_socket);
-			}
-		}
-		
-		/* check the ACK server socket */
-
-		if (engine->pfd[1].revents & POLLERR) {
-			jack_error ("error on server ACK socket");
-			break;
-		}
-
-		if (engine->control->engine_ok && engine->pfd[1].revents & POLLIN) {
-			DEBUG ("pfd[1].revents & POLLIN");
-
-			memset (&client_addr, 0, sizeof (client_addr));
-			client_addrlen = sizeof (client_addr);
-
-			if ((client_socket =
-			     accept (engine->fds[1],
-				     (struct sockaddr *) &client_addr,
-				     &client_addrlen)) < 0) {
-				jack_error ("cannot accept new ACK connection"
-					    " (%s)", strerror (errno));
-			} else if (handle_client_ack_connection
-				   (engine, client_socket)) {
-				jack_error ("cannot complete client ACK "
-					    "connection process");
-				close (client_socket);
-			}
-		}
-	}
-
-	return 0;
-}
-
-jack_engine_t *
-jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock,
-		 const char *server_name, int temporary, int verbose,
-		 int client_timeout, unsigned int port_max, pid_t wait_pid,
-		 jack_nframes_t frame_time_offset, int nozombies, JSList *drivers)
-{
-	jack_engine_t *engine;
-	unsigned int i;
-        char server_dir[PATH_MAX+1] = "";
-
-#ifdef USE_CAPABILITIES
-	uid_t uid = getuid ();
-	uid_t euid = geteuid ();
-#endif /* USE_CAPABILITIES */
-
-	/* before we start allocating resources, make sure that if realtime was requested that we can 
-	   actually do it.
-	*/
-
-	if (realtime) {
-		if (jack_acquire_real_time_scheduling (pthread_self(), 10) != 0) {
-			/* can't run realtime - time to bomb */
-			return NULL;
-		}
-
-		jack_drop_real_time_scheduling (pthread_self());
-
-#ifdef USE_MLOCK
-
-		if (do_mlock && (mlockall (MCL_CURRENT | MCL_FUTURE) != 0)) {
-			jack_error ("cannot lock down memory for jackd (%s)",
-				    strerror (errno));
-#ifdef ENSURE_MLOCK
-			return NULL;
-#endif /* ENSURE_MLOCK */
-		}
-#endif /* USE_MLOCK */
-	}
-
-	/* start a thread to display messages from realtime threads */
-	jack_messagebuffer_init();
-
-	jack_init_time ();
-
-	/* allocate the engine, zero the structure to ease debugging */
-	engine = (jack_engine_t *) calloc (1, sizeof (jack_engine_t));
-
-	engine->drivers = drivers;
-	engine->driver = NULL;
-	engine->driver_desc = NULL;
-	engine->driver_params = NULL;
-
-	engine->set_sample_rate = jack_set_sample_rate;
-	engine->set_buffer_size = jack_driver_buffer_size;
-	engine->run_cycle = jack_run_cycle;
-	engine->delay = jack_engine_delay;
-	engine->driver_exit = jack_engine_driver_exit;
-	engine->transport_cycle_start = jack_transport_cycle_start;
-	engine->client_timeout_msecs = client_timeout;
-	engine->problems = 0;
-
-	engine->next_client_id = 1;	/* 0 is a NULL client ID */
-	engine->port_max = port_max;
-	engine->server_thread = 0;
-	engine->watchdog_thread = 0;
-	engine->rtpriority = rtpriority;
-	engine->silent_buffer = 0;
-	engine->verbose = verbose;
-	engine->server_name = server_name;
-	engine->temporary = temporary;
-	engine->freewheeling = 0;
-	engine->feedbackcount = 0;
-	engine->wait_pid = wait_pid;
-	engine->nozombies = nozombies;
-	engine->removing_clients = 0;
-
-	engine->audio_out_cnt = 0;
-	engine->audio_in_cnt = 0;
-	engine->midi_out_cnt = 0;
-	engine->midi_in_cnt = 0;
-
-	jack_engine_reset_rolling_usecs (engine);
-	engine->max_usecs = 0.0f;
-
-	pthread_rwlock_init (&engine->client_lock, 0);
-	pthread_mutex_init (&engine->port_lock, 0);
-	pthread_mutex_init (&engine->request_lock, 0);
-	pthread_mutex_init (&engine->problem_lock, 0);
-
-	engine->clients = 0;
-
-	engine->pfd_size = 0;
-	engine->pfd_max = 0;
-	engine->pfd = 0;
-
-	engine->fifo_size = 16;
-	engine->fifo = (int *) malloc (sizeof (int) * engine->fifo_size);
-	for (i = 0; i < engine->fifo_size; i++) {
-		engine->fifo[i] = -1;
-	}
-
-	if (pipe (engine->cleanup_fifo)) {
-		jack_error ("cannot create cleanup FIFOs (%s)", strerror (errno));
-		return NULL;
-	}
-
-	if (fcntl (engine->cleanup_fifo[0], F_SETFL, O_NONBLOCK)) {
-		jack_error ("cannot set O_NONBLOCK on cleanup read FIFO (%s)", strerror (errno));
-		return NULL;
-	}
-
-	if (fcntl (engine->cleanup_fifo[1], F_SETFL, O_NONBLOCK)) {
-		jack_error ("cannot set O_NONBLOCK on cleanup write FIFO (%s)", strerror (errno));
-		return NULL;
-	}
-
-	engine->external_client_cnt = 0;
-
-	srandom (time ((time_t *) 0));
-
-	if (jack_shmalloc (sizeof (jack_control_t)
-			   + ((sizeof (jack_port_shared_t) * engine->port_max)),
-			   &engine->control_shm)) {
-		jack_error ("cannot create engine control shared memory "
-			    "segment (%s)", strerror (errno));
-		return NULL;
-	}
-
-	if (jack_attach_shm (&engine->control_shm)) {
-		jack_error ("cannot attach to engine control shared memory"
-			    " (%s)", strerror (errno));
-		jack_destroy_shm (&engine->control_shm);
-		return NULL;
-	}
-
-	engine->control = (jack_control_t *)
-		jack_shm_addr (&engine->control_shm);
-
-	/* Setup port type information from builtins. buffer space is
-	 * allocated when the driver calls jack_driver_buffer_size().
-	 */
-	for (i = 0; jack_builtin_port_types[i].type_name[0]; ++i) {
-
-		memcpy (&engine->control->port_types[i],
-			&jack_builtin_port_types[i],
-			sizeof (jack_port_type_info_t));
-
-		VERBOSE (engine, "registered builtin port type %s",
-			 engine->control->port_types[i].type_name);
-
-		/* the port type id is index into port_types array */
-		engine->control->port_types[i].ptype_id = i;
-
-		/* be sure to initialize mutex correctly */
-		pthread_mutex_init (&engine->port_buffers[i].lock, NULL);
-
-		/* set buffer list info correctly */
-		engine->port_buffers[i].freelist = NULL;
-		engine->port_buffers[i].info = NULL;
-		
-		/* mark each port segment as not allocated */
-		engine->port_segment[i].index = -1;
-		engine->port_segment[i].attached_at = 0;
-	}
-
-	engine->control->n_port_types = i;
-
-	/* Mark all ports as available */
-
-	for (i = 0; i < engine->port_max; i++) {
-		engine->control->ports[i].in_use = 0;
-		engine->control->ports[i].id = i;
-		engine->control->ports[i].alias1[0] = '\0';
-		engine->control->ports[i].alias2[0] = '\0';
-	}
-
-	/* allocate internal port structures so that we can keep track
-	 * of port connections.
-	 */
-	engine->internal_ports = (jack_port_internal_t *)
-		malloc (sizeof (jack_port_internal_t) * engine->port_max);
-
-	for (i = 0; i < engine->port_max; i++) {
-		engine->internal_ports[i].connections = 0;
-	}
-
-	if (make_sockets (engine->server_name, engine->fds) < 0) {
-		jack_error ("cannot create server sockets");
-		return NULL;
-	}
-
-	engine->control->port_max = engine->port_max;
-	engine->control->real_time = realtime;
-	
-	/* leave some headroom for other client threads to run
-	   with priority higher than the regular client threads
-	   but less than the server. see thread.h for 
-	   jack_client_real_time_priority() and jack_client_max_real_time_priority()
-	   which are affected by this.
-	*/
-
-	engine->control->client_priority = (realtime
-					    ? engine->rtpriority - 5
-					    : 0);
-	engine->control->max_client_priority = (realtime
-						? engine->rtpriority - 1
-						: 0);
-	engine->control->do_mlock = do_mlock;
-	engine->control->do_munlock = do_unlock;
-	engine->control->cpu_load = 0;
-	engine->control->xrun_delayed_usecs = 0;
-	engine->control->max_delayed_usecs = 0;
-
-	jack_set_clock_source (clock_source);
-	engine->control->clock_source = clock_source;
-
-	VERBOSE (engine, "clock source = %s", jack_clock_source_name (clock_source));
-
-	engine->control->frame_timer.frames = frame_time_offset;
-	engine->control->frame_timer.reset_pending = 0;
-	engine->control->frame_timer.current_wakeup = 0;
-	engine->control->frame_timer.next_wakeup = 0;
-	engine->control->frame_timer.initialized = 0;
-	engine->control->frame_timer.filter_coefficient = 0.01;
-	engine->control->frame_timer.second_order_integrator = 0;
-
-	engine->first_wakeup = 1;
-
-	engine->control->buffer_size = 0;
-	jack_transport_init (engine);
-	jack_set_sample_rate (engine, 0);
-	engine->control->internal = 0;
-
-	engine->control->has_capabilities = 0;
-        
-#ifdef JACK_USE_MACH_THREADS
-        /* specific resources for server/client real-time thread
-	 * communication */
-	engine->servertask = mach_task_self();
-	if (task_get_bootstrap_port(engine->servertask, &engine->bp)){
-		jack_error("Jackd: Can't find bootstrap mach port");
-		return NULL;
-        }
-        engine->portnum = 0;
-#endif /* JACK_USE_MACH_THREADS */
-        
-        
-#ifdef USE_CAPABILITIES
-	if (uid == 0 || euid == 0) {
-		VERBOSE (engine, "running with uid=%d and euid=%d, "
-			 "will not try to use capabilites",
-			 uid, euid);
-	} else {
-		/* only try to use capabilities if not running as root */
-		engine->control->has_capabilities = check_capabilities (engine);
-		if (engine->control->has_capabilities == 0) {
-			VERBOSE (engine, "required capabilities not "
-				 "available");
-		}
-		if (engine->verbose) {
-			size_t size;
-			cap_t cap = cap_init();
-			capgetp(0, cap);
-			VERBOSE (engine, "capabilities: %s",
-				 cap_to_text(cap, &size));
-		}
-	}
-#endif /* USE_CAPABILITIES */
-
-	engine->control->engine_ok = 1;
-
-	snprintf (engine->fifo_prefix, sizeof (engine->fifo_prefix),
-		  "%s/jack-ack-fifo-%d",
-		  jack_server_dir (engine->server_name, server_dir), getpid ());
-
-	(void) jack_get_fifo_fd (engine, 0);
-
-	jack_client_create_thread (NULL, &engine->server_thread, 0, FALSE,
-				   &jack_server_thread, engine);
-
-	return engine;
-}
-
-static void
-jack_engine_delay (jack_engine_t *engine, float delayed_usecs)
-{
-	jack_event_t event;
-	
-	engine->control->frame_timer.reset_pending = 1;
-
-	engine->control->xrun_delayed_usecs = delayed_usecs;
-
-	if (delayed_usecs > engine->control->max_delayed_usecs)
-		engine->control->max_delayed_usecs = delayed_usecs;
-
-	event.type = XRun;
-
-	jack_deliver_event_to_all (engine, &event);
-}
-
-static inline void
-jack_inc_frame_time (jack_engine_t *engine, jack_nframes_t nframes)
-{
-	jack_frame_timer_t *timer = &engine->control->frame_timer;
-	jack_time_t now = engine->driver->last_wait_ust; // effective time
-	float delta;
-
-	// really need a memory barrier here
-	timer->guard1++;
-
-	delta = (int64_t) now - (int64_t) timer->next_wakeup;
-
-	timer->current_wakeup = timer->next_wakeup;
-	timer->frames += nframes;
-	timer->second_order_integrator += 0.5f * 
-		timer->filter_coefficient * delta;	
-	timer->next_wakeup = timer->current_wakeup + 
-		engine->driver->period_usecs + 
-		(int64_t) floorf ((timer->filter_coefficient * 
-				   (delta + timer->second_order_integrator)));
-	timer->initialized = 1;
-
-	// might need a memory barrier here
-	timer->guard2++;
-}
-
-static void*
-jack_engine_freewheel (void *arg)
-{
-	jack_engine_t* engine = (jack_engine_t *) arg;
-
-	VERBOSE (engine, "freewheel thread starting ...");
-
-	/* we should not be running SCHED_FIFO, so we don't 
-	   have to do anything about scheduling.
-	*/
-
-	while (engine->freewheeling) {
-
-		jack_lock_graph (engine);
-
-		if (jack_engine_process (engine,
-					 engine->control->buffer_size)) {
-			jack_error ("process cycle within freewheel failed");
-			jack_unlock_graph (engine);
-			break;
-		}
-
-		jack_engine_post_process (engine);
-
-		jack_unlock_graph (engine);
-	}
-
-	VERBOSE (engine, "freewheel came to an end, naturally");
-	return 0;
-}
-
-static int
-jack_start_freewheeling (jack_engine_t* engine)
-{
-	jack_event_t event;
-
-	if (engine->freewheeling) {
-		return 0;
-	}
-
-	if (engine->driver == NULL) {
-		jack_error ("cannot start freewheeling without a driver!");
-		return -1;
-	}
-
-	/* stop driver before telling anyone about it so 
-	   there are no more process() calls being handled.
-	*/
-
-	if (engine->driver->stop (engine->driver)) {
-		jack_error ("could not stop driver for freewheeling");
-		return -1;
-	}
-
-	engine->freewheeling = 1;
-
-	event.type = StartFreewheel;
-	jack_deliver_event_to_all (engine, &event);
-	
-	if (jack_client_create_thread (NULL, &engine->freewheel_thread, 0, FALSE,
-				       jack_engine_freewheel, engine)) {
-		jack_error ("could not start create freewheel thread");
-		return -1;
-	}
-
-	return 0;
-}
-
-static int
-jack_stop_freewheeling (jack_engine_t* engine)
-{
-	jack_event_t event;
-	void *ftstatus;
-
-	if (!engine->freewheeling) {
-		return 0;
-	}
-
-	if (engine->driver == NULL) {
-		jack_error ("cannot start freewheeling without a driver!");
-		return -1;
-	}
-
-	if (!engine->freewheeling) {
-		VERBOSE (engine, "stop freewheel when not freewheeling");
-		return 0;
-	}
-
-	/* tell the freewheel thread to stop, and wait for it
-	   to exit.
-	*/
-
-	engine->freewheeling = 0;
-	VERBOSE (engine, "freewheeling stopped, waiting for thread");
-	pthread_join (engine->freewheel_thread, &ftstatus);
-	VERBOSE (engine, "freewheel thread has returned");
-
-	/* tell everyone we've stopped */
-
-	event.type = StopFreewheel;
-	jack_deliver_event_to_all (engine, &event);
-
-	/* restart the driver */
-
-	if (engine->driver->start (engine->driver)) {
-		jack_error ("could not restart driver after freewheeling");
-		return -1;
-	}
-	return 0;
-}
-
-static int
-jack_run_one_cycle (jack_engine_t *engine, jack_nframes_t nframes,
-		    float delayed_usecs)
-{
-	jack_driver_t* driver = engine->driver;
-	int ret = -1;
-	static int consecutive_excessive_delays = 0;
-
-#define WORK_SCALE 1.0f
-
-	if (engine->control->real_time &&
-	    engine->spare_usecs &&
-	    ((WORK_SCALE * engine->spare_usecs) <= delayed_usecs)) {
-
-		MESSAGE("delay of %.3f usecs exceeds estimated spare"
-			 " time of %.3f; restart ...\n",
-			 delayed_usecs, WORK_SCALE * engine->spare_usecs);
-		
-		if (++consecutive_excessive_delays > 10) {
-			jack_error ("too many consecutive interrupt delays "
-				    "... engine pausing");
-			return -1;	/* will exit the thread loop */
-		}
-
-		jack_engine_delay (engine, delayed_usecs);
-		
-		return 0;
-
-	} else {
-		consecutive_excessive_delays = 0;
-	}
-
-	DEBUG ("trying to acquire read lock");
-	if (jack_try_rdlock_graph (engine)) {
-		VERBOSE (engine, "lock-driven null cycle");
-		driver->null_cycle (driver, nframes);
-		return 0;
-	}
-
-	if (jack_trylock_problems (engine)) {
-		VERBOSE (engine, "problem-lock-driven null cycle");
-		jack_unlock_graph (engine);
-		driver->null_cycle (driver, nframes);
-		return 0;
-	}
-
-	if (engine->problems) {
-		VERBOSE (engine, "problem-driven null cycle problems=%d", engine->problems);
-		jack_unlock_problems (engine);
-		jack_unlock_graph (engine);
-		driver->null_cycle (driver, nframes);
-		return 0;
-	}
-
-	jack_unlock_problems (engine);
-		
-	if (!engine->freewheeling) {
-		DEBUG("waiting for driver read\n");
-		if (driver->read (driver, nframes)) {
-			goto unlock;
-		}
-	}
-	
-	DEBUG("run process\n");
-
-	if (jack_engine_process (engine, nframes) == 0) {
-		if (!engine->freewheeling) {
-			if (driver->write (driver, nframes)) {
-				goto unlock;
-			}
-		}
-
-	} else {
-
-		JSList *node;
-		DEBUG ("engine process cycle failed");
-
-		/* we are already late, or something else went wrong,
-		   so it can't hurt to check the existence of all
-		   clients.
-		*/
-
-		for (node = engine->clients; node;
-		     node = jack_slist_next (node)) {
-			jack_client_internal_t *client =
-				(jack_client_internal_t *) node->data;
-
-			if (client->control->type == ClientExternal) {
-				if (kill (client->control->pid, 0)) {
-					VERBOSE(engine,
-						"client %s has died/exited",
-						client->control->name);
-					client->error++;
-				}
-				if(client->control->last_status != 0) {
-					VERBOSE(engine,
-						"client %s has nonzero process callback status (%d)\n",
-						client->control->name, client->control->last_status);
-					client->error++;
-				}
-			}
-			
-			DEBUG ("client %s errors = %d", client->control->name,
-			       client->error);
-		}
-	}
-
-	jack_engine_post_process (engine);
-
-	if (delayed_usecs > engine->control->max_delayed_usecs)
-		engine->control->max_delayed_usecs = delayed_usecs;
-	
-	ret = 0;
-
-  unlock:
-	jack_unlock_graph (engine);
-	DEBUG("cycle finished, status = %d", ret);
-
-	return ret;
-}
-
-static void
-jack_engine_driver_exit (jack_engine_t* engine)
-{
-	jack_driver_t* driver = engine->driver;
-
-	VERBOSE (engine, "stopping driver");
-	driver->stop (driver);
-	VERBOSE (engine, "detaching driver");
-	driver->detach (driver, engine);
-
-	/* tell anyone waiting that the driver exited. */
-	kill (engine->wait_pid, SIGUSR2);
-	
-	engine->driver = NULL;
-}
-
-static int
-jack_run_cycle (jack_engine_t *engine, jack_nframes_t nframes,
-		float delayed_usecs)
-{
-	jack_nframes_t left;
-	jack_nframes_t b_size = engine->control->buffer_size;
-	jack_frame_timer_t* timer = &engine->control->frame_timer;
-	int no_increment = 0;
-
-	if (engine->first_wakeup) {
-
-		/* the first wakeup */
-
-		timer->next_wakeup = 
-			engine->driver->last_wait_ust +
-			engine->driver->period_usecs;
-		engine->first_wakeup = 0;
-		
-		/* if we got an xrun/delayed wakeup on the first cycle,
-		   reset the pending flag (we have no predicted wakeups
-		   to use), but avoid incrementing the frame timer.
-		*/
-
-		if (timer->reset_pending) {
-			timer->reset_pending = 0;
-			no_increment = 1;
-		}
-	}
-
-	if (timer->reset_pending) {
-
-		/* post xrun-handling */
-
-		/* don't bother to increment the frame counter, because we missed 1 or more 
-		   deadlines in the backend anyway.
-		 */
-
-		timer->current_wakeup = engine->driver->last_wait_ust;
-		timer->next_wakeup = engine->driver->last_wait_ust +
-			engine->driver->period_usecs;
-
-		timer->reset_pending = 0;
-
-	} else {
-		
-		/* normal condition */
-
-		if (!no_increment) {
-			jack_inc_frame_time (engine, nframes);
-		}
-	}
-
-	if (engine->verbose) {
-		if (nframes != b_size) { 
-			VERBOSE (engine, 
-				"late driver wakeup: nframes to process = %"
-				PRIu32 ".", nframes);
-		}
-	}
-
-	/* run as many cycles as it takes to consume nframes */
-	for (left = nframes; left >= b_size; left -= b_size) {
-		if (jack_run_one_cycle (engine, b_size, delayed_usecs)) {
-			jack_error ("cycle execution failure, exiting");
-			return EIO;
-		}
-	}
-
-	return 0;
-}
-
-void 
-jack_engine_delete (jack_engine_t *engine)
-{
-	int i;
-
-	if (engine == NULL)
-		return;
-
-	VERBOSE (engine, "starting server engine shutdown");
-
-	engine->control->engine_ok = 0;	/* tell clients we're going away */
-
-	/* this will wake the server thread and cause it to exit */
-
-	close (engine->cleanup_fifo[0]);
-	close (engine->cleanup_fifo[1]);
-
-	/* shutdown master socket to prevent new clients arriving */
-	shutdown (engine->fds[0], SHUT_RDWR);
-	// close (engine->fds[0]);
-
-	/* now really tell them we're going away */
-
-	for (i = 0; i < engine->pfd_max; ++i) {
-		shutdown (engine->pfd[i].fd, SHUT_RDWR);
-	}
-
-	if (engine->driver) {
-		jack_driver_t* driver = engine->driver;
-
-		VERBOSE (engine, "stopping driver");
-		driver->stop (driver);
-		// VERBOSE (engine, "detaching driver");
-		// driver->detach (driver, engine);
-		VERBOSE (engine, "unloading driver");
-		jack_driver_unload (driver);
-		engine->driver = NULL;
-	}
-
-	VERBOSE (engine, "freeing shared port segments");
-	for (i = 0; i < engine->control->n_port_types; ++i) {
-		jack_release_shm (&engine->port_segment[i]);
-		jack_destroy_shm (&engine->port_segment[i]);
-	}
-
-	/* stop the other engine threads */
-	VERBOSE (engine, "stopping server thread");
-
-#if JACK_USE_MACH_THREADS 
-	// MacOSX pthread_cancel still not implemented correctly in Darwin
-	mach_port_t machThread = pthread_mach_thread_np (engine->server_thread);
-	thread_terminate (machThread);
-#else
-	pthread_cancel (engine->server_thread);
-	pthread_join (engine->server_thread, NULL);
-#endif	
-
-#ifndef JACK_USE_MACH_THREADS 
-	/* Cancel the watchdog thread and wait for it to terminate.
-	 *
-	 * The watchdog thread is not used on MacOSX since CoreAudio
-	 * drivers already contain a similar mechanism.
-	 */	
-	if (engine->control->real_time && engine->watchdog_thread) {
-		VERBOSE (engine, "stopping watchdog thread");
-		pthread_cancel (engine->watchdog_thread);
-		pthread_join (engine->watchdog_thread, NULL);
-	}
-#endif
-
-	VERBOSE (engine, "last xrun delay: %.3f usecs",
-		engine->control->xrun_delayed_usecs);
-	VERBOSE (engine, "max delay reported by backend: %.3f usecs",
-		engine->control->max_delayed_usecs);
-
-	/* free engine control shm segment */
-	engine->control = NULL;
-	VERBOSE (engine, "freeing engine shared memory");
-	jack_release_shm (&engine->control_shm);
-	jack_destroy_shm (&engine->control_shm);
-
-	VERBOSE (engine, "max usecs: %.3f, engine deleted", engine->max_usecs);
-
-	free (engine);
-
-	jack_messagebuffer_exit();
-}
-
-void
-jack_port_clear_connections (jack_engine_t *engine,
-			     jack_port_internal_t *port)
-{
-	JSList *node, *next;
-
-	for (node = port->connections; node; ) {
-		next = jack_slist_next (node);
-		jack_port_disconnect_internal (
-			engine, ((jack_connection_internal_t *)
-				 node->data)->source,
-			((jack_connection_internal_t *)
-			 node->data)->destination);
-		node = next;
-	}
-
-	jack_slist_free (port->connections);
-	port->connections = 0;
-}
-
-static void
-jack_deliver_event_to_all (jack_engine_t *engine, jack_event_t *event)
-{
-	JSList *node;
-
-	jack_rdlock_graph (engine);
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		jack_deliver_event (engine,
-				    (jack_client_internal_t *) node->data,
-				    event);
-	}
-	jack_unlock_graph (engine);
-}
-
-static void
-jack_notify_all_port_interested_clients (jack_engine_t *engine, jack_client_id_t src, jack_client_id_t dst, jack_port_id_t a, jack_port_id_t b, int connected)
-{
-	JSList *node;
-	jack_event_t event;
-  
-	event.type = (connected ? PortConnected : PortDisconnected);
-	event.x.self_id = a;
-	event.y.other_id = b;
- 	
-	/* GRAPH MUST BE LOCKED : see callers of jack_send_connection_notification() 
-	 */
-
-	jack_client_internal_t* src_client = jack_client_internal_by_id (engine, src);
-	jack_client_internal_t* dst_client = jack_client_internal_by_id (engine, dst);
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		jack_client_internal_t* client = (jack_client_internal_t*) node->data;
-		if (src_client != client &&  dst_client  != client && client->control->port_connect_cbset != FALSE) {
-			
-			/* one of the ports belong to this client or it has a port connect callback */
-			jack_deliver_event (engine, client, &event);
-		} 
-	}
-}
-
-static int
-jack_deliver_event (jack_engine_t *engine, jack_client_internal_t *client,
-		    jack_event_t *event)
-{
-	char status;
-
-	/* caller must hold the graph lock */
-
-	DEBUG ("delivering event (type %d)", event->type);
-
-	/* we are not RT-constrained here, so use kill(2) to beef up
-	   our check on a client's continued well-being
-	*/
-
-	if (client->control->dead || client->error >= JACK_ERROR_WITH_SOCKETS 
-	    || (client->control->type == ClientExternal && kill (client->control->pid, 0))) {
-		DEBUG ("client %s is dead - no event sent",
-		       client->control->name);
-		return 0;
-	}
-
-	DEBUG ("client %s is still alive", client->control->name);
-
-	if (jack_client_is_internal (client)) {
-
-		switch (event->type) {
-		case PortConnected:
-		case PortDisconnected:
-			jack_client_handle_port_connection
-				(client->private_client, event);
-			break;
-
-		case BufferSizeChange:
-			jack_client_invalidate_port_buffers
-				(client->private_client);
-
-			if (client->control->bufsize_cbset) {
-				client->private_client->bufsize
-					(event->x.n,
-					 client->private_client->bufsize_arg);
-			}
-			break;
-
-		case SampleRateChange:
-			if (client->control->srate_cbset) {
-				client->private_client->srate
-					(event->x.n,
-					 client->private_client->srate_arg);
-			}
-			break;
-
-		case GraphReordered:
-			if (client->control->graph_order_cbset) {
-				client->private_client->graph_order
-					(client->private_client->graph_order_arg);
-			}
-			break;
-
-		case XRun:
-			if (client->control->xrun_cbset) {
-				client->private_client->xrun
-					(client->private_client->xrun_arg);
-			}
-			break;
-
-		default:
-			/* internal clients don't need to know */
-			break;
-		}
-
-	} else {
-
-		if (client->control->active) {
-
-			/* there's a thread waiting for events, so
-			 * it's worth telling the client */
-
-			DEBUG ("engine writing on event fd");
-
-			if (write (client->event_fd, event, sizeof (*event))
-			    != sizeof (*event)) {
-				jack_error ("cannot send event to client [%s]"
-					    " (%s)", client->control->name,
-					    strerror (errno));
-				client->error += JACK_ERROR_WITH_SOCKETS;
-				jack_engine_signal_problems (engine);
-			}
-
- 			if (client->error) {
- 				status = 1;
- 			} else {
- 				// then we check whether there really is an error.... :)
- 
- 				struct pollfd pfd[1];
- 				pfd[0].fd = client->event_fd;
- 				pfd[0].events = POLLERR|POLLIN|POLLHUP|POLLNVAL;
- 				jack_time_t poll_timeout = JACKD_CLIENT_EVENT_TIMEOUT;
- 				int poll_ret;
-				jack_time_t then = jack_get_microseconds ();
-				jack_time_t now;
-				
-#ifdef __linux
-			again:
-#endif
-				VERBOSE(engine,"client event poll on %d for %s starts at %lld", 
-					client->event_fd, client->control->name, then);
- 				if ((poll_ret = poll (pfd, 1, poll_timeout)) < 0) {
- 					DEBUG ("client event poll not ok! (-1) poll returned an error");
- 					jack_error ("poll on subgraph processing failed (%s)", strerror (errno));
- 					status = -1; 
- 				} else {
- 
- 					DEBUG ("\n\n\n\n\n back from client event poll, revents = 0x%x\n\n\n", pfd[0].revents);
-					now = jack_get_microseconds();
-					VERBOSE(engine,"back from client event poll after %lld usecs", now - then);
-
- 					if (pfd[0].revents & ~POLLIN) {
-
-						/* some kind of OOB socket event */
-
- 						DEBUG ("client event poll not ok! (-2), revents = %d\n", pfd[0].revents);
- 						jack_error ("subgraph starting at %s lost client", client->control->name);
- 						status = -2; 
-
- 					} else if (pfd[0].revents & POLLIN) {
-
-						/* client responded normally */
-
- 						DEBUG ("client event poll ok!");
- 						status = 0;
-
- 					} else if (poll_ret == 0) {
-
-						/* no events, no errors, we woke up because poll()
-						   decided that time was up ...
-						*/
-						
-#ifdef __linux		
-						if (linux_poll_bug_encountered (engine, then, &poll_timeout)) {
-							goto again;
-						}
-						
-						if (poll_timeout < 200) {
-							VERBOSE (engine, "FALSE WAKEUP skipped, remaining = %lld usec", poll_timeout);
-							status = 0;
-						} else {
-#endif
-							DEBUG ("client event poll not ok! (1 = poll timed out, revents = 0x%04x, poll_ret = %d)", pfd[0].revents, poll_ret);
-							VERBOSE (engine,"client %s did not respond to event type %d in time"
-								    "(fd=%d, revents = 0x%04x, timeout was %lld)", 
-								    client->control->name, event->type,
-								    client->event_fd,
-								    pfd[0].revents,
-								    poll_timeout);
-							status = 1;
-#ifdef __linux
-						}
-#endif
- 					}
- 				}
-  			}
-
- 			if (status == 0) {
- 				if (read (client->event_fd, &status, sizeof (status)) != sizeof (status)) {
- 					jack_error ("cannot read event response from "
- 							"client [%s] (%s)",
- 							client->control->name,
- 							strerror (errno));
-					status = -1;
- 				} 
-
- 			} else {
- 				jack_error ("bad status (%d) for client %s "
-					    "handling event (type = %d)",
- 					    status,
-					    client->control->name,
-					    event->type);
-  			}
-
-			if (status) {
-				client->error += JACK_ERROR_WITH_SOCKETS;
-				jack_engine_signal_problems (engine);
-			}
-		}
-	}
-	DEBUG ("event delivered");
-
-	return 0;
-}
-
-int
-jack_rechain_graph (jack_engine_t *engine)
-{
-	JSList *node, *next;
-	unsigned long n;
-	int err = 0;
-	jack_client_internal_t *client, *subgraph_client, *next_client;
-	jack_event_t event;
-	int upstream_is_jackd;
-
-	jack_clear_fifos (engine);
-
-	subgraph_client = 0;
-
-	VERBOSE(engine, "++ jack_rechain_graph():");
-
-	event.type = GraphReordered;
-
-	for (n = 0, node = engine->clients, next = NULL; node; node = next) {
-
-		next = jack_slist_next (node);
-
-		VERBOSE(engine, "+++ client is now %s active ? %d",
-			((jack_client_internal_t *) node->data)->control->name,
-			((jack_client_internal_t *) node->data)->control->active);
-
-		if (((jack_client_internal_t *) node->data)->control->active) {
-
-			client = (jack_client_internal_t *) node->data;
-
-			/* find the next active client. its ok for
-			 * this to be NULL */
-			
-			while (next) {
-				if (((jack_client_internal_t *)
-				     next->data)->control->active) {
-					break;
-				}
-				next = jack_slist_next (next);
-			};
-
-			if (next == NULL) {
-				next_client = NULL;
-			} else {
-				next_client = (jack_client_internal_t *)
-					next->data;
-			}
-
-			client->execution_order = n;
-			client->next_client = next_client;
-			
-			if (jack_client_is_internal (client)) {
-				
-				/* break the chain for the current
-				 * subgraph. the server will wait for
-				 * chain on the nth FIFO, and will
-				 * then execute this internal
-				 * client. */
-				
-				if (subgraph_client) {
-					subgraph_client->subgraph_wait_fd =
-						jack_get_fifo_fd (engine, n);
-					VERBOSE (engine, "client %s: wait_fd="
-						 "%d, execution_order="
-						 "%lu.", 
-						 subgraph_client->
-						 control->name,
-						 subgraph_client->
-						 subgraph_wait_fd, n);
-					n++;
-				}
-
-				VERBOSE (engine, "client %s: internal "
-					 "client, execution_order="
-					 "%lu.", 
-					 client->control->name, n);
-
-				/* this does the right thing for
-				 * internal clients too 
-				 */
-
-				jack_deliver_event (engine, client, &event);
-
-				subgraph_client = 0;
-
-			} else {
-				
-				if (subgraph_client == NULL) {
-					
-				        /* start a new subgraph. the
-					 * engine will start the chain
-					 * by writing to the nth
-					 * FIFO. 
-					 */
-					
-					subgraph_client = client;
-					subgraph_client->subgraph_start_fd =
-						jack_get_fifo_fd (engine, n);
-					VERBOSE (engine, "client %s: "
-						 "start_fd=%d, execution"
-						 "_order=%lu.",
-						 subgraph_client->
-						 control->name,
-						 subgraph_client->
-						 subgraph_start_fd, n);
-					
-					/* this external client after
-					   this will have jackd as its
-					   upstream connection.
-					*/
-					
-					upstream_is_jackd = 1;
-
-				} 
-				else {
-					VERBOSE (engine, "client %s: in"
-						 " subgraph after %s, "
-						 "execution_order="
-						 "%lu.",
-						 client->control->name,
-						 subgraph_client->
-						 control->name, n);
-					subgraph_client->subgraph_wait_fd = -1;
-					
-					/* this external client after
-					   this will have another
-					   client as its upstream
-					   connection.
-					*/
-					
-					upstream_is_jackd = 0;
-				}
-
-				/* make sure fifo for 'n + 1' exists
-				 * before issuing client reorder
-				 */
-				(void) jack_get_fifo_fd(
-					engine, client->execution_order + 1);
-				event.x.n = client->execution_order;
-				event.y.n = upstream_is_jackd;
-				jack_deliver_event (engine, client, &event);
-				n++;
-			}
-		}
-	}
-
-	if (subgraph_client) {
-		subgraph_client->subgraph_wait_fd =
-			jack_get_fifo_fd (engine, n);
-		VERBOSE (engine, "client %s: wait_fd=%d, "
-			 "execution_order=%lu (last client).", 
-			 subgraph_client->control->name,
-			 subgraph_client->subgraph_wait_fd, n);
-	}
-
-	VERBOSE (engine, "-- jack_rechain_graph()");
-
-	return err;
-}
-
-static jack_nframes_t
-jack_get_port_total_latency (jack_engine_t *engine,
-			     jack_port_internal_t *port, int hop_count,
-			     int toward_port)
-{
-	JSList *node;
-	jack_nframes_t latency;
-	jack_nframes_t max_latency = 0;
-
-#ifdef DEBUG_TOTAL_LATENCY_COMPUTATION
-	char prefix[32];
-	int i;
-
-	for (i = 0; i < hop_count; ++i) {
-		prefix[i] = '\t';
-	}
-
-	prefix[i] = '\0';
-#endif
-
-	/* call tree must hold engine->client_lock. */
-
-	latency = port->shared->latency;
-
-	/* we don't prevent cyclic graphs, so we have to do something
-	   to bottom out in the event that they are created.
-	*/
-
-	if (hop_count > 8) {
-		return latency;
-	}
-
-#ifdef DEBUG_TOTAL_LATENCY_COMPUTATION
-	jack_info ("%sFor port %s (%s)", prefix, port->shared->name, (toward_port ? "toward" : "away"));
-#endif
-	
-	for (node = port->connections; node; node = jack_slist_next (node)) {
-
-		jack_nframes_t this_latency;
-		jack_connection_internal_t *connection;
-
-		connection = (jack_connection_internal_t *) node->data;
-
-		
-		if ((toward_port &&
-		     (connection->source->shared == port->shared)) ||
-		    (!toward_port &&
-		     (connection->destination->shared == port->shared))) {
-
-#ifdef DEBUG_TOTAL_LATENCY_COMPUTATION
-			jack_info ("%s\tskip connection %s->%s",
-				 prefix,
-				 connection->source->shared->name,
-				 connection->destination->shared->name);
-#endif
-
-			continue;
-		}
-
-#ifdef DEBUG_TOTAL_LATENCY_COMPUTATION
-		jack_info ("%s\tconnection %s->%s ... ", 
-			 prefix,
-			 connection->source->shared->name,
-			 connection->destination->shared->name);
-#endif
-		/* if we're a destination in the connection, recurse
-		   on the source to get its total latency
-		*/
-
-		if (connection->destination == port) {
-
-			if (connection->source->shared->flags
-			    & JackPortIsTerminal) {
-				this_latency = connection->source->
-					shared->latency;
-			} else {
-				this_latency =
-					jack_get_port_total_latency (
-						engine, connection->source,
-						hop_count + 1, 
-						toward_port);
-			}
-
-		} else {
-
-			/* "port" is the source, so get the latency of
-			 * the destination */
-			if (connection->destination->shared->flags
-			    & JackPortIsTerminal) {
-				this_latency = connection->destination->
-					shared->latency;
-			} else {
-				this_latency =
-					jack_get_port_total_latency (
-						engine,
-						connection->destination,
-						hop_count + 1, 
-						toward_port);
-			}
-		}
-
-		if (this_latency > max_latency) {
-			max_latency = this_latency;
-		}
-	}
-
-#ifdef DEBUG_TOTAL_LATENCY_COMPUTATION
-	jack_info ("%s\treturn %lu + %lu = %lu", prefix, latency, max_latency, latency + max_latency);
-#endif	
-
-	return latency + max_latency;
-}
-
-static void
-jack_compute_port_total_latency (jack_engine_t* engine, jack_port_shared_t* port)
-{
-	if (port->in_use) {
-		port->total_latency =
-			jack_get_port_total_latency (
-				engine, &engine->internal_ports[port->id],
-				0, !(port->flags & JackPortIsOutput));
-	}
-}
-
-static void
-jack_compute_all_port_total_latencies (jack_engine_t *engine)
-{
-	jack_port_shared_t *shared = engine->control->ports;
-	unsigned int i;
- 	int toward_port;
- 
-	for (i = 0; i < engine->control->port_max; i++) {
-		if (shared[i].in_use) {
-			if (shared[i].flags & JackPortIsOutput) {
-				toward_port = FALSE;
-			} else {
-				toward_port = TRUE;
-			}
-			shared[i].total_latency =
-				jack_get_port_total_latency (
-					engine, &engine->internal_ports[i],
-					0, toward_port);
-		}
-	}
-}
-
-/* How the sort works:
- *
- * Each client has a "sortfeeds" list of clients indicating which clients
- * it should be considered as feeding for the purposes of sorting the
- * graph. This list differs from the clients it /actually/ feeds in the
- * following ways:
- *
- * 1. Connections from a client to itself are disregarded
- *
- * 2. Connections to a driver client are disregarded
- *
- * 3. If a connection from A to B is a feedback connection (ie there was
- *    already a path from B to A when the connection was made) then instead
- *    of B appearing on A's sortfeeds list, A will appear on B's sortfeeds
- *    list.
- *
- * If client A is on client B's sortfeeds list, client A must come after
- * client B in the execution order. The above 3 rules ensure that the
- * sortfeeds relation is always acyclic so that all ordering constraints
- * can actually be met. 
- *
- * Each client also has a "truefeeds" list which is the same as sortfeeds
- * except that feedback connections appear normally instead of reversed.
- * This is used to detect whether the graph has become acyclic.
- *
- */ 
- 
-void
-jack_sort_graph (jack_engine_t *engine)
-{
-	/* called, obviously, must hold engine->client_lock */
-
-	VERBOSE (engine, "++ jack_sort_graph");
-	engine->clients = jack_slist_sort (engine->clients,
-					   (JCompareFunc) jack_client_sort);
-	jack_compute_all_port_total_latencies (engine);
-	jack_rechain_graph (engine);
-	VERBOSE (engine, "-- jack_sort_graph");
-}
-
-static int 
-jack_client_sort (jack_client_internal_t *a, jack_client_internal_t *b)
-{
-	/* drivers are forced to the front, ie considered as sources
-	   rather than sinks for purposes of the sort */
-
-	if (jack_client_feeds_transitive (a, b) ||
-	    (a->control->type == ClientDriver &&
-	     b->control->type != ClientDriver)) {
-		return -1;
-	} else if (jack_client_feeds_transitive (b, a) ||
-		   (b->control->type == ClientDriver &&
-		    a->control->type != ClientDriver)) {
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-/* transitive closure of the relation expressed by the sortfeeds lists. */
-static int
-jack_client_feeds_transitive (jack_client_internal_t *source,
-			      jack_client_internal_t *dest )
-{
-	jack_client_internal_t *med;
-	JSList *node;
-	
-	if (jack_slist_find (source->sortfeeds, dest)) {
-		return 1;
-	}
-
-	for (node = source->sortfeeds; node; node = jack_slist_next (node)) {
-
-		med = (jack_client_internal_t *) node->data;
-
-		if (jack_client_feeds_transitive (med, dest)) {
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
-/**
- * Checks whether the graph has become acyclic and if so modifies client
- * sortfeeds lists to turn leftover feedback connections into normal ones.
- * This lowers latency, but at the expense of some data corruption.
- */
-static void
-jack_check_acyclic (jack_engine_t *engine)
-{
-	JSList *srcnode, *dstnode, *portnode, *connnode;
-	jack_client_internal_t *src, *dst;
-	jack_port_internal_t *port;
-	jack_connection_internal_t *conn;
-	int stuck;
-	int unsortedclients = 0;
-
-	VERBOSE (engine, "checking for graph become acyclic");
-
-	for (srcnode = engine->clients; srcnode;
-	     srcnode = jack_slist_next (srcnode)) {
-
-		src = (jack_client_internal_t *) srcnode->data;
-		src->tfedcount = src->fedcount;
-		unsortedclients++;
-	}
-	
-	stuck = FALSE;
-
-	/* find out whether a normal sort would have been possible */
-	while (unsortedclients && !stuck) {
-	
-		stuck = TRUE;
-
-		for (srcnode = engine->clients; srcnode;
-	     	     srcnode = jack_slist_next (srcnode)) {
-
-			src = (jack_client_internal_t *) srcnode->data;
-			
-			if (!src->tfedcount) {
-			
-				stuck = FALSE;
-				unsortedclients--;
-				src->tfedcount = -1;
-				
-				for (dstnode = src->truefeeds; dstnode;
-				     dstnode = jack_slist_next (dstnode)) {
-				     
-					dst = (jack_client_internal_t *)
-						dstnode->data;
-					dst->tfedcount--;
-				}
-			}
-		}
-	}
-	
-	if (stuck) {
-
-		VERBOSE (engine, "graph is still cyclic" );
-	} else {
-
-		VERBOSE (engine, "graph has become acyclic");
-
-		/* turn feedback connections around in sortfeeds */
-		for (srcnode = engine->clients; srcnode;
-		     srcnode = jack_slist_next (srcnode)) {
-
-			src = (jack_client_internal_t *) srcnode->data;
-
-			for (portnode = src->ports; portnode;
-			     portnode = jack_slist_next (portnode)) {
-
-				port = (jack_port_internal_t *) portnode->data;
-			
-				for (connnode = port->connections; connnode;
-				     connnode = jack_slist_next (connnode)) {
-				
-					conn = (jack_connection_internal_t*)
-						connnode->data;
-				
-					if (conn->dir == -1 )
-					
-					/*&& 
-						conn->srcclient == src) */{
-				
-						VERBOSE (engine,
-						"reversing connection from "
-						"%s to %s",
-						conn->srcclient->control->name,
-						conn->dstclient->control->name);
-						conn->dir = 1;
-						conn->dstclient->sortfeeds = 
-						  jack_slist_remove
-						    (conn->dstclient->sortfeeds,
-						     conn->srcclient);
-					     
-						conn->srcclient->sortfeeds =
-						  jack_slist_prepend
-						    (conn->srcclient->sortfeeds,
-						     conn->dstclient );
-					}
-				}
-			}
-		}
-		engine->feedbackcount = 0;
-	}
-}
-
-/**
- * Dumps current engine configuration.
- */
-void jack_dump_configuration(jack_engine_t *engine, int take_lock)
-{
-        JSList *clientnode, *portnode, *connectionnode;
-	jack_client_internal_t *client;
-	jack_client_control_t *ctl;
-	jack_port_internal_t *port;
-	jack_connection_internal_t* connection;
-	int n, m, o;
-	
-	jack_info ("engine.c: <-- dump begins -->");
-
-	if (take_lock) {
-		jack_rdlock_graph (engine);
-	}
-
-	for (n = 0, clientnode = engine->clients; clientnode;
-	     clientnode = jack_slist_next (clientnode)) {
-	        client = (jack_client_internal_t *) clientnode->data;
-		ctl = client->control;
-
-		jack_info ("client #%d: %s (type: %d, process? %s,"
-			 " start=%d wait=%d",
-			 ++n,
-			 ctl->name,
-			 ctl->type,
-			 ctl->process_cbset ? "yes" : "no",
-			 client->subgraph_start_fd,
-			 client->subgraph_wait_fd);
-
-		for(m = 0, portnode = client->ports; portnode;
-		    portnode = jack_slist_next (portnode)) {
-		        port = (jack_port_internal_t *) portnode->data;
-
-			jack_info("\t port #%d: %s", ++m,
-				port->shared->name);
-
-			for(o = 0, connectionnode = port->connections; 
-			    connectionnode; 
-			    connectionnode =
-				    jack_slist_next (connectionnode)) {
-			        connection = (jack_connection_internal_t *)
-					connectionnode->data;
-	
-				jack_info("\t\t connection #%d: %s %s",
-					++o,
-					(port->shared->flags
-					 & JackPortIsInput)? "<-": "->",
-					(port->shared->flags & JackPortIsInput)?
-					connection->source->shared->name:
-					connection->destination->shared->name);
-			}
-		}
-	}
-
-	if (take_lock) {
-		jack_unlock_graph (engine);
-	}
-
-	
-	jack_info("engine.c: <-- dump ends -->");
-}
-
-static int 
-jack_port_do_connect (jack_engine_t *engine,
-		       const char *source_port,
-		       const char *destination_port)
-{
-	jack_connection_internal_t *connection;
-	jack_port_internal_t *srcport, *dstport;
-	jack_port_id_t src_id, dst_id;
-	jack_client_internal_t *srcclient, *dstclient;
-	JSList *it;
-
-	if ((srcport = jack_get_port_by_name (engine, source_port)) == NULL) {
-		jack_error ("unknown source port in attempted connection [%s]",
-			    source_port);
-		return -1;
-	}
-
-	if ((dstport = jack_get_port_by_name (engine, destination_port))
-	    == NULL) {
-		jack_error ("unknown destination port in attempted connection"
-			    " [%s]", destination_port);
-		return -1;
-	}
-
-	if ((dstport->shared->flags & JackPortIsInput) == 0) {
-		jack_error ("destination port in attempted connection of"
-			    " %s and %s is not an input port", 
-			    source_port, destination_port);
-		return -1;
-	}
-
-	if ((srcport->shared->flags & JackPortIsOutput) == 0) {
-		jack_error ("source port in attempted connection of %s and"
-			    " %s is not an output port",
-			    source_port, destination_port);
-		return -1;
-	}
-
-	if (srcport->shared->ptype_id != dstport->shared->ptype_id) {
-		jack_error ("ports used in attemped connection are not of "
-			    "the same data type");
-		return -1;
-	}
-
-	if ((srcclient = jack_client_internal_by_id (engine,
-						  srcport->shared->client_id))
-	    == 0) {
-		jack_error ("unknown client set as owner of port - "
-			    "cannot connect");
-		return -1;
-	}
-	
-	if (!srcclient->control->active) {
-		jack_error ("cannot connect ports owned by inactive clients;"
-			    " \"%s\" is not active", srcclient->control->name);
-		return -1;
-	}
-
-	if ((dstclient = jack_client_internal_by_id (engine,
-						  dstport->shared->client_id))
-	    == 0) {
-		jack_error ("unknown client set as owner of port - cannot "
-			    "connect");
-		return -1;
-	}
-	
-	if (!dstclient->control->active) {
-		jack_error ("cannot connect ports owned by inactive clients;"
-			    " \"%s\" is not active", dstclient->control->name);
-		return -1;
-	}
-
-	for (it = srcport->connections; it; it = it->next) {
-		if (((jack_connection_internal_t *)it->data)->destination
-		    == dstport) {
-			return EEXIST;
-		}
-	}
-
-	connection = (jack_connection_internal_t *)
-		malloc (sizeof (jack_connection_internal_t));
-
-	connection->source = srcport;
-	connection->destination = dstport;
-	connection->srcclient = srcclient;
-	connection->dstclient = dstclient;
-
-	src_id = srcport->shared->id;
-	dst_id = dstport->shared->id;
-
-	jack_lock_graph (engine);
-
-	if (dstport->connections && !dstport->shared->has_mixdown) {
-		jack_port_type_info_t *port_type =
-			jack_port_type_info (engine, dstport);
-		jack_error ("cannot make multiple connections to a port of"
-			    " type [%s]", port_type->type_name);
-		free (connection);
-		jack_unlock_graph (engine);
-		return -1;
-	} else {
-
-		if (dstclient->control->type == ClientDriver)
-		{
-			/* Ignore output connections to drivers for purposes
-			   of sorting. Drivers are executed first in the sort
-			   order anyway, and we don't want to treat graphs
-			   such as driver -> client -> driver as containing
-			   feedback */
-			
-			VERBOSE (engine,
-				 "connect %s and %s (output)",
-				 srcport->shared->name,
-				 dstport->shared->name);
-
-			connection->dir = 1;
-
-		}
-		else if (srcclient != dstclient) {
-		
-			srcclient->truefeeds = jack_slist_prepend
-				(srcclient->truefeeds, dstclient);
-
-			dstclient->fedcount++;				
-
-			if (jack_client_feeds_transitive (dstclient,
-							  srcclient ) ||
-			    (dstclient->control->type == ClientDriver &&
-			     srcclient->control->type != ClientDriver)) {
-		    
-				/* dest is running before source so
-				   this is a feedback connection */
-				
-				VERBOSE (engine,
-					 "connect %s and %s (feedback)",
-					 srcport->shared->name,
-					 dstport->shared->name);
-				 
-				dstclient->sortfeeds = jack_slist_prepend
-					(dstclient->sortfeeds, srcclient);
-
-				connection->dir = -1;
-				engine->feedbackcount++;
-				VERBOSE (engine,
-					 "feedback count up to %d",
-					 engine->feedbackcount);
-
-			} else {
-		
-				/* this is not a feedback connection */
-
-				VERBOSE (engine,
-					 "connect %s and %s (forward)",
-					 srcport->shared->name,
-					 dstport->shared->name);
-
-				srcclient->sortfeeds = jack_slist_prepend
-					(srcclient->sortfeeds, dstclient);
-
-				connection->dir = 1;
-			}
-		}
-		else
-		{
-			/* this is a connection to self */
-
-			VERBOSE (engine,
-				 "connect %s and %s (self)",
-				 srcport->shared->name,
-				 dstport->shared->name);
-			
-			connection->dir = 0;
-		}
-
-		dstport->connections =
-			jack_slist_prepend (dstport->connections, connection);
-		srcport->connections =
-			jack_slist_prepend (srcport->connections, connection);
-		
-		DEBUG ("actually sorted the graph...");
-
-		jack_send_connection_notification (engine,
-						   srcport->shared->client_id,
-						   src_id, dst_id, TRUE);
-		
-
-		jack_send_connection_notification (engine,
-						   dstport->shared->client_id,
-						   dst_id, src_id, TRUE);
-						   
-		/* send a port connection notification just once to everyone who cares excluding clients involved in the connection */
-
-		jack_notify_all_port_interested_clients (engine, srcport->shared->client_id, dstport->shared->client_id, src_id, dst_id, 1);
-
-		jack_sort_graph (engine);
-	}
-
-	jack_unlock_graph (engine);
-
-	return 0;
-}
-
-int
-jack_port_disconnect_internal (jack_engine_t *engine, 
-			       jack_port_internal_t *srcport, 
-			       jack_port_internal_t *dstport )
-
-{
-	JSList *node;
-	jack_connection_internal_t *connect;
-	int ret = -1;
-	jack_port_id_t src_id, dst_id;
-	int check_acyclic = engine->feedbackcount;
-
-	/* call tree **** MUST HOLD **** engine->client_lock. */
-	for (node = srcport->connections; node;
-	     node = jack_slist_next (node)) {
-
-		connect = (jack_connection_internal_t *) node->data;
-
-		if (connect->source == srcport &&
-		    connect->destination == dstport) {
-
-			VERBOSE (engine, "DIS-connect %s and %s",
-				 srcport->shared->name,
-				 dstport->shared->name);
-			
-			srcport->connections =
-				jack_slist_remove (srcport->connections,
-						   connect);
-			dstport->connections =
-				jack_slist_remove (dstport->connections,
-						   connect);
-
-			src_id = srcport->shared->id;
-			dst_id = dstport->shared->id;
-
-			/* this is a bit harsh, but it basically says
-			   that if we actually do a disconnect, and
-			   its the last one, then make sure that any
-			   input monitoring is turned off on the
-			   srcport. this isn't ideal for all
-			   situations, but it works better for most of
-			   them.
-			*/
-			if (srcport->connections == NULL) {
-				srcport->shared->monitor_requests = 0;
-			}
-
-			jack_send_connection_notification (
-				engine, srcport->shared->client_id, src_id,
-				dst_id, FALSE);
-			jack_send_connection_notification (
-				engine, dstport->shared->client_id, dst_id,
-				src_id, FALSE);
-
-			/* send a port connection notification just once to everyone who cares excluding clients involved in the connection */
-			
-			jack_notify_all_port_interested_clients (engine, srcport->shared->client_id, dstport->shared->client_id, src_id, dst_id, 0);
-
-			if (connect->dir) {
-			
-				jack_client_internal_t *src;
-				jack_client_internal_t *dst;
-			
-				src = jack_client_internal_by_id 
-					(engine, srcport->shared->client_id);
-
-				dst =  jack_client_internal_by_id
-					(engine, dstport->shared->client_id);
-								    
-				src->truefeeds = jack_slist_remove
-					(src->truefeeds, dst);
-
-				dst->fedcount--;					
-				
-				if (connect->dir == 1) {
-					/* normal connection: remove dest from
-					   source's sortfeeds list */ 
-					src->sortfeeds = jack_slist_remove
-						(src->sortfeeds, dst);
-				} else {
-					/* feedback connection: remove source
-					   from dest's sortfeeds list */
-					dst->sortfeeds = jack_slist_remove
-						(dst->sortfeeds, src);
-					engine->feedbackcount--;
-					VERBOSE (engine,
-						 "feedback count down to %d",
-						 engine->feedbackcount);
-					
-				}
-			} /* else self-connection: do nothing */
-
-			free (connect);
-			ret = 0;
-			break;
-		}
-	}
-
-	if (check_acyclic) {
-		jack_check_acyclic (engine);
-	}
-	
-	jack_sort_graph (engine);
-
-	return ret;
-}
-
-static int
-jack_port_do_disconnect_all (jack_engine_t *engine,
-			     jack_port_id_t port_id)
-{
-	if (port_id >= engine->control->port_max) {
-		jack_error ("illegal port ID in attempted disconnection [%"
-			    PRIu32 "]", port_id);
-		return -1;
-	}
-
-	VERBOSE (engine, "clear connections for %s",
-		 engine->internal_ports[port_id].shared->name);
-
-	jack_lock_graph (engine);
-	jack_port_clear_connections (engine, &engine->internal_ports[port_id]);
-	jack_sort_graph (engine);
-	jack_unlock_graph (engine);
-
-	return 0;
-}
-
-static int 
-jack_port_do_disconnect (jack_engine_t *engine,
-			 const char *source_port,
-			 const char *destination_port)
-{
-	jack_port_internal_t *srcport, *dstport;
-	int ret = -1;
-
-	if ((srcport = jack_get_port_by_name (engine, source_port)) == NULL) {
-		jack_error ("unknown source port in attempted disconnection"
-			    " [%s]", source_port);
-		return -1;
-	}
-
-	if ((dstport = jack_get_port_by_name (engine, destination_port))
-	    == NULL) {
-		jack_error ("unknown destination port in attempted"
-			    " disconnection [%s]", destination_port);
-		return -1;
-	}
-
-	jack_lock_graph (engine);
-
-	ret = jack_port_disconnect_internal (engine, srcport, dstport);
-
-	jack_unlock_graph (engine);
-
-	return ret;
-}
-
-int 
-jack_get_fifo_fd (jack_engine_t *engine, unsigned int which_fifo)
-{
-	/* caller must hold client_lock */
-	char path[PATH_MAX+1];
-	struct stat statbuf;
-
-	snprintf (path, sizeof (path), "%s-%d", engine->fifo_prefix,
-		  which_fifo);
-
-	DEBUG ("%s", path);
-
-	if (stat (path, &statbuf)) {
-		if (errno == ENOENT) {
-
-			if (mkfifo(path, 0666) < 0){
-				jack_error ("cannot create inter-client FIFO"
-					    " [%s] (%s)\n", path,
-					    strerror (errno));
-				return -1;
-			}
-
-		} else {
-			jack_error ("cannot check on FIFO %d\n", which_fifo);
-			return -1;
-		}
-	} else {
-		if (!S_ISFIFO(statbuf.st_mode)) {
-			jack_error ("FIFO %d (%s) already exists, but is not"
-				    " a FIFO!\n", which_fifo, path);
-			return -1;
-		}
-	}
-
-	if (which_fifo >= engine->fifo_size) {
-		unsigned int i;
-
-		engine->fifo = (int *)
-			realloc (engine->fifo,
-				 sizeof (int) * (engine->fifo_size + 16));
-		for (i = engine->fifo_size; i < engine->fifo_size + 16; i++) {
-			engine->fifo[i] = -1;
-		}
-		engine->fifo_size += 16;
-	}
-
-	if (engine->fifo[which_fifo] < 0) {
-		if ((engine->fifo[which_fifo] =
-		     open (path, O_RDWR|O_CREAT|O_NONBLOCK, 0666)) < 0) {
-			jack_error ("cannot open fifo [%s] (%s)", path,
-				    strerror (errno));
-			return -1;
-		}
-		DEBUG ("opened engine->fifo[%d] == %d (%s)",
-		       which_fifo, engine->fifo[which_fifo], path);
-	}
-
-	return engine->fifo[which_fifo];
-}
-
-static void
-jack_clear_fifos (jack_engine_t *engine)
-{
-	/* caller must hold client_lock */
-
-	unsigned int i;
-	char buf[16];
-
-	/* this just drains the existing FIFO's of any data left in
-	   them by aborted clients, etc. there is only ever going to
-	   be 0, 1 or 2 bytes in them, but we'll allow for up to 16.
-	*/
-	for (i = 0; i < engine->fifo_size; i++) {
-		if (engine->fifo[i] >= 0) {
-			int nread = read (engine->fifo[i], buf, sizeof (buf));
-
-			if (nread < 0 && errno != EAGAIN) {
-				jack_error ("clear fifo[%d] error: %s",
-					    i, strerror (errno));
-			} 
-		}
-	}
-}
-
-static int
-jack_use_driver (jack_engine_t *engine, jack_driver_t *driver)
-{
-	if (engine->driver) {
-		engine->driver->detach (engine->driver, engine);
-		engine->driver = 0;
-	}
-
-	if (driver) {
-		engine->driver = driver;
-
-		if (driver->attach (driver, engine)) {
-			engine->driver = 0;
-			return -1;
-		}
-
-		engine->rolling_interval =
-			jack_rolling_interval (driver->period_usecs);
-	}
-
-	return 0;
-}
-
-
-/* PORT RELATED FUNCTIONS */
-
-
-static jack_port_id_t
-jack_get_free_port (jack_engine_t *engine)
-
-{
-	jack_port_id_t i;
-
-	pthread_mutex_lock (&engine->port_lock);
-
-	for (i = 0; i < engine->port_max; i++) {
-		if (engine->control->ports[i].in_use == 0) {
-			engine->control->ports[i].in_use = 1;
-			break;
-		}
-	}
-	
-	pthread_mutex_unlock (&engine->port_lock);
-	
-	if (i == engine->port_max) {
-		return (jack_port_id_t) -1;
-	}
-
-	return i;
-}
-
-void
-jack_port_release (jack_engine_t *engine, jack_port_internal_t *port)
-{
-	pthread_mutex_lock (&engine->port_lock);
-	port->shared->in_use = 0;
-	port->shared->alias1[0] = '\0';
-	port->shared->alias2[0] = '\0';
-
-	if (port->buffer_info) {
-		jack_port_buffer_list_t *blist =
-			jack_port_buffer_list (engine, port);
-		pthread_mutex_lock (&blist->lock);
-		blist->freelist =
-			jack_slist_prepend (blist->freelist,
-					    port->buffer_info);
-		port->buffer_info = NULL;
-		pthread_mutex_unlock (&blist->lock);
-	}
-	pthread_mutex_unlock (&engine->port_lock);
-}
-
-jack_port_internal_t *
-jack_get_port_internal_by_name (jack_engine_t *engine, const char *name)
-{
-	jack_port_id_t id;
-
-	pthread_mutex_lock (&engine->port_lock);
-
-	for (id = 0; id < engine->port_max; id++) {
-		if (jack_port_name_equals (&engine->control->ports[id], name)) {
-			break;
-		}
-	}
-
-	pthread_mutex_unlock (&engine->port_lock);
-	
-	if (id != engine->port_max) {
-		return &engine->internal_ports[id];
-	} else {
-		return NULL;
-	}
-}
-
-int
-jack_port_do_register (jack_engine_t *engine, jack_request_t *req, int internal)
-{
-	jack_port_id_t port_id;
-	jack_port_shared_t *shared;
-	jack_port_internal_t *port;
-	jack_client_internal_t *client;
-	unsigned long i;
-	char *backend_client_name;
-	size_t len;
-
-	for (i = 0; i < engine->control->n_port_types; ++i) {
-		if (strcmp (req->x.port_info.type,
-			    engine->control->port_types[i].type_name) == 0) {
-			break;
-		}
-	}
-
-	if (i == engine->control->n_port_types) {
-		jack_error ("cannot register a port of type \"%s\"",
-			    req->x.port_info.type);
-		return -1;
-	}
-
-	jack_lock_graph (engine);
-	if ((client = jack_client_internal_by_id (engine,
-						  req->x.port_info.client_id))
-	    == NULL) {
-		jack_error ("unknown client id in port registration request");
-		jack_unlock_graph (engine);
-		return -1;
-	}
-
-	if ((port = jack_get_port_by_name(engine, req->x.port_info.name)) != NULL) {
-		jack_error ("duplicate port name in port registration request");
-		jack_unlock_graph (engine);
-		return -1;
-	}
-
-	if ((port_id = jack_get_free_port (engine)) == (jack_port_id_t) -1) {
-		jack_error ("no ports available!");
-		jack_unlock_graph (engine);
-		return -1;
-	}
-
-	shared = &engine->control->ports[port_id];
-
-	if (!internal || !engine->driver)
-		goto fallback;
-
-	backend_client_name = (char *) engine->driver->internal_client->control->name;
-	len = strlen (backend_client_name);
-
-	if (strncmp (req->x.port_info.name, backend_client_name, len) != 0)
-		goto fallback;
-
-	/* use backend's original as an alias, use predefined names */
-
-	if (strcmp(req->x.port_info.type, JACK_DEFAULT_AUDIO_TYPE) == 0) {
-		if ((req->x.port_info.flags & (JackPortIsPhysical|JackPortIsInput)) == (JackPortIsPhysical|JackPortIsInput)) {
-			snprintf (shared->name, sizeof (shared->name), JACK_BACKEND_ALIAS ":playback_%d", ++engine->audio_out_cnt);
-			strcpy (shared->alias1, req->x.port_info.name);
-			goto next;
-		} 
-		else if ((req->x.port_info.flags & (JackPortIsPhysical|JackPortIsOutput)) == (JackPortIsPhysical|JackPortIsOutput)) {
-			snprintf (shared->name, sizeof (shared->name), JACK_BACKEND_ALIAS ":capture_%d", ++engine->audio_in_cnt);
-			strcpy (shared->alias1, req->x.port_info.name);
-			goto next;
-		}
-	}
-
-#if 0 // do not do this for MIDI
-
-	else if (strcmp(req->x.port_info.type, JACK_DEFAULT_MIDI_TYPE) == 0) {
-		if ((req->x.port_info.flags & (JackPortIsPhysical|JackPortIsInput)) == (JackPortIsPhysical|JackPortIsInput)) {
-			snprintf (shared->name, sizeof (shared->name), JACK_BACKEND_ALIAS ":midi_playback_%d", ++engine->midi_out_cnt);
-			strcpy (shared->alias1, req->x.port_info.name);
-			goto next;
-		} 
-		else if ((req->x.port_info.flags & (JackPortIsPhysical|JackPortIsOutput)) == (JackPortIsPhysical|JackPortIsOutput)) {
-			snprintf (shared->name, sizeof (shared->name), JACK_BACKEND_ALIAS ":midi_capture_%d", ++engine->midi_in_cnt);
-			strcpy (shared->alias1, req->x.port_info.name);
-			goto next;
-		}
-	}
-#endif
-
-fallback:
-	strcpy (shared->name, req->x.port_info.name);
-
-next:
-	shared->ptype_id = engine->control->port_types[i].ptype_id;
-	shared->client_id = req->x.port_info.client_id;
-	shared->flags = req->x.port_info.flags;
-	shared->latency = 0;
-	shared->monitor_requests = 0;
-
-	port = &engine->internal_ports[port_id];
-
-	port->shared = shared;
-	port->connections = 0;
-	port->buffer_info = NULL;
-	
-	if (jack_port_assign_buffer (engine, port)) {
-		jack_error ("cannot assign buffer for port");
-		jack_port_release (engine, &engine->internal_ports[port_id]);
-		jack_unlock_graph (engine);
-		return -1;
-	}
-
-	client->ports = jack_slist_prepend (client->ports, port);
-	jack_port_registration_notify (engine, port_id, TRUE);
-	jack_unlock_graph (engine);
-
-	VERBOSE (engine, "registered port %s, offset = %u",
-		 shared->name, (unsigned int)shared->offset);
-
-	req->x.port_info.port_id = port_id;
-
-	return 0;
-}
-
-int
-jack_port_do_unregister (jack_engine_t *engine, jack_request_t *req)
-{
-	jack_client_internal_t *client;
-	jack_port_shared_t *shared;
-	jack_port_internal_t *port;
-
-	if (req->x.port_info.port_id < 0 ||
-	    req->x.port_info.port_id > engine->port_max) {
-		jack_error ("invalid port ID %" PRIu32
-			    " in unregister request",
-			    req->x.port_info.port_id);
-		return -1;
-	}
-
-	shared = &engine->control->ports[req->x.port_info.port_id];
-
-	if (shared->client_id != req->x.port_info.client_id) {
-		jack_error ("Client %" PRIu32
-			    " is not allowed to remove port %s",
-			    req->x.port_info.client_id, shared->name);
-		return -1;
-	}
-
-	jack_lock_graph (engine);
-	if ((client = jack_client_internal_by_id (engine, shared->client_id))
-	    == NULL) {
-		jack_error ("unknown client id in port registration request");
-		jack_unlock_graph (engine);
-		return -1;
-	}
-
-	port = &engine->internal_ports[req->x.port_info.port_id];
-
-	jack_port_clear_connections (engine, port);
-	jack_port_release (engine,
-			   &engine->internal_ports[req->x.port_info.port_id]);
-	
-	client->ports = jack_slist_remove (client->ports, port);
-	jack_port_registration_notify (engine, req->x.port_info.port_id,
-				       FALSE);
-	jack_unlock_graph (engine);
-
-	return 0;
-}
-
-int
-jack_do_get_port_connections (jack_engine_t *engine, jack_request_t *req,
-			      int reply_fd)
-{
-	jack_port_internal_t *port;
-	JSList *node;
-	unsigned int i;
-	int ret = -1;
-	int internal = FALSE;
-
-	jack_rdlock_graph (engine);
-
-	port = &engine->internal_ports[req->x.port_info.port_id];
-
-	DEBUG ("Getting connections for port '%s'.", port->shared->name);
-
-	req->x.port_connections.nports = jack_slist_length (port->connections);
-	req->status = 0;
-
-	/* figure out if this is an internal or external client */
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		
-		if (((jack_client_internal_t *) node->data)->request_fd
-		    == reply_fd) {
-			internal = jack_client_is_internal(
-				(jack_client_internal_t *) node->data);
-			break;
-		}
-	}
-
-	if (!internal) {
-		if (write (reply_fd, req, sizeof (*req))
-		    < (ssize_t) sizeof (req)) {
-			jack_error ("cannot write GetPortConnections result "
-				    "to client via fd = %d (%s)", 
-				    reply_fd, strerror (errno));
-			goto out;
-		}
-	} else {
-		req->x.port_connections.ports = (const char**)
-			malloc (sizeof (char *)
-				* req->x.port_connections.nports);
-	}
-
-	if (req->type == GetPortConnections) {
-		
-		for (i = 0, node = port->connections; node;
-		     node = jack_slist_next (node), ++i) {
-
-			jack_port_id_t port_id;
-			
-			if (((jack_connection_internal_t *) node->data)->source
-			    == port) {
-				port_id = ((jack_connection_internal_t *)
-					   node->data)->destination->shared->id;
-			} else {
-				port_id = ((jack_connection_internal_t *)
-					   node->data)->source->shared->id;
-			}
-			
-			if (internal) {
-
-				/* internal client asking for
-				 * names. store in malloc'ed space,
-				 * client frees
-				 */
-			        char **ports = (char **) req->x.port_connections.ports;
-
-				ports[i] =
-					engine->control->ports[port_id].name;
-
-			} else {
-
-				/* external client asking for
-				 * names. we write the port id's to
-				 * the reply fd.
-				 */
-				if (write (reply_fd, &port_id,
-					   sizeof (port_id))
-				    < (ssize_t) sizeof (port_id)) {
-					jack_error ("cannot write port id "
-						    "to client");
-					goto out;
-				}
-			}
-		}
-	}
-
-	ret = 0;
-
-  out:
-	req->status = ret;
-	jack_unlock_graph (engine);
-	return ret;
-}
-
-void
-jack_port_registration_notify (jack_engine_t *engine,
-			       jack_port_id_t port_id, int yn)
-{
-	jack_event_t event;
-	jack_client_internal_t *client;
-	JSList *node;
-
-	event.type = (yn ? PortRegistered : PortUnregistered);
-	event.x.port_id = port_id;
-	
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		
-		client = (jack_client_internal_t *) node->data;
-
-		if (!client->control->active) {
-			continue;
-		}
-
-		if (client->control->port_register_cbset) {
-			if (jack_deliver_event (engine, client, &event)) {
-				jack_error ("cannot send port registration"
-					    " notification to %s (%s)",
-					     client->control->name,
-					    strerror (errno));
-			}
-		}
-	}
-}
-
-void
-jack_client_registration_notify (jack_engine_t *engine,
-				 const char* name, int yn)
-{
-	jack_event_t event;
-	jack_client_internal_t *client;
-	JSList *node;
-
-	event.type = (yn ? ClientRegistered : ClientUnregistered);
-	snprintf (event.x.name, sizeof (event.x.name), "%s", name);
-	
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		
-		client = (jack_client_internal_t *) node->data;
-
-		if (!client->control->active) {
-			continue;
-		}
-
-		if (strcmp ((char*) client->control->name, (char*) name) == 0) {
-			/* do not notify client of its own registration */
-			continue;
-		}
-
-		if (client->control->client_register_cbset) {
-			if (jack_deliver_event (engine, client, &event)) {
-				jack_error ("cannot send client registration"
-					    " notification to %s (%s)",
-					     client->control->name,
-					    strerror (errno));
-			}
-		}
-	}
-}
-
-int
-jack_port_assign_buffer (jack_engine_t *engine, jack_port_internal_t *port)
-{
-	jack_port_buffer_list_t *blist =
-		jack_port_buffer_list (engine, port);
-	jack_port_buffer_info_t *bi;
-
-	if (port->shared->flags & JackPortIsInput) {
-		port->shared->offset = 0;
-		return 0;
-	}
-	
-	pthread_mutex_lock (&blist->lock);
-
-	if (blist->freelist == NULL) {
-		jack_port_type_info_t *port_type =
-			jack_port_type_info (engine, port);
-		jack_error ("all %s port buffers in use!",
-			    port_type->type_name);
-		pthread_mutex_unlock (&blist->lock);
-		return -1;
-	}
-
-	bi = (jack_port_buffer_info_t *) blist->freelist->data;
-	blist->freelist = jack_slist_remove (blist->freelist, bi);
-
-	port->shared->offset = bi->offset;
-	port->buffer_info = bi;
-
-	pthread_mutex_unlock (&blist->lock);
-	return 0;
-}
-
-static jack_port_internal_t *
-jack_get_port_by_name (jack_engine_t *engine, const char *name)
-{
-	jack_port_id_t id;
-
-	/* Note the potential race on "in_use". Other design
-	   elements prevent this from being a problem.
-	*/
-
-	for (id = 0; id < engine->port_max; id++) {
-		if (engine->control->ports[id].in_use &&
-		    jack_port_name_equals (&engine->control->ports[id], name)) {
-			return &engine->internal_ports[id];
-		}
-	}
-
-	return NULL;
-}
-
-static int
-jack_send_connection_notification (jack_engine_t *engine,
-				   jack_client_id_t client_id, 
-				   jack_port_id_t self_id,
-				   jack_port_id_t other_id, int connected)
-
-{
-	jack_client_internal_t *client;
- 	jack_event_t event;
- 
-	if ((client = jack_client_internal_by_id (engine, client_id)) == NULL) {
-		jack_error ("no such client %" PRIu32
-			    " during connection notification", client_id);
-		return -1;
-	}
-
-	if (client->control->active) {
-		event.type = (connected ? PortConnected : PortDisconnected);
-		event.x.self_id = self_id;
-		event.y.other_id = other_id;
-		
-		if (jack_deliver_event (engine, client, &event)) {
-			jack_error ("cannot send port connection notification"
-				    " to client %s (%s)", 
-				    client->control->name, strerror (errno));
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-void
-jack_engine_signal_problems (jack_engine_t* engine)
-{
-	jack_lock_problems (engine);
-	engine->problems++;
-	jack_unlock_problems (engine);
-}
diff --git a/jackd/jackd.1.in b/jackd/jackd.1.in
deleted file mode 100644
index 718f21d..0000000
--- a/jackd/jackd.1.in
+++ /dev/null
@@ -1,547 +0,0 @@
-.TH "JACKD" "1" "@VERSION@" "April 2006" ""
-.SH "NAME"
-jackd \- JACK Audio Connection Kit sound server
-.SH "SYNOPSIS"
-\fBjackd\fR [\fIoptions\fR] \fB\-d\fI backend \fR 
-[\fIbackend\-parameters\fR]
-.br
-\fBjackd \-\-help\fR
-.SH "DESCRIPTION"
-\fBjackd\fR is the JACK audio server daemon, a low\-latency audio
-server.  Originally written for the
-GNU/Linux operating system, it also supports Mac OS X and various Unix
-platforms.  JACK can connect a number of different client applications
-to an audio device and also to each other.  Most clients are external,
-running in their own processes as normal applications.  JACK also
-supports internal clients, which run within the \fBjackd\fR process
-using a loadable "plugin" interface.
-
-JACK differs from other audio servers in being designed from the
-ground up for professional audio work.  It focuses on two key areas:
-synchronous execution of all clients, and low latency operation.
-
-For the latest JACK information, please consult the web site,
-<\fBhttp://www.jackaudio.org\fR>.
-.SH "OPTIONS"
-.TP
-\fB\-d, \-\-driver \fIbackend\fR [\fIbackend\-parameters\fR ]
-.br
-Select the audio interface backend.  The current list of supported
-backends is: \fBalsa\fR, \fBcoreaudio\fR, \fBdummy\fR, \fBfreebob\fR,
-\fBoss\fR \fBsun\fR and \fBportaudio\fR.  They are not all available
-on all platforms.  All \fIbackend\-parameters\fR are optional.
-
-.TP
-\fB\-h, \-\-help\fR
-.br
-Print a brief usage message describing the main \fBjackd\fR options.
-These do not include \fIbackend\-parameters\fR, which are listed using
-the \fB\-\-help\fR option for each specific backend.  Examples below
-show how to list them.
-.TP
-\fB\-m, \-\-no\-mlock\fR
-Do not attempt to lock memory, even if \fB\-\-realtime\fR.
-.TP
-\fB\-n, \-\-name\fR \fIserver\-name\fR
-Name this \fBjackd\fR instance \fIserver\-name\fR.  If unspecified,
-this name comes from the \fB$JACK_DEFAULT_SERVER\fR environment
-variable.  It will be "default" if that is not defined.
-.TP
-\fB\-p, \-\-port\-max \fI n\fR
-Set the maximum number of ports the JACK server can manage.  
-The default value is 256.
-.TP
-\fB\-\-replace-registry\fR 
-.br
-Remove the shared memory registry used by all JACK server instances
-before startup. This should rarely be used, and is intended only
-for occasions when the structure of this registry changes in ways
-that are incompatible across JACK versions (which is rare).
-.TP
-\fB\-R, \-\-realtime\fR 
-.br
-Use realtime scheduling (default = true). This is needed for reliable low\-latency
-performance.  On many systems, it requires \fBjackd\fR to run with
-special scheduler and memory allocation privileges, which may be
-obtained in several ways. 
-.TP
-\fB\-r, \-\-no-realtime\fR
-.br
-Do not use realtime scheduling. 
-.TP
-\fB\-P, \-\-realtime\-priority \fIint\fR
-When running \fB\-\-realtime\fR, set the scheduler priority to
-\fIint\fR.
-.TP
-\fB\-\-silent\fR
-Silence any output during operation.
-.TP
-\fB\-T, \-\-temporary\fR
-Exit once all clients have closed their connections.
-.TP
-\fB\-t, \-\-timeout \fIint\fR
-.br
-Set client timeout limit in milliseconds.  The default is 500 msec.
-In realtime mode the client timeout must be smaller than the watchdog timeout (5000 msec).
-.TP
-\fB\-Z, \-\-nozombies\fR
-.br
-Prevent JACK from ever kicking out clients because they were too slow.
-This cancels the effect any specified timeout value, but JACK and its clients are
-still subject to the supervision of the watchdog thread or its equivalent.
-.TP
-\fB\-u, \-\-unlock\fR
-.br
-Unlock libraries GTK+, QT, FLTK, Wine.
-.TP
-\fB\-v, \-\-verbose\fR
-Give verbose output.
-.TP
-\fB\-c, \-\-clocksource\fR (\fI c(ycle)\fR | \fI h(pet) \fR | \fI s(ystem) \fR)
-Select a specific wall clock (Cycle Counter, HPET timer, System timer).
-.TP
-\fB\-V, \-\-version\fR
-Print the current JACK version number and exit.
-.SS ALSA BACKEND OPTIONS
-.TP
-\fB\-C, \-\-capture\fR [ \fIname\fR ]
-Provide only capture ports, unless combined with \-D or \-P.  Parameterally set 
-capture device name.
-.TP
-\fB\-d, \-\-device \fIname\fR
-.br
-The ALSA pcm device \fIname\fR to use.  If none is specified, JACK will
-use "hw:0", the first hardware card defined in \fB/etc/modules.conf\fR.
-.TP
-\fB\-z, \-\-dither [rectangular,triangular,shaped,none]
-Set dithering mode.  If \fBnone\fR or unspecified, dithering is off.
-Only the first letter of the mode name is required.
-.TP
-\fB\-D, \-\-duplex\fR
-Provide both capture and playback ports.  Defaults to on unless only one 
-of \-P or \-C is specified.
-.TP
-\fB\-h, \-\-help\fR Print a brief usage message describing only the
-\fBalsa\fR backend parameters.
-.TP
-\fB\-M, \-\-hwmeter\fR
-.br
-Enable hardware metering for devices that support it.  Otherwise, use
-software metering.
-.TP
-\fB\-H, \-\-hwmon\fR
-.br
-Enable hardware monitoring of capture ports.  This is a method for
-obtaining "zero latency" monitoring of audio input.  It requires
-support in hardware and from the underlying ALSA device driver.
-
-When enabled, requests to monitor capture ports will be satisfied by
-creating a direct signal path between audio interface input and output
-connectors, with no processing by the host computer at all.  This
-offers the lowest possible latency for the monitored signal.
-
-Presently (March 2003), only the RME Hammerfall series and cards based
-on the ICE1712 chipset (M\-Audio Delta series, Terratec, and others)
-support \fB\-\-hwmon\fR.  In the future, some consumer cards may also
-be supported by modifying their mixer settings.
-
-Without \fB\-\-hwmon\fR, port monitoring requires JACK to read audio
-into system memory, then copy it back out to the hardware again,
-imposing the basic JACK system latency determined by the
-\fB\-\-period\fR and \fB\-\-nperiods\fR parameters.
-.TP
-\fB\-i, \-\-inchannels \fIint\fR
-.br
-Number of capture channels.  Default is maximum supported by hardware.
-.TP
-\fB\-n, \-\-nperiods \fIint\fR
-.br
-Specify the number of periods of playback latency.  In seconds, this
-corresponds to \fB\-\-nperiods\fR times \fB\-\-period\fR divided by
-\fB\-\-rate\fR.  The default is 2, the minimum allowable.  For most
-devices, there is no need for any other value with the
-\fB\-\-realtime\fR option.  Without realtime privileges or with boards
-providing unreliable interrupts (like ymfpci), a larger value may
-yield fewer xruns.  This can also help if the system is not tuned for
-reliable realtime scheduling.
-
-For most ALSA devices, the hardware buffer has exactly
-\fB\-\-period\fR times \fB\-\-nperiods\fR frames.  Some devices demand
-a larger buffer.  If so, JACK will use the smallest possible buffer
-containing at least \fB\-\-nperiods\fR, but the playback latency does
-not increase.
-
-For USB audio devices it is recommended to use \fB\-n 3\fR. Firewire
-devices supported by FFADO (formerly Freebob) are configured with
-\fB\-n 3\fR by default.
-.TP
-\fB\-o, \-\-outchannels \fIint\fR
-.br
-Number of playback channels.  Default is maximum supported by hardware.
-.TP
-\fB\-P, \-\-playback\fR [ \fIname\fR ]
-Provide only playback ports, unless combined with \-D or \-C.  Optionally set 
-playback device name.
-.TP
-\fB\-p, \-\-period \fIint\fR
-.br
-Specify the number of frames between JACK \fBprocess()\fR calls.  This
-value must be a power of 2, and the default is 1024.  If you need low 
-latency, set \fB\-p\fR as low as you can go without seeing xruns.  A larger 
-period size yields higher latency, but makes xruns less likely.  The JACK 
-capture latency in seconds is \fB\-\-period\fR divided by \fB\-\-rate\fR.
-.TP
-\fB\-r, \-\-rate \fIint\fR
-Specify the sample rate.  The default is 48000.
-.TP
-\fB\-S, \-\-shorts
-.br
-Try to configure card for 16\-bit samples first, only trying 32\-bits if
-unsuccessful.  Default is to prefer 32\-bit samples.
-.TP
-\fB\-s, \-\-softmode\fR 
-.br
-Ignore xruns reported by the ALSA driver.  This makes JACK less likely
-to disconnect unresponsive ports when running without \fB\-\-realtime\fR.
-.TP
-\fB\-X, \-\-midi \fR[\fIseq\fR|\fIraw\fR]
-.br
-Specify which ALSA MIDI system to provide access to. Using \fBraw\fR
-will provide a set of JACK MIDI ports that correspond to each raw ALSA
-device on the machine. Using \fBseq\fR will provide a set of JACK MIDI
-ports that correspond to each ALSA "sequencer" client (which includes
-each hardware MIDI port on the machine). \fBraw\fR provides slightly
-better performance but does not permit JACK MIDI communication with
-software written to use the ALSA "sequencer" API.
-.SS COREAUDIO BACKEND PARAMETERS
-.TP
-\fB\-c \-\-channel\fR
-Maximum number of channels (default: 2)
-.TP
-\fB\-i \-\-channelin\fR
-Maximum number of input channels (default: 2)
-.TP
-\fB\-o \-\-channelout\fR
-Maximum number of output channels (default: 2)
-.TP
-\fB\-C \-\-capture\fR
-Whether or not to capture (default: true)
-.TP
-\fB\-P \-\-playback\fR
-Whether or not to playback (default: true)
-.TP
-\fB\-D \-\-duplex\fR
-Capture and playback (default: true)
-.TP
-\fB\-r \-\-rate\fR
-Sample rate (default: 44100)
-.TP
-\fB\-p \-\-period\fR
-Frames per period (default: 128). Must be a power of 2.
-.TP
-\fB\-n \-\-name\fR
-Driver name (default: none)
-.TP
-\fB\-I \-\-id\fR
-Audio Device ID (default: 0)
-.SS DUMMY BACKEND PARAMETERS
-.TP
-\fB\-C, \-\-capture \fIint\fR
-Specify number of capture ports. The default value is 2.
-.TP
-\fB\-P, \-\-playback \fIint\fR
-Specify number of playback ports. The default value is 2.
-.TP
-\fB\-r, \-\-rate \fIint\fR
-Specify sample rate. The default value is 48000.
-.TP
-\fB\-p, \-\-period \fIint\fR
-Specify the number of frames between JACK \fBprocess()\fR calls.  This
-value must be a power of 2, and the default is 1024.  If you need low 
-latency, set \fB\-p\fR as low as you can go without seeing xruns.  A larger 
-period size yields higher latency, but makes xruns less likely.  The JACK 
-capture latency in seconds is \fB\-\-period\fR divided by \fB\-\-rate\fR.
-.TP
-\fB\-w, \-\-wait \fIint\fR 
-Specify number of usecs to wait between engine processes. 
-The default value is 21333.
-
-
-.SS NET BACKEND PARAMETERS
-
-.TP
- \fB\-i, \-\-audio\-ins \fIint\fR
-Number of capture channels (default: 2)
-.TP
- \fB\-o, \-\-audio\-outs \fIint\fR
-Number of playback channels (default: 2)
-.TP
- \fB\-I, \-\-midi\-ins \fIint\fR
-Number of midi capture channels (default: 1)
-.TP 
-\fB\-O, \-\-midi\-outs \fIint\fR
-Number of midi playback channels (default: 1)
-.TP
- \fB\-r, \-\-rate \fIint\fR
-Sample rate (default: 48000)
-.TP 
-\fB\-p, \-\-period \fIint\fR
-Frames per period (default: 1024)
-.TP 
-\fB\-n, \-\-num\-periods \fIint\fR
-Network latency setting in no. of periods (default: 5)
-.TP 
-\fB\-l, \-\-listen\-port \fIint\fR
-The socket port we are listening on for sync packets (default: 3000)
-.TP 
-\fB\-f, \-\-factor \fIint\fR
-Factor for sample rate reduction (default: 1)
-.TP 
-\fB\-u, \-\-upstream\-factor \fIint\fR
-Factor for sample rate reduction on the upstream (default: 0)
-.TP 
-\fB\-c, \-\-celt \fIint\fR
-sets celt encoding and number of kbits per channel (default: 0)
-.TP 
-\fB\-b, \-\-bit\-depth \fIint\fR
-Sample bit\-depth (0 for float, 8 for 8bit and 16 for 16bit) (default: 0)
-.TP 
-\fB\-t, \-\-transport\-sync \fIint\fR
-Whether to slave the transport to the master transport (default: true)
-.TP 
-\fB\-a, \-\-autoconf \fIint\fR
-Whether to use Autoconfig, or just start. (default: true)
-.TP 
-\fB\-R, \-\-redundancy \fIint\fR
-Send packets N times (default: 1)
-.TP 
-\fB\-e, \-\-native\-endian \fIint\fR
-Dont convert samples to network byte order. (default: false)
-.TP 
-\fB\-J, \-\-jitterval \fIint\fR
-attempted jitterbuffer microseconds on master (default: 0)
-.TP 
-\fB\-D, \-\-always\-deadline \fIint\fR
-always use deadline (default: false)
-
-
-.SS OSS BACKEND PARAMETERS
-.TP
-\fB\-r, \-\-rate \fIint\fR
-Specify the sample rate.  The default is 48000.
-.TP
-\fB\-p, \-\-period \fIint\fR
-Specify the number of frames between JACK \fBprocess()\fR calls.  This
-value must be a power of 2, and the default is 1024.  If you need low 
-latency, set \fB\-p\fR as low as you can go without seeing xruns.  A larger 
-period size yields higher latency, but makes xruns less likely.  The JACK 
-capture latency in seconds is \fB\-\-period\fR divided by \fB\-\-rate\fR.
-.TP
-\fB\-n, \-\-nperiods \fIint\fR
-Specify the number of periods in the hardware buffer.  The default is
-2.  The period size (\fB\-p\fR) times \fB\-\-nperiods\fR times four is
-the JACK buffer size in bytes.  The JACK output latency in seconds is
-\fB\-\-nperiods\fR times \fB\-\-period\fR divided by \fB\-\-rate\fR.
-.TP
-\fB\-w, \-\-wordlength \fIint\fR
-Specify the sample size in bits. The default is 16.
-.TP
-\fB\-i, \-\-inchannels \fIint\fR
-Specify how many channels to capture (default: 2)
-.TP
-\fB\-o, \-\-outchannels \fIint\fR
-Specify number of playback channels (default: 2)
-.TP
-\fB\-C, \-\-capture \fIdevice_file\fR
-Specify input device for capture (default: /dev/dsp)
-.TP
-\fB\-P, \-\-playback \fIdevice_file\fR
-Specify output device for playback (default: /dev/dsp)
-.TP
-\fB\-b, \-\-ignorehwbuf \fIboolean\fR
-Specify, whether to ignore hardware period size (default: false)
-.SS SUN BACKEND PARAMETERS
-.TP
-\fB\-r, \-\-rate \fIint\fR
-Specify the sample rate.  The default is 48000.
-.TP
-\fB\-p, \-\-period \fIint\fR
-Specify the number of frames between JACK \fBprocess()\fR calls.  This
-value must be a power of 2, and the default is 1024.  If you need low 
-latency, set \fB\-p\fR as low as you can go without seeing xruns.  A larger 
-period size yields higher latency, but makes xruns less likely.  The JACK 
-capture latency in seconds is \fB\-\-period\fR divided by \fB\-\-rate\fR.
-.TP
-\fB\-n, \-\-nperiods \fIint\fR
-Specify the number of periods in the hardware buffer.  The default is
-2.  The period size (\fB\-p\fR) times \fB\-\-nperiods\fR times four
-(assuming 2 channels 16-bit samples) is the JACK buffer size in bytes.
-The JACK output latency in seconds is \fB\-\-nperiods\fR times
-\fB\-\-period\fR divided by \fB\-\-rate\fR.
-.TP
-\fB\-w, \-\-wordlength \fIint\fR
-Specify the sample size in bits. The default is 16.
-.TP
-\fB\-i, \-\-inchannels \fIint\fR
-Specify how many channels to capture (default: 2)
-.TP
-\fB\-o, \-\-outchannels \fIint\fR
-Specify number of playback channels (default: 2)
-.TP
-\fB\-C, \-\-capture \fIdevice_file\fR
-Specify input device for capture (default: /dev/audio)
-.TP
-\fB\-P, \-\-playback \fIdevice_file\fR
-Specify output device for playback (default: /dev/audio)
-.TP
-\fB\-b, \-\-ignorehwbuf \fIboolean\fR
-Specify, whether to ignore hardware period size (default: false)
-.SS PORTAUDIO BACKEND PARAMETERS
-.TP
-\fB\-c \-\-channel\fR
-Maximum number of channels (default: all available hardware channels)
-.TP
-\fB\-i \-\-channelin\fR
-Maximum number of input channels (default: all available hardware channels)
-.TP
-\fB\-o \-\-channelout\fR
-Maximum number of output channels (default: all available hardware channels)
-.TP
-\fB\-C \-\-capture\fR
-Whether or not to capture (default: true)
-.TP
-\fB\-P \-\-playback\fR
-Whether or not to playback (default: true)
-.TP
-\fB\-D \-\-duplex\fR
-Capture and playback (default: true)
-.TP
-\fB\-r \-\-rate\fR
-Sample rate (default: 48000)
-.TP
-\fB\-p \-\-period\fR
-Frames per period (default: 1024). Must be a power of 2.
-.TP
-\fB\-n \-\-name\fR
-Driver name (default: none)
-.TP
-\fB\-z \-\-dither\fR
-Dithering mode (default: none)
-.SH "EXAMPLES"
-.PP
-Print usage message for the parameters specific to each backend.
-.IP
-\fBjackd \-d alsa \-\-help\fR
-.br
-\fBjackd \-d coreaudio \-\-help\fR
-.br
-\fBjackd \-d net \-\-help\fR
-.br
-\fBjackd \-d dummy \-\-help\fR
-.br
-\fBjackd \-d firewire \-\-help\fR
-.br
-\fBjackd \-d freebob \-\-help\fR
-.br
-\fBjackd \-d oss \-\-help\fR
-.br
-\fBjackd \-d sun \-\-help\fR
-.br
-\fBjackd \-d portaudio \-\-help\fR
-.PP
-Run the JACK daemon with realtime priority using the first ALSA
-hardware card defined in \fB/etc/modules.conf\fR.
-.IP
-\fBjackstart \-\-realtime \-\-driver=alsa\fR
-.PP
-Run the JACK daemon with low latency giving verbose output, which can
-be helpful for trouble\-shooting system latency problems.  A
-reasonably well\-tuned system with a good sound card and a
-low\-latency kernel can handle these values reliably.  Some can do
-better.  If you get xrun messages, try a larger buffer.  Tuning a
-system for low latency can be challenging.  The JACK FAQ,
-.I http://jackit.sourceforge.net/docs/faq.php\fR
-has some useful suggestions.
-.IP
-\fBjackstart \-Rv \-d alsa \-p 128 \-n 2 \-r 44100\fR
-.PP
-Run \fBjackd\fR with realtime priority using the "sblive" ALSA device
-defined in ~/.asoundrc.  Apply shaped dithering to playback audio.
-.IP
-\fBjackd \-R \-d alsa \-d sblive \-\-dither=shaped\fR
-.PP
-Run \fBjackd\fR with no special privileges using the second ALSA
-hardware card defined in \fB/etc/modules.conf\fR.  Any xruns reported
-by the ALSA backend will be ignored.  The larger buffer helps reduce
-data loss.  Rectangular dithering will be used for playback.
-.IP
-\fBjackd \-d alsa \-d hw:1 \-p2048 \-n3 \-\-softmode \-zr\fR
-.PP
-Run \fBjackd\fR in full\-duplex mode using the ALSA hw:0,0 device for 
-playback and the hw:0,2 device for capture.
-.IP
-\fBjackd \-d alsa \-P hw:0,0 \-C hw:0,2\fR
-.PP
-Run \fBjackd\fR in playback\-only mode using the ALSA hw:0,0 device. 
-.IP
-\fBjackd \-d alsa \-P hw:0,0\fR
-.SH "ENVIRONMENT"
-.br
-JACK is evolving a mechanism for automatically starting the server
-when needed.  Any client started without a running JACK server will
-attempt to start one itself using the command line found in the first
-line of \fB$HOME/.jackdrc\fR if it exists, or \fB/etc/jackdrc\fR if it
-does not.  If neither file exists, a built\-in default command will be
-used, including the \fB\-T\fR flag, which causes the server to shut
-down when all clients have exited.
-
-As a transition, this only happens when \fB$JACK_START_SERVER\fR is
-defined in the environment of the calling process.  In the future this
-will become normal behavior.  In either case, defining
-\fB$JACK_NO_START_SERVER\fR disables this feature.
-
-To change where JACK looks for the backend drivers, set
-\fB$JACK_DRIVER_DIR\fR.
-
-\fB$JACK_DEFAULT_SERVER\fR specifies the default server name.  If not
-defined, the string "default" is used.  If set in their respective
-environments, this affects \fBjackd\fR unless its \fB\-\-name\fR
-parameter is set, and all JACK clients unless they pass an explicit
-name to \fBjack_client_open()\fR.
-
-.SH "SEE ALSO:"
-.PP
-.I http://www.jackaudio.org
-.br
-The official JACK website with news, docs and a list of JACK clients.
-.PP
-.I http://jackaudio.org/email
-.br
-The JACK developers' mailing list.  Subscribe, to take part in
-development of JACK or JACK clients.  User questions are also welcome,
-there is no user-specific mailing list.
-.PP
-.I http://www.jackosx.com/
-.br
-Tools specific to the Mac OS X version of JACK.
-.PP
-.I http://www.alsa\-project.org
-.br
-The Advanced Linux Sound Architecture.
-.SH "BUGS"
-Please report bugs to
-.br
-.I http://trac.jackaudio.org/
-.SH "AUTHORS"
-Architect and original implementor: Paul Davis
-.PP
-Original design Group: Paul Davis, David Olofson, Kai Vehmanen, Benno Sennoner,
-Richard Guenther, and other members of the Linux Audio Developers group.
-.PP
-Programming: Paul Davis, Jack O'Quin, Taybin Rutkin, Stephane Letz, Fernando
-Pablo Lopez-Lezcano, Steve Harris, Jeremy Hall, Andy Wingo, Kai
-Vehmanen, Melanie Thielker, Jussi Laako, Tilman Linneweh, Johnny
-Petrantoni, Torben Hohn.
-.PP
-Manpage written by Stefan Schwandter, Jack O'Quin and Alexandre
-Prokoudine.
diff --git a/jackd/jackd.c b/jackd/jackd.c
deleted file mode 100644
index 1d73931..0000000
--- a/jackd/jackd.c
+++ /dev/null
@@ -1,765 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2005 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <config.h>
-
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <sys/shm.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <dlfcn.h>
-
-#include <jack/engine.h>
-#include <jack/internal.h>
-#include <jack/driver.h>
-#include <jack/shm.h>
-#include <jack/driver_parse.h>
-#include <jack/messagebuffer.h>
-
-#ifdef USE_CAPABILITIES
-
-#include <sys/stat.h>
-/* capgetp and capsetp are linux only extensions, not posix */
-#undef _POSIX_SOURCE
-#include <sys/capability.h>
-#include <jack/start.h>
-
-static struct stat pipe_stat;
-
-#endif /* USE_CAPABILITIES */
-
-static JSList *drivers = NULL;
-static sigset_t signals;
-static jack_engine_t *engine = NULL;
-static char *server_name = NULL;
-static int realtime = 1;
-static int realtime_priority = 10;
-static int do_mlock = 1;
-static int temporary = 0;
-static int verbose = 0;
-static int client_timeout = 0; /* msecs; if zero, use period size. */
-static unsigned int port_max = 256;
-static int do_unlock = 0;
-static jack_nframes_t frame_time_offset = 0;
-static int nozombies = 0;
-
-extern int sanitycheck (int, int);
-
-static void 
-do_nothing_handler (int sig)
-{
-	/* this is used by the child (active) process, but it never
-	   gets called unless we are already shutting down after
-	   another signal.
-	*/
-	char buf[64];
-	snprintf (buf, sizeof(buf),
-		  "received signal %d during shutdown (ignored)\n", sig);
-	write (1, buf, strlen (buf));
-}
-
-static int
-jack_main (jack_driver_desc_t * driver_desc, JSList * driver_params)
-{
-	int sig;
-	int i;
-	sigset_t allsignals;
-	struct sigaction action;
-	int waiting;
-
-	/* ensure that we are in our own process group so that
-	   kill (SIG, -pgrp) does the right thing.
-	*/
-
-	setsid ();
-
-	pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
-
-	/* what's this for?
-
-	   POSIX says that signals are delivered like this:
-
-	   * if a thread has blocked that signal, it is not
-	       a candidate to receive the signal.
-           * of all threads not blocking the signal, pick
-	       one at random, and deliver the signal.
-
-           this means that a simple-minded multi-threaded program can
-           expect to get POSIX signals delivered randomly to any one
-           of its threads,
-
-	   here, we block all signals that we think we might receive
-	   and want to catch. all "child" threads will inherit this
-	   setting. if we create a thread that calls sigwait() on the
-	   same set of signals, implicitly unblocking all those
-	   signals. any of those signals that are delivered to the
-	   process will be delivered to that thread, and that thread
-	   alone. this makes cleanup for a signal-driven exit much
-	   easier, since we know which thread is doing it and more
-	   importantly, we are free to call async-unsafe functions,
-	   because the code is executing in normal thread context
-	   after a return from sigwait().
-	*/
-
-	sigemptyset (&signals);
-	sigaddset(&signals, SIGHUP);
-	sigaddset(&signals, SIGINT);
-	sigaddset(&signals, SIGQUIT);
-	sigaddset(&signals, SIGPIPE);
-	sigaddset(&signals, SIGTERM);
-	sigaddset(&signals, SIGUSR1);
-	sigaddset(&signals, SIGUSR2);
-
-	/* all child threads will inherit this mask unless they
-	 * explicitly reset it 
-	 */
-
-	pthread_sigmask (SIG_BLOCK, &signals, 0);
-
-	if (!realtime && client_timeout == 0)
-		client_timeout = 500; /* 0.5 sec; usable when non realtime. */
-
-	/* get the engine/driver started */
-
-	if ((engine = jack_engine_new (realtime, realtime_priority, 
-				       do_mlock, do_unlock, server_name,
-				       temporary, verbose, client_timeout,
-				       port_max, getpid(), frame_time_offset, 
-				       nozombies, drivers)) == 0) {
-		jack_error ("cannot create engine");
-		return -1;
-	}
-
-	jack_info ("loading driver ..");
-	
-	if (jack_engine_load_driver (engine, driver_desc, driver_params)) {
-		jack_error ("cannot load driver module %s",
-			 driver_desc->name);
-		goto error;
-	}
-
-	if (engine->driver->start (engine->driver) != 0) {
-		jack_error ("cannot start driver");
-		goto error;
-	}
-
-	/* install a do-nothing handler because otherwise pthreads
-	   behaviour is undefined when we enter sigwait.
-	*/
-
-	sigfillset (&allsignals);
-	action.sa_handler = do_nothing_handler;
-	action.sa_mask = allsignals;
-	action.sa_flags = SA_RESTART|SA_RESETHAND;
-
-	for (i = 1; i < NSIG; i++) {
-		if (sigismember (&signals, i)) {
-			sigaction (i, &action, 0);
-		} 
-	}
-	
-	if (verbose) {
-		jack_info ("%d waiting for signals", getpid());
-	}
-
-	waiting = TRUE;
-
-	while (waiting) {
-		sigwait (&signals, &sig);
-
-		jack_info ("jack main caught signal %d", sig);
-		
-		switch (sig) {
-		case SIGUSR1:
-			jack_dump_configuration(engine, 1);
-			break;
-		case SIGUSR2:
-			/* driver exit */
-			waiting = FALSE;
-			break;
-		default:
-			waiting = FALSE;
-			break;
-		}
-	} 
-	
-	if (sig != SIGSEGV) {
-
-		/* unblock signals so we can see them during shutdown.
-		   this will help prod developers not to lose sight of
-		   bugs that cause segfaults etc. during shutdown.
-		*/
-		sigprocmask (SIG_UNBLOCK, &signals, 0);
-	}
-	
-	jack_engine_delete (engine);
-	return 1;
-	
-error:
-	jack_engine_delete (engine);
-	return -1;
-}
-
-static jack_driver_desc_t *
-jack_drivers_get_descriptor (JSList * drivers, const char * sofile)
-{
-	jack_driver_desc_t * descriptor, * other_descriptor;
-	JackDriverDescFunction so_get_descriptor;
-	JSList * node;
-	void * dlhandle;
-	char * filename;
-	const char * dlerr;
-	int err;
-	char* driver_dir;
-
-	if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
-		driver_dir = ADDON_DIR;
-	}
-	filename = malloc (strlen (driver_dir) + 1 + strlen (sofile) + 1);
-	sprintf (filename, "%s/%s", driver_dir, sofile);
-
-	if (verbose) {
-		jack_info ("getting driver descriptor from %s", filename);
-	}
-
-	if ((dlhandle = dlopen (filename, RTLD_NOW|RTLD_GLOBAL)) == NULL) {
-		jack_error ("could not open driver .so '%s': %s\n", filename, dlerror ());
-		free (filename);
-		return NULL;
-	}
-
-	so_get_descriptor = (JackDriverDescFunction)
-		dlsym (dlhandle, "driver_get_descriptor");
-
-	if ((dlerr = dlerror ()) != NULL) {
-		jack_error("%s", dlerr);
-		dlclose (dlhandle);
-		free (filename);
-		return NULL;
-	}
-
-	if ((descriptor = so_get_descriptor ()) == NULL) {
-		jack_error ("driver from '%s' returned NULL descriptor\n", filename);
-		dlclose (dlhandle);
-		free (filename);
-		return NULL;
-	}
-
-	if ((err = dlclose (dlhandle)) != 0) {
-		jack_error ("error closing driver .so '%s': %s\n", filename, dlerror ());
-	}
-
-	/* check it doesn't exist already */
-	for (node = drivers; node; node = jack_slist_next (node)) {
-		other_descriptor = (jack_driver_desc_t *) node->data;
-
-		if (strcmp (descriptor->name, other_descriptor->name) == 0) {
-			jack_error ("the drivers in '%s' and '%s' both have the name '%s'; using the first\n",
-				    other_descriptor->file, filename, other_descriptor->name);
-			/* FIXME: delete the descriptor */
-			free (filename);
-			return NULL;
-		}
-	}
-
-	snprintf (descriptor->file, sizeof(descriptor->file), "%s", filename);
-	free (filename);
-
-	return descriptor;
-}
-
-static JSList *
-jack_drivers_load ()
-{
-	struct dirent * dir_entry;
-	DIR * dir_stream;
-	const char * ptr;
-	int err;
-	JSList * driver_list = NULL;
-	jack_driver_desc_t * desc;
-	char* driver_dir;
-
-	if ((driver_dir = getenv("JACK_DRIVER_DIR")) == 0) {
-		driver_dir = ADDON_DIR;
-	}
-
-	/* search through the driver_dir and add get descriptors
-	   from the .so files in it */
-	dir_stream = opendir (driver_dir);
-	if (!dir_stream) {
-		jack_error ("could not open driver directory %s: %s\n",
-			    driver_dir, strerror (errno));
-		return NULL;
-	}
-  
-	while ( (dir_entry = readdir (dir_stream)) ) {
-		/* check the filename is of the right format */
-		if (strncmp ("jack_", dir_entry->d_name, 5) != 0) {
-			continue;
-		}
-
-		ptr = strrchr (dir_entry->d_name, '.');
-		if (!ptr) {
-			continue;
-		}
-		ptr++;
-		if (strncmp ("so", ptr, 2) != 0) {
-			continue;
-		}
-
-		desc = jack_drivers_get_descriptor (drivers, dir_entry->d_name);
-		if (desc) {
-			driver_list = jack_slist_append (driver_list, desc);
-		}
-	}
-
-	err = closedir (dir_stream);
-	if (err) {
-		jack_error ("error closing driver directory %s: %s\n",
-			    driver_dir, strerror (errno));
-	}
-
-	if (!driver_list) {
-		jack_error ("could not find any drivers in %s!\n", driver_dir);
-		return NULL;
-	}
-
-	return driver_list;
-}
-
-static void copyright (FILE* file)
-{
-	fprintf (file, "jackd " VERSION "\n"
-"Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.\n"
-"jackd comes with ABSOLUTELY NO WARRANTY\n"
-"This is free software, and you are welcome to redistribute it\n"
-"under certain conditions; see the file COPYING for details\n\n");
-}
-
-static void usage (FILE *file) 
-{
-	copyright (file);
-	fprintf (file, "\n"
-"usage: jackd [ --no-realtime OR -r ]\n"
-"             [ --realtime OR -R [ --realtime-priority OR -P priority ] ]\n"
-"      (the two previous arguments are mutually exclusive. The default is --realtime)\n"
-"             [ --name OR -n server-name ]\n"
-"             [ --no-mlock OR -m ]\n"
-"             [ --unlock OR -u ]\n"
-"             [ --timeout OR -t client-timeout-in-msecs ]\n"
-"             [ --port-max OR -p maximum-number-of-ports]\n"
-"             [ --debug-timer OR -D ]\n"
-"             [ --no-sanity-checks OR -N ]\n"
-"             [ --verbose OR -v ]\n"
-"             [ --clocksource OR -c [ c(ycle) | h(pet) | s(ystem) ]\n"
-"             [ --replace-registry ]\n"
-"             [ --silent OR -s ]\n"
-"             [ --version OR -V ]\n"
-"             [ --nozombies OR -Z ]\n"
-"         -d backend [ ... backend args ... ]\n"
-#ifdef __APPLE__
-"             Available backends may include: coreaudio, dummy, net, portaudio.\n\n"
-#else 
-"             Available backends may include: alsa, dummy, freebob, firewire, net, oss, sun, or portaudio.\n\n"
-#endif
-"       jackd -d backend --help\n"
-"             to display options for each backend\n\n");
-}	
-
-static jack_driver_desc_t *
-jack_find_driver_descriptor (const char * name)
-{
-	jack_driver_desc_t * desc = 0;
-	JSList * node;
-
-	for (node = drivers; node; node = jack_slist_next (node)) {
-		desc = (jack_driver_desc_t *) node->data;
-
-		if (strcmp (desc->name, name) != 0) {
-			desc = NULL;
-		} else {
-			break;
-		}
-	}
-
-	return desc;
-}
-
-static void
-jack_cleanup_files (const char *server_name)
-{
-	DIR *dir;
-	struct dirent *dirent;
-	char dir_name[PATH_MAX+1] = "";
-        jack_server_dir (server_name, dir_name);
-
-	/* On termination, we remove all files that jackd creates so
-	 * subsequent attempts to start jackd will not believe that an
-	 * instance is already running.  If the server crashes or is
-	 * terminated with SIGKILL, this is not possible.  So, cleanup
-	 * is also attempted when jackd starts.
-	 *
-	 * There are several tricky issues.  First, the previous JACK
-	 * server may have run for a different user ID, so its files
-	 * may be inaccessible.  This is handled by using a separate
-	 * JACK_TMP_DIR subdirectory for each user.  Second, there may
-	 * be other servers running with different names.  Each gets
-	 * its own subdirectory within the per-user directory.  The
-	 * current process has already registered as `server_name', so
-	 * we know there is no other server actively using that name.
-	 */
-
-	/* nothing to do if the server directory does not exist */
-	if ((dir = opendir (dir_name)) == NULL) {
-		return;
-	}
-
-	/* unlink all the files in this directory, they are mine */
-	while ((dirent = readdir (dir)) != NULL) {
-
-		char fullpath[PATH_MAX+1];
-
-		if ((strcmp (dirent->d_name, ".") == 0)
-		    || (strcmp (dirent->d_name, "..") == 0)) {
-			continue;
-		}
-
-		snprintf (fullpath, sizeof (fullpath), "%s/%s",
-			  dir_name, dirent->d_name);
-
-		if (unlink (fullpath)) {
-			jack_error ("cannot unlink `%s' (%s)", fullpath,
-				    strerror (errno));
-		}
-	} 
-
-	closedir (dir);
-
-	/* now, delete the per-server subdirectory, itself */
-	if (rmdir (dir_name)) {
- 		jack_error ("cannot remove `%s' (%s)", dir_name,
-			    strerror (errno));
-	}
-
-	/* finally, delete the per-user subdirectory, if empty */
-	if (rmdir (jack_user_dir ())) {
-		if (errno != ENOTEMPTY) {
-			jack_error ("cannot remove `%s' (%s)",
-				    jack_user_dir (), strerror (errno));
-		}
-	}
-}
-
-static void
-maybe_use_capabilities ()
-{
-#ifdef USE_CAPABILITIES
-	int status;
-
-	/* check to see if there is a pipe in the right descriptor */
-	if ((status = fstat (PIPE_WRITE_FD, &pipe_stat)) == 0 &&
-	    S_ISFIFO(pipe_stat.st_mode)) {
-
-		/* tell jackstart we are up and running */
-  	        char c = 1;
-
-	        if (write (PIPE_WRITE_FD, &c, 1) != 1) {
-		        jack_error ("cannot write to jackstart sync "
-				 "pipe %d (%s)", PIPE_WRITE_FD,
-				 strerror (errno));
-	        }
-
-		if (close(PIPE_WRITE_FD) != 0) {
-			jack_error("jackd: error on startup pipe close: %s",
-				   strerror (errno));
-		} else {
-			/* wait for jackstart process to set our capabilities */
-			if (wait (&status) == -1) {
-				jack_error ("jackd: wait for startup "
-					    "process exit failed");
-			}
-			if (!WIFEXITED (status) || WEXITSTATUS (status)) {
-				jack_error ("jackd: jackstart did not "
-					    "exit cleanly");
-				exit (1);
-			}
-		}
-	}
-#endif /* USE_CAPABILITIES */
-}
-
-int	       
-main (int argc, char *argv[])
-
-{
-	jack_driver_desc_t * desc;
-	int replace_registry = 0;
-	int do_sanity_checks = 1;
-	int show_version = 0;
-
-	const char *options = "-ad:P:uvshVrRZTFlt:mn:Np:c:";
-	struct option long_options[] = 
-	{ 
-		/* keep ordered by single-letter option code */
-
-		{ "clock-source", 1, 0, 'c' },
-		{ "driver", 1, 0, 'd' },
-		{ "help", 0, 0, 'h' },
-		{ "tmpdir-location", 0, 0, 'l' },
-		{ "no-mlock", 0, 0, 'm' },
-		{ "name", 1, 0, 'n' },
-                { "no-sanity-checks", 0, 0, 'N' },
-		{ "port-max", 1, 0, 'p' },
-		{ "realtime-priority", 1, 0, 'P' },
-		{ "no-realtime", 0, 0, 'r' },
-		{ "realtime", 0, 0, 'R' },
-		{ "replace-registry", 0, &replace_registry, 0 },
-		{ "silent", 0, 0, 's' },
-		{ "timeout", 1, 0, 't' },
-		{ "temporary", 0, 0, 'T' },
-		{ "unlock", 0, 0, 'u' },
-		{ "version", 0, 0, 'V' },
-		{ "verbose", 0, 0, 'v' },
-		{ "nozombies", 0, 0, 'Z' },
-		{ 0, 0, 0, 0 }
-	};
-	int opt = 0;
-	int option_index = 0;
-	int seen_driver = 0;
-	char *driver_name = NULL;
-	char **driver_args = NULL;
-	JSList * driver_params;
-	int driver_nargs = 1;
-	int i;
-	int rc;
-
-	setvbuf (stdout, NULL, _IOLBF, 0);
-
-	maybe_use_capabilities ();
-
-	opterr = 0;
-	while (!seen_driver &&
-	       (opt = getopt_long (argc, argv, options,
-				   long_options, &option_index)) != EOF) {
-		switch (opt) {
-
-		case 'c':
-			if (tolower (optarg[0]) == 'h') {
-				clock_source = JACK_TIMER_HPET;
-			} else if (tolower (optarg[0]) == 'c') {
-				clock_source = JACK_TIMER_CYCLE_COUNTER;
-			} else if (tolower (optarg[0]) == 's') {
-				clock_source = JACK_TIMER_SYSTEM_CLOCK;
-			} else {
-				usage (stderr);
-				return -1;
-			}
-			break;
-
-		case 'd':
-			seen_driver = 1;
-			driver_name = optarg;
-			break;
-
-		case 'D':
-			frame_time_offset = JACK_MAX_FRAMES - atoi(optarg); 
-			break;
-
-		case 'l':
-			/* special flag to allow libjack to determine jackd's idea of where tmpdir is */
-			printf ("%s\n", jack_tmpdir);
-			exit (0);
-
-		case 'm':
-			do_mlock = 0;
-			break;
-
-		case 'n':
-			server_name = optarg;
-			break;
-
-		case 'N':
-			do_sanity_checks = 0;
-			break;
-
-		case 'p':
-			port_max = (unsigned int) atol (optarg);
-			break;
-
-		case 'P':
-			realtime_priority = atoi (optarg);
-			break;
-
-		case 'r':
-			realtime = 0;
-			break;
-
-		case 'R':
-			/* this is now the default */
-			realtime = 1;
-			break;
-
-		case 's':
-			jack_set_error_function (silent_jack_error_callback);
-			break;
-
-		case 'T':
-			temporary = 1;
-			break;
-
-		case 't':
-			client_timeout = atoi (optarg);
-			break;
-
-		case 'u':
-			do_unlock = 1;
-			break;
-
-		case 'v':
-			verbose = 1;
-			break;
-
-		case 'V':
-			show_version = 1;
-			break;
-
-		case 'Z':
-			nozombies = 1;
-			break;
-
-		default:
-			jack_error ("Unknown option character %c",
-				    optopt);
-			/*fallthru*/
-		case 'h':
-			usage (stdout);
-			return -1;
-		}
-	}
-
-	if (show_version) {
-		printf ( "jackd version " VERSION 
-				" tmpdir " DEFAULT_TMP_DIR 
-				" protocol " PROTOCOL_VERSION
-				"\n");
-		return 0;
-	}
-
-	copyright (stdout);
-
-	if (do_sanity_checks && (0 < sanitycheck (realtime, (clock_source == JACK_TIMER_CYCLE_COUNTER)))) {
-		return -1;
-	}
-
-	if (realtime && (client_timeout >= JACKD_WATCHDOG_TIMEOUT)) {
-		usage (stderr);
-		fprintf (stderr, "In realtime mode (-R) the client timeout must be smaller than the watchdog timeout (%ims).\n", JACKD_WATCHDOG_TIMEOUT);
-		exit (1);
-	}
-
-	if (!seen_driver) {
-		usage (stderr);
-		exit (1);
-	}
-
-	drivers = jack_drivers_load ();
-	if (!drivers) {
-		fprintf (stderr, "jackd: no drivers found; exiting\n");
-		exit (1);
-	}
-
-	desc = jack_find_driver_descriptor (driver_name);
-	if (!desc) {
-		fprintf (stderr, "jackd: unknown driver '%s'\n", driver_name);
-		exit (1);
-	}
-
-	if (optind < argc) {
-		driver_nargs = 1 + argc - optind;
-	} else {
-		driver_nargs = 1;
-	}
-
-	if (driver_nargs == 0) {
-		fprintf (stderr, "No driver specified ... hmm. JACK won't do"
-			 " anything when run like this.\n");
-		return -1;
-	}
-
-	driver_args = (char **) malloc (sizeof (char *) * driver_nargs);
-	driver_args[0] = driver_name;
-	
-	for (i = 1; i < driver_nargs; i++) {
-		driver_args[i] = argv[optind++];
-	}
-
-	if (jack_parse_driver_params (desc, driver_nargs,
-				      driver_args, &driver_params)) {
-		exit (0);
-	}
-
-	if (server_name == NULL)
-		server_name = jack_default_server_name ();
-
-	rc = jack_register_server (server_name, replace_registry);
-	switch (rc) {
-	case EEXIST:
-		fprintf (stderr, "`%s' server already active\n", server_name);
-		exit (1);
-	case ENOSPC:
-		fprintf (stderr, "too many servers already active\n");
-		exit (2);
-	case ENOMEM:
-		fprintf (stderr, "no access to shm registry\n");
-		exit (3);
-	default:
-		if (verbose)
-			fprintf (stderr, "server `%s' registered\n",
-				 server_name);
-	}
-
-	/* clean up shared memory and files from any previous
-	 * instance of this server name */
-	jack_cleanup_shm ();
-	jack_cleanup_files (server_name);
-
-	/* run the server engine until it terminates */
-	jack_main (desc, driver_params);
-
-	/* clean up shared memory and files from this server instance */
-	if (verbose)
-		fprintf (stderr, "cleaning up shared memory\n");
-	jack_cleanup_shm ();
-	if (verbose)
-		fprintf (stderr, "cleaning up files\n");
-	jack_cleanup_files (server_name);
-	if (verbose)
-		fprintf (stderr, "unregistering server `%s'\n", server_name);
-	jack_unregister_server (server_name);
-
-	exit (0);
-}
diff --git a/jackd/jackstart.1 b/jackd/jackstart.1
deleted file mode 100644
index b81730b..0000000
--- a/jackd/jackstart.1
+++ /dev/null
@@ -1 +0,0 @@
-.so man1/jackd.1
diff --git a/jackd/jackstart.c b/jackd/jackstart.c
deleted file mode 100644
index 0bd21da..0000000
--- a/jackd/jackstart.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*  Copyright (C) 2002 Fernando Lopez-Lezcano
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    Jackstart is based on code and concepts found in sucap.c, written by
-    Finn Arne Gangstad <finnag at guardian.no> and givertcap.c, written by
-    Tommi Ilmonen, Tommi.Ilmonen at hut.fi
-
-*/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <grp.h>
-#include <unistd.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <string.h>
-
-#include <config.h>
-
-#undef _POSIX_SOURCE
-#include <sys/capability.h>
-
-#include "jack/start.h"
-#include "md5.h"
-#include "jack_md5.h"
-
-#define READ_BLOCKSIZE 4096
-
-/* JACK_LOCATION must be passed on the gcc command line */
-static char *jackd_bin_path = JACK_LOCATION "/jackd";
-
-static char *jackd_md5_sum = JACKD_MD5_SUM;
-
-
-static int check_capabilities (void)
-{
-	cap_t caps = cap_init();
-	cap_flag_value_t cap;
-	pid_t pid;
-	int have_all_caps = 1;
-
-	if (caps == NULL) {
-		fprintf (stderr, "jackstart: could not allocate capability working storage\n");
-		return 0;
-	}
-	pid = getpid ();
-	cap_clear (caps);
-	if (capgetp (pid, caps)) {
-		fprintf (stderr, "jackstart: could not get capabilities for process %d\n", pid);
-		return 0;
-	}
-	/* check that we are able to give capabilites to other processes */
-	cap_get_flag(caps, CAP_SETPCAP, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-	/* check that we have the capabilities we want to transfer */
-	cap_get_flag(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-	cap_get_flag(caps, CAP_SYS_RESOURCE, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-	cap_get_flag(caps, CAP_IPC_LOCK, CAP_EFFECTIVE, &cap);
-	if (cap == CAP_CLEAR) {
-		have_all_caps = 0;
-		goto done;
-	}
-  done:
-	cap_free (caps);
-	return have_all_caps;
-}
-
-
-static int give_capabilities (pid_t pid)
-{
-	cap_t caps = cap_init();
-	const unsigned caps_size = 4;
-	cap_value_t cap_list[] =
-		{ CAP_SETPCAP, CAP_SYS_NICE, CAP_SYS_RESOURCE, CAP_IPC_LOCK} ;
-
-	if (caps == NULL) {
-		fprintf (stderr, "jackstart: could not allocate capability working storage\n");
-		return -1;
-	}
-	cap_clear(caps);
-	if (capgetp (pid, caps)) {
-		fprintf (stderr, "jackstart: could not get capabilities for process %d\n", pid);
-		cap_clear(caps);
-	}
-	cap_set_flag(caps, CAP_EFFECTIVE, caps_size, cap_list , CAP_SET);
-	cap_set_flag(caps, CAP_INHERITABLE, caps_size, cap_list , CAP_SET);
-	cap_set_flag(caps, CAP_PERMITTED, caps_size, cap_list , CAP_SET);
-	if (capsetp (pid, caps)) {
-		fprintf (stderr, "jackstart: could not give capabilities: %s\n", strerror (errno));
-		cap_free (caps);
-		return -1;
-	}
-	cap_free (caps);
-	return 0;
-}
-
-static int check_binary (const char *binpath)
-{
-	struct stat status;
-	FILE *binstream;
-
-	if (lstat(jackd_bin_path, &status)) {
-		fprintf (stderr, "jackstart: could not stat %s: %s\n",
-			 binpath, strerror(errno));
-		return -1;
-	}
-	if (!(S_ISREG(status.st_mode))) {
-		fprintf (stderr, "jackstart: %s is not a regular file\n",
-			 binpath);
-		return -1;
-	}
-	if (status.st_uid != 0) {
-		fprintf (stderr, "jackstart: %s is not owned by root\n",
-			 binpath);
-		return -1;
-	}
-	if ((status.st_mode & 022) != 0) {
-		fprintf (stderr,
-			 "jackstart: %s mode %o writeable by non-root users\n",
-			 binpath, status.st_mode & 07777);
-		return -1;
-	}
-	if ((binstream = fopen (binpath, "r")) == NULL) {
-		fprintf (stderr, "jackstart: can't open %s for reading: %s\n", 
-			 binpath, strerror(errno));
-		return -1;
-	} else {
-		/* md5sum the executable file, check man evp for more details */
-		size_t sum;
-		md5_t ctx;
-		char buffer[READ_BLOCKSIZE + 72];
-		unsigned char md_value[MD5_SIZE];
-		char md_string[3];
-		int i, j;
-
-		md5_init(&ctx);
-		while (1) {
-			size_t n;
-			sum = 0;
-			do {
-				n = fread (buffer + sum, 1, READ_BLOCKSIZE - sum, binstream);
-				sum += n;
-			} while (sum < READ_BLOCKSIZE && n != 0);
-			if (n == 0 && ferror (binstream)) {
-				fprintf (stderr, "jackstart: error while reading %s: %s\n", binpath, strerror(errno));
-				return -1;
-			}
-			if (n == 0) {
-				break;
-			}
-			md5_process(&ctx, buffer, READ_BLOCKSIZE);
-		}
-		if (sum > 0)
-			md5_process(&ctx, buffer, sum);
-		if (fclose (binstream)) {
-			fprintf (stderr, "jackstart: could not close %s after reading: %s\n", binpath, strerror(errno));
-		}
-		md5_finish(&ctx, md_value);
-		for(i = 0, j = 0; i < sizeof(md_value); i++, j+=2) {
-			sprintf(md_string, "%02x", md_value[i]);
-			if (md_string[0] != jackd_md5_sum[j] ||
-			    md_string[1] != jackd_md5_sum[j+1]) {
-				fprintf (stderr, "jackstart: md5 checksum for %s does not match\n", binpath);
-				return -1;
-			}
-		}
-	}
-	return 0;
-}
-
-int main(int argc, char **argv)
-{
-	uid_t uid, euid;
-	pid_t pid, parent_pid;
-	gid_t gid;
-	int pipe_fds[2];
-	int err;
-
-	parent_pid = getpid ();
-
-	/* get real user and group ids, effective user id */
-	uid = getuid ();
-	gid = getgid ();
-	euid = geteuid ();
-
-	/* are we running suid root? */
-	if (uid != 0) {
-		if (euid != 0) {
-			fprintf (stderr, "jackstart: not running suid root, can't use capabilities\n");
-			fprintf (stderr, "    (currently running with uid=%d and euid=%d),\n", uid, euid);
-			fprintf (stderr, "    make jackstart suid root or start jackd directly\n\n");
-		}
-	}
-	/* see if we can get the required capabilities */
-	if (check_capabilities () == 0) {
-		size_t size;
-		cap_t cap = cap_init();
-		capgetp(0, cap);
-		fprintf (stderr, "jackstart: cannot get realtime capabilities, current capabilities are:\n");
-		fprintf (stderr, "           %s\n", cap_to_text(cap, &size));
-		fprintf (stderr, "    probably running under a kernel with capabilities disabled,\n");
-		fprintf (stderr, "    a suitable kernel would have printed something like \"=eip\"\n\n");
-	}
-
-	/* check the executable, owner, permissions, md5 checksum */
-	if (check_binary(jackd_bin_path)) {
-		exit(1);
-	}
-
-	/* set process group to current pid */
-	if (setpgid (0, getpid())) {
-		fprintf (stderr, "jackstart: failed to set process group: %s\n", 
-			 strerror(errno));
-		exit (1);
-	}
-
-	/* create pipe to synchronize with jackd */
-	if (pipe (pipe_fds)) {
-		fprintf (stderr, "jackstart: could not create pipe: %s\n",
-			 strerror(errno));
-		exit (1);
-	}
-
-	/* make sure the file descriptors are the right ones,
-	   otherwise dup them, this is to make sure that both
-	   jackstart and jackd use the same fds
-	*/
-	if (pipe_fds[0] != PIPE_READ_FD) {
-		if (dup2 (pipe_fds[0], PIPE_READ_FD) != PIPE_READ_FD) {
-			fprintf (stderr, "jackstart: could not dup pipe read file descriptor: %s\n",
-				 strerror(errno));
-			exit (1);
-		}
-	}
-	if (pipe_fds[1] != PIPE_WRITE_FD) {
-		if (dup2(pipe_fds[1], PIPE_WRITE_FD)!=PIPE_WRITE_FD) {
-			fprintf (stderr, "jackstart: could not dup pipe write file descriptor: %s\n",
-				 strerror(errno));
-			exit (1);
-		}
-	}
-	/* fork off a child to wait for jackd to start */
-	fflush(NULL);
-	pid = fork();
-	if (pid == -1) {
-		fprintf (stderr, "jackstart: fork failed\n");
-		exit (1);
-	}
-	if (pid) {
-		/* mother process: drops privileges, execs jackd */
-		close(PIPE_READ_FD);
-
-		/* get rid of any supplemental groups */
-		if (!getuid () && setgroups (0, 0)) {
-			fprintf (stderr, "jackstart: setgroups failed: %s\n", strerror(errno));
-			exit (1);
-		}
-
-		/* set gid and uid */
-		setregid(gid, gid);
-		setreuid(uid, uid);
-		execvp(jackd_bin_path, argv);
-	
-		/* we could not start jackd, clean up and exit */
-		fprintf(stderr, "jackstart: unable to execute %s: %s\n", jackd_bin_path, strerror(errno));
-		close (PIPE_WRITE_FD);
-		wait (&err);
-		exit (1);
-	} else {
-		/* child process: grants privileges to jackd */
-		close(PIPE_WRITE_FD);
-
-		/* wait for jackd to start */
-		while (1) {
-		  	int ret;
-			char c;
-
-			/* picking up pipe closure is a tricky business. 
-			   this seems to work as well as anything else.
-			*/
-
-			ret = read(PIPE_READ_FD, &c, 1);
-			fprintf (stderr, "back from read, ret = %d errno == %s\n", ret, strerror (errno));
-			if (ret == 1) {
-			  break;
-			} else if (errno != EINTR) {
-			  break;
-			}
-		}
-
-		/* set privileges on jackd process */
-		give_capabilities (parent_pid);
-	}
-	exit (0);
-}
diff --git a/jackd/md5.c b/jackd/md5.c
deleted file mode 100644
index 15342b9..0000000
--- a/jackd/md5.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * Functions to compute MD5 message digest of files or memory blocks
- * according to the definition of MD5 in RFC 1321 from April 1992.
- * Copyright (C) 1995, 1996 Free Software Foundation, Inc.  NOTE: The
- * canonical source of this file is maintained with the GNU C Library.
- * Bugs can be reported to bug-glibc at prep.ai.mit.edu.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Written by Ulrich Drepper <drepper at gnu.ai.mit.edu>, 1995.
- * Modified by Gray Watson <http://256.com/gray/>, 1997.
- *
- */
-
-/*
- * NOTE: during quick performance tests on a Sun Sparc Ultra 1 and an
- * Alpha 255 300, these functions performed upwards of 3mb/sec
- * including disk I/O time.
- */
-
-/*
- * MD5 Test Suite from RFC1321: http://ds.internic.net:/rfc/rfc1321.txt
- *
- * MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
- * MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
- * MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
- * MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
- * MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
- * MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
- * d174ab98d277d9f5a5611c2c9f419d9f
- * MD5 ("123456789012345678901234567890123456789012345678901234567890123456
- * 78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "md5.h"
-#include "md5_loc.h"
-
-/* static	char	*rcs_id =
-
-/* version id for the library */
-/* static char *version_id = "$MD5Version: 1.0.0 November-19-1997 $"; */
-
-/****************************** local routines *******************************/
-
-/*
- * process_block
- *
- * DESCRIPTION:
- *
- * Process a block of bytes into a MD5 state structure.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure from which we are getting the result.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-static	void	process_block(md5_t *md5_p, const void *buffer,
-			      const unsigned int buf_len)
-{
-  md5_uint32	correct[16];
-  const void	*buf_p = buffer, *end_p;
-  unsigned int	words_n;
-  md5_uint32	A, B, C, D;
-
-  words_n = buf_len / sizeof(md5_uint32);
-  end_p = (char *)buf_p + words_n * sizeof(md5_uint32);
-
-  A = md5_p->md_A;
-  B = md5_p->md_B;
-  C = md5_p->md_C;
-  D = md5_p->md_D;
-
-  /*
-   * First increment the byte count.  RFC 1321 specifies the possible
-   * length of the file up to 2^64 bits.  Here we only compute the
-   * number of bytes with a double word increment.  Modified to do
-   * this to better avoid overflows in the lower word -- Gray 10/97.
-   */
-  if (md5_p->md_total[0] > MAX_MD5_UINT32 - buf_len) {
-    md5_p->md_total[1]++;
-    md5_p->md_total[0] -= (MAX_MD5_UINT32 - buf_len);
-  }
-  else {
-    md5_p->md_total[0] += buf_len;
-  }
-
-  /*
-   * Process all bytes in the buffer with MD5_BLOCK bytes in each
-   * round of the loop.
-   */
-  while (buf_p < end_p) {
-    md5_uint32	A_save, B_save, C_save, D_save;
-    md5_uint32	*corr_p = correct;
-
-    A_save = A;
-    B_save = B;
-    C_save = C;
-    D_save = D;
-
-    /*
-     * Before we start, one word to the strange constants.  They are
-     * defined in RFC 1321 as
-     *
-     * T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..MD5_BLOCK
-     */
-
-    /* Round 1. */
-    OP1 (A, B, C, D, buf_p, corr_p,  7, 0xd76aa478);
-    OP1 (D, A, B, C, buf_p, corr_p, 12, 0xe8c7b756);
-    OP1 (C, D, A, B, buf_p, corr_p, 17, 0x242070db);
-    OP1 (B, C, D, A, buf_p, corr_p, 22, 0xc1bdceee);
-    OP1 (A, B, C, D, buf_p, corr_p,  7, 0xf57c0faf);
-    OP1 (D, A, B, C, buf_p, corr_p, 12, 0x4787c62a);
-    OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa8304613);
-    OP1 (B, C, D, A, buf_p, corr_p, 22, 0xfd469501);
-    OP1 (A, B, C, D, buf_p, corr_p,  7, 0x698098d8);
-    OP1 (D, A, B, C, buf_p, corr_p, 12, 0x8b44f7af);
-    OP1 (C, D, A, B, buf_p, corr_p, 17, 0xffff5bb1);
-    OP1 (B, C, D, A, buf_p, corr_p, 22, 0x895cd7be);
-    OP1 (A, B, C, D, buf_p, corr_p,  7, 0x6b901122);
-    OP1 (D, A, B, C, buf_p, corr_p, 12, 0xfd987193);
-    OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa679438e);
-    OP1 (B, C, D, A, buf_p, corr_p, 22, 0x49b40821);
-
-    /* Round 2. */
-    OP234 (FG, A, B, C, D, correct[  1],  5, 0xf61e2562);
-    OP234 (FG, D, A, B, C, correct[  6],  9, 0xc040b340);
-    OP234 (FG, C, D, A, B, correct[ 11], 14, 0x265e5a51);
-    OP234 (FG, B, C, D, A, correct[  0], 20, 0xe9b6c7aa);
-    OP234 (FG, A, B, C, D, correct[  5],  5, 0xd62f105d);
-    OP234 (FG, D, A, B, C, correct[ 10],  9, 0x02441453);
-    OP234 (FG, C, D, A, B, correct[ 15], 14, 0xd8a1e681);
-    OP234 (FG, B, C, D, A, correct[  4], 20, 0xe7d3fbc8);
-    OP234 (FG, A, B, C, D, correct[  9],  5, 0x21e1cde6);
-    OP234 (FG, D, A, B, C, correct[ 14],  9, 0xc33707d6);
-    OP234 (FG, C, D, A, B, correct[  3], 14, 0xf4d50d87);
-    OP234 (FG, B, C, D, A, correct[  8], 20, 0x455a14ed);
-    OP234 (FG, A, B, C, D, correct[ 13],  5, 0xa9e3e905);
-    OP234 (FG, D, A, B, C, correct[  2],  9, 0xfcefa3f8);
-    OP234 (FG, C, D, A, B, correct[  7], 14, 0x676f02d9);
-    OP234 (FG, B, C, D, A, correct[ 12], 20, 0x8d2a4c8a);
-
-    /* Round 3. */
-    OP234 (FH, A, B, C, D, correct[  5],  4, 0xfffa3942);
-    OP234 (FH, D, A, B, C, correct[  8], 11, 0x8771f681);
-    OP234 (FH, C, D, A, B, correct[ 11], 16, 0x6d9d6122);
-    OP234 (FH, B, C, D, A, correct[ 14], 23, 0xfde5380c);
-    OP234 (FH, A, B, C, D, correct[  1],  4, 0xa4beea44);
-    OP234 (FH, D, A, B, C, correct[  4], 11, 0x4bdecfa9);
-    OP234 (FH, C, D, A, B, correct[  7], 16, 0xf6bb4b60);
-    OP234 (FH, B, C, D, A, correct[ 10], 23, 0xbebfbc70);
-    OP234 (FH, A, B, C, D, correct[ 13],  4, 0x289b7ec6);
-    OP234 (FH, D, A, B, C, correct[  0], 11, 0xeaa127fa);
-    OP234 (FH, C, D, A, B, correct[  3], 16, 0xd4ef3085);
-    OP234 (FH, B, C, D, A, correct[  6], 23, 0x04881d05);
-    OP234 (FH, A, B, C, D, correct[  9],  4, 0xd9d4d039);
-    OP234 (FH, D, A, B, C, correct[ 12], 11, 0xe6db99e5);
-    OP234 (FH, C, D, A, B, correct[ 15], 16, 0x1fa27cf8);
-    OP234 (FH, B, C, D, A, correct[  2], 23, 0xc4ac5665);
-
-    /* Round 4. */
-    OP234 (FI, A, B, C, D, correct[  0],  6, 0xf4292244);
-    OP234 (FI, D, A, B, C, correct[  7], 10, 0x432aff97);
-    OP234 (FI, C, D, A, B, correct[ 14], 15, 0xab9423a7);
-    OP234 (FI, B, C, D, A, correct[  5], 21, 0xfc93a039);
-    OP234 (FI, A, B, C, D, correct[ 12],  6, 0x655b59c3);
-    OP234 (FI, D, A, B, C, correct[  3], 10, 0x8f0ccc92);
-    OP234 (FI, C, D, A, B, correct[ 10], 15, 0xffeff47d);
-    OP234 (FI, B, C, D, A, correct[  1], 21, 0x85845dd1);
-    OP234 (FI, A, B, C, D, correct[  8],  6, 0x6fa87e4f);
-    OP234 (FI, D, A, B, C, correct[ 15], 10, 0xfe2ce6e0);
-    OP234 (FI, C, D, A, B, correct[  6], 15, 0xa3014314);
-    OP234 (FI, B, C, D, A, correct[ 13], 21, 0x4e0811a1);
-    OP234 (FI, A, B, C, D, correct[  4],  6, 0xf7537e82);
-    OP234 (FI, D, A, B, C, correct[ 11], 10, 0xbd3af235);
-    OP234 (FI, C, D, A, B, correct[  2], 15, 0x2ad7d2bb);
-    OP234 (FI, B, C, D, A, correct[  9], 21, 0xeb86d391);
-
-    /* Add the starting values of the context. */
-    A += A_save;
-    B += B_save;
-    C += C_save;
-    D += D_save;
-  }
-
-  /* Put checksum in context given as argument. */
-  md5_p->md_A = A;
-  md5_p->md_B = B;
-  md5_p->md_C = C;
-  md5_p->md_D = D;
-}
-
-/*
- * md5_get_result
- *
- * DESCRIPTION:
- *
- * Copy the resulting MD5 signature from MD5_P into the first 16 bytes
- * (MD5_SIZE) of the result buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure from which we are getting the result.
- *
- * result - A 16 byte buffer that will contain the MD5 signature.
- */
-static	void	md5_get_result(const md5_t *md5_p, void *result)
-{
-  md5_uint32	hold;
-  void		*res_p = result;
-
-  hold = SWAP(md5_p->md_A);
-  memcpy(res_p, &hold, sizeof(md5_uint32));
-  res_p = (char *)res_p + sizeof(md5_uint32);
-
-  hold = SWAP(md5_p->md_B);
-  memcpy(res_p, &hold, sizeof(md5_uint32));
-  res_p = (char *)res_p + sizeof(md5_uint32);
-
-  hold = SWAP(md5_p->md_C);
-  memcpy(res_p, &hold, sizeof(md5_uint32));
-  res_p = (char *)res_p + sizeof(md5_uint32);
-
-  hold = SWAP(md5_p->md_D);
-  memcpy(res_p, &hold, sizeof(md5_uint32));
-}
-
-/***************************** exported routines *****************************/
-
-/*
- * md5_init
- *
- * DESCRIPTION:
- *
- * Initialize structure containing state of MD5 computation. (RFC 1321,
- * 3.3: Step 3).  This is for progressive MD5 calculations only.  If
- * you have the complete string available, md5_buffer should be used.
- * md5_process should be called for each bunch of bytes and after the
- * last process call, md5_finish should be called to get the
- * signature.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to md5 structure that we are initializing.
- */
-void	md5_init(md5_t *md5_p)
-{
-  md5_p->md_A = 0x67452301;
-  md5_p->md_B = 0xefcdab89;
-  md5_p->md_C = 0x98badcfe;
-  md5_p->md_D = 0x10325476;
-
-  md5_p->md_total[0] = 0;
-  md5_p->md_total[1] = 0;
-  md5_p->md_buf_len = 0;
-}
-
-/*
- * md5_process
- *
- * DESCRIPTION:
- *
- * This function is used to progressively calculate a MD5 signature some
- * number of bytes at a time.  If you have the complete string
- * available, md5_buffer should be used.  The MD5 structure should
- * have been initialized with md5_init and after the last process
- * call, md5_finish should be called to get the results.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are progressively updating.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-void	md5_process(md5_t *md5_p, const void *buffer,
-		    const unsigned int buf_len)
-{
-  unsigned int	len = buf_len;
-  unsigned int	in_block, add;
-
-  /*
-   * When we already have some bytes in our internal buffer, copy some
-   * from the user to fill the block.
-   */
-  if (md5_p->md_buf_len > 0) {
-    
-    in_block = md5_p->md_buf_len;
-    if (in_block + len > sizeof(md5_p->md_buffer)) {
-      add = sizeof(md5_p->md_buffer) - in_block;
-    }
-    else {
-      add = len;
-    }
-
-    memcpy (md5_p->md_buffer + in_block, buffer, add);
-    md5_p->md_buf_len += add;
-    in_block += add;
-
-    if (in_block > MD5_BLOCK_SIZE) {
-      process_block (md5_p, md5_p->md_buffer, in_block & ~BLOCK_SIZE_MASK);
-      /* the regions in the following copy operation will not overlap. */
-      memcpy (md5_p->md_buffer,
-	      md5_p->md_buffer + (in_block & ~BLOCK_SIZE_MASK),
-	      in_block & BLOCK_SIZE_MASK);
-      md5_p->md_buf_len = in_block & BLOCK_SIZE_MASK;
-    }
-
-    buffer = (const char *)buffer + add;
-    len -= add;
-  }
-
-  /* process available complete blocks right from the user buffer */
-  if (len > MD5_BLOCK_SIZE) {
-    process_block (md5_p, buffer, len & ~BLOCK_SIZE_MASK);
-    buffer = (const char *) buffer + (len & ~BLOCK_SIZE_MASK);
-    len &= BLOCK_SIZE_MASK;
-  }
-
-  /* copy remaining bytes into the internal buffer */
-  if (len > 0) {
-    memcpy (md5_p->md_buffer, buffer, len);
-    md5_p->md_buf_len = len;
-  }
-}
-
-/*
- * md5_finish
- *
- * DESCRIPTION:
- *
- * Finish a progressing MD5 calculation and copy the resulting MD5
- * signature into the result buffer which should be 16 bytes
- * (MD5_SIZE).  After this call, the MD5 structure is invalid.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are finishing.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-void	md5_finish(md5_t *md5_p, void *signature)
-{
-  md5_uint32	bytes, hold;
-  int		pad;
-
-  /* take yet unprocessed bytes into account */
-  bytes = md5_p->md_buf_len;
-
-  /*
-   * Count remaining bytes.  Modified to do this to better avoid
-   * overflows in the lower word -- Gray 10/97.
-   */
-  if (md5_p->md_total[0] > MAX_MD5_UINT32 - bytes) {
-    md5_p->md_total[1]++;
-    md5_p->md_total[0] -= (MAX_MD5_UINT32 - bytes);
-  }
-  else {
-    md5_p->md_total[0] += bytes;
-  }
-
-  /*
-   * Pad the buffer to the next MD5_BLOCK-byte boundary.  (RFC 1321,
-   * 3.1: Step 1).  We need enough room for two size words and the
-   * bytes left in the buffer.  For some reason even if we are equal
-   * to the block-size, we add an addition block of pad bytes.
-   */
-  pad = MD5_BLOCK_SIZE - (sizeof(md5_uint32) * 2) - bytes;
-  if (pad <= 0) {
-    pad += MD5_BLOCK_SIZE;
-  }
-
-  /*
-   * Modified from a fixed array to this assignment and memset to be
-   * more flexible with block-sizes -- Gray 10/97.
-   */
-  if (pad > 0) {
-    /* some sort of padding start byte */
-    md5_p->md_buffer[bytes] = (unsigned char)0x80;
-    if (pad > 1) {
-      memset (md5_p->md_buffer + bytes + 1, 0, pad - 1);
-    }
-    bytes += pad;
-  }
-
-  /* put the 64-bit file length in _bits_ (i.e. *8) at the end of the buffer */
-  hold = SWAP(md5_p->md_total[0] << 3);
-  memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32));
-  bytes += sizeof(md5_uint32);
-
-  /* shift the high word over by 3 and add in the top 3 bits from the low */
-  hold = SWAP((md5_p->md_total[1] << 3) | (md5_p->md_total[0] >> 29));
-  memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32));
-  bytes += sizeof(md5_uint32);
-
-  /* process last bytes, the padding chars, and size words */
-  process_block(md5_p, md5_p->md_buffer, bytes);
-  md5_get_result(md5_p, signature);
-}
-
-/*
- * md5_buffer
- *
- * DESCRIPTION:
- *
- * This function is used to calculate a MD5 signature for a buffer of
- * bytes.  If you only have part of a buffer that you want to process
- * then md5_init, md5_process, and md5_finish should be used.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-void	md5_buffer(const char *buffer, const unsigned int buf_len,
-		   void *signature)
-{
-  md5_t		md5;
-
-  /* initialize the computation context */
-  md5_init(&md5);
-
-  /* process whole buffer but last buf_len % MD5_BLOCK bytes */
-  md5_process(&md5, buffer, buf_len);
-
-  /* put result in desired memory area */
-  md5_finish(&md5, signature);
-}
-
-/*
- * md5_sig_to_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
- * representation.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - a 16 byte buffer that contains the MD5 signature.
- *
- * str - a string of charactes which should be at least 33 bytes long (2
- * characters per MD5 byte and 1 for the \0).
- *
- * str_len - the length of the string.
- */
-void	md5_sig_to_string(void *signature, char *str, const int str_len)
-{
-  unsigned char	*sig_p;
-  char		*str_p, *max_p;
-  unsigned int	high, low;
-  
-  str_p = str;
-  max_p = str + str_len;
-  
-  for (sig_p = (unsigned char *)signature;
-       sig_p < (unsigned char *)signature + MD5_SIZE;
-       sig_p++) {
-    high = *sig_p / 16;
-    low = *sig_p % 16;
-    /* account for 2 chars */
-    if (str_p + 1 >= max_p) {
-      break;
-    }
-    *str_p++ = HEX_STRING[high];
-    *str_p++ = HEX_STRING[low];
-  }
-  /* account for 2 chars */
-  if (str_p < max_p) {
-    *str_p++ = '\0';
-  }
-}
-
-/*
- * md5_sig_from_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature from a hexadecimal string representation into
- * a 16 byte buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- *
- * str - A string of charactes which _must_ be at least 32 bytes long (2
- * characters per MD5 byte).
- */
-void	md5_sig_from_string(void *signature, const char *str)
-{
-  unsigned char	*sig_p;
-  const char	*str_p;
-  char		*hex;
-  unsigned int	high, low, val;
-  
-  hex = HEX_STRING;
-  sig_p = signature;
-  
-  for (str_p = str; str_p < str + MD5_SIZE * 2; str_p += 2) {
-    high = strchr(hex, *str_p) - hex;
-    low = strchr(hex, *(str_p + 1)) - hex;
-    val = high * 16 + low;
-    *sig_p++ = val;
-  }
-}
diff --git a/jackd/md5.h b/jackd/md5.h
deleted file mode 100644
index de5ddf3..0000000
--- a/jackd/md5.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Declaration of functions and data types used for MD5 sum computing
- * library functions.  Copyright (C) 1995, 1996 Free Software
- * Foundation, Inc.  NOTE: The canonical source of this file is
- * maintained with the GNU C Library.  Bugs can be reported to
- * bug-glibc at prep.ai.mit.edu.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- */
-
-/*
- * NOTE: during quick performance tests on a sun ultra and an alpha
- * 255 300, the md5 libraries performed upwards of 3mb/sec.  That
- * included disk i/o on bobcat and panther.
- */
-
-#ifndef __MD5_H__
-#define __MD5_H__
-
-/*
- * Size of a standard MD5 signature in bytes.  This definition is for
- * external programs only.  The MD5 routines themselves reference the
- * signature as 4 unsigned 32-bit integers.
- */
-#define MD5_SIZE	16
-
-/*
- * NOTE: the following is assumed to generate a 32-bit unsigned data
- * type.
- */
-typedef unsigned int		md5_uint32;
-#define MAX_MD5_UINT32		((md5_uint32)4294967295U)
-
-/*
- * The MD5 algorithm works on blocks of characters of 64 bytes.  This
- * is an internal value only and is not necessary for external use.
- */
-#define MD5_BLOCK_SIZE		64
-
-/*
- * Structure to save state of computation between the single steps.
- */
-typedef struct
-{
-  md5_uint32	md_A;			/* accumulater 1 */
-  md5_uint32	md_B;			/* accumulater 2 */
-  md5_uint32	md_C;			/* accumulater 3 */
-  md5_uint32	md_D;			/* accumulater 4 */
-
-  md5_uint32	md_total[2];		/* totaling storage */
-  md5_uint32	md_buf_len;		/* length of the storage buffer */
-  char		md_buffer[MD5_BLOCK_SIZE * 2];	/* character storage buffer */
-} md5_t;
-
-/*<<<<<<<<<<  The below prototypes are auto-generated by fillproto */
-
-/*
- * md5_init
- *
- * DESCRIPTION:
- *
- * Initialize structure containing state of MD5 computation. (RFC 1321,
- * 3.3: Step 3).  This is for progressive MD5 calculations only.  If
- * you have the complete string available, md5_buffer should be used.
- * md5_process should be called for each bunch of bytes and after the
- * last process call, md5_finish should be called to get the
- * signature.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to md5 structure that we are initializing.
- */
-extern
-void	md5_init(md5_t *md5_p);
-
-/*
- * md5_process
- *
- * DESCRIPTION:
- *
- * This function is used to progressively calculate a MD5 signature some
- * number of bytes at a time.  If you have the complete string
- * available, md5_buffer should be used.  The MD5 structure should
- * have been initialized with md5_init and after the last process
- * call, md5_finish should be called to get the results.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are progressively updating.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-extern
-void	md5_process(md5_t *md5_p, const void *buffer,
-		    const unsigned int buf_len);
-
-/*
- * md5_finish
- *
- * DESCRIPTION:
- *
- * Finish a progressing MD5 calculation and copy the resulting MD5
- * signature into the result buffer which should be 16 bytes
- * (MD5_SIZE).  After this call, the MD5 structure is invalid.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are finishing.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-extern
-void	md5_finish(md5_t *md5_p, void *signature);
-
-/*
- * md5_buffer
- *
- * DESCRIPTION:
- *
- * This function is used to calculate a MD5 signature for a buffer of
- * bytes.  If you only have part of a buffer that you want to process
- * then md5_init, md5_process, and md5_finish should be used.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-extern
-void	md5_buffer(const char *buffer, const unsigned int buf_len,
-		   void *signature);
-
-/*
- * md5_sig_to_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
- * representation.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - a 16 byte buffer that contains the MD5 signature.
- *
- * str - a string of charactes which should be at least 33 bytes long (2
- * characters per MD5 byte and 1 for the \0).
- *
- * str_len - the length of the string.
- */
-extern
-void	md5_sig_to_string(void *signature, char *str, const int str_len);
-
-/*
- * md5_sig_from_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature from a hexadecimal string representation into
- * a 16 byte buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- *
- * str - A string of charactes which _must_ be at least 32 bytes long (2
- * characters per MD5 byte).
- */
-extern
-void	md5_sig_from_string(void *signature, const char *str);
-
-/*<<<<<<<<<<   This is end of the auto-generated output from fillproto. */
-
-#endif /* ! __MD5_H__ */
-
diff --git a/jackd/md5_loc.h b/jackd/md5_loc.h
deleted file mode 100644
index cc1c085..0000000
--- a/jackd/md5_loc.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Local defines for the md5 functions.
- *
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it is
- * identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided that
- * such works are identified as "derived from the RSA Data Security,
- * Inc. MD5 Message-Digest Algorithm" in all material mentioning or
- * referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either the
- * merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is" without
- * express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#ifndef __MD5_LOC_H__
-#define __MD5_LOC_H__
-
-#define HEX_STRING	"0123456789abcdef"	/* to convert to hex */
-#define BLOCK_SIZE_MASK	(MD5_BLOCK_SIZE - 1)
-
-
-#include <config.h>
-
-/*
- * Define my endian-ness.  Could not do in a portable manner using the
- * include files -- grumble.
- */
-#ifdef WORDS_BIGENDIAN
-/*
- * big endian - big is better
- */
-#define SWAP(n)	\
-    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-#else
-/*
-	+ * little endian
-	+ */
-#define SWAP(n)    (n)
-#endif
-
-/*
- * These are the four functions used in the four steps of the MD5
- * algorithm and defined in the RFC 1321.  The first function is a
- * little bit optimized (as found in Colin Plumbs public domain
- * implementation).
- */
-/* #define FF(b, c, d) ((b & c) | (~b & d)) */
-#define FF(b, c, d)	(d ^ (b & (c ^ d)))
-#define FG(b, c, d)	FF(d, b, c)
-#define FH(b, c, d)	(b ^ c ^ d)
-#define FI(b, c, d)	(c ^ (b | ~d))
-
-/*
- * It is unfortunate that C does not provide an operator for cyclic
- * rotation.  Hope the C compiler is smart enough.  -- Modified to
- * remove the w = at the front - Gray 2/97
- */
-#define CYCLIC(w, s)	((w << s) | (w >> (32 - s)))
-
-/*
- * First Round: using the given function, the context and a constant
- * the next context is computed.  Because the algorithms processing
- * unit is a 32-bit word and it is determined to work on words in
- * little endian byte order we perhaps have to change the byte order
- * before the computation.  To reduce the work for the next steps we
- * store the swapped words in the array CORRECT_WORDS. -- Modified to
- * fix the handling of unaligned buffer spaces - Gray 7/97
- */
-#define OP1(a, b, c, d, b_p, c_p, s, T)				\
-     do {							\
-       memcpy(c_p, b_p, sizeof(md5_uint32));       		\
-       *c_p = SWAP(*c_p);					\
-       a += FF (b, c, d) + *c_p + T;				\
-       a = CYCLIC (a, s);					\
-       a += b;							\
-       b_p = (char *)b_p + sizeof(md5_uint32);			\
-       c_p++;							\
-    } while (0)
-
-/*
- * Second to Fourth Round: we have the possibly swapped words in
- * CORRECT_WORDS.  Redefine the macro to take an additional first
- * argument specifying the function to use.
- */
-#define OP234(FUNC, a, b, c, d, k, s, T)		\
-    do { 						\
-      a += FUNC (b, c, d) + k + T;			\
-      a = CYCLIC (a, s);				\
-      a += b;						\
-    } while (0)
-
-#endif /* ! __MD5_LOC_H__ */
diff --git a/jackd/transengine.c b/jackd/transengine.c
deleted file mode 100644
index aea1d0a..0000000
--- a/jackd/transengine.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
-    JACK transport engine -- runs in the server process.
-
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2003 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License as
-    published by the Free Software Foundation; either version 2 of the
-    License, or (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <config.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/messagebuffer.h>
-#include "transengine.h"
-
-/********************** internal functions **********************/
-
-/* initiate polling a new slow-sync client
- *
- *   precondition: caller holds the graph lock. */
-static inline void
-jack_sync_poll_new (jack_engine_t *engine, jack_client_internal_t *client)
-{
-	/* force sync_cb callback to run in its first cycle */
-	engine->control->sync_time_left = engine->control->sync_timeout;
-	client->control->sync_new = 1;
-	if (!client->control->sync_poll) {
-		client->control->sync_poll = 1;
-		engine->control->sync_remain++;
-	}
-
-	// JOQ: I don't like doing this here...
-	if (engine->control->transport_state == JackTransportRolling) {
-		engine->control->transport_state = JackTransportStarting;
-		VERBOSE (engine, "force transport state to Starting");
-	}
-
-	VERBOSE (engine, "polling sync client %" PRIu32,
-		 client->control->id);
-}
-
-/* stop polling a specific slow-sync client
- *
- *   precondition: caller holds the graph lock. */
-static inline void
-jack_sync_poll_deactivate (jack_engine_t *engine,
-			   jack_client_internal_t *client)
-{
-	if (client->control->sync_poll) {
-		client->control->sync_poll = 0;
-		client->control->sync_new = 0;
-		engine->control->sync_remain--;
-		VERBOSE (engine, "sync poll interrupted for client %"
-			 PRIu32, client->control->id);
-	}
-	client->control->active_slowsync = 0;
-	engine->control->sync_clients--;
-	assert(engine->control->sync_clients >= 0);
-}
-
-/* stop polling all the slow-sync clients
- *
- *   precondition: caller holds the graph lock. */
-static void
-jack_sync_poll_stop (jack_engine_t *engine)
-{
-	JSList *node;
-	long poll_count = 0;		/* count sync_poll clients */
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		jack_client_internal_t *client =
-			(jack_client_internal_t *) node->data;
-		if (client->control->active_slowsync &&
-		    client->control->sync_poll) {
-			client->control->sync_poll = 0;
-			poll_count++;
-		}
-	}
-
-	//JOQ: check invariant for debugging...
-	assert (poll_count == engine->control->sync_remain);
-	VERBOSE (engine,
-		 "sync poll halted with %" PRIu32
-		 " clients and %8.6f secs remaining",
-		 engine->control->sync_remain,
-		 (double) (engine->control->sync_time_left / 1000000.0));
-	engine->control->sync_remain = 0;
-	engine->control->sync_time_left = 0;
-}
-
-/* start polling all the slow-sync clients
- *
- *   precondition: caller holds the graph lock. */
-static void
-jack_sync_poll_start (jack_engine_t *engine)
-{
-	JSList *node;
-	long sync_count = 0;		/* count slow-sync clients */
-
-	for (node = engine->clients; node; node = jack_slist_next (node)) {
-		jack_client_internal_t *client =
-			(jack_client_internal_t *) node->data;
-		if (client->control->active_slowsync) {
-			client->control->sync_poll = 1;
-			sync_count++;
-		}
-	}
-
-	//JOQ: check invariant for debugging...
-	assert (sync_count == engine->control->sync_clients);
-	engine->control->sync_remain = sync_count;
-	engine->control->sync_time_left = engine->control->sync_timeout;
-	VERBOSE (engine, "transport Starting, sync poll of %" PRIu32
-		 " clients for %8.6f secs", engine->control->sync_remain,
-		 (double) (engine->control->sync_time_left / 1000000.0));
-}
-
-/* check for sync timeout */
-static inline int
-jack_sync_timeout (jack_engine_t *engine)
-{
-	jack_control_t *ectl = engine->control;
-	jack_time_t buf_usecs =
-		((ectl->buffer_size * (jack_time_t) 1000000) /
-		 ectl->current_time.frame_rate);
-
-	/* compare carefully, jack_time_t is unsigned */
-	if (ectl->sync_time_left > buf_usecs) {
-		ectl->sync_time_left -= buf_usecs;
-		return FALSE;
-	}
-
-	/* timed out */
-	VERBOSE (engine, "transport sync timeout");
-	ectl->sync_time_left = 0;
-	return TRUE;
-}
-
-
-/**************** subroutines used by engine.c ****************/
-
-/* driver callback */
-int
-jack_set_sample_rate (jack_engine_t *engine, jack_nframes_t nframes)
-{
-	jack_control_t *ectl = engine->control;
-
-	ectl->current_time.frame_rate = nframes;
-	ectl->pending_time.frame_rate = nframes;
-	return 0;
-}
-
-/* on ResetTimeBaseClient request */
-int
-jack_timebase_reset (jack_engine_t *engine, jack_client_id_t client_id)
-{
-	int ret;
-	struct _jack_client_internal *client;
-	jack_control_t *ectl = engine->control;
-
-	jack_lock_graph (engine);
-
-	client = jack_client_internal_by_id (engine, client_id);
-	if (client && (client == engine->timebase_client)) {
-		client->control->is_timebase = 0;
-		client->control->timebase_new = 0;
-		engine->timebase_client = NULL;
-		ectl->pending_time.valid = 0;
-		VERBOSE (engine, "%s resigned as timebase master",
-			 client->control->name);
-		ret = 0;
-	}  else
-		ret = EINVAL;
-
-	jack_unlock_graph (engine);
-
-	return ret;
-}
-
-/* on SetTimeBaseClient request */
-int
-jack_timebase_set (jack_engine_t *engine,
-		   jack_client_id_t client_id, int conditional)
-{
-	int ret = 0;
-	struct _jack_client_internal *client;
-
-	jack_lock_graph (engine);
-
-	client = jack_client_internal_by_id (engine, client_id);
-
-	if (client == NULL) {
- 		VERBOSE (engine, " %" PRIu32 " no longer exists", client_id);
-		jack_unlock_graph (engine);
-		return EINVAL;
-	}
-
-	if (conditional && engine->timebase_client) {
-
-		/* see if timebase master is someone else */
-		if (client != engine->timebase_client) {
-			VERBOSE (engine, "conditional timebase for %s failed",
-				 client->control->name);
-			VERBOSE (engine, " %s is already the master",
-				 engine->timebase_client->control->name);
-			ret = EBUSY;
-		} else
-			VERBOSE (engine, " %s was already timebase master:",
-				 client->control->name);
-
-	} else {
-
-		if (engine->timebase_client) {
-			engine->timebase_client->control->is_timebase = 0;
-			engine->timebase_client->control->timebase_new = 0;
-		}
-		engine->timebase_client = client;
-		client->control->is_timebase = 1;
-		if (client->control->active)
-			client->control->timebase_new = 1;
-		VERBOSE (engine, "new timebase master: %s",
-			 client->control->name);
-	}
-
-	jack_unlock_graph (engine);
-
-	return ret;
-}
-
-/* for client activation
- *
- *   precondition: caller holds the graph lock. */
-void
-jack_transport_activate (jack_engine_t *engine, jack_client_internal_t *client)
-{
-	if (client->control->is_slowsync) {
-		assert(!client->control->active_slowsync);
-		client->control->active_slowsync = 1;
-		engine->control->sync_clients++;
-		jack_sync_poll_new (engine, client);
-	}
-
-	if (client->control->is_timebase) {
-		client->control->timebase_new = 1;
-	}
-}
-
-/* for engine initialization */
-void
-jack_transport_init (jack_engine_t *engine)
-{
-	jack_control_t *ectl = engine->control;
-
-	engine->timebase_client = NULL;
-	ectl->transport_state = JackTransportStopped;
-	ectl->transport_cmd = TransportCommandStop;
-	ectl->previous_cmd = TransportCommandStop;
-	memset (&ectl->current_time, 0, sizeof(ectl->current_time));
-	memset (&ectl->pending_time, 0, sizeof(ectl->pending_time));
-	memset (&ectl->request_time, 0, sizeof(ectl->request_time));
-	ectl->prev_request = 0;
-	ectl->seq_number = 1;		/* can't start at 0 */
-	ectl->new_pos = 0;
-	ectl->pending_pos = 0;
-	ectl->pending_frame = 0;
-	ectl->sync_clients = 0;
-	ectl->sync_remain = 0;
-	ectl->sync_timeout = 2000000;	/* 2 second default */
-	ectl->sync_time_left = 0;
-}
-
-/* when any client exits the graph (either dead or not active)
- *
- * precondition: caller holds the graph lock */
-void
-jack_transport_client_exit (jack_engine_t *engine,
-			    jack_client_internal_t *client)
-{
-	if (client == engine->timebase_client) {
-		if (client->control->dead) {
-			engine->timebase_client->control->is_timebase = 0;
-			engine->timebase_client->control->timebase_new = 0;
-			engine->timebase_client = NULL;
-			VERBOSE (engine, "timebase master exit");
-		}
-		engine->control->current_time.valid = 0;
-		engine->control->pending_time.valid = 0;
-	}
-
-	if (client->control->is_slowsync) {
-		if (client->control->active_slowsync)
-			jack_sync_poll_deactivate (engine, client);
-		if (client->control->dead)
-			client->control->is_slowsync = 0;
-	}
-}
-
-/* when a new client is being created */
-void	
-jack_transport_client_new (jack_client_internal_t *client)
-{
-	client->control->is_timebase = 0;
-	client->control->timebase_new = 0;
-	client->control->is_slowsync = 0;
-	client->control->active_slowsync = 0;
-	client->control->sync_poll = 0;
-	client->control->sync_new = 0;
-	
-	client->control->sync_cb_cbset = FALSE;
-	client->control->timebase_cb_cbset = FALSE;
-
-#if 0
-	if (client->control->type != ClientExternal) {
-	client->sync_cb = NULL;
-	client->sync_arg = NULL;
-	client->timebase_cb = NULL;
-	client->timebase_arg = NULL;
-	}
-#endif
-}
-
-/* on ResetSyncClient request */
-int
-jack_transport_client_reset_sync (jack_engine_t *engine,
-				  jack_client_id_t client_id)
-{
-	int ret;
-	jack_client_internal_t *client;
-
-	jack_lock_graph (engine);
-
-	client = jack_client_internal_by_id (engine, client_id);
-
-	if (client && (client->control->is_slowsync)) {
-		if (client->control->active_slowsync)
-			jack_sync_poll_deactivate (engine, client);
-		client->control->is_slowsync = 0;
-		ret = 0;
-	}  else
-		ret = EINVAL;
-
-	jack_unlock_graph (engine);
-
-	return ret;
-}
-
-/* on SetSyncClient request */
-int
-jack_transport_client_set_sync (jack_engine_t *engine,
-				jack_client_id_t client_id)
-{
-	int ret;
-	jack_client_internal_t *client;
-
-	DEBUG ("set sync client");
-
-	/* The process cycle runs with this lock. */
-	jack_lock_graph (engine);
-
-	DEBUG ("got write lock");
-
-	client = jack_client_internal_by_id (engine, client_id);
-
-	DEBUG ("client was %p");
-
-	if (client) {
-		if (!client->control->is_slowsync) {
-			client->control->is_slowsync = 1;
-			if (client->control->active) {
-				client->control->active_slowsync = 1;
-				engine->control->sync_clients++;
-			}
-		}
-
-		/* force poll of the new slow-sync client, if active */
-		if (client->control->active_slowsync) {
-			DEBUG ("sync poll new");
-			jack_sync_poll_new (engine, client);
-		}
-		ret = 0;
-	}  else
-		ret = EINVAL;
-
-	DEBUG ("unlocking write lock for set_sync");
-	jack_unlock_graph (engine);
-
-
-	return ret;
-}
-
-/* at process cycle end, set transport parameters for the next cycle
- *
- * precondition: caller holds the graph lock.
- */
-void
-jack_transport_cycle_end (jack_engine_t *engine)
-{
-	jack_control_t *ectl = engine->control;
-	transport_command_t cmd;	/* latest transport command */
-
-	/* Promote pending_time to current_time.  Maintain the usecs,
-	 * frame_rate and frame values, clients may not set them. */
-	ectl->pending_time.usecs = ectl->current_time.usecs;
-	ectl->pending_time.frame_rate = ectl->current_time.frame_rate;
-	ectl->pending_time.frame = ectl->pending_frame;
-	ectl->current_time = ectl->pending_time;
-	ectl->new_pos = ectl->pending_pos;
-
-	/* check sync results from previous cycle */
-	if (ectl->transport_state == JackTransportStarting) {
-		if ((ectl->sync_remain == 0) ||
-		    (jack_sync_timeout(engine))) {
-			ectl->transport_state = JackTransportRolling;
-			VERBOSE (engine, "transport Rolling, %8.6f sec"
-				 " left for poll",
-				 (double) (ectl->sync_time_left / 1000000.0));
-		}
-	}
-
-	/* Handle any new transport command from the last cycle. */
-	cmd = ectl->transport_cmd;
-	if (cmd != ectl->previous_cmd) {
-		ectl->previous_cmd = cmd;
-		VERBOSE (engine, "transport command: %s",
-		       (cmd == TransportCommandStart? "START": "STOP"));
-	} else
-		cmd = TransportCommandNone;
-
-	/* state transition switch */
-
-	switch (ectl->transport_state) {
-
-	case JackTransportStopped:
-		if (cmd == TransportCommandStart) {
-			if (ectl->sync_clients) {
-				ectl->transport_state = JackTransportStarting;
-				jack_sync_poll_start(engine);
-			} else {
-				ectl->transport_state = JackTransportRolling;
-				VERBOSE (engine, "transport Rolling");
-			}
-		}
-		break;
-
-	case JackTransportStarting:
-		if (cmd == TransportCommandStop) {
-			ectl->transport_state = JackTransportStopped;
-			VERBOSE (engine, "transport Stopped");
-			if (ectl->sync_remain)
-				jack_sync_poll_stop(engine);
-		} else if (ectl->new_pos) {
-			if (ectl->sync_clients) {
-				ectl->transport_state = JackTransportStarting;
-				jack_sync_poll_start(engine);
-			} else {
-				ectl->transport_state = JackTransportRolling;
-				VERBOSE (engine, "transport Rolling");
-			}
-		}
-		break;
-
-	case JackTransportRolling:
-		if (cmd == TransportCommandStop) {
-			ectl->transport_state = JackTransportStopped;
-			VERBOSE (engine, "transport Stopped");
-			if (ectl->sync_remain)
-				jack_sync_poll_stop(engine);
-		} else if (ectl->new_pos) {
-			if (ectl->sync_clients) {
-				ectl->transport_state = JackTransportStarting;
-				jack_sync_poll_start(engine);
-			}
-		}
-		break;
-
-	default:
-		jack_error ("invalid JACK transport state: %d",
-			    ectl->transport_state);
-	}
-
-	/* Update timebase, if needed. */
-	if (ectl->transport_state == JackTransportRolling) {
-		ectl->pending_time.frame =
-			ectl->current_time.frame + ectl->buffer_size;
-	} 
-
-	/* See if an asynchronous position request arrived during the
-	 * last cycle.  The request_time could change during the
-	 * guarded copy.  If so, we use the newest request. */
-	ectl->pending_pos = 0;
-	if (ectl->request_time.unique_1 != ectl->prev_request) {
-		jack_transport_copy_position(&ectl->request_time,
-					     &ectl->pending_time);
-		VERBOSE (engine, "new transport position: %" PRIu32
-			 ", id=0x%" PRIx64, ectl->pending_time.frame,
-			 ectl->pending_time.unique_1);
-		ectl->prev_request = ectl->pending_time.unique_1;
-		ectl->pending_pos = 1;
-	}
-
-	/* clients can't set pending frame number, so save it here */
-	ectl->pending_frame = ectl->pending_time.frame;
-}
-
-/* driver callback at start of cycle */
-void 
-jack_transport_cycle_start (jack_engine_t *engine, jack_time_t time)
-{
-	engine->control->current_time.usecs = time;
-}
-
-/* on SetSyncTimeout request */
-int	
-jack_transport_set_sync_timeout (jack_engine_t *engine,
-				 jack_time_t usecs)
-{
-	engine->control->sync_timeout = usecs;
-	VERBOSE (engine, "new sync timeout: %8.6f secs",
-		 (double) (usecs / 1000000.0));
-	return 0;
-}
diff --git a/jackd/transengine.h b/jackd/transengine.h
deleted file mode 100644
index 9bd238d..0000000
--- a/jackd/transengine.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-    Internal interfaces for JACK transport engine.
-
-    Copyright (C) 2003 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License as
-    published by the Free Software Foundation; either version 2 of the
-    License, or (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-int	jack_set_sample_rate (jack_engine_t *engine, jack_nframes_t nframes);
-int	jack_timebase_reset (jack_engine_t *engine,
-			     jack_client_id_t client_id);
-int	jack_timebase_set (jack_engine_t *engine,
-			   jack_client_id_t client_id, int conditional);
-void	jack_transport_activate (jack_engine_t *engine,
-				 jack_client_internal_t *client);
-void	jack_transport_init (jack_engine_t *engine);
-void	jack_transport_client_exit (jack_engine_t *engine,
-				    jack_client_internal_t *client);
-void	jack_transport_client_new (jack_client_internal_t *client);
-int	jack_transport_client_reset_sync (jack_engine_t *engine,
-					  jack_client_id_t client_id);
-int	jack_transport_client_set_sync (jack_engine_t *engine,
-					jack_client_id_t client_id);
-void	jack_transport_cycle_end (jack_engine_t *engine);
-void	jack_transport_cycle_start(jack_engine_t *engine, jack_time_t time);
-int	jack_transport_set_sync_timeout (jack_engine_t *engine,
-					 jack_time_t usecs);
diff --git a/libjack/.cvsignore b/libjack/.cvsignore
deleted file mode 100644
index a992f83..0000000
--- a/libjack/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.loT
-*.la
diff --git a/libjack/ChangeLog b/libjack/ChangeLog
deleted file mode 100644
index 4986017..0000000
--- a/libjack/ChangeLog
+++ /dev/null
@@ -1,156 +0,0 @@
-2005-04-15  Paul Davis  <paul>
-
-	* change the way threads get RT scheduling. it is now requested by
-	the thread rather than assigned by the thread's parent. in cases
-	where capabilities are used, the child is also given capabilities
-	so that it can release + re-acquire RT scheduling as needed.
-	
-	* prevent watchdog from killing anything is JACK is freewheeling.
-
-2004-12-31  Jack O'Quin  <joq at io.com>
-
-	* new header file: <jack/statistics.h>
-
-2004-12-27  Jack O'Quin  <joq at io.com>
-
-	* new API functions jack_get_max_delayed_usecs() and
-	jack_reset_max_delayed_usecs()
-
-	* add US-X2Y USB device support to ALSA backend
-
-2004-11-28  Jack O'Quin  <joq at io.com>
-
-	* removed deprecated function jack_set_server_dir().
-
-2004-11-27  Jack O'Quin  <joq at io.com>
-
-	* new API functions: jack_internal_client_handle(),
-	jack_internal_client_load(), jack_get_internal_client_name(),
-	jack_internal_client_unload().  See: <jack/intclient.h>.
-
-2004-10-14  Jack O'Quin  <joq at io.com>
-
-	* new API function: jack_get_xrun_delayed_usecs()
-
-2004-10-08  Jack O'Quin  <joq at io.com>
-
-	* new API functions: jack_client_open(), jack_get_client_name()
-
-2004-09-15  Jack O'Quin  <joq at io.com>
-
-	* new API functions from <jack/thread.h>
-
-2004-07-08  Jack O'Quin  <joq at io.com>
-
-	* add jack_ringbuffer_peek()
-
-2004-02-19  Jack O'Quin  <joq at io.com>
-
-	* new API functions:
-
-	  int jack_client_name_size(void);
-	  int jack_port_name_size(void);
-	  int jack_port_type_size(void);
-
-2004-02-16  Jack O'Quin  <joq at io.com>
-
-	* Changed JACK_PORT_NAME_SIZE from 32 to 256
-
-	This could affect some client that defines its own value.
-
-2003-10-15  Paul Davis <paul at linuxaudiosystems.com>
-
-	* new ring buffer interface: <jack/ringbuffer.h>
-
-2003-10-07  Paul Davis <paul at linuxaudiosystems.com>
-
-	* new function jack_set_freewheel().
-
-	No compatibility issues: this introduces new functionality to 
-	JACK and doesn't alter any existing functionality.
-
-2003-09-18  Jack O'Quin  <joq at io.com>
-
-	* new function jack_set_buffer_size().  
-
-	Compatibility issues: programs that rely on the buffer size but do
-	not register a callback will fail.  Cached output buffer addresses
-	are not valid after the buffer size changes.  These rules existed
-	before, but were never enforced.
-
-2003-08-26  Jack O'Quin  <joq at io.com>
-
-	* <jack/types.h> typedefs are now defined using the C99 standard
-	fixed-size integer typedefs.  These new typedefs are binary
-	compatible with 32-bit platforms, but not 64-bit machines.  
-
-	Programs using printf on these values will get GCC compiler
-	warnings.  To suppress the warnings, use the corresponding C99
-	printf specifications defined in <inttypes.h>.  That header is
-	already implicitly included by <jack/types.h>, but can also be
-	included explicitly to maintain compatibility with older versions
-	of JACK without messy #ifdef's.  Adding explicit casts will also
-	work, but may suppress future warnings you might want to see.
-
-	* jack_get_sample_rate() now returns jack_nframes_t rather than
-	unsigned long.  These are the same on 32-bit machines, but not on
-	64-bit platforms.
-
-2003-08-13  Jack O'Quin  <joq at io.com>
-
-	* Many new transport interfaces.  It would be silly to list them
-	all here.  Please see the new transport control section in the
-	JACK reference manual.
-
-	* jack_set_transport_info() and jack_engine_takeover_timebase(),
-	(the old timebase master interfaces) now do nothing.  Instead, use
-	jack_set_timebase_callback().
-
-2003-05-09  Jack O'Quin  <joq at io.com>
-
-	* Added new jack_is_realtime() function.
-
-2003-02-23  Paul Davis  <paul>
-
-	* client.c: 
-		 
-		added deliver_request().
-		removed all use of strncpy().
-		changed ClientDynamic to ClientInProcess.
-
-2003-02-10  Taybin Rutkin <trutkin at physics.clarku.edu>
-
-	* client.c (jack_client_new): Checks jack_protocol_version returned
-	from jackd.
-
-2003-02-05  Kai Vehmanen  <kai.vehmanen at wakkanet.fi>
-
-	* client.c (jack_set_buffer_size_callback): This function is now 
-	deprecated.
-
-2002-12-20  Paul Davis  <paul>
-
-	* error.h (jack_set_error_function): added
-
-2002-12-16  Paul Davis  <paul>
-
-	* jack.h: added inclusion of pthread.h
-
-2002-12-09  Paul Davis  <paul>
-	
-	* jack.h (jack_client_new_inprocess): prototype for in-process client creation (not implemented)
-
-	* jack.h (jack_client_thread_id): added so that clients can easily
-	find out the pthread_t that is running the JACK client code. this
-	turns out to be critical to handling the SIGHUP.
-
-2002-11-15  Paul Davis  <paul>
-
-	* client.c: added port alias functions. untested.
-
-2002-11-05  Kai Vehmanen  <kai.vehmanen at wakkanet.fi>
-
-	* Created this file. Current JACK version is 
-	0.39.0 and libjack interface 0:5:0. See 
-	jack/README.developers for details on how to 
-	use this file.
diff --git a/libjack/Makefile.am b/libjack/Makefile.am
deleted file mode 100644
index 178616f..0000000
--- a/libjack/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-MAINTAINERCLEANFILES    = Makefile.in
-
-if USE_POSIX_SHM
-install-exec-hook:
-	@echo "Nothing to make for $@."
-else
-install-exec-hook:
-	@echo "Removing JACK shared memory registry key " $(JACK_SEMAPHORE_KEY)
-	-ipcrm -M $(JACK_SEMAPHORE_KEY)
-endif
-
-SOURCE_FILES = \
-	     client.c \
-	     intclient.c \
-	     messagebuffer.c \
-	     pool.c \
-	     port.c \
-             midiport.c \
-	     ringbuffer.c \
-	     shm.c \
-	     thread.c \
-             time.c \
-	     timestamps.c \
-	     transclient.c \
-	     unlock.c
-
-simd.lo: $(srcdir)/simd.c
-	$(LIBTOOL) --mode=compile $(CC) -I$(top_builddir) $(JACK_CORE_CFLAGS) $(SIMD_CFLAGS) -c -o simd.lo $(srcdir)/simd.c
-
-lib_LTLIBRARIES	= libjack.la
-
-noinst_HEADERS	= local.h
-
-AM_CFLAGS = $(JACK_CFLAGS) -DJACK_LOCATION=\"$(bindir)\"
-AM_CXXFLAGS = $(JACK_CFLAGS)
-
-libjack_la_CFLAGS = $(AM_CFLAGS)
-
-libjack_la_SOURCES = $(SOURCE_FILES)
-libjack_la_LIBADD  = simd.lo @OS_LDFLAGS@
-libjack_la_LDFLAGS  = -export-dynamic -version-info @JACK_SO_VERSION@
-
diff --git a/libjack/client.c b/libjack/client.c
deleted file mode 100644
index 3589896..0000000
--- a/libjack/client.c
+++ /dev/null
@@ -1,2574 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2005 Jussi Laako
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include <config.h>
-
-#include <pthread.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <limits.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <regex.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/mman.h>
-
-#include <jack/internal.h>
-#include <jack/jack.h>
-#include <jack/engine.h>
-#include <jack/pool.h>
-#include <jack/jslist.h>
-#include <jack/version.h>
-#include <jack/shm.h>
-#include <jack/unlock.h>
-#include <jack/thread.h>
-#include <jack/varargs.h>
-#include <jack/intsimd.h>
-
-#include <sysdeps/time.h>
-
-#include "local.h"
-
-#include <sysdeps/poll.h>
-#include <sysdeps/ipc.h>
-#include <sysdeps/cycles.h>
-
-#ifdef JACK_USE_MACH_THREADS
-#include <sysdeps/pThreadUtilities.h>
-#endif
-
-static pthread_mutex_t client_lock;
-static pthread_cond_t  client_ready;
-
-static int
-jack_client_close_aux (jack_client_t *client);
-
-#define EVENT_POLL_INDEX 0
-#define WAIT_POLL_INDEX 1
-#define event_fd pollfd[EVENT_POLL_INDEX].fd
-#define graph_wait_fd pollfd[WAIT_POLL_INDEX].fd
-
-typedef struct {
-    int status;
-    struct _jack_client *client;
-    const char *client_name;
-} client_info;
-
-#ifdef USE_DYNSIMD
-
-#ifdef ARCH_X86
-
-int cpu_type = 0;
-
-static void
-init_cpu ()
-{
-	cpu_type = ((have_3dnow() << 8) | have_sse());
-	if (ARCH_X86_HAVE_3DNOW(cpu_type))
-		jack_info("Enhanced3DNow! detected");
-	if (ARCH_X86_HAVE_SSE2(cpu_type))
-		jack_info("SSE2 detected");
-	if ((!ARCH_X86_HAVE_3DNOW(cpu_type)) && (!ARCH_X86_HAVE_SSE2(cpu_type)))
-		jack_info("No supported SIMD instruction sets detected");
-	jack_port_set_funcs();
-}
-
-#else /* ARCH_X86 */
-
-static void
-init_cpu ()
-{
-	jack_port_set_funcs();
-}
-
-#endif /* ARCH_X86 */
-
-#endif /* USE_DYNSIMD */
-
-char *jack_tmpdir = DEFAULT_TMP_DIR;
-
-static int
-jack_get_tmpdir ()
-{
-	FILE* in;
-	size_t len;
-	char buf[PATH_MAX+2]; /* allow tmpdir to live anywhere, plus newline, plus null */
-	char *pathenv;
-	char *pathcopy;
-	char *p;
-
-	/* some implementations of popen(3) close a security loophole by
-	   resetting PATH for the exec'd command. since we *want* to
-	   use the user's PATH setting to locate jackd, we have to
-	   do it ourselves.
-	*/
-
-	if ((pathenv = getenv ("PATH")) == 0) {
-		return -1;
-	}
-
-	/* don't let strtok(3) mess with the real environment variable */
-
-	if ((pathcopy = strdup (pathenv)) == NULL) {
-		return -1;
-	}
-	p = strtok (pathcopy, ":");
-
-	while (p) {
-		char jackd[PATH_MAX+1];
-		char command[PATH_MAX+4];
-
-		snprintf (jackd, sizeof (jackd), "%s/jackd", p);
-		
-		if (access (jackd, X_OK) == 0) {
-			
-			snprintf (command, sizeof (command), "%s -l", jackd);
-
-			if ((in = popen (command, "r")) != NULL) {
-				break;
-			}
-		}
-
-		p = strtok (NULL, ":");
-	}
-
-	if (p == NULL) {
-		/* no command successfully started */
-		free (pathcopy);
-		return -1;
-	}
-
-	if (fgets (buf, sizeof (buf), in) == NULL) {
-		fclose (in);
-		free (pathcopy);
-		return -1;
-	}
-
-	len = strlen (buf);
-
-	if (buf[len-1] != '\n') {
-		/* didn't get a whole line */
-		fclose (in);
-		free (pathcopy);
-		return -1;
-	}
-
-	if ((jack_tmpdir = (char *) malloc (len)) == NULL) {
-		free (pathcopy);
-		return -1;
-	}
-
-	memcpy (jack_tmpdir, buf, len-1);
-	jack_tmpdir[len-1] = '\0';
-	
-	fclose (in);
-	free (pathcopy);
-
-	return 0;
-}
-
-void 
-jack_error (const char *fmt, ...)
-{
-	va_list ap;
-	char buffer[300];
-
-	va_start (ap, fmt);
-	vsnprintf (buffer, sizeof(buffer), fmt, ap);
-	jack_error_callback (buffer);
-	va_end (ap);
-}
-
-void 
-default_jack_error_callback (const char *desc)
-{
-#ifdef DEBUG_ENABLED
-	DEBUG("%s", desc);
-#else
-	fprintf(stderr, "%s\n", desc);
-	fflush(stderr);
-#endif
-}
-
-void 
-default_jack_info_callback (const char *desc)
-{
-	fprintf(stdout, "%s\n", desc);
-	fflush(stdout);
-}
-
-void 
-silent_jack_error_callback (const char *desc)
-{
-}
-
-void (*jack_error_callback)(const char *desc) = &default_jack_error_callback;
-void (*jack_info_callback)(const char *desc) = &default_jack_info_callback;
-
-void 
-jack_info (const char *fmt, ...)
-{
-	va_list ap;
-	char buffer[300];
-
-	va_start (ap, fmt);
-	vsnprintf (buffer, sizeof(buffer), fmt, ap);
-	jack_info_callback (buffer);
-	va_end (ap);
-}
-
-static int
-oop_client_deliver_request (void *ptr, jack_request_t *req)
-{
-	int wok, rok;
-	jack_client_t *client = (jack_client_t*) ptr;
-
-	wok = (write (client->request_fd, req, sizeof (*req))
-	       == sizeof (*req));
-	rok = (read (client->request_fd, req, sizeof (*req))
-	       == sizeof (*req));
-
-	if (wok && rok) {		/* everything OK? */
-		return req->status;
-	}
-
-	req->status = -1;		/* request failed */
-
-	/* check for server shutdown */
-	if (client->engine->engine_ok == 0)
-		return req->status;
-
-	/* otherwise report errors */
-	if (!wok)
-		jack_error ("cannot send request type %d to server",
-				    req->type);
-	if (!rok)
-		jack_error ("cannot read result for request type %d from"
-			    " server (%s)", req->type, strerror (errno));
-	return req->status;
-}
-
-int
-jack_client_deliver_request (const jack_client_t *client, jack_request_t *req)
-{
-	/* indirect through the function pointer that was set either
-	 * by jack_client_open() or by jack_new_client_request() in
-	 * the server.
-	 */
-
-	return client->deliver_request (client->deliver_arg,
-						 req);
-}
-
-#if JACK_USE_MACH_THREADS 
-
-jack_client_t *
-jack_client_alloc ()
-{
-	jack_client_t *client;
-
-	if ((client = (jack_client_t *) malloc (sizeof (jack_client_t))) == NULL) {
-		return NULL;
-	}
-
-	if ((client->pollfd = (struct pollfd *) malloc (sizeof (struct pollfd) * 1)) == NULL) {
-		free (client);
-		return NULL;
-	}
-
-	client->pollmax = 1;
-	client->request_fd = -1;
-	client->event_fd = -1;
-	client->upstream_is_jackd = 0;
-	client->graph_wait_fd = -1;
-	client->graph_next_fd = -1;
-	client->ports = NULL;
-	client->ports_ext = NULL;
-	client->engine = NULL;
-	client->control = NULL;
-	client->thread_ok = FALSE;
-	client->rt_thread_ok = FALSE;
-	client->first_active = TRUE;
-	client->on_shutdown = NULL;
-	client->on_info_shutdown = NULL;
-	client->n_port_types = 0;
-	client->port_segment = NULL;
-
-#ifdef USE_DYNSIMD
-	init_cpu();
-#endif /* USE_DYNSIMD */
-
-	return client;
-}
-
-#else
-
-jack_client_t *
-jack_client_alloc ()
-{
-	jack_client_t *client;
-
-	if ((client = (jack_client_t *) malloc (sizeof (jack_client_t))) == NULL) {
-		return NULL;
-	}
-	if ((client->pollfd = (struct pollfd *) malloc (sizeof (struct pollfd) * 2)) == NULL) {
-		free (client);
-		return NULL;
-	}
-
-	client->pollmax = 2;
-	client->request_fd = -1;
-	client->event_fd = -1;
-	client->upstream_is_jackd = 0;
-	client->graph_wait_fd = -1;
-	client->graph_next_fd = -1;
-	client->ports = NULL;
-	client->ports_ext = NULL;
-	client->engine = NULL;
-	client->control = NULL;
-	client->thread_ok = FALSE;
-	client->first_active = TRUE;
-	client->on_shutdown = NULL;
-	client->on_info_shutdown = NULL;
-	client->n_port_types = 0;
-	client->port_segment = NULL;
-
-#ifdef USE_DYNSIMD
-	init_cpu();
-#endif /* USE_DYNSIMD */
-
-	return client;
-}
-
-#endif
-
-/*
- * Build the jack_client_t structure for an internal client.
- */
-jack_client_t *
-jack_client_alloc_internal (jack_client_control_t *cc, jack_engine_t* engine)
-{
-	jack_client_t* client;
-
-	client = jack_client_alloc ();
-
-	client->control = cc;
-	client->engine = engine->control;
-	
-	client->n_port_types = client->engine->n_port_types;
-	client->port_segment = &engine->port_segment[0];
-
-	return client;
-}
-
-static void
-jack_client_free (jack_client_t *client)
-{
-	if (client->pollfd) {
-		free (client->pollfd);
-	}
-
-	free (client);
-}
-
-void
-jack_client_invalidate_port_buffers (jack_client_t *client)
-{
-	JSList *node;
-	jack_port_t *port;
-
-	/* This releases all local memory owned by input ports
-	   and sets the buffer pointer to NULL. This will cause
-	   jack_port_get_buffer() to reallocate space for the
-	   buffer on the next call (if there is one).
-	*/
-
-	for (node = client->ports; node; node = jack_slist_next (node)) {
-		port = (jack_port_t *) node->data;
-
-		if (port->shared->flags & JackPortIsInput) {
-			if (port->mix_buffer) {
-				jack_pool_release (port->mix_buffer);
-				port->mix_buffer = NULL;
-			}
-		}
-	}
-}
-
-int
-jack_client_handle_port_connection (jack_client_t *client, jack_event_t *event)
-{
-	jack_port_t *control_port;
-	jack_port_t *other = 0;
-	JSList *node;
-	int need_free = FALSE;
-
-	if (client->engine->ports[event->x.self_id].client_id == client->control->id ||
-	    client->engine->ports[event->y.other_id].client_id == client->control->id) {
-
-		/* its one of ours */
-
-		switch (event->type) {
-		case PortConnected:
-			other = jack_port_new (client, event->y.other_id,
-					       client->engine);
-			/* jack_port_by_id_int() always returns an internal
-			 * port that does not need to be deallocated 
-			 */
-			control_port = jack_port_by_id_int (client, event->x.self_id,
-							    &need_free);
-			pthread_mutex_lock (&control_port->connection_lock);
-			control_port->connections =
-				jack_slist_prepend (control_port->connections,
-						    (void *) other);
-			pthread_mutex_unlock (&control_port->connection_lock);
-			break;
-			
-		case PortDisconnected:
-			/* jack_port_by_id_int() always returns an internal
-			 * port that does not need to be deallocated 
-			 */
-			control_port = jack_port_by_id_int (client, event->x.self_id,
-							    &need_free);
-			pthread_mutex_lock (&control_port->connection_lock);
-			
-			for (node = control_port->connections; node;
-			     node = jack_slist_next (node)) {
-				
-				other = (jack_port_t *) node->data;
-
-				if (other->shared->id == event->y.other_id) {
-					control_port->connections =
-						jack_slist_remove_link (
-							control_port->connections,
-							node);
-					jack_slist_free_1 (node);
-					free (other);
-					break;
-				}
-			}
-			
-			pthread_mutex_unlock (&control_port->connection_lock);
-			break;
-			
-		default:
-			/* impossible */
-			break;
-		}
-	}
-
-	if (client->control->port_connect_cbset) {
-		client->port_connect (event->x.self_id, event->y.other_id,
-					       (event->type == PortConnected ? 1 : 0), 
-					       client->port_connect_arg);
-	}
-
-	return 0;
-}
-
-#if JACK_USE_MACH_THREADS
-
-static int 
-jack_handle_reorder (jack_client_t *client, jack_event_t *event)
-{	
-	client->pollmax = 1;
-
-	/* If the client registered its own callback for graph order events,
-	   execute it now.
-	*/
-
-	if (client->control->graph_order_cbset) {
-		client->graph_order (client->graph_order_arg);
-	}
-
-	return 0;
-}
-
-#else
-
-static int 
-jack_handle_reorder (jack_client_t *client, jack_event_t *event)
-{	
-	char path[PATH_MAX+1];
-
-	DEBUG ("graph reorder\n");
-
-	if (client->graph_wait_fd >= 0) {
-		DEBUG ("closing graph_wait_fd==%d", client->graph_wait_fd);
-		close (client->graph_wait_fd);
-		client->graph_wait_fd = -1;
-	} 
-
-	if (client->graph_next_fd >= 0) {
-		DEBUG ("closing graph_next_fd==%d", client->graph_next_fd);
-		close (client->graph_next_fd);
-		client->graph_next_fd = -1;
-	}
-
-	sprintf (path, "%s-%" PRIu32, client->fifo_prefix, event->x.n);
-	
-	if ((client->graph_wait_fd = open (path, O_RDONLY|O_NONBLOCK)) < 0) {
-		jack_error ("cannot open specified fifo [%s] for reading (%s)",
-			    path, strerror (errno));
-		return -1;
-	}
-	DEBUG ("opened new graph_wait_fd %d (%s)", client->graph_wait_fd, path);
-
-	sprintf (path, "%s-%" PRIu32, client->fifo_prefix, event->x.n+1);
-	
-	if ((client->graph_next_fd = open (path, O_WRONLY|O_NONBLOCK)) < 0) {
-		jack_error ("cannot open specified fifo [%s] for writing (%s)",
-			    path, strerror (errno));
-		return -1;
-	}
-
-	client->upstream_is_jackd = event->y.n;
-	client->pollmax = 2;
-
-	DEBUG ("opened new graph_next_fd %d (%s) (upstream is jackd? %d)",
-	       client->graph_next_fd, path, 
-	       client->upstream_is_jackd);
-
-	/* If the client registered its own callback for graph order events,
-	   execute it now.
-	*/
-
-	if (client->control->graph_order_cbset) {
-		client->graph_order (client->graph_order_arg);
-	}
-
-	return 0;
-}
-
-#endif
-		
-static int
-server_connect (const char *server_name)
-{
-	int fd;
-	struct sockaddr_un addr;
-	int which = 0;
-
-        char server_dir[PATH_MAX+1] = "";
-
-	if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
-		jack_error ("cannot create client socket (%s)",
-			    strerror (errno));
-		return -1;
-	}
-
-	//JOQ: temporary debug message
-	//jack_info ("DEBUG: connecting to `%s' server", server_name);
-
-	addr.sun_family = AF_UNIX;
-	snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_%d",
-                  jack_server_dir (server_name, server_dir) , which);
-
-	if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
-		close (fd);
-		return -1;
-	}
-
-	return fd;
-}
-
-static int
-server_event_connect (jack_client_t *client, const char *server_name)
-{
-	int fd;
-	struct sockaddr_un addr;
-	jack_client_connect_ack_request_t req;
-	jack_client_connect_ack_result_t res;
-
-        char server_dir[PATH_MAX+1] = "";
-
-	if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
-		jack_error ("cannot create client event socket (%s)",
-			    strerror (errno));
-		return -1;
-	}
-
-	addr.sun_family = AF_UNIX;
-	snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_ack_0",
-		  jack_server_dir (server_name,server_dir));
-
-	if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
-		jack_error ("cannot connect to jack server for events",
-			    strerror (errno));
-		close (fd);
-		return -1;
-	}
-
-	req.client_id = client->control->id;
-
-	if (write (fd, &req, sizeof (req)) != sizeof (req)) {
-		jack_error ("cannot write event connect request to server (%s)",
-			    strerror (errno));
-		close (fd);
-		return -1;
-	}
-
-	if (read (fd, &res, sizeof (res)) != sizeof (res)) {
-		jack_error ("cannot read event connect result from server (%s)",
-			    strerror (errno));
-		close (fd);
-		return -1;
-	}
-
-	if (res.status != 0) {
-		jack_error ("cannot connect to server for event stream (%s)",
-			    strerror (errno));
-		close (fd);
-		return -1;
-	}
-
-	return fd;
-}
-
-/* Exec the JACK server in this process.  Does not return. */
-static void
-_start_server (const char *server_name)
-{
-	FILE* fp = 0;
-	char filename[255];
-	char arguments[255];
-	char buffer[255];
-	char* command = 0;
-	size_t pos = 0;
-	size_t result = 0;
-	char** argv = 0;
-	int i = 0;
-	int good = 0;
-	int ret;
-
-	snprintf(filename, 255, "%s/.jackdrc", getenv("HOME"));
-	fp = fopen(filename, "r");
-
-	if (!fp) {
-		fp = fopen("/etc/jackdrc", "r");
-	}
-	/* if still not found, check old config name for backwards compatability */
-	if (!fp) {
-		fp = fopen("/etc/jackd.conf", "r");
-	}
-
-	if (fp) {
-		arguments[0] = '\0';
-		ret = fscanf(fp, "%s", buffer);
-		while(ret != 0 && ret != EOF) {
-			strcat(arguments, buffer);
-			strcat(arguments, " ");
-			ret = fscanf(fp, "%s", buffer);
-		}
-		if (strlen(arguments) > 0) {
-			good = 1;
-		}
-	}
-
-	if (!good) {
-#if defined(USE_CAPABILITIES)
-		command = JACK_LOCATION "/jackstart";
-		strncpy(arguments, JACK_LOCATION "/jackstart -T -R -d "
-			JACK_DEFAULT_DRIVER " -p 512", 255);
-#else /* !USE_CAPABILITIES */
-		command = JACK_LOCATION "/jackd";
-		strncpy(arguments, JACK_LOCATION "/jackd -T -d "
-			JACK_DEFAULT_DRIVER, 255);
-#endif /* USE_CAPABILITIES */
-	} else {
-		result = strcspn(arguments, " ");
-		if ((command = (char *) malloc(result+1)) == NULL) {
-			goto failure;
-		}
-		strncpy(command, arguments, result);
-		command[result] = '\0';
-	}
-
-	if ((argv = (char **) malloc (255)) == NULL) {
-		goto failure;
-	}
-  
-	while(1) {
-		/* insert -T and -nserver_name in front of arguments */
-		if (i == 1) {
-			argv[i] = (char *) malloc(strlen ("-T") + 1);
-			strcpy (argv[i++], "-T"); 
-			if (server_name) {
-				size_t optlen = strlen ("-n");
-				char *buf =
-					malloc (optlen
-						+ strlen (server_name) + 1);
-				strcpy (buf, "-n");
-				strcpy (buf+optlen, server_name);
-				argv[i++] = buf;
-			}
-		}
-
-		result = strcspn(arguments+pos, " ");
-		if (result == 0) {
-			break;
-		}
-		argv[i] = (char*)malloc(result+1);
-
-		strncpy(argv[i], arguments+pos, result);
-		argv[i][result] = '\0';
-
-		pos += result+1;
-		++i;
-	}
-	argv[i] = 0;
-
-#if 0
-	fprintf (stderr, "execing  JACK using %s\n", command);
-	for (_xx = 0; argv[_xx]; ++_xx) {
-		fprintf (stderr, "\targv[%d] = %s\n", _xx, argv[_xx]);
-	}
-#endif
-
-	execv (command, argv);
-
-failure:
-	/* If execv() succeeds, it does not return.  There's no point
-	 * in calling jack_error() here in the child process. */
-	fprintf (stderr, "exec of JACK server (command = \"%s\") failed: %s\n", command, strerror (errno));
-}
-
-int
-start_server (const char *server_name, jack_options_t options)
-{
-	if ((options & JackNoStartServer)
-	    || getenv("JACK_NO_START_SERVER")) {
-		return 1;
-	}
-
-	/* The double fork() forces the server to become a child of
-	 * init, which will always clean up zombie process state on
-	 * termination.  This even works in cases where the server
-	 * terminates but this client does not.
-	 *
-	 * Since fork() is usually implemented using copy-on-write
-	 * virtual memory tricks, the overhead of the second fork() is
-	 * probably relatively small.
-	 */
-	switch (fork()) {
-	case 0:				/* child process */
-		switch (fork()) {
-		case 0:			/* grandchild process */
-			_start_server(server_name);
-			_exit (99);	/* exec failed */
-		case -1:
-			_exit (98);
-		default:
-			_exit (0);
-		}
-	case -1:			/* fork() error */
-		return 1;		/* failed to start server */
-	}
-
-	/* only the original parent process goes here */
-	return 0;			/* (probably) successful */
-}
-
-static int
-jack_request_client (ClientType type,
-		     const char* client_name, jack_options_t options,
-		     jack_status_t *status, jack_varargs_t *va,
-		     jack_client_connect_result_t *res, int *req_fd)
-{
-	jack_client_connect_request_t req;
-
-	*req_fd = -1;
-	memset (&req, 0, sizeof (req));
-	req.options = options;
-
-	if (strlen (client_name) >= sizeof (req.name)) {
-		jack_error ("\"%s\" is too long to be used as a JACK client"
-			    " name.\n"
-			    "Please use %lu characters or less.",
-			    client_name, sizeof (req.name));
-		return -1;
-	}
-
-	if (va->load_name
-	    && (strlen (va->load_name) > sizeof (req.object_path) - 1)) {
-		jack_error ("\"%s\" is too long to be used as a JACK shared"
-			    " object name.\n"
-			     "Please use %lu characters or less.",
-			    va->load_name, sizeof (req.object_path) - 1);
-		return -1;
-	}
-
-	if (va->load_init
-	    && (strlen (va->load_init) > sizeof (req.object_data) - 1)) {
-		jack_error ("\"%s\" is too long to be used as a JACK shared"
-			    " object data string.\n"
-			     "Please use %lu characters or less.",
-			    va->load_init, sizeof (req.object_data) - 1);
-		return -1;
-	}
-	
-	if ((*req_fd = server_connect (va->server_name)) < 0) {
-		int trys;
-		if (start_server(va->server_name, options)) {
-			*status |= (JackFailure|JackServerFailed);
-			goto fail;
-		}
-		trys = 5;
-		do {
-			sleep(1);
-			if (--trys < 0) {
-				*status |= (JackFailure|JackServerFailed);
-				goto fail;
-			}
-		} while ((*req_fd = server_connect (va->server_name)) < 0);
-		*status |= JackServerStarted;
-	}
-
-	/* format connection request */
-
-	req.protocol_v = jack_protocol_version;
-	req.load = TRUE;
-	req.type = type;
-	snprintf (req.name, sizeof (req.name),
-		  "%s", client_name);
-	snprintf (req.object_path, sizeof (req.object_path),
-		  "%s", va->load_name);
-	snprintf (req.object_data, sizeof (req.object_data),
-		  "%s", va->load_init);
-
-	if (write (*req_fd, &req, sizeof (req)) != sizeof (req)) {
-		jack_error ("cannot send request to jack server (%s)",
-			    strerror (errno));
-		*status |= (JackFailure|JackServerError);
-		goto fail;
-	}
-
-	if (read (*req_fd, res, sizeof (*res)) != sizeof (*res)) {
-
-		if (errno == 0) {
-			/* server shut the socket */
-			jack_error ("could not attach as client");
-			*status |= (JackFailure|JackServerError);
-			goto fail;
-		}
-		
-		if (errno == ECONNRESET) {
-			jack_error ("could not attach as JACK client "
-				    "(server has exited)");
-			*status |= (JackFailure|JackServerError);
-			goto fail;
-		}
-		
-		jack_error ("cannot read response from jack server (%s)",
-			    strerror (errno));
-		*status |= (JackFailure|JackServerError);
-		goto fail;
-	}
-
-	*status |= res->status;		/* return server status bits */
-
-	if (*status & JackFailure) {
-		if (*status & JackVersionError) {
-			jack_error ("client linked with incompatible libjack"
-				    " version.");
-		}
-		jack_error ("could not attach to JACK server");
-		*status |= JackServerError;
-		goto fail;
-	}
-
-	switch (type) {
-	case ClientDriver:
-	case ClientInternal:
-		close (*req_fd);
-		*req_fd = -1;
-		break;
-
-	default:
-		break;
-	}
-
-	return 0;
-
-  fail:
-	if (*req_fd >= 0) {
-		close (*req_fd);
-		*req_fd = -1;
-	}
-	return -1;
-}
-
-int
-jack_attach_port_segment (jack_client_t *client, jack_port_type_id_t ptid)
-{
-	/* Lookup, attach and register the port/buffer segments in use
-	 * right now. 
-	 */
-
-	if (client->control->type != ClientExternal) {
-		jack_error("Only external clients need attach port segments");
-		abort();
-	}
-
-	/* make sure we have space to store the port
-	   segment information.
-	*/
-
-	if (ptid >= client->n_port_types) {
-		
-		client->port_segment = (jack_shm_info_t*)
-			realloc (client->port_segment,
-				 sizeof (jack_shm_info_t) * (ptid+1));
-
-		memset (&client->port_segment[client->n_port_types],
-			0,
-			sizeof (jack_shm_info_t) * 
-			(ptid - client->n_port_types));
-		
-		client->n_port_types = ptid + 1;
-
-	} else {
-
-		/* release any previous segment */
-		jack_release_shm (&client->port_segment[ptid]);
-	}
-
-	/* get the index into the shm registry */
-
-	client->port_segment[ptid].index =
-		client->engine->port_types[ptid].shm_registry_index;
-
-	/* attach the relevant segment */
-
-	if (jack_attach_shm (&client->port_segment[ptid])) {
-		jack_error ("cannot attach port segment shared memory"
-			    " (%s)", strerror (errno));
-		return -1;
-	}
-
-	return 0;
-}
-
-jack_client_t *
-jack_client_open_aux (const char *client_name,
-		  jack_options_t options,
-		  jack_status_t *status, va_list ap)
-{
-	/* optional arguments: */
-	jack_varargs_t va;		/* variable arguments */
-
-	int req_fd = -1;
-	int ev_fd = -1;
-	jack_client_connect_result_t  res;
-	jack_client_t *client;
-	jack_port_type_id_t ptid;
-	jack_status_t my_status;
-
-	jack_messagebuffer_init ();
-	
-	if (status == NULL)		/* no status from caller? */
-		status = &my_status;	/* use local status word */
-	*status = 0;
-
-	/* validate parameters */
-	if ((options & ~JackOpenOptions)) {
-		*status |= (JackFailure|JackInvalidOption);
-		jack_messagebuffer_exit ();
-		return NULL;
-	}
-
-	/* parse variable arguments */
-        jack_varargs_parse(options, ap, &va);
-
-	/* External clients need to know where the tmpdir used for
-	   communication with the server lives
-	*/
-	if (jack_get_tmpdir ()) {
-		*status |= JackFailure;
-		jack_messagebuffer_exit ();
-		return NULL;
-	}
-
-	/* External clients need this initialized.  It is already set
-	 * up in the server's address space for internal clients.
-	 */
-	jack_init_time ();
-
-	if (jack_request_client (ClientExternal, client_name, options, status,
-				 &va, &res, &req_fd)) {
-		jack_messagebuffer_exit ();
-		return NULL;
-	}
-
-	/* Allocate the jack_client_t structure in local memory.
-	 * Shared memory is not accessible yet. */
-	client = jack_client_alloc ();
-	strcpy (client->name, res.name);
-	strcpy (client->fifo_prefix, res.fifo_prefix);
-	client->request_fd = req_fd;
-	client->pollfd[EVENT_POLL_INDEX].events =
-		POLLIN|POLLERR|POLLHUP|POLLNVAL;
-#ifndef JACK_USE_MACH_THREADS
-	client->pollfd[WAIT_POLL_INDEX].events =
-		POLLIN|POLLERR|POLLHUP|POLLNVAL;
-#endif
-
-	/* Don't access shared memory until server connected. */
-	if (jack_initialize_shm (va.server_name)) {
-		jack_error ("Unable to initialize shared memory.");
-		*status |= (JackFailure|JackShmFailure);
-		goto fail;
-	}
-
-	/* attach the engine control/info block */
-	client->engine_shm.index = res.engine_shm_index;
-	if (jack_attach_shm (&client->engine_shm)) {
-		jack_error ("cannot attached engine control shared memory"
-			    " segment");
-		goto fail;
-	}
-	
-	client->engine = (jack_control_t *) jack_shm_addr (&client->engine_shm);
-
-	/* initialize clock source as early as possible */
-	jack_set_clock_source (client->engine->clock_source);
-
-	/* now attach the client control block */
-	client->control_shm.index = res.client_shm_index;
-	if (jack_attach_shm (&client->control_shm)) {
-		jack_error ("cannot attached client control shared memory"
-			    " segment");
-		goto fail;
-	}
-	
-	client->control = (jack_client_control_t *)
-		jack_shm_addr (&client->control_shm);
-
-	/* Nobody else needs to access this shared memory any more, so
-	 * destroy it.  Because we have it attached, it won't vanish
-	 * till we exit (and release it).
-	 */
-	jack_destroy_shm (&client->control_shm);
-
-	client->n_port_types = client->engine->n_port_types;
-	if ((client->port_segment = (jack_shm_info_t *) malloc (sizeof (jack_shm_info_t) * client->n_port_types)) == NULL) {
-		goto fail;
-	}
-	
-	for (ptid = 0; ptid < client->n_port_types; ++ptid) {
-		client->port_segment[ptid].index =
-			client->engine->port_types[ptid].shm_registry_index;
-		client->port_segment[ptid].attached_at = MAP_FAILED;
-		jack_attach_port_segment (client, ptid);
-	}
-
-	/* set up the client so that it does the right thing for an
-	 * external client 
-	 */
-	client->deliver_request = oop_client_deliver_request;
-	client->deliver_arg = client;
-
-	if ((ev_fd = server_event_connect (client, va.server_name)) < 0) {
-		goto fail;
-	}
-
-	client->event_fd = ev_fd;
-        
-#ifdef JACK_USE_MACH_THREADS
-        /* specific resources for server/client real-time thread
-	 * communication */
-	client->clienttask = mach_task_self();
-        
-	if (task_get_bootstrap_port(client->clienttask, &client->bp)){
-            jack_error ("Can't find bootstrap port");
-            goto fail;
-        }
-        
-        if (allocate_mach_clientport(client, res.portnum) < 0) {
-            jack_error("Can't allocate mach port");
-            goto fail; 
-        }; 
-#endif /* JACK_USE_MACH_THREADS */
- 	return client;
-	
-  fail:
-	jack_messagebuffer_exit ();
-
-	if (client->engine) {
-		jack_release_shm (&client->engine_shm);
-		client->engine = 0;
-	}
-	if (client->control) {
-		jack_release_shm (&client->control_shm);
-		client->control = 0;
-	}
-	if (req_fd >= 0) {
-		close (req_fd);
-	}
-	if (ev_fd >= 0) {
-		close (ev_fd);
-	}
-	free (client);
-
-	return NULL;
-}
-
-jack_client_t* jack_client_open(const char* ext_client_name, jack_options_t options, jack_status_t* status, ...)
-{
-	va_list ap;
-	va_start(ap, status);
-	jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap);
-	va_end(ap);
-	return res;
-}
-
-jack_client_t *
-jack_client_new (const char *client_name)
-{
-	jack_options_t options = JackUseExactName;
-	if (getenv("JACK_START_SERVER") == NULL)
-		options |= JackNoStartServer;
-	return jack_client_open (client_name, options, NULL);
-}
-
-char *
-jack_get_client_name (jack_client_t *client)
-{
-	return client->name;
-}
-
-int
-jack_internal_client_new (const char *client_name,
-			  const char *so_name, const char *so_data)
-{
-	jack_client_connect_result_t res;
-	int req_fd;
-	jack_varargs_t va;
-	jack_status_t status;
-	jack_options_t options = JackUseExactName;
-
-	if (getenv("JACK_START_SERVER") == NULL)
-		options |= JackNoStartServer;
-
-	jack_varargs_init (&va);
-	va.load_name = (char *) so_name;
-	va.load_init = (char *) so_data;
-
-	return jack_request_client (ClientInternal, client_name,
-				    options, &status, &va, &res, &req_fd);
-}
-
-char *
-jack_default_server_name (void)
-{
-	char *server_name;
-	if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
-		server_name = "default";
-	return server_name;
-}
-
-/* returns the name of the per-user subdirectory of jack_tmpdir */
-char *
-jack_user_dir (void)
-{
-	static char user_dir[PATH_MAX+1] = "";
-
-	/* format the path name on the first call */
-	if (user_dir[0] == '\0') {
-		if (getenv ("JACK_PROMISCUOUS_SERVER")) {
-			snprintf (user_dir, sizeof (user_dir), "%s/jack",
-				  jack_tmpdir);
-		} else {
-			snprintf (user_dir, sizeof (user_dir), "%s/jack-%d",
-				  jack_tmpdir, getuid ());
-		}
-	}
-
-	return user_dir;
-}
-
-/* returns the name of the per-server subdirectory of jack_user_dir() */
-char *
-jack_server_dir (const char *server_name, char *server_dir)
-{
-	/* format the path name into the suppled server_dir char array,
-	 * assuming that server_dir is at least as large as PATH_MAX+1 */
-
-	snprintf (server_dir, PATH_MAX+1, "%s/%s",
-		  jack_user_dir (), server_name);
-
-	return server_dir;
-}
-
-void
-jack_internal_client_close (const char *client_name)
-{
-	jack_client_connect_request_t req;
-	int fd;
-	char *server_name = jack_default_server_name ();
-
-	req.load = FALSE;
-	snprintf (req.name, sizeof (req.name), "%s", client_name);
-	
-	if ((fd = server_connect (server_name)) < 0) {
-		return;
-	}
-
-	if (write (fd, &req, sizeof (req)) != sizeof(req)) {
-		jack_error ("cannot deliver ClientUnload request to JACK "
-			    "server.");
-	}
-
-	/* no response to this request */
-	
-	close (fd);
-	return;
-}
-
-int
-jack_recompute_total_latencies (jack_client_t* client)
-{
-	jack_request_t request;
-
-	request.type = RecomputeTotalLatencies;
-	return jack_client_deliver_request (client, &request);
-}
-
-int
-jack_recompute_total_latency (jack_client_t* client, jack_port_t* port)
-{
-	jack_request_t request;
-
-	request.type = RecomputeTotalLatency;
-	request.x.port_info.port_id = port->shared->id;
-	return jack_client_deliver_request (client, &request);
-}
-
-int
-jack_set_freewheel (jack_client_t* client, int onoff)
-{
-	jack_request_t request;
-
-	request.type = onoff ? FreeWheel : StopFreeWheel;
-	return jack_client_deliver_request (client, &request);
-}
-
-void
-jack_start_freewheel (jack_client_t* client)
-{
-	jack_client_control_t *control = client->control;
-
-	if (client->engine->real_time) {
-#if JACK_USE_MACH_THREADS 
-		jack_drop_real_time_scheduling (client->process_thread);
-#else
-		jack_drop_real_time_scheduling (client->thread);
-#endif
-	}
-
-	if (control->freewheel_cb_cbset) {
-		client->freewheel_cb (1, client->freewheel_arg);
-	}
-}
-
-void
-jack_stop_freewheel (jack_client_t* client)
-{
-	jack_client_control_t *control = client->control;
-
-	if (client->engine->real_time) {
-#if JACK_USE_MACH_THREADS 
-		jack_acquire_real_time_scheduling (client->process_thread,
-				client->engine->client_priority);
-#else
-		jack_acquire_real_time_scheduling (client->thread, 
-				client->engine->client_priority);
-#endif
-	}
-
-	if (control->freewheel_cb_cbset) {
-		client->freewheel_cb (0, client->freewheel_arg);
-	}
-}
-
-static void
-jack_client_thread_suicide (jack_client_t* client)
-{
-	if (client->on_info_shutdown) {
-		jack_error ("zombified - calling shutdown handler");
-		client->on_info_shutdown (JackClientZombie, "Zombified", client->on_info_shutdown_arg);
-	} else if (client->on_shutdown) {
-		jack_error ("zombified - calling shutdown handler");
-		client->on_shutdown (client->on_shutdown_arg);
-	} else {
-		jack_error ("jack_client_thread zombified - exiting from JACK");
-		jack_client_close_aux (client);
-		/* Need a fix : possibly make client crash if
-		 * zombified without shutdown handler 
-		 */
-	}
-
-	pthread_exit (0);
-	/*NOTREACHED*/
-}
-
-static int
-jack_client_process_events (jack_client_t* client)
-{
-	jack_event_t event;
-	char status = 0;
-	jack_client_control_t *control = client->control;
-	JSList *node;
-	jack_port_t* port;
-
-	DEBUG ("process events");
-
-	if (client->pollfd[EVENT_POLL_INDEX].revents & POLLIN) {
-		
-		DEBUG ("client receives an event, "
-		       "now reading on event fd");
-                
-		/* server has sent us an event. process the
-		 * event and reply */
-		
-		if (read (client->event_fd, &event, sizeof (event))
-		    != sizeof (event)) {
-			jack_error ("cannot read server event (%s)",
-				    strerror (errno));
-			return -1;
-		}
-		
-		status = 0;
-		
-		switch (event.type) {
-		case PortRegistered:
-			for (node = client->ports_ext; node; node = jack_slist_next (node)) {
-				port = node->data;
-				if (port->shared->id == event.x.port_id) { // Found port, update port type
-					port->type_info = &client->engine->port_types[port->shared->ptype_id];
-				}
-			}
-			if (control->port_register_cbset) {
-				client->port_register
-					(event.x.port_id, TRUE,
-					 client->port_register_arg);
-			} 
-			break;
-			
-		case PortUnregistered:
-			if (control->port_register_cbset) {
-				client->port_register
-					(event.x.port_id, FALSE,
-					 client->port_register_arg);
-			}
-			break;
-			
-		case ClientRegistered:
-			if (control->client_register_cbset) {
-				client->client_register
-					(event.x.name, TRUE,
-					 client->client_register_arg);
-			} 
-			break;
-			
-		case ClientUnregistered:
-			if (control->client_register_cbset) {
-				client->client_register
-					(event.x.name, FALSE,
-					 client->client_register_arg);
-			}
-			break;
-			
-		case GraphReordered:
-			status = jack_handle_reorder (client, &event);
-			break;
-			
-		case PortConnected:
-		case PortDisconnected:
-			status = jack_client_handle_port_connection
-				(client, &event);
-			break;
-			
-		case BufferSizeChange:
-			jack_client_invalidate_port_buffers (client);
-			if (control->bufsize_cbset) {
-				status = client->bufsize
-					(control->nframes,
-					 client->bufsize_arg);
-			} 
-			break;
-			
-		case SampleRateChange:
-			if (control->srate_cbset) {
-				status = client->srate
-					(control->nframes,
-					 client->srate_arg);
-			}
-			break;
-			
-		case XRun:
-			if (control->xrun_cbset) {
-				status = client->xrun
-					(client->xrun_arg);
-			}
-			break;
-			
-		case AttachPortSegment:
-			jack_attach_port_segment (client, event.y.ptid);
-			break;
-			
-		case StartFreewheel:
-			jack_start_freewheel (client);
-			break;
-			
-		case StopFreewheel:
-			jack_stop_freewheel (client);
-			break;
-		}
-		
-		DEBUG ("client has dealt with the event, writing "
-		       "response on event fd");
-		
-		if (write (client->event_fd, &status, sizeof (status))
-		    != sizeof (status)) {
-			jack_error ("cannot send event response to "
-				    "engine (%s)", strerror (errno));
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-static int
-jack_client_core_wait (jack_client_t* client)
-{
-	jack_client_control_t *control = client->control;
-
-	DEBUG ("client polling on %s", client->pollmax == 2 ? x
-	       "event_fd and graph_wait_fd..." :
-	       "event_fd only");
-	
-	while (1) {
-		if (poll (client->pollfd, client->pollmax, 1000) < 0) {
-			if (errno == EINTR) {
-				continue;
-			}
-			jack_error ("poll failed in client (%s)",
-				    strerror (errno));
-			return -1;
-		}
-
-		pthread_testcancel();
-
-#ifndef JACK_USE_MACH_THREADS 
-		
-		/* get an accurate timestamp on waking from poll for a
-		 * process() cycle. 
-		 */
-		
-		if (client->graph_wait_fd >= 0
-		    && client->pollfd[WAIT_POLL_INDEX].revents & POLLIN) {
-			control->awake_at = jack_get_microseconds();
-		}
-		
-		DEBUG ("pfd[EVENT].revents = 0x%x pfd[WAIT].revents = 0x%x",
-		       client->pollfd[EVENT_POLL_INDEX].revents,
-		       client->pollfd[WAIT_POLL_INDEX].revents);
-		
-		if (client->graph_wait_fd >= 0 &&
-		    (client->pollfd[WAIT_POLL_INDEX].revents & ~POLLIN)) {
-			
-			/* our upstream "wait" connection
-			   closed, which either means that
-			   an intermediate client exited, or
-			   jackd exited, or jackd zombified
-			   us.
-			   
-			   we can discover the zombification
-			   via client->control->dead, but
-			   the other two possibilities are
-			   impossible to identify just from
-			   this situation. so we have to
-			   check what we are connected to,
-			   and act accordingly.
-			*/
-			
-			if (client->upstream_is_jackd) {
-				DEBUG ("WE DIE\n");
-				return 0;
-			} else {
-				DEBUG ("WE PUNT\n");
-				/* don't poll on the wait fd
-				 * again until we get a
-				 * GraphReordered event.
-				 */
-				
-				client->graph_wait_fd = -1;
-				client->pollmax = 1;
-			}
-		}
-#endif
-		
-		if (jack_client_process_events (client)) {
-			DEBUG ("event processing failed\n");
-			return 0;
-		}
-		
-		if (client->graph_wait_fd >= 0 &&
-		    (client->pollfd[WAIT_POLL_INDEX].revents & POLLIN)) {
-			DEBUG ("time to run process()\n");
-			break;
-		}
-	}
-
-	if (control->dead || client->pollfd[EVENT_POLL_INDEX].revents & ~POLLIN) {
-		DEBUG ("client appears dead or event pollfd has error status\n");
-		return -1;
-	}
-
-	return 0;
-}
-
-static int
-jack_wake_next_client (jack_client_t* client)
-{
-	struct pollfd pfds[1];
-	int pret = 0;
-	char c = 0;
-
-	if (write (client->graph_next_fd, &c, sizeof (c))
-	    != sizeof (c)) {
-		DEBUG("cannot write byte to fd %d", client->graph_next_fd);
-		jack_error ("cannot continue execution of the "
-			    "processing graph (%s)",
-			    strerror(errno));
-		return -1;
-	}
-	
-	DEBUG ("client sent message to next stage by %" PRIu64 "",
-	       jack_get_microseconds());
-	
-	DEBUG("reading cleanup byte from pipe %d\n", client->graph_wait_fd);
-
-	/* "upstream client went away?  readability is checked in
-	 * jack_client_core_wait(), but that's almost a whole cycle
-	 * before we get here.
-	 */
-
-	if (client->graph_wait_fd >= 0) {
-		pfds[0].fd = client->graph_wait_fd;
-		pfds[0].events = POLLIN;
-
-		/* 0 timeout, don't actually wait */
-		pret = poll(pfds, 1, 0);
-	}
-
-	if (pret > 0 && (pfds[0].revents & POLLIN)) {
-		if (read (client->graph_wait_fd, &c, sizeof (c))
-		    != sizeof (c)) {
-			jack_error ("cannot complete execution of the "
-				"processing graph (%s)", strerror(errno));
-			return -1;
-		}
-	} else {
-		DEBUG("cleanup byte from pipe %d not available?\n",
-			client->graph_wait_fd);
-	}
-	
-	return 0;
-}
-
-static jack_nframes_t 
-jack_thread_first_wait (jack_client_t* client)
-{
-	if (jack_client_core_wait (client)) {
-		return 0;
-	}
-	return client->control->nframes;
-}
-		
-jack_nframes_t
-jack_thread_wait (jack_client_t* client, int status)
-{
-	client->control->last_status = status;
-
-   /* SECTION ONE: HOUSEKEEPING/CLEANUP FROM LAST DATA PROCESSING */
-
-	/* housekeeping/cleanup after data processing */
-
-	if (status == 0 && client->control->timebase_cb_cbset) {
-		jack_call_timebase_master (client);
-	}
-	
-	/* end preemption checking */
-	CHECK_PREEMPTION (client->engine, FALSE);
-	
-	client->control->finished_at = jack_get_microseconds();
-	
-	/* wake the next client in the chain (could be the server), 
-	   and check if we were killed during the process
-	   cycle.
-	*/
-	
-	if (jack_wake_next_client (client)) {
-		DEBUG("client cannot wake next, or is dead\n");
-		return 0;
-	}
-
-	if (status || client->control->dead || !client->engine->engine_ok) {
-		return 0;
-	}
-	
-   /* SECTION TWO: WAIT FOR NEXT DATA PROCESSING TIME */
-
-	if (jack_client_core_wait (client)) {
-		return 0;
-	}
-
-   /* SECTION THREE: START NEXT DATA PROCESSING TIME */
-
-	/* Time to do data processing */
-
-	client->control->state = Running;
-	
-	/* begin preemption checking */
-	CHECK_PREEMPTION (client->engine, TRUE);
-	
-	if (client->control->sync_cb_cbset)
-		jack_call_sync_client (client);
-
-	return client->control->nframes;
-}
-
-jack_nframes_t jack_cycle_wait (jack_client_t* client)
-{
-	/* SECTION TWO: WAIT FOR NEXT DATA PROCESSING TIME */
-
-	if (jack_client_core_wait (client)) {
-		return 0;
-	}
-
-   /* SECTION THREE: START NEXT DATA PROCESSING TIME */
-
-	/* Time to do data processing */
-
-	client->control->state = Running;
-	
-	/* begin preemption checking */
-	CHECK_PREEMPTION (client->engine, TRUE);
-	
-	if (client->control->sync_cb_cbset)
-		jack_call_sync_client (client);
-
-	return client->control->nframes;
-}
-
-void jack_cycle_signal(jack_client_t* client, int status)
-{
-	client->control->last_status = status;
-
-   /* SECTION ONE: HOUSEKEEPING/CLEANUP FROM LAST DATA PROCESSING */
-
-	/* housekeeping/cleanup after data processing */
-
-	if (status == 0 && client->control->timebase_cb_cbset) {
-		jack_call_timebase_master (client);
-	}
-	
-	/* end preemption checking */
-	CHECK_PREEMPTION (client->engine, FALSE);
-	
-	client->control->finished_at = jack_get_microseconds();
-	
-	/* wake the next client in the chain (could be the server), 
-	   and check if we were killed during the process
-	   cycle.
-	*/
-	
-	if (jack_wake_next_client (client)) {
-		DEBUG("client cannot wake next, or is dead\n");
-		jack_client_thread_suicide (client);
-		/*NOTREACHED*/
-	}
-
-	if (status || client->control->dead || !client->engine->engine_ok) {
-		jack_client_thread_suicide (client);
-		/*NOTREACHED*/
-	}
-}
-
-static void
-jack_client_thread_aux (void *arg)
-{
-	jack_client_t *client = (jack_client_t *) arg;
-	jack_client_control_t *control = client->control;
-
-	pthread_mutex_lock (&client_lock);
-	client->thread_ok = TRUE;
-	client->thread_id = pthread_self();
-	pthread_cond_signal (&client_ready);
-	pthread_mutex_unlock (&client_lock);
-
-	control->pid = getpid();
-	control->pgrp = getpgrp();
-
-	DEBUG ("client thread is now running");
-
-	if (control->thread_init_cbset) {
-		DEBUG ("calling client thread init callback");
-		client->thread_init (client->thread_init_arg);
-	}
-
-	/* wait for first wakeup from server */
-
-	if (jack_thread_first_wait (client) == control->nframes) {
-
-		/* now run till we're done */
-
-		if (control->process_cbset) {
-
-			/* run process callback, then wait... ad-infinitum */
-
-			while (1) {
-				DEBUG("client calls process()");
-				int status = (client->process (control->nframes, 
-								client->process_arg) ==
-					      control->nframes);
-				control->state = Finished;
-				DEBUG("client leaves process(), re-enters wait");
-				if (!jack_thread_wait (client, status)) {
-					break;
-				}
-				DEBUG("client done with wait");
-			}
-
-		} else {
-			/* no process handling but still need to process events */
-			while (jack_thread_wait (client, 0) == control->nframes)
-				;
-		}
-	}
-
-	jack_client_thread_suicide (client);
-}
-
-static void *
-jack_client_thread (void *arg)
-{
-	jack_client_t *client = (jack_client_t *) arg;
-	jack_client_control_t *control = client->control;
-	
-	if (client->control->thread_cb_cbset) {
-	
-		pthread_mutex_lock (&client_lock);
-		client->thread_ok = TRUE;
-		client->thread_id = pthread_self();
-		pthread_cond_signal (&client_ready);
-		pthread_mutex_unlock (&client_lock);
-
-		control->pid = getpid();
-		control->pgrp = getpgrp();
-
-		client->thread_cb(client->thread_cb_arg);
-		jack_client_thread_suicide(client);
-	} else {
-		jack_client_thread_aux(arg);
-	}
-	
-	/*NOTREACHED*/
-	return (void *) 0;
-}
-
-#ifdef JACK_USE_MACH_THREADS
-/* real-time thread : separated from the normal client thread, it will
- * communicate with the server using fast mach RPC mechanism */
-
-static void *
-jack_client_process_thread (void *arg)
-{
-	jack_client_t *client = (jack_client_t *) arg;
-	jack_client_control_t *control = client->control;
-	int err = 0;
-
-	if (client->control->thread_init_cbset) {
-	/* this means that the init callback will be called twice -taybin*/
-		DEBUG ("calling client thread init callback");
-		client->thread_init (client->thread_init_arg);
-	}
-
-	client->control->pid = getpid();
-	DEBUG ("client process thread is now running");
-        
-	client->rt_thread_ok = TRUE;
-            
-   	while (err == 0) {
-	
-		if (jack_client_suspend(client) < 0) {
-				jack_error ("jack_client_process_thread :resume error");
-				goto zombie;
-		}
-		
-		control->awake_at = jack_get_microseconds();
-		
-		DEBUG ("client resumed");
-		 
-		control->state = Running;
-
-		if (control->sync_cb_cbset)
-			jack_call_sync_client (client);
-
-		if (control->process_cbset) {
-			if (client->process (control->nframes,
-					     client->process_arg) == 0) {
-				control->state = Finished;
-			}
-		} else {
-			control->state = Finished;
-		}
-
-		if (control->timebase_cb_cbset)
-			jack_call_timebase_master (client);
-                
-		control->finished_at = jack_get_microseconds();
-                
-		DEBUG ("client finished processing at %Lu (elapsed = %f usecs)",
-			control->finished_at,
-			((float)(control->finished_at - control->awake_at)));
-                  
- 		/* check if we were killed during the process cycle
-		 * (or whatever) */
-		
-		if (client->control->dead) {
-				jack_error ("jack_client_process_thread: "
-						"client->control->dead");
-				goto zombie;
-		}
-
-		DEBUG("process cycle fully complete\n");
-
-	}
-        
- 	return (void *) ((intptr_t)err);
-
-  zombie:
-        
-        jack_error ("jack_client_process_thread : zombified");
-        
-        client->rt_thread_ok = FALSE;
-
-	if (client->on_info_shutdown) {
-		jack_error ("zombified - calling shutdown handler");
-		client->on_info_shutdown (JackClientZombie, "Zombified", client->on_info_shutdown_arg);
-	} else if (client->on_shutdown) {
-		jack_error ("zombified - calling shutdown handler");
-		client->on_shutdown (client->on_shutdown_arg);
-	} else {
-		jack_error ("jack_client_process_thread zombified - exiting from JACK");
-		/* Need a fix : possibly make client crash if
-		 * zombified without shutdown handler */
-		jack_client_close_aux (client); 
-	}
-
-	pthread_exit (0);
-	/*NOTREACHED*/
-	return 0;
-}
-#endif /* JACK_USE_MACH_THREADS */
-
-static int
-jack_start_thread (jack_client_t *client)
-{
- 	if (client->engine->real_time) {
-
-#ifdef USE_MLOCK
-		if (client->engine->do_mlock
-		    && (mlockall (MCL_CURRENT | MCL_FUTURE) != 0)) {
-			jack_error ("cannot lock down memory for RT thread "
-				    "(%s)", strerror (errno));
-			 
-#ifdef ENSURE_MLOCK
-			 return -1;
-#endif /* ENSURE_MLOCK */
-		 }
-		 
-		 if (client->engine->do_munlock) {
-			 cleanup_mlock ();
-		 }
-#endif /* USE_MLOCK */
-	}
-
-#ifdef JACK_USE_MACH_THREADS
-/* Stephane Letz : letz at grame.fr
-   On MacOSX, the normal thread does not need to be real-time.
-*/
-	if (jack_client_create_thread (client, 
-				       &client->thread,
-				       client->engine->client_priority,
-				       FALSE,
-				       jack_client_thread, client)) {
-		return -1;
-	}
-#else
-	if (jack_client_create_thread (client,
-				&client->thread,
-				client->engine->client_priority,
-				client->engine->real_time,
-				jack_client_thread, client)) {
-		return -1;
-	}
-
-#endif
-
-#ifdef JACK_USE_MACH_THREADS
-
-	/* a secondary thread that runs the process callback and uses
-	   ultra-fast Mach primitives for inter-thread signalling.
-
-	   XXX in a properly structured JACK, there would be no
-	   need for this, because we would have client wake up
-	   methods that encapsulated the underlying mechanism
-	   used.
-
-	*/
-
-	if (jack_client_create_thread(client,
-				      &client->process_thread,
-				      client->engine->client_priority,
-				      client->engine->real_time,
-				      jack_client_process_thread, client)) {
-		return -1;
-	}
-#endif /* JACK_USE_MACH_THREADS */
-
-	return 0;
-}
-
-int 
-jack_activate (jack_client_t *client)
-{
-	jack_request_t req;
-
-	/* we need to scribble on our stack to ensure that its memory
-	 * pages are actually mapped (more important for mlockall(2)
-	 * usage in jack_start_thread())
-	 */
-         
-	char buf[JACK_THREAD_STACK_TOUCH];
-	int i;
-
-	for (i = 0; i < JACK_THREAD_STACK_TOUCH; i++) {
-		buf[i] = (char) (i & 0xff);
-	}
-
-	if (client->control->type == ClientInternal ||
-	    client->control->type == ClientDriver) {
-		goto startit;
-	}
-
-	/* get the pid of the client process to pass it to engine */
-
-	client->control->pid = getpid ();
-
-#ifdef USE_CAPABILITIES
-
-	if (client->engine->has_capabilities != 0 &&
-	    client->control->pid != 0 && client->engine->real_time != 0) {
-
-		/* we need to ask the engine for realtime capabilities
-		   before trying to start the realtime thread
-		*/
-
-		req.type = SetClientCapabilities;
-		req.x.client_id = client->control->id;
-		req.x.cap_pid = client->control->pid;
-
-		jack_client_deliver_request (client, &req);
-
-		if (req.status) {
-
-			/* what to do? engine is running realtime, it
-			   is using capabilities and has them
-			   (otherwise we would not get an error
-			   return) but for some reason it could not
-			   give the client the required capabilities.
-			   For now, leave the client so that it
-			   still runs, albeit non-realtime.
-			*/
-			
-			jack_error ("could not receive realtime capabilities, "
-				    "client will run non-realtime");
-		} 
-	}
-#endif /* USE_CAPABILITIES */
-
-	if (client->first_active) {
-
-		pthread_mutex_init (&client_lock, NULL);
-		pthread_cond_init (&client_ready, NULL);
-		
-		pthread_mutex_lock (&client_lock);
-
-		if (jack_start_thread (client)) {
-			pthread_mutex_unlock (&client_lock);
-			return -1;
-		}
-
-		pthread_cond_wait (&client_ready, &client_lock);
-		pthread_mutex_unlock (&client_lock);
-
-		if (!client->thread_ok) {
-			jack_error ("could not start client thread");
-			return -1;
-		}
-
-		client->first_active = FALSE;
-	}
-
-  startit:
-
-	req.type = ActivateClient;
-	req.x.client_id = client->control->id;
-
-	return jack_client_deliver_request (client, &req);
-}
-
-static int 
-jack_deactivate_aux (jack_client_t *client)
-{
-	jack_request_t req;
-	int rc = ESRCH;			/* already shut down */
-	
-	if (client && client->control) { /* not shut down? */
-		rc = 0;
-		if (client->control->active) { /* still active? */
-			req.type = DeactivateClient;
-			req.x.client_id = client->control->id;
-			rc = jack_client_deliver_request (client, &req);
-		}
-	}
-	return rc;
-}
-
-int 
-jack_deactivate (jack_client_t *client)
-{
-	return jack_deactivate_aux(client);
-}
-
-static int
-jack_client_close_aux (jack_client_t *client)
-{
-	JSList *node;
-	void *status;
-	int rc;
-
-	rc = jack_deactivate_aux (client);
-	if (rc == ESRCH) {		/* already shut down? */
-		return rc;
-	}
-
-	if (client->control->type == ClientExternal) {
-
-#if JACK_USE_MACH_THREADS 
-		if (client->rt_thread_ok) {
-			// MacOSX pthread_cancel not implemented in
-			// Darwin 5.5, 6.4
-			mach_port_t machThread =
-				pthread_mach_thread_np (client->process_thread);
-			thread_terminate (machThread);
-		}
-#endif
-	
-		/* stop the thread that communicates with the jack
-		 * server, only if it was actually running 
-		 */
-		
-		if (client->thread_ok){
-			pthread_cancel (client->thread);
-			pthread_join (client->thread, &status);
-		}
-
-		if (client->control) {
-			jack_release_shm (&client->control_shm);
-			client->control = NULL;
-		}
-		if (client->engine) {
-			jack_release_shm (&client->engine_shm);
-			client->engine = NULL;
-		}
-
-		if (client->port_segment) {
-			jack_port_type_id_t ptid;
-			for (ptid = 0; ptid < client->n_port_types; ++ptid) {
-				jack_release_shm (&client->port_segment[ptid]);
-			}
-			free (client->port_segment);
-			client->port_segment = NULL;
-		}
-
-#ifndef JACK_USE_MACH_THREADS
-		if (client->graph_wait_fd >= 0) {
-			close (client->graph_wait_fd);
-		}
-		
-		if (client->graph_next_fd >= 0) {
-			close (client->graph_next_fd);
-		}
-#endif		
-		
-		close (client->event_fd);
-
-		if (shutdown (client->request_fd, SHUT_RDWR)) {
-			jack_error ("could not shutdown client request socket");
-		}
-
-		close (client->request_fd);
-
-	}
-
-	for (node = client->ports; node; node = jack_slist_next (node)) {
-		free (node->data);
-	}
-	jack_slist_free (client->ports);
-	for (node = client->ports_ext; node; node = jack_slist_next (node)) {
-		free (node->data);
-	}
-	jack_slist_free (client->ports_ext);
-	jack_client_free (client);
-	jack_messagebuffer_exit ();
-
-	return rc;
-}
-
-int
-jack_client_close (jack_client_t *client)
-{
-	return jack_client_close_aux(client);
-}	
-
-int 
-jack_is_realtime (jack_client_t *client)
-{
-	return client->engine->real_time;
-}
-
-jack_nframes_t 
-jack_get_buffer_size (jack_client_t *client)
-{
-	return client->engine->buffer_size;
-}
-
-int
-jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes)
-{
-#ifdef DO_BUFFER_RESIZE
-	jack_request_t req;
-
-	req.type = SetBufferSize;
-	req.x.nframes = nframes;
-
-	return jack_client_deliver_request (client, &req);
-#else
-	return ENOSYS;
-
-#endif /* DO_BUFFER_RESIZE */
-}
-
-int 
-jack_connect (jack_client_t *client, const char *source_port,
-	      const char *destination_port)
-{
-	jack_request_t req;
-
-	req.type = ConnectPorts;
-
-	snprintf (req.x.connect.source_port,
-		  sizeof (req.x.connect.source_port), "%s", source_port);
-	snprintf (req.x.connect.destination_port,
-		  sizeof (req.x.connect.destination_port),
-		  "%s", destination_port);
-
-	return jack_client_deliver_request (client, &req);
-}
-
-int
-jack_port_disconnect (jack_client_t *client, jack_port_t *port)
-{
-	jack_request_t req;
-
-	pthread_mutex_lock (&port->connection_lock);
-
-	if (port->connections == NULL) {
-		pthread_mutex_unlock (&port->connection_lock);
-		return 0;
-	}
-
-	pthread_mutex_unlock (&port->connection_lock);
-
-	req.type = DisconnectPort;
-	req.x.port_info.port_id = port->shared->id;
-
-	return jack_client_deliver_request (client, &req);
-}
-
-int 
-jack_disconnect (jack_client_t *client, const char *source_port,
-		 const char *destination_port)
-{
-	jack_request_t req;
-
-	req.type = DisconnectPorts;
-
-	snprintf (req.x.connect.source_port,
-		  sizeof (req.x.connect.source_port), "%s", source_port);
-	snprintf (req.x.connect.destination_port,
-		  sizeof (req.x.connect.destination_port),
-		  "%s", destination_port);
-	
-	return jack_client_deliver_request (client, &req);
-}
-
-void
-jack_set_error_function (void (*func) (const char *))
-{
-	jack_error_callback = func;
-}
-
-void
-jack_set_info_function (void (*func) (const char *))
-{
-	jack_info_callback = func;
-}
-
-int 
-jack_set_graph_order_callback (jack_client_t *client,
-			       JackGraphOrderCallback callback, void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->graph_order = callback;
-	client->graph_order_arg = arg;
-	client->control->graph_order_cbset = (callback != NULL);
-	return 0;
-}
-
-int jack_set_xrun_callback (jack_client_t *client,
-			    JackXRunCallback callback, void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-
-	client->xrun = callback;
-	client->xrun_arg = arg;
-	client->control->xrun_cbset = (callback != NULL);
-	return 0;       
-}
-
-int
-jack_set_process_callback (jack_client_t *client,
-			   JackProcessCallback callback, void *arg)
-
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	
-	if (client->control->thread_cb_cbset) {
-		jack_error ("A thread callback has already been setup, both models cannot be used at the same time!");
-		return -1;
-	}
-	
-	client->process_arg = arg;
-	client->process = callback;
-	client->control->process_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_thread_init_callback (jack_client_t *client,
-			       JackThreadInitCallback callback, void *arg)
-
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->thread_init_arg = arg;
-	client->thread_init = callback;
-	client->control->thread_init_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_freewheel_callback (jack_client_t *client,
-			     JackFreewheelCallback callback, void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->freewheel_arg = arg;
-	client->freewheel_cb = callback;
-	client->control->freewheel_cb_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_buffer_size_callback (jack_client_t *client,
-			       JackBufferSizeCallback callback, void *arg)
-{
-	client->bufsize_arg = arg;
-	client->bufsize = callback;
-	client->control->bufsize_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_port_registration_callback(jack_client_t *client,
-				    JackPortRegistrationCallback callback,
-				    void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->port_register_arg = arg;
-	client->port_register = callback;
-	client->control->port_register_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_port_connect_callback(jack_client_t *client,
-			       JackPortConnectCallback callback,
-			       void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->port_connect_arg = arg;
-	client->port_connect = callback;
-	client->control->port_connect_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_client_registration_callback(jack_client_t *client,
-				      JackClientRegistrationCallback callback,
-				      void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->client_register_arg = arg;
-	client->client_register = callback;
-	client->control->client_register_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_set_process_thread(jack_client_t* client, JackThreadCallback callback, void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	
-	if (client->control->process_cbset) {
-		jack_error ("A process callback has already been setup, both models cannot be used at the same time!");
-		return -1;
-	}
-
-	client->thread_cb_arg = arg;
-	client->thread_cb = callback;
-	client->control->thread_cb_cbset = (callback != NULL);
-	return 0;
-}
-
-int
-jack_get_process_done_fd (jack_client_t *client)
-{
-	return client->graph_next_fd;
-}
-
-void
-jack_on_shutdown (jack_client_t *client, void (*function)(void *arg), void *arg)
-{
-	client->on_shutdown = function;
-	client->on_shutdown_arg = arg;
-}
-
-void
-jack_on_info_shutdown (jack_client_t *client, void (*function)(jack_status_t, const char*, void *arg), void *arg)
-{
-	client->on_info_shutdown = function;
-	client->on_info_shutdown_arg = arg;
-}
-
-const char **
-jack_get_ports (jack_client_t *client,
-		const char *port_name_pattern,
-		const char *type_name_pattern,
-		unsigned long flags)
-{
-	jack_control_t *engine;
-	const char **matching_ports;
-	unsigned long match_cnt;
-	jack_port_shared_t *psp;
-	unsigned long i;
-	regex_t port_regex;
-	regex_t type_regex;
-	int matching;
-
-	engine = client->engine;
-
-	if (port_name_pattern && port_name_pattern[0]) {
-		regcomp (&port_regex, port_name_pattern,
-			 REG_EXTENDED|REG_NOSUB);
-	}
-	if (type_name_pattern && type_name_pattern[0]) {
-		regcomp (&type_regex, type_name_pattern,
-			 REG_EXTENDED|REG_NOSUB);
-	}
-
-	psp = engine->ports;
-	match_cnt = 0;
-
-	if ((matching_ports = (const char **) malloc (sizeof (char *) * engine->port_max)) == NULL) {
-		return NULL;
-	}
-
-	for (i = 0; i < engine->port_max; i++) {
-		matching = 1;
-
-		if (!psp[i].in_use) {
-			continue;
-		}
-
-		if (flags) {
-			if ((psp[i].flags & flags) != flags) {
-				matching = 0;
-			}
-		}
-
-		if (matching && port_name_pattern && port_name_pattern[0]) {
-			if (regexec (&port_regex, psp[i].name, 0, NULL, 0)) {
-				matching = 0;
-			}
-		} 
-
-		if (matching && type_name_pattern && type_name_pattern[0]) {
-			jack_port_type_id_t ptid = psp[i].ptype_id;
-			if (regexec (&type_regex,
-				     engine->port_types[ptid].type_name,
-				     0, NULL, 0)) {
-				matching = 0;
-			}
-		} 
-		
-		if (matching) {
-			matching_ports[match_cnt++] = psp[i].name;
-		}
-	}
-	if (port_name_pattern && port_name_pattern[0]) {
-		regfree (&port_regex);
-	}
-	if (type_name_pattern && type_name_pattern[0]) {
-		regfree (&type_regex);
-	}
-
-	matching_ports[match_cnt] = 0;
-
-	if (match_cnt == 0) {
-		free (matching_ports);
-		matching_ports = 0;
-	}
-
-	return matching_ports;
-}
-
-float
-jack_cpu_load (jack_client_t *client)
-{
-	return client->engine->cpu_load;
-}
-
-float
-jack_get_xrun_delayed_usecs (jack_client_t *client)
-{
-	return client->engine->xrun_delayed_usecs;
-}
-
-float
-jack_get_max_delayed_usecs (jack_client_t *client)
-{
-	return client->engine->max_delayed_usecs;
-}
-
-void
-jack_reset_max_delayed_usecs (jack_client_t *client)
-{
-	client->engine->max_delayed_usecs =  0.0f;
-}
-
-pthread_t
-jack_client_thread_id (jack_client_t *client)
-{
-	return client->thread_id;
-}
-
-int
-jack_client_name_size(void)
-{
-	return JACK_CLIENT_NAME_SIZE;
-}
-
-int
-jack_port_name_size(void)
-{
-	return JACK_PORT_NAME_SIZE;
-}
-
-int
-jack_port_type_size(void)
-{
-	return JACK_PORT_TYPE_SIZE;
-}
-
-void
-jack_free (void* ptr)
-{
-	free (ptr);
-}
diff --git a/libjack/driver.c b/libjack/driver.c
deleted file mode 100644
index 34db14a..0000000
--- a/libjack/driver.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* -*- mode: c; c-file-style: "linux"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-    
-*/
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include <jack/internal.h>
-#include <jack/driver.h>
-#include <jack/engine.h>
-#include <jack/thread.h>
-
-#ifdef USE_MLOCK
-#include <sys/mman.h>
-#endif /* USE_MLOCK */
-
-static int dummy_attach (jack_driver_t *drv, jack_engine_t *eng) { return 0; }
-static int dummy_detach (jack_driver_t *drv, jack_engine_t *eng) { return 0; }
-static int dummy_write (jack_driver_t *drv,
-			jack_nframes_t nframes) { return 0; }
-static int dummy_read (jack_driver_t *drv, jack_nframes_t nframes) { return 0; }
-static int dummy_null_cycle (jack_driver_t *drv,
-			     jack_nframes_t nframes) { return 0; }
-static int dummy_bufsize (jack_driver_t *drv,
-			  jack_nframes_t nframes) {return 0;}
-static int dummy_stop (jack_driver_t *drv) { return 0; }
-static int dummy_start (jack_driver_t *drv) { return 0; }
-
-void
-jack_driver_init (jack_driver_t *driver)
-{
-	memset (driver, 0, sizeof (*driver));
-
-	driver->attach = dummy_attach;
-	driver->detach = dummy_detach;
-	driver->write = dummy_write;
-	driver->read = dummy_read;
-	driver->null_cycle = dummy_null_cycle;
-	driver->bufsize = dummy_bufsize;
-	driver->start = dummy_start;
-	driver->stop = dummy_stop;
-}
-
-
-
-/****************************
- *** Non-Threaded Drivers ***
- ****************************/
-
-static int dummy_nt_run_cycle (jack_driver_nt_t *drv) { return 0; }
-static int dummy_nt_attach    (jack_driver_nt_t *drv) { return 0; }
-static int dummy_nt_detach    (jack_driver_nt_t *drv) { return 0; }
-
-
-/*
- * These are used in driver->nt_run for controlling whether or not
- * driver->engine->driver_exit() gets called (EXIT = call it, PAUSE = don't)
- */
-#define DRIVER_NT_RUN   0
-#define DRIVER_NT_EXIT  1
-#define DRIVER_NT_PAUSE 2
-#define DRIVER_NT_DYING 3
-
-static int
-jack_driver_nt_attach (jack_driver_nt_t * driver, jack_engine_t * engine)
-{
-	driver->engine = engine;
-	return driver->nt_attach (driver);
-}
-
-static int
-jack_driver_nt_detach (jack_driver_nt_t * driver, jack_engine_t * engine)
-{
-	int ret;
-
-	ret = driver->nt_detach (driver);
-	driver->engine = NULL;
-
-	return ret;
-}
-
-static void *
-jack_driver_nt_thread (void * arg)
-{
-	jack_driver_nt_t * driver = (jack_driver_nt_t *) arg;
-	int rc = 0;
-	int run;
-
-	/* This thread may start running before pthread_create()
-	 * actually stores the driver->nt_thread value.  It's safer to
-	 * store it here as well. 
-	 */
-
-	driver->nt_thread = pthread_self();
-
-	pthread_mutex_lock (&driver->nt_run_lock);
-
-	while ((run = driver->nt_run) == DRIVER_NT_RUN) {
-		pthread_mutex_unlock (&driver->nt_run_lock);
-
-		if ((rc = driver->nt_run_cycle (driver)) != 0) {
-			jack_error ("DRIVER NT: could not run driver cycle");
-			goto out;
-		}
-
-		pthread_mutex_lock (&driver->nt_run_lock);
-	}
-
-	pthread_mutex_unlock (&driver->nt_run_lock);
-
- out:
-	if (rc) {
-		driver->nt_run = DRIVER_NT_DYING;
-		driver->engine->driver_exit (driver->engine);
-	}
-	pthread_exit (NULL);
-}
-
-static int
-jack_driver_nt_start (jack_driver_nt_t * driver)
-{
-	int err;
-
-	/* stop the new thread from really starting until the driver has
-	   been started.
-	*/
- 
-	pthread_mutex_lock (&driver->nt_run_lock);
-	driver->nt_run = DRIVER_NT_RUN;
-
-	if ((err = jack_client_create_thread (NULL,
-					      &driver->nt_thread, 
-					      driver->engine->rtpriority,
-					      driver->engine->control->real_time,
-					      jack_driver_nt_thread, driver)) != 0) {
-		jack_error ("DRIVER NT: could not start driver thread!");
-		return err;
-	}
-
-	if ((err = driver->nt_start (driver)) != 0) {
-		/* make the thread run and exit immediately */
-		driver->nt_run = DRIVER_NT_EXIT;
-		pthread_mutex_unlock (&driver->nt_run_lock);
-		jack_error ("DRIVER NT: could not start driver");
-		return err;
-	}
-
-	/* let the thread run, since the underlying "device" has now been started */
-
-	pthread_mutex_unlock (&driver->nt_run_lock);
-
-	return 0;
-}
-
-static int
-jack_driver_nt_do_stop (jack_driver_nt_t * driver, int run)
-{
-	int err;
-
-	pthread_mutex_lock (&driver->nt_run_lock);
-	if(driver->nt_run != DRIVER_NT_DYING) {
-		driver->nt_run = run;
-	}
-	pthread_mutex_unlock (&driver->nt_run_lock);
-
-	/* detect when called while the thread is shutting itself down */
-	if (driver->nt_thread && driver->nt_run != DRIVER_NT_DYING
-	    && (err = pthread_join (driver->nt_thread, NULL)) != 0) {
-		jack_error ("DRIVER NT: error waiting for driver thread: %s",
-                            strerror (err));
-		return err;
-	}
-
-	if ((err = driver->nt_stop (driver)) != 0) {
-		jack_error ("DRIVER NT: error stopping driver");
-		return err;
-	}
-
-	return 0;
-}
-
-static int
-jack_driver_nt_stop (jack_driver_nt_t * driver)
-{
-	return jack_driver_nt_do_stop (driver, DRIVER_NT_EXIT);
-}
-
-static int
-jack_driver_nt_bufsize (jack_driver_nt_t * driver, jack_nframes_t nframes)
-{
-	int err;
-	int ret;
-
-	err = jack_driver_nt_do_stop (driver, DRIVER_NT_PAUSE);
-	if (err) {
-		jack_error ("DRIVER NT: could not stop driver to change buffer size");
-		driver->engine->driver_exit (driver->engine);
-		return err;
-	}
-
-	ret = driver->nt_bufsize (driver, nframes);
-
-	err = jack_driver_nt_start (driver);
-	if (err) {
-		jack_error ("DRIVER NT: could not restart driver during buffer size change");
-		driver->engine->driver_exit (driver->engine);
-		return err;
-	}
-
-	return ret;
-}
-
-void
-jack_driver_nt_init (jack_driver_nt_t * driver)
-{
-	memset (driver, 0, sizeof (*driver));
-
-	jack_driver_init ((jack_driver_t *) driver);
-
-	driver->attach       = (JackDriverAttachFunction)    jack_driver_nt_attach;
-	driver->detach       = (JackDriverDetachFunction)    jack_driver_nt_detach;
-	driver->bufsize      = (JackDriverBufSizeFunction)   jack_driver_nt_bufsize;
-	driver->stop         = (JackDriverStopFunction)      jack_driver_nt_stop;
-	driver->start        = (JackDriverStartFunction)     jack_driver_nt_start;
-
-	driver->nt_bufsize   = (JackDriverNTBufSizeFunction) dummy_bufsize;
-	driver->nt_start     = (JackDriverNTStartFunction)   dummy_start;
-	driver->nt_stop      = (JackDriverNTStopFunction)    dummy_stop;
-	driver->nt_attach    =                               dummy_nt_attach;
-	driver->nt_detach    =                               dummy_nt_detach;
-	driver->nt_run_cycle =                               dummy_nt_run_cycle;
-
-
-	pthread_mutex_init (&driver->nt_run_lock, NULL);
-}
-
-void
-jack_driver_nt_finish     (jack_driver_nt_t * driver)
-{
-	pthread_mutex_destroy (&driver->nt_run_lock);
-}
diff --git a/libjack/intclient.c b/libjack/intclient.c
deleted file mode 100644
index 8901b5d..0000000
--- a/libjack/intclient.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
- *  Copyright (C) 2004 Jack O'Quin
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation; either version 2.1 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *  
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software 
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <jack/internal.h>
-#include <jack/intclient.h>
-#include <jack/varargs.h>
-
-#include "local.h"
-
-static jack_intclient_t
-jack_intclient_request(RequestType type, jack_client_t *client,
-		  const char* client_name, jack_options_t options,
-		  jack_status_t *status, jack_varargs_t *va)
-{
-	jack_request_t req;
-
-	memset (&req, 0, sizeof (req));
-
-	if (strlen (client_name) >= sizeof (req.x.intclient.name)) {
-		jack_error ("\"%s\" is too long for a JACK client name.\n"
-			    "Please use %lu characters or less.",
-			    client_name, sizeof (req.x.intclient.name));
-		return 0;
-	}
-
-	if (va->load_name
-	    && (strlen (va->load_name) > sizeof (req.x.intclient.path) - 1)) {
-		jack_error ("\"%s\" is too long for a shared object name.\n"
-			     "Please use %lu characters or less.",
-			    va->load_name, sizeof (req.x.intclient.path) - 1);
-		*status |= (JackFailure|JackInvalidOption);
-		return 0;
-	}
-
-	if (va->load_init
-	    && (strlen (va->load_init) > sizeof (req.x.intclient.init) - 1)) {
-		jack_error ("\"%s\" is too long for internal client init "
-			    "string.\nPlease use %lu characters or less.",
-			    va->load_init, sizeof (req.x.intclient.init) - 1);
-		*status |= (JackFailure|JackInvalidOption);
-		return 0;
-	}
-
-	req.type = type;
-	req.x.intclient.options = options;
-	strncpy (req.x.intclient.name, client_name,
-		 sizeof (req.x.intclient.name));
-	if (va->load_name)
-		strncpy (req.x.intclient.path, va->load_name,
-			 sizeof (req.x.intclient.path));
-	if (va->load_init)
-		strncpy (req.x.intclient.init, va->load_init,
-			 sizeof (req.x.intclient.init));
-
-	jack_client_deliver_request (client, &req);
-
-	*status |= req.status;
-
-	if (*status & JackFailure)
-		return 0;
-
-	return req.x.intclient.id;
-}
-
-char *
-jack_get_internal_client_name (jack_client_t *client,
-			       jack_intclient_t intclient)
-{
-	jack_request_t req;
-	char *name;
-
-	memset (&req, 0, sizeof (req));
-	req.type = IntClientName;
-	req.x.intclient.options = JackNullOption;
-	req.x.intclient.id = intclient;
-
-	jack_client_deliver_request (client, &req);
-
-	if (req.status & JackFailure) {
-		return NULL;
-	}
-
-	/* allocate storage for returning the name */
-	if ((name = strdup (req.x.intclient.name)) == NULL) {
-		return NULL;
-	}
-
-	return name;
-}
-
-jack_intclient_t
-jack_internal_client_handle (jack_client_t *client,
-			     const char *client_name,
-			     jack_status_t *status)
-{
-	jack_request_t req;
-	jack_status_t my_status;
-
-	if (status == NULL)		/* no status from caller? */
-		status = &my_status;	/* use local status word */
-	*status = 0;
-
-	memset (&req, 0, sizeof (req));
-	req.type = IntClientHandle;
-	req.x.intclient.options = JackNullOption;
-	strncpy (req.x.intclient.name, client_name,
-		 sizeof (req.x.intclient.name));
-
-	*status = jack_client_deliver_request (client, &req);
-
-	return req.x.intclient.id;
-}
-
-jack_intclient_t
-jack_internal_client_load_aux (jack_client_t *client,
-		  const char *client_name,
-		  jack_options_t options,
-		  jack_status_t *status, va_list ap)
-{
-	jack_varargs_t va;
-	jack_status_t my_status;
-
-	if (status == NULL)		/* no status from caller? */
-		status = &my_status;	/* use local status word */
-	*status = 0;
-
-	/* validate parameters */
-	if ((options & ~JackLoadOptions)) {
-		*status |= (JackFailure|JackInvalidOption);
-		return 0;
-	}
-
-	/* parse variable arguments */
-	jack_varargs_parse (options, ap, &va);
-
-	return jack_intclient_request (IntClientLoad, client, client_name,
-				       options, status, &va);
-}
-
-jack_intclient_t
-jack_internal_client_load (jack_client_t *client,
-			   const char *client_name,
-			   jack_options_t options,
-			   jack_status_t *status, ...)
-{
-    va_list ap;
-    va_start(ap, status);
-    jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap);
-    va_end(ap);
-    return res;
-}
-
-jack_status_t
-jack_internal_client_unload (jack_client_t *client,
-			     jack_intclient_t intclient)
-{
-	jack_request_t req;
-	jack_status_t status;
-
-	if (intclient) {
-
-		memset (&req, 0, sizeof (req));
-		req.type = IntClientUnload;
-		req.x.intclient.options = JackNullOption;
-		req.x.intclient.id = intclient;
-		jack_client_deliver_request (client, &req);
-		status = req.status;
-
-	} else {			/* intclient is null */
-		status = (JackNoSuchClient|JackFailure);
-	}
-
-	return status;
-}
diff --git a/libjack/local.h b/libjack/local.h
deleted file mode 100644
index ef03235..0000000
--- a/libjack/local.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __jack_libjack_local_h__
-#define __jack_libjack_local_h__
-
-/* Client data structure, in the client address space. */
-struct _jack_client {
-
-    jack_control_t        *engine;
-    jack_client_control_t *control;
-    jack_shm_info_t        engine_shm;
-    jack_shm_info_t        control_shm;
-
-    struct pollfd*  pollfd;
-    int             pollmax;
-    int             graph_next_fd;
-    int             request_fd;
-    int             upstream_is_jackd;
-
-    /* these two are copied from the engine when the 
-     * client is created.
-    */
-
-    jack_port_type_id_t n_port_types;
-    jack_shm_info_t*    port_segment;
-
-    JSList *ports;
-    JSList *ports_ext;
-
-    pthread_t thread;
-    char fifo_prefix[PATH_MAX+1];
-    void (*on_shutdown)(void *arg);
-    void *on_shutdown_arg;
-    void (*on_info_shutdown)(jack_status_t, const char*, void *arg);
-    void *on_info_shutdown_arg;
-    char thread_ok : 1;
-    char first_active : 1;
-    pthread_t thread_id;
-    char name[JACK_CLIENT_NAME_SIZE];
-
-#ifdef JACK_USE_MACH_THREADS
-    /* specific ressources for server/client real-time thread communication */
-    mach_port_t clienttask, bp, serverport, replyport;
-    trivial_message  message;
-    pthread_t process_thread;
-    char rt_thread_ok : 1;
-#endif
-
-    /* callbacks 
-     */
-    JackProcessCallback process;
-    void *process_arg;
-    JackThreadInitCallback thread_init;
-    void *thread_init_arg;
-    JackBufferSizeCallback bufsize;
-    void *bufsize_arg;
-    JackSampleRateCallback srate;
-    void *srate_arg;
-    JackPortRegistrationCallback port_register;
-    void *port_register_arg;
-    JackPortConnectCallback port_connect;
-    void *port_connect_arg;
-    JackGraphOrderCallback graph_order;
-    void *graph_order_arg;
-    JackXRunCallback xrun;
-    void *xrun_arg;
-    JackSyncCallback sync_cb;
-    void *sync_arg;
-    JackTimebaseCallback timebase_cb;
-    void *timebase_arg;
-    JackFreewheelCallback freewheel_cb;
-    void *freewheel_arg;
-    JackClientRegistrationCallback client_register;	
-    void *client_register_arg;
-	JackThreadCallback thread_cb;	
-    void *thread_cb_arg;
-
-    /* external clients: set by libjack
-     * internal clients: set by engine */
-    int (*deliver_request)(void*, jack_request_t*); /* JOQ: 64/32 bug! */
-    void *deliver_arg;
-
-};
-
-extern int jack_client_deliver_request (const jack_client_t *client,
-					jack_request_t *req);
-extern jack_port_t *jack_port_new (const jack_client_t *client,
-				   jack_port_id_t port_id,
-				   jack_control_t *control);
-
-extern void *jack_zero_filled_buffer;
-
-extern void jack_set_clock_source (jack_timer_type_t);
-
-#endif /* __jack_libjack_local_h__ */
diff --git a/libjack/messagebuffer.c b/libjack/messagebuffer.c
deleted file mode 100644
index f724da1..0000000
--- a/libjack/messagebuffer.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * messagebuffer.c -- realtime-safe message handling for jackd.
- *
- *  This interface is included in libjack so backend drivers can use
- *  it, *not* for external client processes.  It implements the
- *  VERBOSE() and MESSAGE() macros in a realtime-safe manner.
- */
-
-/*
- *  Copyright (C) 2004 Rui Nuno Capela, Steve Harris
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation; either version 2.1 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *  
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software 
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <unistd.h>
-#include <string.h>
-#include <pthread.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include <jack/messagebuffer.h>
-#include <jack/atomicity.h>
-#include <jack/internal.h>
-
-/* MB_NEXT() relies on the fact that MB_BUFFERS is a power of two */
-#define MB_BUFFERS	128
-#define MB_NEXT(index) ((index+1) & (MB_BUFFERS-1))
-#define MB_BUFFERSIZE	256		/* message length limit */
-
-static char mb_buffers[MB_BUFFERS][MB_BUFFERSIZE];
-static volatile unsigned int mb_initialized = 0;
-static volatile unsigned int mb_inbuffer = 0;
-static volatile unsigned int mb_outbuffer = 0;
-static volatile _Atomic_word mb_overruns = 0;
-static pthread_t mb_writer_thread;
-static pthread_mutex_t mb_write_lock;
-static pthread_cond_t mb_ready_cond;
-
-static void
-mb_flush()
-{
-	/* called WITHOUT the mb_write_lock */
-	while (mb_outbuffer != mb_inbuffer) {
-		jack_info(mb_buffers[mb_outbuffer]);
-		mb_outbuffer = MB_NEXT(mb_outbuffer);
-	}
-}
-
-static void *
-mb_thread_func(void *arg)
-{
-	/* The mutex is only to eliminate collisions between multiple
-	 * writer threads and protect the condition variable. */
-	pthread_mutex_lock(&mb_write_lock);
-
-	while (mb_initialized) {
-		pthread_cond_wait(&mb_ready_cond, &mb_write_lock);
-
-		/* releasing the mutex reduces contention */
-		pthread_mutex_unlock(&mb_write_lock);
-		mb_flush();
-		pthread_mutex_lock(&mb_write_lock);
-	}
-
-	pthread_mutex_unlock(&mb_write_lock);
-
-	return NULL;
-}
-
-void 
-jack_messagebuffer_init ()
-{
-	if (mb_initialized)
-		return;
-
-	pthread_mutex_init(&mb_write_lock, NULL);
-	pthread_cond_init(&mb_ready_cond, NULL);
-
-	mb_overruns = 0;
-	mb_initialized = 1;
-
-	if (jack_thread_creator (&mb_writer_thread, NULL, &mb_thread_func, NULL) != 0)
-		mb_initialized = 0;
-}
-
-void 
-jack_messagebuffer_exit ()
-{
-	if (!mb_initialized)
-		return;
-
-	pthread_mutex_lock(&mb_write_lock);
-	mb_initialized = 0;
-	pthread_cond_signal(&mb_ready_cond);
-	pthread_mutex_unlock(&mb_write_lock);
-
-	pthread_join(mb_writer_thread, NULL);
-	mb_flush();
-
-	if (mb_overruns)
-		jack_error("WARNING: %d message buffer overruns!",
-			mb_overruns);
-
-	pthread_mutex_destroy(&mb_write_lock);
-	pthread_cond_destroy(&mb_ready_cond);
-}
-
-
-void 
-jack_messagebuffer_add (const char *fmt, ...)
-{
-	char msg[MB_BUFFERSIZE];
-	va_list ap;
-
-	/* format the message first, to reduce lock contention */
-	va_start(ap, fmt);
-	vsnprintf(msg, MB_BUFFERSIZE, fmt, ap);
-	va_end(ap);
-
-	if (!mb_initialized) {
-		/* Unable to print message with realtime safety.
-		 * Complain and print it anyway. */
-		fprintf(stderr, "ERROR: messagebuffer not initialized: %s",
-			msg);
-		return;
-	}
-
-	if (pthread_mutex_trylock(&mb_write_lock) == 0) {
-		strncpy(mb_buffers[mb_inbuffer], msg, MB_BUFFERSIZE);
-		mb_inbuffer = MB_NEXT(mb_inbuffer);
-		pthread_cond_signal(&mb_ready_cond);
-		pthread_mutex_unlock(&mb_write_lock);
-	} else {			/* lock collision */
-		atomic_add(&mb_overruns, 1);
-	}
-}
diff --git a/libjack/midiport.c b/libjack/midiport.c
deleted file mode 100644
index bcdb958..0000000
--- a/libjack/midiport.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
-    Copyright (C) 2004-2006 Ian Esten
-    Copyright (C) 2006 Dave Robillard
-	
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <jack/jack.h>
-#include <jack/midiport.h>
-#include <jack/port.h>
-
-
-enum { MIDI_INLINE_MAX = sizeof(jack_shmsize_t) };
-
-
-typedef struct _jack_midi_port_info_private {
-	jack_nframes_t        nframes; /**< Number of frames in buffer */
- 	uint32_t                buffer_size; /**< Size of buffer in bytes */
-	jack_nframes_t        event_count; /**< Number of events stored in this buffer */
-	jack_nframes_t        last_write_loc; /**< Used for both writing and mixdown */
-	jack_nframes_t        events_lost;	  /**< Number of events lost in this buffer */
-} POST_PACKED_STRUCTURE jack_midi_port_info_private_t;
-
-typedef struct _jack_midi_port_internal_event {
-	int32_t        time;
-	jack_shmsize_t size;
-	union {
-		jack_shmsize_t byte_offset;
-		jack_midi_data_t inline_data[MIDI_INLINE_MAX];
-	} POST_PACKED_STRUCTURE;
-} POST_PACKED_STRUCTURE jack_midi_port_internal_event_t;
-
-
-static inline jack_midi_data_t*
-jack_midi_event_data(void* port_buffer,
-                     const jack_midi_port_internal_event_t* event)
-{
-	if (event->size <= MIDI_INLINE_MAX)
-		return (jack_midi_data_t*) event->inline_data;
-	else
-		return ((jack_midi_data_t *)port_buffer) + event->byte_offset;
-}
-
-
-/* jack_midi_port_functions.buffer_init */
-static void
-jack_midi_buffer_init(void  *port_buffer,
-                       size_t buffer_size,
-		       jack_nframes_t nframes)
-{
-	jack_midi_port_info_private_t *info =
-		(jack_midi_port_info_private_t *) port_buffer;
-	/* We can also add some magic field to midi buffer to validate client calls */
-	info->nframes = nframes;
-	info->buffer_size = buffer_size;
-	info->event_count = 0;
-	info->last_write_loc = 0;
-	info->events_lost = 0;
-}
-
-
-jack_nframes_t
-jack_midi_get_event_count(void           *port_buffer)
-{
-	jack_midi_port_info_private_t *info =
-		(jack_midi_port_info_private_t *) port_buffer;
-	return info->event_count;
-}
-
-
-int
-jack_midi_event_get(jack_midi_event_t *event,
-                    void              *port_buffer,
-                    jack_nframes_t     event_idx)
-{
-	jack_midi_port_internal_event_t *port_event;
-	jack_midi_port_info_private_t *info =
-		(jack_midi_port_info_private_t *) port_buffer;
-	
-	if (event_idx >= info->event_count)
-#ifdef ENODATA
-		return ENODATA;
-#else
-		return ENOMSG;
-#endif
-	
-	port_event = (jack_midi_port_internal_event_t *) (info + 1);
-	port_event += event_idx;
-	event->time = port_event->time;
-	event->size = port_event->size;
-	event->buffer = jack_midi_event_data(port_buffer, port_event);
-	
-	return 0;
-}
-
-
-size_t
-jack_midi_max_event_size(void           *port_buffer)
-{
-	jack_midi_port_info_private_t *info =
-		(jack_midi_port_info_private_t *) port_buffer;
-	size_t buffer_size =
-		info->buffer_size;
-	
-	/* (event_count + 1) below accounts for jack_midi_port_internal_event_t
-	 * which would be needed to store the next event */
-	size_t used_size = sizeof(jack_midi_port_info_private_t)
-		+ info->last_write_loc
-		+ ((info->event_count + 1)
-		   * sizeof(jack_midi_port_internal_event_t));
-	
-	if (used_size > buffer_size)
-		return 0;
-	else if ((buffer_size - used_size) < MIDI_INLINE_MAX)
-		return MIDI_INLINE_MAX;
-	else
-		return (buffer_size - used_size);
-}
-
-
-jack_midi_data_t*
-jack_midi_event_reserve(void           *port_buffer,
-                        jack_nframes_t  time, 
-                        size_t          data_size)
-{
-	jack_midi_data_t *retbuf = (jack_midi_data_t *) port_buffer;
-
-	jack_midi_port_info_private_t *info =
-		(jack_midi_port_info_private_t *) port_buffer;
-	jack_midi_port_internal_event_t *event_buffer =
-		(jack_midi_port_internal_event_t *) (info + 1);
-	size_t buffer_size =
-		info->buffer_size;
-	
-	if (time < 0 || time >= info->nframes)
- 		goto failed;
- 
- 	if (info->event_count > 0 && time < event_buffer[info->event_count-1].time)
- 		goto failed;
-
-	/* Check if data_size is >0 and there is enough space in the buffer for the event. */
-	if (data_size <=0) {
-		goto failed; // return NULL?
-	} else if (jack_midi_max_event_size (port_buffer) < data_size) {
-		goto failed;
-	} else {
-		jack_midi_port_internal_event_t *event = &event_buffer[info->event_count];
-
-		event->time = time;
-		event->size = data_size;
-		if (data_size <= MIDI_INLINE_MAX) {
-			retbuf = event->inline_data;
-		} else {
-			info->last_write_loc += data_size;
-			retbuf = &retbuf[buffer_size - 1 - info->last_write_loc];
-			event->byte_offset =
-				buffer_size - 1 - info->last_write_loc;
-		}
-		info->event_count += 1;
-		return retbuf;
-	}
- failed:
- 	info->events_lost++;
-	return NULL;
-}
-
-
-int
-jack_midi_event_write(void                   *port_buffer,
-                      jack_nframes_t          time,
-                      const jack_midi_data_t *data,
-                      size_t                  data_size)
-{
-	jack_midi_data_t *retbuf =
-		jack_midi_event_reserve(port_buffer, time, data_size);
-
-	if (retbuf) {
-		memcpy(retbuf, data, data_size);
-		return 0;
-	} else {
-		return ENOBUFS;
-	}
-}
-
-
-/* Can't check to make sure this port is an output anymore.  If this gets
- * called on an input port, all clients after the client that calls it
- * will think there are no events in the buffer as the event count has
- * been reset.
- */
-void
-jack_midi_clear_buffer(void           *port_buffer)
-{
-	jack_midi_port_info_private_t *info =
-		(jack_midi_port_info_private_t *) port_buffer;
-
-	info->event_count = 0;
-	info->last_write_loc = 0;
-	info->events_lost = 0;
-}
-
-
-/* jack_midi_port_functions.mixdown */
-static void
-jack_midi_port_mixdown(jack_port_t    *port, jack_nframes_t nframes)
-{
-	JSList         *node;
-	jack_port_t    *input;
-	jack_nframes_t  num_events = 0;
-	jack_nframes_t  i          = 0;
-	int             err        = 0;
-	jack_nframes_t  lost_events = 0;
-
-	/* The next (single) event to mix in to the buffer */
-	jack_midi_port_info_private_t   *earliest_info;
-	jack_midi_port_internal_event_t *earliest_event;
-	jack_midi_data_t                *earliest_buffer;
-	
-	jack_midi_port_info_private_t   *in_info;   /* For finding next event */
-	jack_midi_port_internal_event_t *in_events; /* Corresponds to in_info */
-	jack_midi_port_info_private_t   *out_info;  /* Output 'buffer' */
-
-	jack_midi_clear_buffer(port->mix_buffer);
-	
-	out_info = (jack_midi_port_info_private_t *) port->mix_buffer;
-
-	/* This function uses jack_midi_port_info_private_t.last_write_loc of the
-	 * source ports to store indices of the last event read from that buffer
-	 * so far.  This is OK because last_write_loc is used when writing events
-	 * to a buffer, which at this stage is already complete so the value
-	 * can be safely smashed. */
-	
-	/* Iterate through all connections to see how many events we need to mix,
-	 * and initialise their 'last event read' (last_write_loc) to 0 */
-	for (node = port->connections; node; node = jack_slist_next(node)) {
-		input = (jack_port_t *) node->data;
-		in_info =
-			(jack_midi_port_info_private_t *) jack_output_port_buffer(input);
-		num_events += in_info->event_count;
-		lost_events += in_info->events_lost;
-		in_info->last_write_loc = 0;
-	}
-
-	/* Write the events in the order of their timestamps */
-	for (i = 0; i < num_events; ++i) {
-		earliest_info = NULL;
-		earliest_event = NULL;
-		earliest_buffer = NULL;
-
-		/* Find the earliest unread event, to mix next
-		 * (search for an event earlier than earliest_event) */
-		for (node = port->connections; node; node = jack_slist_next(node)) {
-			in_info = (jack_midi_port_info_private_t *)
-				jack_output_port_buffer(((jack_port_t *) node->data));
-			in_events = (jack_midi_port_internal_event_t *) (in_info + 1);
-
-			/* If there are unread events left in this port.. */
-			if (in_info->event_count > in_info->last_write_loc) {
-				/* .. and this event is the new earliest .. */
-				/* NOTE: that's why we compare time with <, not <= */
-				if (earliest_info == NULL
-						|| in_events[in_info->last_write_loc].time
-					       < earliest_event->time) {
-					/* .. then set this event as the next earliest */
-					earliest_info = in_info;
-					earliest_event = (jack_midi_port_internal_event_t *)
-						(&in_events[in_info->last_write_loc]);
-				}
-			}
-		}
-
-		if (earliest_info && earliest_event) {
-			earliest_buffer = (jack_midi_data_t *) earliest_info;
-			
-			/* Write event to output */
-			err = jack_midi_event_write(
-				jack_port_buffer(port),
-				earliest_event->time,
-				jack_midi_event_data(earliest_buffer, earliest_event),
-				earliest_event->size);
-			
-			earliest_info->last_write_loc++;
-
-			if (err) {
-				out_info->events_lost = num_events - i;
-				break;
-			}
-		}
-	}
-	assert(out_info->event_count == num_events - out_info->events_lost);
-
-	// inherit total lost events count from all connected ports.
-	out_info->events_lost += lost_events;
-}
-
-
-jack_nframes_t
-jack_midi_get_lost_event_count(void           *port_buffer)
-{
-	return ((jack_midi_port_info_private_t *) port_buffer)->events_lost;
-}
-
-jack_port_functions_t jack_builtin_midi_functions = {
-	.buffer_init    = jack_midi_buffer_init,
-	.mixdown = jack_midi_port_mixdown, 
-};
diff --git a/libjack/pool.c b/libjack/pool.c
deleted file mode 100644
index b8d2538..0000000
--- a/libjack/pool.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-    
-*/
-
-#include <config.h>
-
-#ifdef HAVE_POSIX_MEMALIGN
-#define _XOPEN_SOURCE 600
-#endif
-#include <stdlib.h>
-#include <config.h>
-#include <jack/pool.h>
-
-/* XXX need RT-pool based allocator here */
-void *
-jack_pool_alloc (size_t bytes)
-{
-#ifdef HAVE_POSIX_MEMALIGN
-	void* m;
-	int	err = posix_memalign (&m, 64, bytes);
-	return (!err) ? m : 0;
-#else
-	return malloc (bytes);
-#endif /* HAVE_POSIX_MEMALIGN */
-}
-
-void
-jack_pool_release (void *ptr)
-{
-	free (ptr);
-}
diff --git a/libjack/port.c b/libjack/port.c
deleted file mode 100644
index bb92b7c..0000000
--- a/libjack/port.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2005 Jussi Laako
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
-#include <config.h>
-
-#include <jack/jack.h>
-#include <jack/types.h>
-#include <jack/internal.h>
-#include <jack/engine.h>
-#include <jack/pool.h>
-#include <jack/port.h>
-#include <jack/midiport.h>
-#include <jack/jslist.h>
-#include <jack/intsimd.h>
-
-#include "local.h"
-
-static void    jack_generic_buffer_init(void *port_buffer,
-                                      size_t buffer_size,
-				      jack_nframes_t nframes);
-
-static void    jack_audio_port_mixdown (jack_port_t *port,
-					jack_nframes_t nframes);
-
-/* These function pointers are local to each address space.  For
- * internal clients they reside within jackd; for external clients in
- * the application process. */
-jack_port_functions_t jack_builtin_audio_functions = {
-	.buffer_init    = jack_generic_buffer_init,
-	.mixdown = jack_audio_port_mixdown, 
-};
-
-extern jack_port_functions_t jack_builtin_midi_functions;
-
-jack_port_functions_t jack_builtin_NULL_functions = {
-	.buffer_init    = jack_generic_buffer_init,
-	.mixdown = NULL, 
-};
-
-/* Only the Audio and MIDI port types are currently built in. */
-jack_port_type_info_t jack_builtin_port_types[] = {
-	{ .type_name = JACK_DEFAULT_AUDIO_TYPE, 
-	  .buffer_scale_factor = 1,
-	},
-	{ .type_name = JACK_DEFAULT_MIDI_TYPE, 
-	  .buffer_scale_factor = 1,
-	},
-	{ .type_name = "", }
-};
-
-/* these functions have been taken from libDSP X86.c  -jl */
-
-#ifdef USE_DYNSIMD
-
-static void (*opt_copy) (float *, const float *, int);
-static void (*opt_mix) (float *, const float *, int);
-
-static void
-gen_copyf (float *dest, const float *src, int length)
-{
-	memcpy(dest, src, length * sizeof(float));
-}
-
-static void
-gen_mixf (float *dest, const float *src, int length)
-{
-	int n;
-
-	n = length;
-	while (n--)
-		*dest++ += *src++;
-	/*for (iSample = 0; iSample < iDataLength; iSample++)
-		fpDest[iSample] += fpSrc[iSample];*/
-}
-
-#ifdef ARCH_X86
-
-void jack_port_set_funcs ()
-{
-	if (ARCH_X86_HAVE_SSE2(cpu_type)) {
-		opt_copy = x86_sse_copyf;
-		opt_mix = x86_sse_add2f;
-	}
-	else if (ARCH_X86_HAVE_3DNOW(cpu_type)) {
-		opt_copy = x86_3dnow_copyf;
-		opt_mix = x86_3dnow_add2f;
-	}
-	else {
-		opt_copy = gen_copyf;
-		opt_mix = gen_mixf;
-	}
-}
-
-#else /* ARCH_X86 */
-
-void jack_port_set_funcs ()
-{
-	opt_copy = gen_copyf;
-	opt_mix = gen_mixf;
-}
-
-#endif /* ARCH_X86 */
-
-#endif /* USE_DYNSIMD */
-
-int
-jack_port_name_equals (jack_port_shared_t* port, const char* target)
-{
-	char buf[JACK_PORT_NAME_SIZE+1];
-
-	/* this nasty, nasty kludge is here because between 0.109.0 and 0.109.1,
-	   the ALSA audio backend had the name "ALSA", whereas as before and
-	   after it, it was called "alsa_pcm". this stops breakage for
-	   any setups that have saved "alsa_pcm" or "ALSA" in their connection
-	   state.
-	*/
-
-	if (strncmp (target, "ALSA:capture", 12) == 0 || strncmp (target, "ALSA:playback", 13) == 0) {
-		snprintf (buf, sizeof (buf), "alsa_pcm%s", target+4);
-		target = buf;
-	}
-
-	return (strcmp (port->name, target) == 0 || 
-		strcmp (port->alias1, target) == 0 || 
-		strcmp (port->alias2, target) == 0);
-}
-
-jack_port_functions_t *
-jack_get_port_functions(jack_port_type_id_t ptid)
-{
-	switch (ptid) {
-	case JACK_AUDIO_PORT_TYPE:
-		return &jack_builtin_audio_functions;
-	case JACK_MIDI_PORT_TYPE:
-		return &jack_builtin_midi_functions;
-	/* no other builtin functions */
-	default:
-		return NULL;
-	}
-}
-
-/*
- * Fills buffer with zeroes. For audio ports, engine->silent_buffer relies on it.
- */
-static void
-jack_generic_buffer_init(void *buffer, size_t size, jack_nframes_t nframes)
-{ 
-	memset(buffer, 0, size);
-}
-
-
-jack_port_t *
-jack_port_new (const jack_client_t *client, jack_port_id_t port_id,
-	       jack_control_t *control)
-{
-	jack_port_shared_t *shared = &control->ports[port_id];
-	jack_port_type_id_t ptid = shared->ptype_id;
-	jack_port_t *port;
-
-	if ((port = (jack_port_t *) malloc (sizeof (jack_port_t))) == NULL) {
-		return NULL;
-	}
-	
-	port->mix_buffer = NULL;
-	port->client_segment_base = NULL;
-	port->shared = shared;
-	port->type_info = &client->engine->port_types[ptid];
-	pthread_mutex_init (&port->connection_lock, NULL);
-	port->connections = 0;
-	port->tied = NULL;
-
-	if (client->control->id == port->shared->client_id) {
-			
-		/* It's our port, so initialize the pointers to port
-		 * functions within this address space.  These builtin
-		 * definitions can be overridden by the client. 
-		 */
-		jack_port_functions_t *port_functions = jack_get_port_functions(ptid);
-		if (port_functions == NULL)
-			port_functions = &jack_builtin_NULL_functions;
-		port->fptr = *port_functions;
-		port->shared->has_mixdown = (port->fptr.mixdown ? TRUE : FALSE);
-	}
-
-	/* set up a base address so that port->offset can be used to
-	   compute the correct location. we don't store the location
-	   directly, because port->client_segment_base and/or
-	   port->offset can change if the buffer size or port counts
-	   are changed.
-	*/
-
-	port->client_segment_base =
-		(void **) &client->port_segment[ptid].attached_at;
-
-	return port;
-}
-
-jack_port_t *
-jack_port_register (jack_client_t *client, 
-		    const char *port_name,
-		    const char *port_type,
-		    unsigned long flags,
-		    unsigned long buffer_size)
-{
-	jack_request_t req;
-	jack_port_t *port = 0;
-	int length ;
-
-	req.type = RegisterPort;
-
-	length = strlen ((const char *) client->control->name)
-		+ 1 + strlen (port_name);
-	if ( length >= sizeof (req.x.port_info.name) ) {
-	  jack_error ("\"%s:%s\" is too long to be used as a JACK port name.\n"
-		      "Please use %lu characters or less.",
-		      client->control->name , 
-		      port_name,
-		      sizeof (req.x.port_info.name) - 1);
-	  return NULL ;
-	}
-
-	strcpy ((char *) req.x.port_info.name,
-		(const char *) client->control->name);
-	strcat ((char *) req.x.port_info.name, ":");
-	strcat ((char *) req.x.port_info.name, port_name);
-
-	snprintf (req.x.port_info.type, sizeof (req.x.port_info.type),
-		  "%s", port_type);
-	req.x.port_info.flags = flags;
-	req.x.port_info.buffer_size = buffer_size;
-	req.x.port_info.client_id = client->control->id;
-
-	if (jack_client_deliver_request (client, &req)) {
-		jack_error ("cannot deliver port registration request");
-		return NULL;
-	}
-
-	if ((port = jack_port_new (client, req.x.port_info.port_id,
-				   client->engine)) == NULL) {
-		jack_error ("cannot allocate client side port structure");
-		return NULL;
-	}
-
-	client->ports = jack_slist_prepend (client->ports, port);
-
-	return port;
-}
-
-int 
-jack_port_unregister (jack_client_t *client, jack_port_t *port)
-{
-	jack_request_t req;
-
-	req.type = UnRegisterPort;
-	req.x.port_info.port_id = port->shared->id;
-	req.x.port_info.client_id = client->control->id;
-
-	return jack_client_deliver_request (client, &req);
-}
-
-/* LOCAL (in-client) connection querying only */
-
-int
-jack_port_connected (const jack_port_t *port)
-{
-	return jack_slist_length (port->connections);
-}
-
-int
-jack_port_connected_to (const jack_port_t *port, const char *portname)
-{
-	JSList *node;
-	int ret = FALSE;
-
-	/* XXX this really requires a cross-process lock
-	   so that ports/connections cannot go away
-	   while we are checking for them. that's hard,
-	   and has a non-trivial performance impact
-	   for jackd.
-	*/  
-
-	pthread_mutex_lock (&((jack_port_t *) port)->connection_lock);
-
-	for (node = port->connections; node; node = jack_slist_next (node)) {
-		jack_port_t *other_port = (jack_port_t *) node->data;
-		
-		if (jack_port_name_equals (other_port->shared, portname)) {
-			ret = TRUE;
-			break;
-		}
-	}
-
-	pthread_mutex_unlock (&((jack_port_t *) port)->connection_lock);
-	return ret;
-}
-
-const char **
-jack_port_get_connections (const jack_port_t *port)
-{
-	const char **ret = NULL;
-	JSList *node;
-	unsigned int n;
-
-	/* XXX this really requires a cross-process lock
-	   so that ports/connections cannot go away
-	   while we are checking for them. that's hard,
-	   and has a non-trivial performance impact
-	   for jackd.
-	*/  
-
-	pthread_mutex_lock (&((jack_port_t *) port)->connection_lock);
-
-	if (port->connections != NULL) {
-
-		ret = (const char **)
-			malloc (sizeof (char *)
-				* (jack_slist_length (port->connections) + 1));
-		if (ret == NULL) {
-			pthread_mutex_unlock (&((jack_port_t *)port)->connection_lock);
-			return NULL;
-		}
-
-		for (n = 0, node = port->connections; node;
-		     node = jack_slist_next (node), ++n) {
-			jack_port_t* other =(jack_port_t *) node->data;
-			ret[n] = other->shared->name;
-		}
-		ret[n] = NULL;
-	}
-
-	pthread_mutex_unlock (&((jack_port_t *) port)->connection_lock);
-	return ret;
-}
-
-/* SERVER-SIDE (all) connection querying */
-
-const char **
-jack_port_get_all_connections (const jack_client_t *client,
-			       const jack_port_t *port)
-{
-	const char **ret;
-	jack_request_t req;
-	jack_port_t *tmp;
-	unsigned int i;
-	int need_free = FALSE;
-
-	if (port == NULL) {
-		return NULL;
-	}
-
-	req.type = GetPortConnections;
-
-	req.x.port_info.name[0] = '\0';
-	req.x.port_info.type[0] = '\0';
-	req.x.port_info.flags = 0;
-	req.x.port_info.buffer_size = 0;
-	req.x.port_info.client_id = 0;
-	req.x.port_info.port_id = port->shared->id;
-
-	jack_client_deliver_request (client, &req);
-
-	if (req.status != 0 || req.x.port_connections.nports == 0) {
-		return NULL;
-	}
-
-	if (client->request_fd < 0) {
-		/* internal client, .ports is in our own address space */
-		return req.x.port_connections.ports;
-	}
-
-	if ((ret = (const char **) malloc (sizeof (char *) * (req.x.port_connections.nports + 1))) == NULL) {
-		return NULL;
-	}
-
-	for (i = 0; i < req.x.port_connections.nports; ++i ) {
-		jack_port_id_t port_id;
-		
-		if (read (client->request_fd, &port_id, sizeof (port_id))
-		    != sizeof (port_id)) {
-			jack_error ("cannot read port id from server");
-			return 0;
-		}
-		tmp = jack_port_by_id_int (client, port_id, &need_free);
-		ret[i] = tmp->shared->name;
-		if (need_free) {
-			free (tmp);
-			need_free = FALSE;
-		}
-	}
-
-	ret[i] = NULL;
-
-	return ret;
-}
-
-jack_port_t *
-jack_port_by_id_int (const jack_client_t *client, jack_port_id_t id, int* free)
-{
-	JSList *node;
-
-	for (node = client->ports; node; node = jack_slist_next (node)) {
-		if (((jack_port_t *) node->data)->shared->id == id) {
-			*free = FALSE;
-			return (jack_port_t *) node->data;
-		}
-	}
-
-	if (id >= client->engine->port_max)
-		return NULL;
-
-	if (client->engine->ports[id].in_use) {
-		*free = TRUE;
-		return jack_port_new (client, id, client->engine);
-	}
-
-	return NULL;
-}
-
-jack_port_t *
-jack_port_by_id (jack_client_t *client, jack_port_id_t id)
-{
-	JSList *node;
-	jack_port_t* port;
-	int need_free = FALSE;
-	for (node = client->ports_ext; node; node = jack_slist_next (node)) {
-		port = node->data;
-		if (port->shared->id == id) { // Found port, return the cached structure
-			return port;
-		}
-	}
-	
-	// Otherwise possibly allocate a new port structure, keep it in the ports_ext list for later use
-	port = jack_port_by_id_int (client,id,&need_free);
-	if (port != NULL && need_free)
-		client->ports_ext =
-			jack_slist_prepend (client->ports_ext, port);
-	return port;
-}
-
-jack_port_t *
-jack_port_by_name_int (jack_client_t *client, const char *port_name)
-{
-	unsigned long i, limit;
-	jack_port_shared_t *port;
-	
-	limit = client->engine->port_max;
-	port = &client->engine->ports[0];
-	
-	for (i = 0; i < limit; i++) {
-		if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
-			return jack_port_new (client, port[i].id,
-					      client->engine);
-		}
-	}
-
-	return NULL;
-}
-
-jack_port_t *
-jack_port_by_name (jack_client_t *client,  const char *port_name)
-{
-	JSList *node;
-	jack_port_t* port;
-	for (node = client->ports_ext; node; node = jack_slist_next (node)) {
-		port = node->data;
-		if (jack_port_name_equals (port->shared, port_name)) {
-			/* Found port, return the cached structure. */
-			return port;
-		}
-	}
-	
-	/* Otherwise allocate a new port structure, keep it in the
-	 * ports_ext list for later use. */
-	port = jack_port_by_name_int (client, port_name);
-	if (port != NULL)
-		client->ports_ext =
-			jack_slist_prepend (client->ports_ext, port);
-	return port;
-}
-
-jack_nframes_t
-jack_port_get_latency (jack_port_t *port)
-{
-	return port->shared->latency;
-}
-
-jack_nframes_t
-jack_port_get_total_latency (jack_client_t *client, jack_port_t *port)
-{
-	return port->shared->total_latency;
-}
-
-void
-jack_port_set_latency (jack_port_t *port, jack_nframes_t nframes)
-{
-	port->shared->latency = nframes;
-}
-
-void *
-jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes)
-{
-	JSList *node, *next;
-
-	/* Output port.  The buffer was assigned by the engine
-	   when the port was registered.
-	*/
-	if (port->shared->flags & JackPortIsOutput) {
-		if (port->tied) {
-			return jack_port_get_buffer (port->tied, nframes);
-		}
-
-		return jack_output_port_buffer (port);
-	}
-
-	/* Input port.  Since this can only be called from the
-	   process() callback, and since no connections can be
-	   made/broken during this phase (enforced by the jack
-	   server), there is no need to take the connection lock here
-	*/
-	if ((node = port->connections) == NULL) {
-		
-		/* no connections; return a zero-filled buffer */
-		return (void *) (*(port->client_segment_base) + port->type_info->zero_buffer_offset);
-	}
-
-	if ((next = jack_slist_next (node)) == NULL) {
-
-		/* one connection: use zero-copy mode - just pass
-		   the buffer of the connected (output) port.
-		*/
-		return jack_port_get_buffer (((jack_port_t *) node->data),
-					     nframes);
-	}
-
-	/* Multiple connections.  Use a local buffer and mix the
-	   incoming data into that buffer.  We have already
-	   established the existence of a mixdown function during the
-	   connection process.
-	*/
-	if (port->mix_buffer == NULL) {
-		size_t buffer_size = 
-				port->type_info->buffer_scale_factor
-				* sizeof (jack_default_audio_sample_t)
-				* nframes;
-		port->mix_buffer = jack_pool_alloc (buffer_size);
-		port->fptr.buffer_init (port->mix_buffer, buffer_size, nframes);
-	}
-	port->fptr.mixdown (port, nframes);
-	return (void *) port->mix_buffer;
-}
-
-int
-jack_port_tie (jack_port_t *src, jack_port_t *dst)
-
-{
-	if (dst->shared->client_id != src->shared->client_id) {
-		jack_error ("cannot tie ports not owned by the same client");
-		return -1;
-	}
-
-	if (dst->shared->flags & JackPortIsOutput) {
-		jack_error ("cannot tie an input port");
-		return -1;
-	}
-
-	dst->tied = src;
-	return 0;
-}
-
-int
-jack_port_untie (jack_port_t *port)
-{
-	if (port->tied == NULL) {
-		jack_error ("port \"%s\" is not tied", port->shared->name);
-		return -1;
-	}
-	port->tied = NULL;
-	return 0;
-}
-
-int 
-jack_port_request_monitor (jack_port_t *port, int onoff)
-
-{
-	if (onoff) {
-		port->shared->monitor_requests++;
-	} else if (port->shared->monitor_requests) {
-		port->shared->monitor_requests--;
-	}
-
-	if ((port->shared->flags & JackPortIsOutput) == 0) {
-
-		JSList *node;
-
-		/* this port is for input, so recurse over each of the 
-		   connected ports.
-		 */
-
-		pthread_mutex_lock (&port->connection_lock);
-		for (node = port->connections; node;
-		     node = jack_slist_next (node)) {
-			
-			/* drop the lock because if there is a feedback loop,
-			   we will deadlock. XXX much worse things will
-			   happen if there is a feedback loop !!!
-			*/
-
-			pthread_mutex_unlock (&port->connection_lock);
-			jack_port_request_monitor ((jack_port_t *) node->data,
-						   onoff);
-			pthread_mutex_lock (&port->connection_lock);
-		}
-		pthread_mutex_unlock (&port->connection_lock);
-	}
-
-	return 0;
-}
-	
-int 
-jack_port_request_monitor_by_name (jack_client_t *client,
-				   const char *port_name, int onoff)
-
-{
-	jack_port_t *port;
-	unsigned long i, limit;
-	jack_port_shared_t *ports;
-
-	limit = client->engine->port_max;
-	ports = &client->engine->ports[0];
-	
-	for (i = 0; i < limit; i++) {
-		if (ports[i].in_use &&
-		    strcmp (ports[i].name, port_name) == 0) {
-			port = jack_port_new (client, ports[i].id,
-					      client->engine);
-			return jack_port_request_monitor (port, onoff);
-			free (port);
-			return 0;
-		}
-	}
-
-	return -1;
-}
-
-int
-jack_port_ensure_monitor (jack_port_t *port, int yn)
-{
-	if (yn) {
-		if (port->shared->monitor_requests == 0) {
-			port->shared->monitor_requests++;
-		}
-	} else {
-		if (port->shared->monitor_requests > 0) {
-			port->shared->monitor_requests = 0;
-		}
-	}
-
-	return 0;
-}
-
-int
-jack_port_monitoring_input (jack_port_t *port)
-{
-	return port->shared->monitor_requests > 0;
-}
-
-const char *
-jack_port_name (const jack_port_t *port)
-{
-	return port->shared->name;
-}
-
-int
-jack_port_get_aliases (const jack_port_t *port, char* const aliases[2])
-{
-	int cnt = 0;
-	
-	if (port->shared->alias1[0] != '\0') {
-		snprintf (aliases[0], JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE, "%s", port->shared->alias1);
-		cnt++;
-	}
-
-	if (port->shared->alias2[0] != '\0') {
-		snprintf (aliases[1], JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE, "%s", port->shared->alias2);
-		cnt++;
-	}
-
-	return cnt;
-}
-
-const char *
-jack_port_short_name (const jack_port_t *port)
-{
-	/* we know there is always a colon, because we put
-	   it there ...
-	*/
-
-	return strchr (port->shared->name, ':') + 1;
-}
-
-int 
-jack_port_is_mine (const jack_client_t *client, const jack_port_t *port)
-{
-	return port->shared->client_id == client->control->id;
-}
-
-int
-jack_port_flags (const jack_port_t *port)
-{
-	return port->shared->flags;
-}
-
-const char *
-jack_port_type (const jack_port_t *port)
-{
-	return port->type_info->type_name;
-}
-
-int
-jack_port_set_name (jack_port_t *port, const char *new_name)
-{
-	char *colon;
-	int len;
-
-	colon = strchr (port->shared->name, ':');
-	len = sizeof (port->shared->name) -
-		((int) (colon - port->shared->name)) - 2;
-	snprintf (colon+1, len, "%s", new_name);
-	
-	return 0;
-}
-
-int
-jack_port_set_alias (jack_port_t *port, const char *alias)
-{
-	if (port->shared->alias1[0] == '\0') {
-		snprintf (port->shared->alias1, sizeof (port->shared->alias1), "%s", alias);
-	} else if (port->shared->alias2[0] == '\0') {
-		snprintf (port->shared->alias2, sizeof (port->shared->alias2), "%s", alias);
-	} else {
-		return -1;
-	}
-
-	return 0;
-}
-
-int
-jack_port_unset_alias (jack_port_t *port, const char *alias)
-{
-	if (strcmp (port->shared->alias1, alias) == 0) {
-		port->shared->alias1[0] = '\0';
-	} else if (strcmp (port->shared->alias2, alias) == 0) {
-		port->shared->alias2[0] = '\0';
-	} else {
-		return -1;
-	}
-
-	return 0;
-}
-
-
-/* AUDIO PORT SUPPORT */
-
-static inline float f_max(float x, float a)
-{
-	x -= a;
-	x += fabs (x);
-	x *= 0.5;
-	x += a;
-
-	return (x);
-}
-
-static void 
-jack_audio_port_mixdown (jack_port_t *port, jack_nframes_t nframes)
-{
-	JSList *node;
-	jack_port_t *input;
-#ifndef ARCH_X86
-	jack_nframes_t n;
-	jack_default_audio_sample_t *dst, *src;
-#endif
-	jack_default_audio_sample_t *buffer;
-
-	/* by the time we've called this, we've already established
-	   the existence of more than one connection to this input
-	   port and allocated a mix_buffer.
-	*/
-
-	/* no need to take connection lock, since this is called
-	   from the process() callback, and the jack server
-	   ensures that no changes to connections happen
-	   during this time.
-	*/
-
-	node = port->connections;
-	input = (jack_port_t *) node->data;
-	buffer = port->mix_buffer;
-
-#ifndef USE_DYNSIMD
-	memcpy (buffer, jack_output_port_buffer (input),
-		sizeof (jack_default_audio_sample_t) * nframes);
-#else /* USE_DYNSIMD */
-	opt_copy (buffer, jack_output_port_buffer (input), nframes);
-#endif /* USE_DYNSIMD */
-
-	for (node = jack_slist_next (node); node;
-	     node = jack_slist_next (node)) {
-
-		input = (jack_port_t *) node->data;
-
-#ifndef USE_DYNSIMD
-		n = nframes;
-		dst = buffer;
-		src = jack_output_port_buffer (input);
-
-		while (n--) {
-			*dst++ += *src++;
-		}
-#else /* USE_DYNSIMD */
-		opt_mix (buffer, jack_output_port_buffer (input), nframes);
-#endif /* USE_DYNSIMD */
-	}
-}
-
-
-
-
-
diff --git a/libjack/ringbuffer.c b/libjack/ringbuffer.c
deleted file mode 100644
index c06a1b2..0000000
--- a/libjack/ringbuffer.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
-  Copyright (C) 2000 Paul Davis
-  Copyright (C) 2003 Rohan Drape
-    
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-    
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU Lesser General Public License for more details.
-    
-  You should have received a copy of the GNU Lesser General Public License
-  along with this program; if not, write to the Free Software 
-  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-    
-  ISO/POSIX C version of Paul Davis's lock free ringbuffer C++ code.
-  This is safe for the case of one read thread and one write thread.
-*/
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef USE_MLOCK
-#include <sys/mman.h>
-#endif /* USE_MLOCK */
-#include <jack/ringbuffer.h>
-
-/* Create a new ringbuffer to hold at least `sz' bytes of data. The
-   actual buffer size is rounded up to the next power of two.  */
-
-jack_ringbuffer_t *
-jack_ringbuffer_create (size_t sz)
-{
-	int power_of_two;
-	jack_ringbuffer_t *rb;
-	
-	if ((rb = malloc (sizeof (jack_ringbuffer_t))) == NULL) {
-		return NULL;
-	}
-	
-	for (power_of_two = 1; 1 << power_of_two < sz; power_of_two++);
-	
-	rb->size = 1 << power_of_two;
-	rb->size_mask = rb->size;
-	rb->size_mask -= 1;
-	rb->write_ptr = 0;
-	rb->read_ptr = 0;
-	if ((rb->buf = malloc (rb->size)) == NULL) {
-		free (rb);
-		return NULL;
-	}
-	rb->mlocked = 0;
-	
-	return rb;
-}
-
-/* Free all data associated with the ringbuffer `rb'. */
-
-void
-jack_ringbuffer_free (jack_ringbuffer_t * rb)
-{
-#ifdef USE_MLOCK
-	if (rb->mlocked) {
-		munlock (rb->buf, rb->size);
-	}
-#endif /* USE_MLOCK */
-	free (rb->buf);
-	free (rb);
-}
-
-/* Lock the data block of `rb' using the system call 'mlock'.  */
-
-int
-jack_ringbuffer_mlock (jack_ringbuffer_t * rb)
-{
-#ifdef USE_MLOCK
-	if (mlock (rb->buf, rb->size)) {
-		return -1;
-	}
-#endif /* USE_MLOCK */
-	rb->mlocked = 1;
-	return 0;
-}
-
-/* Reset the read and write pointers to zero. This is not thread
-   safe. */
-
-void
-jack_ringbuffer_reset (jack_ringbuffer_t * rb)
-{
-	rb->read_ptr = 0;
-	rb->write_ptr = 0;
-}
-
-/* Return the number of bytes available for reading.  This is the
-   number of bytes in front of the read pointer and behind the write
-   pointer.  */
-
-size_t
-jack_ringbuffer_read_space (const jack_ringbuffer_t * rb)
-{
-	size_t w, r;
-	
-	w = rb->write_ptr;
-	r = rb->read_ptr;
-	
-	if (w > r) {
-		return w - r;
-	} else {
-		return (w - r + rb->size) & rb->size_mask;
-	}
-}
-
-/* Return the number of bytes available for writing.  This is the
-   number of bytes in front of the write pointer and behind the read
-   pointer.  */
-
-size_t
-jack_ringbuffer_write_space (const jack_ringbuffer_t * rb)
-{
-	size_t w, r;
-
-	w = rb->write_ptr;
-	r = rb->read_ptr;
-
-	if (w > r) {
-		return ((r - w + rb->size) & rb->size_mask) - 1;
-	} else if (w < r) {
-		return (r - w) - 1;
-	} else {
-		return rb->size - 1;
-	}
-}
-
-/* The copying data reader.  Copy at most `cnt' bytes from `rb' to
-   `dest'.  Returns the actual number of bytes copied. */
-
-size_t
-jack_ringbuffer_read (jack_ringbuffer_t * rb, char *dest, size_t cnt)
-{
-	size_t free_cnt;
-	size_t cnt2;
-	size_t to_read;
-	size_t n1, n2;
-
-	if ((free_cnt = jack_ringbuffer_read_space (rb)) == 0) {
-		return 0;
-	}
-
-	to_read = cnt > free_cnt ? free_cnt : cnt;
-
-	cnt2 = rb->read_ptr + to_read;
-
-	if (cnt2 > rb->size) {
-		n1 = rb->size - rb->read_ptr;
-		n2 = cnt2 & rb->size_mask;
-	} else {
-		n1 = to_read;
-		n2 = 0;
-	}
-
-	memcpy (dest, &(rb->buf[rb->read_ptr]), n1);
-	rb->read_ptr = (rb->read_ptr + n1) & rb->size_mask;
-
-	if (n2) {
-		memcpy (dest + n1, &(rb->buf[rb->read_ptr]), n2);
-		rb->read_ptr = (rb->read_ptr + n2) & rb->size_mask;
-	}
-
-	return to_read;
-}
-
-/* The copying data reader w/o read pointer advance.  Copy at most 
-   `cnt' bytes from `rb' to `dest'.  Returns the actual number of bytes 
-   copied. */
-
-size_t
-jack_ringbuffer_peek (jack_ringbuffer_t * rb, char *dest, size_t cnt)
-{
-	size_t free_cnt;
-	size_t cnt2;
-	size_t to_read;
-	size_t n1, n2;
-	size_t tmp_read_ptr;
-
-	tmp_read_ptr = rb->read_ptr;
-
-	if ((free_cnt = jack_ringbuffer_read_space (rb)) == 0) {
-		return 0;
-	}
-
-	to_read = cnt > free_cnt ? free_cnt : cnt;
-
-	cnt2 = tmp_read_ptr + to_read;
-
-	if (cnt2 > rb->size) {
-		n1 = rb->size - tmp_read_ptr;
-		n2 = cnt2 & rb->size_mask;
-	} else {
-		n1 = to_read;
-		n2 = 0;
-	}
-
-	memcpy (dest, &(rb->buf[tmp_read_ptr]), n1);
-	tmp_read_ptr = (tmp_read_ptr + n1) & rb->size_mask;
-
-	if (n2) {
-		memcpy (dest + n1, &(rb->buf[tmp_read_ptr]), n2);
-	}
-
-	return to_read;
-}
-
-
-/* The copying data writer.  Copy at most `cnt' bytes to `rb' from
-   `src'.  Returns the actual number of bytes copied. */
-
-size_t
-jack_ringbuffer_write (jack_ringbuffer_t * rb, const char *src, size_t cnt)
-{
-	size_t free_cnt;
-	size_t cnt2;
-	size_t to_write;
-	size_t n1, n2;
-
-	if ((free_cnt = jack_ringbuffer_write_space (rb)) == 0) {
-		return 0;
-	}
-
-	to_write = cnt > free_cnt ? free_cnt : cnt;
-
-	cnt2 = rb->write_ptr + to_write;
-
-	if (cnt2 > rb->size) {
-		n1 = rb->size - rb->write_ptr;
-		n2 = cnt2 & rb->size_mask;
-	} else {
-		n1 = to_write;
-		n2 = 0;
-	}
-
-	memcpy (&(rb->buf[rb->write_ptr]), src, n1);
-	rb->write_ptr = (rb->write_ptr + n1) & rb->size_mask;
-
-	if (n2) {
-		memcpy (&(rb->buf[rb->write_ptr]), src + n1, n2);
-		rb->write_ptr = (rb->write_ptr + n2) & rb->size_mask;
-	}
-
-	return to_write;
-}
-
-/* Advance the read pointer `cnt' places. */
-
-void
-jack_ringbuffer_read_advance (jack_ringbuffer_t * rb, size_t cnt)
-{
-	size_t tmp = (rb->read_ptr + cnt) & rb->size_mask;
-	rb->read_ptr = tmp;
-}
-
-/* Advance the write pointer `cnt' places. */
-
-void
-jack_ringbuffer_write_advance (jack_ringbuffer_t * rb, size_t cnt)
-{
-	size_t tmp = (rb->write_ptr + cnt) & rb->size_mask;
-	rb->write_ptr = tmp;
-}
-
-/* The non-copying data reader.  `vec' is an array of two places.  Set
-   the values at `vec' to hold the current readable data at `rb'.  If
-   the readable data is in one segment the second segment has zero
-   length.  */
-
-void
-jack_ringbuffer_get_read_vector (const jack_ringbuffer_t * rb,
-				 jack_ringbuffer_data_t * vec)
-{
-	size_t free_cnt;
-	size_t cnt2;
-	size_t w, r;
-
-	w = rb->write_ptr;
-	r = rb->read_ptr;
-
-	if (w > r) {
-		free_cnt = w - r;
-	} else {
-		free_cnt = (w - r + rb->size) & rb->size_mask;
-	}
-
-	cnt2 = r + free_cnt;
-
-	if (cnt2 > rb->size) {
-
-		/* Two part vector: the rest of the buffer after the current write
-		   ptr, plus some from the start of the buffer. */
-
-		vec[0].buf = &(rb->buf[r]);
-		vec[0].len = rb->size - r;
-		vec[1].buf = rb->buf;
-		vec[1].len = cnt2 & rb->size_mask;
-
-	} else {
-
-		/* Single part vector: just the rest of the buffer */
-
-		vec[0].buf = &(rb->buf[r]);
-		vec[0].len = free_cnt;
-		vec[1].len = 0;
-	}
-}
-
-/* The non-copying data writer.  `vec' is an array of two places.  Set
-   the values at `vec' to hold the current writeable data at `rb'.  If
-   the writeable data is in one segment the second segment has zero
-   length.  */
-
-void
-jack_ringbuffer_get_write_vector (const jack_ringbuffer_t * rb,
-				  jack_ringbuffer_data_t * vec)
-{
-	size_t free_cnt;
-	size_t cnt2;
-	size_t w, r;
-
-	w = rb->write_ptr;
-	r = rb->read_ptr;
-
-	if (w > r) {
-		free_cnt = ((r - w + rb->size) & rb->size_mask) - 1;
-	} else if (w < r) {
-		free_cnt = (r - w) - 1;
-	} else {
-		free_cnt = rb->size - 1;
-	}
-
-	cnt2 = w + free_cnt;
-
-	if (cnt2 > rb->size) {
-
-		/* Two part vector: the rest of the buffer after the current write
-		   ptr, plus some from the start of the buffer. */
-
-		vec[0].buf = &(rb->buf[w]);
-		vec[0].len = rb->size - w;
-		vec[1].buf = rb->buf;
-		vec[1].len = cnt2 & rb->size_mask;
-	} else {
-		vec[0].buf = &(rb->buf[w]);
-		vec[0].len = free_cnt;
-		vec[1].len = 0;
-	}
-}
diff --git a/libjack/sanitycheck.c b/libjack/sanitycheck.c
deleted file mode 100644
index d0fc2da..0000000
--- a/libjack/sanitycheck.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/sanitycheck.c>
diff --git a/libjack/shm.c b/libjack/shm.c
deleted file mode 100644
index e7a631b..0000000
--- a/libjack/shm.c
+++ /dev/null
@@ -1,915 +0,0 @@
-/* This module provides a set of abstract shared memory interfaces
- * with support using both System V and POSIX shared memory
- * implementations.  The code is divided into three sections:
- *
- *	- common (interface-independent) code
- *	- POSIX implementation
- *	- System V implementation
- *
- * The implementation used is determined by whether USE_POSIX_SHM was
- * set in the ./configure step.
- */
-
-/*
- * Copyright (C) 2003 Paul Davis
- * Copyright (C) 2004 Jack O'Quin
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#include <config.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
-#include <limits.h>
-#include <errno.h>
-#include <dirent.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sysdeps/ipc.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-#include <sysdeps/ipc.h>
-
-#include <jack/shm.h>
-#include <jack/internal.h>
-#include <jack/version.h>
-
-#ifdef USE_POSIX_SHM
-static jack_shmtype_t jack_shmtype = shm_POSIX;
-#else
-static jack_shmtype_t jack_shmtype = shm_SYSV;
-#endif
-
-/* interface-dependent forward declarations */
-static int	jack_access_registry (jack_shm_info_t *ri);
-static int	jack_create_registry (jack_shm_info_t *ri);
-static void	jack_remove_shm (jack_shm_id_t *id);
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * common interface-independent section
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* The JACK SHM registry is a chunk of memory for keeping track of the
- * shared memory used by each active JACK server.  This allows the
- * server to clean up shared memory when it exits.  To avoid memory
- * leakage due to kill -9, crashes or debugger-driven exits, this
- * cleanup is also done when a new instance of that server starts.
- */
-
-/* per-process global data for the SHM interfaces */
-static jack_shm_id_t   registry_id;	/* SHM id for the registry */
-static jack_shm_info_t registry_info = { /* SHM info for the registry */
-	.index = JACK_SHM_NULL_INDEX,
-	.attached_at = MAP_FAILED
-};
-
-/* pointers to registry header and array */
-static jack_shm_header_t   *jack_shm_header = NULL;
-static jack_shm_registry_t *jack_shm_registry = NULL;
-static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE] = "";
-
-/* jack_shm_lock_registry() serializes updates to the shared memory
- * segment JACK uses to keep track of the SHM segements allocated to
- * all its processes, including multiple servers.
- *
- * This is not a high-contention lock, but it does need to work across
- * multiple processes.  High transaction rates and realtime safety are
- * not required.  Any solution needs to at least be portable to POSIX
- * and POSIX-like systems.
- *
- * We must be particularly careful to ensure that the lock be released
- * if the owning process terminates abnormally.  Otherwise, a segfault
- * or kill -9 at the wrong moment could prevent JACK from ever running
- * again on that machine until after a reboot.
- */
-
-#ifndef USE_POSIX_SHM
-#define JACK_SHM_REGISTRY_KEY JACK_SEMAPHORE_KEY
-#endif
-
-static int semid = -1;
-
-/* all semaphore errors are fatal -- issue message, but do not return */
-static void
-semaphore_error (char *msg)
-{
-	jack_error ("Fatal JACK semaphore error: %s (%s)",
-		    msg, strerror (errno));
-	abort ();
-}
-
-static void
-semaphore_init ()
-{
-	key_t semkey = JACK_SEMAPHORE_KEY;
-	struct sembuf sbuf;
-	int create_flags = IPC_CREAT | IPC_EXCL
-		| S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-
-	/* Get semaphore ID associated with this key. */
-	if ((semid = semget(semkey, 0, 0)) == -1) {
-
-		/* Semaphore does not exist - Create. */
-		if ((semid = semget(semkey, 1, create_flags)) != -1) {
-
-			/* Initialize the semaphore, allow one owner. */
-			sbuf.sem_num = 0;
-			sbuf.sem_op = 1;
-			sbuf.sem_flg = 0;
-			if (semop(semid, &sbuf, 1) == -1) {
-				semaphore_error ("semop");
-			}
-
-		} else if (errno == EEXIST) {
-			if ((semid = semget(semkey, 0, 0)) == -1) {
-				semaphore_error ("semget");
-			}
-
-		} else {
-			semaphore_error ("semget creation"); 
-		}
-	}
-}
-
-static inline void
-semaphore_add (int value)
-{
-	struct sembuf sbuf;
-
-	sbuf.sem_num = 0;
-	sbuf.sem_op = value;
-	sbuf.sem_flg = SEM_UNDO;
-	if (semop(semid, &sbuf, 1) == -1) {
-		semaphore_error ("semop");
-	}
-}
-
-static void 
-jack_shm_lock_registry (void)
-{
-	if (semid == -1)
-		semaphore_init ();
-
-	semaphore_add (-1);
-}
-
-static void 
-jack_shm_unlock_registry (void)
-{
-	semaphore_add (1);
-}
-
-static void
-jack_shm_init_registry ()
-{
-	/* registry must be locked */
-	int i;
-
-	memset (jack_shm_header, 0, JACK_SHM_REGISTRY_SIZE);
-
-	jack_shm_header->magic = JACK_SHM_MAGIC;
-	jack_shm_header->protocol = jack_protocol_version;
-	jack_shm_header->type = jack_shmtype;
-	jack_shm_header->size = JACK_SHM_REGISTRY_SIZE;
-	jack_shm_header->hdr_len = sizeof (jack_shm_header_t);
-	jack_shm_header->entry_len = sizeof (jack_shm_registry_t);
-
-	for (i = 0; i < MAX_SHM_ID; ++i) {
-		jack_shm_registry[i].index = i;
-	}
-}
-
-static int
-jack_shm_validate_registry ()
-{
-	/* registry must be locked */
-
-	if ((jack_shm_header->magic == JACK_SHM_MAGIC)
-	    && (jack_shm_header->protocol == jack_protocol_version)
-	    && (jack_shm_header->type == jack_shmtype)
-	    && (jack_shm_header->size == JACK_SHM_REGISTRY_SIZE)
-	    && (jack_shm_header->hdr_len == sizeof (jack_shm_header_t))
-	    && (jack_shm_header->entry_len == sizeof (jack_shm_registry_t))) {
-
-		return 0;		/* registry OK */
-	}
-
-	return -1;
-}
-
-/* set a unique per-user, per-server shm prefix string
- *
- * According to the POSIX standard:
- *
- *   "The name argument conforms to the construction rules for a
- *   pathname. If name begins with the slash character, then processes
- *   calling shm_open() with the same value of name refer to the same
- *   shared memory object, as long as that name has not been
- *   removed. If name does not begin with the slash character, the
- *   effect is implementation-defined. The interpretation of slash
- *   characters other than the leading slash character in name is
- *   implementation-defined."
- *
- * Since the Linux implementation does not allow slashes *within* the
- * name, in the interest of portability we use colons instead.
- */
-static void
-jack_set_server_prefix (const char *server_name)
-{
-	snprintf (jack_shm_server_prefix, sizeof (jack_shm_server_prefix),
-		  "/jack-%d:%s:", getuid (), server_name);
-}
-
-/* gain server addressability to shared memory registration segment
- *
- * returns: 0 if successful
- */
-static int
-jack_server_initialize_shm (int new_registry)
-{
-	int rc;
-
-	if (jack_shm_header)
-		return 0;		/* already initialized */
-
-	jack_shm_lock_registry ();
-
-	rc = jack_access_registry (&registry_info);
-
-	if (new_registry) {
-		jack_remove_shm (&registry_id);
-		rc = ENOENT;
-	}
-
-	switch (rc) {
-	case ENOENT:			/* registry does not exist */
-		rc = jack_create_registry (&registry_info);
-		break;
-	case 0:				/* existing registry */
-		if (jack_shm_validate_registry () == 0)
-			break;
-		/* else it was invalid, so fall through */
-	case EINVAL:			/* bad registry */
-		/* Apparently, this registry was created by an older
-		 * JACK version.  Delete it so we can try again. */
-		jack_release_shm (&registry_info);
-		jack_remove_shm (&registry_id);
-		if ((rc = jack_create_registry (&registry_info)) != 0) {
-			jack_error ("incompatible shm registry (%s)",
-				    strerror (errno));
-#ifndef USE_POSIX_SHM
-			jack_error ("to delete, use `ipcrm -M 0x%0.8x'",
-				    JACK_SHM_REGISTRY_KEY);
-#endif
-		}
-		break;
-	default:			/* failure return code */
-		break;
-	}
-
-	jack_shm_unlock_registry ();
-	return rc;
-}
-
-/* gain client addressability to shared memory registration segment
- *
- * NOTE: this function is no longer used for server initialization,
- * instead it calls jack_register_server().
- *
- * returns: 0 if successful
- */
-int
-jack_initialize_shm (const char *server_name)
-{
-	int rc;
-
-	if (jack_shm_header)
-		return 0;		/* already initialized */
-
-	jack_set_server_prefix (server_name);
-
-	jack_shm_lock_registry ();
-
-	if ((rc = jack_access_registry (&registry_info)) == 0) {
-		if ((rc = jack_shm_validate_registry ()) != 0) {
-			jack_error ("Incompatible shm registry, "
-				    "are jackd and libjack in sync?");
-		}
-	}
-	jack_shm_unlock_registry ();
-
-	return rc;
-}
-
-void
-jack_destroy_shm (jack_shm_info_t* si)
-{
-	/* must NOT have the registry locked */
-	if (si->index == JACK_SHM_NULL_INDEX)
-		return;			/* segment not allocated */
-
-	jack_remove_shm (&jack_shm_registry[si->index].id);
-	jack_release_shm_info (si->index);
-}
-
-jack_shm_registry_t *
-jack_get_free_shm_info ()
-{
-	/* registry must be locked */
-	jack_shm_registry_t* si = NULL;
-	int i;
-
-	for (i = 0; i < MAX_SHM_ID; ++i) {
-		if (jack_shm_registry[i].size == 0) {
-			break;
-		}
-	}
-	
-	if (i < MAX_SHM_ID) {
-		si = &jack_shm_registry[i];
-	}
-
-	return si;
-}
-
-static inline void
-jack_release_shm_entry (jack_shm_registry_index_t index)
-{
-	/* the registry must be locked */
-	jack_shm_registry[index].size = 0;
-	jack_shm_registry[index].allocator = 0;
-	memset (&jack_shm_registry[index].id, 0,
-		sizeof (jack_shm_registry[index].id));
-}
-
-void
-jack_release_shm_info (jack_shm_registry_index_t index)
-{
-	/* must NOT have the registry locked */
-	if (jack_shm_registry[index].allocator == getpid()) {
-		jack_shm_lock_registry ();
-		jack_release_shm_entry (index);
-		jack_shm_unlock_registry ();
-	}
-}
-
-/* Claim server_name for this process.  
- *
- * returns 0 if successful
- *	   EEXIST if server_name was already active for this user
- *	   ENOSPC if server registration limit reached
- *	   ENOMEM if unable to access shared memory registry
- */
-int
-jack_register_server (const char *server_name, int new_registry)
-{
-	int i;
-	pid_t my_pid = getpid ();
-
-	jack_set_server_prefix (server_name);
-
-	jack_info ("JACK compiled with %s SHM support.", JACK_SHM_TYPE);
-
-	if (jack_server_initialize_shm (new_registry))
-		return ENOMEM;
-
-	jack_shm_lock_registry ();
-
-	/* See if server_name already registered.  Since server names
-	 * are per-user, we register the unique server prefix string.
-	 */
-	for (i = 0; i < MAX_SERVERS; i++) {
-
-		if (strncmp (jack_shm_header->server[i].name,
-			     jack_shm_server_prefix,
-			     JACK_SERVER_NAME_SIZE) != 0)
-			continue;	/* no match */
-
-		if (jack_shm_header->server[i].pid == my_pid)
-			return 0;	/* it's me */
-
-		/* see if server still exists */
-		if (kill (jack_shm_header->server[i].pid, 0) == 0) {
-			return EEXIST;	/* other server running */
-		}
-
-		/* it's gone, reclaim this entry */
-		memset (&jack_shm_header->server[i], 0,
-			sizeof (jack_shm_server_t));
-	}
-
-	/* find a free entry */
-	for (i = 0; i < MAX_SERVERS; i++) {
-		if (jack_shm_header->server[i].pid == 0)
-			break;
-	}
-
-	if (i >= MAX_SERVERS)
-		return ENOSPC;		/* out of space */
-
-	/* claim it */
-	jack_shm_header->server[i].pid = my_pid;
-	strncpy (jack_shm_header->server[i].name,
-		 jack_shm_server_prefix,
-		 JACK_SERVER_NAME_SIZE);
-
-	jack_shm_unlock_registry ();
-
-	return 0;
-}
-
-/* release server_name registration */
-void
-jack_unregister_server (const char *server_name /* unused */)
-{
-	int i;
-	pid_t my_pid = getpid ();
-
-	jack_shm_lock_registry ();
-
-	for (i = 0; i < MAX_SERVERS; i++) {
-		if (jack_shm_header->server[i].pid == my_pid) {
-			memset (&jack_shm_header->server[i], 0,
-				sizeof (jack_shm_server_t));
-		}
-	}
-
-	jack_shm_unlock_registry ();
-}
-
-/* called for server startup and termination */
-int
-jack_cleanup_shm ()
-{
-	int i;
-	int destroy;
-	jack_shm_info_t copy;
-	pid_t my_pid = getpid ();
-
-	jack_shm_lock_registry ();
-		
-	for (i = 0; i < MAX_SHM_ID; i++) {
-		jack_shm_registry_t* r;
-
-		r = &jack_shm_registry[i];
-		memcpy (&copy, r, sizeof (jack_shm_info_t));
-		destroy = FALSE;
-
-		/* ignore unused entries */
-		if (r->allocator == 0)
-			continue;
-
-		/* is this my shm segment? */
-		if (r->allocator == my_pid) {
-
-			/* allocated by this process, so unattach 
-			   and destroy. */
-			jack_release_shm (&copy);
-			destroy = TRUE;
-
-		} else {
-
-			/* see if allocator still exists */
-			if (kill (r->allocator, 0)) {
-				if (errno == ESRCH) {
-					/* allocator no longer exists,
-					 * so destroy */
-					destroy = TRUE;
-				}
-			}
-		}
-
-		if (destroy) {
-
-			int index = copy.index;
-
-			if ((index >= 0)  && (index < MAX_SHM_ID)) {
-				jack_remove_shm (&jack_shm_registry[index].id);
-				jack_release_shm_entry (index);
-			}
-			r->size = 0;
-			r->allocator = 0;
-		}
-	}
-
-	jack_shm_unlock_registry ();
-
-	return TRUE;
-}
-
-/* resize a shared memory segment
- *
- * There is no way to resize a System V shm segment.  Resizing is
- * possible with POSIX shm, but not with the non-conformant Mac OS X
- * implementation.  Since POSIX shm is mainly used on that platform,
- * it's simpler to treat them both the same.
- *
- * So, we always resize by deleting and reallocating.  This is
- * tricky, because the old segment will not disappear until
- * all the clients have released it.  We only do what we can
- * from here.
- *
- * This is not done under a single lock.  I don't even want to think
- * about all the things that could possibly go wrong if multple
- * processes tried to resize the same segment concurrently.  That
- * probably doesn't happen.
- */
-int
-jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size)
-{
-	jack_release_shm (si);
-	jack_destroy_shm (si);
-
-	if (jack_shmalloc (size, si)) {
-		return -1;
-	}
-
-	return jack_attach_shm (si);
-}
-
-#ifdef USE_POSIX_SHM
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * POSIX interface-dependent functions
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* gain addressability to existing SHM registry segment
- *
- * sets up global registry pointers, if successful
- *
- * returns: 0 if existing registry accessed successfully
- *          ENOENT if registry does not exist
- *          EINVAL if registry exists, but has the wrong size
- */
-static int
-jack_access_registry (jack_shm_info_t *ri)
-{
-	/* registry must be locked */
-	int shm_fd;
-
-	strncpy (registry_id, "/jack-shm-registry", sizeof (registry_id));
-
-	/* try to open an existing segment */
-	if ((shm_fd = shm_open (registry_id, O_RDWR, 0666)) < 0) {
-		int rc = errno;
-		if (errno != ENOENT) {
-			jack_error ("cannot open existing shm registry segment"
-				    " (%s)", strerror (errno));
-		}
-		close (shm_fd);
-		return rc;
-	}
-
-	if ((ri->attached_at = mmap (0, JACK_SHM_REGISTRY_SIZE,
-				     PROT_READ|PROT_WRITE,
-				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
-		jack_error ("cannot mmap shm registry segment (%s)",
-			    strerror (errno));
-		close (shm_fd);
-		return EINVAL;
-	}
-
-	/* set up global pointers */
-	ri->index = JACK_SHM_REGISTRY_INDEX;
-	jack_shm_header = ri->attached_at;
-	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
-
-	return 0;
-}
-
-/* create a new SHM registry segment
- *
- * sets up global registry pointers, if successful
- *
- * returns: 0 if registry created successfully
- *          nonzero error code if unable to allocate a new registry
- */
-static int
-jack_create_registry (jack_shm_info_t *ri)
-{
-	/* registry must be locked */
-	int shm_fd;
-
-	strncpy (registry_id, "/jack-shm-registry", sizeof (registry_id));
-
-	if ((shm_fd = shm_open (registry_id, O_RDWR|O_CREAT, 0666)) < 0) {
-		int rc = errno;
-		jack_error ("cannot create shm registry segment (%s)",
-			    strerror (errno));
-		return rc;
-	}
-
-	/* Set the desired segment size.  NOTE: the non-conformant Mac
-	 * OS X POSIX shm only allows ftruncate() on segment creation.
-	 */
-	if (ftruncate (shm_fd, JACK_SHM_REGISTRY_SIZE) < 0) {
-		int rc = errno;
-		jack_error ("cannot set registry size (%s)", strerror (errno));
-		jack_remove_shm (&registry_id);
-		close (shm_fd);
-		return rc;
-	}
-
-	if ((ri->attached_at = mmap (0, JACK_SHM_REGISTRY_SIZE,
-				     PROT_READ|PROT_WRITE,
-				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
-		jack_error ("cannot mmap shm registry segment (%s)",
-			    strerror (errno));
-		jack_remove_shm (&registry_id);
-		close (shm_fd);
-		return EINVAL;
-	}
-
-	/* set up global pointers */
-	ri->index = JACK_SHM_REGISTRY_INDEX;
-	jack_shm_header = ri->attached_at;
-	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
-
-	/* initialize registry contents */
-	jack_shm_init_registry ();
-
-	return 0;
-}
-
-static void
-jack_remove_shm (jack_shm_id_t *id)
-{
-	/* registry may or may not be locked */
-	/* note that in many cases the client has already removed
-	   the shm segment, so this failing is not an error.
-	   XXX it would be good to differentiate between these
-	   two conditions.
-	*/
-	shm_unlink ((char *) id);
-}
-
-void
-jack_release_shm (jack_shm_info_t* si)
-{
-	/* registry may or may not be locked */
-	if (si->attached_at != MAP_FAILED) {
-		munmap (si->attached_at, jack_shm_registry[si->index].size);
-	}
-}
-
-/* allocate a POSIX shared memory segment */
-int
-jack_shmalloc (jack_shmsize_t size, jack_shm_info_t* si)
-{
-	jack_shm_registry_t* registry;
-	int shm_fd;
-	int rc = -1;
-	char name[SHM_NAME_MAX+1];
-
-	jack_shm_lock_registry ();
-
-	if ((registry = jack_get_free_shm_info ()) == NULL) {
-		jack_error ("shm registry full");
-		goto unlock;
-	}
-
-	/* On Mac OS X, the maximum length of a shared memory segment
-	 * name is SHM_NAME_MAX (instead of NAME_MAX or PATH_MAX as
-	 * defined by the standard).  Unfortunately, Apple sets this
-	 * value so small (about 31 bytes) that it is useless for
-	 * actual names.  So, we construct a short name from the
-	 * registry index for uniqueness.
-	 */
-	snprintf (name, sizeof (name), "/jack-%d", registry->index);
-
-	if (strlen (name) >= sizeof (registry->id)) {
-		jack_error ("shm segment name too long %s", name);
-		goto unlock;
-	}
-
-	if ((shm_fd = shm_open (name, O_RDWR|O_CREAT, 0666)) < 0) {
-		jack_error ("cannot create shm segment %s (%s)",
-			    name, strerror (errno));
-		goto unlock;
-	}
-
-	if (ftruncate (shm_fd, size) < 0) {
-		jack_error ("cannot set size of engine shm "
-			    "registry 0 (%s)",
-			    strerror (errno));
-		close (shm_fd);
-		goto unlock;
-	}
-
-	close (shm_fd);
-	registry->size = size;
-	strncpy (registry->id, name, sizeof (registry->id));
-	registry->allocator = getpid();
-	si->index = registry->index;
-	si->attached_at = MAP_FAILED;	/* not attached */
-	rc = 0;				/* success */
-
- unlock:
-	jack_shm_unlock_registry ();
-	return rc;
-}
-
-int
-jack_attach_shm (jack_shm_info_t* si)
-{
-	int shm_fd;
-	jack_shm_registry_t *registry = &jack_shm_registry[si->index];
-
-	if ((shm_fd = shm_open (registry->id,
-				O_RDWR, 0666)) < 0) {
-		jack_error ("cannot open shm segment %s (%s)", registry->id,
-			    strerror (errno));
-		return -1;
-	}
-
-	if ((si->attached_at = mmap (0, registry->size, PROT_READ|PROT_WRITE,
-				     MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
-		jack_error ("cannot mmap shm segment %s (%s)", 
-			    registry->id,
-			    strerror (errno));
-		close (shm_fd);
-		return -1;
-	}
-
-	close (shm_fd);
-
-	return 0;
-}
-
-#else
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * System V interface-dependent functions
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* gain addressability to existing SHM registry segment
- *
- * sets up global registry pointers, if successful
- *
- * returns: 0 if existing registry accessed successfully
- *          ENOENT if registry does not exist
- *          EINVAL if registry exists, but has the wrong size
- *          other nonzero error code if unable to access registry
- */
-static int
-jack_access_registry (jack_shm_info_t *ri)
-{
-	/* registry must be locked */
-
-	/* try without IPC_CREAT to get existing segment */
-	if ((registry_id = shmget (JACK_SHM_REGISTRY_KEY,
-				   JACK_SHM_REGISTRY_SIZE, 0666)) < 0) {
-
-		switch (errno) {
-
-		case ENOENT:		/* segment does not exist */
-			return ENOENT;
-
-		case EINVAL:		/* segment exists, but too small */
-			/* attempt minimum size access */
-			registry_id = shmget (JACK_SHM_REGISTRY_KEY, 1, 0666);
-			return EINVAL;
-
-		default:		/* or other error */
-			jack_error ("unable to access shm registry (%s)",
-				    strerror (errno));
-			return errno;
-		}
-	}
-
-	if ((ri->attached_at = shmat (registry_id, 0, 0)) < 0) {
-		jack_error ("cannot attach shm registry segment (%s)",
-			    strerror (errno));
-		return EINVAL;
-	}
-
-	/* set up global pointers */
-	ri->index = JACK_SHM_REGISTRY_INDEX;
-	jack_shm_header = ri->attached_at;
-	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
-
-	return 0;
-}
-
-/* create a new SHM registry segment
- *
- * sets up global registry pointers, if successful
- *
- * returns: 0 if registry created successfully
- *          nonzero error code if unable to allocate a new registry
- */
-static int
-jack_create_registry (jack_shm_info_t *ri)
-{
-	/* registry must be locked */
-	if ((registry_id = shmget (JACK_SHM_REGISTRY_KEY,
-				   JACK_SHM_REGISTRY_SIZE,
-				   0666|IPC_CREAT)) < 0) {
-		jack_error ("cannot create shm registry segment (%s)",
-			    strerror (errno));
-		return errno;
-	}
-
-	if ((ri->attached_at = shmat (registry_id, 0, 0)) < 0) {
-		jack_error ("cannot attach shm registry segment (%s)",
-			    strerror (errno));
-		return EINVAL;
-	}
-
-	/* set up global pointers */
-	ri->index = JACK_SHM_REGISTRY_INDEX;
-	jack_shm_header = ri->attached_at;
-	jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
-
-	/* initialize registry contents */
-	jack_shm_init_registry ();
-
-	return 0;
-}
-
-static void
-jack_remove_shm (jack_shm_id_t *id)
-{
-	/* registry may or may not be locked */
-	/* this call can fail if we are attempting to 
-	   remove a segment that was already deleted
-	   by the client. XXX i suppose the 
-	   function should take a "canfail" argument.
-	*/
-	shmctl (*id, IPC_RMID, NULL);
-}
-
-void
-jack_release_shm (jack_shm_info_t* si)
-{
-	/* registry may or may not be locked */
-	if (si->attached_at != MAP_FAILED) {
-		shmdt (si->attached_at);
-	}
-}
-
-int
-jack_shmalloc (jack_shmsize_t size, jack_shm_info_t* si) 
-{
-	int shmflags;
-	int shmid;
-	int rc = -1;
-	jack_shm_registry_t* registry;
-
-	jack_shm_lock_registry ();
-
-	if ((registry = jack_get_free_shm_info ())) {
-
-		shmflags = 0666 | IPC_CREAT | IPC_EXCL;
-
-		if ((shmid = shmget (IPC_PRIVATE, size, shmflags)) >= 0) {
-
-			registry->size = size;
-			registry->id = shmid;
-			registry->allocator = getpid();
-			si->index = registry->index;
-			si->attached_at = MAP_FAILED; /* not attached */
-			rc = 0;
-
-		} else {
-			jack_error ("cannot create shm segment (%s)",
-				    strerror (errno));
-		}
-	}
-
-	jack_shm_unlock_registry ();
-
-	return rc;
-}
-
-int
-jack_attach_shm (jack_shm_info_t* si)
-{
-	if ((si->attached_at = shmat (jack_shm_registry[si->index].id,
-				      0, 0)) < 0) {
-		jack_error ("cannot attach shm segment (%s)",
-			    strerror (errno));
-		jack_release_shm_info (si->index);
-		return -1;
-	}
-	return 0;
-}
-
-#endif /* !USE_POSIX_SHM */
diff --git a/libjack/simd.c b/libjack/simd.c
deleted file mode 100644
index d1d1412..0000000
--- a/libjack/simd.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2005-2008 Jussi Laako
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-
-#include <config.h>
-#include <jack/intsimd.h>
-
-#ifdef USE_DYNSIMD
-
-#ifdef ARCH_X86
-
-int
-have_3dnow ()
-{
-	unsigned int res = 0;
-
-#ifdef __x86_64__
-	asm volatile ("pushq %%rbx\n\t" : : : "memory");
-#else
-	asm volatile ("pushl %%ebx\n\t" : : : "memory");
-#endif
-	asm volatile (
-		"movl $0x80000000, %%eax\n\t" \
-		"cpuid\n\t" \
-		"cmpl $0x80000001, %%eax\n\t" \
-		"jl tdnow_prexit\n\t" \
-		\
-		"movl $0x80000001, %%eax\n\t" \
-		"cpuid\n\t" \
-		\
-		"xorl %%eax, %%eax\n\t" \
-		\
-		"movl $1, %%ecx\n\t" \
-		"shll $31, %%ecx\n\t" \
-		"testl %%ecx, %%edx\n\t" \
-		"jz tdnow_testexit\n\t" \
-		"movl $1, %%eax\n\t" \
-		\
-		"movl $1, %%ecx\n\t" \
-		"shll $30, %%ecx\n\t" \
-		"testl %%ecx, %%edx\n\t" \
-		"jz tdnow_testexit\n\t" \
-		"movl $2, %%eax\n\t" \
-		"jmp tdnow_testexit\n\t" \
-		\
-		"tdnow_prexit:\n\t" \
-		"xorl %%eax, %%eax\n\t" \
-		"tdnow_testexit:\n\t"
-		: "=a" (res)
-		:
-		: "ecx", "edx", "memory");
-#ifdef __x86_64__
-	asm volatile ("popq %%rbx\n\t" : : : "memory");
-#else
-	asm volatile ("popl %%ebx\n\t" : : : "memory");
-#endif
-	return res;
-}
-
-int
-have_sse ()
-{
-	unsigned int res = 0;
-
-#ifdef __x86_64__
-	asm volatile ("pushq %%rbx\n\t" : : : "memory");
-#else
-	asm volatile ("pushl %%ebx\n\t" : : : "memory");
-#endif
-	asm volatile (
-		"movl $1, %%eax\n\t" \
-		"cpuid\n\t" \
-		\
-		"xorl %%eax, %%eax\n\t" \
-		\
-		"movl $1, %%ebx\n\t" \
-		"shll $25, %%ebx\n\t" \
-		"testl %%ebx, %%edx\n\t" \
-		"jz sse_testexit\n\t" \
-		"movl $1, %%eax\n\t" \
-		\
-		"movl $1, %%ebx\n\t" \
-		"shll $26, %%ebx\n\t" \
-		"testl %%ebx, %%edx\n\t" \
-		"jz sse_testexit\n\t" \
-		"movl $2, %%eax\n\t" \
-		\
-		"movl $1, %%ebx\n\t" \
-		"testl %%ebx, %%ecx\n\t" \
-		"jz sse_testexit\n\t" \
-		"movl $3, %%eax\n\t" \
-		\
-		"sse_testexit:\n\t"
-		: "=a" (res)
-		:
-		: "ecx", "edx", "memory");
-#ifdef __x86_64__
-	asm volatile ("popq %%rbx\n\t" : : : "memory");
-#else
-	asm volatile ("popl %%ebx\n\t" : : : "memory");
-#endif
-	return res;
-}
-
-void
-x86_3dnow_copyf (float *dest, const float *src, int length)
-{
-	int i, n1, n2;
-	pv2sf m64p_src = (pv2sf) src;
-	pv2sf m64p_dest = (pv2sf) dest;
-
-	n1 = (length >> 4);
-	n2 = ((length & 0xf) >> 1);
-	for (i = 0; i < n1; i++)
-	{
-		asm volatile ("movq %0, %%mm0\n\t"
-			: : "m" (*m64p_src++) : "mm0", "memory");
-		asm volatile ("movq %0, %%mm1\n\t"
-			: : "m" (*m64p_src++) : "mm1", "memory");
-		asm volatile ("movq %0, %%mm2\n\t"
-			: : "m" (*m64p_src++) : "mm2", "memory");
-		asm volatile ("movq %0, %%mm3\n\t"
-			: : "m" (*m64p_src++) : "mm3", "memory");
-		asm volatile ("movq %0, %%mm4\n\t"
-			: : "m" (*m64p_src++) : "mm4", "memory");
-		asm volatile ("movq %0, %%mm5\n\t"
-			: : "m" (*m64p_src++) : "mm5", "memory");
-		asm volatile ("movq %0, %%mm6\n\t"
-			: : "m" (*m64p_src++) : "mm6", "memory");
-		asm volatile ("movq %0, %%mm7\n\t"
-			: : "m" (*m64p_src++) : "mm7", "memory");
-
-		asm volatile ("movq %%mm0, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm0", "memory");
-		asm volatile ("movq %%mm1, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm1", "memory");
-		asm volatile ("movq %%mm2, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm2", "memory");
-		asm volatile ("movq %%mm3, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm3", "memory");
-		asm volatile ("movq %%mm4, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm4", "memory");
-		asm volatile ("movq %%mm5, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm5", "memory");
-		asm volatile ("movq %%mm6, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm6", "memory");
-		asm volatile ("movq %%mm7, %0\n\t"
-			: "=m" (*m64p_dest++) : : "mm7", "memory");
-	}
-	for (i = 0; i < n2; i++)
-	{
-		asm volatile (
-			"movq %1, %%mm0\n\t" \
-			"movq %%mm0, %0\n\t"
-			: "=m" (*m64p_dest++)
-			: "m" (*m64p_src++)
-			: "mm0", "memory");
-	}
-	if (length & 0x1)
-	{
-		asm volatile (
-			"movd %1, %%mm0\n\t" \
-			"movd %%mm0, %0\n\t"
-			: "=m" (dest[length - 1])
-			: "m" (src[length - 1])
-			: "mm0", "memory");
-	}
-	asm volatile (
-		"femms\n\t" \
-		"sfence\n\t");
-}
-
-void
-x86_3dnow_add2f (float *dest, const float *src, int length)
-{
-	int i, n;
-	pv2sf m64p_dest = (pv2sf) dest;
-	pv2sf m64p_src = (pv2sf) src;
-
-	n = (length >> 1);
-	for (i = 0; i < n; i++)
-	{
-		asm volatile (
-			"movq %1, %%mm0\n\t" \
-			"pfadd %2, %%mm0\n\t" \
-			"movq %%mm0, %0\n\t"
-			: "=m" (m64p_dest[i])
-			: "m0" (m64p_dest[i]),
-			  "m" (m64p_src[i])
-			: "mm0", "memory");
-	}
-	if (n & 0x1)
-	{
-		asm volatile (
-			"movd %1, %%mm0\n\t" \
-			"movd %2, %%mm1\n\t" \
-			"pfadd %%mm1, %%mm0\n\t" \
-			"movd %%mm0, %0\n\t"
-			: "=m" (dest[length - 1])
-			: "m0" (dest[length - 1]),
-			  "m" (src[length - 1])
-			: "mm0", "mm1", "memory");
-	}
-	asm volatile (
-		"femms\n\t" \
-		"sfence\n\t");
-}
-
-void
-x86_sse_copyf (float *dest, const float *src, int length)
-{
-	int i, n1, n2, si3;
-	pv4sf m128p_src = (pv4sf) src;
-	pv4sf m128p_dest = (pv4sf) dest;
-
-	n1 = (length >> 5);
-	n2 = ((length & 0x1f) >> 2);
-	si3 = (length & ~0x3);
-	for (i = 0; i < n1; i++)
-	{
-		asm volatile ("movaps %0, %%xmm0\n\t"
-			: : "m" (*m128p_src++) : "xmm0", "memory");
-		asm volatile ("movaps %0, %%xmm1\n\t"
-			: : "m" (*m128p_src++) : "xmm1", "memory");
-		asm volatile ("movaps %0, %%xmm2\n\t"
-			: : "m" (*m128p_src++) : "xmm2", "memory");
-		asm volatile ("movaps %0, %%xmm3\n\t"
-			: : "m" (*m128p_src++) : "xmm3", "memory");
-		asm volatile ("movaps %0, %%xmm4\n\t"
-			: : "m" (*m128p_src++) : "xmm4", "memory");
-		asm volatile ("movaps %0, %%xmm5\n\t"
-			: : "m" (*m128p_src++) : "xmm5", "memory");
-		asm volatile ("movaps %0, %%xmm6\n\t"
-			: : "m" (*m128p_src++) : "xmm6", "memory");
-		asm volatile ("movaps %0, %%xmm7\n\t"
-			: : "m" (*m128p_src++) : "xmm7", "memory");
-
-		asm volatile ("movaps %%xmm0, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm0", "memory");
-		asm volatile ("movaps %%xmm1, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm1", "memory");
-		asm volatile ("movaps %%xmm2, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm2", "memory");
-		asm volatile ("movaps %%xmm3, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm3", "memory");
-		asm volatile ("movaps %%xmm4, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm4", "memory");
-		asm volatile ("movaps %%xmm5, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm5", "memory");
-		asm volatile ("movaps %%xmm6, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm6", "memory");
-		asm volatile ("movaps %%xmm7, %0\n\t"
-			: "=m" (*m128p_dest++) : : "xmm7", "memory");
-	}
-	for (i = 0; i < n2; i++)
-	{
-		asm volatile (
-			"movaps %1, %%xmm0\n\t" \
-			"movaps %%xmm0, %0\n\t"
-			: "=m" (*m128p_dest++)
-			: "m" (*m128p_src++)
-			: "xmm0", "memory");
-	}
-	for (i = si3; i < length; i++)
-	{
-		asm volatile (
-			"movss %1, %%xmm0\n\t" \
-			"movss %%xmm0, %0\n\t"
-			: "=m" (dest[i])
-			: "m" (src[i])
-			: "xmm0", "memory");
-	}
-}
-
-void
-x86_sse_add2f (float *dest, const float *src, int length)
-{
-	int i, n, si2;
-	pv4sf m128p_src = (pv4sf) src;
-	pv4sf m128p_dest = (pv4sf) dest;
-
-	if (__builtin_expect(((long) src & 0xf) || ((long) dest & 0xf), 0))
-	{
-		/*jack_error("x86_sse_add2f(): non aligned pointers!");*/
-		si2 = 0;
-		goto sse_nonalign;
-	}
-	si2 = (length & ~0x3);
-	n = (length >> 2);
-	for (i = 0; i < n; i++)
-	{
-		asm volatile (
-			"movaps %1, %%xmm0\n\t" \
-			"addps %2, %%xmm0\n\t" \
-			"movaps %%xmm0, %0\n\t"
-			: "=m" (m128p_dest[i])
-			: "m0" (m128p_dest[i]),
-			  "m" (m128p_src[i])
-			: "xmm0", "memory");
-	}
-sse_nonalign:
-	for (i = si2; i < length; i++)
-	{
-		asm volatile (
-			"movss %1, %%xmm0\n\t" \
-			"addss %2, %%xmm0\n\t" \
-			"movss %%xmm0, %0\n\t"
-			: "=m" (dest[i])
-			: "m0" (dest[i]),
-			  "m" (src[i])
-			: "xmm0", "memory");
-	}
-}
-
-void x86_sse_f2i (int *dest, const float *src, int length, float scale)
-{
-	int i;
-	static const float max[4] __attribute__((aligned(16))) =
-		{ -1.0F, -1.0F, -1.0F, -1.0F };
-	static const float min[4] __attribute__((aligned(16))) =
-		{ 1.0F, 1.0F, 1.0F, 1.0F };
-	float s[4] __attribute__((aligned(16)));
-
-	s[0] = s[1] = s[2] = s[3] = scale;
-	asm volatile (
-		"movaps %0, %%xmm4\n\t" \
-		"movaps %1, %%xmm5\n\t" \
-		"movaps %2, %%xmm6\n\t"
-		:
-		: "m" (*max),
-		  "m" (*min),
-		  "m" (*s)
-		: "xmm4", "xmm5", "xmm6");
-
-	if (__builtin_expect((((long) dest & 0xf) || ((long) src & 0xf)), 0))
-		goto sse_nonalign;
-	for (i = 0; i < length; i += 4)
-	{
-		asm volatile (
-			"movaps %1, %%xmm1\n\t" \
-			"maxps %%xmm4, %%xmm1\n\t" \
-			"minps %%xmm5, %%xmm1\n\t" \
-			"mulps %%xmm6, %%xmm1\n\t" \
-			"cvtps2dq %%xmm1, %%xmm0\n\t" \
-			"movdqa %%xmm0, %0\n\t"
-			: "=m" (dest[i])
-			: "m" (src[i])
-			: "xmm0", "xmm1", "xmm4", "xmm5", "xmm6", "memory");
-	}
-	return;
-
-sse_nonalign:
-	for (i = 0; i < length; i += 4)
-	{
-		asm volatile (
-			"movups %1, %%xmm1\n\t" \
-			"maxps %%xmm4, %%xmm1\n\t" \
-			"minps %%xmm5, %%xmm1\n\t" \
-			"mulps %%xmm6, %%xmm1\n\t" \
-			"cvtps2dq %%xmm1, %%xmm0\n\t" \
-			"movdqu %%xmm0, %0\n\t"
-			: "=m" (dest[i])
-			: "m" (src[i])
-			: "xmm0", "xmm1", "xmm4", "xmm5", "xmm6", "memory");
-	}
-}
-
-
-void x86_sse_i2f (float *dest, const int *src, int length, float scale)
-{
-	int i;
-	float s[4] __attribute__((aligned(16)));
-
-	s[0] = s[1] = s[2] = s[3] = scale;
-	asm volatile (
-		"movaps %0, %%xmm4\n\t"
-		:
-		: "m" (*s)
-		: "xmm4" );
-
-	if (__builtin_expect((((long) dest & 0xf) || ((long) src & 0xf)), 0))
-		goto sse_nonalign; 
-	for (i = 0; i < length; i += 4)
-	{
-		asm volatile (
-			"cvtdq2ps %1, %%xmm0\n\t" \
-			"mulps %%xmm4, %%xmm0\n\t" \
-			"movaps %%xmm0, %0\n\t"
-			: "=m" (dest[i])
-			: "m" (src[i])
-			: "xmm0", "xmm4", "memory");
-	}
-	return;
-
-sse_nonalign:
-	for (i = 0; i < length; i += 4)
-	{
-		asm volatile (
-			"movdqu %1, %%xmm1\n\t" \
-			"cvtdq2ps %%xmm1, %%xmm0\n\t" \
-			"mulps %%xmm4, %%xmm0\n\t" \
-			"movups %%xmm0, %0\n\t"
-			: "=m" (dest[i])
-			: "m" (src[i])
-			: "xmm0", "xmm1", "xmm4", "memory");
-	}
-}
-
-#endif /* ARCH_X86 */
-
-#endif /* USE_DYNSIMD */
-
diff --git a/libjack/systemtest.c b/libjack/systemtest.c
deleted file mode 100644
index e090432..0000000
--- a/libjack/systemtest.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/systemtest.c>
diff --git a/libjack/thread.c b/libjack/thread.c
deleted file mode 100644
index 45dd050..0000000
--- a/libjack/thread.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-  Copyright (C) 2004 Paul Davis
-  
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-  Thread creation function including workarounds for real-time scheduling
-  behaviour on different glibc versions.
-
-
-*/
-
-#include <config.h>
-
-#include <jack/jack.h>
-#include <jack/thread.h>
-#include <jack/internal.h>
-
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include "local.h"
-
-#ifdef JACK_USE_MACH_THREADS
-#include <sysdeps/pThreadUtilities.h>
-#endif
-
-jack_thread_creator_t jack_thread_creator = pthread_create;
-
-void
-jack_set_thread_creator (jack_thread_creator_t jtc) 
-{
-	jack_thread_creator = jtc;
-}
-
-static inline void
-log_result (char *msg, int res)
-{
-	char outbuf[500];
-	snprintf(outbuf, sizeof(outbuf),
-		 "jack_client_create_thread: error %d %s: %s",
-		 res, msg, strerror(res));
-	jack_error(outbuf);
-}
-
-static void
-maybe_get_capabilities (jack_client_t* client)
-{
-#ifdef USE_CAPABILITIES
-
-	if (client != 0) {
-		
-		jack_request_t req;
-		
-		if (client->engine->has_capabilities != 0) {
-			
-			/* we need to ask the engine for realtime capabilities
-			   before trying to run the thread work function
-			*/
-			
-			req.type = SetClientCapabilities;
-			req.x.cap_pid = getpid();
-			
-			jack_client_deliver_request (client, &req);
-			
-			if (req.status) {
-				
-				/* what to do? engine is running realtime, it
-				   is using capabilities and has them
-				   (otherwise we would not get an error
-				   return) but for some reason it could not
-				   give the client the required capabilities.
-				   for now, allow the client to run, albeit
-				   non-realtime.
-				*/
-				
-				jack_error ("could not receive realtime capabilities, "
-					    "client will run non-realtime");
-				
-			}
-		}
-	}
-#endif /* USE_CAPABILITIES */
-}	
-
-static void*
-jack_thread_proxy (void* varg)
-{
-	jack_thread_arg_t* arg = (jack_thread_arg_t*) varg;
-	void* (*work)(void*);
-	void* warg;
-	jack_client_t* client = arg->client;
-
-	if (arg->realtime) {
-		maybe_get_capabilities (client);
-		jack_acquire_real_time_scheduling (pthread_self(), arg->priority);
-	}
-
-	warg = arg->arg;
-	work = arg->work_function;
-
-	free (arg);
-	
-	return work (warg);
-}
-
-int
-jack_client_create_thread (jack_client_t* client,
-			   pthread_t* thread,
-			   int priority,
-			   int realtime,
-			   void*(*start_routine)(void*),
-			   void* arg)
-{
-#ifndef JACK_USE_MACH_THREADS
-	pthread_attr_t attr;
-	jack_thread_arg_t* thread_args;
-#endif /* !JACK_USE_MACH_THREADS */
-
-	int result = 0;
-
-	if (!realtime) {
-		result = jack_thread_creator (thread, 0, start_routine, arg);
-		if (result) {
-			log_result("creating thread with default parameters",
-				   result);
-		}
-		return result;
-	}
-
-	/* realtime thread. this disgusting mess is a reflection of
-	 * the 2nd-class nature of RT programming under POSIX in
-	 * general and Linux in particular.
-	 */
-
-#ifndef JACK_USE_MACH_THREADS
-
-	pthread_attr_init(&attr);
-	result = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
-	if (result) {
-		log_result("requesting explicit scheduling", result);
-		return result;
-	}
-	result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
-	if (result) {
-		log_result("requesting joinable thread creation", result);
-		return result;
-	}
-#ifdef __OpenBSD__
-	result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
-#else
-	result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-#endif
-	if (result) {
-		log_result("requesting system scheduling scope", result);
-		return result;
-	}
-
-        result = pthread_attr_setstacksize(&attr, THREAD_STACK); 
-        if (result) {
-                log_result("setting thread stack size", result);
-                return result;
-        }
-
-	if ((thread_args = (jack_thread_arg_t *) malloc (sizeof (jack_thread_arg_t))) == NULL) {
-		return -1;
-	}
-
-	thread_args->client = client;
-	thread_args->work_function = start_routine;
-	thread_args->arg = arg;
-	thread_args->realtime = 1;
-	thread_args->priority = priority;
-
-	result = jack_thread_creator (thread, &attr, jack_thread_proxy, thread_args);
-	if (result) {
-		log_result ("creating realtime thread", result);
-		return result;
-	}
-
-#else /* JACK_USE_MACH_THREADS */
-
-	result = jack_thread_creator (thread, 0, start_routine, arg);
-	if (result) {
-		log_result ("creating realtime thread", result);
-		return result;
-	}
-
-	/* time constraint thread */
-	setThreadToPriority (*thread, 96, TRUE, 10000000);
-	
-#endif /* JACK_USE_MACH_THREADS */
-
-	return 0;
-}
-
-int
-jack_client_real_time_priority (jack_client_t* client)
-{
-	if (!client->engine->real_time) {
-		return -1;
-	}
-	
-	return client->engine->client_priority;
-}
-
-int
-jack_client_max_real_time_priority (jack_client_t* client)
-{
-	if (!client->engine->real_time) {
-		return -1;
-	}
-
-	return client->engine->max_client_priority;
-}
-
-#if JACK_USE_MACH_THREADS 
-
-int
-jack_drop_real_time_scheduling (pthread_t thread)
-{
-	setThreadToPriority(thread, 31, FALSE, 10000000);
-	return 0;       
-}
-
-int
-jack_acquire_real_time_scheduling (pthread_t thread, int priority)
-	//priority is unused
-{
-	setThreadToPriority(thread, 96, TRUE, 10000000);
-	return 0;
-}
-
-#else /* !JACK_USE_MACH_THREADS */
-
-int
-jack_drop_real_time_scheduling (pthread_t thread)
-{
-	struct sched_param rtparam;
-	int x;
-	
-	memset (&rtparam, 0, sizeof (rtparam));
-	rtparam.sched_priority = 0;
-
-	if ((x = pthread_setschedparam (thread, SCHED_OTHER, &rtparam)) != 0) {
-		jack_error ("cannot switch to normal scheduling priority(%s)\n",
-			    strerror (errno));
-		return -1;
-	}
-        return 0;
-}
-
-int
-jack_acquire_real_time_scheduling (pthread_t thread, int priority)
-{
-	struct sched_param rtparam;
-	int x;
-	
-	memset (&rtparam, 0, sizeof (rtparam));
-	rtparam.sched_priority = priority;
-	
-	if ((x = pthread_setschedparam (thread, SCHED_FIFO, &rtparam)) != 0) {
-		jack_error ("cannot use real-time scheduling (FIFO at priority %d) "
-			    "[for thread %d, from thread %d] (%d: %s)", 
-			    rtparam.sched_priority, 
-			    thread, pthread_self(),
-			    x, strerror (x));
-		return -1;
-	}
-
-        return 0;
-}
-
-#endif /* JACK_USE_MACH_THREADS */
-
diff --git a/libjack/time.c b/libjack/time.c
deleted file mode 100644
index 6412ea0..0000000
--- a/libjack/time.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2005 Jussi Laako
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <jack/internal.h>
-#include <jack/jack.h>
-#include <jack/engine.h>
-
-#include <sysdeps/time.h>
-#include <sysdeps/cycles.h>
-
-#include "local.h"
-
-const char*
-jack_clock_source_name (jack_timer_type_t src)
-{
-	switch (src) {
-	case JACK_TIMER_CYCLE_COUNTER:
-		return "cycle counter";
-	case JACK_TIMER_HPET:
-		return "hpet";
-	case JACK_TIMER_SYSTEM_CLOCK:
-#ifdef HAVE_CLOCK_GETTIME
-		return "system clock via clock_gettime";
-#else
-		return "system clock via gettimeofday";
-#endif
-	}
-
-	/* what is wrong with gcc ? */
-
-	return "unknown";
-}
-
-#ifndef HAVE_CLOCK_GETTIME
-
-jack_time_t 
-jack_get_microseconds_from_system (void) {
-	jack_time_t jackTime;
-	struct timeval tv;
-
-	gettimeofday (&tv, NULL);
-	jackTime = (jack_time_t) tv.tv_sec * 1000000 + (jack_time_t) tv.tv_usec;
-	return jackTime;
-}
-
-#else
-
-jack_time_t 
-jack_get_microseconds_from_system (void) {
-	jack_time_t jackTime;
-	struct timespec time;
-
-	clock_gettime(CLOCK_MONOTONIC, &time);
-	jackTime = (jack_time_t) time.tv_sec * 1e6 +
-		(jack_time_t) time.tv_nsec / 1e3;
-	return jackTime;
-}
-
-#endif /* HAVE_CLOCK_GETTIME */
-
-/* everything below here should be system-dependent */
-
-#include <sysdeps/time.c>
-
-
diff --git a/libjack/timestamps.c b/libjack/timestamps.c
deleted file mode 100644
index 62ee2cb..0000000
--- a/libjack/timestamps.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-    Copyright (C) 2002-2003 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <jack/timestamps.h>
-#include <jack/internal.h>
-#include <sysdeps/time.h>
-
-typedef struct {
-    jack_time_t when;
-    const char *what;
-} jack_timestamp_t;
-
-static jack_timestamp_t *timestamps = 0;
-static unsigned long timestamp_cnt = 0;
-static unsigned long timestamp_index;
-
-void
-jack_init_timestamps (unsigned long howmany)
-{
-	if (timestamps) {
-		free (timestamps);
-	}
-	timestamps = (jack_timestamp_t *)
-		malloc (howmany * sizeof(jack_timestamp_t));
-	timestamp_cnt = howmany;
-	memset (timestamps, 0, sizeof (jack_timestamp_t) * howmany);
-	timestamp_index = 0;
-}
-
-void
-jack_timestamp (const char *what)
-{
-	if (timestamp_index < timestamp_cnt) {
-		timestamps[timestamp_index].when = jack_get_microseconds();
-		timestamps[timestamp_index].what = what;
-		++timestamp_index;
-	}
-}
-
-void
-jack_dump_timestamps (FILE *out)
-{
-	unsigned long i;
-
-	for (i = 0; i < timestamp_index; ++i) {
-		fprintf (out, "%-.32s %" PRIu64 " %" PRIu64, 
-			 timestamps[i].what, timestamps[i].when,
-			 timestamps[i].when - timestamps[0].when);
-		if (i > 0) {
-			fprintf (out, " %" PRIu64,
-				 timestamps[i].when - timestamps[i-1].when);
-		}
-		fputc ('\n', out);
-	}
-}
-
-void
-jack_reset_timestamps ()
-{
-	timestamp_index = 0;
-}
-
diff --git a/libjack/transclient.c b/libjack/transclient.c
deleted file mode 100644
index f449003..0000000
--- a/libjack/transclient.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
-    JACK transport client interface -- runs in the client process.
-
-    Copyright (C) 2001-2003 Paul Davis
-    Copyright (C) 2003 Jack O'Quin
-    
-    This program is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public License
-    as published by the Free Software Foundation; either version 2.1
-    of the License, or (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public
-    License along with this program; if not, write to the Free
-    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-    02111-1307, USA.
-*/
-
-#include <config.h>
-#include <errno.h>
-#include <math.h>
-#include <stdio.h>
-#include <jack/atomicity.h>
-#include <jack/internal.h>
-#include "local.h"
-
-
-/********************* Internal functions *********************/
-
-/* generate a unique non-zero ID, different for each call */
-jack_unique_t
-jack_generate_unique_id (jack_control_t *ectl)
-{
-	/* The jack_unique_t is an opaque type. */
-	return exchange_and_add(&ectl->seq_number, 1);
-}
-
-static inline void
-jack_read_frame_time (const jack_client_t *client, jack_frame_timer_t *copy)
-{
-	int tries = 0;
-	long timeout = 1000;
-
-	do {
-		/* throttle the busy wait if we don't get 
-		   the answer very quickly.
-
-		   XXX This is disgusting. on a UP
-		   system, it needs to sleep
-		   if the first try didn't work. on an SMP
-		   system, it should wait for half of
-		   the context switch time before
-		   sleeping.
-		*/
-
-		if (tries > 10) {
-			usleep (20);
-			tries = 0;
-
-			/* debug code to avoid system hangs... */
-			if (--timeout == 0) {
-				jack_error ("hung in loop copying position A");
-				abort();
-			}
-		}
-
-		*copy = client->engine->frame_timer;
-
-		tries++;
-
-	} while (copy->guard1 != copy->guard2);
-}
-
-/* copy a JACK transport position structure (thread-safe) */
-void
-jack_transport_copy_position (jack_position_t *from, jack_position_t *to)
-{
-	int tries = 0;
-	long timeout = 1000;
-
-	do {
-		/* throttle the busy wait if we don't get the answer
-		 * very quickly. See comment above about this
-		 * design.
-		 */
-		if (tries > 10) {
-			usleep (20);
-			tries = 0;
-
-			/* debug code to avoid system hangs... */
-			if (--timeout == 0) {
-				jack_error ("hung in loop copying position B");
-				abort();
-			}
-		}
-		*to = *from;
-		tries++;
-
-	} while (to->unique_1 != to->unique_2);
-}
-
-static inline int
-jack_transport_request_new_pos (jack_client_t *client, jack_position_t *pos)
-{
-	jack_control_t *ectl = client->engine;
-
-	/* distinguish this request from all others */
-	pos->unique_1 = pos->unique_2 = jack_generate_unique_id(ectl);
-
-	/* clients may not set these fields */
-	pos->usecs = ectl->current_time.usecs;
-	pos->frame_rate = ectl->current_time.frame_rate;
-
-	/* carefully copy requested postion into shared memory */
-	jack_transport_copy_position (pos, &ectl->request_time);
-	
-	return 0;
-}
-
-
-/******************** Callback invocations ********************/
-
-void
-jack_call_sync_client (jack_client_t *client)
-{
-	jack_client_control_t *control = client->control;
-	jack_control_t *ectl = client->engine;
-
-	/* Make sure still active and slow-sync; active_slowsync is
-	 * set in a critical section; sync_cb is not. */
-	if ((ectl->new_pos || control->sync_poll || control->sync_new) &&
-	    control->active_slowsync) {
-
-		if (client->sync_cb (ectl->transport_state,
-				      &ectl->current_time,
-				      client->sync_arg)) {
-
-			if (control->sync_poll) {
-				control->sync_poll = 0;
-				ectl->sync_remain--;
-			}
-		}
-		control->sync_new = 0;
-	}
-}
-
-void
-jack_call_timebase_master (jack_client_t *client)
-{
-	jack_client_control_t *control = client->control;
-	jack_control_t *ectl = client->engine;
-	int new_pos = (int) ectl->pending_pos;
-
-	
-	/* Make sure this is still the master; is_timebase is set in a
-	 * critical section; timebase_cb is not. */
-	if (control->is_timebase) { 
-
-		if (control->timebase_new) {	/* first callback? */
-			control->timebase_new = 0;
-			new_pos = 1;
-		}
-
-
-		if ((ectl->transport_state == JackTransportRolling) ||
-		    new_pos) {
-
-			client->timebase_cb (ectl->transport_state,
-					      control->nframes,
-					      &ectl->pending_time,
-					      new_pos,
-					      client->timebase_arg);
-		}
-
-	} else {
-
-		/* another master took over, so resign */
-		client->timebase_cb = NULL;
-		client->timebase_arg = NULL;
-		control->timebase_cb_cbset = FALSE;
-	}
-}
-
-
-/************************* API functions *************************/
-
-jack_nframes_t
-jack_get_current_transport_frame (const jack_client_t *client)
-{
- 	jack_position_t position;
-	float usecs;
-	jack_nframes_t elapsed;
-	jack_transport_state_t tstate;
-
-	/* get the current transport position information. 
-	   this is thread-safe and atomic with respect
-	   to the structure contents.
-	*/
-
-	tstate = jack_transport_query (client, &position);
-	
-	if (tstate != JackTransportRolling) {
-		return position.frame;
-	}
-	
-	/* compute the elapsed usecs then audio frames since
-	   the transport info was last updated
-	*/
-	
-	usecs = jack_get_microseconds() - position.usecs;
-	elapsed = (jack_nframes_t) floor ((((float) position.frame_rate)
-					   / 1000000.0f) * usecs);
-
-	/* return the estimated transport frame position
-	 */
-	
-	return position.frame + elapsed;
-}	
-
-jack_nframes_t
-jack_frames_since_cycle_start (const jack_client_t *client)
-{
-	float usecs;
-	jack_control_t *ectl = client->engine;
-
-	usecs = jack_get_microseconds() - ectl->current_time.usecs;
-	return (jack_nframes_t) floor ((((float) ectl->current_time.frame_rate)
-					/ 1000000.0f) * usecs);
-}
-
-jack_time_t
-jack_get_time()
-{
-	return jack_get_microseconds();
-}
-
-jack_nframes_t
-jack_time_to_frames(const jack_client_t *client, jack_time_t now)
-{
-	jack_frame_timer_t time;
-	jack_control_t *ectl = client->engine;
-
-	jack_read_frame_time (client, &time);
-
-	if (time.initialized) {
-#if 0
-		jack_info ("now = %Lu current wakeup = %Lu next = %Lu frames = %lu + %f => %lu FC = %f SOI = %f", 
-			 now, time.current_wakeup, time.next_wakeup, time.frames,
-			 (double) (now - time.current_wakeup)/ (time.next_wakeup - time.current_wakeup),
-			 time.frames + 
-			   (long) rint (((double) ((long long) now - time.current_wakeup)/ 
-					 (long long) (time.next_wakeup - time.current_wakeup)) * ectl->buffer_size),
-			   time.filter_coefficient,  
-			   time.second_order_integrator);
-#endif
-
-		return time.frames + 
-			(long) rint (((double) ((long long) (now - time.current_wakeup))/ 
-						((long long) (time.next_wakeup - time.current_wakeup))) * ectl->buffer_size);
-	}
-	return 0;
-}
-
-jack_nframes_t
-jack_frame_time (const jack_client_t *client)
-{
-	jack_time_t now = jack_get_microseconds();
-	return jack_time_to_frames(client, now);
-}
-
-jack_nframes_t
-jack_last_frame_time (const jack_client_t *client)
-{
-	return client->engine->frame_timer.frames;
-}
-
-jack_time_t
-jack_frames_to_time(const jack_client_t *client, jack_nframes_t frames)
-{
-	jack_frame_timer_t time;
-	jack_control_t *ectl = client->engine;
-
-	jack_read_frame_time (client, &time);
-
-	if (time.initialized) {
-		return time.current_wakeup +
-			(long) rint (((double) ((long long) (frames - time.frames)) *
-						((long long) (time.next_wakeup - time.current_wakeup)) / ectl->buffer_size) );
-	} 
-
-	return 0;
-}
-
-jack_nframes_t
-jack_get_sample_rate (jack_client_t *client)
-{
-	return client->engine->current_time.frame_rate;
-}
-
-int
-jack_set_sample_rate_callback (jack_client_t *client,
-			       JackSampleRateCallback callback, void *arg)
-{
-	if (client->control->active) {
-		jack_error ("You cannot set callbacks on an active client.");
-		return -1;
-	}
-	client->srate_arg = arg;
-	client->srate = callback;
-	client->control->srate_cbset = (callback != NULL);
-
-	/* Now invoke it */
-
-	callback (client->engine->current_time.frame_rate, arg);
-
-	return 0;
-}
-
-int  
-jack_release_timebase (jack_client_t *client)
-{
-	int rc;
-	jack_request_t req;
-	jack_client_control_t *ctl = client->control;
-
-	req.type = ResetTimeBaseClient;
-	req.x.client_id = ctl->id;
-
-	rc = jack_client_deliver_request (client, &req);
-	if (rc == 0) {
-		client->timebase_cb = NULL;
-		client->timebase_arg = NULL;
-		ctl->timebase_cb_cbset = 0;
-	}
-
-	return rc;
-}
-
-int  
-jack_set_sync_callback (jack_client_t *client,
-			JackSyncCallback sync_callback, void *arg)
-{
-	jack_client_control_t *ctl = client->control;
-	jack_request_t req;
-	int rc;
-
-	if (sync_callback)
-		req.type = SetSyncClient;
-	else
-		req.type = ResetSyncClient;
-	req.x.client_id = ctl->id;
-
-	rc = jack_client_deliver_request (client, &req);
-	if (rc == 0) {
-		client->sync_cb = sync_callback;
-		client->sync_arg = arg;
-		ctl->sync_cb_cbset = TRUE;
-	}
-	return rc;
-}
-
-int  
-jack_set_sync_timeout (jack_client_t *client, jack_time_t usecs)
-{
-	jack_request_t req;
-
-	req.type = SetSyncTimeout;
-	req.x.timeout = usecs;
-
-	return jack_client_deliver_request (client, &req);
-}
-
-int  
-jack_set_timebase_callback (jack_client_t *client, int conditional,
-			    JackTimebaseCallback timebase_cb, void *arg)
-{
-	int rc;
-	jack_request_t req;
-	jack_client_control_t *ctl = client->control;
-
-	req.type = SetTimeBaseClient;
-	req.x.timebase.client_id = ctl->id;
-	req.x.timebase.conditional = conditional;
-
-	rc = jack_client_deliver_request (client, &req);
-	if (rc == 0) {
-		client->timebase_arg = arg;
-		client->timebase_cb = timebase_cb;
-		ctl->timebase_cb_cbset = TRUE;
-	}
-	return rc;
-}
-
-int
-jack_transport_locate (jack_client_t *client, jack_nframes_t frame)
-{
-	jack_position_t pos;
-
-	pos.frame = frame;
-	pos.valid = 0;
-	return jack_transport_request_new_pos (client, &pos);
-}
-
-jack_transport_state_t 
-jack_transport_query (const jack_client_t *client, jack_position_t *pos)
-{
-	jack_control_t *ectl = client->engine;
-
-	if (pos) {
-		/* the guarded copy makes this function work in any
-		 * thread 
-		 */
-		jack_transport_copy_position (&ectl->current_time, pos);
-	}
-
-	return ectl->transport_state;
-}
-
-int
-jack_transport_reposition (jack_client_t *client, jack_position_t *pos)
-{
-	/* copy the input, to avoid modifying its contents */
-	jack_position_t tmp = *pos;
-
-	/* validate input */
-	if (tmp.valid & ~JACK_POSITION_MASK) /* unknown field present? */
-		return EINVAL;
-
-	return jack_transport_request_new_pos (client, &tmp);
-}
-
-void  
-jack_transport_start (jack_client_t *client)
-{
-	client->engine->transport_cmd = TransportCommandStart;
-}
-
-void
-jack_transport_stop (jack_client_t *client)
-{
-	client->engine->transport_cmd = TransportCommandStop;
-}
-
-
-#ifdef OLD_TRANSPORT
-
-/************* Compatibility with old transport API. *************/
-
-int
-jack_engine_takeover_timebase (jack_client_t *client)
-{
-	jack_error ("jack_engine_takeover_timebase() is no longer supported.");
-	return ENOSYS;
-}	
-
-void
-jack_get_transport_info (jack_client_t *client,
-			 jack_transport_info_t *info)
-{
-	jack_control_t *ectl = client->engine;
-	static int first_time = 1;
-
-	if (first_time)
-		jack_error ("jack_get_transport_info() is deprecated.");
-	first_time = 0;
-
-	/* check that this is the process thread */
-	if (!pthread_equal(client->thread_id, pthread_self())) {
-		jack_error("Invalid thread for jack_get_transport_info().");
-		abort();		/* kill this client */
-	}
-
-	info->usecs = ectl->current_time.usecs;
-	info->frame_rate = ectl->current_time.frame_rate;
-	info->transport_state = ectl->transport_state;
-	info->frame = ectl->current_time.frame;
-	info->valid = (ectl->current_time.valid |
-		       JackTransportState | JackTransportPosition);
-
-	if (info->valid & JackTransportBBT) {
-		info->bar = ectl->current_time.bar;
-		info->beat = ectl->current_time.beat;
-		info->tick = ectl->current_time.tick;
-		info->bar_start_tick = ectl->current_time.bar_start_tick;
-		info->beats_per_bar = ectl->current_time.beats_per_bar;
-		info->beat_type = ectl->current_time.beat_type;
-		info->ticks_per_beat = ectl->current_time.ticks_per_beat;
-		info->beats_per_minute = ectl->current_time.beats_per_minute;
-	}
-}
-
-void
-jack_set_transport_info (jack_client_t *client,
-			 jack_transport_info_t *info)
-{
-	static int first_time = 1;
-
-	if (first_time)
-		jack_error ("jack_set_transport_info() no longer supported.");
-	first_time = 0;
-}	
-
-#endif /* OLD_TRANSPORT */
diff --git a/libjack/unlock.c b/libjack/unlock.c
deleted file mode 100644
index f621449..0000000
--- a/libjack/unlock.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- mode: c; c-file-style: "bsd"; -*- */
-/*
-    Copyright (C) 2004 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-    
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software 
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <limits.h>
-#include <sys/mman.h>
-
-#include "jack/unlock.h"
-#include "jack/internal.h"
-
-static char* blacklist[] = {
-	"/libgtk",
-	"/libqt",
-	"/libfltk",
-	"/wine/",
-	NULL
-};
-
-static char* whitelist[] = {
-	"/libc-",
-	"/libardour",
-	NULL
-};
-
-static char* library_roots[] = {
-	"/lib",
-	"/usr/lib",
-	"/usr/local/lib",
-	"/usr/X11R6/lib",
-	"/opt/lib",       /* solaris-y */   
-	"/opt/local/lib", /* common on OS X */
-	NULL
-};
-
-void
-cleanup_mlock ()
-{
-	FILE* map;
-	size_t start;
-	size_t end;
-	char path[PATH_MAX+1];
-	int unlock;
-	int i;
-	int whoknows;
-	int looks_like_library;
-
-	snprintf (path, sizeof(path), "/proc/%d/maps", getpid());
-
-	if ((map = fopen (path, "r")) == NULL) {
-		jack_error ("can't open map file");
-		return;
-	}
-
-	while (!feof (map)) {
-
-		unlock = 0;
-
-		if (fscanf (map, "%zx-%zx %*s %*x %*d:%*d %d",
-			    &start, &end, &whoknows) != 3) {
-			break;
-		}
-
-		if (!whoknows) {
-			continue;
-		}
-
-		fscanf (map, " %[^\n]", path);
-
-		/* if it doesn't look like a library, forget it */
-
-		looks_like_library = 0;
-
-		for (i = 0; library_roots[i]; ++i) {
-			if ((looks_like_library = (strstr (path, library_roots[i]) == path))) {
-				break;
-			}
-		}
-
-		if (!looks_like_library) {
-			continue;
-		}
-		
-		for (i = 0; blacklist[i]; ++i) {
-			if (strstr (path, blacklist[i])) {
-				unlock = 1;
-				break;
-			}
-		}
-
-		if (end - start > 1048576) {
-			unlock = 1;
-		}
-		
-		for (i = 0; whitelist[i]; ++i) {
-			if (strstr (path, whitelist[i])) {
-				unlock = 0;
-				break;
-			}
-		}
-		
-		if (unlock) {
-			jack_info ("unlocking %s", path);
-			munlock ((char *) start, end - start);
-		}
-	}
-
-	fclose (map);
-}
-	
-	
diff --git a/linux/JackAtomic_os.h b/linux/JackAtomic_os.h
new file mode 100644
index 0000000..b69cb22
--- /dev/null
+++ b/linux/JackAtomic_os.h
@@ -0,0 +1,73 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackAtomic_linux__
+#define __JackAtomic_linux__
+
+#include "JackTypes.h"
+
+#ifdef __PPC__
+
+static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr)
+{
+    register int result;
+    register UInt32 tmp;
+    asm volatile (
+        "# CAS					\n"
+        "	lwarx	%4, 0, %1	\n"         // creates a reservation on addr
+        "	cmpw	%4, %2		\n"        //  test value at addr
+        "	bne-	1f          \n"
+        "	sync            	\n"         //  synchronize instructions
+        "	stwcx.	%3, 0, %1	\n"         //  if the reservation is not altered
+        //  stores the new value at addr
+        "	bne-	1f          \n"
+        "   li      %0, 1       \n"
+        "	b		2f          \n"
+        "1:                     \n"
+        "   li      %0, 0       \n"
+        "2:                     \n"
+    : "=r" (result)
+                : "r" (addr), "r" (value), "r" (newvalue), "r" (tmp)
+            );
+    return result;
+}
+
+#endif
+
+#if defined(__i386__) || defined(__x86_64__)
+
+#define LOCK "lock ; "
+
+static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
+{
+    register char ret;
+    __asm__ __volatile__ (
+        "# CAS \n\t"
+        LOCK "cmpxchg %2, (%1) \n\t"
+        "sete %0               \n\t"
+    : "=a" (ret)
+                : "c" (addr), "d" (newvalue), "a" (value)
+            );
+    return ret;
+}
+
+#endif
+
+#endif
+
diff --git a/linux/JackLinuxTime.c b/linux/JackLinuxTime.c
new file mode 100644
index 0000000..37ae9fb
--- /dev/null
+++ b/linux/JackLinuxTime.c
@@ -0,0 +1,267 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2005 Jussi Laako
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackConstants.h"
+#include "JackTime.h"
+#include "JackTypes.h"
+#include "JackError.h"
+#include "cycles.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+static jack_time_t __jack_cpu_mhz = 0;
+jack_time_t (*_jack_get_microseconds)(void) = 0;
+
+#if defined(__gnu_linux__) && (defined(__i386__) || defined(__x86_64__))
+#define HPET_SUPPORT
+#define HPET_MMAP_SIZE			1024
+#define HPET_CAPS			0x000
+#define HPET_PERIOD			0x004
+#define HPET_COUNTER			0x0f0
+#define HPET_CAPS_COUNTER_64BIT		(1 << 13)
+#if defined(__x86_64__)
+typedef uint64_t hpet_counter_t;
+#else
+typedef uint32_t hpet_counter_t;
+#endif
+static int hpet_fd;
+static unsigned char *hpet_ptr;
+static uint32_t hpet_period; /* period length in femto secs */
+static uint64_t hpet_offset = 0;
+static uint64_t hpet_wrap;
+static hpet_counter_t hpet_previous = 0;
+#endif /* defined(__gnu_linux__) && (__i386__ || __x86_64__) */
+
+#ifdef HPET_SUPPORT
+
+static int jack_hpet_init ()
+{
+	uint32_t hpet_caps;
+
+	hpet_fd = open("/dev/hpet", O_RDONLY);
+	if (hpet_fd < 0) {
+		jack_error ("This system has no accessible HPET device (%s)", strerror (errno));
+		return -1;
+	}
+
+	hpet_ptr = (unsigned char *) mmap(NULL, HPET_MMAP_SIZE,
+					  PROT_READ, MAP_SHARED, hpet_fd, 0);
+	if (hpet_ptr == MAP_FAILED) {
+		jack_error ("This system has no mappable HPET device (%s)", strerror (errno));
+		close (hpet_fd);
+		return -1;
+	}
+
+	/* this assumes period to be constant. if needed,
+	   it can be moved to the clock access function 
+	*/
+	hpet_period = *((uint32_t *) (hpet_ptr + HPET_PERIOD));
+	hpet_caps = *((uint32_t *) (hpet_ptr + HPET_CAPS));
+	hpet_wrap = ((hpet_caps & HPET_CAPS_COUNTER_64BIT) &&
+		(sizeof(hpet_counter_t) == sizeof(uint64_t))) ?
+		0 : ((uint64_t) 1 << 32);
+
+	return 0;
+}
+
+static jack_time_t jack_get_microseconds_from_hpet (void) 
+{
+	hpet_counter_t hpet_counter;
+	long double hpet_time;
+
+	hpet_counter = *((hpet_counter_t *) (hpet_ptr + HPET_COUNTER));
+	if (hpet_counter < hpet_previous)
+		hpet_offset += hpet_wrap;
+	hpet_previous = hpet_counter;
+	hpet_time = (long double) (hpet_offset + hpet_counter) *
+		(long double) hpet_period * (long double) 1e-9;
+	return ((jack_time_t) (hpet_time + 0.5));
+}
+
+#else
+
+static int jack_hpet_init ()
+{
+	jack_error ("This version of JACK or this computer does not have HPET support.\n"
+		    "Please choose a different clock source.");
+	return -1;
+}
+
+static jack_time_t jack_get_microseconds_from_hpet (void) 
+{
+	/* never called */
+	return 0;
+}
+
+#endif /* HPET_SUPPORT */
+
+static jack_time_t jack_get_microseconds_from_cycles (void) {
+	return get_cycles() / __jack_cpu_mhz;
+}
+
+/*
+ * This is another kludge.  It looks CPU-dependent, but actually it
+ * reflects the lack of standards for the Linux kernel formatting of
+ * /proc/cpuinfo.
+ */
+
+static jack_time_t jack_get_mhz (void)
+{
+	FILE *f = fopen("/proc/cpuinfo", "r");
+	if (f == 0)
+	{
+		perror("can't open /proc/cpuinfo\n");
+		exit(1);
+	}
+
+	for ( ; ; )
+	{
+		jack_time_t mhz;
+		int ret;
+		char buf[1000];
+
+		if (fgets(buf, sizeof(buf), f) == NULL) {
+			jack_error ("FATAL: cannot locate cpu MHz in "
+				    "/proc/cpuinfo\n");
+			exit(1);
+		}
+
+#if defined(__powerpc__)
+		ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz);
+#elif defined( __i386__ ) || defined (__hppa__)  || defined (__ia64__) || \
+      defined(__x86_64__)
+		ret = sscanf(buf, "cpu MHz         : %" SCNu64, &mhz);
+#elif defined( __sparc__ )
+		ret = sscanf(buf, "Cpu0Bogo        : %" SCNu64, &mhz);
+#elif defined( __mc68000__ )
+		ret = sscanf(buf, "Clocking:       %" SCNu64, &mhz);
+#elif defined( __s390__  )
+		ret = sscanf(buf, "bogomips per cpu: %" SCNu64, &mhz);
+#else /* MIPS, ARM, alpha */
+		ret = sscanf(buf, "BogoMIPS        : %" SCNu64, &mhz);
+#endif 
+
+		if (ret == 1)
+		{
+			fclose(f);
+			return (jack_time_t)mhz;
+		}
+	}
+}
+
+#define HAVE_CLOCK_GETTIME 1
+
+#ifndef HAVE_CLOCK_GETTIME
+
+static jack_time_t jack_get_microseconds_from_system (void) 
+{
+	jack_time_t jackTime;
+	struct timeval tv;
+
+	gettimeofday (&tv, NULL);
+	jackTime = (jack_time_t) tv.tv_sec * 1000000 + (jack_time_t) tv.tv_usec;
+	return jackTime;
+}
+
+#else
+
+static jack_time_t jack_get_microseconds_from_system (void) 
+{
+	jack_time_t jackTime;
+	struct timespec time;
+
+	clock_gettime(CLOCK_MONOTONIC, &time);
+	jackTime = (jack_time_t) time.tv_sec * 1e6 +
+		(jack_time_t) time.tv_nsec / 1e3;
+	return jackTime;
+}
+
+#endif /* HAVE_CLOCK_GETTIME */
+
+
+SERVER_EXPORT void JackSleep(long usec) 
+{
+	usleep(usec);
+}
+
+SERVER_EXPORT void InitTime()
+{
+	__jack_cpu_mhz = jack_get_mhz ();
+}
+
+SERVER_EXPORT void SetClockSource(jack_timer_type_t source)
+{
+        jack_log("Clock source : %s", ClockSourceName(source));
+
+	switch (source)
+	{
+	case JACK_TIMER_CYCLE_COUNTER:
+		_jack_get_microseconds = jack_get_microseconds_from_cycles;
+		break;
+
+	case JACK_TIMER_HPET:
+		if (jack_hpet_init () == 0) {
+			_jack_get_microseconds = jack_get_microseconds_from_hpet;
+		} else {
+			_jack_get_microseconds = jack_get_microseconds_from_system;
+		}
+		break;
+
+	case JACK_TIMER_SYSTEM_CLOCK:
+	default:
+		_jack_get_microseconds = jack_get_microseconds_from_system;
+		break;
+	}
+}
+
+SERVER_EXPORT const char* ClockSourceName(jack_timer_type_t source)
+{
+	switch (source) {
+	case JACK_TIMER_CYCLE_COUNTER:
+		return "cycle counter";
+	case JACK_TIMER_HPET:
+		return "hpet";
+	case JACK_TIMER_SYSTEM_CLOCK:
+#ifdef HAVE_CLOCK_GETTIME
+		return "system clock via clock_gettime";
+#else
+		return "system clock via gettimeofday";
+#endif
+	}
+
+	/* what is wrong with gcc ? */
+	return "unknown";
+}
+
+SERVER_EXPORT jack_time_t GetMicroSeconds()
+{
+	return _jack_get_microseconds();
+}
diff --git a/linux/JackPlatformPlug_os.h b/linux/JackPlatformPlug_os.h
new file mode 100644
index 0000000..c0cd93b
--- /dev/null
+++ b/linux/JackPlatformPlug_os.h
@@ -0,0 +1,79 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPlatformPlug_linux__
+#define __JackPlatformPlug_linux__
+
+namespace Jack
+{
+    struct JackRequest;
+    struct JackResult;
+    
+    class JackPosixMutex;
+    class JackPosixThread;
+    class JackFifo;
+    class JackSocketServerChannel;
+    class JackSocketClientChannel;
+    class JackSocketServerNotifyChannel;
+    class JackSocketNotifyChannel;
+    class JackClientSocket;
+    class JackNetUnixSocket;
+}
+
+/* __JackPlatformMutex__ */
+#include "JackPosixMutex.h"
+namespace Jack {typedef JackPosixMutex JackMutex; }
+
+/* __JackPlatformThread__ */
+#include "JackPosixThread.h"
+namespace Jack { typedef JackPosixThread JackThread; }
+
+/* __JackPlatformSynchro__  client activation */
+#include "JackFifo.h"
+namespace Jack { typedef JackFifo JackSynchro; }
+
+/* __JackPlatformChannelTransaction__ */
+#include "JackSocket.h"
+namespace Jack { typedef JackClientSocket JackChannelTransaction; }
+
+#include "JackProcessSync.h"
+/* __JackPlatformProcessSync__ */
+/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */
+
+/* __JackPlatformServerChannel__ */ 
+#include "JackSocketServerChannel.h"
+namespace Jack { typedef JackSocketServerChannel JackServerChannel; }
+
+/* __JackPlatformClientChannel__ */
+#include "JackSocketClientChannel.h"
+namespace Jack { typedef JackSocketClientChannel JackClientChannel; }
+
+/* __JackPlatformServerNotifyChannel__ */
+#include "JackSocketServerNotifyChannel.h"
+namespace Jack { typedef JackSocketServerNotifyChannel JackServerNotifyChannel; }
+
+/* __JackPlatformNotifyChannel__ */
+#include "JackSocketNotifyChannel.h"
+namespace Jack { typedef JackSocketNotifyChannel JackNotifyChannel; }
+
+/* __JackPlatformNetSocket__ */
+#include "JackNetUnixSocket.h"
+namespace Jack { typedef JackNetUnixSocket JackNetSocket; }
+
+#endif
diff --git a/linux/alsa/JackAlsaAdapter.cpp b/linux/alsa/JackAlsaAdapter.cpp
new file mode 100644
index 0000000..a046e1f
--- /dev/null
+++ b/linux/alsa/JackAlsaAdapter.cpp
@@ -0,0 +1,299 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "JackAlsaAdapter.h"
+#include "JackServerGlobals.h"
+#include "JackEngineControl.h"
+
+namespace Jack
+{
+
+    JackAlsaAdapter::JackAlsaAdapter ( jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params ) :
+            JackAudioAdapterInterface ( buffer_size, sample_rate ),
+            fThread ( this ),
+            fAudioInterface ( buffer_size, sample_rate )
+    {
+        const JSList* node;
+        const jack_driver_param_t* param;
+
+        fCaptureChannels = 2;
+        fPlaybackChannels = 2;
+
+        fAudioInterface.fPeriod = 2;
+
+        for ( node = params; node; node = jack_slist_next ( node ) )
+        {
+            param = ( const jack_driver_param_t* ) node->data;
+
+            switch ( param->character )
+            {
+                case 'i':
+                    fCaptureChannels = param->value.ui;
+                    break;
+                case 'o':
+                    fPlaybackChannels = param->value.ui;
+                    break;
+                case 'C':
+                    break;
+                case 'P':
+                    break;
+                case 'D':
+                    break;
+                case 'n':
+                    fAudioInterface.fPeriod = param->value.ui;
+                    break;
+                case 'd':
+                    fAudioInterface.fCardName = strdup ( param->value.str );
+                    break;
+                case 'r':
+                    fAudioInterface.fFrequency = param->value.ui;
+                    SetAdaptedSampleRate ( param->value.ui );
+                    break;
+                case 'p':
+                    fAudioInterface.fBuffering = param->value.ui;
+                    SetAdaptedBufferSize ( param->value.ui );
+                    break;
+                case 'q':
+                    fQuality = param->value.ui;
+                    break;
+                case 'g':
+                    fRingbufferCurSize = param->value.ui;
+                    fAdaptative = false;
+                    break;
+            }
+        }
+
+        fAudioInterface.setInputs ( fCaptureChannels );
+        fAudioInterface.setOutputs ( fPlaybackChannels );
+    }
+
+    int JackAlsaAdapter::Open()
+    {
+        //open audio interface
+        if ( fAudioInterface.open() )
+            return -1;
+
+        //start adapter thread
+        if ( fThread.StartSync() < 0 )
+        {
+            jack_error ( "Cannot start audioadapter thread" );
+            return -1;
+        }
+
+        //display card info
+        fAudioInterface.longinfo();
+
+        //turn the thread realtime
+        fThread.AcquireRealTime ( JackServerGlobals::fInstance->GetEngineControl()->fClientPriority );
+        return 0;
+    }
+
+    int JackAlsaAdapter::Close()
+    {
+#ifdef JACK_MONITOR
+        fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
+#endif
+        switch ( fThread.GetStatus() )
+        {
+
+                // Kill the thread in Init phase
+            case JackThread::kStarting:
+            case JackThread::kIniting:
+                if ( fThread.Kill() < 0 )
+                {
+                    jack_error ( "Cannot kill thread" );
+                    return -1;
+                }
+                break;
+
+                // Stop when the thread cycle is finished
+            case JackThread::kRunning:
+                if ( fThread.Stop() < 0 )
+                {
+                    jack_error ( "Cannot stop thread" );
+                    return -1;
+                }
+                break;
+
+            default:
+                break;
+        }
+        return fAudioInterface.close();
+    }
+
+    bool JackAlsaAdapter::Init()
+    {
+        //fill the hardware buffers
+        for ( unsigned int i = 0; i < fAudioInterface.fPeriod; i++ )
+            fAudioInterface.write();
+        return true;
+    }
+
+    bool JackAlsaAdapter::Execute()
+    {
+        //read data from audio interface
+        if (fAudioInterface.read() < 0)
+            return false;
+            
+        PushAndPull(fAudioInterface.fInputSoftChannels, fAudioInterface.fOutputSoftChannels, fAdaptedBufferSize);
+
+        //write data to audio interface
+        if (fAudioInterface.write() < 0)
+            return false;
+
+        return true;
+    }
+
+    int JackAlsaAdapter::SetSampleRate ( jack_nframes_t sample_rate )
+    {
+        JackAudioAdapterInterface::SetHostSampleRate ( sample_rate );
+        Close();
+        return Open();
+    }
+
+    int JackAlsaAdapter::SetBufferSize ( jack_nframes_t buffer_size )
+    {
+        JackAudioAdapterInterface::SetHostBufferSize ( buffer_size );
+        Close();
+        return Open();
+    }
+
+} // namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+    {
+        jack_driver_desc_t *desc;
+        unsigned int i;
+        desc = ( jack_driver_desc_t* ) calloc ( 1, sizeof ( jack_driver_desc_t ) );
+
+        strcpy ( desc->name, "audioadapter" );                         // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy ( desc->desc, "netjack audio <==> net backend adapter" );  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 11;
+        desc->params = ( jack_driver_param_desc_t* ) calloc ( desc->nparams, sizeof ( jack_driver_param_desc_t ) );
+
+        i = 0;
+        strcpy ( desc->params[i].name, "capture" );
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, "none" );
+        strcpy ( desc->params[i].short_desc,
+                 "Provide capture ports.  Optionally set device" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "playback" );
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, "none" );
+        strcpy ( desc->params[i].short_desc,
+                 "Provide playback ports.  Optionally set device" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "device" );
+        desc->params[i].character = 'd';
+        desc->params[i].type = JackDriverParamString;
+        strcpy ( desc->params[i].value.str, "hw:0" );
+        strcpy ( desc->params[i].short_desc, "ALSA device name" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "rate" );
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 48000U;
+        strcpy ( desc->params[i].short_desc, "Sample rate" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "periodsize" );
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 512U;
+        strcpy ( desc->params[i].short_desc, "Period size" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "nperiods" );
+        desc->params[i].character = 'n';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 2U;
+        strcpy ( desc->params[i].short_desc, "Number of periods of playback latency" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "duplex" );
+        desc->params[i].character = 'D';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = true;
+        strcpy ( desc->params[i].short_desc,
+                 "Provide both capture and playback ports" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "inchannels" );
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 0;
+        strcpy ( desc->params[i].short_desc,
+                 "Number of capture channels (defaults to hardware max)" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+
+        i++;
+        strcpy ( desc->params[i].name, "outchannels" );
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 0;
+        strcpy ( desc->params[i].short_desc,
+                 "Number of playback channels (defaults to hardware max)" );
+        strcpy ( desc->params[i].long_desc, desc->params[i].short_desc );
+    
+        i++;
+        strcpy(desc->params[i].name, "quality");
+        desc->params[i].character = 'q';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Resample algorithm quality (0 - 4)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "ring-buffer");
+        desc->params[i].character = 'g';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 32768;
+        strcpy(desc->params[i].short_desc, "Fixed ringbuffer size");
+        strcpy(desc->params[i].long_desc, "Fixed ringbuffer size (if not set => automatic adaptative)");
+
+        return desc;
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/linux/alsa/JackAlsaAdapter.h b/linux/alsa/JackAlsaAdapter.h
new file mode 100644
index 0000000..8cdde0e
--- /dev/null
+++ b/linux/alsa/JackAlsaAdapter.h
@@ -0,0 +1,631 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackAlsaAdapter__
+#define __JackAlsaAdapter__
+
+#include <math.h>
+#include <limits.h>
+#include <assert.h>
+#include <alsa/asoundlib.h>
+#include "JackAudioAdapterInterface.h"
+#include "JackPlatformPlug.h"
+#include "JackError.h"
+#include "jack.h"
+#include "jslist.h"
+
+namespace Jack
+{
+
+    inline void* aligned_calloc ( size_t nmemb, size_t size ) { return ( void* ) calloc ( nmemb, size ); }
+
+#define max(x,y) (((x)>(y)) ? (x) : (y))
+#define min(x,y) (((x)<(y)) ? (x) : (y))
+
+#define check_error(err) if (err) { jack_error("%s:%d, alsa error %d : %s", __FILE__, __LINE__, err, snd_strerror(err)); return err; }
+#define check_error_msg(err,msg) if (err) { jack_error("%s:%d, %s : %s(%d)", __FILE__, __LINE__, msg, snd_strerror(err), err); return err; }
+#define display_error_msg(err,msg) if (err) { jack_error("%s:%d, %s : %s(%d)", __FILE__, __LINE__, msg, snd_strerror(err), err); }
+
+    /**
+     * A convenient class to pass parameters to AudioInterface
+     */
+    class AudioParam
+    {
+        public:
+            const char*     fCardName;
+            unsigned int    fFrequency;
+            int             fBuffering;
+
+            unsigned int    fSoftInputs;
+            unsigned int    fSoftOutputs;
+
+        public:
+            AudioParam() :
+                    fCardName ( "hw:0" ),
+                    fFrequency ( 44100 ),
+                    fBuffering ( 512 ),
+                    fSoftInputs ( 2 ),
+                    fSoftOutputs ( 2 )
+            {}
+
+            AudioParam ( jack_nframes_t buffer_size, jack_nframes_t sample_rate ) :
+                    fCardName ( "hw:0" ),
+                    fFrequency ( sample_rate ),
+                    fBuffering ( buffer_size ),
+                    fSoftInputs ( 2 ),
+                    fSoftOutputs ( 2 )
+            {}
+
+            AudioParam& cardName ( const char* n )
+            {
+                fCardName = n;
+                return *this;
+            }
+
+            AudioParam& frequency ( int f )
+            {
+                fFrequency = f;
+                return *this;
+            }
+
+            AudioParam& buffering ( int fpb )
+            {
+                fBuffering = fpb;
+                return *this;
+            }
+
+            void setInputs ( int inputs )
+            {
+                fSoftInputs = inputs;
+            }
+
+            AudioParam& inputs ( int n )
+            {
+                fSoftInputs = n;
+                return *this;
+            }
+
+            void setOutputs ( int outputs )
+            {
+                fSoftOutputs = outputs;
+            }
+
+            AudioParam& outputs ( int n )
+            {
+                fSoftOutputs = n;
+                return *this;
+            }
+    };
+
+    /**
+     * An ALSA audio interface
+     */
+    class AudioInterface : public AudioParam
+    {
+        public:
+            //device info
+            snd_pcm_t*  fOutputDevice;
+            snd_pcm_t*  fInputDevice;
+            snd_pcm_hw_params_t* fInputParams;
+            snd_pcm_hw_params_t* fOutputParams;
+
+            //samples info
+            snd_pcm_format_t fSampleFormat;
+            snd_pcm_access_t fSampleAccess;
+
+            //channels
+            unsigned int fCardInputs;
+            unsigned int fCardOutputs;
+
+            //stream parameters
+            unsigned int fPeriod;
+
+            //interleaved mode audiocard buffers
+            void* fInputCardBuffer;
+            void* fOutputCardBuffer;
+
+            //non-interleaved mode audiocard buffers
+            void* fInputCardChannels[256];
+            void* fOutputCardChannels[256];
+
+            //non-interleaved mod, floating point software buffers
+            float* fInputSoftChannels[256];
+            float* fOutputSoftChannels[256];
+
+            //public methods ---------------------------------------------------------
+
+            const char* cardName()
+            {
+                return fCardName;
+            }
+
+            int frequency()
+            {
+                return fFrequency;
+            }
+
+            int buffering()
+            {
+                return fBuffering;
+            }
+
+            float** inputSoftChannels()
+            {
+                return fInputSoftChannels;
+            }
+
+            float** outputSoftChannels()
+            {
+                return fOutputSoftChannels;
+            }
+
+            AudioInterface ( const AudioParam& ap = AudioParam() ) : AudioParam ( ap )
+            {
+                fInputDevice    = 0;
+                fOutputDevice   = 0;
+                fInputParams    = 0;
+                fOutputParams   = 0;
+                fPeriod = 2;
+                
+                fInputCardBuffer = 0;
+                fOutputCardBuffer = 0;
+                
+                for ( int i = 0; i < 256; i++ )
+                {
+                    fInputCardChannels[i] = 0;
+                    fOutputCardChannels[i] = 0;
+                    fInputSoftChannels[i] = 0;
+                    fOutputSoftChannels[i] = 0;
+                }
+            }
+
+            AudioInterface ( jack_nframes_t buffer_size, jack_nframes_t sample_rate ) :
+                    AudioParam ( buffer_size, sample_rate )
+            {
+                fInputCardBuffer = 0;
+                fOutputCardBuffer = 0;
+
+                for ( int i = 0; i < 256; i++ )
+                {
+                    fInputCardChannels[i] = 0;
+                    fOutputCardChannels[i] = 0;
+                    fInputSoftChannels[i] = 0;
+                    fOutputSoftChannels[i] = 0;
+                }
+            }
+
+            /**
+             * Open the audio interface
+             */
+            int open()
+            {
+                //open input/output streams
+                check_error ( snd_pcm_open ( &fInputDevice,  fCardName, SND_PCM_STREAM_CAPTURE, 0 ) );
+                check_error ( snd_pcm_open ( &fOutputDevice, fCardName, SND_PCM_STREAM_PLAYBACK, 0 ) );
+
+                //get hardware input parameters
+                check_error ( snd_pcm_hw_params_malloc ( &fInputParams ) );
+                setAudioParams ( fInputDevice, fInputParams );
+           
+                //get hardware output parameters
+                check_error ( snd_pcm_hw_params_malloc ( &fOutputParams ) )
+                setAudioParams ( fOutputDevice, fOutputParams );
+                
+                // set the number of physical input and output channels close to what we need
+                fCardInputs 	= fSoftInputs;
+                fCardOutputs 	= fSoftOutputs;
+  
+                snd_pcm_hw_params_set_channels_near(fInputDevice, fInputParams, &fCardInputs);
+                snd_pcm_hw_params_set_channels_near(fOutputDevice, fOutputParams, &fCardOutputs);
+     
+                //set input/output param
+                check_error ( snd_pcm_hw_params ( fInputDevice,  fInputParams ) );
+                check_error ( snd_pcm_hw_params ( fOutputDevice, fOutputParams ) );
+
+                //set hardware buffers
+                if ( fSampleAccess == SND_PCM_ACCESS_RW_INTERLEAVED )
+                {
+                    fInputCardBuffer = aligned_calloc ( interleavedBufferSize ( fInputParams ), 1 );
+                    fOutputCardBuffer = aligned_calloc ( interleavedBufferSize ( fOutputParams ), 1 );
+                }
+                else
+                {
+                    for ( unsigned int i = 0; i < fCardInputs; i++ )
+                        fInputCardChannels[i] = aligned_calloc ( noninterleavedBufferSize ( fInputParams ), 1 );
+                    for ( unsigned int i = 0; i < fCardOutputs; i++ )
+                        fOutputCardChannels[i] = aligned_calloc ( noninterleavedBufferSize ( fOutputParams ), 1 );
+                }
+
+                //set floating point buffers needed by the dsp code
+                fSoftInputs = max ( fSoftInputs, fCardInputs );
+                assert ( fSoftInputs < 256 );
+                fSoftOutputs = max ( fSoftOutputs, fCardOutputs );
+                assert ( fSoftOutputs < 256 );
+
+                for ( unsigned int i = 0; i < fSoftInputs; i++ )
+                {
+                    fInputSoftChannels[i] = ( float* ) aligned_calloc ( fBuffering, sizeof ( float ) );
+                    for ( int j = 0; j < fBuffering; j++ )
+                        fInputSoftChannels[i][j] = 0.0;
+                }
+
+                for ( unsigned int i = 0; i < fSoftOutputs; i++ )
+                {
+                    fOutputSoftChannels[i] = ( float* ) aligned_calloc ( fBuffering, sizeof ( float ) );
+                    for ( int j = 0; j < fBuffering; j++ )
+                        fOutputSoftChannels[i][j] = 0.0;
+                }
+                return 0;
+            }
+
+            int close()
+            {
+                snd_pcm_hw_params_free ( fInputParams );
+                snd_pcm_hw_params_free ( fOutputParams );
+                snd_pcm_close ( fInputDevice );
+                snd_pcm_close ( fOutputDevice );
+
+                for ( unsigned int i = 0; i < fSoftInputs; i++ )
+                    if ( fInputSoftChannels[i] )
+                        free ( fInputSoftChannels[i] );
+
+                for ( unsigned int i = 0; i < fSoftOutputs; i++ )
+                    if ( fOutputSoftChannels[i] )
+                        free ( fOutputSoftChannels[i] );
+
+                for ( unsigned int i = 0; i < fCardInputs; i++ )
+                    if ( fInputCardChannels[i] )
+                        free ( fInputCardChannels[i] );
+
+                for ( unsigned int i = 0; i < fCardOutputs; i++ )
+                    if ( fOutputCardChannels[i] )
+                        free ( fOutputCardChannels[i] );
+
+                if ( fInputCardBuffer )
+                    free ( fInputCardBuffer );
+                if ( fOutputCardBuffer )
+                    free ( fOutputCardBuffer );
+
+                return 0;
+            }
+
+            int setAudioParams ( snd_pcm_t* stream, snd_pcm_hw_params_t* params )
+            {
+                //set params record with initial values
+                check_error_msg ( snd_pcm_hw_params_any ( stream, params ), "unable to init parameters" )
+
+                //set alsa access mode (and fSampleAccess field) either to non interleaved or interleaved
+                if ( snd_pcm_hw_params_set_access ( stream, params, SND_PCM_ACCESS_RW_NONINTERLEAVED ) )
+                    check_error_msg ( snd_pcm_hw_params_set_access ( stream, params, SND_PCM_ACCESS_RW_INTERLEAVED ),
+                                      "unable to set access mode neither to non-interleaved or to interleaved" );
+                snd_pcm_hw_params_get_access ( params, &fSampleAccess );
+
+                //search for 32-bits or 16-bits format
+                if ( snd_pcm_hw_params_set_format ( stream, params, SND_PCM_FORMAT_S32 ) )
+                    check_error_msg ( snd_pcm_hw_params_set_format ( stream, params, SND_PCM_FORMAT_S16 ),
+                                      "unable to set format to either 32-bits or 16-bits" );
+                snd_pcm_hw_params_get_format ( params, &fSampleFormat );
+
+                //set sample frequency
+                snd_pcm_hw_params_set_rate_near ( stream, params, &fFrequency, 0 );
+
+                //set period and period size (buffering)
+                check_error_msg ( snd_pcm_hw_params_set_period_size ( stream, params, fBuffering, 0 ), "period size not available" );
+                check_error_msg ( snd_pcm_hw_params_set_periods ( stream, params, fPeriod, 0 ), "number of periods not available" );
+
+                return 0;
+            }
+
+            ssize_t interleavedBufferSize ( snd_pcm_hw_params_t* params )
+            {
+                _snd_pcm_format format;
+                unsigned int channels;
+                snd_pcm_hw_params_get_format ( params, &format );
+                snd_pcm_uframes_t psize;
+                snd_pcm_hw_params_get_period_size ( params, &psize, NULL );
+                snd_pcm_hw_params_get_channels ( params, &channels );
+                ssize_t bsize = snd_pcm_format_size ( format, psize * channels );
+                return bsize;
+            }
+
+            ssize_t noninterleavedBufferSize ( snd_pcm_hw_params_t* params )
+            {
+                _snd_pcm_format format;
+                snd_pcm_hw_params_get_format ( params, &format );
+                snd_pcm_uframes_t psize;
+                snd_pcm_hw_params_get_period_size ( params, &psize, NULL );
+                ssize_t bsize = snd_pcm_format_size ( format, psize );
+                return bsize;
+            }
+
+            /**
+             * Read audio samples from the audio card. Convert samples to floats and take
+             * care of interleaved buffers
+             */
+            int read()
+            {
+                int count, s;
+                unsigned int c;
+                switch ( fSampleAccess )
+                {
+                    case SND_PCM_ACCESS_RW_INTERLEAVED :
+                        count = snd_pcm_readi ( fInputDevice, fInputCardBuffer, fBuffering );
+                        if ( count < 0 )
+                        {
+                            display_error_msg ( count, "reading samples" );
+                            check_error_msg ( snd_pcm_prepare ( fInputDevice ), "preparing input stream" );
+                        }
+                        if ( fSampleFormat == SND_PCM_FORMAT_S16 )
+                        {
+                            short* buffer16b = ( short* ) fInputCardBuffer;
+                            for ( s = 0; s < fBuffering; s++ )
+                                for ( c = 0; c < fCardInputs; c++ )
+                                    fInputSoftChannels[c][s] = float ( buffer16b[c + s*fCardInputs] ) * ( 1.0/float ( SHRT_MAX ) );
+                        }
+                        else   // SND_PCM_FORMAT_S32
+                        {
+                            int32_t* buffer32b = ( int32_t* ) fInputCardBuffer;
+                            for ( s = 0; s < fBuffering; s++ )
+                                for ( c = 0; c < fCardInputs; c++ )
+                                    fInputSoftChannels[c][s] = float ( buffer32b[c + s*fCardInputs] ) * ( 1.0/float ( INT_MAX ) );
+                        }
+                        break;
+                    case SND_PCM_ACCESS_RW_NONINTERLEAVED :
+                        count = snd_pcm_readn ( fInputDevice, fInputCardChannels, fBuffering );
+                        if ( count < 0 )
+                        {
+                            display_error_msg ( count, "reading samples" );
+                            check_error_msg ( snd_pcm_prepare ( fInputDevice ), "preparing input stream" );
+                        }
+                        if ( fSampleFormat == SND_PCM_FORMAT_S16 )
+                        {
+                            short* chan16b;
+                            for ( c = 0; c < fCardInputs; c++ )
+                            {
+                                chan16b = ( short* ) fInputCardChannels[c];
+                                for ( s = 0; s < fBuffering; s++ )
+                                    fInputSoftChannels[c][s] = float ( chan16b[s] ) * ( 1.0/float ( SHRT_MAX ) );
+                            }
+                        }
+                        else   // SND_PCM_FORMAT_S32
+                        {
+                            int32_t* chan32b;
+                            for ( c = 0; c < fCardInputs; c++ )
+                            {
+                                chan32b = ( int32_t* ) fInputCardChannels[c];
+                                for ( s = 0; s < fBuffering; s++ )
+                                    fInputSoftChannels[c][s] = float ( chan32b[s] ) * ( 1.0/float ( INT_MAX ) );
+                            }
+                        }
+                        break;
+                    default :
+                        check_error_msg ( -10000, "unknow access mode" );
+                        break;
+                }
+                return 0;
+            }
+
+            /**
+             * write the output soft channels to the audio card. Convert sample
+             * format and interleaves buffers when needed
+             */
+            int write()
+            {
+                int count, f;
+                unsigned int c;
+            recovery:
+                switch ( fSampleAccess )
+                {
+                    case SND_PCM_ACCESS_RW_INTERLEAVED :
+                        if ( fSampleFormat == SND_PCM_FORMAT_S16 )
+                        {
+                            short* buffer16b = ( short* ) fOutputCardBuffer;
+                            for ( f = 0; f < fBuffering; f++ )
+                            {
+                                for ( unsigned int c = 0; c < fCardOutputs; c++ )
+                                {
+                                    float x = fOutputSoftChannels[c][f];
+                                    buffer16b[c + f * fCardOutputs] = short ( max ( min ( x, 1.0 ), -1.0 ) * float ( SHRT_MAX ) );
+                                }
+                            }
+                        }
+                        else   // SND_PCM_FORMAT_S32
+                        {
+                            int32_t* buffer32b = ( int32_t* ) fOutputCardBuffer;
+                            for ( f = 0; f < fBuffering; f++ )
+                            {
+                                for ( unsigned int c = 0; c < fCardOutputs; c++ )
+                                {
+                                    float x = fOutputSoftChannels[c][f];
+                                    buffer32b[c + f * fCardOutputs] = int32_t ( max ( min ( x, 1.0 ), -1.0 ) * float ( INT_MAX ) );
+                                }
+                            }
+                        }
+                        count = snd_pcm_writei ( fOutputDevice, fOutputCardBuffer, fBuffering );
+                        if ( count < 0 )
+                        {
+                            display_error_msg ( count, "w3" );
+                            int err = snd_pcm_prepare ( fOutputDevice );
+                            check_error_msg ( err, "preparing output stream" );
+                            goto recovery;
+                        }
+                        break;
+                    case SND_PCM_ACCESS_RW_NONINTERLEAVED :
+                        if ( fSampleFormat == SND_PCM_FORMAT_S16 )
+                        {
+                            for ( c = 0; c < fCardOutputs; c++ )
+                            {
+                                short* chan16b = ( short* ) fOutputCardChannels[c];
+                                for ( f = 0; f < fBuffering; f++ )
+                                {
+                                    float x = fOutputSoftChannels[c][f];
+                                    chan16b[f] = short ( max ( min ( x,1.0 ), -1.0 ) * float ( SHRT_MAX ) ) ;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            for ( c = 0; c < fCardOutputs; c++ )
+                            {
+                                int32_t* chan32b = ( int32_t* ) fOutputCardChannels[c];
+                                for ( f = 0; f < fBuffering; f++ )
+                                {
+                                    float x = fOutputSoftChannels[c][f];
+                                    chan32b[f] = int32_t ( max ( min ( x,1.0 ),-1.0 ) * float ( INT_MAX ) ) ;
+                                }
+                            }
+                        }
+                        count = snd_pcm_writen ( fOutputDevice, fOutputCardChannels, fBuffering );
+                        if ( count<0 )
+                        {
+                            display_error_msg ( count, "w3" );
+                            int err = snd_pcm_prepare ( fOutputDevice );
+                            check_error_msg ( err, "preparing output stream" );
+                            goto recovery;
+                        }
+                        break;
+                    default :
+                        check_error_msg ( -10000, "unknow access mode" );
+                        break;
+                }
+                return 0;
+            }
+
+            /**
+             *  print short information on the audio device
+             */
+            int shortinfo()
+            {
+                int err;
+                snd_ctl_card_info_t* card_info;
+                snd_ctl_t* ctl_handle;
+                err = snd_ctl_open ( &ctl_handle, fCardName, 0 );   check_error ( err );
+                snd_ctl_card_info_alloca ( &card_info );
+                err = snd_ctl_card_info ( ctl_handle, card_info );  check_error ( err );
+                jack_info ( "%s|%d|%d|%d|%d|%s",
+                            snd_ctl_card_info_get_driver ( card_info ),
+                            fCardInputs, fCardOutputs,
+                            fFrequency, fBuffering,
+                            snd_pcm_format_name ( ( _snd_pcm_format ) fSampleFormat ) );
+            }
+
+            /**
+             *  print more detailled information on the audio device
+             */
+            int longinfo()
+            {
+                snd_ctl_card_info_t* card_info;
+                snd_ctl_t* ctl_handle;
+
+                //display info
+                jack_info ( "Audio Interface Description :" );
+                jack_info ( "Sampling Frequency : %d, Sample Format : %s, buffering : %d, nperiod : %d",
+                            fFrequency, snd_pcm_format_name ( ( _snd_pcm_format ) fSampleFormat ), fBuffering, fPeriod );
+                jack_info ( "Software inputs : %2d, Software outputs : %2d", fSoftInputs, fSoftOutputs );
+                jack_info ( "Hardware inputs : %2d, Hardware outputs : %2d", fCardInputs, fCardOutputs );
+
+                //get audio card info and display
+                check_error ( snd_ctl_open ( &ctl_handle, fCardName, 0 ) );
+                snd_ctl_card_info_alloca ( &card_info );
+                check_error ( snd_ctl_card_info ( ctl_handle, card_info ) );
+                printCardInfo ( card_info );
+
+                //display input/output streams info
+                if ( fSoftInputs > 0 )
+                    printHWParams ( fInputParams );
+                if ( fSoftOutputs > 0 )
+                    printHWParams ( fOutputParams );
+
+                return 0;
+            }
+
+            void printCardInfo ( snd_ctl_card_info_t* ci )
+            {
+                jack_info ( "Card info (address : %p)", ci );
+                jack_info ( "\tID         = %s", snd_ctl_card_info_get_id ( ci ) );
+                jack_info ( "\tDriver     = %s", snd_ctl_card_info_get_driver ( ci ) );
+                jack_info ( "\tName       = %s", snd_ctl_card_info_get_name ( ci ) );
+                jack_info ( "\tLongName   = %s", snd_ctl_card_info_get_longname ( ci ) );
+                jack_info ( "\tMixerName  = %s", snd_ctl_card_info_get_mixername ( ci ) );
+                jack_info ( "\tComponents = %s", snd_ctl_card_info_get_components ( ci ) );
+                jack_info ( "--------------" );
+            }
+
+            void printHWParams ( snd_pcm_hw_params_t* params )
+            {
+                jack_info ( "HW Params info (address : %p)\n", params );
+#if 0
+                jack_info ( "\tChannels    = %d", snd_pcm_hw_params_get_channels ( params, NULL ) );
+                jack_info ( "\tFormat      = %s", snd_pcm_format_name ( ( _snd_pcm_format ) snd_pcm_hw_params_get_format ( params, NULL ) ) );
+                jack_info ( "\tAccess      = %s", snd_pcm_access_name ( ( _snd_pcm_access ) snd_pcm_hw_params_get_access ( params, NULL ) ) );
+                jack_info ( "\tRate        = %d", snd_pcm_hw_params_get_rate ( params, NULL, NULL ) );
+                jack_info ( "\tPeriods     = %d", snd_pcm_hw_params_get_periods ( params, NULL, NULL ) );
+                jack_info ( "\tPeriod size = %d", ( int ) snd_pcm_hw_params_get_period_size ( params, NULL, NULL ) );
+                jack_info ( "\tPeriod time = %d", snd_pcm_hw_params_get_period_time ( params, NULL, NULL ) );
+                jack_info ( "\tBuffer size = %d", ( int ) snd_pcm_hw_params_get_buffer_size ( params, NULL ) );
+                jack_info ( "\tBuffer time = %d", snd_pcm_hw_params_get_buffer_time ( params, NULL, NULL ) );
+#endif
+                jack_info ( "--------------" );
+            }
+    };
+
+    /*!
+    \brief Audio adapter using ALSA API.
+    */
+
+    class JackAlsaAdapter : public JackAudioAdapterInterface, public JackRunnableInterface
+    {
+
+        private:
+            JackThread fThread;
+            AudioInterface fAudioInterface;
+
+        public:
+            JackAlsaAdapter ( jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params );
+            ~JackAlsaAdapter()
+            {}
+
+            virtual int Open();
+            virtual int Close();
+
+            virtual int SetSampleRate ( jack_nframes_t sample_rate );
+            virtual int SetBufferSize ( jack_nframes_t buffer_size );
+
+            virtual bool Init();
+            virtual bool Execute();
+
+    };
+
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "JackCompilerDeps.h"
+#include "driver_interface.h"
+
+    EXPORT jack_driver_desc_t* jack_get_descriptor();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/linux/alsa/JackAlsaDriver.cpp b/linux/alsa/JackAlsaDriver.cpp
new file mode 100644
index 0000000..fff7aea
--- /dev/null
+++ b/linux/alsa/JackAlsaDriver.cpp
@@ -0,0 +1,2981 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#define __STDC_FORMAT_MACROS   // For inttypes.h to work in C++
+
+#include <iostream>
+#include <math.h>
+#include <stdio.h>
+#include <memory.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <regex.h>
+#include <string.h>
+
+#include "JackAlsaDriver.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackPort.h"
+#include "JackGraphManager.h"
+#include "JackLockedEngine.h"
+#include "JackPosixThread.h"
+#include "JackCompilerDeps.h"
+#include "hammerfall.h"
+#include "hdsp.h"
+#include "ice1712.h"
+#include "usx2y.h"
+#include "generic.h"
+#include "memops.h"
+#include "JackServerGlobals.h"
+
+
+//#define DEBUG_WAKEUP 1
+
+namespace Jack
+{
+
+#define jack_get_microseconds GetMicroSeconds
+
+/* Delay (in process calls) before jackd will report an xrun */
+#define XRUN_REPORT_DELAY 0
+
+void
+JackAlsaDriver::alsa_driver_release_channel_dependent_memory (alsa_driver_t *driver)
+{
+    bitset_destroy (&driver->channels_done);
+    bitset_destroy (&driver->channels_not_done);
+
+    if (driver->playback_addr) {
+        free (driver->playback_addr);
+        driver->playback_addr = 0;
+    }
+
+    if (driver->capture_addr) {
+        free (driver->capture_addr);
+        driver->capture_addr = 0;
+    }
+
+    if (driver->playback_interleave_skip) {
+        free (driver->playback_interleave_skip);
+        driver->playback_interleave_skip = NULL;
+    }
+
+    if (driver->capture_interleave_skip) {
+        free (driver->capture_interleave_skip);
+        driver->capture_interleave_skip = NULL;
+    }
+
+    if (driver->silent) {
+        free (driver->silent);
+        driver->silent = 0;
+    }
+
+    if (driver->dither_state) {
+        free (driver->dither_state);
+        driver->dither_state = 0;
+    }
+}
+
+int
+JackAlsaDriver::alsa_driver_check_capabilities (alsa_driver_t *driver)
+{
+    return 0;
+}
+
+static
+char *
+get_control_device_name (const char * device_name)
+{
+    char * ctl_name;
+    regex_t expression;
+
+    regcomp(&expression, "(plug)?hw:[0-9](,[0-9])?", REG_ICASE | REG_EXTENDED);
+
+    if (!regexec(&expression, device_name, 0, NULL, 0)) {
+        /* the user wants a hw or plughw device, the ctl name
+         * should be hw:x where x is the card number */
+
+        char tmp[5];
+        strncpy(tmp, strstr(device_name, "hw"), 4);
+        tmp[4] = '\0';
+        //jack_log("control device %s", tmp);
+        ctl_name = strdup(tmp);
+    } else {
+        ctl_name = strdup(device_name);
+    }
+
+    regfree(&expression);
+
+    if (ctl_name == NULL) {
+        jack_error("strdup(\"%s\") failed.", ctl_name);
+    }
+
+    return ctl_name;
+}
+
+int
+JackAlsaDriver::alsa_driver_check_card_type (alsa_driver_t *driver)
+{
+    int err;
+    snd_ctl_card_info_t *card_info;
+    char * ctl_name;
+
+    snd_ctl_card_info_alloca (&card_info);
+
+    ctl_name = get_control_device_name(driver->alsa_name_playback);
+
+    // XXX: I don't know the "right" way to do this. Which to use
+    // driver->alsa_name_playback or driver->alsa_name_capture.
+    if ((err = snd_ctl_open (&driver->ctl_handle, ctl_name, 0)) < 0) {
+        jack_error ("control open \"%s\" (%s)", ctl_name,
+                    snd_strerror(err));
+        return -1;
+    }
+
+    if ((err = snd_ctl_card_info(driver->ctl_handle, card_info)) < 0) {
+        jack_error ("control hardware info \"%s\" (%s)",
+                    driver->alsa_name_playback, snd_strerror (err));
+        snd_ctl_close (driver->ctl_handle);
+        return -1;
+    }
+
+    driver->alsa_driver = strdup(snd_ctl_card_info_get_driver (card_info));
+    jack_info("Using ALSA driver %s running on card %i - %s", driver->alsa_driver, snd_ctl_card_info_get_card(card_info), snd_ctl_card_info_get_longname(card_info));
+
+    free(ctl_name);
+
+    return alsa_driver_check_capabilities (driver);
+}
+
+int
+JackAlsaDriver::alsa_driver_hammerfall_hardware (alsa_driver_t *driver)
+{
+    driver->hw = jack_alsa_hammerfall_hw_new (driver);
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_hdsp_hardware (alsa_driver_t *driver)
+{
+    driver->hw = jack_alsa_hdsp_hw_new (driver);
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_ice1712_hardware (alsa_driver_t *driver)
+{
+    driver->hw = jack_alsa_ice1712_hw_new (driver);
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_usx2y_hardware (alsa_driver_t *driver)
+{
+    // TODO : will need so deeped redesign
+    // driver->hw = jack_alsa_usx2y_hw_new (driver);
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_generic_hardware (alsa_driver_t *driver)
+{
+    driver->hw = jack_alsa_generic_hw_new (driver);
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_hw_specific (alsa_driver_t *driver, int hw_monitoring,
+        int hw_metering)
+{
+    int err;
+
+    if (!strcmp(driver->alsa_driver, "RME9652")) {
+        if ((err = alsa_driver_hammerfall_hardware (driver)) != 0) {
+            return err;
+        }
+    } else if (!strcmp(driver->alsa_driver, "H-DSP")) {
+        if ((err = alsa_driver_hdsp_hardware (driver)) != 0) {
+            return err;
+        }
+    } else if (!strcmp(driver->alsa_driver, "ICE1712")) {
+        if ((err = alsa_driver_ice1712_hardware (driver)) != 0) {
+            return err;
+        }
+    } /*else if (!strcmp(driver->alsa_driver, "USB US-X2Y")) {
+        if ((err = alsa_driver_usx2y_hardware (driver)) != 0) {
+            return err;
+        }
+    } */else {
+        if ((err = alsa_driver_generic_hardware (driver)) != 0) {
+            return err;
+        }
+    }
+
+    if (driver->hw->capabilities & Cap_HardwareMonitoring) {
+        driver->has_hw_monitoring = TRUE;
+        /* XXX need to ensure that this is really FALSE or
+         * TRUE or whatever*/
+        driver->hw_monitoring = hw_monitoring;
+    } else {
+        driver->has_hw_monitoring = FALSE;
+        driver->hw_monitoring = FALSE;
+    }
+
+    if (driver->hw->capabilities & Cap_ClockLockReporting) {
+        driver->has_clock_sync_reporting = TRUE;
+    } else {
+        driver->has_clock_sync_reporting = FALSE;
+    }
+
+    if (driver->hw->capabilities & Cap_HardwareMetering) {
+        driver->has_hw_metering = TRUE;
+        driver->hw_metering = hw_metering;
+    } else {
+        driver->has_hw_metering = FALSE;
+        driver->hw_metering = FALSE;
+    }
+
+    return 0;
+}
+
+void
+JackAlsaDriver::alsa_driver_setup_io_function_pointers (alsa_driver_t *driver)
+{
+	if (driver->playback_handle) {
+		if (SND_PCM_FORMAT_FLOAT_LE == driver->playback_sample_format) {
+			if (driver->playback_interleaved) {
+				driver->channel_copy = memcpy_interleave_d32_s32;
+			} else {
+				driver->channel_copy = memcpy_fake;
+			}
+			driver->read_via_copy = sample_move_floatLE_sSs;
+			driver->write_via_copy = sample_move_dS_floatLE;
+		} else {
+
+			switch (driver->playback_sample_bytes) {
+			case 2:
+				if (driver->playback_interleaved) {
+					driver->channel_copy = memcpy_interleave_d16_s16;
+				} else {
+					driver->channel_copy = memcpy_fake;
+				}
+			
+				switch (driver->dither) {
+				case Rectangular:
+					jack_info("Rectangular dithering at 16 bits");
+					driver->write_via_copy = driver->quirk_bswap?
+        	                                sample_move_dither_rect_d16_sSs:
+        	                                sample_move_dither_rect_d16_sS;
+					break;
+				
+				case Triangular:
+					jack_info("Triangular dithering at 16 bits");
+					driver->write_via_copy = driver->quirk_bswap?
+        	                                sample_move_dither_tri_d16_sSs:
+        	                                sample_move_dither_tri_d16_sS;
+					break;
+				
+				case Shaped:
+					jack_info("Noise-shaped dithering at 16 bits");
+					driver->write_via_copy = driver->quirk_bswap?
+        	                                sample_move_dither_shaped_d16_sSs:
+        	                                sample_move_dither_shaped_d16_sS;
+					break;
+				
+				default:
+					driver->write_via_copy = driver->quirk_bswap?
+        	                                sample_move_d16_sSs : 
+        					sample_move_d16_sS;
+					break;
+				}
+				break;
+			
+			case 3: /* NO DITHER */
+				if (driver->playback_interleaved) {
+					driver->channel_copy = memcpy_interleave_d24_s24;
+				} else {
+					driver->channel_copy = memcpy_fake;
+				}
+			
+				driver->write_via_copy = driver->quirk_bswap?
+					sample_move_d24_sSs: 
+					sample_move_d24_sS;
+
+				break;
+									
+		 	case 4: /* NO DITHER */
+				if (driver->playback_interleaved) {
+					driver->channel_copy = memcpy_interleave_d32_s32;
+				} else {
+					driver->channel_copy = memcpy_fake;
+				}
+
+				driver->write_via_copy = driver->quirk_bswap?
+					sample_move_d32u24_sSs: 
+					sample_move_d32u24_sS;
+			    break;
+
+			default:
+				jack_error ("impossible sample width (%d) discovered!",
+					    driver->playback_sample_bytes);
+				exit (1);
+			}
+		}
+	}
+	
+	if (driver->capture_handle) {
+		switch (driver->capture_sample_bytes) {
+		case 2:
+			driver->read_via_copy = driver->quirk_bswap?
+				sample_move_dS_s16s: 
+			        sample_move_dS_s16;
+			break;
+		case 3:
+			driver->read_via_copy = driver->quirk_bswap?
+				sample_move_dS_s24s: 
+			        sample_move_dS_s24;
+			break;
+		case 4:
+			driver->read_via_copy = driver->quirk_bswap?
+			 	sample_move_dS_s32u24s: 
+			        sample_move_dS_s32u24;
+			break;
+		}
+	}
+}
+
+int
+JackAlsaDriver::alsa_driver_configure_stream (alsa_driver_t *driver, char *device_name,
+        const char *stream_name,
+        snd_pcm_t *handle,
+        snd_pcm_hw_params_t *hw_params,
+        snd_pcm_sw_params_t *sw_params,
+        unsigned int *nperiodsp,
+        unsigned long *nchns,
+        unsigned long sample_width)
+{
+	int err, format;
+	unsigned int frame_rate;
+	snd_pcm_uframes_t stop_th;
+	static struct {
+		char Name[32];
+		snd_pcm_format_t format;
+		int swapped;
+	} formats[] = {
+ 	    {"32bit float little-endian", SND_PCM_FORMAT_FLOAT_LE},
+		{"32bit integer little-endian", SND_PCM_FORMAT_S32_LE, IS_LE},
+		{"32bit integer big-endian", SND_PCM_FORMAT_S32_BE, IS_BE},
+		{"24bit little-endian", SND_PCM_FORMAT_S24_3LE, IS_LE},
+		{"24bit big-endian", SND_PCM_FORMAT_S24_3BE, IS_BE},
+		{"16bit little-endian", SND_PCM_FORMAT_S16_LE, IS_LE},
+		{"16bit big-endian", SND_PCM_FORMAT_S16_BE, IS_BE},
+	};
+#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
+#define FIRST_16BIT_FORMAT 5
+
+	if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0)  {
+		jack_error ("ALSA: no playback configurations available (%s)",
+			    snd_strerror (err));
+		return -1;
+	}
+
+	if ((err = snd_pcm_hw_params_set_periods_integer (handle, hw_params))
+	    < 0) {
+		jack_error ("ALSA: cannot restrict period size to integral"
+			    " value.");
+		return -1;
+	}
+
+	if ((err = snd_pcm_hw_params_set_access (handle, hw_params, SND_PCM_ACCESS_MMAP_NONINTERLEAVED)) < 0) {
+		if ((err = snd_pcm_hw_params_set_access (handle, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0) {
+			if ((err = snd_pcm_hw_params_set_access (
+				     handle, hw_params,
+				     SND_PCM_ACCESS_MMAP_COMPLEX)) < 0) {
+				jack_error ("ALSA: mmap-based access is not possible"
+					    " for the %s "
+					    "stream of this audio interface",
+					    stream_name);
+				return -1;
+			}
+		}
+	}
+	
+	format = (sample_width == 4) ? 0 : NUMFORMATS - 1;
+
+	while (1) {
+		if ((err = snd_pcm_hw_params_set_format (
+			     handle, hw_params, formats[format].format)) < 0) {
+
+			if ((sample_width == 4
+			     ? format++ >= NUMFORMATS - 1
+			     : format-- <= 0)) {
+				jack_error ("Sorry. The audio interface \"%s\""
+					    " doesn't support any of the"
+					    " hardware sample formats that"
+					    " JACK's alsa-driver can use.",
+					    device_name);
+				return -1;
+			}
+		} else {
+			if (formats[format].swapped) {
+				driver->quirk_bswap = 1;
+			} else {
+				driver->quirk_bswap = 0;
+			}
+			jack_info ("ALSA: final selected sample format for %s: %s", stream_name, formats[format].Name);
+			break;
+		}
+	} 
+
+	frame_rate = driver->frame_rate ;
+	err = snd_pcm_hw_params_set_rate_near (handle, hw_params,
+					       &frame_rate, NULL) ;
+	driver->frame_rate = frame_rate ;
+	if (err < 0) {
+		jack_error ("ALSA: cannot set sample/frame rate to %"
+			    PRIu32 " for %s", driver->frame_rate,
+			    stream_name);
+		return -1;
+	}
+	if (!*nchns) {
+		/*if not user-specified, try to find the maximum
+		 * number of channels */
+		unsigned int channels_max ;
+		err = snd_pcm_hw_params_get_channels_max (hw_params,
+							  &channels_max);
+		*nchns = channels_max ;
+
+		if (*nchns > 1024) { 
+
+			/* the hapless user is an unwitting victim of
+			   the "default" ALSA PCM device, which can
+			   support up to 16 million channels. since
+			   they can't be bothered to set up a proper
+			   default device, limit the number of
+			   channels for them to a sane default.
+			*/
+
+			jack_error (
+"You appear to be using the ALSA software \"plug\" layer, probably\n"
+"a result of using the \"default\" ALSA device. This is less\n"
+"efficient than it could be. Consider using a hardware device\n"
+"instead rather than using the plug layer. Usually the name of the\n"
+"hardware device that corresponds to the first sound card is hw:0\n"
+				);
+			*nchns = 2;  
+		}
+	}				
+
+	if ((err = snd_pcm_hw_params_set_channels (handle, hw_params,
+						   *nchns)) < 0) {
+		jack_error ("ALSA: cannot set channel count to %u for %s",
+			    *nchns, stream_name);
+		return -1;
+	}
+	
+	if ((err = snd_pcm_hw_params_set_period_size (handle, hw_params,
+						      driver->frames_per_cycle,
+						      0))
+	    < 0) {
+		jack_error ("ALSA: cannot set period size to %" PRIu32
+			    " frames for %s", driver->frames_per_cycle,
+			    stream_name);
+		return -1;
+	}
+
+	*nperiodsp = driver->user_nperiods;
+	snd_pcm_hw_params_set_periods_min (handle, hw_params, nperiodsp, NULL);
+	if (*nperiodsp < driver->user_nperiods)
+		*nperiodsp = driver->user_nperiods;
+	if (snd_pcm_hw_params_set_periods_near (handle, hw_params,
+						nperiodsp, NULL) < 0) {
+		jack_error ("ALSA: cannot set number of periods to %u for %s",
+			    *nperiodsp, stream_name);
+		return -1;
+	}
+
+	if (*nperiodsp < driver->user_nperiods) {
+		jack_error ("ALSA: got smaller periods %u than %u for %s",
+			    *nperiodsp, (unsigned int) driver->user_nperiods,
+			    stream_name);
+		return -1;
+	}
+	jack_info ("ALSA: use %d periods for %s", *nperiodsp, stream_name);
+#if 0	
+	if (!jack_power_of_two(driver->frames_per_cycle)) {
+		jack_error("JACK: frames must be a power of two "
+			   "(64, 512, 1024, ...)\n");
+		return -1;
+	}
+#endif
+
+	if ((err = snd_pcm_hw_params_set_buffer_size (handle, hw_params,
+						      *nperiodsp *
+						      driver->frames_per_cycle))
+	    < 0) {
+		jack_error ("ALSA: cannot set buffer length to %" PRIu32
+			    " for %s",
+			    *nperiodsp * driver->frames_per_cycle,
+			    stream_name);
+		return -1;
+	}
+
+	if ((err = snd_pcm_hw_params (handle, hw_params)) < 0) {
+		jack_error ("ALSA: cannot set hardware parameters for %s",
+			    stream_name);
+		return -1;
+	}
+
+	snd_pcm_sw_params_current (handle, sw_params);
+
+	if ((err = snd_pcm_sw_params_set_start_threshold (handle, sw_params,
+							  0U)) < 0) {
+		jack_error ("ALSA: cannot set start mode for %s", stream_name);
+		return -1;
+	}
+
+	stop_th = *nperiodsp * driver->frames_per_cycle;
+	if (driver->soft_mode) {
+		stop_th = (snd_pcm_uframes_t)-1;
+	}
+	
+	if ((err = snd_pcm_sw_params_set_stop_threshold (
+		     handle, sw_params, stop_th)) < 0) {
+		jack_error ("ALSA: cannot set stop mode for %s",
+			    stream_name);
+		return -1;
+	}
+
+	if ((err = snd_pcm_sw_params_set_silence_threshold (
+		     handle, sw_params, 0)) < 0) {
+		jack_error ("ALSA: cannot set silence threshold for %s",
+			    stream_name);
+		return -1;
+	}
+
+#if 0
+	jack_info ("set silence size to %lu * %lu = %lu",
+		 driver->frames_per_cycle, *nperiodsp,
+		 driver->frames_per_cycle * *nperiodsp);
+
+	if ((err = snd_pcm_sw_params_set_silence_size (
+		     handle, sw_params,
+		     driver->frames_per_cycle * *nperiodsp)) < 0) {
+		jack_error ("ALSA: cannot set silence size for %s",
+			    stream_name);
+		return -1;
+	}
+#endif
+
+	if (handle == driver->playback_handle)
+		err = snd_pcm_sw_params_set_avail_min (
+			handle, sw_params,
+			driver->frames_per_cycle
+			* (*nperiodsp - driver->user_nperiods + 1));
+	else
+		err = snd_pcm_sw_params_set_avail_min (
+			handle, sw_params, driver->frames_per_cycle);
+			
+	if (err < 0) {
+		jack_error ("ALSA: cannot set avail min for %s", stream_name);
+		return -1;
+	}
+
+	if ((err = snd_pcm_sw_params (handle, sw_params)) < 0) {
+		jack_error ("ALSA: cannot set software parameters for %s\n",
+			    stream_name);
+		return -1;
+	}
+
+	return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_set_parameters (alsa_driver_t *driver,
+        jack_nframes_t frames_per_cycle,
+        jack_nframes_t user_nperiods,
+        jack_nframes_t rate)
+{
+    int dir;
+    snd_pcm_uframes_t p_period_size = 0;
+    snd_pcm_uframes_t c_period_size = 0;
+    channel_t chn;
+    unsigned int pr = 0;
+    unsigned int cr = 0;
+    int err;
+
+    driver->frame_rate = rate;
+    driver->frames_per_cycle = frames_per_cycle;
+    driver->user_nperiods = user_nperiods;
+
+    jack_info ("configuring for %" PRIu32 "Hz, period = %"
+		 PRIu32 " frames (%.1f ms), buffer = %" PRIu32 " periods",
+		 rate, frames_per_cycle, (((float)frames_per_cycle / (float) rate) * 1000.0f), user_nperiods);
+
+    if (driver->capture_handle) {
+        if (alsa_driver_configure_stream (
+                    driver,
+                    driver->alsa_name_capture,
+                    "capture",
+                    driver->capture_handle,
+                    driver->capture_hw_params,
+                    driver->capture_sw_params,
+                    &driver->capture_nperiods,
+                    (long unsigned int*)&driver->capture_nchannels,
+                    driver->capture_sample_bytes)) {
+            jack_error ("ALSA: cannot configure capture channel");
+            return -1;
+        }
+    }
+
+    if (driver->playback_handle) {
+        if (alsa_driver_configure_stream (
+                    driver,
+                    driver->alsa_name_playback,
+                    "playback",
+                    driver->playback_handle,
+                    driver->playback_hw_params,
+                    driver->playback_sw_params,
+                    &driver->playback_nperiods,
+                    (long unsigned int*)&driver->playback_nchannels,
+                    driver->playback_sample_bytes)) {
+            jack_error ("ALSA: cannot configure playback channel");
+            return -1;
+        }
+    }
+
+    /* check the rate, since thats rather important */
+
+    if (driver->playback_handle) {
+        snd_pcm_hw_params_get_rate (driver->playback_hw_params,
+                                    &pr, &dir);
+    }
+
+    if (driver->capture_handle) {
+        snd_pcm_hw_params_get_rate (driver->capture_hw_params,
+                                    &cr, &dir);
+    }
+
+    if (driver->capture_handle && driver->playback_handle) {
+        if (cr != pr) {
+            jack_error ("playback and capture sample rates do "
+                        "not match (%d vs. %d)", pr, cr);
+        }
+
+        /* only change if *both* capture and playback rates
+         * don't match requested certain hardware actually
+         * still works properly in full-duplex with slightly
+         * different rate values between adc and dac
+         */
+        if (cr != driver->frame_rate && pr != driver->frame_rate) {
+            jack_error ("sample rate in use (%d Hz) does not "
+                        "match requested rate (%d Hz)",
+                        cr, driver->frame_rate);
+            driver->frame_rate = cr;
+        }
+
+    } else if (driver->capture_handle && cr != driver->frame_rate) {
+        jack_error ("capture sample rate in use (%d Hz) does not "
+                    "match requested rate (%d Hz)",
+                    cr, driver->frame_rate);
+        driver->frame_rate = cr;
+    } else if (driver->playback_handle && pr != driver->frame_rate) {
+        jack_error ("playback sample rate in use (%d Hz) does not "
+                    "match requested rate (%d Hz)",
+                    pr, driver->frame_rate);
+        driver->frame_rate = pr;
+    }
+
+
+    /* check the fragment size, since thats non-negotiable */
+
+    if (driver->playback_handle) {
+        snd_pcm_access_t access;
+
+        err = snd_pcm_hw_params_get_period_size (
+                  driver->playback_hw_params, &p_period_size, &dir);
+        err = snd_pcm_hw_params_get_format (
+                  driver->playback_hw_params,
+                  &(driver->playback_sample_format));
+        err = snd_pcm_hw_params_get_access (driver->playback_hw_params,
+                                            &access);
+        driver->playback_interleaved =
+            (access == SND_PCM_ACCESS_MMAP_INTERLEAVED)
+            || (access == SND_PCM_ACCESS_MMAP_COMPLEX);
+
+        if (p_period_size != driver->frames_per_cycle) {
+            jack_error ("alsa_pcm: requested an interrupt every %"
+            	    PRIu32
+            	    " frames but got %u frames for playback",
+            	    driver->frames_per_cycle, p_period_size);
+            return -1;
+        }
+    }
+
+    if (driver->capture_handle) {
+        snd_pcm_access_t access;
+
+        err = snd_pcm_hw_params_get_period_size (
+                  driver->capture_hw_params, &c_period_size, &dir);
+        err = snd_pcm_hw_params_get_format (
+                  driver->capture_hw_params,
+                  &(driver->capture_sample_format));
+        err = snd_pcm_hw_params_get_access (driver->capture_hw_params,
+                                            &access);
+        driver->capture_interleaved =
+            (access == SND_PCM_ACCESS_MMAP_INTERLEAVED)
+            || (access == SND_PCM_ACCESS_MMAP_COMPLEX);
+
+
+        if (c_period_size != driver->frames_per_cycle) {
+            jack_error ("alsa_pcm: requested an interrupt every %"
+            	    PRIu32
+            	    " frames but got %uc frames for capture",
+            	    driver->frames_per_cycle, p_period_size);
+            return -1;
+        }
+    }
+
+    driver->playback_sample_bytes =
+        snd_pcm_format_physical_width (driver->playback_sample_format)
+        / 8;
+    driver->capture_sample_bytes =
+        snd_pcm_format_physical_width (driver->capture_sample_format)
+        / 8;
+
+    if (driver->playback_handle) {
+        switch (driver->playback_sample_format) {
+           case SND_PCM_FORMAT_FLOAT_LE:
+            case SND_PCM_FORMAT_S32_LE:
+            case SND_PCM_FORMAT_S24_3LE:
+            case SND_PCM_FORMAT_S24_3BE:
+            case SND_PCM_FORMAT_S16_LE:
+            case SND_PCM_FORMAT_S32_BE:
+            case SND_PCM_FORMAT_S16_BE:
+                break;
+
+            default:
+                jack_error ("programming error: unhandled format "
+                            "type for playback");
+                exit (1);
+        }
+    }
+
+    if (driver->capture_handle) {
+        switch (driver->capture_sample_format) {
+           case SND_PCM_FORMAT_FLOAT_LE:
+            case SND_PCM_FORMAT_S32_LE:
+            case SND_PCM_FORMAT_S24_3LE:
+            case SND_PCM_FORMAT_S24_3BE:
+            case SND_PCM_FORMAT_S16_LE:
+            case SND_PCM_FORMAT_S32_BE:
+            case SND_PCM_FORMAT_S16_BE:
+                break;
+
+            default:
+                jack_error ("programming error: unhandled format "
+                            "type for capture");
+                exit (1);
+        }
+    }
+
+    if (driver->playback_interleaved) {
+        const snd_pcm_channel_area_t *my_areas;
+        snd_pcm_uframes_t offset, frames;
+        if (snd_pcm_mmap_begin(driver->playback_handle,
+                               &my_areas, &offset, &frames) < 0) {
+            jack_error ("ALSA: %s: mmap areas info error",
+                        driver->alsa_name_playback);
+            return -1;
+        }
+        driver->interleave_unit =
+            snd_pcm_format_physical_width (
+                driver->playback_sample_format) / 8;
+    } else {
+        driver->interleave_unit = 0;  /* NOT USED */
+    }
+
+    if (driver->capture_interleaved) {
+        const snd_pcm_channel_area_t *my_areas;
+        snd_pcm_uframes_t offset, frames;
+        if (snd_pcm_mmap_begin(driver->capture_handle,
+                               &my_areas, &offset, &frames) < 0) {
+            jack_error ("ALSA: %s: mmap areas info error",
+                        driver->alsa_name_capture);
+            return -1;
+        }
+    }
+
+    if (driver->playback_nchannels > driver->capture_nchannels) {
+        driver->max_nchannels = driver->playback_nchannels;
+        driver->user_nchannels = driver->capture_nchannels;
+    } else {
+        driver->max_nchannels = driver->capture_nchannels;
+        driver->user_nchannels = driver->playback_nchannels;
+    }
+
+    alsa_driver_setup_io_function_pointers (driver);
+
+    /* Allocate and initialize structures that rely on the
+       channels counts.
+
+       Set up the bit pattern that is used to record which
+       channels require action on every cycle. any bits that are
+       not set after the engine's process() call indicate channels
+       that potentially need to be silenced.
+    */
+
+    bitset_create (&driver->channels_done, driver->max_nchannels);
+    bitset_create (&driver->channels_not_done, driver->max_nchannels);
+
+    if (driver->playback_handle) {
+        driver->playback_addr = (char **)
+                                malloc (sizeof (char *) * driver->playback_nchannels);
+        memset (driver->playback_addr, 0,
+                sizeof (char *) * driver->playback_nchannels);
+        driver->playback_interleave_skip = (unsigned long *)
+                                           malloc (sizeof (unsigned long *) * driver->playback_nchannels);
+        memset (driver->playback_interleave_skip, 0,
+                sizeof (unsigned long *) * driver->playback_nchannels);
+        driver->silent = (unsigned long *)
+                         malloc (sizeof (unsigned long)
+                                 * driver->playback_nchannels);
+
+        for (chn = 0; chn < driver->playback_nchannels; chn++) {
+            driver->silent[chn] = 0;
+        }
+
+        for (chn = 0; chn < driver->playback_nchannels; chn++) {
+            bitset_add (driver->channels_done, chn);
+        }
+
+        driver->dither_state = (dither_state_t *)
+                               calloc ( driver->playback_nchannels,
+                                        sizeof (dither_state_t));
+    }
+
+    if (driver->capture_handle) {
+        driver->capture_addr = (char **)
+                               malloc (sizeof (char *) * driver->capture_nchannels);
+        memset (driver->capture_addr, 0,
+                sizeof (char *) * driver->capture_nchannels);
+        driver->capture_interleave_skip = (unsigned long *)
+                                          malloc (sizeof (unsigned long *) * driver->capture_nchannels);
+        memset (driver->capture_interleave_skip, 0,
+                sizeof (unsigned long *) * driver->capture_nchannels);
+    }
+
+    driver->clock_sync_data = (ClockSyncStatus *)
+                              malloc (sizeof (ClockSyncStatus) * driver->max_nchannels);
+
+    driver->period_usecs =
+        (jack_time_t) floor ((((float) driver->frames_per_cycle) /
+                              driver->frame_rate) * 1000000.0f);
+    driver->poll_timeout = (int) floor (1.5f * driver->period_usecs);
+
+    // steph
+    /*
+    if (driver->engine) {
+    	driver->engine->set_buffer_size (driver->engine,
+    					 driver->frames_per_cycle);
+    }
+    */
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_reset_parameters (alsa_driver_t *driver,
+        jack_nframes_t frames_per_cycle,
+        jack_nframes_t user_nperiods,
+        jack_nframes_t rate)
+{
+    /* XXX unregister old ports ? */
+    alsa_driver_release_channel_dependent_memory (driver);
+    return alsa_driver_set_parameters (driver,
+                                       frames_per_cycle,
+                                       user_nperiods, rate);
+}
+
+int
+JackAlsaDriver::alsa_driver_get_channel_addresses (alsa_driver_t *driver,
+        snd_pcm_uframes_t *capture_avail,
+        snd_pcm_uframes_t *playback_avail,
+        snd_pcm_uframes_t *capture_offset,
+        snd_pcm_uframes_t *playback_offset)
+{
+    unsigned long err;
+    channel_t chn;
+
+    if (capture_avail) {
+        if ((err = snd_pcm_mmap_begin (
+                       driver->capture_handle, &driver->capture_areas,
+                       (snd_pcm_uframes_t *) capture_offset,
+                       (snd_pcm_uframes_t *) capture_avail)) < 0) {
+            jack_error ("ALSA: %s: mmap areas info error",
+                        driver->alsa_name_capture);
+            return -1;
+        }
+
+        for (chn = 0; chn < driver->capture_nchannels; chn++) {
+            const snd_pcm_channel_area_t *a =
+                &driver->capture_areas[chn];
+            driver->capture_addr[chn] = (char *) a->addr
+                                        + ((a->first + a->step * *capture_offset) / 8);
+            driver->capture_interleave_skip[chn] = (unsigned long ) (a->step / 8);
+        }
+    }
+
+    if (playback_avail) {
+        if ((err = snd_pcm_mmap_begin (
+                       driver->playback_handle, &driver->playback_areas,
+                       (snd_pcm_uframes_t *) playback_offset,
+                       (snd_pcm_uframes_t *) playback_avail)) < 0) {
+            jack_error ("ALSA: %s: mmap areas info error ",
+                        driver->alsa_name_playback);
+            return -1;
+        }
+
+        for (chn = 0; chn < driver->playback_nchannels; chn++) {
+            const snd_pcm_channel_area_t *a =
+                &driver->playback_areas[chn];
+            driver->playback_addr[chn] = (char *) a->addr
+                                         + ((a->first + a->step * *playback_offset) / 8);
+            driver->playback_interleave_skip[chn] = (unsigned long ) (a->step / 8);
+        }
+    }
+
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_start (alsa_driver_t *driver)
+{
+    int err;
+    snd_pcm_uframes_t poffset, pavail;
+    channel_t chn;
+
+    driver->poll_last = 0;
+    driver->poll_next = 0;
+
+    if (driver->playback_handle) {
+        if ((err = snd_pcm_prepare (driver->playback_handle)) < 0) {
+            jack_error ("ALSA: prepare error for playback on "
+                        "\"%s\" (%s)", driver->alsa_name_playback,
+                        snd_strerror(err));
+            return -1;
+        }
+    }
+
+    if ((driver->capture_handle && driver->capture_and_playback_not_synced)
+            || !driver->playback_handle) {
+        if ((err = snd_pcm_prepare (driver->capture_handle)) < 0) {
+            jack_error ("ALSA: prepare error for capture on \"%s\""
+                        " (%s)", driver->alsa_name_capture,
+                        snd_strerror(err));
+            return -1;
+        }
+    }
+
+    if (driver->hw_monitoring) {
+        if (driver->input_monitor_mask || driver->all_monitor_in) {
+            if (driver->all_monitor_in) {
+                driver->hw->set_input_monitor_mask (driver->hw, ~0U);
+            } else {
+                driver->hw->set_input_monitor_mask (
+                    driver->hw, driver->input_monitor_mask);
+            }
+        } else {
+            driver->hw->set_input_monitor_mask (driver->hw,
+                                                driver->input_monitor_mask);
+        }
+    }
+
+    if (driver->playback_handle) {
+        driver->playback_nfds =
+            snd_pcm_poll_descriptors_count (driver->playback_handle);
+    } else {
+        driver->playback_nfds = 0;
+    }
+
+    if (driver->capture_handle) {
+        driver->capture_nfds =
+            snd_pcm_poll_descriptors_count (driver->capture_handle);
+    } else {
+        driver->capture_nfds = 0;
+    }
+
+    if (driver->pfd) {
+        free (driver->pfd);
+    }
+
+    driver->pfd = (struct pollfd *)
+                  malloc (sizeof (struct pollfd) *
+                          (driver->playback_nfds + driver->capture_nfds + 2));
+
+    if (driver->midi && !driver->xrun_recovery)
+        (driver->midi->start)(driver->midi);
+
+    if (driver->playback_handle) {
+        /* fill playback buffer with zeroes, and mark
+           all fragments as having data.
+        */
+
+        pavail = snd_pcm_avail_update (driver->playback_handle);
+
+        if (pavail !=
+                driver->frames_per_cycle * driver->playback_nperiods) {
+            jack_error ("ALSA: full buffer not available at start");
+            return -1;
+        }
+
+        if (alsa_driver_get_channel_addresses (driver,
+                                               0, &pavail, 0, &poffset)) {
+            return -1;
+        }
+
+        /* XXX this is cheating. ALSA offers no guarantee that
+           we can access the entire buffer at any one time. It
+           works on most hardware tested so far, however, buts
+           its a liability in the long run. I think that
+           alsa-lib may have a better function for doing this
+           here, where the goal is to silence the entire
+           buffer.
+        */
+
+        for (chn = 0; chn < driver->playback_nchannels; chn++) {
+            alsa_driver_silence_on_channel (
+                driver, chn,
+                driver->user_nperiods
+                * driver->frames_per_cycle);
+        }
+
+        snd_pcm_mmap_commit (driver->playback_handle, poffset,
+                             driver->user_nperiods
+                             * driver->frames_per_cycle);
+
+        if ((err = snd_pcm_start (driver->playback_handle)) < 0) {
+            jack_error ("ALSA: could not start playback (%s)",
+                        snd_strerror (err));
+            return -1;
+        }
+    }
+
+    if ((driver->capture_handle && driver->capture_and_playback_not_synced)
+            || !driver->playback_handle) {
+        if ((err = snd_pcm_start (driver->capture_handle)) < 0) {
+            jack_error ("ALSA: could not start capture (%s)",
+                        snd_strerror (err));
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_stop (alsa_driver_t *driver)
+{
+    int err;
+    //JSList* node;
+    //int chn;
+
+    /* silence all capture port buffers, because we might
+       be entering offline mode.
+    */
+
+    // steph
+    /*
+    for (chn = 0, node = driver->capture_ports; node;
+         node = jack_slist_next (node), chn++) {
+
+    	jack_port_t* port;
+    	char* buf;
+    	jack_nframes_t nframes = driver->engine->control->buffer_size;
+
+    	port = (jack_port_t *) node->data;
+    	buf = jack_port_get_buffer (port, nframes);
+    	memset (buf, 0, sizeof (jack_default_audio_sample_t) * nframes);
+    }
+    */
+
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        jack_default_audio_sample_t* buf =
+            (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[i], fEngineControl->fBufferSize);
+        memset (buf, 0, sizeof (jack_default_audio_sample_t) * fEngineControl->fBufferSize);
+    }
+
+    if (driver->playback_handle) {
+        if ((err = snd_pcm_drop (driver->playback_handle)) < 0) {
+            jack_error ("ALSA: channel flush for playback "
+                        "failed (%s)", snd_strerror (err));
+            return -1;
+        }
+    }
+
+    if (!driver->playback_handle
+            || driver->capture_and_playback_not_synced) {
+        if (driver->capture_handle) {
+            if ((err = snd_pcm_drop (driver->capture_handle)) < 0) {
+                jack_error ("ALSA: channel flush for "
+                            "capture failed (%s)",
+                            snd_strerror (err));
+                return -1;
+            }
+        }
+    }
+
+    if (driver->hw_monitoring) {
+        driver->hw->set_input_monitor_mask (driver->hw, 0);
+    }
+
+    if (driver->midi && !driver->xrun_recovery)
+        (driver->midi->stop)(driver->midi);
+
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_restart (alsa_driver_t *driver)
+{
+    int res;
+    
+    driver->xrun_recovery = 1;
+    if ((res = Stop()) == 0)
+        res = Start();
+    driver->xrun_recovery = 0;
+
+    if (res && driver->midi)
+	(driver->midi->stop)(driver->midi);
+
+    return res;
+}
+
+int
+JackAlsaDriver::alsa_driver_xrun_recovery (alsa_driver_t *driver, float *delayed_usecs)
+{
+    snd_pcm_status_t *status;
+    int res;
+
+    jack_error("alsa_driver_xrun_recovery");
+
+    snd_pcm_status_alloca(&status);
+
+    if (driver->capture_handle) {
+        if ((res = snd_pcm_status(driver->capture_handle, status))
+                < 0) {
+            jack_error("status error: %s", snd_strerror(res));
+        }
+    } else {
+        if ((res = snd_pcm_status(driver->playback_handle, status))
+                < 0) {
+            jack_error("status error: %s", snd_strerror(res));
+        }
+    }
+
+    if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN
+            && driver->process_count > XRUN_REPORT_DELAY) {
+        struct timeval now, diff, tstamp;
+        driver->xrun_count++;
+        snd_pcm_status_get_tstamp(status,&now); 
+        snd_pcm_status_get_trigger_tstamp(status, &tstamp);
+        timersub(&now, &tstamp, &diff);
+        *delayed_usecs = diff.tv_sec * 1000000.0 + diff.tv_usec;
+        jack_error("\n\n**** alsa_pcm: xrun of at least %.3f msecs\n\n", *delayed_usecs / 1000.0);
+    }
+
+    if (alsa_driver_restart (driver)) {
+        return -1;
+    }
+    return 0;
+}
+
+void
+JackAlsaDriver::alsa_driver_silence_untouched_channels (alsa_driver_t *driver,
+        jack_nframes_t nframes)
+{
+    channel_t chn;
+    jack_nframes_t buffer_frames =
+        driver->frames_per_cycle * driver->playback_nperiods;
+
+    for (chn = 0; chn < driver->playback_nchannels; chn++) {
+        if (bitset_contains (driver->channels_not_done, chn)) {
+            if (driver->silent[chn] < buffer_frames) {
+                alsa_driver_silence_on_channel_no_mark (
+                    driver, chn, nframes);
+                driver->silent[chn] += nframes;
+            }
+        }
+    }
+}
+
+static int under_gdb = FALSE;
+
+jack_nframes_t
+JackAlsaDriver::alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float
+                                  *delayed_usecs)
+{
+	snd_pcm_sframes_t avail = 0;
+	snd_pcm_sframes_t capture_avail = 0;
+	snd_pcm_sframes_t playback_avail = 0;
+	int xrun_detected = FALSE;
+	int need_capture;
+	int need_playback;
+	unsigned int i;
+	jack_time_t poll_enter;
+	jack_time_t poll_ret = 0;
+
+	*status = -1;
+	*delayed_usecs = 0;
+
+	need_capture = driver->capture_handle ? 1 : 0;
+
+	if (extra_fd >= 0) {
+		need_playback = 0;
+	} else {
+		need_playback = driver->playback_handle ? 1 : 0;
+	}
+
+  again:
+	
+	while (need_playback || need_capture) {
+
+		int poll_result;
+		unsigned int ci = 0;
+		unsigned int nfds;
+		unsigned short revents;
+
+		nfds = 0;
+
+		if (need_playback) {
+			snd_pcm_poll_descriptors (driver->playback_handle,
+						  &driver->pfd[0],
+						  driver->playback_nfds);
+			nfds += driver->playback_nfds;
+		}
+		
+		if (need_capture) {
+			snd_pcm_poll_descriptors (driver->capture_handle,
+						  &driver->pfd[nfds],
+						  driver->capture_nfds);
+			ci = nfds;
+			nfds += driver->capture_nfds;
+		}
+
+		/* ALSA doesn't set POLLERR in some versions of 0.9.X */
+		
+		for (i = 0; i < nfds; i++) {
+			driver->pfd[i].events |= POLLERR;
+		}
+
+		if (extra_fd >= 0) {
+			driver->pfd[nfds].fd = extra_fd;
+			driver->pfd[nfds].events =
+				POLLIN|POLLERR|POLLHUP|POLLNVAL;
+			nfds++;
+		}
+
+		poll_enter = jack_get_microseconds ();
+
+		if (poll_enter > driver->poll_next) {
+			/*
+			 * This processing cycle was delayed past the
+			 * next due interrupt!  Do not account this as
+			 * a wakeup delay:
+			 */
+			driver->poll_next = 0;
+			driver->poll_late++;
+		}
+
+		poll_result = poll (driver->pfd, nfds, driver->poll_timeout);
+		if (poll_result < 0) {
+
+			if (errno == EINTR) {
+				jack_info ("poll interrupt");
+				// this happens mostly when run
+				// under gdb, or when exiting due to a signal
+				if (under_gdb) {
+					goto again;
+				}
+				*status = -2;
+				return 0;
+			}
+			
+			jack_error ("ALSA: poll call failed (%s)",
+				    strerror (errno));
+			*status = -3;
+			return 0;
+			
+		}
+
+		poll_ret = jack_get_microseconds ();
+
+		// steph
+		fBeginDateUst = poll_ret;
+
+		if (extra_fd < 0) {
+			if (driver->poll_next && poll_ret > driver->poll_next) {
+				*delayed_usecs = poll_ret - driver->poll_next;
+			} 
+			driver->poll_last = poll_ret;
+			driver->poll_next = poll_ret + driver->period_usecs;
+			// steph
+			/*
+			driver->engine->transport_cycle_start (driver->engine, 
+							       poll_ret);
+			*/
+		}
+
+#ifdef DEBUG_WAKEUP
+		jack_info ("%" PRIu64 ": checked %d fds, %" PRIu64
+			 " usecs since poll entered", poll_ret, nfds,
+			 poll_ret - poll_enter);
+#endif
+
+		/* check to see if it was the extra FD that caused us
+		 * to return from poll */
+
+		if (extra_fd >= 0) {
+
+			if (driver->pfd[nfds-1].revents == 0) {
+				/* we timed out on the extra fd */
+
+				*status = -4;
+				return -1;
+			} 
+
+			/* if POLLIN was the only bit set, we're OK */
+
+			*status = 0;
+            if (driver->pfd[nfds-1].revents == POLLIN) {
+                jack_error("driver->pfd[nfds-1].revents == POLLIN");
+            }
+			return (driver->pfd[nfds-1].revents == POLLIN) ? 0 : -1;
+		}
+
+		if (need_playback) {
+			if (snd_pcm_poll_descriptors_revents
+			    (driver->playback_handle, &driver->pfd[0],
+			     driver->playback_nfds, &revents) < 0) {
+				jack_error ("ALSA: playback revents failed");
+				*status = -6;
+				return 0;
+			}
+
+			if (revents & POLLERR) {
+				xrun_detected = TRUE;
+			}
+
+			if (revents & POLLOUT) {
+				need_playback = 0;
+#ifdef DEBUG_WAKEUP
+				jack_info ("%" PRIu64
+					 " playback stream ready",
+					 poll_ret);
+#endif
+			}
+		}
+
+		if (need_capture) {
+			if (snd_pcm_poll_descriptors_revents
+			    (driver->capture_handle, &driver->pfd[ci],
+			     driver->capture_nfds, &revents) < 0) {
+				jack_error ("ALSA: capture revents failed");
+				*status = -6;
+				return 0;
+			}
+
+			if (revents & POLLERR) {
+				xrun_detected = TRUE;
+			}
+
+			if (revents & POLLIN) {
+				need_capture = 0;
+#ifdef DEBUG_WAKEUP
+				jack_info ("%" PRIu64
+					 " capture stream ready",
+					 poll_ret);
+#endif
+			}
+		}
+		
+		if (poll_result == 0) {
+			jack_error ("ALSA: poll time out, polled for %" PRIu64
+				    " usecs",
+				    poll_ret - poll_enter);
+			*status = -5;
+			return 0;
+		}		
+
+	}
+
+	if (driver->capture_handle) {
+		if ((capture_avail = snd_pcm_avail_update (
+			     driver->capture_handle)) < 0) {
+			if (capture_avail == -EPIPE) {
+				xrun_detected = TRUE;
+			} else {
+				jack_error ("unknown ALSA avail_update return"
+					    " value (%u)", capture_avail);
+			}
+		}
+	} else {
+		/* odd, but see min() computation below */
+		capture_avail = INT_MAX; 
+	}
+
+	if (driver->playback_handle) {
+		if ((playback_avail = snd_pcm_avail_update (
+			     driver->playback_handle)) < 0) {
+			if (playback_avail == -EPIPE) {
+				xrun_detected = TRUE;
+			} else {
+				jack_error ("unknown ALSA avail_update return"
+					    " value (%u)", playback_avail);
+			}
+		}
+	} else {
+		/* odd, but see min() computation below */
+		playback_avail = INT_MAX; 
+	}
+
+	if (xrun_detected) {
+		*status = alsa_driver_xrun_recovery (driver, delayed_usecs);
+		return 0;
+	}
+
+	*status = 0;
+	driver->last_wait_ust = poll_ret;
+
+	avail = capture_avail < playback_avail ? capture_avail : playback_avail;
+
+#ifdef DEBUG_WAKEUP
+	jack_info ("wakeup complete, avail = %lu, pavail = %lu "
+		 "cavail = %lu",
+		 avail, playback_avail, capture_avail);
+#endif
+
+	/* mark all channels not done for now. read/write will change this */
+
+	bitset_copy (driver->channels_not_done, driver->channels_done);
+
+	/* constrain the available count to the nearest (round down) number of
+	   periods.
+	*/
+
+	return avail - (avail % driver->frames_per_cycle);
+}
+
+
+int JackAlsaDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    jack_log("JackAlsaDriver::SetBufferSize %ld", buffer_size);
+    int res = alsa_driver_reset_parameters((alsa_driver_t *)fDriver, buffer_size,
+                                           ((alsa_driver_t *)fDriver)->user_nperiods,
+                                           ((alsa_driver_t *)fDriver)->frame_rate);
+
+    if (res == 0) { // update fEngineControl and fGraphManager
+        JackAudioDriver::SetBufferSize(buffer_size); // never fails
+    } else {
+        alsa_driver_reset_parameters((alsa_driver_t *)fDriver, fEngineControl->fBufferSize,
+                                     ((alsa_driver_t *)fDriver)->user_nperiods,
+                                     ((alsa_driver_t *)fDriver)->frame_rate);
+    }
+
+    return res;
+}
+
+int
+JackAlsaDriver::alsa_driver_read (alsa_driver_t *driver, jack_nframes_t nframes)
+{
+    snd_pcm_sframes_t contiguous;
+    snd_pcm_sframes_t nread;
+    snd_pcm_sframes_t offset;
+    jack_nframes_t orig_nframes;
+    jack_default_audio_sample_t* buf;
+    //channel_t chn;
+    //JSList *node;
+    //jack_port_t* port;
+    int err;
+
+    // steph
+    /*
+    if (!driver->capture_handle || driver->engine->freewheeling) {
+    	return 0;
+    }
+    */
+
+    if (nframes > driver->frames_per_cycle) {
+        return -1;
+    }
+
+    if (driver->midi)
+        (driver->midi->read)(driver->midi, nframes);
+
+    if (!driver->capture_handle) {
+        return 0;
+    }
+   
+    nread = 0;
+    contiguous = 0;
+    orig_nframes = nframes;
+
+    while (nframes) {
+
+        contiguous = nframes;
+
+        if (alsa_driver_get_channel_addresses (
+                    driver,
+                    (snd_pcm_uframes_t *) &contiguous,
+                    (snd_pcm_uframes_t *) 0,
+                    (snd_pcm_uframes_t *)&offset, 0) < 0) {
+            return -1;
+        }
+
+        // steph
+        for (int chn = 0; chn < fCaptureChannels; chn++) {
+            if (fGraphManager->GetConnectionsNum(fCapturePortList[chn]) > 0) {
+                buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[chn], orig_nframes);
+                alsa_driver_read_from_channel (driver, chn, buf + nread, contiguous);
+            }
+        }
+
+        /* // steph
+        for (chn = 0, node = driver->capture_ports; node;
+             node = jack_slist_next (node), chn++) {
+        	
+        	port = (jack_port_t *) node->data;
+        	
+        	if (!jack_port_connected (port)) {
+        		// no-copy optimization 
+        		continue;
+        	}
+        	buf = jack_port_get_buffer (port, orig_nframes);
+        	alsa_driver_read_from_channel (driver, chn,
+        		buf + nread, contiguous);
+        }
+        */
+
+        if ((err = snd_pcm_mmap_commit (driver->capture_handle,
+                                        offset, contiguous)) < 0) {
+         
+            jack_error ("ALSA: could not complete read of %"
+            		PRIu32 " frames: error = %d\n", contiguous, err);
+            jack_error ("ALSA: could not complete read of %d frames: error = %d", contiguous, err);
+            return -1;
+        }
+
+        nframes -= contiguous;
+        nread += contiguous;
+    }
+
+    return 0;
+}
+
+int
+JackAlsaDriver::alsa_driver_write (alsa_driver_t* driver, jack_nframes_t nframes)
+{
+    //channel_t chn;
+    //JSList *node;
+    //JSList *mon_node;
+    jack_default_audio_sample_t* buf;
+    jack_default_audio_sample_t* monbuf;
+    jack_nframes_t orig_nframes;
+    snd_pcm_sframes_t nwritten;
+    snd_pcm_sframes_t contiguous;
+    snd_pcm_sframes_t offset;
+    JackPort* port;
+    //jack_port_t *port;
+    int err;
+
+    driver->process_count++;
+
+    // steph
+    /*
+    if (!driver->playback_handle || driver->engine->freewheeling) {
+    	return 0;
+    }
+    */
+    if (!driver->playback_handle) {
+        return 0;
+    }
+
+    if (nframes > driver->frames_per_cycle) {
+        return -1;
+    }
+
+    if (driver->midi)
+        (driver->midi->write)(driver->midi, nframes);
+
+    nwritten = 0;
+    contiguous = 0;
+    orig_nframes = nframes;
+
+    /* check current input monitor request status */
+
+    driver->input_monitor_mask = 0;
+
+    // steph
+    /*
+    for (chn = 0, node = driver->capture_ports; node;
+         node = jack_slist_next (node), chn++) {
+    	if (((jack_port_t *) node->data)->shared->monitor_requests) {
+    		driver->input_monitor_mask |= (1<<chn);
+    	}
+    }
+    */
+    for (int chn = 0; chn < fCaptureChannels; chn++) {
+        port = fGraphManager->GetPort(fCapturePortList[chn]);
+        if (port->MonitoringInput()) {
+            driver->input_monitor_mask |= (1 << chn);
+        }
+    }
+
+    if (driver->hw_monitoring) {
+        if ((driver->hw->input_monitor_mask
+                != driver->input_monitor_mask)
+                && !driver->all_monitor_in) {
+            driver->hw->set_input_monitor_mask (
+                driver->hw, driver->input_monitor_mask);
+        }
+    }
+
+    while (nframes) {
+
+        contiguous = nframes;
+
+        if (alsa_driver_get_channel_addresses (
+                    driver,
+                    (snd_pcm_uframes_t *) 0,
+                    (snd_pcm_uframes_t *) &contiguous,
+                    0, (snd_pcm_uframes_t *)&offset) < 0) {
+            return -1;
+        }
+
+        // steph
+        for (int chn = 0; chn < fPlaybackChannels; chn++) {
+            // Ouput ports
+            if (fGraphManager->GetConnectionsNum(fPlaybackPortList[chn]) > 0) {
+                buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], orig_nframes);
+                alsa_driver_write_to_channel (driver, chn, buf + nwritten, contiguous);
+                // Monitor ports
+                if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[chn]) > 0) {
+                    monbuf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fMonitorPortList[chn], orig_nframes);
+                    memcpy(monbuf + nwritten, buf + nwritten, contiguous * sizeof(jack_default_audio_sample_t));
+                }
+            }
+        }
+
+        /*
+        for (chn = 0, node = driver->playback_ports, mon_node=driver->monitor_ports;
+             node;
+             node = jack_slist_next (node), chn++) {
+
+        	port = (jack_port_t *) node->data;
+
+        	if (!jack_port_connected (port)) {
+        		continue;
+        	}
+        	buf = jack_port_get_buffer (port, orig_nframes);
+        	alsa_driver_write_to_channel (driver, chn,
+        		buf + nwritten, contiguous);
+
+        	if (mon_node) {
+        		port = (jack_port_t *) mon_node->data;
+        		if (!jack_port_connected (port)) {
+        			continue;
+        		}
+        		monbuf = jack_port_get_buffer (port, orig_nframes);
+        		memcpy (monbuf + nwritten, buf + nwritten, contiguous * sizeof(jack_default_audio_sample_t));
+        		mon_node = jack_slist_next (mon_node);				
+        	}
+        }
+        */
+
+        if (!bitset_empty (driver->channels_not_done)) {
+            alsa_driver_silence_untouched_channels (driver,
+                                                    contiguous);
+        }
+
+        if ((err = snd_pcm_mmap_commit (driver->playback_handle,
+                                        offset, contiguous)) < 0) {
+            jack_error ("ALSA: could not complete playback of %"
+            		PRIu32 " frames: error = %d", contiguous, err);
+            jack_error ("ALSA: could not complete playback of %d frames: error = %d", contiguous, err);
+            if (err != EPIPE && err != ESTRPIPE)
+                return -1;
+        }
+
+        nframes -= contiguous;
+        nwritten += contiguous;
+    }
+    return 0;
+}
+
+void
+JackAlsaDriver::alsa_driver_delete (alsa_driver_t *driver)
+{
+    JSList *node;
+
+    if (driver->midi)
+        (driver->midi->destroy)(driver->midi);
+
+    for (node = driver->clock_sync_listeners; node;
+        node = jack_slist_next (node)) {
+        free (node->data);
+    }
+    jack_slist_free (driver->clock_sync_listeners);
+    
+    if (driver->ctl_handle) {
+		snd_ctl_close (driver->ctl_handle);
+		driver->ctl_handle = 0;
+	} 
+
+    if (driver->ctl_handle) {
+        snd_ctl_close (driver->ctl_handle);
+        driver->ctl_handle = 0;
+    } 
+
+    if (driver->capture_handle) {
+        snd_pcm_close (driver->capture_handle);
+        driver->capture_handle = 0;
+    }
+
+    if (driver->playback_handle) {
+        snd_pcm_close (driver->playback_handle);
+        driver->capture_handle = 0;
+    }
+
+    if (driver->capture_hw_params) {
+        snd_pcm_hw_params_free (driver->capture_hw_params);
+        driver->capture_hw_params = 0;
+    }
+
+    if (driver->playback_hw_params) {
+        snd_pcm_hw_params_free (driver->playback_hw_params);
+        driver->playback_hw_params = 0;
+    }
+
+    if (driver->capture_sw_params) {
+        snd_pcm_sw_params_free (driver->capture_sw_params);
+        driver->capture_sw_params = 0;
+    }
+
+    if (driver->playback_sw_params) {
+        snd_pcm_sw_params_free (driver->playback_sw_params);
+        driver->playback_sw_params = 0;
+    }
+
+    if (driver->pfd) {
+        free (driver->pfd);
+    }
+
+    if (driver->hw) {
+        driver->hw->release (driver->hw);
+        driver->hw = 0;
+    }
+    free(driver->alsa_name_playback);
+    free(driver->alsa_name_capture);
+    free(driver->alsa_driver);
+
+    alsa_driver_release_channel_dependent_memory (driver);
+    // steph
+    //jack_driver_nt_finish ((jack_driver_nt_t *) driver);
+    free (driver);
+}
+
+jack_driver_t *
+JackAlsaDriver::alsa_driver_new (const char *name, char *playback_alsa_device,
+                                 char *capture_alsa_device,
+                                 jack_client_t *client,
+                                 jack_nframes_t frames_per_cycle,
+                                 jack_nframes_t user_nperiods,
+                                 jack_nframes_t rate,
+                                 int hw_monitoring,
+                                 int hw_metering,
+                                 int capturing,
+                                 int playing,
+                                 DitherAlgorithm dither,
+                                 int soft_mode,
+                                 int monitor,
+                                 int user_capture_nchnls,
+                                 int user_playback_nchnls,
+                                 int shorts_first,
+                                 jack_nframes_t capture_latency,
+                                 jack_nframes_t playback_latency,
+                                 alsa_midi_t *midi)
+{
+    int err;
+
+    alsa_driver_t *driver;
+
+    jack_info ("creating alsa driver ... %s|%s|%" PRIu32 "|%" PRIu32
+    	"|%" PRIu32"|%" PRIu32"|%" PRIu32 "|%s|%s|%s|%s",
+    	playing ? playback_alsa_device : "-",
+    	capturing ? capture_alsa_device : "-", 
+    	frames_per_cycle, user_nperiods, rate,
+    	user_capture_nchnls,user_playback_nchnls,
+    	hw_monitoring ? "hwmon": "nomon",
+    	hw_metering ? "hwmeter":"swmeter",
+    	soft_mode ? "soft-mode":"-",
+    	shorts_first ? "16bit":"32bit");
+ 
+    driver = (alsa_driver_t *) calloc (1, sizeof (alsa_driver_t));
+
+    jack_driver_nt_init ((jack_driver_nt_t *) driver);
+
+    driver->midi = midi;
+    driver->xrun_recovery = 0;
+
+    //driver->nt_attach = (JackDriverNTAttachFunction) alsa_driver_attach;
+    //driver->nt_detach = (JackDriverNTDetachFunction) alsa_driver_detach;
+    //driver->read = (JackDriverReadFunction) alsa_driver_read;
+    //driver->write = (JackDriverReadFunction) alsa_driver_write;
+    //driver->null_cycle = (JackDriverNullCycleFunction) alsa_driver_null_cycle;
+    //driver->nt_bufsize = (JackDriverNTBufSizeFunction) alsa_driver_bufsize;
+    //driver->nt_start = (JackDriverNTStartFunction) alsa_driver_start;
+    //driver->nt_stop = (JackDriverNTStopFunction) alsa_driver_stop;
+    //driver->nt_run_cycle = (JackDriverNTRunCycleFunction) alsa_driver_run_cycle;
+
+    driver->playback_handle = NULL;
+    driver->capture_handle = NULL;
+    driver->ctl_handle = 0;
+    driver->hw = 0;
+    driver->capture_and_playback_not_synced = FALSE;
+    driver->max_nchannels = 0;
+    driver->user_nchannels = 0;
+    driver->playback_nchannels = user_playback_nchnls;
+    driver->capture_nchannels = user_capture_nchnls;
+    driver->playback_sample_bytes = (shorts_first ? 2 : 4);
+    driver->capture_sample_bytes = (shorts_first ? 2 : 4);
+    driver->capture_frame_latency = capture_latency;
+    driver->playback_frame_latency = playback_latency;
+
+    driver->playback_addr = 0;
+    driver->capture_addr = 0;
+    driver->playback_interleave_skip = NULL; 
+    driver->capture_interleave_skip = NULL; 
+
+    driver->silent = 0;
+    driver->all_monitor_in = FALSE;
+    driver->with_monitor_ports = monitor;
+
+    driver->clock_mode = ClockMaster; /* XXX is it? */
+    driver->input_monitor_mask = 0;   /* XXX is it? */
+
+    driver->capture_ports = 0;
+    driver->playback_ports = 0;
+    driver->monitor_ports = 0;
+
+    driver->pfd = 0;
+    driver->playback_nfds = 0;
+    driver->capture_nfds = 0;
+
+    driver->dither = dither;
+    driver->soft_mode = soft_mode;
+
+    pthread_mutex_init (&driver->clock_sync_lock, 0);
+    driver->clock_sync_listeners = 0;
+
+    driver->poll_late = 0;
+    driver->xrun_count = 0;
+    driver->process_count = 0;
+
+    driver->alsa_name_playback = strdup (playback_alsa_device);
+    driver->alsa_name_capture = strdup (capture_alsa_device);
+
+    if (alsa_driver_check_card_type (driver)) {
+        alsa_driver_delete (driver);
+        return NULL;
+    }
+
+    alsa_driver_hw_specific (driver, hw_monitoring, hw_metering);
+
+    if (playing) {
+        if (snd_pcm_open (&driver->playback_handle,
+                          playback_alsa_device,
+                          SND_PCM_STREAM_PLAYBACK,
+                          SND_PCM_NONBLOCK) < 0) {
+            switch (errno) {
+                case EBUSY:
+                    jack_error ("the playback device \"%s\" is "
+                                "already in use. Please stop the"
+                                " application using it and "
+                                "run JACK again",
+                                playback_alsa_device);
+                    alsa_driver_delete (driver);
+                    return NULL;
+                    break;
+
+                case EPERM:
+                    jack_error ("you do not have permission to open "
+                                "the audio device \"%s\" for playback",
+                                playback_alsa_device);
+                    alsa_driver_delete (driver);
+                    return NULL;
+                    break;
+            }
+
+            driver->playback_handle = NULL;
+        }
+
+        if (driver->playback_handle) {
+            snd_pcm_nonblock (driver->playback_handle, 0);
+        }
+    }
+
+    if (capturing) {
+        if (snd_pcm_open (&driver->capture_handle,
+                          capture_alsa_device,
+                          SND_PCM_STREAM_CAPTURE,
+                          SND_PCM_NONBLOCK) < 0) {
+            switch (errno) {
+                case EBUSY:
+                    jack_error ("the capture device \"%s\" is "
+                                "already in use. Please stop the"
+                                " application using it and "
+                                "run JACK again",
+                                capture_alsa_device);
+                    alsa_driver_delete (driver);
+                    return NULL;
+                    break;
+
+                case EPERM:
+                    jack_error ("you do not have permission to open "
+                                "the audio device \"%s\" for capture",
+                                capture_alsa_device);
+                    alsa_driver_delete (driver);
+                    return NULL;
+                    break;
+            }
+
+            driver->capture_handle = NULL;
+        }
+
+        if (driver->capture_handle) {
+            snd_pcm_nonblock (driver->capture_handle, 0);
+        }
+    }
+
+    if (driver->playback_handle == NULL) {
+        if (playing) {
+
+            /* they asked for playback, but we can't do it */
+
+            jack_error ("ALSA: Cannot open PCM device %s for "
+                        "playback. Falling back to capture-only"
+                        " mode", name);
+
+            if (driver->capture_handle == NULL) {
+                /* can't do anything */
+                alsa_driver_delete (driver);
+                return NULL;
+            }
+
+            playing = FALSE;
+        }
+    }
+
+    if (driver->capture_handle == NULL) {
+        if (capturing) {
+
+            /* they asked for capture, but we can't do it */
+
+            jack_error ("ALSA: Cannot open PCM device %s for "
+                        "capture. Falling back to playback-only"
+                        " mode", name);
+
+            if (driver->playback_handle == NULL) {
+                /* can't do anything */
+                alsa_driver_delete (driver);
+                return NULL;
+            }
+
+            capturing = FALSE;
+        }
+    }
+
+    driver->playback_hw_params = 0;
+    driver->capture_hw_params = 0;
+    driver->playback_sw_params = 0;
+    driver->capture_sw_params = 0;
+
+    if (driver->playback_handle) {
+        if ((err = snd_pcm_hw_params_malloc (
+                       &driver->playback_hw_params)) < 0) {
+            jack_error ("ALSA: could not allocate playback hw"
+                        " params structure");
+            alsa_driver_delete (driver);
+            return NULL;
+        }
+
+        if ((err = snd_pcm_sw_params_malloc (
+                       &driver->playback_sw_params)) < 0) {
+            jack_error ("ALSA: could not allocate playback sw"
+                        " params structure");
+            alsa_driver_delete (driver);
+            return NULL;
+        }
+    }
+
+    if (driver->capture_handle) {
+        if ((err = snd_pcm_hw_params_malloc (
+                       &driver->capture_hw_params)) < 0) {
+            jack_error ("ALSA: could not allocate capture hw"
+                        " params structure");
+            alsa_driver_delete (driver);
+            return NULL;
+        }
+
+        if ((err = snd_pcm_sw_params_malloc (
+                       &driver->capture_sw_params)) < 0) {
+            jack_error ("ALSA: could not allocate capture sw"
+                        " params structure");
+            alsa_driver_delete (driver);
+            return NULL;
+        }
+    }
+
+    if (alsa_driver_set_parameters (driver, frames_per_cycle,
+                                    user_nperiods, rate)) {
+        alsa_driver_delete (driver);
+        return NULL;
+    }
+
+    driver->capture_and_playback_not_synced = FALSE;
+
+    if (driver->capture_handle && driver->playback_handle) {
+        if (snd_pcm_link (driver->capture_handle,
+                          driver->playback_handle) != 0) {
+            driver->capture_and_playback_not_synced = TRUE;
+        }
+    }
+
+    driver->client = client;
+    return (jack_driver_t *) driver;
+}
+
+int JackAlsaDriver::Attach()
+{
+    JackPort* port;
+    int port_index;
+    unsigned long port_flags;
+    char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+
+    assert(fCaptureChannels < DRIVER_PORT_NUM);
+    assert(fPlaybackChannels < DRIVER_PORT_NUM);
+
+    port_flags = (unsigned long)CaptureDriverFlags;
+
+    alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;
+
+    if (alsa_driver->has_hw_monitoring)
+        port_flags |= JackPortCanMonitor;
+
+    // ALSA driver may have changed the values
+    JackAudioDriver::SetBufferSize(alsa_driver->frames_per_cycle);
+    JackAudioDriver::SetSampleRate(alsa_driver->frame_rate);
+
+    jack_log("JackAudioDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    for (int i = 0; i < fCaptureChannels; i++) {
+        snprintf(alias, sizeof(alias) - 1, "%s:capture_%u", fAliasName, i + 1);
+        snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        port->SetLatency(alsa_driver->frames_per_cycle + alsa_driver->capture_frame_latency);
+        fCapturePortList[i] = port_index;
+        jack_log("JackAudioDriver::Attach fCapturePortList[i] %ld ", port_index);
+    }
+
+    port_flags = (unsigned long)PlaybackDriverFlags;
+
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fAliasName, i + 1);
+        snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        // Add one buffer more latency if "async" mode is used...
+        port->SetLatency((alsa_driver->frames_per_cycle * (alsa_driver->user_nperiods - 1)) +
+                         ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + alsa_driver->playback_frame_latency);
+        fPlaybackPortList[i] = port_index;
+        jack_log("JackAudioDriver::Attach fPlaybackPortList[i] %ld ", port_index);
+
+        // Monitor ports
+        if (fWithMonitorPorts) {
+            jack_log("Create monitor port ");
+            snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error ("ALSA: cannot register monitor port for %s", name);
+            } else {
+                port = fGraphManager->GetPort(port_index);
+                port->SetLatency(alsa_driver->frames_per_cycle);
+                fMonitorPortList[i] = port_index;
+            }
+        }
+    }
+
+    if (alsa_driver->midi) {
+        int err = (alsa_driver->midi->attach)(alsa_driver->midi);
+        if (err)
+            jack_error ("ALSA: cannot attach MIDI: %d", err);
+    }
+
+    return 0;
+}
+
+int JackAlsaDriver::Detach()
+{
+    alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;
+    if (alsa_driver->midi)
+        (alsa_driver->midi->detach)(alsa_driver->midi);
+
+    return JackAudioDriver::Detach();
+}
+
+static int card_to_num(const char* device) 
+{
+    int err;
+    char* ctl_name;
+    snd_ctl_card_info_t *card_info;
+    snd_ctl_t* ctl_handle;
+    int i = -1;
+
+    snd_ctl_card_info_alloca (&card_info);
+
+    ctl_name = get_control_device_name(device);
+    if (ctl_name == NULL) {
+        jack_error("get_control_device_name() failed.");
+        goto fail;
+    }
+
+    if ((err = snd_ctl_open (&ctl_handle, ctl_name, 0)) < 0) {
+        jack_error ("control open \"%s\" (%s)", ctl_name,
+                    snd_strerror(err));
+        goto free;
+    }
+
+    if ((err = snd_ctl_card_info(ctl_handle, card_info)) < 0) {
+        jack_error ("control hardware info \"%s\" (%s)",
+                    device, snd_strerror (err));
+        goto close;
+    }
+
+    i = snd_ctl_card_info_get_card(card_info);
+
+close:
+    snd_ctl_close(ctl_handle);
+
+free:
+    free(ctl_name);
+
+fail:
+    return i;
+}
+
+int JackAlsaDriver::Open(jack_nframes_t nframes,
+                         jack_nframes_t user_nperiods,
+                         jack_nframes_t samplerate,
+                         bool hw_monitoring,
+                         bool hw_metering,
+                         bool capturing,
+                         bool playing,
+                         DitherAlgorithm dither,
+                         bool soft_mode,
+                         bool monitor,
+                         int inchannels,
+                         int outchannels,
+                         bool shorts_first,
+                         const char* capture_driver_name,
+                         const char* playback_driver_name,
+                         jack_nframes_t capture_latency,
+                         jack_nframes_t playback_latency,
+                         const char* midi_driver_name)
+{
+    // Generic JackAudioDriver Open
+    if (JackAudioDriver::Open(nframes, samplerate, capturing, playing,
+                              inchannels, outchannels, monitor, capture_driver_name, playback_driver_name,
+                              capture_latency, playback_latency) != 0) {
+        return -1;
+    }
+
+    alsa_midi_t *midi = 0;
+    if (strcmp(midi_driver_name, "seq") == 0)
+        midi = alsa_seqmidi_new((jack_client_t*)this, 0);
+    else if (strcmp(midi_driver_name, "raw") == 0)
+        midi = alsa_rawmidi_new((jack_client_t*)this);
+
+    if (JackServerGlobals::on_device_acquire != NULL)
+    {
+        int capture_card = card_to_num(capture_driver_name);
+        int playback_card = card_to_num(playback_driver_name);
+        char audio_name[32];
+
+        snprintf(audio_name, sizeof(audio_name) - 1, "Audio%d", capture_card);
+        if (!JackServerGlobals::on_device_acquire(audio_name)) {
+            jack_error("Audio device %s cannot be acquired, trying to open it anyway...", capture_driver_name);
+        }
+
+        if (playback_card != capture_card) {
+            snprintf(audio_name, sizeof(audio_name) - 1, "Audio%d", playback_card);
+            if (!JackServerGlobals::on_device_acquire(audio_name)) {
+                jack_error("Audio device %s cannot be acquired, trying to open it anyway...", playback_driver_name);
+            }
+        }
+    }
+
+    fDriver = alsa_driver_new ("alsa_pcm", (char*)playback_driver_name, (char*)capture_driver_name,
+                               NULL,
+                               nframes,
+                               user_nperiods,
+                               samplerate,
+                               hw_monitoring,
+                               hw_metering,
+                               capturing,
+                               playing,
+                               dither,
+                               soft_mode,
+                               monitor,
+                               inchannels,
+                               outchannels,
+                               shorts_first,
+                               capture_latency,
+                               playback_latency,
+                               midi);
+    if (fDriver) {
+        // ALSA driver may have changed the in/out values
+        fCaptureChannels = ((alsa_driver_t *)fDriver)->capture_nchannels;
+        fPlaybackChannels = ((alsa_driver_t *)fDriver)->playback_nchannels;
+        return 0;
+    } else {
+        JackAudioDriver::Close();
+        return -1;
+    }
+}
+
+int JackAlsaDriver::Close()
+{
+    JackAudioDriver::Close();
+    alsa_driver_delete((alsa_driver_t*)fDriver);
+
+    if (JackServerGlobals::on_device_release != NULL)
+    {
+        char audio_name[32];
+        int capture_card = card_to_num(fCaptureDriverName);
+        if (capture_card >= 0) {
+            snprintf(audio_name, sizeof(audio_name) - 1, "Audio%d", capture_card);
+            JackServerGlobals::on_device_release(audio_name);
+        }
+
+        int playback_card = card_to_num(fPlaybackDriverName);
+        if (playback_card >= 0 && playback_card != capture_card) {
+            snprintf(audio_name, sizeof(audio_name) - 1, "Audio%d", playback_card);
+            JackServerGlobals::on_device_release(audio_name);
+        }
+    }
+
+    return 0;
+}
+
+int JackAlsaDriver::Start()
+{
+    JackAudioDriver::Start();
+    return alsa_driver_start((alsa_driver_t *)fDriver);
+}
+
+int JackAlsaDriver::Stop()
+{
+    return alsa_driver_stop((alsa_driver_t *)fDriver);
+}
+
+int JackAlsaDriver::Read()
+{
+    /* Taken from alsa_driver_run_cycle */
+    int wait_status;
+    jack_nframes_t nframes;
+    fDelayedUsecs = 0.f;
+
+    nframes = alsa_driver_wait((alsa_driver_t *)fDriver, -1, &wait_status, &fDelayedUsecs);
+ 
+    if (wait_status < 0)
+        return -1;		/* driver failed */
+
+    if (nframes == 0) {
+        /* we detected an xrun and restarted: notify
+         * clients about the delay. 
+         */
+        jack_log("ALSA XRun wait_status = %d", wait_status);
+        NotifyXRun(fBeginDateUst, fDelayedUsecs);
+        return -1;
+    }
+
+    if (nframes != fEngineControl->fBufferSize)
+        jack_log("JackAlsaDriver::Read error nframes = %ld", nframes);
+        
+    // Has to be done before read
+    JackDriver::CycleIncTime();
+
+    return alsa_driver_read((alsa_driver_t *)fDriver, fEngineControl->fBufferSize);
+}
+
+int JackAlsaDriver::Write()
+{
+    return alsa_driver_write((alsa_driver_t *)fDriver, fEngineControl->fBufferSize);
+}
+
+void
+JackAlsaDriver::jack_driver_init (jack_driver_t *driver)
+{
+    memset (driver, 0, sizeof (*driver));
+
+    driver->attach = 0;
+    driver->detach = 0;
+    driver->write = 0;
+    driver->read = 0;
+    driver->null_cycle = 0;
+    driver->bufsize = 0;
+    driver->start = 0;
+    driver->stop = 0;
+}
+
+void
+JackAlsaDriver::jack_driver_nt_init (jack_driver_nt_t * driver)
+{
+    memset (driver, 0, sizeof (*driver));
+
+    jack_driver_init ((jack_driver_t *) driver);
+
+    driver->attach = 0;
+    driver->detach = 0;
+    driver->bufsize = 0;
+    driver->stop = 0;
+    driver->start = 0;
+
+    driver->nt_bufsize = 0;
+    driver->nt_start = 0;
+    driver->nt_stop = 0;
+    driver->nt_attach = 0;
+    driver->nt_detach = 0;
+    driver->nt_run_cycle = 0;
+}
+
+int JackAlsaDriver::is_realtime() const
+{
+    return fEngineControl->fRealTime;
+}
+
+int JackAlsaDriver::create_thread(pthread_t *thread, int priority, int realtime, void *(*start_routine)(void*), void *arg)
+{
+    return JackPosixThread::StartImp(thread, priority, realtime, start_routine, arg);
+}
+
+jack_port_id_t JackAlsaDriver::port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size)
+{
+    jack_port_id_t port_index;
+    int res = fEngine->PortRegister(fClientControl.fRefNum, port_name, port_type, flags, buffer_size, &port_index);
+    return (res == 0) ? port_index : 0;
+}
+
+int JackAlsaDriver::port_unregister(jack_port_id_t port_index)
+{
+    return fEngine->PortUnRegister(fClientControl.fRefNum, port_index);
+}
+
+void* JackAlsaDriver::port_get_buffer(int port, jack_nframes_t nframes)
+{
+    return fGraphManager->GetBuffer(port, nframes);
+}
+
+int  JackAlsaDriver::port_set_alias(int port, const char* name)
+{
+    return fGraphManager->GetPort(port)->SetAlias(name);
+}
+
+jack_nframes_t JackAlsaDriver::get_sample_rate() const
+{
+    return fEngineControl->fSampleRate;
+}
+
+jack_nframes_t JackAlsaDriver::frame_time() const
+{
+    JackTimer timer;
+    fEngineControl->ReadFrameTime(&timer);
+    return timer.Time2Frames(GetMicroSeconds(), fEngineControl->fBufferSize);
+}
+
+jack_nframes_t JackAlsaDriver::last_frame_time() const
+{
+    JackTimer timer;
+    fEngineControl->ReadFrameTime(&timer);
+    return timer.CurFrame();
+}
+
+} // end of namespace
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+static
+void
+fill_device(
+    jack_driver_param_constraint_desc_t ** constraint_ptr_ptr,
+    uint32_t * array_size_ptr,
+    const char * device_id,
+    const char * device_description)
+{
+    jack_driver_param_value_enum_t * possible_value_ptr;
+
+    //jack_info("%6s - %s", device_id, device_description);
+
+    if (*constraint_ptr_ptr == NULL)
+    {
+        *constraint_ptr_ptr = (jack_driver_param_constraint_desc_t *)calloc(1, sizeof(jack_driver_param_value_enum_t));
+        *array_size_ptr = 0;
+    }
+
+    if ((*constraint_ptr_ptr)->constraint.enumeration.count == *array_size_ptr)
+    {
+        *array_size_ptr += 10;
+        (*constraint_ptr_ptr)->constraint.enumeration.possible_values_array =
+            (jack_driver_param_value_enum_t *)realloc(
+                (*constraint_ptr_ptr)->constraint.enumeration.possible_values_array,
+                sizeof(jack_driver_param_value_enum_t) * *array_size_ptr);
+    }
+
+    possible_value_ptr = (*constraint_ptr_ptr)->constraint.enumeration.possible_values_array + (*constraint_ptr_ptr)->constraint.enumeration.count;
+    (*constraint_ptr_ptr)->constraint.enumeration.count++;
+    strcpy(possible_value_ptr->value.str, device_id);
+    strcpy(possible_value_ptr->short_desc, device_description);
+}
+
+static
+jack_driver_param_constraint_desc_t *
+enum_alsa_devices()
+{
+    snd_ctl_t * handle;
+    snd_ctl_card_info_t * info;
+    snd_pcm_info_t * pcminfo_capture;
+    snd_pcm_info_t * pcminfo_playback;
+    int card_no = -1;
+    char card_id[JACK_DRIVER_PARAM_STRING_MAX + 1];
+    char device_id[JACK_DRIVER_PARAM_STRING_MAX + 1];
+    char description[64];
+    int device_no;
+    bool has_capture;
+    bool has_playback;
+    jack_driver_param_constraint_desc_t * constraint_ptr;
+    uint32_t array_size = 0;
+
+    snd_ctl_card_info_alloca(&info);
+    snd_pcm_info_alloca(&pcminfo_capture);
+    snd_pcm_info_alloca(&pcminfo_playback);
+
+    constraint_ptr = NULL;
+
+    while(snd_card_next(&card_no) >= 0 && card_no >= 0)
+    {
+        sprintf(card_id, "hw:%d", card_no);
+
+        if (snd_ctl_open(&handle, card_id, 0) >= 0 &&
+            snd_ctl_card_info(handle, info) >= 0)
+        {
+            fill_device(&constraint_ptr, &array_size, card_id, snd_ctl_card_info_get_name(info));
+
+            device_no = -1;
+
+            while (snd_ctl_pcm_next_device(handle, &device_no) >= 0 && device_no != -1)
+            {
+                sprintf(device_id, "%s,%d", card_id, device_no);
+
+                snd_pcm_info_set_device(pcminfo_capture, device_no);
+                snd_pcm_info_set_subdevice(pcminfo_capture, 0);
+                snd_pcm_info_set_stream(pcminfo_capture, SND_PCM_STREAM_CAPTURE);
+                has_capture = snd_ctl_pcm_info(handle, pcminfo_capture) >= 0;
+
+                snd_pcm_info_set_device(pcminfo_playback, device_no);
+                snd_pcm_info_set_subdevice(pcminfo_playback, 0);
+                snd_pcm_info_set_stream(pcminfo_playback, SND_PCM_STREAM_PLAYBACK);
+                has_playback = snd_ctl_pcm_info(handle, pcminfo_playback) >= 0;
+
+                if (has_capture && has_playback)
+                {
+                    snprintf(description, sizeof(description),"%s (duplex)", snd_pcm_info_get_name(pcminfo_capture));
+                }
+                else if (has_capture)
+                {
+                    snprintf(description, sizeof(description),"%s (capture)", snd_pcm_info_get_name(pcminfo_capture));
+                }
+                else if (has_playback)
+                {
+                    snprintf(description, sizeof(description),"%s (playback)", snd_pcm_info_get_name(pcminfo_playback));
+                }
+                else
+                {
+                    continue;
+                }
+
+                fill_device(&constraint_ptr, &array_size, device_id, description);
+            }
+
+            snd_ctl_close(handle);
+        }
+    }
+
+    return constraint_ptr;
+}
+
+static
+jack_driver_param_constraint_desc_t *
+get_midi_driver_constraint()
+{
+    jack_driver_param_constraint_desc_t * constraint_ptr;
+    jack_driver_param_value_enum_t * possible_value_ptr;
+
+    //jack_info("%6s - %s", device_id, device_description);
+
+    constraint_ptr = (jack_driver_param_constraint_desc_t *)calloc(1, sizeof(jack_driver_param_value_enum_t));
+    constraint_ptr->flags = JACK_CONSTRAINT_FLAG_STRICT | JACK_CONSTRAINT_FLAG_FAKE_VALUE;
+
+    constraint_ptr->constraint.enumeration.possible_values_array = (jack_driver_param_value_enum_t *)malloc(3 * sizeof(jack_driver_param_value_enum_t));
+    constraint_ptr->constraint.enumeration.count = 3;
+
+    possible_value_ptr = constraint_ptr->constraint.enumeration.possible_values_array;
+
+    strcpy(possible_value_ptr->value.str, "none");
+    strcpy(possible_value_ptr->short_desc, "no MIDI driver");
+
+    possible_value_ptr++;
+
+    strcpy(possible_value_ptr->value.str, "seq");
+    strcpy(possible_value_ptr->short_desc, "ALSA Sequencer driver");
+
+    possible_value_ptr++;
+
+    strcpy(possible_value_ptr->value.str, "raw");
+    strcpy(possible_value_ptr->short_desc, "ALSA RawMIDI driver");
+
+    return constraint_ptr;
+}
+
+static
+jack_driver_param_constraint_desc_t *
+get_dither_constraint()
+{
+    jack_driver_param_constraint_desc_t * constraint_ptr;
+    jack_driver_param_value_enum_t * possible_value_ptr;
+
+    //jack_info("%6s - %s", device_id, device_description);
+
+    constraint_ptr = (jack_driver_param_constraint_desc_t *)calloc(1, sizeof(jack_driver_param_value_enum_t));
+    constraint_ptr->flags = JACK_CONSTRAINT_FLAG_STRICT | JACK_CONSTRAINT_FLAG_FAKE_VALUE;
+
+    constraint_ptr->constraint.enumeration.possible_values_array = (jack_driver_param_value_enum_t *)malloc(4 * sizeof(jack_driver_param_value_enum_t));
+    constraint_ptr->constraint.enumeration.count = 4;
+
+    possible_value_ptr = constraint_ptr->constraint.enumeration.possible_values_array;
+
+    possible_value_ptr->value.c = 'n';
+    strcpy(possible_value_ptr->short_desc, "none");
+
+    possible_value_ptr++;
+
+    possible_value_ptr->value.c = 'r';
+    strcpy(possible_value_ptr->short_desc, "rectangular");
+
+    possible_value_ptr++;
+
+    possible_value_ptr->value.c = 's';
+    strcpy(possible_value_ptr->short_desc, "shaped");
+
+    possible_value_ptr++;
+
+    possible_value_ptr->value.c = 't';
+    strcpy(possible_value_ptr->short_desc, "triangular");
+
+    return constraint_ptr;
+}
+
+    static int
+    dither_opt (char c, DitherAlgorithm* dither) 
+    {
+        switch (c) {
+            case '-':
+            case 'n':
+                *dither = None;
+                break;
+
+            case 'r':
+                *dither = Rectangular;
+                break;
+
+            case 's':
+                *dither = Shaped;
+                break;
+
+            case 't':
+                *dither = Triangular;
+                break;
+
+            default:
+                fprintf (stderr, "ALSA driver: illegal dithering mode %c\n", c);
+                return -1;
+        }
+        return 0;
+    }
+
+    SERVER_EXPORT const jack_driver_desc_t* driver_get_descriptor () 
+    {
+        jack_driver_desc_t * desc;
+        jack_driver_param_desc_t * params;
+        unsigned int i;
+
+        desc = (jack_driver_desc_t*)calloc (1, sizeof (jack_driver_desc_t));
+        
+        strcpy(desc->name, "alsa");                                    // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Linux ALSA API based audio backend");      // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+        
+        desc->nparams = 18;
+        params = (jack_driver_param_desc_t*)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy (params[i].name, "capture");
+        params[i].character = 'C';
+        params[i].type = JackDriverParamString;
+        strcpy (params[i].value.str, "none");
+        strcpy (params[i].short_desc,
+                "Provide capture ports.  Optionally set device");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "playback");
+        params[i].character = 'P';
+        params[i].type = JackDriverParamString;
+        strcpy (params[i].value.str, "none");
+        strcpy (params[i].short_desc,
+                "Provide playback ports.  Optionally set device");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "device");
+        params[i].character = 'd';
+        params[i].type = JackDriverParamString;
+        strcpy (params[i].value.str, "hw:0");
+        strcpy (params[i].short_desc, "ALSA device name");
+        strcpy (params[i].long_desc, params[i].short_desc);
+        params[i].constraint = enum_alsa_devices();
+
+        i++;
+        strcpy (params[i].name, "rate");
+        params[i].character = 'r';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.ui = 48000U;
+        strcpy (params[i].short_desc, "Sample rate");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "period");
+        params[i].character = 'p';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.ui = 1024U;
+        strcpy (params[i].short_desc, "Frames per period");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "nperiods");
+        params[i].character = 'n';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.ui = 2U;
+        strcpy (params[i].short_desc, "Number of periods of playback latency");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "hwmon");
+        params[i].character = 'H';
+        params[i].type = JackDriverParamBool;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc, "Hardware monitoring, if available");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "hwmeter");
+        params[i].character = 'M';
+        params[i].type = JackDriverParamBool;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc, "Hardware metering, if available");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "duplex");
+        params[i].character = 'D';
+        params[i].type = JackDriverParamBool;
+        params[i].value.i = 1;
+        strcpy (params[i].short_desc,
+                "Provide both capture and playback ports");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "softmode");
+        params[i].character = 's';
+        params[i].type = JackDriverParamBool;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc, "Soft-mode, no xrun handling");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "monitor");
+        params[i].character = 'm';
+        params[i].type = JackDriverParamBool;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc, "Provide monitor ports for the output");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "dither");
+        params[i].character = 'z';
+        params[i].type = JackDriverParamChar;
+        params[i].value.c = 'n';
+        strcpy (params[i].short_desc, "Dithering mode");
+        strcpy (params[i].long_desc,
+                "Dithering mode:\n"
+                "  n - none\n"
+                "  r - rectangular\n"
+                "  s - shaped\n"
+                "  t - triangular");
+        params[i].constraint = get_dither_constraint();
+
+        i++;
+        strcpy (params[i].name, "inchannels");
+        params[i].character = 'i';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc,
+                "Number of capture channels (defaults to hardware max)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "outchannels");
+        params[i].character = 'o';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc,
+                "Number of playback channels (defaults to hardware max)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "shorts");
+        params[i].character = 'S';
+        params[i].type = JackDriverParamBool;
+        params[i].value.i = FALSE;
+        strcpy (params[i].short_desc, "Try 16-bit samples before 32-bit");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "input-latency");
+        params[i].character = 'I';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc, "Extra input latency (frames)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "output-latency");
+        params[i].character = 'O';
+        params[i].type = JackDriverParamUInt;
+        params[i].value.i = 0;
+        strcpy (params[i].short_desc, "Extra output latency (frames)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "midi-driver");
+        params[i].character = 'X';
+        params[i].type = JackDriverParamString;
+        strcpy (params[i].value.str, "none");
+        strcpy (params[i].short_desc, "ALSA MIDI driver name (seq|raw)");
+        strcpy (params[i].long_desc,
+                "ALSA MIDI driver:\n"
+                " none - no MIDI driver\n"
+                " seq - ALSA Sequencer driver\n"
+                " raw - ALSA RawMIDI driver\n");
+        params[i].constraint = get_midi_driver_constraint();
+
+        desc->params = params;
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) 
+    {
+        jack_nframes_t srate = 48000;
+        jack_nframes_t frames_per_interrupt = 1024;
+        unsigned long user_nperiods = 2;
+        const char *playback_pcm_name = "hw:0";
+        const char *capture_pcm_name = "hw:0";
+        int hw_monitoring = FALSE;
+        int hw_metering = FALSE;
+        int capture = FALSE;
+        int playback = FALSE;
+        int soft_mode = FALSE;
+        int monitor = FALSE;
+        DitherAlgorithm dither = None;
+        int user_capture_nchnls = 0;
+        int user_playback_nchnls = 0;
+        int shorts_first = FALSE;
+        jack_nframes_t systemic_input_latency = 0;
+        jack_nframes_t systemic_output_latency = 0;
+        const JSList * node;
+        const jack_driver_param_t * param;
+        const char *midi_driver = "none";
+
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (const jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+
+                case 'C':
+                    capture = TRUE;
+                    if (strcmp (param->value.str, "none") != 0) {
+                        capture_pcm_name = strdup (param->value.str);
+                        jack_log("capture device %s", capture_pcm_name);
+                    }
+                    break;
+
+                case 'P':
+                    playback = TRUE;
+                    if (strcmp (param->value.str, "none") != 0) {
+                        playback_pcm_name = strdup (param->value.str);
+                        jack_log("playback device %s", playback_pcm_name);
+                    }
+                    break;
+
+                case 'D':
+                    playback = TRUE;
+                    capture = TRUE;
+                    break;
+
+                case 'd':
+                    playback_pcm_name = strdup (param->value.str);
+                    capture_pcm_name = strdup (param->value.str);
+                    jack_log("playback device %s", playback_pcm_name);
+                    jack_log("capture device %s", capture_pcm_name);
+                    break;
+
+                case 'H':
+                    hw_monitoring = param->value.i;
+                    break;
+
+                case 'm':
+                    monitor = param->value.i;
+                    break;
+
+                case 'M':
+                    hw_metering = param->value.i;
+                    break;
+
+                case 'r':
+                    srate = param->value.ui;
+                    jack_log("apparent rate = %d", srate);
+                    break;
+
+                case 'p':
+                    frames_per_interrupt = param->value.ui;
+                    jack_log("frames per period = %d", frames_per_interrupt);
+                    break;
+
+                case 'n':
+                    user_nperiods = param->value.ui;
+                    if (user_nperiods < 2)	/* enforce minimum value */
+                        user_nperiods = 2;
+                    break;
+
+                case 's':
+                    soft_mode = param->value.i;
+                    break;
+
+                case 'z':
+                    if (dither_opt (param->value.c, &dither)) {
+                        return NULL;
+                    }
+                    break;
+
+                case 'i':
+                    user_capture_nchnls = param->value.ui;
+                    break;
+
+                case 'o':
+                    user_playback_nchnls = param->value.ui;
+                    break;
+
+                case 'S':
+                    shorts_first = param->value.i;
+                    break;
+
+                case 'I':
+                    systemic_input_latency = param->value.ui;
+                    break;
+
+                case 'O':
+                    systemic_output_latency = param->value.ui;
+                    break;
+
+                case 'X':
+                    midi_driver = strdup(param->value.str);
+                    break;
+            }
+        }
+
+        /* duplex is the default */
+        if (!capture && !playback) {
+            capture = TRUE;
+            playback = TRUE;
+        }
+
+        Jack::JackAlsaDriver* alsa_driver = new Jack::JackAlsaDriver("system", "alsa_pcm", engine, table);
+        Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(alsa_driver);
+        // Special open for ALSA driver...
+        if (alsa_driver->Open(frames_per_interrupt, user_nperiods, srate, hw_monitoring, hw_metering, capture, playback, dither, soft_mode, monitor,
+                              user_capture_nchnls, user_playback_nchnls, shorts_first, capture_pcm_name, playback_pcm_name,
+                              systemic_input_latency, systemic_output_latency, midi_driver) == 0) {
+            return threaded_driver;
+        } else {
+            delete threaded_driver; // Delete the decorated driver
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/linux/alsa/JackAlsaDriver.h b/linux/alsa/JackAlsaDriver.h
new file mode 100644
index 0000000..fc66195
--- /dev/null
+++ b/linux/alsa/JackAlsaDriver.h
@@ -0,0 +1,183 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackAlsaDriver__
+#define __JackAlsaDriver__
+
+#include "JackAudioDriver.h"
+#include "JackThreadedDriver.h"
+#include "JackTime.h"
+
+#include "alsa_driver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The ALSA driver.
+*/
+
+class JackAlsaDriver : public JackAudioDriver
+{
+
+    private:
+
+        jack_driver_t* fDriver;
+        int fReservedCaptureDevice;
+        int fReservedPlaybackDevice;
+    
+        void alsa_driver_release_channel_dependent_memory(alsa_driver_t *driver);
+        int alsa_driver_check_capabilities(alsa_driver_t *driver);
+        int alsa_driver_check_card_type(alsa_driver_t *driver);
+        int alsa_driver_hammerfall_hardware(alsa_driver_t *driver);
+        int alsa_driver_hdsp_hardware(alsa_driver_t *driver);
+        int alsa_driver_ice1712_hardware(alsa_driver_t *driver);
+        int alsa_driver_usx2y_hardware(alsa_driver_t *driver);
+        int alsa_driver_generic_hardware(alsa_driver_t *driver);
+        int alsa_driver_hw_specific(alsa_driver_t *driver, int hw_monitoring,
+                                     int hw_metering);
+        void alsa_driver_setup_io_function_pointers (alsa_driver_t *driver);
+        int alsa_driver_configure_stream(alsa_driver_t *driver, char *device_name,
+                                          const char *stream_name,
+                                          snd_pcm_t *handle,
+                                          snd_pcm_hw_params_t *hw_params,
+                                          snd_pcm_sw_params_t *sw_params,
+                                          unsigned int *nperiodsp,
+                                          unsigned long *nchns,
+                                          unsigned long sample_width);
+
+        int alsa_driver_set_parameters(alsa_driver_t *driver,
+                                        jack_nframes_t frames_per_cycle,
+                                        jack_nframes_t user_nperiods,
+                                        jack_nframes_t rate);
+
+        int	alsa_driver_reset_parameters(alsa_driver_t *driver,
+                                          jack_nframes_t frames_per_cycle,
+                                          jack_nframes_t user_nperiods,
+                                          jack_nframes_t rate);
+
+        int alsa_driver_get_channel_addresses(alsa_driver_t *driver,
+                                               snd_pcm_uframes_t *capture_avail,
+                                               snd_pcm_uframes_t *playback_avail,
+                                               snd_pcm_uframes_t *capture_offset,
+                                               snd_pcm_uframes_t *playback_offset);
+
+        jack_driver_t * alsa_driver_new(const char *name, char *playback_alsa_device,
+                                        char *capture_alsa_device,
+                                        jack_client_t *client,
+                                        jack_nframes_t frames_per_cycle,
+                                        jack_nframes_t user_nperiods,
+                                        jack_nframes_t rate,
+                                        int hw_monitoring,
+                                        int hw_metering,
+                                        int capturing,
+                                        int playing,
+                                        DitherAlgorithm dither,
+                                        int soft_mode,
+                                        int monitor,
+                                        int user_capture_nchnls,
+                                        int user_playback_nchnls,
+                                        int shorts_first,
+                                        jack_nframes_t capture_latency,
+                                        jack_nframes_t playback_latency,
+                                        alsa_midi_t *midi);
+
+        void alsa_driver_delete(alsa_driver_t *driver);
+        int alsa_driver_start(alsa_driver_t *driver);
+        int alsa_driver_stop(alsa_driver_t *driver);
+        int alsa_driver_read(alsa_driver_t *driver, jack_nframes_t nframes);
+        int alsa_driver_write(alsa_driver_t *driver, jack_nframes_t nframes);
+
+        jack_nframes_t alsa_driver_wait(alsa_driver_t *driver, int extra_fd, int *status, float
+                                         *delayed_usecs);
+
+        void alsa_driver_silence_untouched_channels(alsa_driver_t *driver,
+                jack_nframes_t nframes);
+
+        int alsa_driver_restart(alsa_driver_t *driver);
+        int alsa_driver_xrun_recovery(alsa_driver_t *driver, float *delayed_usecs);
+        void jack_driver_init(jack_driver_t *driver);
+        void jack_driver_nt_init(jack_driver_nt_t * driver);
+
+    public:
+
+        JackAlsaDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+		: JackAudioDriver(name, alias, engine, table)
+		,fDriver(NULL)
+		,fReservedCaptureDevice(-1)
+		,fReservedPlaybackDevice(-1)
+        {}
+        virtual ~JackAlsaDriver()
+        {}
+
+        int Open(jack_nframes_t buffer_size,
+                 jack_nframes_t user_nperiods,
+                 jack_nframes_t samplerate,
+                 bool hw_monitoring,
+                 bool hw_metering,
+                 bool capturing,
+                 bool playing,
+                 DitherAlgorithm dither,
+                 bool soft_mode,
+                 bool monitor,
+                 int inchannels,
+                 int outchannels,
+                 bool shorts_first,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency,
+                 const char* midi_driver_name);
+
+        int Close();
+        int Attach();
+        int Detach();
+
+        int Start();
+        int Stop();
+
+        int Read();
+        int Write();
+
+        // BufferSize can be changed
+        bool IsFixedBufferSize()
+        {
+            return false;
+        }
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+
+        // jack api emulation for the midi driver
+        int is_realtime() const;
+        int create_thread(pthread_t *thread, int prio, int rt, void *(*start_func)(void*), void *arg);
+
+        jack_port_id_t port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size);
+        int port_unregister(jack_port_id_t port_index);
+        void* port_get_buffer(int port, jack_nframes_t nframes);
+        int port_set_alias(int port, const char* name);
+
+        jack_nframes_t get_sample_rate() const;
+        jack_nframes_t frame_time() const;
+        jack_nframes_t last_frame_time() const;
+};
+
+} // end of namespace
+
+#endif
diff --git a/linux/alsa/alsa_driver.h b/linux/alsa/alsa_driver.h
new file mode 100644
index 0000000..13a7807
--- /dev/null
+++ b/linux/alsa/alsa_driver.h
@@ -0,0 +1,243 @@
+/*
+    Copyright (C) 2001 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: alsa_driver.h 945 2006-05-04 15:14:45Z pbd $
+*/
+
+#ifndef __jack_alsa_driver_h__
+#define __jack_alsa_driver_h__
+
+#include <alsa/asoundlib.h>
+#include "bitset.h"
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define IS_LE 0
+#define IS_BE 1
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define IS_LE 1
+#define IS_BE 0
+#endif
+
+#include "types.h"
+#include "hardware.h"
+#include "driver.h"
+#include "memops.h"
+#include "alsa_midi.h"
+
+typedef void (*ReadCopyFunction)  (jack_default_audio_sample_t *dst, char *src,
+                                   unsigned long src_bytes,
+                                   unsigned long src_skip_bytes);
+typedef void (*WriteCopyFunction) (char *dst, jack_default_audio_sample_t *src,
+                                   unsigned long src_bytes,
+                                   unsigned long dst_skip_bytes,
+                                   dither_state_t *state);
+typedef void (*CopyCopyFunction)  (char *dst, char *src,
+                                   unsigned long src_bytes,
+                                   unsigned long dst_skip_bytes,
+                                   unsigned long src_skip_byte);
+
+typedef struct _alsa_driver
+{
+
+    JACK_DRIVER_NT_DECL
+
+    int                           poll_timeout;
+    jack_time_t                   poll_last;
+    jack_time_t                   poll_next;
+    char                        **playback_addr;
+    char                        **capture_addr;
+    const snd_pcm_channel_area_t *capture_areas;
+    const snd_pcm_channel_area_t *playback_areas;
+    struct pollfd                *pfd;
+    unsigned int                  playback_nfds;
+    unsigned int                  capture_nfds;
+    unsigned long                 interleave_unit;
+    unsigned long                *capture_interleave_skip;
+    unsigned long                *playback_interleave_skip;
+    channel_t                     max_nchannels;
+    channel_t                     user_nchannels;
+    channel_t                     playback_nchannels;
+    channel_t                     capture_nchannels;
+    unsigned long                 playback_sample_bytes;
+    unsigned long                 capture_sample_bytes;
+
+    jack_nframes_t                frame_rate;
+    jack_nframes_t                frames_per_cycle;
+    jack_nframes_t                capture_frame_latency;
+    jack_nframes_t                playback_frame_latency;
+
+    unsigned long                *silent;
+    char                         *alsa_name_playback;
+    char                         *alsa_name_capture;
+    char                         *alsa_driver;
+    bitset_t			  channels_not_done;
+    bitset_t			  channels_done;
+    snd_pcm_format_t              playback_sample_format;
+    snd_pcm_format_t              capture_sample_format;
+    float                         max_sample_val;
+    unsigned long                 user_nperiods;
+    unsigned int                  playback_nperiods;
+    unsigned int                  capture_nperiods;
+    unsigned long                 last_mask;
+    snd_ctl_t                    *ctl_handle;
+    snd_pcm_t                    *playback_handle;
+    snd_pcm_t                    *capture_handle;
+    snd_pcm_hw_params_t          *playback_hw_params;
+    snd_pcm_sw_params_t          *playback_sw_params;
+    snd_pcm_hw_params_t          *capture_hw_params;
+    snd_pcm_sw_params_t          *capture_sw_params;
+    jack_hardware_t              *hw;
+    ClockSyncStatus              *clock_sync_data;
+    jack_client_t                *client;
+    JSList                       *capture_ports;
+    JSList                       *playback_ports;
+    JSList                       *monitor_ports;
+
+    unsigned long input_monitor_mask;
+
+    char soft_mode;
+    char hw_monitoring;
+    char hw_metering;
+    char all_monitor_in;
+    char capture_and_playback_not_synced;
+    char playback_interleaved;
+    char capture_interleaved;
+    char with_monitor_ports;
+    char has_clock_sync_reporting;
+    char has_hw_monitoring;
+    char has_hw_metering;
+    char quirk_bswap;
+
+    ReadCopyFunction read_via_copy;
+    WriteCopyFunction write_via_copy;
+    CopyCopyFunction channel_copy;
+
+    int             dither;
+    dither_state_t *dither_state;
+
+    SampleClockMode clock_mode;
+    JSList *clock_sync_listeners;
+    pthread_mutex_t clock_sync_lock;
+    unsigned long next_clock_sync_listener_id;
+
+    int running;
+    int run;
+
+    int poll_late;
+    int xrun_count;
+    int process_count;
+
+    alsa_midi_t *midi;
+    int xrun_recovery;
+
+}
+alsa_driver_t;
+
+static inline void
+alsa_driver_mark_channel_done (alsa_driver_t *driver, channel_t chn)
+{
+    bitset_remove (driver->channels_not_done, chn);
+    driver->silent[chn] = 0;
+}
+
+static inline void
+alsa_driver_silence_on_channel (alsa_driver_t *driver, channel_t chn,
+                                jack_nframes_t nframes)
+{
+    if (driver->playback_interleaved) {
+        memset_interleave
+        (driver->playback_addr[chn],
+         0, nframes * driver->playback_sample_bytes,
+         driver->interleave_unit,
+         driver->playback_interleave_skip[chn]);
+    } else {
+        memset (driver->playback_addr[chn], 0,
+                nframes * driver->playback_sample_bytes);
+    }
+    alsa_driver_mark_channel_done (driver, chn);
+}
+
+static inline void
+alsa_driver_silence_on_channel_no_mark (alsa_driver_t *driver, channel_t chn,
+                                        jack_nframes_t nframes)
+{
+    if (driver->playback_interleaved) {
+        memset_interleave
+        (driver->playback_addr[chn],
+         0, nframes * driver->playback_sample_bytes,
+         driver->interleave_unit,
+         driver->playback_interleave_skip[chn]);
+    } else {
+        memset (driver->playback_addr[chn], 0,
+                nframes * driver->playback_sample_bytes);
+    }
+}
+
+static inline void
+alsa_driver_read_from_channel (alsa_driver_t *driver,
+                               channel_t channel,
+                               jack_default_audio_sample_t *buf,
+                               jack_nframes_t nsamples)
+{
+    driver->read_via_copy (buf,
+                           driver->capture_addr[channel],
+                           nsamples,
+                           driver->capture_interleave_skip[channel]);
+}
+
+static inline void
+alsa_driver_write_to_channel (alsa_driver_t *driver,
+                              channel_t channel,
+                              jack_default_audio_sample_t *buf,
+                              jack_nframes_t nsamples)
+{
+    driver->write_via_copy (driver->playback_addr[channel],
+                            buf,
+                            nsamples,
+                            driver->playback_interleave_skip[channel],
+                            driver->dither_state + channel);
+    alsa_driver_mark_channel_done (driver, channel);
+}
+
+static inline void
+alsa_driver_copy_channel (alsa_driver_t *driver,
+                          channel_t input_channel,
+                          channel_t output_channel,
+                          jack_nframes_t nsamples)
+{
+
+    driver->channel_copy (driver->playback_addr[output_channel],
+                          driver->capture_addr[input_channel],
+                          nsamples * driver->playback_sample_bytes,
+                          driver->playback_interleave_skip[output_channel],
+                          driver->capture_interleave_skip[input_channel]);
+    alsa_driver_mark_channel_done (driver, output_channel);
+}
+
+void  alsa_driver_silence_untouched_channels (alsa_driver_t *driver,
+        jack_nframes_t nframes);
+void  alsa_driver_set_clock_sync_status (alsa_driver_t *driver, channel_t chn,
+        ClockSyncStatus status);
+int   alsa_driver_listen_for_clock_sync_status (alsa_driver_t *,
+        ClockSyncListenerFunction,
+        void *arg);
+int   alsa_driver_stop_listen_for_clock_sync_status (alsa_driver_t *,
+        unsigned int);
+void  alsa_driver_clock_sync_notify (alsa_driver_t *, channel_t chn,
+                                     ClockSyncStatus);
+
+#endif /* __jack_alsa_driver_h__ */
diff --git a/linux/alsa/alsa_midi.h b/linux/alsa/alsa_midi.h
new file mode 100644
index 0000000..1437e21
--- /dev/null
+++ b/linux/alsa/alsa_midi.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2006 Dmitry S. Baikov
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef __jack_alsa_midi_h__
+#define __jack_alsa_midi_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#else
+#include <stdbool.h>
+#endif
+
+    typedef struct alsa_midi_t alsa_midi_t;
+    struct alsa_midi_t {
+        void (*destroy)(alsa_midi_t *amidi);
+        int (*attach)(alsa_midi_t *amidi);
+        int (*detach)(alsa_midi_t *amidi);
+        int (*start)(alsa_midi_t *amidi);
+        int (*stop)(alsa_midi_t *amidi);
+        void (*read)(alsa_midi_t *amidi, jack_nframes_t nframes);
+        void (*write)(alsa_midi_t *amidi, jack_nframes_t nframes);
+    };
+
+    alsa_midi_t* alsa_rawmidi_new(jack_client_t *jack);
+    alsa_midi_t* alsa_seqmidi_new(jack_client_t *jack, const char* alsa_name);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* __jack_alsa_midi_h__ */
diff --git a/linux/alsa/alsa_midi_impl.h b/linux/alsa/alsa_midi_impl.h
new file mode 100644
index 0000000..e71e823
--- /dev/null
+++ b/linux/alsa/alsa_midi_impl.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2007 Dmitry S. Baikov
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef __jack_alsa_midi_impl_h__
+#define __jack_alsa_midi_impl_h__
+
+#include "JackConstants.h"
+
+#ifdef JACKMP
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    int JACK_is_realtime(jack_client_t *client);
+    int JACK_client_create_thread(jack_client_t *client, pthread_t *thread, int priority, int realtime, void *(*start_routine)(void*), void *arg);
+
+    jack_port_t* JACK_port_register(jack_client_t *client, const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size);
+    int JACK_port_unregister(jack_client_t *, jack_port_t*);
+    void* JACK_port_get_buffer(jack_port_t*, jack_nframes_t);
+    int JACK_port_set_alias(jack_port_t* port, const char* name);
+
+    jack_nframes_t JACK_get_sample_rate(jack_client_t *);
+    jack_nframes_t JACK_frame_time(jack_client_t *);
+    jack_nframes_t JACK_last_frame_time(jack_client_t *);
+
+#define jack_is_realtime JACK_is_realtime
+#define jack_client_create_thread JACK_client_create_thread
+
+#define jack_port_register JACK_port_register
+#define jack_port_unregister JACK_port_unregister
+#define jack_port_get_buffer JACK_port_get_buffer
+#define jack_port_set_alias JACK_port_set_alias
+
+#define jack_get_sample_rate JACK_get_sample_rate
+#define jack_frame_time JACK_frame_time
+#define jack_last_frame_time JACK_last_frame_time
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#else // usual jack
+
+#include "jack.h"
+#include "thread.h"
+
+#endif
+
+#if defined(STANDALONE)
+#define MESSAGE(...) fprintf(stderr, __VA_ARGS__)
+#elif !defined(JACKMP)
+#include <jack/messagebuffer.h>
+#endif
+
+#define info_log(...)  jack_info(__VA_ARGS__)
+#define error_log(...) jack_error(__VA_ARGS__)
+
+#ifdef ALSA_MIDI_DEBUG
+#define debug_log(...) jack_info(__VA_ARGS__)
+#else
+#define debug_log(...)
+#endif
+
+#include "alsa_midi.h"
+
+#endif /* __jack_alsa_midi_impl_h__ */
diff --git a/linux/alsa/alsa_midi_jackmp.cpp b/linux/alsa/alsa_midi_jackmp.cpp
new file mode 100644
index 0000000..1e27624
--- /dev/null
+++ b/linux/alsa/alsa_midi_jackmp.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2006,2007 Dmitry S. Baikov <c0ff at konstruktiv.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include "JackAlsaDriver.h"
+#include "JackPort.h"
+#include "alsa_midi_impl.h"
+
+using Jack::JackAlsaDriver;
+
+struct fake_port_t
+{
+    JackAlsaDriver* driver;
+    int port_id;
+    fake_port_t(JackAlsaDriver *d, int i) : driver(d), port_id(i)
+    {}
+};
+
+int JACK_is_realtime(jack_client_t* client)
+{
+    return ((JackAlsaDriver*)client)->is_realtime();
+}
+
+int JACK_client_create_thread(jack_client_t* client, pthread_t *thread, int priority, int realtime, void *(*start_routine)(void*), void *arg)
+{
+    return ((JackAlsaDriver*)client)->create_thread(thread, priority, realtime, start_routine, arg);
+}
+
+jack_port_t* JACK_port_register(jack_client_t *client, const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size)
+{
+    JackAlsaDriver *driver = (JackAlsaDriver*)client;
+    int port_id = driver->port_register(port_name, port_type, flags, buffer_size);
+    if (port_id == NO_PORT) {
+        return 0;
+    } else {
+        return (jack_port_t*) new fake_port_t(driver, port_id);
+    }
+}
+
+int JACK_port_unregister(jack_client_t *client, jack_port_t *port)
+{
+    fake_port_t* real = (fake_port_t*)port;
+    int res = real->driver->port_unregister(real->port_id);
+    delete real;
+    return res;
+}
+
+void* JACK_port_get_buffer(jack_port_t *port, jack_nframes_t nframes)
+{
+    fake_port_t* real = (fake_port_t*)port;
+    return real->driver->port_get_buffer(real->port_id, nframes);
+}
+
+int JACK_port_set_alias(jack_port_t *port, const char* name)
+{
+    fake_port_t* real = (fake_port_t*)port;
+    return real->driver->port_set_alias(real->port_id, name);
+}
+
+jack_nframes_t JACK_get_sample_rate(jack_client_t *client)
+{
+    return ((JackAlsaDriver*)client)->get_sample_rate();
+}
+
+jack_nframes_t JACK_frame_time(jack_client_t *client)
+{
+    return ((JackAlsaDriver*)client)->frame_time();
+}
+
+jack_nframes_t JACK_last_frame_time(jack_client_t *client)
+{
+    return ((JackAlsaDriver*)client)->last_frame_time();
+}
diff --git a/linux/alsa/alsa_rawmidi.c b/linux/alsa/alsa_rawmidi.c
new file mode 100644
index 0000000..62e18cd
--- /dev/null
+++ b/linux/alsa/alsa_rawmidi.c
@@ -0,0 +1,1206 @@
+/*
+ * ALSA RAWMIDI < - > JACK MIDI bridge
+ *
+ * Copyright (c) 2006,2007 Dmitry S. Baikov
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+/* Required for clock_nanosleep(). Thanks, Nedko */
+#define _GNU_SOURCE
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+#include <time.h>
+#include <limits.h>
+#include <ctype.h>
+#include <alsa/asoundlib.h>
+
+#include "ringbuffer.h"
+#include "midiport.h"
+#include "alsa_midi_impl.h"
+#include "midi_pack.h"
+#include "midi_unpack.h"
+#include "JackError.h"
+
+enum {
+	NANOSLEEP_RESOLUTION = 7000
+};
+
+#define NFRAMES_INF INT_MAX
+
+enum {
+#ifndef JACK_MIDI_DEBUG
+	MAX_PFDS = 64,
+	MAX_PORTS = MAX_PFDS-1,
+	MAX_EVENTS = 4096,
+	MAX_DATA = 64*1024,
+	MIDI_THREAD_PRIO = 80
+#else
+	MAX_PFDS = 6,
+	MAX_PORTS = MAX_PFDS-1,
+	MAX_EVENTS = 16,
+	MAX_DATA = 64,
+	MIDI_THREAD_PRIO = 80
+#endif
+};
+
+enum PortState {
+	PORT_DESTROYED,
+	PORT_CREATED,
+	PORT_ADDED_TO_JACK,
+	PORT_ADDED_TO_MIDI,
+	PORT_REMOVED_FROM_MIDI,
+	PORT_REMOVED_FROM_JACK,
+	PORT_ZOMBIFIED,
+};
+
+typedef struct {
+	int id[4]; //card, dev, dir, sub;
+} alsa_id_t;
+
+typedef struct {
+	jack_time_t time;
+	int size;
+	int overruns;
+} event_head_t;
+
+typedef struct midi_port_t midi_port_t;
+struct midi_port_t {
+	midi_port_t *next;
+
+	enum PortState state;
+
+	alsa_id_t id;
+	char dev[16];
+	char name[64];
+
+	jack_port_t *jack;
+	snd_rawmidi_t *rawmidi;
+	int npfds;
+	int is_ready;
+
+	jack_ringbuffer_t *event_ring;
+	jack_ringbuffer_t *data_ring;
+
+};
+
+typedef struct input_port_t {
+	midi_port_t base;
+
+	// jack
+	midi_unpack_t unpack;
+	
+	// midi
+	int overruns;
+} input_port_t;
+
+typedef struct output_port_t {
+	midi_port_t base;
+
+	// jack
+	midi_pack_t packer;
+	
+	// midi
+	event_head_t next_event;
+	int todo;
+} output_port_t;
+
+typedef struct alsa_rawmidi_t alsa_rawmidi_t;
+
+typedef struct {
+	alsa_rawmidi_t *midi;
+	midi_port_t *port;
+	void *buffer;
+	jack_time_t frame_time;
+	jack_nframes_t nframes;
+} process_jack_t;
+
+typedef struct {
+	alsa_rawmidi_t *midi;
+	int mode;
+	midi_port_t *port;
+	struct pollfd *rpfds;
+	struct pollfd *wpfds;
+	int max_pfds;
+	jack_nframes_t cur_frames;
+	jack_time_t cur_time;
+	jack_time_t next_time;
+} process_midi_t;
+
+typedef struct midi_stream_t {
+	alsa_rawmidi_t *owner;
+	int mode;
+	const char *name;
+	pthread_t thread;
+	int wake_pipe[2];
+
+	struct {
+		jack_ringbuffer_t *new_ports;
+		int nports;
+		midi_port_t *ports[MAX_PORTS];
+	} jack, midi;
+
+	size_t port_size;
+	int (*port_init)(alsa_rawmidi_t *midi, midi_port_t *port);
+	void (*port_close)(alsa_rawmidi_t *midi, midi_port_t *port);
+	void (*process_jack)(process_jack_t *j);
+	int (*process_midi)(process_midi_t *m);
+} midi_stream_t;
+
+
+struct alsa_rawmidi_t {
+	alsa_midi_t ops;
+
+	jack_client_t *client;
+	int keep_walking;
+
+	struct {
+		pthread_t thread;
+		midi_port_t *ports;
+		int wake_pipe[2];
+	} scan;
+
+	midi_stream_t in;
+	midi_stream_t out;
+	int midi_in_cnt;
+	int midi_out_cnt;
+};
+
+static int input_port_init(alsa_rawmidi_t *midi, midi_port_t *port);
+static void input_port_close(alsa_rawmidi_t *midi, midi_port_t *port);
+
+static void do_jack_input(process_jack_t *j);
+static int do_midi_input(process_midi_t *m);
+
+static int output_port_init(alsa_rawmidi_t *midi, midi_port_t *port);
+static void output_port_close(alsa_rawmidi_t *midi, midi_port_t *port);
+
+static void do_jack_output(process_jack_t *j);
+static int do_midi_output(process_midi_t *m);
+
+static
+int stream_init(midi_stream_t *s, alsa_rawmidi_t *midi, const char *name)
+{
+	s->owner = midi;
+	s->name = name;
+	if (pipe(s->wake_pipe)==-1) {
+		s->wake_pipe[0] = -1;
+		error_log("pipe() in stream_init(%s) failed: %s", name, strerror(errno));
+		return -errno;
+	}
+	s->jack.new_ports = jack_ringbuffer_create(sizeof(midi_port_t*)*MAX_PORTS);
+	s->midi.new_ports = jack_ringbuffer_create(sizeof(midi_port_t*)*MAX_PORTS);
+	if (!s->jack.new_ports || !s->midi.new_ports)
+		return -ENOMEM;
+	return 0;
+}
+
+static
+void stream_close(midi_stream_t *s)
+{
+	if (s->wake_pipe[0] != -1) {
+		close(s->wake_pipe[0]);
+		close(s->wake_pipe[1]);
+	}
+	if (s->jack.new_ports)
+		jack_ringbuffer_free(s->jack.new_ports);
+	if (s->midi.new_ports)
+		jack_ringbuffer_free(s->midi.new_ports);
+}
+
+static void alsa_rawmidi_delete(alsa_midi_t *m);
+static int alsa_rawmidi_attach(alsa_midi_t *m);
+static int alsa_rawmidi_detach(alsa_midi_t *m);
+static int alsa_rawmidi_start(alsa_midi_t *m);
+static int alsa_rawmidi_stop(alsa_midi_t *m);
+static void alsa_rawmidi_read(alsa_midi_t *m, jack_nframes_t nframes);
+static void alsa_rawmidi_write(alsa_midi_t *m, jack_nframes_t nframes);
+
+alsa_midi_t* alsa_rawmidi_new(jack_client_t *jack)
+{
+	alsa_rawmidi_t *midi = calloc(1, sizeof(alsa_rawmidi_t));
+	if (!midi)
+		goto fail_0;
+	midi->client = jack;
+	if (pipe(midi->scan.wake_pipe)==-1) {
+		error_log("pipe() in alsa_midi_new failed: %s", strerror(errno));
+		goto fail_1;
+	}
+
+	if (stream_init(&midi->in, midi, "in"))
+		goto fail_2;
+	midi->in.mode = POLLIN;
+	midi->in.port_size = sizeof(input_port_t);
+	midi->in.port_init = input_port_init;
+	midi->in.port_close = input_port_close;
+	midi->in.process_jack = do_jack_input;
+	midi->in.process_midi = do_midi_input;
+
+	if (stream_init(&midi->out, midi, "out"))
+		goto fail_3;
+	midi->out.mode = POLLOUT;
+	midi->out.port_size = sizeof(output_port_t);
+	midi->out.port_init = output_port_init;
+	midi->out.port_close = output_port_close;
+	midi->out.process_jack = do_jack_output;
+	midi->out.process_midi = do_midi_output;
+
+	midi->ops.destroy = alsa_rawmidi_delete;
+	midi->ops.attach = alsa_rawmidi_attach;
+	midi->ops.detach = alsa_rawmidi_detach;
+	midi->ops.start = alsa_rawmidi_start;
+	midi->ops.stop = alsa_rawmidi_stop;
+	midi->ops.read = alsa_rawmidi_read;
+	midi->ops.write = alsa_rawmidi_write;
+	midi->midi_in_cnt = 0;
+	midi->midi_out_cnt = 0;
+
+	return &midi->ops;
+ fail_3:
+ 	stream_close(&midi->out);
+ fail_2:
+ 	stream_close(&midi->in);
+ 	close(midi->scan.wake_pipe[1]);
+ 	close(midi->scan.wake_pipe[0]);
+ fail_1:
+ 	free(midi);
+ fail_0:
+	return NULL;
+}
+
+static
+midi_port_t** scan_port_del(alsa_rawmidi_t *midi, midi_port_t **list);
+
+static
+void alsa_rawmidi_delete(alsa_midi_t *m)
+{
+	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
+
+	alsa_rawmidi_detach(m);
+
+	stream_close(&midi->out);
+	stream_close(&midi->in);
+	close(midi->scan.wake_pipe[0]);
+	close(midi->scan.wake_pipe[1]);
+
+	free(midi);
+}
+
+static void* scan_thread(void *);
+static void *midi_thread(void *arg);
+
+static
+int alsa_rawmidi_attach(alsa_midi_t *m)
+{
+	return 0;
+}
+
+static
+int alsa_rawmidi_detach(alsa_midi_t *m)
+{
+	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
+	midi_port_t **list;
+
+	alsa_rawmidi_stop(m);
+
+	list = &midi->scan.ports;
+	while (*list) {
+		(*list)->state = PORT_REMOVED_FROM_JACK;
+		list = scan_port_del(midi, list);
+	}
+	return 0;
+}
+
+static
+int alsa_rawmidi_start(alsa_midi_t *m)
+{
+	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
+	int err;
+	char c = 'q';
+	if (midi->keep_walking == 1)
+		return -EALREADY;
+
+	midi->keep_walking = 1;
+	if ((err = jack_client_create_thread(midi->client, &midi->in.thread, MIDI_THREAD_PRIO, jack_is_realtime(midi->client), midi_thread, &midi->in))) {
+		midi->keep_walking = 0;
+		return err;
+	}
+	if ((err = jack_client_create_thread(midi->client, &midi->out.thread, MIDI_THREAD_PRIO, jack_is_realtime(midi->client), midi_thread, &midi->out))) {
+		midi->keep_walking = 0;
+		write(midi->in.wake_pipe[1], &c, 1);
+		pthread_join(midi->in.thread, NULL);
+		return err;
+	}
+	if ((err = jack_client_create_thread(midi->client, &midi->scan.thread, 0, 0, scan_thread, midi))) {
+		midi->keep_walking = 0;
+		write(midi->in.wake_pipe[1], &c, 1);
+		write(midi->out.wake_pipe[1], &c, 1);
+		pthread_join(midi->in.thread, NULL);
+		pthread_join(midi->out.thread, NULL);
+		return err;
+	}
+	return 0;
+}
+
+static
+int alsa_rawmidi_stop(alsa_midi_t *m)
+{
+	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
+	char c = 'q';
+	if (midi->keep_walking == 0)
+		return -EALREADY;
+	midi->keep_walking = 0;
+	write(midi->in.wake_pipe[1], &c, 1);
+	write(midi->out.wake_pipe[1], &c, 1);
+	write(midi->scan.wake_pipe[1], &c, 1);
+	pthread_join(midi->in.thread, NULL);
+	pthread_join(midi->out.thread, NULL);
+	pthread_join(midi->scan.thread, NULL);
+	// ports are freed in alsa_midi_detach()
+	return 0;
+}
+
+static void jack_process(midi_stream_t *str, jack_nframes_t nframes);
+
+static
+void alsa_rawmidi_read(alsa_midi_t *m, jack_nframes_t nframes)
+{
+	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
+	jack_process(&midi->in, nframes);
+}
+
+static
+void alsa_rawmidi_write(alsa_midi_t *m, jack_nframes_t nframes)
+{
+	alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
+	jack_process(&midi->out, nframes);
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ */
+static inline
+int can_pass(size_t sz, jack_ringbuffer_t *in, jack_ringbuffer_t *out)
+{
+	return jack_ringbuffer_read_space(in) >= sz && jack_ringbuffer_write_space(out) >= sz;
+}
+
+static
+void midi_port_init(const alsa_rawmidi_t *midi, midi_port_t *port, snd_rawmidi_info_t *info, const alsa_id_t *id)
+{
+	const char *name;
+	char *c;
+
+	port->id = *id;
+	snprintf(port->dev, sizeof(port->dev), "hw:%d,%d,%d", id->id[0], id->id[1], id->id[3]);
+	name = snd_rawmidi_info_get_subdevice_name(info);
+	if (!strlen(name))
+		name = snd_rawmidi_info_get_name(info);
+	snprintf(port->name, sizeof(port->name), "%s %s %s", port->id.id[2] ? "out":"in", port->dev, name);
+
+	// replace all offending characters with '-'
+	for (c=port->name; *c; ++c)
+	        if (!isalnum(*c))
+			*c = '-';
+
+	port->state = PORT_CREATED;
+}
+
+static
+inline int midi_port_open_jack(alsa_rawmidi_t *midi, midi_port_t *port, int type, const char *alias)
+{
+	char name[128];
+	
+	if (type & JackPortIsOutput)
+		snprintf(name, sizeof(name) - 1, "system:midi_capture_%d", ++midi->midi_in_cnt);
+	else 
+		snprintf(name, sizeof(name) - 1, "system:midi_playback_%d", ++midi->midi_out_cnt);
+
+	port->jack = jack_port_register(midi->client, name, JACK_DEFAULT_MIDI_TYPE,
+		type | JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive, 0);
+		
+	if (port->jack) 
+		jack_port_set_alias(port->jack, alias);
+	return port->jack == NULL;
+}
+
+static
+int midi_port_open(alsa_rawmidi_t *midi, midi_port_t *port)
+{
+	int err;
+	int type;
+	char name[64];
+	snd_rawmidi_t **in = NULL;
+	snd_rawmidi_t **out = NULL;
+
+	if (port->id.id[2] == 0) {
+		in = &port->rawmidi;
+		type = JackPortIsOutput;
+	} else {
+		out = &port->rawmidi;
+		type = JackPortIsInput;
+	}
+	
+	if ((err = snd_rawmidi_open(in, out, port->dev, SND_RAWMIDI_NONBLOCK))<0)
+		return err;
+
+	/* Some devices (emu10k1) have subdevs with the same name,
+	 * and we need to generate unique port name for jack */
+	snprintf(name, sizeof(name), "%s", port->name);
+	if (midi_port_open_jack(midi, port, type, name)) {
+		int num;
+		num = port->id.id[3] ? port->id.id[3] : port->id.id[1];
+		snprintf(name, sizeof(name), "%s %d", port->name, num);
+		if (midi_port_open_jack(midi, port, type, name))
+			return 2;
+	}
+	if ((port->event_ring = jack_ringbuffer_create(MAX_EVENTS*sizeof(event_head_t)))==NULL)
+		return 3;
+	if ((port->data_ring = jack_ringbuffer_create(MAX_DATA))==NULL)
+		return 4;
+
+	return 0;
+}
+
+static
+void midi_port_close(const alsa_rawmidi_t *midi, midi_port_t *port)
+{
+	if (port->data_ring) {
+		jack_ringbuffer_free(port->data_ring);
+		port->data_ring = NULL;
+	}
+	if (port->event_ring) {
+		jack_ringbuffer_free(port->event_ring);
+		port->event_ring = NULL;
+	}
+	if (port->jack) {
+		jack_port_unregister(midi->client, port->jack);
+		port->jack = NULL;
+	}
+	if (port->rawmidi) {
+		snd_rawmidi_close(port->rawmidi);
+		port->rawmidi = NULL;
+	}
+}
+
+/*
+ * ------------------------- Port scanning -------------------------------
+ */
+
+static
+int alsa_id_before(const alsa_id_t *p1, const alsa_id_t *p2)
+{
+	int i;
+	for (i=0; i<4; ++i) {
+		if (p1->id[i] < p2->id[i])
+			return 1;
+		else if (p1->id[i] > p2->id[i])
+			return 0;
+	}
+	return 0;
+}
+
+static
+void alsa_get_id(alsa_id_t *id, snd_rawmidi_info_t *info)
+{
+	id->id[0] = snd_rawmidi_info_get_card(info);
+	id->id[1] = snd_rawmidi_info_get_device(info);
+	id->id[2] = snd_rawmidi_info_get_stream(info) == SND_RAWMIDI_STREAM_OUTPUT ? 1 : 0;
+	id->id[3] = snd_rawmidi_info_get_subdevice(info);
+}
+
+#include <stdio.h>
+
+static inline
+void alsa_error(const char *func, int err)
+{
+	error_log("%s() failed", snd_strerror(err));
+}
+
+typedef struct {
+	alsa_rawmidi_t *midi;
+	midi_port_t **iterator;
+	snd_ctl_t *ctl;
+	snd_rawmidi_info_t *info;
+} scan_t;
+
+static midi_port_t** scan_port_del(alsa_rawmidi_t *midi, midi_port_t **list);
+
+static
+void scan_cleanup(alsa_rawmidi_t *midi)
+{
+	midi_port_t **list = &midi->scan.ports;
+	while (*list)
+		list = scan_port_del(midi, list);
+}
+
+static void scan_card(scan_t *scan);
+static midi_port_t** scan_port_open(alsa_rawmidi_t *midi, midi_port_t **list);
+
+void scan_cycle(alsa_rawmidi_t *midi)
+{
+	int card = -1, err;
+	scan_t scan;
+	midi_port_t **ports;
+
+	//debug_log("scan: cleanup");
+	scan_cleanup(midi);
+
+	scan.midi = midi;
+	scan.iterator = &midi->scan.ports;
+	snd_rawmidi_info_alloca(&scan.info);
+
+	//debug_log("scan: rescan");
+	while ((err = snd_card_next(&card))>=0 && card>=0) {
+		char name[32];
+		snprintf(name, sizeof(name), "hw:%d", card);
+		if ((err = snd_ctl_open(&scan.ctl, name, SND_CTL_NONBLOCK))>=0) {
+			scan_card(&scan);
+			snd_ctl_close(scan.ctl);
+		} else
+			alsa_error("scan: snd_ctl_open", err);
+	}
+
+	// delayed open to workaround alsa<1.0.14 bug (can't open more than 1 subdevice if ctl is opened).
+	ports = &midi->scan.ports;
+	while (*ports) {
+		midi_port_t *port = *ports;
+		if (port->state == PORT_CREATED)
+			ports = scan_port_open(midi, ports);
+		else
+			ports = &port->next;
+	}
+}
+
+static void scan_device(scan_t *scan);
+
+static
+void scan_card(scan_t *scan)
+{
+	int device = -1;
+	int err;
+
+	while ((err = snd_ctl_rawmidi_next_device(scan->ctl, &device))>=0 && device >=0) {
+		snd_rawmidi_info_set_device(scan->info, device);
+
+		snd_rawmidi_info_set_stream(scan->info, SND_RAWMIDI_STREAM_INPUT);
+		snd_rawmidi_info_set_subdevice(scan->info, 0);
+		if ((err = snd_ctl_rawmidi_info(scan->ctl, scan->info))>=0)
+			scan_device(scan);
+		else if (err != -ENOENT)
+			alsa_error("scan: snd_ctl_rawmidi_info on device", err);
+
+		snd_rawmidi_info_set_stream(scan->info, SND_RAWMIDI_STREAM_OUTPUT);
+		snd_rawmidi_info_set_subdevice(scan->info, 0);
+		if ((err = snd_ctl_rawmidi_info(scan->ctl, scan->info))>=0)
+			scan_device(scan);
+		else if (err != -ENOENT)
+			alsa_error("scan: snd_ctl_rawmidi_info on device", err);
+	}
+}
+
+static void scan_port_update(scan_t *scan);
+
+static
+void scan_device(scan_t *scan)
+{
+	int err;
+	int sub, nsubs = 0;
+	nsubs = snd_rawmidi_info_get_subdevices_count(scan->info);
+
+	for (sub=0; sub<nsubs; ++sub) {
+		snd_rawmidi_info_set_subdevice(scan->info, sub);
+		if ((err = snd_ctl_rawmidi_info(scan->ctl, scan->info)) < 0) {
+			alsa_error("scan: snd_ctl_rawmidi_info on subdevice", err);
+			continue;
+		}
+
+		scan_port_update(scan);
+	}
+}
+
+static midi_port_t** scan_port_add(scan_t *scan, const alsa_id_t *id, midi_port_t **list);
+
+static
+void scan_port_update(scan_t *scan)
+{
+	midi_port_t **list = scan->iterator;
+	alsa_id_t id;
+	alsa_get_id(&id, scan->info);
+
+	while (*list && alsa_id_before(&(*list)->id, &id))
+		list = scan_port_del(scan->midi, list);
+
+	if (!*list || alsa_id_before(&id, &(*list)->id))
+		list = scan_port_add(scan, &id, list);
+	else if (*list)
+		list = &(*list)->next;
+
+	scan->iterator = list;
+}
+
+static
+midi_port_t** scan_port_add(scan_t *scan, const alsa_id_t *id, midi_port_t **list)
+{
+	midi_port_t *port;
+	midi_stream_t *str = id->id[2] ? &scan->midi->out : &scan->midi->in;
+
+	port = calloc(1, str->port_size);
+	if (!port)
+		return list;
+	midi_port_init(scan->midi, port, scan->info, id);
+
+	port->next = *list;
+	*list = port;
+	info_log("scan: added port %s %s", port->dev, port->name);
+	return &port->next;
+}
+
+static
+midi_port_t** scan_port_open(alsa_rawmidi_t *midi, midi_port_t **list)
+{
+	int ret;
+	midi_stream_t *str;
+	midi_port_t *port;
+
+	port = *list;
+	str = port->id.id[2] ? &midi->out : &midi->in;
+
+	if (jack_ringbuffer_write_space(str->jack.new_ports) < sizeof(port))
+		goto fail_0;
+
+	ret = midi_port_open(midi, port);
+	if (ret)
+		goto fail_1;
+	if ((str->port_init)(midi, port))
+		goto fail_2;
+
+	port->state = PORT_ADDED_TO_JACK;
+	jack_ringbuffer_write(str->jack.new_ports, (char*) &port, sizeof(port));
+
+	info_log("scan: opened port %s %s", port->dev, port->name);
+	return &port->next;
+
+ fail_2:
+ 	(str->port_close)(midi, port);
+ fail_1:
+	midi_port_close(midi, port);
+	port->state = PORT_ZOMBIFIED;
+	error_log("scan: can't open port %s %s, error code %d, zombified", port->dev, port->name, ret);
+	return &port->next;
+ fail_0:
+	error_log("scan: can't open port %s %s", port->dev, port->name);
+	return &port->next;
+}
+
+static
+midi_port_t** scan_port_del(alsa_rawmidi_t *midi, midi_port_t **list)
+{
+	midi_port_t *port = *list;
+	if (port->state == PORT_REMOVED_FROM_JACK) {
+		info_log("scan: deleted port %s %s", port->dev, port->name);
+		*list = port->next;
+		if (port->id.id[2] )
+			(midi->out.port_close)(midi, port);
+		else
+			(midi->in.port_close)(midi, port);
+		midi_port_close(midi, port);
+		free(port);
+		return list;
+	} else {
+		//debug_log("can't delete port %s, wrong state: %d", port->name, (int)port->state);
+		return &port->next;
+	}
+}
+
+void* scan_thread(void *arg)
+{
+	alsa_rawmidi_t *midi = arg;
+	struct pollfd wakeup;
+
+	wakeup.fd = midi->scan.wake_pipe[0];
+	wakeup.events = POLLIN|POLLERR|POLLNVAL;
+	while (midi->keep_walking) {
+		int res;
+		//error_log("scanning....");
+		scan_cycle(midi);
+		res = poll(&wakeup, 1, 2000);
+		if (res>0) {
+			char c;
+			read(wakeup.fd, &c, 1);
+		} else if (res<0 && errno != EINTR)
+			break;
+	}
+	return NULL;
+}
+
+/* 
+ * ------------------------------- Input/Output  ------------------------------
+ */
+
+static
+void jack_add_ports(midi_stream_t *str)
+{
+	midi_port_t *port;
+	while (can_pass(sizeof(port), str->jack.new_ports, str->midi.new_ports) && str->jack.nports < MAX_PORTS) {
+		jack_ringbuffer_read(str->jack.new_ports, (char*)&port, sizeof(port));
+		str->jack.ports[str->jack.nports++] = port;
+		port->state = PORT_ADDED_TO_MIDI;
+		jack_ringbuffer_write(str->midi.new_ports, (char*)&port, sizeof(port));
+	}
+}
+
+static
+void jack_process(midi_stream_t *str, jack_nframes_t nframes)
+{
+	int r, w;
+	process_jack_t proc;
+	jack_nframes_t cur_frames;
+
+	if (!str->owner->keep_walking)
+		return;
+
+	proc.midi = str->owner;
+	proc.nframes = nframes;
+	proc.frame_time = jack_last_frame_time(proc.midi->client);
+	cur_frames = jack_frame_time(proc.midi->client);
+	int periods_diff = cur_frames - proc.frame_time;
+	if (periods_diff < proc.nframes) {
+		int periods_lost = periods_diff / proc.nframes;
+		proc.frame_time += periods_lost * proc.nframes;
+		debug_log("xrun detected: %d periods lost", periods_lost);
+	}
+
+	// process existing ports
+	for (r=0, w=0; r<str->jack.nports; ++r) {
+		midi_port_t *port = str->jack.ports[r];
+		proc.port = port;
+
+		assert (port->state > PORT_ADDED_TO_JACK && port->state < PORT_REMOVED_FROM_JACK);
+
+		proc.buffer = jack_port_get_buffer(port->jack, nframes);
+		if (str->mode == POLLIN)
+			jack_midi_clear_buffer(proc.buffer);
+
+		if (port->state == PORT_REMOVED_FROM_MIDI) {
+			port->state = PORT_REMOVED_FROM_JACK; // this signals to scan thread
+			continue; // this effectively removes port from the midi->in.jack.ports[]
+		}
+
+		(str->process_jack)(&proc);
+
+		if (r != w)
+			str->jack.ports[w] = port;
+		++w;
+	}
+	if (str->jack.nports != w)
+		debug_log("jack_%s: nports %d -> %d", str->name, str->jack.nports, w);
+	str->jack.nports = w;
+
+	jack_add_ports(str); // it makes no sense to add them earlier since they have no data yet
+
+	// wake midi thread
+	write(str->wake_pipe[1], &r, 1);
+}
+
+static
+void *midi_thread(void *arg)
+{
+	midi_stream_t *str = arg;
+	alsa_rawmidi_t *midi = str->owner;
+	struct pollfd pfds[MAX_PFDS];
+	int npfds;
+	jack_time_t wait_nsec = 1000*1000*1000; // 1 sec
+	process_midi_t proc;
+
+	proc.midi = midi;
+	proc.mode = str->mode;
+
+	pfds[0].fd = str->wake_pipe[0];
+	pfds[0].events = POLLIN|POLLERR|POLLNVAL;
+	npfds = 1;
+
+ 	if (jack_is_realtime(midi->client))
+	    set_threaded_log_function(); 	
+
+	//debug_log("midi_thread(%s): enter", str->name);
+
+	while (midi->keep_walking) {
+		int poll_timeout;
+		int wait_nanosleep;
+		int r=1, w=1; // read,write pos in pfds
+		int rp=0, wp=0; // read, write pos in ports
+
+		// sleep
+		//if (wait_nsec != 1000*1000*1000) {
+		//	debug_log("midi_thread(%s): ", str->name);
+		//	assert (wait_nsec == 1000*1000*1000);
+		//}
+		poll_timeout = wait_nsec / (1000*1000);
+		wait_nanosleep = wait_nsec % (1000*1000);
+		if (wait_nanosleep > NANOSLEEP_RESOLUTION) {
+			struct timespec ts;
+			ts.tv_sec = 0;
+			ts.tv_nsec = wait_nanosleep;
+			clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
+		}
+		int res = poll((struct pollfd*)&pfds, npfds, poll_timeout);
+		//debug_log("midi_thread(%s): poll exit: %d", str->name, res);
+		if (!midi->keep_walking)
+			break;
+		if (res < 0) {
+			if (errno == EINTR)
+				continue;
+			error_log("midi_thread(%s) poll failed: %s", str->name, strerror(errno));
+			break;
+		}
+
+		// check wakeup pipe
+		if (pfds[0].revents & ~POLLIN)
+			break;
+		if (pfds[0].revents & POLLIN) {
+			char c;
+			read(pfds[0].fd, &c, 1);
+		}
+
+		// add new ports
+		while (jack_ringbuffer_read_space(str->midi.new_ports) >= sizeof(midi_port_t*) && str->midi.nports < MAX_PORTS) {
+			midi_port_t *port;
+			jack_ringbuffer_read(str->midi.new_ports, (char*)&port, sizeof(port));
+			str->midi.ports[str->midi.nports++] = port;
+			debug_log("midi_thread(%s): added port %s", str->name, port->name);
+		}
+
+//		if (res == 0)
+//			continue;
+
+		// process ports
+		proc.cur_time = 0; //jack_frame_time(midi->client);
+		proc.next_time = NFRAMES_INF;
+
+		for (rp = 0; rp < str->midi.nports; ++rp) {
+			midi_port_t *port = str->midi.ports[rp];
+			proc.cur_time = jack_frame_time(midi->client);
+			proc.port = port;
+			proc.rpfds = &pfds[r];
+			proc.wpfds = &pfds[w];
+			proc.max_pfds = MAX_PFDS - w;
+			r += port->npfds;
+			if (!(str->process_midi)(&proc)) {
+				port->state = PORT_REMOVED_FROM_MIDI; // this signals to jack thread
+				continue; // this effectively removes port from array
+			}
+			w += port->npfds;
+			if (rp != wp)
+				str->midi.ports[wp] = port;
+			++wp;
+		}
+		if (str->midi.nports != wp)
+			debug_log("midi_%s: nports %d -> %d", str->name, str->midi.nports, wp);
+		str->midi.nports = wp;
+		if (npfds != w)
+			debug_log("midi_%s: npfds %d -> %d", str->name, npfds, w);
+		npfds = w;
+
+		/*
+		 * Input : ports do not set proc.next_time.
+		 * Output: port sets proc.next_time ONLY if it does not have queued data.
+		 * So, zero timeout will not cause busy-looping.
+		 */
+		if (proc.next_time < proc.cur_time) {
+			debug_log("%s: late: next_time = %d, cur_time = %d", str->name, (int)proc.next_time, (int)proc.cur_time);
+			wait_nsec = 0; // we are late
+		} else if (proc.next_time != NFRAMES_INF) {
+			jack_time_t wait_frames = proc.next_time - proc.cur_time;
+			jack_nframes_t rate = jack_get_sample_rate(midi->client);
+			wait_nsec = (wait_frames * (1000*1000*1000)) / rate;
+			debug_log("midi_%s: timeout = %d", str->name, (int)wait_frames);
+		} else
+			wait_nsec = 1000*1000*1000;
+		//debug_log("midi_thread(%s): wait_nsec = %lld", str->name, wait_nsec);
+	}
+	return NULL;
+}
+
+static
+int midi_is_ready(process_midi_t *proc)
+{
+	midi_port_t *port = proc->port;
+	if (port->npfds) {
+		unsigned short revents = 0;
+		int res = snd_rawmidi_poll_descriptors_revents(port->rawmidi, proc->rpfds, port->npfds, &revents);
+		if (res) {
+			error_log("snd_rawmidi_poll_descriptors_revents failed on port %s with: %s", port->name, snd_strerror(res));
+			return 0;
+		}
+
+		if (revents & ~proc->mode) {
+			debug_log("midi: port %s failed", port->name);
+			return 0;
+		}
+		if (revents & proc->mode) {
+			port->is_ready = 1;
+			debug_log("midi: is_ready %s", port->name);
+		}
+	}
+	return 1;
+}
+
+static
+int midi_update_pfds(process_midi_t *proc)
+{
+	midi_port_t *port = proc->port;
+	if (port->npfds == 0) {
+		port->npfds = snd_rawmidi_poll_descriptors_count(port->rawmidi);
+		if (port->npfds > proc->max_pfds) {
+			debug_log("midi: not enough pfds for port %s", port->name);
+			return 0;
+		}
+		snd_rawmidi_poll_descriptors(port->rawmidi, proc->wpfds, port->npfds);
+	} else if (proc->rpfds != proc->wpfds) {
+		memmove(proc->wpfds, proc->rpfds, sizeof(struct pollfd) * port->npfds);
+	}
+	return 1;
+}
+
+/* 
+ * ------------------------------------ Input ------------------------------
+ */
+
+static
+int input_port_init(alsa_rawmidi_t *midi, midi_port_t *port)
+{
+	input_port_t *in = (input_port_t*)port;
+	midi_unpack_init(&in->unpack);
+	return 0;
+}
+
+static
+void input_port_close(alsa_rawmidi_t *midi, midi_port_t *port)
+{}
+
+/*
+ * Jack-level input.
+ */
+
+static
+void do_jack_input(process_jack_t *p)
+{
+	input_port_t *port = (input_port_t*) p->port;
+	event_head_t event;
+	while (jack_ringbuffer_read_space(port->base.event_ring) >= sizeof(event)) {
+		jack_ringbuffer_data_t vec[2];
+		jack_nframes_t time;
+		int i, todo;
+
+		jack_ringbuffer_read(port->base.event_ring, (char*)&event, sizeof(event));
+		// TODO: take into account possible warping
+		if ((event.time + p->nframes) < p->frame_time)
+			time = 0;
+		else if (event.time >= p->frame_time)
+			time = p->nframes -1;
+		else
+			time = event.time + p->nframes - p->frame_time;
+
+		jack_ringbuffer_get_read_vector(port->base.data_ring, vec);
+		assert ((vec[0].len + vec[1].len) >= event.size);
+
+		if (event.overruns)
+			midi_unpack_reset(&port->unpack);
+
+		todo = event.size;
+		for (i=0; i<2 && todo>0; ++i) {
+			int avail = todo < vec[i].len ? todo : vec[i].len;
+			int done = midi_unpack_buf(&port->unpack, (unsigned char*)vec[i].buf, avail, p->buffer, time);
+			if (done != avail) {
+				debug_log("jack_in: buffer overflow in port %s", port->base.name);
+				break;
+			}
+			todo -= done;
+		}
+		jack_ringbuffer_read_advance(port->base.data_ring, event.size);
+	}
+}
+
+/*
+ * Low level input.
+ */
+static
+int do_midi_input(process_midi_t *proc)
+{
+	input_port_t *port = (input_port_t*) proc->port;
+	if (!midi_is_ready(proc))
+		return 0;
+
+	if (port->base.is_ready) {
+		jack_ringbuffer_data_t vec[2];
+		int res;
+
+		jack_ringbuffer_get_write_vector(port->base.data_ring, vec);
+		if (jack_ringbuffer_write_space(port->base.event_ring) < sizeof(event_head_t) || vec[0].len < 1) {
+			port->overruns++;
+			if (port->base.npfds)
+				debug_log("midi_in: internal overflow on %s", port->base.name);
+			// remove from poll to prevent busy-looping
+			port->base.npfds = 0;
+			return 1;
+		}
+		res = snd_rawmidi_read(port->base.rawmidi, vec[0].buf, vec[0].len);
+		if (res < 0 && res != -EWOULDBLOCK) {
+			error_log("midi_in: reading from port %s failed: %s", port->base.name, snd_strerror(res));
+			return 0;
+		} else if (res > 0) {
+			event_head_t event;
+			event.time = proc->cur_time;
+			event.size = res;
+			event.overruns = port->overruns;
+			port->overruns = 0;
+			debug_log("midi_in: read %d bytes at %d", (int)event.size, (int)event.time);
+			jack_ringbuffer_write_advance(port->base.data_ring, event.size);
+			jack_ringbuffer_write(port->base.event_ring, (char*)&event, sizeof(event));
+		}
+		port->base.is_ready = 0;
+	}
+
+	if (!midi_update_pfds(proc))
+		return 0;
+
+	return 1;
+}
+
+/* 
+ * ------------------------------------ Output ------------------------------
+ */
+
+static int output_port_init(alsa_rawmidi_t *midi, midi_port_t *port)
+{
+	output_port_t *out = (output_port_t*)port;
+	midi_pack_reset(&out->packer);
+	out->next_event.time = 0;
+	out->next_event.size = 0;
+	out->todo = 0;
+	return 0;
+}
+
+static void output_port_close(alsa_rawmidi_t *midi, midi_port_t *port)
+{}
+
+static
+void do_jack_output(process_jack_t *proc)
+{
+	output_port_t *port = (output_port_t*) proc->port;
+	int nevents = jack_midi_get_event_count(proc->buffer);
+	int i;
+	if (nevents)
+		debug_log("jack_out: %d events in %s", nevents, port->base.name);
+	for (i=0; i<nevents; ++i) {
+		jack_midi_event_t event;
+		event_head_t hdr;
+
+		jack_midi_event_get(&event, proc->buffer, i);
+
+		if (jack_ringbuffer_write_space(port->base.data_ring) < event.size || jack_ringbuffer_write_space(port->base.event_ring) < sizeof(hdr)) {
+			debug_log("jack_out: output buffer overflow on %s", port->base.name);
+			break;
+		}
+
+		midi_pack_event(&port->packer, &event);
+
+		jack_ringbuffer_write(port->base.data_ring, (char*)event.buffer, event.size);
+
+		hdr.time = proc->frame_time + event.time + proc->nframes;
+		hdr.size = event.size;
+		jack_ringbuffer_write(port->base.event_ring, (char*)&hdr, sizeof(hdr));
+		debug_log("jack_out: sent %d-byte event at %ld", (int)event.size, (long)event.time);
+	}
+}
+
+static
+int do_midi_output(process_midi_t *proc)
+{
+	int worked = 0;
+	output_port_t *port = (output_port_t*) proc->port;
+
+	if (!midi_is_ready(proc))
+		return 0;
+
+	// eat events
+	while (port->next_event.time <= proc->cur_time) {
+		port->todo += port->next_event.size;
+		if (jack_ringbuffer_read(port->base.event_ring, (char*)&port->next_event, sizeof(port->next_event))!=sizeof(port->next_event)) {
+			port->next_event.time = 0;
+			port->next_event.size = 0;
+			break;
+		} else
+			debug_log("midi_out: at %ld got %d bytes for %ld", (long)proc->cur_time, (int)port->next_event.size, (long)port->next_event.time);
+	}
+	
+	if (port->todo)
+		debug_log("midi_out: todo = %d at %ld", (int)port->todo, (long)proc->cur_time);
+
+	// calc next wakeup time
+	if (!port->todo && port->next_event.time && port->next_event.time < proc->next_time) {
+		proc->next_time = port->next_event.time;
+		debug_log("midi_out: next_time = %ld", (long)proc->next_time);
+	}
+
+	if (port->todo && port->base.is_ready) {
+		// write data
+		int size = port->todo;
+		int res;
+		jack_ringbuffer_data_t vec[2];
+
+		jack_ringbuffer_get_read_vector(port->base.data_ring, vec);
+		if (size > vec[0].len) {
+			size = vec[0].len;
+			assert (size > 0);
+		}
+		res = snd_rawmidi_write(port->base.rawmidi, vec[0].buf, size);
+		if (res > 0) {
+			jack_ringbuffer_read_advance(port->base.data_ring, res);
+			debug_log("midi_out: written %d bytes to %s", res, port->base.name);
+			port->todo -= res;
+			worked = 1;
+		} else if (res == -EWOULDBLOCK) {
+			port->base.is_ready = 0;
+			debug_log("midi_out: -EWOULDBLOCK on %s", port->base.name);
+			return 1;
+		} else {
+			error_log("midi_out: writing to port %s failed: %s", port->base.name, snd_strerror(res));
+			return 0;
+		}
+		snd_rawmidi_drain(port->base.rawmidi);
+	}
+
+	// update pfds for this port
+	if (!midi_update_pfds(proc))
+		return 0;
+
+	if (!port->todo) {
+		int i;
+		if (worked)
+			debug_log("midi_out: relaxing on %s", port->base.name);
+		for (i=0; i<port->base.npfds; ++i)
+			proc->wpfds[i].events &= ~POLLOUT;
+	} else {
+		int i;
+		for (i=0; i<port->base.npfds; ++i)
+			proc->wpfds[i].events |= POLLOUT;
+	}
+	return 1;
+}
diff --git a/linux/alsa/alsa_seqmidi.c b/linux/alsa/alsa_seqmidi.c
new file mode 100644
index 0000000..0abc52a
--- /dev/null
+++ b/linux/alsa/alsa_seqmidi.c
@@ -0,0 +1,915 @@
+/*
+ * ALSA SEQ < - > JACK MIDI bridge
+ *
+ * Copyright (c) 2006,2007 Dmitry S. Baikov <c0ff at konstruktiv.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+/*
+ * alsa_seqmidi_read:
+ *	add new ports
+ * 	reads queued snd_seq_event's
+ * 	if PORT_EXIT: mark port as dead
+ * 	if PORT_ADD, PORT_CHANGE: send addr to port_thread (it also may mark port as dead)
+ * 	else process input event
+ * 	remove dead ports and send them to port_thread
+ *
+ * alsa_seqmidi_write:
+ * 	remove dead ports and send them to port_thread
+ * 	add new ports
+ * 	queue output events
+ *
+ * port_thread:
+ * 	wait for port_sem
+ * 	free deleted ports
+ * 	create new ports or mark existing as dead
+ */
+
+#include <alsa/asoundlib.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#include <semaphore.h>
+#include <pthread.h>
+#include <time.h>
+#include <ctype.h>
+
+#include "midiport.h"
+#include "ringbuffer.h"
+#include "alsa_midi_impl.h"
+#include "JackError.h"
+
+#define NSEC_PER_SEC ((int64_t)1000*1000*1000)
+
+enum {
+	MAX_PORTS = 64,
+	MAX_EVENT_SIZE = 1024,
+};
+
+typedef struct port_t port_t;
+
+enum {
+	PORT_HASH_BITS = 4,
+	PORT_HASH_SIZE = 1 << PORT_HASH_BITS
+};
+
+typedef port_t* port_hash_t[PORT_HASH_SIZE];
+
+struct port_t {
+	port_t *next;
+	int is_dead;
+	char name[64];
+	snd_seq_addr_t remote;
+	jack_port_t *jack_port;
+
+	jack_ringbuffer_t *early_events; // alsa_midi_event_t + data
+	int64_t last_out_time;
+
+	void *jack_buf;
+};
+
+typedef struct {
+	snd_midi_event_t *codec;
+
+	jack_ringbuffer_t *new_ports;
+
+	port_t *ports[MAX_PORTS];
+} stream_t;
+
+typedef struct alsa_seqmidi {
+	alsa_midi_t ops;
+	jack_client_t *jack;
+
+	snd_seq_t *seq;
+	int client_id;
+	int port_id;
+	int queue;
+
+	int keep_walking;
+
+	pthread_t port_thread;
+	sem_t port_sem;
+	jack_ringbuffer_t *port_add; // snd_seq_addr_t
+	jack_ringbuffer_t *port_del; // port_t*
+
+	stream_t stream[2];
+
+	char alsa_name[32];
+	int midi_in_cnt;
+	int midi_out_cnt;
+} alsa_seqmidi_t;
+
+struct alsa_midi_event {
+	int64_t time;
+	int size;
+};
+typedef struct alsa_midi_event alsa_midi_event_t;
+
+struct process_info {
+	int dir;
+	jack_nframes_t nframes;
+	jack_nframes_t period_start;
+	jack_nframes_t sample_rate;
+	jack_nframes_t cur_frames;
+	int64_t alsa_time;
+};
+
+enum PortType { PORT_INPUT = 0, PORT_OUTPUT = 1 };
+
+typedef void (*port_jack_func)(alsa_seqmidi_t *self, port_t *port,struct process_info* info);
+static void do_jack_input(alsa_seqmidi_t *self, port_t *port, struct process_info* info);
+static void do_jack_output(alsa_seqmidi_t *self, port_t *port, struct process_info* info);
+
+typedef struct {
+	int alsa_mask;
+	int jack_caps;
+	char name[9];
+	port_jack_func jack_func;
+} port_type_t;
+
+static port_type_t port_type[2] = {
+	{
+		SND_SEQ_PORT_CAP_SUBS_READ,
+		JackPortIsOutput,
+		"playback",
+		do_jack_input
+	},
+	{
+		SND_SEQ_PORT_CAP_SUBS_WRITE,
+		JackPortIsInput,
+		"capture",
+		do_jack_output
+	}
+};
+
+static void alsa_seqmidi_delete(alsa_midi_t *m);
+static int alsa_seqmidi_attach(alsa_midi_t *m);
+static int alsa_seqmidi_detach(alsa_midi_t *m);
+static int alsa_seqmidi_start(alsa_midi_t *m);
+static int alsa_seqmidi_stop(alsa_midi_t *m);
+static void alsa_seqmidi_read(alsa_midi_t *m, jack_nframes_t nframes);
+static void alsa_seqmidi_write(alsa_midi_t *m, jack_nframes_t nframes);
+
+static
+void stream_init(alsa_seqmidi_t *self, int dir)
+{
+	stream_t *str = &self->stream[dir];
+
+	str->new_ports = jack_ringbuffer_create(MAX_PORTS*sizeof(port_t*));
+	snd_midi_event_new(MAX_EVENT_SIZE, &str->codec);
+}
+
+static void port_free(alsa_seqmidi_t *self, port_t *port);
+static void free_ports(alsa_seqmidi_t *self, jack_ringbuffer_t *ports);
+
+static
+void stream_attach(alsa_seqmidi_t *self, int dir)
+{
+}
+
+static
+void stream_detach(alsa_seqmidi_t *self, int dir)
+{
+	stream_t *str = &self->stream[dir];
+	int i;
+
+	free_ports(self, str->new_ports);
+
+	// delete all ports from hash
+	for (i=0; i<PORT_HASH_SIZE; ++i) {
+		port_t *port = str->ports[i];
+		while (port) {
+			port_t *next = port->next;
+			port_free(self, port);
+			port = next;
+		}
+		str->ports[i] = NULL;
+	}
+}
+
+static
+void stream_close(alsa_seqmidi_t *self, int dir)
+{
+	stream_t *str = &self->stream[dir];
+
+	if (str->codec)
+		snd_midi_event_free(str->codec);
+	if (str->new_ports)
+		jack_ringbuffer_free(str->new_ports);
+}
+
+alsa_midi_t* alsa_seqmidi_new(jack_client_t *client, const char* alsa_name)
+{
+	alsa_seqmidi_t *self = calloc(1, sizeof(alsa_seqmidi_t));
+	debug_log("midi: new");
+	if (!self)
+		return NULL;
+	self->jack = client;
+	if (!alsa_name)
+		alsa_name = "jack_midi";
+	snprintf(self->alsa_name, sizeof(self->alsa_name), "%s", alsa_name);
+
+	self->port_add = jack_ringbuffer_create(2*MAX_PORTS*sizeof(snd_seq_addr_t));
+	self->port_del = jack_ringbuffer_create(2*MAX_PORTS*sizeof(port_t*));
+	sem_init(&self->port_sem, 0, 0);
+
+	stream_init(self, PORT_INPUT);
+	stream_init(self, PORT_OUTPUT);
+
+	self->midi_in_cnt = 0;
+	self->midi_out_cnt = 0;
+	self->ops.destroy = alsa_seqmidi_delete;
+	self->ops.attach = alsa_seqmidi_attach;
+	self->ops.detach = alsa_seqmidi_detach;
+	self->ops.start = alsa_seqmidi_start;
+	self->ops.stop = alsa_seqmidi_stop;
+	self->ops.read = alsa_seqmidi_read;
+	self->ops.write = alsa_seqmidi_write;
+	return &self->ops;
+}
+
+static
+void alsa_seqmidi_delete(alsa_midi_t *m)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+
+	debug_log("midi: delete");
+	alsa_seqmidi_detach(m);
+
+	stream_close(self, PORT_OUTPUT);
+	stream_close(self, PORT_INPUT);
+
+	jack_ringbuffer_free(self->port_add);
+	jack_ringbuffer_free(self->port_del);
+	sem_close(&self->port_sem);
+
+	free(self);
+}
+
+static
+int alsa_seqmidi_attach(alsa_midi_t *m)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+	int err;
+
+	debug_log("midi: attach");
+
+	if (self->seq)
+		return -EALREADY;
+
+	if ((err = snd_seq_open(&self->seq, "hw", SND_SEQ_OPEN_DUPLEX, 0)) < 0) {
+		error_log("failed to open alsa seq");
+		return err;
+	}
+	snd_seq_set_client_name(self->seq, self->alsa_name);
+	self->port_id = snd_seq_create_simple_port(self->seq, "port",
+		SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_WRITE
+#ifndef JACK_MIDI_DEBUG
+		|SND_SEQ_PORT_CAP_NO_EXPORT
+#endif
+		,SND_SEQ_PORT_TYPE_APPLICATION);
+	self->client_id = snd_seq_client_id(self->seq);
+
+  	self->queue = snd_seq_alloc_queue(self->seq);
+  	snd_seq_start_queue(self->seq, self->queue, 0); 
+
+	stream_attach(self, PORT_INPUT);
+	stream_attach(self, PORT_OUTPUT);
+
+	snd_seq_nonblock(self->seq, 1);
+
+	return 0;
+}
+
+static
+int alsa_seqmidi_detach(alsa_midi_t *m)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+
+	debug_log("midi: detach");
+
+	if (!self->seq)
+		return -EALREADY;
+
+	alsa_seqmidi_stop(m);
+
+	jack_ringbuffer_reset(self->port_add);
+	free_ports(self, self->port_del);
+
+	stream_detach(self, PORT_INPUT);
+	stream_detach(self, PORT_OUTPUT);
+
+	snd_seq_close(self->seq);
+	self->seq = NULL;
+
+	return 0;
+}
+
+static void* port_thread(void *);
+
+static void add_existing_ports(alsa_seqmidi_t *self);
+static void update_ports(alsa_seqmidi_t *self);
+static void add_ports(stream_t *str);
+
+static
+int alsa_seqmidi_start(alsa_midi_t *m)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+	int err;
+
+	debug_log("midi: start");
+
+	if (!self->seq)
+		return -EBADF;
+
+	if (self->keep_walking)
+		return -EALREADY;
+
+	snd_seq_connect_from(self->seq, self->port_id, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
+	snd_seq_drop_input(self->seq);
+
+	add_existing_ports(self);
+	update_ports(self);
+	add_ports(&self->stream[PORT_INPUT]);
+	add_ports(&self->stream[PORT_OUTPUT]);
+
+	self->keep_walking = 1;
+
+	if ((err = pthread_create(&self->port_thread, NULL, port_thread, self))) {
+		self->keep_walking = 0;
+		return -errno;
+	}
+
+	return 0;
+}
+
+static
+int alsa_seqmidi_stop(alsa_midi_t *m)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+
+	debug_log("midi: stop");
+
+	if (!self->keep_walking)
+		return -EALREADY;
+
+	snd_seq_disconnect_from(self->seq, self->port_id, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
+
+	self->keep_walking = 0;
+
+	sem_post(&self->port_sem);
+	pthread_join(self->port_thread, NULL);
+	self->port_thread = 0;
+
+	return 0;
+}
+
+static
+int alsa_connect_from(alsa_seqmidi_t *self, int client, int port)
+{
+	snd_seq_port_subscribe_t* sub;
+	snd_seq_addr_t seq_addr;
+	int err;
+
+	snd_seq_port_subscribe_alloca(&sub);
+	seq_addr.client = client;
+	seq_addr.port = port;
+	snd_seq_port_subscribe_set_sender(sub, &seq_addr);
+	seq_addr.client = self->client_id;
+	seq_addr.port = self->port_id;
+	snd_seq_port_subscribe_set_dest(sub, &seq_addr);
+
+	snd_seq_port_subscribe_set_time_update(sub, 1);
+	snd_seq_port_subscribe_set_queue(sub, self->queue);
+	snd_seq_port_subscribe_set_time_real(sub, 1);
+
+	if ((err=snd_seq_subscribe_port(self->seq, sub)))
+		error_log("can't subscribe to %d:%d - %s", client, port, snd_strerror(err));
+	return err;
+}
+
+/*
+ * ==================== Port routines =============================
+ */
+static inline
+int port_hash(snd_seq_addr_t addr)
+{
+	return (addr.client + addr.port) % PORT_HASH_SIZE;
+}
+
+static
+port_t* port_get(port_hash_t hash, snd_seq_addr_t addr)
+{
+	port_t **pport = &hash[port_hash(addr)];
+	while (*pport) {
+		port_t *port = *pport;
+		if (port->remote.client == addr.client && port->remote.port == addr.port)
+			return port;
+		pport = &port->next;
+	}
+	return NULL;
+}
+
+static
+void port_insert(port_hash_t hash, port_t *port)
+{
+	port_t **pport = &hash[port_hash(port->remote)];
+	port->next = *pport;
+	*pport = port;
+}
+
+static
+void port_setdead(port_hash_t hash, snd_seq_addr_t addr)
+{
+	port_t *port = port_get(hash, addr);
+	if (port)
+		port->is_dead = 1; // see jack_process
+	else
+		debug_log("port_setdead: not found (%d:%d)", addr.client, addr.port);
+}
+
+static
+void port_free(alsa_seqmidi_t *self, port_t *port)
+{
+	//snd_seq_disconnect_from(self->seq, self->port_id, port->remote.client, port->remote.port);
+	//snd_seq_disconnect_to(self->seq, self->port_id, port->remote.client, port->remote.port);
+	if (port->early_events)
+		jack_ringbuffer_free(port->early_events);
+	if (port->jack_port)
+		jack_port_unregister(self->jack, port->jack_port);
+	info_log("port deleted: %s", port->name);
+
+	free(port);
+}
+
+static
+port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const snd_seq_port_info_t *info)
+{
+	snd_seq_client_info_t* client_info;
+	port_t *port;
+	char *c;
+	int err;
+	int jack_caps;
+        char name[128];
+
+	port = calloc(1, sizeof(port_t));
+	if (!port)
+		return NULL;
+
+	port->remote = addr;
+
+	snd_seq_client_info_alloca (&client_info);
+	snd_seq_get_any_client_info (self->seq, addr.client, client_info);
+
+	snprintf(port->name, sizeof(port->name), "alsa_pcm:%s/midi_%s_%d",
+		 snd_seq_client_info_get_name(client_info), port_type[type].name, addr.port+1);
+
+	// replace all offending characters by -
+	for (c = port->name; *c; ++c)
+		if (!isalnum(*c) && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')')
+			*c = '-';
+
+	jack_caps = port_type[type].jack_caps;
+
+	/* mark anything that looks like a hardware port as physical&terminal */
+
+	if (snd_seq_port_info_get_type (info) & (SND_SEQ_PORT_TYPE_HARDWARE|SND_SEQ_PORT_TYPE_PORT|SND_SEQ_PORT_TYPE_SPECIFIC)) {
+		jack_caps |= (JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive);
+	}
+
+	if (jack_caps & JackPortIsOutput)
+		snprintf(name, sizeof(name) - 1, "system:midi_capture_%d", ++self->midi_in_cnt);
+	else 
+		snprintf(name, sizeof(name) - 1, "system:midi_playback_%d", ++self->midi_out_cnt);
+			
+	port->jack_port = jack_port_register(self->jack,
+		name, JACK_DEFAULT_MIDI_TYPE, jack_caps, 0);
+	if (!port->jack_port)
+		goto failed;
+
+	jack_port_set_alias (port->jack_port, port->name);
+
+	/* generate an alias */
+
+	snprintf(port->name, sizeof(port->name), "%s:midi/%s_%d",
+		 snd_seq_client_info_get_name (client_info), port_type[type].name, addr.port+1);
+
+	// replace all offending characters by -
+	for (c = port->name; *c; ++c)
+		if (!isalnum(*c) && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')')
+			*c = '-';
+
+	jack_port_set_alias (port->jack_port, port->name);
+
+	if (type == PORT_INPUT)
+		err = alsa_connect_from(self, port->remote.client, port->remote.port);
+	else
+		err = snd_seq_connect_to(self->seq, self->port_id, port->remote.client, port->remote.port);
+	if (err)
+		goto failed;
+
+	port->early_events = jack_ringbuffer_create(MAX_EVENT_SIZE*16);
+
+	info_log("port created: %s", port->name);
+	return port;
+
+ failed:
+ 	port_free(self, port);
+	return NULL;
+}
+
+/*
+ * ==================== Port add/del handling thread ==============================
+ */
+static
+void update_port_type(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, int caps, const snd_seq_port_info_t *info)
+{
+	stream_t *str = &self->stream[type];
+	int alsa_mask = port_type[type].alsa_mask;
+	port_t *port = port_get(str->ports, addr);
+
+	debug_log("update_port_type(%d:%d)", addr.client, addr.port);
+
+	if (port && (caps & alsa_mask)!=alsa_mask) {
+		debug_log("setdead: %s", port->name);
+		port->is_dead = 1;
+	}
+
+	if (!port && (caps & alsa_mask)==alsa_mask) {
+		assert (jack_ringbuffer_write_space(str->new_ports) >= sizeof(port));
+		port = port_create(self, type, addr, info);
+		if (port)
+			jack_ringbuffer_write(str->new_ports, (char*)&port, sizeof(port));
+	}
+}
+
+static
+void update_port(alsa_seqmidi_t *self, snd_seq_addr_t addr, const snd_seq_port_info_t *info)
+{
+	unsigned int port_caps = snd_seq_port_info_get_capability(info);
+	if (port_caps & SND_SEQ_PORT_CAP_NO_EXPORT)
+		return;
+	update_port_type(self, PORT_INPUT, addr, port_caps, info);
+	update_port_type(self, PORT_OUTPUT,addr, port_caps, info);
+}
+
+static
+void free_ports(alsa_seqmidi_t *self, jack_ringbuffer_t *ports)
+{
+	port_t *port;
+	int sz;
+	while ((sz = jack_ringbuffer_read(ports, (char*)&port, sizeof(port)))) {
+		assert (sz == sizeof(port));
+		port_free(self, port);
+	}
+}
+
+static
+void update_ports(alsa_seqmidi_t *self)
+{
+	snd_seq_addr_t addr;
+	snd_seq_port_info_t *info;
+	int size;
+
+	snd_seq_port_info_alloca(&info);
+
+	while ((size = jack_ringbuffer_read(self->port_add, (char*)&addr, sizeof(addr)))) {
+		
+		int err;
+
+		assert (size == sizeof(addr));
+		assert (addr.client != self->client_id);
+		if ((err=snd_seq_get_any_port_info(self->seq, addr.client, addr.port, info))>=0) {
+			update_port(self, addr, info);
+		} else {
+			//port_setdead(self->stream[PORT_INPUT].ports, addr);
+			//port_setdead(self->stream[PORT_OUTPUT].ports, addr);
+		}
+	}
+}
+
+static
+void* port_thread(void *arg)
+{
+	alsa_seqmidi_t *self = arg;
+
+	while (self->keep_walking) {
+		sem_wait(&self->port_sem);
+		free_ports(self, self->port_del);
+		update_ports(self);
+	}
+	debug_log("port_thread exited");
+	return NULL;
+}
+
+static
+void add_existing_ports(alsa_seqmidi_t *self)
+{
+	snd_seq_addr_t addr;
+	snd_seq_client_info_t *client_info;
+	snd_seq_port_info_t *port_info;
+
+	snd_seq_client_info_alloca(&client_info);
+	snd_seq_port_info_alloca(&port_info);
+	snd_seq_client_info_set_client(client_info, -1);
+	while (snd_seq_query_next_client(self->seq, client_info) >= 0)
+	{
+		addr.client = snd_seq_client_info_get_client(client_info);
+		if (addr.client == SND_SEQ_CLIENT_SYSTEM || addr.client == self->client_id)
+			continue;
+		snd_seq_port_info_set_client(port_info, addr.client);
+		snd_seq_port_info_set_port(port_info, -1);
+		while (snd_seq_query_next_port(self->seq, port_info) >= 0)
+		{
+			addr.port = snd_seq_port_info_get_port(port_info);
+			update_port(self, addr, port_info);
+		}
+	}
+}
+
+/*
+ * =================== Input/output port handling =========================
+ */
+static
+void set_process_info(struct process_info *info, alsa_seqmidi_t *self, int dir, jack_nframes_t nframes)
+{
+	const snd_seq_real_time_t* alsa_time;
+	snd_seq_queue_status_t *status;
+
+	snd_seq_queue_status_alloca(&status);
+
+	info->dir = dir;
+
+	info->period_start = jack_last_frame_time(self->jack);
+	info->nframes = nframes;
+	info->sample_rate = jack_get_sample_rate(self->jack);
+
+	info->cur_frames = jack_frame_time(self->jack);
+
+	// immediately get alsa'a real time (uhh, why everybody has their own 'real' time)
+	snd_seq_get_queue_status(self->seq, self->queue, status);
+	alsa_time = snd_seq_queue_status_get_real_time(status);
+	info->alsa_time = alsa_time->tv_sec * NSEC_PER_SEC + alsa_time->tv_nsec;
+
+	if (info->period_start + info->nframes < info->cur_frames) {
+		int periods_lost = (info->cur_frames - info->period_start) / info->nframes; 
+		info->period_start += periods_lost * info->nframes;
+		debug_log("xrun detected: %d periods lost\n", periods_lost);
+	}
+}
+
+static
+void add_ports(stream_t *str)
+{
+	port_t *port;
+	while (jack_ringbuffer_read(str->new_ports, (char*)&port, sizeof(port))) {
+		debug_log("jack: inserted port %s\n", port->name);
+		port_insert(str->ports, port);
+	}
+}
+
+static
+void jack_process(alsa_seqmidi_t *self, struct process_info *info)
+{
+	stream_t *str = &self->stream[info->dir];
+	port_jack_func process = port_type[info->dir].jack_func;
+	int i, del=0;
+
+	add_ports(str);
+
+	// process ports
+	for (i=0; i<PORT_HASH_SIZE; ++i) {
+		port_t **pport = &str->ports[i];
+		while (*pport) {
+			port_t *port = *pport;
+			port->jack_buf = jack_port_get_buffer(port->jack_port, info->nframes);
+			if (info->dir == PORT_INPUT)
+				jack_midi_clear_buffer(port->jack_buf);
+
+			if (!port->is_dead)
+				(*process)(self, port, info);
+			else if (jack_ringbuffer_write_space(self->port_del) >= sizeof(port)) {
+				debug_log("jack: removed port %s", port->name);
+				*pport = port->next;
+				jack_ringbuffer_write(self->port_del, (char*)&port, sizeof(port));
+				del++;
+				continue;
+			}
+
+			pport = &port->next;
+		}
+	}
+
+	if (del)
+		sem_post(&self->port_sem);
+}
+
+/*
+ * ============================ Input ==============================
+ */
+static
+void do_jack_input(alsa_seqmidi_t *self, port_t *port, struct process_info *info)
+{
+	// process port->early_events
+	alsa_midi_event_t ev;
+	while (jack_ringbuffer_read(port->early_events, (char*)&ev, sizeof(ev))) {
+		jack_midi_data_t* buf;
+		jack_nframes_t time = ev.time - info->period_start;
+		if (time < 0)
+			time = 0;
+		else if (time >= info->nframes)
+			time = info->nframes - 1;
+		buf = jack_midi_event_reserve(port->jack_buf, (jack_nframes_t)time, ev.size);
+		if (buf)
+			jack_ringbuffer_read(port->early_events, (char*)buf, ev.size);
+		else
+			jack_ringbuffer_read_advance(port->early_events, ev.size);
+		debug_log("input: it's time for %d bytes at %lld", ev.size, time);
+	}
+}
+
+static
+void port_event(alsa_seqmidi_t *self, snd_seq_event_t *ev)
+{
+	const snd_seq_addr_t addr = ev->data.addr;
+
+	if (addr.client == self->client_id)
+		return;
+
+	if (ev->type == SND_SEQ_EVENT_PORT_START || ev->type == SND_SEQ_EVENT_PORT_CHANGE) {
+		assert (jack_ringbuffer_write_space(self->port_add) >= sizeof(addr));
+
+		debug_log("port_event: add/change %d:%d", addr.client, addr.port);
+		jack_ringbuffer_write(self->port_add, (char*)&addr, sizeof(addr));
+		sem_post(&self->port_sem);
+	} else if (ev->type == SND_SEQ_EVENT_PORT_EXIT) {
+		debug_log("port_event: del %d:%d", addr.client, addr.port);
+		port_setdead(self->stream[PORT_INPUT].ports, addr);
+		port_setdead(self->stream[PORT_OUTPUT].ports, addr);
+	}
+}
+
+static
+void input_event(alsa_seqmidi_t *self, snd_seq_event_t *alsa_event, struct process_info* info)
+{
+	jack_midi_data_t data[MAX_EVENT_SIZE];
+	stream_t *str = &self->stream[PORT_INPUT];
+	long size;
+	int64_t alsa_time, time_offset;
+	int64_t frame_offset, event_frame;
+	port_t *port;
+
+	port = port_get(str->ports, alsa_event->source);
+	if (!port)
+		return;
+
+	/*
+	 * RPNs, NRPNs, Bank Change, etc. need special handling
+	 * but seems, ALSA does it for us already.
+	 */
+	snd_midi_event_reset_decode(str->codec);
+	if ((size = snd_midi_event_decode(str->codec, data, sizeof(data), alsa_event))<0)
+		return;
+
+	// fixup NoteOn with vel 0
+	if ((data[0] & 0xF0) == 0x90 && data[2] == 0x00) {
+		data[0] = 0x80 + (data[0] & 0x0F);
+		data[2] = 0x40;
+	}
+
+	alsa_time = alsa_event->time.time.tv_sec * NSEC_PER_SEC + alsa_event->time.time.tv_nsec;
+	time_offset = info->alsa_time - alsa_time;
+	frame_offset = (info->sample_rate * time_offset) / NSEC_PER_SEC;
+	event_frame = (int64_t)info->cur_frames - info->period_start - frame_offset + info->nframes;
+
+	debug_log("input: %d bytes at event_frame = %d", (int)size, (int)event_frame);
+
+	if (event_frame >= info->nframes &&
+	    jack_ringbuffer_write_space(port->early_events) >= (sizeof(alsa_midi_event_t) + size)) {
+		alsa_midi_event_t ev;
+		ev.time = event_frame + info->period_start;
+		ev.size = size;
+		jack_ringbuffer_write(port->early_events, (char*)&ev, sizeof(ev));
+		jack_ringbuffer_write(port->early_events, (char*)data, size);
+		debug_log("postponed to next frame +%d", (int) (event_frame - info->nframes)); 
+		return;
+	}
+
+	if (event_frame < 0)
+		event_frame = 0;
+	else if (event_frame >= info->nframes)
+		event_frame = info->nframes - 1;
+
+	jack_midi_event_write(port->jack_buf, event_frame, data, size);
+}
+
+static
+void alsa_seqmidi_read(alsa_midi_t *m, jack_nframes_t nframes)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+	int res;
+	snd_seq_event_t *event;
+	struct process_info info;
+
+	if (!self->keep_walking)
+		return;
+
+	set_process_info(&info, self, PORT_INPUT, nframes);
+	jack_process(self, &info); 
+
+	while ((res = snd_seq_event_input(self->seq, &event))>0) {
+		if (event->source.client == SND_SEQ_CLIENT_SYSTEM)
+			port_event(self, event);
+		else
+			input_event(self, event, &info);
+	}
+}
+
+/*
+ * ============================ Output ==============================
+ */
+
+static
+void do_jack_output(alsa_seqmidi_t *self, port_t *port, struct process_info* info)
+{
+	stream_t *str = &self->stream[info->dir];
+	int nevents = jack_midi_get_event_count(port->jack_buf);
+	int i;
+	for (i=0; i<nevents; ++i) {
+		jack_midi_event_t jack_event;
+		snd_seq_event_t alsa_event;
+		int64_t frame_offset;
+		int64_t out_time;
+		snd_seq_real_time_t out_rt;
+		int err;
+
+		jack_midi_event_get(&jack_event, port->jack_buf, i);
+
+		snd_seq_ev_clear(&alsa_event);
+		snd_midi_event_reset_encode(str->codec);
+		if (!snd_midi_event_encode(str->codec, jack_event.buffer, jack_event.size, &alsa_event))
+			continue; // invalid event
+
+		snd_seq_ev_set_source(&alsa_event, self->port_id);
+		snd_seq_ev_set_dest(&alsa_event, port->remote.client, port->remote.port);
+
+		/* NOTE: in case of xrun it could become negative, so it is essential to use signed type! */
+		frame_offset = (int64_t)jack_event.time + info->period_start + info->nframes - info->cur_frames;
+		if (frame_offset < 0) {
+			frame_offset = info->nframes + jack_event.time;
+			error_log("internal xrun detected: frame_offset = %"PRId64"\n", frame_offset);
+		}
+		/* Ken Ellinwood reported problems with this assert.
+		 * Seems, magic 2 should be replaced with nperiods. */
+		//FIXME: assert (frame_offset < info->nframes*2);
+		//if (frame_offset < info->nframes * info->nperiods)
+		//        debug_log("alsa_out: BLAH-BLAH-BLAH");
+
+		out_time = info->alsa_time + (frame_offset * NSEC_PER_SEC) / info->sample_rate;
+
+		debug_log("alsa_out: frame_offset = %lld, info->alsa_time = %lld, out_time = %lld, port->last_out_time = %lld",
+			frame_offset, info->alsa_time, out_time, port->last_out_time);
+
+		// we should use absolute time to prevent reordering caused by rounding errors
+		if (out_time < port->last_out_time) {
+			debug_log("alsa_out: limiting out_time %lld at %lld", out_time, port->last_out_time);
+			out_time = port->last_out_time;
+		} else
+			port->last_out_time = out_time;
+
+		out_rt.tv_nsec = out_time % NSEC_PER_SEC;
+		out_rt.tv_sec = out_time / NSEC_PER_SEC;
+		snd_seq_ev_schedule_real(&alsa_event, self->queue, 0, &out_rt);
+
+		err = snd_seq_event_output(self->seq, &alsa_event);
+		debug_log("alsa_out: written %d bytes to %s at %+d (%lld): %d", (int)jack_event.size, port->name, (int)frame_offset, out_time, err);
+	}
+}
+
+static
+void alsa_seqmidi_write(alsa_midi_t *m, jack_nframes_t nframes)
+{
+	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
+	struct process_info info;
+
+	if (!self->keep_walking)
+		return;
+
+	set_process_info(&info, self, PORT_OUTPUT, nframes);
+	jack_process(self, &info);
+	snd_seq_drain_output(self->seq);
+}
diff --git a/linux/alsa/bitset.h b/linux/alsa/bitset.h
new file mode 100644
index 0000000..048b5fb
--- /dev/null
+++ b/linux/alsa/bitset.h
@@ -0,0 +1,132 @@
+/*
+* bitset.h -- some simple bit vector set operations.
+*
+* This is useful for sets of small non-negative integers.  There are
+* some obvious set operations that are not implemented because I
+* don't need them right now.
+*
+* These functions represent sets as arrays of unsigned 32-bit
+* integers allocated on the heap.  The first entry contains the set
+* cardinality (number of elements allowed), followed by one or more
+* words containing bit vectors.
+*
+*  $Id: bitset.h,v 1.2 2005/11/23 11:24:29 letz Exp $
+*/
+
+/*
+ *  Copyright (C) 2005 Jack O'Quin
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License as
+ *  published by the Free Software Foundation; either version 2 of the
+ *  License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __bitset_h__
+#define __bitset_h__
+
+#include <inttypes.h>			/* POSIX standard fixed-size types */
+#include <assert.h>			/* `#define NDEBUG' to disable */
+
+/* On some 64-bit machines, this implementation may be slightly
+ * inefficient, depending on how compilers allocate space for
+ * uint32_t.  For the set sizes I currently need, this is acceptable.
+ * It should not be hard to pack the bits better, if that becomes
+ * worthwhile.
+ */
+typedef uint32_t _bitset_word_t;
+typedef _bitset_word_t *bitset_t;
+
+#define WORD_SIZE(cardinality) (1+((cardinality)+31)/32)
+#define BYTE_SIZE(cardinality) (WORD_SIZE(cardinality)*sizeof(_bitset_word_t))
+#define WORD_INDEX(element) (1+(element)/32)
+#define BIT_INDEX(element) ((element)&037)
+
+static inline void
+bitset_add(bitset_t set
+               , unsigned int element)
+{
+    assert(element < set
+               [0]);
+    set
+        [WORD_INDEX(element)] |= (1 << BIT_INDEX(element));
+}
+
+static inline void
+bitset_copy(bitset_t to_set, bitset_t from_set)
+{
+    assert(to_set[0] == from_set[0]);
+    memcpy(to_set, from_set, BYTE_SIZE(to_set[0]));
+}
+
+static inline void
+bitset_create(bitset_t *set
+              , unsigned int cardinality)
+{
+    *set
+    = (bitset_t) calloc(WORD_SIZE(cardinality),
+                        sizeof(_bitset_word_t));
+    assert(*set
+          );
+    *set
+    [0] = cardinality;
+}
+
+static inline void
+bitset_destroy(bitset_t *set
+              )
+{
+    if (*set
+       ) {
+        free(*set
+            );
+        *set
+        = (bitset_t) 0;
+    }
+}
+
+static inline int
+bitset_empty(bitset_t set
+                )
+{
+    int i;
+    _bitset_word_t result = 0;
+    int nwords = WORD_SIZE(set
+                           [0]);
+    for (i = 1; i < nwords; i++) {
+        result |= set
+                      [i];
+    }
+    return (result == 0);
+}
+
+static inline int
+bitset_contains(bitset_t set
+                    , unsigned int element)
+{
+    assert(element < set
+               [0]);
+    return (0 != (set
+                  [WORD_INDEX(element)] & (1 << BIT_INDEX(element))));
+}
+
+static inline void
+bitset_remove(bitset_t set
+                  , unsigned int element)
+{
+    assert(element < set
+               [0]);
+    set
+        [WORD_INDEX(element)] &= ~(1 << BIT_INDEX(element));
+}
+
+#endif /* __bitset_h__ */
diff --git a/linux/alsa/generic.h b/linux/alsa/generic.h
new file mode 100644
index 0000000..4458aea
--- /dev/null
+++ b/linux/alsa/generic.h
@@ -0,0 +1,37 @@
+/*
+   Copyright (C) 2001 Paul Davis
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   $Id: generic.h,v 1.3 2005/11/23 11:24:29 letz Exp $
+*/
+
+#ifndef __jack_generic_h__
+#define __jack_generic_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    jack_hardware_t *
+    jack_alsa_generic_hw_new (alsa_driver_t *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __jack_generic_h__*/
diff --git a/linux/alsa/generic_hw.c b/linux/alsa/generic_hw.c
new file mode 100644
index 0000000..30e7f34
--- /dev/null
+++ b/linux/alsa/generic_hw.c
@@ -0,0 +1,56 @@
+/*
+    Copyright (C) 2001 Paul Davis 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: generic_hw.c,v 1.2 2005/08/29 10:36:28 letz Exp $
+*/
+
+#include "hardware.h"
+#include "alsa_driver.h"
+
+static int generic_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
+{
+	return -1;
+}
+
+static int generic_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
+{
+	return -1;
+}
+
+static void
+generic_release (jack_hardware_t *hw)
+{
+	return;
+}
+
+jack_hardware_t *
+jack_alsa_generic_hw_new (alsa_driver_t *driver)
+
+{
+	jack_hardware_t *hw;
+
+	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
+
+	hw->capabilities = 0;
+	hw->input_monitor_mask = 0;
+	
+	hw->set_input_monitor_mask = generic_set_input_monitor_mask;
+	hw->change_sample_clock = generic_change_sample_clock;
+	hw->release = generic_release;
+
+	return hw;
+}
diff --git a/linux/alsa/hammerfall.c b/linux/alsa/hammerfall.c
new file mode 100644
index 0000000..c2e3efe
--- /dev/null
+++ b/linux/alsa/hammerfall.c
@@ -0,0 +1,308 @@
+/*
+    Copyright (C) 2001 Paul Davis 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: hammerfall.c,v 1.3 2005/09/29 14:51:59 letz Exp $
+*/
+
+#include "hardware.h"
+#include "alsa_driver.h"
+#include "hammerfall.h"
+#include "JackError.h"
+
+#define FALSE 0
+#define TRUE 1
+
+/* Set this to 1 if you want this compile error:
+ *   warning: `hammerfall_monitor_controls' defined but not used */
+#define HAMMERFALL_MONITOR_CONTROLS 0
+
+static void 
+set_control_id (snd_ctl_elem_id_t *ctl, const char *name)
+{
+	snd_ctl_elem_id_set_name (ctl, name);
+	snd_ctl_elem_id_set_numid (ctl, 0);
+	snd_ctl_elem_id_set_interface (ctl, SND_CTL_ELEM_IFACE_MIXER);
+	snd_ctl_elem_id_set_device (ctl, 0);
+	snd_ctl_elem_id_set_subdevice (ctl, 0);
+	snd_ctl_elem_id_set_index (ctl, 0);
+}
+
+#if HAMMERFALL_MONITOR_CONTROLS
+static void
+hammerfall_broadcast_channel_status_change (hammerfall_t *h, int lock, int sync, channel_t lowchn, channel_t highchn)
+
+{
+	channel_t chn;
+	ClockSyncStatus status = 0;
+
+	if (lock) {
+		status |= Lock;
+	} else {
+		status |= NoLock;
+	}
+
+	if (sync) {
+		status |= Sync;
+	} else {
+		status |= NoSync;
+	}
+
+	for (chn = lowchn; chn < highchn; chn++) {
+		alsa_driver_set_clock_sync_status (h->driver, chn, status);
+	}
+}
+
+static void
+hammerfall_check_sync_state (hammerfall_t *h, int val, int adat_id)
+
+{
+	int lock;
+	int sync;
+
+	/* S/PDIF channel is always locked and synced, but we only
+	   need tell people once that this is TRUE.
+
+	   XXX - maybe need to make sure that the rate matches our
+	   idea of the current rate ?
+	*/
+
+	if (!h->said_that_spdif_is_fine) {
+		ClockSyncStatus status;
+		
+		status = Lock|Sync;
+
+		/* XXX broken! fix for hammerfall light ! */
+
+		alsa_driver_set_clock_sync_status (h->driver, 24, status);
+		alsa_driver_set_clock_sync_status (h->driver, 25, status);
+
+		h->said_that_spdif_is_fine = TRUE;
+	}
+
+	lock = (val & 0x1) ? TRUE : FALSE;
+	sync = (val & 0x2) ? TRUE : FALSE;
+	
+	if (h->lock_status[adat_id] != lock ||
+	    h->sync_status[adat_id] != sync) {
+		hammerfall_broadcast_channel_status_change (h, lock, sync, adat_id*8, (adat_id*8)+8);
+	}
+
+	h->lock_status[adat_id] = lock;
+	h->sync_status[adat_id] = sync;
+}
+
+static void
+hammerfall_check_sync (hammerfall_t *h, snd_ctl_elem_value_t *ctl)
+
+{
+	const char *name;
+	int val;
+	snd_ctl_elem_id_t *ctl_id;
+	
+	jack_info ("check sync");
+
+	snd_ctl_elem_id_alloca (&ctl_id);
+	snd_ctl_elem_value_get_id (ctl, ctl_id);
+
+	name = snd_ctl_elem_id_get_name (ctl_id);
+
+	if (strcmp (name, "ADAT1 Sync Check") == 0) {
+		val = snd_ctl_elem_value_get_enumerated (ctl, 0);
+		hammerfall_check_sync_state (h, val, 0);
+	} else if (strcmp (name, "ADAT2 Sync Check") == 0) {
+		val = snd_ctl_elem_value_get_enumerated (ctl, 0);
+		hammerfall_check_sync_state (h, val, 1);
+	} else if (strcmp (name, "ADAT3 Sync Check") == 0) {
+		val = snd_ctl_elem_value_get_enumerated (ctl, 0);
+		hammerfall_check_sync_state (h, val, 2);
+	} else {
+		jack_error ("Hammerfall: unknown control \"%s\"", name);
+	}
+}
+#endif /* HAMMERFALL_MONITOR_CONTROLS */
+
+static int 
+hammerfall_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
+{
+	hammerfall_t *h = (hammerfall_t *) hw->private_hw;
+	snd_ctl_elem_value_t *ctl;
+	snd_ctl_elem_id_t *ctl_id;
+	int err;
+	int i;
+	
+	snd_ctl_elem_value_alloca (&ctl);
+	snd_ctl_elem_id_alloca (&ctl_id);
+	set_control_id (ctl_id, "Channels Thru");
+	snd_ctl_elem_value_set_id (ctl, ctl_id);
+	
+	for (i = 0; i < 26; i++) {
+		snd_ctl_elem_value_set_integer (ctl, i, (mask & (1<<i)) ? 1 : 0);
+	}
+	
+	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, ctl)) != 0) {
+		jack_error ("ALSA/Hammerfall: cannot set input monitoring (%s)", snd_strerror (err));
+		return -1;
+	}
+	
+	hw->input_monitor_mask = mask;
+
+	return 0;
+}
+
+static int 
+hammerfall_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
+{
+	hammerfall_t *h = (hammerfall_t *) hw->private_hw;
+	snd_ctl_elem_value_t *ctl;
+	snd_ctl_elem_id_t *ctl_id;
+	int err;
+
+	snd_ctl_elem_value_alloca (&ctl);
+	snd_ctl_elem_id_alloca (&ctl_id);
+	set_control_id (ctl_id, "Sync Mode");
+	snd_ctl_elem_value_set_id (ctl, ctl_id);
+
+	switch (mode) {
+	case AutoSync:
+		snd_ctl_elem_value_set_enumerated (ctl, 0, 0);
+		break;
+	case ClockMaster:
+		snd_ctl_elem_value_set_enumerated (ctl, 0, 1);
+		break;
+	case WordClock:
+		snd_ctl_elem_value_set_enumerated (ctl, 0, 2);
+		break;
+	}
+
+	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, ctl)) < 0) {
+		jack_error ("ALSA-Hammerfall: cannot set clock mode");
+	}
+
+	return 0;
+}
+
+static void
+hammerfall_release (jack_hardware_t *hw)
+
+{
+	hammerfall_t *h = (hammerfall_t *) hw->private_hw;
+	void *status;
+
+	if (h == 0) {
+		return;
+	}
+
+    if (h->monitor_thread) {
+        pthread_cancel (h->monitor_thread);
+        pthread_join (h->monitor_thread, &status);
+    }
+
+	free (h);
+}
+
+#if HAMMERFALL_MONITOR_CONTROLS
+static void *
+hammerfall_monitor_controls (void *arg)
+{
+	jack_hardware_t *hw = (jack_hardware_t *) arg;
+	hammerfall_t *h = (hammerfall_t *) hw->private_hw;
+	snd_ctl_elem_id_t *switch_id[3];
+	snd_ctl_elem_value_t *sw[3];
+
+	pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
+	snd_ctl_elem_id_malloc (&switch_id[0]);
+	snd_ctl_elem_id_malloc (&switch_id[1]);
+	snd_ctl_elem_id_malloc (&switch_id[2]);
+
+	snd_ctl_elem_value_malloc (&sw[0]);
+	snd_ctl_elem_value_malloc (&sw[1]);
+	snd_ctl_elem_value_malloc (&sw[2]);
+
+	set_control_id (switch_id[0], "ADAT1 Sync Check");
+	set_control_id (switch_id[1], "ADAT2 Sync Check");
+	set_control_id (switch_id[2], "ADAT3 Sync Check");
+
+	snd_ctl_elem_value_set_id (sw[0], switch_id[0]);
+	snd_ctl_elem_value_set_id (sw[1], switch_id[1]);
+	snd_ctl_elem_value_set_id (sw[2], switch_id[2]);
+
+	while (1) {
+		if (snd_ctl_elem_read (h->driver->ctl_handle, sw[0])) {
+			jack_error ("cannot read control switch 0 ...");
+		}
+		hammerfall_check_sync (h, sw[0]);
+
+		if (snd_ctl_elem_read (h->driver->ctl_handle, sw[1])) {
+			jack_error ("cannot read control switch 0 ...");
+		}
+		hammerfall_check_sync (h, sw[1]);
+
+		if (snd_ctl_elem_read (h->driver->ctl_handle, sw[2])) {
+			jack_error ("cannot read control switch 0 ...");
+		}
+		hammerfall_check_sync (h, sw[2]);
+		
+		if (nanosleep (&h->monitor_interval, 0)) {
+			break;
+		}
+	}
+
+	pthread_exit (0);
+}
+#endif /* HAMMERFALL_MONITOR_CONTROLS */
+
+jack_hardware_t *
+jack_alsa_hammerfall_hw_new (alsa_driver_t *driver)
+{
+	jack_hardware_t *hw;
+	hammerfall_t *h;
+
+	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
+
+	hw->capabilities = Cap_HardwareMonitoring|Cap_AutoSync|Cap_WordClock|Cap_ClockMaster|Cap_ClockLockReporting;
+	hw->input_monitor_mask = 0;
+	hw->private_hw = 0;
+
+	hw->set_input_monitor_mask = hammerfall_set_input_monitor_mask;
+	hw->change_sample_clock = hammerfall_change_sample_clock;
+	hw->release = hammerfall_release;
+
+	h = (hammerfall_t *) malloc (sizeof (hammerfall_t));
+
+	h->lock_status[0] = FALSE;
+	h->sync_status[0] = FALSE;
+	h->lock_status[1] = FALSE;
+	h->sync_status[1] = FALSE;
+	h->lock_status[2] = FALSE;
+	h->sync_status[2] = FALSE;
+	h->said_that_spdif_is_fine = FALSE;
+	h->driver = driver;
+
+	h->monitor_interval.tv_sec = 1;
+	h->monitor_interval.tv_nsec = 0;
+
+	hw->private_hw = h;
+
+#if 0
+	if (pthread_create (&h->monitor_thread, 0, hammerfall_monitor_controls, hw)) {
+		jack_error ("ALSA/Hammerfall: cannot create sync monitor thread");
+	}
+#endif
+
+	return hw;
+}
diff --git a/linux/alsa/hammerfall.h b/linux/alsa/hammerfall.h
new file mode 100644
index 0000000..aeb6eb7
--- /dev/null
+++ b/linux/alsa/hammerfall.h
@@ -0,0 +1,48 @@
+/*
+   Copyright (C) 2001 Paul Davis
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   $Id: hammerfall.h,v 1.3 2005/11/23 11:24:29 letz Exp $
+*/
+
+#ifndef __jack_hammerfall_h__
+#define __jack_hammerfall_h__
+
+#include <sys/time.h>
+
+typedef struct
+{
+    int lock_status[3];
+    int sync_status[3];
+    int said_that_spdif_is_fine;
+    pthread_t monitor_thread;
+    alsa_driver_t *driver;
+    struct timespec monitor_interval;
+}
+hammerfall_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    jack_hardware_t *jack_alsa_hammerfall_hw_new (alsa_driver_t *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_hammerfall_h__*/
diff --git a/linux/alsa/hardware.h b/linux/alsa/hardware.h
new file mode 100644
index 0000000..b77dc85
--- /dev/null
+++ b/linux/alsa/hardware.h
@@ -0,0 +1,75 @@
+/*
+   Copyright (C) 2001 Paul Davis
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   $Id: hardware.h,v 1.3 2005/11/23 11:24:29 letz Exp $
+*/
+
+#ifndef __jack_hardware_h__
+#define __jack_hardware_h__
+
+#include "types.h"
+
+typedef	enum {
+    AutoSync,
+    WordClock,
+    ClockMaster
+} SampleClockMode;
+
+typedef enum {
+    Cap_HardwareMonitoring = 0x1,
+    Cap_AutoSync = 0x2,
+    Cap_WordClock = 0x4,
+    Cap_ClockMaster = 0x8,
+    Cap_ClockLockReporting = 0x10,
+    Cap_HardwareMetering = 0x20
+} Capabilities;
+
+struct _jack_hardware;
+
+typedef void (*JackHardwareReleaseFunction)(struct _jack_hardware *);
+typedef int (*JackHardwareSetInputMonitorMaskFunction)(struct _jack_hardware *, unsigned long);
+typedef int (*JackHardwareChangeSampleClockFunction)(struct _jack_hardware *, SampleClockMode);
+typedef double (*JackHardwareGetHardwarePeak)(jack_port_t *port, jack_nframes_t frames);
+typedef double (*JackHardwareGetHardwarePower)(jack_port_t *port, jack_nframes_t frames);
+
+typedef struct _jack_hardware
+{
+    unsigned long capabilities;
+    unsigned long input_monitor_mask;
+
+    JackHardwareChangeSampleClockFunction change_sample_clock;
+    JackHardwareSetInputMonitorMaskFunction set_input_monitor_mask;
+    JackHardwareReleaseFunction release;
+    JackHardwareGetHardwarePeak get_hardware_peak;
+    JackHardwareGetHardwarePower get_hardware_power;
+    void *private_hw;
+}
+jack_hardware_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    jack_hardware_t * jack_hardware_new ();
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __jack_hardware_h__ */
diff --git a/linux/alsa/hdsp.c b/linux/alsa/hdsp.c
new file mode 100644
index 0000000..64dcb40
--- /dev/null
+++ b/linux/alsa/hdsp.c
@@ -0,0 +1,232 @@
+/*
+    Copyright (C) 2001 Paul Davis 
+    Copyright (C) 2002 Dave LaRose
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: hdsp.c,v 1.3 2005/09/29 14:51:59 letz Exp $
+*/
+
+#include "hardware.h"
+#include "alsa_driver.h"
+#include "hdsp.h"
+#include "JackError.h"
+
+/* Constants to make working with the hdsp matrix mixer easier */
+static const int HDSP_MINUS_INFINITY_GAIN = 0;
+static const int HDSP_UNITY_GAIN = 32768;
+static const int HDSP_MAX_GAIN = 65535;
+
+/*
+ * Use these two arrays to choose the value of the input_channel 
+ * argument to hsdp_set_mixer_gain().  hdsp_physical_input_index[n] 
+ * selects the nth optical/analog input.  audio_stream_index[n] 
+ * selects the nth channel being received from the host via pci/pccard.
+ */
+static const int hdsp_num_input_channels = 52;
+static const int hdsp_physical_input_index[] = {
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+  12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
+static const int hdsp_audio_stream_index[] = {
+  26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+  38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
+
+/*
+ * Use this array to choose the value of the output_channel 
+ * argument to hsdp_set_mixer_gain().  hdsp_physical_output_index[26]
+ * and hdsp_physical_output_index[27] refer to the two "line out"
+ * channels (1/4" phone jack on the front of digiface/multiface).
+ */
+static const int hdsp_num_output_channels = 28;
+static const int hdsp_physical_output_index[] = {
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+  12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
+
+
+/* Function for checking argument values */
+static int clamp_int(int value, int lower_bound, int upper_bound)
+{
+  if(value < lower_bound) {
+    return lower_bound;
+  }
+  if(value > upper_bound) {
+    return upper_bound;
+  }
+  return value;
+}
+
+/* Note(XXX): Maybe should share this code with hammerfall.c? */
+static void 
+set_control_id (snd_ctl_elem_id_t *ctl, const char *name)
+{
+	snd_ctl_elem_id_set_name (ctl, name);
+	snd_ctl_elem_id_set_numid (ctl, 0);
+	snd_ctl_elem_id_set_interface (ctl, SND_CTL_ELEM_IFACE_HWDEP);
+	snd_ctl_elem_id_set_device (ctl, 0);
+	snd_ctl_elem_id_set_subdevice (ctl, 0);
+	snd_ctl_elem_id_set_index (ctl, 0);
+}
+
+/* The hdsp matrix mixer lets you connect pretty much any input to */
+/* any output with gain from -inf to about +2dB. Pretty slick. */
+/* This routine makes a convenient way to set the gain from */
+/* input_channel to output_channel (see hdsp_physical_input_index */
+/* etc. above. */
+/* gain is an int from 0 to 65535, with 0 being -inf gain, and */
+/* 65535 being about +2dB. */
+
+static int hdsp_set_mixer_gain(jack_hardware_t *hw, int input_channel,
+			       int output_channel, int gain)
+{
+	hdsp_t *h = (hdsp_t *) hw->private_hw;
+	snd_ctl_elem_value_t *ctl;
+	snd_ctl_elem_id_t *ctl_id;
+	int err;
+
+	/* Check args */
+	input_channel = clamp_int(input_channel, 0, hdsp_num_input_channels);
+	output_channel = clamp_int(output_channel, 0, hdsp_num_output_channels);
+	gain = clamp_int(gain, HDSP_MINUS_INFINITY_GAIN, HDSP_MAX_GAIN);
+
+	/* Allocate control element and select "Mixer" control */
+	snd_ctl_elem_value_alloca (&ctl);
+	snd_ctl_elem_id_alloca (&ctl_id);
+	set_control_id (ctl_id, "Mixer");
+	snd_ctl_elem_value_set_id (ctl, ctl_id);
+
+	/* Apparently non-standard and unstable interface for the */
+        /* mixer control. */
+	snd_ctl_elem_value_set_integer (ctl, 0, input_channel);
+	snd_ctl_elem_value_set_integer (ctl, 1, output_channel);
+	snd_ctl_elem_value_set_integer (ctl, 2, gain);
+
+	/* Commit the mixer value and check for errors */
+	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, ctl)) != 0) {
+	  jack_error ("ALSA/HDSP: cannot set mixer gain (%s)", snd_strerror (err));
+	  return -1;
+	}
+
+	/* Note (XXX): Perhaps we should maintain a cache of the current */
+	/* mixer values, since it's not clear how to query them from the */
+	/* hdsp hardware.  We'll leave this out until a little later. */
+	return 0;
+}
+  
+static int hdsp_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
+{
+	int i;
+
+	/* For each input channel */
+	for (i = 0; i < 26; i++) {
+		/* Monitoring requested for this channel? */
+		if(mask & (1<<i)) {
+			/* Yes.  Connect physical input to output */
+
+			if(hdsp_set_mixer_gain (hw, hdsp_physical_input_index[i],
+						hdsp_physical_output_index[i],
+						HDSP_UNITY_GAIN) != 0) {
+			  return -1;
+			}
+
+#ifdef CANNOT_HEAR_SOFTWARE_STREAM_WHEN_MONITORING
+			/* ...and disconnect the corresponding software */
+			/* channel */
+			if(hdsp_set_mixer_gain (hw, hdsp_audio_stream_index[i],
+						hdsp_physical_output_index[i],
+						HDSP_MINUS_INFINITY_GAIN) != 0) {
+			  return -1;
+			}
+#endif
+
+		} else {
+			/* No.  Disconnect physical input from output */
+			if(hdsp_set_mixer_gain (hw, hdsp_physical_input_index[i],
+						hdsp_physical_output_index[i],
+						HDSP_MINUS_INFINITY_GAIN) != 0) {
+			  return -1;
+			}
+
+#ifdef CANNOT_HEAR_SOFTWARE_STREAM_WHEN_MONITORING
+			/* ...and connect the corresponding software */
+			/* channel */
+			if(hdsp_set_mixer_gain (hw, hdsp_audio_stream_index[i],
+						hdsp_physical_output_index[i],
+						HDSP_UNITY_GAIN) != 0) {
+			  return -1;
+			}
+#endif
+		}
+	}
+	/* Cache the monitor mask */
+	hw->input_monitor_mask = mask;
+	return 0;
+}
+
+
+static int hdsp_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
+{
+  // Empty for now, until Dave understands more about clock sync so
+  // he can test.
+  return -1;
+}
+
+static double hdsp_get_hardware_peak (jack_port_t *port, jack_nframes_t frame)
+{
+	return 0;
+}
+
+static double hdsp_get_hardware_power (jack_port_t *port, jack_nframes_t frame)
+{
+	return 0;
+}
+
+static void
+hdsp_release (jack_hardware_t *hw)
+{
+	hdsp_t *h = (hdsp_t *) hw->private_hw;
+
+	if (h != 0) {
+	  free (h);
+	}
+}
+
+/* Mostly copied directly from hammerfall.c */
+jack_hardware_t *
+jack_alsa_hdsp_hw_new (alsa_driver_t *driver)
+{
+	jack_hardware_t *hw;
+	hdsp_t *h;
+
+	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
+
+	/* Not using clock lock-sync-whatever in home hardware setup */
+	/* yet.  Will write this code when can test it. */
+	/* hw->capabilities = Cap_HardwareMonitoring|Cap_AutoSync|Cap_WordClock|Cap_ClockMaster|Cap_ClockLockReporting; */
+	hw->capabilities = Cap_HardwareMonitoring | Cap_HardwareMetering;
+	hw->input_monitor_mask = 0;
+	hw->private_hw = 0;
+
+	hw->set_input_monitor_mask = hdsp_set_input_monitor_mask;
+	hw->change_sample_clock = hdsp_change_sample_clock;
+	hw->release = hdsp_release;
+	hw->get_hardware_peak = hdsp_get_hardware_peak;
+	hw->get_hardware_power = hdsp_get_hardware_power;
+	
+	h = (hdsp_t *) malloc (sizeof (hdsp_t));
+	h->driver = driver;
+	hw->private_hw = h;
+
+	return hw;
+}
diff --git a/linux/alsa/hdsp.h b/linux/alsa/hdsp.h
new file mode 100644
index 0000000..fe5df84
--- /dev/null
+++ b/linux/alsa/hdsp.h
@@ -0,0 +1,45 @@
+/*
+   Copyright (C) 2001 Paul Davis
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   $Id: hdsp.h,v 1.3 2005/11/23 11:24:29 letz Exp $
+*/
+
+#ifndef __jack_hdsp_h__
+#define __jack_hdsp_h__
+
+#include <sys/time.h>
+
+typedef struct
+{
+    alsa_driver_t *driver;
+}
+hdsp_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    jack_hardware_t *
+    jack_alsa_hdsp_hw_new (alsa_driver_t *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __jack_hdsp_h__*/
diff --git a/linux/alsa/ice1712.c b/linux/alsa/ice1712.c
new file mode 100644
index 0000000..9689221
--- /dev/null
+++ b/linux/alsa/ice1712.c
@@ -0,0 +1,153 @@
+/*
+    Copyright (C) 2002 Anthony Van Groningen
+
+    Parts based on source code taken from the 
+    "Env24 chipset (ICE1712) control utility" that is
+
+    Copyright (C) 2000 by Jaroslav Kysela <perex at suse.cz>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "hardware.h"
+#include "alsa_driver.h"
+#include "ice1712.h"
+#include "JackError.h"
+
+static int
+ice1712_hw_monitor_toggle(jack_hardware_t *hw, int idx, int onoff)
+{
+        ice1712_t *h = (ice1712_t *) hw->private_hw;
+	snd_ctl_elem_value_t *val;
+	int err;
+	
+	snd_ctl_elem_value_alloca (&val);
+	snd_ctl_elem_value_set_interface (val, SND_CTL_ELEM_IFACE_MIXER);
+	if (idx >= 8) {
+		snd_ctl_elem_value_set_name (val, SPDIF_PLAYBACK_ROUTE_NAME);
+		snd_ctl_elem_value_set_index (val, idx - 8);
+	} else {
+		snd_ctl_elem_value_set_name (val, ANALOG_PLAYBACK_ROUTE_NAME);
+		snd_ctl_elem_value_set_index (val, idx);
+	}
+	if (onoff) {
+		snd_ctl_elem_value_set_enumerated (val, 0, idx + 1);
+	} else {
+		snd_ctl_elem_value_set_enumerated (val, 0, 0);
+	}
+	if ((err = snd_ctl_elem_write (h->driver->ctl_handle, val)) != 0) {
+		jack_error ("ALSA/ICE1712: (%d) cannot set input monitoring (%s)",
+			    idx,snd_strerror (err));
+		return -1;
+	}
+
+	return 0;
+}
+
+static int 
+ice1712_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)    
+{
+	int idx;
+	ice1712_t *h = (ice1712_t *) hw->private_hw;
+	
+	for (idx = 0; idx < 10; idx++) {
+		if (h->active_channels & (1<<idx)) {
+			ice1712_hw_monitor_toggle (hw, idx, mask & (1<<idx) ? 1 : 0);
+		}
+	}
+	hw->input_monitor_mask = mask;
+	
+	return 0;
+}
+
+static int 
+ice1712_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode)      
+{
+	return -1;
+}
+
+static void
+ice1712_release (jack_hardware_t *hw)
+{
+	ice1712_t *h = (ice1712_t *) hw->private_hw;
+	
+	if (h == 0)
+	return;
+
+	if (h->eeprom)
+		free(h->eeprom);
+
+	free(h);
+}
+
+
+jack_hardware_t *
+jack_alsa_ice1712_hw_new (alsa_driver_t *driver)
+{
+	jack_hardware_t *hw;
+	ice1712_t *h;
+	snd_ctl_elem_value_t *val;	
+	int err;
+
+	hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
+
+	hw->capabilities = Cap_HardwareMonitoring;
+	hw->input_monitor_mask = 0;
+	hw->private_hw = 0;
+
+	hw->set_input_monitor_mask = ice1712_set_input_monitor_mask;
+	hw->change_sample_clock = ice1712_change_sample_clock;
+	hw->release = ice1712_release;
+
+	h = (ice1712_t *) malloc (sizeof (ice1712_t));
+
+	h->driver = driver;
+
+	/* Get the EEPROM (adopted from envy24control) */
+	h->eeprom = (ice1712_eeprom_t *) malloc (sizeof (ice1712_eeprom_t));
+	snd_ctl_elem_value_alloca (&val);
+	snd_ctl_elem_value_set_interface (val, SND_CTL_ELEM_IFACE_CARD);
+        snd_ctl_elem_value_set_name (val, "ICE1712 EEPROM");
+        if ((err = snd_ctl_elem_read (driver->ctl_handle, val)) < 0) {
+                jack_error( "ALSA/ICE1712: Unable to read EEPROM contents (%s)\n", snd_strerror (err));
+                /* Recover? */
+        }
+        memcpy(h->eeprom, snd_ctl_elem_value_get_bytes(val), 32);
+
+	/* determine number of pro ADC's. We're asumming that there is at least one stereo pair. 
+	   Should check this first, but how?  */
+	switch((h->eeprom->codec & 0xCU) >> 2) {
+	case 0:
+	        h->active_channels = 0x3U;
+	        break;
+	case 1:
+	        h->active_channels = 0xfU;
+	        break;
+	case 2:
+	        h->active_channels = 0x3fU;
+	        break;
+	case 3:
+	        h->active_channels = 0xffU;
+	        break;
+	}
+	/* check for SPDIF In's */
+	if (h->eeprom->spdif & 0x1U) {
+	        h->active_channels |= 0x300U;
+	}
+	
+	hw->private_hw = h;
+
+	return hw;
+}
diff --git a/linux/alsa/ice1712.h b/linux/alsa/ice1712.h
new file mode 100644
index 0000000..fb42201
--- /dev/null
+++ b/linux/alsa/ice1712.h
@@ -0,0 +1,79 @@
+/*
+    Copyright (C) 2002 Anthony Van Groningen
+
+    Parts based on source code taken from the
+    "Env24 chipset (ICE1712) control utility" that is
+
+    Copyright (C) 2000 by Jaroslav Kysela <perex at suse.cz>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __jack_ice1712_h__
+#define __jack_ice1712_h__
+
+#define ICE1712_SUBDEVICE_DELTA44       0x121433d6
+#define ICE1712_SUBDEVICE_DELTA66       0x121432d6
+#define ICE1712_SUBDEVICE_DELTA1010     0x121430d6
+#define ICE1712_SUBDEVICE_DELTADIO2496  0x121431d6
+#define ICE1712_SUBDEVICE_AUDIOPHILE    0x121434d6
+
+#define SPDIF_PLAYBACK_ROUTE_NAME       "IEC958 Playback Route"
+#define ANALOG_PLAYBACK_ROUTE_NAME      "H/W Playback Route"
+#define MULTITRACK_PEAK_NAME            "Multi Track Peak"
+
+typedef struct
+{
+    unsigned int subvendor; /* PCI[2c-2f] */
+    unsigned char size;     /* size of EEPROM image in bytes */
+    unsigned char version;  /* must be 1 */
+    unsigned char codec;    /* codec configuration PCI[60] */
+    unsigned char aclink;   /* ACLink configuration PCI[61] */
+    unsigned char i2sID;    /* PCI[62] */
+    unsigned char spdif;    /* S/PDIF configuration PCI[63] */
+    unsigned char gpiomask; /* GPIO initial mask, 0 = write, 1 = don't */
+    unsigned char gpiostate; /* GPIO initial state */
+    unsigned char gpiodir;  /* GPIO direction state */
+    unsigned short ac97main;
+    unsigned short ac97pcm;
+    unsigned short ac97rec;
+    unsigned char ac97recsrc;
+    unsigned char dacID[4]; /* I2S IDs for DACs */
+    unsigned char adcID[4]; /* I2S IDs for ADCs */
+    unsigned char extra[4];
+}
+ice1712_eeprom_t;
+
+typedef struct
+{
+    alsa_driver_t *driver;
+    ice1712_eeprom_t *eeprom;
+    unsigned long active_channels;
+}
+ice1712_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    jack_hardware_t *jack_alsa_ice1712_hw_new (alsa_driver_t *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __jack_ice1712_h__*/
diff --git a/linux/alsa/jslist.h b/linux/alsa/jslist.h
new file mode 100644
index 0000000..cc145f0
--- /dev/null
+++ b/linux/alsa/jslist.h
@@ -0,0 +1,286 @@
+/*
+   Based on gslist.c from glib-1.2.9 (LGPL).
+
+   Adaption to JACK, Copyright (C) 2002 Kai Vehmanen.
+     - replaced use of gtypes with normal ANSI C types
+     - glib's memery allocation routines replaced with
+       malloc/free calls
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+   $Id: jslist.h,v 1.2 2005/11/23 11:24:29 letz Exp $
+*/
+
+#ifndef __jack_jslist_h__
+#define __jack_jslist_h__
+
+#include <stdlib.h>
+
+typedef struct _JSList JSList;
+
+typedef int	(*JCompareFunc)	(void*	a,
+                             void*	b);
+struct _JSList
+{
+    void *data;
+    JSList *next;
+};
+
+static __inline__
+JSList*
+jack_slist_alloc (void)
+{
+    JSList *new_list;
+
+    new_list = (JSList*)malloc(sizeof(JSList));
+    new_list->data = NULL;
+    new_list->next = NULL;
+
+    return new_list;
+}
+
+static __inline__
+JSList*
+jack_slist_prepend (JSList *list,
+                    void *data)
+{
+    JSList *new_list;
+
+    new_list = (JSList*)malloc(sizeof(JSList));
+    new_list->data = data;
+    new_list->next = list;
+
+    return new_list;
+}
+
+#define jack_slist_next(slist)	((slist) ? (((JSList *)(slist))->next) : NULL)
+static __inline__
+JSList*
+jack_slist_last (JSList *list)
+{
+    if (list) {
+        while (list->next)
+            list = list->next;
+    }
+
+    return list;
+}
+
+static __inline__
+JSList*
+jack_slist_remove_link (JSList *list,
+                        JSList *link)
+{
+    JSList *tmp;
+    JSList *prev;
+
+    prev = NULL;
+    tmp = list;
+
+    while (tmp) {
+        if (tmp == link) {
+            if (prev)
+                prev->next = tmp->next;
+            if (list == tmp)
+                list = list->next;
+
+            tmp->next = NULL;
+            break;
+        }
+
+        prev = tmp;
+        tmp = tmp->next;
+    }
+
+    return list;
+}
+
+static __inline__
+void
+jack_slist_free (JSList *list)
+{
+    while (list) {
+        JSList *next = list->next;
+        free(list);
+        list = next;
+    }
+}
+
+static __inline__
+void
+jack_slist_free_1 (JSList *list)
+{
+    if (list) {
+        free(list);
+    }
+}
+
+static __inline__
+JSList*
+jack_slist_remove (JSList *list,
+                   void *data)
+{
+    JSList *tmp;
+    JSList *prev;
+
+    prev = NULL;
+    tmp = list;
+
+    while (tmp) {
+        if (tmp->data == data) {
+            if (prev)
+                prev->next = tmp->next;
+            if (list == tmp)
+                list = list->next;
+
+            tmp->next = NULL;
+            jack_slist_free (tmp);
+
+            break;
+        }
+
+        prev = tmp;
+        tmp = tmp->next;
+    }
+
+    return list;
+}
+
+static __inline__
+unsigned int
+jack_slist_length (JSList *list)
+{
+    unsigned int length;
+
+    length = 0;
+    while (list) {
+        length++;
+        list = list->next;
+    }
+
+    return length;
+}
+
+static __inline__
+JSList*
+jack_slist_find (JSList *list,
+                 void *data)
+{
+    while (list) {
+        if (list->data == data)
+            break;
+        list = list->next;
+    }
+
+    return list;
+}
+
+static __inline__
+JSList*
+jack_slist_copy (JSList *list)
+{
+    JSList *new_list = NULL;
+
+    if (list) {
+        JSList *last;
+
+        new_list = jack_slist_alloc ();
+        new_list->data = list->data;
+        last = new_list;
+        list = list->next;
+        while (list) {
+            last->next = jack_slist_alloc ();
+            last = last->next;
+            last->data = list->data;
+            list = list->next;
+        }
+    }
+
+    return new_list;
+}
+
+static __inline__
+JSList*
+jack_slist_append (JSList *list,
+                   void *data)
+{
+    JSList *new_list;
+    JSList *last;
+
+    new_list = jack_slist_alloc ();
+    new_list->data = data;
+
+    if (list) {
+        last = jack_slist_last (list);
+        last->next = new_list;
+
+        return list;
+    } else
+        return new_list;
+}
+
+static __inline__
+JSList*
+jack_slist_sort_merge (JSList *l1,
+                       JSList *l2,
+                       JCompareFunc compare_func)
+{
+    JSList list, *l;
+
+    l = &list;
+
+    while (l1 && l2) {
+        if (compare_func(l1->data, l2->data) < 0) {
+            l = l->next = l1;
+            l1 = l1->next;
+        } else {
+            l = l->next = l2;
+            l2 = l2->next;
+        }
+    }
+    l->next = l1 ? l1 : l2;
+
+    return list.next;
+}
+
+static __inline__
+JSList*
+jack_slist_sort (JSList *list,
+                 JCompareFunc compare_func)
+{
+    JSList *l1, *l2;
+
+    if (!list)
+        return NULL;
+    if (!list->next)
+        return list;
+
+    l1 = list;
+    l2 = list->next;
+
+    while ((l2 = l2->next) != NULL) {
+        if ((l2 = l2->next) == NULL)
+            break;
+        l1 = l1->next;
+    }
+    l2 = l1->next;
+    l1->next = NULL;
+
+    return jack_slist_sort_merge (jack_slist_sort (list, compare_func),
+                                  jack_slist_sort (l2, compare_func),
+                                  compare_func);
+}
+
+#endif /* __jack_jslist_h__ */
diff --git a/linux/alsa/midi_pack.h b/linux/alsa/midi_pack.h
new file mode 100644
index 0000000..56872a5
--- /dev/null
+++ b/linux/alsa/midi_pack.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2006,2007 Dmitry S. Baikov
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef __jack_midi_pack_h__
+#define __jack_midi_pack_h__
+
+typedef struct
+{
+    int running_status;
+}
+midi_pack_t;
+
+static inline
+void midi_pack_reset(midi_pack_t *p)
+{
+    p->running_status = 0;
+}
+
+static
+void midi_pack_event(midi_pack_t *p, jack_midi_event_t *e)
+{
+    if (e->buffer[0] >= 0x80 && e->buffer[0] < 0xF0) { // Voice Message
+        if (e->buffer[0] == p->running_status) {
+            e->buffer++;
+            e->size--;
+        } else
+            p->running_status = e->buffer[0];
+    } else if (e->buffer[0] < 0xF8) { // not System Realtime
+        p->running_status = 0;
+    }
+}
+
+#endif /* __jack_midi_pack_h__ */
diff --git a/linux/alsa/midi_unpack.h b/linux/alsa/midi_unpack.h
new file mode 100644
index 0000000..f6b381b
--- /dev/null
+++ b/linux/alsa/midi_unpack.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2006,2007 Dmitry S. Baikov
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef __jack_midi_unpack_h__
+#define __jack_midi_unpack_h__
+
+enum {
+    MIDI_UNPACK_MAX_MSG = 1024
+};
+
+typedef struct
+{
+    int pos, need, size;
+    unsigned char data[MIDI_UNPACK_MAX_MSG];
+}
+midi_unpack_t;
+
+static inline
+void midi_unpack_init(midi_unpack_t *u)
+{
+    u->pos = 0;
+    u->size = sizeof(u->data);
+    u->need = u->size;
+}
+
+static inline
+void midi_unpack_reset(midi_unpack_t *u)
+{
+    u->pos = 0;
+    u->need = u->size;
+}
+
+static const unsigned char midi_voice_len[] =
+    {
+        3, /*0x80 Note Off*/
+        3, /*0x90 Note On*/
+        3, /*0xA0 Aftertouch*/
+        3, /*0xB0 Control Change*/
+        2, /*0xC0 Program Change*/
+        2, /*0xD0 Channel Pressure*/
+        3, /*0xE0 Pitch Wheel*/
+        1  /*0xF0 System*/
+    };
+
+static const unsigned char midi_system_len[] =
+    {
+        0, /*0xF0 System Exclusive Start*/
+        2, /*0xF1 MTC Quarter Frame*/
+        3, /*0xF2 Song Postion*/
+        2, /*0xF3 Song Select*/
+        0, /*0xF4 undefined*/
+        0, /*0xF5 undefined*/
+        1, /*0xF6 Tune Request*/
+        1  /*0xF7 System Exlusive End*/
+    };
+
+static
+int midi_unpack_buf(midi_unpack_t *buf, const unsigned char *data, int len, void *jack_port_buf, jack_nframes_t time)
+{
+    int i;
+    for (i = 0; i < len; ++i) {
+        const unsigned char byte = data[i];
+        if (byte >= 0xF8) // system realtime
+        {
+            jack_midi_event_write(jack_port_buf, time, &data[i], 1);
+            //printf("midi_unpack: written system relatime event\n");
+            //midi_input_write(in, &data[i], 1);
+        } else if (byte < 0x80) // data
+        {
+            assert (buf->pos < buf->size);
+            buf->data[buf->pos++] = byte;
+        } else if (byte < 0xF0) // voice
+        {
+            assert (byte >= 0x80 && byte < 0xF0);
+            //buf->need = ((byte|0x0F) == 0xCF || (byte|0x0F)==0xDF) ? 2 : 3;
+            buf->need = midi_voice_len[(byte-0x80)>>4];
+            buf->data[0] = byte;
+            buf->pos = 1;
+        } else if (byte == 0xF7) // sysex end
+        {
+            assert (buf->pos < buf->size);
+            buf->data[buf->pos++] = byte;
+            buf->need = buf->pos;
+        } else {
+            assert (byte >= 0xF0 && byte < 0xF8);
+            buf->pos = 1;
+            buf->data[0] = byte;
+            buf->need = midi_system_len[byte - 0xF0];
+            if (!buf->need)
+                buf->need = buf->size;
+        }
+        if (buf->pos == buf->need) {
+            // TODO: deal with big sysex'es (they are silently dropped for now)
+            if (buf->data[0] >= 0x80 || (buf->data[0] == 0xF0 && buf->data[buf->pos-1] == 0xF7)) {
+                /* convert Note On with velocity 0 to Note Off */
+                if ((buf->data[0] & 0xF0) == 0x90 && buf->data[2] == 0) {
+                    // we use temp array here to keep running status sync
+                    jack_midi_data_t temp[3] = { 0x80, 0, 0x40 };
+                    temp[0] |= buf->data[0] & 0x0F;
+                    temp[1] = buf->data[1];
+                    jack_midi_event_write(jack_port_buf, time, temp, 3);
+                } else
+                    jack_midi_event_write(jack_port_buf, time, &buf->data[0], buf->pos);
+                //printf("midi_unpack: written %d-byte event\n", buf->pos);
+                //midi_input_write(in, &buf->data[0], buf->pos);
+            }
+            /* keep running status */
+            if (buf->data[0] >= 0x80 && buf->data[0] < 0xF0)
+                buf->pos = 1;
+            else {
+                buf->pos = 0;
+                buf->need = buf->size;
+            }
+        }
+    }
+    assert (i == len);
+    return i;
+}
+
+#endif /* __jack_midi_unpack_h__ */
diff --git a/linux/alsa/usx2y.c b/linux/alsa/usx2y.c
new file mode 100644
index 0000000..9223692
--- /dev/null
+++ b/linux/alsa/usx2y.c
@@ -0,0 +1,692 @@
+/*
+    Copyright (C) 2001 Paul Davis 
+    Copyright (C) 2005 Karsten Wiese, Rui Nuno Capela
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "hardware.h"
+#include "alsa_driver.h"
+#include "usx2y.h"
+#include <sys/mman.h>
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+//#define DBGHWDEP
+
+#ifdef DBGHWDEP
+int dbg_offset;
+char dbg_buffer[8096];
+#endif
+static 
+int usx2y_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
+{
+	return -1;
+}
+
+static
+int usx2y_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode) 
+{
+	return -1;
+}
+
+static void
+usx2y_release (jack_hardware_t *hw)
+{
+	usx2y_t *h = (usx2y_t *) hw->private_hw;
+
+	if (h == 0)
+		return;
+        
+	if (h->hwdep_handle)
+		snd_hwdep_close(h->hwdep_handle);
+
+	free(h);
+}
+
+static int
+usx2y_driver_get_channel_addresses_playback (alsa_driver_t *driver,
+					snd_pcm_uframes_t *playback_avail)
+{
+	channel_t chn;
+	int iso;
+	snd_pcm_uframes_t playback_iso_avail;
+	char *playback;
+
+	usx2y_t *h = (usx2y_t *) driver->hw->private_hw;
+
+	if (0 > h->playback_iso_start) {
+		int bytes = driver->playback_sample_bytes * 2 * driver->frames_per_cycle *
+			driver->user_nperiods;
+		iso = h->hwdep_pcm_shm->playback_iso_start;
+		if (0 > iso)
+			return 0; /* FIXME: return -1; */
+		if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
+			iso = 0;
+		while((bytes -= h->hwdep_pcm_shm->captured_iso[iso].length) > 0)
+			if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
+				iso = 0;
+		h->playback_iso_bytes_done = h->hwdep_pcm_shm->captured_iso[iso].length + bytes;
+#ifdef DBGHWDEP
+		dbg_offset = sprintf(dbg_buffer, "first iso = %i %i@%p:%i\n",
+					iso, h->hwdep_pcm_shm->captured_iso[iso].length,
+					h->hwdep_pcm_shm->playback,
+					h->hwdep_pcm_shm->captured_iso[iso].offset);
+#endif
+	} else {
+		iso = h->playback_iso_start;
+	}
+#ifdef DBGHWDEP
+	dbg_offset += sprintf(dbg_buffer + dbg_offset, "iso = %i(%i;%i); ", iso,
+				h->hwdep_pcm_shm->captured_iso[iso].offset,
+				h->hwdep_pcm_shm->captured_iso[iso].frame);
+#endif
+	playback = h->hwdep_pcm_shm->playback +
+		h->hwdep_pcm_shm->captured_iso[iso].offset +
+		h->playback_iso_bytes_done;
+	playback_iso_avail = (h->hwdep_pcm_shm->captured_iso[iso].length -
+		h->playback_iso_bytes_done) /
+		(driver->playback_sample_bytes * 2);
+	if (*playback_avail >= playback_iso_avail) {
+		*playback_avail = playback_iso_avail;
+		if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
+			iso = 0;
+		h->playback_iso_bytes_done = 0;
+	} else
+		h->playback_iso_bytes_done =
+			*playback_avail * (driver->playback_sample_bytes * 2);
+	h->playback_iso_start = iso;
+	for (chn = 0; chn < driver->playback_nchannels; chn++) {
+		const snd_pcm_channel_area_t *a = &driver->playback_areas[chn];
+		driver->playback_addr[chn] = playback + a->first / 8;
+	}
+#ifdef DBGHWDEP
+	if (dbg_offset < (sizeof(dbg_buffer) - 256))
+		dbg_offset += sprintf(dbg_buffer + dbg_offset, "avail %li@%p\n", *playback_avail, driver->playback_addr[0]);
+	else {
+		printf(dbg_buffer);
+		return -1;
+	}
+#endif
+
+	return 0;
+}
+
+static int
+usx2y_driver_get_channel_addresses_capture (alsa_driver_t *driver,
+					snd_pcm_uframes_t *capture_avail)
+{
+	channel_t chn;
+	int iso;
+	snd_pcm_uframes_t capture_iso_avail;
+	int capture_offset;
+
+	usx2y_t *h = (usx2y_t *) driver->hw->private_hw;
+
+	if (0 > h->capture_iso_start) {
+		iso = h->hwdep_pcm_shm->capture_iso_start;
+		if (0 > iso)
+			return 0; /* FIXME: return -1; */
+		h->capture_iso_bytes_done = 0;
+#ifdef DBGHWDEP
+		dbg_offset = sprintf(dbg_buffer, "cfirst iso = %i %i@%p:%i\n",
+					iso, h->hwdep_pcm_shm->captured_iso[iso].length,
+					h->hwdep_pcm_shm->capture0x8,
+					h->hwdep_pcm_shm->captured_iso[iso].offset);
+#endif
+	} else {
+		iso = h->capture_iso_start;
+	}
+#ifdef DBGHWDEP
+	dbg_offset += sprintf(dbg_buffer + dbg_offset, "ciso = %i(%i;%i); ", iso,
+				h->hwdep_pcm_shm->captured_iso[iso].offset,
+				h->hwdep_pcm_shm->captured_iso[iso].frame);
+#endif
+	capture_offset =
+		h->hwdep_pcm_shm->captured_iso[iso].offset +
+			h->capture_iso_bytes_done;
+	capture_iso_avail = (h->hwdep_pcm_shm->captured_iso[iso].length -
+		h->capture_iso_bytes_done) /
+		(driver->capture_sample_bytes * 2);
+	if (*capture_avail >= capture_iso_avail) {
+		*capture_avail = capture_iso_avail;
+		if (++iso >= ARRAY_SIZE(h->hwdep_pcm_shm->captured_iso))
+			iso = 0;
+		h->capture_iso_bytes_done = 0;
+	} else
+		h->capture_iso_bytes_done =
+			*capture_avail * (driver->capture_sample_bytes * 2);
+	h->capture_iso_start = iso;
+	for (chn = 0; chn < driver->capture_nchannels; chn++) {
+		driver->capture_addr[chn] =
+			(chn < 2 ? h->hwdep_pcm_shm->capture0x8 : h->hwdep_pcm_shm->capture0xA)
+			+ capture_offset +
+			((chn & 1) ? driver->capture_sample_bytes : 0);
+	}
+#ifdef DBGHWDEP
+ {
+	int f = 0;
+	unsigned *u = driver->capture_addr[0];
+	static unsigned last;
+	dbg_offset += sprintf(dbg_buffer + dbg_offset, "\nvon %6u  bis %6u\n", last, u[0]);
+	while (f < *capture_avail && dbg_offset < (sizeof(dbg_buffer) - 256)) {
+		if (u[f] != last + 1)
+			 dbg_offset += sprintf(dbg_buffer + dbg_offset, "\nooops %6u  %6u\n", last, u[f]);
+		last = u[f++];
+	}
+ }
+	if (dbg_offset < (sizeof(dbg_buffer) - 256))
+		dbg_offset += sprintf(dbg_buffer + dbg_offset, "avail %li@%p\n", *capture_avail, driver->capture_addr[0]);
+	else {
+		printf(dbg_buffer);
+		return -1;
+	}
+#endif
+
+	return 0;
+}
+
+static int
+usx2y_driver_start (alsa_driver_t *driver)
+{
+	int err, i;
+	snd_pcm_uframes_t poffset, pavail;
+
+	usx2y_t *h = (usx2y_t *) driver->hw->private_hw;
+
+	for (i = 0; i < driver->capture_nchannels; i++)
+		// US428 channels 3+4 are on a seperate 2 channel stream.
+		// ALSA thinks its 1 stream with 4 channels.
+		driver->capture_interleave_skip[i] = 2 * driver->capture_sample_bytes;
+
+
+	driver->playback_interleave_skip[0] = 2 * driver->playback_sample_bytes;
+	driver->playback_interleave_skip[1] = 2 * driver->playback_sample_bytes;
+
+	driver->poll_last = 0;
+	driver->poll_next = 0;
+
+	if ((err = snd_pcm_prepare (driver->playback_handle)) < 0) {
+		jack_error ("ALSA/USX2Y: prepare error for playback: %s", snd_strerror(err));
+		return -1;
+	}
+
+	if (driver->midi && !driver->xrun_recovery)
+		(driver->midi->start)(driver->midi);
+
+	if (driver->playback_handle) {
+/* 		int i, j; */
+/* 		char buffer[2000]; */
+		h->playback_iso_start =
+			h->capture_iso_start = -1;
+		snd_hwdep_poll_descriptors(h->hwdep_handle, &h->pfds, 1);
+		h->hwdep_pcm_shm = (snd_usX2Y_hwdep_pcm_shm_t*)
+			mmap(NULL, sizeof(snd_usX2Y_hwdep_pcm_shm_t),
+			     PROT_READ,
+			     MAP_SHARED, h->pfds.fd,
+			     0);
+		if (MAP_FAILED == h->hwdep_pcm_shm) {
+			perror("ALSA/USX2Y: mmap");
+			return -1;
+		}
+		if (mprotect(h->hwdep_pcm_shm->playback,
+					sizeof(h->hwdep_pcm_shm->playback),
+					PROT_READ|PROT_WRITE)) {
+			perror("ALSA/USX2Y: mprotect");
+			return -1;
+		}
+		memset(h->hwdep_pcm_shm->playback, 0, sizeof(h->hwdep_pcm_shm->playback));
+/* 		for (i = 0, j = 0; i < 2000;) { */
+/* 			j += sprintf(buffer + j, "%04hX ", */
+/* 				     *(unsigned short*)(h->hwdep_pcm_shm->capture + i)); */
+/* 			if (((i += 2) % 32) == 0) { */
+/* 				jack_error(buffer); */
+/* 				j = 0; */
+/* 			} */
+/* 		} */
+	}
+
+	if (driver->hw_monitoring) {
+		driver->hw->set_input_monitor_mask (driver->hw,
+						    driver->input_monitor_mask);
+	}
+
+	if (driver->playback_handle) {
+		/* fill playback buffer with zeroes, and mark
+		   all fragments as having data.
+		*/
+
+		pavail = snd_pcm_avail_update (driver->playback_handle);
+
+		if (pavail != driver->frames_per_cycle * driver->playback_nperiods) {
+			jack_error ("ALSA/USX2Y: full buffer not available at start");
+			return -1;
+		}
+
+		if (snd_pcm_mmap_begin(
+					driver->playback_handle,
+					&driver->playback_areas,
+					&poffset, &pavail) < 0) {
+			return -1;
+		}
+
+		/* XXX this is cheating. ALSA offers no guarantee that
+		   we can access the entire buffer at any one time. It
+		   works on most hardware tested so far, however, buts
+		   its a liability in the long run. I think that
+		   alsa-lib may have a better function for doing this
+		   here, where the goal is to silence the entire
+		   buffer.
+		*/
+		{
+/* 			snd_pcm_uframes_t frag, nframes = driver->buffer_frames; */
+/* 			while (nframes) { */
+/* 				frag = nframes; */
+/* 				if (usx2y_driver_get_channel_addresses_playback(driver, &frag) < 0) */
+/* 					return -1; */
+
+/* 				for (chn = 0; chn < driver->playback_nchannels; chn++) */
+/* 					alsa_driver_silence_on_channel (driver, chn, frag); */
+/* 				nframes -= frag; */
+/* 			} */
+		}
+
+		snd_pcm_mmap_commit (driver->playback_handle, poffset,
+						driver->user_nperiods * driver->frames_per_cycle);
+
+		if ((err = snd_pcm_start (driver->playback_handle)) < 0) {
+			jack_error ("ALSA/USX2Y: could not start playback (%s)",
+				    snd_strerror (err));
+			return -1;
+		}
+	}
+
+	if (driver->hw_monitoring &&
+	    (driver->input_monitor_mask || driver->all_monitor_in)) {
+		if (driver->all_monitor_in) {
+			driver->hw->set_input_monitor_mask (driver->hw, ~0U);
+		} else {
+			driver->hw->set_input_monitor_mask (
+				driver->hw, driver->input_monitor_mask);
+		}
+	}
+
+	driver->playback_nfds =	snd_pcm_poll_descriptors_count (driver->playback_handle);
+	driver->capture_nfds = snd_pcm_poll_descriptors_count (driver->capture_handle);
+
+	if (driver->pfd) {
+		free (driver->pfd);
+	}
+
+	driver->pfd = (struct pollfd *)
+		malloc (sizeof (struct pollfd) *
+			(driver->playback_nfds + driver->capture_nfds + 2));
+
+	return 0;
+}
+
+static int
+usx2y_driver_stop (alsa_driver_t *driver)
+{
+	int err;
+	JSList* node;
+	int chn;
+
+	usx2y_t *h = (usx2y_t *) driver->hw->private_hw;
+
+	/* silence all capture port buffers, because we might
+	   be entering offline mode.
+	*/
+
+	for (chn = 0, node = driver->capture_ports; node;
+		node = jack_slist_next (node), chn++) {
+
+		jack_port_t* port;
+		char* buf;
+		jack_nframes_t nframes = driver->engine->control->buffer_size;
+
+		port = (jack_port_t *) node->data;
+		buf = jack_port_get_buffer (port, nframes);
+		memset (buf, 0, sizeof (jack_default_audio_sample_t) * nframes);
+	}
+
+	if (driver->playback_handle) {
+		if ((err = snd_pcm_drop (driver->playback_handle)) < 0) {
+			jack_error ("ALSA/USX2Y: channel flush for playback "
+					"failed (%s)", snd_strerror (err));
+			return -1;
+		}
+	}
+
+	if (driver->hw_monitoring) {
+		driver->hw->set_input_monitor_mask (driver->hw, 0);
+	}
+
+	munmap(h->hwdep_pcm_shm, sizeof(snd_usX2Y_hwdep_pcm_shm_t));
+
+	if (driver->midi && !driver->xrun_recovery)
+		(driver->midi->stop)(driver->midi);
+
+	return 0;
+}
+
+static int
+usx2y_driver_null_cycle (alsa_driver_t* driver, jack_nframes_t nframes)
+{
+	jack_nframes_t nf;
+	snd_pcm_uframes_t offset;
+	snd_pcm_uframes_t contiguous, contiguous_;
+	int chn;
+
+	VERBOSE(driver->engine,
+		"usx2y_driver_null_cycle (%p, %i)", driver, nframes);
+
+	if (driver->capture_handle) {
+		nf = nframes;
+		offset = 0;
+		while (nf) {
+
+			contiguous = (nf > driver->frames_per_cycle) ?
+				driver->frames_per_cycle : nf;
+
+			if (snd_pcm_mmap_begin (
+					driver->capture_handle,
+					&driver->capture_areas,
+					(snd_pcm_uframes_t *) &offset,
+					(snd_pcm_uframes_t *) &contiguous)) {
+				return -1;
+			}
+			contiguous_ = contiguous;
+			while (contiguous_) {
+				snd_pcm_uframes_t frag = contiguous_;
+				if (usx2y_driver_get_channel_addresses_capture(driver, &frag) < 0)
+					return -1;
+				contiguous_ -= frag;
+			}
+
+			if (snd_pcm_mmap_commit (driver->capture_handle,
+						offset, contiguous) < 0) {
+				return -1;
+			}
+
+			nf -= contiguous;
+		}
+	}
+
+	if (driver->playback_handle) {
+		nf = nframes;
+		offset = 0;
+		while (nf) {
+			contiguous = (nf > driver->frames_per_cycle) ?
+				driver->frames_per_cycle : nf;
+
+			if (snd_pcm_mmap_begin (
+				    driver->playback_handle,
+				    &driver->playback_areas,
+				    (snd_pcm_uframes_t *) &offset,
+				    (snd_pcm_uframes_t *) &contiguous)) {
+				return -1;
+			}
+
+			{
+				snd_pcm_uframes_t frag, nframes = contiguous;
+				while (nframes) {
+					frag = nframes;
+					if (usx2y_driver_get_channel_addresses_playback(driver, &frag) < 0)
+						return -1;
+					for (chn = 0; chn < driver->playback_nchannels; chn++)
+						alsa_driver_silence_on_channel (driver, chn, frag);
+					nframes -= frag;
+				}
+			}
+
+			if (snd_pcm_mmap_commit (driver->playback_handle,
+						offset, contiguous) < 0) {
+				return -1;
+			}
+
+			nf -= contiguous;
+		}
+	}
+
+	return 0;
+}
+
+static int
+usx2y_driver_read (alsa_driver_t *driver, jack_nframes_t nframes)
+{
+	snd_pcm_uframes_t contiguous;
+	snd_pcm_sframes_t nread;
+	snd_pcm_uframes_t offset;
+	jack_default_audio_sample_t* buf[4];
+	channel_t chn;
+	JSList *node;
+	jack_port_t* port;
+	int err;
+	snd_pcm_uframes_t nframes_ = nframes;
+
+	if (!driver->capture_handle || driver->engine->freewheeling) {
+		return 0;
+	}
+
+    if (driver->midi)
+        (driver->midi->read)(driver->midi, nframes);
+
+	nread = 0;
+
+	if (snd_pcm_mmap_begin (driver->capture_handle,
+				&driver->capture_areas,
+				&offset, &nframes_) < 0) {
+		jack_error ("ALSA/USX2Y: %s: mmap areas info error",
+			    driver->alsa_name_capture);
+		return -1;
+	}
+
+	for (chn = 0, node = driver->capture_ports;
+	     node; node = jack_slist_next (node), chn++) {
+		port = (jack_port_t *) node->data;
+		if (!jack_port_connected (port)) {
+			continue;
+		}
+		buf[chn] = jack_port_get_buffer (port, nframes_);
+	}
+
+	while (nframes) {
+
+		contiguous = nframes;
+		if (usx2y_driver_get_channel_addresses_capture (
+			    driver, &contiguous) < 0) {
+			return -1;
+		}
+		for (chn = 0, node = driver->capture_ports;
+		     node; node = jack_slist_next (node), chn++) {
+			port = (jack_port_t *) node->data;
+			if (!jack_port_connected (port)) {
+				/* no-copy optimization */
+				continue;
+			}
+			alsa_driver_read_from_channel (driver, chn,
+						       buf[chn] + nread,
+						       contiguous);
+/* 			sample_move_dS_s24(buf[chn] + nread, */
+/* 					   driver->capture_addr[chn], */
+/* 					   contiguous, */
+/* 					   driver->capture_interleave_skip); */
+		}
+		nread += contiguous;
+		nframes -= contiguous;
+	}
+
+	if ((err = snd_pcm_mmap_commit (driver->capture_handle,
+					offset, nframes_)) < 0) {
+		jack_error ("ALSA/USX2Y: could not complete read of %"
+			    PRIu32 " frames: error = %d", nframes_, err);
+		return -1;
+	}
+
+	return 0;
+}
+
+static int
+usx2y_driver_write (alsa_driver_t* driver, jack_nframes_t nframes)
+{
+	channel_t chn;
+	JSList *node;
+	jack_default_audio_sample_t* buf[2];
+	snd_pcm_sframes_t nwritten;
+	snd_pcm_uframes_t contiguous;
+	snd_pcm_uframes_t offset;
+	jack_port_t *port;
+	int err;
+	snd_pcm_uframes_t nframes_ = nframes;
+
+	driver->process_count++;
+
+	if (!driver->playback_handle || driver->engine->freewheeling) {
+		return 0;
+	}
+
+    if (driver->midi)
+        (driver->midi->write)(driver->midi, nframes);
+
+	nwritten = 0;
+
+	/* check current input monitor request status */
+
+	driver->input_monitor_mask = 0;
+
+	for (chn = 0, node = driver->capture_ports; node;
+		node = jack_slist_next (node), chn++) {
+		if (((jack_port_t *) node->data)->shared->monitor_requests) {
+			driver->input_monitor_mask |= (1<<chn);
+		}
+	}
+
+	if (driver->hw_monitoring) {
+		if ((driver->hw->input_monitor_mask
+			!= driver->input_monitor_mask)
+			&& !driver->all_monitor_in) {
+			driver->hw->set_input_monitor_mask (
+				driver->hw, driver->input_monitor_mask);
+		}
+	}
+
+	if (snd_pcm_mmap_begin(driver->playback_handle,
+			       &driver->playback_areas,
+			       &offset, &nframes_) < 0) {
+		jack_error ("ALSA/USX2Y: %s: mmap areas info error",
+			    driver->alsa_name_capture);
+		return -1;
+	}
+
+	for (chn = 0, node = driver->playback_ports;
+	     node; node = jack_slist_next (node), chn++) {
+		port = (jack_port_t *) node->data;
+		buf[chn] = jack_port_get_buffer (port, nframes_);
+	}
+
+	while (nframes) {
+
+		contiguous = nframes;
+		if (usx2y_driver_get_channel_addresses_playback (
+			    driver, &contiguous) < 0) {
+			return -1;
+		}
+		for (chn = 0, node = driver->playback_ports;
+		     node; node = jack_slist_next (node), chn++) {
+			port = (jack_port_t *) node->data;
+			alsa_driver_write_to_channel (driver, chn,
+						      buf[chn] + nwritten,
+						      contiguous);
+		}
+		nwritten += contiguous;
+		nframes -= contiguous;
+	}
+
+	if ((err = snd_pcm_mmap_commit (driver->playback_handle,
+					offset, nframes_)) < 0) {
+		jack_error ("ALSA/USX2Y: could not complete playback of %"
+			    PRIu32 " frames: error = %d", nframes_, err);
+		if (err != EPIPE && err != ESTRPIPE)
+			return -1;
+	}
+
+	return 0;
+}
+
+static void
+usx2y_driver_setup (alsa_driver_t *driver)
+{
+	driver->nt_start = (JackDriverNTStartFunction) usx2y_driver_start;
+	driver->nt_stop = (JackDriverNTStopFunction) usx2y_driver_stop;
+	driver->read = (JackDriverReadFunction) usx2y_driver_read;
+	driver->write = (JackDriverReadFunction) usx2y_driver_write;
+	driver->null_cycle =
+		(JackDriverNullCycleFunction) usx2y_driver_null_cycle;
+}
+
+jack_hardware_t *
+jack_alsa_usx2y_hw_new (alsa_driver_t *driver)
+{
+	jack_hardware_t *hw;
+	usx2y_t *h;
+
+	int   hwdep_cardno;
+    int   hwdep_devno;
+	char *hwdep_colon;
+	char  hwdep_name[9];
+	snd_hwdep_t *hwdep_handle;
+
+    hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));
+
+	hw->capabilities = 0;
+	hw->input_monitor_mask = 0;
+	hw->private_hw = 0;
+
+	hw->set_input_monitor_mask = usx2y_set_input_monitor_mask;
+	hw->change_sample_clock = usx2y_change_sample_clock;
+	hw->release = usx2y_release;
+
+	/* Derive the special USB US-X2Y hwdep pcm device name from
+	 * the playback one, thus allowing the use of the "rawusb"
+	 * experimental stuff if, and only if, the "hw:n,2" device
+	 * name is specified. Otherwise, fallback to generic backend.
+	 */
+	hwdep_handle = NULL;
+	hwdep_cardno = hwdep_devno = 0;
+	if ((hwdep_colon = strrchr(driver->alsa_name_playback, ':')) != NULL)
+		sscanf(hwdep_colon, ":%d,%d", &hwdep_cardno, &hwdep_devno);
+	if (hwdep_devno == 2) {
+		snprintf(hwdep_name, sizeof(hwdep_name), "hw:%d,1", hwdep_cardno);
+		if (snd_hwdep_open (&hwdep_handle, hwdep_name, O_RDWR) < 0) {
+			jack_error ("ALSA/USX2Y: Cannot open hwdep device \"%s\"", hwdep_name);
+		} else {
+			/* Allocate specific USX2Y hwdep pcm struct. */
+			h = (usx2y_t *) malloc (sizeof (usx2y_t));
+			h->driver = driver;
+			h->hwdep_handle = hwdep_handle;
+			hw->private_hw = h;
+			/* Set our own operational function pointers. */
+			usx2y_driver_setup(driver);
+			jack_info("ALSA/USX2Y: EXPERIMENTAL hwdep pcm device %s"
+				" (aka \"rawusb\")", driver->alsa_name_playback);
+		}
+	}
+
+	return hw;
+}
diff --git a/linux/alsa/usx2y.h b/linux/alsa/usx2y.h
new file mode 100644
index 0000000..522d19a
--- /dev/null
+++ b/linux/alsa/usx2y.h
@@ -0,0 +1,67 @@
+/*
+    Copyright (C) 2001 Paul Davis
+    Copyright (C) 2004 Karsten Wiese, Rui Nuno Capela
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: usx2y.h 855 2004-12-28 05:50:18Z joq $
+*/
+
+#ifndef __jack_usx2y_h__
+#define __jack_usx2y_h__
+
+#define USX2Y_MAXPACK		50
+#define USX2Y_MAXBUFFERMS	100
+#define USX2Y_MAXSTRIDE	3
+
+#define USX2Y_SSS (((USX2Y_MAXPACK * USX2Y_MAXBUFFERMS * USX2Y_MAXSTRIDE + 4096) / 4096) * 4096)
+
+struct snd_usX2Y_hwdep_pcm_shm
+{
+    char playback[USX2Y_SSS];
+    char capture0x8[USX2Y_SSS];
+    char capture0xA[USX2Y_SSS];
+    volatile int playback_iso_head;
+    int playback_iso_start;
+    struct
+    {
+        int	frame,
+        offset,
+        length;
+    }
+    captured_iso[128];
+    volatile int captured_iso_head;
+    volatile unsigned captured_iso_frames;
+    int capture_iso_start;
+};
+typedef struct snd_usX2Y_hwdep_pcm_shm snd_usX2Y_hwdep_pcm_shm_t;
+
+typedef struct
+{
+    alsa_driver_t *driver;
+    snd_hwdep_t *hwdep_handle;
+    struct pollfd pfds;
+    struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
+    int playback_iso_start;
+    int playback_iso_bytes_done;
+    int capture_iso_start;
+    int capture_iso_bytes_done;
+}
+usx2y_t;
+
+jack_hardware_t *
+jack_alsa_usx2y_hw_new (alsa_driver_t *driver);
+
+#endif /* __jack_usx2y_h__*/
diff --git a/linux/cycles.h b/linux/cycles.h
new file mode 100644
index 0000000..51be192
--- /dev/null
+++ b/linux/cycles.h
@@ -0,0 +1,108 @@
+/*
+  Copyright (C) 2001 Paul Davis
+  Code derived from various headers from the Linux kernel
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+  $Id: cycles.h,v 1.4.2.1 2006/06/20 14:44:00 letz Exp $
+*/
+
+#ifndef __jack_cycles_h__
+#define __jack_cycles_h__
+
+/*
+ * Standard way to access the cycle counter on i586+ CPUs.
+ * Currently only used on SMP.
+ *
+ * If you really have a SMP machine with i486 chips or older,
+ * compile for that, and this will just always return zero.
+ * That's ok, it just means that the nicer scheduling heuristics
+ * won't work for you.
+ *
+ * We only use the low 32 bits, and we'd simply better make sure
+ * that we reschedule before that wraps. Scheduling at least every
+ * four billion cycles just basically sounds like a good idea,
+ * regardless of how fast the machine is.
+ */
+
+#ifdef __linux__
+
+#ifdef __x86_64__
+
+typedef unsigned long cycles_t;
+extern cycles_t cacheflush_time;
+
+static inline unsigned long get_cycles(void)
+{
+    unsigned int hi, lo;
+    __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+    return (((unsigned long)hi)<<32) | ((unsigned long)lo);
+}
+
+#endif
+
+#ifdef __PPC__
+
+/* PowerPC */
+
+#define CPU_FTR_601			0x00000100
+
+typedef unsigned long cycles_t;
+
+/* For the "cycle" counter we use the timebase lower half. */
+
+extern cycles_t cacheflush_time;
+
+static inline cycles_t get_cycles(void)
+{
+    cycles_t ret = 0;
+
+    __asm__ __volatile__(
+        "98:	mftb %0\n"
+        "99:\n"
+        ".section __ftr_fixup,\"a\"\n"
+        "	.long %1\n"
+        "	.long 0\n"
+        "	.long 98b\n"
+        "	.long 99b\n"
+        ".previous"
+    : "=r" (ret) : "i" (CPU_FTR_601));
+    return ret;
+}
+
+#endif
+
+#ifdef __i386__
+
+typedef unsigned long long cycles_t;
+
+extern cycles_t cacheflush_time;
+
+#define rdtscll(val) \
+     __asm__ __volatile__("rdtsc" : "=A" (val))
+
+static inline cycles_t get_cycles (void)
+{
+    unsigned long long ret;
+
+    rdtscll(ret);
+    return ret;
+}
+
+#endif
+
+#endif
+
+#endif /* __jack_cycles_h__ */
diff --git a/linux/driver.h b/linux/driver.h
new file mode 100644
index 0000000..4e353b4
--- /dev/null
+++ b/linux/driver.h
@@ -0,0 +1,302 @@
+/*
+   Copyright (C) 2001 Paul Davis
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   $Id: driver.h,v 1.2 2005/11/23 11:24:29 letz Exp $
+*/
+
+#ifndef __jack_driver_h__
+#define __jack_driver_h__
+
+#include <pthread.h>
+#include "types.h"
+#include "jslist.h"
+#include "driver_interface.h"
+
+typedef float gain_t;
+typedef long channel_t;
+
+typedef	enum {
+    Lock = 0x1,
+    NoLock = 0x2,
+    Sync = 0x4,
+    NoSync = 0x8
+} ClockSyncStatus;
+
+typedef void (*ClockSyncListenerFunction)(channel_t, ClockSyncStatus, void*);
+
+typedef struct
+{
+    unsigned long id;
+    ClockSyncListenerFunction function;
+    void *arg;
+}
+ClockSyncListener;
+
+struct _jack_engine;
+struct _jack_driver;
+
+typedef int (*JackDriverAttachFunction)(struct _jack_driver *,
+                                        struct _jack_engine *);
+typedef int (*JackDriverDetachFunction)(struct _jack_driver *,
+                                        struct _jack_engine *);
+typedef int (*JackDriverReadFunction)(struct _jack_driver *,
+                                      jack_nframes_t nframes);
+typedef int (*JackDriverWriteFunction)(struct _jack_driver *,
+                                       jack_nframes_t nframes);
+typedef int (*JackDriverNullCycleFunction)(struct _jack_driver *,
+        jack_nframes_t nframes);
+typedef int (*JackDriverStopFunction)(struct _jack_driver *);
+typedef int (*JackDriverStartFunction)(struct _jack_driver *);
+typedef int	(*JackDriverBufSizeFunction)(struct _jack_driver *,
+        jack_nframes_t nframes);
+/*
+   Call sequence summary:
+
+     1) engine loads driver via runtime dynamic linking
+	 - calls jack_driver_load
+	 - we call dlsym for "driver_initialize" and execute it
+     2) engine attaches to driver
+     3) engine starts driver
+     4) driver runs its own thread, calling
+         while () {
+          driver->wait ();
+	  driver->engine->run_cycle ()
+         }
+     5) engine stops driver
+     6) engine detaches from driver
+     7) engine calls driver `finish' routine
+
+     Note that stop/start may be called multiple times in the event of an
+     error return from the `wait' function.
+*/
+
+typedef struct _jack_driver
+{
+
+    /* The _jack_driver structure fields are included at the beginning of
+       each driver-specific structure using the JACK_DRIVER_DECL macro,
+       which is defined below.  The comments that follow describe each
+       common field.
+      
+       The driver should set this to be the interval it expects to elapse
+       between returning from the `wait' function. if set to zero, it
+       implies that the driver does not expect regular periodic wakeups.
+     
+        jack_time_t period_usecs;
+     
+     
+       The driver should set this within its "wait" function to indicate
+       the UST of the most recent determination that the engine cycle
+       should run. it should not be set if the "extra_fd" argument of
+       the wait function is set to a non-zero value.
+     
+        jack_time_t last_wait_ust;
+     
+     
+       These are not used by the driver.  They should not be written to or
+       modified in any way
+     
+        void *handle;
+        struct _jack_internal_client *internal_client;
+     
+       This should perform any cleanup associated with the driver. it will
+       be called when jack server process decides to get rid of the
+       driver. in some systems, it may not be called at all, so the driver
+       should never rely on a call to this. it can set it to NULL if
+       it has nothing do do.
+     
+        void (*finish)(struct _jack_driver *);
+     
+     
+       The JACK engine will call this when it wishes to attach itself to
+       the driver. the engine will pass a pointer to itself, which the driver
+       may use in anyway it wishes to. the driver may assume that this
+       is the same engine object that will make `wait' calls until a
+       `detach' call is made.
+     
+        JackDriverAttachFunction attach;
+     
+     
+       The JACK engine will call this when it is finished using a driver.
+     
+        JackDriverDetachFunction detach;
+     
+     
+       The JACK engine will call this when it wants to wait until the 
+       driver decides that its time to process some data. the driver returns
+       a count of the number of audioframes that can be processed. 
+     
+       it should set the variable pointed to by `status' as follows:
+     
+       zero: the wait completed normally, processing may begin
+       negative: the wait failed, and recovery is not possible
+       positive: the wait failed, and the driver stopped itself.
+    	       a call to `start' will return the driver to	
+    	       a correct and known state.
+     
+       the driver should also fill out the `delayed_usecs' variable to
+       indicate any delay in its expected periodic execution. for example,
+       if it discovers that its return from poll(2) is later than it
+       expects it to be, it would place an estimate of the delay
+       in this variable. the engine will use this to decide if it 
+       plans to continue execution.
+     
+        JackDriverWaitFunction wait;
+     
+     
+       The JACK engine will call this to ask the driver to move
+       data from its inputs to its output port buffers. it should
+       return 0 to indicate successful completion, negative otherwise. 
+     
+       This function will always be called after the wait function (above).
+     
+        JackDriverReadFunction read;
+     
+     
+       The JACK engine will call this to ask the driver to move
+       data from its input port buffers to its outputs. it should
+       return 0 to indicate successful completion, negative otherwise. 
+     
+       this function will always be called after the read function (above).
+     
+        JackDriverWriteFunction write;
+     
+     
+       The JACK engine will call this after the wait function (above) has
+       been called, but for some reason the engine is unable to execute
+       a full "cycle". the driver should do whatever is necessary to
+       keep itself running correctly, but cannot reference ports
+       or other JACK data structures in any way.
+     
+        JackDriverNullCycleFunction null_cycle;
+     
+        
+       The engine will call this when it plans to stop calling the `wait'
+       function for some period of time. the driver should take
+       appropriate steps to handle this (possibly no steps at all).
+       NOTE: the driver must silence its capture buffers (if any)
+       from within this function or the function that actually
+       implements the change in state.
+     
+        JackDriverStopFunction stop;
+     
+     
+       The engine will call this to let the driver know that it plans
+       to start calling the `wait' function on a regular basis. the driver
+       should take any appropriate steps to handle this (possibly no steps
+       at all). NOTE: The driver may wish to silence its playback buffers
+       (if any) from within this function or the function that actually
+       implements the change in state.
+       
+        JackDriverStartFunction start;
+     
+       The engine will call this to let the driver know that some client
+       has requested a new buffer size.  The stop function will be called
+       prior to this, and the start function after this one has returned.
+     
+        JackDriverBufSizeFunction bufsize;
+    */
+
+    /* define the fields here... */
+#define JACK_DRIVER_DECL \
+    jack_time_t period_usecs; \
+    jack_time_t last_wait_ust; \
+    void *handle; \
+    struct _jack_client_internal * internal_client; \
+    void (*finish)(struct _jack_driver *);\
+    JackDriverAttachFunction attach; \
+    JackDriverDetachFunction detach; \
+    JackDriverReadFunction read; \
+    JackDriverWriteFunction write; \
+    JackDriverNullCycleFunction null_cycle; \
+    JackDriverStopFunction stop; \
+    JackDriverStartFunction start; \
+    JackDriverBufSizeFunction bufsize;
+
+    JACK_DRIVER_DECL			/* expand the macro */
+}
+jack_driver_t;
+
+typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
+
+void jack_driver_init (jack_driver_t *);
+void jack_driver_release (jack_driver_t *);
+
+jack_driver_t *jack_driver_load (int argc, char **argv);
+void jack_driver_unload (jack_driver_t *);
+
+/****************************
+ *** Non-Threaded Drivers ***
+ ****************************/
+
+/*
+   Call sequence summary:
+
+     1) engine loads driver via runtime dynamic linking
+	 - calls jack_driver_load
+	 - we call dlsym for "driver_initialize" and execute it
+         - driver_initialize calls jack_driver_nt_init
+     2) nt layer attaches to driver
+     3) nt layer starts driver
+     4) nt layer runs a thread, calling
+         while () {
+           driver->nt_run_ctcle();
+         }
+     5) nt layer stops driver
+     6) nt layer detaches driver
+     7) engine calls driver `finish' routine which calls jack_driver_nt_finish
+
+     Note that stop/start may be called multiple times in the event of an
+     error return from the `wait' function.
+*/
+
+struct _jack_driver_nt;
+
+typedef int (*JackDriverNTAttachFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTDetachFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTStopFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTStartFunction)(struct _jack_driver_nt *);
+typedef int	(*JackDriverNTBufSizeFunction)(struct _jack_driver_nt *,
+        jack_nframes_t nframes);
+typedef int (*JackDriverNTRunCycleFunction)(struct _jack_driver_nt *);
+
+typedef struct _jack_driver_nt
+{
+#define JACK_DRIVER_NT_DECL \
+    JACK_DRIVER_DECL \
+    struct _jack_engine * engine; \
+    volatile int nt_run; \
+    pthread_t nt_thread; \
+    pthread_mutex_t nt_run_lock; \
+    JackDriverNTAttachFunction nt_attach; \
+    JackDriverNTDetachFunction nt_detach; \
+    JackDriverNTStopFunction nt_stop; \
+    JackDriverNTStartFunction nt_start; \
+    JackDriverNTBufSizeFunction nt_bufsize; \
+    JackDriverNTRunCycleFunction nt_run_cycle;
+#define nt_read read
+#define nt_write write
+#define nt_null_cycle null_cycle
+
+    JACK_DRIVER_NT_DECL
+}
+jack_driver_nt_t;
+
+void jack_driver_nt_init (jack_driver_nt_t * driver);
+void jack_driver_nt_finish (jack_driver_nt_t * driver);
+
+#endif /* __jack_driver_h__ */
diff --git a/linux/firewire/JackFFADODriver.cpp b/linux/firewire/JackFFADODriver.cpp
new file mode 100644
index 0000000..735aace
--- /dev/null
+++ b/linux/firewire/JackFFADODriver.cpp
@@ -0,0 +1,945 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004 Grame
+Copyright (C) 2007 Pieter Palmers
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <unistd.h>
+#include <math.h>
+#include <stdio.h>
+#include <memory.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <regex.h>
+#include <string.h>
+
+#include "JackFFADODriver.h"
+#include "JackFFADOMidiInput.h"
+#include "JackFFADOMidiOutput.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackPort.h"
+#include "JackGraphManager.h"
+#include "JackCompilerDeps.h"
+
+namespace Jack
+{
+
+#define FIREWIRE_REQUIRED_FFADO_API_VERSION 8
+
+#define jack_get_microseconds GetMicroSeconds
+
+int
+JackFFADODriver::ffado_driver_read (ffado_driver_t * driver, jack_nframes_t nframes)
+{
+    channel_t chn;
+    jack_default_audio_sample_t* buf = NULL;
+
+    printEnter();
+    for (chn = 0; chn < driver->capture_nchannels; chn++) {
+        // if nothing connected, don't process
+        if (fGraphManager->GetConnectionsNum(fCapturePortList[chn]) == 0) {
+            buf = (jack_default_audio_sample_t*)driver->scratchbuffer;
+            // we always have to specify a valid buffer
+            ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(buf));
+            // notify the streaming system that it can (but doesn't have to) skip
+            // this channel
+            ffado_streaming_capture_stream_onoff(driver->dev, chn, 0);
+        } else {
+            if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
+                buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[chn],  nframes);
+
+                /* if the returned buffer is invalid, use the dummy buffer */
+                if (!buf) buf = (jack_default_audio_sample_t*)driver->scratchbuffer;
+
+                ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(buf));
+                ffado_streaming_capture_stream_onoff(driver->dev, chn, 1);
+            } else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
+                ffado_streaming_set_capture_stream_buffer(driver->dev, chn,
+                        (char *)(driver->capture_channels[chn].midi_buffer));
+                ffado_streaming_capture_stream_onoff(driver->dev, chn, 1);
+            } else { // always have a valid buffer
+                ffado_streaming_set_capture_stream_buffer(driver->dev, chn, (char *)(driver->scratchbuffer));
+                // don't process what we don't use
+                ffado_streaming_capture_stream_onoff(driver->dev, chn, 0);
+            }
+        }
+    }
+
+    /* now transfer the buffers */
+    ffado_streaming_transfer_capture_buffers(driver->dev);
+
+    /* process the midi data */
+    for (chn = 0; chn < driver->capture_nchannels; chn++) {
+        if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
+            JackFFADOMidiInput *midi_input = (JackFFADOMidiInput *) driver->capture_channels[chn].midi_input;
+            JackMidiBuffer *buffer = (JackMidiBuffer *) fGraphManager->GetBuffer(fCapturePortList[chn], nframes);
+            if (! buffer) {
+                continue;
+            }
+            midi_input->SetInputBuffer(driver->capture_channels[chn].midi_buffer);
+            midi_input->SetPortBuffer(buffer);
+            midi_input->Process(nframes);
+        }
+    }
+
+    printExit();
+    return 0;
+}
+
+int
+JackFFADODriver::ffado_driver_write (ffado_driver_t * driver, jack_nframes_t nframes)
+{
+    channel_t chn;
+    jack_default_audio_sample_t* buf;
+    printEnter();
+
+    driver->process_count++;
+
+    for (chn = 0; chn < driver->playback_nchannels; chn++) {
+        if (fGraphManager->GetConnectionsNum(fPlaybackPortList[chn]) == 0) {
+            buf = (jack_default_audio_sample_t*)driver->nullbuffer;
+            // we always have to specify a valid buffer
+            ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(buf));
+            // notify the streaming system that it can (but doesn't have to) skip
+            // this channel
+            ffado_streaming_playback_stream_onoff(driver->dev, chn, 0);
+        } else {
+            if (driver->playback_channels[chn].stream_type == ffado_stream_type_audio) {
+                buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], nframes);
+                /* use the silent buffer if there is no valid jack buffer */
+                if (!buf) buf = (jack_default_audio_sample_t*)driver->nullbuffer;
+                ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(buf));
+                ffado_streaming_playback_stream_onoff(driver->dev, chn, 1);
+            } else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
+                uint32_t *midi_buffer = driver->playback_channels[chn].midi_buffer;
+                memset(midi_buffer, 0, nframes * sizeof(uint32_t));
+                buf = (jack_default_audio_sample_t *) fGraphManager->GetBuffer(fPlaybackPortList[chn], nframes);
+                ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(midi_buffer));
+                /* if the returned buffer is invalid, continue */
+                if (!buf) {
+                    ffado_streaming_playback_stream_onoff(driver->dev, chn, 0);
+                    continue;
+                }
+                ffado_streaming_playback_stream_onoff(driver->dev, chn, 1);
+                JackFFADOMidiOutput *midi_output = (JackFFADOMidiOutput *) driver->playback_channels[chn].midi_output;
+                midi_output->SetPortBuffer((JackMidiBuffer *) buf);
+                midi_output->SetOutputBuffer(midi_buffer);
+                midi_output->Process(nframes);
+
+            } else { // always have a valid buffer
+                ffado_streaming_set_playback_stream_buffer(driver->dev, chn, (char *)(driver->nullbuffer));
+                ffado_streaming_playback_stream_onoff(driver->dev, chn, 0);
+            }
+        }
+    }
+
+    ffado_streaming_transfer_playback_buffers(driver->dev);
+
+    printExit();
+    return 0;
+}
+
+jack_nframes_t
+JackFFADODriver::ffado_driver_wait (ffado_driver_t *driver, int extra_fd, int *status,
+                                    float *delayed_usecs)
+{
+    jack_time_t wait_enter;
+    jack_time_t wait_ret;
+    ffado_wait_response response;
+
+    printEnter();
+
+    wait_enter = jack_get_microseconds ();
+    if (wait_enter > driver->wait_next) {
+        /*
+                * This processing cycle was delayed past the
+                * next due interrupt!  Do not account this as
+                * a wakeup delay:
+                */
+        driver->wait_next = 0;
+        driver->wait_late++;
+    }
+// *status = -2; interrupt
+// *status = -3; timeout
+// *status = -4; extra FD
+
+    response = ffado_streaming_wait(driver->dev);
+
+    wait_ret = jack_get_microseconds ();
+
+    if (driver->wait_next && wait_ret > driver->wait_next) {
+        *delayed_usecs = wait_ret - driver->wait_next;
+    }
+    driver->wait_last = wait_ret;
+    driver->wait_next = wait_ret + driver->period_usecs;
+//         driver->engine->transport_cycle_start (driver->engine, wait_ret);
+
+    if(response == ffado_wait_ok) {
+       // all good
+       *status = 0;
+    } else if (response == ffado_wait_xrun) {
+        // xrun happened, but it's handled
+        *status = 0;
+        return 0;
+    } else if (response == ffado_wait_error) {
+        // an error happened (unhandled xrun)
+        // this should be fatal
+        jack_error("JackFFADODriver::ffado_driver_wait - unhandled xrun");
+        *status = -1;
+        return 0;
+    } else if (response == ffado_wait_shutdown) {
+        // ffado requested shutdown (e.g. device unplugged)
+        // this should be fatal
+        jack_error("JackFFADODriver::ffado_driver_wait - shutdown requested "
+                   "(device unplugged?)");
+        *status = -1;
+        return 0;
+    } else {
+        // unknown response code. should be fatal
+        // this should be fatal
+        jack_error("JackFFADODriver::ffado_driver_wait - unexpected error "
+                   "code '%d' returned from 'ffado_streaming_wait'", response);
+        *status = -1;
+        return 0;
+    }
+
+    fBeginDateUst = wait_ret;
+
+    printExit();
+    return driver->period_size;
+}
+
+int
+JackFFADODriver::ffado_driver_start (ffado_driver_t *driver)
+{
+    int retval = 0;
+
+    if ((retval = ffado_streaming_start(driver->dev))) {
+        printError("Could not start streaming threads");
+
+        return retval;
+    }
+    return 0;
+}
+
+int
+JackFFADODriver::ffado_driver_stop (ffado_driver_t *driver)
+{
+    int retval = 0;
+
+    if ((retval = ffado_streaming_stop(driver->dev))) {
+        printError("Could not stop streaming threads");
+        return retval;
+    }
+
+    return 0;
+}
+
+int
+JackFFADODriver::ffado_driver_restart (ffado_driver_t *driver)
+{
+    if (Stop())
+        return -1;
+    return Start();
+}
+
+int
+JackFFADODriver::SetBufferSize (jack_nframes_t nframes)
+{
+    printError("Buffer size change requested but not supported!!!");
+
+    /*
+    driver->period_size = nframes; 
+    driver->period_usecs =
+            (jack_time_t) floor ((((float) nframes) / driver->sample_rate)
+                                 * 1000000.0f);
+    */
+
+    /* tell the engine to change its buffer size */
+    //driver->engine->set_buffer_size (driver->engine, nframes);
+
+    return -1; // unsupported
+}
+
+typedef void (*JackDriverFinishFunction) (jack_driver_t *);
+
+ffado_driver_t *
+JackFFADODriver::ffado_driver_new (const char *name,
+                                   ffado_jack_settings_t *params)
+{
+    ffado_driver_t *driver;
+
+    assert(params);
+
+    if (ffado_get_api_version() != FIREWIRE_REQUIRED_FFADO_API_VERSION) {
+        printError("Incompatible libffado version! (%s)", ffado_get_version());
+        return NULL;
+    }
+
+    printMessage("Starting FFADO backend (%s)", ffado_get_version());
+
+    driver = (ffado_driver_t*)calloc (1, sizeof (ffado_driver_t));
+
+    /* Setup the jack interfaces */
+    jack_driver_nt_init ((jack_driver_nt_t *) driver);
+
+    /*        driver->nt_attach    = (JackDriverNTAttachFunction)   ffado_driver_attach;
+            driver->nt_detach    = (JackDriverNTDetachFunction)   ffado_driver_detach;
+            driver->nt_start     = (JackDriverNTStartFunction)    ffado_driver_start;
+            driver->nt_stop      = (JackDriverNTStopFunction)     ffado_driver_stop;
+            driver->nt_run_cycle = (JackDriverNTRunCycleFunction) ffado_driver_run_cycle;
+            driver->null_cycle   = (JackDriverNullCycleFunction)  ffado_driver_null_cycle;
+            driver->write        = (JackDriverReadFunction)       ffado_driver_write;
+            driver->read         = (JackDriverReadFunction)       ffado_driver_read;
+            driver->nt_bufsize   = (JackDriverNTBufSizeFunction)  ffado_driver_bufsize;
+            */
+
+    /* copy command line parameter contents to the driver structure */
+    memcpy(&driver->settings, params, sizeof(ffado_jack_settings_t));
+
+    /* prepare all parameters */
+    driver->sample_rate = params->sample_rate;
+    driver->period_size = params->period_size;
+    fBeginDateUst = 0;
+
+    driver->period_usecs =
+        (jack_time_t) floor ((((float) driver->period_size) * 1000000.0f) / driver->sample_rate);
+
+//         driver->client = client;
+    driver->engine = NULL;
+
+    memset(&driver->device_options, 0, sizeof(driver->device_options));
+    driver->device_options.sample_rate = params->sample_rate;
+    driver->device_options.period_size = params->period_size;
+    driver->device_options.nb_buffers = params->buffer_size;
+    driver->device_options.verbose = params->verbose_level;
+    driver->capture_frame_latency = params->capture_frame_latency;
+    driver->playback_frame_latency = params->playback_frame_latency;
+
+    debugPrint(DEBUG_LEVEL_STARTUP, " Driver compiled on %s %s", __DATE__, __TIME__);
+    debugPrint(DEBUG_LEVEL_STARTUP, " Created driver %s", name);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            period_size:   %d", driver->device_options.period_size);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            period_usecs:  %d", driver->period_usecs);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            sample rate:   %d", driver->device_options.sample_rate);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            verbose level: %d", driver->device_options.verbose);
+
+    return (ffado_driver_t *) driver;
+}
+
+void
+JackFFADODriver::ffado_driver_delete (ffado_driver_t *driver)
+{
+    free (driver);
+}
+
+int JackFFADODriver::Attach()
+{
+    JackPort* port;
+    int port_index;
+    char buf[JACK_PORT_NAME_SIZE];
+    char portname[JACK_PORT_NAME_SIZE];
+
+    ffado_driver_t* driver = (ffado_driver_t*)fDriver;
+
+    jack_log("JackFFADODriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    g_verbose = (fEngineControl->fVerbose ? 1 : 0);
+
+    /* preallocate some buffers such that they don't have to be allocated
+       in RT context (or from the stack)
+     */
+    /* the null buffer is a buffer that contains one period of silence */
+    driver->nullbuffer = (ffado_sample_t *)calloc(driver->period_size, sizeof(ffado_sample_t));
+    if (driver->nullbuffer == NULL) {
+        printError("could not allocate memory for null buffer");
+        return -1;
+    }
+    /* calloc should do this, but it can't hurt to be sure */
+    memset(driver->nullbuffer, 0, driver->period_size*sizeof(ffado_sample_t));
+
+    /* the scratch buffer is a buffer of one period that can be used as dummy memory */
+    driver->scratchbuffer = (ffado_sample_t *)calloc(driver->period_size, sizeof(ffado_sample_t));
+    if (driver->scratchbuffer == NULL) {
+        printError("could not allocate memory for scratch buffer");
+        return -1;
+    }
+
+    /* packetizer thread options */
+    driver->device_options.realtime = (fEngineControl->fRealTime ? 1 : 0);
+
+    driver->device_options.packetizer_priority = fEngineControl->fServerPriority +
+            FFADO_RT_PRIORITY_PACKETIZER_RELATIVE;
+    if (driver->device_options.packetizer_priority > 98) {
+        driver->device_options.packetizer_priority = 98;
+    }
+
+    // initialize the thread
+    driver->dev = ffado_streaming_init(driver->device_info, driver->device_options);
+
+    if (!driver->dev) {
+        printError("FFADO: Error creating virtual device");
+        return -1;
+    }
+
+    if (driver->device_options.realtime) {
+        printMessage("Streaming thread running with Realtime scheduling, priority %d",
+                     driver->device_options.packetizer_priority);
+    } else {
+        printMessage("Streaming thread running without Realtime scheduling");
+    }
+
+    ffado_streaming_set_audio_datatype(driver->dev, ffado_audio_datatype_float);
+
+    /* ports */
+
+    // capture
+    driver->capture_nchannels = ffado_streaming_get_nb_capture_streams(driver->dev);
+    driver->capture_channels = (ffado_capture_channel_t *)calloc(driver->capture_nchannels, sizeof(ffado_capture_channel_t));
+    if (driver->capture_channels == NULL) {
+        printError("could not allocate memory for capture channel list");
+        return -1;
+    }
+
+    fCaptureChannels = 0;
+    for (channel_t chn = 0; chn < driver->capture_nchannels; chn++) {
+        ffado_streaming_get_capture_stream_name(driver->dev, chn, portname, sizeof(portname) - 1);
+
+        driver->capture_channels[chn].stream_type = ffado_streaming_get_capture_stream_type(driver->dev, chn);
+        if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
+            snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
+            printMessage ("Registering audio capture port %s", buf);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
+                              JACK_DEFAULT_AUDIO_TYPE,
+                              CaptureDriverFlags,
+                              fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("driver: cannot register port for %s", buf);
+                return -1;
+            }
+
+            // setup port parameters
+            if (ffado_streaming_set_capture_stream_buffer(driver->dev, chn, NULL)) {
+                printError(" cannot configure initial port buffer for %s", buf);
+            }
+            ffado_streaming_capture_stream_onoff(driver->dev, chn, 0);
+
+            port = fGraphManager->GetPort(port_index);
+            port->SetLatency(driver->period_size + driver->capture_frame_latency);
+            // capture port aliases (jackd1 style port names)
+            snprintf(buf, sizeof(buf) - 1, "%s:capture_%i", fClientControl.fName, (int) chn + 1);
+            port->SetAlias(buf);
+            fCapturePortList[chn] = port_index;
+            jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
+            fCaptureChannels++;
+
+        } else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
+            snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
+            printMessage ("Registering midi capture port %s", buf);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
+                              JACK_DEFAULT_MIDI_TYPE,
+                              CaptureDriverFlags,
+                              fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("driver: cannot register port for %s", buf);
+                return -1;
+            }
+
+            // setup port parameters
+            if (ffado_streaming_set_capture_stream_buffer(driver->dev, chn, NULL)) {
+                printError(" cannot configure initial port buffer for %s", buf);
+            }
+            if (ffado_streaming_capture_stream_onoff(driver->dev, chn, 0)) {
+                printError(" cannot enable port %s", buf);
+            }
+
+            driver->capture_channels[chn].midi_input = new JackFFADOMidiInput();
+            // setup the midi buffer
+            driver->capture_channels[chn].midi_buffer = (uint32_t *)calloc(driver->period_size, sizeof(uint32_t));
+
+            port = fGraphManager->GetPort(port_index);
+            port->SetLatency(driver->period_size + driver->capture_frame_latency);
+            fCapturePortList[chn] = port_index;
+            jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
+            fCaptureChannels++;
+        } else {
+            printMessage ("Don't register capture port %s", portname);
+        }
+    }
+
+    // playback
+    driver->playback_nchannels = ffado_streaming_get_nb_playback_streams(driver->dev);
+    driver->playback_channels = (ffado_playback_channel_t *)calloc(driver->playback_nchannels, sizeof(ffado_playback_channel_t));
+    if (driver->playback_channels == NULL) {
+        printError("could not allocate memory for playback channel list");
+        return -1;
+    }
+
+    fPlaybackChannels = 0;
+    for (channel_t chn = 0; chn < driver->playback_nchannels; chn++) {
+        ffado_streaming_get_playback_stream_name(driver->dev, chn, portname, sizeof(portname) - 1);
+
+        driver->playback_channels[chn].stream_type = ffado_streaming_get_playback_stream_type(driver->dev, chn);
+
+        if (driver->playback_channels[chn].stream_type == ffado_stream_type_audio) {
+            snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
+            printMessage ("Registering audio playback port %s", buf);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
+                              JACK_DEFAULT_AUDIO_TYPE,
+                              PlaybackDriverFlags,
+                              fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("driver: cannot register port for %s", buf);
+                return -1;
+            }
+
+            // setup port parameters
+            if (ffado_streaming_set_playback_stream_buffer(driver->dev, chn, NULL)) {
+                printError(" cannot configure initial port buffer for %s", buf);
+            }
+            if (ffado_streaming_playback_stream_onoff(driver->dev, chn, 0)) {
+                printError(" cannot enable port %s", buf);
+            }
+
+            port = fGraphManager->GetPort(port_index);
+            // Add one buffer more latency if "async" mode is used...
+            port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + driver->playback_frame_latency);
+            // playback port aliases (jackd1 style port names)
+            snprintf(buf, sizeof(buf) - 1, "%s:playback_%i", fClientControl.fName, (int) chn + 1);
+            port->SetAlias(buf);
+            fPlaybackPortList[chn] = port_index;
+            jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index);
+            fPlaybackChannels++;
+        } else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
+            snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
+            printMessage ("Registering midi playback port %s", buf);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
+                              JACK_DEFAULT_MIDI_TYPE,
+                              PlaybackDriverFlags,
+                              fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("driver: cannot register port for %s", buf);
+                return -1;
+            }
+
+            // setup port parameters
+            if (ffado_streaming_set_playback_stream_buffer(driver->dev, chn, NULL)) {
+                printError(" cannot configure initial port buffer for %s", buf);
+            }
+            if (ffado_streaming_playback_stream_onoff(driver->dev, chn, 0)) {
+                printError(" cannot enable port %s", buf);
+            }
+            // setup the midi buffer
+            
+            // This constructor optionally accepts arguments for the
+            // non-realtime buffer size and the realtime buffer size.  Ideally,
+            // these would become command-line options for the FFADO driver.
+            driver->playback_channels[chn].midi_output = new JackFFADOMidiOutput();
+
+            driver->playback_channels[chn].midi_buffer = (uint32_t *)calloc(driver->period_size, sizeof(uint32_t));
+
+            port = fGraphManager->GetPort(port_index);
+            port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + driver->playback_frame_latency);
+            fPlaybackPortList[chn] = port_index;
+            jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index);
+            fPlaybackChannels++;
+        } else {
+            printMessage ("Don't register playback port %s", portname);
+        }
+    }
+
+    assert(fCaptureChannels < DRIVER_PORT_NUM);
+    assert(fPlaybackChannels < DRIVER_PORT_NUM);
+
+    if (ffado_streaming_prepare(driver->dev)) {
+        printError("Could not prepare streaming device!");
+        return -1;
+    }
+
+    // this makes no sense...
+    assert(fCaptureChannels + fPlaybackChannels > 0);
+    return 0;
+}
+
+int JackFFADODriver::Detach()
+{
+    channel_t chn;
+    ffado_driver_t* driver = (ffado_driver_t*)fDriver;
+    jack_log("JackFFADODriver::Detach");
+
+    // finish the libfreebob streaming
+    ffado_streaming_finish(driver->dev);
+    driver->dev = NULL;
+
+    // free all internal buffers
+    for (chn = 0; chn < driver->capture_nchannels; chn++) {
+        if (driver->capture_channels[chn].midi_buffer)
+            free(driver->capture_channels[chn].midi_buffer);
+        if (driver->capture_channels[chn].midi_input)
+            delete ((JackFFADOMidiInput *) (driver->capture_channels[chn].midi_input));
+    }
+    free(driver->capture_channels);
+
+    for (chn = 0; chn < driver->playback_nchannels; chn++) {
+        if (driver->playback_channels[chn].midi_buffer)
+            free(driver->playback_channels[chn].midi_buffer);
+        if (driver->playback_channels[chn].midi_output)
+            delete ((JackFFADOMidiOutput *) (driver->playback_channels[chn].midi_output));
+    }
+    free(driver->playback_channels);
+
+    free(driver->nullbuffer);
+    free(driver->scratchbuffer);
+
+    return JackAudioDriver::Detach();  // Generic JackAudioDriver Detach
+}
+
+int JackFFADODriver::Open(ffado_jack_settings_t *params)
+{
+    // Generic JackAudioDriver Open
+    if (JackAudioDriver::Open(
+                params->period_size, params->sample_rate,
+                params->playback_ports, params->playback_ports,
+                0, 0, 0, "", "",
+                params->capture_frame_latency, params->playback_frame_latency) != 0) {
+        return -1;
+    }
+
+    fDriver = (jack_driver_t *)ffado_driver_new ("ffado_pcm", params);
+
+    if (fDriver) {
+        // FFADO driver may have changed the in/out values
+        //fCaptureChannels = ((ffado_driver_t *)fDriver)->capture_nchannels_audio;
+        //fPlaybackChannels = ((ffado_driver_t *)fDriver)->playback_nchannels_audio;
+        return 0;
+    } else {
+        JackAudioDriver::Close();
+        return -1;
+    }
+}
+
+int JackFFADODriver::Close()
+{
+    JackAudioDriver::Close();
+    ffado_driver_delete((ffado_driver_t*)fDriver);
+    return 0;
+}
+
+int JackFFADODriver::Start()
+{
+    JackAudioDriver::Start();
+    return ffado_driver_start((ffado_driver_t *)fDriver);
+}
+
+int JackFFADODriver::Stop()
+{
+    return ffado_driver_stop((ffado_driver_t *)fDriver);
+}
+
+int JackFFADODriver::Read()
+{
+    printEnter();
+
+    /* Taken from ffado_driver_run_cycle */
+    ffado_driver_t* driver = (ffado_driver_t*)fDriver;
+    int wait_status = 0;
+    fDelayedUsecs = 0.f;
+
+    jack_nframes_t nframes = ffado_driver_wait(driver, -1, &wait_status,
+                             &fDelayedUsecs);
+
+    if ((wait_status < 0)) {
+        printError( "wait status < 0! (= %d)", wait_status);
+        return -1;
+    }
+
+    if (nframes == 0) {
+        /* we detected an xrun and restarted: notify
+         * clients about the delay. 
+         */
+        jack_log("FFADO XRun");
+        NotifyXRun(fBeginDateUst, fDelayedUsecs);
+        return -1;
+    }
+
+    if (nframes != fEngineControl->fBufferSize)
+        jack_log("JackFFADODriver::Read nframes = %ld", nframes);
+        
+    // Has to be done before read
+    JackDriver::CycleIncTime();
+
+    printExit();
+    return ffado_driver_read((ffado_driver_t *)fDriver, fEngineControl->fBufferSize);
+}
+
+int JackFFADODriver::Write()
+{
+    printEnter();
+    int res = ffado_driver_write((ffado_driver_t *)fDriver, fEngineControl->fBufferSize);
+    printExit();
+    return res;
+}
+
+void
+JackFFADODriver::jack_driver_init (jack_driver_t *driver)
+{
+    memset (driver, 0, sizeof (*driver));
+
+    driver->attach = 0;
+    driver->detach = 0;
+    driver->write = 0;
+    driver->read = 0;
+    driver->null_cycle = 0;
+    driver->bufsize = 0;
+    driver->start = 0;
+    driver->stop = 0;
+}
+
+void
+JackFFADODriver::jack_driver_nt_init (jack_driver_nt_t * driver)
+{
+    memset (driver, 0, sizeof (*driver));
+
+    jack_driver_init ((jack_driver_t *) driver);
+
+    driver->attach = 0;
+    driver->detach = 0;
+    driver->bufsize = 0;
+    driver->stop = 0;
+    driver->start = 0;
+
+    driver->nt_bufsize = 0;
+    driver->nt_start = 0;
+    driver->nt_stop = 0;
+    driver->nt_attach = 0;
+    driver->nt_detach = 0;
+    driver->nt_run_cycle = 0;
+}
+
+} // end of namespace
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT const jack_driver_desc_t *
+    driver_get_descriptor () {
+        jack_driver_desc_t * desc;
+        jack_driver_param_desc_t * params;
+        unsigned int i;
+
+        desc = (jack_driver_desc_t *)calloc (1, sizeof (jack_driver_desc_t));
+
+        strcpy (desc->name, "firewire");                               // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Linux FFADO API based audio backend");     // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+       
+        desc->nparams = 11;
+
+        params = (jack_driver_param_desc_t *)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+        desc->params = params;
+
+        i = 0;
+        strcpy (params[i].name, "period");
+        params[i].character  = 'p';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui   = 1024;
+        strcpy (params[i].short_desc, "Frames per period");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "nperiods");
+        params[i].character  = 'n';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui   = 3;
+        strcpy (params[i].short_desc, "Number of periods of playback latency");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "rate");
+        params[i].character  = 'r';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui   = 48000U;
+        strcpy (params[i].short_desc, "Sample rate");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "capture");
+        params[i].character  = 'C';
+        params[i].type       = JackDriverParamBool;
+        params[i].value.i    = 0;
+        strcpy (params[i].short_desc, "Provide capture ports.");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "playback");
+        params[i].character  = 'P';
+        params[i].type       = JackDriverParamBool;
+        params[i].value.i    = 0;
+        strcpy (params[i].short_desc, "Provide playback ports.");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "duplex");
+        params[i].character  = 'D';
+        params[i].type       = JackDriverParamBool;
+        params[i].value.i    = 1;
+        strcpy (params[i].short_desc, "Provide both capture and playback ports.");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "input-latency");
+        params[i].character  = 'I';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Extra input latency (frames)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "output-latency");
+        params[i].character  = 'O';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Extra output latency (frames)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "inchannels");
+        params[i].character  = 'i';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Number of input channels to provide (note: currently ignored)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "outchannels");
+        params[i].character  = 'o';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Number of output channels to provide (note: currently ignored)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "verbose");
+        params[i].character  = 'v';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 3;
+        strcpy (params[i].short_desc, "libffado verbose level");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) {
+        const JSList * node;
+        const jack_driver_param_t * param;
+
+        ffado_jack_settings_t cmlparams;
+
+        char *device_name="hw:0";
+
+        cmlparams.period_size_set = 0;
+        cmlparams.sample_rate_set = 0;
+        cmlparams.buffer_size_set = 0;
+
+        /* default values */
+        cmlparams.period_size = 1024;
+        cmlparams.sample_rate = 48000;
+        cmlparams.buffer_size = 3;
+        cmlparams.playback_ports = 0;
+        cmlparams.capture_ports = 0;
+        cmlparams.playback_frame_latency = 0;
+        cmlparams.capture_frame_latency = 0;
+
+        cmlparams.verbose_level = 0;
+
+        cmlparams.slave_mode = 0;
+        cmlparams.snoop_mode = 0;
+        cmlparams.device_info = NULL;
+
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+                case 'd':
+                    device_name = strdup (param->value.str);
+                    break;
+                case 'p':
+                    cmlparams.period_size = param->value.ui;
+                    cmlparams.period_size_set = 1;
+                    break;
+                case 'n':
+                    cmlparams.buffer_size = param->value.ui;
+                    cmlparams.buffer_size_set = 1;
+                    break;
+                case 'r':
+                    cmlparams.sample_rate = param->value.ui;
+                    cmlparams.sample_rate_set = 1;
+                    break;
+                case 'i':
+                    cmlparams.capture_ports = param->value.ui;
+                    break;
+                case 'o':
+                    cmlparams.playback_ports = param->value.ui;
+                    break;
+                case 'I':
+                    cmlparams.capture_frame_latency = param->value.ui;
+                    break;
+                case 'O':
+                    cmlparams.playback_frame_latency = param->value.ui;
+                    break;
+                case 'x':
+                    cmlparams.slave_mode = param->value.ui;
+                    break;
+                case 'X':
+                    cmlparams.snoop_mode = param->value.ui;
+                    break;
+                case 'v':
+                    cmlparams.verbose_level = param->value.ui;
+            }
+        }
+
+        /* duplex is the default */
+        if (!cmlparams.playback_ports && !cmlparams.capture_ports) {
+            cmlparams.playback_ports = 1;
+            cmlparams.capture_ports = 1;
+        }
+
+        // temporary
+        cmlparams.device_info = device_name;
+
+        Jack::JackFFADODriver* ffado_driver = new Jack::JackFFADODriver("system", "firewire_pcm", engine, table);
+        Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(ffado_driver);
+        // Special open for FFADO driver...
+        if (ffado_driver->Open(&cmlparams) == 0) {
+            return threaded_driver;
+        } else {
+            delete threaded_driver; // Delete the decorated driver
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/linux/firewire/JackFFADODriver.h b/linux/firewire/JackFFADODriver.h
new file mode 100644
index 0000000..1dd401a
--- /dev/null
+++ b/linux/firewire/JackFFADODriver.h
@@ -0,0 +1,88 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004 Grame
+Copyright (C) 2007 Pieter Palmers
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackFFADODriver__
+#define __JackFFADODriver__
+
+#include "JackAudioDriver.h"
+#include "JackThreadedDriver.h"
+#include "JackTime.h"
+
+#include "ffado_driver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The FFADO driver.
+*/
+
+class JackFFADODriver : public JackAudioDriver
+{
+
+    private:
+
+        // enable verbose messages
+        int g_verbose;
+
+        jack_driver_t* fDriver;
+        int ffado_driver_attach (ffado_driver_t *driver);
+        int ffado_driver_detach (ffado_driver_t *driver);
+        int ffado_driver_read (ffado_driver_t * driver, jack_nframes_t nframes);
+        int ffado_driver_write (ffado_driver_t * driver, jack_nframes_t nframes);
+        jack_nframes_t ffado_driver_wait (ffado_driver_t *driver,
+                                          int extra_fd, int *status,
+                                          float *delayed_usecs);
+        int ffado_driver_start (ffado_driver_t *driver);
+        int ffado_driver_stop (ffado_driver_t *driver);
+        int ffado_driver_restart (ffado_driver_t *driver);
+        ffado_driver_t *ffado_driver_new (const char *name, ffado_jack_settings_t *params);
+        void ffado_driver_delete (ffado_driver_t *driver);
+
+        void jack_driver_init (jack_driver_t *driver);
+        void jack_driver_nt_init (jack_driver_nt_t * driver);
+
+    public:
+
+        JackFFADODriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+            : JackAudioDriver(name, alias,engine, table)
+        {}
+        virtual ~JackFFADODriver()
+        {}
+
+        int Open(ffado_jack_settings_t *cmlparams);
+
+        int Close();
+        int Attach();
+        int Detach();
+
+        int Start();
+        int Stop();
+
+        int Read();
+        int Write();
+
+        int SetBufferSize(jack_nframes_t nframes);
+};
+
+} // end of namespace
+
+#endif
diff --git a/linux/firewire/JackFFADOMidiInput.cpp b/linux/firewire/JackFFADOMidiInput.cpp
new file mode 100644
index 0000000..38ed539
--- /dev/null
+++ b/linux/firewire/JackFFADOMidiInput.cpp
@@ -0,0 +1,59 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include <cassert>
+
+#include "JackFFADOMidiInput.h"
+
+namespace Jack {
+
+JackFFADOMidiInput::JackFFADOMidiInput(size_t buffer_size):
+    JackPhysicalMidiInput(buffer_size)
+{
+    new_period = true;
+}
+
+JackFFADOMidiInput::~JackFFADOMidiInput()
+{
+    // Empty
+}
+
+jack_nframes_t
+JackFFADOMidiInput::Receive(jack_midi_data_t *datum,
+                            jack_nframes_t current_frame,
+                            jack_nframes_t total_frames)
+{
+    assert(input_buffer);
+    if (! new_period) {
+        current_frame += 8;
+    } else {
+        new_period = false;
+    }
+    for (; current_frame < total_frames; current_frame += 8) {
+        uint32_t data = input_buffer[current_frame];
+        if (data & 0xff000000) {
+            *datum = (jack_midi_data_t) (data & 0xff);
+            return current_frame;
+        }
+    }
+    new_period = true;
+    return total_frames;
+}
+
+}
diff --git a/linux/firewire/JackFFADOMidiInput.h b/linux/firewire/JackFFADOMidiInput.h
new file mode 100644
index 0000000..12dc043
--- /dev/null
+++ b/linux/firewire/JackFFADOMidiInput.h
@@ -0,0 +1,54 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackFFADOMidiInput__
+#define __JackFFADOMidiInput__
+
+#include "JackPhysicalMidiInput.h"
+
+namespace Jack {
+
+    class JackFFADOMidiInput: public JackPhysicalMidiInput {
+
+    private:
+
+        uint32_t *input_buffer;
+        bool new_period;
+
+    protected:
+
+        jack_nframes_t
+        Receive(jack_midi_data_t *, jack_nframes_t, jack_nframes_t);
+
+    public:
+
+        JackFFADOMidiInput(size_t buffer_size=1024);
+        ~JackFFADOMidiInput();
+
+        inline void
+        SetInputBuffer(uint32_t *input_buffer)
+        {
+            this->input_buffer = input_buffer;
+        }
+
+    };
+
+}
+
+#endif
diff --git a/linux/firewire/JackFFADOMidiOutput.cpp b/linux/firewire/JackFFADOMidiOutput.cpp
new file mode 100644
index 0000000..995f2d2
--- /dev/null
+++ b/linux/firewire/JackFFADOMidiOutput.cpp
@@ -0,0 +1,60 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include <cassert>
+
+#include "JackError.h"
+#include "JackFFADOMidiOutput.h"
+
+namespace Jack {
+
+JackFFADOMidiOutput::JackFFADOMidiOutput(size_t non_rt_buffer_size,
+                                         size_t rt_buffer_size):
+    JackPhysicalMidiOutput(non_rt_buffer_size, rt_buffer_size)
+{
+    // Empty
+}
+
+JackFFADOMidiOutput::~JackFFADOMidiOutput()
+{
+    // Empty
+}
+
+jack_nframes_t
+JackFFADOMidiOutput::Advance(jack_nframes_t current_frame)
+{
+    if (current_frame % 8) {
+        current_frame = (current_frame & (~ ((jack_nframes_t) 7))) + 8;
+    }
+    return current_frame;
+}
+
+jack_nframes_t
+JackFFADOMidiOutput::Send(jack_nframes_t current_frame, jack_midi_data_t datum)
+{
+    assert(output_buffer);
+
+    jack_log("JackFFADOMidiOutput::Send (%d) - Sending '%x' byte.",
+             current_frame, (unsigned int) datum);
+
+    output_buffer[current_frame] = 0x01000000 | ((uint32_t) datum);
+    return current_frame + 8;
+}
+
+}
diff --git a/linux/firewire/JackFFADOMidiOutput.h b/linux/firewire/JackFFADOMidiOutput.h
new file mode 100644
index 0000000..309e7f6
--- /dev/null
+++ b/linux/firewire/JackFFADOMidiOutput.h
@@ -0,0 +1,57 @@
+/*
+Copyright (C) 2009 Devin Anderson
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackFFADOMidiOutput__
+#define __JackFFADOMidiOutput__
+
+#include "JackPhysicalMidiOutput.h"
+
+namespace Jack {
+
+    class JackFFADOMidiOutput: public JackPhysicalMidiOutput {
+
+    private:
+
+        uint32_t *output_buffer;
+
+    protected:
+
+        jack_nframes_t
+        Advance(jack_nframes_t);
+
+        jack_nframes_t
+        Send(jack_nframes_t, jack_midi_data_t);
+
+    public:
+
+        JackFFADOMidiOutput(size_t non_rt_buffer_size=1024,
+                            size_t rt_buffer_size=64);
+        ~JackFFADOMidiOutput();
+
+        inline void
+        SetOutputBuffer(uint32_t *output_buffer)
+        {
+            this->output_buffer = output_buffer;
+        }
+
+    };
+
+}
+
+#endif
diff --git a/linux/firewire/ffado_driver.h b/linux/firewire/ffado_driver.h
new file mode 100644
index 0000000..a06c136
--- /dev/null
+++ b/linux/firewire/ffado_driver.h
@@ -0,0 +1,204 @@
+/*
+ *   FireWire Backend for Jack
+ *   using FFADO
+ *   FFADO = Firewire (pro-)audio for linux
+ *
+ *   http://www.ffado.org
+ *   http://www.jackaudio.org
+ *
+ *   Copyright (C) 2005-2007 Pieter Palmers
+ *   Copyright (C) 2009 Devin Anderson
+ *
+ *   adapted for JackMP by Pieter Palmers
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Main Jack driver entry routines
+ *
+ */
+
+#ifndef __JACK_FFADO_DRIVER_H__
+#define __JACK_FFADO_DRIVER_H__
+
+#include <libffado/ffado.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <poll.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <endian.h>
+
+#include <pthread.h>
+#include <semaphore.h>
+
+#include <driver.h>
+#include <types.h>
+
+#include <assert.h>
+//#include <jack/midiport.h>
+
+// debug print control flags
+#define DEBUG_LEVEL_BUFFERS           	(1<<0)
+#define DEBUG_LEVEL_HANDLERS			(1<<1)
+#define DEBUG_LEVEL_XRUN_RECOVERY     	(1<<2)
+#define DEBUG_LEVEL_WAIT     			(1<<3)
+
+#define DEBUG_LEVEL_RUN_CYCLE         	(1<<8)
+
+#define DEBUG_LEVEL_PACKETCOUNTER		(1<<16)
+#define DEBUG_LEVEL_STARTUP				(1<<17)
+#define DEBUG_LEVEL_THREADS				(1<<18)
+
+//#define DEBUG_ENABLED
+#ifdef DEBUG_ENABLED
+
+// default debug level
+#define DEBUG_LEVEL (  DEBUG_LEVEL_RUN_CYCLE | \
+	(DEBUG_LEVEL_XRUN_RECOVERY)| DEBUG_LEVEL_STARTUP | DEBUG_LEVEL_WAIT | DEBUG_LEVEL_PACKETCOUNTER)
+
+#warning Building debug build!
+
+#define printMessage(format, args...) jack_error( "firewire MSG: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
+#define printError(format, args...) jack_error( "firewire ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
+
+#define printEnter() jack_error( "FWDRV ENTERS: %s (%s)\n", __FUNCTION__,  __FILE__)
+#define printExit() jack_error( "FWDRV EXITS: %s (%s)\n", __FUNCTION__,  __FILE__)
+#define printEnter()
+#define printExit()
+
+#define debugError(format, args...) jack_error( "firewire ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
+#define debugPrint(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error("DEBUG %s:%d (%s) :"  format, __FILE__, __LINE__, __FUNCTION__, ##args );
+#define debugPrintShort(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error( format,##args );
+#define debugPrintWithTimeStamp(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( "%16lu: "format, debugGetCurrentUTime(),##args );
+#define SEGFAULT int *test=NULL;	*test=1;
+#else
+#define DEBUG_LEVEL
+
+#define printMessage(format, args...) if(g_verbose) \
+	                                         jack_error("firewire MSG: " format, ##args )
+#define printError(format, args...)   jack_error("firewire ERR: " format, ##args )
+
+#define printEnter()
+#define printExit()
+
+#define debugError(format, args...)
+#define debugPrint(Level, format, args...)
+#define debugPrintShort(Level, format, args...)
+#define debugPrintWithTimeStamp(Level, format, args...)
+#endif
+
+// thread priority setup
+#define FFADO_RT_PRIORITY_PACKETIZER_RELATIVE	5
+
+typedef struct _ffado_driver ffado_driver_t;
+
+/*
+ * Jack Driver command line parameters
+ */
+
+typedef struct _ffado_jack_settings ffado_jack_settings_t;
+struct _ffado_jack_settings
+{
+    int verbose_level;
+
+    int period_size_set;
+    jack_nframes_t period_size;
+
+    int sample_rate_set;
+    int sample_rate;
+
+    int buffer_size_set;
+    jack_nframes_t buffer_size;
+
+    int playback_ports;
+    int capture_ports;
+
+    jack_nframes_t capture_frame_latency;
+    jack_nframes_t playback_frame_latency;
+
+    int slave_mode;
+    int snoop_mode;
+
+    char *device_info;
+};
+
+typedef struct _ffado_capture_channel
+{
+    ffado_streaming_stream_type stream_type;
+    uint32_t *midi_buffer;
+    void *midi_input;
+}
+ffado_capture_channel_t;
+
+typedef struct _ffado_playback_channel
+{
+    ffado_streaming_stream_type stream_type;
+    uint32_t *midi_buffer;
+    void *midi_output;
+}
+ffado_playback_channel_t;
+
+/*
+ * JACK driver structure
+ */
+struct _ffado_driver
+{
+    JACK_DRIVER_NT_DECL;
+
+    jack_nframes_t  sample_rate;
+    jack_nframes_t  period_size;
+    unsigned long   wait_time;
+
+    jack_time_t                   wait_last;
+    jack_time_t                   wait_next;
+    int wait_late;
+
+    jack_client_t  *client;
+
+    int		xrun_detected;
+    int		xrun_count;
+
+    int process_count;
+
+    /* settings from the command line */
+    ffado_jack_settings_t settings;
+
+    /* the firewire virtual device */
+    ffado_device_t *dev;
+
+    channel_t                     playback_nchannels;
+    channel_t                     capture_nchannels;
+
+    ffado_playback_channel_t *playback_channels;
+    ffado_capture_channel_t  *capture_channels;
+    ffado_sample_t *nullbuffer;
+    ffado_sample_t *scratchbuffer;
+
+    jack_nframes_t  playback_frame_latency;
+    jack_nframes_t  capture_frame_latency;
+
+    ffado_device_info_t device_info;
+    ffado_options_t device_options;
+
+};
+
+#endif /* __JACK_FFADO_DRIVER_H__ */
+
+
diff --git a/linux/freebob/JackFreebobDriver.cpp b/linux/freebob/JackFreebobDriver.cpp
new file mode 100644
index 0000000..348e463
--- /dev/null
+++ b/linux/freebob/JackFreebobDriver.cpp
@@ -0,0 +1,1159 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004 Grame
+Copyright (C) 2007 Pieter Palmers
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <unistd.h>
+#include <math.h>
+#include <stdio.h>
+#include <memory.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <regex.h>
+#include <string.h>
+
+#include "JackFreebobDriver.h"
+#include "JackEngineControl.h"
+#include "JackClientControl.h"
+#include "JackPort.h"
+#include "JackGraphManager.h"
+
+namespace Jack
+{
+
+#define jack_get_microseconds GetMicroSeconds
+
+#define SAMPLE_MAX_24BIT  8388608.0f
+#define SAMPLE_MAX_16BIT  32768.0f
+
+int
+JackFreebobDriver::freebob_driver_read (freebob_driver_t * driver, jack_nframes_t nframes)
+{
+    jack_default_audio_sample_t* buf = NULL;
+    freebob_sample_t nullbuffer[nframes];
+    void *addr_of_nullbuffer = (void *)nullbuffer;
+
+    freebob_streaming_stream_type stream_type;
+
+    printEnter();
+
+    // make sure all buffers have a valid buffer if not connected
+    for (unsigned int i = 0; i < driver->capture_nchannels; i++) {
+        stream_type = freebob_streaming_get_playback_stream_type(driver->dev, i);
+        if (stream_type == freebob_stream_type_audio) {
+            freebob_streaming_set_playback_stream_buffer(driver->dev, i,
+                    (char *)(nullbuffer), freebob_buffer_type_float);
+        } else if (stream_type == freebob_stream_type_midi) {
+            // these should be read/written with the per-stream functions
+        } else {	// empty other buffers without doing something with them
+            freebob_streaming_set_playback_stream_buffer(driver->dev, i,
+                    (char *)(nullbuffer), freebob_buffer_type_uint24);
+        }
+    }
+
+    for (int i = 0; i < fCaptureChannels; i++) {
+        stream_type = freebob_streaming_get_capture_stream_type(driver->dev, i);
+        if (stream_type == freebob_stream_type_audio) {
+
+            if (fGraphManager->GetConnectionsNum(fCapturePortList[i]) > 0) {
+                buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[i],  nframes);
+
+                if (!buf) {
+                    buf = (jack_default_audio_sample_t *)addr_of_nullbuffer;
+                }
+
+                freebob_streaming_set_capture_stream_buffer(driver->dev, i, (char *)(buf), freebob_buffer_type_float);
+            }
+        } else if (stream_type == freebob_stream_type_midi) {
+            // these should be read/written with the per-stream functions
+        } else {	// empty other buffers without doing something with them
+            freebob_streaming_set_capture_stream_buffer(driver->dev, i, (char *)(nullbuffer), freebob_buffer_type_uint24);
+        }
+
+    }
+
+    // now transfer the buffers
+    freebob_streaming_transfer_capture_buffers(driver->dev);
+    printExit();
+    return 0;
+}
+
+int
+JackFreebobDriver::freebob_driver_write (freebob_driver_t * driver, jack_nframes_t nframes)
+{
+    jack_default_audio_sample_t* buf = NULL;
+
+    freebob_streaming_stream_type stream_type;
+
+    freebob_sample_t nullbuffer[nframes];
+    void *addr_of_nullbuffer = (void*)nullbuffer;
+
+    memset(&nullbuffer, 0, nframes*sizeof(freebob_sample_t));
+
+    printEnter();
+    driver->process_count++;
+    assert(driver->dev);
+
+    // make sure all buffers output silence if not connected
+    for (unsigned int i = 0; i < driver->playback_nchannels; i++) {
+        stream_type = freebob_streaming_get_playback_stream_type(driver->dev, i);
+        if (stream_type == freebob_stream_type_audio) {
+            freebob_streaming_set_playback_stream_buffer(driver->dev, i,
+                    (char *)(nullbuffer), freebob_buffer_type_float);
+        } else if (stream_type == freebob_stream_type_midi) {
+            // these should be read/written with the per-stream functions
+        } else { // empty other buffers without doing something with them
+            freebob_streaming_set_playback_stream_buffer(driver->dev, i,
+                    (char *)(nullbuffer), freebob_buffer_type_uint24);
+        }
+    }
+
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        stream_type = freebob_streaming_get_playback_stream_type(driver->dev, i);
+        if (stream_type == freebob_stream_type_audio) {
+            // Ouput ports
+            if (fGraphManager->GetConnectionsNum(fPlaybackPortList[i]) > 0) {
+                buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[i], nframes);
+                if (!buf) {
+                    buf = (jack_default_audio_sample_t *)addr_of_nullbuffer;
+                }
+                freebob_streaming_set_playback_stream_buffer(driver->dev, i, (char *)(buf), freebob_buffer_type_float);
+            }
+        }
+    }
+
+    freebob_streaming_transfer_playback_buffers(driver->dev);
+    printExit();
+    return 0;
+}
+
+jack_nframes_t
+JackFreebobDriver::freebob_driver_wait (freebob_driver_t *driver, int extra_fd, int *status,
+                                        float *delayed_usecs)
+{
+    int nframes;
+    jack_time_t wait_enter;
+    jack_time_t wait_ret;
+
+    printEnter();
+
+    wait_enter = jack_get_microseconds ();
+    if (wait_enter > driver->wait_next) {
+        /*
+        	* This processing cycle was delayed past the
+        	* next due interrupt!  Do not account this as
+        	* a wakeup delay:
+        	*/
+        driver->wait_next = 0;
+        driver->wait_late++;
+    }
+// *status = -2; interrupt
+// *status = -3; timeout
+// *status = -4; extra FD
+
+    nframes = freebob_streaming_wait(driver->dev);
+
+    wait_ret = jack_get_microseconds ();
+
+    if (driver->wait_next && wait_ret > driver->wait_next) {
+        *delayed_usecs = wait_ret - driver->wait_next;
+    }
+    driver->wait_last = wait_ret;
+    driver->wait_next = wait_ret + driver->period_usecs;
+// 	driver->engine->transport_cycle_start (driver->engine, wait_ret);
+
+    if (nframes < 0) {
+        *status = 0;
+        return 0;
+    }
+
+    *status = 0;
+    fBeginDateUst = wait_ret;
+
+    // FIXME: this should do something more usefull
+    *delayed_usecs = 0;
+    printExit();
+    return nframes - nframes % driver->period_size;
+}
+
+int
+JackFreebobDriver::freebob_driver_start (freebob_driver_t *driver)
+{
+    int retval = 0;
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+    if (driver->midi_handle) {
+        if ((retval = freebob_driver_midi_start(driver->midi_handle))) {
+            printError("Could not start MIDI threads");
+            return retval;
+        }
+    }
+#endif
+
+    if ((retval = freebob_streaming_start(driver->dev))) {
+        printError("Could not start streaming threads");
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+        if (driver->midi_handle) {
+            freebob_driver_midi_stop(driver->midi_handle);
+        }
+#endif
+        return retval;
+    }
+
+    return 0;
+}
+
+int
+JackFreebobDriver::freebob_driver_stop (freebob_driver_t *driver)
+{
+    int retval = 0;
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+    if (driver->midi_handle) {
+        if ((retval = freebob_driver_midi_stop(driver->midi_handle))) {
+            printError("Could not stop MIDI threads");
+            return retval;
+        }
+    }
+#endif
+    if ((retval = freebob_streaming_stop(driver->dev))) {
+        printError("Could not stop streaming threads");
+        return retval;
+    }
+
+    return 0;
+}
+
+int
+JackFreebobDriver::freebob_driver_restart (freebob_driver_t *driver)
+{
+    if (Stop())
+        return -1;
+    return Start();
+}
+
+int
+JackFreebobDriver::SetBufferSize (jack_nframes_t nframes)
+{
+    printError("Buffer size change requested but not supported!!!");
+
+    /*
+    driver->period_size = nframes; 
+    driver->period_usecs =
+    	(jack_time_t) floor ((((float) nframes) / driver->sample_rate)
+    			     * 1000000.0f);
+    */
+
+    /* tell the engine to change its buffer size */
+    //driver->engine->set_buffer_size (driver->engine, nframes);
+
+    return -1; // unsupported
+}
+
+typedef void (*JackDriverFinishFunction) (jack_driver_t *);
+
+freebob_driver_t *
+JackFreebobDriver::freebob_driver_new (char *name,
+                                       freebob_jack_settings_t *params)
+{
+    freebob_driver_t *driver;
+
+    assert(params);
+
+    if (freebob_get_api_version() != 1) {
+        printMessage("Incompatible libfreebob version! (%s)", freebob_get_version());
+        return NULL;
+    }
+
+    printMessage("Starting Freebob backend (%s)", freebob_get_version());
+
+    driver = (freebob_driver_t*)calloc (1, sizeof (freebob_driver_t));
+
+    /* Setup the jack interfaces */
+    jack_driver_nt_init ((jack_driver_nt_t *) driver);
+
+    /*	driver->nt_attach    = (JackDriverNTAttachFunction)   freebob_driver_attach;
+    	driver->nt_detach    = (JackDriverNTDetachFunction)   freebob_driver_detach;
+    	driver->nt_start     = (JackDriverNTStartFunction)    freebob_driver_start;
+    	driver->nt_stop      = (JackDriverNTStopFunction)     freebob_driver_stop;
+    	driver->nt_run_cycle = (JackDriverNTRunCycleFunction) freebob_driver_run_cycle;
+    	driver->null_cycle   = (JackDriverNullCycleFunction)  freebob_driver_null_cycle;
+    	driver->write        = (JackDriverReadFunction)       freebob_driver_write;
+    	driver->read         = (JackDriverReadFunction)       freebob_driver_read;
+    	driver->nt_bufsize   = (JackDriverNTBufSizeFunction)  freebob_driver_bufsize;
+    */
+
+    /* copy command line parameter contents to the driver structure */
+    memcpy(&driver->settings, params, sizeof(freebob_jack_settings_t));
+
+    /* prepare all parameters */
+    driver->sample_rate = params->sample_rate;
+    driver->period_size = params->period_size;
+    fBeginDateUst = 0;
+
+    driver->period_usecs =
+        (jack_time_t) floor ((((float) driver->period_size) * 1000000.0f) / driver->sample_rate);
+
+// 	driver->client = client;
+    driver->engine = NULL;
+
+    memset(&driver->device_options, 0, sizeof(driver->device_options));
+    driver->device_options.sample_rate = params->sample_rate;
+    driver->device_options.period_size = params->period_size;
+    driver->device_options.nb_buffers = params->buffer_size;
+    driver->device_options.node_id = params->node_id;
+    driver->device_options.port = params->port;
+    driver->capture_frame_latency = params->capture_frame_latency;
+    driver->playback_frame_latency = params->playback_frame_latency;
+
+    if (!params->capture_ports) {
+        driver->device_options.directions |= FREEBOB_IGNORE_CAPTURE;
+    }
+
+    if (!params->playback_ports) {
+        driver->device_options.directions |= FREEBOB_IGNORE_PLAYBACK;
+    }
+
+    debugPrint(DEBUG_LEVEL_STARTUP, " Driver compiled on %s %s", __DATE__, __TIME__);
+    debugPrint(DEBUG_LEVEL_STARTUP, " Created driver %s", name);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            period_size: %d", driver->period_size);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            period_usecs: %d", driver->period_usecs);
+    debugPrint(DEBUG_LEVEL_STARTUP, "            sample rate: %d", driver->sample_rate);
+
+    return (freebob_driver_t *) driver;
+}
+
+void
+JackFreebobDriver::freebob_driver_delete (freebob_driver_t *driver)
+{
+    free (driver);
+}
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+/*
+ * MIDI support
+ */
+
+// the thread that will queue the midi events from the seq to the stream buffers
+
+void *
+JackFreebobDriver::freebob_driver_midi_queue_thread(void *arg)
+{
+    freebob_driver_midi_handle_t *m = (freebob_driver_midi_handle_t *)arg;
+    assert(m);
+    snd_seq_event_t *ev;
+    unsigned char work_buffer[MIDI_TRANSMIT_BUFFER_SIZE];
+    int bytes_to_send;
+    int b;
+    int i;
+
+    printMessage("MIDI queue thread started");
+
+    while (1) {
+        // get next event, if one is present
+        while ((snd_seq_event_input(m->seq_handle, &ev) > 0)) {
+            // get the port this event is originated from
+            freebob_midi_port_t *port = NULL;
+            for (i = 0;i < m->nb_output_ports;i++) {
+                if (m->output_ports[i]->seq_port_nr == ev->dest.port) {
+                    port = m->output_ports[i];
+                    break;
+                }
+            }
+
+            if (!port) {
+                printError(" Could not find target port for event: dst=%d src=%d", ev->dest.port, ev->source.port);
+                break;
+            }
+
+            // decode it to the work buffer
+            if ((bytes_to_send = snd_midi_event_decode ( port->parser,
+                                 work_buffer,
+                                 MIDI_TRANSMIT_BUFFER_SIZE,
+                                 ev)) < 0) { // failed
+                printError(" Error decoding event for port %d (errcode=%d)", port->seq_port_nr, bytes_to_send);
+                bytes_to_send = 0;
+                //return -1;
+            }
+
+            for (b = 0;b < bytes_to_send;b++) {
+                freebob_sample_t tmp_event = work_buffer[b];
+                if (freebob_streaming_write(m->dev, port->stream_nr, &tmp_event, 1) < 1) {
+                    printError(" Midi send buffer overrun");
+                }
+            }
+        }
+
+        // sleep for some time
+        usleep(MIDI_THREAD_SLEEP_TIME_USECS);
+    }
+    return NULL;
+}
+
+// the dequeue thread (maybe we need one thread per stream)
+void *
+JackFreebobDriver::freebob_driver_midi_dequeue_thread (void *arg)
+{
+    freebob_driver_midi_handle_t *m = (freebob_driver_midi_handle_t *)arg;
+
+    int i;
+    int s;
+    int samples_read;
+
+    assert(m);
+
+    while (1) {
+        // read incoming events
+
+        for (i = 0;i < m->nb_input_ports;i++) {
+            unsigned int buff[64];
+            freebob_midi_port_t *port = m->input_ports[i];
+            if (!port) {
+                printError(" something went wrong when setting up the midi input port map (%d)", i);
+            }
+
+            do {
+                samples_read = freebob_streaming_read(m->dev, port->stream_nr, buff, 64);
+
+                for (s = 0;s < samples_read;s++) {
+                    unsigned int *byte = (buff + s) ;
+                    snd_seq_event_t ev;
+                    if ((snd_midi_event_encode_byte(port->parser, (*byte) & 0xFF, &ev)) > 0) {
+                        // a midi message is complete, send it out to ALSA
+                        snd_seq_ev_set_subs(&ev);
+                        snd_seq_ev_set_direct(&ev);
+                        snd_seq_ev_set_source(&ev, port->seq_port_nr);
+                        snd_seq_event_output_direct(port->seq_handle, &ev);
+                    }
+                }
+            } while (samples_read > 0);
+        }
+
+        // sleep for some time
+        usleep(MIDI_THREAD_SLEEP_TIME_USECS);
+    }
+    return NULL;
+}
+
+freebob_driver_midi_handle_t *
+JackFreebobDriver::freebob_driver_midi_init(freebob_driver_t *driver)
+{
+    char buf[256];
+    channel_t chn;
+    int nchannels;
+    int i = 0;
+
+    freebob_device_t *dev = driver->dev;
+    assert(dev);
+
+    freebob_driver_midi_handle_t *m = calloc(1, sizeof(freebob_driver_midi_handle_t));
+    if (!m) {
+        printError("not enough memory to create midi structure");
+        return NULL;
+    }
+
+    if (snd_seq_open(&m->seq_handle, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK) < 0) {
+        printError("Error opening ALSA sequencer.");
+        free(m);
+        return NULL;
+    }
+
+    snd_seq_set_client_name(m->seq_handle, "FreeBoB Jack MIDI");
+
+    // find out the number of midi in/out ports we need to setup
+    nchannels = freebob_streaming_get_nb_capture_streams(dev);
+    m->nb_input_ports = 0;
+
+    for (chn = 0; chn < nchannels; chn++) {
+        if (freebob_streaming_get_capture_stream_type(dev, chn) == freebob_stream_type_midi) {
+            m->nb_input_ports++;
+        }
+    }
+
+    m->input_ports = calloc(m->nb_input_ports, sizeof(freebob_midi_port_t *));
+    if (!m->input_ports) {
+        printError("not enough memory to create midi structure");
+        free(m);
+        return NULL;
+    }
+
+    i = 0;
+    for (chn = 0; chn < nchannels; chn++) {
+        if (freebob_streaming_get_capture_stream_type(dev, chn) == freebob_stream_type_midi) {
+            m->input_ports[i] = calloc(1, sizeof(freebob_midi_port_t));
+            if (!m->input_ports[i]) {
+                // fixme
+                printError("Could not allocate memory for seq port");
+                continue;
+            }
+
+            freebob_streaming_get_capture_stream_name(dev, chn, buf, sizeof(buf) - 1);
+            printMessage("Register MIDI IN port %s", buf);
+
+            m->input_ports[i]->seq_port_nr = snd_seq_create_simple_port(m->seq_handle, buf,
+                                             SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,
+                                             SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+
+            if (m->input_ports[i]->seq_port_nr < 0) {
+                printError("Could not create seq port");
+                m->input_ports[i]->stream_nr = -1;
+                m->input_ports[i]->seq_port_nr = -1;
+            } else {
+                m->input_ports[i]->stream_nr = chn;
+                m->input_ports[i]->seq_handle = m->seq_handle;
+                if (snd_midi_event_new  ( ALSA_SEQ_BUFF_SIZE, &(m->input_ports[i]->parser)) < 0) {
+                    printError("could not init parser for MIDI IN port %d", i);
+                    m->input_ports[i]->stream_nr = -1;
+                    m->input_ports[i]->seq_port_nr = -1;
+                }
+            }
+
+            i++;
+        }
+    }
+
+    // playback
+    nchannels = freebob_streaming_get_nb_playback_streams(dev);
+
+    m->nb_output_ports = 0;
+
+    for (chn = 0; chn < nchannels; chn++) {
+        if (freebob_streaming_get_playback_stream_type(dev, chn) == freebob_stream_type_midi) {
+            m->nb_output_ports++;
+        }
+    }
+
+    m->output_ports = calloc(m->nb_output_ports, sizeof(freebob_midi_port_t *));
+    if (!m->output_ports) {
+        printError("not enough memory to create midi structure");
+        for (i = 0; i < m->nb_input_ports; i++) {
+            free(m->input_ports[i]);
+        }
+        free(m->input_ports);
+        free(m);
+        return NULL;
+    }
+
+    i = 0;
+    for (chn = 0; chn < nchannels; chn++) {
+        if (freebob_streaming_get_playback_stream_type(dev, chn) == freebob_stream_type_midi) {
+            m->output_ports[i] = calloc(1, sizeof(freebob_midi_port_t));
+            if (!m->output_ports[i]) {
+                // fixme
+                printError("Could not allocate memory for seq port");
+                continue;
+            }
+
+            freebob_streaming_get_playback_stream_name(dev, chn, buf, sizeof(buf) - 1);
+            printMessage("Register MIDI OUT port %s", buf);
+
+            m->output_ports[i]->seq_port_nr = snd_seq_create_simple_port(m->seq_handle, buf,
+                                              SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE,
+                                              SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+
+            if (m->output_ports[i]->seq_port_nr < 0) {
+                printError("Could not create seq port");
+                m->output_ports[i]->stream_nr = -1;
+                m->output_ports[i]->seq_port_nr = -1;
+            } else {
+                m->output_ports[i]->stream_nr = chn;
+                m->output_ports[i]->seq_handle = m->seq_handle;
+                if (snd_midi_event_new  ( ALSA_SEQ_BUFF_SIZE, &(m->output_ports[i]->parser)) < 0) {
+                    printError("could not init parser for MIDI OUT port %d", i);
+                    m->output_ports[i]->stream_nr = -1;
+                    m->output_ports[i]->seq_port_nr = -1;
+                }
+            }
+
+            i++;
+        }
+    }
+
+    m->dev = dev;
+    m->driver = driver;
+    return m;
+}
+
+int
+JackFreebobDriver::freebob_driver_midi_start (freebob_driver_midi_handle_t *m)
+{
+    assert(m);
+    // start threads
+
+    m->queue_thread_realtime = (m->driver->engine->control->real_time ? 1 : 0);
+    m->queue_thread_priority =
+        m->driver->engine->control->client_priority +
+        FREEBOB_RT_PRIORITY_MIDI_RELATIVE;
+
+    if (m->queue_thread_priority > 98) {
+        m->queue_thread_priority = 98;
+    }
+    if (m->queue_thread_realtime) {
+        printMessage("MIDI threads running with Realtime scheduling, priority %d",
+                     m->queue_thread_priority);
+    } else {
+        printMessage("MIDI threads running without Realtime scheduling");
+    }
+
+    if (jack_client_create_thread(NULL, &m->queue_thread, m->queue_thread_priority, m->queue_thread_realtime, freebob_driver_midi_queue_thread, (void *)m)) {
+        printError(" cannot create midi queueing thread");
+        return -1;
+    }
+
+    if (jack_client_create_thread(NULL, &m->dequeue_thread, m->queue_thread_priority, m->queue_thread_realtime, freebob_driver_midi_dequeue_thread, (void *)m)) {
+        printError(" cannot create midi dequeueing thread");
+        return -1;
+    }
+    return 0;
+}
+
+int
+JackFreebobDriver::freebob_driver_midi_stop (freebob_driver_midi_handle_t *m)
+{
+    assert(m);
+
+    pthread_cancel (m->queue_thread);
+    pthread_join (m->queue_thread, NULL);
+
+    pthread_cancel (m->dequeue_thread);
+    pthread_join (m->dequeue_thread, NULL);
+    return 0;
+}
+
+void
+JackFreebobDriver::freebob_driver_midi_finish (freebob_driver_midi_handle_t *m)
+{
+    assert(m);
+
+    int i;
+    // TODO: add state info here, if not stopped then stop
+
+    for (i = 0;i < m->nb_input_ports;i++) {
+        free(m->input_ports[i]);
+    }
+    free(m->input_ports);
+
+    for (i = 0;i < m->nb_output_ports;i++) {
+        free(m->output_ports[i]);
+    }
+    free(m->output_ports);
+    free(m);
+}
+#endif
+
+int JackFreebobDriver::Attach()
+{
+    JackPort* port;
+    int port_index;
+  
+    char buf[JACK_PORT_NAME_SIZE];
+    char portname[JACK_PORT_NAME_SIZE];
+
+    freebob_driver_t* driver = (freebob_driver_t*)fDriver;
+
+    jack_log("JackFreebobDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    g_verbose = (fEngineControl->fVerbose ? 1 : 0);
+    driver->device_options.verbose = (fEngineControl->fVerbose ? 1 : 0);
+
+    /* packetizer thread options */
+    driver->device_options.realtime = (fEngineControl->fRealTime ? 1 : 0);
+
+    driver->device_options.packetizer_priority = fEngineControl->fServerPriority +
+            FREEBOB_RT_PRIORITY_PACKETIZER_RELATIVE;
+    if (driver->device_options.packetizer_priority > 98) {
+        driver->device_options.packetizer_priority = 98;
+    }
+
+    // initialize the thread
+    driver->dev = freebob_streaming_init(&driver->device_info, driver->device_options);
+
+    if (!driver->dev) {
+        printError("FREEBOB: Error creating virtual device");
+        return -1;
+    }
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+    driver->midi_handle = freebob_driver_midi_init(driver);
+    if (!driver->midi_handle) {
+        printError("-----------------------------------------------------------");
+        printError("Error creating midi device!");
+        printError("FreeBob will run without MIDI support.");
+        printError("Consult the above error messages to solve the problem. ");
+        printError("-----------------------------------------------------------\n\n");
+    }
+#endif
+
+    if (driver->device_options.realtime) {
+        printMessage("Streaming thread running with Realtime scheduling, priority %d",
+                     driver->device_options.packetizer_priority);
+    } else {
+        printMessage("Streaming thread running without Realtime scheduling");
+    }
+
+    /* ports */
+
+    // capture
+    driver->capture_nchannels = freebob_streaming_get_nb_capture_streams(driver->dev);
+    driver->capture_nchannels_audio = 0;
+
+    for (unsigned int i = 0; i < driver->capture_nchannels; i++) {
+
+        freebob_streaming_get_capture_stream_name(driver->dev, i, portname, sizeof(portname) - 1);
+        snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
+
+        if (freebob_streaming_get_capture_stream_type(driver->dev, i) != freebob_stream_type_audio) {
+            printMessage ("Don't register capture port %s", buf);
+        } else {
+            printMessage ("Registering capture port %s", buf);
+
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
+                              JACK_DEFAULT_AUDIO_TYPE,
+                              CaptureDriverFlags,
+                              fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("driver: cannot register port for %s", buf);
+                return -1;
+            }
+            port = fGraphManager->GetPort(port_index);
+            port->SetLatency(driver->period_size + driver->capture_frame_latency);
+            fCapturePortList[i] = port_index;
+            jack_log("JackFreebobDriver::Attach fCapturePortList[i] %ld ", port_index);
+            driver->capture_nchannels_audio++;
+        }
+    }
+
+    // playback
+    driver->playback_nchannels = freebob_streaming_get_nb_playback_streams(driver->dev);
+    driver->playback_nchannels_audio = 0;
+
+    for (unsigned int i = 0; i < driver->playback_nchannels; i++) {
+
+        freebob_streaming_get_playback_stream_name(driver->dev, i, portname, sizeof(portname) - 1);
+        snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
+
+        if (freebob_streaming_get_playback_stream_type(driver->dev, i) != freebob_stream_type_audio) {
+            printMessage ("Don't register playback port %s", buf);
+        } else {
+            printMessage ("Registering playback port %s", buf);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
+                              JACK_DEFAULT_AUDIO_TYPE,
+                              PlaybackDriverFlags,
+                              fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("driver: cannot register port for %s", buf);
+                return -1;
+            }
+            port = fGraphManager->GetPort(port_index);
+            // Add one buffer more latency if "async" mode is used...
+            port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + driver->playback_frame_latency);
+            fPlaybackPortList[i] = port_index;
+            jack_log("JackFreebobDriver::Attach fPlaybackPortList[i] %ld ", port_index);
+            driver->playback_nchannels_audio++;
+        }
+    }
+
+    fCaptureChannels = driver->capture_nchannels_audio;
+    fPlaybackChannels = driver->playback_nchannels_audio;
+
+    assert(fCaptureChannels < DRIVER_PORT_NUM);
+    assert(fPlaybackChannels < DRIVER_PORT_NUM);
+
+    // this makes no sense...
+    assert(fCaptureChannels + fPlaybackChannels > 0);
+    return 0;
+}
+
+int JackFreebobDriver::Detach()
+{
+    freebob_driver_t* driver = (freebob_driver_t*)fDriver;
+    jack_log("JackFreebobDriver::Detach");
+
+    // finish the libfreebob streaming
+    freebob_streaming_finish(driver->dev);
+    driver->dev = NULL;
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+    if (driver->midi_handle) {
+        freebob_driver_midi_finish(driver->midi_handle);
+    }
+    driver->midi_handle = NULL;
+#endif
+
+    return JackAudioDriver::Detach();  // Generic JackAudioDriver Detach
+}
+
+int JackFreebobDriver::Open(freebob_jack_settings_t *params)
+{
+    // Generic JackAudioDriver Open
+    if (JackAudioDriver::Open(
+                params->period_size, params->sample_rate,
+                params->playback_ports, params->playback_ports,
+                0, 0, 0, "", "",
+                params->capture_frame_latency, params->playback_frame_latency) != 0) {
+        return -1;
+    }
+
+    fDriver = (jack_driver_t *)freebob_driver_new ((char*)"freebob_pcm", params);
+
+    if (fDriver) {
+        // FreeBoB driver may have changed the in/out values
+        fCaptureChannels = ((freebob_driver_t *)fDriver)->capture_nchannels_audio;
+        fPlaybackChannels = ((freebob_driver_t *)fDriver)->playback_nchannels_audio;
+        return 0;
+    } else {
+        JackAudioDriver::Close();
+        return -1;
+    }
+}
+
+int JackFreebobDriver::Close()
+{
+    JackAudioDriver::Close();
+    freebob_driver_delete((freebob_driver_t*)fDriver);
+    return 0;
+}
+
+int JackFreebobDriver::Start()
+{
+    JackAudioDriver::Start();
+    return freebob_driver_start((freebob_driver_t *)fDriver);
+}
+
+int JackFreebobDriver::Stop()
+{
+    return freebob_driver_stop((freebob_driver_t *)fDriver);
+}
+
+int JackFreebobDriver::Read()
+{
+    printEnter();
+
+    /* Taken from freebob_driver_run_cycle */
+    freebob_driver_t* driver = (freebob_driver_t*)fDriver;
+    int wait_status = 0;
+    fDelayedUsecs = 0.f;
+
+    jack_nframes_t nframes = freebob_driver_wait (driver, -1, &wait_status,
+                             &fDelayedUsecs);
+
+    if ((wait_status < 0)) {
+        printError( "wait status < 0! (= %d)", wait_status);
+        return -1;
+    }
+
+    if (nframes == 0) {
+        /* we detected an xrun and restarted: notify
+         * clients about the delay. 
+         */
+        jack_log("FreeBoB XRun");
+        NotifyXRun(fBeginDateUst, fDelayedUsecs);
+        return -1;
+    }
+
+    if (nframes != fEngineControl->fBufferSize)
+        jack_log("JackFreebobDriver::Read nframes = %ld", nframes);
+
+    // Has to be done before read
+    JackDriver::CycleIncTime();
+    
+    printExit();
+    return freebob_driver_read((freebob_driver_t *)fDriver, fEngineControl->fBufferSize);
+}
+
+int JackFreebobDriver::Write()
+{
+    printEnter();
+    int res = freebob_driver_write((freebob_driver_t *)fDriver, fEngineControl->fBufferSize);
+    printExit();
+    return res;
+}
+
+void
+JackFreebobDriver::jack_driver_init (jack_driver_t *driver)
+{
+    memset (driver, 0, sizeof (*driver));
+
+    driver->attach = 0;
+    driver->detach = 0;
+    driver->write = 0;
+    driver->read = 0;
+    driver->null_cycle = 0;
+    driver->bufsize = 0;
+    driver->start = 0;
+    driver->stop = 0;
+}
+
+void
+JackFreebobDriver::jack_driver_nt_init (jack_driver_nt_t * driver)
+{
+    memset (driver, 0, sizeof (*driver));
+
+    jack_driver_init ((jack_driver_t *) driver);
+
+    driver->attach = 0;
+    driver->detach = 0;
+    driver->bufsize = 0;
+    driver->stop = 0;
+    driver->start = 0;
+
+    driver->nt_bufsize = 0;
+    driver->nt_start = 0;
+    driver->nt_stop = 0;
+    driver->nt_attach = 0;
+    driver->nt_detach = 0;
+    driver->nt_run_cycle = 0;
+}
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    const jack_driver_desc_t *
+    driver_get_descriptor () {
+        jack_driver_desc_t * desc;
+        jack_driver_param_desc_t * params;
+        unsigned int i;
+
+        desc = (jack_driver_desc_t *)calloc (1, sizeof (jack_driver_desc_t));
+
+        strcpy (desc->name, "freebob");                                // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Linux FreeBob API based audio backend");   // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+        
+        desc->nparams = 11;
+
+        params = (jack_driver_param_desc_t *)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+        desc->params = params;
+
+        i = 0;
+        strcpy (params[i].name, "device");
+        params[i].character  = 'd';
+        params[i].type       = JackDriverParamString;
+        strcpy (params[i].value.str,  "hw:0");
+        strcpy (params[i].short_desc, "The FireWire device to use. Format is: 'hw:port[,node]'.");
+        strcpy (params[i].long_desc,  params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "period");
+        params[i].character  = 'p';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui   = 1024;
+        strcpy (params[i].short_desc, "Frames per period");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "nperiods");
+        params[i].character  = 'n';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui   = 3;
+        strcpy (params[i].short_desc, "Number of periods of playback latency");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "rate");
+        params[i].character  = 'r';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui   = 48000U;
+        strcpy (params[i].short_desc, "Sample rate");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "capture");
+        params[i].character  = 'C';
+        params[i].type       = JackDriverParamBool;
+        params[i].value.i    = 0;
+        strcpy (params[i].short_desc, "Provide capture ports.");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "playback");
+        params[i].character  = 'P';
+        params[i].type       = JackDriverParamBool;
+        params[i].value.i    = 0;
+        strcpy (params[i].short_desc, "Provide playback ports.");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "duplex");
+        params[i].character  = 'D';
+        params[i].type       = JackDriverParamBool;
+        params[i].value.i    = 1;
+        strcpy (params[i].short_desc, "Provide both capture and playback ports.");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "input-latency");
+        params[i].character  = 'I';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Extra input latency (frames)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "output-latency");
+        params[i].character  = 'O';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Extra output latency (frames)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "inchannels");
+        params[i].character  = 'i';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Number of input channels to provide (note: currently ignored)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        i++;
+        strcpy (params[i].name, "outchannels");
+        params[i].character  = 'o';
+        params[i].type       = JackDriverParamUInt;
+        params[i].value.ui    = 0;
+        strcpy (params[i].short_desc, "Number of output channels to provide (note: currently ignored)");
+        strcpy (params[i].long_desc, params[i].short_desc);
+
+        return desc;
+    }
+
+    Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) {
+        unsigned int port = 0;
+        unsigned int node_id = -1;
+        int nbitems;
+
+        const JSList * node;
+        const jack_driver_param_t * param;
+
+        freebob_jack_settings_t cmlparams;
+
+        const char *device_name = "hw:0";
+
+        cmlparams.period_size_set = 0;
+        cmlparams.sample_rate_set = 0;
+        cmlparams.buffer_size_set = 0;
+        cmlparams.port_set = 0;
+        cmlparams.node_id_set = 0;
+
+        /* default values */
+        cmlparams.period_size = 1024;
+        cmlparams.sample_rate = 48000;
+        cmlparams.buffer_size = 3;
+        cmlparams.port = 0;
+        cmlparams.node_id = -1;
+        cmlparams.playback_ports = 0;
+        cmlparams.capture_ports = 0;
+        cmlparams.playback_frame_latency = 0;
+        cmlparams.capture_frame_latency = 0;
+
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+                case 'd':
+                    device_name = param->value.str;
+                    break;
+                case 'p':
+                    cmlparams.period_size = param->value.ui;
+                    cmlparams.period_size_set = 1;
+                    break;
+                case 'n':
+                    cmlparams.buffer_size = param->value.ui;
+                    cmlparams.buffer_size_set = 1;
+                    break;
+                case 'r':
+                    cmlparams.sample_rate = param->value.ui;
+                    cmlparams.sample_rate_set = 1;
+                    break;
+                case 'C':
+                    cmlparams.capture_ports = 1;
+                    break;
+                case 'P':
+                    cmlparams.playback_ports = 1;
+                    break;
+                case 'D':
+                    cmlparams.capture_ports = 1;
+                    cmlparams.playback_ports = 1;
+                    break;
+                case 'I':
+                    cmlparams.capture_frame_latency = param->value.ui;
+                    break;
+                case 'O':
+                    cmlparams.playback_frame_latency = param->value.ui;
+                    break;
+                    // ignore these for now
+                case 'i':
+                    break;
+                case 'o':
+                    break;
+            }
+        }
+
+        /* duplex is the default */
+        if (!cmlparams.playback_ports && !cmlparams.capture_ports) {
+            cmlparams.playback_ports = TRUE;
+            cmlparams.capture_ports = TRUE;
+        }
+
+        nbitems = sscanf(device_name, "hw:%u,%u", &port, &node_id);
+        if (nbitems < 2) {
+            nbitems = sscanf(device_name, "hw:%u", &port);
+
+            if (nbitems < 1) {
+                printError("device (-d) argument not valid\n");
+                return NULL;
+            } else {
+                cmlparams.port = port;
+                cmlparams.port_set = 1;
+
+                cmlparams.node_id = -1;
+                cmlparams.node_id_set = 0;
+            }
+        } else {
+            cmlparams.port = port;
+            cmlparams.port_set = 1;
+
+            cmlparams.node_id = node_id;
+            cmlparams.node_id_set = 1;
+        }
+
+        jack_error("Freebob using Firewire port %d, node %d", cmlparams.port, cmlparams.node_id);
+
+        Jack::JackFreebobDriver* freebob_driver = new Jack::JackFreebobDriver("system", "freebob_pcm", engine, table);
+        Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(freebob_driver);
+        // Special open for FreeBoB driver...
+        if (freebob_driver->Open(&cmlparams) == 0) {
+            return threaded_driver;
+        } else {
+            delete threaded_driver; // Delete the decorated driver
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/linux/freebob/JackFreebobDriver.h b/linux/freebob/JackFreebobDriver.h
new file mode 100644
index 0000000..0f71c2b
--- /dev/null
+++ b/linux/freebob/JackFreebobDriver.h
@@ -0,0 +1,95 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004 Grame
+Copyright (C) 2007 Pieter Palmers
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackFreebobDriver__
+#define __JackFreebobDriver__
+
+#include "JackAudioDriver.h"
+#include "JackThreadedDriver.h"
+#include "JackTime.h"
+
+#include "freebob_driver.h"
+
+namespace Jack
+{
+
+/*!
+\brief The FreeBoB driver.
+*/
+
+class JackFreebobDriver : public JackAudioDriver
+{
+
+    private:
+
+        // enable verbose messages
+        int g_verbose;
+
+        jack_driver_t* fDriver;
+        int freebob_driver_attach (freebob_driver_t *driver);
+        int freebob_driver_detach (freebob_driver_t *driver);
+        int freebob_driver_read (freebob_driver_t * driver, jack_nframes_t nframes);
+        int freebob_driver_write (freebob_driver_t * driver, jack_nframes_t nframes);
+        jack_nframes_t freebob_driver_wait (freebob_driver_t *driver,
+                                            int extra_fd, int *status,
+                                            float *delayed_usecs);
+        int freebob_driver_start (freebob_driver_t *driver);
+        int freebob_driver_stop (freebob_driver_t *driver);
+        int freebob_driver_restart (freebob_driver_t *driver);
+        freebob_driver_t *freebob_driver_new (char *name, freebob_jack_settings_t *params);
+        void freebob_driver_delete (freebob_driver_t *driver);
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+        freebob_driver_midi_handle_t *freebob_driver_midi_init(freebob_driver_t *driver);
+        void freebob_driver_midi_finish (freebob_driver_midi_handle_t *m);
+        int freebob_driver_midi_start (freebob_driver_midi_handle_t *m);
+        int freebob_driver_midi_stop (freebob_driver_midi_handle_t *m);
+#endif
+
+        void jack_driver_init (jack_driver_t *driver);
+        void jack_driver_nt_init (jack_driver_nt_t * driver);
+
+    public:
+
+        JackFreebobDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+            :JackAudioDriver(name, alias, engine, table)
+        {}
+        virtual ~JackFreebobDriver()
+        {}
+
+        int Open(freebob_jack_settings_t *cmlparams);
+
+        int Close();
+        int Attach();
+        int Detach();
+
+        int Start();
+        int Stop();
+
+        int Read();
+        int Write();
+
+        int SetBufferSize(jack_nframes_t nframes);
+};
+
+} // end of namespace
+
+#endif
diff --git a/linux/freebob/freebob_driver.h b/linux/freebob/freebob_driver.h
new file mode 100644
index 0000000..8cada7f
--- /dev/null
+++ b/linux/freebob/freebob_driver.h
@@ -0,0 +1,245 @@
+/* freebob_driver.h
+ *
+ *   FreeBob Backend for Jack
+ *   FreeBob = Firewire (pro-)audio for linux
+ *
+ *   adapted for jackmp
+ *
+ *   http://freebob.sf.net
+ *   http://jackit.sf.net
+ *
+ *   Copyright (C) 2005,2006,2007 Pieter Palmers <pieterpalmers at users.sourceforge.net>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Main Jack driver entry routines
+ *
+ */
+
+#ifndef __JACK_FREEBOB_DRIVER_H__
+#define __JACK_FREEBOB_DRIVER_H__
+
+// #define FREEBOB_DRIVER_WITH_MIDI
+// #define DEBUG_ENABLED
+
+#include <libfreebob/freebob.h>
+#include <libfreebob/freebob_streaming.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <poll.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <endian.h>
+
+#include <pthread.h>
+#include <semaphore.h>
+
+#include <driver.h>
+#include <types.h>
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+#include <JackPosixThread.h>
+#include <alsa/asoundlib.h>
+#endif
+
+// debug print control flags
+#define DEBUG_LEVEL_BUFFERS           	(1<<0)
+#define DEBUG_LEVEL_HANDLERS			(1<<1)
+#define DEBUG_LEVEL_XRUN_RECOVERY     	(1<<2)
+#define DEBUG_LEVEL_WAIT     			(1<<3)
+
+#define DEBUG_LEVEL_RUN_CYCLE         	(1<<8)
+
+#define DEBUG_LEVEL_PACKETCOUNTER		(1<<16)
+#define DEBUG_LEVEL_STARTUP				(1<<17)
+#define DEBUG_LEVEL_THREADS				(1<<18)
+
+#ifdef DEBUG_ENABLED
+
+// default debug level
+#define DEBUG_LEVEL (  DEBUG_LEVEL_RUN_CYCLE | \
+	(DEBUG_LEVEL_XRUN_RECOVERY)| DEBUG_LEVEL_STARTUP | DEBUG_LEVEL_WAIT | DEBUG_LEVEL_PACKETCOUNTER)
+
+#warning Building debug build!
+
+#define printMessage(format, args...) jack_error( "FreeBoB MSG: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
+#define printError(format, args...) jack_error( "FreeBoB ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
+
+/*	#define printEnter() jack_error( "FBDRV ENTERS: %s (%s)", __FUNCTION__,  __FILE__)
+	#define printExit() jack_error( "FBDRV EXITS: %s (%s)", __FUNCTION__,  __FILE__)*/
+#define printEnter()
+#define printExit()
+
+#define debugError(format, args...) jack_error( "FREEBOB ERR: %s:%d (%s): " format,  __FILE__, __LINE__, __FUNCTION__, ##args )
+#define debugPrint(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error("DEBUG %s:%d (%s) :"  format, __FILE__, __LINE__, __FUNCTION__, ##args );
+#define debugPrintShort(Level, format, args...) if(DEBUG_LEVEL & (Level))  jack_error( format,##args );
+#define debugPrintWithTimeStamp(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( "%16lu: "format, debugGetCurrentUTime(),##args );
+#define SEGFAULT int *test=NULL;	*test=1;
+#else
+#define DEBUG_LEVEL
+
+#define printMessage(format, args...) if(g_verbose) \
+	                                         jack_error("FreeBoB MSG: " format, ##args )
+#define printError(format, args...)   jack_error("FreeBoB ERR: " format, ##args )
+
+#define printEnter()
+#define printExit()
+
+#define debugError(format, args...)
+#define debugPrint(Level, format, args...)
+#define debugPrintShort(Level, format, args...)
+#define debugPrintWithTimeStamp(Level, format, args...)
+#endif
+
+// thread priority setup
+#define FREEBOB_RT_PRIORITY_PACKETIZER_RELATIVE	5
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+
+#define ALSA_SEQ_BUFF_SIZE 1024
+#define MIDI_TRANSMIT_BUFFER_SIZE 1024
+#define MIDI_THREAD_SLEEP_TIME_USECS 100
+// midi priority should be higher than the audio priority in order to
+// make sure events are not only delivered on period boundarys
+// but I think it should be smaller than the packetizer thread in order not
+// to lose any packets
+#define FREEBOB_RT_PRIORITY_MIDI_RELATIVE 	4
+
+#endif
+
+typedef struct _freebob_driver freebob_driver_t;
+
+/*
+ * Jack Driver command line parameters
+ */
+
+typedef struct _freebob_jack_settings freebob_jack_settings_t;
+struct _freebob_jack_settings
+{
+    int period_size_set;
+    jack_nframes_t period_size;
+
+    int sample_rate_set;
+    int sample_rate;
+
+    int buffer_size_set;
+    jack_nframes_t buffer_size;
+
+    int port_set;
+    int port;
+
+    int node_id_set;
+    int node_id;
+
+    int playback_ports;
+    int capture_ports;
+
+    jack_nframes_t capture_frame_latency;
+    jack_nframes_t playback_frame_latency;
+
+    freebob_handle_t fb_handle;
+};
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+
+typedef struct
+{
+    int stream_nr;
+    int seq_port_nr;
+    snd_midi_event_t *parser;
+    snd_seq_t *seq_handle;
+}
+freebob_midi_port_t;
+
+typedef struct _freebob_driver_midi_handle
+{
+    freebob_device_t *dev;
+    freebob_driver_t *driver;
+
+    snd_seq_t *seq_handle;
+
+    pthread_t queue_thread;
+    pthread_t dequeue_thread;
+    int queue_thread_realtime;
+    int queue_thread_priority;
+
+    int nb_input_ports;
+    int nb_output_ports;
+
+    freebob_midi_port_t **input_ports;
+    freebob_midi_port_t **output_ports;
+
+    freebob_midi_port_t **input_stream_port_map;
+    int *output_port_stream_map;
+}
+freebob_driver_midi_handle_t;
+
+#endif
+/*
+ * JACK driver structure
+ */
+
+struct _freebob_driver
+{
+    JACK_DRIVER_NT_DECL
+
+    jack_nframes_t  sample_rate;
+    jack_nframes_t  period_size;
+    unsigned long   wait_time;
+
+    jack_time_t wait_last;
+    jack_time_t wait_next;
+    int wait_late;
+
+    jack_client_t  *client;
+
+    int	xrun_detected;
+    int	xrun_count;
+
+    int process_count;
+
+    /* settings from the command line */
+    freebob_jack_settings_t settings;
+
+    /* the freebob virtual device */
+    freebob_device_t *dev;
+
+    JSList  *capture_ports;
+    JSList  *playback_ports;
+    JSList   *monitor_ports;
+    unsigned long  playback_nchannels;
+    unsigned long  capture_nchannels;
+    unsigned long  playback_nchannels_audio;
+    unsigned long  capture_nchannels_audio;
+
+    jack_nframes_t  playback_frame_latency;
+    jack_nframes_t  capture_frame_latency;
+
+    freebob_device_info_t device_info;
+    freebob_options_t device_options;
+
+#ifdef FREEBOB_DRIVER_WITH_MIDI
+    freebob_driver_midi_handle_t *midi_handle;
+#endif
+};
+
+#endif /* __JACK_FREEBOB_DRIVER_H__ */
+
+
diff --git a/linux/wscript b/linux/wscript
new file mode 100644
index 0000000..869985d
--- /dev/null
+++ b/linux/wscript
@@ -0,0 +1,81 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+def configure(conf):
+    conf.check_cfg(package='alsa', atleast_version='1.0.18', args='--cflags --libs')
+    conf.env['BUILD_DRIVER_ALSA'] = conf.is_defined('HAVE_ALSA')
+
+    conf. check_cfg(package='libfreebob', atleast_version='1.0.0', args='--cflags --libs')
+    conf.env['BUILD_DRIVER_FREEBOB'] = conf.is_defined('HAVE_LIBFREEBOB')
+
+    conf. check_cfg(package='libffado', atleast_version='1.999.17', args='--cflags --libs')
+    conf.env['BUILD_DRIVER_FFADO'] = conf.is_defined('HAVE_LIBFFADO')
+
+    conf.define('HAVE_PPOLL', 1 )
+
+
+def create_jack_driver_obj(bld, target, sources, uselib = None):
+    driver = bld.new_task_gen('cxx', 'shlib')
+    driver.features.append('cc')
+    driver.env['shlib_PATTERN'] = 'jack_%s.so'
+    driver.defines = ['HAVE_CONFIG_H','SERVER_SIDE', 'HAVE_PPOLL']
+    driver.includes = ['.', '../linux', '../posix', '../common', '../common/jack', '../dbus']
+    driver.target = target
+    driver.source = sources
+    driver.install_path = '${ADDON_DIR}/'
+    if uselib:
+        driver.uselib = uselib
+    driver.uselib_local = 'serverlib'
+    return driver
+
+def build(bld):
+    if bld.env['BUILD_JACKD'] == True:
+        jackd = bld.new_task_gen('cxx', 'program')
+        jackd.includes = ['../linux', '../posix', '../common/jack', '../common', '../dbus']
+        jackd.defines = 'HAVE_CONFIG_H'
+        jackd.source = ['../common/Jackdmp.cpp']
+	if bld.env['IS_LINUX'] and bld.env['BUILD_JACKDBUS']: 
+            jackd.source += ['../dbus/reserve.c', '../dbus/audio_reserve.c'] 
+            jackd.uselib = 'PTHREAD DL RT DBUS-1'
+	else:
+            jackd.uselib = 'PTHREAD DL RT'		
+        jackd.uselib_local = 'serverlib'
+        jackd.target = 'jackd'
+  	
+    create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp')
+    
+    alsa_driver_src = ['alsa/JackAlsaDriver.cpp',
+                       'alsa/alsa_rawmidi.c',
+                       'alsa/alsa_seqmidi.c',
+                       'alsa/alsa_midi_jackmp.cpp',
+                       '../common/memops.c',
+                       'alsa/generic_hw.c',
+                       'alsa/hdsp.c',
+                       'alsa/hammerfall.c',
+                       'alsa/ice1712.c'
+                       ]
+
+    ffado_driver_src = ['firewire/JackFFADODriver.cpp',
+                        'firewire/JackFFADOMidiInput.cpp',
+                        'firewire/JackFFADOMidiOutput.cpp',
+                        '../common/JackPhysicalMidiInput.cpp',
+                        '../common/JackPhysicalMidiOutput.cpp'
+                       ]
+
+    if bld.env['BUILD_DRIVER_ALSA'] == True:
+        create_jack_driver_obj(bld, 'alsa', alsa_driver_src, "ALSA")
+
+    if bld.env['BUILD_DRIVER_FREEBOB'] == True:
+        create_jack_driver_obj(bld, 'freebob', 'freebob/JackFreebobDriver.cpp', "LIBFREEBOB")
+
+    if bld.env['BUILD_DRIVER_FFADO'] == True:
+        create_jack_driver_obj(bld, 'firewire', ffado_driver_src, "LIBFFADO")
+
+    create_jack_driver_obj(bld, 'net', '../common/JackNetDriver.cpp')
+
+    create_jack_driver_obj(bld, 'loopback', '../common/JackLoopbackDriver.cpp')
+
+    create_jack_driver_obj(bld, 'netone', [ '../common/JackNetOneDriver.cpp',
+                                            '../common/netjack.c',
+                                            '../common/netjack_packet.c' ], "SAMPLERATE CELT" )
+
diff --git a/macosx/Jack-Info.plist b/macosx/Jack-Info.plist
new file mode 100644
index 0000000..8b6a61d
--- /dev/null
+++ b/macosx/Jack-Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>Jackservermp</string>
+	<key>CFBundleGetInfoString</key>
+	<string>Jackdmp 1.9.5, @03-09 Paul Davis, Grame</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.grame.Jackmp</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleShortVersionString</key>
+	<string></string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1.9.5</string>
+</dict>
+</plist>
diff --git a/macosx/JackAtomic_os.h b/macosx/JackAtomic_os.h
new file mode 100644
index 0000000..bd88a22
--- /dev/null
+++ b/macosx/JackAtomic_os.h
@@ -0,0 +1,73 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackAtomic_APPLE__
+#define __JackAtomic_APPLE__
+
+#include "JackTypes.h"
+
+#if defined(__ppc__) || defined(__ppc64__)
+
+static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr)
+{
+    register int result;
+    asm volatile (
+        "# CAS					\n"
+        "	lwarx	r0, 0, %1	\n"         // creates a reservation on addr
+        "	cmpw	r0, %2		\n"			//  test value at addr
+        "	bne-	1f          \n"
+        "	sync            	\n"         //  synchronize instructions
+        "	stwcx.	%3, 0, %1	\n"         //  if the reservation is not altered
+        //  stores the new value at addr
+        "	bne-	1f          \n"
+        "   li      %0, 1       \n"
+        "	b		2f          \n"
+        "1:                     \n"
+        "   li      %0, 0       \n"
+        "2:                     \n"
+    : "=r" (result)
+                : "r" (addr), "r" (value), "r" (newvalue)
+                : "r0"
+            );
+    return result;
+}
+
+#endif
+
+#if defined(__i386__) || defined(__x86_64__)
+
+#define LOCK "lock ; "
+
+static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
+{
+    register char ret;
+    __asm__ __volatile__ (
+        "# CAS \n\t"
+        LOCK "cmpxchg %2, (%1) \n\t"
+        "sete %0               \n\t"
+    : "=a" (ret)
+                : "c" (addr), "d" (newvalue), "a" (value)
+            );
+    return ret;
+}
+
+#endif
+
+#endif
+
diff --git a/macosx/JackMacEngineRPC.cpp b/macosx/JackMacEngineRPC.cpp
new file mode 100644
index 0000000..fb95621
--- /dev/null
+++ b/macosx/JackMacEngineRPC.cpp
@@ -0,0 +1,250 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackServer.h"
+#include "JackNotification.h"
+#include "JackLockedEngine.h"
+#include "JackRPCEngine.h"
+#include "JackMachServerChannel.h"
+#include "JackException.h"
+#include <assert.h>
+
+using namespace Jack;
+
+//-------------------
+// Client management
+//-------------------
+
+#define rpc_type kern_return_t // for astyle
+
+rpc_type server_rpc_jack_client_check(mach_port_t private_port, client_name_t name, client_name_t name_res, int protocol, int options, int* status, int* result)
+{
+    jack_log("rpc_jack_client_check");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    channel->ClientCheck((char*)name, (char*)name_res, protocol, options, status, result);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_client_open(mach_port_t server_port, client_name_t name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    jack_log("rpc_jack_client_open name = %s", name);
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[server_port];
+    assert(channel);
+    channel->ClientOpen((char*)name, pid, private_port, shared_engine, shared_client, shared_graph, result);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_client_close(mach_port_t private_port, int refnum, int* result)
+{
+    jack_log("rpc_jack_client_close");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    channel->ClientClose(private_port, refnum);
+    *result = 0;
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_client_activate(mach_port_t private_port, int refnum, int is_real_time, int* result)
+{
+    jack_log("rpc_jack_client_activate");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->ClientActivate(refnum, is_real_time);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_client_deactivate(mach_port_t private_port, int refnum, int* result)
+{
+    jack_log("rpc_jack_client_deactivate");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->ClientDeactivate(refnum);
+    return KERN_SUCCESS;
+}
+
+//-----------------
+// Port management
+//-----------------
+
+rpc_type server_rpc_jack_port_register(mach_port_t private_port, int refnum, client_port_name_t name, client_port_type_t type, unsigned int flags, unsigned int buffer_size, unsigned int* port_index, int* result)
+{
+    jack_log("rpc_jack_port_register ref = %d name = %s", refnum, name);
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortRegister(refnum, name, type, flags, buffer_size, port_index);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_port_unregister(mach_port_t private_port, int refnum, int port, int* result)
+{
+    jack_log("rpc_jack_port_unregister ref = %d port = %d ", refnum, port);
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortUnRegister(refnum, port);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_port_connect_name(mach_port_t private_port, int refnum, client_port_name_t src, client_port_name_t dst, int* result)
+{
+    jack_log("rpc_jack_port_connect_name");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortConnect(refnum, src, dst);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_port_disconnect_name(mach_port_t private_port, int refnum, client_port_name_t src, client_port_name_t dst, int* result)
+{
+    jack_log("rpc_jack_port_disconnect_name");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortDisconnect(refnum, src, dst);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_port_connect(mach_port_t private_port, int refnum, int src, int dst, int* result)
+{
+    jack_log("rpc_jack_port_connect");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortConnect(refnum, src, dst);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_port_disconnect(mach_port_t private_port, int refnum, int src, int dst, int* result)
+{
+    jack_log("rpc_jack_port_disconnect");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortDisconnect(refnum, src, dst);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_port_rename(mach_port_t private_port, int refnum, int port, client_port_name_t name, int* result)
+{
+    jack_log("server_rpc_jack_port_rename");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetEngine()->PortRename(refnum, port, name);
+    return KERN_SUCCESS;
+}
+
+//------------------------
+// Buffer size, freewheel
+//------------------------
+
+rpc_type server_rpc_jack_set_buffer_size(mach_port_t private_port, int buffer_size, int* result)
+{
+    jack_log("server_rpc_jack_set_buffer_size");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->SetBufferSize(buffer_size);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_set_freewheel(mach_port_t private_port, int onoff, int* result)
+{
+    jack_log("server_rpc_jack_set_freewheel");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->SetFreewheel(onoff);
+    return KERN_SUCCESS;
+}
+
+//----------------------
+// Transport management
+//----------------------
+
+rpc_type server_rpc_jack_release_timebase(mach_port_t private_port, int refnum, int* result)
+{
+    jack_log("server_rpc_jack_release_timebase");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->ReleaseTimebase(refnum);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_set_timebase_callback(mach_port_t private_port, int refnum, int conditional, int* result)
+{
+    jack_log("server_rpc_jack_set_timebase_callback");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->SetTimebaseCallback(refnum, conditional);
+    return KERN_SUCCESS;
+}
+
+//------------------
+// Internal clients
+//------------------
+
+rpc_type server_rpc_jack_get_internal_clientname(mach_port_t private_port, int refnum, int int_ref, client_name_t name_res, int* result)
+{
+    jack_log("server_rpc_jack_get_internal_clientname");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->GetEngine()->GetInternalClientName(int_ref, (char*)name_res);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_internal_clienthandle(mach_port_t private_port, int refnum, client_name_t client_name, int* status, int* int_ref, int* result)
+{
+    jack_log("server_rpc_jack_internal_clienthandle");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->GetEngine()->InternalClientHandle(client_name, status, int_ref);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_internal_clientload(mach_port_t private_port, int refnum, client_name_t client_name, so_name_t so_name, objet_data_t objet_data, int options, int* status, int* int_ref, int* result)
+{
+    jack_log("server_rpc_jack_internal_clientload");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, status);
+    return KERN_SUCCESS;
+}
+
+rpc_type server_rpc_jack_internal_clientunload(mach_port_t private_port, int refnum, int int_ref, int* status, int* result)
+{
+    jack_log("server_rpc_jack_internal_clientunload");
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
+    assert(channel);
+    *result = channel->GetServer()->GetEngine()->InternalClientUnload(int_ref, status);
+    return KERN_SUCCESS;
+}
+
+//-----------------
+// RT notification
+//-----------------
+
+rpc_type server_rpc_jack_client_rt_notify(mach_port_t server_port, int refnum, int notify, int value)
+{
+    jack_log("rpc_jack_client_rt_notify ref = %d notify = %d value = %d", refnum, notify, value);
+    JackMachServerChannel* channel = JackMachServerChannel::fPortTable[server_port];
+    assert(channel);
+    assert(channel->GetServer());
+    
+    if (notify == kQUIT) {
+        throw JackQuitException();
+    } else {
+        channel->GetServer()->Notify(refnum, notify, value);
+        return KERN_SUCCESS;
+    }
+}
diff --git a/macosx/JackMacLibClientRPC.cpp b/macosx/JackMacLibClientRPC.cpp
new file mode 100644
index 0000000..b70878a
--- /dev/null
+++ b/macosx/JackMacLibClientRPC.cpp
@@ -0,0 +1,47 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackLibClient.h"
+#include "JackMachClientChannel.h"
+#include "JackRPCEngine.h"
+#include "JackLibGlobals.h"
+#include <assert.h>
+
+using namespace Jack;
+
+#define rpc_type kern_return_t  // for astyle
+
+rpc_type rpc_jack_client_sync_notify(mach_port_t client_port, int refnum, client_name_t name, int notify, message_t message, int value1, int value2, int* result)
+{
+    jack_log("rpc_jack_client_sync_notify ref = %ld name = %s notify = %ld message %s val1 = %ld val2 = %ld", refnum, name, notify, message, value1, value2);
+    JackClient* client = gClientTable[client_port];
+    assert(client);
+    *result = client->ClientNotify(refnum, name, notify, true, message, value1, value2);
+    return KERN_SUCCESS;
+}
+
+rpc_type rpc_jack_client_async_notify(mach_port_t client_port, int refnum, client_name_t name, int notify, message_t message,  int value1, int value2)
+{
+    jack_log("rpc_jack_client_async_notify ref = %ld name = %s notify = %ld message %s val1 = %ld val2 = %ld", refnum, name, notify, message, value1, value2);
+    JackClient* client = gClientTable[client_port];
+    assert(client);
+    client->ClientNotify(refnum, name, notify, false, message, value1, value2);
+    return KERN_SUCCESS;
+}
+
diff --git a/macosx/JackMachClientChannel.cpp b/macosx/JackMachClientChannel.cpp
new file mode 100644
index 0000000..f5f8850
--- /dev/null
+++ b/macosx/JackMachClientChannel.cpp
@@ -0,0 +1,334 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackMachClientChannel.h"
+#include "JackRPCEngine.h"
+#include "JackTools.h"
+#include "JackRPCClientServer.c"
+#include "JackError.h"
+#include "JackLibClient.h"
+#include "JackMachThread.h"
+#include "JackConstants.h"
+
+namespace Jack
+{
+
+std::map<mach_port_t, JackClient*> gClientTable;
+
+JackMachClientChannel::JackMachClientChannel():fPrivatePort(0),fThread(this)
+{}
+
+JackMachClientChannel::~JackMachClientChannel()
+{}
+
+// Server <===> client
+
+int JackMachClientChannel::ServerCheck(const char* server_name)
+{
+    jack_log("JackMachClientChannel::ServerCheck = %s", server_name);
+    char jack_server_entry_name[512];
+    snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);
+
+    // Connect to server
+    if (!fServerPort.ConnectPort(jack_server_entry_name)) {
+        jack_error("Cannot connect to server Mach port");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackMachClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status)
+{
+    jack_log("JackMachClientChannel::Open name = %s", name);
+    char jack_server_entry_name[512];
+    snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);
+
+    // Connect to server
+    if (!fServerPort.ConnectPort(jack_server_entry_name)) {
+        jack_error("Cannot connect to server Mach port");
+        return -1;
+    }
+
+    // Check name in server
+    int result = 0;
+    ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
+    if (result < 0) {
+        int status1 = *status;
+        if (status1 & JackVersionError)
+            jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
+        else
+            jack_error("Client name = %s conflits with another running client", name);
+        return -1;
+    }
+
+    // Prepare local port using client name
+    char buf[JACK_CLIENT_NAME_SIZE + 1];
+    snprintf(buf, sizeof(buf) - 1, "%s:%s", jack_client_entry, name_res);
+
+    if (!fClientPort.AllocatePort(buf, 16)) {
+        jack_error("Cannot allocate client Mach port");
+        return -1;
+    }
+
+    gClientTable[fClientPort.GetPort()] = client;
+    return 0;
+}
+
+void JackMachClientChannel::Close()
+{
+    jack_log("JackMachClientChannel::Close");
+    gClientTable.erase(fClientPort.GetPort());
+    fServerPort.DisconnectPort();
+    fClientPort.DestroyPort();
+
+    if (fPrivatePort != 0) {
+         kern_return_t res;
+        if ((res = mach_port_destroy(mach_task_self(), fPrivatePort)) != KERN_SUCCESS) {
+            jack_error("JackMachClientChannel::Close err = %s", mach_error_string(res));
+        }
+    }
+}
+
+int JackMachClientChannel::Start()
+{
+    jack_log("JackMachClientChannel::Start");
+    /*
+     To be sure notification thread is started before ClientOpen is called.
+    */
+    if (fThread.StartSync() != 0) {
+        jack_error("Cannot start Jack client listener");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+void JackMachClientChannel::Stop()
+{
+    jack_log("JackMachClientChannel::Stop");
+    fThread.Kill();
+}
+
+void JackMachClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
+{
+    kern_return_t res = rpc_jack_client_check(fServerPort.GetPort(), (char*)name, name_res, protocol, options, status, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::ClientCheck err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    kern_return_t res = rpc_jack_client_open(fServerPort.GetPort(), (char*)name, pid, &fPrivatePort, shared_engine, shared_client, shared_graph, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::ClientOpen err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::ClientClose(int refnum, int* result)
+{
+    kern_return_t res = rpc_jack_client_close(fPrivatePort, refnum, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::ClientClose err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::ClientActivate(int refnum, int is_real_time, int* result)
+{
+    kern_return_t res = rpc_jack_client_activate(fPrivatePort, refnum, is_real_time, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::ClientActivate err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::ClientDeactivate(int refnum, int* result)
+{
+    kern_return_t res = rpc_jack_client_deactivate(fPrivatePort, refnum, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::ClientDeactivate err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
+{
+    kern_return_t res = rpc_jack_port_register(fPrivatePort, refnum, (char*)name, (char*)type, flags, buffer_size, port_index, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::PortRegister err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
+{
+    kern_return_t res = rpc_jack_port_unregister(fPrivatePort, refnum, port_index, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::PortUnRegister err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortConnect(int refnum, const char* src, const char* dst, int* result)
+{
+    kern_return_t res = rpc_jack_port_connect_name(fPrivatePort, refnum, (char*)src, (char*)dst, result);
+    if (res != KERN_SUCCESS) {
+        jack_error("JackMachClientChannel::PortConnect err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortDisconnect(int refnum, const char* src, const char* dst, int* result)
+{
+    kern_return_t res = rpc_jack_port_disconnect_name(fPrivatePort, refnum, (char*)src, (char*)dst, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::PortDisconnect err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+{
+    kern_return_t res = rpc_jack_port_connect(fPrivatePort, refnum, src, dst, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::PortConnect err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+{
+    kern_return_t res = rpc_jack_port_disconnect(fPrivatePort, refnum, src, dst, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::PortDisconnect err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
+{
+    kern_return_t res = rpc_jack_port_rename(fPrivatePort, refnum, port, (char*)name, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::PortRename err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::SetBufferSize(jack_nframes_t buffer_size, int* result)
+{
+    kern_return_t res = rpc_jack_set_buffer_size(fPrivatePort, buffer_size, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::SetBufferSize err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::SetFreewheel(int onoff, int* result)
+{
+    kern_return_t res = rpc_jack_set_freewheel(fPrivatePort, onoff, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::SetFreewheel err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::ReleaseTimebase(int refnum, int* result)
+{
+    kern_return_t res = rpc_jack_release_timebase(fPrivatePort, refnum, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::ReleaseTimebase err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::SetTimebaseCallback(int refnum, int conditional, int* result)
+{
+    kern_return_t res = rpc_jack_set_timebase_callback(fPrivatePort, refnum, conditional, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::SetTimebaseCallback err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
+{
+    kern_return_t res = rpc_jack_get_internal_clientname(fPrivatePort, refnum, int_ref, name_res, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::GetInternalClientName err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
+{
+    kern_return_t res = rpc_jack_internal_clienthandle(fPrivatePort, refnum, (char*)client_name, status, int_ref, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::InternalClientHandle err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
+{
+    const char* int_client_name = (client_name) ? client_name : "";
+    const char* int_so_name = (so_name) ? so_name : "";
+    const char* int_objet_data = (objet_data) ? objet_data : "";
+    
+    kern_return_t res = rpc_jack_internal_clientload(fPrivatePort, refnum, (char*)int_client_name, (char*)int_so_name, (char*)int_objet_data, options, status, int_ref, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::InternalClientLoad err = %s", mach_error_string(res));
+    }
+}
+
+void JackMachClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result)
+{
+    kern_return_t res = rpc_jack_internal_clientunload(fPrivatePort, refnum, int_ref, status, result);
+    if (res != KERN_SUCCESS) {
+        *result = -1;
+        jack_error("JackMachClientChannel::InternalClientUnload err = %s", mach_error_string(res));
+    }
+}
+
+bool JackMachClientChannel::Init()
+{
+    jack_log("JackMachClientChannel::Init");
+    JackClient* client = gClientTable[fClientPort.GetPort()];
+    return client->Init();
+}
+
+bool JackMachClientChannel::Execute()
+{
+    kern_return_t res;
+    if ((res = mach_msg_server(JackRPCClient_server, 1024, fClientPort.GetPort(), 0)) != KERN_SUCCESS) {
+        jack_error("JackMachClientChannel::Execute err = %s", mach_error_string(res));
+        JackClient* client = gClientTable[fClientPort.GetPort()];
+        client->ShutDown();
+        return false;
+    } else {
+        return true;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/macosx/JackMachClientChannel.h b/macosx/JackMachClientChannel.h
new file mode 100644
index 0000000..379fb53
--- /dev/null
+++ b/macosx/JackMachClientChannel.h
@@ -0,0 +1,99 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMachClientChannel__
+#define __JackMachClientChannel__
+
+#include "JackChannel.h"
+#include "JackMachPort.h"
+#include "JackPlatformPlug.h"
+#include <map>
+
+namespace Jack
+{
+
+/*!
+\brief JackClientChannel using Mach IPC.
+*/
+
+class JackMachClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface
+{
+
+    private:
+
+        JackMachPort fClientPort;    /*! Mach port to communicate with the server : from server to client */
+        JackMachPort fServerPort;    /*! Mach port to communicate with the server : from client to server */
+        mach_port_t	fPrivatePort;
+        JackThread	fThread;		 /*! Thread to execute the event loop */
+
+    public:
+
+        JackMachClientChannel();
+        ~JackMachClientChannel();
+
+        int Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status);
+        void Close();
+
+        int Start();
+        void Stop();
+
+        int ServerCheck(const char* server_name);
+
+        void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result);
+        void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
+        void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
+        {}
+        void ClientClose(int refnum, int* result);
+
+        void ClientActivate(int refnum, int is_real_time, int* result);
+        void ClientDeactivate(int refnum, int* result);
+
+        void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result);
+        void PortUnRegister(int refnum, jack_port_id_t port_index, int* result);
+
+        void PortConnect(int refnum, const char* src, const char* dst, int* result);
+        void PortDisconnect(int refnum, const char* src, const char* dst, int* result);
+
+        void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
+        void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
+        
+        void PortRename(int refnum, jack_port_id_t port, const char* name, int* result);
+
+        void SetBufferSize(jack_nframes_t buffer_size, int* result);
+        void SetFreewheel(int onoff, int* result);
+
+        void ReleaseTimebase(int refnum, int* result);
+        void SetTimebaseCallback(int refnum, int conditional, int* result);
+
+        void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
+        void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
+        void InternalClientLoad(int refnum, const char* client_name,  const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
+        void InternalClientUnload(int refnum, int int_ref, int* status, int* result);
+
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};
+
+extern std::map<mach_port_t, JackClient*> gClientTable;
+
+} // end of namespace
+
+#endif
+
diff --git a/macosx/JackMachNotifyChannel.cpp b/macosx/JackMachNotifyChannel.cpp
new file mode 100644
index 0000000..56d6b42
--- /dev/null
+++ b/macosx/JackMachNotifyChannel.cpp
@@ -0,0 +1,67 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackMachNotifyChannel.h"
+#include "JackRPCClient.h"
+#include "JackError.h"
+#include "JackConstants.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+// Server side : server to client
+
+int JackMachNotifyChannel::Open(const char* name)
+{
+    jack_log("JackMachNotifyChannel::Open name = %s", name);
+
+    char buf[256];
+    snprintf(buf, sizeof(buf) - 1, "%s:%s", jack_client_entry, name);
+
+    // Connect to client notification port using client name
+    if (!fClientPort.ConnectPort(buf)) {
+        jack_error("Cannot connect client port");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+void JackMachNotifyChannel::Close()
+{
+    fClientPort.DisconnectPort();
+}
+
+void JackMachNotifyChannel::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result)
+{
+    kern_return_t res = (sync)
+                        ? rpc_jack_client_sync_notify(fClientPort.GetPort(), refnum, (char*)name, notify, (char*)message, value1, value2, result)
+                        : rpc_jack_client_async_notify(fClientPort.GetPort(), refnum, (char*)name, notify, (char*)message, value1, value2);
+    if (res == KERN_SUCCESS) {
+        *result = 0;
+    } else {
+        jack_error("JackMachNotifyChannel::ClientNotify: name = %s notify = %ld err = %s", name, notify, mach_error_string(res));
+        *result = -1;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/macosx/JackMachNotifyChannel.h b/macosx/JackMachNotifyChannel.h
new file mode 100644
index 0000000..ab99fef
--- /dev/null
+++ b/macosx/JackMachNotifyChannel.h
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMachNotifyChannel__
+#define __JackMachNotifyChannel__
+
+#include "JackMachPort.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackNotifyChannel using Mach IPC.
+*/
+
+class JackMachNotifyChannel
+{
+
+    private:
+
+        JackMachPort fClientPort;    /*! Mach port to communicate with the client : from server to client */
+
+    public:
+
+        JackMachNotifyChannel()
+        {}
+
+        int Open(const char* name);		// Open the Server/Client connection
+        void Close();					// Close the Server/Client connection
+
+        void ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result);
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/macosx/JackMachPort.cpp b/macosx/JackMachPort.cpp
new file mode 100644
index 0000000..d0d236b
--- /dev/null
+++ b/macosx/JackMachPort.cpp
@@ -0,0 +1,295 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackMachPort.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+// Server side : port is published to be accessible from other processes (clients)
+
+bool JackMachPort::AllocatePort(const char* name, int queue)
+{
+    mach_port_t task = mach_task_self();
+    kern_return_t res;
+
+    if ((res = task_get_bootstrap_port(task, &fBootPort)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: Can't find bootstrap mach port err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &fServerPort)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: can't allocate mach port err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = mach_port_insert_right(task, fServerPort, fServerPort, MACH_MSG_TYPE_MAKE_SEND)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: error inserting mach rights err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = bootstrap_register(fBootPort, (char*)name, fServerPort)) != KERN_SUCCESS) {
+        jack_error("Allocate: can't check in mach port name = %s err = %s", name, mach_error_string(res));
+        return false;
+    }
+
+    mach_port_limits_t qlimits;
+    mach_msg_type_number_t info_cnt = MACH_PORT_LIMITS_INFO_COUNT;
+    if ((res = mach_port_get_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, &info_cnt)) != KERN_SUCCESS) {
+        jack_error("Allocate: mach_port_get_attributes error err = %s", name, mach_error_string(res));
+    }
+
+    jack_log("AllocatePort: queue limit %ld", qlimits.mpl_qlimit);
+
+    if (queue > 0) {
+        qlimits.mpl_qlimit = queue;
+        if ((res = mach_port_set_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, MACH_PORT_LIMITS_INFO_COUNT)) != KERN_SUCCESS) {
+            jack_error("Allocate: mach_port_set_attributes error name = %s err = %s", name, mach_error_string(res));
+        }
+    }
+
+    return true;
+}
+
+// Server side : port is published to be accessible from other processes (clients)
+
+bool JackMachPort::AllocatePort(const char* name)
+{
+    return AllocatePort(name, -1);
+}
+
+// Client side : get the published port from server
+
+bool JackMachPort::ConnectPort(const char* name)
+{
+    kern_return_t res;
+
+    jack_log("JackMachPort::ConnectPort %s", name);
+
+    if ((res = task_get_bootstrap_port(mach_task_self(), &fBootPort)) != KERN_SUCCESS) {
+        jack_error("ConnectPort: can't find bootstrap port err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = bootstrap_look_up(fBootPort, (char*)name, &fServerPort)) != KERN_SUCCESS) {
+        jack_error("ConnectPort: can't find mach server port name = %s err = %s", name, mach_error_string(res));
+        return false;
+    }
+
+    return true;
+}
+
+bool JackMachPort::DisconnectPort()
+{
+    jack_log("JackMacRPC::DisconnectPort");
+    kern_return_t res;
+    mach_port_t task = mach_task_self();
+
+    if (fBootPort != 0) {
+        if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
+            jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
+        }
+    }
+
+    if (fServerPort != 0) {
+        if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
+            jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
+        }
+    }
+    
+    return true;
+}
+
+bool JackMachPort::DestroyPort()
+{
+    jack_log("JackMacRPC::DisconnectPort");
+    kern_return_t res;
+    mach_port_t task = mach_task_self();
+
+    if (fBootPort != 0) {
+        if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
+            jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
+        }
+    }
+
+    if (fServerPort != 0) {
+        if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
+            jack_error("JackMacRPC::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
+        }
+    }
+
+    return true;
+}
+
+mach_port_t JackMachPort::GetPort()
+{
+    return fServerPort;
+}
+
+bool JackMachPortSet::AllocatePort(const char* name, int queue)
+{
+    kern_return_t res;
+    mach_port_t task = mach_task_self();
+
+    jack_log("JackMachPortSet::AllocatePort");
+
+    if ((res = task_get_bootstrap_port(task, &fBootPort)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: Can't find bootstrap mach port err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &fServerPort)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: can't allocate mach port err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = mach_port_insert_right(task, fServerPort, fServerPort, MACH_MSG_TYPE_MAKE_SEND)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: error inserting mach rights err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_PORT_SET, &fPortSet)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: can't allocate mach port err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = mach_port_move_member(task, fServerPort, fPortSet)) != KERN_SUCCESS) {
+        jack_error("AllocatePort: error in mach_port_move_member err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = bootstrap_register(fBootPort, (char*)name, fServerPort)) != KERN_SUCCESS) {
+        jack_error("Allocate: can't check in mach port name = %s err = %s", name, mach_error_string(res));
+        return false;
+    }
+
+    mach_port_limits_t qlimits;
+    mach_msg_type_number_t info_cnt = MACH_PORT_LIMITS_INFO_COUNT;
+    if ((res = mach_port_get_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, &info_cnt)) != KERN_SUCCESS) {
+        jack_error("Allocate: mach_port_get_attributes error name = %s err = %s", name, mach_error_string(res));
+    }
+
+    jack_log("AllocatePort: queue limit = %ld", qlimits.mpl_qlimit);
+
+    if (queue > 0) {
+        qlimits.mpl_qlimit = queue;
+
+        if ((res = mach_port_set_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, MACH_PORT_LIMITS_INFO_COUNT)) != KERN_SUCCESS) {
+            jack_error("Allocate: mach_port_set_attributes error name = %s err = %s", name, mach_error_string(res));
+        }
+    }
+
+    return true;
+}
+
+// Server side : port is published to be accessible from other processes (clients)
+
+bool JackMachPortSet::AllocatePort(const char* name)
+{
+    return AllocatePort(name, -1);
+}
+
+bool JackMachPortSet::DisconnectPort()
+{
+    kern_return_t res;
+    mach_port_t task = mach_task_self();
+
+    jack_log("JackMachPortSet::DisconnectPort");
+
+    if (fBootPort != 0) {
+        if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
+            jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
+        }
+    }
+
+    if (fServerPort != 0) {
+        if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
+            jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
+        }
+    }
+
+    return true;
+}
+
+bool JackMachPortSet::DestroyPort()
+{
+    kern_return_t res;
+    mach_port_t task = mach_task_self();
+
+    jack_log("JackMachPortSet::DisconnectPort");
+
+    if (fBootPort != 0) {
+        if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
+            jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate err = %s", mach_error_string(res));
+        }
+    }
+
+    if (fServerPort != 0) {
+        if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
+            jack_error("JackMachPortSet::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
+        }
+    }
+
+    return true;
+}
+
+mach_port_t JackMachPortSet::GetPortSet()
+{
+    return fPortSet;
+}
+
+mach_port_t JackMachPortSet::AddPort()
+{
+    kern_return_t res;
+    mach_port_t task = mach_task_self();
+    mach_port_t old_port, result = 0;
+
+    jack_log("JackMachPortSet::AddPort");
+
+    if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &result)) != KERN_SUCCESS) {
+        jack_error("AddPort: can't allocate mach port err = %s", mach_error_string(res));
+        goto error;
+    }
+
+    if ((res = mach_port_request_notification(task, result, MACH_NOTIFY_NO_SENDERS,
+               1, result, MACH_MSG_TYPE_MAKE_SEND_ONCE, &old_port)) != KERN_SUCCESS) {
+        jack_error("AddPort: error in mach_port_request_notification err = %s", mach_error_string(res));
+        goto error;
+    }
+
+    if ((res = mach_port_move_member(task, result, fPortSet)) != KERN_SUCCESS) {
+        jack_error("AddPort: error in mach_port_move_member err = %s", mach_error_string(res));
+        goto error;
+    }
+
+    return result;
+
+error:
+    if (result) {
+        if ((res = mach_port_destroy(task, result)) != KERN_SUCCESS) {
+            jack_error("JackMacRPC::DisconnectPort mach_port_destroy err = %s", mach_error_string(res));
+        }
+    }
+    return 0;
+}
+
+
+} // end of namespace
+
diff --git a/macosx/JackMachPort.h b/macosx/JackMachPort.h
new file mode 100644
index 0000000..85176b3
--- /dev/null
+++ b/macosx/JackMachPort.h
@@ -0,0 +1,88 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMachPort__
+#define __JackMachPort__
+
+#include <mach/mach.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mach_error.h>
+#include <servers/bootstrap.h>
+
+namespace Jack
+{
+
+/*!
+\brief Mach port.
+*/
+
+class JackMachPort
+{
+
+    protected:
+
+        mach_port_t fBootPort;
+        mach_port_t fServerPort;
+
+    public:
+
+        JackMachPort():fBootPort(0), fServerPort(0)
+        {}
+        virtual ~JackMachPort()
+        {}
+
+        virtual bool AllocatePort(const char* name);
+        virtual bool AllocatePort(const char* name, int queue);
+        virtual bool ConnectPort(const char* name);
+        virtual bool DisconnectPort();
+        virtual bool DestroyPort();
+        virtual mach_port_t GetPort();
+};
+
+/*!
+\brief Mach port set.
+*/
+
+class JackMachPortSet : public JackMachPort
+{
+
+    private:
+
+        mach_port_t fPortSet;
+
+    public:
+
+        JackMachPortSet():fPortSet(0)
+        {}
+        virtual ~JackMachPortSet()
+        {}
+
+        bool AllocatePort(const char* name);
+        bool AllocatePort(const char* name, int queue);
+        bool DisconnectPort();
+        bool DestroyPort();
+        mach_port_t GetPortSet();
+        mach_port_t AddPort();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/macosx/JackMachSemaphore.cpp b/macosx/JackMachSemaphore.cpp
new file mode 100644
index 0000000..f4b129c
--- /dev/null
+++ b/macosx/JackMachSemaphore.cpp
@@ -0,0 +1,216 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackMachSemaphore.h"
+#include "JackConstants.h"
+#include "JackTools.h"
+#include "JackError.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+mach_port_t JackMachSemaphore::fBootPort = 0;
+
+void JackMachSemaphore::BuildName(const char* client_name, const char* server_name, char* res)
+{
+    char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
+    JackTools::RewriteName(client_name, ext_client_name);
+    sprintf(res, "jack_mach_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name);
+}
+
+bool JackMachSemaphore::Signal()
+{
+    if (!fSemaphore) {
+        jack_error("JackMachSemaphore::Signal name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if (fFlush)
+        return true;
+
+    kern_return_t res;
+    if ((res = semaphore_signal(fSemaphore)) != KERN_SUCCESS) {
+        jack_error("JackMachSemaphore::Signal name = %s err = %s", fName, mach_error_string(res));
+    }
+    return (res == KERN_SUCCESS);
+}
+
+bool JackMachSemaphore::SignalAll()
+{
+    if (!fSemaphore) {
+        jack_error("JackMachSemaphore::SignalAll name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if (fFlush)
+        return true;
+        
+    kern_return_t res;
+    // When signaled several times, do not accumulate signals...
+    if ((res = semaphore_signal_all(fSemaphore)) != KERN_SUCCESS) {
+        jack_error("JackMachSemaphore::SignalAll name = %s err = %s", fName, mach_error_string(res));
+    }
+    return (res == KERN_SUCCESS);
+}
+
+bool JackMachSemaphore::Wait()
+{
+    if (!fSemaphore) {
+        jack_error("JackMachSemaphore::Wait name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    kern_return_t res;
+    if ((res = semaphore_wait(fSemaphore)) != KERN_SUCCESS) {
+        jack_error("JackMachSemaphore::Wait name = %s err = %s", fName, mach_error_string(res));
+    }
+    return (res == KERN_SUCCESS);
+}
+
+bool JackMachSemaphore::TimedWait(long usec)
+{
+    if (!fSemaphore) {
+        jack_error("JackMachSemaphore::TimedWait name = %s already desallocated!!", fName);
+        return false;
+    }
+    
+    kern_return_t res;
+    mach_timespec time;
+    time.tv_sec = usec / 1000000;
+    time.tv_nsec = (usec % 1000000) * 1000;
+
+    if ((res = semaphore_timedwait(fSemaphore, time)) != KERN_SUCCESS) {
+        jack_error("JackMachSemaphore::TimedWait name = %s usec = %ld err = %s", fName, usec, mach_error_string(res));
+    }
+    return (res == KERN_SUCCESS);
+}
+
+// Server side : publish the semaphore in the global namespace
+bool JackMachSemaphore::Allocate(const char* name, const char* server_name, int value)
+{
+    BuildName(name, server_name, fName);
+    mach_port_t task = mach_task_self();
+    kern_return_t res;
+
+    if (fBootPort == 0) {
+        if ((res = task_get_bootstrap_port(task, &fBootPort)) != KERN_SUCCESS) {
+            jack_error("Allocate: Can't find bootstrap mach port err = %s", mach_error_string(res));
+            return false;
+        }
+    }
+
+    if ((res = semaphore_create(task, &fSemaphore, SYNC_POLICY_FIFO, value)) != KERN_SUCCESS) {
+        jack_error("Allocate: can create semaphore err = %s", mach_error_string(res));
+        return false;
+    }
+
+    if ((res = bootstrap_register(fBootPort, fName, fSemaphore)) != KERN_SUCCESS) {
+        jack_error("Allocate: can't check in mach semaphore name = %s err = %s", fName, mach_error_string(res));
+
+        switch (res) {
+            case BOOTSTRAP_SUCCESS :
+                /* service not currently registered, "a good thing" (tm) */
+                break;
+            case BOOTSTRAP_NOT_PRIVILEGED :
+                jack_log("bootstrap_register(): bootstrap not privileged");
+                break;
+            case BOOTSTRAP_SERVICE_ACTIVE :
+                jack_log("bootstrap_register(): bootstrap service active");
+                break;
+            default :
+                jack_log("bootstrap_register() err = %s", mach_error_string(res));
+                break;
+        }
+
+        return false;
+    }
+
+    jack_log("JackMachSemaphore::Allocate name = %s", fName);
+    return true;
+}
+
+// Client side : get the published semaphore from server
+bool JackMachSemaphore::ConnectInput(const char* name, const char* server_name)
+{
+    BuildName(name, server_name, fName);
+    kern_return_t res;
+
+    // Temporary...  A REVOIR
+    /*
+    if (fSemaphore > 0) {
+    	jack_log("Already connected name = %s", name);
+    	return true;
+    }
+    */
+
+    if (fBootPort == 0) {
+        if ((res = task_get_bootstrap_port(mach_task_self(), &fBootPort)) != KERN_SUCCESS) {
+            jack_error("Connect: can't find bootstrap port err = %s", mach_error_string(res));
+            return false;
+        }
+    }
+
+    if ((res = bootstrap_look_up(fBootPort, fName, &fSemaphore)) != KERN_SUCCESS) {
+        jack_error("Connect: can't find mach semaphore name = %s err = %s", fName, mach_error_string(res));
+        return false;
+    }
+
+    jack_log("JackMachSemaphore::Connect name = %s ", fName);
+    return true;
+}
+
+bool JackMachSemaphore::Connect(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackMachSemaphore::ConnectOutput(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackMachSemaphore::Disconnect()
+{
+    if (fSemaphore > 0) {
+        jack_log("JackMachSemaphore::Disconnect name = %s", fName);
+        fSemaphore = 0;
+    }
+    // Nothing to do
+    return true;
+}
+
+// Server side : destroy the JackGlobals
+void JackMachSemaphore::Destroy()
+{
+    kern_return_t res;
+
+    if (fSemaphore > 0) {
+        jack_log("JackMachSemaphore::Destroy");
+        if ((res = semaphore_destroy(mach_task_self(), fSemaphore)) != KERN_SUCCESS) {
+            jack_error("JackMachSemaphore::Destroy can't destroy semaphore err = %s", mach_error_string(res));
+        }
+        fSemaphore = 0;
+    } else {
+        jack_error("JackMachSemaphore::Destroy semaphore < 0");
+    }
+}
+
+} // end of namespace
+
diff --git a/macosx/JackMachSemaphore.h b/macosx/JackMachSemaphore.h
new file mode 100644
index 0000000..e87f0c5
--- /dev/null
+++ b/macosx/JackMachSemaphore.h
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMachSemaphore__
+#define __JackMachSemaphore__
+
+#include "JackCompilerDeps.h"
+#include "JackSynchro.h"
+#include <mach/mach.h>
+#include <servers/bootstrap.h>
+#include <mach/semaphore.h>
+
+namespace Jack
+{
+
+/*!
+\brief Inter process synchronization using using Mach semaphore.
+*/
+
+class SERVER_EXPORT JackMachSemaphore : public detail::JackSynchro
+{
+
+    private:
+
+        semaphore_t fSemaphore;
+        static mach_port_t fBootPort;
+
+    protected:
+
+        void BuildName(const char* name, const char* server_name, char* res);
+
+    public:
+
+        JackMachSemaphore():JackSynchro(), fSemaphore(0)
+        {}
+
+        bool Signal();
+        bool SignalAll();
+        bool Wait();
+        bool TimedWait(long usec);
+
+        bool Allocate(const char* name, const char* server_name, int value);
+        bool Connect(const char* name, const char* server_name);
+        bool ConnectInput(const char* name, const char* server_name);
+        bool ConnectOutput(const char* name, const char* server_name);
+        bool Disconnect();
+        void Destroy();
+};
+
+
+} // end of namespace
+
+
+#endif
+
diff --git a/macosx/JackMachServerChannel.cpp b/macosx/JackMachServerChannel.cpp
new file mode 100644
index 0000000..fcf4fe8
--- /dev/null
+++ b/macosx/JackMachServerChannel.cpp
@@ -0,0 +1,174 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackTools.h"
+#include "JackMachServerChannel.h"
+#include "JackRPCEngineServer.c"
+#include "JackError.h"
+#include "JackServer.h"
+#include "JackLockedEngine.h"
+#include "JackNotification.h"
+#include "JackServerGlobals.h"
+
+using namespace std;
+
+namespace Jack
+{
+
+map<mach_port_t, JackMachServerChannel*> JackMachServerChannel::fPortTable;
+
+JackMachServerChannel::JackMachServerChannel():fThread(this)
+{}
+
+JackMachServerChannel::~JackMachServerChannel()
+{}
+
+int JackMachServerChannel::Open(const char* server_name, JackServer* server)
+{
+    jack_log("JackMachServerChannel::Open");
+    char jack_server_entry_name[512];
+    snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);
+
+    if (!fServerPort.AllocatePort(jack_server_entry_name, 16)) { // 16 is the max possible value
+        jack_error("Cannot check in Jack server");
+        return -1;
+    }
+
+    fServer = server;
+    fPortTable[fServerPort.GetPort()] = this;
+    return 0;
+}
+
+void JackMachServerChannel::Close()
+{
+    jack_log("JackMachServerChannel::Close");
+ #ifdef MAC_OS_X_VERSION_10_5
+    // Exception does not work in this case on pre Snow Loopard systems, see JackMachServerNotifyChannel::NotifyQuit()
+    fThread.Kill();
+ #else
+    fThread.Stop();
+ #endif
+    fServerPort.DestroyPort();
+}
+    
+int JackMachServerChannel::Start()
+{
+    if (fThread.Start() != 0) {
+        jack_error("Cannot start Jack server listener");
+        return -1;
+    }  
+    
+    return 0;
+}
+
+JackLockedEngine* JackMachServerChannel::GetEngine()
+{
+    return fServer->GetEngine();
+}
+
+JackServer* JackMachServerChannel::GetServer()
+{
+    return fServer;
+}
+
+void JackMachServerChannel::ClientCheck(char* name, char* name_res, int protocol, int options, int* status, int* result)
+{
+    *result = GetEngine()->ClientCheck(name, name_res, protocol, options, status);
+}
+
+void JackMachServerChannel::ClientOpen(char* name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    int refnum = -1;
+    *result = GetEngine()->ClientExternalOpen(name, pid, &refnum, shared_engine, shared_client, shared_graph);
+
+    if (*result == 0) {
+        mach_port_t port = fServerPort.AddPort();
+        if (port != 0) {
+            fClientTable[port] = refnum;
+            fPortTable[port] = this;
+            *private_port = port;
+        } else {
+            jack_error("Cannot create private client mach port");
+            *result = -1;
+        }
+    } else {
+        jack_error("Cannot create new client");
+    }
+}
+
+void JackMachServerChannel::ClientClose(mach_port_t private_port, int refnum)
+{
+    GetEngine()->ClientExternalClose(refnum);
+    fClientTable.erase(private_port);
+
+    // Hum, hum....
+    kern_return_t res;
+    if ((res = mach_port_destroy(mach_task_self(), private_port)) != KERN_SUCCESS) {
+        jack_error("server_rpc_jack_client_close mach_port_destroy %s", mach_error_string(res));
+    }
+}
+
+void JackMachServerChannel::ClientKill(mach_port_t private_port)
+{
+    jack_log("JackMachServerChannel::ClientKill");
+    int refnum = fClientTable[private_port];
+    assert(refnum > 0);
+    fServer->ClientKill(refnum);
+    fClientTable.erase(private_port);
+
+    // Hum, hum....
+    kern_return_t res;
+    if ((res = mach_port_destroy(mach_task_self(), private_port)) != KERN_SUCCESS) {
+        jack_error("server_rpc_jack_client_close mach_port_destroy %s", mach_error_string(res));
+    }
+}
+
+boolean_t JackMachServerChannel::MessageHandler(mach_msg_header_t* Request, mach_msg_header_t* Reply)
+{
+    if (Request->msgh_id == MACH_NOTIFY_NO_SENDERS) {
+        jack_log("MACH_NOTIFY_NO_SENDERS %ld", Request->msgh_local_port);
+        JackMachServerChannel* channel = JackMachServerChannel::fPortTable[Request->msgh_local_port];
+        assert(channel);
+        channel->ClientKill(Request->msgh_local_port);
+    } else {
+        JackRPCEngine_server(Request, Reply);
+    }
+    return true;
+}
+
+bool JackMachServerChannel::Execute()
+{
+    try {
+        
+        kern_return_t res;
+        if ((res = mach_msg_server(MessageHandler, 1024, fServerPort.GetPortSet(), 0)) != KERN_SUCCESS) {
+            jack_log("JackMachServerChannel::Execute: err = %s", mach_error_string(res));
+            return false;
+        }
+        return true;
+        
+    } catch (JackQuitException& e) {
+        jack_log("JackMachServerChannel::Execute JackQuitException");
+        return false;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/macosx/JackMachServerChannel.h b/macosx/JackMachServerChannel.h
new file mode 100644
index 0000000..fc5a100
--- /dev/null
+++ b/macosx/JackMachServerChannel.h
@@ -0,0 +1,76 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMachServerChannel__
+#define __JackMachServerChannel__
+
+#include "JackPlatformPlug.h"
+#include "JackMachPort.h"
+#include <map>
+
+namespace Jack
+{
+
+class JackServer;
+class JackLockedEngine;
+
+/*!
+\brief JackServerChannel using Mach IPC.
+*/
+
+class JackMachServerChannel : public JackRunnableInterface
+{
+
+    private:
+
+        JackMachPortSet fServerPort;    /*! Mach port to communicate with the server : from client to server */
+        JackThread fThread;             /*! Thread to execute the event loop */
+        JackServer* fServer;
+        std::map<mach_port_t, int> fClientTable;
+
+        static boolean_t MessageHandler(mach_msg_header_t* Request, mach_msg_header_t* Reply);
+
+    public:
+
+        JackMachServerChannel();
+        ~JackMachServerChannel();
+
+        int Open(const char* server_name, JackServer* server);	// Open the Server/Client connection
+        void Close();                                           // Close the Server/Client connection
+    
+        int Start();
+  
+        JackLockedEngine* GetEngine();
+        JackServer* GetServer();
+
+        void ClientCheck(char* name, char* name_res, int protocol, int options, int* status, int* result);
+        void ClientOpen(char* name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result);
+        void ClientClose(mach_port_t private_port, int refnum);
+        void ClientKill(mach_port_t private_port);
+
+        bool Execute();
+
+        // Has to be public..
+        static std::map<mach_port_t, JackMachServerChannel*> fPortTable;
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/macosx/JackMachServerNotifyChannel.cpp b/macosx/JackMachServerNotifyChannel.cpp
new file mode 100644
index 0000000..f55ce09
--- /dev/null
+++ b/macosx/JackMachServerNotifyChannel.cpp
@@ -0,0 +1,70 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackMachServerNotifyChannel.h"
+#include "JackRPCEngineUser.c"
+#include "JackNotification.h"
+#include "JackTools.h"
+#include "JackConstants.h"
+#include "JackError.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+int JackMachServerNotifyChannel::Open(const char* server_name)
+{
+    jack_log("JackMachServerChannel::Open");
+    char jack_server_entry_name[512];
+    snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);
+
+    if (!fClientPort.ConnectPort(jack_server_entry_name)) {
+        jack_error("Cannot connect to server port");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+void JackMachServerNotifyChannel::Close()
+{}
+
+void JackMachServerNotifyChannel::Notify(int refnum, int notify, int value)
+{
+    kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), refnum, notify, value, 0);
+    if (res != KERN_SUCCESS) {
+        jack_error("Could not write request ref = %d notify = %d err = %s", refnum, notify, mach_error_string(res));
+    }
+}
+    
+void JackMachServerNotifyChannel::NotifyQuit()
+{
+ #ifdef MAC_OS_X_VERSION_10_5
+    // Nothing : since exception does not work in this case on pre Snow Loopard systems, see JackMachServerChannel::Close()
+ #else
+    kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), -1, kQUIT, 0, 0);
+    if (res != KERN_SUCCESS) {
+        jack_error("Could not write request ref = %d notify = %d err = %s", -1, kQUIT, mach_error_string(res));
+    }
+#endif
+}
+
+} // end of namespace
+
+
diff --git a/macosx/JackMachServerNotifyChannel.h b/macosx/JackMachServerNotifyChannel.h
new file mode 100644
index 0000000..8eb7b72
--- /dev/null
+++ b/macosx/JackMachServerNotifyChannel.h
@@ -0,0 +1,55 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackMachServerNotifyChannel__
+#define __JackMachServerNotifyChannel__
+
+#include "JackChannel.h"
+#include "JackMachPort.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackServerNotifyChannel using Mach IPC.
+*/
+
+class JackMachServerNotifyChannel
+{
+
+    private:
+
+        JackMachPort fClientPort;    /*! Mach port to communicate with the server : from client to server */
+
+    public:
+
+        JackMachServerNotifyChannel()
+        {}
+
+        int Open(const char* server_name);  // Open the Server/Client connection
+        void Close();                       // Close the Server/Client connection
+
+        void Notify(int refnum, int notify, int value);
+        void NotifyQuit();
+};  
+
+} // end of namespace
+
+#endif
+
diff --git a/macosx/JackMachThread.cpp b/macosx/JackMachThread.cpp
new file mode 100644
index 0000000..9a7ed47
--- /dev/null
+++ b/macosx/JackMachThread.cpp
@@ -0,0 +1,214 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackMachThread.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+int JackMachThread::SetThreadToPriority(pthread_t thread, UInt32 inPriority, Boolean inIsFixed, UInt64 period, UInt64 computation, UInt64 constraint)
+{
+    if (inPriority == 96) {
+        // REAL-TIME / TIME-CONSTRAINT THREAD
+        thread_time_constraint_policy_data_t	theTCPolicy;
+
+        theTCPolicy.period = AudioConvertNanosToHostTime(period);
+        theTCPolicy.computation = AudioConvertNanosToHostTime(computation);
+        theTCPolicy.constraint = AudioConvertNanosToHostTime(constraint);
+        theTCPolicy.preemptible = true;
+        kern_return_t res = thread_policy_set(pthread_mach_thread_np(thread), THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t) & theTCPolicy, THREAD_TIME_CONSTRAINT_POLICY_COUNT);
+        jack_log("JackMachThread::thread_policy_set res = %ld", res);
+        return (res == KERN_SUCCESS) ? 0 : -1;
+    } else {
+        // OTHER THREADS
+        thread_extended_policy_data_t theFixedPolicy;
+        thread_precedence_policy_data_t thePrecedencePolicy;
+        SInt32 relativePriority;
+
+        // [1] SET FIXED / NOT FIXED
+        theFixedPolicy.timeshare = !inIsFixed;
+        thread_policy_set(pthread_mach_thread_np(thread), THREAD_EXTENDED_POLICY, (thread_policy_t)&theFixedPolicy, THREAD_EXTENDED_POLICY_COUNT);
+
+        // [2] SET PRECEDENCE
+        // N.B.: We expect that if thread A created thread B, and the program wishes to change
+        // the priority of thread B, then the call to change the priority of thread B must be
+        // made by thread A.
+        // This assumption allows us to use pthread_self() to correctly calculate the priority
+        // of the feeder thread (since precedency policy's importance is relative to the
+        // spawning thread's priority.)
+        relativePriority = inPriority - GetThreadSetPriority(pthread_self());
+
+        thePrecedencePolicy.importance = relativePriority;
+        kern_return_t res = thread_policy_set(pthread_mach_thread_np(thread), THREAD_PRECEDENCE_POLICY, (thread_policy_t) & thePrecedencePolicy, THREAD_PRECEDENCE_POLICY_COUNT);
+        jack_log("JackMachThread::thread_policy_set res = %ld", res);
+        return (res == KERN_SUCCESS) ? 0 : -1;
+    }
+}
+
+// returns the thread's priority as it was last set by the API
+UInt32 JackMachThread::GetThreadSetPriority(pthread_t thread)
+{
+    return GetThreadPriority(thread, THREAD_SET_PRIORITY);
+}
+
+// returns the thread's priority as it was last scheduled by the Kernel
+UInt32 JackMachThread::GetThreadScheduledPriority(pthread_t thread)
+{
+    return GetThreadPriority(thread, THREAD_SCHEDULED_PRIORITY);
+}
+
+UInt32 JackMachThread::GetThreadPriority(pthread_t thread, int inWhichPriority)
+{
+    thread_basic_info_data_t threadInfo;
+    policy_info_data_t thePolicyInfo;
+    unsigned int count;
+
+    // get basic info
+    count = THREAD_BASIC_INFO_COUNT;
+    thread_info(pthread_mach_thread_np(thread), THREAD_BASIC_INFO, (thread_info_t)&threadInfo, &count);
+
+    switch (threadInfo.policy) {
+        case POLICY_TIMESHARE:
+            count = POLICY_TIMESHARE_INFO_COUNT;
+            thread_info(pthread_mach_thread_np(thread), THREAD_SCHED_TIMESHARE_INFO, (thread_info_t)&(thePolicyInfo.ts), &count);
+            if (inWhichPriority == THREAD_SCHEDULED_PRIORITY) {
+                return thePolicyInfo.ts.cur_priority;
+            } else {
+                return thePolicyInfo.ts.base_priority;
+            }
+            break;
+
+        case POLICY_FIFO:
+            count = POLICY_FIFO_INFO_COUNT;
+            thread_info(pthread_mach_thread_np(thread), THREAD_SCHED_FIFO_INFO, (thread_info_t)&(thePolicyInfo.fifo), &count);
+            if ( (thePolicyInfo.fifo.depressed) && (inWhichPriority == THREAD_SCHEDULED_PRIORITY) ) {
+                return thePolicyInfo.fifo.depress_priority;
+            }
+            return thePolicyInfo.fifo.base_priority;
+            break;
+
+        case POLICY_RR:
+            count = POLICY_RR_INFO_COUNT;
+            thread_info(pthread_mach_thread_np(thread), THREAD_SCHED_RR_INFO, (thread_info_t)&(thePolicyInfo.rr), &count);
+            if ( (thePolicyInfo.rr.depressed) && (inWhichPriority == THREAD_SCHEDULED_PRIORITY) ) {
+                return thePolicyInfo.rr.depress_priority;
+            }
+            return thePolicyInfo.rr.base_priority;
+            break;
+    }
+
+    return 0;
+}
+
+int JackMachThread::GetParams(pthread_t thread, UInt64* period, UInt64* computation, UInt64* constraint)
+{
+    thread_time_constraint_policy_data_t theTCPolicy;
+    mach_msg_type_number_t count = THREAD_TIME_CONSTRAINT_POLICY_COUNT;
+    boolean_t get_default = false;
+
+    kern_return_t res = thread_policy_get(pthread_mach_thread_np(thread),
+                                          THREAD_TIME_CONSTRAINT_POLICY,
+                                          (thread_policy_t) & theTCPolicy,
+                                          &count,
+                                          &get_default);
+    if (res == KERN_SUCCESS) {
+        *period = AudioConvertHostTimeToNanos(theTCPolicy.period);
+        *computation = AudioConvertHostTimeToNanos(theTCPolicy.computation);
+        *constraint = AudioConvertHostTimeToNanos(theTCPolicy.constraint);
+        jack_log("JackMachThread::GetParams period = %ld computation = %ld constraint = %ld", long(*period / 1000.0f), long(*computation / 1000.0f), long(*constraint / 1000.0f));
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackMachThread::Kill()
+{
+    // pthread_cancel still not yet implemented in Darwin (TO CHECK ON TIGER)
+    jack_log("JackMachThread::Kill");
+    
+    if (fThread != (pthread_t)NULL)  { // If thread has been started
+        mach_port_t machThread = pthread_mach_thread_np(fThread);
+        int res = (thread_terminate(machThread) == KERN_SUCCESS) ? 0 : -1;
+        fThread = (pthread_t)NULL;
+        return res;
+    } else {
+        return -1;
+    }
+}
+
+int JackMachThread::AcquireRealTime()
+{
+    jack_log("JackMachThread::AcquireRealTime fPeriod = %ld fComputation = %ld fConstraint = %ld",
+             long(fPeriod / 1000), long(fComputation / 1000), long(fConstraint / 1000));
+    return (fThread != (pthread_t)NULL) ? AcquireRealTimeImp(fThread, fPeriod, fComputation, fConstraint) : -1; 
+}
+
+int JackMachThread::AcquireSelfRealTime()
+{
+    jack_log("JackMachThread::AcquireRealTime fPeriod = %ld fComputation = %ld fConstraint = %ld",
+             long(fPeriod / 1000), long(fComputation / 1000), long(fConstraint / 1000));
+    return AcquireRealTimeImp(pthread_self(), fPeriod, fComputation, fConstraint);
+}
+
+int JackMachThread::AcquireRealTime(int priority)
+{
+    fPriority = priority;
+    return AcquireRealTime();
+}
+
+int JackMachThread::AcquireSelfRealTime(int priority)
+{
+    fPriority = priority;
+    return AcquireSelfRealTime();
+}
+
+int JackMachThread::AcquireRealTimeImp(pthread_t thread, UInt64 period, UInt64 computation, UInt64 constraint)
+{
+    SetThreadToPriority(thread, 96, true, period, computation, constraint);
+    return 0;
+}
+
+int JackMachThread::DropRealTime()
+{
+    return (fThread != (pthread_t)NULL) ? DropRealTimeImp(fThread) : -1;
+}
+
+int JackMachThread::DropSelfRealTime()
+{
+    return DropRealTimeImp(pthread_self());
+}
+
+int JackMachThread::DropRealTimeImp(pthread_t thread)
+{
+    SetThreadToPriority(thread, 63, false, 0, 0, 0);
+    return 0;
+}
+
+void JackMachThread::SetParams(UInt64 period, UInt64 computation, UInt64 constraint)
+{
+    fPeriod = period;
+    fComputation = computation;
+    fConstraint = constraint;
+}
+
+} // end of namespace
+
diff --git a/macosx/JackMachThread.h b/macosx/JackMachThread.h
new file mode 100644
index 0000000..c7a44f7
--- /dev/null
+++ b/macosx/JackMachThread.h
@@ -0,0 +1,129 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/*
+	Copyright: 	Copyright 2002 Apple Computer, Inc. All rights reserved.
+
+	Disclaimer:	IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
+	("Apple") in consideration of your agreement to the following terms, and your
+	use, installation, modification or redistribution of this Apple software
+	constitutes acceptance of these terms.  If you do not agree with these terms,
+	please do not use, install, modify or redistribute this Apple software.
+
+	In consideration of your agreement to abide by the following terms, and subject
+	to these terms, Apple grants you a personal, non-exclusive license, under Apple
+	copyrights in this original Apple software (the "Apple Software"), to use,
+	reproduce, modify and redistribute the Apple Software, with or without
+	modifications, in source and/or binary forms; provided that if you redistribute
+	the Apple Software in its entirety and without modifications, you must retain
+	this notice and the following text and disclaimers in all such redistributions of
+	the Apple Software.  Neither the name, trademarks, service marks or logos of
+	Apple Computer, Inc. may be used to endorse or promote products derived from the
+	Apple Software without specific prior written permission from Apple.  Except as
+	expressly stated in this notice, no other rights or licenses, express or implied,
+	are granted by Apple herein, including but not limited to any patent rights that
+	may be infringed by your derivative works or by other works in which the Apple
+	Software may be incorporated.
+
+	The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
+	WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+	WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+	PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+	COMBINATION WITH YOUR PRODUCTS.
+
+	IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+	GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+	ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
+	OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
+	(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
+	ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef __JackMachThread__
+#define __JackMachThread__
+
+#include "JackPosixThread.h"
+#import <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
+
+#include <mach/thread_policy.h>
+#include <mach/thread_act.h>
+#include <CoreAudio/HostTime.h>
+
+#define THREAD_SET_PRIORITY         0
+#define THREAD_SCHEDULED_PRIORITY   1
+
+namespace Jack
+{
+
+/*!
+\brief Darwin threads. Real-time threads are actually "time constraint" threads.
+*/
+
+class SERVER_EXPORT JackMachThread : public JackPosixThread
+{
+
+    private:
+
+        UInt64 fPeriod;
+        UInt64 fComputation;
+        UInt64 fConstraint;
+
+        static UInt32 GetThreadSetPriority(pthread_t thread);
+        static UInt32 GetThreadScheduledPriority(pthread_t thread);
+        static UInt32 GetThreadPriority(pthread_t thread, int inWhichPriority);
+
+    public:
+
+        JackMachThread(JackRunnableInterface* runnable, UInt64 period, UInt64 computation, UInt64 constraint)
+                : JackPosixThread(runnable), fPeriod(period), fComputation(computation), fConstraint(constraint)
+        {}
+
+        JackMachThread(JackRunnableInterface* runnable, int cancellation = PTHREAD_CANCEL_ASYNCHRONOUS)
+                : JackPosixThread(runnable, cancellation), fPeriod(0), fComputation(0), fConstraint(0)
+        {}
+
+        int Kill();
+
+        int AcquireRealTime();                  // Used when called from another thread
+        int AcquireSelfRealTime();              // Used when called from thread itself
+        
+        int AcquireRealTime(int priority);      // Used when called from another thread
+        int AcquireSelfRealTime(int priority);  // Used when called from thread itself
+        
+        int DropRealTime();                     // Used when called from another thread
+        int DropSelfRealTime();                 // Used when called from thread itself
+        
+        void SetParams(UInt64 period, UInt64 computation, UInt64 constraint);
+        static int GetParams(pthread_t thread, UInt64* period, UInt64* computation, UInt64* constraint);
+        static int SetThreadToPriority(pthread_t thread, UInt32 inPriority, Boolean inIsFixed, UInt64 period, UInt64 computation, UInt64 constraint);
+
+        static int AcquireRealTimeImp(pthread_t thread, UInt64 period, UInt64 computation, UInt64 constraint);
+        static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
+		{ 
+            return JackMachThread::AcquireRealTimeImp(thread, period, computation, constraint); 
+        }
+        static int DropRealTimeImp(pthread_t thread);
+};
+
+} // end of namespace
+
+#endif
diff --git a/macosx/JackMachTime.c b/macosx/JackMachTime.c
new file mode 100644
index 0000000..c24ae31
--- /dev/null
+++ b/macosx/JackMachTime.c
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackTime.h"
+#include "JackError.h"
+#include "JackTypes.h"
+#include <mach/mach_time.h>
+#include <unistd.h>
+
+static double __jack_time_ratio;
+
+SERVER_EXPORT void JackSleep(long usec) 
+{
+	usleep(usec);
+}
+
+/* This should only be called ONCE per process. */
+SERVER_EXPORT void InitTime()
+{
+	mach_timebase_info_data_t info;
+	mach_timebase_info(&info);
+	__jack_time_ratio = ((float)info.numer / info.denom) / 1000;
+}
+
+SERVER_EXPORT jack_time_t GetMicroSeconds(void) 
+{
+    return (jack_time_t) (mach_absolute_time () * __jack_time_ratio);
+}
+
+SERVER_EXPORT void SetClockSource(jack_timer_type_t source)
+{}
+
+SERVER_EXPORT const char* ClockSourceName(jack_timer_type_t source)
+{
+    return "";
+}
diff --git a/macosx/JackPlatformPlug_os.h b/macosx/JackPlatformPlug_os.h
new file mode 100644
index 0000000..c52a259
--- /dev/null
+++ b/macosx/JackPlatformPlug_os.h
@@ -0,0 +1,72 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPlatformPlug_APPLE__
+#define __JackPlatformPlug_APPLE__
+
+namespace Jack
+{       
+	class JackPosixMutex;
+	class JackMachThread;
+	class JackMachSemaphore;
+
+	class JackMachServerChannel;
+	class JackMachClientChannel;
+	class JackMachServerNotifyChannel;
+	class JackMachNotifyChannel;
+	class JackNetUnixSocket;
+}
+
+/* __JackPlatformMutex__ */
+#include "JackPosixMutex.h"
+namespace Jack { typedef JackPosixMutex JackMutex; }
+
+/* __JackPlatformThread__ */
+#include "JackMachThread.h"
+namespace Jack { typedef JackMachThread JackThread; }
+
+/* __JackPlatformSynchro__  client activation */
+#include "JackMachSemaphore.h"
+namespace Jack { typedef JackMachSemaphore JackSynchro; }
+
+/* __JackPlatformProcessSync__ */
+#include "JackProcessSync.h"
+/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */
+
+/* __JackPlatformServerChannel__ */ 
+#include "JackMachServerChannel.h"
+namespace Jack { typedef JackMachServerChannel JackServerChannel; }
+
+/* __JackPlatformClientChannel__ */
+#include "JackMachClientChannel.h"
+namespace Jack { typedef JackMachClientChannel JackClientChannel; }
+
+/* __JackPlatformServerNotifyChannel__ */
+#include "JackMachServerNotifyChannel.h"
+namespace Jack { typedef JackMachServerNotifyChannel JackServerNotifyChannel; }
+
+/* __JackPlatformNotifyChannel__ */
+#include "JackMachNotifyChannel.h"
+namespace Jack { typedef JackMachNotifyChannel JackNotifyChannel; }
+
+/* __JackPlatformNetSocket__ */
+#include "JackNetUnixSocket.h"
+namespace Jack { typedef JackNetUnixSocket JackNetSocket; }
+
+#endif
diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..461f827
--- /dev/null
+++ b/macosx/Jackdmp.xcodeproj/project.pbxproj
@@ -0,0 +1,18862 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXAggregateTarget section */
+		4B35C6420D47339B000DE7AE /* All Universal 32/64 bits */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 4B35C6790D47339B000DE7AE /* Build configuration list for PBXAggregateTarget "All Universal 32/64 bits" */;
+			buildPhases = (
+			);
+			dependencies = (
+				4B35C6800D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6820D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C67E0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6AC0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6B00D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6B20D4733B9000DE7AE /* PBXTargetDependency */,
+				4BDCDC2C1002036100B15929 /* PBXTargetDependency */,
+				4BDCDC2E1002036100B15929 /* PBXTargetDependency */,
+				4B32259110A31ABA00838A8E /* PBXTargetDependency */,
+				4B43A8E91014618D00E52943 /* PBXTargetDependency */,
+				4BDCDC301002036100B15929 /* PBXTargetDependency */,
+				4BDCDC39100203D500B15929 /* PBXTargetDependency */,
+				4BDCDC3B100203D500B15929 /* PBXTargetDependency */,
+				4B35C6860D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6880D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C68A0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C68C0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C68E0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6900D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6920D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6940D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6960D4733B9000DE7AE /* PBXTargetDependency */,
+				4B0A29300D5210C4002EFF74 /* PBXTargetDependency */,
+				4B35C69C0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C69E0D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6A00D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6A20D4733B9000DE7AE /* PBXTargetDependency */,
+				4B35C6A40D4733B9000DE7AE /* PBXTargetDependency */,
+				4BFA83320DF6AB540087B4E1 /* PBXTargetDependency */,
+				4BFA83340DF6AB540087B4E1 /* PBXTargetDependency */,
+				4BFA83380DF6AB540087B4E1 /* PBXTargetDependency */,
+				4BFA833A0DF6AB540087B4E1 /* PBXTargetDependency */,
+				4BFA833C0DF6AB540087B4E1 /* PBXTargetDependency */,
+				4B32258F10A31AB400838A8E /* PBXTargetDependency */,
+			);
+			name = "All Universal 32/64 bits";
+			productName = All;
+		};
+		4B699B26097D421600A18468 /* All Universal 32 bits */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 4B699B33097D421600A18468 /* Build configuration list for PBXAggregateTarget "All Universal 32 bits" */;
+			buildPhases = (
+			);
+			dependencies = (
+				4B699DB4097D421700A18468 /* PBXTargetDependency */,
+				4B699DB6097D421700A18468 /* PBXTargetDependency */,
+				4B699DB8097D421700A18468 /* PBXTargetDependency */,
+				4B699DBA097D421700A18468 /* PBXTargetDependency */,
+				4BF339280F8B87800080FB5B /* PBXTargetDependency */,
+				4B699DBC097D421700A18468 /* PBXTargetDependency */,
+				BA222AF20DC883F3001A17F4 /* PBXTargetDependency */,
+				4B32258D10A31A9D00838A8E /* PBXTargetDependency */,
+				4B43A8CD1014607100E52943 /* PBXTargetDependency */,
+				4BD624D30CBCF55700DE782F /* PBXTargetDependency */,
+				BA222AF00DC883EF001A17F4 /* PBXTargetDependency */,
+				4B19B32C0E23636E00DD4A82 /* PBXTargetDependency */,
+				4B224B340E65BA330066BE5B /* PBXTargetDependency */,
+				4B5A1BE20CD1CD730005BF74 /* PBXTargetDependency */,
+				4B5A1BCF0CD1CCC80005BF74 /* PBXTargetDependency */,
+				4BFA99440AAAED90009E916C /* PBXTargetDependency */,
+				4BFA99460AAAED90009E916C /* PBXTargetDependency */,
+				4BA7FECD0D8E76810017FF73 /* PBXTargetDependency */,
+				4BFA99480AAAED90009E916C /* PBXTargetDependency */,
+				4BFA994A0AAAED90009E916C /* PBXTargetDependency */,
+				4BFA994C0AAAED90009E916C /* PBXTargetDependency */,
+				4BFA994E0AAAED90009E916C /* PBXTargetDependency */,
+				4BFA99560AAAED90009E916C /* PBXTargetDependency */,
+				4BE99D630AD7A19100C59091 /* PBXTargetDependency */,
+				4BA693E90CBE5BBA00EAD520 /* PBXTargetDependency */,
+				4BA693EB0CBE5BBA00EAD520 /* PBXTargetDependency */,
+				4B0A28F40D520D11002EFF74 /* PBXTargetDependency */,
+				4B363DE50DEB037F001F72D9 /* PBXTargetDependency */,
+				4BFA99AC0AAAF41D009E916C /* PBXTargetDependency */,
+				4BFA99540AAAED90009E916C /* PBXTargetDependency */,
+				4B363E750DEB0838001F72D9 /* PBXTargetDependency */,
+				4B363E770DEB0838001F72D9 /* PBXTargetDependency */,
+				4B363F250DEB0ABE001F72D9 /* PBXTargetDependency */,
+				4B363F530DEB0CFE001F72D9 /* PBXTargetDependency */,
+				4B363F780DEB0D85001F72D9 /* PBXTargetDependency */,
+				4B32258B10A31A9000838A8E /* PBXTargetDependency */,
+			);
+			name = "All Universal 32 bits";
+			productName = All;
+		};
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+		4B0A28ED0D520852002EFF74 /* tw.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0A28EC0D520852002EFF74 /* tw.c */; };
+		4B0A29260D52108E002EFF74 /* tw.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0A28EC0D520852002EFF74 /* tw.c */; };
+		4B19B3130E2362E800DD4A82 /* JackAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */; };
+		4B19B3140E2362E800DD4A82 /* JackAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */; };
+		4B19B3150E2362E800DD4A82 /* JackAudioAdapterInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */; };
+		4B19B3160E2362E800DD4A82 /* JackAudioAdapterInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3090E2362E700DD4A82 /* JackAudioAdapterInterface.h */; };
+		4B19B3190E2362E800DD4A82 /* JackException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30C0E2362E700DD4A82 /* JackException.h */; };
+		4B19B31B0E2362E800DD4A82 /* JackLibSampleRateResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B30E0E2362E700DD4A82 /* JackLibSampleRateResampler.cpp */; };
+		4B19B31C0E2362E800DD4A82 /* JackLibSampleRateResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30F0E2362E700DD4A82 /* JackLibSampleRateResampler.h */; };
+		4B19B31F0E2362E800DD4A82 /* JackResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3120E2362E700DD4A82 /* JackResampler.cpp */; };
+		4B3224EA10A315B100838A8E /* JackNetOneDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224E810A315B100838A8E /* JackNetOneDriver.cpp */; };
+		4B3224EB10A315B100838A8E /* JackNetOneDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224E910A315B100838A8E /* JackNetOneDriver.h */; };
+		4B3224F010A315C400838A8E /* netjack_packet.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EC10A315C400838A8E /* netjack_packet.c */; };
+		4B3224F110A315C400838A8E /* netjack_packet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224ED10A315C400838A8E /* netjack_packet.h */; };
+		4B3224F210A315C400838A8E /* netjack.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EE10A315C400838A8E /* netjack.c */; };
+		4B3224F310A315C400838A8E /* netjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224EF10A315C400838A8E /* netjack.h */; };
+		4B32253110A3173900838A8E /* JackNetOneDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224E810A315B100838A8E /* JackNetOneDriver.cpp */; };
+		4B32253210A3173A00838A8E /* JackNetOneDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224E910A315B100838A8E /* JackNetOneDriver.h */; };
+		4B32253310A3173B00838A8E /* netjack.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EE10A315C400838A8E /* netjack.c */; };
+		4B32253410A3173C00838A8E /* netjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224EF10A315C400838A8E /* netjack.h */; };
+		4B32253510A3173D00838A8E /* netjack_packet.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EC10A315C400838A8E /* netjack_packet.c */; };
+		4B32253610A3173E00838A8E /* netjack_packet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224ED10A315C400838A8E /* netjack_packet.h */; };
+		4B32256410A318E300838A8E /* netsource.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B32256310A318E300838A8E /* netsource.c */; };
+		4B32256B10A318FA00838A8E /* netjack.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EE10A315C400838A8E /* netjack.c */; };
+		4B32256C10A318FB00838A8E /* netjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224EF10A315C400838A8E /* netjack.h */; };
+		4B32256D10A318FC00838A8E /* netjack_packet.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EC10A315C400838A8E /* netjack_packet.c */; };
+		4B32256E10A318FD00838A8E /* netjack_packet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224ED10A315C400838A8E /* netjack_packet.h */; };
+		4B32257D10A3195700838A8E /* netjack.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EE10A315C400838A8E /* netjack.c */; };
+		4B32257E10A3195800838A8E /* netjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224EF10A315C400838A8E /* netjack.h */; };
+		4B32257F10A3195900838A8E /* netjack_packet.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3224EC10A315C400838A8E /* netjack_packet.c */; };
+		4B32258010A3195A00838A8E /* netjack_packet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224ED10A315C400838A8E /* netjack_packet.h */; };
+		4B32258110A3195B00838A8E /* netsource.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B32256310A318E300838A8E /* netsource.c */; };
+		4B35C41E0D4731D1000DE7AE /* Jackdmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2250834F06A00C94B91 /* Jackdmp.cpp */; };
+		4B35C4290D4731D1000DE7AE /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
+		4B35C42A0D4731D1000DE7AE /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4B35C42B0D4731D1000DE7AE /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
+		4B35C42C0D4731D1000DE7AE /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
+		4B35C42D0D4731D1000DE7AE /* shm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D18F0834EE8400C94B91 /* shm.h */; };
+		4B35C42F0D4731D1000DE7AE /* JackThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D19F0834EE9E00C94B91 /* JackThread.h */; };
+		4B35C4300D4731D1000DE7AE /* JackActivationCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */; };
+		4B35C4310D4731D1000DE7AE /* JackChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */; };
+		4B35C4320D4731D1000DE7AE /* JackGraphManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */; };
+		4B35C4330D4731D1000DE7AE /* JackPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1CF0834EF2F00C94B91 /* JackPort.h */; };
+		4B35C4340D4731D1000DE7AE /* JackClientInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */; };
+		4B35C4350D4731D1000DE7AE /* JackClientControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */; };
+		4B35C4360D4731D1000DE7AE /* JackClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1E10834EF5500C94B91 /* JackClient.h */; };
+		4B35C4370D4731D1000DE7AE /* JackInternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */; };
+		4B35C4380D4731D1000DE7AE /* JackLibGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1FB0834EFD100C94B91 /* JackLibGlobals.h */; };
+		4B35C4390D4731D1000DE7AE /* JackLibClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1FC0834EFD100C94B91 /* JackLibClient.h */; };
+		4B35C43A0D4731D1000DE7AE /* JackConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */; };
+		4B35C43B0D4731D1000DE7AE /* JackFrameTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */; };
+		4B35C43D0D4731D1000DE7AE /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
+		4B35C43E0D4731D1000DE7AE /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
+		4B35C43F0D4731D1000DE7AE /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
+		4B35C4400D4731D1000DE7AE /* JackMachClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298708AF450200D450D4 /* JackMachClientChannel.h */; };
+		4B35C4460D4731D1000DE7AE /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
+		4B35C4470D4731D1000DE7AE /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
+		4B35C4480D4731D1000DE7AE /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4B35C4490D4731D1000DE7AE /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
+		4B35C44A0D4731D1000DE7AE /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF520580CB8D1010037470E /* timestamps.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C44B0D4731D1000DE7AE /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C73790CC60A6D001AFFD4 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C44C0D4731D1000DE7AE /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737A0CC60A6D001AFFD4 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C44D0D4731D1000DE7AE /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C44E0D4731D1000DE7AE /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737C0CC60A6D001AFFD4 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C44F0D4731D1000DE7AE /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737D0CC60A6D001AFFD4 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4500D4731D1000DE7AE /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737E0CC60A6D001AFFD4 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4510D4731D1000DE7AE /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737F0CC60A6D001AFFD4 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4520D4731D1000DE7AE /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; };
+		4B35C4530D4731D1000DE7AE /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
+		4B35C4540D4731D1000DE7AE /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4550D4731D1000DE7AE /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
+		4B35C4580D4731D1000DE7AE /* JackMacLibClientRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */; };
+		4B35C4590D4731D1000DE7AE /* JackRPCEngineUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B769076B74D200D170DE /* JackRPCEngineUser.c */; };
+		4B35C45A0D4731D1000DE7AE /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
+		4B35C45B0D4731D1000DE7AE /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
+		4B35C45C0D4731D1000DE7AE /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
+		4B35C45E0D4731D1000DE7AE /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
+		4B35C45F0D4731D1000DE7AE /* JackGraphManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */; };
+		4B35C4600D4731D1000DE7AE /* JackPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */; };
+		4B35C4610D4731D1000DE7AE /* JackClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E50834EF6700C94B91 /* JackClient.cpp */; };
+		4B35C4620D4731D1000DE7AE /* JackAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */; };
+		4B35C4630D4731D1000DE7AE /* JackLibClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1FD0834EFD100C94B91 /* JackLibClient.cpp */; };
+		4B35C4640D4731D1000DE7AE /* JackLibAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1FE0834EFD100C94B91 /* JackLibAPI.cpp */; };
+		4B35C4650D4731D1000DE7AE /* JackConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */; };
+		4B35C4660D4731D1000DE7AE /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
+		4B35C4680D4731D1000DE7AE /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4B35C4690D4731D1000DE7AE /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4B35C46A0D4731D1000DE7AE /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; };
+		4B35C4700D4731D1000DE7AE /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
+		4B35C4720D4731D1000DE7AE /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
+		4B35C4730D4731D1000DE7AE /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
+		4B35C4740D4731D1000DE7AE /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
+		4B35C4760D4731D1000DE7AE /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
+		4B35C4770D4731D1000DE7AE /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; };
+		4B35C4780D4731D1000DE7AE /* JackAudioPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */; };
+		4B35C4790D4731D1000DE7AE /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
+		4B35C47A0D4731D1000DE7AE /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
+		4B35C47B0D4731D1000DE7AE /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
+		4B35C47C0D4731D1000DE7AE /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
+		4B35C4870D4731D1000DE7AE /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
+		4B35C4880D4731D1000DE7AE /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4B35C4890D4731D1000DE7AE /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
+		4B35C48A0D4731D1000DE7AE /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
+		4B35C48B0D4731D1000DE7AE /* shm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D18F0834EE8400C94B91 /* shm.h */; };
+		4B35C48D0D4731D1000DE7AE /* JackThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D19F0834EE9E00C94B91 /* JackThread.h */; };
+		4B35C48E0D4731D1000DE7AE /* JackActivationCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */; };
+		4B35C48F0D4731D1000DE7AE /* JackChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */; };
+		4B35C4900D4731D1000DE7AE /* JackGraphManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */; };
+		4B35C4910D4731D1000DE7AE /* JackPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1CF0834EF2F00C94B91 /* JackPort.h */; };
+		4B35C4920D4731D1000DE7AE /* JackClientInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */; };
+		4B35C4930D4731D1000DE7AE /* JackClientControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */; };
+		4B35C4940D4731D1000DE7AE /* JackClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1E10834EF5500C94B91 /* JackClient.h */; };
+		4B35C4950D4731D1000DE7AE /* JackInternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */; };
+		4B35C4960D4731D1000DE7AE /* JackConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */; };
+		4B35C4970D4731D1000DE7AE /* JackFrameTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */; };
+		4B35C4990D4731D1000DE7AE /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
+		4B35C49A0D4731D1000DE7AE /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
+		4B35C49B0D4731D1000DE7AE /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
+		4B35C4A00D4731D1000DE7AE /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
+		4B35C4A10D4731D1000DE7AE /* JackAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2290834F07D00C94B91 /* JackAudioDriver.h */; };
+		4B35C4A20D4731D1000DE7AE /* JackFreewheelDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1B90834EEF100C94B91 /* JackFreewheelDriver.h */; };
+		4B35C4A30D4731D1000DE7AE /* JackThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1BD0834EEFC00C94B91 /* JackThreadedDriver.h */; };
+		4B35C4A40D4731D1000DE7AE /* JackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1B50834EEE400C94B91 /* JackDriver.h */; };
+		4B35C4A50D4731D1000DE7AE /* driver_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B869B3D08C8D21C001CF041 /* driver_interface.h */; };
+		4B35C4A70D4731D1000DE7AE /* JackDriverLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B869B4208C8D22F001CF041 /* JackDriverLoader.h */; };
+		4B35C4A90D4731D1000DE7AE /* JackEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2130834F02800C94B91 /* JackEngine.h */; };
+		4B35C4AA0D4731D1000DE7AE /* JackExternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */; };
+		4B35C4AB0D4731D1000DE7AE /* JackServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2220834F05C00C94B91 /* JackServer.h */; };
+		4B35C4AE0D4731D1000DE7AE /* JackMachNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */; };
+		4B35C4AF0D4731D1000DE7AE /* JackMachServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */; };
+		4B35C4B00D4731D1000DE7AE /* JackMachServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */; };
+		4B35C4B20D4731D1000DE7AE /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4B35C4B30D4731D1000DE7AE /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
+		4B35C4B40D4731D1000DE7AE /* JackServerGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */; };
+		4B35C4B50D4731D1000DE7AE /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF520580CB8D1010037470E /* timestamps.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4B60D4731D1000DE7AE /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737A0CC60A6D001AFFD4 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4B70D4731D1000DE7AE /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C73790CC60A6D001AFFD4 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4B80D4731D1000DE7AE /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4B90D4731D1000DE7AE /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737C0CC60A6D001AFFD4 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4BA0D4731D1000DE7AE /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737D0CC60A6D001AFFD4 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4BB0D4731D1000DE7AE /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737E0CC60A6D001AFFD4 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4BC0D4731D1000DE7AE /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737F0CC60A6D001AFFD4 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4BD0D4731D1000DE7AE /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; };
+		4B35C4BE0D4731D1000DE7AE /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
+		4B35C4BF0D4731D1000DE7AE /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B35C4C00D4731D1000DE7AE /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
+		4B35C4C10D4731D1000DE7AE /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
+		4B35C4C40D4731D1000DE7AE /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
+		4B35C4C50D4731D1000DE7AE /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
+		4B35C4C60D4731D1000DE7AE /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
+		4B35C4C80D4731D1000DE7AE /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
+		4B35C4C90D4731D1000DE7AE /* JackGraphManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */; };
+		4B35C4CA0D4731D1000DE7AE /* JackPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */; };
+		4B35C4CB0D4731D1000DE7AE /* JackClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E50834EF6700C94B91 /* JackClient.cpp */; };
+		4B35C4CC0D4731D1000DE7AE /* JackAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */; };
+		4B35C4CD0D4731D1000DE7AE /* JackConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */; };
+		4B35C4CE0D4731D1000DE7AE /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
+		4B35C4D00D4731D1000DE7AE /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4B35C4D10D4731D1000DE7AE /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4B35C4D50D4731D1000DE7AE /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
+		4B35C4D70D4731D1000DE7AE /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
+		4B35C4D80D4731D1000DE7AE /* JackAudioDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D22A0834F07D00C94B91 /* JackAudioDriver.cpp */; };
+		4B35C4D90D4731D1000DE7AE /* JackFreewheelDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1BA0834EEF100C94B91 /* JackFreewheelDriver.cpp */; };
+		4B35C4DA0D4731D1000DE7AE /* JackThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1BE0834EEFC00C94B91 /* JackThreadedDriver.cpp */; };
+		4B35C4DB0D4731D1000DE7AE /* JackDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1B60834EEE400C94B91 /* JackDriver.cpp */; };
+		4B35C4DC0D4731D1000DE7AE /* JackDriverLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */; };
+		4B35C4DD0D4731D1000DE7AE /* JackEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2140834F02800C94B91 /* JackEngine.cpp */; };
+		4B35C4DE0D4731D1000DE7AE /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; };
+		4B35C4DF0D4731D1000DE7AE /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; };
+		4B35C4E00D4731D1000DE7AE /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; };
+		4B35C4E20D4731D1000DE7AE /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; };
+		4B35C4E60D4731D1000DE7AE /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; };
+		4B35C4E70D4731D1000DE7AE /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; };
+		4B35C4E80D4731D1000DE7AE /* JackMachServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */; };
+		4B35C4E90D4731D1000DE7AE /* JackMachServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */; };
+		4B35C4EB0D4731D1000DE7AE /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
+		4B35C4EC0D4731D1000DE7AE /* JackServerAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */; };
+		4B35C4ED0D4731D1000DE7AE /* JackServerGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */; };
+		4B35C4EE0D4731D1000DE7AE /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
+		4B35C4EF0D4731D1000DE7AE /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; };
+		4B35C4F00D4731D1000DE7AE /* JackAudioPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */; };
+		4B35C4F10D4731D1000DE7AE /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
+		4B35C4F20D4731D1000DE7AE /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
+		4B35C4F30D4731D1000DE7AE /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
+		4B35C4F40D4731D1000DE7AE /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
+		4B35C4F50D4731D1000DE7AE /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
+		4B35C50D0D4731D1000DE7AE /* midiseq.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A1BBD0CD1CC110005BF74 /* midiseq.c */; };
+		4B35C5190D4731D1000DE7AE /* midisine.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A1BDC0CD1CD420005BF74 /* midisine.c */; };
+		4B35C5250D4731D1000DE7AE /* metro.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D16B0834EDF000C94B91 /* metro.c */; };
+		4B35C5310D4731D1000DE7AE /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1690834EDE600C94B91 /* lsp.c */; };
+		4B35C53D0D4731D1000DE7AE /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B60CE480AAABA31004956AA /* connect.c */; };
+		4B35C5490D4731D1000DE7AE /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B60CE480AAABA31004956AA /* connect.c */; };
+		4B35C5570D4731D2000DE7AE /* freewheel.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1710834EE0F00C94B91 /* freewheel.c */; };
+		4B35C5630D4731D2000DE7AE /* jdelay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFA99A90AAAF40C009E916C /* jdelay.cpp */; };
+		4B35C57D0D4731D2000DE7AE /* testAtomic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D23E0834F1C300C94B91 /* testAtomic.cpp */; };
+		4B35C58D0D4731D2000DE7AE /* testSem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2470834F20600C94B91 /* testSem.cpp */; };
+		4B35C59F0D4731D2000DE7AE /* zombie.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1670834EDD900C94B91 /* zombie.c */; };
+		4B35C5AB0D4731D2000DE7AE /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* test.cpp */; };
+		4B35C5B70D4731D2000DE7AE /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F49070AD8503300491C6E /* cpu.c */; };
+		4B35C5C30D4731D2000DE7AE /* ipload.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA692B20CBE4C2D00EAD520 /* ipload.c */; };
+		4B35C5CF0D4731D2000DE7AE /* ipunload.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA692D60CBE4CC600EAD520 /* ipunload.c */; };
+		4B35C5DA0D4731D2000DE7AE /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4B35C5DB0D4731D2000DE7AE /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4B35C5DD0D4731D2000DE7AE /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4B35C5E00D4731D2000DE7AE /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4B35C5E20D4731D2000DE7AE /* testSynchroServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */; };
+		4B35C5F60D4731D2000DE7AE /* testSynchroClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */; };
+		4B35C60A0D4731D2000DE7AE /* testSynchroServerClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */; };
+		4B35C62C0D4731D2000DE7AE /* JackDummyDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3988A08B3CF6C00B6F371 /* JackDummyDriver.h */; };
+		4B35C62E0D4731D2000DE7AE /* JackDummyDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3988908B3CF6C00B6F371 /* JackDummyDriver.cpp */; };
+		4B35C6380D4731D3000DE7AE /* inprocess.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD6240C0CBCF16600DE782F /* inprocess.c */; };
+		4B363DDF0DEB034E001F72D9 /* alias.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363DDE0DEB034E001F72D9 /* alias.c */; };
+		4B363E210DEB0401001F72D9 /* evmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363E200DEB0401001F72D9 /* evmon.c */; };
+		4B363E720DEB0808001F72D9 /* bufsize.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363E710DEB0808001F72D9 /* bufsize.c */; };
+		4B363EEE0DEB094B001F72D9 /* capture_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363EED0DEB094B001F72D9 /* capture_client.c */; };
+		4B363F230DEB0AB0001F72D9 /* monitor_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F220DEB0AB0001F72D9 /* monitor_client.c */; };
+		4B363F3E0DEB0C31001F72D9 /* showtime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F3D0DEB0C31001F72D9 /* showtime.c */; };
+		4B363F760DEB0D7D001F72D9 /* impulse_grabber.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F750DEB0D7D001F72D9 /* impulse_grabber.c */; };
+		4B3F49080AD8503300491C6E /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F49070AD8503300491C6E /* cpu.c */; };
+		4B43A8CA1014605000E52943 /* JackLoopbackDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B43A8C81014605000E52943 /* JackLoopbackDriver.cpp */; };
+		4B43A8CB1014605000E52943 /* JackLoopbackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B43A8C91014605000E52943 /* JackLoopbackDriver.h */; };
+		4B43A8DF1014615800E52943 /* JackLoopbackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B43A8C91014605000E52943 /* JackLoopbackDriver.h */; };
+		4B43A8E11014615800E52943 /* JackLoopbackDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B43A8C81014605000E52943 /* JackLoopbackDriver.cpp */; };
+		4B47AC8210B5890100469C67 /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
+		4B47AC8310B5890100469C67 /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4B47AC8410B5890100469C67 /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
+		4B47AC8510B5890100469C67 /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
+		4B47AC8610B5890100469C67 /* shm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D18F0834EE8400C94B91 /* shm.h */; };
+		4B47AC8710B5890100469C67 /* JackThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D19F0834EE9E00C94B91 /* JackThread.h */; };
+		4B47AC8810B5890100469C67 /* JackActivationCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */; };
+		4B47AC8910B5890100469C67 /* JackChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */; };
+		4B47AC8A10B5890100469C67 /* JackGraphManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */; };
+		4B47AC8B10B5890100469C67 /* JackPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1CF0834EF2F00C94B91 /* JackPort.h */; };
+		4B47AC8C10B5890100469C67 /* JackClientInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */; };
+		4B47AC8D10B5890100469C67 /* JackClientControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */; };
+		4B47AC8E10B5890100469C67 /* JackClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1E10834EF5500C94B91 /* JackClient.h */; };
+		4B47AC8F10B5890100469C67 /* JackInternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */; };
+		4B47AC9010B5890100469C67 /* JackLibGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1FB0834EFD100C94B91 /* JackLibGlobals.h */; };
+		4B47AC9110B5890100469C67 /* JackLibClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1FC0834EFD100C94B91 /* JackLibClient.h */; };
+		4B47AC9210B5890100469C67 /* JackConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */; };
+		4B47AC9310B5890100469C67 /* JackFrameTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */; };
+		4B47AC9410B5890100469C67 /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
+		4B47AC9510B5890100469C67 /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
+		4B47AC9610B5890100469C67 /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
+		4B47AC9710B5890100469C67 /* JackMachClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298708AF450200D450D4 /* JackMachClientChannel.h */; };
+		4B47AC9810B5890100469C67 /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
+		4B47AC9910B5890100469C67 /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
+		4B47AC9A10B5890100469C67 /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4B47AC9B10B5890100469C67 /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
+		4B47AC9C10B5890100469C67 /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF520580CB8D1010037470E /* timestamps.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47AC9D10B5890100469C67 /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C73790CC60A6D001AFFD4 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47AC9E10B5890100469C67 /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737A0CC60A6D001AFFD4 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47AC9F10B5890100469C67 /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA010B5890100469C67 /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737C0CC60A6D001AFFD4 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA110B5890100469C67 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737D0CC60A6D001AFFD4 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA210B5890100469C67 /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737E0CC60A6D001AFFD4 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA310B5890100469C67 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737F0CC60A6D001AFFD4 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA410B5890100469C67 /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; };
+		4B47ACA510B5890100469C67 /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
+		4B47ACA610B5890100469C67 /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA710B5890100469C67 /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
+		4B47ACA810B5890100469C67 /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B47ACA910B5890100469C67 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4B47ACAA10B5890100469C67 /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
+		4B47ACAB10B5890100469C67 /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
+		4B47ACAE10B5890100469C67 /* JackMacLibClientRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */; };
+		4B47ACAF10B5890100469C67 /* JackRPCEngineUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B769076B74D200D170DE /* JackRPCEngineUser.c */; };
+		4B47ACB010B5890100469C67 /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
+		4B47ACB110B5890100469C67 /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
+		4B47ACB210B5890100469C67 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
+		4B47ACB310B5890100469C67 /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
+		4B47ACB410B5890100469C67 /* JackGraphManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */; };
+		4B47ACB510B5890100469C67 /* JackPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */; };
+		4B47ACB610B5890100469C67 /* JackClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E50834EF6700C94B91 /* JackClient.cpp */; };
+		4B47ACB710B5890100469C67 /* JackAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */; };
+		4B47ACB810B5890100469C67 /* JackLibClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1FD0834EFD100C94B91 /* JackLibClient.cpp */; };
+		4B47ACB910B5890100469C67 /* JackLibAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1FE0834EFD100C94B91 /* JackLibAPI.cpp */; };
+		4B47ACBA10B5890100469C67 /* JackConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */; };
+		4B47ACBB10B5890100469C67 /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
+		4B47ACBC10B5890100469C67 /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4B47ACBD10B5890100469C67 /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4B47ACBE10B5890100469C67 /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; };
+		4B47ACBF10B5890100469C67 /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
+		4B47ACC010B5890100469C67 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
+		4B47ACC110B5890100469C67 /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
+		4B47ACC210B5890100469C67 /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
+		4B47ACC310B5890100469C67 /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
+		4B47ACC410B5890100469C67 /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; };
+		4B47ACC510B5890100469C67 /* JackAudioPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */; };
+		4B47ACC610B5890100469C67 /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
+		4B47ACC710B5890100469C67 /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
+		4B47ACC810B5890100469C67 /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
+		4B47ACC910B5890100469C67 /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
+		4B47ACCA10B5890100469C67 /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4B47ACCB10B5890100469C67 /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4B47ACCC10B5890100469C67 /* JackPosixServerLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */; };
+		4B47ACCD10B5890100469C67 /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
+		4B47ACCE10B5890100469C67 /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4B47ACCF10B5890100469C67 /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; };
+		4B47ACD210B5890100469C67 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BCC87950D57168300A7FEB1 /* Accelerate.framework */; };
+		4B4CA9750E02CF9600F4BFDA /* JackRestartThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */; };
+		4B4CA9760E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4CA9740E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp */; };
+		4B4CA9770E02CF9600F4BFDA /* JackRestartThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */; };
+		4B4CA9780E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4CA9740E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp */; };
+		4B4E9AFA0E5F1090000A3278 /* JackControlAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4E9AF80E5F1090000A3278 /* JackControlAPI.cpp */; };
+		4B4E9AFB0E5F1090000A3278 /* JackControlAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4E9AF90E5F1090000A3278 /* JackControlAPI.h */; };
+		4B4E9AFC0E5F1090000A3278 /* JackControlAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4E9AF80E5F1090000A3278 /* JackControlAPI.cpp */; };
+		4B4E9AFD0E5F1090000A3278 /* JackControlAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4E9AF90E5F1090000A3278 /* JackControlAPI.h */; };
+		4B4F9C8C0DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4B4F9C8D0DC20C0400706CB0 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4B4F9C8E0DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4B4F9C8F0DC20C0400706CB0 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4B4F9C900DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4B4F9C910DC20C0400706CB0 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4B4F9C920DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4B4F9C930DC20C0400706CB0 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4B4F9D820DC2178E00706CB0 /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4B4F9D830DC2178F00706CB0 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4B5A1BBE0CD1CC110005BF74 /* midiseq.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A1BBD0CD1CC110005BF74 /* midiseq.c */; };
+		4B5A1BDD0CD1CD420005BF74 /* midisine.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A1BDC0CD1CD420005BF74 /* midisine.c */; };
+		4B5DB9830CD2429A00EBA5EE /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
+		4B5DB9840CD2429B00EBA5EE /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
+		4B5E08C30E5B66EE00BEE4E0 /* JackAudioAdapterInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3090E2362E700DD4A82 /* JackAudioAdapterInterface.h */; };
+		4B5E08C40E5B66EE00BEE4E0 /* JackException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30C0E2362E700DD4A82 /* JackException.h */; };
+		4B5E08C60E5B66EE00BEE4E0 /* JackLibSampleRateResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30F0E2362E700DD4A82 /* JackLibSampleRateResampler.h */; };
+		4B5E08CC0E5B66EE00BEE4E0 /* JackAudioAdapterInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */; };
+		4B5E08CD0E5B66EE00BEE4E0 /* JackLibSampleRateResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B30E0E2362E700DD4A82 /* JackLibSampleRateResampler.cpp */; };
+		4B5E08CE0E5B66EE00BEE4E0 /* JackResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3120E2362E700DD4A82 /* JackResampler.cpp */; };
+		4B5E08E10E5B676C00BEE4E0 /* JackNetAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5E08DF0E5B676C00BEE4E0 /* JackNetAdapter.cpp */; };
+		4B5E08E20E5B676D00BEE4E0 /* JackNetAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5E08E00E5B676C00BEE4E0 /* JackNetAdapter.h */; };
+		4B5E08EB0E5B67EA00BEE4E0 /* JackNetInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */; };
+		4B5E08EC0E5B67EB00BEE4E0 /* JackNetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */; };
+		4B5E08EE0E5B680200BEE4E0 /* JackAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */; };
+		4B5E08EF0E5B680200BEE4E0 /* JackAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */; };
+		4B5F253E0DEE9B8F0041E486 /* JackLockedEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5F253D0DEE9B8F0041E486 /* JackLockedEngine.h */; };
+		4B60CE490AAABA31004956AA /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B60CE480AAABA31004956AA /* connect.c */; };
+		4B60CE4A0AAABA31004956AA /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B60CE480AAABA31004956AA /* connect.c */; };
+		4B699BAA097D421600A18468 /* Jackdmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2250834F06A00C94B91 /* Jackdmp.cpp */; };
+		4B699C02097D421600A18468 /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
+		4B699C03097D421600A18468 /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4B699C04097D421600A18468 /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
+		4B699C05097D421600A18468 /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
+		4B699C06097D421600A18468 /* shm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D18F0834EE8400C94B91 /* shm.h */; };
+		4B699C08097D421600A18468 /* JackThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D19F0834EE9E00C94B91 /* JackThread.h */; };
+		4B699C09097D421600A18468 /* JackActivationCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */; };
+		4B699C0A097D421600A18468 /* JackChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */; };
+		4B699C0B097D421600A18468 /* JackGraphManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */; };
+		4B699C0C097D421600A18468 /* JackPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1CF0834EF2F00C94B91 /* JackPort.h */; };
+		4B699C0D097D421600A18468 /* JackClientInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */; };
+		4B699C0E097D421600A18468 /* JackClientControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */; };
+		4B699C0F097D421600A18468 /* JackClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1E10834EF5500C94B91 /* JackClient.h */; };
+		4B699C10097D421600A18468 /* JackInternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */; };
+		4B699C11097D421600A18468 /* JackLibGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1FB0834EFD100C94B91 /* JackLibGlobals.h */; };
+		4B699C12097D421600A18468 /* JackLibClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1FC0834EFD100C94B91 /* JackLibClient.h */; };
+		4B699C13097D421600A18468 /* JackConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */; };
+		4B699C14097D421600A18468 /* JackFrameTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */; };
+		4B699C16097D421600A18468 /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
+		4B699C17097D421600A18468 /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
+		4B699C18097D421600A18468 /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
+		4B699C19097D421600A18468 /* JackMachClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298708AF450200D450D4 /* JackMachClientChannel.h */; };
+		4B699C20097D421600A18468 /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
+		4B699C21097D421600A18468 /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
+		4B699C22097D421600A18468 /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4B699C25097D421600A18468 /* JackMacLibClientRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */; };
+		4B699C26097D421600A18468 /* JackRPCEngineUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B769076B74D200D170DE /* JackRPCEngineUser.c */; };
+		4B699C27097D421600A18468 /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
+		4B699C28097D421600A18468 /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
+		4B699C29097D421600A18468 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
+		4B699C2B097D421600A18468 /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
+		4B699C2C097D421600A18468 /* JackGraphManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */; };
+		4B699C2D097D421600A18468 /* JackPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */; };
+		4B699C2E097D421600A18468 /* JackClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E50834EF6700C94B91 /* JackClient.cpp */; };
+		4B699C2F097D421600A18468 /* JackAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */; };
+		4B699C30097D421600A18468 /* JackLibClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1FD0834EFD100C94B91 /* JackLibClient.cpp */; };
+		4B699C31097D421600A18468 /* JackLibAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1FE0834EFD100C94B91 /* JackLibAPI.cpp */; };
+		4B699C32097D421600A18468 /* JackConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */; };
+		4B699C33097D421600A18468 /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
+		4B699C35097D421600A18468 /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4B699C36097D421600A18468 /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4B699C37097D421600A18468 /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; };
+		4B699C3D097D421600A18468 /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
+		4B699C3F097D421600A18468 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
+		4B699C40097D421600A18468 /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
+		4B699C4E097D421600A18468 /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
+		4B699C4F097D421600A18468 /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4B699C50097D421600A18468 /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
+		4B699C51097D421600A18468 /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
+		4B699C52097D421600A18468 /* shm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D18F0834EE8400C94B91 /* shm.h */; };
+		4B699C54097D421600A18468 /* JackThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D19F0834EE9E00C94B91 /* JackThread.h */; };
+		4B699C55097D421600A18468 /* JackActivationCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */; };
+		4B699C56097D421600A18468 /* JackChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */; };
+		4B699C57097D421600A18468 /* JackGraphManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */; };
+		4B699C58097D421600A18468 /* JackPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1CF0834EF2F00C94B91 /* JackPort.h */; };
+		4B699C59097D421600A18468 /* JackClientInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */; };
+		4B699C5A097D421600A18468 /* JackClientControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */; };
+		4B699C5B097D421600A18468 /* JackClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1E10834EF5500C94B91 /* JackClient.h */; };
+		4B699C5C097D421600A18468 /* JackInternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */; };
+		4B699C5D097D421600A18468 /* JackConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */; };
+		4B699C5E097D421600A18468 /* JackFrameTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */; };
+		4B699C60097D421600A18468 /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
+		4B699C61097D421600A18468 /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
+		4B699C62097D421600A18468 /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
+		4B699C68097D421600A18468 /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
+		4B699C69097D421600A18468 /* JackAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2290834F07D00C94B91 /* JackAudioDriver.h */; };
+		4B699C6A097D421600A18468 /* JackFreewheelDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1B90834EEF100C94B91 /* JackFreewheelDriver.h */; };
+		4B699C6B097D421600A18468 /* JackThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1BD0834EEFC00C94B91 /* JackThreadedDriver.h */; };
+		4B699C6C097D421600A18468 /* JackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1B50834EEE400C94B91 /* JackDriver.h */; };
+		4B699C6D097D421600A18468 /* driver_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B869B3D08C8D21C001CF041 /* driver_interface.h */; };
+		4B699C6F097D421600A18468 /* JackDriverLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B869B4208C8D22F001CF041 /* JackDriverLoader.h */; };
+		4B699C71097D421600A18468 /* JackEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2130834F02800C94B91 /* JackEngine.h */; };
+		4B699C73097D421600A18468 /* JackExternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */; };
+		4B699C74097D421600A18468 /* JackServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2220834F05C00C94B91 /* JackServer.h */; };
+		4B699C77097D421600A18468 /* JackMachNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */; };
+		4B699C78097D421600A18468 /* JackMachServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */; };
+		4B699C79097D421600A18468 /* JackMachServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */; };
+		4B699C7B097D421600A18468 /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4B699C7E097D421600A18468 /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
+		4B699C7F097D421600A18468 /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
+		4B699C80097D421600A18468 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
+		4B699C82097D421600A18468 /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
+		4B699C83097D421600A18468 /* JackGraphManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */; };
+		4B699C84097D421600A18468 /* JackPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */; };
+		4B699C85097D421600A18468 /* JackClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E50834EF6700C94B91 /* JackClient.cpp */; };
+		4B699C86097D421600A18468 /* JackAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */; };
+		4B699C87097D421600A18468 /* JackConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */; };
+		4B699C88097D421600A18468 /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
+		4B699C8A097D421600A18468 /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4B699C8B097D421600A18468 /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4B699C8F097D421600A18468 /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
+		4B699C91097D421600A18468 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
+		4B699C92097D421600A18468 /* JackAudioDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D22A0834F07D00C94B91 /* JackAudioDriver.cpp */; };
+		4B699C93097D421600A18468 /* JackFreewheelDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1BA0834EEF100C94B91 /* JackFreewheelDriver.cpp */; };
+		4B699C94097D421600A18468 /* JackThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1BE0834EEFC00C94B91 /* JackThreadedDriver.cpp */; };
+		4B699C95097D421600A18468 /* JackDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1B60834EEE400C94B91 /* JackDriver.cpp */; };
+		4B699C96097D421600A18468 /* JackDriverLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */; };
+		4B699C97097D421600A18468 /* JackEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2140834F02800C94B91 /* JackEngine.cpp */; };
+		4B699C99097D421600A18468 /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; };
+		4B699C9A097D421600A18468 /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; };
+		4B699C9B097D421600A18468 /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; };
+		4B699C9D097D421600A18468 /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; };
+		4B699CA1097D421600A18468 /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; };
+		4B699CA2097D421600A18468 /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; };
+		4B699CA3097D421600A18468 /* JackMachServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */; };
+		4B699CA4097D421600A18468 /* JackMachServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */; };
+		4B699CB4097D421600A18468 /* metro.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D16B0834EDF000C94B91 /* metro.c */; };
+		4B699CC4097D421600A18468 /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1690834EDE600C94B91 /* lsp.c */; };
+		4B699CF6097D421600A18468 /* freewheel.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1710834EE0F00C94B91 /* freewheel.c */; };
+		4B699D18097D421600A18468 /* testAtomic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D23E0834F1C300C94B91 /* testAtomic.cpp */; };
+		4B699D2C097D421600A18468 /* testSem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2470834F20600C94B91 /* testSem.cpp */; };
+		4B699D42097D421600A18468 /* zombie.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1670834EDD900C94B91 /* zombie.c */; };
+		4B699D59097D421600A18468 /* testSynchroServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */; };
+		4B699D71097D421600A18468 /* testSynchroClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */; };
+		4B699D89097D421700A18468 /* testSynchroServerClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */; };
+		4B699DA8097D421700A18468 /* JackDummyDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3988A08B3CF6C00B6F371 /* JackDummyDriver.h */; };
+		4B699DAA097D421700A18468 /* JackDummyDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3988908B3CF6C00B6F371 /* JackDummyDriver.cpp */; };
+		4B6B9EF60CD095930051EE5A /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6B9EF70CD095970051EE5A /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73800CC60A7F001AFFD4 /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C73790CC60A6D001AFFD4 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73810CC60A7F001AFFD4 /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737A0CC60A6D001AFFD4 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73820CC60A7F001AFFD4 /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73830CC60A80001AFFD4 /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737C0CC60A6D001AFFD4 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73840CC60A80001AFFD4 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737D0CC60A6D001AFFD4 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73850CC60A81001AFFD4 /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737E0CC60A6D001AFFD4 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73860CC60A83001AFFD4 /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737A0CC60A6D001AFFD4 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73870CC60A84001AFFD4 /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C73790CC60A6D001AFFD4 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73880CC60A84001AFFD4 /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C73890CC60A85001AFFD4 /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737C0CC60A6D001AFFD4 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C738A0CC60A85001AFFD4 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737D0CC60A6D001AFFD4 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6C738B0CC60A86001AFFD4 /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737E0CC60A6D001AFFD4 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B6F7AEE0CD0CDBD00F48A9D /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
+		4B76C76A0E5AB2DB00E2AC21 /* JackNetInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */; };
+		4B76C76B0E5AB2DB00E2AC21 /* JackNetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */; };
+		4B76C76C0E5AB2DB00E2AC21 /* JackNetInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */; };
+		4B76C76D0E5AB2DB00E2AC21 /* JackNetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */; };
+		4B80D7E80BA0D17400F035BB /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
+		4B80D7E90BA0D17400F035BB /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
+		4B80D7EA0BA0D17400F035BB /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
+		4B80D7EB0BA0D17400F035BB /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
+		4B80D7EC0BA0D17400F035BB /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
+		4B80D7ED0BA0D17400F035BB /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
+		4B93F1990E87992100E4ECCD /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
+		4B93F19A0E87992200E4ECCD /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
+		4B93F19C0E87998200E4ECCD /* JackPosixServerLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */; };
+		4B93F19D0E87998400E4ECCD /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
+		4B93F19E0E87998400E4ECCD /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
+		4B93F1C00E87A35400E4ECCD /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4B93F22B0E87A72500E4ECCD /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4B94334A10A5E666002A187F /* systemdeps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B94334910A5E666002A187F /* systemdeps.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B94334B10A5E666002A187F /* systemdeps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B94334910A5E666002A187F /* systemdeps.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B95BCAE0D913073000F7695 /* control.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B95BCAD0D913073000F7695 /* control.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B9A25B50DBF8330006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4B9A25B60DBF8330006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4B9A26010DBF8584006E9FBC /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B9A26020DBF8584006E9FBC /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B9A26040DBF8584006E9FBC /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (); }; };
+		4B9A26050DBF8584006E9FBC /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B9A26060DBF8584006E9FBC /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4B9A26610DBF8ADD006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4B9A26640DBF8B14006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4B9A26790DBF8B88006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4BA3393510B2E36800190E3B /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
+		4BA3393610B2E36800190E3B /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
+		4BA3393710B2E36800190E3B /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
+		4BA3393810B2E36800190E3B /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
+		4BA3393910B2E36800190E3B /* shm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D18F0834EE8400C94B91 /* shm.h */; };
+		4BA3393A10B2E36800190E3B /* JackThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D19F0834EE9E00C94B91 /* JackThread.h */; };
+		4BA3393B10B2E36800190E3B /* JackActivationCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */; };
+		4BA3393C10B2E36800190E3B /* JackChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */; };
+		4BA3393D10B2E36800190E3B /* JackGraphManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */; };
+		4BA3393E10B2E36800190E3B /* JackPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1CF0834EF2F00C94B91 /* JackPort.h */; };
+		4BA3393F10B2E36800190E3B /* JackClientInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */; };
+		4BA3394010B2E36800190E3B /* JackClientControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */; };
+		4BA3394110B2E36800190E3B /* JackClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1E10834EF5500C94B91 /* JackClient.h */; };
+		4BA3394210B2E36800190E3B /* JackInternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */; };
+		4BA3394310B2E36800190E3B /* JackConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */; };
+		4BA3394410B2E36800190E3B /* JackFrameTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */; };
+		4BA3394510B2E36800190E3B /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
+		4BA3394610B2E36800190E3B /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
+		4BA3394710B2E36800190E3B /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
+		4BA3394810B2E36800190E3B /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
+		4BA3394910B2E36800190E3B /* JackAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2290834F07D00C94B91 /* JackAudioDriver.h */; };
+		4BA3394A10B2E36800190E3B /* JackFreewheelDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1B90834EEF100C94B91 /* JackFreewheelDriver.h */; };
+		4BA3394B10B2E36800190E3B /* JackThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1BD0834EEFC00C94B91 /* JackThreadedDriver.h */; };
+		4BA3394C10B2E36800190E3B /* JackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1B50834EEE400C94B91 /* JackDriver.h */; };
+		4BA3394D10B2E36800190E3B /* driver_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B869B3D08C8D21C001CF041 /* driver_interface.h */; };
+		4BA3394E10B2E36800190E3B /* JackDriverLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B869B4208C8D22F001CF041 /* JackDriverLoader.h */; };
+		4BA3394F10B2E36800190E3B /* JackEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2130834F02800C94B91 /* JackEngine.h */; };
+		4BA3395010B2E36800190E3B /* JackExternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */; };
+		4BA3395110B2E36800190E3B /* JackServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2220834F05C00C94B91 /* JackServer.h */; };
+		4BA3395210B2E36800190E3B /* JackMachNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */; };
+		4BA3395310B2E36800190E3B /* JackMachServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */; };
+		4BA3395410B2E36800190E3B /* JackMachServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */; };
+		4BA3395510B2E36800190E3B /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
+		4BA3395610B2E36800190E3B /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
+		4BA3395710B2E36800190E3B /* JackServerGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */; };
+		4BA3395810B2E36800190E3B /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF520580CB8D1010037470E /* timestamps.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395910B2E36800190E3B /* jack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737A0CC60A6D001AFFD4 /* jack.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395A10B2E36800190E3B /* intclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C73790CC60A6D001AFFD4 /* intclient.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395B10B2E36800190E3B /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395C10B2E36800190E3B /* statistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737C0CC60A6D001AFFD4 /* statistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395D10B2E36800190E3B /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737D0CC60A6D001AFFD4 /* thread.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395E10B2E36800190E3B /* transport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737E0CC60A6D001AFFD4 /* transport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3395F10B2E36800190E3B /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737F0CC60A6D001AFFD4 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3396010B2E36800190E3B /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; };
+		4BA3396110B2E36800190E3B /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
+		4BA3396210B2E36800190E3B /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3396310B2E36800190E3B /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
+		4BA3396410B2E36800190E3B /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
+		4BA3396510B2E36800190E3B /* JackNetTool.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222AD70DC88268001A17F4 /* JackNetTool.h */; };
+		4BA3396610B2E36800190E3B /* jslist.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9A26000DBF8584006E9FBC /* jslist.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BA3396710B2E36800190E3B /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
+		4BA3396810B2E36800190E3B /* JackRestartThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */; };
+		4BA3396910B2E36800190E3B /* JackControlAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4E9AF90E5F1090000A3278 /* JackControlAPI.h */; };
+		4BA3396A10B2E36800190E3B /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
+		4BA3396B10B2E36800190E3B /* JackEngineProfiling.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBAE40E0F42FA6100B8BD3F /* JackEngineProfiling.h */; };
+		4BA3396C10B2E36800190E3B /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
+		4BA3396D10B2E36800190E3B /* JackMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339200F8B873E0080FB5B /* JackMidiDriver.h */; };
+		4BA3396E10B2E36800190E3B /* JackWaitThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBC93B90DF9736C002DF220 /* JackWaitThreadedDriver.h */; };
+		4BA3396F10B2E36800190E3B /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; };
+		4BA3397210B2E36800190E3B /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
+		4BA3397310B2E36800190E3B /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
+		4BA3397410B2E36800190E3B /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
+		4BA3397510B2E36800190E3B /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
+		4BA3397610B2E36800190E3B /* JackGraphManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */; };
+		4BA3397710B2E36800190E3B /* JackPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */; };
+		4BA3397810B2E36800190E3B /* JackClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E50834EF6700C94B91 /* JackClient.cpp */; };
+		4BA3397910B2E36800190E3B /* JackAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */; };
+		4BA3397A10B2E36800190E3B /* JackConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */; };
+		4BA3397B10B2E36800190E3B /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
+		4BA3397C10B2E36800190E3B /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
+		4BA3397D10B2E36800190E3B /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
+		4BA3397E10B2E36800190E3B /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
+		4BA3397F10B2E36800190E3B /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
+		4BA3398010B2E36800190E3B /* JackAudioDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D22A0834F07D00C94B91 /* JackAudioDriver.cpp */; };
+		4BA3398110B2E36800190E3B /* JackFreewheelDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1BA0834EEF100C94B91 /* JackFreewheelDriver.cpp */; };
+		4BA3398210B2E36800190E3B /* JackThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1BE0834EEFC00C94B91 /* JackThreadedDriver.cpp */; };
+		4BA3398310B2E36800190E3B /* JackDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1B60834EEE400C94B91 /* JackDriver.cpp */; };
+		4BA3398410B2E36800190E3B /* JackDriverLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */; };
+		4BA3398510B2E36800190E3B /* JackEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2140834F02800C94B91 /* JackEngine.cpp */; };
+		4BA3398610B2E36800190E3B /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; };
+		4BA3398710B2E36800190E3B /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; };
+		4BA3398810B2E36800190E3B /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; };
+		4BA3398910B2E36800190E3B /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; };
+		4BA3398A10B2E36800190E3B /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; };
+		4BA3398B10B2E36800190E3B /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; };
+		4BA3398C10B2E36800190E3B /* JackMachServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */; };
+		4BA3398D10B2E36800190E3B /* JackMachServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */; };
+		4BA3398E10B2E36800190E3B /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
+		4BA3398F10B2E36800190E3B /* JackServerAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */; };
+		4BA3399010B2E36800190E3B /* JackServerGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */; };
+		4BA3399110B2E36800190E3B /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
+		4BA3399210B2E36800190E3B /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; };
+		4BA3399310B2E36800190E3B /* JackAudioPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */; };
+		4BA3399410B2E36800190E3B /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
+		4BA3399510B2E36800190E3B /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
+		4BA3399610B2E36800190E3B /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
+		4BA3399710B2E36800190E3B /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
+		4BA3399810B2E36800190E3B /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
+		4BA3399910B2E36800190E3B /* JackNetTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222AD60DC88268001A17F4 /* JackNetTool.cpp */; };
+		4BA3399A10B2E36800190E3B /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
+		4BA3399B10B2E36800190E3B /* JackMessageBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */; };
+		4BA3399C10B2E36800190E3B /* JackRestartThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4CA9740E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp */; };
+		4BA3399D10B2E36800190E3B /* JackControlAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4E9AF80E5F1090000A3278 /* JackControlAPI.cpp */; };
+		4BA3399E10B2E36800190E3B /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
+		4BA3399F10B2E36800190E3B /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4BA339A010B2E36800190E3B /* JackEngineProfiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBAE40F0F42FA6100B8BD3F /* JackEngineProfiling.cpp */; };
+		4BA339A110B2E36800190E3B /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; };
+		4BA339A210B2E36800190E3B /* JackMidiDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3391F0F8B873E0080FB5B /* JackMidiDriver.cpp */; };
+		4BA339A310B2E36800190E3B /* JackWaitThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBC93B80DF9736C002DF220 /* JackWaitThreadedDriver.cpp */; };
+		4BA339A410B2E36800190E3B /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; };
+		4BA339A710B2E36800190E3B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BCC87950D57168300A7FEB1 /* Accelerate.framework */; };
+		4BA4ADB40E87AB2500F26C85 /* JackCoreAudioDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5FECB0E725C090020B576 /* JackCoreAudioDriver.cpp */; };
+		4BA4ADB50E87AB2600F26C85 /* JackCoreAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FECC0E725C090020B576 /* JackCoreAudioDriver.h */; };
+		4BA692B30CBE4C2D00EAD520 /* ipload.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA692B20CBE4C2D00EAD520 /* ipload.c */; };
+		4BA692D70CBE4CC600EAD520 /* ipunload.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA692D60CBE4CC600EAD520 /* ipunload.c */; };
+		4BA7BE0F0DC232A400AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; };
+		4BA7BE1A0DC2347500AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; };
+		4BA7BE200DC234FB00AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; };
+		4BA7BE240DC2350D00AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; };
+		4BA7BE270DC2352A00AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; };
+		4BA7FECA0D8E76650017FF73 /* control.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA7FEC80D8E76650017FF73 /* control.c */; };
+		4BAB95B80B9E20B800A0C723 /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; };
+		4BAB95B90B9E20B800A0C723 /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; };
+		4BAB95BA0B9E20B800A0C723 /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; };
+		4BAB95BB0B9E20B800A0C723 /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; };
+		4BAB95ED0B9E21A500A0C723 /* JackAudioPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */; };
+		4BAB95EE0B9E21A500A0C723 /* JackAudioPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */; };
+		4BB9D4B30E2610B300351653 /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
+		4BB9D4B40E2610B400351653 /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
+		4BB9D4E40E26112900351653 /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
+		4BBAE4100F42FA6100B8BD3F /* JackEngineProfiling.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBAE40E0F42FA6100B8BD3F /* JackEngineProfiling.h */; };
+		4BBAE4110F42FA6100B8BD3F /* JackEngineProfiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBAE40F0F42FA6100B8BD3F /* JackEngineProfiling.cpp */; };
+		4BBAE4120F42FA6100B8BD3F /* JackEngineProfiling.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBAE40E0F42FA6100B8BD3F /* JackEngineProfiling.h */; };
+		4BBAE4130F42FA6100B8BD3F /* JackEngineProfiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBAE40F0F42FA6100B8BD3F /* JackEngineProfiling.cpp */; };
+		4BBB00D30E72614F0018AB1B /* JackPortAudioDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB00CF0E72614F0018AB1B /* JackPortAudioDevices.cpp */; };
+		4BBB00D40E72614F0018AB1B /* JackPortAudioDevices.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB00D00E72614F0018AB1B /* JackPortAudioDevices.h */; };
+		4BBB00D50E72614F0018AB1B /* JackPortAudioDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB00D10E72614F0018AB1B /* JackPortAudioDriver.cpp */; };
+		4BBB00D60E72614F0018AB1B /* JackPortAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBB00D20E72614F0018AB1B /* JackPortAudioDriver.h */; };
+		4BBC93BA0DF9736C002DF220 /* JackWaitThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBC93B80DF9736C002DF220 /* JackWaitThreadedDriver.cpp */; };
+		4BBC93BB0DF9736C002DF220 /* JackWaitThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBC93B90DF9736C002DF220 /* JackWaitThreadedDriver.h */; };
+		4BC216850A444BAD00BDA09F /* JackServerAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */; };
+		4BC216890A444BDE00BDA09F /* JackServerGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */; };
+		4BC2168E0A444BED00BDA09F /* JackServerGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */; };
+		4BC3B6A40E703B2E0066E42F /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
+		4BC3B6A50E703B2E0066E42F /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
+		4BC3B6A60E703B2E0066E42F /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
+		4BC3B6A70E703B2E0066E42F /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
+		4BC3B6BB0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; };
+		4BC3B6BC0E703BCC0066E42F /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; };
+		4BC3B6BD0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; };
+		4BC3B6BE0E703BCC0066E42F /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; };
+		4BC3B6BF0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; };
+		4BC3B6C00E703BCC0066E42F /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; };
+		4BCBCE5D10C4FE3F00450FFE /* JackPhysicalMidiInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCBCE5910C4FE3F00450FFE /* JackPhysicalMidiInput.cpp */; };
+		4BCBCE5E10C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCBCE5A10C4FE3F00450FFE /* JackPhysicalMidiInput.h */; };
+		4BCBCE5F10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCBCE5B10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp */; };
+		4BCBCE6010C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCBCE5C10C4FE3F00450FFE /* JackPhysicalMidiOutput.h */; };
+		4BCBCE6110C4FE3F00450FFE /* JackPhysicalMidiInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCBCE5910C4FE3F00450FFE /* JackPhysicalMidiInput.cpp */; };
+		4BCBCE6210C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCBCE5A10C4FE3F00450FFE /* JackPhysicalMidiInput.h */; };
+		4BCBCE6310C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCBCE5B10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp */; };
+		4BCBCE6410C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCBCE5C10C4FE3F00450FFE /* JackPhysicalMidiOutput.h */; };
+		4BCBCE6510C4FE3F00450FFE /* JackPhysicalMidiInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCBCE5910C4FE3F00450FFE /* JackPhysicalMidiInput.cpp */; };
+		4BCBCE6610C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCBCE5A10C4FE3F00450FFE /* JackPhysicalMidiInput.h */; };
+		4BCBCE6710C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCBCE5B10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp */; };
+		4BCBCE6810C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCBCE5C10C4FE3F00450FFE /* JackPhysicalMidiOutput.h */; };
+		4BCC87960D57168300A7FEB1 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BCC87950D57168300A7FEB1 /* Accelerate.framework */; };
+		4BCC87970D57168300A7FEB1 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BCC87950D57168300A7FEB1 /* Accelerate.framework */; };
+		4BCC87980D57168300A7FEB1 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BCC87950D57168300A7FEB1 /* Accelerate.framework */; };
+		4BCC87990D57168300A7FEB1 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BCC87950D57168300A7FEB1 /* Accelerate.framework */; };
+		4BD4B4D809BACD9600750C0F /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
+		4BD4B4D909BACD9600750C0F /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
+		4BD6240D0CBCF16600DE782F /* inprocess.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD6240C0CBCF16600DE782F /* inprocess.c */; };
+		4BDCDB951001FB9C00B15929 /* JackCoreMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339140F8B86DC0080FB5B /* JackCoreMidiDriver.h */; };
+		4BDCDB971001FB9C00B15929 /* JackCoreMidiDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF339150F8B86DC0080FB5B /* JackCoreMidiDriver.cpp */; };
+		4BDCDBB91001FCC000B15929 /* JackNetDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222ADD0DC882A5001A17F4 /* JackNetDriver.h */; };
+		4BDCDBBA1001FCC000B15929 /* JackNetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */; };
+		4BDCDBBB1001FCC000B15929 /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; };
+		4BDCDBBD1001FCC000B15929 /* JackNetDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222ADC0DC882A5001A17F4 /* JackNetDriver.cpp */; };
+		4BDCDBBE1001FCC000B15929 /* JackNetInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */; };
+		4BDCDBBF1001FCC000B15929 /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; };
+		4BDCDBD11001FD0100B15929 /* JackWaitThreadedDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBC93B80DF9736C002DF220 /* JackWaitThreadedDriver.cpp */; };
+		4BDCDBD21001FD0200B15929 /* JackWaitThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBC93B90DF9736C002DF220 /* JackWaitThreadedDriver.h */; };
+		4BDCDBD91001FD2D00B15929 /* JackNetManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222AEC0DC883B3001A17F4 /* JackNetManager.h */; };
+		4BDCDBDA1001FD2D00B15929 /* JackNetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */; };
+		4BDCDBDB1001FD2D00B15929 /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; };
+		4BDCDBDC1001FD2D00B15929 /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; };
+		4BDCDBDE1001FD2D00B15929 /* JackNetManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222AEB0DC883B3001A17F4 /* JackNetManager.cpp */; };
+		4BDCDBDF1001FD2D00B15929 /* JackNetInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */; };
+		4BDCDBE01001FD2D00B15929 /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; };
+		4BDCDBE11001FD2D00B15929 /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4BDCDBE21001FD2D00B15929 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; };
+		4BDCDBEE1001FD7300B15929 /* JackAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */; };
+		4BDCDBEF1001FD7300B15929 /* JackAudioAdapterInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3090E2362E700DD4A82 /* JackAudioAdapterInterface.h */; };
+		4BDCDBF01001FD7300B15929 /* JackException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30C0E2362E700DD4A82 /* JackException.h */; };
+		4BDCDBF11001FD7300B15929 /* JackLibSampleRateResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30F0E2362E700DD4A82 /* JackLibSampleRateResampler.h */; };
+		4BDCDBF21001FD7300B15929 /* JackCoreAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */; };
+		4BDCDBF41001FD7300B15929 /* JackAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */; };
+		4BDCDBF51001FD7300B15929 /* JackAudioAdapterInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */; };
+		4BDCDBF61001FD7300B15929 /* JackLibSampleRateResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B30E0E2362E700DD4A82 /* JackLibSampleRateResampler.cpp */; };
+		4BDCDBF71001FD7300B15929 /* JackResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3120E2362E700DD4A82 /* JackResampler.cpp */; };
+		4BDCDBF81001FD7300B15929 /* JackAudioAdapterFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */; };
+		4BDCDBF91001FD7300B15929 /* JackCoreAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */; };
+		4BDCDC091001FDA800B15929 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; };
+		4BDCDC0A1001FDA800B15929 /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; };
+		4BDCDC111001FDE300B15929 /* JackAudioAdapterInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3090E2362E700DD4A82 /* JackAudioAdapterInterface.h */; };
+		4BDCDC121001FDE300B15929 /* JackException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30C0E2362E700DD4A82 /* JackException.h */; };
+		4BDCDC131001FDE300B15929 /* JackLibSampleRateResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B30F0E2362E700DD4A82 /* JackLibSampleRateResampler.h */; };
+		4BDCDC141001FDE300B15929 /* JackNetAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5E08E00E5B676C00BEE4E0 /* JackNetAdapter.h */; };
+		4BDCDC151001FDE300B15929 /* JackNetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */; };
+		4BDCDC161001FDE300B15929 /* JackAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */; };
+		4BDCDC171001FDE300B15929 /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; };
+		4BDCDC191001FDE300B15929 /* JackAudioAdapterInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */; };
+		4BDCDC1A1001FDE300B15929 /* JackLibSampleRateResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B30E0E2362E700DD4A82 /* JackLibSampleRateResampler.cpp */; };
+		4BDCDC1B1001FDE300B15929 /* JackResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3120E2362E700DD4A82 /* JackResampler.cpp */; };
+		4BDCDC1C1001FDE300B15929 /* JackNetAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5E08DF0E5B676C00BEE4E0 /* JackNetAdapter.cpp */; };
+		4BDCDC1D1001FDE300B15929 /* JackNetInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */; };
+		4BDCDC1E1001FDE300B15929 /* JackAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */; };
+		4BDCDC1F1001FDE300B15929 /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; };
+		4BE3225A0CC611EF00AFA640 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737F0CC60A6D001AFFD4 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BE3225B0CC611F500AFA640 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6C737F0CC60A6D001AFFD4 /* types.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4BE4CC010CDA153400CCF5BB /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
+		4BE4CC020CDA153500CCF5BB /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
+		4BE4CC030CDA153500CCF5BB /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
+		4BE4CC040CDA153500CCF5BB /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
+		4BE5FECD0E725C090020B576 /* JackCoreAudioDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5FECB0E725C090020B576 /* JackCoreAudioDriver.cpp */; };
+		4BE5FECE0E725C090020B576 /* JackCoreAudioDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FECC0E725C090020B576 /* JackCoreAudioDriver.h */; };
+		4BE5FED10E725C320020B576 /* JackCoreAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */; };
+		4BE5FED20E725C320020B576 /* JackCoreAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */; };
+		4BE6C6AD0A3E0A65005A203A /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* test.cpp */; };
+		4BECB2F50F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; };
+		4BECB2F60F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
+		4BECB2F70F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; };
+		4BECB2F80F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
+		4BECB2F90F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; };
+		4BECB2FA0F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
+		4BECB2FB0F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; };
+		4BECB2FC0F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
+		4BF284180F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; };
+		4BF284190F31B4BC00B05BE3 /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; };
+		4BF2841A0F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; };
+		4BF2841B0F31B4BC00B05BE3 /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; };
+		4BF3391A0F8B86DC0080FB5B /* JackCoreMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339140F8B86DC0080FB5B /* JackCoreMidiDriver.h */; };
+		4BF3391B0F8B86DC0080FB5B /* JackCoreMidiDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF339150F8B86DC0080FB5B /* JackCoreMidiDriver.cpp */; };
+		4BF339210F8B873E0080FB5B /* JackMidiDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3391F0F8B873E0080FB5B /* JackMidiDriver.cpp */; };
+		4BF339220F8B873E0080FB5B /* JackMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339200F8B873E0080FB5B /* JackMidiDriver.h */; };
+		4BF339230F8B873E0080FB5B /* JackMidiDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3391F0F8B873E0080FB5B /* JackMidiDriver.cpp */; };
+		4BF339240F8B873E0080FB5B /* JackMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339200F8B873E0080FB5B /* JackMidiDriver.h */; };
+		4BF4BAB10E3480AB00403CDF /* JackAudioAdapterFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */; };
+		4BF520530CB8D0E80037470E /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
+		4BF520540CB8D0E80037470E /* timestamps.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF520520CB8D0E80037470E /* timestamps.c */; };
+		4BF520590CB8D1010037470E /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF520580CB8D1010037470E /* timestamps.h */; settings = {ATTRIBUTES = (); }; };
+		4BF5205A0CB8D1010037470E /* timestamps.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF520580CB8D1010037470E /* timestamps.h */; settings = {ATTRIBUTES = (); }; };
+		4BF5FBBC0E878B9C003D2374 /* JackPosixServerLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */; };
+		4BF5FBC90E878D24003D2374 /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4BF5FBCA0E878D24003D2374 /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4BF5FBCB0E878D24003D2374 /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; };
+		4BFA5E9F0DEC4DD900FA4CDB /* testMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */; };
+		4BFA82850DF6A9E40087B4E1 /* evmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363E200DEB0401001F72D9 /* evmon.c */; };
+		4BFA82980DF6A9E40087B4E1 /* bufsize.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363E710DEB0808001F72D9 /* bufsize.c */; };
+		4BFA82A40DF6A9E40087B4E1 /* capture_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363EED0DEB094B001F72D9 /* capture_client.c */; };
+		4BFA82B00DF6A9E40087B4E1 /* monitor_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F220DEB0AB0001F72D9 /* monitor_client.c */; };
+		4BFA82BC0DF6A9E40087B4E1 /* showtime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F3D0DEB0C31001F72D9 /* showtime.c */; };
+		4BFA82C80DF6A9E40087B4E1 /* impulse_grabber.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B363F750DEB0D7D001F72D9 /* impulse_grabber.c */; };
+		4BFA99AA0AAAF40C009E916C /* jdelay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFA99A90AAAF40C009E916C /* jdelay.cpp */; };
+		BA047C760E14E79D0041F3B6 /* JackNetSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = BA047C710E14E7540041F3B6 /* JackNetSocket.h */; };
+		BA222AD80DC88268001A17F4 /* JackNetTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222AD60DC88268001A17F4 /* JackNetTool.cpp */; };
+		BA222AD90DC88269001A17F4 /* JackNetTool.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222AD70DC88268001A17F4 /* JackNetTool.h */; };
+		BA222ADA0DC88269001A17F4 /* JackNetTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222AD60DC88268001A17F4 /* JackNetTool.cpp */; };
+		BA222ADB0DC88269001A17F4 /* JackNetTool.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222AD70DC88268001A17F4 /* JackNetTool.h */; };
+		BA222ADE0DC882A5001A17F4 /* JackNetDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222ADC0DC882A5001A17F4 /* JackNetDriver.cpp */; };
+		BA222ADF0DC882A5001A17F4 /* JackNetDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222ADD0DC882A5001A17F4 /* JackNetDriver.h */; };
+		BA222AED0DC883B3001A17F4 /* JackNetManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA222AEB0DC883B3001A17F4 /* JackNetManager.cpp */; };
+		BA222AEE0DC883B3001A17F4 /* JackNetManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BA222AEC0DC883B3001A17F4 /* JackNetManager.h */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		4B0A28F30D520D11002EFF74 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B0A28DC0D52073D002EFF74;
+			remoteInfo = jack_thread_wait;
+		};
+		4B0A292F0D5210C4002EFF74 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B0A29230D52108E002EFF74;
+			remoteInfo = "jack_thread_wait 64 bits";
+		};
+		4B19B32B0E23636E00DD4A82 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B19B2F60E23620F00DD4A82;
+			remoteInfo = audioadapter;
+		};
+		4B224B330E65BA330066BE5B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B5E08BF0E5B66EE00BEE4E0;
+			remoteInfo = netadapter;
+		};
+		4B3224E610A3157900838A8E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B3224D710A3156800838A8E;
+			remoteInfo = "jack_netone Universal";
+		};
+		4B32258A10A31A9000838A8E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B32255710A3187800838A8E;
+			remoteInfo = "jack_netsource Universal";
+		};
+		4B32258C10A31A9D00838A8E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B3224D710A3156800838A8E;
+			remoteInfo = "jack_netone Universal";
+		};
+		4B32258E10A31AB400838A8E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B32257110A3190C00838A8E;
+			remoteInfo = "jack_netsource 64 bits";
+		};
+		4B32259010A31ABA00838A8E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B32251D10A316B200838A8E;
+			remoteInfo = "jack_netone 64 bits";
+		};
+		4B35C5540D4731D2000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699D03097D421600A18468;
+			remoteInfo = "jack_external_metro Universal";
+		};
+		4B35C67D0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C41B0D4731D1000DE7AE;
+			remoteInfo = "jackdmp framework 64bits";
+		};
+		4B35C67F0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C4270D4731D1000DE7AE;
+			remoteInfo = "Jackmp.framework 64 bits";
+		};
+		4B35C6810D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C4850D4731D1000DE7AE;
+			remoteInfo = "Jackdmp.framework 64 bits";
+		};
+		4B35C6850D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C50A0D4731D1000DE7AE;
+			remoteInfo = "jack_midiseq 64 bits";
+		};
+		4B35C6870D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5160D4731D1000DE7AE;
+			remoteInfo = "jack_midisine 64 bits";
+		};
+		4B35C6890D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5220D4731D1000DE7AE;
+			remoteInfo = "jack_metro 64 bits";
+		};
+		4B35C68B0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C52E0D4731D1000DE7AE;
+			remoteInfo = "jack_lsp 64 bits";
+		};
+		4B35C68D0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C53A0D4731D1000DE7AE;
+			remoteInfo = "jack_connect 64 bits";
+		};
+		4B35C68F0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5460D4731D1000DE7AE;
+			remoteInfo = "jack_disconnect 64 bits";
+		};
+		4B35C6910D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5520D4731D2000DE7AE;
+			remoteInfo = "jack_freewheel 64 bits";
+		};
+		4B35C6930D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5600D4731D2000DE7AE;
+			remoteInfo = "jdelay 64 bits";
+		};
+		4B35C6950D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C56C0D4731D2000DE7AE;
+			remoteInfo = "jack_external_metro 64 bits";
+		};
+		4B35C69B0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C59C0D4731D2000DE7AE;
+			remoteInfo = "zombie 64 bits";
+		};
+		4B35C69D0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5A80D4731D2000DE7AE;
+			remoteInfo = "jack_test 64 bits";
+		};
+		4B35C69F0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5B40D4731D2000DE7AE;
+			remoteInfo = "jack_cpu 64 bits";
+		};
+		4B35C6A10D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5C00D4731D2000DE7AE;
+			remoteInfo = "jack_load 64 bits";
+		};
+		4B35C6A30D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C5CC0D4731D2000DE7AE;
+			remoteInfo = "jack_unload 64 bits";
+		};
+		4B35C6AB0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C6140D4731D2000DE7AE;
+			remoteInfo = "jack_coreaudio 64 bits";
+		};
+		4B35C6AF0D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C62A0D4731D2000DE7AE;
+			remoteInfo = "jack_dummy 64 bits";
+		};
+		4B35C6B10D4733B9000DE7AE /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B35C6350D4731D3000DE7AE;
+			remoteInfo = "inprocess 64 bits";
+		};
+		4B363DE40DEB037F001F72D9 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B363DCE0DEB02F6001F72D9;
+			remoteInfo = "jack_alias Universal";
+		};
+		4B363E740DEB0838001F72D9 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B363E100DEB03C5001F72D9;
+			remoteInfo = "jack_evmon Universal";
+		};
+		4B363E760DEB0838001F72D9 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B363E440DEB0775001F72D9;
+			remoteInfo = "jack_bufsize Universal";
+		};
+		4B363F240DEB0ABE001F72D9 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B363F140DEB0A6A001F72D9;
+			remoteInfo = "jack_monitor_client Universal";
+		};
+		4B363F520DEB0CFE001F72D9 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B363F2B0DEB0BD1001F72D9;
+			remoteInfo = "jack_showtime Universal";
+		};
+		4B363F770DEB0D85001F72D9 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B363F680DEB0D4E001F72D9;
+			remoteInfo = "jack_impulse_grabber Universal";
+		};
+		4B43A8CC1014607100E52943 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B43A8B010145F6F00E52943;
+			remoteInfo = "jack_loopback Universal";
+		};
+		4B43A8E81014618D00E52943 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B43A8DD1014615800E52943;
+			remoteInfo = "jack_loopback 64 bits";
+		};
+		4B5A1BCE0CD1CCC80005BF74 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B5A1BB10CD1CB9E0005BF74;
+			remoteInfo = jack_midiseq;
+		};
+		4B5A1BE10CD1CD730005BF74 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B5A1BD00CD1CCE10005BF74;
+			remoteInfo = jack_midisine;
+		};
+		4B699DB3097D421700A18468 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699C4C097D421600A18468;
+			remoteInfo = "Jackdmp.framework Universal";
+		};
+		4B699DB5097D421700A18468 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699C00097D421600A18468;
+			remoteInfo = "Jackmp.framework Universal";
+		};
+		4B699DB7097D421700A18468 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699BA7097D421600A18468;
+			remoteInfo = "jackdmp framework Universal";
+		};
+		4B699DB9097D421700A18468 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699D97097D421700A18468;
+			remoteInfo = "jack_coreaudio Universal";
+		};
+		4B699DBB097D421700A18468 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699DA6097D421700A18468;
+			remoteInfo = "jack_dummy Universal";
+		};
+		4B699DBF097D421700A18468 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699D03097D421600A18468;
+			remoteInfo = "jack_external_metro Universal";
+		};
+		4BA693E80CBE5BBA00EAD520 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BA692A60CBE4BC700EAD520;
+			remoteInfo = "jack_load Universal";
+		};
+		4BA693EA0CBE5BBA00EAD520 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BA692CA0CBE4C9000EAD520;
+			remoteInfo = "jack_unload Universal";
+		};
+		4BA7FECC0D8E76810017FF73 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BA7FEB90D8E76270017FF73;
+			remoteInfo = "jack_control Universal";
+		};
+		4BD624D20CBCF55700DE782F /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BD623ED0CBCF0F000DE782F;
+			remoteInfo = inprocess;
+		};
+		4BDCDC2B1002036100B15929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BDCDB931001FB9C00B15929;
+			remoteInfo = "jack_coremidi 64 bits";
+		};
+		4BDCDC2D1002036100B15929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BDCDBB71001FCC000B15929;
+			remoteInfo = "jack_net 64 bits";
+		};
+		4BDCDC2F1002036100B15929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BDCDBD71001FD2D00B15929;
+			remoteInfo = "netmanager 64 bits";
+		};
+		4BDCDC38100203D500B15929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BDCDBEC1001FD7300B15929;
+			remoteInfo = "audioadapter 64 bits";
+		};
+		4BDCDC3A100203D500B15929 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BDCDC0F1001FDE300B15929;
+			remoteInfo = "netadapter 64 bits";
+		};
+		4BE99D620AD7A19100C59091 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BE99D260AD7A04800C59091;
+			remoteInfo = "jack_cpu Universal";
+		};
+		4BF339270F8B87800080FB5B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BF339020F8B864B0080FB5B;
+			remoteInfo = jack_coremidi;
+		};
+		4BFA83310DF6AB540087B4E1 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BFA82820DF6A9E40087B4E1;
+			remoteInfo = "jack_evmon 64 bits";
+		};
+		4BFA83330DF6AB540087B4E1 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BFA82950DF6A9E40087B4E1;
+			remoteInfo = "jack_bufsize 64 bits";
+		};
+		4BFA83370DF6AB540087B4E1 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BFA82AD0DF6A9E40087B4E1;
+			remoteInfo = "jack_monitor_client 64 bits";
+		};
+		4BFA83390DF6AB540087B4E1 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BFA82B90DF6A9E40087B4E1;
+			remoteInfo = "jack_showtime 64 bits";
+		};
+		4BFA833B0DF6AB540087B4E1 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BFA82C50DF6A9E40087B4E1;
+			remoteInfo = "jack_impulse_grabber 64 bits";
+		};
+		4BFA99430AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699CB1097D421600A18468;
+			remoteInfo = "jack_metro Universal";
+		};
+		4BFA99450AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699CC1097D421600A18468;
+			remoteInfo = "jack_lsp Universal";
+		};
+		4BFA99470AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699CD1097D421600A18468;
+			remoteInfo = "jack_connect Universal";
+		};
+		4BFA99490AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699CE1097D421600A18468;
+			remoteInfo = "jack_disconnect Universal";
+		};
+		4BFA994B0AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699CF1097D421600A18468;
+			remoteInfo = "jack_freewheel Universal";
+		};
+		4BFA994D0AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699D03097D421600A18468;
+			remoteInfo = "jack_external_metro Universal";
+		};
+		4BFA99530AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4B699D3F097D421600A18468;
+			remoteInfo = "zombie Universal";
+		};
+		4BFA99550AAAED90009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BE6C6910A3E096F005A203A;
+			remoteInfo = "jack_test Universal";
+		};
+		4BFA99AB0AAAF41D009E916C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 4BFA99980AAAF3B0009E916C;
+			remoteInfo = "jdelay Universal";
+		};
+		BA222AEF0DC883EF001A17F4 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = BA222AE00DC882DB001A17F4;
+			remoteInfo = netmanager;
+		};
+		BA222AF10DC883F3001A17F4 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = BA222AC50DC88132001A17F4;
+			remoteInfo = "jack_net Universal";
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		4B003AB008E2B2BA0060EFDC /* ringbuffer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ringbuffer.c; path = ../common/ringbuffer.c; sourceTree = SOURCE_ROOT; };
+		4B05A04D0DF72BC000840F4C /* alsa_driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = alsa_driver.h; path = ../linux/alsa/alsa_driver.h; sourceTree = SOURCE_ROOT; };
+		4B05A04E0DF72BC000840F4C /* alsa_midi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = alsa_midi.h; path = ../linux/alsa/alsa_midi.h; sourceTree = SOURCE_ROOT; };
+		4B05A04F0DF72BC000840F4C /* alsa_midi_impl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = alsa_midi_impl.h; path = ../linux/alsa/alsa_midi_impl.h; sourceTree = SOURCE_ROOT; };
+		4B05A0500DF72BC000840F4C /* alsa_midi_jackmp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = alsa_midi_jackmp.cpp; path = ../linux/alsa/alsa_midi_jackmp.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0510DF72BC000840F4C /* alsa_rawmidi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = alsa_rawmidi.c; path = ../linux/alsa/alsa_rawmidi.c; sourceTree = SOURCE_ROOT; };
+		4B05A0520DF72BC000840F4C /* alsa_seqmidi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = alsa_seqmidi.c; path = ../linux/alsa/alsa_seqmidi.c; sourceTree = SOURCE_ROOT; };
+		4B05A0530DF72BC000840F4C /* bitset.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = bitset.h; path = ../linux/alsa/bitset.h; sourceTree = SOURCE_ROOT; };
+		4B05A0540DF72BC000840F4C /* generic.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = generic.h; path = ../linux/alsa/generic.h; sourceTree = SOURCE_ROOT; };
+		4B05A0550DF72BC000840F4C /* generic_hw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = generic_hw.c; path = ../linux/alsa/generic_hw.c; sourceTree = SOURCE_ROOT; };
+		4B05A0560DF72BC000840F4C /* hammerfall.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hammerfall.c; path = ../linux/alsa/hammerfall.c; sourceTree = SOURCE_ROOT; };
+		4B05A0570DF72BC000840F4C /* hammerfall.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hammerfall.h; path = ../linux/alsa/hammerfall.h; sourceTree = SOURCE_ROOT; };
+		4B05A0580DF72BC000840F4C /* hardware.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hardware.h; path = ../linux/alsa/hardware.h; sourceTree = SOURCE_ROOT; };
+		4B05A0590DF72BC000840F4C /* hdsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hdsp.c; path = ../linux/alsa/hdsp.c; sourceTree = SOURCE_ROOT; };
+		4B05A05A0DF72BC000840F4C /* hdsp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hdsp.h; path = ../linux/alsa/hdsp.h; sourceTree = SOURCE_ROOT; };
+		4B05A05B0DF72BC000840F4C /* ice1712.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ice1712.c; path = ../linux/alsa/ice1712.c; sourceTree = SOURCE_ROOT; };
+		4B05A05C0DF72BC000840F4C /* ice1712.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ice1712.h; path = ../linux/alsa/ice1712.h; sourceTree = SOURCE_ROOT; };
+		4B05A05D0DF72BC000840F4C /* JackAlsaDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackAlsaDriver.cpp; path = ../linux/alsa/JackAlsaDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A05E0DF72BC000840F4C /* JackAlsaDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackAlsaDriver.h; path = ../linux/alsa/JackAlsaDriver.h; sourceTree = SOURCE_ROOT; };
+		4B05A05F0DF72BC000840F4C /* jslist.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jslist.h; path = ../linux/alsa/jslist.h; sourceTree = SOURCE_ROOT; };
+		4B05A0620DF72BC000840F4C /* midi_pack.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = midi_pack.h; path = ../linux/alsa/midi_pack.h; sourceTree = SOURCE_ROOT; };
+		4B05A0630DF72BC000840F4C /* midi_unpack.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = midi_unpack.h; path = ../linux/alsa/midi_unpack.h; sourceTree = SOURCE_ROOT; };
+		4B05A0640DF72BC000840F4C /* usx2y.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = usx2y.c; path = ../linux/alsa/usx2y.c; sourceTree = SOURCE_ROOT; };
+		4B05A0650DF72BC000840F4C /* usx2y.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = usx2y.h; path = ../linux/alsa/usx2y.h; sourceTree = SOURCE_ROOT; };
+		4B05A07D0DF72BC000840F4C /* driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = driver.h; path = ../linux/driver.h; sourceTree = SOURCE_ROOT; };
+		4B05A07F0DF72BC000840F4C /* ffado_driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ffado_driver.h; path = ../linux/firewire/ffado_driver.h; sourceTree = SOURCE_ROOT; };
+		4B05A0800DF72BC000840F4C /* JackFFADODriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFFADODriver.cpp; path = ../linux/firewire/JackFFADODriver.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0810DF72BC000840F4C /* JackFFADODriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFFADODriver.h; path = ../linux/firewire/JackFFADODriver.h; sourceTree = SOURCE_ROOT; };
+		4B05A0830DF72BC000840F4C /* freebob_driver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = freebob_driver.h; path = ../linux/freebob/freebob_driver.h; sourceTree = SOURCE_ROOT; };
+		4B05A0840DF72BC000840F4C /* JackFreebobDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFreebobDriver.cpp; path = ../linux/freebob/JackFreebobDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0850DF72BC000840F4C /* JackFreebobDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFreebobDriver.h; path = ../linux/freebob/JackFreebobDriver.h; sourceTree = SOURCE_ROOT; };
+		4B05A08B0DF72C3200840F4C /* JackWinEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinEvent.cpp; path = ../windows/JackWinEvent.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A08C0DF72C3200840F4C /* JackWinEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinEvent.h; path = ../windows/JackWinEvent.h; sourceTree = SOURCE_ROOT; };
+		4B05A08D0DF72C3200840F4C /* JackWinNamedPipe.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinNamedPipe.cpp; path = ../windows/JackWinNamedPipe.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A08E0DF72C3200840F4C /* JackWinNamedPipe.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinNamedPipe.h; path = ../windows/JackWinNamedPipe.h; sourceTree = SOURCE_ROOT; };
+		4B05A08F0DF72C3200840F4C /* JackWinNamedPipeClientChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinNamedPipeClientChannel.cpp; path = ../windows/JackWinNamedPipeClientChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0900DF72C3200840F4C /* JackWinNamedPipeClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinNamedPipeClientChannel.h; path = ../windows/JackWinNamedPipeClientChannel.h; sourceTree = SOURCE_ROOT; };
+		4B05A0910DF72C3200840F4C /* JackWinNamedPipeNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinNamedPipeNotifyChannel.cpp; path = ../windows/JackWinNamedPipeNotifyChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0920DF72C3200840F4C /* JackWinNamedPipeNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinNamedPipeNotifyChannel.h; path = ../windows/JackWinNamedPipeNotifyChannel.h; sourceTree = SOURCE_ROOT; };
+		4B05A0930DF72C3200840F4C /* JackWinNamedPipeServerChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinNamedPipeServerChannel.cpp; path = ../windows/JackWinNamedPipeServerChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0940DF72C3200840F4C /* JackWinNamedPipeServerChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinNamedPipeServerChannel.h; path = ../windows/JackWinNamedPipeServerChannel.h; sourceTree = SOURCE_ROOT; };
+		4B05A0950DF72C3200840F4C /* JackWinNamedPipeServerNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinNamedPipeServerNotifyChannel.cpp; path = ../windows/JackWinNamedPipeServerNotifyChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0960DF72C3200840F4C /* JackWinNamedPipeServerNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinNamedPipeServerNotifyChannel.h; path = ../windows/JackWinNamedPipeServerNotifyChannel.h; sourceTree = SOURCE_ROOT; };
+		4B05A0970DF72C3200840F4C /* JackWinProcessSync.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinProcessSync.cpp; path = ../windows/JackWinProcessSync.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A0980DF72C3200840F4C /* JackWinProcessSync.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinProcessSync.h; path = ../windows/JackWinProcessSync.h; sourceTree = SOURCE_ROOT; };
+		4B05A0990DF72C3200840F4C /* JackWinSemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinSemaphore.cpp; path = ../windows/JackWinSemaphore.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A09A0DF72C3200840F4C /* JackWinSemaphore.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinSemaphore.h; path = ../windows/JackWinSemaphore.h; sourceTree = SOURCE_ROOT; };
+		4B05A09B0DF72C3200840F4C /* JackWinThread.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinThread.cpp; path = ../windows/JackWinThread.cpp; sourceTree = SOURCE_ROOT; };
+		4B05A09C0DF72C3200840F4C /* JackWinThread.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackWinThread.h; path = ../windows/JackWinThread.h; sourceTree = SOURCE_ROOT; };
+		4B0A28E60D52073D002EFF74 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B0A28EC0D520852002EFF74 /* tw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tw.c; path = "../example-clients/tw.c"; sourceTree = SOURCE_ROOT; };
+		4B0A292D0D52108E002EFF74 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B19B3000E23620F00DD4A82 /* audioadapter.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = audioadapter.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapter.cpp; path = ../common/JackAudioAdapter.cpp; sourceTree = SOURCE_ROOT; };
+		4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackAudioAdapter.h; path = ../common/JackAudioAdapter.h; sourceTree = SOURCE_ROOT; };
+		4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapterInterface.cpp; path = ../common/JackAudioAdapterInterface.cpp; sourceTree = SOURCE_ROOT; };
+		4B19B3090E2362E700DD4A82 /* JackAudioAdapterInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackAudioAdapterInterface.h; path = ../common/JackAudioAdapterInterface.h; sourceTree = SOURCE_ROOT; };
+		4B19B30C0E2362E700DD4A82 /* JackException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackException.h; path = ../common/JackException.h; sourceTree = SOURCE_ROOT; };
+		4B19B30E0E2362E700DD4A82 /* JackLibSampleRateResampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackLibSampleRateResampler.cpp; path = ../common/JackLibSampleRateResampler.cpp; sourceTree = SOURCE_ROOT; };
+		4B19B30F0E2362E700DD4A82 /* JackLibSampleRateResampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackLibSampleRateResampler.h; path = ../common/JackLibSampleRateResampler.h; sourceTree = SOURCE_ROOT; };
+		4B19B3120E2362E700DD4A82 /* JackResampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackResampler.cpp; path = ../common/JackResampler.cpp; sourceTree = SOURCE_ROOT; };
+		4B2C28F908DAD01E00249230 /* JackGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackGlobals.cpp; path = ../common/JackGlobals.cpp; sourceTree = SOURCE_ROOT; };
+		4B3224E510A3156800838A8E /* jack_netone.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_netone.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B3224E810A315B100838A8E /* JackNetOneDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetOneDriver.cpp; path = ../common/JackNetOneDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4B3224E910A315B100838A8E /* JackNetOneDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackNetOneDriver.h; path = ../common/JackNetOneDriver.h; sourceTree = SOURCE_ROOT; };
+		4B3224EC10A315C400838A8E /* netjack_packet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = netjack_packet.c; path = ../common/netjack_packet.c; sourceTree = SOURCE_ROOT; };
+		4B3224ED10A315C400838A8E /* netjack_packet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = netjack_packet.h; path = ../common/netjack_packet.h; sourceTree = SOURCE_ROOT; };
+		4B3224EE10A315C400838A8E /* netjack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = netjack.c; path = ../common/netjack.c; sourceTree = SOURCE_ROOT; };
+		4B3224EF10A315C400838A8E /* netjack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = netjack.h; path = ../common/netjack.h; sourceTree = SOURCE_ROOT; };
+		4B32252B10A316B200838A8E /* jack_netone.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_netone.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B32256110A3187800838A8E /* jack_netsource */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_netsource; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B32256310A318E300838A8E /* netsource.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = netsource.c; path = "../example-clients/netsource.c"; sourceTree = SOURCE_ROOT; };
+		4B32257B10A3190C00838A8E /* jack_netsource */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_netsource; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C4250D4731D1000DE7AE /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C4830D4731D1000DE7AE /* Jackmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackmp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackservermp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5140D4731D1000DE7AE /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5200D4731D1000DE7AE /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C52C0D4731D1000DE7AE /* jack_metro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_metro; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5380D4731D1000DE7AE /* jack_lsp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_lsp; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5440D4731D1000DE7AE /* jack_connect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_connect; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5500D4731D1000DE7AE /* jack_disconnect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_disconnect; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C55E0D4731D2000DE7AE /* jack_freewheel */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_freewheel; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C56A0D4731D2000DE7AE /* jdelay */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jdelay; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5760D4731D2000DE7AE /* jack_external_metro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_external_metro; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5860D4731D2000DE7AE /* testAtomic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testAtomic; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C59A0D4731D2000DE7AE /* testSem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testSem; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5A60D4731D2000DE7AE /* zombie */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = zombie; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5B20D4731D2000DE7AE /* jack_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_test; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5BE0D4731D2000DE7AE /* jack_cpu */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_cpu; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5CA0D4731D2000DE7AE /* jack_load */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_load; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5D60D4731D2000DE7AE /* jack_unload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_unload; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5EA0D4731D2000DE7AE /* synchroServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = synchroServer; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C5FE0D4731D2000DE7AE /* synchroClient */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = synchroClient; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C6120D4731D2000DE7AE /* synchroServerClient */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = synchroServerClient; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C61E0D4731D2000DE7AE /* jack_coreaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_coreaudio.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C6290D4731D2000DE7AE /* jack_portaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_portaudio.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C6340D4731D2000DE7AE /* jack_dummy.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_dummy.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B35C63E0D4731D3000DE7AE /* inprocess.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = inprocess.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363DD80DEB02F6001F72D9 /* jack_alias */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_alias; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363DDE0DEB034E001F72D9 /* alias.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = alias.c; path = "../example-clients/alias.c"; sourceTree = SOURCE_ROOT; };
+		4B363E1A0DEB03C5001F72D9 /* jack_evmon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_evmon; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363E200DEB0401001F72D9 /* evmon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = evmon.c; path = "../example-clients/evmon.c"; sourceTree = SOURCE_ROOT; };
+		4B363E4E0DEB0775001F72D9 /* jack_bufsize */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_bufsize; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363E710DEB0808001F72D9 /* bufsize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bufsize.c; path = "../example-clients/bufsize.c"; sourceTree = SOURCE_ROOT; };
+		4B363EE90DEB091C001F72D9 /* jack_rec */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_rec; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363EED0DEB094B001F72D9 /* capture_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = capture_client.c; path = "../example-clients/capture_client.c"; sourceTree = SOURCE_ROOT; };
+		4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_monitor_client; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363F220DEB0AB0001F72D9 /* monitor_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = monitor_client.c; path = "../example-clients/monitor_client.c"; sourceTree = SOURCE_ROOT; };
+		4B363F350DEB0BD1001F72D9 /* jack_showtime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_showtime; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363F3D0DEB0C31001F72D9 /* showtime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = showtime.c; path = "../example-clients/showtime.c"; sourceTree = SOURCE_ROOT; };
+		4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_impulse_grabber; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B363F750DEB0D7D001F72D9 /* impulse_grabber.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = impulse_grabber.c; path = "../example-clients/impulse_grabber.c"; sourceTree = SOURCE_ROOT; };
+		4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CALatencyLog.cpp; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.cpp; sourceTree = "<absolute>"; };
+		4B37C20406DF1FBE0016E567 /* CALatencyLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CALatencyLog.h; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.h; sourceTree = "<absolute>"; };
+		4B37C20906DF1FE20016E567 /* latency.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = latency.c; path = /Developer/Examples/CoreAudio/PublicUtility/latency.c; sourceTree = "<absolute>"; };
+		4B3F49070AD8503300491C6E /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = cpu.c; path = ../tests/cpu.c; sourceTree = SOURCE_ROOT; };
+		4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacEngineRPC.cpp; sourceTree = SOURCE_ROOT; };
+		4B43A8BA10145F6F00E52943 /* jack_loopback.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_loopback.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B43A8C81014605000E52943 /* JackLoopbackDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackLoopbackDriver.cpp; path = ../common/JackLoopbackDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4B43A8C91014605000E52943 /* JackLoopbackDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackLoopbackDriver.h; path = ../common/JackLoopbackDriver.h; sourceTree = SOURCE_ROOT; };
+		4B43A8E71014615800E52943 /* jack_loopback.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_loopback.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B464301076CAC7700E5077C /* Jack-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = "Jack-Info.plist"; sourceTree = SOURCE_ROOT; };
+		4B47ACD710B5890100469C67 /* Jackmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackmp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackRestartThreadedDriver.h; path = ../common/JackRestartThreadedDriver.h; sourceTree = SOURCE_ROOT; };
+		4B4CA9740E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackRestartThreadedDriver.cpp; path = ../common/JackRestartThreadedDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4B4E9AF80E5F1090000A3278 /* JackControlAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackControlAPI.cpp; path = ../common/JackControlAPI.cpp; sourceTree = SOURCE_ROOT; };
+		4B4E9AF90E5F1090000A3278 /* JackControlAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackControlAPI.h; path = ../common/JackControlAPI.h; sourceTree = SOURCE_ROOT; };
+		4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackMessageBuffer.cpp; path = ../common/JackMessageBuffer.cpp; sourceTree = SOURCE_ROOT; };
+		4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackMessageBuffer.h; path = ../common/JackMessageBuffer.h; sourceTree = SOURCE_ROOT; };
+		4B57F5950D72C27900B4E719 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B5A1BBB0CD1CB9E0005BF74 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B5A1BBD0CD1CC110005BF74 /* midiseq.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midiseq.c; path = "../example-clients/midiseq.c"; sourceTree = SOURCE_ROOT; };
+		4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B5A1BDC0CD1CD420005BF74 /* midisine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midisine.c; path = "../example-clients/midisine.c"; sourceTree = SOURCE_ROOT; };
+		4B5E08D50E5B66EE00BEE4E0 /* netadapter.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netadapter.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B5E08DF0E5B676C00BEE4E0 /* JackNetAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetAdapter.cpp; path = ../common/JackNetAdapter.cpp; sourceTree = SOURCE_ROOT; };
+		4B5E08E00E5B676C00BEE4E0 /* JackNetAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNetAdapter.h; path = ../common/JackNetAdapter.h; sourceTree = SOURCE_ROOT; };
+		4B5F253D0DEE9B8F0041E486 /* JackLockedEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackLockedEngine.h; path = ../common/JackLockedEngine.h; sourceTree = SOURCE_ROOT; };
+		4B60CE480AAABA31004956AA /* connect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = connect.c; path = "../example-clients/connect.c"; sourceTree = SOURCE_ROOT; };
+		4B66A8580934964500A89560 /* JackConstants.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackConstants.h; path = ../common/JackConstants.h; sourceTree = SOURCE_ROOT; };
+		4B699BB1097D421600A18468 /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699C47097D421600A18468 /* Jackmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackmp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699CAC097D421600A18468 /* Jackservermp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackservermp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699CBB097D421600A18468 /* jack_metro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_metro; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699CCB097D421600A18468 /* jack_lsp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_lsp; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699CDB097D421600A18468 /* jack_connect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_connect; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699CEB097D421600A18468 /* jack_disconnect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_disconnect; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699CFD097D421600A18468 /* jack_freewheel */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_freewheel; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D0D097D421600A18468 /* jack_external_metro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_external_metro; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D21097D421600A18468 /* testAtomic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testAtomic; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D39097D421600A18468 /* testSem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testSem; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D49097D421600A18468 /* zombie */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = zombie; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D61097D421600A18468 /* synchroServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = synchroServer; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D79097D421600A18468 /* synchroClient */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = synchroClient; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699D91097D421700A18468 /* synchroServerClient */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = synchroServerClient; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699DA1097D421700A18468 /* jack_coreaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_coreaudio.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B699DB0097D421700A18468 /* jack_dummy.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_dummy.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B6B9EF50CD0958B0051EE5A /* midiport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = midiport.h; path = ../common/jack/midiport.h; sourceTree = SOURCE_ROOT; };
+		4B6C73790CC60A6D001AFFD4 /* intclient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = intclient.h; path = ../common/jack/intclient.h; sourceTree = SOURCE_ROOT; };
+		4B6C737A0CC60A6D001AFFD4 /* jack.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jack.h; path = ../common/jack/jack.h; sourceTree = SOURCE_ROOT; };
+		4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ringbuffer.h; path = ../common/jack/ringbuffer.h; sourceTree = SOURCE_ROOT; };
+		4B6C737C0CC60A6D001AFFD4 /* statistics.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = statistics.h; path = ../common/jack/statistics.h; sourceTree = SOURCE_ROOT; };
+		4B6C737D0CC60A6D001AFFD4 /* thread.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = thread.h; path = ../common/jack/thread.h; sourceTree = SOURCE_ROOT; };
+		4B6C737E0CC60A6D001AFFD4 /* transport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = transport.h; path = ../common/jack/transport.h; sourceTree = SOURCE_ROOT; };
+		4B6C737F0CC60A6D001AFFD4 /* types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../common/jack/types.h; sourceTree = SOURCE_ROOT; };
+		4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackEngineControl.cpp; path = ../common/JackEngineControl.cpp; sourceTree = SOURCE_ROOT; };
+		4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetInterface.cpp; path = ../common/JackNetInterface.cpp; sourceTree = SOURCE_ROOT; };
+		4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackNetInterface.h; path = ../common/JackNetInterface.h; sourceTree = SOURCE_ROOT; };
+		4B799AD607899652003F3F15 /* JackMachPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachPort.cpp; sourceTree = "<group>"; };
+		4B799AD707899652003F3F15 /* JackMachPort.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachPort.h; sourceTree = "<group>"; };
+		4B80D7E50BA0D17400F035BB /* JackMidiPort.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackMidiPort.h; path = ../common/JackMidiPort.h; sourceTree = SOURCE_ROOT; };
+		4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiPort.cpp; path = ../common/JackMidiPort.cpp; sourceTree = SOURCE_ROOT; };
+		4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiAPI.cpp; path = ../common/JackMidiAPI.cpp; sourceTree = SOURCE_ROOT; };
+		4B869B3D08C8D21C001CF041 /* driver_interface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = driver_interface.h; path = ../common/driver_interface.h; sourceTree = SOURCE_ROOT; };
+		4B869B4208C8D22F001CF041 /* JackDriverLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDriverLoader.h; path = ../common/JackDriverLoader.h; sourceTree = SOURCE_ROOT; };
+		4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDriverLoader.cpp; path = ../common/JackDriverLoader.cpp; sourceTree = SOURCE_ROOT; };
+		4B89B759076B731100D170DE /* JackRPCClientUser.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = JackRPCClientUser.c; path = RPC/JackRPCClientUser.c; sourceTree = SOURCE_ROOT; };
+		4B89B769076B74D200D170DE /* JackRPCEngineUser.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = JackRPCEngineUser.c; path = RPC/JackRPCEngineUser.c; sourceTree = SOURCE_ROOT; };
+		4B940B9B06DDDE5B00D77F60 /* AudioHardware.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AudioHardware.h; path = /System/Library/Frameworks/CoreAudio.framework/Versions/A/Headers/AudioHardware.h; sourceTree = "<absolute>"; };
+		4B94334910A5E666002A187F /* systemdeps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = systemdeps.h; path = ../common/jack/systemdeps.h; sourceTree = SOURCE_ROOT; };
+		4B95BCAD0D913073000F7695 /* control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = control.h; path = ../common/jack/control.h; sourceTree = SOURCE_ROOT; };
+		4B978DBB0A31CF4A009E2DD1 /* jack_portaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_portaudio.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4B98AE000931D30C0091932A /* JackDebugClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDebugClient.cpp; path = ../common/JackDebugClient.cpp; sourceTree = SOURCE_ROOT; };
+		4B98AE010931D30C0091932A /* JackDebugClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDebugClient.h; path = ../common/JackDebugClient.h; sourceTree = SOURCE_ROOT; };
+		4B9A25B30DBF8330006E9FBC /* JackError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackError.cpp; path = ../common/JackError.cpp; sourceTree = SOURCE_ROOT; };
+		4B9A26000DBF8584006E9FBC /* jslist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jslist.h; path = ../common/jack/jslist.h; sourceTree = SOURCE_ROOT; };
+		4BA339AC10B2E36800190E3B /* Jackservermp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackservermp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroClient.cpp; path = ../tests/testSynchroClient.cpp; sourceTree = SOURCE_ROOT; };
+		4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServer.cpp; path = ../tests/testSynchroServer.cpp; sourceTree = SOURCE_ROOT; };
+		4BA692B00CBE4BC700EAD520 /* jack_load */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_load; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BA692B20CBE4C2D00EAD520 /* ipload.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ipload.c; path = "../example-clients/ipload.c"; sourceTree = SOURCE_ROOT; };
+		4BA692D40CBE4C9000EAD520 /* jack_unload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_unload; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BA692D60CBE4CC600EAD520 /* ipunload.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ipunload.c; path = "../example-clients/ipunload.c"; sourceTree = SOURCE_ROOT; };
+		4BA7FEC30D8E76270017FF73 /* jack_server_control */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_server_control; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BA7FEC80D8E76650017FF73 /* control.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = control.c; path = "../example-clients/control.c"; sourceTree = SOURCE_ROOT; };
+		4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPortType.cpp; path = ../common/JackPortType.cpp; sourceTree = SOURCE_ROOT; };
+		4BAB95B70B9E20B800A0C723 /* JackPortType.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPortType.h; path = ../common/JackPortType.h; sourceTree = SOURCE_ROOT; };
+		4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioPort.cpp; path = ../common/JackAudioPort.cpp; sourceTree = SOURCE_ROOT; };
+		4BB371D40C1AD85A0050C1E4 /* JackNotification.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNotification.h; path = ../common/JackNotification.h; sourceTree = SOURCE_ROOT; };
+		4BBAE40E0F42FA6100B8BD3F /* JackEngineProfiling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackEngineProfiling.h; path = ../common/JackEngineProfiling.h; sourceTree = SOURCE_ROOT; };
+		4BBAE40F0F42FA6100B8BD3F /* JackEngineProfiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackEngineProfiling.cpp; path = ../common/JackEngineProfiling.cpp; sourceTree = SOURCE_ROOT; };
+		4BBB00CF0E72614F0018AB1B /* JackPortAudioDevices.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPortAudioDevices.cpp; path = ../windows/portaudio/JackPortAudioDevices.cpp; sourceTree = SOURCE_ROOT; };
+		4BBB00D00E72614F0018AB1B /* JackPortAudioDevices.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPortAudioDevices.h; path = ../windows/portaudio/JackPortAudioDevices.h; sourceTree = SOURCE_ROOT; };
+		4BBB00D10E72614F0018AB1B /* JackPortAudioDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPortAudioDriver.cpp; path = ../windows/portaudio/JackPortAudioDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BBB00D20E72614F0018AB1B /* JackPortAudioDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPortAudioDriver.h; path = ../windows/portaudio/JackPortAudioDriver.h; sourceTree = SOURCE_ROOT; };
+		4BBC93B80DF9736C002DF220 /* JackWaitThreadedDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackWaitThreadedDriver.cpp; path = ../common/JackWaitThreadedDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BBC93B90DF9736C002DF220 /* JackWaitThreadedDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackWaitThreadedDriver.h; path = ../common/JackWaitThreadedDriver.h; sourceTree = SOURCE_ROOT; };
+		4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServerClient.cpp; path = ../tests/testSynchroServerClient.cpp; sourceTree = SOURCE_ROOT; };
+		4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServerGlobals.cpp; path = ../common/JackServerGlobals.cpp; sourceTree = SOURCE_ROOT; };
+		4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackServerGlobals.h; path = ../common/JackServerGlobals.h; sourceTree = SOURCE_ROOT; };
+		4BC3988908B3CF6C00B6F371 /* JackDummyDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDummyDriver.cpp; path = ../common/JackDummyDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3988A08B3CF6C00B6F371 /* JackDummyDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDummyDriver.h; path = ../common/JackDummyDriver.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackPosixThread.cpp; path = ../posix/JackPosixThread.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPosixThread.h; path = ../posix/JackPosixThread.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6AD0E703B8D0066E42F /* JackSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocket.cpp; path = ../posix/JackSocket.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6AE0E703B8D0066E42F /* JackSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackSocket.h; path = ../posix/JackSocket.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6AF0E703B8D0066E42F /* JackSocketClientChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocketClientChannel.cpp; path = ../posix/JackSocketClientChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6B00E703B8D0066E42F /* JackSocketClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackSocketClientChannel.h; path = ../posix/JackSocketClientChannel.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6B10E703B8D0066E42F /* JackSocketNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocketNotifyChannel.cpp; path = ../posix/JackSocketNotifyChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6B20E703B8D0066E42F /* JackSocketNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackSocketNotifyChannel.h; path = ../posix/JackSocketNotifyChannel.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6B30E703B8D0066E42F /* JackSocketServerChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocketServerChannel.cpp; path = ../posix/JackSocketServerChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6B40E703B8D0066E42F /* JackSocketServerChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackSocketServerChannel.h; path = ../posix/JackSocketServerChannel.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6B50E703B8D0066E42F /* JackSocketServerNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocketServerNotifyChannel.cpp; path = ../posix/JackSocketServerNotifyChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6B60E703B8D0066E42F /* JackSocketServerNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackSocketServerNotifyChannel.h; path = ../posix/JackSocketServerNotifyChannel.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6B70E703BAA0066E42F /* JackPosixSemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackPosixSemaphore.cpp; path = ../posix/JackPosixSemaphore.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6B80E703BAA0066E42F /* JackPosixSemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPosixSemaphore.h; path = ../posix/JackPosixSemaphore.h; sourceTree = SOURCE_ROOT; };
+		4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetUnixSocket.cpp; path = ../posix/JackNetUnixSocket.cpp; sourceTree = SOURCE_ROOT; };
+		4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackNetUnixSocket.h; path = ../posix/JackNetUnixSocket.h; sourceTree = SOURCE_ROOT; };
+		4BC8326D0DF42C7D00DD1C93 /* JackMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackMutex.h; path = ../common/JackMutex.h; sourceTree = SOURCE_ROOT; };
+		4BCBCE5910C4FE3F00450FFE /* JackPhysicalMidiInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackPhysicalMidiInput.cpp; path = ../common/JackPhysicalMidiInput.cpp; sourceTree = SOURCE_ROOT; };
+		4BCBCE5A10C4FE3F00450FFE /* JackPhysicalMidiInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPhysicalMidiInput.h; path = ../common/JackPhysicalMidiInput.h; sourceTree = SOURCE_ROOT; };
+		4BCBCE5B10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackPhysicalMidiOutput.cpp; path = ../common/JackPhysicalMidiOutput.cpp; sourceTree = SOURCE_ROOT; };
+		4BCBCE5C10C4FE3F00450FFE /* JackPhysicalMidiOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPhysicalMidiOutput.h; path = ../common/JackPhysicalMidiOutput.h; sourceTree = SOURCE_ROOT; };
+		4BCC87950D57168300A7FEB1 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = "<absolute>"; };
+		4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackTransportEngine.h; path = ../common/JackTransportEngine.h; sourceTree = SOURCE_ROOT; };
+		4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackTransportEngine.cpp; path = ../common/JackTransportEngine.cpp; sourceTree = SOURCE_ROOT; };
+		4BD561C708EEB910006BBC2A /* JackSynchro.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackSynchro.h; path = ../common/JackSynchro.h; sourceTree = SOURCE_ROOT; };
+		4BD623F70CBCF0F000DE782F /* inprocess.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = inprocess.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BD6240C0CBCF16600DE782F /* inprocess.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inprocess.c; path = "../example-clients/inprocess.c"; sourceTree = SOURCE_ROOT; };
+		4BDCDB9D1001FB9C00B15929 /* jack_coremidi.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_coremidi.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BDCDBC51001FCC000B15929 /* jack_net.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_net.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BDCDBE81001FD2D00B15929 /* netmanager.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netmanager.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BDCDBFF1001FD7300B15929 /* audioadapter.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = audioadapter.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BDCDC251001FDE300B15929 /* netadapter.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netadapter.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackTools.cpp; path = ../common/JackTools.cpp; sourceTree = SOURCE_ROOT; };
+		4BE4CC000CDA153400CCF5BB /* JackTools.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackTools.h; path = ../common/JackTools.h; sourceTree = SOURCE_ROOT; };
+		4BE5FECB0E725C090020B576 /* JackCoreAudioDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreAudioDriver.cpp; path = coreaudio/JackCoreAudioDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BE5FECC0E725C090020B576 /* JackCoreAudioDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackCoreAudioDriver.h; path = coreaudio/JackCoreAudioDriver.h; sourceTree = SOURCE_ROOT; };
+		4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreAudioAdapter.cpp; path = coreaudio/JackCoreAudioAdapter.cpp; sourceTree = SOURCE_ROOT; };
+		4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackCoreAudioAdapter.h; path = coreaudio/JackCoreAudioAdapter.h; sourceTree = SOURCE_ROOT; };
+		4BE6C6A30A3E096F005A203A /* jack_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_test; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BE6C6AC0A3E0A65005A203A /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = test.cpp; path = ../tests/test.cpp; sourceTree = SOURCE_ROOT; };
+		4BE99D300AD7A04800C59091 /* jack_cpu */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_cpu; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackProcessSync.cpp; path = ../posix/JackProcessSync.cpp; sourceTree = SOURCE_ROOT; };
+		4BECB2F40F4451C10091B70A /* JackProcessSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackProcessSync.h; path = ../posix/JackProcessSync.h; sourceTree = SOURCE_ROOT; };
+		4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackArgParser.cpp; path = ../common/JackArgParser.cpp; sourceTree = SOURCE_ROOT; };
+		4BF284170F31B4BC00B05BE3 /* JackArgParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackArgParser.h; path = ../common/JackArgParser.h; sourceTree = SOURCE_ROOT; };
+		4BF3390C0F8B864B0080FB5B /* jack_coremidi.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_coremidi.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BF339140F8B86DC0080FB5B /* JackCoreMidiDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackCoreMidiDriver.h; path = coremidi/JackCoreMidiDriver.h; sourceTree = SOURCE_ROOT; };
+		4BF339150F8B86DC0080FB5B /* JackCoreMidiDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreMidiDriver.cpp; path = coremidi/JackCoreMidiDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BF3391F0F8B873E0080FB5B /* JackMidiDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiDriver.cpp; path = ../common/JackMidiDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BF339200F8B873E0080FB5B /* JackMidiDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackMidiDriver.h; path = ../common/JackMidiDriver.h; sourceTree = SOURCE_ROOT; };
+		4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacLibClientRPC.cpp; sourceTree = SOURCE_ROOT; };
+		4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapterFactory.cpp; path = ../common/JackAudioAdapterFactory.cpp; sourceTree = SOURCE_ROOT; };
+		4BF520520CB8D0E80037470E /* timestamps.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = timestamps.c; path = ../common/timestamps.c; sourceTree = SOURCE_ROOT; };
+		4BF520580CB8D1010037470E /* timestamps.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = timestamps.h; path = ../common/timestamps.h; sourceTree = SOURCE_ROOT; };
+		4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackPosixServerLaunch.cpp; path = ../posix/JackPosixServerLaunch.cpp; sourceTree = SOURCE_ROOT; };
+		4BF5FBC80E878D24003D2374 /* JackMachTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = JackMachTime.c; sourceTree = SOURCE_ROOT; };
+		4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachSemaphore.cpp; sourceTree = SOURCE_ROOT; };
+		4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachSemaphore.h; sourceTree = SOURCE_ROOT; };
+		4BF772FD08B3330F00149912 /* JackAtomic.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackAtomic.h; path = ../common/JackAtomic.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1670834EDD900C94B91 /* zombie.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = zombie.c; path = "../example-clients/zombie.c"; sourceTree = SOURCE_ROOT; };
+		4BF8D1690834EDE600C94B91 /* lsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lsp.c; path = "..//example-clients/lsp.c"; sourceTree = SOURCE_ROOT; };
+		4BF8D16B0834EDF000C94B91 /* metro.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = metro.c; path = "../example-clients/metro.c"; sourceTree = SOURCE_ROOT; };
+		4BF8D1710834EE0F00C94B91 /* freewheel.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = freewheel.c; path = "../example-clients/freewheel.c"; sourceTree = SOURCE_ROOT; };
+		4BF8D1770834EE4800C94B91 /* JackError.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackError.h; path = ../common/JackError.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1830834EE5800C94B91 /* JackTime.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackTime.h; path = ../common/JackTime.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1870834EE7900C94B91 /* JackShmMem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackShmMem.h; path = ../common/JackShmMem.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackShmMem.cpp; path = ../common/JackShmMem.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D18F0834EE8400C94B91 /* shm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shm.h; path = ../common/shm.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1900834EE8400C94B91 /* shm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = shm.c; path = ../common/shm.c; sourceTree = SOURCE_ROOT; };
+		4BF8D19F0834EE9E00C94B91 /* JackThread.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackThread.h; path = ../common/JackThread.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackActivationCount.h; path = ../common/JackActivationCount.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackActivationCount.cpp; path = ../common/JackActivationCount.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1AF0834EEC400C94B91 /* JackChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackChannel.h; path = ../common/JackChannel.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackInternalClientChannel.h; path = ../common/JackInternalClientChannel.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1B50834EEE400C94B91 /* JackDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDriver.h; path = ../common/JackDriver.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1B60834EEE400C94B91 /* JackDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDriver.cpp; path = ../common/JackDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1B90834EEF100C94B91 /* JackFreewheelDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFreewheelDriver.h; path = ../common/JackFreewheelDriver.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1BA0834EEF100C94B91 /* JackFreewheelDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFreewheelDriver.cpp; path = ../common/JackFreewheelDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1BD0834EEFC00C94B91 /* JackThreadedDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackThreadedDriver.h; path = ../common/JackThreadedDriver.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1BE0834EEFC00C94B91 /* JackThreadedDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackThreadedDriver.cpp; path = ../common/JackThreadedDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1C10834EF0800C94B91 /* JackAtomicState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackAtomicState.h; path = ../common/JackAtomicState.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackConnectionManager.h; path = ../common/JackConnectionManager.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackConnectionManager.cpp; path = ../common/JackConnectionManager.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackGraphManager.h; path = ../common/JackGraphManager.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackGraphManager.cpp; path = ../common/JackGraphManager.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1CF0834EF2F00C94B91 /* JackPort.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPort.h; path = ../common/JackPort.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPort.cpp; path = ../common/JackPort.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackClientInterface.h; path = ../common/JackClientInterface.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackClientControl.h; path = ../common/JackClientControl.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1E10834EF5500C94B91 /* JackClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackClient.h; path = ../common/JackClient.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1E50834EF6700C94B91 /* JackClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackClient.cpp; path = ../common/JackClient.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackAPI.cpp; path = ../common/JackAPI.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackInternalClient.cpp; path = ../common/JackInternalClient.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackInternalClient.h; path = ../common/JackInternalClient.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServerAPI.cpp; path = ../common/JackServerAPI.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackExternalClient.h; path = ../common/JackExternalClient.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackExternalClient.cpp; path = ../common/JackExternalClient.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1FB0834EFD100C94B91 /* JackLibGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackLibGlobals.h; path = ../common/JackLibGlobals.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1FC0834EFD100C94B91 /* JackLibClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackLibClient.h; path = ../common/JackLibClient.h; sourceTree = SOURCE_ROOT; };
+		4BF8D1FD0834EFD100C94B91 /* JackLibClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackLibClient.cpp; path = ../common/JackLibClient.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D1FE0834EFD100C94B91 /* JackLibAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackLibAPI.cpp; path = ../common/JackLibAPI.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D2130834F02800C94B91 /* JackEngine.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackEngine.h; path = ../common/JackEngine.h; sourceTree = SOURCE_ROOT; };
+		4BF8D2140834F02800C94B91 /* JackEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackEngine.cpp; path = ../common/JackEngine.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D2190834F03D00C94B91 /* JackEngineControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackEngineControl.h; path = ../common/JackEngineControl.h; sourceTree = SOURCE_ROOT; };
+		4BF8D2210834F05C00C94B91 /* JackServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServer.cpp; path = ../common/JackServer.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D2220834F05C00C94B91 /* JackServer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackServer.h; path = ../common/JackServer.h; sourceTree = SOURCE_ROOT; };
+		4BF8D2250834F06A00C94B91 /* Jackdmp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Jackdmp.cpp; path = ../common/Jackdmp.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D2290834F07D00C94B91 /* JackAudioDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackAudioDriver.h; path = ../common/JackAudioDriver.h; sourceTree = SOURCE_ROOT; };
+		4BF8D22A0834F07D00C94B91 /* JackAudioDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioDriver.cpp; path = ../common/JackAudioDriver.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D23E0834F1C300C94B91 /* testAtomic.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testAtomic.cpp; path = ../tests/testAtomic.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8D2470834F20600C94B91 /* testSem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSem.cpp; path = ../tests/testSem.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFrameTimer.cpp; path = ../common/JackFrameTimer.cpp; sourceTree = SOURCE_ROOT; };
+		4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFrameTimer.h; path = ../common/JackFrameTimer.h; sourceTree = SOURCE_ROOT; };
+		4BFA5E980DEC4D9C00FA4CDB /* testMutex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testMutex; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testMutex.cpp; path = ../tests/testMutex.cpp; sourceTree = SOURCE_ROOT; };
+		4BFA828C0DF6A9E40087B4E1 /* jack_evmon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_evmon; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_bufsize; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA82AB0DF6A9E40087B4E1 /* jack_rec */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_rec; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA82B70DF6A9E40087B4E1 /* jack_monitor_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_monitor_client; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA82C30DF6A9E40087B4E1 /* jack_showtime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_showtime; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_impulse_grabber; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA99A20AAAF3B0009E916C /* jdelay */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jdelay; sourceTree = BUILT_PRODUCTS_DIR; };
+		4BFA99A90AAAF40C009E916C /* jdelay.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = jdelay.cpp; path = ../tests/jdelay.cpp; sourceTree = SOURCE_ROOT; };
+		4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachServerNotifyChannel.cpp; sourceTree = "<group>"; };
+		4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachServerChannel.h; sourceTree = "<group>"; };
+		4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachServerChannel.cpp; sourceTree = "<group>"; };
+		4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachServerNotifyChannel.h; sourceTree = "<group>"; };
+		4BFB298708AF450200D450D4 /* JackMachClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachClientChannel.h; sourceTree = "<group>"; };
+		4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachNotifyChannel.cpp; sourceTree = "<group>"; };
+		4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachNotifyChannel.h; sourceTree = "<group>"; };
+		4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachClientChannel.cpp; sourceTree = SOURCE_ROOT; };
+		4BFB73F608AD291A00DB99B8 /* JackGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackGlobals.h; path = ../common/JackGlobals.h; sourceTree = SOURCE_ROOT; };
+		4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachThread.cpp; sourceTree = SOURCE_ROOT; };
+		4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachThread.h; sourceTree = SOURCE_ROOT; };
+		BA047C710E14E7540041F3B6 /* JackNetSocket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNetSocket.h; path = ../common/JackNetSocket.h; sourceTree = SOURCE_ROOT; };
+		BA222ACF0DC88132001A17F4 /* jack_net.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_net.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		BA222AD60DC88268001A17F4 /* JackNetTool.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetTool.cpp; path = ../common/JackNetTool.cpp; sourceTree = SOURCE_ROOT; };
+		BA222AD70DC88268001A17F4 /* JackNetTool.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNetTool.h; path = ../common/JackNetTool.h; sourceTree = SOURCE_ROOT; };
+		BA222ADC0DC882A5001A17F4 /* JackNetDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetDriver.cpp; path = ../common/JackNetDriver.cpp; sourceTree = SOURCE_ROOT; };
+		BA222ADD0DC882A5001A17F4 /* JackNetDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNetDriver.h; path = ../common/JackNetDriver.h; sourceTree = SOURCE_ROOT; };
+		BA222AE90DC882DB001A17F4 /* netmanager.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netmanager.so; sourceTree = BUILT_PRODUCTS_DIR; };
+		BA222AEB0DC883B3001A17F4 /* JackNetManager.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetManager.cpp; path = ../common/JackNetManager.cpp; sourceTree = SOURCE_ROOT; };
+		BA222AEC0DC883B3001A17F4 /* JackNetManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNetManager.h; path = ../common/JackNetManager.h; sourceTree = SOURCE_ROOT; };
+		C6859E8B029090EE04C91782 /* JackServer.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = JackServer.1; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		4B0A28E00D52073D002EFF74 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B0A29270D52108E002EFF74 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B19B2FB0E23620F00DD4A82 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B3224E010A3156800838A8E /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32252610A316B200838A8E /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32255B10A3187800838A8E /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32257510A3190C00838A8E /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C41F0D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C47E0D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BCC87980D57168300A7FEB1 /* Accelerate.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4F70D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BCC87990D57168300A7FEB1 /* Accelerate.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C50E0D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C51A0D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5260D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5320D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C53E0D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C54A0D4731D1000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5580D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5640D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5700D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5800D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA7BE0F0DC232A400AA3457 /* Jackservermp.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5940D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA7BE1A0DC2347500AA3457 /* Jackservermp.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5A00D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5AC0D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5B80D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5C40D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5D00D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5E40D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA7BE200DC234FB00AA3457 /* Jackservermp.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5F80D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA7BE240DC2350D00AA3457 /* Jackservermp.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C60C0D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA7BE270DC2352A00AA3457 /* Jackservermp.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6190D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6240D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C62F0D4731D2000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6390D4731D3000DE7AE /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363DD20DEB02F6001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E140DEB03C5001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E480DEB0775001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363EE30DEB091C001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F180DEB0A6A001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F2F0DEB0BD1001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F6C0DEB0D4E001F72D9 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B43A8B510145F6F00E52943 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B43A8E21014615800E52943 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B47ACD110B5890100469C67 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B47ACD210B5890100469C67 /* Accelerate.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BB50CD1CB9E0005BF74 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BD40CD1CCE10005BF74 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5E08D00E5B66EE00BEE4E0 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699BAB097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C42097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BCC87970D57168300A7FEB1 /* Accelerate.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CA7097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BCC87960D57168300A7FEB1 /* Accelerate.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CB5097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CC5097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CD5097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CE5097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CF7097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D07097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D1B097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D33097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D43097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D5B097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D73097D421600A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D8B097D421700A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D9C097D421700A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699DAB097D421700A18468 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B978DB60A31CF4A009E2DD1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA339A610B2E36800190E3B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA339A710B2E36800190E3B /* Accelerate.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692AA0CBE4BC700EAD520 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692CE0CBE4C9000EAD520 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA7FEBD0D8E76270017FF73 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BD623F20CBCF0F000DE782F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDB981001FB9C00B15929 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBC01001FCC000B15929 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBE31001FD2D00B15929 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBFA1001FD7300B15929 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDC201001FDE300B15929 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE6C69D0A3E096F005A203A /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE99D2A0AD7A04800C59091 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BF339070F8B864B0080FB5B /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA5E910DEC4D9C00FA4CDB /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82860DF6A9E40087B4E1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82990DF6A9E40087B4E1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82A50DF6A9E40087B4E1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82B10DF6A9E40087B4E1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82BD0DF6A9E40087B4E1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82C90DF6A9E40087B4E1 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA999C0AAAF3B0009E916C /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		BA222ACA0DC88132001A17F4 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		BA222AE40DC882DB001A17F4 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		0249A662FF388D9811CA2CEA /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				4BCC87950D57168300A7FEB1 /* Accelerate.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+		08FB7794FE84155DC02AAC07 /* JackServer */ = {
+			isa = PBXGroup;
+			children = (
+				08FB7795FE84155DC02AAC07 /* Source */,
+				C6859E8C029090F304C91782 /* Documentation */,
+				0249A662FF388D9811CA2CEA /* External Frameworks and Libraries */,
+				1AB674ADFE9D54B511CA2CBB /* Products */,
+				4B464301076CAC7700E5077C /* Jack-Info.plist */,
+			);
+			name = JackServer;
+			sourceTree = "<group>";
+		};
+		08FB7795FE84155DC02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A09D0DF72C6000840F4C /* Additional */,
+				4B6BEB4A07A6CCDC00A5DBDA /* Tests */,
+				4B37C20006DF1F900016E567 /* Latency */,
+				4B03383E0797E19900686131 /* Simple clients */,
+				4B765CC805ECE17900571F78 /* Tools */,
+				4BA550FC05E2421400569492 /* Shm */,
+				4BA33DF905EDFD8C000CCD5F /* Thread */,
+				4BA3874007947A46008D8992 /* Synchro */,
+				4BA550FF05E2423600569492 /* Channels */,
+				4BA550F605E241B800569492 /* Driver */,
+				4BA3873B079479C2008D8992 /* Graph */,
+				4BA550FA05E241F200569492 /* Ports */,
+				4BD56D74079687D7006D44F9 /* Client */,
+				4BA550FB05E2420000569492 /* Engine */,
+				4B9B627005E60A9E001E19AA /* Server */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		1AB674ADFE9D54B511CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				4B699BB1097D421600A18468 /* jackdmp */,
+				4B699C47097D421600A18468 /* Jackmp.framework */,
+				4B699CAC097D421600A18468 /* Jackservermp.framework */,
+				4B699CBB097D421600A18468 /* jack_metro */,
+				4B699CCB097D421600A18468 /* jack_lsp */,
+				4B699CDB097D421600A18468 /* jack_connect */,
+				4B699CEB097D421600A18468 /* jack_disconnect */,
+				4B699CFD097D421600A18468 /* jack_freewheel */,
+				4B699D0D097D421600A18468 /* jack_external_metro */,
+				4B699D21097D421600A18468 /* testAtomic */,
+				4B699D39097D421600A18468 /* testSem */,
+				4B699D49097D421600A18468 /* zombie */,
+				4B699D61097D421600A18468 /* synchroServer */,
+				4B699D79097D421600A18468 /* synchroClient */,
+				4B699D91097D421700A18468 /* synchroServerClient */,
+				4B699DA1097D421700A18468 /* jack_coreaudio.so */,
+				4B699DB0097D421700A18468 /* jack_dummy.so */,
+				4B978DBB0A31CF4A009E2DD1 /* jack_portaudio.so */,
+				4BE6C6A30A3E096F005A203A /* jack_test */,
+				4BFA99A20AAAF3B0009E916C /* jdelay */,
+				4BE99D300AD7A04800C59091 /* jack_cpu */,
+				4BD623F70CBCF0F000DE782F /* inprocess.so */,
+				4BA692B00CBE4BC700EAD520 /* jack_load */,
+				4BA692D40CBE4C9000EAD520 /* jack_unload */,
+				4B5A1BBB0CD1CB9E0005BF74 /* jack_midiseq */,
+				4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */,
+				4B35C4250D4731D1000DE7AE /* jackdmp */,
+				4B35C4830D4731D1000DE7AE /* Jackmp.framework */,
+				4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */,
+				4B35C5140D4731D1000DE7AE /* jack_midiseq */,
+				4B35C5200D4731D1000DE7AE /* jack_midisine */,
+				4B35C52C0D4731D1000DE7AE /* jack_metro */,
+				4B35C5380D4731D1000DE7AE /* jack_lsp */,
+				4B35C5440D4731D1000DE7AE /* jack_connect */,
+				4B35C5500D4731D1000DE7AE /* jack_disconnect */,
+				4B35C55E0D4731D2000DE7AE /* jack_freewheel */,
+				4B35C56A0D4731D2000DE7AE /* jdelay */,
+				4B35C5760D4731D2000DE7AE /* jack_external_metro */,
+				4B35C5860D4731D2000DE7AE /* testAtomic */,
+				4B35C59A0D4731D2000DE7AE /* testSem */,
+				4B35C5A60D4731D2000DE7AE /* zombie */,
+				4B35C5B20D4731D2000DE7AE /* jack_test */,
+				4B35C5BE0D4731D2000DE7AE /* jack_cpu */,
+				4B35C5CA0D4731D2000DE7AE /* jack_load */,
+				4B35C5D60D4731D2000DE7AE /* jack_unload */,
+				4B35C5EA0D4731D2000DE7AE /* synchroServer */,
+				4B35C5FE0D4731D2000DE7AE /* synchroClient */,
+				4B35C6120D4731D2000DE7AE /* synchroServerClient */,
+				4B35C61E0D4731D2000DE7AE /* jack_coreaudio.so */,
+				4B35C6290D4731D2000DE7AE /* jack_portaudio.so */,
+				4B35C6340D4731D2000DE7AE /* jack_dummy.so */,
+				4B35C63E0D4731D3000DE7AE /* inprocess.so */,
+				4B0A28E60D52073D002EFF74 /* jack_thread_wait */,
+				4B0A292D0D52108E002EFF74 /* jack_thread_wait */,
+				4B57F5950D72C27900B4E719 /* jack_thread_wait */,
+				4BA7FEC30D8E76270017FF73 /* jack_server_control */,
+				BA222ACF0DC88132001A17F4 /* jack_net.so */,
+				BA222AE90DC882DB001A17F4 /* netmanager.so */,
+				4BA7FEC30D8E76270017FF73 /* jack_server_control */,
+				4B363DD80DEB02F6001F72D9 /* jack_alias */,
+				4B363E1A0DEB03C5001F72D9 /* jack_evmon */,
+				4B363E4E0DEB0775001F72D9 /* jack_bufsize */,
+				4B363EE90DEB091C001F72D9 /* jack_rec */,
+				4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */,
+				4B363F350DEB0BD1001F72D9 /* jack_showtime */,
+				4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */,
+				4BFA5E980DEC4D9C00FA4CDB /* testMutex */,
+				4BFA828C0DF6A9E40087B4E1 /* jack_evmon */,
+				4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */,
+				4BFA82AB0DF6A9E40087B4E1 /* jack_rec */,
+				4BFA82B70DF6A9E40087B4E1 /* jack_monitor_client */,
+				4BFA82C30DF6A9E40087B4E1 /* jack_showtime */,
+				4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */,
+				4B19B3000E23620F00DD4A82 /* audioadapter.so */,
+				4B5E08D50E5B66EE00BEE4E0 /* netadapter.so */,
+				4BF3390C0F8B864B0080FB5B /* jack_coremidi.so */,
+				4BDCDB9D1001FB9C00B15929 /* jack_coremidi.so */,
+				4BDCDBC51001FCC000B15929 /* jack_net.so */,
+				4BDCDBE81001FD2D00B15929 /* netmanager.so */,
+				4BDCDBFF1001FD7300B15929 /* audioadapter.so */,
+				4BDCDC251001FDE300B15929 /* netadapter.so */,
+				4B43A8BA10145F6F00E52943 /* jack_loopback.so */,
+				4B43A8E71014615800E52943 /* jack_loopback.so */,
+				4B3224E510A3156800838A8E /* jack_netone.so */,
+				4B32252B10A316B200838A8E /* jack_netone.so */,
+				4B32256110A3187800838A8E /* jack_netsource */,
+				4B32257B10A3190C00838A8E /* jack_netsource */,
+				4BA339AC10B2E36800190E3B /* Jackservermp.framework */,
+				4B47ACD710B5890100469C67 /* Jackmp.framework */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		4B03383E0797E19900686131 /* Simple clients */ = {
+			isa = PBXGroup;
+			children = (
+				4B363F750DEB0D7D001F72D9 /* impulse_grabber.c */,
+				4B363F220DEB0AB0001F72D9 /* monitor_client.c */,
+				4B363EED0DEB094B001F72D9 /* capture_client.c */,
+				4B363E710DEB0808001F72D9 /* bufsize.c */,
+				4B363E200DEB0401001F72D9 /* evmon.c */,
+				4B363DDE0DEB034E001F72D9 /* alias.c */,
+				4BA7FEC80D8E76650017FF73 /* control.c */,
+				4B0A28EC0D520852002EFF74 /* tw.c */,
+				4B5A1BDC0CD1CD420005BF74 /* midisine.c */,
+				4B5A1BBD0CD1CC110005BF74 /* midiseq.c */,
+				4BA692D60CBE4CC600EAD520 /* ipunload.c */,
+				4BA692B20CBE4C2D00EAD520 /* ipload.c */,
+				4BD6240C0CBCF16600DE782F /* inprocess.c */,
+				4B60CE480AAABA31004956AA /* connect.c */,
+				4BF8D1670834EDD900C94B91 /* zombie.c */,
+				4BF8D1690834EDE600C94B91 /* lsp.c */,
+				4BF8D16B0834EDF000C94B91 /* metro.c */,
+				4BF8D1710834EE0F00C94B91 /* freewheel.c */,
+				4B363F3D0DEB0C31001F72D9 /* showtime.c */,
+			);
+			name = "Simple clients";
+			sourceTree = "<group>";
+		};
+		4B05A0420DF72B8500840F4C /* Linux */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A04C0DF72BC000840F4C /* alsa */,
+				4B05A07D0DF72BC000840F4C /* driver.h */,
+				4B05A07E0DF72BC000840F4C /* firewire */,
+				4B05A0820DF72BC000840F4C /* freebob */,
+			);
+			name = Linux;
+			sourceTree = "<group>";
+		};
+		4B05A04C0DF72BC000840F4C /* alsa */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A04D0DF72BC000840F4C /* alsa_driver.h */,
+				4B05A04E0DF72BC000840F4C /* alsa_midi.h */,
+				4B05A04F0DF72BC000840F4C /* alsa_midi_impl.h */,
+				4B05A0500DF72BC000840F4C /* alsa_midi_jackmp.cpp */,
+				4B05A0510DF72BC000840F4C /* alsa_rawmidi.c */,
+				4B05A0520DF72BC000840F4C /* alsa_seqmidi.c */,
+				4B05A0530DF72BC000840F4C /* bitset.h */,
+				4B05A0540DF72BC000840F4C /* generic.h */,
+				4B05A0550DF72BC000840F4C /* generic_hw.c */,
+				4B05A0560DF72BC000840F4C /* hammerfall.c */,
+				4B05A0570DF72BC000840F4C /* hammerfall.h */,
+				4B05A0580DF72BC000840F4C /* hardware.h */,
+				4B05A0590DF72BC000840F4C /* hdsp.c */,
+				4B05A05A0DF72BC000840F4C /* hdsp.h */,
+				4B05A05B0DF72BC000840F4C /* ice1712.c */,
+				4B05A05C0DF72BC000840F4C /* ice1712.h */,
+				4B05A05D0DF72BC000840F4C /* JackAlsaDriver.cpp */,
+				4B05A05E0DF72BC000840F4C /* JackAlsaDriver.h */,
+				4B05A05F0DF72BC000840F4C /* jslist.h */,
+				4B05A0620DF72BC000840F4C /* midi_pack.h */,
+				4B05A0630DF72BC000840F4C /* midi_unpack.h */,
+				4B05A0640DF72BC000840F4C /* usx2y.c */,
+				4B05A0650DF72BC000840F4C /* usx2y.h */,
+			);
+			name = alsa;
+			path = ../linux/alsa;
+			sourceTree = SOURCE_ROOT;
+		};
+		4B05A07E0DF72BC000840F4C /* firewire */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A07F0DF72BC000840F4C /* ffado_driver.h */,
+				4B05A0800DF72BC000840F4C /* JackFFADODriver.cpp */,
+				4B05A0810DF72BC000840F4C /* JackFFADODriver.h */,
+			);
+			name = firewire;
+			path = ../linux/firewire;
+			sourceTree = SOURCE_ROOT;
+		};
+		4B05A0820DF72BC000840F4C /* freebob */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A0830DF72BC000840F4C /* freebob_driver.h */,
+				4B05A0840DF72BC000840F4C /* JackFreebobDriver.cpp */,
+				4B05A0850DF72BC000840F4C /* JackFreebobDriver.h */,
+			);
+			name = freebob;
+			path = ../linux/freebob;
+			sourceTree = SOURCE_ROOT;
+		};
+		4B05A08A0DF72BF600840F4C /* Windows */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A08B0DF72C3200840F4C /* JackWinEvent.cpp */,
+				4B05A08C0DF72C3200840F4C /* JackWinEvent.h */,
+				4B05A08D0DF72C3200840F4C /* JackWinNamedPipe.cpp */,
+				4B05A08E0DF72C3200840F4C /* JackWinNamedPipe.h */,
+				4B05A08F0DF72C3200840F4C /* JackWinNamedPipeClientChannel.cpp */,
+				4B05A0900DF72C3200840F4C /* JackWinNamedPipeClientChannel.h */,
+				4B05A0910DF72C3200840F4C /* JackWinNamedPipeNotifyChannel.cpp */,
+				4B05A0920DF72C3200840F4C /* JackWinNamedPipeNotifyChannel.h */,
+				4B05A0930DF72C3200840F4C /* JackWinNamedPipeServerChannel.cpp */,
+				4B05A0940DF72C3200840F4C /* JackWinNamedPipeServerChannel.h */,
+				4B05A0950DF72C3200840F4C /* JackWinNamedPipeServerNotifyChannel.cpp */,
+				4B05A0960DF72C3200840F4C /* JackWinNamedPipeServerNotifyChannel.h */,
+				4B05A0970DF72C3200840F4C /* JackWinProcessSync.cpp */,
+				4B05A0980DF72C3200840F4C /* JackWinProcessSync.h */,
+				4B05A0990DF72C3200840F4C /* JackWinSemaphore.cpp */,
+				4B05A09A0DF72C3200840F4C /* JackWinSemaphore.h */,
+				4B05A09B0DF72C3200840F4C /* JackWinThread.cpp */,
+				4B05A09C0DF72C3200840F4C /* JackWinThread.h */,
+			);
+			name = Windows;
+			sourceTree = "<group>";
+		};
+		4B05A09D0DF72C6000840F4C /* Additional */ = {
+			isa = PBXGroup;
+			children = (
+				4B05A08A0DF72BF600840F4C /* Windows */,
+				4B05A0420DF72B8500840F4C /* Linux */,
+			);
+			name = Additional;
+			sourceTree = "<group>";
+		};
+		4B168CA3076A5319005B2802 /* MIG_RPC */ = {
+			isa = PBXGroup;
+			children = (
+				4B89B759076B731100D170DE /* JackRPCClientUser.c */,
+				4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */,
+			);
+			name = MIG_RPC;
+			sourceTree = "<group>";
+		};
+		4B168CA4076A5333005B2802 /* MIG_RPC */ = {
+			isa = PBXGroup;
+			children = (
+				4B89B769076B74D200D170DE /* JackRPCEngineUser.c */,
+				4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */,
+			);
+			name = MIG_RPC;
+			sourceTree = "<group>";
+		};
+		4B19B3010E23629800DD4A82 /* Adapter */ = {
+			isa = PBXGroup;
+			children = (
+				4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */,
+				4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */,
+				4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */,
+				4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */,
+				4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */,
+				4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */,
+				4B19B3090E2362E700DD4A82 /* JackAudioAdapterInterface.h */,
+				4B19B30C0E2362E700DD4A82 /* JackException.h */,
+				4B19B30E0E2362E700DD4A82 /* JackLibSampleRateResampler.cpp */,
+				4B19B30F0E2362E700DD4A82 /* JackLibSampleRateResampler.h */,
+				4B19B3120E2362E700DD4A82 /* JackResampler.cpp */,
+			);
+			name = Adapter;
+			sourceTree = "<group>";
+		};
+		4B37C20006DF1F900016E567 /* Latency */ = {
+			isa = PBXGroup;
+			children = (
+				4B37C20906DF1FE20016E567 /* latency.c */,
+				4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */,
+				4B37C20406DF1FBE0016E567 /* CALatencyLog.h */,
+			);
+			name = Latency;
+			sourceTree = "<group>";
+		};
+		4B6BEB4A07A6CCDC00A5DBDA /* Tests */ = {
+			isa = PBXGroup;
+			children = (
+				4B3F49070AD8503300491C6E /* cpu.c */,
+				4BFA99A90AAAF40C009E916C /* jdelay.cpp */,
+				4BF8D23E0834F1C300C94B91 /* testAtomic.cpp */,
+				4BF8D2470834F20600C94B91 /* testSem.cpp */,
+				4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */,
+				4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */,
+				4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */,
+				4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */,
+				4BE6C6AC0A3E0A65005A203A /* test.cpp */,
+			);
+			name = Tests;
+			sourceTree = "<group>";
+		};
+		4B6C73780CC60A6D001AFFD4 /* jack */ = {
+			isa = PBXGroup;
+			children = (
+				4B94334910A5E666002A187F /* systemdeps.h */,
+				4B9A26000DBF8584006E9FBC /* jslist.h */,
+				4B95BCAD0D913073000F7695 /* control.h */,
+				4B6B9EF50CD0958B0051EE5A /* midiport.h */,
+				4B6C73790CC60A6D001AFFD4 /* intclient.h */,
+				4B6C737A0CC60A6D001AFFD4 /* jack.h */,
+				4B6C737B0CC60A6D001AFFD4 /* ringbuffer.h */,
+				4B6C737C0CC60A6D001AFFD4 /* statistics.h */,
+				4B6C737D0CC60A6D001AFFD4 /* thread.h */,
+				4B6C737E0CC60A6D001AFFD4 /* transport.h */,
+				4B6C737F0CC60A6D001AFFD4 /* types.h */,
+			);
+			name = jack;
+			path = ../common/jack;
+			sourceTree = SOURCE_ROOT;
+		};
+		4B765CC805ECE17900571F78 /* Tools */ = {
+			isa = PBXGroup;
+			children = (
+				4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */,
+				4BF284170F31B4BC00B05BE3 /* JackArgParser.h */,
+				4BF5FBC80E878D24003D2374 /* JackMachTime.c */,
+				4B4F9C8A0DC20C0400706CB0 /* JackMessageBuffer.cpp */,
+				4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */,
+				4B9A25B30DBF8330006E9FBC /* JackError.cpp */,
+				4B003AB008E2B2BA0060EFDC /* ringbuffer.c */,
+				4BF8D1770834EE4800C94B91 /* JackError.h */,
+				4BF8D1830834EE5800C94B91 /* JackTime.h */,
+			);
+			name = Tools;
+			sourceTree = "<group>";
+		};
+		4B9B627005E60A9E001E19AA /* Server */ = {
+			isa = PBXGroup;
+			children = (
+				4B6C73780CC60A6D001AFFD4 /* jack */,
+				4BE4CC000CDA153400CCF5BB /* JackTools.h */,
+				4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */,
+				4B4E9AF80E5F1090000A3278 /* JackControlAPI.cpp */,
+				4B4E9AF90E5F1090000A3278 /* JackControlAPI.h */,
+				4B66A8580934964500A89560 /* JackConstants.h */,
+				4BFB73F608AD291A00DB99B8 /* JackGlobals.h */,
+				4B2C28F908DAD01E00249230 /* JackGlobals.cpp */,
+				4BF8D2190834F03D00C94B91 /* JackEngineControl.h */,
+				4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */,
+				4BBAE40E0F42FA6100B8BD3F /* JackEngineProfiling.h */,
+				4BBAE40F0F42FA6100B8BD3F /* JackEngineProfiling.cpp */,
+				4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */,
+				4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */,
+				4BF8D2220834F05C00C94B91 /* JackServer.h */,
+				4BF8D2210834F05C00C94B91 /* JackServer.cpp */,
+				4BF8D2250834F06A00C94B91 /* Jackdmp.cpp */,
+				4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */,
+				4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */,
+			);
+			name = Server;
+			sourceTree = "<group>";
+		};
+		4BA33DF905EDFD8C000CCD5F /* Thread */ = {
+			isa = PBXGroup;
+			children = (
+				4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */,
+				4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */,
+				4BF8D19F0834EE9E00C94B91 /* JackThread.h */,
+				4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */,
+				4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */,
+			);
+			name = Thread;
+			sourceTree = "<group>";
+		};
+		4BA3873B079479C2008D8992 /* Graph */ = {
+			isa = PBXGroup;
+			children = (
+				4BF772FD08B3330F00149912 /* JackAtomic.h */,
+				4BF8D1C10834EF0800C94B91 /* JackAtomicState.h */,
+				4BF8D1C30834EF1400C94B91 /* JackConnectionManager.h */,
+				4BF8D1C40834EF1400C94B91 /* JackConnectionManager.cpp */,
+				4BF8D1C70834EF2200C94B91 /* JackGraphManager.h */,
+				4BF8D1C80834EF2200C94B91 /* JackGraphManager.cpp */,
+			);
+			name = Graph;
+			sourceTree = "<group>";
+		};
+		4BA3874007947A46008D8992 /* Synchro */ = {
+			isa = PBXGroup;
+			children = (
+				4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */,
+				4BECB2F40F4451C10091B70A /* JackProcessSync.h */,
+				4BC3B6B70E703BAA0066E42F /* JackPosixSemaphore.cpp */,
+				4BC3B6B80E703BAA0066E42F /* JackPosixSemaphore.h */,
+				4BD561C708EEB910006BBC2A /* JackSynchro.h */,
+				4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */,
+				4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */,
+				4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */,
+				4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */,
+				4BC8326D0DF42C7D00DD1C93 /* JackMutex.h */,
+			);
+			name = Synchro;
+			sourceTree = "<group>";
+		};
+		4BA550F605E241B800569492 /* Driver */ = {
+			isa = PBXGroup;
+			children = (
+				4B869B3D08C8D21C001CF041 /* driver_interface.h */,
+				4B43A8C91014605000E52943 /* JackLoopbackDriver.h */,
+				4B43A8C81014605000E52943 /* JackLoopbackDriver.cpp */,
+				4B869B4208C8D22F001CF041 /* JackDriverLoader.h */,
+				4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */,
+				4BF8D1B50834EEE400C94B91 /* JackDriver.h */,
+				4BF8D1B60834EEE400C94B91 /* JackDriver.cpp */,
+				4BC3988A08B3CF6C00B6F371 /* JackDummyDriver.h */,
+				4BC3988908B3CF6C00B6F371 /* JackDummyDriver.cpp */,
+				4BF3390D0F8B86AF0080FB5B /* MIDI */,
+				4B19B3010E23629800DD4A82 /* Adapter */,
+				BA222AEA0DC88379001A17F4 /* Net */,
+				4BD56D8707968982006D44F9 /* Threaded */,
+				4BD56D8607968979006D44F9 /* Audio */,
+			);
+			name = Driver;
+			sourceTree = "<group>";
+		};
+		4BA550F905E241D900569492 /* Library */ = {
+			isa = PBXGroup;
+			children = (
+				4B168CA4076A5333005B2802 /* MIG_RPC */,
+				4BF8D1FB0834EFD100C94B91 /* JackLibGlobals.h */,
+				4BF8D1FC0834EFD100C94B91 /* JackLibClient.h */,
+				4BF8D1FD0834EFD100C94B91 /* JackLibClient.cpp */,
+				4BF8D1FE0834EFD100C94B91 /* JackLibAPI.cpp */,
+			);
+			name = Library;
+			sourceTree = "<group>";
+		};
+		4BA550FA05E241F200569492 /* Ports */ = {
+			isa = PBXGroup;
+			children = (
+				4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */,
+				4B80D7E50BA0D17400F035BB /* JackMidiPort.h */,
+				4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */,
+				4BAB95B70B9E20B800A0C723 /* JackPortType.h */,
+				4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */,
+				4BF8D1CF0834EF2F00C94B91 /* JackPort.h */,
+				4BF8D1D00834EF2F00C94B91 /* JackPort.cpp */,
+			);
+			name = Ports;
+			sourceTree = "<group>";
+		};
+		4BA550FB05E2420000569492 /* Engine */ = {
+			isa = PBXGroup;
+			children = (
+				4B168CA3076A5319005B2802 /* MIG_RPC */,
+				4B5F253D0DEE9B8F0041E486 /* JackLockedEngine.h */,
+				4BF8D2130834F02800C94B91 /* JackEngine.h */,
+				4BF8D2140834F02800C94B91 /* JackEngine.cpp */,
+				4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */,
+				4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */,
+			);
+			name = Engine;
+			sourceTree = "<group>";
+		};
+		4BA550FC05E2421400569492 /* Shm */ = {
+			isa = PBXGroup;
+			children = (
+				4BF8D18F0834EE8400C94B91 /* shm.h */,
+				4BF8D1900834EE8400C94B91 /* shm.c */,
+				4BF8D1870834EE7900C94B91 /* JackShmMem.h */,
+				4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */,
+			);
+			name = Shm;
+			sourceTree = "<group>";
+		};
+		4BA550FF05E2423600569492 /* Channels */ = {
+			isa = PBXGroup;
+			children = (
+				4BF8D1AF0834EEC400C94B91 /* JackChannel.h */,
+				4BB371D40C1AD85A0050C1E4 /* JackNotification.h */,
+				4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */,
+				4BFB299908AF452300D450D4 /* Socket */,
+				4BFB299808AF451200D450D4 /* Mach */,
+			);
+			name = Channels;
+			sourceTree = "<group>";
+		};
+		4BD56D73079687AD006D44F9 /* External */ = {
+			isa = PBXGroup;
+			children = (
+				4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */,
+				4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */,
+			);
+			name = External;
+			sourceTree = "<group>";
+		};
+		4BD56D74079687D7006D44F9 /* Client */ = {
+			isa = PBXGroup;
+			children = (
+				4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */,
+				4BF8D1D90834EF4500C94B91 /* JackClientInterface.h */,
+				4BF8D1DD0834EF4D00C94B91 /* JackClientControl.h */,
+				4BF8D1E10834EF5500C94B91 /* JackClient.h */,
+				4BF8D1E50834EF6700C94B91 /* JackClient.cpp */,
+				4B98AE010931D30C0091932A /* JackDebugClient.h */,
+				4B98AE000931D30C0091932A /* JackDebugClient.cpp */,
+				4BF8D1E90834EF7500C94B91 /* JackAPI.cpp */,
+				4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */,
+				4BF520580CB8D1010037470E /* timestamps.h */,
+				4BF520520CB8D0E80037470E /* timestamps.c */,
+				4BD56D75079687EB006D44F9 /* Internal  */,
+				4BD56D73079687AD006D44F9 /* External */,
+				4BA550F905E241D900569492 /* Library */,
+			);
+			name = Client;
+			sourceTree = "<group>";
+		};
+		4BD56D75079687EB006D44F9 /* Internal  */ = {
+			isa = PBXGroup;
+			children = (
+				4BF8D1EE0834EF9200C94B91 /* JackInternalClient.h */,
+				4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */,
+				4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */,
+			);
+			name = "Internal ";
+			sourceTree = "<group>";
+		};
+		4BD56D8607968979006D44F9 /* Audio */ = {
+			isa = PBXGroup;
+			children = (
+				4BBB00CF0E72614F0018AB1B /* JackPortAudioDevices.cpp */,
+				4BBB00D00E72614F0018AB1B /* JackPortAudioDevices.h */,
+				4BBB00D10E72614F0018AB1B /* JackPortAudioDriver.cpp */,
+				4BBB00D20E72614F0018AB1B /* JackPortAudioDriver.h */,
+				4BE5FECB0E725C090020B576 /* JackCoreAudioDriver.cpp */,
+				4BE5FECC0E725C090020B576 /* JackCoreAudioDriver.h */,
+				4B940B9B06DDDE5B00D77F60 /* AudioHardware.h */,
+				4BF8D2290834F07D00C94B91 /* JackAudioDriver.h */,
+				4BF8D22A0834F07D00C94B91 /* JackAudioDriver.cpp */,
+			);
+			name = Audio;
+			sourceTree = "<group>";
+		};
+		4BD56D8707968982006D44F9 /* Threaded */ = {
+			isa = PBXGroup;
+			children = (
+				4BF8D1BD0834EEFC00C94B91 /* JackThreadedDriver.h */,
+				4BF8D1BE0834EEFC00C94B91 /* JackThreadedDriver.cpp */,
+				4BF8D1B90834EEF100C94B91 /* JackFreewheelDriver.h */,
+				4BF8D1BA0834EEF100C94B91 /* JackFreewheelDriver.cpp */,
+				4B4CA9730E02CF9600F4BFDA /* JackRestartThreadedDriver.h */,
+				4B4CA9740E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp */,
+				4BBC93B90DF9736C002DF220 /* JackWaitThreadedDriver.h */,
+				4BBC93B80DF9736C002DF220 /* JackWaitThreadedDriver.cpp */,
+			);
+			name = Threaded;
+			sourceTree = "<group>";
+		};
+		4BF3390D0F8B86AF0080FB5B /* MIDI */ = {
+			isa = PBXGroup;
+			children = (
+				4BCBCE5910C4FE3F00450FFE /* JackPhysicalMidiInput.cpp */,
+				4BCBCE5A10C4FE3F00450FFE /* JackPhysicalMidiInput.h */,
+				4BCBCE5B10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp */,
+				4BCBCE5C10C4FE3F00450FFE /* JackPhysicalMidiOutput.h */,
+				4BF3391F0F8B873E0080FB5B /* JackMidiDriver.cpp */,
+				4BF339200F8B873E0080FB5B /* JackMidiDriver.h */,
+				4BF339140F8B86DC0080FB5B /* JackCoreMidiDriver.h */,
+				4BF339150F8B86DC0080FB5B /* JackCoreMidiDriver.cpp */,
+			);
+			name = MIDI;
+			sourceTree = "<group>";
+		};
+		4BFB299808AF451200D450D4 /* Mach */ = {
+			isa = PBXGroup;
+			children = (
+				4B799AD707899652003F3F15 /* JackMachPort.h */,
+				4B799AD607899652003F3F15 /* JackMachPort.cpp */,
+				4BFB298708AF450200D450D4 /* JackMachClientChannel.h */,
+				4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */,
+				4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */,
+				4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */,
+				4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */,
+				4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */,
+				4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */,
+				4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */,
+			);
+			name = Mach;
+			sourceTree = "<group>";
+		};
+		4BFB299908AF452300D450D4 /* Socket */ = {
+			isa = PBXGroup;
+			children = (
+				4BC3B6AD0E703B8D0066E42F /* JackSocket.cpp */,
+				4BC3B6AE0E703B8D0066E42F /* JackSocket.h */,
+				4BC3B6AF0E703B8D0066E42F /* JackSocketClientChannel.cpp */,
+				4BC3B6B00E703B8D0066E42F /* JackSocketClientChannel.h */,
+				4BC3B6B10E703B8D0066E42F /* JackSocketNotifyChannel.cpp */,
+				4BC3B6B20E703B8D0066E42F /* JackSocketNotifyChannel.h */,
+				4BC3B6B30E703B8D0066E42F /* JackSocketServerChannel.cpp */,
+				4BC3B6B40E703B8D0066E42F /* JackSocketServerChannel.h */,
+				4BC3B6B50E703B8D0066E42F /* JackSocketServerNotifyChannel.cpp */,
+				4BC3B6B60E703B8D0066E42F /* JackSocketServerNotifyChannel.h */,
+			);
+			name = Socket;
+			sourceTree = "<group>";
+		};
+		BA222AEA0DC88379001A17F4 /* Net */ = {
+			isa = PBXGroup;
+			children = (
+				4B32256310A318E300838A8E /* netsource.c */,
+				4B3224EC10A315C400838A8E /* netjack_packet.c */,
+				4B3224ED10A315C400838A8E /* netjack_packet.h */,
+				4B3224EE10A315C400838A8E /* netjack.c */,
+				4B3224EF10A315C400838A8E /* netjack.h */,
+				4B3224E810A315B100838A8E /* JackNetOneDriver.cpp */,
+				4B3224E910A315B100838A8E /* JackNetOneDriver.h */,
+				4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */,
+				4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */,
+				4B5E08DF0E5B676C00BEE4E0 /* JackNetAdapter.cpp */,
+				4B5E08E00E5B676C00BEE4E0 /* JackNetAdapter.h */,
+				4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */,
+				4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */,
+				BA222ADD0DC882A5001A17F4 /* JackNetDriver.h */,
+				BA222ADC0DC882A5001A17F4 /* JackNetDriver.cpp */,
+				BA047C710E14E7540041F3B6 /* JackNetSocket.h */,
+				BA222AEB0DC883B3001A17F4 /* JackNetManager.cpp */,
+				BA222AEC0DC883B3001A17F4 /* JackNetManager.h */,
+				BA222AD60DC88268001A17F4 /* JackNetTool.cpp */,
+				BA222AD70DC88268001A17F4 /* JackNetTool.h */,
+			);
+			name = Net;
+			sourceTree = "<group>";
+		};
+		C6859E8C029090F304C91782 /* Documentation */ = {
+			isa = PBXGroup;
+			children = (
+				C6859E8B029090EE04C91782 /* JackServer.1 */,
+			);
+			name = Documentation;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		4B0A28DD0D52073D002EFF74 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B0A29240D52108E002EFF74 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B19B2F70E23620F00DD4A82 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B19B3140E2362E800DD4A82 /* JackAudioAdapter.h in Headers */,
+				4B19B3160E2362E800DD4A82 /* JackAudioAdapterInterface.h in Headers */,
+				4B19B3190E2362E800DD4A82 /* JackException.h in Headers */,
+				4B19B31C0E2362E800DD4A82 /* JackLibSampleRateResampler.h in Headers */,
+				4BE5FED20E725C320020B576 /* JackCoreAudioAdapter.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B3224D810A3156800838A8E /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B3224EB10A315B100838A8E /* JackNetOneDriver.h in Headers */,
+				4B3224F110A315C400838A8E /* netjack_packet.h in Headers */,
+				4B3224F310A315C400838A8E /* netjack.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32251E10A316B200838A8E /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B32253210A3173A00838A8E /* JackNetOneDriver.h in Headers */,
+				4B32253410A3173C00838A8E /* netjack.h in Headers */,
+				4B32253610A3173E00838A8E /* netjack_packet.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32255810A3187800838A8E /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B32256C10A318FB00838A8E /* netjack.h in Headers */,
+				4B32256E10A318FD00838A8E /* netjack_packet.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32257210A3190C00838A8E /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B32257E10A3195800838A8E /* netjack.h in Headers */,
+				4B32258010A3195A00838A8E /* netjack_packet.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C41C0D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B9A26040DBF8584006E9FBC /* jslist.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4280D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C4290D4731D1000DE7AE /* JackMachPort.h in Headers */,
+				4B35C42A0D4731D1000DE7AE /* JackError.h in Headers */,
+				4B35C42B0D4731D1000DE7AE /* JackTime.h in Headers */,
+				4B35C42C0D4731D1000DE7AE /* JackShmMem.h in Headers */,
+				4B35C42D0D4731D1000DE7AE /* shm.h in Headers */,
+				4B35C42F0D4731D1000DE7AE /* JackThread.h in Headers */,
+				4B35C4300D4731D1000DE7AE /* JackActivationCount.h in Headers */,
+				4B35C4310D4731D1000DE7AE /* JackChannel.h in Headers */,
+				4B35C4320D4731D1000DE7AE /* JackGraphManager.h in Headers */,
+				4B35C4330D4731D1000DE7AE /* JackPort.h in Headers */,
+				4B35C4340D4731D1000DE7AE /* JackClientInterface.h in Headers */,
+				4B35C4350D4731D1000DE7AE /* JackClientControl.h in Headers */,
+				4B35C4360D4731D1000DE7AE /* JackClient.h in Headers */,
+				4B35C4370D4731D1000DE7AE /* JackInternalClient.h in Headers */,
+				4B35C4380D4731D1000DE7AE /* JackLibGlobals.h in Headers */,
+				4B35C4390D4731D1000DE7AE /* JackLibClient.h in Headers */,
+				4B35C43A0D4731D1000DE7AE /* JackConnectionManager.h in Headers */,
+				4B35C43B0D4731D1000DE7AE /* JackFrameTimer.h in Headers */,
+				4B35C43D0D4731D1000DE7AE /* JackMachSemaphore.h in Headers */,
+				4B35C43E0D4731D1000DE7AE /* JackGlobals.h in Headers */,
+				4B35C43F0D4731D1000DE7AE /* JackMachThread.h in Headers */,
+				4B35C4400D4731D1000DE7AE /* JackMachClientChannel.h in Headers */,
+				4B35C4460D4731D1000DE7AE /* JackSynchro.h in Headers */,
+				4B35C4470D4731D1000DE7AE /* JackDebugClient.h in Headers */,
+				4B35C4480D4731D1000DE7AE /* JackConstants.h in Headers */,
+				4B35C4490D4731D1000DE7AE /* JackTransportEngine.h in Headers */,
+				4B35C44A0D4731D1000DE7AE /* timestamps.h in Headers */,
+				4B35C44B0D4731D1000DE7AE /* intclient.h in Headers */,
+				4B35C44C0D4731D1000DE7AE /* jack.h in Headers */,
+				4B35C44D0D4731D1000DE7AE /* ringbuffer.h in Headers */,
+				4B35C44E0D4731D1000DE7AE /* statistics.h in Headers */,
+				4B35C44F0D4731D1000DE7AE /* thread.h in Headers */,
+				4B35C4500D4731D1000DE7AE /* transport.h in Headers */,
+				4B35C4510D4731D1000DE7AE /* types.h in Headers */,
+				4B35C4520D4731D1000DE7AE /* JackPortType.h in Headers */,
+				4B35C4530D4731D1000DE7AE /* JackMidiPort.h in Headers */,
+				4B35C4540D4731D1000DE7AE /* midiport.h in Headers */,
+				4B35C4550D4731D1000DE7AE /* JackTools.h in Headers */,
+				4B9A26050DBF8584006E9FBC /* jslist.h in Headers */,
+				4B4F9C910DC20C0400706CB0 /* JackMessageBuffer.h in Headers */,
+				4B93F19E0E87998400E4ECCD /* JackPosixThread.h in Headers */,
+				4BECB2FA0F4451C10091B70A /* JackProcessSync.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4860D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C4870D4731D1000DE7AE /* JackMachPort.h in Headers */,
+				4B35C4880D4731D1000DE7AE /* JackError.h in Headers */,
+				4B35C4890D4731D1000DE7AE /* JackTime.h in Headers */,
+				4B35C48A0D4731D1000DE7AE /* JackShmMem.h in Headers */,
+				4B35C48B0D4731D1000DE7AE /* shm.h in Headers */,
+				4B35C48D0D4731D1000DE7AE /* JackThread.h in Headers */,
+				4B35C48E0D4731D1000DE7AE /* JackActivationCount.h in Headers */,
+				4B35C48F0D4731D1000DE7AE /* JackChannel.h in Headers */,
+				4B35C4900D4731D1000DE7AE /* JackGraphManager.h in Headers */,
+				4B35C4910D4731D1000DE7AE /* JackPort.h in Headers */,
+				4B35C4920D4731D1000DE7AE /* JackClientInterface.h in Headers */,
+				4B35C4930D4731D1000DE7AE /* JackClientControl.h in Headers */,
+				4B35C4940D4731D1000DE7AE /* JackClient.h in Headers */,
+				4B35C4950D4731D1000DE7AE /* JackInternalClient.h in Headers */,
+				4B35C4960D4731D1000DE7AE /* JackConnectionManager.h in Headers */,
+				4B35C4970D4731D1000DE7AE /* JackFrameTimer.h in Headers */,
+				4B35C4990D4731D1000DE7AE /* JackMachSemaphore.h in Headers */,
+				4B35C49A0D4731D1000DE7AE /* JackGlobals.h in Headers */,
+				4B35C49B0D4731D1000DE7AE /* JackMachThread.h in Headers */,
+				4B35C4A00D4731D1000DE7AE /* JackSynchro.h in Headers */,
+				4B35C4A10D4731D1000DE7AE /* JackAudioDriver.h in Headers */,
+				4B35C4A20D4731D1000DE7AE /* JackFreewheelDriver.h in Headers */,
+				4B35C4A30D4731D1000DE7AE /* JackThreadedDriver.h in Headers */,
+				4B35C4A40D4731D1000DE7AE /* JackDriver.h in Headers */,
+				4B35C4A50D4731D1000DE7AE /* driver_interface.h in Headers */,
+				4B35C4A70D4731D1000DE7AE /* JackDriverLoader.h in Headers */,
+				4B35C4A90D4731D1000DE7AE /* JackEngine.h in Headers */,
+				4B35C4AA0D4731D1000DE7AE /* JackExternalClient.h in Headers */,
+				4B35C4AB0D4731D1000DE7AE /* JackServer.h in Headers */,
+				4B35C4AE0D4731D1000DE7AE /* JackMachNotifyChannel.h in Headers */,
+				4B35C4AF0D4731D1000DE7AE /* JackMachServerChannel.h in Headers */,
+				4B35C4B00D4731D1000DE7AE /* JackMachServerNotifyChannel.h in Headers */,
+				4B35C4B20D4731D1000DE7AE /* JackConstants.h in Headers */,
+				4B35C4B30D4731D1000DE7AE /* JackTransportEngine.h in Headers */,
+				4B35C4B40D4731D1000DE7AE /* JackServerGlobals.h in Headers */,
+				4B35C4B50D4731D1000DE7AE /* timestamps.h in Headers */,
+				4B35C4B60D4731D1000DE7AE /* jack.h in Headers */,
+				4B35C4B70D4731D1000DE7AE /* intclient.h in Headers */,
+				4B35C4B80D4731D1000DE7AE /* ringbuffer.h in Headers */,
+				4B35C4B90D4731D1000DE7AE /* statistics.h in Headers */,
+				4B35C4BA0D4731D1000DE7AE /* thread.h in Headers */,
+				4B35C4BB0D4731D1000DE7AE /* transport.h in Headers */,
+				4B35C4BC0D4731D1000DE7AE /* types.h in Headers */,
+				4B35C4BD0D4731D1000DE7AE /* JackPortType.h in Headers */,
+				4B35C4BE0D4731D1000DE7AE /* JackMidiPort.h in Headers */,
+				4B35C4BF0D4731D1000DE7AE /* midiport.h in Headers */,
+				4B35C4C00D4731D1000DE7AE /* JackDebugClient.h in Headers */,
+				4B35C4C10D4731D1000DE7AE /* JackTools.h in Headers */,
+				BA222ADB0DC88269001A17F4 /* JackNetTool.h in Headers */,
+				4B9A26060DBF8584006E9FBC /* jslist.h in Headers */,
+				4B4F9C930DC20C0400706CB0 /* JackMessageBuffer.h in Headers */,
+				4B4CA9770E02CF9600F4BFDA /* JackRestartThreadedDriver.h in Headers */,
+				4B4E9AFD0E5F1090000A3278 /* JackControlAPI.h in Headers */,
+				4B93F19A0E87992200E4ECCD /* JackPosixThread.h in Headers */,
+				4BBAE4120F42FA6100B8BD3F /* JackEngineProfiling.h in Headers */,
+				4BECB2FC0F4451C10091B70A /* JackProcessSync.h in Headers */,
+				4BF339220F8B873E0080FB5B /* JackMidiDriver.h in Headers */,
+				4BDCDBD21001FD0200B15929 /* JackWaitThreadedDriver.h in Headers */,
+				4BDCDC0A1001FDA800B15929 /* JackArgParser.h in Headers */,
+				4BCBCE6210C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */,
+				4BCBCE6410C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C50B0D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5170D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5230D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C52F0D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C53B0D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5470D4731D1000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5550D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5610D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C56D0D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5790D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5890D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C59D0D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5A90D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5B50D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5C10D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5CD0D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5D90D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5DA0D4731D2000DE7AE /* JackError.h in Headers */,
+				4B35C5DB0D4731D2000DE7AE /* JackConstants.h in Headers */,
+				4B4F9D830DC2178F00706CB0 /* JackMessageBuffer.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5ED0D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6010D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6150D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA4ADB50E87AB2600F26C85 /* JackCoreAudioDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6200D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C62B0D4731D2000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C62C0D4731D2000DE7AE /* JackDummyDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6360D4731D3000DE7AE /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363DCF0DEB02F6001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E110DEB03C5001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E450DEB0775001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363EE00DEB091C001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F150DEB0A6A001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F2C0DEB0BD1001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F690DEB0D4E001F72D9 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B43A8B110145F6F00E52943 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B43A8CB1014605000E52943 /* JackLoopbackDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B43A8DE1014615800E52943 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B43A8DF1014615800E52943 /* JackLoopbackDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B47AC8110B5890100469C67 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B47AC8210B5890100469C67 /* JackMachPort.h in Headers */,
+				4B47AC8310B5890100469C67 /* JackError.h in Headers */,
+				4B47AC8410B5890100469C67 /* JackTime.h in Headers */,
+				4B47AC8510B5890100469C67 /* JackShmMem.h in Headers */,
+				4B47AC8610B5890100469C67 /* shm.h in Headers */,
+				4B47AC8710B5890100469C67 /* JackThread.h in Headers */,
+				4B47AC8810B5890100469C67 /* JackActivationCount.h in Headers */,
+				4B47AC8910B5890100469C67 /* JackChannel.h in Headers */,
+				4B47AC8A10B5890100469C67 /* JackGraphManager.h in Headers */,
+				4B47AC8B10B5890100469C67 /* JackPort.h in Headers */,
+				4B47AC8C10B5890100469C67 /* JackClientInterface.h in Headers */,
+				4B47AC8D10B5890100469C67 /* JackClientControl.h in Headers */,
+				4B47AC8E10B5890100469C67 /* JackClient.h in Headers */,
+				4B47AC8F10B5890100469C67 /* JackInternalClient.h in Headers */,
+				4B47AC9010B5890100469C67 /* JackLibGlobals.h in Headers */,
+				4B47AC9110B5890100469C67 /* JackLibClient.h in Headers */,
+				4B47AC9210B5890100469C67 /* JackConnectionManager.h in Headers */,
+				4B47AC9310B5890100469C67 /* JackFrameTimer.h in Headers */,
+				4B47AC9410B5890100469C67 /* JackMachSemaphore.h in Headers */,
+				4B47AC9510B5890100469C67 /* JackGlobals.h in Headers */,
+				4B47AC9610B5890100469C67 /* JackMachThread.h in Headers */,
+				4B47AC9710B5890100469C67 /* JackMachClientChannel.h in Headers */,
+				4B47AC9810B5890100469C67 /* JackSynchro.h in Headers */,
+				4B47AC9910B5890100469C67 /* JackDebugClient.h in Headers */,
+				4B47AC9A10B5890100469C67 /* JackConstants.h in Headers */,
+				4B47AC9B10B5890100469C67 /* JackTransportEngine.h in Headers */,
+				4B47AC9C10B5890100469C67 /* timestamps.h in Headers */,
+				4B47AC9D10B5890100469C67 /* intclient.h in Headers */,
+				4B47AC9E10B5890100469C67 /* jack.h in Headers */,
+				4B47AC9F10B5890100469C67 /* ringbuffer.h in Headers */,
+				4B47ACA010B5890100469C67 /* statistics.h in Headers */,
+				4B47ACA110B5890100469C67 /* thread.h in Headers */,
+				4B47ACA210B5890100469C67 /* transport.h in Headers */,
+				4B47ACA310B5890100469C67 /* types.h in Headers */,
+				4B47ACA410B5890100469C67 /* JackPortType.h in Headers */,
+				4B47ACA510B5890100469C67 /* JackMidiPort.h in Headers */,
+				4B47ACA610B5890100469C67 /* midiport.h in Headers */,
+				4B47ACA710B5890100469C67 /* JackTools.h in Headers */,
+				4B47ACA810B5890100469C67 /* jslist.h in Headers */,
+				4B47ACA910B5890100469C67 /* JackMessageBuffer.h in Headers */,
+				4B47ACAA10B5890100469C67 /* JackPosixThread.h in Headers */,
+				4B47ACAB10B5890100469C67 /* JackProcessSync.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BB20CD1CB9E0005BF74 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BD10CD1CCE10005BF74 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5E08C00E5B66EE00BEE4E0 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B5E08C30E5B66EE00BEE4E0 /* JackAudioAdapterInterface.h in Headers */,
+				4B5E08C40E5B66EE00BEE4E0 /* JackException.h in Headers */,
+				4B5E08C60E5B66EE00BEE4E0 /* JackLibSampleRateResampler.h in Headers */,
+				4B5E08E20E5B676D00BEE4E0 /* JackNetAdapter.h in Headers */,
+				4B5E08EC0E5B67EB00BEE4E0 /* JackNetInterface.h in Headers */,
+				4B5E08EF0E5B680200BEE4E0 /* JackAudioAdapter.h in Headers */,
+				4BC3B6C00E703BCC0066E42F /* JackNetUnixSocket.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699BA8097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C01097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699C02097D421600A18468 /* JackMachPort.h in Headers */,
+				4B699C03097D421600A18468 /* JackError.h in Headers */,
+				4B699C04097D421600A18468 /* JackTime.h in Headers */,
+				4B699C05097D421600A18468 /* JackShmMem.h in Headers */,
+				4B699C06097D421600A18468 /* shm.h in Headers */,
+				4B699C08097D421600A18468 /* JackThread.h in Headers */,
+				4B699C09097D421600A18468 /* JackActivationCount.h in Headers */,
+				4B699C0A097D421600A18468 /* JackChannel.h in Headers */,
+				4B699C0B097D421600A18468 /* JackGraphManager.h in Headers */,
+				4B699C0C097D421600A18468 /* JackPort.h in Headers */,
+				4B699C0D097D421600A18468 /* JackClientInterface.h in Headers */,
+				4B699C0E097D421600A18468 /* JackClientControl.h in Headers */,
+				4B699C0F097D421600A18468 /* JackClient.h in Headers */,
+				4B699C10097D421600A18468 /* JackInternalClient.h in Headers */,
+				4B699C11097D421600A18468 /* JackLibGlobals.h in Headers */,
+				4B699C12097D421600A18468 /* JackLibClient.h in Headers */,
+				4B699C13097D421600A18468 /* JackConnectionManager.h in Headers */,
+				4B699C14097D421600A18468 /* JackFrameTimer.h in Headers */,
+				4B699C16097D421600A18468 /* JackMachSemaphore.h in Headers */,
+				4B699C17097D421600A18468 /* JackGlobals.h in Headers */,
+				4B699C18097D421600A18468 /* JackMachThread.h in Headers */,
+				4B699C19097D421600A18468 /* JackMachClientChannel.h in Headers */,
+				4B699C20097D421600A18468 /* JackSynchro.h in Headers */,
+				4B699C21097D421600A18468 /* JackDebugClient.h in Headers */,
+				4B699C22097D421600A18468 /* JackConstants.h in Headers */,
+				4BF520590CB8D1010037470E /* timestamps.h in Headers */,
+				4B6C73800CC60A7F001AFFD4 /* intclient.h in Headers */,
+				4B6C73810CC60A7F001AFFD4 /* jack.h in Headers */,
+				4B6C73820CC60A7F001AFFD4 /* ringbuffer.h in Headers */,
+				4B6C73830CC60A80001AFFD4 /* statistics.h in Headers */,
+				4B6C73840CC60A80001AFFD4 /* thread.h in Headers */,
+				4B6C73850CC60A81001AFFD4 /* transport.h in Headers */,
+				4BE3225A0CC611EF00AFA640 /* types.h in Headers */,
+				4BAB95B90B9E20B800A0C723 /* JackPortType.h in Headers */,
+				4B80D7E80BA0D17400F035BB /* JackMidiPort.h in Headers */,
+				4B6B9EF60CD095930051EE5A /* midiport.h in Headers */,
+				4BE4CC020CDA153500CCF5BB /* JackTools.h in Headers */,
+				4B9A26010DBF8584006E9FBC /* jslist.h in Headers */,
+				4B4F9C8F0DC20C0400706CB0 /* JackMessageBuffer.h in Headers */,
+				4BB9D4B30E2610B300351653 /* JackTransportEngine.h in Headers */,
+				4BC3B6A50E703B2E0066E42F /* JackPosixThread.h in Headers */,
+				4BECB2F80F4451C10091B70A /* JackProcessSync.h in Headers */,
+				4B94334A10A5E666002A187F /* systemdeps.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C4D097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699C4E097D421600A18468 /* JackMachPort.h in Headers */,
+				4B699C4F097D421600A18468 /* JackError.h in Headers */,
+				4B699C50097D421600A18468 /* JackTime.h in Headers */,
+				4B699C51097D421600A18468 /* JackShmMem.h in Headers */,
+				4B699C52097D421600A18468 /* shm.h in Headers */,
+				4B699C54097D421600A18468 /* JackThread.h in Headers */,
+				4B699C55097D421600A18468 /* JackActivationCount.h in Headers */,
+				4B699C56097D421600A18468 /* JackChannel.h in Headers */,
+				4B699C57097D421600A18468 /* JackGraphManager.h in Headers */,
+				4B699C58097D421600A18468 /* JackPort.h in Headers */,
+				4B699C59097D421600A18468 /* JackClientInterface.h in Headers */,
+				4B699C5A097D421600A18468 /* JackClientControl.h in Headers */,
+				4B699C5B097D421600A18468 /* JackClient.h in Headers */,
+				4B699C5C097D421600A18468 /* JackInternalClient.h in Headers */,
+				4B699C5D097D421600A18468 /* JackConnectionManager.h in Headers */,
+				4B699C5E097D421600A18468 /* JackFrameTimer.h in Headers */,
+				4B699C60097D421600A18468 /* JackMachSemaphore.h in Headers */,
+				4B699C61097D421600A18468 /* JackGlobals.h in Headers */,
+				4B699C62097D421600A18468 /* JackMachThread.h in Headers */,
+				4B699C68097D421600A18468 /* JackSynchro.h in Headers */,
+				4B699C69097D421600A18468 /* JackAudioDriver.h in Headers */,
+				4B699C6A097D421600A18468 /* JackFreewheelDriver.h in Headers */,
+				4B699C6B097D421600A18468 /* JackThreadedDriver.h in Headers */,
+				4B699C6C097D421600A18468 /* JackDriver.h in Headers */,
+				4B699C6D097D421600A18468 /* driver_interface.h in Headers */,
+				4B699C6F097D421600A18468 /* JackDriverLoader.h in Headers */,
+				4B699C71097D421600A18468 /* JackEngine.h in Headers */,
+				4B699C73097D421600A18468 /* JackExternalClient.h in Headers */,
+				4B699C74097D421600A18468 /* JackServer.h in Headers */,
+				4B699C77097D421600A18468 /* JackMachNotifyChannel.h in Headers */,
+				4B699C78097D421600A18468 /* JackMachServerChannel.h in Headers */,
+				4B699C79097D421600A18468 /* JackMachServerNotifyChannel.h in Headers */,
+				4B699C7B097D421600A18468 /* JackConstants.h in Headers */,
+				4BD4B4D809BACD9600750C0F /* JackTransportEngine.h in Headers */,
+				4BC2168E0A444BED00BDA09F /* JackServerGlobals.h in Headers */,
+				4BF5205A0CB8D1010037470E /* timestamps.h in Headers */,
+				4B6C73860CC60A83001AFFD4 /* jack.h in Headers */,
+				4B6C73870CC60A84001AFFD4 /* intclient.h in Headers */,
+				4B6C73880CC60A84001AFFD4 /* ringbuffer.h in Headers */,
+				4B6C73890CC60A85001AFFD4 /* statistics.h in Headers */,
+				4B6C738A0CC60A85001AFFD4 /* thread.h in Headers */,
+				4B6C738B0CC60A86001AFFD4 /* transport.h in Headers */,
+				4BE3225B0CC611F500AFA640 /* types.h in Headers */,
+				4BAB95BB0B9E20B800A0C723 /* JackPortType.h in Headers */,
+				4B80D7EB0BA0D17400F035BB /* JackMidiPort.h in Headers */,
+				4B6B9EF70CD095970051EE5A /* midiport.h in Headers */,
+				4B5DB9840CD2429B00EBA5EE /* JackDebugClient.h in Headers */,
+				4BE4CC040CDA153500CCF5BB /* JackTools.h in Headers */,
+				BA222AD90DC88269001A17F4 /* JackNetTool.h in Headers */,
+				BA047C760E14E79D0041F3B6 /* JackNetSocket.h in Headers */,
+				4B95BCAE0D913073000F7695 /* control.h in Headers */,
+				4B9A26020DBF8584006E9FBC /* jslist.h in Headers */,
+				4B4F9C8D0DC20C0400706CB0 /* JackMessageBuffer.h in Headers */,
+				4B5F253E0DEE9B8F0041E486 /* JackLockedEngine.h in Headers */,
+				4BBC93BB0DF9736C002DF220 /* JackWaitThreadedDriver.h in Headers */,
+				4B4CA9750E02CF9600F4BFDA /* JackRestartThreadedDriver.h in Headers */,
+				4B4E9AFB0E5F1090000A3278 /* JackControlAPI.h in Headers */,
+				4BC3B6A70E703B2E0066E42F /* JackPosixThread.h in Headers */,
+				4BF2841B0F31B4BC00B05BE3 /* JackArgParser.h in Headers */,
+				4BBAE4100F42FA6100B8BD3F /* JackEngineProfiling.h in Headers */,
+				4BECB2F60F4451C10091B70A /* JackProcessSync.h in Headers */,
+				4BF339240F8B873E0080FB5B /* JackMidiDriver.h in Headers */,
+				4B94334B10A5E666002A187F /* systemdeps.h in Headers */,
+				4BCBCE5E10C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */,
+				4BCBCE6010C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CB2097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CC2097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CD2097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CE2097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CF4097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D04097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D14097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D28097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D40097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D50097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D68097D421600A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D80097D421700A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D98097D421700A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BE5FECE0E725C090020B576 /* JackCoreAudioDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699DA7097D421700A18468 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699DA8097D421700A18468 /* JackDummyDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B978DB20A31CF4A009E2DD1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BBB00D40E72614F0018AB1B /* JackPortAudioDevices.h in Headers */,
+				4BBB00D60E72614F0018AB1B /* JackPortAudioDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA3393410B2E36800190E3B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA3393510B2E36800190E3B /* JackMachPort.h in Headers */,
+				4BA3393610B2E36800190E3B /* JackError.h in Headers */,
+				4BA3393710B2E36800190E3B /* JackTime.h in Headers */,
+				4BA3393810B2E36800190E3B /* JackShmMem.h in Headers */,
+				4BA3393910B2E36800190E3B /* shm.h in Headers */,
+				4BA3393A10B2E36800190E3B /* JackThread.h in Headers */,
+				4BA3393B10B2E36800190E3B /* JackActivationCount.h in Headers */,
+				4BA3393C10B2E36800190E3B /* JackChannel.h in Headers */,
+				4BA3393D10B2E36800190E3B /* JackGraphManager.h in Headers */,
+				4BA3393E10B2E36800190E3B /* JackPort.h in Headers */,
+				4BA3393F10B2E36800190E3B /* JackClientInterface.h in Headers */,
+				4BA3394010B2E36800190E3B /* JackClientControl.h in Headers */,
+				4BA3394110B2E36800190E3B /* JackClient.h in Headers */,
+				4BA3394210B2E36800190E3B /* JackInternalClient.h in Headers */,
+				4BA3394310B2E36800190E3B /* JackConnectionManager.h in Headers */,
+				4BA3394410B2E36800190E3B /* JackFrameTimer.h in Headers */,
+				4BA3394510B2E36800190E3B /* JackMachSemaphore.h in Headers */,
+				4BA3394610B2E36800190E3B /* JackGlobals.h in Headers */,
+				4BA3394710B2E36800190E3B /* JackMachThread.h in Headers */,
+				4BA3394810B2E36800190E3B /* JackSynchro.h in Headers */,
+				4BA3394910B2E36800190E3B /* JackAudioDriver.h in Headers */,
+				4BA3394A10B2E36800190E3B /* JackFreewheelDriver.h in Headers */,
+				4BA3394B10B2E36800190E3B /* JackThreadedDriver.h in Headers */,
+				4BA3394C10B2E36800190E3B /* JackDriver.h in Headers */,
+				4BA3394D10B2E36800190E3B /* driver_interface.h in Headers */,
+				4BA3394E10B2E36800190E3B /* JackDriverLoader.h in Headers */,
+				4BA3394F10B2E36800190E3B /* JackEngine.h in Headers */,
+				4BA3395010B2E36800190E3B /* JackExternalClient.h in Headers */,
+				4BA3395110B2E36800190E3B /* JackServer.h in Headers */,
+				4BA3395210B2E36800190E3B /* JackMachNotifyChannel.h in Headers */,
+				4BA3395310B2E36800190E3B /* JackMachServerChannel.h in Headers */,
+				4BA3395410B2E36800190E3B /* JackMachServerNotifyChannel.h in Headers */,
+				4BA3395510B2E36800190E3B /* JackConstants.h in Headers */,
+				4BA3395610B2E36800190E3B /* JackTransportEngine.h in Headers */,
+				4BA3395710B2E36800190E3B /* JackServerGlobals.h in Headers */,
+				4BA3395810B2E36800190E3B /* timestamps.h in Headers */,
+				4BA3395910B2E36800190E3B /* jack.h in Headers */,
+				4BA3395A10B2E36800190E3B /* intclient.h in Headers */,
+				4BA3395B10B2E36800190E3B /* ringbuffer.h in Headers */,
+				4BA3395C10B2E36800190E3B /* statistics.h in Headers */,
+				4BA3395D10B2E36800190E3B /* thread.h in Headers */,
+				4BA3395E10B2E36800190E3B /* transport.h in Headers */,
+				4BA3395F10B2E36800190E3B /* types.h in Headers */,
+				4BA3396010B2E36800190E3B /* JackPortType.h in Headers */,
+				4BA3396110B2E36800190E3B /* JackMidiPort.h in Headers */,
+				4BA3396210B2E36800190E3B /* midiport.h in Headers */,
+				4BA3396310B2E36800190E3B /* JackDebugClient.h in Headers */,
+				4BA3396410B2E36800190E3B /* JackTools.h in Headers */,
+				4BA3396510B2E36800190E3B /* JackNetTool.h in Headers */,
+				4BA3396610B2E36800190E3B /* jslist.h in Headers */,
+				4BA3396710B2E36800190E3B /* JackMessageBuffer.h in Headers */,
+				4BA3396810B2E36800190E3B /* JackRestartThreadedDriver.h in Headers */,
+				4BA3396910B2E36800190E3B /* JackControlAPI.h in Headers */,
+				4BA3396A10B2E36800190E3B /* JackPosixThread.h in Headers */,
+				4BA3396B10B2E36800190E3B /* JackEngineProfiling.h in Headers */,
+				4BA3396C10B2E36800190E3B /* JackProcessSync.h in Headers */,
+				4BA3396D10B2E36800190E3B /* JackMidiDriver.h in Headers */,
+				4BA3396E10B2E36800190E3B /* JackWaitThreadedDriver.h in Headers */,
+				4BA3396F10B2E36800190E3B /* JackArgParser.h in Headers */,
+				4BCBCE6610C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */,
+				4BCBCE6810C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692A70CBE4BC700EAD520 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692CB0CBE4C9000EAD520 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA7FEBA0D8E76270017FF73 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BD623EE0CBCF0F000DE782F /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDB941001FB9C00B15929 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDB951001FB9C00B15929 /* JackCoreMidiDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBB81001FCC000B15929 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDBB91001FCC000B15929 /* JackNetDriver.h in Headers */,
+				4BDCDBBA1001FCC000B15929 /* JackNetInterface.h in Headers */,
+				4BDCDBBB1001FCC000B15929 /* JackNetUnixSocket.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBD81001FD2D00B15929 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDBD91001FD2D00B15929 /* JackNetManager.h in Headers */,
+				4BDCDBDA1001FD2D00B15929 /* JackNetInterface.h in Headers */,
+				4BDCDBDB1001FD2D00B15929 /* JackNetUnixSocket.h in Headers */,
+				4BDCDBDC1001FD2D00B15929 /* JackArgParser.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBED1001FD7300B15929 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDBEE1001FD7300B15929 /* JackAudioAdapter.h in Headers */,
+				4BDCDBEF1001FD7300B15929 /* JackAudioAdapterInterface.h in Headers */,
+				4BDCDBF01001FD7300B15929 /* JackException.h in Headers */,
+				4BDCDBF11001FD7300B15929 /* JackLibSampleRateResampler.h in Headers */,
+				4BDCDBF21001FD7300B15929 /* JackCoreAudioAdapter.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDC101001FDE300B15929 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDC111001FDE300B15929 /* JackAudioAdapterInterface.h in Headers */,
+				4BDCDC121001FDE300B15929 /* JackException.h in Headers */,
+				4BDCDC131001FDE300B15929 /* JackLibSampleRateResampler.h in Headers */,
+				4BDCDC141001FDE300B15929 /* JackNetAdapter.h in Headers */,
+				4BDCDC151001FDE300B15929 /* JackNetInterface.h in Headers */,
+				4BDCDC161001FDE300B15929 /* JackAudioAdapter.h in Headers */,
+				4BDCDC171001FDE300B15929 /* JackNetUnixSocket.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE6C6920A3E096F005A203A /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE99D270AD7A04800C59091 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BF339030F8B864B0080FB5B /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BF3391A0F8B86DC0080FB5B /* JackCoreMidiDriver.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA5E8C0DEC4D9C00FA4CDB /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82830DF6A9E40087B4E1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82960DF6A9E40087B4E1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82A20DF6A9E40087B4E1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82AE0DF6A9E40087B4E1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82BA0DF6A9E40087B4E1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82C60DF6A9E40087B4E1 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA99990AAAF3B0009E916C /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		BA222AC60DC88132001A17F4 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				BA222ADF0DC882A5001A17F4 /* JackNetDriver.h in Headers */,
+				4B76C76B0E5AB2DB00E2AC21 /* JackNetInterface.h in Headers */,
+				4BC3B6BC0E703BCC0066E42F /* JackNetUnixSocket.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		BA222AE10DC882DB001A17F4 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				BA222AEE0DC883B3001A17F4 /* JackNetManager.h in Headers */,
+				4B76C76D0E5AB2DB00E2AC21 /* JackNetInterface.h in Headers */,
+				4BC3B6BE0E703BCC0066E42F /* JackNetUnixSocket.h in Headers */,
+				4BF284190F31B4BC00B05BE3 /* JackArgParser.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		4B0A28DC0D52073D002EFF74 /* jack_thread_wait */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B0A28E20D52073D002EFF74 /* Build configuration list for PBXNativeTarget "jack_thread_wait" */;
+			buildPhases = (
+				4B0A28DD0D52073D002EFF74 /* Headers */,
+				4B0A28DE0D52073D002EFF74 /* Sources */,
+				4B0A28E00D52073D002EFF74 /* Frameworks */,
+				4B0A28E10D52073D002EFF74 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = jack_thread_wait;
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B0A28E60D52073D002EFF74 /* jack_thread_wait */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B0A29230D52108E002EFF74 /* jack_thread_wait 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B0A29290D52108E002EFF74 /* Build configuration list for PBXNativeTarget "jack_thread_wait 64 bits" */;
+			buildPhases = (
+				4B0A29240D52108E002EFF74 /* Headers */,
+				4B0A29250D52108E002EFF74 /* Sources */,
+				4B0A29270D52108E002EFF74 /* Frameworks */,
+				4B0A29280D52108E002EFF74 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_thread_wait 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B0A292D0D52108E002EFF74 /* jack_thread_wait */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B19B2F60E23620F00DD4A82 /* audioadapter Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B19B2FC0E23620F00DD4A82 /* Build configuration list for PBXNativeTarget "audioadapter Universal" */;
+			buildPhases = (
+				4B19B2F70E23620F00DD4A82 /* Headers */,
+				4B19B2F90E23620F00DD4A82 /* Sources */,
+				4B19B2FB0E23620F00DD4A82 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "audioadapter Universal";
+			productName = jack_coreaudio;
+			productReference = 4B19B3000E23620F00DD4A82 /* audioadapter.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B3224D710A3156800838A8E /* jack_netone Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B3224E110A3156800838A8E /* Build configuration list for PBXNativeTarget "jack_netone Universal" */;
+			buildPhases = (
+				4B3224D810A3156800838A8E /* Headers */,
+				4B3224DC10A3156800838A8E /* Sources */,
+				4B3224E010A3156800838A8E /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_netone Universal";
+			productName = jack_coreaudio;
+			productReference = 4B3224E510A3156800838A8E /* jack_netone.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B32251D10A316B200838A8E /* jack_netone 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B32252710A316B200838A8E /* Build configuration list for PBXNativeTarget "jack_netone 64 bits" */;
+			buildPhases = (
+				4B32251E10A316B200838A8E /* Headers */,
+				4B32252210A316B200838A8E /* Sources */,
+				4B32252610A316B200838A8E /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_netone 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4B32252B10A316B200838A8E /* jack_netone.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B32255710A3187800838A8E /* jack_netsource Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B32255D10A3187800838A8E /* Build configuration list for PBXNativeTarget "jack_netsource Universal" */;
+			buildPhases = (
+				4B32255810A3187800838A8E /* Headers */,
+				4B32255910A3187800838A8E /* Sources */,
+				4B32255B10A3187800838A8E /* Frameworks */,
+				4B32255C10A3187800838A8E /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_netsource Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B32256110A3187800838A8E /* jack_netsource */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B32257110A3190C00838A8E /* jack_netsource 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B32257710A3190C00838A8E /* Build configuration list for PBXNativeTarget "jack_netsource 64 bits" */;
+			buildPhases = (
+				4B32257210A3190C00838A8E /* Headers */,
+				4B32257310A3190C00838A8E /* Sources */,
+				4B32257510A3190C00838A8E /* Frameworks */,
+				4B32257610A3190C00838A8E /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_netsource 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B32257B10A3190C00838A8E /* jack_netsource */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C41B0D4731D1000DE7AE /* jackdmp framework 64bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C4210D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jackdmp framework 64bits" */;
+			buildPhases = (
+				4B35C41C0D4731D1000DE7AE /* Headers */,
+				4B35C41D0D4731D1000DE7AE /* Sources */,
+				4B35C41F0D4731D1000DE7AE /* Frameworks */,
+				4B35C4200D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jackdmp framework 64bits";
+			productInstallPath = /usr/local/bin;
+			productName = TestMacEngine;
+			productReference = 4B35C4250D4731D1000DE7AE /* jackdmp */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C4270D4731D1000DE7AE /* Jackmp.framework 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C47F0D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "Jackmp.framework 64 bits" */;
+			buildPhases = (
+				4B35C4280D4731D1000DE7AE /* Headers */,
+				4B35C4560D4731D1000DE7AE /* Resources */,
+				4B35C4570D4731D1000DE7AE /* Sources */,
+				4B35C47D0D4731D1000DE7AE /* Rez */,
+				4B35C47E0D4731D1000DE7AE /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Jackmp.framework 64 bits";
+			productName = Jack;
+			productReference = 4B35C4830D4731D1000DE7AE /* Jackmp.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		4B35C4850D4731D1000DE7AE /* Jackservermp.framework 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C4F80D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "Jackservermp.framework 64 bits" */;
+			buildPhases = (
+				4B35C4860D4731D1000DE7AE /* Headers */,
+				4B35C4C20D4731D1000DE7AE /* Resources */,
+				4B35C4C30D4731D1000DE7AE /* Sources */,
+				4B35C4F60D4731D1000DE7AE /* Rez */,
+				4B35C4F70D4731D1000DE7AE /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Jackservermp.framework 64 bits";
+			productName = Jack;
+			productReference = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		4B35C50A0D4731D1000DE7AE /* jack_midiseq 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5100D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_midiseq 64 bits" */;
+			buildPhases = (
+				4B35C50B0D4731D1000DE7AE /* Headers */,
+				4B35C50C0D4731D1000DE7AE /* Sources */,
+				4B35C50E0D4731D1000DE7AE /* Frameworks */,
+				4B35C50F0D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_midiseq 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B35C5140D4731D1000DE7AE /* jack_midiseq */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5160D4731D1000DE7AE /* jack_midisine 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C51C0D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_midisine 64 bits" */;
+			buildPhases = (
+				4B35C5170D4731D1000DE7AE /* Headers */,
+				4B35C5180D4731D1000DE7AE /* Sources */,
+				4B35C51A0D4731D1000DE7AE /* Frameworks */,
+				4B35C51B0D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_midisine 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B35C5200D4731D1000DE7AE /* jack_midisine */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5220D4731D1000DE7AE /* jack_metro 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5280D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_metro 64 bits" */;
+			buildPhases = (
+				4B35C5230D4731D1000DE7AE /* Headers */,
+				4B35C5240D4731D1000DE7AE /* Sources */,
+				4B35C5260D4731D1000DE7AE /* Frameworks */,
+				4B35C5270D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_metro 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B35C52C0D4731D1000DE7AE /* jack_metro */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C52E0D4731D1000DE7AE /* jack_lsp 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5340D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_lsp 64 bits" */;
+			buildPhases = (
+				4B35C52F0D4731D1000DE7AE /* Headers */,
+				4B35C5300D4731D1000DE7AE /* Sources */,
+				4B35C5320D4731D1000DE7AE /* Frameworks */,
+				4B35C5330D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_lsp 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_lsp;
+			productReference = 4B35C5380D4731D1000DE7AE /* jack_lsp */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C53A0D4731D1000DE7AE /* jack_connect 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5400D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_connect 64 bits" */;
+			buildPhases = (
+				4B35C53B0D4731D1000DE7AE /* Headers */,
+				4B35C53C0D4731D1000DE7AE /* Sources */,
+				4B35C53E0D4731D1000DE7AE /* Frameworks */,
+				4B35C53F0D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_connect 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_connect;
+			productReference = 4B35C5440D4731D1000DE7AE /* jack_connect */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5460D4731D1000DE7AE /* jack_disconnect 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C54C0D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_disconnect 64 bits" */;
+			buildPhases = (
+				4B35C5470D4731D1000DE7AE /* Headers */,
+				4B35C5480D4731D1000DE7AE /* Sources */,
+				4B35C54A0D4731D1000DE7AE /* Frameworks */,
+				4B35C54B0D4731D1000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_disconnect 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_disconnect;
+			productReference = 4B35C5500D4731D1000DE7AE /* jack_disconnect */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5520D4731D2000DE7AE /* jack_freewheel 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C55A0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_freewheel 64 bits" */;
+			buildPhases = (
+				4B35C5550D4731D2000DE7AE /* Headers */,
+				4B35C5560D4731D2000DE7AE /* Sources */,
+				4B35C5580D4731D2000DE7AE /* Frameworks */,
+				4B35C5590D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				4B35C5530D4731D2000DE7AE /* PBXTargetDependency */,
+			);
+			name = "jack_freewheel 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_freewheel;
+			productReference = 4B35C55E0D4731D2000DE7AE /* jack_freewheel */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5600D4731D2000DE7AE /* jdelay 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5660D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jdelay 64 bits" */;
+			buildPhases = (
+				4B35C5610D4731D2000DE7AE /* Headers */,
+				4B35C5620D4731D2000DE7AE /* Sources */,
+				4B35C5640D4731D2000DE7AE /* Frameworks */,
+				4B35C5650D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jdelay 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_lsp;
+			productReference = 4B35C56A0D4731D2000DE7AE /* jdelay */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C56C0D4731D2000DE7AE /* jack_external_metro 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5720D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_external_metro 64 bits" */;
+			buildPhases = (
+				4B35C56D0D4731D2000DE7AE /* Headers */,
+				4B35C56E0D4731D2000DE7AE /* Sources */,
+				4B35C5700D4731D2000DE7AE /* Frameworks */,
+				4B35C5710D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_external_metro 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B35C5760D4731D2000DE7AE /* jack_external_metro */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5780D4731D2000DE7AE /* testAtomic 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5820D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "testAtomic 64 bits" */;
+			buildPhases = (
+				4B35C5790D4731D2000DE7AE /* Headers */,
+				4B35C57C0D4731D2000DE7AE /* Sources */,
+				4B35C5800D4731D2000DE7AE /* Frameworks */,
+				4B35C5810D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "testAtomic 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testAtomic;
+			productReference = 4B35C5860D4731D2000DE7AE /* testAtomic */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5880D4731D2000DE7AE /* testSem 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5960D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "testSem 64 bits" */;
+			buildPhases = (
+				4B35C5890D4731D2000DE7AE /* Headers */,
+				4B35C58C0D4731D2000DE7AE /* Sources */,
+				4B35C5940D4731D2000DE7AE /* Frameworks */,
+				4B35C5950D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "testSem 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B35C59A0D4731D2000DE7AE /* testSem */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C59C0D4731D2000DE7AE /* zombie 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5A20D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "zombie 64 bits" */;
+			buildPhases = (
+				4B35C59D0D4731D2000DE7AE /* Headers */,
+				4B35C59E0D4731D2000DE7AE /* Sources */,
+				4B35C5A00D4731D2000DE7AE /* Frameworks */,
+				4B35C5A10D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "zombie 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = zombie;
+			productReference = 4B35C5A60D4731D2000DE7AE /* zombie */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5A80D4731D2000DE7AE /* jack_test 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5AE0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_test 64 bits" */;
+			buildPhases = (
+				4B35C5A90D4731D2000DE7AE /* Headers */,
+				4B35C5AA0D4731D2000DE7AE /* Sources */,
+				4B35C5AC0D4731D2000DE7AE /* Frameworks */,
+				4B35C5AD0D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_test 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B35C5B20D4731D2000DE7AE /* jack_test */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5B40D4731D2000DE7AE /* jack_cpu 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5BA0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_cpu 64 bits" */;
+			buildPhases = (
+				4B35C5B50D4731D2000DE7AE /* Headers */,
+				4B35C5B60D4731D2000DE7AE /* Sources */,
+				4B35C5B80D4731D2000DE7AE /* Frameworks */,
+				4B35C5B90D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_cpu 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B35C5BE0D4731D2000DE7AE /* jack_cpu */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5C00D4731D2000DE7AE /* jack_load 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5C60D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_load 64 bits" */;
+			buildPhases = (
+				4B35C5C10D4731D2000DE7AE /* Headers */,
+				4B35C5C20D4731D2000DE7AE /* Sources */,
+				4B35C5C40D4731D2000DE7AE /* Frameworks */,
+				4B35C5C50D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_load 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B35C5CA0D4731D2000DE7AE /* jack_load */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5CC0D4731D2000DE7AE /* jack_unload 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5D20D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_unload 64 bits" */;
+			buildPhases = (
+				4B35C5CD0D4731D2000DE7AE /* Headers */,
+				4B35C5CE0D4731D2000DE7AE /* Sources */,
+				4B35C5D00D4731D2000DE7AE /* Frameworks */,
+				4B35C5D10D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_unload 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B35C5D60D4731D2000DE7AE /* jack_unload */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5D80D4731D2000DE7AE /* synchroServer 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5E60D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "synchroServer 64 bits" */;
+			buildPhases = (
+				4B35C5D90D4731D2000DE7AE /* Headers */,
+				4B35C5DC0D4731D2000DE7AE /* Sources */,
+				4B35C5E40D4731D2000DE7AE /* Frameworks */,
+				4B35C5E50D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "synchroServer 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = synchroServer;
+			productReference = 4B35C5EA0D4731D2000DE7AE /* synchroServer */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C5EC0D4731D2000DE7AE /* synchroClient 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C5FA0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "synchroClient 64 bits" */;
+			buildPhases = (
+				4B35C5ED0D4731D2000DE7AE /* Headers */,
+				4B35C5F00D4731D2000DE7AE /* Sources */,
+				4B35C5F80D4731D2000DE7AE /* Frameworks */,
+				4B35C5F90D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "synchroClient 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = synchroServer;
+			productReference = 4B35C5FE0D4731D2000DE7AE /* synchroClient */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C6000D4731D2000DE7AE /* synchroServerClient 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C60E0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "synchroServerClient 64 bits" */;
+			buildPhases = (
+				4B35C6010D4731D2000DE7AE /* Headers */,
+				4B35C6040D4731D2000DE7AE /* Sources */,
+				4B35C60C0D4731D2000DE7AE /* Frameworks */,
+				4B35C60D0D4731D2000DE7AE /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "synchroServerClient 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = synchroServer;
+			productReference = 4B35C6120D4731D2000DE7AE /* synchroServerClient */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B35C6140D4731D2000DE7AE /* jack_coreaudio 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C61A0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_coreaudio 64 bits" */;
+			buildPhases = (
+				4B35C6150D4731D2000DE7AE /* Headers */,
+				4B35C6170D4731D2000DE7AE /* Sources */,
+				4B35C6190D4731D2000DE7AE /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_coreaudio 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4B35C61E0D4731D2000DE7AE /* jack_coreaudio.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B35C61F0D4731D2000DE7AE /* jack_portaudio 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C6250D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_portaudio 64 bits" */;
+			buildPhases = (
+				4B35C6200D4731D2000DE7AE /* Headers */,
+				4B35C6220D4731D2000DE7AE /* Sources */,
+				4B35C6240D4731D2000DE7AE /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_portaudio 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4B35C6290D4731D2000DE7AE /* jack_portaudio.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B35C62A0D4731D2000DE7AE /* jack_dummy 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C6300D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_dummy 64 bits" */;
+			buildPhases = (
+				4B35C62B0D4731D2000DE7AE /* Headers */,
+				4B35C62D0D4731D2000DE7AE /* Sources */,
+				4B35C62F0D4731D2000DE7AE /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_dummy 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4B35C6340D4731D2000DE7AE /* jack_dummy.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B35C6350D4731D3000DE7AE /* inprocess 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B35C63A0D4731D3000DE7AE /* Build configuration list for PBXNativeTarget "inprocess 64 bits" */;
+			buildPhases = (
+				4B35C6360D4731D3000DE7AE /* Headers */,
+				4B35C6370D4731D3000DE7AE /* Sources */,
+				4B35C6390D4731D3000DE7AE /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "inprocess 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4B35C63E0D4731D3000DE7AE /* inprocess.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B363DCE0DEB02F6001F72D9 /* jack_alias Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363DD40DEB02F6001F72D9 /* Build configuration list for PBXNativeTarget "jack_alias Universal" */;
+			buildPhases = (
+				4B363DCF0DEB02F6001F72D9 /* Headers */,
+				4B363DD00DEB02F6001F72D9 /* Sources */,
+				4B363DD20DEB02F6001F72D9 /* Frameworks */,
+				4B363DD30DEB02F6001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_alias Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363DD80DEB02F6001F72D9 /* jack_alias */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B363E100DEB03C5001F72D9 /* jack_evmon Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363E160DEB03C5001F72D9 /* Build configuration list for PBXNativeTarget "jack_evmon Universal" */;
+			buildPhases = (
+				4B363E110DEB03C5001F72D9 /* Headers */,
+				4B363E120DEB03C5001F72D9 /* Sources */,
+				4B363E140DEB03C5001F72D9 /* Frameworks */,
+				4B363E150DEB03C5001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_evmon Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363E1A0DEB03C5001F72D9 /* jack_evmon */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B363E440DEB0775001F72D9 /* jack_bufsize Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363E4A0DEB0775001F72D9 /* Build configuration list for PBXNativeTarget "jack_bufsize Universal" */;
+			buildPhases = (
+				4B363E450DEB0775001F72D9 /* Headers */,
+				4B363E460DEB0775001F72D9 /* Sources */,
+				4B363E480DEB0775001F72D9 /* Frameworks */,
+				4B363E490DEB0775001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_bufsize Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363E4E0DEB0775001F72D9 /* jack_bufsize */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B363EDF0DEB091C001F72D9 /* jack_rec Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363EE50DEB091C001F72D9 /* Build configuration list for PBXNativeTarget "jack_rec Universal" */;
+			buildPhases = (
+				4B363EE00DEB091C001F72D9 /* Headers */,
+				4B363EE10DEB091C001F72D9 /* Sources */,
+				4B363EE30DEB091C001F72D9 /* Frameworks */,
+				4B363EE40DEB091C001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_rec Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363EE90DEB091C001F72D9 /* jack_rec */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B363F140DEB0A6A001F72D9 /* jack_monitor_client Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363F1A0DEB0A6A001F72D9 /* Build configuration list for PBXNativeTarget "jack_monitor_client Universal" */;
+			buildPhases = (
+				4B363F150DEB0A6A001F72D9 /* Headers */,
+				4B363F160DEB0A6A001F72D9 /* Sources */,
+				4B363F180DEB0A6A001F72D9 /* Frameworks */,
+				4B363F190DEB0A6A001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_monitor_client Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B363F2B0DEB0BD1001F72D9 /* jack_showtime Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363F310DEB0BD1001F72D9 /* Build configuration list for PBXNativeTarget "jack_showtime Universal" */;
+			buildPhases = (
+				4B363F2C0DEB0BD1001F72D9 /* Headers */,
+				4B363F2D0DEB0BD1001F72D9 /* Sources */,
+				4B363F2F0DEB0BD1001F72D9 /* Frameworks */,
+				4B363F300DEB0BD1001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_showtime Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363F350DEB0BD1001F72D9 /* jack_showtime */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B363F680DEB0D4E001F72D9 /* jack_impulse_grabber Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B363F6E0DEB0D4E001F72D9 /* Build configuration list for PBXNativeTarget "jack_impulse_grabber Universal" */;
+			buildPhases = (
+				4B363F690DEB0D4E001F72D9 /* Headers */,
+				4B363F6A0DEB0D4E001F72D9 /* Sources */,
+				4B363F6C0DEB0D4E001F72D9 /* Frameworks */,
+				4B363F6D0DEB0D4E001F72D9 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_impulse_grabber Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B43A8B010145F6F00E52943 /* jack_loopback Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B43A8B610145F6F00E52943 /* Build configuration list for PBXNativeTarget "jack_loopback Universal" */;
+			buildPhases = (
+				4B43A8B110145F6F00E52943 /* Headers */,
+				4B43A8B310145F6F00E52943 /* Sources */,
+				4B43A8B510145F6F00E52943 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_loopback Universal";
+			productName = jack_coreaudio;
+			productReference = 4B43A8BA10145F6F00E52943 /* jack_loopback.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B43A8DD1014615800E52943 /* jack_loopback 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B43A8E31014615800E52943 /* Build configuration list for PBXNativeTarget "jack_loopback 64 bits" */;
+			buildPhases = (
+				4B43A8DE1014615800E52943 /* Headers */,
+				4B43A8E01014615800E52943 /* Sources */,
+				4B43A8E21014615800E52943 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_loopback 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4B43A8E71014615800E52943 /* jack_loopback.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B47AC8010B5890100469C67 /* Jackmp.framework 64 bits debugging */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B47ACD310B5890100469C67 /* Build configuration list for PBXNativeTarget "Jackmp.framework 64 bits debugging" */;
+			buildPhases = (
+				4B47AC8110B5890100469C67 /* Headers */,
+				4B47ACAC10B5890100469C67 /* Resources */,
+				4B47ACAD10B5890100469C67 /* Sources */,
+				4B47ACD010B5890100469C67 /* Rez */,
+				4B47ACD110B5890100469C67 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Jackmp.framework 64 bits debugging";
+			productName = Jack;
+			productReference = 4B47ACD710B5890100469C67 /* Jackmp.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		4B5A1BB10CD1CB9E0005BF74 /* jack_midiseq Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B5A1BB70CD1CB9E0005BF74 /* Build configuration list for PBXNativeTarget "jack_midiseq Universal" */;
+			buildPhases = (
+				4B5A1BB20CD1CB9E0005BF74 /* Headers */,
+				4B5A1BB30CD1CB9E0005BF74 /* Sources */,
+				4B5A1BB50CD1CB9E0005BF74 /* Frameworks */,
+				4B5A1BB60CD1CB9E0005BF74 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_midiseq Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B5A1BBB0CD1CB9E0005BF74 /* jack_midiseq */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B5A1BD00CD1CCE10005BF74 /* jack_midisine Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B5A1BD60CD1CCE10005BF74 /* Build configuration list for PBXNativeTarget "jack_midisine Universal" */;
+			buildPhases = (
+				4B5A1BD10CD1CCE10005BF74 /* Headers */,
+				4B5A1BD20CD1CCE10005BF74 /* Sources */,
+				4B5A1BD40CD1CCE10005BF74 /* Frameworks */,
+				4B5A1BD50CD1CCE10005BF74 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_midisine Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B5E08BF0E5B66EE00BEE4E0 /* netadapter Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B5E08D10E5B66EE00BEE4E0 /* Build configuration list for PBXNativeTarget "netadapter Universal" */;
+			buildPhases = (
+				4B5E08C00E5B66EE00BEE4E0 /* Headers */,
+				4B5E08C90E5B66EE00BEE4E0 /* Sources */,
+				4B5E08D00E5B66EE00BEE4E0 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "netadapter Universal";
+			productName = jack_coreaudio;
+			productReference = 4B5E08D50E5B66EE00BEE4E0 /* netadapter.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B699BA7097D421600A18468 /* jackdmp framework Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699BAD097D421600A18468 /* Build configuration list for PBXNativeTarget "jackdmp framework Universal" */;
+			buildPhases = (
+				4B699BA8097D421600A18468 /* Headers */,
+				4B699BA9097D421600A18468 /* Sources */,
+				4B699BAB097D421600A18468 /* Frameworks */,
+				4B699BAC097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jackdmp framework Universal";
+			productInstallPath = /usr/local/bin;
+			productName = TestMacEngine;
+			productReference = 4B699BB1097D421600A18468 /* jackdmp */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699C00097D421600A18468 /* Jackmp.framework Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699C43097D421600A18468 /* Build configuration list for PBXNativeTarget "Jackmp.framework Universal" */;
+			buildPhases = (
+				4B699C01097D421600A18468 /* Headers */,
+				4B699C23097D421600A18468 /* Resources */,
+				4B699C24097D421600A18468 /* Sources */,
+				4B699C41097D421600A18468 /* Rez */,
+				4B699C42097D421600A18468 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Jackmp.framework Universal";
+			productName = Jack;
+			productReference = 4B699C47097D421600A18468 /* Jackmp.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		4B699C4C097D421600A18468 /* Jackservermp.framework Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699CA8097D421600A18468 /* Build configuration list for PBXNativeTarget "Jackservermp.framework Universal" */;
+			buildPhases = (
+				4B699C4D097D421600A18468 /* Headers */,
+				4B699C7C097D421600A18468 /* Resources */,
+				4B699C7D097D421600A18468 /* Sources */,
+				4B699CA6097D421600A18468 /* Rez */,
+				4B699CA7097D421600A18468 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Jackservermp.framework Universal";
+			productName = Jack;
+			productReference = 4B699CAC097D421600A18468 /* Jackservermp.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		4B699CB1097D421600A18468 /* jack_metro Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699CB7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_metro Universal" */;
+			buildPhases = (
+				4B699CB2097D421600A18468 /* Headers */,
+				4B699CB3097D421600A18468 /* Sources */,
+				4B699CB5097D421600A18468 /* Frameworks */,
+				4B699CB6097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_metro Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B699CBB097D421600A18468 /* jack_metro */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699CC1097D421600A18468 /* jack_lsp Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699CC7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_lsp Universal" */;
+			buildPhases = (
+				4B699CC2097D421600A18468 /* Headers */,
+				4B699CC3097D421600A18468 /* Sources */,
+				4B699CC5097D421600A18468 /* Frameworks */,
+				4B699CC6097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_lsp Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_lsp;
+			productReference = 4B699CCB097D421600A18468 /* jack_lsp */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699CD1097D421600A18468 /* jack_connect Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699CD7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_connect Universal" */;
+			buildPhases = (
+				4B699CD2097D421600A18468 /* Headers */,
+				4B699CD3097D421600A18468 /* Sources */,
+				4B699CD5097D421600A18468 /* Frameworks */,
+				4B699CD6097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_connect Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_connect;
+			productReference = 4B699CDB097D421600A18468 /* jack_connect */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699CE1097D421600A18468 /* jack_disconnect Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699CE7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_disconnect Universal" */;
+			buildPhases = (
+				4B699CE2097D421600A18468 /* Headers */,
+				4B699CE3097D421600A18468 /* Sources */,
+				4B699CE5097D421600A18468 /* Frameworks */,
+				4B699CE6097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_disconnect Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_disconnect;
+			productReference = 4B699CEB097D421600A18468 /* jack_disconnect */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699CF1097D421600A18468 /* jack_freewheel Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699CF9097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_freewheel Universal" */;
+			buildPhases = (
+				4B699CF4097D421600A18468 /* Headers */,
+				4B699CF5097D421600A18468 /* Sources */,
+				4B699CF7097D421600A18468 /* Frameworks */,
+				4B699CF8097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				4B699DC0097D421700A18468 /* PBXTargetDependency */,
+			);
+			name = "jack_freewheel Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_freewheel;
+			productReference = 4B699CFD097D421600A18468 /* jack_freewheel */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D03097D421600A18468 /* jack_external_metro Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D09097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_external_metro Universal" */;
+			buildPhases = (
+				4B699D04097D421600A18468 /* Headers */,
+				4B699D05097D421600A18468 /* Sources */,
+				4B699D07097D421600A18468 /* Frameworks */,
+				4B699D08097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_external_metro Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4B699D0D097D421600A18468 /* jack_external_metro */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D13097D421600A18468 /* testAtomic Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D1D097D421600A18468 /* Build configuration list for PBXNativeTarget "testAtomic Universal" */;
+			buildPhases = (
+				4B699D14097D421600A18468 /* Headers */,
+				4B699D17097D421600A18468 /* Sources */,
+				4B699D1B097D421600A18468 /* Frameworks */,
+				4B699D1C097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "testAtomic Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testAtomic;
+			productReference = 4B699D21097D421600A18468 /* testAtomic */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D27097D421600A18468 /* testSem Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D35097D421600A18468 /* Build configuration list for PBXNativeTarget "testSem Universal" */;
+			buildPhases = (
+				4B699D28097D421600A18468 /* Headers */,
+				4B699D2B097D421600A18468 /* Sources */,
+				4B699D33097D421600A18468 /* Frameworks */,
+				4B699D34097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "testSem Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4B699D39097D421600A18468 /* testSem */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D3F097D421600A18468 /* zombie Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D45097D421600A18468 /* Build configuration list for PBXNativeTarget "zombie Universal" */;
+			buildPhases = (
+				4B699D40097D421600A18468 /* Headers */,
+				4B699D41097D421600A18468 /* Sources */,
+				4B699D43097D421600A18468 /* Frameworks */,
+				4B699D44097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "zombie Universal";
+			productInstallPath = /usr/local/bin;
+			productName = zombie;
+			productReference = 4B699D49097D421600A18468 /* zombie */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D4F097D421600A18468 /* synchroServer Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D5D097D421600A18468 /* Build configuration list for PBXNativeTarget "synchroServer Universal" */;
+			buildPhases = (
+				4B699D50097D421600A18468 /* Headers */,
+				4B699D53097D421600A18468 /* Sources */,
+				4B699D5B097D421600A18468 /* Frameworks */,
+				4B699D5C097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "synchroServer Universal";
+			productInstallPath = /usr/local/bin;
+			productName = synchroServer;
+			productReference = 4B699D61097D421600A18468 /* synchroServer */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D67097D421600A18468 /* synchroClient Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D75097D421600A18468 /* Build configuration list for PBXNativeTarget "synchroClient Universal" */;
+			buildPhases = (
+				4B699D68097D421600A18468 /* Headers */,
+				4B699D6B097D421600A18468 /* Sources */,
+				4B699D73097D421600A18468 /* Frameworks */,
+				4B699D74097D421600A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "synchroClient Universal";
+			productInstallPath = /usr/local/bin;
+			productName = synchroServer;
+			productReference = 4B699D79097D421600A18468 /* synchroClient */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D7F097D421700A18468 /* synchroServerClient Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D8D097D421700A18468 /* Build configuration list for PBXNativeTarget "synchroServerClient Universal" */;
+			buildPhases = (
+				4B699D80097D421700A18468 /* Headers */,
+				4B699D83097D421700A18468 /* Sources */,
+				4B699D8B097D421700A18468 /* Frameworks */,
+				4B699D8C097D421700A18468 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "synchroServerClient Universal";
+			productInstallPath = /usr/local/bin;
+			productName = synchroServer;
+			productReference = 4B699D91097D421700A18468 /* synchroServerClient */;
+			productType = "com.apple.product-type.tool";
+		};
+		4B699D97097D421700A18468 /* jack_coreaudio Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699D9D097D421700A18468 /* Build configuration list for PBXNativeTarget "jack_coreaudio Universal" */;
+			buildPhases = (
+				4B699D98097D421700A18468 /* Headers */,
+				4B699D9A097D421700A18468 /* Sources */,
+				4B699D9C097D421700A18468 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_coreaudio Universal";
+			productName = jack_coreaudio;
+			productReference = 4B699DA1097D421700A18468 /* jack_coreaudio.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B699DA6097D421700A18468 /* jack_dummy Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B699DAC097D421700A18468 /* Build configuration list for PBXNativeTarget "jack_dummy Universal" */;
+			buildPhases = (
+				4B699DA7097D421700A18468 /* Headers */,
+				4B699DA9097D421700A18468 /* Sources */,
+				4B699DAB097D421700A18468 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_dummy Universal";
+			productName = jack_coreaudio;
+			productReference = 4B699DB0097D421700A18468 /* jack_dummy.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4B978DB10A31CF4A009E2DD1 /* jack_portaudio Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4B978DB70A31CF4A009E2DD1 /* Build configuration list for PBXNativeTarget "jack_portaudio Universal" */;
+			buildPhases = (
+				4B978DB20A31CF4A009E2DD1 /* Headers */,
+				4B978DB40A31CF4A009E2DD1 /* Sources */,
+				4B978DB60A31CF4A009E2DD1 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_portaudio Universal";
+			productName = jack_coreaudio;
+			productReference = 4B978DBB0A31CF4A009E2DD1 /* jack_portaudio.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BA3393310B2E36800190E3B /* Jackservermp.framework 64 bits profiling */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BA339A810B2E36800190E3B /* Build configuration list for PBXNativeTarget "Jackservermp.framework 64 bits profiling" */;
+			buildPhases = (
+				4BA3393410B2E36800190E3B /* Headers */,
+				4BA3397010B2E36800190E3B /* Resources */,
+				4BA3397110B2E36800190E3B /* Sources */,
+				4BA339A510B2E36800190E3B /* Rez */,
+				4BA339A610B2E36800190E3B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Jackservermp.framework 64 bits profiling";
+			productName = Jack;
+			productReference = 4BA339AC10B2E36800190E3B /* Jackservermp.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		4BA692A60CBE4BC700EAD520 /* jack_load Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BA692AC0CBE4BC700EAD520 /* Build configuration list for PBXNativeTarget "jack_load Universal" */;
+			buildPhases = (
+				4BA692A70CBE4BC700EAD520 /* Headers */,
+				4BA692A80CBE4BC700EAD520 /* Sources */,
+				4BA692AA0CBE4BC700EAD520 /* Frameworks */,
+				4BA692AB0CBE4BC700EAD520 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_load Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4BA692B00CBE4BC700EAD520 /* jack_load */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BA692CA0CBE4C9000EAD520 /* jack_unload Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BA692D00CBE4C9000EAD520 /* Build configuration list for PBXNativeTarget "jack_unload Universal" */;
+			buildPhases = (
+				4BA692CB0CBE4C9000EAD520 /* Headers */,
+				4BA692CC0CBE4C9000EAD520 /* Sources */,
+				4BA692CE0CBE4C9000EAD520 /* Frameworks */,
+				4BA692CF0CBE4C9000EAD520 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_unload Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4BA692D40CBE4C9000EAD520 /* jack_unload */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BA7FEB90D8E76270017FF73 /* jack_server_control Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BA7FEBF0D8E76270017FF73 /* Build configuration list for PBXNativeTarget "jack_server_control Universal" */;
+			buildPhases = (
+				4BA7FEBA0D8E76270017FF73 /* Headers */,
+				4BA7FEBB0D8E76270017FF73 /* Sources */,
+				4BA7FEBD0D8E76270017FF73 /* Frameworks */,
+				4BA7FEBE0D8E76270017FF73 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_server_control Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_lsp;
+			productReference = 4BA7FEC30D8E76270017FF73 /* jack_server_control */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BD623ED0CBCF0F000DE782F /* inprocess Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BD623F30CBCF0F000DE782F /* Build configuration list for PBXNativeTarget "inprocess Universal" */;
+			buildPhases = (
+				4BD623EE0CBCF0F000DE782F /* Headers */,
+				4BD623F00CBCF0F000DE782F /* Sources */,
+				4BD623F20CBCF0F000DE782F /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "inprocess Universal";
+			productName = jack_coreaudio;
+			productReference = 4BD623F70CBCF0F000DE782F /* inprocess.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BDCDB931001FB9C00B15929 /* jack_coremidi 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BDCDB991001FB9C00B15929 /* Build configuration list for PBXNativeTarget "jack_coremidi 64 bits" */;
+			buildPhases = (
+				4BDCDB941001FB9C00B15929 /* Headers */,
+				4BDCDB961001FB9C00B15929 /* Sources */,
+				4BDCDB981001FB9C00B15929 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_coremidi 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4BDCDB9D1001FB9C00B15929 /* jack_coremidi.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BDCDBB71001FCC000B15929 /* jack_net 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BDCDBC11001FCC000B15929 /* Build configuration list for PBXNativeTarget "jack_net 64 bits" */;
+			buildPhases = (
+				4BDCDBB81001FCC000B15929 /* Headers */,
+				4BDCDBBC1001FCC000B15929 /* Sources */,
+				4BDCDBC01001FCC000B15929 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_net 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4BDCDBC51001FCC000B15929 /* jack_net.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BDCDBD71001FD2D00B15929 /* netmanager 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BDCDBE41001FD2D00B15929 /* Build configuration list for PBXNativeTarget "netmanager 64 bits" */;
+			buildPhases = (
+				4BDCDBD81001FD2D00B15929 /* Headers */,
+				4BDCDBDD1001FD2D00B15929 /* Sources */,
+				4BDCDBE31001FD2D00B15929 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "netmanager 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4BDCDBE81001FD2D00B15929 /* netmanager.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BDCDBEC1001FD7300B15929 /* audioadapter 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BDCDBFB1001FD7300B15929 /* Build configuration list for PBXNativeTarget "audioadapter 64 bits" */;
+			buildPhases = (
+				4BDCDBED1001FD7300B15929 /* Headers */,
+				4BDCDBF31001FD7300B15929 /* Sources */,
+				4BDCDBFA1001FD7300B15929 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "audioadapter 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4BDCDBFF1001FD7300B15929 /* audioadapter.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BDCDC0F1001FDE300B15929 /* netadapter 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BDCDC211001FDE300B15929 /* Build configuration list for PBXNativeTarget "netadapter 64 bits" */;
+			buildPhases = (
+				4BDCDC101001FDE300B15929 /* Headers */,
+				4BDCDC181001FDE300B15929 /* Sources */,
+				4BDCDC201001FDE300B15929 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "netadapter 64 bits";
+			productName = jack_coreaudio;
+			productReference = 4BDCDC251001FDE300B15929 /* netadapter.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BE6C6910A3E096F005A203A /* jack_test Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BE6C69F0A3E096F005A203A /* Build configuration list for PBXNativeTarget "jack_test Universal" */;
+			buildPhases = (
+				4BE6C6920A3E096F005A203A /* Headers */,
+				4BE6C6950A3E096F005A203A /* Sources */,
+				4BE6C69D0A3E096F005A203A /* Frameworks */,
+				4BE6C69E0A3E096F005A203A /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_test Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4BE6C6A30A3E096F005A203A /* jack_test */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BE99D260AD7A04800C59091 /* jack_cpu Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BE99D2C0AD7A04800C59091 /* Build configuration list for PBXNativeTarget "jack_cpu Universal" */;
+			buildPhases = (
+				4BE99D270AD7A04800C59091 /* Headers */,
+				4BE99D280AD7A04800C59091 /* Sources */,
+				4BE99D2A0AD7A04800C59091 /* Frameworks */,
+				4BE99D2B0AD7A04800C59091 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_cpu Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4BE99D300AD7A04800C59091 /* jack_cpu */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BF339020F8B864B0080FB5B /* jack_coremidi Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BF339080F8B864B0080FB5B /* Build configuration list for PBXNativeTarget "jack_coremidi Universal" */;
+			buildPhases = (
+				4BF339030F8B864B0080FB5B /* Headers */,
+				4BF339050F8B864B0080FB5B /* Sources */,
+				4BF339070F8B864B0080FB5B /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_coremidi Universal";
+			productName = jack_coreaudio;
+			productReference = 4BF3390C0F8B864B0080FB5B /* jack_coremidi.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		4BFA5E8B0DEC4D9C00FA4CDB /* testMutex Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA5E940DEC4D9C00FA4CDB /* Build configuration list for PBXNativeTarget "testMutex Universal" */;
+			buildPhases = (
+				4BFA5E8C0DEC4D9C00FA4CDB /* Headers */,
+				4BFA5E8D0DEC4D9C00FA4CDB /* Sources */,
+				4BFA5E910DEC4D9C00FA4CDB /* Frameworks */,
+				4BFA5E930DEC4D9C00FA4CDB /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "testMutex Universal";
+			productInstallPath = /usr/local/bin;
+			productName = testSem;
+			productReference = 4BFA5E980DEC4D9C00FA4CDB /* testMutex */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA82820DF6A9E40087B4E1 /* jack_evmon 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA82880DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_evmon 64 bits" */;
+			buildPhases = (
+				4BFA82830DF6A9E40087B4E1 /* Headers */,
+				4BFA82840DF6A9E40087B4E1 /* Sources */,
+				4BFA82860DF6A9E40087B4E1 /* Frameworks */,
+				4BFA82870DF6A9E40087B4E1 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_evmon 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4BFA828C0DF6A9E40087B4E1 /* jack_evmon */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA82950DF6A9E40087B4E1 /* jack_bufsize 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA829B0DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_bufsize 64 bits" */;
+			buildPhases = (
+				4BFA82960DF6A9E40087B4E1 /* Headers */,
+				4BFA82970DF6A9E40087B4E1 /* Sources */,
+				4BFA82990DF6A9E40087B4E1 /* Frameworks */,
+				4BFA829A0DF6A9E40087B4E1 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_bufsize 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA82A10DF6A9E40087B4E1 /* jack_rec 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA82A70DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_rec 64 bits" */;
+			buildPhases = (
+				4BFA82A20DF6A9E40087B4E1 /* Headers */,
+				4BFA82A30DF6A9E40087B4E1 /* Sources */,
+				4BFA82A50DF6A9E40087B4E1 /* Frameworks */,
+				4BFA82A60DF6A9E40087B4E1 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_rec 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4BFA82AB0DF6A9E40087B4E1 /* jack_rec */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA82AD0DF6A9E40087B4E1 /* jack_monitor_client 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA82B30DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_monitor_client 64 bits" */;
+			buildPhases = (
+				4BFA82AE0DF6A9E40087B4E1 /* Headers */,
+				4BFA82AF0DF6A9E40087B4E1 /* Sources */,
+				4BFA82B10DF6A9E40087B4E1 /* Frameworks */,
+				4BFA82B20DF6A9E40087B4E1 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_monitor_client 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4BFA82B70DF6A9E40087B4E1 /* jack_monitor_client */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA82B90DF6A9E40087B4E1 /* jack_showtime 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA82BF0DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_showtime 64 bits" */;
+			buildPhases = (
+				4BFA82BA0DF6A9E40087B4E1 /* Headers */,
+				4BFA82BB0DF6A9E40087B4E1 /* Sources */,
+				4BFA82BD0DF6A9E40087B4E1 /* Frameworks */,
+				4BFA82BE0DF6A9E40087B4E1 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_showtime 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4BFA82C30DF6A9E40087B4E1 /* jack_showtime */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA82C50DF6A9E40087B4E1 /* jack_impulse_grabber 64 bits */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA82CB0DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_impulse_grabber 64 bits" */;
+			buildPhases = (
+				4BFA82C60DF6A9E40087B4E1 /* Headers */,
+				4BFA82C70DF6A9E40087B4E1 /* Sources */,
+				4BFA82C90DF6A9E40087B4E1 /* Frameworks */,
+				4BFA82CA0DF6A9E40087B4E1 /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jack_impulse_grabber 64 bits";
+			productInstallPath = /usr/local/bin;
+			productName = jack_metro;
+			productReference = 4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */;
+			productType = "com.apple.product-type.tool";
+		};
+		4BFA99980AAAF3B0009E916C /* jdelay Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4BFA999E0AAAF3B0009E916C /* Build configuration list for PBXNativeTarget "jdelay Universal" */;
+			buildPhases = (
+				4BFA99990AAAF3B0009E916C /* Headers */,
+				4BFA999A0AAAF3B0009E916C /* Sources */,
+				4BFA999C0AAAF3B0009E916C /* Frameworks */,
+				4BFA999D0AAAF3B0009E916C /* Rez */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "jdelay Universal";
+			productInstallPath = /usr/local/bin;
+			productName = jack_lsp;
+			productReference = 4BFA99A20AAAF3B0009E916C /* jdelay */;
+			productType = "com.apple.product-type.tool";
+		};
+		BA222AC50DC88132001A17F4 /* jack_net Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = BA222ACB0DC88132001A17F4 /* Build configuration list for PBXNativeTarget "jack_net Universal" */;
+			buildPhases = (
+				BA222AC60DC88132001A17F4 /* Headers */,
+				BA222AC80DC88132001A17F4 /* Sources */,
+				BA222ACA0DC88132001A17F4 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				4B3224E710A3157900838A8E /* PBXTargetDependency */,
+			);
+			name = "jack_net Universal";
+			productName = jack_coreaudio;
+			productReference = BA222ACF0DC88132001A17F4 /* jack_net.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+		BA222AE00DC882DB001A17F4 /* netmanager Universal */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = BA222AE50DC882DB001A17F4 /* Build configuration list for PBXNativeTarget "netmanager Universal" */;
+			buildPhases = (
+				BA222AE10DC882DB001A17F4 /* Headers */,
+				BA222AE20DC882DB001A17F4 /* Sources */,
+				BA222AE40DC882DB001A17F4 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "netmanager Universal";
+			productName = jack_coreaudio;
+			productReference = BA222AE90DC882DB001A17F4 /* netmanager.so */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		08FB7793FE84155DC02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 4B699DD5097D427F00A18468 /* Build configuration list for PBXProject "Jackdmp" */;
+			compatibilityVersion = "Xcode 2.4";
+			hasScannedForEncodings = 1;
+			mainGroup = 08FB7794FE84155DC02AAC07 /* JackServer */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				4B699B26097D421600A18468 /* All Universal 32 bits */,
+				4B35C6420D47339B000DE7AE /* All Universal 32/64 bits */,
+				4B699BA7097D421600A18468 /* jackdmp framework Universal */,
+				4B699C00097D421600A18468 /* Jackmp.framework Universal */,
+				4B699C4C097D421600A18468 /* Jackservermp.framework Universal */,
+				4B5A1BB10CD1CB9E0005BF74 /* jack_midiseq Universal */,
+				4B5A1BD00CD1CCE10005BF74 /* jack_midisine Universal */,
+				4B363DCE0DEB02F6001F72D9 /* jack_alias Universal */,
+				4B699CB1097D421600A18468 /* jack_metro Universal */,
+				4B699CC1097D421600A18468 /* jack_lsp Universal */,
+				4B699CD1097D421600A18468 /* jack_connect Universal */,
+				4B699CE1097D421600A18468 /* jack_disconnect Universal */,
+				4B699CF1097D421600A18468 /* jack_freewheel Universal */,
+				4BFA99980AAAF3B0009E916C /* jdelay Universal */,
+				4B699D03097D421600A18468 /* jack_external_metro Universal */,
+				4B699D13097D421600A18468 /* testAtomic Universal */,
+				4B699D27097D421600A18468 /* testSem Universal */,
+				4BFA5E8B0DEC4D9C00FA4CDB /* testMutex Universal */,
+				4B699D3F097D421600A18468 /* zombie Universal */,
+				4BE6C6910A3E096F005A203A /* jack_test Universal */,
+				4BA7FEB90D8E76270017FF73 /* jack_server_control Universal */,
+				4BE99D260AD7A04800C59091 /* jack_cpu Universal */,
+				4BA692A60CBE4BC700EAD520 /* jack_load Universal */,
+				4BA692CA0CBE4C9000EAD520 /* jack_unload Universal */,
+				4B0A28DC0D52073D002EFF74 /* jack_thread_wait */,
+				4B363E100DEB03C5001F72D9 /* jack_evmon Universal */,
+				4B363E440DEB0775001F72D9 /* jack_bufsize Universal */,
+				4B363EDF0DEB091C001F72D9 /* jack_rec Universal */,
+				4B363F140DEB0A6A001F72D9 /* jack_monitor_client Universal */,
+				4B363F2B0DEB0BD1001F72D9 /* jack_showtime Universal */,
+				4B363F680DEB0D4E001F72D9 /* jack_impulse_grabber Universal */,
+				4B32255710A3187800838A8E /* jack_netsource Universal */,
+				4B699D4F097D421600A18468 /* synchroServer Universal */,
+				4B699D67097D421600A18468 /* synchroClient Universal */,
+				4B699D7F097D421700A18468 /* synchroServerClient Universal */,
+				4B699D97097D421700A18468 /* jack_coreaudio Universal */,
+				4B978DB10A31CF4A009E2DD1 /* jack_portaudio Universal */,
+				4BF339020F8B864B0080FB5B /* jack_coremidi Universal */,
+				4B43A8B010145F6F00E52943 /* jack_loopback Universal */,
+				4B699DA6097D421700A18468 /* jack_dummy Universal */,
+				BA222AC50DC88132001A17F4 /* jack_net Universal */,
+				4B3224D710A3156800838A8E /* jack_netone Universal */,
+				4BD623ED0CBCF0F000DE782F /* inprocess Universal */,
+				BA222AE00DC882DB001A17F4 /* netmanager Universal */,
+				4B19B2F60E23620F00DD4A82 /* audioadapter Universal */,
+				4B5E08BF0E5B66EE00BEE4E0 /* netadapter Universal */,
+				4B35C41B0D4731D1000DE7AE /* jackdmp framework 64bits */,
+				4B35C4270D4731D1000DE7AE /* Jackmp.framework 64 bits */,
+				4B47AC8010B5890100469C67 /* Jackmp.framework 64 bits debugging */,
+				4B35C4850D4731D1000DE7AE /* Jackservermp.framework 64 bits */,
+				4BA3393310B2E36800190E3B /* Jackservermp.framework 64 bits profiling */,
+				4B35C50A0D4731D1000DE7AE /* jack_midiseq 64 bits */,
+				4B35C5160D4731D1000DE7AE /* jack_midisine 64 bits */,
+				4B35C5220D4731D1000DE7AE /* jack_metro 64 bits */,
+				4B35C52E0D4731D1000DE7AE /* jack_lsp 64 bits */,
+				4B35C53A0D4731D1000DE7AE /* jack_connect 64 bits */,
+				4B35C5460D4731D1000DE7AE /* jack_disconnect 64 bits */,
+				4B35C5520D4731D2000DE7AE /* jack_freewheel 64 bits */,
+				4B35C5600D4731D2000DE7AE /* jdelay 64 bits */,
+				4B35C56C0D4731D2000DE7AE /* jack_external_metro 64 bits */,
+				4B35C5780D4731D2000DE7AE /* testAtomic 64 bits */,
+				4B35C5880D4731D2000DE7AE /* testSem 64 bits */,
+				4B35C59C0D4731D2000DE7AE /* zombie 64 bits */,
+				4B35C5A80D4731D2000DE7AE /* jack_test 64 bits */,
+				4B35C5B40D4731D2000DE7AE /* jack_cpu 64 bits */,
+				4B35C5C00D4731D2000DE7AE /* jack_load 64 bits */,
+				4B35C5CC0D4731D2000DE7AE /* jack_unload 64 bits */,
+				4B0A29230D52108E002EFF74 /* jack_thread_wait 64 bits */,
+				4BFA82820DF6A9E40087B4E1 /* jack_evmon 64 bits */,
+				4BFA82950DF6A9E40087B4E1 /* jack_bufsize 64 bits */,
+				4BFA82A10DF6A9E40087B4E1 /* jack_rec 64 bits */,
+				4BFA82AD0DF6A9E40087B4E1 /* jack_monitor_client 64 bits */,
+				4BFA82B90DF6A9E40087B4E1 /* jack_showtime 64 bits */,
+				4BFA82C50DF6A9E40087B4E1 /* jack_impulse_grabber 64 bits */,
+				4B32257110A3190C00838A8E /* jack_netsource 64 bits */,
+				4B35C5D80D4731D2000DE7AE /* synchroServer 64 bits */,
+				4B35C5EC0D4731D2000DE7AE /* synchroClient 64 bits */,
+				4B35C6000D4731D2000DE7AE /* synchroServerClient 64 bits */,
+				4B35C6140D4731D2000DE7AE /* jack_coreaudio 64 bits */,
+				4B35C61F0D4731D2000DE7AE /* jack_portaudio 64 bits */,
+				4B35C62A0D4731D2000DE7AE /* jack_dummy 64 bits */,
+				4B43A8DD1014615800E52943 /* jack_loopback 64 bits */,
+				4BDCDB931001FB9C00B15929 /* jack_coremidi 64 bits */,
+				4BDCDBB71001FCC000B15929 /* jack_net 64 bits */,
+				4B32251D10A316B200838A8E /* jack_netone 64 bits */,
+				4BDCDBD71001FD2D00B15929 /* netmanager 64 bits */,
+				4BDCDBEC1001FD7300B15929 /* audioadapter 64 bits */,
+				4BDCDC0F1001FDE300B15929 /* netadapter 64 bits */,
+				4B35C6350D4731D3000DE7AE /* inprocess 64 bits */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		4B35C4560D4731D1000DE7AE /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4C20D4731D1000DE7AE /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B47ACAC10B5890100469C67 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C23097D421600A18468 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C7C097D421600A18468 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA3397010B2E36800190E3B /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+		4B0A28E10D52073D002EFF74 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B0A29280D52108E002EFF74 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32255C10A3187800838A8E /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32257610A3190C00838A8E /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4200D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C47D0D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4F60D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C50F0D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C51B0D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5270D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5330D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C53F0D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C54B0D4731D1000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5590D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5650D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5710D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5810D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5950D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5A10D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5AD0D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5B90D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5C50D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5D10D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5E50D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5F90D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C60D0D4731D2000DE7AE /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363DD30DEB02F6001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E150DEB03C5001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E490DEB0775001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363EE40DEB091C001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F190DEB0A6A001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F300DEB0BD1001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F6D0DEB0D4E001F72D9 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B47ACD010B5890100469C67 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BB60CD1CB9E0005BF74 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BD50CD1CCE10005BF74 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699BAC097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C41097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CA6097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CB6097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CC6097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CD6097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CE6097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CF8097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D08097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D1C097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D34097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D44097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D5C097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D74097D421600A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D8C097D421700A18468 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA339A510B2E36800190E3B /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692AB0CBE4BC700EAD520 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692CF0CBE4C9000EAD520 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA7FEBE0D8E76270017FF73 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE6C69E0A3E096F005A203A /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE99D2B0AD7A04800C59091 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA5E930DEC4D9C00FA4CDB /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82870DF6A9E40087B4E1 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA829A0DF6A9E40087B4E1 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82A60DF6A9E40087B4E1 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82B20DF6A9E40087B4E1 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82BE0DF6A9E40087B4E1 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82CA0DF6A9E40087B4E1 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA999D0AAAF3B0009E916C /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		4B0A28DE0D52073D002EFF74 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B0A28ED0D520852002EFF74 /* tw.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B0A29250D52108E002EFF74 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B0A29260D52108E002EFF74 /* tw.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B19B2F90E23620F00DD4A82 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B19B3130E2362E800DD4A82 /* JackAudioAdapter.cpp in Sources */,
+				4B19B3150E2362E800DD4A82 /* JackAudioAdapterInterface.cpp in Sources */,
+				4B19B31B0E2362E800DD4A82 /* JackLibSampleRateResampler.cpp in Sources */,
+				4B19B31F0E2362E800DD4A82 /* JackResampler.cpp in Sources */,
+				4BF4BAB10E3480AB00403CDF /* JackAudioAdapterFactory.cpp in Sources */,
+				4BE5FED10E725C320020B576 /* JackCoreAudioAdapter.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B3224DC10A3156800838A8E /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B3224EA10A315B100838A8E /* JackNetOneDriver.cpp in Sources */,
+				4B3224F010A315C400838A8E /* netjack_packet.c in Sources */,
+				4B3224F210A315C400838A8E /* netjack.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32252210A316B200838A8E /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B32253110A3173900838A8E /* JackNetOneDriver.cpp in Sources */,
+				4B32253310A3173B00838A8E /* netjack.c in Sources */,
+				4B32253510A3173D00838A8E /* netjack_packet.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32255910A3187800838A8E /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B32256410A318E300838A8E /* netsource.c in Sources */,
+				4B32256B10A318FA00838A8E /* netjack.c in Sources */,
+				4B32256D10A318FC00838A8E /* netjack_packet.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B32257310A3190C00838A8E /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B32257D10A3195700838A8E /* netjack.c in Sources */,
+				4B32257F10A3195900838A8E /* netjack_packet.c in Sources */,
+				4B32258110A3195B00838A8E /* netsource.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C41D0D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C41E0D4731D1000DE7AE /* Jackdmp.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4570D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C4580D4731D1000DE7AE /* JackMacLibClientRPC.cpp in Sources */,
+				4B35C4590D4731D1000DE7AE /* JackRPCEngineUser.c in Sources */,
+				4B35C45A0D4731D1000DE7AE /* JackMachPort.cpp in Sources */,
+				4B35C45B0D4731D1000DE7AE /* JackShmMem.cpp in Sources */,
+				4B35C45C0D4731D1000DE7AE /* shm.c in Sources */,
+				4B35C45E0D4731D1000DE7AE /* JackActivationCount.cpp in Sources */,
+				4B35C45F0D4731D1000DE7AE /* JackGraphManager.cpp in Sources */,
+				4B35C4600D4731D1000DE7AE /* JackPort.cpp in Sources */,
+				4B35C4610D4731D1000DE7AE /* JackClient.cpp in Sources */,
+				4B35C4620D4731D1000DE7AE /* JackAPI.cpp in Sources */,
+				4B35C4630D4731D1000DE7AE /* JackLibClient.cpp in Sources */,
+				4B35C4640D4731D1000DE7AE /* JackLibAPI.cpp in Sources */,
+				4B35C4650D4731D1000DE7AE /* JackConnectionManager.cpp in Sources */,
+				4B35C4660D4731D1000DE7AE /* JackFrameTimer.cpp in Sources */,
+				4B35C4680D4731D1000DE7AE /* JackMachSemaphore.cpp in Sources */,
+				4B35C4690D4731D1000DE7AE /* JackMachThread.cpp in Sources */,
+				4B35C46A0D4731D1000DE7AE /* JackMachClientChannel.cpp in Sources */,
+				4B35C4700D4731D1000DE7AE /* JackGlobals.cpp in Sources */,
+				4B35C4720D4731D1000DE7AE /* ringbuffer.c in Sources */,
+				4B35C4730D4731D1000DE7AE /* JackDebugClient.cpp in Sources */,
+				4B35C4740D4731D1000DE7AE /* JackTransportEngine.cpp in Sources */,
+				4B35C4760D4731D1000DE7AE /* timestamps.c in Sources */,
+				4B35C4770D4731D1000DE7AE /* JackPortType.cpp in Sources */,
+				4B35C4780D4731D1000DE7AE /* JackAudioPort.cpp in Sources */,
+				4B35C4790D4731D1000DE7AE /* JackMidiPort.cpp in Sources */,
+				4B35C47A0D4731D1000DE7AE /* JackMidiAPI.cpp in Sources */,
+				4B35C47B0D4731D1000DE7AE /* JackEngineControl.cpp in Sources */,
+				4B35C47C0D4731D1000DE7AE /* JackTools.cpp in Sources */,
+				4B9A26610DBF8ADD006E9FBC /* JackError.cpp in Sources */,
+				4B4F9C900DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */,
+				4B93F19C0E87998200E4ECCD /* JackPosixServerLaunch.cpp in Sources */,
+				4B93F19D0E87998400E4ECCD /* JackPosixThread.cpp in Sources */,
+				4B93F1C00E87A35400E4ECCD /* JackMachTime.c in Sources */,
+				4BECB2F90F4451C10091B70A /* JackProcessSync.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C4C30D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C4C40D4731D1000DE7AE /* JackMachPort.cpp in Sources */,
+				4B35C4C50D4731D1000DE7AE /* JackShmMem.cpp in Sources */,
+				4B35C4C60D4731D1000DE7AE /* shm.c in Sources */,
+				4B35C4C80D4731D1000DE7AE /* JackActivationCount.cpp in Sources */,
+				4B35C4C90D4731D1000DE7AE /* JackGraphManager.cpp in Sources */,
+				4B35C4CA0D4731D1000DE7AE /* JackPort.cpp in Sources */,
+				4B35C4CB0D4731D1000DE7AE /* JackClient.cpp in Sources */,
+				4B35C4CC0D4731D1000DE7AE /* JackAPI.cpp in Sources */,
+				4B35C4CD0D4731D1000DE7AE /* JackConnectionManager.cpp in Sources */,
+				4B35C4CE0D4731D1000DE7AE /* JackFrameTimer.cpp in Sources */,
+				4B35C4D00D4731D1000DE7AE /* JackMachSemaphore.cpp in Sources */,
+				4B35C4D10D4731D1000DE7AE /* JackMachThread.cpp in Sources */,
+				4B35C4D50D4731D1000DE7AE /* JackGlobals.cpp in Sources */,
+				4B35C4D70D4731D1000DE7AE /* ringbuffer.c in Sources */,
+				4B35C4D80D4731D1000DE7AE /* JackAudioDriver.cpp in Sources */,
+				4B35C4D90D4731D1000DE7AE /* JackFreewheelDriver.cpp in Sources */,
+				4B35C4DA0D4731D1000DE7AE /* JackThreadedDriver.cpp in Sources */,
+				4B35C4DB0D4731D1000DE7AE /* JackDriver.cpp in Sources */,
+				4B35C4DC0D4731D1000DE7AE /* JackDriverLoader.cpp in Sources */,
+				4B35C4DD0D4731D1000DE7AE /* JackEngine.cpp in Sources */,
+				4B35C4DE0D4731D1000DE7AE /* JackExternalClient.cpp in Sources */,
+				4B35C4DF0D4731D1000DE7AE /* JackInternalClient.cpp in Sources */,
+				4B35C4E00D4731D1000DE7AE /* JackRPCClientUser.c in Sources */,
+				4B35C4E20D4731D1000DE7AE /* JackServer.cpp in Sources */,
+				4B35C4E60D4731D1000DE7AE /* JackMacEngineRPC.cpp in Sources */,
+				4B35C4E70D4731D1000DE7AE /* JackMachNotifyChannel.cpp in Sources */,
+				4B35C4E80D4731D1000DE7AE /* JackMachServerChannel.cpp in Sources */,
+				4B35C4E90D4731D1000DE7AE /* JackMachServerNotifyChannel.cpp in Sources */,
+				4B35C4EB0D4731D1000DE7AE /* JackTransportEngine.cpp in Sources */,
+				4B35C4EC0D4731D1000DE7AE /* JackServerAPI.cpp in Sources */,
+				4B35C4ED0D4731D1000DE7AE /* JackServerGlobals.cpp in Sources */,
+				4B35C4EE0D4731D1000DE7AE /* timestamps.c in Sources */,
+				4B35C4EF0D4731D1000DE7AE /* JackPortType.cpp in Sources */,
+				4B35C4F00D4731D1000DE7AE /* JackAudioPort.cpp in Sources */,
+				4B35C4F10D4731D1000DE7AE /* JackMidiPort.cpp in Sources */,
+				4B35C4F20D4731D1000DE7AE /* JackMidiAPI.cpp in Sources */,
+				4B35C4F30D4731D1000DE7AE /* JackEngineControl.cpp in Sources */,
+				4B35C4F40D4731D1000DE7AE /* JackDebugClient.cpp in Sources */,
+				4B35C4F50D4731D1000DE7AE /* JackTools.cpp in Sources */,
+				BA222ADA0DC88269001A17F4 /* JackNetTool.cpp in Sources */,
+				4B9A26640DBF8B14006E9FBC /* JackError.cpp in Sources */,
+				4B4F9C920DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */,
+				4B4CA9780E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */,
+				4B4E9AFC0E5F1090000A3278 /* JackControlAPI.cpp in Sources */,
+				4B93F1990E87992100E4ECCD /* JackPosixThread.cpp in Sources */,
+				4B93F22B0E87A72500E4ECCD /* JackMachTime.c in Sources */,
+				4BBAE4130F42FA6100B8BD3F /* JackEngineProfiling.cpp in Sources */,
+				4BECB2FB0F4451C10091B70A /* JackProcessSync.cpp in Sources */,
+				4BF339210F8B873E0080FB5B /* JackMidiDriver.cpp in Sources */,
+				4BDCDBD11001FD0100B15929 /* JackWaitThreadedDriver.cpp in Sources */,
+				4BDCDC091001FDA800B15929 /* JackArgParser.cpp in Sources */,
+				4BCBCE6110C4FE3F00450FFE /* JackPhysicalMidiInput.cpp in Sources */,
+				4BCBCE6310C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C50C0D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C50D0D4731D1000DE7AE /* midiseq.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5180D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5190D4731D1000DE7AE /* midisine.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5240D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5250D4731D1000DE7AE /* metro.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5300D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5310D4731D1000DE7AE /* lsp.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C53C0D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C53D0D4731D1000DE7AE /* connect.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5480D4731D1000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5490D4731D1000DE7AE /* connect.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5560D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5570D4731D2000DE7AE /* freewheel.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5620D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5630D4731D2000DE7AE /* jdelay.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C56E0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C57C0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C57D0D4731D2000DE7AE /* testAtomic.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C58C0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C58D0D4731D2000DE7AE /* testSem.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C59E0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C59F0D4731D2000DE7AE /* zombie.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5AA0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5AB0D4731D2000DE7AE /* test.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5B60D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5B70D4731D2000DE7AE /* cpu.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5C20D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5C30D4731D2000DE7AE /* ipload.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5CE0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5CF0D4731D2000DE7AE /* ipunload.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5DC0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5DD0D4731D2000DE7AE /* JackMachSemaphore.cpp in Sources */,
+				4B35C5E00D4731D2000DE7AE /* JackMachThread.cpp in Sources */,
+				4B35C5E20D4731D2000DE7AE /* testSynchroServer.cpp in Sources */,
+				4B9A26790DBF8B88006E9FBC /* JackError.cpp in Sources */,
+				4B4F9D820DC2178E00706CB0 /* JackMessageBuffer.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C5F00D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C5F60D4731D2000DE7AE /* testSynchroClient.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6040D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C60A0D4731D2000DE7AE /* testSynchroServerClient.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6170D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA4ADB40E87AB2500F26C85 /* JackCoreAudioDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6220D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C62D0D4731D2000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C62E0D4731D2000DE7AE /* JackDummyDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B35C6370D4731D3000DE7AE /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B35C6380D4731D3000DE7AE /* inprocess.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363DD00DEB02F6001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363DDF0DEB034E001F72D9 /* alias.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E120DEB03C5001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363E210DEB0401001F72D9 /* evmon.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363E460DEB0775001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363E720DEB0808001F72D9 /* bufsize.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363EE10DEB091C001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363EEE0DEB094B001F72D9 /* capture_client.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F160DEB0A6A001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363F230DEB0AB0001F72D9 /* monitor_client.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F2D0DEB0BD1001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363F3E0DEB0C31001F72D9 /* showtime.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B363F6A0DEB0D4E001F72D9 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B363F760DEB0D7D001F72D9 /* impulse_grabber.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B43A8B310145F6F00E52943 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B43A8CA1014605000E52943 /* JackLoopbackDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B43A8E01014615800E52943 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B43A8E11014615800E52943 /* JackLoopbackDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B47ACAD10B5890100469C67 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B47ACAE10B5890100469C67 /* JackMacLibClientRPC.cpp in Sources */,
+				4B47ACAF10B5890100469C67 /* JackRPCEngineUser.c in Sources */,
+				4B47ACB010B5890100469C67 /* JackMachPort.cpp in Sources */,
+				4B47ACB110B5890100469C67 /* JackShmMem.cpp in Sources */,
+				4B47ACB210B5890100469C67 /* shm.c in Sources */,
+				4B47ACB310B5890100469C67 /* JackActivationCount.cpp in Sources */,
+				4B47ACB410B5890100469C67 /* JackGraphManager.cpp in Sources */,
+				4B47ACB510B5890100469C67 /* JackPort.cpp in Sources */,
+				4B47ACB610B5890100469C67 /* JackClient.cpp in Sources */,
+				4B47ACB710B5890100469C67 /* JackAPI.cpp in Sources */,
+				4B47ACB810B5890100469C67 /* JackLibClient.cpp in Sources */,
+				4B47ACB910B5890100469C67 /* JackLibAPI.cpp in Sources */,
+				4B47ACBA10B5890100469C67 /* JackConnectionManager.cpp in Sources */,
+				4B47ACBB10B5890100469C67 /* JackFrameTimer.cpp in Sources */,
+				4B47ACBC10B5890100469C67 /* JackMachSemaphore.cpp in Sources */,
+				4B47ACBD10B5890100469C67 /* JackMachThread.cpp in Sources */,
+				4B47ACBE10B5890100469C67 /* JackMachClientChannel.cpp in Sources */,
+				4B47ACBF10B5890100469C67 /* JackGlobals.cpp in Sources */,
+				4B47ACC010B5890100469C67 /* ringbuffer.c in Sources */,
+				4B47ACC110B5890100469C67 /* JackDebugClient.cpp in Sources */,
+				4B47ACC210B5890100469C67 /* JackTransportEngine.cpp in Sources */,
+				4B47ACC310B5890100469C67 /* timestamps.c in Sources */,
+				4B47ACC410B5890100469C67 /* JackPortType.cpp in Sources */,
+				4B47ACC510B5890100469C67 /* JackAudioPort.cpp in Sources */,
+				4B47ACC610B5890100469C67 /* JackMidiPort.cpp in Sources */,
+				4B47ACC710B5890100469C67 /* JackMidiAPI.cpp in Sources */,
+				4B47ACC810B5890100469C67 /* JackEngineControl.cpp in Sources */,
+				4B47ACC910B5890100469C67 /* JackTools.cpp in Sources */,
+				4B47ACCA10B5890100469C67 /* JackError.cpp in Sources */,
+				4B47ACCB10B5890100469C67 /* JackMessageBuffer.cpp in Sources */,
+				4B47ACCC10B5890100469C67 /* JackPosixServerLaunch.cpp in Sources */,
+				4B47ACCD10B5890100469C67 /* JackPosixThread.cpp in Sources */,
+				4B47ACCE10B5890100469C67 /* JackMachTime.c in Sources */,
+				4B47ACCF10B5890100469C67 /* JackProcessSync.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BB30CD1CB9E0005BF74 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B5A1BBE0CD1CC110005BF74 /* midiseq.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5A1BD20CD1CCE10005BF74 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B5A1BDD0CD1CD420005BF74 /* midisine.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B5E08C90E5B66EE00BEE4E0 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B5E08CC0E5B66EE00BEE4E0 /* JackAudioAdapterInterface.cpp in Sources */,
+				4B5E08CD0E5B66EE00BEE4E0 /* JackLibSampleRateResampler.cpp in Sources */,
+				4B5E08CE0E5B66EE00BEE4E0 /* JackResampler.cpp in Sources */,
+				4B5E08E10E5B676C00BEE4E0 /* JackNetAdapter.cpp in Sources */,
+				4B5E08EB0E5B67EA00BEE4E0 /* JackNetInterface.cpp in Sources */,
+				4B5E08EE0E5B680200BEE4E0 /* JackAudioAdapter.cpp in Sources */,
+				4BC3B6BF0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699BA9097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699BAA097D421600A18468 /* Jackdmp.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C24097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699C25097D421600A18468 /* JackMacLibClientRPC.cpp in Sources */,
+				4B699C26097D421600A18468 /* JackRPCEngineUser.c in Sources */,
+				4B699C27097D421600A18468 /* JackMachPort.cpp in Sources */,
+				4B699C28097D421600A18468 /* JackShmMem.cpp in Sources */,
+				4B699C29097D421600A18468 /* shm.c in Sources */,
+				4B699C2B097D421600A18468 /* JackActivationCount.cpp in Sources */,
+				4B699C2C097D421600A18468 /* JackGraphManager.cpp in Sources */,
+				4B699C2D097D421600A18468 /* JackPort.cpp in Sources */,
+				4B699C2E097D421600A18468 /* JackClient.cpp in Sources */,
+				4B699C2F097D421600A18468 /* JackAPI.cpp in Sources */,
+				4B699C30097D421600A18468 /* JackLibClient.cpp in Sources */,
+				4B699C31097D421600A18468 /* JackLibAPI.cpp in Sources */,
+				4B699C32097D421600A18468 /* JackConnectionManager.cpp in Sources */,
+				4B699C33097D421600A18468 /* JackFrameTimer.cpp in Sources */,
+				4B699C35097D421600A18468 /* JackMachSemaphore.cpp in Sources */,
+				4B699C36097D421600A18468 /* JackMachThread.cpp in Sources */,
+				4B699C37097D421600A18468 /* JackMachClientChannel.cpp in Sources */,
+				4B699C3D097D421600A18468 /* JackGlobals.cpp in Sources */,
+				4B699C3F097D421600A18468 /* ringbuffer.c in Sources */,
+				4B699C40097D421600A18468 /* JackDebugClient.cpp in Sources */,
+				4BF520530CB8D0E80037470E /* timestamps.c in Sources */,
+				4BAB95B80B9E20B800A0C723 /* JackPortType.cpp in Sources */,
+				4BAB95ED0B9E21A500A0C723 /* JackAudioPort.cpp in Sources */,
+				4B80D7E90BA0D17400F035BB /* JackMidiPort.cpp in Sources */,
+				4B80D7EA0BA0D17400F035BB /* JackMidiAPI.cpp in Sources */,
+				4BE4CC010CDA153400CCF5BB /* JackTools.cpp in Sources */,
+				4B9A25B50DBF8330006E9FBC /* JackError.cpp in Sources */,
+				4B4F9C8E0DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */,
+				4BB9D4B40E2610B400351653 /* JackTransportEngine.cpp in Sources */,
+				4BB9D4E40E26112900351653 /* JackEngineControl.cpp in Sources */,
+				4BC3B6A40E703B2E0066E42F /* JackPosixThread.cpp in Sources */,
+				4BF5FBBC0E878B9C003D2374 /* JackPosixServerLaunch.cpp in Sources */,
+				4BF5FBCB0E878D24003D2374 /* JackMachTime.c in Sources */,
+				4BECB2F70F4451C10091B70A /* JackProcessSync.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699C7D097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699C7E097D421600A18468 /* JackMachPort.cpp in Sources */,
+				4B699C7F097D421600A18468 /* JackShmMem.cpp in Sources */,
+				4B699C80097D421600A18468 /* shm.c in Sources */,
+				4B699C82097D421600A18468 /* JackActivationCount.cpp in Sources */,
+				4B699C83097D421600A18468 /* JackGraphManager.cpp in Sources */,
+				4B699C84097D421600A18468 /* JackPort.cpp in Sources */,
+				4B699C85097D421600A18468 /* JackClient.cpp in Sources */,
+				4B699C86097D421600A18468 /* JackAPI.cpp in Sources */,
+				4B699C87097D421600A18468 /* JackConnectionManager.cpp in Sources */,
+				4B699C88097D421600A18468 /* JackFrameTimer.cpp in Sources */,
+				4B699C8A097D421600A18468 /* JackMachSemaphore.cpp in Sources */,
+				4B699C8B097D421600A18468 /* JackMachThread.cpp in Sources */,
+				4B699C8F097D421600A18468 /* JackGlobals.cpp in Sources */,
+				4B699C91097D421600A18468 /* ringbuffer.c in Sources */,
+				4B699C92097D421600A18468 /* JackAudioDriver.cpp in Sources */,
+				4B699C93097D421600A18468 /* JackFreewheelDriver.cpp in Sources */,
+				4B699C94097D421600A18468 /* JackThreadedDriver.cpp in Sources */,
+				4B699C95097D421600A18468 /* JackDriver.cpp in Sources */,
+				4B699C96097D421600A18468 /* JackDriverLoader.cpp in Sources */,
+				4B699C97097D421600A18468 /* JackEngine.cpp in Sources */,
+				4B699C99097D421600A18468 /* JackExternalClient.cpp in Sources */,
+				4B699C9A097D421600A18468 /* JackInternalClient.cpp in Sources */,
+				4B699C9B097D421600A18468 /* JackRPCClientUser.c in Sources */,
+				4B699C9D097D421600A18468 /* JackServer.cpp in Sources */,
+				4B699CA1097D421600A18468 /* JackMacEngineRPC.cpp in Sources */,
+				4B699CA2097D421600A18468 /* JackMachNotifyChannel.cpp in Sources */,
+				4B699CA3097D421600A18468 /* JackMachServerChannel.cpp in Sources */,
+				4B699CA4097D421600A18468 /* JackMachServerNotifyChannel.cpp in Sources */,
+				4BD4B4D909BACD9600750C0F /* JackTransportEngine.cpp in Sources */,
+				4BC216850A444BAD00BDA09F /* JackServerAPI.cpp in Sources */,
+				4BC216890A444BDE00BDA09F /* JackServerGlobals.cpp in Sources */,
+				4BF520540CB8D0E80037470E /* timestamps.c in Sources */,
+				4BAB95BA0B9E20B800A0C723 /* JackPortType.cpp in Sources */,
+				4BAB95EE0B9E21A500A0C723 /* JackAudioPort.cpp in Sources */,
+				4B80D7EC0BA0D17400F035BB /* JackMidiPort.cpp in Sources */,
+				4B80D7ED0BA0D17400F035BB /* JackMidiAPI.cpp in Sources */,
+				4B6F7AEE0CD0CDBD00F48A9D /* JackEngineControl.cpp in Sources */,
+				4B5DB9830CD2429A00EBA5EE /* JackDebugClient.cpp in Sources */,
+				4BE4CC030CDA153500CCF5BB /* JackTools.cpp in Sources */,
+				BA222AD80DC88268001A17F4 /* JackNetTool.cpp in Sources */,
+				4B9A25B60DBF8330006E9FBC /* JackError.cpp in Sources */,
+				4B4F9C8C0DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */,
+				4BBC93BA0DF9736C002DF220 /* JackWaitThreadedDriver.cpp in Sources */,
+				4B4CA9760E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */,
+				4B4E9AFA0E5F1090000A3278 /* JackControlAPI.cpp in Sources */,
+				4BC3B6A60E703B2E0066E42F /* JackPosixThread.cpp in Sources */,
+				4BF5FBCA0E878D24003D2374 /* JackMachTime.c in Sources */,
+				4BF2841A0F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */,
+				4BBAE4110F42FA6100B8BD3F /* JackEngineProfiling.cpp in Sources */,
+				4BECB2F50F4451C10091B70A /* JackProcessSync.cpp in Sources */,
+				4BF339230F8B873E0080FB5B /* JackMidiDriver.cpp in Sources */,
+				4BCBCE5D10C4FE3F00450FFE /* JackPhysicalMidiInput.cpp in Sources */,
+				4BCBCE5F10C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CB3097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699CB4097D421600A18468 /* metro.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CC3097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699CC4097D421600A18468 /* lsp.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CD3097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B60CE490AAABA31004956AA /* connect.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CE3097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B60CE4A0AAABA31004956AA /* connect.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699CF5097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699CF6097D421600A18468 /* freewheel.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D05097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D17097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699D18097D421600A18468 /* testAtomic.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D2B097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699D2C097D421600A18468 /* testSem.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D41097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699D42097D421600A18468 /* zombie.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D53097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699D59097D421600A18468 /* testSynchroServer.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D6B097D421600A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699D71097D421600A18468 /* testSynchroClient.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D83097D421700A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699D89097D421700A18468 /* testSynchroServerClient.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699D9A097D421700A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BE5FECD0E725C090020B576 /* JackCoreAudioDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B699DA9097D421700A18468 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B699DAA097D421700A18468 /* JackDummyDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4B978DB40A31CF4A009E2DD1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BBB00D30E72614F0018AB1B /* JackPortAudioDevices.cpp in Sources */,
+				4BBB00D50E72614F0018AB1B /* JackPortAudioDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA3397110B2E36800190E3B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA3397210B2E36800190E3B /* JackMachPort.cpp in Sources */,
+				4BA3397310B2E36800190E3B /* JackShmMem.cpp in Sources */,
+				4BA3397410B2E36800190E3B /* shm.c in Sources */,
+				4BA3397510B2E36800190E3B /* JackActivationCount.cpp in Sources */,
+				4BA3397610B2E36800190E3B /* JackGraphManager.cpp in Sources */,
+				4BA3397710B2E36800190E3B /* JackPort.cpp in Sources */,
+				4BA3397810B2E36800190E3B /* JackClient.cpp in Sources */,
+				4BA3397910B2E36800190E3B /* JackAPI.cpp in Sources */,
+				4BA3397A10B2E36800190E3B /* JackConnectionManager.cpp in Sources */,
+				4BA3397B10B2E36800190E3B /* JackFrameTimer.cpp in Sources */,
+				4BA3397C10B2E36800190E3B /* JackMachSemaphore.cpp in Sources */,
+				4BA3397D10B2E36800190E3B /* JackMachThread.cpp in Sources */,
+				4BA3397E10B2E36800190E3B /* JackGlobals.cpp in Sources */,
+				4BA3397F10B2E36800190E3B /* ringbuffer.c in Sources */,
+				4BA3398010B2E36800190E3B /* JackAudioDriver.cpp in Sources */,
+				4BA3398110B2E36800190E3B /* JackFreewheelDriver.cpp in Sources */,
+				4BA3398210B2E36800190E3B /* JackThreadedDriver.cpp in Sources */,
+				4BA3398310B2E36800190E3B /* JackDriver.cpp in Sources */,
+				4BA3398410B2E36800190E3B /* JackDriverLoader.cpp in Sources */,
+				4BA3398510B2E36800190E3B /* JackEngine.cpp in Sources */,
+				4BA3398610B2E36800190E3B /* JackExternalClient.cpp in Sources */,
+				4BA3398710B2E36800190E3B /* JackInternalClient.cpp in Sources */,
+				4BA3398810B2E36800190E3B /* JackRPCClientUser.c in Sources */,
+				4BA3398910B2E36800190E3B /* JackServer.cpp in Sources */,
+				4BA3398A10B2E36800190E3B /* JackMacEngineRPC.cpp in Sources */,
+				4BA3398B10B2E36800190E3B /* JackMachNotifyChannel.cpp in Sources */,
+				4BA3398C10B2E36800190E3B /* JackMachServerChannel.cpp in Sources */,
+				4BA3398D10B2E36800190E3B /* JackMachServerNotifyChannel.cpp in Sources */,
+				4BA3398E10B2E36800190E3B /* JackTransportEngine.cpp in Sources */,
+				4BA3398F10B2E36800190E3B /* JackServerAPI.cpp in Sources */,
+				4BA3399010B2E36800190E3B /* JackServerGlobals.cpp in Sources */,
+				4BA3399110B2E36800190E3B /* timestamps.c in Sources */,
+				4BA3399210B2E36800190E3B /* JackPortType.cpp in Sources */,
+				4BA3399310B2E36800190E3B /* JackAudioPort.cpp in Sources */,
+				4BA3399410B2E36800190E3B /* JackMidiPort.cpp in Sources */,
+				4BA3399510B2E36800190E3B /* JackMidiAPI.cpp in Sources */,
+				4BA3399610B2E36800190E3B /* JackEngineControl.cpp in Sources */,
+				4BA3399710B2E36800190E3B /* JackDebugClient.cpp in Sources */,
+				4BA3399810B2E36800190E3B /* JackTools.cpp in Sources */,
+				4BA3399910B2E36800190E3B /* JackNetTool.cpp in Sources */,
+				4BA3399A10B2E36800190E3B /* JackError.cpp in Sources */,
+				4BA3399B10B2E36800190E3B /* JackMessageBuffer.cpp in Sources */,
+				4BA3399C10B2E36800190E3B /* JackRestartThreadedDriver.cpp in Sources */,
+				4BA3399D10B2E36800190E3B /* JackControlAPI.cpp in Sources */,
+				4BA3399E10B2E36800190E3B /* JackPosixThread.cpp in Sources */,
+				4BA3399F10B2E36800190E3B /* JackMachTime.c in Sources */,
+				4BA339A010B2E36800190E3B /* JackEngineProfiling.cpp in Sources */,
+				4BA339A110B2E36800190E3B /* JackProcessSync.cpp in Sources */,
+				4BA339A210B2E36800190E3B /* JackMidiDriver.cpp in Sources */,
+				4BA339A310B2E36800190E3B /* JackWaitThreadedDriver.cpp in Sources */,
+				4BA339A410B2E36800190E3B /* JackArgParser.cpp in Sources */,
+				4BCBCE6510C4FE3F00450FFE /* JackPhysicalMidiInput.cpp in Sources */,
+				4BCBCE6710C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692A80CBE4BC700EAD520 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA692B30CBE4C2D00EAD520 /* ipload.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA692CC0CBE4C9000EAD520 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA692D70CBE4CC600EAD520 /* ipunload.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BA7FEBB0D8E76270017FF73 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BA7FECA0D8E76650017FF73 /* control.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BD623F00CBCF0F000DE782F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BD6240D0CBCF16600DE782F /* inprocess.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDB961001FB9C00B15929 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDB971001FB9C00B15929 /* JackCoreMidiDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBBC1001FCC000B15929 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDBBD1001FCC000B15929 /* JackNetDriver.cpp in Sources */,
+				4BDCDBBE1001FCC000B15929 /* JackNetInterface.cpp in Sources */,
+				4BDCDBBF1001FCC000B15929 /* JackNetUnixSocket.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBDD1001FD2D00B15929 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDBDE1001FD2D00B15929 /* JackNetManager.cpp in Sources */,
+				4BDCDBDF1001FD2D00B15929 /* JackNetInterface.cpp in Sources */,
+				4BDCDBE01001FD2D00B15929 /* JackNetUnixSocket.cpp in Sources */,
+				4BDCDBE11001FD2D00B15929 /* JackMachTime.c in Sources */,
+				4BDCDBE21001FD2D00B15929 /* JackArgParser.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDBF31001FD7300B15929 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDBF41001FD7300B15929 /* JackAudioAdapter.cpp in Sources */,
+				4BDCDBF51001FD7300B15929 /* JackAudioAdapterInterface.cpp in Sources */,
+				4BDCDBF61001FD7300B15929 /* JackLibSampleRateResampler.cpp in Sources */,
+				4BDCDBF71001FD7300B15929 /* JackResampler.cpp in Sources */,
+				4BDCDBF81001FD7300B15929 /* JackAudioAdapterFactory.cpp in Sources */,
+				4BDCDBF91001FD7300B15929 /* JackCoreAudioAdapter.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BDCDC181001FDE300B15929 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BDCDC191001FDE300B15929 /* JackAudioAdapterInterface.cpp in Sources */,
+				4BDCDC1A1001FDE300B15929 /* JackLibSampleRateResampler.cpp in Sources */,
+				4BDCDC1B1001FDE300B15929 /* JackResampler.cpp in Sources */,
+				4BDCDC1C1001FDE300B15929 /* JackNetAdapter.cpp in Sources */,
+				4BDCDC1D1001FDE300B15929 /* JackNetInterface.cpp in Sources */,
+				4BDCDC1E1001FDE300B15929 /* JackAudioAdapter.cpp in Sources */,
+				4BDCDC1F1001FDE300B15929 /* JackNetUnixSocket.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE6C6950A3E096F005A203A /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BE6C6AD0A3E0A65005A203A /* test.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BE99D280AD7A04800C59091 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4B3F49080AD8503300491C6E /* cpu.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BF339050F8B864B0080FB5B /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BF3391B0F8B86DC0080FB5B /* JackCoreMidiDriver.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA5E8D0DEC4D9C00FA4CDB /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA5E9F0DEC4DD900FA4CDB /* testMutex.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82840DF6A9E40087B4E1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA82850DF6A9E40087B4E1 /* evmon.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82970DF6A9E40087B4E1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA82980DF6A9E40087B4E1 /* bufsize.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82A30DF6A9E40087B4E1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA82A40DF6A9E40087B4E1 /* capture_client.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82AF0DF6A9E40087B4E1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA82B00DF6A9E40087B4E1 /* monitor_client.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82BB0DF6A9E40087B4E1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA82BC0DF6A9E40087B4E1 /* showtime.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA82C70DF6A9E40087B4E1 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA82C80DF6A9E40087B4E1 /* impulse_grabber.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4BFA999A0AAAF3B0009E916C /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				4BFA99AA0AAAF40C009E916C /* jdelay.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		BA222AC80DC88132001A17F4 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				BA222ADE0DC882A5001A17F4 /* JackNetDriver.cpp in Sources */,
+				4B76C76A0E5AB2DB00E2AC21 /* JackNetInterface.cpp in Sources */,
+				4BC3B6BB0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		BA222AE20DC882DB001A17F4 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				BA222AED0DC883B3001A17F4 /* JackNetManager.cpp in Sources */,
+				4B76C76C0E5AB2DB00E2AC21 /* JackNetInterface.cpp in Sources */,
+				4BC3B6BD0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */,
+				4BF5FBC90E878D24003D2374 /* JackMachTime.c in Sources */,
+				4BF284180F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		4B0A28F40D520D11002EFF74 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B0A28DC0D52073D002EFF74 /* jack_thread_wait */;
+			targetProxy = 4B0A28F30D520D11002EFF74 /* PBXContainerItemProxy */;
+		};
+		4B0A29300D5210C4002EFF74 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B0A29230D52108E002EFF74 /* jack_thread_wait 64 bits */;
+			targetProxy = 4B0A292F0D5210C4002EFF74 /* PBXContainerItemProxy */;
+		};
+		4B19B32C0E23636E00DD4A82 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B19B2F60E23620F00DD4A82 /* audioadapter Universal */;
+			targetProxy = 4B19B32B0E23636E00DD4A82 /* PBXContainerItemProxy */;
+		};
+		4B224B340E65BA330066BE5B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B5E08BF0E5B66EE00BEE4E0 /* netadapter Universal */;
+			targetProxy = 4B224B330E65BA330066BE5B /* PBXContainerItemProxy */;
+		};
+		4B3224E710A3157900838A8E /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B3224D710A3156800838A8E /* jack_netone Universal */;
+			targetProxy = 4B3224E610A3157900838A8E /* PBXContainerItemProxy */;
+		};
+		4B32258B10A31A9000838A8E /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B32255710A3187800838A8E /* jack_netsource Universal */;
+			targetProxy = 4B32258A10A31A9000838A8E /* PBXContainerItemProxy */;
+		};
+		4B32258D10A31A9D00838A8E /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B3224D710A3156800838A8E /* jack_netone Universal */;
+			targetProxy = 4B32258C10A31A9D00838A8E /* PBXContainerItemProxy */;
+		};
+		4B32258F10A31AB400838A8E /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B32257110A3190C00838A8E /* jack_netsource 64 bits */;
+			targetProxy = 4B32258E10A31AB400838A8E /* PBXContainerItemProxy */;
+		};
+		4B32259110A31ABA00838A8E /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B32251D10A316B200838A8E /* jack_netone 64 bits */;
+			targetProxy = 4B32259010A31ABA00838A8E /* PBXContainerItemProxy */;
+		};
+		4B35C5530D4731D2000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699D03097D421600A18468 /* jack_external_metro Universal */;
+			targetProxy = 4B35C5540D4731D2000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C67E0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C41B0D4731D1000DE7AE /* jackdmp framework 64bits */;
+			targetProxy = 4B35C67D0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6800D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C4270D4731D1000DE7AE /* Jackmp.framework 64 bits */;
+			targetProxy = 4B35C67F0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6820D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C4850D4731D1000DE7AE /* Jackservermp.framework 64 bits */;
+			targetProxy = 4B35C6810D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6860D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C50A0D4731D1000DE7AE /* jack_midiseq 64 bits */;
+			targetProxy = 4B35C6850D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6880D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5160D4731D1000DE7AE /* jack_midisine 64 bits */;
+			targetProxy = 4B35C6870D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C68A0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5220D4731D1000DE7AE /* jack_metro 64 bits */;
+			targetProxy = 4B35C6890D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C68C0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C52E0D4731D1000DE7AE /* jack_lsp 64 bits */;
+			targetProxy = 4B35C68B0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C68E0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C53A0D4731D1000DE7AE /* jack_connect 64 bits */;
+			targetProxy = 4B35C68D0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6900D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5460D4731D1000DE7AE /* jack_disconnect 64 bits */;
+			targetProxy = 4B35C68F0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6920D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5520D4731D2000DE7AE /* jack_freewheel 64 bits */;
+			targetProxy = 4B35C6910D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6940D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5600D4731D2000DE7AE /* jdelay 64 bits */;
+			targetProxy = 4B35C6930D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6960D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C56C0D4731D2000DE7AE /* jack_external_metro 64 bits */;
+			targetProxy = 4B35C6950D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C69C0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C59C0D4731D2000DE7AE /* zombie 64 bits */;
+			targetProxy = 4B35C69B0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C69E0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5A80D4731D2000DE7AE /* jack_test 64 bits */;
+			targetProxy = 4B35C69D0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6A00D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5B40D4731D2000DE7AE /* jack_cpu 64 bits */;
+			targetProxy = 4B35C69F0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6A20D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5C00D4731D2000DE7AE /* jack_load 64 bits */;
+			targetProxy = 4B35C6A10D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6A40D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C5CC0D4731D2000DE7AE /* jack_unload 64 bits */;
+			targetProxy = 4B35C6A30D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6AC0D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C6140D4731D2000DE7AE /* jack_coreaudio 64 bits */;
+			targetProxy = 4B35C6AB0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6B00D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C62A0D4731D2000DE7AE /* jack_dummy 64 bits */;
+			targetProxy = 4B35C6AF0D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B35C6B20D4733B9000DE7AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B35C6350D4731D3000DE7AE /* inprocess 64 bits */;
+			targetProxy = 4B35C6B10D4733B9000DE7AE /* PBXContainerItemProxy */;
+		};
+		4B363DE50DEB037F001F72D9 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B363DCE0DEB02F6001F72D9 /* jack_alias Universal */;
+			targetProxy = 4B363DE40DEB037F001F72D9 /* PBXContainerItemProxy */;
+		};
+		4B363E750DEB0838001F72D9 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B363E100DEB03C5001F72D9 /* jack_evmon Universal */;
+			targetProxy = 4B363E740DEB0838001F72D9 /* PBXContainerItemProxy */;
+		};
+		4B363E770DEB0838001F72D9 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B363E440DEB0775001F72D9 /* jack_bufsize Universal */;
+			targetProxy = 4B363E760DEB0838001F72D9 /* PBXContainerItemProxy */;
+		};
+		4B363F250DEB0ABE001F72D9 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B363F140DEB0A6A001F72D9 /* jack_monitor_client Universal */;
+			targetProxy = 4B363F240DEB0ABE001F72D9 /* PBXContainerItemProxy */;
+		};
+		4B363F530DEB0CFE001F72D9 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B363F2B0DEB0BD1001F72D9 /* jack_showtime Universal */;
+			targetProxy = 4B363F520DEB0CFE001F72D9 /* PBXContainerItemProxy */;
+		};
+		4B363F780DEB0D85001F72D9 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B363F680DEB0D4E001F72D9 /* jack_impulse_grabber Universal */;
+			targetProxy = 4B363F770DEB0D85001F72D9 /* PBXContainerItemProxy */;
+		};
+		4B43A8CD1014607100E52943 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B43A8B010145F6F00E52943 /* jack_loopback Universal */;
+			targetProxy = 4B43A8CC1014607100E52943 /* PBXContainerItemProxy */;
+		};
+		4B43A8E91014618D00E52943 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B43A8DD1014615800E52943 /* jack_loopback 64 bits */;
+			targetProxy = 4B43A8E81014618D00E52943 /* PBXContainerItemProxy */;
+		};
+		4B5A1BCF0CD1CCC80005BF74 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B5A1BB10CD1CB9E0005BF74 /* jack_midiseq Universal */;
+			targetProxy = 4B5A1BCE0CD1CCC80005BF74 /* PBXContainerItemProxy */;
+		};
+		4B5A1BE20CD1CD730005BF74 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B5A1BD00CD1CCE10005BF74 /* jack_midisine Universal */;
+			targetProxy = 4B5A1BE10CD1CD730005BF74 /* PBXContainerItemProxy */;
+		};
+		4B699DB4097D421700A18468 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699C4C097D421600A18468 /* Jackservermp.framework Universal */;
+			targetProxy = 4B699DB3097D421700A18468 /* PBXContainerItemProxy */;
+		};
+		4B699DB6097D421700A18468 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699C00097D421600A18468 /* Jackmp.framework Universal */;
+			targetProxy = 4B699DB5097D421700A18468 /* PBXContainerItemProxy */;
+		};
+		4B699DB8097D421700A18468 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699BA7097D421600A18468 /* jackdmp framework Universal */;
+			targetProxy = 4B699DB7097D421700A18468 /* PBXContainerItemProxy */;
+		};
+		4B699DBA097D421700A18468 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699D97097D421700A18468 /* jack_coreaudio Universal */;
+			targetProxy = 4B699DB9097D421700A18468 /* PBXContainerItemProxy */;
+		};
+		4B699DBC097D421700A18468 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699DA6097D421700A18468 /* jack_dummy Universal */;
+			targetProxy = 4B699DBB097D421700A18468 /* PBXContainerItemProxy */;
+		};
+		4B699DC0097D421700A18468 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699D03097D421600A18468 /* jack_external_metro Universal */;
+			targetProxy = 4B699DBF097D421700A18468 /* PBXContainerItemProxy */;
+		};
+		4BA693E90CBE5BBA00EAD520 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BA692A60CBE4BC700EAD520 /* jack_load Universal */;
+			targetProxy = 4BA693E80CBE5BBA00EAD520 /* PBXContainerItemProxy */;
+		};
+		4BA693EB0CBE5BBA00EAD520 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BA692CA0CBE4C9000EAD520 /* jack_unload Universal */;
+			targetProxy = 4BA693EA0CBE5BBA00EAD520 /* PBXContainerItemProxy */;
+		};
+		4BA7FECD0D8E76810017FF73 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BA7FEB90D8E76270017FF73 /* jack_server_control Universal */;
+			targetProxy = 4BA7FECC0D8E76810017FF73 /* PBXContainerItemProxy */;
+		};
+		4BD624D30CBCF55700DE782F /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BD623ED0CBCF0F000DE782F /* inprocess Universal */;
+			targetProxy = 4BD624D20CBCF55700DE782F /* PBXContainerItemProxy */;
+		};
+		4BDCDC2C1002036100B15929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BDCDB931001FB9C00B15929 /* jack_coremidi 64 bits */;
+			targetProxy = 4BDCDC2B1002036100B15929 /* PBXContainerItemProxy */;
+		};
+		4BDCDC2E1002036100B15929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BDCDBB71001FCC000B15929 /* jack_net 64 bits */;
+			targetProxy = 4BDCDC2D1002036100B15929 /* PBXContainerItemProxy */;
+		};
+		4BDCDC301002036100B15929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BDCDBD71001FD2D00B15929 /* netmanager 64 bits */;
+			targetProxy = 4BDCDC2F1002036100B15929 /* PBXContainerItemProxy */;
+		};
+		4BDCDC39100203D500B15929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BDCDBEC1001FD7300B15929 /* audioadapter 64 bits */;
+			targetProxy = 4BDCDC38100203D500B15929 /* PBXContainerItemProxy */;
+		};
+		4BDCDC3B100203D500B15929 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BDCDC0F1001FDE300B15929 /* netadapter 64 bits */;
+			targetProxy = 4BDCDC3A100203D500B15929 /* PBXContainerItemProxy */;
+		};
+		4BE99D630AD7A19100C59091 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BE99D260AD7A04800C59091 /* jack_cpu Universal */;
+			targetProxy = 4BE99D620AD7A19100C59091 /* PBXContainerItemProxy */;
+		};
+		4BF339280F8B87800080FB5B /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BF339020F8B864B0080FB5B /* jack_coremidi Universal */;
+			targetProxy = 4BF339270F8B87800080FB5B /* PBXContainerItemProxy */;
+		};
+		4BFA83320DF6AB540087B4E1 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BFA82820DF6A9E40087B4E1 /* jack_evmon 64 bits */;
+			targetProxy = 4BFA83310DF6AB540087B4E1 /* PBXContainerItemProxy */;
+		};
+		4BFA83340DF6AB540087B4E1 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BFA82950DF6A9E40087B4E1 /* jack_bufsize 64 bits */;
+			targetProxy = 4BFA83330DF6AB540087B4E1 /* PBXContainerItemProxy */;
+		};
+		4BFA83380DF6AB540087B4E1 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BFA82AD0DF6A9E40087B4E1 /* jack_monitor_client 64 bits */;
+			targetProxy = 4BFA83370DF6AB540087B4E1 /* PBXContainerItemProxy */;
+		};
+		4BFA833A0DF6AB540087B4E1 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BFA82B90DF6A9E40087B4E1 /* jack_showtime 64 bits */;
+			targetProxy = 4BFA83390DF6AB540087B4E1 /* PBXContainerItemProxy */;
+		};
+		4BFA833C0DF6AB540087B4E1 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BFA82C50DF6A9E40087B4E1 /* jack_impulse_grabber 64 bits */;
+			targetProxy = 4BFA833B0DF6AB540087B4E1 /* PBXContainerItemProxy */;
+		};
+		4BFA99440AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699CB1097D421600A18468 /* jack_metro Universal */;
+			targetProxy = 4BFA99430AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA99460AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699CC1097D421600A18468 /* jack_lsp Universal */;
+			targetProxy = 4BFA99450AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA99480AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699CD1097D421600A18468 /* jack_connect Universal */;
+			targetProxy = 4BFA99470AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA994A0AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699CE1097D421600A18468 /* jack_disconnect Universal */;
+			targetProxy = 4BFA99490AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA994C0AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699CF1097D421600A18468 /* jack_freewheel Universal */;
+			targetProxy = 4BFA994B0AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA994E0AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699D03097D421600A18468 /* jack_external_metro Universal */;
+			targetProxy = 4BFA994D0AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA99540AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4B699D3F097D421600A18468 /* zombie Universal */;
+			targetProxy = 4BFA99530AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA99560AAAED90009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BE6C6910A3E096F005A203A /* jack_test Universal */;
+			targetProxy = 4BFA99550AAAED90009E916C /* PBXContainerItemProxy */;
+		};
+		4BFA99AC0AAAF41D009E916C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 4BFA99980AAAF3B0009E916C /* jdelay Universal */;
+			targetProxy = 4BFA99AB0AAAF41D009E916C /* PBXContainerItemProxy */;
+		};
+		BA222AF00DC883EF001A17F4 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = BA222AE00DC882DB001A17F4 /* netmanager Universal */;
+			targetProxy = BA222AEF0DC883EF001A17F4 /* PBXContainerItemProxy */;
+		};
+		BA222AF20DC883F3001A17F4 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = BA222AC50DC88132001A17F4 /* jack_net Universal */;
+			targetProxy = BA222AF10DC883F3001A17F4 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		4B0A28E30D52073D002EFF74 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_thread_wait;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B0A28E40D52073D002EFF74 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_thread_wait;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B0A28E50D52073D002EFF74 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_thread_wait;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B0A292A0D52108E002EFF74 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_thread_wait;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B0A292B0D52108E002EFF74 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_thread_wait;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B0A292C0D52108E002EFF74 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+					ppc64,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_thread_wait;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B19B2FD0E23620F00DD4A82 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = i386;
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					/usr/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B19B2FE0E23620F00DD4A82 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = audioadapter;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B19B2FF0E23620F00DD4A82 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B3224E210A3156800838A8E /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_netone;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B3224E310A3156800838A8E /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_netone;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B3224E410A3156800838A8E /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B32252810A316B200838A8E /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_netone;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B32252910A316B200838A8E /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_netone;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B32252A10A316B200838A8E /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B32255E10A3187800838A8E /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_netsource;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B32255F10A3187800838A8E /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_netsource;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B32256010A3187800838A8E /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B32257810A3190C00838A8E /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_netsource;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B32257910A3190C00838A8E /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_netsource;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B32257A10A3190C00838A8E /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C4220D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+					"-DJACK_32_64",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jackdmp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C4230D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+					"-DJACK_32_64",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jackdmp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C4240D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					../common,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+					"-DJACK_32_64",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jackdmp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C4800D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-DJACK_32_64",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"-DJACK_32_64",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C4810D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-DJACK_32_64",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C4820D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-DJACK_32_64",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+			};
+			name = Default;
+		};
+		4B35C4F90D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackdmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C4FA0D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DLIB_DIR=\\\"lib\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackservermp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C4FB0D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-D__SMP__",
+					"-DJACK_32_64",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-D__SMP__",
+					"-DJACK_32_64",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DLIB_DIR=\\\"lib\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackdmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+			};
+			name = Default;
+		};
+		4B35C5110D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5120D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5130D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C51D0D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midisine;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C51E0D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midisine;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C51F0D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midisine;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5290D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C52A0D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C52B0D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5350D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5360D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5370D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5410D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_connect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				SYMROOT = build;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5420D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_connect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				SYMROOT = build;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5430D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_connect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				SYMROOT = build;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C54D0D4731D1000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_disconnect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C54E0D4731D1000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_disconnect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C54F0D4731D1000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_disconnect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C55B0D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_freewheel;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C55C0D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_freewheel;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C55D0D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_freewheel;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5670D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jdelay;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5680D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jdelay;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5690D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jdelay;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5730D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_external_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5740D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_external_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5750D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_external_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5830D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					.,
+					RPC,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testAtomic;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5840D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					.,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testAtomic;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5850D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				HEADER_SEARCH_PATHS = RPC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testAtomic;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5970D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					.,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5980D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					.,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5990D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5A30D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = zombie;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5A40D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = zombie;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5A50D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = zombie;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5AF0D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_test;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5B00D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_test;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5B10D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_test;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5BB0D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_cpu;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5BC0D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_cpu;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5BD0D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_cpu;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5C70D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_load;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5C80D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_load;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5C90D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_load;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5D30D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_unload;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5D40D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_unload;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5D50D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_unload;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5E70D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../posix,
+					.,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServer;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5E80D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServer;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5E90D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServer;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C5FB0D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../posix,
+					.,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C5FC0D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					../posix,
+					.,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C5FD0D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C60F0D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../posix,
+					.,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServerClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C6100D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					../posix,
+					.,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServerClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C6110D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServerClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C61B0D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					../common/jack,
+					../posix,
+					.,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C61C0D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					../common/jack,
+					../posix,
+					.,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C61D0D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C6260D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common/;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					libportaudio.a,
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolbox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					AudioUnit,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_portaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C6270D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common/;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					libportaudio.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					AudioUnit,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioToolbox,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_portaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C6280D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common/;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					libportaudio.a,
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					AudioUnit,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_portaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C6310D4731D2000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					../posix,
+					.,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C6320D4731D2000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					../posix,
+					.,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C6330D4731D2000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C63B0D4731D3000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C63C0D4731D3000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C63D0D4731D3000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B35C67A0D47339B000DE7AE /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = All;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B35C67B0D47339B000DE7AE /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = All;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B35C67C0D47339B000DE7AE /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = All;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363DD50DEB02F6001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363DD60DEB02F6001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_alias;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363DD70DEB02F6001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363E170DEB03C5001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363E180DEB03C5001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_evmon;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363E190DEB03C5001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363E4B0DEB0775001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363E4C0DEB0775001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_bufsize;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363E4D0DEB0775001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363EE60DEB091C001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					/opt/local/include,
+					../common,
+				);
+				LIBRARY_SEARCH_PATHS = /opt/local/lib;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsndfile.a,
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363EE70DEB091C001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					/opt/local/include,
+					../common,
+				);
+				LIBRARY_SEARCH_PATHS = /opt/local/lib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsndfile.a,
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_rec;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363EE80DEB091C001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363F1B0DEB0A6A001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363F1C0DEB0A6A001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_monitor_client;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363F1D0DEB0A6A001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363F320DEB0BD1001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_showtime;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363F330DEB0BD1001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_showtime;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363F340DEB0BD1001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B363F6F0DEB0D4E001F72D9 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B363F700DEB0D4E001F72D9 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_impulse_grabber;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B363F710DEB0D4E001F72D9 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B43A8B710145F6F00E52943 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					.,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B43A8B810145F6F00E52943 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					.,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_loopback;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B43A8B910145F6F00E52943 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B43A8E41014615800E52943 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					.,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B43A8E51014615800E52943 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					.,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_loopback;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B43A8E61014615800E52943 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B47ACD410B5890100469C67 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-DJACK_32_64",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-D__CLIENTDEBUG__",
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"-DJACK_32_64",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B47ACD510B5890100469C67 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-DJACK_32_64",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-D__CLIENTDEBUG__",
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B47ACD610B5890100469C67 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info copy 2.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-DJACK_32_64",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+			};
+			name = Default;
+		};
+		4B5A1BB80CD1CB9E0005BF74 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B5A1BB90CD1CB9E0005BF74 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B5A1BBA0CD1CB9E0005BF74 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B5A1BD70CD1CCE10005BF74 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midisine;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B5A1BD80CD1CCE10005BF74 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midisine;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B5A1BD90CD1CCE10005BF74 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midisine;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B5E08D20E5B66EE00BEE4E0 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = i386;
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					/usr/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B5E08D30E5B66EE00BEE4E0 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common,
+					../common/jack,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netadapter;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B5E08D40E5B66EE00BEE4E0 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699B34097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = All;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699B35097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = All;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699B36097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = All;
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699BAE097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jackdmp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699BAF097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jackdmp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699BB0097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					../common,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jackdmp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699C44097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699C45097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DSERVER_SIDE",
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699C46097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DUSE_POSIX_SHM",
+					"-D__SMP__",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-D__SMP__",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DJACK_LOCATION=\\\"/usr/local/bin\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+			};
+			name = Default;
+		};
+		4B699CA9097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DSERVER_SIDE",
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DSERVER_SIDE",
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackservermp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699CAA097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DSERVER_SIDE",
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DSERVER_SIDE",
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DLIB_DIR=\\\"lib\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackservermp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699CAB097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DLIB_DIR=\\\"lib\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackdmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+			};
+			name = Default;
+		};
+		4B699CB8097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699CB9097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699CBA097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699CC8097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699CC9097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699CCA097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699CD8097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_connect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				SYMROOT = build;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699CD9097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_connect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				SYMROOT = build;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699CDA097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_connect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				SYMROOT = build;
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699CE8097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_disconnect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699CE9097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_disconnect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699CEA097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_disconnect;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699CFA097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_freewheel;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699CFB097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_freewheel;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699CFC097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_freewheel;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D0A097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_external_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D0B097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_external_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D0C097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_external_metro;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D1E097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+					RPC,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testAtomic;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D1F097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+					RPC,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testAtomic;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D20097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				HEADER_SEARCH_PATHS = RPC;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testAtomic;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D36097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common,
+					../common/jack,
+					../posix,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D37097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common,
+					../common/jack,
+					../posix,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D38097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_OPTIMIZATION_LEVEL = 3;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D46097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = zombie;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D47097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = zombie;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D48097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = zombie;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D5E097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServer;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D5F097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServer;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D60097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServer;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D76097D421600A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D77097D421600A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D78097D421600A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D8E097D421700A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServerClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D8F097D421700A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServerClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699D90097D421700A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = synchroServerClient;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699D9E097D421700A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699D9F097D421700A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699DA0097D421700A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699DAD097D421700A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					.,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B699DAE097D421700A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../common/jack,
+					.,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B699DAF097D421700A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4B699DD6097D427F00A18468 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Development;
+		};
+		4B699DD7097D427F00A18468 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Deployment;
+		};
+		4B699DD8097D427F00A18468 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Default;
+		};
+		4B978DB80A31CF4A009E2DD1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common/;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					libportaudio.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					AudioToolbox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					AudioUnit,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_portaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4B978DB90A31CF4A009E2DD1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common/;
+				INSTALL_PATH = /usr/local/lib;
+				LD_OPENMP_FLAGS = "-fopenmp";
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					libportaudio.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					AudioUnit,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioToolbox,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_portaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4B978DBA0A31CF4A009E2DD1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common/;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					libportaudio.a,
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					AudioUnit,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_portaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BA339A910B2E36800190E3B /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-DJACK_MONITOR",
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DJACK_MONITOR",
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackdmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BA339AA10B2E36800190E3B /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DEAD_CODE_STRIPPING = YES;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					../posix,
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = (
+					"-DJACK_MONITOR",
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DJACK_MONITOR",
+					"-DSERVER_SIDE",
+					"-DJACK_32_64",
+					"-D__SMP__",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DLIB_DIR=\\\"lib\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackservermp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BA339AB10B2E36800190E3B /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				FRAMEWORK_VERSION = A;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = NO;
+				GENERATE_PKGINFO_FILE = NO;
+				HEADER_SEARCH_PATHS = (
+					RPC,
+					../common/jack,
+				);
+				INFOPLIST_FILE = "Jack-Info.plist";
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.3;
+				OTHER_CFLAGS = (
+					"-D__SMP__",
+					"-DJACK_32_64",
+					"-DUSE_POSIX_SHM",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-D__SMP__",
+					"-DJACK_32_64",
+					"-DMACH_RPC_MACH_SEMA",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1)",
+					"$(OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2)",
+				);
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_1 = "-DADDON_DIR=\\\"/usr/local/lib/jackmp\\\"";
+				OTHER_CPLUSPLUSFLAGS_QUOTED_FOR_TARGET_2 = "-DLIB_DIR=\\\"lib\\\"";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Carbon,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = Jackdmp;
+				REZ_EXECUTABLE = NO;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = "-Wmost";
+			};
+			name = Default;
+		};
+		4BA692AD0CBE4BC700EAD520 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_load;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BA692AE0CBE4BC700EAD520 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_load;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BA692AF0CBE4BC700EAD520 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_load;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BA692D10CBE4C9000EAD520 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_unload;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BA692D20CBE4C9000EAD520 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_unload;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BA692D30CBE4C9000EAD520 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_unload;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BA7FEC00D8E76270017FF73 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BA7FEC10D8E76270017FF73 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_server_control;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BA7FEC20D8E76270017FF73 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_lsp;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BD623F40CBCF0F000DE782F /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BD623F50CBCF0F000DE782F /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BD623F60CBCF0F000DE782F /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BDCDB9A1001FB9C00B15929 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreMIDI,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coremidi;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BDCDB9B1001FB9C00B15929 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreMIDI,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coremidi;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BDCDB9C1001FB9C00B15929 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BDCDBC21001FCC000B15929 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_net;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BDCDBC31001FCC000B15929 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_net;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BDCDBC41001FCC000B15929 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BDCDBE51001FD2D00B15929 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BDCDBE61001FD2D00B15929 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BDCDBE71001FD2D00B15929 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BDCDBFC1001FD7300B15929 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					/usr/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BDCDBFD1001FD7300B15929 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = audioadapter;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BDCDBFE1001FD7300B15929 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BDCDC221001FDE300B15929 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					/usr/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BDCDC231001FDE300B15929 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common,
+					../common/jack,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "-DJACK_32_64";
+				OTHER_CPLUSPLUSFLAGS = (
+					"-DMACH_RPC_MACH_SEMA",
+					"-DJACK_32_64",
+				);
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsamplerate.a,
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netadapter;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BDCDC241001FDE300B15929 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BE6C6A00A3E096F005A203A /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_test;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BE6C6A10A3E096F005A203A /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_test;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BE6C6A20A3E096F005A203A /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_test;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BE99D2D0AD7A04800C59091 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_cpu;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BE99D2E0AD7A04800C59091 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_cpu;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BE99D2F0AD7A04800C59091 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_cpu;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BF339090F8B864B0080FB5B /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreMIDI,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coremidi;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BF3390A0F8B864B0080FB5B /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../common/jack,
+					../posix,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreMIDI,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coremidi;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BF3390B0F8B864B0080FB5B /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_coreaudio;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA5E950DEC4D9C00FA4CDB /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA5E960DEC4D9C00FA4CDB /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testMutex;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA5E970DEC4D9C00FA4CDB /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+				);
+				FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\"";
+				GCC_OPTIMIZATION_LEVEL = 3;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = testSem;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA82890DF6A9E40087B4E1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA828A0DF6A9E40087B4E1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_evmon;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA828B0DF6A9E40087B4E1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc64,
+					ppc,
+					i386,
+					x86_64,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA829C0DF6A9E40087B4E1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA829D0DF6A9E40087B4E1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_bufsize;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA829E0DF6A9E40087B4E1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA82A80DF6A9E40087B4E1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					/opt/local/include,
+					../common,
+				);
+				LIBRARY_SEARCH_PATHS = /opt/local/lib;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsndfile.a,
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA82A90DF6A9E40087B4E1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = (
+					/opt/local/include,
+					../common,
+				);
+				LIBRARY_SEARCH_PATHS = /opt/local/lib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					/opt/local/lib/libsndfile.a,
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_rec;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA82AA0DF6A9E40087B4E1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA82B40DF6A9E40087B4E1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA82B50DF6A9E40087B4E1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_monitor_client;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA82B60DF6A9E40087B4E1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA82C00DF6A9E40087B4E1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_showtime;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA82C10DF6A9E40087B4E1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_showtime;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA82C20DF6A9E40087B4E1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA82CC0DF6A9E40087B4E1 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA82CD0DF6A9E40087B4E1 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_impulse_grabber;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA82CE0DF6A9E40087B4E1 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+					"-framework",
+					CoreFoundation,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jack_midiseq;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		4BFA999F0AAAF3B0009E916C /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jdelay;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4BFA99A00AAAF3B0009E916C /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				HEADER_SEARCH_PATHS = ../common;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jdelay;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		4BFA99A10AAAF3B0009E916C /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				FRAMEWORK_SEARCH_PATHS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackmp,
+				);
+				OTHER_REZFLAGS = "";
+				PRODUCT_NAME = jdelay;
+				REZ_EXECUTABLE = YES;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		BA222ACC0DC88132001A17F4 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_net;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		BA222ACD0DC88132001A17F4 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				HEADER_SEARCH_PATHS = (
+					../common,
+					.,
+					../common/jack,
+					../posix,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreServices,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_net;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		BA222ACE0DC88132001A17F4 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = jack_dummy;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+		BA222AE60DC882DB001A17F4 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUGGING_SYMBOLS = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		BA222AE70DC882DB001A17F4 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = (
+					.,
+					../posix,
+					../common/jack,
+					../common,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackservermp,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = netmanager;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		BA222AE80DC882DB001A17F4 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					i386,
+					ppc,
+				);
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				EXECUTABLE_EXTENSION = so;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PREPROCESSOR_DEFINITIONS = "";
+				HEADER_SEARCH_PATHS = ../common;
+				INSTALL_PATH = /usr/local/lib;
+				LIBRARY_STYLE = DYNAMIC;
+				MACH_O_TYPE = mh_dylib;
+				OTHER_CFLAGS = "";
+				OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
+				OTHER_LDFLAGS = (
+					"-framework",
+					Jackdmp,
+					"-framework",
+					AudioToolBox,
+					"-framework",
+					CoreAudio,
+					"-framework",
+					CoreServices,
+					"-framework",
+					AudioUnit,
+				);
+				OTHER_REZFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = inprocess;
+				SDKROOT = "";
+				SECTORDER_FLAGS = "";
+				WARNING_CFLAGS = (
+					"-Wmost",
+					"-Wno-four-char-constants",
+					"-Wno-unknown-pragmas",
+				);
+			};
+			name = Default;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		4B0A28E20D52073D002EFF74 /* Build configuration list for PBXNativeTarget "jack_thread_wait" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B0A28E30D52073D002EFF74 /* Development */,
+				4B0A28E40D52073D002EFF74 /* Deployment */,
+				4B0A28E50D52073D002EFF74 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B0A29290D52108E002EFF74 /* Build configuration list for PBXNativeTarget "jack_thread_wait 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B0A292A0D52108E002EFF74 /* Development */,
+				4B0A292B0D52108E002EFF74 /* Deployment */,
+				4B0A292C0D52108E002EFF74 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B19B2FC0E23620F00DD4A82 /* Build configuration list for PBXNativeTarget "audioadapter Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B19B2FD0E23620F00DD4A82 /* Development */,
+				4B19B2FE0E23620F00DD4A82 /* Deployment */,
+				4B19B2FF0E23620F00DD4A82 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B3224E110A3156800838A8E /* Build configuration list for PBXNativeTarget "jack_netone Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B3224E210A3156800838A8E /* Development */,
+				4B3224E310A3156800838A8E /* Deployment */,
+				4B3224E410A3156800838A8E /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B32252710A316B200838A8E /* Build configuration list for PBXNativeTarget "jack_netone 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B32252810A316B200838A8E /* Development */,
+				4B32252910A316B200838A8E /* Deployment */,
+				4B32252A10A316B200838A8E /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B32255D10A3187800838A8E /* Build configuration list for PBXNativeTarget "jack_netsource Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B32255E10A3187800838A8E /* Development */,
+				4B32255F10A3187800838A8E /* Deployment */,
+				4B32256010A3187800838A8E /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B32257710A3190C00838A8E /* Build configuration list for PBXNativeTarget "jack_netsource 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B32257810A3190C00838A8E /* Development */,
+				4B32257910A3190C00838A8E /* Deployment */,
+				4B32257A10A3190C00838A8E /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C4210D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jackdmp framework 64bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C4220D4731D1000DE7AE /* Development */,
+				4B35C4230D4731D1000DE7AE /* Deployment */,
+				4B35C4240D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C47F0D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "Jackmp.framework 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C4800D4731D1000DE7AE /* Development */,
+				4B35C4810D4731D1000DE7AE /* Deployment */,
+				4B35C4820D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C4F80D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "Jackservermp.framework 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C4F90D4731D1000DE7AE /* Development */,
+				4B35C4FA0D4731D1000DE7AE /* Deployment */,
+				4B35C4FB0D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5100D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_midiseq 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5110D4731D1000DE7AE /* Development */,
+				4B35C5120D4731D1000DE7AE /* Deployment */,
+				4B35C5130D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C51C0D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_midisine 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C51D0D4731D1000DE7AE /* Development */,
+				4B35C51E0D4731D1000DE7AE /* Deployment */,
+				4B35C51F0D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5280D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_metro 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5290D4731D1000DE7AE /* Development */,
+				4B35C52A0D4731D1000DE7AE /* Deployment */,
+				4B35C52B0D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5340D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_lsp 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5350D4731D1000DE7AE /* Development */,
+				4B35C5360D4731D1000DE7AE /* Deployment */,
+				4B35C5370D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5400D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_connect 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5410D4731D1000DE7AE /* Development */,
+				4B35C5420D4731D1000DE7AE /* Deployment */,
+				4B35C5430D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C54C0D4731D1000DE7AE /* Build configuration list for PBXNativeTarget "jack_disconnect 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C54D0D4731D1000DE7AE /* Development */,
+				4B35C54E0D4731D1000DE7AE /* Deployment */,
+				4B35C54F0D4731D1000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C55A0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_freewheel 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C55B0D4731D2000DE7AE /* Development */,
+				4B35C55C0D4731D2000DE7AE /* Deployment */,
+				4B35C55D0D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5660D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jdelay 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5670D4731D2000DE7AE /* Development */,
+				4B35C5680D4731D2000DE7AE /* Deployment */,
+				4B35C5690D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5720D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_external_metro 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5730D4731D2000DE7AE /* Development */,
+				4B35C5740D4731D2000DE7AE /* Deployment */,
+				4B35C5750D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5820D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "testAtomic 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5830D4731D2000DE7AE /* Development */,
+				4B35C5840D4731D2000DE7AE /* Deployment */,
+				4B35C5850D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5960D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "testSem 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5970D4731D2000DE7AE /* Development */,
+				4B35C5980D4731D2000DE7AE /* Deployment */,
+				4B35C5990D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5A20D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "zombie 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5A30D4731D2000DE7AE /* Development */,
+				4B35C5A40D4731D2000DE7AE /* Deployment */,
+				4B35C5A50D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5AE0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_test 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5AF0D4731D2000DE7AE /* Development */,
+				4B35C5B00D4731D2000DE7AE /* Deployment */,
+				4B35C5B10D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5BA0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_cpu 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5BB0D4731D2000DE7AE /* Development */,
+				4B35C5BC0D4731D2000DE7AE /* Deployment */,
+				4B35C5BD0D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5C60D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_load 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5C70D4731D2000DE7AE /* Development */,
+				4B35C5C80D4731D2000DE7AE /* Deployment */,
+				4B35C5C90D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5D20D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_unload 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5D30D4731D2000DE7AE /* Development */,
+				4B35C5D40D4731D2000DE7AE /* Deployment */,
+				4B35C5D50D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5E60D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "synchroServer 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5E70D4731D2000DE7AE /* Development */,
+				4B35C5E80D4731D2000DE7AE /* Deployment */,
+				4B35C5E90D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C5FA0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "synchroClient 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C5FB0D4731D2000DE7AE /* Development */,
+				4B35C5FC0D4731D2000DE7AE /* Deployment */,
+				4B35C5FD0D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C60E0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "synchroServerClient 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C60F0D4731D2000DE7AE /* Development */,
+				4B35C6100D4731D2000DE7AE /* Deployment */,
+				4B35C6110D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C61A0D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_coreaudio 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C61B0D4731D2000DE7AE /* Development */,
+				4B35C61C0D4731D2000DE7AE /* Deployment */,
+				4B35C61D0D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C6250D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_portaudio 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C6260D4731D2000DE7AE /* Development */,
+				4B35C6270D4731D2000DE7AE /* Deployment */,
+				4B35C6280D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C6300D4731D2000DE7AE /* Build configuration list for PBXNativeTarget "jack_dummy 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C6310D4731D2000DE7AE /* Development */,
+				4B35C6320D4731D2000DE7AE /* Deployment */,
+				4B35C6330D4731D2000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C63A0D4731D3000DE7AE /* Build configuration list for PBXNativeTarget "inprocess 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C63B0D4731D3000DE7AE /* Development */,
+				4B35C63C0D4731D3000DE7AE /* Deployment */,
+				4B35C63D0D4731D3000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B35C6790D47339B000DE7AE /* Build configuration list for PBXAggregateTarget "All Universal 32/64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B35C67A0D47339B000DE7AE /* Development */,
+				4B35C67B0D47339B000DE7AE /* Deployment */,
+				4B35C67C0D47339B000DE7AE /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363DD40DEB02F6001F72D9 /* Build configuration list for PBXNativeTarget "jack_alias Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363DD50DEB02F6001F72D9 /* Development */,
+				4B363DD60DEB02F6001F72D9 /* Deployment */,
+				4B363DD70DEB02F6001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363E160DEB03C5001F72D9 /* Build configuration list for PBXNativeTarget "jack_evmon Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363E170DEB03C5001F72D9 /* Development */,
+				4B363E180DEB03C5001F72D9 /* Deployment */,
+				4B363E190DEB03C5001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363E4A0DEB0775001F72D9 /* Build configuration list for PBXNativeTarget "jack_bufsize Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363E4B0DEB0775001F72D9 /* Development */,
+				4B363E4C0DEB0775001F72D9 /* Deployment */,
+				4B363E4D0DEB0775001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363EE50DEB091C001F72D9 /* Build configuration list for PBXNativeTarget "jack_rec Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363EE60DEB091C001F72D9 /* Development */,
+				4B363EE70DEB091C001F72D9 /* Deployment */,
+				4B363EE80DEB091C001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363F1A0DEB0A6A001F72D9 /* Build configuration list for PBXNativeTarget "jack_monitor_client Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363F1B0DEB0A6A001F72D9 /* Development */,
+				4B363F1C0DEB0A6A001F72D9 /* Deployment */,
+				4B363F1D0DEB0A6A001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363F310DEB0BD1001F72D9 /* Build configuration list for PBXNativeTarget "jack_showtime Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363F320DEB0BD1001F72D9 /* Development */,
+				4B363F330DEB0BD1001F72D9 /* Deployment */,
+				4B363F340DEB0BD1001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B363F6E0DEB0D4E001F72D9 /* Build configuration list for PBXNativeTarget "jack_impulse_grabber Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B363F6F0DEB0D4E001F72D9 /* Development */,
+				4B363F700DEB0D4E001F72D9 /* Deployment */,
+				4B363F710DEB0D4E001F72D9 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B43A8B610145F6F00E52943 /* Build configuration list for PBXNativeTarget "jack_loopback Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B43A8B710145F6F00E52943 /* Development */,
+				4B43A8B810145F6F00E52943 /* Deployment */,
+				4B43A8B910145F6F00E52943 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B43A8E31014615800E52943 /* Build configuration list for PBXNativeTarget "jack_loopback 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B43A8E41014615800E52943 /* Development */,
+				4B43A8E51014615800E52943 /* Deployment */,
+				4B43A8E61014615800E52943 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B47ACD310B5890100469C67 /* Build configuration list for PBXNativeTarget "Jackmp.framework 64 bits debugging" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B47ACD410B5890100469C67 /* Development */,
+				4B47ACD510B5890100469C67 /* Deployment */,
+				4B47ACD610B5890100469C67 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B5A1BB70CD1CB9E0005BF74 /* Build configuration list for PBXNativeTarget "jack_midiseq Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B5A1BB80CD1CB9E0005BF74 /* Development */,
+				4B5A1BB90CD1CB9E0005BF74 /* Deployment */,
+				4B5A1BBA0CD1CB9E0005BF74 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B5A1BD60CD1CCE10005BF74 /* Build configuration list for PBXNativeTarget "jack_midisine Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B5A1BD70CD1CCE10005BF74 /* Development */,
+				4B5A1BD80CD1CCE10005BF74 /* Deployment */,
+				4B5A1BD90CD1CCE10005BF74 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B5E08D10E5B66EE00BEE4E0 /* Build configuration list for PBXNativeTarget "netadapter Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B5E08D20E5B66EE00BEE4E0 /* Development */,
+				4B5E08D30E5B66EE00BEE4E0 /* Deployment */,
+				4B5E08D40E5B66EE00BEE4E0 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699B33097D421600A18468 /* Build configuration list for PBXAggregateTarget "All Universal 32 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699B34097D421600A18468 /* Development */,
+				4B699B35097D421600A18468 /* Deployment */,
+				4B699B36097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699BAD097D421600A18468 /* Build configuration list for PBXNativeTarget "jackdmp framework Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699BAE097D421600A18468 /* Development */,
+				4B699BAF097D421600A18468 /* Deployment */,
+				4B699BB0097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699C43097D421600A18468 /* Build configuration list for PBXNativeTarget "Jackmp.framework Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699C44097D421600A18468 /* Development */,
+				4B699C45097D421600A18468 /* Deployment */,
+				4B699C46097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699CA8097D421600A18468 /* Build configuration list for PBXNativeTarget "Jackservermp.framework Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699CA9097D421600A18468 /* Development */,
+				4B699CAA097D421600A18468 /* Deployment */,
+				4B699CAB097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699CB7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_metro Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699CB8097D421600A18468 /* Development */,
+				4B699CB9097D421600A18468 /* Deployment */,
+				4B699CBA097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699CC7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_lsp Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699CC8097D421600A18468 /* Development */,
+				4B699CC9097D421600A18468 /* Deployment */,
+				4B699CCA097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699CD7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_connect Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699CD8097D421600A18468 /* Development */,
+				4B699CD9097D421600A18468 /* Deployment */,
+				4B699CDA097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699CE7097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_disconnect Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699CE8097D421600A18468 /* Development */,
+				4B699CE9097D421600A18468 /* Deployment */,
+				4B699CEA097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699CF9097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_freewheel Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699CFA097D421600A18468 /* Development */,
+				4B699CFB097D421600A18468 /* Deployment */,
+				4B699CFC097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D09097D421600A18468 /* Build configuration list for PBXNativeTarget "jack_external_metro Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D0A097D421600A18468 /* Development */,
+				4B699D0B097D421600A18468 /* Deployment */,
+				4B699D0C097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D1D097D421600A18468 /* Build configuration list for PBXNativeTarget "testAtomic Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D1E097D421600A18468 /* Development */,
+				4B699D1F097D421600A18468 /* Deployment */,
+				4B699D20097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D35097D421600A18468 /* Build configuration list for PBXNativeTarget "testSem Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D36097D421600A18468 /* Development */,
+				4B699D37097D421600A18468 /* Deployment */,
+				4B699D38097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D45097D421600A18468 /* Build configuration list for PBXNativeTarget "zombie Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D46097D421600A18468 /* Development */,
+				4B699D47097D421600A18468 /* Deployment */,
+				4B699D48097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D5D097D421600A18468 /* Build configuration list for PBXNativeTarget "synchroServer Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D5E097D421600A18468 /* Development */,
+				4B699D5F097D421600A18468 /* Deployment */,
+				4B699D60097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D75097D421600A18468 /* Build configuration list for PBXNativeTarget "synchroClient Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D76097D421600A18468 /* Development */,
+				4B699D77097D421600A18468 /* Deployment */,
+				4B699D78097D421600A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D8D097D421700A18468 /* Build configuration list for PBXNativeTarget "synchroServerClient Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D8E097D421700A18468 /* Development */,
+				4B699D8F097D421700A18468 /* Deployment */,
+				4B699D90097D421700A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699D9D097D421700A18468 /* Build configuration list for PBXNativeTarget "jack_coreaudio Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699D9E097D421700A18468 /* Development */,
+				4B699D9F097D421700A18468 /* Deployment */,
+				4B699DA0097D421700A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699DAC097D421700A18468 /* Build configuration list for PBXNativeTarget "jack_dummy Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699DAD097D421700A18468 /* Development */,
+				4B699DAE097D421700A18468 /* Deployment */,
+				4B699DAF097D421700A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B699DD5097D427F00A18468 /* Build configuration list for PBXProject "Jackdmp" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B699DD6097D427F00A18468 /* Development */,
+				4B699DD7097D427F00A18468 /* Deployment */,
+				4B699DD8097D427F00A18468 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4B978DB70A31CF4A009E2DD1 /* Build configuration list for PBXNativeTarget "jack_portaudio Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4B978DB80A31CF4A009E2DD1 /* Development */,
+				4B978DB90A31CF4A009E2DD1 /* Deployment */,
+				4B978DBA0A31CF4A009E2DD1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BA339A810B2E36800190E3B /* Build configuration list for PBXNativeTarget "Jackservermp.framework 64 bits profiling" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BA339A910B2E36800190E3B /* Development */,
+				4BA339AA10B2E36800190E3B /* Deployment */,
+				4BA339AB10B2E36800190E3B /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BA692AC0CBE4BC700EAD520 /* Build configuration list for PBXNativeTarget "jack_load Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BA692AD0CBE4BC700EAD520 /* Development */,
+				4BA692AE0CBE4BC700EAD520 /* Deployment */,
+				4BA692AF0CBE4BC700EAD520 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BA692D00CBE4C9000EAD520 /* Build configuration list for PBXNativeTarget "jack_unload Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BA692D10CBE4C9000EAD520 /* Development */,
+				4BA692D20CBE4C9000EAD520 /* Deployment */,
+				4BA692D30CBE4C9000EAD520 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BA7FEBF0D8E76270017FF73 /* Build configuration list for PBXNativeTarget "jack_server_control Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BA7FEC00D8E76270017FF73 /* Development */,
+				4BA7FEC10D8E76270017FF73 /* Deployment */,
+				4BA7FEC20D8E76270017FF73 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BD623F30CBCF0F000DE782F /* Build configuration list for PBXNativeTarget "inprocess Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BD623F40CBCF0F000DE782F /* Development */,
+				4BD623F50CBCF0F000DE782F /* Deployment */,
+				4BD623F60CBCF0F000DE782F /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BDCDB991001FB9C00B15929 /* Build configuration list for PBXNativeTarget "jack_coremidi 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BDCDB9A1001FB9C00B15929 /* Development */,
+				4BDCDB9B1001FB9C00B15929 /* Deployment */,
+				4BDCDB9C1001FB9C00B15929 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BDCDBC11001FCC000B15929 /* Build configuration list for PBXNativeTarget "jack_net 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BDCDBC21001FCC000B15929 /* Development */,
+				4BDCDBC31001FCC000B15929 /* Deployment */,
+				4BDCDBC41001FCC000B15929 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BDCDBE41001FD2D00B15929 /* Build configuration list for PBXNativeTarget "netmanager 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BDCDBE51001FD2D00B15929 /* Development */,
+				4BDCDBE61001FD2D00B15929 /* Deployment */,
+				4BDCDBE71001FD2D00B15929 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BDCDBFB1001FD7300B15929 /* Build configuration list for PBXNativeTarget "audioadapter 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BDCDBFC1001FD7300B15929 /* Development */,
+				4BDCDBFD1001FD7300B15929 /* Deployment */,
+				4BDCDBFE1001FD7300B15929 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BDCDC211001FDE300B15929 /* Build configuration list for PBXNativeTarget "netadapter 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BDCDC221001FDE300B15929 /* Development */,
+				4BDCDC231001FDE300B15929 /* Deployment */,
+				4BDCDC241001FDE300B15929 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BE6C69F0A3E096F005A203A /* Build configuration list for PBXNativeTarget "jack_test Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BE6C6A00A3E096F005A203A /* Development */,
+				4BE6C6A10A3E096F005A203A /* Deployment */,
+				4BE6C6A20A3E096F005A203A /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BE99D2C0AD7A04800C59091 /* Build configuration list for PBXNativeTarget "jack_cpu Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BE99D2D0AD7A04800C59091 /* Development */,
+				4BE99D2E0AD7A04800C59091 /* Deployment */,
+				4BE99D2F0AD7A04800C59091 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BF339080F8B864B0080FB5B /* Build configuration list for PBXNativeTarget "jack_coremidi Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BF339090F8B864B0080FB5B /* Development */,
+				4BF3390A0F8B864B0080FB5B /* Deployment */,
+				4BF3390B0F8B864B0080FB5B /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA5E940DEC4D9C00FA4CDB /* Build configuration list for PBXNativeTarget "testMutex Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA5E950DEC4D9C00FA4CDB /* Development */,
+				4BFA5E960DEC4D9C00FA4CDB /* Deployment */,
+				4BFA5E970DEC4D9C00FA4CDB /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA82880DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_evmon 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA82890DF6A9E40087B4E1 /* Development */,
+				4BFA828A0DF6A9E40087B4E1 /* Deployment */,
+				4BFA828B0DF6A9E40087B4E1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA829B0DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_bufsize 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA829C0DF6A9E40087B4E1 /* Development */,
+				4BFA829D0DF6A9E40087B4E1 /* Deployment */,
+				4BFA829E0DF6A9E40087B4E1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA82A70DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_rec 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA82A80DF6A9E40087B4E1 /* Development */,
+				4BFA82A90DF6A9E40087B4E1 /* Deployment */,
+				4BFA82AA0DF6A9E40087B4E1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA82B30DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_monitor_client 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA82B40DF6A9E40087B4E1 /* Development */,
+				4BFA82B50DF6A9E40087B4E1 /* Deployment */,
+				4BFA82B60DF6A9E40087B4E1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA82BF0DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_showtime 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA82C00DF6A9E40087B4E1 /* Development */,
+				4BFA82C10DF6A9E40087B4E1 /* Deployment */,
+				4BFA82C20DF6A9E40087B4E1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA82CB0DF6A9E40087B4E1 /* Build configuration list for PBXNativeTarget "jack_impulse_grabber 64 bits" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA82CC0DF6A9E40087B4E1 /* Development */,
+				4BFA82CD0DF6A9E40087B4E1 /* Deployment */,
+				4BFA82CE0DF6A9E40087B4E1 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		4BFA999E0AAAF3B0009E916C /* Build configuration list for PBXNativeTarget "jdelay Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4BFA999F0AAAF3B0009E916C /* Development */,
+				4BFA99A00AAAF3B0009E916C /* Deployment */,
+				4BFA99A10AAAF3B0009E916C /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		BA222ACB0DC88132001A17F4 /* Build configuration list for PBXNativeTarget "jack_net Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				BA222ACC0DC88132001A17F4 /* Development */,
+				BA222ACD0DC88132001A17F4 /* Deployment */,
+				BA222ACE0DC88132001A17F4 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		BA222AE50DC882DB001A17F4 /* Build configuration list for PBXNativeTarget "netmanager Universal" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				BA222AE60DC882DB001A17F4 /* Development */,
+				BA222AE70DC882DB001A17F4 /* Deployment */,
+				BA222AE80DC882DB001A17F4 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/macosx/RPC/JackRPCClient.defs b/macosx/RPC/JackRPCClient.defs
new file mode 100644
index 0000000..3c3eb51
--- /dev/null
+++ b/macosx/RPC/JackRPCClient.defs
@@ -0,0 +1,47 @@
+/*
+ 	Copyright (C) 2004 Grame
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+subsystem  JackRPCClient 1000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+import "Jackdefs.h";
+waittime 5000;
+
+type client_name_t = c_string[64];
+type message_t = c_string[256];
+
+routine rpc_jack_client_sync_notify(
+	client_port	: mach_port_t;
+	refnum		: int;
+	client_name	: client_name_t;
+	notify		: int;
+	message		: message_t;
+	value1		: int;
+	value2		: int;
+    out result : int);
+
+simpleroutine rpc_jack_client_async_notify(
+	client_port	: mach_port_t;
+	refnum		: int;
+	client_name	: client_name_t;
+	notify		: int;
+	message		: message_t;
+	value1		: int;
+	value2		: int);
diff --git a/macosx/RPC/JackRPCClient.h b/macosx/RPC/JackRPCClient.h
new file mode 100644
index 0000000..d446247
--- /dev/null
+++ b/macosx/RPC/JackRPCClient.h
@@ -0,0 +1,194 @@
+#ifndef	_JackRPCClient_user_
+#define	_JackRPCClient_user_
+
+/* Module JackRPCClient */
+
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#include <mach/port.h>
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	JackRPCClient_MSG_COUNT
+#define	JackRPCClient_MSG_COUNT	2
+#endif	/* JackRPCClient_MSG_COUNT */
+
+#include <mach/std_types.h>
+#include <mach/mig.h>
+#include <mach/mig.h>
+#include <mach/mach_types.h>
+#include "Jackdefs.h"
+
+#ifdef __BeforeMigUserHeader
+__BeforeMigUserHeader
+#endif /* __BeforeMigUserHeader */
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+
+
+/* Routine rpc_jack_client_sync_notify */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_sync_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	client_name_t client_name,
+	int notify,
+	message_t message,
+	int value1,
+	int value2,
+	int *result
+);
+
+/* SimpleRoutine rpc_jack_client_async_notify */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_async_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	client_name_t client_name,
+	int notify,
+	message_t message,
+	int value1,
+	int value2
+);
+
+__END_DECLS
+
+/********************** Caution **************************/
+/* The following data types should be used to calculate  */
+/* maximum message sizes only. The actual message may be */
+/* smaller, and the position of the arguments within the */
+/* message layout may vary from what is presented here.  */
+/* For example, if any of the arguments are variable-    */
+/* sized, and less than the maximum is sent, the data    */
+/* will be packed tight in the actual message to reduce  */
+/* the presence of holes.                                */
+/********************** Caution **************************/
+
+/* typedefs for all requests */
+
+#ifndef __Request__JackRPCClient_subsystem__defined
+#define __Request__JackRPCClient_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+	} __Request__rpc_jack_client_sync_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+	} __Request__rpc_jack_client_async_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__JackRPCClient_subsystem__defined */
+
+/* union of all requests */
+
+#ifndef __RequestUnion__JackRPCClient_subsystem__defined
+#define __RequestUnion__JackRPCClient_subsystem__defined
+union __RequestUnion__JackRPCClient_subsystem {
+	__Request__rpc_jack_client_sync_notify_t Request_rpc_jack_client_sync_notify;
+	__Request__rpc_jack_client_async_notify_t Request_rpc_jack_client_async_notify;
+};
+#endif /* !__RequestUnion__JackRPCClient_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__JackRPCClient_subsystem__defined
+#define __Reply__JackRPCClient_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_sync_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__rpc_jack_client_async_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__JackRPCClient_subsystem__defined */
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__JackRPCClient_subsystem__defined
+#define __ReplyUnion__JackRPCClient_subsystem__defined
+union __ReplyUnion__JackRPCClient_subsystem {
+	__Reply__rpc_jack_client_sync_notify_t Reply_rpc_jack_client_sync_notify;
+	__Reply__rpc_jack_client_async_notify_t Reply_rpc_jack_client_async_notify;
+};
+#endif /* !__RequestUnion__JackRPCClient_subsystem__defined */
+
+#ifndef subsystem_to_name_map_JackRPCClient
+#define subsystem_to_name_map_JackRPCClient \
+    { "rpc_jack_client_sync_notify", 1000 },\
+    { "rpc_jack_client_async_notify", 1001 }
+#endif
+
+#ifdef __AfterMigUserHeader
+__AfterMigUserHeader
+#endif /* __AfterMigUserHeader */
+
+#endif	 /* _JackRPCClient_user_ */
diff --git a/macosx/RPC/JackRPCClientServer.c b/macosx/RPC/JackRPCClientServer.c
new file mode 100644
index 0000000..7f5af27
--- /dev/null
+++ b/macosx/RPC/JackRPCClientServer.c
@@ -0,0 +1,1373 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Fri Oct 23 10:35:08 2009
+ * with a MiG generated Mon May 18 09:59:33 PDT 2009 by root at sulitlana.apple.com
+ * OPTIONS: 
+ */
+
+/* Module JackRPCClient */
+
+#define	__MIG_check__Request__JackRPCClient_subsystem__ 1
+#define	__NDR_convert__Request__JackRPCClient_subsystem__ 1
+
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#include <mach/port.h>
+
+#include <mach/std_types.h>
+#include <mach/mig.h>
+#include <mach/mig.h>
+#include <mach/mach_types.h>
+#include "Jackdefs.h"
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 3) & ~3)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	0
+#endif	/* UseStaticTemplates */
+
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__JackRPCClient_subsystem__defined
+#define __Request__JackRPCClient_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+	} __Request__rpc_jack_client_sync_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+	} __Request__rpc_jack_client_async_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__JackRPCClient_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__JackRPCClient_subsystem__defined
+#define __Reply__JackRPCClient_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_sync_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__rpc_jack_client_async_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__JackRPCClient_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__JackRPCClient_subsystem__defined
+#define __ReplyUnion__JackRPCClient_subsystem__defined
+union __ReplyUnion__JackRPCClient_subsystem {
+	__Reply__rpc_jack_client_sync_notify_t Reply_rpc_jack_client_sync_notify;
+	__Reply__rpc_jack_client_async_notify_t Reply_rpc_jack_client_async_notify;
+};
+#endif /* __RequestUnion__JackRPCClient_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xrpc_jack_client_sync_notify
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_client_async_notify
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCClient_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_sync_notify_t__defined)
+#define __MIG_check__Request__rpc_jack_client_sync_notify_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__message_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__message_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__int_rep__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__string(a, f, 256)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__int_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__message_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__message_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__char_rep__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__string(a, f, 256)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__char_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__message_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__message_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__float_rep__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__string(a, f, 256)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message(a, f) \
+	__NDR_convert__float_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_sync_notify_t(__attribute__((__unused__)) __Request__rpc_jack_client_sync_notify_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_sync_notify_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->client_name),  64);
+		if (( memchr(In0P->client_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->message),  256);
+		if (( memchr(In0P->message, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name(&In0P->client_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify(&In0P->notify, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__notify__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message(&In0P->message, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__message__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1(&In0P->value1, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value1__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2(&In0P->value2, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_sync_notify_t__value2__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name(&In0P->client_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify(&In0P->notify, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__notify__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message(&In0P->message, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__message__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1(&In0P->value1, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value1__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2(&In0P->value2, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_sync_notify_t__value2__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name(&In0P->client_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__client_name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify(&In0P->notify, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__notify__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message(&In0P->message, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__message__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1(&In0P->value1, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value1__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2(&In0P->value2, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_sync_notify_t__value2__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_sync_notify_t__defined) */
+#endif /* __MIG_check__Request__JackRPCClient_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_sync_notify */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_sync_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	client_name_t client_name,
+	int notify,
+	message_t message,
+	int value1,
+	int value2,
+	int *result
+);
+
+/* Routine rpc_jack_client_sync_notify */
+mig_internal novalue _Xrpc_jack_client_sync_notify
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_sync_notify_t __Request;
+	typedef __Reply__rpc_jack_client_sync_notify_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_sync_notify_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_sync_notify_t__defined */
+
+	__DeclareRcvRpc(1000, "rpc_jack_client_sync_notify")
+	__BeforeRcvRpc(1000, "rpc_jack_client_sync_notify")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_sync_notify_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_sync_notify_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_sync_notify_t__defined) */
+
+	OutP->RetCode = rpc_jack_client_sync_notify(In0P->Head.msgh_request_port, In0P->refnum, In0P->client_name, In0P->notify, In0P->message, In0P->value1, In0P->value2, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1000, "rpc_jack_client_sync_notify")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCClient_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_async_notify_t__defined)
+#define __MIG_check__Request__rpc_jack_client_async_notify_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__message_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__message_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__int_rep__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__string(a, f, 256)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__int_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__message_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__message_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__char_rep__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__string(a, f, 256)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__char_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__message_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__message_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__float_rep__message_t((message_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__string(a, f, 256)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message(a, f) \
+	__NDR_convert__float_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_async_notify_t(__attribute__((__unused__)) __Request__rpc_jack_client_async_notify_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_async_notify_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->client_name),  64);
+		if (( memchr(In0P->client_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->message),  256);
+		if (( memchr(In0P->message, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name(&In0P->client_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__client_name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify(&In0P->notify, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__notify__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message(&In0P->message, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__message__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1(&In0P->value1, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value1__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2(&In0P->value2, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_async_notify_t__value2__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name(&In0P->client_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__client_name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify(&In0P->notify, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__notify__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message(&In0P->message, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__message__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1(&In0P->value1, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value1__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2(&In0P->value2, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_async_notify_t__value2__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name(&In0P->client_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__client_name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify(&In0P->notify, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__notify__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message(&In0P->message, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__message__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1(&In0P->value1, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value1__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2(&In0P->value2, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_async_notify_t__value2__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_async_notify_t__defined) */
+#endif /* __MIG_check__Request__JackRPCClient_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* SimpleRoutine rpc_jack_client_async_notify */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_async_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	client_name_t client_name,
+	int notify,
+	message_t message,
+	int value1,
+	int value2
+);
+
+/* SimpleRoutine rpc_jack_client_async_notify */
+mig_internal novalue _Xrpc_jack_client_async_notify
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_async_notify_t __Request;
+	typedef __Reply__rpc_jack_client_async_notify_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_async_notify_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_async_notify_t__defined */
+
+	__DeclareRcvSimple(1001, "rpc_jack_client_async_notify")
+	__BeforeRcvSimple(1001, "rpc_jack_client_async_notify")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_async_notify_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_async_notify_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_async_notify_t__defined) */
+
+	OutP->RetCode = rpc_jack_client_async_notify(In0P->Head.msgh_request_port, In0P->refnum, In0P->client_name, In0P->notify, In0P->message, In0P->value1, In0P->value2);
+	__AfterRcvSimple(1001, "rpc_jack_client_async_notify")
+}
+
+
+extern boolean_t JackRPCClient_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+extern mig_routine_t JackRPCClient_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+const struct JackRPCClient_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[2];
+} JackRPCClient_subsystem = {
+	JackRPCClient_server_routine,
+	1000,
+	1002,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__JackRPCClient_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_sync_notify, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_sync_notify_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_async_notify, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_async_notify_t)},
+	}
+};
+
+mig_external boolean_t JackRPCClient_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 1001) || (InHeadP->msgh_id < 1000) ||
+	    ((routine = JackRPCClient_subsystem.routine[InHeadP->msgh_id - 1000].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t JackRPCClient_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 1000;
+
+	if ((msgh_id > 1) || (msgh_id < 0))
+		return 0;
+
+	return JackRPCClient_subsystem.routine[msgh_id].stub_routine;
+}
diff --git a/macosx/RPC/JackRPCClientUser.c b/macosx/RPC/JackRPCClientUser.c
new file mode 100644
index 0000000..e6fef35
--- /dev/null
+++ b/macosx/RPC/JackRPCClientUser.c
@@ -0,0 +1,466 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Fri Oct 23 10:35:08 2009
+ * with a MiG generated Mon May 18 09:59:33 PDT 2009 by root at sulitlana.apple.com
+ * OPTIONS: 
+ */
+#define	__MIG_check__Reply__JackRPCClient_subsystem__ 1
+#define	__NDR_convert__Reply__JackRPCClient_subsystem__ 1
+#define	__NDR_convert__mig_reply_error_subsystem__ 1
+
+#include "JackRPCClient.h"
+
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 3) & ~3)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	0
+#endif	/* UseStaticTemplates */
+
+#ifndef	__MachMsgErrorWithTimeout
+#define	__MachMsgErrorWithTimeout(_R_) { \
+	switch (_R_) { \
+	case MACH_SEND_INVALID_DATA: \
+	case MACH_SEND_INVALID_DEST: \
+	case MACH_SEND_INVALID_HEADER: \
+		mig_put_reply_port(InP->Head.msgh_reply_port); \
+		break; \
+	case MACH_SEND_TIMED_OUT: \
+	case MACH_RCV_TIMED_OUT: \
+	default: \
+		mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
+	} \
+}
+#endif	/* __MachMsgErrorWithTimeout */
+
+#ifndef	__MachMsgErrorWithoutTimeout
+#define	__MachMsgErrorWithoutTimeout(_R_) { \
+	switch (_R_) { \
+	case MACH_SEND_INVALID_DATA: \
+	case MACH_SEND_INVALID_DEST: \
+	case MACH_SEND_INVALID_HEADER: \
+		mig_put_reply_port(InP->Head.msgh_reply_port); \
+		break; \
+	default: \
+		mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
+	} \
+}
+#endif	/* __MachMsgErrorWithoutTimeout */
+
+#ifndef	__DeclareSendRpc
+#define	__DeclareSendRpc(_NUM_, _NAME_)
+#endif	/* __DeclareSendRpc */
+
+#ifndef	__BeforeSendRpc
+#define	__BeforeSendRpc(_NUM_, _NAME_)
+#endif	/* __BeforeSendRpc */
+
+#ifndef	__AfterSendRpc
+#define	__AfterSendRpc(_NUM_, _NAME_)
+#endif	/* __AfterSendRpc */
+
+#ifndef	__DeclareSendSimple
+#define	__DeclareSendSimple(_NUM_, _NAME_)
+#endif	/* __DeclareSendSimple */
+
+#ifndef	__BeforeSendSimple
+#define	__BeforeSendSimple(_NUM_, _NAME_)
+#endif	/* __BeforeSendSimple */
+
+#ifndef	__AfterSendSimple
+#define	__AfterSendSimple(_NUM_, _NAME_)
+#endif	/* __AfterSendSimple */
+
+#define msgh_request_port	msgh_remote_port
+#define msgh_reply_port		msgh_local_port
+
+
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCClient_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined)
+#define __MIG_check__Reply__rpc_jack_client_sync_notify_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_sync_notify_t(__Reply__rpc_jack_client_sync_notify_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_client_sync_notify_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1100) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCClient_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_sync_notify */
+mig_external kern_return_t rpc_jack_client_sync_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	client_name_t client_name,
+	int notify,
+	message_t message,
+	int value1,
+	int value2,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_sync_notify_t__defined */
+
+	__DeclareSendRpc(1000, "rpc_jack_client_sync_notify")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->client_name, client_name, 64);
+
+	InP->notify = notify;
+
+	(void) mig_strncpy(InP->message, message, 256);
+
+	InP->value1 = value1;
+
+	InP->value2 = value2;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = client_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1000;
+
+	__BeforeSendRpc(1000, "rpc_jack_client_sync_notify")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_SEND_TIMEOUT|MACH_RCV_TIMEOUT|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, 5000, MACH_PORT_NULL);
+	__AfterSendRpc(1000, "rpc_jack_client_sync_notify")
+
+	if (msg_result == MACH_SEND_TIMED_OUT) {
+	}
+
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_client_sync_notify_t((__Reply__rpc_jack_client_sync_notify_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+/* SimpleRoutine rpc_jack_client_async_notify */
+mig_external kern_return_t rpc_jack_client_async_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	client_name_t client_name,
+	int notify,
+	message_t message,
+	int value1,
+	int value2
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		int notify;
+		message_t message;
+		int value1;
+		int value2;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+	} Mess;
+
+	Request *InP = &Mess.In;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_async_notify_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_async_notify_t__defined */
+
+	__DeclareSendSimple(1001, "rpc_jack_client_async_notify")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->client_name, client_name, 64);
+
+	InP->notify = notify;
+
+	(void) mig_strncpy(InP->message, message, 256);
+
+	InP->value1 = value1;
+
+	InP->value2 = value2;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, 0);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = client_port;
+	InP->Head.msgh_reply_port = MACH_PORT_NULL;
+	InP->Head.msgh_id = 1001;
+
+	__BeforeSendSimple(1001, "rpc_jack_client_async_notify")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_SEND_TIMEOUT|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, 5000, MACH_PORT_NULL);
+	__AfterSendSimple(1001, "rpc_jack_client_async_notify")
+
+	if (msg_result == MACH_SEND_TIMED_OUT) {
+	}
+
+	return msg_result;
+}
diff --git a/macosx/RPC/JackRPCEngine.defs b/macosx/RPC/JackRPCEngine.defs
new file mode 100644
index 0000000..468b377
--- /dev/null
+++ b/macosx/RPC/JackRPCEngine.defs
@@ -0,0 +1,181 @@
+/*
+ 	Copyright (C) 2004 Grame
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation; either version 2.1 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public License
+    along with this program; if not, write to the Free Software 
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+subsystem  JackRPCEngine 1000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+import "Jackdefs.h";
+
+ServerPrefix server_;
+
+type client_name_t = c_string[64];
+type client_port_name_t = c_string[128];
+type client_port_type_t = c_string[128];
+type so_name_t = c_string[256];
+type objet_data_t = c_string[256];
+
+routine rpc_jack_client_open(
+	server_port	: mach_port_t;
+	client_name	: client_name_t;
+    	pid         : int;
+	out private_port : mach_port_make_send_t;
+	out shared_engine : int;
+	out shared_client : int;
+	out shared_graph : int;
+	out result : int);
+
+routine rpc_jack_client_check(
+	server_port	: mach_port_t;
+	client_name	: client_name_t;
+	out client_name_res	: client_name_t;
+	protocol	: int;
+	options		: int;
+	out status	: int;
+	out result : int);
+
+routine  rpc_jack_client_close(
+	server_port	: mach_port_t;
+	refnum		: int;
+	out result 	: int);
+    
+routine  rpc_jack_client_activate(
+	server_port	: mach_port_t;
+	refnum		: int;
+    	state		: int;
+	out result 	: int);
+
+routine  rpc_jack_client_deactivate(
+	server_port	: mach_port_t;
+	refnum		: int;
+	out result 	: int);
+
+routine rpc_jack_port_register(
+	server_port	: mach_port_t;
+	refnum		: int;
+	name		: client_port_name_t;
+	port_type	: client_port_type_t;
+	flags		: unsigned;
+	buffer_size : unsigned;
+	out port_index : unsigned;
+	out result 	: int);
+	
+routine rpc_jack_port_unregister(
+	server_port	: mach_port_t;
+	refnum		: int;
+	port		: int;
+	out result 	: int);	
+	
+routine rpc_jack_port_connect(
+	server_port	: mach_port_t;
+	refnum		: int;
+	src         	: int;
+	dst         	: int;
+	out result 	: int);
+	
+routine rpc_jack_port_disconnect(
+	server_port	: mach_port_t;
+	refnum		: int;
+	src         	: int;
+	dst         	: int;
+	out result 	: int);
+    
+routine rpc_jack_port_connect_name(
+	server_port	: mach_port_t;
+	refnum		: int;
+	src         	: client_port_name_t;
+	dst         	: client_port_name_t;
+	out result 	: int);
+	
+routine rpc_jack_port_disconnect_name(
+	server_port	: mach_port_t;
+	refnum		: int;
+	src         	: client_port_name_t;
+	dst         	: client_port_name_t;
+	out result 	: int);
+	
+routine rpc_jack_port_rename(
+	server_port	: mach_port_t;
+	refnum		: int;
+	src         	: int;
+	name        	: client_port_name_t;
+	out result 	: int);
+
+routine rpc_jack_set_buffer_size(
+	server_port	: mach_port_t;
+	buffer_size 	: int;
+	out result 	: int);
+	
+routine rpc_jack_set_freewheel(
+	server_port	: mach_port_t;
+	onoff		: int;
+	out result 	: int);
+
+routine rpc_jack_release_timebase(
+	server_port	: mach_port_t;
+	refnum		: int;
+	out result 	: int);
+	
+routine rpc_jack_set_timebase_callback(
+	server_port	: mach_port_t;
+	refnum		: int;
+	conditional	: int;
+	out result 	: int);
+	
+routine rpc_jack_get_internal_clientname(
+	server_port	: mach_port_t;
+	refnum		: int;
+	int_ref		: int;
+	out client_name_res	: client_name_t;
+	out result 	: int);
+	
+routine rpc_jack_internal_clienthandle(
+	server_port	: mach_port_t;
+	refnum		: int;
+	client_name	: client_name_t;
+	out int_ref 	: int;
+	out status	: int;
+	out result 	: int);
+	
+routine rpc_jack_internal_clientload(
+	server_port	: mach_port_t;
+	refnum		: int;
+	client_name	: client_name_t;
+	so_name		: so_name_t;
+	objet_data	: objet_data_t;
+	options		: int;
+	out status	: int;
+	out int_ref 	: int;
+	out result	: int);
+	
+routine rpc_jack_internal_clientunload(
+	server_port	: mach_port_t;
+	refnum		: int;
+	int_ref		: int;
+	out status	: int;
+	out result 	: int);
+
+simpleroutine rpc_jack_client_rt_notify(
+	client_port	: mach_port_t;
+	refnum		: int;
+	notify		: int;
+    	value		: int;
+	waittime timeout : int);
+
+	
diff --git a/macosx/RPC/JackRPCEngine.h b/macosx/RPC/JackRPCEngine.h
new file mode 100644
index 0000000..b9ba07f
--- /dev/null
+++ b/macosx/RPC/JackRPCEngine.h
@@ -0,0 +1,1040 @@
+#ifndef	_JackRPCEngine_user_
+#define	_JackRPCEngine_user_
+
+/* Module JackRPCEngine */
+
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#include <mach/port.h>
+
+#ifdef AUTOTEST
+#ifndef FUNCTION_PTR_T
+#define FUNCTION_PTR_T
+typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
+typedef struct {
+        char            *name;
+        function_ptr_t  function;
+} function_table_entry;
+typedef function_table_entry   *function_table_t;
+#endif /* FUNCTION_PTR_T */
+#endif /* AUTOTEST */
+
+#ifndef	JackRPCEngine_MSG_COUNT
+#define	JackRPCEngine_MSG_COUNT	21
+#endif	/* JackRPCEngine_MSG_COUNT */
+
+#include <mach/std_types.h>
+#include <mach/mig.h>
+#include <mach/mig.h>
+#include <mach/mach_types.h>
+#include "Jackdefs.h"
+
+#ifdef __BeforeMigUserHeader
+__BeforeMigUserHeader
+#endif /* __BeforeMigUserHeader */
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+
+
+/* Routine rpc_jack_client_open */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_open
+(
+	mach_port_t server_port,
+	client_name_t client_name,
+	int pid,
+	mach_port_t *private_port,
+	int *shared_engine,
+	int *shared_client,
+	int *shared_graph,
+	int *result
+);
+
+/* Routine rpc_jack_client_check */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_check
+(
+	mach_port_t server_port,
+	client_name_t client_name,
+	client_name_t client_name_res,
+	int protocol,
+	int options,
+	int *status,
+	int *result
+);
+
+/* Routine rpc_jack_client_close */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_close
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+);
+
+/* Routine rpc_jack_client_activate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_activate
+(
+	mach_port_t server_port,
+	int refnum,
+	int state,
+	int *result
+);
+
+/* Routine rpc_jack_client_deactivate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_deactivate
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+);
+
+/* Routine rpc_jack_port_register */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_register
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t name,
+	client_port_type_t port_type,
+	unsigned flags,
+	unsigned buffer_size,
+	unsigned *port_index,
+	int *result
+);
+
+/* Routine rpc_jack_port_unregister */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_unregister
+(
+	mach_port_t server_port,
+	int refnum,
+	int port,
+	int *result
+);
+
+/* Routine rpc_jack_port_connect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_connect
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	int dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_disconnect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_disconnect
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	int dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_connect_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_connect_name
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t src,
+	client_port_name_t dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_disconnect_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_disconnect_name
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t src,
+	client_port_name_t dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_rename */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_port_rename
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	client_port_name_t name,
+	int *result
+);
+
+/* Routine rpc_jack_set_buffer_size */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_set_buffer_size
+(
+	mach_port_t server_port,
+	int buffer_size,
+	int *result
+);
+
+/* Routine rpc_jack_set_freewheel */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_set_freewheel
+(
+	mach_port_t server_port,
+	int onoff,
+	int *result
+);
+
+/* Routine rpc_jack_release_timebase */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_release_timebase
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+);
+
+/* Routine rpc_jack_set_timebase_callback */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_set_timebase_callback
+(
+	mach_port_t server_port,
+	int refnum,
+	int conditional,
+	int *result
+);
+
+/* Routine rpc_jack_get_internal_clientname */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_get_internal_clientname
+(
+	mach_port_t server_port,
+	int refnum,
+	int int_ref,
+	client_name_t client_name_res,
+	int *result
+);
+
+/* Routine rpc_jack_internal_clienthandle */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_internal_clienthandle
+(
+	mach_port_t server_port,
+	int refnum,
+	client_name_t client_name,
+	int *int_ref,
+	int *status,
+	int *result
+);
+
+/* Routine rpc_jack_internal_clientload */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_internal_clientload
+(
+	mach_port_t server_port,
+	int refnum,
+	client_name_t client_name,
+	so_name_t so_name,
+	objet_data_t objet_data,
+	int options,
+	int *status,
+	int *int_ref,
+	int *result
+);
+
+/* Routine rpc_jack_internal_clientunload */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_internal_clientunload
+(
+	mach_port_t server_port,
+	int refnum,
+	int int_ref,
+	int *status,
+	int *result
+);
+
+/* SimpleRoutine rpc_jack_client_rt_notify */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t rpc_jack_client_rt_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	int notify,
+	int value,
+	int timeout
+);
+
+__END_DECLS
+
+/********************** Caution **************************/
+/* The following data types should be used to calculate  */
+/* maximum message sizes only. The actual message may be */
+/* smaller, and the position of the arguments within the */
+/* message layout may vary from what is presented here.  */
+/* For example, if any of the arguments are variable-    */
+/* sized, and less than the maximum is sent, the data    */
+/* will be packed tight in the actual message to reduce  */
+/* the presence of holes.                                */
+/********************** Caution **************************/
+
+/* typedefs for all requests */
+
+#ifndef __Request__JackRPCEngine_subsystem__defined
+#define __Request__JackRPCEngine_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int pid;
+	} __Request__rpc_jack_client_open_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int protocol;
+		int options;
+	} __Request__rpc_jack_client_check_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} __Request__rpc_jack_client_close_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int state;
+	} __Request__rpc_jack_client_activate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} __Request__rpc_jack_client_deactivate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t name;
+		client_port_type_t port_type;
+		unsigned flags;
+		unsigned buffer_size;
+	} __Request__rpc_jack_port_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int port;
+	} __Request__rpc_jack_port_unregister_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+	} __Request__rpc_jack_port_connect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+	} __Request__rpc_jack_port_disconnect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+	} __Request__rpc_jack_port_connect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+	} __Request__rpc_jack_port_disconnect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		client_port_name_t name;
+	} __Request__rpc_jack_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int buffer_size;
+	} __Request__rpc_jack_set_buffer_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int onoff;
+	} __Request__rpc_jack_set_freewheel_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} __Request__rpc_jack_release_timebase_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int conditional;
+	} __Request__rpc_jack_set_timebase_callback_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+	} __Request__rpc_jack_get_internal_clientname_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+	} __Request__rpc_jack_internal_clienthandle_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		so_name_t so_name;
+		objet_data_t objet_data;
+		int options;
+	} __Request__rpc_jack_internal_clientload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+	} __Request__rpc_jack_internal_clientunload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int notify;
+		int value;
+	} __Request__rpc_jack_client_rt_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__JackRPCEngine_subsystem__defined */
+
+/* union of all requests */
+
+#ifndef __RequestUnion__JackRPCEngine_subsystem__defined
+#define __RequestUnion__JackRPCEngine_subsystem__defined
+union __RequestUnion__JackRPCEngine_subsystem {
+	__Request__rpc_jack_client_open_t Request_rpc_jack_client_open;
+	__Request__rpc_jack_client_check_t Request_rpc_jack_client_check;
+	__Request__rpc_jack_client_close_t Request_rpc_jack_client_close;
+	__Request__rpc_jack_client_activate_t Request_rpc_jack_client_activate;
+	__Request__rpc_jack_client_deactivate_t Request_rpc_jack_client_deactivate;
+	__Request__rpc_jack_port_register_t Request_rpc_jack_port_register;
+	__Request__rpc_jack_port_unregister_t Request_rpc_jack_port_unregister;
+	__Request__rpc_jack_port_connect_t Request_rpc_jack_port_connect;
+	__Request__rpc_jack_port_disconnect_t Request_rpc_jack_port_disconnect;
+	__Request__rpc_jack_port_connect_name_t Request_rpc_jack_port_connect_name;
+	__Request__rpc_jack_port_disconnect_name_t Request_rpc_jack_port_disconnect_name;
+	__Request__rpc_jack_port_rename_t Request_rpc_jack_port_rename;
+	__Request__rpc_jack_set_buffer_size_t Request_rpc_jack_set_buffer_size;
+	__Request__rpc_jack_set_freewheel_t Request_rpc_jack_set_freewheel;
+	__Request__rpc_jack_release_timebase_t Request_rpc_jack_release_timebase;
+	__Request__rpc_jack_set_timebase_callback_t Request_rpc_jack_set_timebase_callback;
+	__Request__rpc_jack_get_internal_clientname_t Request_rpc_jack_get_internal_clientname;
+	__Request__rpc_jack_internal_clienthandle_t Request_rpc_jack_internal_clienthandle;
+	__Request__rpc_jack_internal_clientload_t Request_rpc_jack_internal_clientload;
+	__Request__rpc_jack_internal_clientunload_t Request_rpc_jack_internal_clientunload;
+	__Request__rpc_jack_client_rt_notify_t Request_rpc_jack_client_rt_notify;
+};
+#endif /* !__RequestUnion__JackRPCEngine_subsystem__defined */
+/* typedefs for all replies */
+
+#ifndef __Reply__JackRPCEngine_subsystem__defined
+#define __Reply__JackRPCEngine_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t private_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int shared_engine;
+		int shared_client;
+		int shared_graph;
+		int result;
+	} __Reply__rpc_jack_client_open_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int status;
+		int result;
+	} __Reply__rpc_jack_client_check_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_close_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_activate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_deactivate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		unsigned port_index;
+		int result;
+	} __Reply__rpc_jack_port_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_unregister_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_connect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_disconnect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_connect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_disconnect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_set_buffer_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_set_freewheel_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_release_timebase_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_set_timebase_callback_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int result;
+	} __Reply__rpc_jack_get_internal_clientname_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int int_ref;
+		int status;
+		int result;
+	} __Reply__rpc_jack_internal_clienthandle_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int int_ref;
+		int result;
+	} __Reply__rpc_jack_internal_clientload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int result;
+	} __Reply__rpc_jack_internal_clientunload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__rpc_jack_client_rt_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__JackRPCEngine_subsystem__defined */
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__JackRPCEngine_subsystem__defined
+#define __ReplyUnion__JackRPCEngine_subsystem__defined
+union __ReplyUnion__JackRPCEngine_subsystem {
+	__Reply__rpc_jack_client_open_t Reply_rpc_jack_client_open;
+	__Reply__rpc_jack_client_check_t Reply_rpc_jack_client_check;
+	__Reply__rpc_jack_client_close_t Reply_rpc_jack_client_close;
+	__Reply__rpc_jack_client_activate_t Reply_rpc_jack_client_activate;
+	__Reply__rpc_jack_client_deactivate_t Reply_rpc_jack_client_deactivate;
+	__Reply__rpc_jack_port_register_t Reply_rpc_jack_port_register;
+	__Reply__rpc_jack_port_unregister_t Reply_rpc_jack_port_unregister;
+	__Reply__rpc_jack_port_connect_t Reply_rpc_jack_port_connect;
+	__Reply__rpc_jack_port_disconnect_t Reply_rpc_jack_port_disconnect;
+	__Reply__rpc_jack_port_connect_name_t Reply_rpc_jack_port_connect_name;
+	__Reply__rpc_jack_port_disconnect_name_t Reply_rpc_jack_port_disconnect_name;
+	__Reply__rpc_jack_port_rename_t Reply_rpc_jack_port_rename;
+	__Reply__rpc_jack_set_buffer_size_t Reply_rpc_jack_set_buffer_size;
+	__Reply__rpc_jack_set_freewheel_t Reply_rpc_jack_set_freewheel;
+	__Reply__rpc_jack_release_timebase_t Reply_rpc_jack_release_timebase;
+	__Reply__rpc_jack_set_timebase_callback_t Reply_rpc_jack_set_timebase_callback;
+	__Reply__rpc_jack_get_internal_clientname_t Reply_rpc_jack_get_internal_clientname;
+	__Reply__rpc_jack_internal_clienthandle_t Reply_rpc_jack_internal_clienthandle;
+	__Reply__rpc_jack_internal_clientload_t Reply_rpc_jack_internal_clientload;
+	__Reply__rpc_jack_internal_clientunload_t Reply_rpc_jack_internal_clientunload;
+	__Reply__rpc_jack_client_rt_notify_t Reply_rpc_jack_client_rt_notify;
+};
+#endif /* !__RequestUnion__JackRPCEngine_subsystem__defined */
+
+#ifndef subsystem_to_name_map_JackRPCEngine
+#define subsystem_to_name_map_JackRPCEngine \
+    { "rpc_jack_client_open", 1000 },\
+    { "rpc_jack_client_check", 1001 },\
+    { "rpc_jack_client_close", 1002 },\
+    { "rpc_jack_client_activate", 1003 },\
+    { "rpc_jack_client_deactivate", 1004 },\
+    { "rpc_jack_port_register", 1005 },\
+    { "rpc_jack_port_unregister", 1006 },\
+    { "rpc_jack_port_connect", 1007 },\
+    { "rpc_jack_port_disconnect", 1008 },\
+    { "rpc_jack_port_connect_name", 1009 },\
+    { "rpc_jack_port_disconnect_name", 1010 },\
+    { "rpc_jack_port_rename", 1011 },\
+    { "rpc_jack_set_buffer_size", 1012 },\
+    { "rpc_jack_set_freewheel", 1013 },\
+    { "rpc_jack_release_timebase", 1014 },\
+    { "rpc_jack_set_timebase_callback", 1015 },\
+    { "rpc_jack_get_internal_clientname", 1016 },\
+    { "rpc_jack_internal_clienthandle", 1017 },\
+    { "rpc_jack_internal_clientload", 1018 },\
+    { "rpc_jack_internal_clientunload", 1019 },\
+    { "rpc_jack_client_rt_notify", 1020 }
+#endif
+
+#ifdef __AfterMigUserHeader
+__AfterMigUserHeader
+#endif /* __AfterMigUserHeader */
+
+#endif	 /* _JackRPCEngine_user_ */
diff --git a/macosx/RPC/JackRPCEngineServer.c b/macosx/RPC/JackRPCEngineServer.c
new file mode 100644
index 0000000..7ef5d55
--- /dev/null
+++ b/macosx/RPC/JackRPCEngineServer.c
@@ -0,0 +1,6817 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Fri Oct 23 10:35:08 2009
+ * with a MiG generated Mon May 18 09:59:33 PDT 2009 by root at sulitlana.apple.com
+ * OPTIONS: 
+ */
+
+/* Module JackRPCEngine */
+
+#define	__MIG_check__Request__JackRPCEngine_subsystem__ 1
+#define	__NDR_convert__Request__JackRPCEngine_subsystem__ 1
+
+#include <string.h>
+#include <mach/ndr.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/notify.h>
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/mig_errors.h>
+#include <mach/port.h>
+
+#include <mach/std_types.h>
+#include <mach/mig.h>
+#include <mach/mig.h>
+#include <mach/mach_types.h>
+#include "Jackdefs.h"
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 3) & ~3)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	0
+#endif	/* UseStaticTemplates */
+
+#ifndef	__DeclareRcvRpc
+#define	__DeclareRcvRpc(_NUM_, _NAME_)
+#endif	/* __DeclareRcvRpc */
+
+#ifndef	__BeforeRcvRpc
+#define	__BeforeRcvRpc(_NUM_, _NAME_)
+#endif	/* __BeforeRcvRpc */
+
+#ifndef	__AfterRcvRpc
+#define	__AfterRcvRpc(_NUM_, _NAME_)
+#endif	/* __AfterRcvRpc */
+
+#ifndef	__DeclareRcvSimple
+#define	__DeclareRcvSimple(_NUM_, _NAME_)
+#endif	/* __DeclareRcvSimple */
+
+#ifndef	__BeforeRcvSimple
+#define	__BeforeRcvSimple(_NUM_, _NAME_)
+#endif	/* __BeforeRcvSimple */
+
+#ifndef	__AfterRcvSimple
+#define	__AfterRcvSimple(_NUM_, _NAME_)
+#endif	/* __AfterRcvSimple */
+
+#define novalue void
+
+#define msgh_request_port	msgh_local_port
+#define MACH_MSGH_BITS_REQUEST(bits)	MACH_MSGH_BITS_LOCAL(bits)
+#define msgh_reply_port		msgh_remote_port
+#define MACH_MSGH_BITS_REPLY(bits)	MACH_MSGH_BITS_REMOTE(bits)
+
+#define MIG_RETURN_ERROR(X, code)	{\
+				((mig_reply_error_t *)X)->RetCode = code;\
+				((mig_reply_error_t *)X)->NDR = NDR_record;\
+				return;\
+				}
+
+/* typedefs for all requests */
+
+#ifndef __Request__JackRPCEngine_subsystem__defined
+#define __Request__JackRPCEngine_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int pid;
+	} __Request__rpc_jack_client_open_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int protocol;
+		int options;
+	} __Request__rpc_jack_client_check_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} __Request__rpc_jack_client_close_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int state;
+	} __Request__rpc_jack_client_activate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} __Request__rpc_jack_client_deactivate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t name;
+		client_port_type_t port_type;
+		unsigned flags;
+		unsigned buffer_size;
+	} __Request__rpc_jack_port_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int port;
+	} __Request__rpc_jack_port_unregister_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+	} __Request__rpc_jack_port_connect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+	} __Request__rpc_jack_port_disconnect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+	} __Request__rpc_jack_port_connect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+	} __Request__rpc_jack_port_disconnect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		client_port_name_t name;
+	} __Request__rpc_jack_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int buffer_size;
+	} __Request__rpc_jack_set_buffer_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int onoff;
+	} __Request__rpc_jack_set_freewheel_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} __Request__rpc_jack_release_timebase_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int conditional;
+	} __Request__rpc_jack_set_timebase_callback_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+	} __Request__rpc_jack_get_internal_clientname_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+	} __Request__rpc_jack_internal_clienthandle_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		so_name_t so_name;
+		objet_data_t objet_data;
+		int options;
+	} __Request__rpc_jack_internal_clientload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+	} __Request__rpc_jack_internal_clientunload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int notify;
+		int value;
+	} __Request__rpc_jack_client_rt_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Request__JackRPCEngine_subsystem__defined */
+
+/* typedefs for all replies */
+
+#ifndef __Reply__JackRPCEngine_subsystem__defined
+#define __Reply__JackRPCEngine_subsystem__defined
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t private_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int shared_engine;
+		int shared_client;
+		int shared_graph;
+		int result;
+	} __Reply__rpc_jack_client_open_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int status;
+		int result;
+	} __Reply__rpc_jack_client_check_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_close_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_activate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_client_deactivate_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		unsigned port_index;
+		int result;
+	} __Reply__rpc_jack_port_register_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_unregister_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_connect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_disconnect_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_connect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_disconnect_name_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_port_rename_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_set_buffer_size_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_set_freewheel_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_release_timebase_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply__rpc_jack_set_timebase_callback_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int result;
+	} __Reply__rpc_jack_get_internal_clientname_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int int_ref;
+		int status;
+		int result;
+	} __Reply__rpc_jack_internal_clienthandle_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int int_ref;
+		int result;
+	} __Reply__rpc_jack_internal_clientload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int result;
+	} __Reply__rpc_jack_internal_clientunload_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+	} __Reply__rpc_jack_client_rt_notify_t;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+#endif /* !__Reply__JackRPCEngine_subsystem__defined */
+
+
+/* union of all replies */
+
+#ifndef __ReplyUnion__server_JackRPCEngine_subsystem__defined
+#define __ReplyUnion__server_JackRPCEngine_subsystem__defined
+union __ReplyUnion__server_JackRPCEngine_subsystem {
+	__Reply__rpc_jack_client_open_t Reply_rpc_jack_client_open;
+	__Reply__rpc_jack_client_check_t Reply_rpc_jack_client_check;
+	__Reply__rpc_jack_client_close_t Reply_rpc_jack_client_close;
+	__Reply__rpc_jack_client_activate_t Reply_rpc_jack_client_activate;
+	__Reply__rpc_jack_client_deactivate_t Reply_rpc_jack_client_deactivate;
+	__Reply__rpc_jack_port_register_t Reply_rpc_jack_port_register;
+	__Reply__rpc_jack_port_unregister_t Reply_rpc_jack_port_unregister;
+	__Reply__rpc_jack_port_connect_t Reply_rpc_jack_port_connect;
+	__Reply__rpc_jack_port_disconnect_t Reply_rpc_jack_port_disconnect;
+	__Reply__rpc_jack_port_connect_name_t Reply_rpc_jack_port_connect_name;
+	__Reply__rpc_jack_port_disconnect_name_t Reply_rpc_jack_port_disconnect_name;
+	__Reply__rpc_jack_port_rename_t Reply_rpc_jack_port_rename;
+	__Reply__rpc_jack_set_buffer_size_t Reply_rpc_jack_set_buffer_size;
+	__Reply__rpc_jack_set_freewheel_t Reply_rpc_jack_set_freewheel;
+	__Reply__rpc_jack_release_timebase_t Reply_rpc_jack_release_timebase;
+	__Reply__rpc_jack_set_timebase_callback_t Reply_rpc_jack_set_timebase_callback;
+	__Reply__rpc_jack_get_internal_clientname_t Reply_rpc_jack_get_internal_clientname;
+	__Reply__rpc_jack_internal_clienthandle_t Reply_rpc_jack_internal_clienthandle;
+	__Reply__rpc_jack_internal_clientload_t Reply_rpc_jack_internal_clientload;
+	__Reply__rpc_jack_internal_clientunload_t Reply_rpc_jack_internal_clientunload;
+	__Reply__rpc_jack_client_rt_notify_t Reply_rpc_jack_client_rt_notify;
+};
+#endif /* __RequestUnion__server_JackRPCEngine_subsystem__defined */
+/* Forward Declarations */
+
+
+mig_internal novalue _Xrpc_jack_client_open
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_client_check
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_client_close
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_client_activate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_client_deactivate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_register
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_unregister
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_connect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_disconnect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_connect_name
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_disconnect_name
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_port_rename
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_set_buffer_size
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_set_freewheel
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_release_timebase
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_set_timebase_callback
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_get_internal_clientname
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_internal_clienthandle
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_internal_clientload
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_internal_clientunload
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+mig_internal novalue _Xrpc_jack_client_rt_notify
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
+
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_open_t__defined)
+#define __MIG_check__Request__rpc_jack_client_open_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_open_t(__attribute__((__unused__)) __Request__rpc_jack_client_open_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_open_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->client_name),  64);
+		if (( memchr(In0P->client_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name(&In0P->client_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(&In0P->pid, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name(&In0P->client_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(&In0P->pid, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name(&In0P->client_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(&In0P->pid, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_open_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_open */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_client_open
+(
+	mach_port_t server_port,
+	client_name_t client_name,
+	int pid,
+	mach_port_t *private_port,
+	int *shared_engine,
+	int *shared_client,
+	int *shared_graph,
+	int *result
+);
+
+/* Routine rpc_jack_client_open */
+mig_internal novalue _Xrpc_jack_client_open
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int pid;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_open_t __Request;
+	typedef __Reply__rpc_jack_client_open_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_open_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_open_t__defined */
+
+#if	UseStaticTemplates
+	const static mach_msg_port_descriptor_t private_portTemplate = {
+		/* name = */		MACH_PORT_NULL,
+		/* pad1 = */		0,
+		/* pad2 = */		0,
+		/* disp = */		20,
+		/* type = */		MACH_MSG_PORT_DESCRIPTOR,
+	};
+#endif	/* UseStaticTemplates */
+
+	kern_return_t RetCode;
+	__DeclareRcvRpc(1000, "rpc_jack_client_open")
+	__BeforeRcvRpc(1000, "rpc_jack_client_open")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_open_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_open_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_open_t__defined) */
+
+#if	UseStaticTemplates
+	OutP->private_port = private_portTemplate;
+#else	/* UseStaticTemplates */
+	OutP->private_port.disposition = 20;
+	OutP->private_port.type = MACH_MSG_PORT_DESCRIPTOR;
+#endif	/* UseStaticTemplates */
+
+
+	RetCode = server_rpc_jack_client_open(In0P->Head.msgh_request_port, In0P->client_name, In0P->pid, &OutP->private_port.name, &OutP->shared_engine, &OutP->shared_client, &OutP->shared_graph, &OutP->result);
+	if (RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	OutP->msgh_body.msgh_descriptor_count = 1;
+	__AfterRcvRpc(1000, "rpc_jack_client_open")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_check_t__defined)
+#define __MIG_check__Request__rpc_jack_client_check_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_check_t(__attribute__((__unused__)) __Request__rpc_jack_client_check_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_check_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->client_name),  64);
+		if (( memchr(In0P->client_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name(&In0P->client_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_check_t__client_name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol(&In0P->protocol, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_check_t__protocol__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_check_t__options(&In0P->options, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_check_t__options__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name(&In0P->client_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_check_t__client_name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol(&In0P->protocol, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_check_t__protocol__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_check_t__options(&In0P->options, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_check_t__options__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name(&In0P->client_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_check_t__client_name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol(&In0P->protocol, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_check_t__protocol__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_check_t__options(&In0P->options, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_check_t__options__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_check_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_check */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_client_check
+(
+	mach_port_t server_port,
+	client_name_t client_name,
+	client_name_t client_name_res,
+	int protocol,
+	int options,
+	int *status,
+	int *result
+);
+
+/* Routine rpc_jack_client_check */
+mig_internal novalue _Xrpc_jack_client_check
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int protocol;
+		int options;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_check_t __Request;
+	typedef __Reply__rpc_jack_client_check_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_check_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_check_t__defined */
+
+	__DeclareRcvRpc(1001, "rpc_jack_client_check")
+	__BeforeRcvRpc(1001, "rpc_jack_client_check")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_check_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_check_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_check_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_client_check(In0P->Head.msgh_request_port, In0P->client_name, OutP->client_name_res, In0P->protocol, In0P->options, &OutP->status, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1001, "rpc_jack_client_check")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_close_t__defined)
+#define __MIG_check__Request__rpc_jack_client_close_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_close_t(__attribute__((__unused__)) __Request__rpc_jack_client_close_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_close_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_close_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_close_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_close_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_close_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_close */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_client_close
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+);
+
+/* Routine rpc_jack_client_close */
+mig_internal novalue _Xrpc_jack_client_close
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_close_t __Request;
+	typedef __Reply__rpc_jack_client_close_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_close_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_close_t__defined */
+
+	__DeclareRcvRpc(1002, "rpc_jack_client_close")
+	__BeforeRcvRpc(1002, "rpc_jack_client_close")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_close_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_close_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_close_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_client_close(In0P->Head.msgh_request_port, In0P->refnum, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1002, "rpc_jack_client_close")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_activate_t__defined)
+#define __MIG_check__Request__rpc_jack_client_activate_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_activate_t(__attribute__((__unused__)) __Request__rpc_jack_client_activate_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_activate_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_activate_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state(&In0P->state, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_activate_t__state__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_activate_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state(&In0P->state, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_activate_t__state__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_activate_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state(&In0P->state, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_activate_t__state__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_activate_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_activate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_client_activate
+(
+	mach_port_t server_port,
+	int refnum,
+	int state,
+	int *result
+);
+
+/* Routine rpc_jack_client_activate */
+mig_internal novalue _Xrpc_jack_client_activate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int state;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_activate_t __Request;
+	typedef __Reply__rpc_jack_client_activate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_activate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_activate_t__defined */
+
+	__DeclareRcvRpc(1003, "rpc_jack_client_activate")
+	__BeforeRcvRpc(1003, "rpc_jack_client_activate")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_activate_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_activate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_activate_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_client_activate(In0P->Head.msgh_request_port, In0P->refnum, In0P->state, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1003, "rpc_jack_client_activate")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_deactivate_t__defined)
+#define __MIG_check__Request__rpc_jack_client_deactivate_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_deactivate_t(__attribute__((__unused__)) __Request__rpc_jack_client_deactivate_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_deactivate_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_deactivate_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_deactivate_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_deactivate_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_deactivate_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_deactivate */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_client_deactivate
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+);
+
+/* Routine rpc_jack_client_deactivate */
+mig_internal novalue _Xrpc_jack_client_deactivate
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_deactivate_t __Request;
+	typedef __Reply__rpc_jack_client_deactivate_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_deactivate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_deactivate_t__defined */
+
+	__DeclareRcvRpc(1004, "rpc_jack_client_deactivate")
+	__BeforeRcvRpc(1004, "rpc_jack_client_deactivate")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_deactivate_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_deactivate_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_deactivate_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_client_deactivate(In0P->Head.msgh_request_port, In0P->refnum, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1004, "rpc_jack_client_deactivate")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_register_t__defined)
+#define __MIG_check__Request__rpc_jack_port_register_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__int_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_type_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_type_t((client_port_type_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_type_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__int_rep__client_port_type_t((client_port_type_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__int_rep__unsigned__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__int_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__uint32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__int_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__int_rep__unsigned__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__uint32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__char_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_type_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_type_t((client_port_type_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_type_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__char_rep__client_port_type_t((client_port_type_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__char_rep__unsigned__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__char_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__uint32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__char_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__char_rep__unsigned__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__uint32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__float_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_type_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_type_t((client_port_type_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_type_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__float_rep__client_port_type_t((client_port_type_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__float_rep__unsigned__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__float_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__uint32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags(a, f) \
+	__NDR_convert__float_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__float_rep__unsigned__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__uint32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_register_t(__attribute__((__unused__)) __Request__rpc_jack_port_register_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_register_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->name),  128);
+		if (( memchr(In0P->name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->port_type),  128);
+		if (( memchr(In0P->port_type, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_register_t__name(&In0P->name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type(&In0P->port_type, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__port_type__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags(&In0P->flags, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__flags__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size(&In0P->buffer_size, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_register_t__buffer_size__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_register_t__name(&In0P->name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type(&In0P->port_type, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__port_type__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags(&In0P->flags, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__flags__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size(&In0P->buffer_size, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_register_t__buffer_size__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_register_t__name(&In0P->name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type(&In0P->port_type, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__port_type__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags(&In0P->flags, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__flags__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size(&In0P->buffer_size, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_register_t__buffer_size__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_register_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_register */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_register
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t name,
+	client_port_type_t port_type,
+	unsigned flags,
+	unsigned buffer_size,
+	unsigned *port_index,
+	int *result
+);
+
+/* Routine rpc_jack_port_register */
+mig_internal novalue _Xrpc_jack_port_register
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t name;
+		client_port_type_t port_type;
+		unsigned flags;
+		unsigned buffer_size;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_register_t __Request;
+	typedef __Reply__rpc_jack_port_register_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_register_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_register_t__defined */
+
+	__DeclareRcvRpc(1005, "rpc_jack_port_register")
+	__BeforeRcvRpc(1005, "rpc_jack_port_register")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_register_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_register_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_register_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_register(In0P->Head.msgh_request_port, In0P->refnum, In0P->name, In0P->port_type, In0P->flags, In0P->buffer_size, &OutP->port_index, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1005, "rpc_jack_port_register")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_unregister_t__defined)
+#define __MIG_check__Request__rpc_jack_port_unregister_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_unregister_t(__attribute__((__unused__)) __Request__rpc_jack_port_unregister_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_unregister_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port(&In0P->port, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_unregister_t__port__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port(&In0P->port, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_unregister_t__port__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port(&In0P->port, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_unregister_t__port__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_unregister_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_unregister */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_unregister
+(
+	mach_port_t server_port,
+	int refnum,
+	int port,
+	int *result
+);
+
+/* Routine rpc_jack_port_unregister */
+mig_internal novalue _Xrpc_jack_port_unregister
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int port;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_unregister_t __Request;
+	typedef __Reply__rpc_jack_port_unregister_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_unregister_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_unregister_t__defined */
+
+	__DeclareRcvRpc(1006, "rpc_jack_port_unregister")
+	__BeforeRcvRpc(1006, "rpc_jack_port_unregister")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_unregister_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_unregister_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_unregister_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_unregister(In0P->Head.msgh_request_port, In0P->refnum, In0P->port, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1006, "rpc_jack_port_unregister")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_connect_t__defined)
+#define __MIG_check__Request__rpc_jack_port_connect_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_connect_t(__attribute__((__unused__)) __Request__rpc_jack_port_connect_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_connect_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src(&In0P->src, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__src__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst(&In0P->dst, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_connect_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src(&In0P->src, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__src__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst(&In0P->dst, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_connect_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src(&In0P->src, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__src__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst(&In0P->dst, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_connect_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_connect_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_connect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_connect
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	int dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_connect */
+mig_internal novalue _Xrpc_jack_port_connect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_connect_t __Request;
+	typedef __Reply__rpc_jack_port_connect_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_connect_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_connect_t__defined */
+
+	__DeclareRcvRpc(1007, "rpc_jack_port_connect")
+	__BeforeRcvRpc(1007, "rpc_jack_port_connect")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_connect_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_connect_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_connect_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_connect(In0P->Head.msgh_request_port, In0P->refnum, In0P->src, In0P->dst, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1007, "rpc_jack_port_connect")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_disconnect_t__defined)
+#define __MIG_check__Request__rpc_jack_port_disconnect_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_disconnect_t(__attribute__((__unused__)) __Request__rpc_jack_port_disconnect_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_disconnect_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src(&In0P->src, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__src__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst(&In0P->dst, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src(&In0P->src, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__src__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst(&In0P->dst, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src(&In0P->src, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__src__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst(&In0P->dst, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_disconnect_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_disconnect */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_disconnect
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	int dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_disconnect */
+mig_internal novalue _Xrpc_jack_port_disconnect
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_disconnect_t __Request;
+	typedef __Reply__rpc_jack_port_disconnect_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_disconnect_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_disconnect_t__defined */
+
+	__DeclareRcvRpc(1008, "rpc_jack_port_disconnect")
+	__BeforeRcvRpc(1008, "rpc_jack_port_disconnect")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_disconnect_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_disconnect_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_disconnect_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_disconnect(In0P->Head.msgh_request_port, In0P->refnum, In0P->src, In0P->dst, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1008, "rpc_jack_port_disconnect")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_connect_name_t__defined)
+#define __MIG_check__Request__rpc_jack_port_connect_name_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__int_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__char_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__float_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_connect_name_t(__attribute__((__unused__)) __Request__rpc_jack_port_connect_name_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_connect_name_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->src),  128);
+		if (( memchr(In0P->src, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->dst),  128);
+		if (( memchr(In0P->dst, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src(&In0P->src, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__src__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst(&In0P->dst, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_connect_name_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src(&In0P->src, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__src__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst(&In0P->dst, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_connect_name_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src(&In0P->src, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__src__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst(&In0P->dst, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_connect_name_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_connect_name_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_connect_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_connect_name
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t src,
+	client_port_name_t dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_connect_name */
+mig_internal novalue _Xrpc_jack_port_connect_name
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_connect_name_t __Request;
+	typedef __Reply__rpc_jack_port_connect_name_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_connect_name_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_connect_name_t__defined */
+
+	__DeclareRcvRpc(1009, "rpc_jack_port_connect_name")
+	__BeforeRcvRpc(1009, "rpc_jack_port_connect_name")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_connect_name_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_connect_name_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_connect_name_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_connect_name(In0P->Head.msgh_request_port, In0P->refnum, In0P->src, In0P->dst, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1009, "rpc_jack_port_connect_name")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_disconnect_name_t__defined)
+#define __MIG_check__Request__rpc_jack_port_disconnect_name_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__int_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__char_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__float_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_disconnect_name_t(__attribute__((__unused__)) __Request__rpc_jack_port_disconnect_name_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_disconnect_name_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->src),  128);
+		if (( memchr(In0P->src, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->dst),  128);
+		if (( memchr(In0P->dst, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src(&In0P->src, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__src__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst(&In0P->dst, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src(&In0P->src, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__src__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst(&In0P->dst, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src(&In0P->src, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__src__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst(&In0P->dst, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_disconnect_name_t__dst__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_disconnect_name_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_disconnect_name */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_disconnect_name
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t src,
+	client_port_name_t dst,
+	int *result
+);
+
+/* Routine rpc_jack_port_disconnect_name */
+mig_internal novalue _Xrpc_jack_port_disconnect_name
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_disconnect_name_t __Request;
+	typedef __Reply__rpc_jack_port_disconnect_name_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_disconnect_name_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_disconnect_name_t__defined */
+
+	__DeclareRcvRpc(1010, "rpc_jack_port_disconnect_name")
+	__BeforeRcvRpc(1010, "rpc_jack_port_disconnect_name")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_disconnect_name_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_disconnect_name_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_disconnect_name_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_disconnect_name(In0P->Head.msgh_request_port, In0P->refnum, In0P->src, In0P->dst, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1010, "rpc_jack_port_disconnect_name")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_port_rename_t__defined)
+#define __MIG_check__Request__rpc_jack_port_rename_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_port_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__int_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_port_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__char_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_port_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__float_rep__client_port_name_t((client_port_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 128)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 128)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_port_rename_t(__attribute__((__unused__)) __Request__rpc_jack_port_rename_t *In0P)
+{
+
+	typedef __Request__rpc_jack_port_rename_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->name),  128);
+		if (( memchr(In0P->name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src(&In0P->src, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__src__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name(&In0P->name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_port_rename_t__name__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src(&In0P->src, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__src__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name(&In0P->name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_port_rename_t__name__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src(&In0P->src, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__src__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name(&In0P->name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_port_rename_t__name__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_port_rename_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_rename */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_port_rename
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	client_port_name_t name,
+	int *result
+);
+
+/* Routine rpc_jack_port_rename */
+mig_internal novalue _Xrpc_jack_port_rename
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		client_port_name_t name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_port_rename_t __Request;
+	typedef __Reply__rpc_jack_port_rename_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_port_rename_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_port_rename_t__defined */
+
+	__DeclareRcvRpc(1011, "rpc_jack_port_rename")
+	__BeforeRcvRpc(1011, "rpc_jack_port_rename")
+
+#if	defined(__MIG_check__Request__rpc_jack_port_rename_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_port_rename_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_port_rename_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_port_rename(In0P->Head.msgh_request_port, In0P->refnum, In0P->src, In0P->name, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1011, "rpc_jack_port_rename")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_set_buffer_size_t__defined)
+#define __MIG_check__Request__rpc_jack_set_buffer_size_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_set_buffer_size_t(__attribute__((__unused__)) __Request__rpc_jack_set_buffer_size_t *In0P)
+{
+
+	typedef __Request__rpc_jack_set_buffer_size_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(&In0P->buffer_size, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(&In0P->buffer_size, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size(&In0P->buffer_size, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_set_buffer_size_t__buffer_size__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_set_buffer_size_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_set_buffer_size */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_set_buffer_size
+(
+	mach_port_t server_port,
+	int buffer_size,
+	int *result
+);
+
+/* Routine rpc_jack_set_buffer_size */
+mig_internal novalue _Xrpc_jack_set_buffer_size
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int buffer_size;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_set_buffer_size_t __Request;
+	typedef __Reply__rpc_jack_set_buffer_size_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_set_buffer_size_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_set_buffer_size_t__defined */
+
+	__DeclareRcvRpc(1012, "rpc_jack_set_buffer_size")
+	__BeforeRcvRpc(1012, "rpc_jack_set_buffer_size")
+
+#if	defined(__MIG_check__Request__rpc_jack_set_buffer_size_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_set_buffer_size_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_set_buffer_size_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_set_buffer_size(In0P->Head.msgh_request_port, In0P->buffer_size, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1012, "rpc_jack_set_buffer_size")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_set_freewheel_t__defined)
+#define __MIG_check__Request__rpc_jack_set_freewheel_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_set_freewheel_t(__attribute__((__unused__)) __Request__rpc_jack_set_freewheel_t *In0P)
+{
+
+	typedef __Request__rpc_jack_set_freewheel_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff(&In0P->onoff, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_set_freewheel_t__onoff__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff(&In0P->onoff, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_set_freewheel_t__onoff__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff(&In0P->onoff, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_set_freewheel_t__onoff__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_set_freewheel_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_set_freewheel */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_set_freewheel
+(
+	mach_port_t server_port,
+	int onoff,
+	int *result
+);
+
+/* Routine rpc_jack_set_freewheel */
+mig_internal novalue _Xrpc_jack_set_freewheel
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int onoff;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_set_freewheel_t __Request;
+	typedef __Reply__rpc_jack_set_freewheel_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_set_freewheel_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_set_freewheel_t__defined */
+
+	__DeclareRcvRpc(1013, "rpc_jack_set_freewheel")
+	__BeforeRcvRpc(1013, "rpc_jack_set_freewheel")
+
+#if	defined(__MIG_check__Request__rpc_jack_set_freewheel_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_set_freewheel_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_set_freewheel_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_set_freewheel(In0P->Head.msgh_request_port, In0P->onoff, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1013, "rpc_jack_set_freewheel")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_release_timebase_t__defined)
+#define __MIG_check__Request__rpc_jack_release_timebase_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_release_timebase_t(__attribute__((__unused__)) __Request__rpc_jack_release_timebase_t *In0P)
+{
+
+	typedef __Request__rpc_jack_release_timebase_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_release_timebase_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_release_timebase_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_release_timebase_t__refnum__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_release_timebase_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_release_timebase */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_release_timebase
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+);
+
+/* Routine rpc_jack_release_timebase */
+mig_internal novalue _Xrpc_jack_release_timebase
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_release_timebase_t __Request;
+	typedef __Reply__rpc_jack_release_timebase_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_release_timebase_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_release_timebase_t__defined */
+
+	__DeclareRcvRpc(1014, "rpc_jack_release_timebase")
+	__BeforeRcvRpc(1014, "rpc_jack_release_timebase")
+
+#if	defined(__MIG_check__Request__rpc_jack_release_timebase_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_release_timebase_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_release_timebase_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_release_timebase(In0P->Head.msgh_request_port, In0P->refnum, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1014, "rpc_jack_release_timebase")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_set_timebase_callback_t__defined)
+#define __MIG_check__Request__rpc_jack_set_timebase_callback_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_set_timebase_callback_t(__attribute__((__unused__)) __Request__rpc_jack_set_timebase_callback_t *In0P)
+{
+
+	typedef __Request__rpc_jack_set_timebase_callback_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional(&In0P->conditional, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional(&In0P->conditional, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional(&In0P->conditional, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_set_timebase_callback_t__conditional__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_set_timebase_callback_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_set_timebase_callback */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_set_timebase_callback
+(
+	mach_port_t server_port,
+	int refnum,
+	int conditional,
+	int *result
+);
+
+/* Routine rpc_jack_set_timebase_callback */
+mig_internal novalue _Xrpc_jack_set_timebase_callback
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int conditional;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_set_timebase_callback_t __Request;
+	typedef __Reply__rpc_jack_set_timebase_callback_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_set_timebase_callback_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_set_timebase_callback_t__defined */
+
+	__DeclareRcvRpc(1015, "rpc_jack_set_timebase_callback")
+	__BeforeRcvRpc(1015, "rpc_jack_set_timebase_callback")
+
+#if	defined(__MIG_check__Request__rpc_jack_set_timebase_callback_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_set_timebase_callback_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_set_timebase_callback_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_set_timebase_callback(In0P->Head.msgh_request_port, In0P->refnum, In0P->conditional, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1015, "rpc_jack_set_timebase_callback")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_get_internal_clientname_t__defined)
+#define __MIG_check__Request__rpc_jack_get_internal_clientname_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_get_internal_clientname_t(__attribute__((__unused__)) __Request__rpc_jack_get_internal_clientname_t *In0P)
+{
+
+	typedef __Request__rpc_jack_get_internal_clientname_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(&In0P->int_ref, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(&In0P->int_ref, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref(&In0P->int_ref, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_get_internal_clientname_t__int_ref__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_get_internal_clientname_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_get_internal_clientname */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_get_internal_clientname
+(
+	mach_port_t server_port,
+	int refnum,
+	int int_ref,
+	client_name_t client_name_res,
+	int *result
+);
+
+/* Routine rpc_jack_get_internal_clientname */
+mig_internal novalue _Xrpc_jack_get_internal_clientname
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_get_internal_clientname_t __Request;
+	typedef __Reply__rpc_jack_get_internal_clientname_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_get_internal_clientname_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_get_internal_clientname_t__defined */
+
+	__DeclareRcvRpc(1016, "rpc_jack_get_internal_clientname")
+	__BeforeRcvRpc(1016, "rpc_jack_get_internal_clientname")
+
+#if	defined(__MIG_check__Request__rpc_jack_get_internal_clientname_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_get_internal_clientname_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_get_internal_clientname_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_get_internal_clientname(In0P->Head.msgh_request_port, In0P->refnum, In0P->int_ref, OutP->client_name_res, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1016, "rpc_jack_get_internal_clientname")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_internal_clienthandle_t__defined)
+#define __MIG_check__Request__rpc_jack_internal_clienthandle_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_internal_clienthandle_t(__attribute__((__unused__)) __Request__rpc_jack_internal_clienthandle_t *In0P)
+{
+
+	typedef __Request__rpc_jack_internal_clienthandle_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->client_name),  64);
+		if (( memchr(In0P->client_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name(&In0P->client_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name(&In0P->client_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name(&In0P->client_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clienthandle_t__client_name__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_internal_clienthandle_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_internal_clienthandle */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_internal_clienthandle
+(
+	mach_port_t server_port,
+	int refnum,
+	client_name_t client_name,
+	int *int_ref,
+	int *status,
+	int *result
+);
+
+/* Routine rpc_jack_internal_clienthandle */
+mig_internal novalue _Xrpc_jack_internal_clienthandle
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_internal_clienthandle_t __Request;
+	typedef __Reply__rpc_jack_internal_clienthandle_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_internal_clienthandle_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_internal_clienthandle_t__defined */
+
+	__DeclareRcvRpc(1017, "rpc_jack_internal_clienthandle")
+	__BeforeRcvRpc(1017, "rpc_jack_internal_clienthandle")
+
+#if	defined(__MIG_check__Request__rpc_jack_internal_clienthandle_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_internal_clienthandle_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_internal_clienthandle_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_internal_clienthandle(In0P->Head.msgh_request_port, In0P->refnum, In0P->client_name, &OutP->int_ref, &OutP->status, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1017, "rpc_jack_internal_clienthandle")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_internal_clientload_t__defined)
+#define __MIG_check__Request__rpc_jack_internal_clientload_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__so_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__so_name_t((so_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__so_name_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__int_rep__so_name_t((so_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 256)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__int_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__objet_data_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__objet_data_t((objet_data_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__objet_data_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__int_rep__objet_data_t((objet_data_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 256)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__int_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__so_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__so_name_t((so_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__so_name_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__char_rep__so_name_t((so_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 256)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__char_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__objet_data_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__objet_data_t((objet_data_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__objet_data_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__char_rep__objet_data_t((objet_data_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 256)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__char_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__so_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__so_name_t((so_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__so_name_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__float_rep__so_name_t((so_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 256)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name(a, f) \
+	__NDR_convert__float_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__objet_data_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__objet_data_t((objet_data_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__objet_data_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__float_rep__objet_data_t((objet_data_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 256)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data(a, f) \
+	__NDR_convert__float_rep__string(a, f, 256)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_internal_clientload_t(__attribute__((__unused__)) __Request__rpc_jack_internal_clientload_t *In0P)
+{
+
+	typedef __Request__rpc_jack_internal_clientload_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if __MigTypeCheck
+	{
+		char * msg_limit = ((char *) In0P) + In0P->Head.msgh_size;
+		size_t memchr_limit;
+
+		memchr_limit = min((msg_limit - In0P->client_name),  64);
+		if (( memchr(In0P->client_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->so_name),  256);
+		if (( memchr(In0P->so_name, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+		memchr_limit = min((msg_limit - In0P->objet_data),  256);
+		if (( memchr(In0P->objet_data, '\0', memchr_limit) == NULL ))
+			return MIG_BAD_ARGUMENTS; // string length exceeds buffer length!
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name(&In0P->client_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__client_name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name(&In0P->so_name, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__so_name__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data(&In0P->objet_data, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options(&In0P->options, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientload_t__options__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name(&In0P->client_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__client_name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name(&In0P->so_name, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__so_name__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data(&In0P->objet_data, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options(&In0P->options, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientload_t__options__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name(&In0P->client_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__client_name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name(&In0P->so_name, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__so_name__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data(&In0P->objet_data, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__objet_data__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options(&In0P->options, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientload_t__options__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_internal_clientload_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_internal_clientload */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_internal_clientload
+(
+	mach_port_t server_port,
+	int refnum,
+	client_name_t client_name,
+	so_name_t so_name,
+	objet_data_t objet_data,
+	int options,
+	int *status,
+	int *int_ref,
+	int *result
+);
+
+/* Routine rpc_jack_internal_clientload */
+mig_internal novalue _Xrpc_jack_internal_clientload
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		so_name_t so_name;
+		objet_data_t objet_data;
+		int options;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_internal_clientload_t __Request;
+	typedef __Reply__rpc_jack_internal_clientload_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_internal_clientload_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_internal_clientload_t__defined */
+
+	__DeclareRcvRpc(1018, "rpc_jack_internal_clientload")
+	__BeforeRcvRpc(1018, "rpc_jack_internal_clientload")
+
+#if	defined(__MIG_check__Request__rpc_jack_internal_clientload_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_internal_clientload_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_internal_clientload_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_internal_clientload(In0P->Head.msgh_request_port, In0P->refnum, In0P->client_name, In0P->so_name, In0P->objet_data, In0P->options, &OutP->status, &OutP->int_ref, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1018, "rpc_jack_internal_clientload")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_internal_clientunload_t__defined)
+#define __MIG_check__Request__rpc_jack_internal_clientunload_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_internal_clientunload_t(__attribute__((__unused__)) __Request__rpc_jack_internal_clientunload_t *In0P)
+{
+
+	typedef __Request__rpc_jack_internal_clientunload_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref(&In0P->int_ref, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref(&In0P->int_ref, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref(&In0P->int_ref, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_internal_clientunload_t__int_ref__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_internal_clientunload_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_internal_clientunload */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_internal_clientunload
+(
+	mach_port_t server_port,
+	int refnum,
+	int int_ref,
+	int *status,
+	int *result
+);
+
+/* Routine rpc_jack_internal_clientunload */
+mig_internal novalue _Xrpc_jack_internal_clientunload
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_internal_clientunload_t __Request;
+	typedef __Reply__rpc_jack_internal_clientunload_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_internal_clientunload_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_internal_clientunload_t__defined */
+
+	__DeclareRcvRpc(1019, "rpc_jack_internal_clientunload")
+	__BeforeRcvRpc(1019, "rpc_jack_internal_clientunload")
+
+#if	defined(__MIG_check__Request__rpc_jack_internal_clientunload_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_internal_clientunload_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_internal_clientunload_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_internal_clientunload(In0P->Head.msgh_request_port, In0P->refnum, In0P->int_ref, &OutP->status, &OutP->result);
+	if (OutP->RetCode != KERN_SUCCESS) {
+		MIG_RETURN_ERROR(OutP, OutP->RetCode);
+	}
+
+	OutP->NDR = NDR_record;
+
+
+	OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply));
+	__AfterRcvRpc(1019, "rpc_jack_internal_clientunload")
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Request__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Request__rpc_jack_client_rt_notify_t__defined)
+#define __MIG_check__Request__rpc_jack_client_rt_notify_t__defined
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined */
+
+#ifndef __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined */
+
+#ifndef __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined */
+
+#ifndef __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined
+#define	__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined */
+
+
+mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_rt_notify_t(__attribute__((__unused__)) __Request__rpc_jack_client_rt_notify_t *In0P)
+{
+
+	typedef __Request__rpc_jack_client_rt_notify_t __Request;
+#if	__MigTypeCheck
+	if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request)))
+		return MIG_BAD_ARGUMENTS;
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined) || \
+	defined(__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined)
+	if (In0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum(&In0P->refnum, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify(&In0P->notify, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__notify__defined */
+#if defined(__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined)
+		__NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value(&In0P->value, In0P->NDR.int_rep);
+#endif	/* __NDR_convert__int_rep__Request__rpc_jack_client_rt_notify_t__value__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined) || \
+	defined(__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined)
+	if (In0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum(&In0P->refnum, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify(&In0P->notify, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__notify__defined */
+#if defined(__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined)
+		__NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value(&In0P->value, In0P->NDR.char_rep);
+#endif	/* __NDR_convert__char_rep__Request__rpc_jack_client_rt_notify_t__value__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined) || \
+	defined(__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined)
+	if (In0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum(&In0P->refnum, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__refnum__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify(&In0P->notify, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__notify__defined */
+#if defined(__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined)
+		__NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value(&In0P->value, In0P->NDR.float_rep);
+#endif	/* __NDR_convert__float_rep__Request__rpc_jack_client_rt_notify_t__value__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Request__rpc_jack_client_rt_notify_t__defined) */
+#endif /* __MIG_check__Request__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* SimpleRoutine rpc_jack_client_rt_notify */
+#ifdef	mig_external
+mig_external
+#else
+extern
+#endif	/* mig_external */
+kern_return_t server_rpc_jack_client_rt_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	int notify,
+	int value
+);
+
+/* SimpleRoutine rpc_jack_client_rt_notify */
+mig_internal novalue _Xrpc_jack_client_rt_notify
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int notify;
+		int value;
+		mach_msg_trailer_t trailer;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	typedef __Request__rpc_jack_client_rt_notify_t __Request;
+	typedef __Reply__rpc_jack_client_rt_notify_t Reply;
+
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	Request *In0P = (Request *) InHeadP;
+	Reply *OutP = (Reply *) OutHeadP;
+#ifdef	__MIG_check__Request__rpc_jack_client_rt_notify_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Request__rpc_jack_client_rt_notify_t__defined */
+
+	__DeclareRcvSimple(1020, "rpc_jack_client_rt_notify")
+	__BeforeRcvSimple(1020, "rpc_jack_client_rt_notify")
+
+#if	defined(__MIG_check__Request__rpc_jack_client_rt_notify_t__defined)
+	check_result = __MIG_check__Request__rpc_jack_client_rt_notify_t((__Request *)In0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ MIG_RETURN_ERROR(OutP, check_result); }
+#endif	/* defined(__MIG_check__Request__rpc_jack_client_rt_notify_t__defined) */
+
+	OutP->RetCode = server_rpc_jack_client_rt_notify(In0P->Head.msgh_request_port, In0P->refnum, In0P->notify, In0P->value);
+	__AfterRcvSimple(1020, "rpc_jack_client_rt_notify")
+}
+
+
+extern boolean_t JackRPCEngine_server(
+		mach_msg_header_t *InHeadP,
+		mach_msg_header_t *OutHeadP);
+
+extern mig_routine_t JackRPCEngine_server_routine(
+		mach_msg_header_t *InHeadP);
+
+
+/* Description of this subsystem, for use in direct RPC */
+const struct server_JackRPCEngine_subsystem {
+	mig_server_routine_t 	server;	/* Server routine */
+	mach_msg_id_t	start;	/* Min routine number */
+	mach_msg_id_t	end;	/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max msg size */
+	vm_address_t	reserved;	/* Reserved */
+	struct routine_descriptor	/*Array of routine descriptors */
+		routine[21];
+} server_JackRPCEngine_subsystem = {
+	JackRPCEngine_server_routine,
+	1000,
+	1021,
+	(mach_msg_size_t)sizeof(union __ReplyUnion__server_JackRPCEngine_subsystem),
+	(vm_address_t)0,
+	{
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_open, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_open_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_check, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_check_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_close, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_close_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_activate, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_activate_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_deactivate, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_deactivate_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_register, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_register_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_unregister, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_unregister_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_connect, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_connect_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_disconnect, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_disconnect_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_connect_name, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_connect_name_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_disconnect_name, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_disconnect_name_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_port_rename, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_port_rename_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_set_buffer_size, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_set_buffer_size_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_set_freewheel, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_set_freewheel_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_release_timebase, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_release_timebase_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_set_timebase_callback, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_set_timebase_callback_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_get_internal_clientname, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_get_internal_clientname_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_internal_clienthandle, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_internal_clienthandle_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_internal_clientload, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_internal_clientload_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_internal_clientunload, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_internal_clientunload_t)},
+          { (mig_impl_routine_t) 0,
+          (mig_stub_routine_t) _Xrpc_jack_client_rt_notify, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_rt_notify_t)},
+	}
+};
+
+mig_external boolean_t JackRPCEngine_server
+	(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
+{
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	register mig_routine_t routine;
+
+	OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
+	OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
+	/* Minimal size: routine() will update it if different */
+	OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
+	OutHeadP->msgh_local_port = MACH_PORT_NULL;
+	OutHeadP->msgh_id = InHeadP->msgh_id + 100;
+
+	if ((InHeadP->msgh_id > 1020) || (InHeadP->msgh_id < 1000) ||
+	    ((routine = server_JackRPCEngine_subsystem.routine[InHeadP->msgh_id - 1000].stub_routine) == 0)) {
+		((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
+		((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
+		return FALSE;
+	}
+	(*routine) (InHeadP, OutHeadP);
+	return TRUE;
+}
+
+mig_external mig_routine_t JackRPCEngine_server_routine
+	(mach_msg_header_t *InHeadP)
+{
+	register int msgh_id;
+
+	msgh_id = InHeadP->msgh_id - 1000;
+
+	if ((msgh_id > 20) || (msgh_id < 0))
+		return 0;
+
+	return server_JackRPCEngine_subsystem.routine[msgh_id].stub_routine;
+}
diff --git a/macosx/RPC/JackRPCEngineUser.c b/macosx/RPC/JackRPCEngineUser.c
new file mode 100644
index 0000000..e86e8cf
--- /dev/null
+++ b/macosx/RPC/JackRPCEngineUser.c
@@ -0,0 +1,6302 @@
+/*
+ * IDENTIFICATION:
+ * stub generated Fri Oct 23 10:35:08 2009
+ * with a MiG generated Mon May 18 09:59:33 PDT 2009 by root at sulitlana.apple.com
+ * OPTIONS: 
+ */
+#define	__MIG_check__Reply__JackRPCEngine_subsystem__ 1
+#define	__NDR_convert__Reply__JackRPCEngine_subsystem__ 1
+#define	__NDR_convert__mig_reply_error_subsystem__ 1
+
+#include "JackRPCEngine.h"
+
+
+#ifndef	mig_internal
+#define	mig_internal	static __inline__
+#endif	/* mig_internal */
+
+#ifndef	mig_external
+#define mig_external
+#endif	/* mig_external */
+
+#if	!defined(__MigTypeCheck) && defined(TypeCheck)
+#define	__MigTypeCheck		TypeCheck	/* Legacy setting */
+#endif	/* !defined(__MigTypeCheck) */
+
+#if	!defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
+#define	__MigKernelSpecificCode	_MIG_KERNEL_SPECIFIC_CODE_	/* Legacy setting */
+#endif	/* !defined(__MigKernelSpecificCode) */
+
+#ifndef	LimitCheck
+#define	LimitCheck 0
+#endif	/* LimitCheck */
+
+#ifndef	min
+#define	min(a,b)  ( ((a) < (b))? (a): (b) )
+#endif	/* min */
+
+#if !defined(_WALIGN_)
+#define _WALIGN_(x) (((x) + 3) & ~3)
+#endif /* !defined(_WALIGN_) */
+
+#if !defined(_WALIGNSZ_)
+#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
+#endif /* !defined(_WALIGNSZ_) */
+
+#ifndef	UseStaticTemplates
+#define	UseStaticTemplates	0
+#endif	/* UseStaticTemplates */
+
+#ifndef	__MachMsgErrorWithTimeout
+#define	__MachMsgErrorWithTimeout(_R_) { \
+	switch (_R_) { \
+	case MACH_SEND_INVALID_DATA: \
+	case MACH_SEND_INVALID_DEST: \
+	case MACH_SEND_INVALID_HEADER: \
+		mig_put_reply_port(InP->Head.msgh_reply_port); \
+		break; \
+	case MACH_SEND_TIMED_OUT: \
+	case MACH_RCV_TIMED_OUT: \
+	default: \
+		mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
+	} \
+}
+#endif	/* __MachMsgErrorWithTimeout */
+
+#ifndef	__MachMsgErrorWithoutTimeout
+#define	__MachMsgErrorWithoutTimeout(_R_) { \
+	switch (_R_) { \
+	case MACH_SEND_INVALID_DATA: \
+	case MACH_SEND_INVALID_DEST: \
+	case MACH_SEND_INVALID_HEADER: \
+		mig_put_reply_port(InP->Head.msgh_reply_port); \
+		break; \
+	default: \
+		mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
+	} \
+}
+#endif	/* __MachMsgErrorWithoutTimeout */
+
+#ifndef	__DeclareSendRpc
+#define	__DeclareSendRpc(_NUM_, _NAME_)
+#endif	/* __DeclareSendRpc */
+
+#ifndef	__BeforeSendRpc
+#define	__BeforeSendRpc(_NUM_, _NAME_)
+#endif	/* __BeforeSendRpc */
+
+#ifndef	__AfterSendRpc
+#define	__AfterSendRpc(_NUM_, _NAME_)
+#endif	/* __AfterSendRpc */
+
+#ifndef	__DeclareSendSimple
+#define	__DeclareSendSimple(_NUM_, _NAME_)
+#endif	/* __DeclareSendSimple */
+
+#ifndef	__BeforeSendSimple
+#define	__BeforeSendSimple(_NUM_, _NAME_)
+#endif	/* __BeforeSendSimple */
+
+#ifndef	__AfterSendSimple
+#define	__AfterSendSimple(_NUM_, _NAME_)
+#endif	/* __AfterSendSimple */
+
+#define msgh_request_port	msgh_remote_port
+#define msgh_reply_port		msgh_local_port
+
+
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_client_open_t__defined)
+#define __MIG_check__Reply__rpc_jack_client_open_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_open_t(__Reply__rpc_jack_client_open_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_client_open_t __Reply;
+	boolean_t msgh_simple;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1100) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+	msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX);
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 ||
+	    msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	    (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	    ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (msgh_simple) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	__MigTypeCheck
+	if (Out0P->private_port.type != MACH_MSG_PORT_DESCRIPTOR ||
+	    Out0P->private_port.disposition != 17) {
+		return MIG_TYPE_ERROR;
+	}
+#endif	/* __MigTypeCheck */
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine(&Out0P->shared_engine, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_engine__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client(&Out0P->shared_client, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_client__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph(&Out0P->shared_graph, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__shared_graph__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_open_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine(&Out0P->shared_engine, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_engine__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client(&Out0P->shared_client, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_client__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph(&Out0P->shared_graph, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__shared_graph__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_open_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine(&Out0P->shared_engine, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_engine__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client(&Out0P->shared_client, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_client__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph(&Out0P->shared_graph, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__shared_graph__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_open_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_client_open_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_open */
+mig_external kern_return_t rpc_jack_client_open
+(
+	mach_port_t server_port,
+	client_name_t client_name,
+	int pid,
+	mach_port_t *private_port,
+	int *shared_engine,
+	int *shared_client,
+	int *shared_graph,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int pid;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t private_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int shared_engine;
+		int shared_client;
+		int shared_graph;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		/* start of the kernel processed data */
+		mach_msg_body_t msgh_body;
+		mach_msg_port_descriptor_t private_port;
+		/* end of the kernel processed data */
+		NDR_record_t NDR;
+		int shared_engine;
+		int shared_client;
+		int shared_graph;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_open_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_open_t__defined */
+
+	__DeclareSendRpc(1000, "rpc_jack_client_open")
+
+	InP->NDR = NDR_record;
+
+	(void) mig_strncpy(InP->client_name, client_name, 64);
+
+	InP->pid = pid;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1000;
+
+	__BeforeSendRpc(1000, "rpc_jack_client_open")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1000, "rpc_jack_client_open")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_client_open_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_client_open_t((__Reply__rpc_jack_client_open_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_client_open_t__defined) */
+
+	*private_port = Out0P->private_port.name;
+	*shared_engine = Out0P->shared_engine;
+
+	*shared_client = Out0P->shared_client;
+
+	*shared_graph = Out0P->shared_graph;
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_client_check_t__defined)
+#define __MIG_check__Reply__rpc_jack_client_check_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_check_t(__Reply__rpc_jack_client_check_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_client_check_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1101) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res(&Out0P->client_name_res, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__client_name_res__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status(&Out0P->status, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__status__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_check_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res(&Out0P->client_name_res, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__client_name_res__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status(&Out0P->status, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__status__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_check_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res(&Out0P->client_name_res, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__client_name_res__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status(&Out0P->status, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__status__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_check_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_client_check_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_check */
+mig_external kern_return_t rpc_jack_client_check
+(
+	mach_port_t server_port,
+	client_name_t client_name,
+	client_name_t client_name_res,
+	int protocol,
+	int options,
+	int *status,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		client_name_t client_name;
+		int protocol;
+		int options;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int status;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int status;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_check_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_check_t__defined */
+
+	__DeclareSendRpc(1001, "rpc_jack_client_check")
+
+	InP->NDR = NDR_record;
+
+	(void) mig_strncpy(InP->client_name, client_name, 64);
+
+	InP->protocol = protocol;
+
+	InP->options = options;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1001;
+
+	__BeforeSendRpc(1001, "rpc_jack_client_check")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1001, "rpc_jack_client_check")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_client_check_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_client_check_t((__Reply__rpc_jack_client_check_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_client_check_t__defined) */
+
+	(void) mig_strncpy(client_name_res, Out0P->client_name_res, 64);
+
+	*status = Out0P->status;
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_client_close_t__defined)
+#define __MIG_check__Reply__rpc_jack_client_close_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_close_t(__Reply__rpc_jack_client_close_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_client_close_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1102) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_close_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_close_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_close_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_close_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_client_close_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_close */
+mig_external kern_return_t rpc_jack_client_close
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_close_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_close_t__defined */
+
+	__DeclareSendRpc(1002, "rpc_jack_client_close")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1002;
+
+	__BeforeSendRpc(1002, "rpc_jack_client_close")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1002, "rpc_jack_client_close")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_client_close_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_client_close_t((__Reply__rpc_jack_client_close_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_client_close_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_client_activate_t__defined)
+#define __MIG_check__Reply__rpc_jack_client_activate_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_activate_t(__Reply__rpc_jack_client_activate_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_client_activate_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1103) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_activate_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_activate_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_activate_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_client_activate_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_activate */
+mig_external kern_return_t rpc_jack_client_activate
+(
+	mach_port_t server_port,
+	int refnum,
+	int state,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int state;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_activate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_activate_t__defined */
+
+	__DeclareSendRpc(1003, "rpc_jack_client_activate")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->state = state;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1003;
+
+	__BeforeSendRpc(1003, "rpc_jack_client_activate")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1003, "rpc_jack_client_activate")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_client_activate_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_client_activate_t((__Reply__rpc_jack_client_activate_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_client_activate_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_client_deactivate_t__defined)
+#define __MIG_check__Reply__rpc_jack_client_deactivate_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_deactivate_t(__Reply__rpc_jack_client_deactivate_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_client_deactivate_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1104) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_deactivate_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_deactivate_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_deactivate_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_client_deactivate_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_client_deactivate */
+mig_external kern_return_t rpc_jack_client_deactivate
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_deactivate_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_deactivate_t__defined */
+
+	__DeclareSendRpc(1004, "rpc_jack_client_deactivate")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1004;
+
+	__BeforeSendRpc(1004, "rpc_jack_client_deactivate")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1004, "rpc_jack_client_deactivate")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_client_deactivate_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_client_deactivate_t((__Reply__rpc_jack_client_deactivate_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_client_deactivate_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_register_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_register_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__int_rep__unsigned__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__int_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__uint32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__int_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__char_rep__unsigned__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__char_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__uint32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__char_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__unsigned__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__float_rep__unsigned__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__float_rep__unsigned((unsigned *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__uint32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__uint32_t((uint32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__uint32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index(a, f) \
+	__NDR_convert__float_rep__uint32_t((uint32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_register_t(__Reply__rpc_jack_port_register_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_register_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1105) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index(&Out0P->port_index, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__port_index__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_register_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index(&Out0P->port_index, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_register_t__port_index__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_register_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index(&Out0P->port_index, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_register_t__port_index__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_register_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_register_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_register */
+mig_external kern_return_t rpc_jack_port_register
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t name,
+	client_port_type_t port_type,
+	unsigned flags,
+	unsigned buffer_size,
+	unsigned *port_index,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t name;
+		client_port_type_t port_type;
+		unsigned flags;
+		unsigned buffer_size;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		unsigned port_index;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		unsigned port_index;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_register_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_register_t__defined */
+
+	__DeclareSendRpc(1005, "rpc_jack_port_register")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->name, name, 128);
+
+	(void) mig_strncpy(InP->port_type, port_type, 128);
+
+	InP->flags = flags;
+
+	InP->buffer_size = buffer_size;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1005;
+
+	__BeforeSendRpc(1005, "rpc_jack_port_register")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1005, "rpc_jack_port_register")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_register_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_register_t((__Reply__rpc_jack_port_register_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_register_t__defined) */
+
+	*port_index = Out0P->port_index;
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_unregister_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_unregister_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_unregister_t(__Reply__rpc_jack_port_unregister_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_unregister_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1106) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_unregister_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_unregister_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_unregister_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_unregister_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_unregister */
+mig_external kern_return_t rpc_jack_port_unregister
+(
+	mach_port_t server_port,
+	int refnum,
+	int port,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int port;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_unregister_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_unregister_t__defined */
+
+	__DeclareSendRpc(1006, "rpc_jack_port_unregister")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->port = port;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1006;
+
+	__BeforeSendRpc(1006, "rpc_jack_port_unregister")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1006, "rpc_jack_port_unregister")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_unregister_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_unregister_t((__Reply__rpc_jack_port_unregister_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_unregister_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_connect_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_connect_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_connect_t(__Reply__rpc_jack_port_connect_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_connect_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1107) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_connect_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_connect_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_connect_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_connect */
+mig_external kern_return_t rpc_jack_port_connect
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	int dst,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_connect_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_connect_t__defined */
+
+	__DeclareSendRpc(1007, "rpc_jack_port_connect")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->src = src;
+
+	InP->dst = dst;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1007;
+
+	__BeforeSendRpc(1007, "rpc_jack_port_connect")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1007, "rpc_jack_port_connect")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_connect_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_connect_t((__Reply__rpc_jack_port_connect_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_connect_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_disconnect_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_disconnect_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_disconnect_t(__Reply__rpc_jack_port_disconnect_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_disconnect_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1108) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_disconnect_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_disconnect */
+mig_external kern_return_t rpc_jack_port_disconnect
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	int dst,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		int dst;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_disconnect_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_disconnect_t__defined */
+
+	__DeclareSendRpc(1008, "rpc_jack_port_disconnect")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->src = src;
+
+	InP->dst = dst;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1008;
+
+	__BeforeSendRpc(1008, "rpc_jack_port_disconnect")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1008, "rpc_jack_port_disconnect")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_disconnect_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_disconnect_t((__Reply__rpc_jack_port_disconnect_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_disconnect_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_connect_name_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_connect_name_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_connect_name_t(__Reply__rpc_jack_port_connect_name_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_connect_name_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1109) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_connect_name_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_connect_name_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_connect_name_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_connect_name_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_connect_name */
+mig_external kern_return_t rpc_jack_port_connect_name
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t src,
+	client_port_name_t dst,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_connect_name_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_connect_name_t__defined */
+
+	__DeclareSendRpc(1009, "rpc_jack_port_connect_name")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->src, src, 128);
+
+	(void) mig_strncpy(InP->dst, dst, 128);
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1009;
+
+	__BeforeSendRpc(1009, "rpc_jack_port_connect_name")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1009, "rpc_jack_port_connect_name")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_connect_name_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_connect_name_t((__Reply__rpc_jack_port_connect_name_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_connect_name_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_disconnect_name_t(__Reply__rpc_jack_port_disconnect_name_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_disconnect_name_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1110) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_disconnect_name_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_disconnect_name */
+mig_external kern_return_t rpc_jack_port_disconnect_name
+(
+	mach_port_t server_port,
+	int refnum,
+	client_port_name_t src,
+	client_port_name_t dst,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_port_name_t src;
+		client_port_name_t dst;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined */
+
+	__DeclareSendRpc(1010, "rpc_jack_port_disconnect_name")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->src, src, 128);
+
+	(void) mig_strncpy(InP->dst, dst, 128);
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1010;
+
+	__BeforeSendRpc(1010, "rpc_jack_port_disconnect_name")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1010, "rpc_jack_port_disconnect_name")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_disconnect_name_t((__Reply__rpc_jack_port_disconnect_name_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_disconnect_name_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_port_rename_t__defined)
+#define __MIG_check__Reply__rpc_jack_port_rename_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_port_rename_t(__Reply__rpc_jack_port_rename_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_port_rename_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1111) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_port_rename_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_port_rename_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_port_rename_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_port_rename_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_port_rename */
+mig_external kern_return_t rpc_jack_port_rename
+(
+	mach_port_t server_port,
+	int refnum,
+	int src,
+	client_port_name_t name,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int src;
+		client_port_name_t name;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_port_rename_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_port_rename_t__defined */
+
+	__DeclareSendRpc(1011, "rpc_jack_port_rename")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->src = src;
+
+	(void) mig_strncpy(InP->name, name, 128);
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1011;
+
+	__BeforeSendRpc(1011, "rpc_jack_port_rename")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1011, "rpc_jack_port_rename")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_port_rename_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_port_rename_t((__Reply__rpc_jack_port_rename_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_port_rename_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_set_buffer_size_t__defined)
+#define __MIG_check__Reply__rpc_jack_set_buffer_size_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_set_buffer_size_t(__Reply__rpc_jack_set_buffer_size_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_set_buffer_size_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1112) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_buffer_size_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_set_buffer_size_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_set_buffer_size_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_set_buffer_size_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_set_buffer_size */
+mig_external kern_return_t rpc_jack_set_buffer_size
+(
+	mach_port_t server_port,
+	int buffer_size,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int buffer_size;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_set_buffer_size_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_set_buffer_size_t__defined */
+
+	__DeclareSendRpc(1012, "rpc_jack_set_buffer_size")
+
+	InP->NDR = NDR_record;
+
+	InP->buffer_size = buffer_size;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1012;
+
+	__BeforeSendRpc(1012, "rpc_jack_set_buffer_size")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1012, "rpc_jack_set_buffer_size")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_set_buffer_size_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_set_buffer_size_t((__Reply__rpc_jack_set_buffer_size_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_set_buffer_size_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_set_freewheel_t__defined)
+#define __MIG_check__Reply__rpc_jack_set_freewheel_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_set_freewheel_t(__Reply__rpc_jack_set_freewheel_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_set_freewheel_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1113) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_freewheel_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_set_freewheel_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_set_freewheel_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_set_freewheel_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_set_freewheel */
+mig_external kern_return_t rpc_jack_set_freewheel
+(
+	mach_port_t server_port,
+	int onoff,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int onoff;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_set_freewheel_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_set_freewheel_t__defined */
+
+	__DeclareSendRpc(1013, "rpc_jack_set_freewheel")
+
+	InP->NDR = NDR_record;
+
+	InP->onoff = onoff;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1013;
+
+	__BeforeSendRpc(1013, "rpc_jack_set_freewheel")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1013, "rpc_jack_set_freewheel")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_set_freewheel_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_set_freewheel_t((__Reply__rpc_jack_set_freewheel_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_set_freewheel_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_release_timebase_t__defined)
+#define __MIG_check__Reply__rpc_jack_release_timebase_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_release_timebase_t(__Reply__rpc_jack_release_timebase_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_release_timebase_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1114) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_release_timebase_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_release_timebase_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_release_timebase_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_release_timebase_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_release_timebase */
+mig_external kern_return_t rpc_jack_release_timebase
+(
+	mach_port_t server_port,
+	int refnum,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_release_timebase_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_release_timebase_t__defined */
+
+	__DeclareSendRpc(1014, "rpc_jack_release_timebase")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1014;
+
+	__BeforeSendRpc(1014, "rpc_jack_release_timebase")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1014, "rpc_jack_release_timebase")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_release_timebase_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_release_timebase_t((__Reply__rpc_jack_release_timebase_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_release_timebase_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined)
+#define __MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_set_timebase_callback_t(__Reply__rpc_jack_set_timebase_callback_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_set_timebase_callback_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1115) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_set_timebase_callback_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_set_timebase_callback */
+mig_external kern_return_t rpc_jack_set_timebase_callback
+(
+	mach_port_t server_port,
+	int refnum,
+	int conditional,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int conditional;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined */
+
+	__DeclareSendRpc(1015, "rpc_jack_set_timebase_callback")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->conditional = conditional;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1015;
+
+	__BeforeSendRpc(1015, "rpc_jack_set_timebase_callback")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1015, "rpc_jack_set_timebase_callback")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_set_timebase_callback_t((__Reply__rpc_jack_set_timebase_callback_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_set_timebase_callback_t__defined) */
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined)
+#define __MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__client_name_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__int_rep__string__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__int_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__client_name_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__char_rep__string__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__char_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__client_name_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__client_name_t((client_name_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__string__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__string(a, f, 64)
+#elif	defined(__NDR_convert__float_rep__string__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(a, f) \
+	__NDR_convert__float_rep__string(a, f, 64)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_get_internal_clientname_t(__Reply__rpc_jack_get_internal_clientname_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_get_internal_clientname_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1116) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(&Out0P->client_name_res, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(&Out0P->client_name_res, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res(&Out0P->client_name_res, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__client_name_res__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_get_internal_clientname_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_get_internal_clientname */
+mig_external kern_return_t rpc_jack_get_internal_clientname
+(
+	mach_port_t server_port,
+	int refnum,
+	int int_ref,
+	client_name_t client_name_res,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		client_name_t client_name_res;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined */
+
+	__DeclareSendRpc(1016, "rpc_jack_get_internal_clientname")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->int_ref = int_ref;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1016;
+
+	__BeforeSendRpc(1016, "rpc_jack_get_internal_clientname")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1016, "rpc_jack_get_internal_clientname")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_get_internal_clientname_t((__Reply__rpc_jack_get_internal_clientname_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_get_internal_clientname_t__defined) */
+
+	(void) mig_strncpy(client_name_res, Out0P->client_name_res, 64);
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined)
+#define __MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_internal_clienthandle_t(__Reply__rpc_jack_internal_clienthandle_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_internal_clienthandle_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1117) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(&Out0P->int_ref, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status(&Out0P->status, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(&Out0P->int_ref, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status(&Out0P->status, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref(&Out0P->int_ref, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__int_ref__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status(&Out0P->status, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__status__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clienthandle_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_internal_clienthandle */
+mig_external kern_return_t rpc_jack_internal_clienthandle
+(
+	mach_port_t server_port,
+	int refnum,
+	client_name_t client_name,
+	int *int_ref,
+	int *status,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int int_ref;
+		int status;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int int_ref;
+		int status;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined */
+
+	__DeclareSendRpc(1017, "rpc_jack_internal_clienthandle")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->client_name, client_name, 64);
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1017;
+
+	__BeforeSendRpc(1017, "rpc_jack_internal_clienthandle")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1017, "rpc_jack_internal_clienthandle")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_internal_clienthandle_t((__Reply__rpc_jack_internal_clienthandle_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_internal_clienthandle_t__defined) */
+
+	*int_ref = Out0P->int_ref;
+
+	*status = Out0P->status;
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_internal_clientload_t__defined)
+#define __MIG_check__Reply__rpc_jack_internal_clientload_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_internal_clientload_t(__Reply__rpc_jack_internal_clientload_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_internal_clientload_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1118) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status(&Out0P->status, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__status__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref(&Out0P->int_ref, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientload_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status(&Out0P->status, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__status__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref(&Out0P->int_ref, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientload_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status(&Out0P->status, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__status__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref(&Out0P->int_ref, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__int_ref__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientload_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_internal_clientload_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_internal_clientload */
+mig_external kern_return_t rpc_jack_internal_clientload
+(
+	mach_port_t server_port,
+	int refnum,
+	client_name_t client_name,
+	so_name_t so_name,
+	objet_data_t objet_data,
+	int options,
+	int *status,
+	int *int_ref,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		client_name_t client_name;
+		so_name_t so_name;
+		objet_data_t objet_data;
+		int options;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int int_ref;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int int_ref;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_internal_clientload_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_internal_clientload_t__defined */
+
+	__DeclareSendRpc(1018, "rpc_jack_internal_clientload")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	(void) mig_strncpy(InP->client_name, client_name, 64);
+
+	(void) mig_strncpy(InP->so_name, so_name, 256);
+
+	(void) mig_strncpy(InP->objet_data, objet_data, 256);
+
+	InP->options = options;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1018;
+
+	__BeforeSendRpc(1018, "rpc_jack_internal_clientload")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1018, "rpc_jack_internal_clientload")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_internal_clientload_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_internal_clientload_t((__Reply__rpc_jack_internal_clientload_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_internal_clientload_t__defined) */
+
+	*status = Out0P->status;
+
+	*int_ref = Out0P->int_ref;
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+#if ( __MigTypeCheck || __NDR_convert__ )
+#if __MIG_check__Reply__JackRPCEngine_subsystem__
+#if !defined(__MIG_check__Reply__rpc_jack_internal_clientunload_t__defined)
+#define __MIG_check__Reply__rpc_jack_internal_clientunload_t__defined
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__kern_return_t((kern_return_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__kern_return_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode(a, f) \
+	__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined */
+
+
+#ifndef __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#if	defined(__NDR_convert__int_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__int_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__int_rep__int32_t__defined)
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined */
+
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined */
+
+
+#ifndef __NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#if	defined(__NDR_convert__char_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__char_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__char_rep__int32_t__defined)
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined */
+
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined */
+
+
+#ifndef __NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#if	defined(__NDR_convert__float_rep__JackRPCEngine__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__float_rep__int((int *)(a), f)
+#elif	defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f)
+#elif	defined(__NDR_convert__float_rep__int32_t__defined)
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined
+#define	__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result(a, f) \
+	__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
+#endif /* defined(__NDR_convert__*__defined) */
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined */
+
+
+
+mig_internal kern_return_t __MIG_check__Reply__rpc_jack_internal_clientunload_t(__Reply__rpc_jack_internal_clientunload_t *Out0P)
+{
+
+	typedef __Reply__rpc_jack_internal_clientunload_t __Reply;
+#if	__MigTypeCheck
+	unsigned int msgh_size;
+#endif	/* __MigTypeCheck */
+	if (Out0P->Head.msgh_id != 1119) {
+	    if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
+		{ return MIG_SERVER_DIED; }
+	    else
+		{ return MIG_REPLY_MISMATCH; }
+	}
+
+#if	__MigTypeCheck
+	msgh_size = Out0P->Head.msgh_size;
+
+	if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
+	    ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
+	     (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
+	      Out0P->RetCode == KERN_SUCCESS)))
+		{ return MIG_TYPE_ERROR ; }
+#endif	/* __MigTypeCheck */
+
+	if (Out0P->RetCode != KERN_SUCCESS) {
+#ifdef	__NDR_convert__mig_reply_error_t__defined
+		__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
+#endif	/* __NDR_convert__mig_reply_error_t__defined */
+		return ((mig_reply_error_t *)Out0P)->RetCode;
+	}
+
+#if	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined) || \
+	defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined)
+	if (Out0P->NDR.int_rep != NDR_record.int_rep) {
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__RetCode__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status(&Out0P->status, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__status__defined */
+#if defined(__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined)
+		__NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result(&Out0P->result, Out0P->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__Reply__rpc_jack_internal_clientunload_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__int_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined) || \
+	defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined)
+	if (Out0P->NDR.char_rep != NDR_record.char_rep) {
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status(&Out0P->status, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__status__defined */
+#if defined(__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined)
+		__NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result(&Out0P->result, Out0P->NDR.char_rep);
+#endif /* __NDR_convert__char_rep__Reply__rpc_jack_internal_clientunload_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__char_rep...) */
+
+#if	0 || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined) || \
+	defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined)
+	if (Out0P->NDR.float_rep != NDR_record.float_rep) {
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status(&Out0P->status, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__status__defined */
+#if defined(__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined)
+		__NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result(&Out0P->result, Out0P->NDR.float_rep);
+#endif /* __NDR_convert__float_rep__Reply__rpc_jack_internal_clientunload_t__result__defined */
+	}
+#endif	/* defined(__NDR_convert__float_rep...) */
+
+	return MACH_MSG_SUCCESS;
+}
+#endif /* !defined(__MIG_check__Reply__rpc_jack_internal_clientunload_t__defined) */
+#endif /* __MIG_check__Reply__JackRPCEngine_subsystem__ */
+#endif /* ( __MigTypeCheck || __NDR_convert__ ) */
+
+
+/* Routine rpc_jack_internal_clientunload */
+mig_external kern_return_t rpc_jack_internal_clientunload
+(
+	mach_port_t server_port,
+	int refnum,
+	int int_ref,
+	int *status,
+	int *result
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int int_ref;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int result;
+		mach_msg_trailer_t trailer;
+	} Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		kern_return_t RetCode;
+		int status;
+		int result;
+	} __Reply;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+		Reply Out;
+	} Mess;
+
+	Request *InP = &Mess.In;
+	Reply *Out0P = &Mess.Out;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_internal_clientunload_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_internal_clientunload_t__defined */
+
+	__DeclareSendRpc(1019, "rpc_jack_internal_clientunload")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->int_ref = int_ref;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = server_port;
+	InP->Head.msgh_reply_port = mig_get_reply_port();
+	InP->Head.msgh_id = 1019;
+
+	__BeforeSendRpc(1019, "rpc_jack_internal_clientunload")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+	__AfterSendRpc(1019, "rpc_jack_internal_clientunload")
+	if (msg_result != MACH_MSG_SUCCESS) {
+		__MachMsgErrorWithoutTimeout(msg_result);
+		{ return msg_result; }
+	}
+
+
+#if	defined(__MIG_check__Reply__rpc_jack_internal_clientunload_t__defined)
+	check_result = __MIG_check__Reply__rpc_jack_internal_clientunload_t((__Reply__rpc_jack_internal_clientunload_t *)Out0P);
+	if (check_result != MACH_MSG_SUCCESS)
+		{ return check_result; }
+#endif	/* defined(__MIG_check__Reply__rpc_jack_internal_clientunload_t__defined) */
+
+	*status = Out0P->status;
+
+	*result = Out0P->result;
+
+	return KERN_SUCCESS;
+}
+
+/* SimpleRoutine rpc_jack_client_rt_notify */
+mig_external kern_return_t rpc_jack_client_rt_notify
+(
+	mach_port_t client_port,
+	int refnum,
+	int notify,
+	int value,
+	int timeout
+)
+{
+
+#ifdef  __MigPackStructs
+#pragma pack(4)
+#endif
+	typedef struct {
+		mach_msg_header_t Head;
+		NDR_record_t NDR;
+		int refnum;
+		int notify;
+		int value;
+	} Request;
+#ifdef  __MigPackStructs
+#pragma pack()
+#endif
+	/*
+	 * typedef struct {
+	 * 	mach_msg_header_t Head;
+	 * 	NDR_record_t NDR;
+	 * 	kern_return_t RetCode;
+	 * } mig_reply_error_t;
+	 */
+
+	union {
+		Request In;
+	} Mess;
+
+	Request *InP = &Mess.In;
+
+	mach_msg_return_t msg_result;
+
+#ifdef	__MIG_check__Reply__rpc_jack_client_rt_notify_t__defined
+	kern_return_t check_result;
+#endif	/* __MIG_check__Reply__rpc_jack_client_rt_notify_t__defined */
+
+	__DeclareSendSimple(1020, "rpc_jack_client_rt_notify")
+
+	InP->NDR = NDR_record;
+
+	InP->refnum = refnum;
+
+	InP->notify = notify;
+
+	InP->value = value;
+
+	InP->Head.msgh_bits =
+		MACH_MSGH_BITS(19, 0);
+	/* msgh_size passed as argument */
+	InP->Head.msgh_request_port = client_port;
+	InP->Head.msgh_reply_port = MACH_PORT_NULL;
+	InP->Head.msgh_id = 1020;
+
+	__BeforeSendSimple(1020, "rpc_jack_client_rt_notify")
+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_SEND_TIMEOUT|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, timeout, MACH_PORT_NULL);
+	__AfterSendSimple(1020, "rpc_jack_client_rt_notify")
+
+	if (msg_result == MACH_SEND_TIMED_OUT) {
+	}
+
+	return msg_result;
+}
diff --git a/macosx/RPC/Jackdefs.h b/macosx/RPC/Jackdefs.h
new file mode 100644
index 0000000..5e73d98
--- /dev/null
+++ b/macosx/RPC/Jackdefs.h
@@ -0,0 +1,25 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+typedef char client_name_t[64];
+typedef char client_port_name_t[128];
+typedef char client_port_type_t[128];
+typedef char so_name_t[256];
+typedef char objet_data_t[256];
+typedef char message_t[256];
diff --git a/macosx/coreaudio/JackCoreAudioAdapter.cpp b/macosx/coreaudio/JackCoreAudioAdapter.cpp
new file mode 100644
index 0000000..cb05d62
--- /dev/null
+++ b/macosx/coreaudio/JackCoreAudioAdapter.cpp
@@ -0,0 +1,1579 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackCoreAudioAdapter.h"
+#include "JackError.h"
+#include <unistd.h>
+
+#include <CoreServices/CoreServices.h>
+
+namespace Jack
+{
+
+static void PrintStreamDesc(AudioStreamBasicDescription *inDesc)
+{
+    jack_log("- - - - - - - - - - - - - - - - - - - -");
+    jack_log("  Sample Rate:%f", inDesc->mSampleRate);
+    jack_log("  Format ID:%.*s", (int) sizeof(inDesc->mFormatID), (char*)&inDesc->mFormatID);
+    jack_log("  Format Flags:%lX", inDesc->mFormatFlags);
+    jack_log("  Bytes per Packet:%ld", inDesc->mBytesPerPacket);
+    jack_log("  Frames per Packet:%ld", inDesc->mFramesPerPacket);
+    jack_log("  Bytes per Frame:%ld", inDesc->mBytesPerFrame);
+    jack_log("  Channels per Frame:%ld", inDesc->mChannelsPerFrame);
+    jack_log("  Bits per Channel:%ld", inDesc->mBitsPerChannel);
+    jack_log("- - - - - - - - - - - - - - - - - - - -");
+}
+
+static OSStatus DisplayDeviceNames()
+{
+    UInt32 size;
+    Boolean isWritable;
+    int i, deviceNum;
+    OSStatus err;
+    CFStringRef UIname;
+
+    err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, &isWritable);
+    if (err != noErr)
+        return err;
+
+    deviceNum = size / sizeof(AudioDeviceID);
+    AudioDeviceID devices[deviceNum];
+
+    err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, devices);
+    if (err != noErr)
+        return err;
+
+    for (i = 0; i < deviceNum; i++) {
+        char device_name[256];
+        char internal_name[256];
+
+        size = sizeof(CFStringRef);
+        UIname = NULL;
+        err = AudioDeviceGetProperty(devices[i], 0, false, kAudioDevicePropertyDeviceUID, &size, &UIname);
+        if (err == noErr) {
+            CFStringGetCString(UIname, internal_name, 256, CFStringGetSystemEncoding());
+        } else {
+            goto error;
+        }
+
+        size = 256;
+        err = AudioDeviceGetProperty(devices[i], 0, false, kAudioDevicePropertyDeviceName, &size, device_name);
+        if (err != noErr)
+            return err;
+
+        jack_info("Device name = \'%s\', internal_name = \'%s\' (to be used as -C, -P, or -d parameter)", device_name, internal_name);
+    }
+
+    return noErr;
+
+error:
+    if (UIname != NULL)
+        CFRelease(UIname);
+    return err;
+}
+
+static void printError(OSStatus err)
+{
+    switch (err) {
+        case kAudioHardwareNoError:
+            jack_log("error code : kAudioHardwareNoError");
+            break;
+        case kAudioConverterErr_FormatNotSupported:
+            jack_log("error code : kAudioConverterErr_FormatNotSupported");
+            break;
+        case kAudioConverterErr_OperationNotSupported:
+            jack_log("error code : kAudioConverterErr_OperationNotSupported");
+            break;
+        case kAudioConverterErr_PropertyNotSupported:
+            jack_log("error code : kAudioConverterErr_PropertyNotSupported");
+            break;
+        case kAudioConverterErr_InvalidInputSize:
+            jack_log("error code : kAudioConverterErr_InvalidInputSize");
+            break;
+        case kAudioConverterErr_InvalidOutputSize:
+            jack_log("error code : kAudioConverterErr_InvalidOutputSize");
+            break;
+        case kAudioConverterErr_UnspecifiedError:
+            jack_log("error code : kAudioConverterErr_UnspecifiedError");
+            break;
+        case kAudioConverterErr_BadPropertySizeError:
+            jack_log("error code : kAudioConverterErr_BadPropertySizeError");
+            break;
+        case kAudioConverterErr_RequiresPacketDescriptionsError:
+            jack_log("error code : kAudioConverterErr_RequiresPacketDescriptionsError");
+            break;
+        case kAudioConverterErr_InputSampleRateOutOfRange:
+            jack_log("error code : kAudioConverterErr_InputSampleRateOutOfRange");
+            break;
+        case kAudioConverterErr_OutputSampleRateOutOfRange:
+            jack_log("error code : kAudioConverterErr_OutputSampleRateOutOfRange");
+            break;
+        case kAudioHardwareNotRunningError:
+            jack_log("error code : kAudioHardwareNotRunningError");
+            break;
+        case kAudioHardwareUnknownPropertyError:
+            jack_log("error code : kAudioHardwareUnknownPropertyError");
+            break;
+        case kAudioHardwareIllegalOperationError:
+            jack_log("error code : kAudioHardwareIllegalOperationError");
+            break;
+        case kAudioHardwareBadDeviceError:
+            jack_log("error code : kAudioHardwareBadDeviceError");
+            break;
+        case kAudioHardwareBadStreamError:
+            jack_log("error code : kAudioHardwareBadStreamError");
+            break;
+        case kAudioDeviceUnsupportedFormatError:
+            jack_log("error code : kAudioDeviceUnsupportedFormatError");
+            break;
+        case kAudioDevicePermissionsError:
+            jack_log("error code : kAudioDevicePermissionsError");
+            break;
+        case kAudioHardwareBadObjectError:
+            jack_log("error code : kAudioHardwareBadObjectError");
+            break;
+        case kAudioHardwareUnsupportedOperationError:
+            jack_log("error code : kAudioHardwareUnsupportedOperationError");
+            break;
+        default:
+            jack_log("error code : unknown");
+            break;
+    }
+}
+
+OSStatus JackCoreAudioAdapter::SRNotificationCallback(AudioDeviceID inDevice,
+                                                        UInt32 inChannel,
+                                                        Boolean	isInput,
+                                                        AudioDevicePropertyID inPropertyID,
+                                                        void* inClientData)
+{
+    JackCoreAudioAdapter* driver = static_cast<JackCoreAudioAdapter*>(inClientData);
+
+    switch (inPropertyID) {
+
+        case kAudioDevicePropertyNominalSampleRate: {
+            jack_log("JackCoreAudioDriver::SRNotificationCallback kAudioDevicePropertyNominalSampleRate");
+            driver->fState = true;
+            break;
+        }
+    }
+
+    return noErr;
+}
+
+// A better implementation would try to recover in case of hardware device change (see HALLAB HLFilePlayerWindowControllerAudioDevicePropertyListenerProc code)
+OSStatus JackCoreAudioAdapter::DeviceNotificationCallback(AudioDeviceID inDevice,
+        UInt32 inChannel,
+        Boolean	isInput,
+        AudioDevicePropertyID inPropertyID,
+        void* inClientData)
+{
+        
+    switch (inPropertyID) {
+        
+        case kAudioDeviceProcessorOverload: {
+            jack_error("JackCoreAudioAdapter::DeviceNotificationCallback kAudioDeviceProcessorOverload");
+            break;
+		}
+
+        case kAudioDevicePropertyStreamConfiguration: {
+            jack_error("Cannot handle kAudioDevicePropertyStreamConfiguration");
+            return kAudioHardwareUnsupportedOperationError;
+        }
+            
+        case kAudioDevicePropertyNominalSampleRate: {
+            jack_error("Cannot handle kAudioDevicePropertyNominalSampleRate");
+            return kAudioHardwareUnsupportedOperationError;
+        }
+            
+    }
+    return noErr;
+}
+
+int JackCoreAudioAdapter::AddListeners()
+{
+    OSStatus err = noErr;
+
+    // Add listeners
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDeviceProcessorOverload, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDeviceProcessorOverload");
+        printError(err);
+        return -1;
+    }
+    
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioHardwarePropertyDevices, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioHardwarePropertyDevices");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDevicePropertyNominalSampleRate, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyNominalSampleRate");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDevicePropertyDeviceIsRunning, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyDeviceIsRunning");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyStreamConfiguration");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, false, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyStreamConfiguration");
+        printError(err);
+        return -1;
+    }
+
+    return 0;
+}
+
+void JackCoreAudioAdapter::RemoveListeners()
+{
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDeviceProcessorOverload, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioHardwarePropertyDevices, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDevicePropertyNominalSampleRate, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDevicePropertyDeviceIsRunning, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, false, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback);
+}
+
+OSStatus JackCoreAudioAdapter::Render(void *inRefCon,
+                                        AudioUnitRenderActionFlags *ioActionFlags,
+                                        const AudioTimeStamp *inTimeStamp,
+                                        UInt32 inBusNumber,
+                                        UInt32 inNumberFrames,
+                                        AudioBufferList *ioData)
+{
+    JackCoreAudioAdapter* adapter = static_cast<JackCoreAudioAdapter*>(inRefCon);
+    AudioUnitRender(adapter->fAUHAL, ioActionFlags, inTimeStamp, 1, inNumberFrames, adapter->fInputData);
+    
+    float* inputBuffer[adapter->fCaptureChannels];
+    float* outputBuffer[adapter->fPlaybackChannels];
+ 
+    for (int i = 0; i < adapter->fCaptureChannels; i++) {
+        inputBuffer[i] = (float*)adapter->fInputData->mBuffers[i].mData;
+    }
+    for (int i = 0; i < adapter->fPlaybackChannels; i++) {
+        outputBuffer[i] = (float*)ioData->mBuffers[i].mData;
+    }
+    
+    adapter->PushAndPull((float**)inputBuffer, (float**)outputBuffer, inNumberFrames);
+    return noErr;
+}
+
+JackCoreAudioAdapter::JackCoreAudioAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params)
+                :JackAudioAdapterInterface(buffer_size, sample_rate), fInputData(0), fCapturing(false), fPlaying(false), fState(false)
+{
+    const JSList* node;
+    const jack_driver_param_t* param;
+    int in_nChannels = 0;
+    int out_nChannels = 0;
+    char captureName[256];
+    char playbackName[256];
+    fCaptureUID[0] = 0;
+    fPlaybackUID[0] = 0;
+    fClockDriftCompensate = false;
+    
+    // Default values
+    fCaptureChannels = -1;
+    fPlaybackChannels = -1;
+    
+    SInt32 major;
+    SInt32 minor;
+    Gestalt(gestaltSystemVersionMajor, &major);
+    Gestalt(gestaltSystemVersionMinor, &minor);
+    
+    // Starting with 10.6 systems, the HAL notification thread is created internally
+    if (major == 10 && minor >= 6) {
+        CFRunLoopRef theRunLoop = NULL;
+        AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+        OSStatus theError = AudioObjectSetPropertyData (kAudioObjectSystemObject, &theAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);
+        if (theError != noErr) {
+            jack_error("JackCoreAudioAdapter::Open kAudioHardwarePropertyRunLoop error");
+        }
+    }
+  
+    for (node = params; node; node = jack_slist_next(node)) {
+        param = (const jack_driver_param_t*) node->data;
+
+        switch (param->character) {
+
+            case 'c' :
+                fCaptureChannels = fPlaybackChannels = param->value.ui;
+                break;
+
+            case 'i':
+                fCaptureChannels = param->value.ui;
+                break;
+
+            case 'o':
+                fPlaybackChannels = param->value.ui;
+                break;
+
+            case 'C':
+                fCapturing = true;
+                strncpy(fCaptureUID, param->value.str, 256);
+                break;
+
+            case 'P':
+                fPlaying = true;
+                strncpy(fPlaybackUID, param->value.str, 256);
+                break;
+                
+            case 'd':
+                strncpy(fCaptureUID, param->value.str, 256);
+                strncpy(fPlaybackUID, param->value.str, 256);
+                break;
+
+            case 'D':
+                fCapturing = fPlaying = true;
+                break;
+
+            case 'r':
+                SetAdaptedSampleRate(param->value.ui);
+                break;
+
+            case 'p':
+                SetAdaptedBufferSize(param->value.ui);
+                break;
+                
+            case 'l':
+                DisplayDeviceNames();
+                break;
+                
+            case 'q':
+                fQuality = param->value.ui;
+                break;
+                
+            case 'g':
+                fRingbufferCurSize = param->value.ui;
+                fAdaptative = false;
+                break;
+                
+            case 's':
+                fClockDriftCompensate = true;
+                break;
+        }
+    }
+    
+    /* duplex is the default */
+    if (!fCapturing && !fPlaying) {
+        fCapturing = true;
+        fPlaying = true;
+    }
+    
+    if (SetupDevices(fCaptureUID, fPlaybackUID, captureName, playbackName, fAdaptedSampleRate) < 0)
+        throw -1;
+  
+    if (SetupChannels(fCapturing, fPlaying, fCaptureChannels, fPlaybackChannels, in_nChannels, out_nChannels, true) < 0)
+        throw -1;
+    
+    if (SetupBufferSize(fAdaptedBufferSize) < 0)
+         throw -1;
+ 
+    if (SetupSampleRate(fAdaptedSampleRate) < 0)
+        throw -1;
+           
+    if (OpenAUHAL(fCapturing, fPlaying, fCaptureChannels, fPlaybackChannels, in_nChannels, out_nChannels, fAdaptedBufferSize, fAdaptedSampleRate) < 0) 
+        throw -1;
+         
+    if (fCapturing && fCaptureChannels > 0)
+        if (SetupBuffers(fCaptureChannels) < 0)
+            throw -1;
+       
+    if (AddListeners() < 0)
+        throw -1;
+}
+
+OSStatus JackCoreAudioAdapter::GetDefaultDevice(AudioDeviceID* id)
+{
+    OSStatus res;
+    UInt32 theSize = sizeof(UInt32);
+    AudioDeviceID inDefault;
+    AudioDeviceID outDefault;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &theSize, &inDefault)) != noErr)
+        return res;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &theSize, &outDefault)) != noErr)
+        return res;
+
+    jack_log("GetDefaultDevice: input = %ld output = %ld", inDefault, outDefault);
+
+    // Get the device only if default input and output are the same
+    if (inDefault == outDefault) {
+        *id = inDefault;
+        return noErr;
+    } else {
+        jack_error("Default input and output devices are not the same !!");
+        return kAudioHardwareBadDeviceError;
+    }
+}
+
+OSStatus JackCoreAudioAdapter::GetTotalChannels(AudioDeviceID device, int& channelCount, bool isInput)
+{
+    OSStatus err = noErr;
+    UInt32	outSize;
+    Boolean	outWritable;
+    AudioBufferList* bufferList = 0;
+
+    channelCount = 0;
+    err = AudioDeviceGetPropertyInfo(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, &outWritable);
+    if (err == noErr) {
+        bufferList = (AudioBufferList*)malloc(outSize);
+        err = AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, bufferList);
+        if (err == noErr) {
+            for (unsigned int i = 0; i < bufferList->mNumberBuffers; i++)
+                channelCount += bufferList->mBuffers[i].mNumberChannels;
+        }
+
+        if (bufferList)
+            free(bufferList);
+    }
+
+    return err;
+}
+
+OSStatus JackCoreAudioAdapter::GetDeviceIDFromUID(const char* UID, AudioDeviceID* id)
+{
+    UInt32 size = sizeof(AudioValueTranslation);
+    CFStringRef inIUD = CFStringCreateWithCString(NULL, UID, CFStringGetSystemEncoding());
+    AudioValueTranslation value = { &inIUD, sizeof(CFStringRef), id, sizeof(AudioDeviceID) };
+
+    if (inIUD == NULL) {
+        return kAudioHardwareUnspecifiedError;
+    } else {
+        OSStatus res = AudioHardwareGetProperty(kAudioHardwarePropertyDeviceForUID, &size, &value);
+        CFRelease(inIUD);
+        jack_log("GetDeviceIDFromUID %s %ld", UID, *id);
+        return (*id == kAudioDeviceUnknown) ? kAudioHardwareBadDeviceError : res;
+    }
+}
+
+OSStatus JackCoreAudioAdapter::GetDefaultInputDevice(AudioDeviceID* id)
+{
+    OSStatus res;
+    UInt32 theSize = sizeof(UInt32);
+    AudioDeviceID inDefault;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &theSize, &inDefault)) != noErr)
+        return res;
+
+    jack_log("GetDefaultInputDevice: input = %ld ", inDefault);
+    *id = inDefault;
+    return noErr;
+}
+
+OSStatus JackCoreAudioAdapter::GetDefaultOutputDevice(AudioDeviceID* id)
+{
+    OSStatus res;
+    UInt32 theSize = sizeof(UInt32);
+    AudioDeviceID outDefault;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &theSize, &outDefault)) != noErr)
+        return res;
+
+    jack_log("GetDefaultOutputDevice: output = %ld", outDefault);
+    *id = outDefault;
+    return noErr;
+}
+
+OSStatus JackCoreAudioAdapter::GetDeviceNameFromID(AudioDeviceID id, char* name)
+{
+    UInt32 size = 256;
+    return AudioDeviceGetProperty(id, 0, false, kAudioDevicePropertyDeviceName, &size, name);
+}
+
+// Setup
+int JackCoreAudioAdapter::SetupDevices(const char* capture_driver_uid,
+                                        const char* playback_driver_uid,
+                                        char* capture_driver_name,
+                                        char* playback_driver_name,
+                                        jack_nframes_t samplerate)
+{
+    capture_driver_name[0] = 0;
+    playback_driver_name[0] = 0;
+
+    // Duplex
+    if (strcmp(capture_driver_uid, "") != 0 && strcmp(playback_driver_uid, "") != 0) {
+    
+        // Same device for capture and playback...
+        if (strcmp(capture_driver_uid, playback_driver_uid) == 0)  {
+            
+            if (GetDeviceIDFromUID(playback_driver_uid, &fDeviceID) != noErr) {
+                jack_log("Will take default in/out");
+                if (GetDefaultDevice(&fDeviceID) != noErr) {
+                    jack_error("Cannot open default device");
+                    return -1;
+                }
+            }
+            if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr || GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
+                jack_error("Cannot get device name from device ID");
+                return -1;
+            }
+            
+        } else {
+        
+            // Creates aggregate device
+            AudioDeviceID captureID, playbackID;
+            if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr)
+                return -1;
+            if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr) 
+                return -1;
+            if (CreateAggregateDevice(captureID, playbackID, samplerate, &fDeviceID) != noErr)
+                return -1;
+        }
+
+    // Capture only
+    } else if (strcmp(capture_driver_uid, "") != 0) {
+        jack_log("JackCoreAudioAdapter::Open capture only");
+        if (GetDeviceIDFromUID(capture_driver_uid, &fDeviceID) != noErr) {
+            if (GetDefaultInputDevice(&fDeviceID) != noErr) {
+                jack_error("Cannot open default device");
+                return -1;
+            }
+        }
+        if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr) {
+            jack_error("Cannot get device name from device ID");
+            return -1;
+        }
+
+    // Playback only
+    } else if (strcmp(playback_driver_uid, "") != 0) {
+        jack_log("JackCoreAudioAdapter::Open playback only");
+        if (GetDeviceIDFromUID(playback_driver_uid, &fDeviceID) != noErr) {
+            if (GetDefaultOutputDevice(&fDeviceID) != noErr) {
+                jack_error("Cannot open default device");
+                return -1;
+            }
+        }
+        if (GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
+            jack_error("Cannot get device name from device ID");
+            return -1;
+        }
+
+    // Use default driver in duplex mode
+    } else {
+        jack_log("JackCoreAudioAdapter::Open default driver");
+        if (GetDefaultDevice(&fDeviceID) != noErr) {
+            jack_error("Cannot open default device");
+            return -1;
+        }
+        if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr || GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
+            jack_error("Cannot get device name from device ID");
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+int JackCoreAudioAdapter::SetupChannels(bool capturing,
+                                        bool playing,
+                                        int& inchannels,
+                                        int& outchannels,
+                                        int& in_nChannels,
+                                        int& out_nChannels,
+                                        bool strict)
+{
+    OSStatus err = noErr;
+
+    if (capturing) {
+        err = GetTotalChannels(fDeviceID, in_nChannels, true);
+        if (err != noErr) {
+            jack_error("Cannot get input channel number");
+            printError(err);
+            return -1;
+        } else {
+            jack_log("Max input channels : %d", in_nChannels);
+        }
+    }
+
+    if (playing) {
+        err = GetTotalChannels(fDeviceID, out_nChannels, false);
+        if (err != noErr) {
+            jack_error("Cannot get output channel number");
+            printError(err);
+            return -1;
+        } else {
+            jack_log("Max output channels : %d", out_nChannels);
+        }
+    }
+
+    if (inchannels > in_nChannels) {
+        jack_error("This device hasn't required input channels inchannels = %ld in_nChannels = %ld", inchannels, in_nChannels);
+        if (strict)
+            return -1;
+    }
+
+    if (outchannels > out_nChannels) {
+        jack_error("This device hasn't required output channels outchannels = %ld out_nChannels = %ld", outchannels, out_nChannels);
+        if (strict)
+            return -1;
+    }
+
+    if (inchannels == -1) {
+        jack_log("Setup max in channels = %ld", in_nChannels);
+        inchannels = in_nChannels;
+    }
+
+    if (outchannels == -1) {
+        jack_log("Setup max out channels = %ld", out_nChannels);
+        outchannels = out_nChannels;
+    }
+ 
+    return 0;
+}
+
+int JackCoreAudioAdapter::SetupBufferSize(jack_nframes_t buffer_size)
+{
+    // Setting buffer size
+    UInt32 outSize = sizeof(UInt32);
+    OSStatus err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false, kAudioDevicePropertyBufferFrameSize, outSize, &buffer_size);
+    if (err != noErr) {
+        jack_error("Cannot set buffer size %ld", buffer_size);
+        printError(err);
+        return -1;
+    }
+    
+    return 0;
+}
+
+int JackCoreAudioAdapter::SetupSampleRate(jack_nframes_t samplerate)
+{
+    return SetupSampleRateAux(fDeviceID, samplerate);
+}
+
+int JackCoreAudioAdapter::SetupSampleRateAux(AudioDeviceID inDevice, jack_nframes_t samplerate)
+{
+    OSStatus err = noErr;
+    UInt32 outSize;
+    Float64 sampleRate;
+    
+    // Get sample rate
+    outSize =  sizeof(Float64);
+    err = AudioDeviceGetProperty(inDevice, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outSize, &sampleRate);
+    if (err != noErr) {
+        jack_error("Cannot get current sample rate");
+        printError(err);
+        return -1;
+    }
+    
+    // If needed, set new sample rate
+    if (samplerate != (jack_nframes_t)sampleRate) {
+        sampleRate = (Float64)samplerate;
+        
+        // To get SR change notification
+        err = AudioDeviceAddPropertyListener(inDevice, 0, true, kAudioDevicePropertyNominalSampleRate, SRNotificationCallback, this);
+        if (err != noErr) {
+            jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyNominalSampleRate");
+            printError(err);
+            return -1;
+        }
+        err = AudioDeviceSetProperty(inDevice, NULL, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, outSize, &sampleRate);
+        if (err != noErr) {
+            jack_error("Cannot set sample rate = %ld", samplerate);
+            printError(err);
+            return -1;
+        }
+        
+        // Waiting for SR change notification
+        int count = 0;
+        while (!fState && count++ < WAIT_COUNTER) {
+            usleep(100000);
+            jack_log("Wait count = %d", count);
+        }
+        
+        // Remove SR change notification
+        AudioDeviceRemovePropertyListener(inDevice, 0, true, kAudioDevicePropertyNominalSampleRate, SRNotificationCallback);
+    }
+    
+    return 0;
+}
+
+int JackCoreAudioAdapter::SetupBuffers(int inchannels)
+{
+    jack_log("JackCoreAudioAdapter::SetupBuffers: input = %ld", inchannels);
+
+    // Prepare buffers
+    fInputData = (AudioBufferList*)malloc(sizeof(UInt32) + inchannels * sizeof(AudioBuffer));
+    fInputData->mNumberBuffers = inchannels;
+    for (int i = 0; i < fCaptureChannels; i++) {
+        fInputData->mBuffers[i].mNumberChannels = 1;
+        fInputData->mBuffers[i].mDataByteSize = fAdaptedBufferSize * sizeof(float);
+        fInputData->mBuffers[i].mData = malloc(fAdaptedBufferSize * sizeof(float));
+    }
+    return 0;
+}
+
+void JackCoreAudioAdapter::DisposeBuffers()
+{
+    if (fInputData) {
+        for (int i = 0; i < fCaptureChannels; i++)
+            free(fInputData->mBuffers[i].mData);
+        free(fInputData);
+        fInputData = 0;
+    }
+}
+
+int JackCoreAudioAdapter::OpenAUHAL(bool capturing,
+                                   bool playing,
+                                   int inchannels,
+                                   int outchannels,
+                                   int in_nChannels,
+                                   int out_nChannels,
+                                   jack_nframes_t buffer_size,
+                                   jack_nframes_t samplerate)
+{
+    ComponentResult err1;
+    UInt32 enableIO;
+    AudioStreamBasicDescription srcFormat, dstFormat;
+    AudioDeviceID currAudioDeviceID;
+    UInt32 size;
+
+    jack_log("OpenAUHAL capturing = %d playing = %d inchannels = %d outchannels = %d in_nChannels = %d out_nChannels = %d", capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels);
+
+    if (inchannels == 0 && outchannels == 0) {
+        jack_error("No input and output channels...");
+        return -1;
+    }
+         
+    // AUHAL
+    ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0};
+    Component HALOutput = FindNextComponent(NULL, &cd);
+
+    err1 = OpenAComponent(HALOutput, &fAUHAL);
+    if (err1 != noErr) {
+        jack_error("Error calling OpenAComponent");
+        printError(err1);
+        goto error;
+    }
+
+    err1 = AudioUnitInitialize(fAUHAL);
+    if (err1 != noErr) {
+        jack_error("Cannot initialize AUHAL unit");
+        printError(err1);
+        goto error;
+    }
+
+    // Start I/O
+    if (capturing && inchannels > 0) {
+        enableIO = 1;
+        jack_log("Setup AUHAL input on");
+    } else {
+        enableIO = 0;
+        jack_log("Setup AUHAL input off");
+    }
+    
+    err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(enableIO));
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input");
+        printError(err1);
+        goto error;
+    }
+
+    if (playing && outchannels > 0) {
+        enableIO = 1;
+        jack_log("Setup AUHAL output on");
+    } else {
+        enableIO = 0;
+        jack_log("Setup AUHAL output off");
+    }
+    
+    err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(enableIO));
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_EnableIO,kAudioUnitScope_Output");
+        printError(err1);
+        goto error;
+    }
+    
+    size = sizeof(AudioDeviceID);
+    err1 = AudioUnitGetProperty(fAUHAL, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &currAudioDeviceID, &size);
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitGetProperty - kAudioOutputUnitProperty_CurrentDevice");
+        printError(err1);
+        goto error;
+    } else {
+        jack_log("AudioUnitGetPropertyCurrentDevice = %d", currAudioDeviceID);
+    }
+
+    // Setup up choosen device, in both input and output cases
+    err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &fDeviceID, sizeof(AudioDeviceID));
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_CurrentDevice");
+        printError(err1);
+        goto error;
+    }
+  
+    // Set buffer size
+    if (capturing && inchannels > 0) {
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 1, (UInt32*)&buffer_size, sizeof(UInt32));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_MaximumFramesPerSlice");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    if (playing && outchannels > 0) {
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, (UInt32*)&buffer_size, sizeof(UInt32));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_MaximumFramesPerSlice");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    // Setup channel map
+    if (capturing && inchannels > 0 && inchannels < in_nChannels) {
+        SInt32 chanArr[in_nChannels];
+        for (int i = 0; i < in_nChannels; i++) {
+            chanArr[i] = -1;
+        }
+        for (int i = 0; i < inchannels; i++) {
+            chanArr[i] = i;
+        }
+        AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap , kAudioUnitScope_Input, 1, chanArr, sizeof(SInt32) * in_nChannels);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 1");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    if (playing && outchannels > 0 && outchannels < out_nChannels) {
+        SInt32 chanArr[out_nChannels];
+        for (int i = 0;	i < out_nChannels; i++) {
+            chanArr[i] = -1;
+        }
+        for (int i = 0; i < outchannels; i++) {
+            chanArr[i] = i;
+        }
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, chanArr, sizeof(SInt32) * out_nChannels);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 0");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    // Setup stream converters
+    if (capturing && inchannels > 0) {
+    
+        size = sizeof(AudioStreamBasicDescription);
+        err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &srcFormat, &size);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
+            printError(err1);
+            goto error;
+        }
+        PrintStreamDesc(&srcFormat);
+              
+        jack_log("Setup AUHAL input stream converter SR = %ld", samplerate);
+        srcFormat.mSampleRate = samplerate;
+        srcFormat.mFormatID = kAudioFormatLinearPCM;
+        srcFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
+        srcFormat.mBytesPerPacket = sizeof(float);
+        srcFormat.mFramesPerPacket = 1;
+        srcFormat.mBytesPerFrame = sizeof(float);
+        srcFormat.mChannelsPerFrame = inchannels;
+        srcFormat.mBitsPerChannel = 32;
+        PrintStreamDesc(&srcFormat);
+      
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &srcFormat, sizeof(AudioStreamBasicDescription));
+        
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    if (playing && outchannels > 0) {
+    
+        size = sizeof(AudioStreamBasicDescription);
+        err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &dstFormat, &size);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
+            printError(err1);
+            goto error;
+        }
+        PrintStreamDesc(&dstFormat);
+         
+        jack_log("Setup AUHAL output stream converter SR = %ld", samplerate);
+        dstFormat.mSampleRate = samplerate;
+        dstFormat.mFormatID = kAudioFormatLinearPCM;
+        dstFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
+        dstFormat.mBytesPerPacket = sizeof(float);
+        dstFormat.mFramesPerPacket = 1;
+        dstFormat.mBytesPerFrame = sizeof(float);
+        dstFormat.mChannelsPerFrame = outchannels;
+        dstFormat.mBitsPerChannel = 32;
+        PrintStreamDesc(&dstFormat);
+       
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &dstFormat, sizeof(AudioStreamBasicDescription));
+        
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    // Setup callbacks
+    if (inchannels > 0 && outchannels == 0) {
+        AURenderCallbackStruct output;
+        output.inputProc = Render;
+        output.inputProcRefCon = this;
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &output, sizeof(output));
+        if (err1 != noErr) {
+            jack_error("Error calling  AudioUnitSetProperty - kAudioUnitProperty_SetRenderCallback 1");
+            printError(err1);
+            goto error;
+        }
+    } else {
+        AURenderCallbackStruct output;
+        output.inputProc = Render;
+        output.inputProcRefCon = this;
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &output, sizeof(output));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_SetRenderCallback 0");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    return 0;
+    
+error:
+    CloseAUHAL();
+    return -1;
+}
+
+OSStatus JackCoreAudioAdapter::DestroyAggregateDevice() 
+{
+    OSStatus osErr = noErr;
+    AudioObjectPropertyAddress pluginAOPA;
+    pluginAOPA.mSelector = kAudioPlugInDestroyAggregateDevice;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    UInt32 outDataSize;
+  
+    osErr = AudioObjectGetPropertyDataSize(fPluginID, &pluginAOPA, 0, NULL, &outDataSize);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::DestroyAggregateDevice : AudioObjectGetPropertyDataSize error");
+        printError(osErr);
+        return osErr;
+    }
+        
+    osErr = AudioObjectGetPropertyData(fPluginID, &pluginAOPA, 0, NULL, &outDataSize, &fDeviceID);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::DestroyAggregateDevice : AudioObjectGetPropertyData error");
+        printError(osErr);
+        return osErr;
+    }
+    
+    return noErr;
+}
+
+static CFStringRef GetDeviceName(AudioDeviceID id)
+{
+    UInt32 size = sizeof(CFStringRef);
+    CFStringRef UIname;
+    OSStatus err = AudioDeviceGetProperty(id, 0, false, kAudioDevicePropertyDeviceUID, &size, &UIname);
+    return (err == noErr) ? UIname : NULL;
+}
+
+OSStatus JackCoreAudioAdapter::CreateAggregateDevice(AudioDeviceID captureDeviceID, AudioDeviceID playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice) 
+{
+    OSStatus err = noErr;
+    AudioObjectID sub_device[32];
+    UInt32 outSize = sizeof(sub_device);
+    
+    err = AudioDeviceGetProperty(captureDeviceID, 0, kAudioDeviceSectionGlobal, kAudioAggregateDevicePropertyActiveSubDeviceList, &outSize, sub_device);
+    vector<AudioDeviceID> captureDeviceIDArray;
+    
+    if (err != noErr) {
+        jack_log("Input device does not have subdevices");
+        captureDeviceIDArray.push_back(captureDeviceID);
+    } else {
+        int num_devices = outSize / sizeof(AudioObjectID);
+        jack_log("Input device has %d subdevices", num_devices);
+        for (int i = 0; i < num_devices; i++) {
+            captureDeviceIDArray.push_back(sub_device[i]);
+        }
+    }
+    
+    err = AudioDeviceGetProperty(playbackDeviceID, 0, kAudioDeviceSectionGlobal, kAudioAggregateDevicePropertyActiveSubDeviceList, &outSize, sub_device);    
+    vector<AudioDeviceID> playbackDeviceIDArray;
+    
+    if (err != noErr) {
+        jack_log("Output device does not have subdevices");
+        playbackDeviceIDArray.push_back(playbackDeviceID);
+    } else {
+        int num_devices = outSize / sizeof(AudioObjectID);
+        jack_log("Output device has %d subdevices", num_devices);
+        for (int i = 0; i < num_devices; i++) {
+            playbackDeviceIDArray.push_back(sub_device[i]);
+        }
+    }
+    
+    return CreateAggregateDeviceAux(captureDeviceIDArray, playbackDeviceIDArray, samplerate, outAggregateDevice);
+}
+    
+OSStatus JackCoreAudioAdapter::CreateAggregateDeviceAux(vector<AudioDeviceID> captureDeviceID, vector<AudioDeviceID> playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice) 
+{
+    OSStatus osErr = noErr;
+    UInt32 outSize;
+    Boolean outWritable;
+    
+    // Prepare sub-devices for clock drift compensation
+    // Workaround for bug in the HAL : until 10.6.2
+    AudioObjectPropertyAddress theAddressOwned = { kAudioObjectPropertyOwnedObjects, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+    AudioObjectPropertyAddress theAddressDrift = { kAudioSubDevicePropertyDriftCompensation, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+    UInt32 theQualifierDataSize = sizeof(AudioObjectID);
+    AudioClassID inClass = kAudioSubDeviceClassID;
+    void* theQualifierData = &inClass;
+    UInt32 subDevicesNum = 0;
+    
+    //---------------------------------------------------------------------------
+    // Setup SR of both devices otherwise creating AD may fail...
+    //---------------------------------------------------------------------------
+    UInt32 keptclockdomain = 0;
+    UInt32 clockdomain = 0;
+    outSize = sizeof(UInt32);
+    bool need_clock_drift_compensation = false;
+    
+    for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+        if (SetupSampleRateAux(captureDeviceID[i], samplerate) < 0) {
+            jack_error("JackCoreAudioDriver::CreateAggregateDevice : cannot set SR of input device");
+        } else  {
+            // Check clock domain
+            osErr = AudioDeviceGetProperty(captureDeviceID[i], 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyClockDomain, &outSize, &clockdomain); 
+            if (osErr != 0) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice : kAudioDevicePropertyClockDomain error");
+                printError(osErr);
+            } else {
+                keptclockdomain = (keptclockdomain == 0) ? clockdomain : keptclockdomain; 
+                jack_log("JackCoreAudioDriver::CreateAggregateDevice : input clockdomain = %d", clockdomain);
+                if (clockdomain != 0 && clockdomain != keptclockdomain) {
+                    jack_error("JackCoreAudioDriver::CreateAggregateDevice : devices do not share the same clock!! clock drift compensation would be needed...");
+                    need_clock_drift_compensation = true;
+                }
+            }
+        }
+    }
+    
+    for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+        if (SetupSampleRateAux(playbackDeviceID[i], samplerate) < 0) {
+            jack_error("JackCoreAudioDriver::CreateAggregateDevice : cannot set SR of output device");
+        } else {
+            // Check clock domain
+            osErr = AudioDeviceGetProperty(playbackDeviceID[i], 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyClockDomain, &outSize, &clockdomain); 
+            if (osErr != 0) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice : kAudioDevicePropertyClockDomain error");
+                printError(osErr);
+            } else {
+                keptclockdomain = (keptclockdomain == 0) ? clockdomain : keptclockdomain; 
+                jack_log("JackCoreAudioDriver::CreateAggregateDevice : output clockdomain = %d", clockdomain);
+                if (clockdomain != 0 && clockdomain != keptclockdomain) {
+                    jack_error("JackCoreAudioDriver::CreateAggregateDevice : devices do not share the same clock!! clock drift compensation would be needed...");
+                    need_clock_drift_compensation = true;
+                }
+            }
+        }
+    }
+    
+    // If no valid clock domain was found, then assume we have to compensate...
+    if (keptclockdomain == 0) {
+        need_clock_drift_compensation = true;
+    }
+    
+    //---------------------------------------------------------------------------
+    // Start to create a new aggregate by getting the base audio hardware plugin
+    //---------------------------------------------------------------------------
+    
+    char device_name[256];
+    for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+        GetDeviceNameFromID(captureDeviceID[i], device_name);
+        jack_info("Separated input = '%s' ", device_name);
+    }
+    
+    for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+        GetDeviceNameFromID(playbackDeviceID[i], device_name);
+        jack_info("Separated output = '%s' ", device_name);
+    }
+    
+    osErr = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyPlugInForBundleID, &outSize, &outWritable);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioHardwareGetPropertyInfo kAudioHardwarePropertyPlugInForBundleID error");
+        printError(osErr);
+        return osErr;
+    }
+    
+    AudioValueTranslation pluginAVT;
+    
+    CFStringRef inBundleRef = CFSTR("com.apple.audio.CoreAudio");
+    
+    pluginAVT.mInputData = &inBundleRef;
+    pluginAVT.mInputDataSize = sizeof(inBundleRef);
+    pluginAVT.mOutputData = &fPluginID;
+    pluginAVT.mOutputDataSize = sizeof(fPluginID);
+    
+    osErr = AudioHardwareGetProperty(kAudioHardwarePropertyPlugInForBundleID, &outSize, &pluginAVT);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioHardwareGetProperty kAudioHardwarePropertyPlugInForBundleID error");
+        printError(osErr);
+        return osErr;
+    }
+    
+    //-------------------------------------------------
+    // Create a CFDictionary for our aggregate device
+    //-------------------------------------------------
+    
+    CFMutableDictionaryRef aggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+    
+    CFStringRef AggregateDeviceNameRef = CFSTR("JackDuplex");
+    CFStringRef AggregateDeviceUIDRef = CFSTR("com.grame.JackDuplex");
+    
+    // add the name of the device to the dictionary
+    CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceNameKey), AggregateDeviceNameRef);
+    
+    // add our choice of UID for the aggregate device to the dictionary
+    CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceUIDKey), AggregateDeviceUIDRef);
+    
+    // add a "private aggregate key" to the dictionary
+    int value = 1;
+    CFNumberRef AggregateDeviceNumberRef = CFNumberCreate(NULL, kCFNumberIntType, &value);
+    
+    SInt32 system;
+    Gestalt(gestaltSystemVersion, &system);
+    
+    jack_log("JackCoreAudioDriver::CreateAggregateDevice : system version = %x limit = %x", system, 0x00001054);
+    
+    // Starting with 10.5.4 systems, the AD can be internal... (better)
+    if (system < 0x00001054) {
+        jack_log("JackCoreAudioDriver::CreateAggregateDevice : public aggregate device....");
+    } else {
+        jack_log("JackCoreAudioDriver::CreateAggregateDevice : private aggregate device....");
+        CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceIsPrivateKey), AggregateDeviceNumberRef);
+    }
+    
+    // Prepare sub-devices for clock drift compensation
+    CFMutableArrayRef subDevicesArrayClock = NULL;
+    
+    /*
+     if (fClockDriftCompensate) {
+     if (need_clock_drift_compensation) {
+     jack_info("Clock drift compensation activated...");
+     subDevicesArrayClock = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+     
+     for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+     CFStringRef UID = GetDeviceName(captureDeviceID[i]);
+     if (UID) {
+     CFMutableDictionaryRef subdeviceAggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+     CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceUIDKey), UID);
+     CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceDriftCompensationKey), AggregateDeviceNumberRef);
+     //CFRelease(UID);
+     CFArrayAppendValue(subDevicesArrayClock, subdeviceAggDeviceDict);
+     }
+     }
+     
+     for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+     CFStringRef UID = GetDeviceName(playbackDeviceID[i]);
+     if (UID) {
+     CFMutableDictionaryRef subdeviceAggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+     CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceUIDKey), UID);
+     CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceDriftCompensationKey), AggregateDeviceNumberRef);
+     //CFRelease(UID);
+     CFArrayAppendValue(subDevicesArrayClock, subdeviceAggDeviceDict);
+     }
+     }
+     
+     // add sub-device clock array for the aggregate device to the dictionary
+     CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceSubDeviceListKey), subDevicesArrayClock);
+     } else {
+     jack_info("Clock drift compensation was asked but is not needed (devices use the same clock domain)");
+     }
+     }
+     */
+    
+    //-------------------------------------------------
+    // Create a CFMutableArray for our sub-device list
+    //-------------------------------------------------
+    
+    // we need to append the UID for each device to a CFMutableArray, so create one here
+    CFMutableArrayRef subDevicesArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    
+    vector<CFStringRef> captureDeviceUID;
+    for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+        CFStringRef ref = GetDeviceName(captureDeviceID[i]);
+        if (ref == NULL)
+            return -1;
+        captureDeviceUID.push_back(ref);
+        // input sub-devices in this example, so append the sub-device's UID to the CFArray
+        CFArrayAppendValue(subDevicesArray, ref);
+    }
+    
+    vector<CFStringRef> playbackDeviceUID;
+    for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+        CFStringRef ref = GetDeviceName(playbackDeviceID[i]);
+        if (ref == NULL)
+            return -1;
+        playbackDeviceUID.push_back(ref);
+        // output sub-devices in this example, so append the sub-device's UID to the CFArray
+        CFArrayAppendValue(subDevicesArray, ref);
+    }
+    
+    //-----------------------------------------------------------------------
+    // Feed the dictionary to the plugin, to create a blank aggregate device
+    //-----------------------------------------------------------------------
+    
+    AudioObjectPropertyAddress pluginAOPA;
+    pluginAOPA.mSelector = kAudioPlugInCreateAggregateDevice;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    UInt32 outDataSize;
+    
+    osErr = AudioObjectGetPropertyDataSize(fPluginID, &pluginAOPA, 0, NULL, &outDataSize);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectGetPropertyDataSize error");
+        printError(osErr);
+        goto error;
+    }
+    
+    osErr = AudioObjectGetPropertyData(fPluginID, &pluginAOPA, sizeof(aggDeviceDict), &aggDeviceDict, &outDataSize, outAggregateDevice);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectGetPropertyData error");
+        printError(osErr);
+        goto error;
+    }
+    
+    // pause for a bit to make sure that everything completed correctly
+    // this is to work around a bug in the HAL where a new aggregate device seems to disappear briefly after it is created
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+    
+    //-------------------------
+    // Set the sub-device list
+    //-------------------------
+    
+    pluginAOPA.mSelector = kAudioAggregateDevicePropertyFullSubDeviceList;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    outDataSize = sizeof(CFMutableArrayRef);
+    osErr = AudioObjectSetPropertyData(*outAggregateDevice, &pluginAOPA, 0, NULL, outDataSize, &subDevicesArray);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectSetPropertyData for sub-device list error");
+        printError(osErr);
+        goto error;
+    }
+    
+    // pause again to give the changes time to take effect
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+    
+    //-----------------------
+    // Set the master device
+    //-----------------------
+    
+    // set the master device manually (this is the device which will act as the master clock for the aggregate device)
+    // pass in the UID of the device you want to use
+    pluginAOPA.mSelector = kAudioAggregateDevicePropertyMasterSubDevice;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    outDataSize = sizeof(CFStringRef);
+    osErr = AudioObjectSetPropertyData(*outAggregateDevice, &pluginAOPA, 0, NULL, outDataSize, &captureDeviceUID[0]);  // First apture is master...
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectSetPropertyData for master device error");
+        printError(osErr);
+        goto error;
+    }
+    
+    // pause again to give the changes time to take effect
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+    
+    // Prepare sub-devices for clock drift compensation
+    // Workaround for bug in the HAL : until 10.6.2
+    
+    if (fClockDriftCompensate) {
+        if (need_clock_drift_compensation) {
+            jack_info("Clock drift compensation activated...");
+            
+            // Get the property data size
+            osErr = AudioObjectGetPropertyDataSize(*outAggregateDevice, &theAddressOwned, theQualifierDataSize, theQualifierData, &outSize);
+            if (osErr != noErr) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice kAudioObjectPropertyOwnedObjects error");
+                printError(osErr);
+            }
+            
+            //	Calculate the number of object IDs
+            subDevicesNum = outSize / sizeof(AudioObjectID);
+            jack_info("JackCoreAudioDriver::CreateAggregateDevice clock drift compensation, number of sub-devices = %d", subDevicesNum);
+            AudioObjectID subDevices[subDevicesNum];
+            outSize = sizeof(subDevices);
+            
+            osErr = AudioObjectGetPropertyData(*outAggregateDevice, &theAddressOwned, theQualifierDataSize, theQualifierData, &outSize, subDevices);
+            if (osErr != noErr) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice kAudioObjectPropertyOwnedObjects error");
+                printError(osErr);
+            }
+            
+            // Set kAudioSubDevicePropertyDriftCompensation property...
+            for (UInt32 index = 0; index < subDevicesNum; ++index) {
+                UInt32 theDriftCompensationValue = 1;
+                osErr = AudioObjectSetPropertyData(subDevices[index], &theAddressDrift, 0, NULL, sizeof(UInt32), &theDriftCompensationValue);
+                if (osErr != noErr) {
+                    jack_error("JackCoreAudioDriver::CreateAggregateDevice kAudioSubDevicePropertyDriftCompensation error");
+                    printError(osErr);
+                }
+            }
+        } else {
+            jack_info("Clock drift compensation was asked but is not needed (devices use the same clock domain)");
+        }
+    }    
+    
+    // pause again to give the changes time to take effect
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+    
+    //----------
+    // Clean up
+    //----------
+    
+    // release the private AD key
+    CFRelease(AggregateDeviceNumberRef);
+    
+    // release the CF objects we have created - we don't need them any more
+    CFRelease(aggDeviceDict);
+    CFRelease(subDevicesArray);
+    
+    if (subDevicesArrayClock)
+        CFRelease(subDevicesArrayClock);
+    
+    // release the device UID
+    for (UInt32 i = 0; i < captureDeviceUID.size(); i++) {
+        CFRelease(captureDeviceUID[i]);
+    }
+    
+    for (UInt32 i = 0; i < playbackDeviceUID.size(); i++) {
+        CFRelease(playbackDeviceUID[i]);
+    }
+    
+    jack_log("New aggregate device %ld", *outAggregateDevice);
+    return noErr;
+    
+error:
+    DestroyAggregateDevice();
+    return -1;
+}
+    
+    
+bool JackCoreAudioAdapter::IsAggregateDevice(AudioDeviceID device)
+{
+    OSStatus err = noErr;
+    AudioObjectID sub_device[32];
+    UInt32 outSize = sizeof(sub_device);
+    err = AudioDeviceGetProperty(device, 0, kAudioDeviceSectionGlobal, kAudioAggregateDevicePropertyActiveSubDeviceList, &outSize, sub_device);
+    
+    if (err != noErr) {
+        jack_log("Device does not have subdevices");
+        return false;
+    } else {
+        int num_devices = outSize / sizeof(AudioObjectID);
+        jack_log("Device does has %d subdevices", num_devices);
+        return true;
+    }
+}
+
+void JackCoreAudioAdapter::CloseAUHAL()
+{
+    AudioUnitUninitialize(fAUHAL);
+    CloseComponent(fAUHAL);
+}
+
+int JackCoreAudioAdapter::Open()
+{
+    return (AudioOutputUnitStart(fAUHAL) != noErr)  ? -1 : 0;
+}
+
+int JackCoreAudioAdapter::Close()
+{
+#ifdef JACK_MONITOR
+    fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
+#endif
+    AudioOutputUnitStop(fAUHAL);
+    DisposeBuffers();
+    CloseAUHAL();
+    RemoveListeners();
+    if (fPluginID > 0)
+        DestroyAggregateDevice();
+    return 0;
+}
+
+int JackCoreAudioAdapter::SetSampleRate ( jack_nframes_t sample_rate ) {
+    JackAudioAdapterInterface::SetHostSampleRate ( sample_rate );
+    Close();
+    return Open();
+}
+
+int JackCoreAudioAdapter::SetBufferSize ( jack_nframes_t buffer_size ) {
+    JackAudioAdapterInterface::SetHostBufferSize ( buffer_size );
+    Close();
+    return Open();
+}
+
+} // namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+   SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+   {
+        jack_driver_desc_t *desc;
+        unsigned int i;
+        desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+        strcpy(desc->name, "audioadapter");                            // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "netjack audio <==> net backend adapter");  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+     
+        desc->nparams = 13;
+        desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy(desc->params[i].name, "channels");
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = -1;
+        strcpy(desc->params[i].short_desc, "Maximum number of channels");
+        strcpy(desc->params[i].long_desc, "Maximum number of channels. If -1, max possible number of channels will be used");
+
+        i++;
+        strcpy(desc->params[i].name, "inchannels");
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = -1;
+        strcpy(desc->params[i].short_desc, "Maximum number of input channels");
+        strcpy(desc->params[i].long_desc, "Maximum number of input channels. If -1, max possible number of input channels will be used");
+
+        i++;
+        strcpy(desc->params[i].name, "outchannels");
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = -1;
+        strcpy(desc->params[i].short_desc, "Maximum number of output channels");
+        strcpy(desc->params[i].long_desc, "Maximum number of output channels. If -1, max possible number of output channels will be used");
+
+        i++;
+        strcpy(desc->params[i].name, "capture");
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].short_desc, "Input CoreAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "playback");
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].short_desc, "Output CoreAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "rate");
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 44100U;
+        strcpy(desc->params[i].short_desc, "Sample rate");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "period");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 512U;
+        strcpy(desc->params[i].short_desc, "Frames per period");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "duplex");
+        desc->params[i].character = 'D';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = TRUE;
+        strcpy(desc->params[i].short_desc, "Provide both capture and playback ports");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "device");
+        desc->params[i].character = 'd';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].short_desc, "CoreAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "list-devices");
+        desc->params[i].character = 'l';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = TRUE;
+        strcpy(desc->params[i].short_desc, "Display available CoreAudio devices");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "quality");
+        desc->params[i].character = 'q';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Resample algorithm quality (0 - 4)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "ring-buffer");
+        desc->params[i].character = 'g';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 32768;
+        strcpy(desc->params[i].short_desc, "Fixed ringbuffer size");
+        strcpy(desc->params[i].long_desc, "Fixed ringbuffer size (if not set => automatic adaptative)");
+       
+        i++;
+        strcpy(desc->params[i].name, "clock-drift");
+        desc->params[i].character = 's';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Clock drift compensation");
+        strcpy(desc->params[i].long_desc, "Whether to compensate clock drift in dynamically created aggregate device");
+   
+        return desc;
+    }
+
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/macosx/coreaudio/JackCoreAudioAdapter.h b/macosx/coreaudio/JackCoreAudioAdapter.h
new file mode 100644
index 0000000..8ef6e4d
--- /dev/null
+++ b/macosx/coreaudio/JackCoreAudioAdapter.h
@@ -0,0 +1,166 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackCoreAudioAdapter__
+#define __JackCoreAudioAdapter__
+
+#include "JackAudioAdapterInterface.h"
+#include "jack.h"
+#include "jslist.h"
+#include <AudioToolbox/AudioConverter.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioUnit/AudioUnit.h>
+
+#include <vector>
+
+using namespace std;
+
+namespace Jack
+{
+
+typedef	UInt8	CAAudioHardwareDeviceSectionID;
+#define	kAudioDeviceSectionInput	((CAAudioHardwareDeviceSectionID)0x01)
+#define	kAudioDeviceSectionOutput	((CAAudioHardwareDeviceSectionID)0x00)
+#define	kAudioDeviceSectionGlobal	((CAAudioHardwareDeviceSectionID)0x00)
+#define	kAudioDeviceSectionWildcard	((CAAudioHardwareDeviceSectionID)0xFF)
+
+#define WAIT_COUNTER 60
+    
+/*!
+\brief Audio adapter using CoreAudio API.
+*/
+
+class JackCoreAudioAdapter : public JackAudioAdapterInterface
+{
+
+    private:
+
+        AudioUnit fAUHAL;
+        AudioBufferList* fInputData;
+        
+        char fCaptureUID[256];
+        char fPlaybackUID[256];
+         
+        bool fCapturing;
+        bool fPlaying;
+
+        AudioDeviceID fDeviceID;    // Used "duplex" device
+        AudioObjectID fPluginID;    // Used for aggregate device
+
+        bool fState;
+
+        AudioUnitRenderActionFlags* fActionFags;
+        AudioTimeStamp* fCurrentTime;
+        bool fClockDriftCompensate;
+
+        static	OSStatus Render(void *inRefCon,
+                                AudioUnitRenderActionFlags *ioActionFlags,
+                                const AudioTimeStamp *inTimeStamp,
+                                UInt32 inBusNumber,
+                                UInt32 inNumberFrames,
+                                AudioBufferList *ioData);
+
+        static OSStatus SRNotificationCallback(AudioDeviceID inDevice,
+                                                UInt32 inChannel,
+                                                Boolean	isInput,
+                                                AudioDevicePropertyID inPropertyID,
+                                                void* inClientData);
+        static OSStatus DeviceNotificationCallback(AudioDeviceID inDevice,
+                                                    UInt32 inChannel,
+                                                    Boolean	isInput,
+                                                    AudioDevicePropertyID inPropertyID,
+                                                    void* inClientData);
+
+        OSStatus GetDefaultDevice(AudioDeviceID* id);
+        OSStatus GetTotalChannels(AudioDeviceID device, int& channelCount, bool isInput);
+        OSStatus GetDeviceIDFromUID(const char* UID, AudioDeviceID* id);
+        OSStatus GetDefaultInputDevice(AudioDeviceID* id);
+        OSStatus GetDefaultOutputDevice(AudioDeviceID* id);
+        OSStatus GetDeviceNameFromID(AudioDeviceID id, char* name);
+
+        // Setup
+        OSStatus CreateAggregateDevice(AudioDeviceID captureDeviceID, AudioDeviceID playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice);
+        OSStatus CreateAggregateDeviceAux(vector<AudioDeviceID> captureDeviceID, vector<AudioDeviceID> playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice);
+        OSStatus DestroyAggregateDevice();
+        bool IsAggregateDevice(AudioDeviceID device);
+        
+        int SetupDevices(const char* capture_driver_uid,
+                         const char* playback_driver_uid,
+                         char* capture_driver_name,
+                         char* playback_driver_name,
+                         jack_nframes_t samplerate);
+
+        int SetupChannels(bool capturing,
+                          bool playing,
+                          int& inchannels,
+                          int& outchannels,
+                          int& in_nChannels,
+                          int& out_nChannels,
+                          bool strict);
+
+        int OpenAUHAL(bool capturing,
+                    bool playing,
+                    int inchannels,
+                    int outchannels,
+                    int in_nChannels,
+                    int out_nChannels,
+                    jack_nframes_t buffer_size,
+                    jack_nframes_t samplerate);
+
+        int SetupBufferSize(jack_nframes_t buffer_size);
+        int SetupSampleRate(jack_nframes_t samplerate);
+        int SetupSampleRateAux(AudioDeviceID inDevice, jack_nframes_t samplerate);
+    
+        int SetupBuffers(int inchannels);
+        void DisposeBuffers();
+        void CloseAUHAL();
+        
+        int AddListeners();
+        void RemoveListeners();
+
+    public:
+
+        JackCoreAudioAdapter( jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params);
+        ~JackCoreAudioAdapter()
+        {}
+
+        virtual int Open();
+        virtual int Close();
+
+        virtual int SetSampleRate(jack_nframes_t sample_rate);
+        virtual int SetBufferSize(jack_nframes_t buffer_size);
+
+};
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "JackCompilerDeps.h"
+#include "driver_interface.h"
+
+SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/macosx/coreaudio/JackCoreAudioDriver.cpp b/macosx/coreaudio/JackCoreAudioDriver.cpp
new file mode 100644
index 0000000..2441375
--- /dev/null
+++ b/macosx/coreaudio/JackCoreAudioDriver.cpp
@@ -0,0 +1,2085 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackCoreAudioDriver.h"
+#include "JackEngineControl.h"
+#include "JackMachThread.h"
+#include "JackGraphManager.h"
+#include "JackError.h"
+#include "JackClientControl.h"
+#include "JackDriverLoader.h"
+#include "JackGlobals.h"
+#include "JackTools.h"
+#include "JackCompilerDeps.h"
+
+#include <iostream>
+#include <CoreServices/CoreServices.h>
+#include <CoreFoundation/CFNumber.h>
+
+namespace Jack
+{
+
+static void Print4CharCode(const char* msg, long c)
+{
+    UInt32 __4CC_number = (c);
+    char __4CC_string[5];
+    *((SInt32*)__4CC_string) = EndianU32_NtoB(__4CC_number);		
+    __4CC_string[4] = 0;
+    jack_log("%s'%s'", (msg), __4CC_string);
+}
+
+static void PrintStreamDesc(AudioStreamBasicDescription *inDesc)
+{
+    jack_log("- - - - - - - - - - - - - - - - - - - -");
+    jack_log("  Sample Rate:%f", inDesc->mSampleRate);
+    jack_log("  Format ID:%.*s", (int) sizeof(inDesc->mFormatID), (char*)&inDesc->mFormatID);
+    jack_log("  Format Flags:%lX", inDesc->mFormatFlags);
+    jack_log("  Bytes per Packet:%ld", inDesc->mBytesPerPacket);
+    jack_log("  Frames per Packet:%ld", inDesc->mFramesPerPacket);
+    jack_log("  Bytes per Frame:%ld", inDesc->mBytesPerFrame);
+    jack_log("  Channels per Frame:%ld", inDesc->mChannelsPerFrame);
+    jack_log("  Bits per Channel:%ld", inDesc->mBitsPerChannel);
+    jack_log("- - - - - - - - - - - - - - - - - - - -\n");
+}
+
+static void printError(OSStatus err)
+{
+    switch (err) {
+        case kAudioHardwareNoError:
+            jack_log("error code : kAudioHardwareNoError");
+            break;
+        case kAudioConverterErr_FormatNotSupported:
+            jack_log("error code : kAudioConverterErr_FormatNotSupported");
+            break;
+        case kAudioConverterErr_OperationNotSupported:
+            jack_log("error code : kAudioConverterErr_OperationNotSupported");
+            break;
+        case kAudioConverterErr_PropertyNotSupported:
+            jack_log("error code : kAudioConverterErr_PropertyNotSupported");
+            break;
+        case kAudioConverterErr_InvalidInputSize:
+            jack_log("error code : kAudioConverterErr_InvalidInputSize");
+            break;
+        case kAudioConverterErr_InvalidOutputSize:
+            jack_log("error code : kAudioConverterErr_InvalidOutputSize");
+            break;
+        case kAudioConverterErr_UnspecifiedError:
+            jack_log("error code : kAudioConverterErr_UnspecifiedError");
+            break;
+        case kAudioConverterErr_BadPropertySizeError:
+            jack_log("error code : kAudioConverterErr_BadPropertySizeError");
+            break;
+        case kAudioConverterErr_RequiresPacketDescriptionsError:
+            jack_log("error code : kAudioConverterErr_RequiresPacketDescriptionsError");
+            break;
+        case kAudioConverterErr_InputSampleRateOutOfRange:
+            jack_log("error code : kAudioConverterErr_InputSampleRateOutOfRange");
+            break;
+        case kAudioConverterErr_OutputSampleRateOutOfRange:
+            jack_log("error code : kAudioConverterErr_OutputSampleRateOutOfRange");
+            break;
+        case kAudioHardwareNotRunningError:
+            jack_log("error code : kAudioHardwareNotRunningError");
+            break;
+        case kAudioHardwareUnknownPropertyError:
+            jack_log("error code : kAudioHardwareUnknownPropertyError");
+            break;
+        case kAudioHardwareIllegalOperationError:
+            jack_log("error code : kAudioHardwareIllegalOperationError");
+            break;
+        case kAudioHardwareBadDeviceError:
+            jack_log("error code : kAudioHardwareBadDeviceError");
+            break;
+        case kAudioHardwareBadStreamError:
+            jack_log("error code : kAudioHardwareBadStreamError");
+            break;
+        case kAudioDeviceUnsupportedFormatError:
+            jack_log("error code : kAudioDeviceUnsupportedFormatError");
+            break;
+        case kAudioDevicePermissionsError:
+            jack_log("error code : kAudioDevicePermissionsError");
+            break;
+        case kAudioHardwareBadObjectError:
+            jack_log("error code : kAudioHardwareBadObjectError");
+            break;
+        case kAudioHardwareUnsupportedOperationError:
+            jack_log("error code : kAudioHardwareUnsupportedOperationError");
+            break;
+        default:
+            Print4CharCode("error code : unknown", err);
+            break;
+    }
+}
+
+static OSStatus DisplayDeviceNames()
+{
+    UInt32 size;
+    Boolean isWritable;
+    int i, deviceNum;
+    OSStatus err;
+    CFStringRef UIname;
+
+    err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, &isWritable);
+    if (err != noErr)
+        return err;
+
+    deviceNum = size / sizeof(AudioDeviceID);
+    AudioDeviceID devices[deviceNum];
+
+    err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, devices);
+    if (err != noErr)
+        return err;
+
+    for (i = 0; i < deviceNum; i++) {
+        char device_name[256];
+        char internal_name[256];
+
+        size = sizeof(CFStringRef);
+        UIname = NULL;
+        err = AudioDeviceGetProperty(devices[i], 0, false, kAudioDevicePropertyDeviceUID, &size, &UIname);
+        if (err == noErr) {
+            CFStringGetCString(UIname, internal_name, 256, CFStringGetSystemEncoding());
+        } else {
+            goto error;
+        }
+
+        size = 256;
+        err = AudioDeviceGetProperty(devices[i], 0, false, kAudioDevicePropertyDeviceName, &size, device_name);
+        if (err != noErr)
+            return err;
+
+        jack_info("Device name = \'%s\', internal_name = \'%s\' (to be used as -C, -P, or -d parameter)", device_name, internal_name);
+    }
+
+    return noErr;
+
+error:
+    if (UIname != NULL)
+        CFRelease(UIname);
+    return err;
+}
+
+static CFStringRef GetDeviceName(AudioDeviceID id)
+{
+    UInt32 size = sizeof(CFStringRef);
+    CFStringRef UIname;
+    OSStatus err = AudioDeviceGetProperty(id, 0, false, kAudioDevicePropertyDeviceUID, &size, &UIname);
+    return (err == noErr) ? UIname : NULL;
+}
+
+OSStatus JackCoreAudioDriver::Render(void *inRefCon,
+                                     AudioUnitRenderActionFlags *ioActionFlags,
+                                     const AudioTimeStamp *inTimeStamp,
+                                     UInt32 inBusNumber,
+                                     UInt32 inNumberFrames,
+                                     AudioBufferList *ioData)
+{
+    JackCoreAudioDriver* driver = (JackCoreAudioDriver*)inRefCon;
+    driver->fActionFags = ioActionFlags;
+    driver->fCurrentTime = (AudioTimeStamp *)inTimeStamp;
+    driver->fDriverOutputData = ioData;
+    driver->CycleTakeBeginTime();
+    return driver->Process();
+}
+
+int JackCoreAudioDriver::Read()
+{
+    AudioUnitRender(fAUHAL, fActionFags, fCurrentTime, 1, fEngineControl->fBufferSize, fJackInputData);
+    return 0;
+}
+
+int JackCoreAudioDriver::Write()
+{
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        if (fGraphManager->GetConnectionsNum(fPlaybackPortList[i]) > 0) {
+            float* buffer = GetOutputBuffer(i);
+            int size = sizeof(float) * fEngineControl->fBufferSize;
+            memcpy((float*)fDriverOutputData->mBuffers[i].mData, buffer, size);
+            // Monitor ports
+            if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0)
+                memcpy(GetMonitorBuffer(i), buffer, size);
+        } else {
+            memset((float*)fDriverOutputData->mBuffers[i].mData, 0, sizeof(float) * fEngineControl->fBufferSize);
+        }
+    }
+    return 0;
+}
+
+// Will run only once
+OSStatus JackCoreAudioDriver::MeasureCallback(AudioDeviceID inDevice,
+        const AudioTimeStamp* inNow,
+        const AudioBufferList* inInputData,
+        const AudioTimeStamp* inInputTime,
+        AudioBufferList* outOutputData,
+        const AudioTimeStamp* inOutputTime,
+        void* inClientData)
+{
+    JackCoreAudioDriver* driver = (JackCoreAudioDriver*)inClientData;
+    AudioDeviceStop(driver->fDeviceID, MeasureCallback);
+    
+    jack_log("JackCoreAudioDriver::MeasureCallback called");
+    JackMachThread::GetParams(pthread_self(), &driver->fEngineControl->fPeriod, &driver->fEngineControl->fComputation, &driver->fEngineControl->fConstraint);
+    
+    if (driver->fComputationGrain > 0) {
+        jack_log("JackCoreAudioDriver::MeasureCallback : RT thread computation setup to %d percent of period", int(driver->fComputationGrain * 100));
+        driver->fEngineControl->fComputation = driver->fEngineControl->fPeriod * driver->fComputationGrain;
+    }
+    
+    // Signal waiting start function...
+    driver->fState = true;
+    
+    // Setup threadded based log function
+    set_threaded_log_function();
+    return noErr;
+}
+
+OSStatus JackCoreAudioDriver::SRNotificationCallback(AudioDeviceID inDevice,
+                                                    UInt32 inChannel,
+                                                    Boolean	isInput,
+                                                    AudioDevicePropertyID inPropertyID,
+                                                    void* inClientData)
+{
+    JackCoreAudioDriver* driver = (JackCoreAudioDriver*)inClientData;
+
+    switch (inPropertyID) {
+
+        case kAudioDevicePropertyNominalSampleRate: {
+            jack_log("JackCoreAudioDriver::SRNotificationCallback kAudioDevicePropertyNominalSampleRate");
+            driver->fState = true;
+            // Check new sample rate
+            Float64 sampleRate;
+            UInt32 outSize =  sizeof(Float64);
+            OSStatus err = AudioDeviceGetProperty(inDevice, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outSize, &sampleRate);
+            if (err != noErr) {
+                jack_error("Cannot get current sample rate");
+                printError(err);
+            } else {
+                jack_log("SRNotificationCallback : checked sample rate = %f", sampleRate);
+            }
+            break;
+        }
+    }
+
+    return noErr;
+}
+
+// A better implementation would possibly try to recover in case of hardware device change (see HALLAB HLFilePlayerWindowControllerAudioDevicePropertyListenerProc code)
+OSStatus JackCoreAudioDriver::DeviceNotificationCallback(AudioDeviceID inDevice,
+                                                        UInt32 inChannel,
+                                                        Boolean	isInput,
+                                                        AudioDevicePropertyID inPropertyID,
+                                                        void* inClientData)
+{
+    JackCoreAudioDriver* driver = (JackCoreAudioDriver*)inClientData;
+         
+    switch (inPropertyID) {
+            
+        case kAudioDevicePropertyDeviceIsRunning: {
+            UInt32 isrunning = 0;
+            UInt32 outsize = sizeof(UInt32);
+            if (AudioDeviceGetProperty(driver->fDeviceID, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyDeviceIsRunning, &outsize, &isrunning) == noErr) {
+                jack_log("JackCoreAudioDriver::DeviceNotificationCallback kAudioDevicePropertyDeviceIsRunning = %d", isrunning);
+            }
+            break;
+        }
+        
+        case kAudioDeviceProcessorOverload: {
+            jack_error("JackCoreAudioDriver::DeviceNotificationCallback kAudioDeviceProcessorOverload");
+            jack_time_t cur_time = GetMicroSeconds();
+            driver->NotifyXRun(cur_time, float(cur_time - driver->fBeginDateUst));   // Better this value than nothing... 
+            break;
+        }
+        
+        case kAudioDevicePropertyStreamConfiguration: {
+            jack_error("Cannot handle kAudioDevicePropertyStreamConfiguration : server will quit...");
+            driver->NotifyFailure(JackBackendError, "Another application has changed the device configuration.");   // Message length limited to JACK_MESSAGE_SIZE
+            driver->CloseAUHAL();
+            kill(JackTools::GetPID(), SIGINT);
+            return kAudioHardwareUnsupportedOperationError;
+        }
+        
+        case kAudioDevicePropertyNominalSampleRate: {
+            Float64 sampleRate = 0;
+            UInt32 outsize = sizeof(Float64);
+            OSStatus err = AudioDeviceGetProperty(driver->fDeviceID, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outsize, &sampleRate);
+            if (err != noErr)
+                return kAudioHardwareUnsupportedOperationError;
+            
+            char device_name[256];
+            const char* digidesign_name = "Digidesign";
+            driver->GetDeviceNameFromID(driver->fDeviceID, device_name);
+        
+            if (sampleRate != driver->fEngineControl->fSampleRate) {
+               
+               // Digidesign hardware, so "special" code : change the SR again here
+               if (strncmp(device_name, digidesign_name, sizeof(digidesign_name)) == 0) {
+                   
+                    jack_log("Digidesign HW = %s", device_name);
+                
+                    // Set sample rate again...
+                    sampleRate = driver->fEngineControl->fSampleRate;
+                    err = AudioDeviceSetProperty(driver->fDeviceID, NULL, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, outsize, &sampleRate);
+                    if (err != noErr) {
+                        jack_error("Cannot set sample rate = %f", sampleRate);
+                        printError(err);
+                    } else {
+                        jack_log("Set sample rate = %f", sampleRate);
+                    }
+                    
+                    // Check new sample rate again...
+                    outsize = sizeof(Float64);
+                    err = AudioDeviceGetProperty(inDevice, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outsize, &sampleRate);
+                    if (err != noErr) {
+                        jack_error("Cannot get current sample rate");
+                        printError(err);
+                    } else {
+                        jack_log("Checked sample rate = %f", sampleRate);
+                    }
+                    return noErr;
+                    
+                } else {
+                    driver->NotifyFailure(JackBackendError, "Another application has changed the sample rate.");    // Message length limited to JACK_MESSAGE_SIZE
+                    driver->CloseAUHAL();
+                    kill(JackTools::GetPID(), SIGINT);
+                    return kAudioHardwareUnsupportedOperationError;
+                }
+            }
+        }
+            
+    }
+    return noErr;
+}
+
+OSStatus JackCoreAudioDriver::GetDeviceIDFromUID(const char* UID, AudioDeviceID* id)
+{
+    UInt32 size = sizeof(AudioValueTranslation);
+    CFStringRef inIUD = CFStringCreateWithCString(NULL, UID, CFStringGetSystemEncoding());
+    AudioValueTranslation value = { &inIUD, sizeof(CFStringRef), id, sizeof(AudioDeviceID) };
+
+    if (inIUD == NULL) {
+        return kAudioHardwareUnspecifiedError;
+    } else {
+        OSStatus res = AudioHardwareGetProperty(kAudioHardwarePropertyDeviceForUID, &size, &value);
+        CFRelease(inIUD);
+        jack_log("GetDeviceIDFromUID %s %ld", UID, *id);
+        return (*id == kAudioDeviceUnknown) ? kAudioHardwareBadDeviceError : res;
+    }
+}
+
+OSStatus JackCoreAudioDriver::GetDefaultDevice(AudioDeviceID* id)
+{
+    OSStatus res;
+    UInt32 theSize = sizeof(UInt32);
+    AudioDeviceID inDefault;
+    AudioDeviceID outDefault;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &theSize, &inDefault)) != noErr)
+        return res;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &theSize, &outDefault)) != noErr)
+        return res;
+
+    jack_log("GetDefaultDevice: input = %ld output = %ld", inDefault, outDefault);
+
+    // Get the device only if default input and output are the same
+    if (inDefault == outDefault) {
+        *id = inDefault;
+        return noErr;
+    } else {
+        jack_error("Default input and output devices are not the same !!");
+        return kAudioHardwareBadDeviceError;
+    }
+}
+
+OSStatus JackCoreAudioDriver::GetDefaultInputDevice(AudioDeviceID* id)
+{
+    OSStatus res;
+    UInt32 theSize = sizeof(UInt32);
+    AudioDeviceID inDefault;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &theSize, &inDefault)) != noErr)
+        return res;
+
+    jack_log("GetDefaultInputDevice: input = %ld ", inDefault);
+    *id = inDefault;
+    return noErr;
+}
+
+OSStatus JackCoreAudioDriver::GetDefaultOutputDevice(AudioDeviceID* id)
+{
+    OSStatus res;
+    UInt32 theSize = sizeof(UInt32);
+    AudioDeviceID outDefault;
+
+    if ((res = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &theSize, &outDefault)) != noErr)
+        return res;
+
+    jack_log("GetDefaultOutputDevice: output = %ld", outDefault);
+    *id = outDefault;
+    return noErr;
+}
+
+OSStatus JackCoreAudioDriver::GetDeviceNameFromID(AudioDeviceID id, char* name)
+{
+    UInt32 size = 256;
+    return AudioDeviceGetProperty(id, 0, false, kAudioDevicePropertyDeviceName, &size, name);
+}
+
+OSStatus JackCoreAudioDriver::GetTotalChannels(AudioDeviceID device, int& channelCount, bool isInput)
+{
+    OSStatus err = noErr;
+    UInt32	outSize;
+    Boolean	outWritable;
+ 
+    channelCount = 0;
+    err = AudioDeviceGetPropertyInfo(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, &outWritable);
+    if (err == noErr) {
+        AudioBufferList bufferList[outSize];
+        err = AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, bufferList);
+        if (err == noErr) {
+            for (unsigned int i = 0; i < bufferList->mNumberBuffers; i++)
+                channelCount += bufferList->mBuffers[i].mNumberChannels;
+        }
+    }
+    return err;
+}
+
+JackCoreAudioDriver::JackCoreAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+        : JackAudioDriver(name, alias, engine, table), 
+        fJackInputData(NULL), 
+        fDriverOutputData(NULL), 
+        fPluginID(0), 
+        fState(false), 
+        fHogged(false),
+        fIOUsage(1.f),
+        fComputationGrain(-1.f),
+        fClockDriftCompensate(false)
+{}
+
+JackCoreAudioDriver::~JackCoreAudioDriver()
+{}
+
+OSStatus JackCoreAudioDriver::DestroyAggregateDevice() 
+{
+    OSStatus osErr = noErr;
+    AudioObjectPropertyAddress pluginAOPA;
+    pluginAOPA.mSelector = kAudioPlugInDestroyAggregateDevice;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    UInt32 outDataSize;
+     
+    if (fPluginID > 0)   {
+      
+        osErr = AudioObjectGetPropertyDataSize(fPluginID, &pluginAOPA, 0, NULL, &outDataSize);
+        if (osErr != noErr) {
+            jack_error("JackCoreAudioDriver::DestroyAggregateDevice : AudioObjectGetPropertyDataSize error");
+            printError(osErr);
+            return osErr;
+        }
+            
+        osErr = AudioObjectGetPropertyData(fPluginID, &pluginAOPA, 0, NULL, &outDataSize, &fDeviceID);
+        if (osErr != noErr) {
+            jack_error("JackCoreAudioDriver::DestroyAggregateDevice : AudioObjectGetPropertyData error");
+            printError(osErr);
+            return osErr;
+        }
+        
+    }
+    
+    return noErr;
+}
+    
+OSStatus JackCoreAudioDriver::CreateAggregateDevice(AudioDeviceID captureDeviceID, AudioDeviceID playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice) 
+{
+    OSStatus err = noErr;
+    AudioObjectID sub_device[32];
+    UInt32 outSize = sizeof(sub_device);
+    
+    err = AudioDeviceGetProperty(captureDeviceID, 0, kAudioDeviceSectionGlobal, kAudioAggregateDevicePropertyActiveSubDeviceList, &outSize, sub_device);
+    vector<AudioDeviceID> captureDeviceIDArray;
+    
+    if (err != noErr) {
+        jack_log("Input device does not have subdevices");
+        captureDeviceIDArray.push_back(captureDeviceID);
+    } else {
+        int num_devices = outSize / sizeof(AudioObjectID);
+        jack_log("Input device has %d subdevices", num_devices);
+        for (int i = 0; i < num_devices; i++) {
+            captureDeviceIDArray.push_back(sub_device[i]);
+        }
+    }
+    
+    err = AudioDeviceGetProperty(playbackDeviceID, 0, kAudioDeviceSectionGlobal, kAudioAggregateDevicePropertyActiveSubDeviceList, &outSize, sub_device);    
+    vector<AudioDeviceID> playbackDeviceIDArray;
+    
+    if (err != noErr) {
+        jack_log("Output device does not have subdevices");
+        playbackDeviceIDArray.push_back(playbackDeviceID);
+    } else {
+        int num_devices = outSize / sizeof(AudioObjectID);
+        jack_log("Output device has %d subdevices", num_devices);
+        for (int i = 0; i < num_devices; i++) {
+            playbackDeviceIDArray.push_back(sub_device[i]);
+        }
+    }
+    
+    return CreateAggregateDeviceAux(captureDeviceIDArray, playbackDeviceIDArray, samplerate, outAggregateDevice);
+}
+
+OSStatus JackCoreAudioDriver::CreateAggregateDeviceAux(vector<AudioDeviceID> captureDeviceID, vector<AudioDeviceID> playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice) 
+{
+    OSStatus osErr = noErr;
+    UInt32 outSize;
+    Boolean outWritable;
+    
+    // Prepare sub-devices for clock drift compensation
+    // Workaround for bug in the HAL : until 10.6.2
+    AudioObjectPropertyAddress theAddressOwned = { kAudioObjectPropertyOwnedObjects, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+    AudioObjectPropertyAddress theAddressDrift = { kAudioSubDevicePropertyDriftCompensation, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+    UInt32 theQualifierDataSize = sizeof(AudioObjectID);
+    AudioClassID inClass = kAudioSubDeviceClassID;
+    void* theQualifierData = &inClass;
+    UInt32 subDevicesNum = 0;
+     
+    //---------------------------------------------------------------------------
+    // Setup SR of both devices otherwise creating AD may fail...
+    //---------------------------------------------------------------------------
+    UInt32 keptclockdomain = 0;
+    UInt32 clockdomain = 0;
+    outSize = sizeof(UInt32);
+    bool need_clock_drift_compensation = false;
+    
+    for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+        if (SetupSampleRateAux(captureDeviceID[i], samplerate) < 0) {
+            jack_error("JackCoreAudioDriver::CreateAggregateDevice : cannot set SR of input device");
+        } else  {
+            // Check clock domain
+            osErr = AudioDeviceGetProperty(captureDeviceID[i], 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyClockDomain, &outSize, &clockdomain); 
+            if (osErr != 0) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice : kAudioDevicePropertyClockDomain error");
+                printError(osErr);
+            } else {
+                keptclockdomain = (keptclockdomain == 0) ? clockdomain : keptclockdomain; 
+                jack_log("JackCoreAudioDriver::CreateAggregateDevice : input clockdomain = %d", clockdomain);
+                if (clockdomain != 0 && clockdomain != keptclockdomain) {
+                    jack_error("JackCoreAudioDriver::CreateAggregateDevice : devices do not share the same clock!! clock drift compensation would be needed...");
+                    need_clock_drift_compensation = true;
+                }
+            }
+        }
+    }
+    
+    for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+        if (SetupSampleRateAux(playbackDeviceID[i], samplerate) < 0) {
+            jack_error("JackCoreAudioDriver::CreateAggregateDevice : cannot set SR of output device");
+        } else {
+            // Check clock domain
+            osErr = AudioDeviceGetProperty(playbackDeviceID[i], 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyClockDomain, &outSize, &clockdomain); 
+            if (osErr != 0) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice : kAudioDevicePropertyClockDomain error");
+                printError(osErr);
+            } else {
+                keptclockdomain = (keptclockdomain == 0) ? clockdomain : keptclockdomain; 
+                jack_log("JackCoreAudioDriver::CreateAggregateDevice : output clockdomain = %d", clockdomain);
+                if (clockdomain != 0 && clockdomain != keptclockdomain) {
+                    jack_error("JackCoreAudioDriver::CreateAggregateDevice : devices do not share the same clock!! clock drift compensation would be needed...");
+                    need_clock_drift_compensation = true;
+                }
+            }
+        }
+    }
+    
+    // If no valid clock domain was found, then assume we have to compensate...
+    if (keptclockdomain == 0) {
+        need_clock_drift_compensation = true;
+    }
+
+    //---------------------------------------------------------------------------
+    // Start to create a new aggregate by getting the base audio hardware plugin
+    //---------------------------------------------------------------------------
+    
+    char device_name[256];
+    for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+        GetDeviceNameFromID(captureDeviceID[i], device_name);
+        jack_info("Separated input = '%s' ", device_name);
+    }
+    
+    for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+        GetDeviceNameFromID(playbackDeviceID[i], device_name);
+        jack_info("Separated output = '%s' ", device_name);
+    }
+   
+    osErr = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyPlugInForBundleID, &outSize, &outWritable);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioHardwareGetPropertyInfo kAudioHardwarePropertyPlugInForBundleID error");
+        printError(osErr);
+        return osErr;
+    }
+
+    AudioValueTranslation pluginAVT;
+
+    CFStringRef inBundleRef = CFSTR("com.apple.audio.CoreAudio");
+   
+    pluginAVT.mInputData = &inBundleRef;
+    pluginAVT.mInputDataSize = sizeof(inBundleRef);
+    pluginAVT.mOutputData = &fPluginID;
+    pluginAVT.mOutputDataSize = sizeof(fPluginID);
+
+    osErr = AudioHardwareGetProperty(kAudioHardwarePropertyPlugInForBundleID, &outSize, &pluginAVT);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioHardwareGetProperty kAudioHardwarePropertyPlugInForBundleID error");
+        printError(osErr);
+        return osErr;
+    }
+
+    //-------------------------------------------------
+    // Create a CFDictionary for our aggregate device
+    //-------------------------------------------------
+
+    CFMutableDictionaryRef aggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+
+    CFStringRef AggregateDeviceNameRef = CFSTR("JackDuplex");
+    CFStringRef AggregateDeviceUIDRef = CFSTR("com.grame.JackDuplex");
+    
+    // add the name of the device to the dictionary
+    CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceNameKey), AggregateDeviceNameRef);
+
+    // add our choice of UID for the aggregate device to the dictionary
+    CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceUIDKey), AggregateDeviceUIDRef);
+    
+    // add a "private aggregate key" to the dictionary
+    int value = 1;
+    CFNumberRef AggregateDeviceNumberRef = CFNumberCreate(NULL, kCFNumberIntType, &value);
+    
+    SInt32 system;
+    Gestalt(gestaltSystemVersion, &system);
+     
+    jack_log("JackCoreAudioDriver::CreateAggregateDevice : system version = %x limit = %x", system, 0x00001054);
+    
+    // Starting with 10.5.4 systems, the AD can be internal... (better)
+    if (system < 0x00001054) {
+        jack_log("JackCoreAudioDriver::CreateAggregateDevice : public aggregate device....");
+    } else {
+        jack_log("JackCoreAudioDriver::CreateAggregateDevice : private aggregate device....");
+        CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceIsPrivateKey), AggregateDeviceNumberRef);
+    }
+    
+    // Prepare sub-devices for clock drift compensation
+    CFMutableArrayRef subDevicesArrayClock = NULL;
+    
+    /*
+    if (fClockDriftCompensate) {
+        if (need_clock_drift_compensation) {
+            jack_info("Clock drift compensation activated...");
+            subDevicesArrayClock = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+            
+            for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+                CFStringRef UID = GetDeviceName(captureDeviceID[i]);
+                if (UID) {
+                    CFMutableDictionaryRef subdeviceAggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                    CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceUIDKey), UID);
+                    CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceDriftCompensationKey), AggregateDeviceNumberRef);
+                    //CFRelease(UID);
+                    CFArrayAppendValue(subDevicesArrayClock, subdeviceAggDeviceDict);
+                }
+            }
+            
+            for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+                CFStringRef UID = GetDeviceName(playbackDeviceID[i]);
+                if (UID) {
+                    CFMutableDictionaryRef subdeviceAggDeviceDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                    CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceUIDKey), UID);
+                    CFDictionaryAddValue(subdeviceAggDeviceDict, CFSTR(kAudioSubDeviceDriftCompensationKey), AggregateDeviceNumberRef);
+                    //CFRelease(UID);
+                    CFArrayAppendValue(subDevicesArrayClock, subdeviceAggDeviceDict);
+                }
+            }
+            
+            // add sub-device clock array for the aggregate device to the dictionary
+            CFDictionaryAddValue(aggDeviceDict, CFSTR(kAudioAggregateDeviceSubDeviceListKey), subDevicesArrayClock);
+        } else {
+            jack_info("Clock drift compensation was asked but is not needed (devices use the same clock domain)");
+        }
+    }
+    */
+    
+    //-------------------------------------------------
+    // Create a CFMutableArray for our sub-device list
+    //-------------------------------------------------
+    
+    // we need to append the UID for each device to a CFMutableArray, so create one here
+    CFMutableArrayRef subDevicesArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    
+    vector<CFStringRef> captureDeviceUID;
+    for (UInt32 i = 0; i < captureDeviceID.size(); i++) {
+        CFStringRef ref = GetDeviceName(captureDeviceID[i]);
+        if (ref == NULL)
+            return -1;
+        captureDeviceUID.push_back(ref);
+        // input sub-devices in this example, so append the sub-device's UID to the CFArray
+        CFArrayAppendValue(subDevicesArray, ref);
+   }
+    
+    vector<CFStringRef> playbackDeviceUID;
+    for (UInt32 i = 0; i < playbackDeviceID.size(); i++) {
+        CFStringRef ref = GetDeviceName(playbackDeviceID[i]);
+        if (ref == NULL)
+            return -1;
+        playbackDeviceUID.push_back(ref);
+        // output sub-devices in this example, so append the sub-device's UID to the CFArray
+        CFArrayAppendValue(subDevicesArray, ref);
+    }
+  
+    //-----------------------------------------------------------------------
+    // Feed the dictionary to the plugin, to create a blank aggregate device
+    //-----------------------------------------------------------------------
+ 
+    AudioObjectPropertyAddress pluginAOPA;
+    pluginAOPA.mSelector = kAudioPlugInCreateAggregateDevice;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    UInt32 outDataSize;
+
+    osErr = AudioObjectGetPropertyDataSize(fPluginID, &pluginAOPA, 0, NULL, &outDataSize);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectGetPropertyDataSize error");
+        printError(osErr);
+        goto error;
+    }
+    
+    osErr = AudioObjectGetPropertyData(fPluginID, &pluginAOPA, sizeof(aggDeviceDict), &aggDeviceDict, &outDataSize, outAggregateDevice);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectGetPropertyData error");
+        printError(osErr);
+        goto error;
+    }
+
+    // pause for a bit to make sure that everything completed correctly
+    // this is to work around a bug in the HAL where a new aggregate device seems to disappear briefly after it is created
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+
+    //-------------------------
+    // Set the sub-device list
+    //-------------------------
+
+    pluginAOPA.mSelector = kAudioAggregateDevicePropertyFullSubDeviceList;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    outDataSize = sizeof(CFMutableArrayRef);
+    osErr = AudioObjectSetPropertyData(*outAggregateDevice, &pluginAOPA, 0, NULL, outDataSize, &subDevicesArray);
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectSetPropertyData for sub-device list error");
+        printError(osErr);
+        goto error;
+    }
+    
+    // pause again to give the changes time to take effect
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+    
+    //-----------------------
+    // Set the master device
+    //-----------------------
+
+    // set the master device manually (this is the device which will act as the master clock for the aggregate device)
+    // pass in the UID of the device you want to use
+    pluginAOPA.mSelector = kAudioAggregateDevicePropertyMasterSubDevice;
+    pluginAOPA.mScope = kAudioObjectPropertyScopeGlobal;
+    pluginAOPA.mElement = kAudioObjectPropertyElementMaster;
+    outDataSize = sizeof(CFStringRef);
+    osErr = AudioObjectSetPropertyData(*outAggregateDevice, &pluginAOPA, 0, NULL, outDataSize, &captureDeviceUID[0]);  // First apture is master...
+    if (osErr != noErr) {
+        jack_error("JackCoreAudioDriver::CreateAggregateDevice : AudioObjectSetPropertyData for master device error");
+        printError(osErr);
+        goto error;
+    }
+    
+    // pause again to give the changes time to take effect
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+  
+    // Prepare sub-devices for clock drift compensation
+    // Workaround for bug in the HAL : until 10.6.2
+    
+    if (fClockDriftCompensate) {
+        if (need_clock_drift_compensation) {
+            jack_info("Clock drift compensation activated...");
+       
+            // Get the property data size
+            osErr = AudioObjectGetPropertyDataSize(*outAggregateDevice, &theAddressOwned, theQualifierDataSize, theQualifierData, &outSize);
+            if (osErr != noErr) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice kAudioObjectPropertyOwnedObjects error");
+                printError(osErr);
+            }
+            
+            //	Calculate the number of object IDs
+            subDevicesNum = outSize / sizeof(AudioObjectID);
+            jack_info("JackCoreAudioDriver::CreateAggregateDevice clock drift compensation, number of sub-devices = %d", subDevicesNum);
+            AudioObjectID subDevices[subDevicesNum];
+            outSize = sizeof(subDevices);
+            
+            osErr = AudioObjectGetPropertyData(*outAggregateDevice, &theAddressOwned, theQualifierDataSize, theQualifierData, &outSize, subDevices);
+            if (osErr != noErr) {
+                jack_error("JackCoreAudioDriver::CreateAggregateDevice kAudioObjectPropertyOwnedObjects error");
+                printError(osErr);
+            }
+            
+            // Set kAudioSubDevicePropertyDriftCompensation property...
+            for (UInt32 index = 0; index < subDevicesNum; ++index) {
+                UInt32 theDriftCompensationValue = 1;
+                osErr = AudioObjectSetPropertyData(subDevices[index], &theAddressDrift, 0, NULL, sizeof(UInt32), &theDriftCompensationValue);
+                if (osErr != noErr) {
+                    jack_error("JackCoreAudioDriver::CreateAggregateDevice kAudioSubDevicePropertyDriftCompensation error");
+                    printError(osErr);
+                }
+            }
+        } else {
+            jack_info("Clock drift compensation was asked but is not needed (devices use the same clock domain)");
+        }
+    }    
+    
+    // pause again to give the changes time to take effect
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false);
+       
+    //----------
+    // Clean up
+    //----------
+    
+    // release the private AD key
+    CFRelease(AggregateDeviceNumberRef);
+
+    // release the CF objects we have created - we don't need them any more
+    CFRelease(aggDeviceDict);
+    CFRelease(subDevicesArray);
+    
+    if (subDevicesArrayClock)
+        CFRelease(subDevicesArrayClock);
+
+    // release the device UID
+    for (UInt32 i = 0; i < captureDeviceUID.size(); i++) {
+        CFRelease(captureDeviceUID[i]);
+    }
+    
+    for (UInt32 i = 0; i < playbackDeviceUID.size(); i++) {
+        CFRelease(playbackDeviceUID[i]);
+    }
+    
+    jack_log("New aggregate device %ld", *outAggregateDevice);
+    return noErr;
+    
+error:
+    DestroyAggregateDevice();
+    return -1;
+}
+
+int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid, 
+                                      const char* playback_driver_uid, 
+                                      char* capture_driver_name, 
+                                      char* playback_driver_name, 
+                                      jack_nframes_t samplerate)
+{
+    capture_driver_name[0] = 0;
+    playback_driver_name[0] = 0;
+   
+    // Duplex
+    if (strcmp(capture_driver_uid, "") != 0 && strcmp(playback_driver_uid, "") != 0) {
+        jack_log("JackCoreAudioDriver::Open duplex");
+          
+        // Same device for capture and playback...
+        if (strcmp(capture_driver_uid, playback_driver_uid) == 0)  {
+            
+            if (GetDeviceIDFromUID(playback_driver_uid, &fDeviceID) != noErr) {
+                jack_log("Will take default in/out");
+                if (GetDefaultDevice(&fDeviceID) != noErr) {
+                    jack_error("Cannot open default device");
+                    return -1;
+                }
+            }
+            if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr || GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
+                jack_error("Cannot get device name from device ID");
+                return -1;
+            }
+            
+        } else {
+        
+            // Creates aggregate device
+            AudioDeviceID captureID, playbackID;
+            
+            if (GetDeviceIDFromUID(capture_driver_uid, &captureID) != noErr) {
+                jack_log("Will take default input");
+                if (GetDefaultInputDevice(&captureID) != noErr) {
+                    jack_error("Cannot open default device");
+                    return -1;
+                }
+            }
+
+            if (GetDeviceIDFromUID(playback_driver_uid, &playbackID) != noErr) {
+                jack_log("Will take default output");
+                if (GetDefaultOutputDevice(&playbackID) != noErr) {
+                    jack_error("Cannot open default device");
+                    return -1;
+                }
+            }
+
+            if (CreateAggregateDevice(captureID, playbackID, samplerate, &fDeviceID) != noErr)
+                return -1;
+        }
+
+    // Capture only
+    } else if (strcmp(capture_driver_uid, "") != 0) {
+        jack_log("JackCoreAudioDriver::Open capture only");
+        if (GetDeviceIDFromUID(capture_driver_uid, &fDeviceID) != noErr) {
+            jack_log("Will take default input");
+            if (GetDefaultInputDevice(&fDeviceID) != noErr) {
+                jack_error("Cannot open default device");
+                return -1;
+            }
+        }
+        if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr) {
+            jack_error("Cannot get device name from device ID");
+            return -1;
+        }
+
+    // Playback only
+    } else if (strcmp(playback_driver_uid, "") != 0) {
+        jack_log("JackCoreAudioDriver::Open playback only");
+        if (GetDeviceIDFromUID(playback_driver_uid, &fDeviceID) != noErr) {
+            jack_log("Will take default output");
+            if (GetDefaultOutputDevice(&fDeviceID) != noErr) {
+                jack_error("Cannot open default device");
+                return -1;
+            }
+        }
+        if (GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
+            jack_error("Cannot get device name from device ID");
+            return -1;
+        }
+
+    // Use default driver in duplex mode
+    } else {
+        jack_log("JackCoreAudioDriver::Open default driver");
+        if (GetDefaultDevice(&fDeviceID) != noErr) {
+            jack_error("Cannot open default device");
+            return -1;
+        }
+        if (GetDeviceNameFromID(fDeviceID, capture_driver_name) != noErr || GetDeviceNameFromID(fDeviceID, playback_driver_name) != noErr) {
+            jack_error("Cannot get device name from device ID");
+            return -1;
+        }
+    }
+    
+    if (fHogged) {
+        if (TakeHog()) {
+            jack_info("Device = %ld has been hogged", fDeviceID);
+        }
+    }
+
+    return 0;
+}
+
+/*
+Return the max possible input channels in in_nChannels and output channels in out_nChannels.
+*/
+int JackCoreAudioDriver::SetupChannels(bool capturing, bool playing, int& inchannels, int& outchannels, int& in_nChannels, int& out_nChannels, bool strict)
+{
+    OSStatus err = noErr;
+
+    if (capturing) {
+        err = GetTotalChannels(fDeviceID, in_nChannels, true);
+        if (err != noErr) {
+            jack_error("Cannot get input channel number");
+            printError(err);
+            return -1;
+        } else {
+            jack_log("Max input channels : %d", in_nChannels);
+        }
+    }
+
+    if (playing) {
+        err = GetTotalChannels(fDeviceID, out_nChannels, false);
+        if (err != noErr) {
+            jack_error("Cannot get output channel number");
+            printError(err);
+            return -1;
+        } else {
+            jack_log("Max output channels : %d", out_nChannels);
+        }
+    }
+
+    if (inchannels > in_nChannels) {
+        jack_error("This device hasn't required input channels inchannels = %d in_nChannels = %d", inchannels, in_nChannels);
+        if (strict)
+            return -1;
+    }
+
+    if (outchannels > out_nChannels) {
+        jack_error("This device hasn't required output channels outchannels = %d out_nChannels = %d", outchannels, out_nChannels);
+        if (strict)
+            return -1;
+    }
+
+    if (inchannels == -1) {
+        jack_log("Setup max in channels = %d", in_nChannels);
+        inchannels = in_nChannels;
+    }
+
+    if (outchannels == -1) {
+        jack_log("Setup max out channels = %d", out_nChannels);
+        outchannels = out_nChannels;
+    }
+
+    return 0;
+}
+
+int JackCoreAudioDriver::SetupBufferSize(jack_nframes_t buffer_size)
+{
+    // Setting buffer size
+    UInt32 outSize = sizeof(UInt32);
+    OSStatus err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false, kAudioDevicePropertyBufferFrameSize, outSize, &buffer_size);
+    if (err != noErr) {
+        jack_error("Cannot set buffer size %ld", buffer_size);
+        printError(err);
+        return -1;
+    }
+
+    return 0;
+}
+
+int JackCoreAudioDriver::SetupSampleRate(jack_nframes_t samplerate)
+{
+    return SetupSampleRateAux(fDeviceID, samplerate);
+}
+
+int JackCoreAudioDriver::SetupSampleRateAux(AudioDeviceID inDevice, jack_nframes_t samplerate)
+{
+    OSStatus err = noErr;
+    UInt32 outSize;
+    Float64 sampleRate;
+
+    // Get sample rate
+    outSize =  sizeof(Float64);
+    err = AudioDeviceGetProperty(inDevice, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outSize, &sampleRate);
+    if (err != noErr) {
+        jack_error("Cannot get current sample rate");
+        printError(err);
+        return -1;
+    } else {
+        jack_log("Current sample rate = %f", sampleRate);
+    }
+
+    // If needed, set new sample rate
+    if (samplerate != (jack_nframes_t)sampleRate) {
+        sampleRate = (Float64)samplerate;
+
+        // To get SR change notification
+        err = AudioDeviceAddPropertyListener(inDevice, 0, true, kAudioDevicePropertyNominalSampleRate, SRNotificationCallback, this);
+        if (err != noErr) {
+            jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyNominalSampleRate");
+            printError(err);
+            return -1;
+        }
+        err = AudioDeviceSetProperty(inDevice, NULL, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, outSize, &sampleRate);
+        if (err != noErr) {
+            jack_error("Cannot set sample rate = %ld", samplerate);
+            printError(err);
+            return -1;
+        }
+
+        // Waiting for SR change notification
+        int count = 0;
+        while (!fState && count++ < WAIT_COUNTER) {
+            usleep(100000);
+            jack_log("Wait count = %d", count);
+        }
+        
+        // Check new sample rate
+        outSize =  sizeof(Float64);
+        err = AudioDeviceGetProperty(inDevice, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyNominalSampleRate, &outSize, &sampleRate);
+        if (err != noErr) {
+            jack_error("Cannot get current sample rate");
+            printError(err);
+        } else {
+            jack_log("Checked sample rate = %f", sampleRate);
+        }
+
+        // Remove SR change notification
+        AudioDeviceRemovePropertyListener(inDevice, 0, true, kAudioDevicePropertyNominalSampleRate, SRNotificationCallback);
+    }
+
+    return 0;
+}
+
+int JackCoreAudioDriver::OpenAUHAL(bool capturing,
+                                   bool playing,
+                                   int inchannels,
+                                   int outchannels,
+                                   int in_nChannels,
+                                   int out_nChannels,
+                                   jack_nframes_t buffer_size,
+                                   jack_nframes_t samplerate)
+{
+    ComponentResult err1;
+    UInt32 enableIO;
+    AudioStreamBasicDescription srcFormat, dstFormat;
+    AudioDeviceID currAudioDeviceID;
+    UInt32 size;
+
+    jack_log("OpenAUHAL capturing = %d playing = %d inchannels = %d outchannels = %d in_nChannels = %d out_nChannels = %d", capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels);
+
+    if (inchannels == 0 && outchannels == 0) {
+        jack_error("No input and output channels...");
+        return -1;
+    }
+         
+    // AUHAL
+    ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0};
+    Component HALOutput = FindNextComponent(NULL, &cd);
+
+    err1 = OpenAComponent(HALOutput, &fAUHAL);
+    if (err1 != noErr) {
+        jack_error("Error calling OpenAComponent");
+        printError(err1);
+        goto error;
+    }
+
+    err1 = AudioUnitInitialize(fAUHAL);
+    if (err1 != noErr) {
+        jack_error("Cannot initialize AUHAL unit");
+        printError(err1);
+        goto error;
+    }
+
+    // Start I/O
+    if (capturing && inchannels > 0) {
+        enableIO = 1;
+        jack_log("Setup AUHAL input on");
+    } else {
+        enableIO = 0;
+        jack_log("Setup AUHAL input off");
+    }
+    
+    err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(enableIO));
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input");
+        printError(err1);
+        goto error;
+    }
+
+    if (playing && outchannels > 0) {
+        enableIO = 1;
+        jack_log("Setup AUHAL output on");
+    } else {
+        enableIO = 0;
+        jack_log("Setup AUHAL output off");
+    }
+    
+    err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(enableIO));
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_EnableIO,kAudioUnitScope_Output");
+        printError(err1);
+        goto error;
+    }
+    
+    size = sizeof(AudioDeviceID);
+    err1 = AudioUnitGetProperty(fAUHAL, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &currAudioDeviceID, &size);
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitGetProperty - kAudioOutputUnitProperty_CurrentDevice");
+        printError(err1);
+        goto error;
+    } else {
+        jack_log("AudioUnitGetPropertyCurrentDevice = %d", currAudioDeviceID);
+    }
+
+    // Setup up choosen device, in both input and output cases
+    err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &fDeviceID, sizeof(AudioDeviceID));
+    if (err1 != noErr) {
+        jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_CurrentDevice");
+        printError(err1);
+        goto error;
+    }
+  
+    // Set buffer size
+    if (capturing && inchannels > 0) {
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 1, (UInt32*)&buffer_size, sizeof(UInt32));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_MaximumFramesPerSlice");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    if (playing && outchannels > 0) {
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, (UInt32*)&buffer_size, sizeof(UInt32));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_MaximumFramesPerSlice");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    // Setup channel map
+    if (capturing && inchannels > 0 && inchannels < in_nChannels) {
+        SInt32 chanArr[in_nChannels];
+        for (int i = 0; i < in_nChannels; i++) {
+            chanArr[i] = -1;
+        }
+        for (int i = 0; i < inchannels; i++) {
+            chanArr[i] = i;
+        }
+        AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap , kAudioUnitScope_Input, 1, chanArr, sizeof(SInt32) * in_nChannels);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 1");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    if (playing && outchannels > 0 && outchannels < out_nChannels) {
+        SInt32 chanArr[out_nChannels];
+        for (int i = 0;	i < out_nChannels; i++) {
+            chanArr[i] = -1;
+        }
+        for (int i = 0; i < outchannels; i++) {
+            chanArr[i] = i;
+        }
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, chanArr, sizeof(SInt32) * out_nChannels);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 0");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    // Setup stream converters
+    if (capturing && inchannels > 0) {
+    
+        size = sizeof(AudioStreamBasicDescription);
+        err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &srcFormat, &size);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
+            printError(err1);
+            goto error;
+        }
+        PrintStreamDesc(&srcFormat);
+              
+        jack_log("Setup AUHAL input stream converter SR = %ld", samplerate);
+        srcFormat.mSampleRate = samplerate;
+        srcFormat.mFormatID = kAudioFormatLinearPCM;
+        srcFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
+        srcFormat.mBytesPerPacket = sizeof(float);
+        srcFormat.mFramesPerPacket = 1;
+        srcFormat.mBytesPerFrame = sizeof(float);
+        srcFormat.mChannelsPerFrame = inchannels;
+        srcFormat.mBitsPerChannel = 32;
+        PrintStreamDesc(&srcFormat);
+      
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &srcFormat, sizeof(AudioStreamBasicDescription));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    if (playing && outchannels > 0) {
+    
+        size = sizeof(AudioStreamBasicDescription);
+        err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &dstFormat, &size);
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
+            printError(err1);
+            goto error;
+        }
+        PrintStreamDesc(&dstFormat);
+         
+        jack_log("Setup AUHAL output stream converter SR = %ld", samplerate);
+        dstFormat.mSampleRate = samplerate;
+        dstFormat.mFormatID = kAudioFormatLinearPCM;
+        dstFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
+        dstFormat.mBytesPerPacket = sizeof(float);
+        dstFormat.mFramesPerPacket = 1;
+        dstFormat.mBytesPerFrame = sizeof(float);
+        dstFormat.mChannelsPerFrame = outchannels;
+        dstFormat.mBitsPerChannel = 32;
+        PrintStreamDesc(&dstFormat);
+       
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &dstFormat, sizeof(AudioStreamBasicDescription));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    // Setup callbacks
+    if (inchannels > 0 && outchannels == 0) {
+        AURenderCallbackStruct output;
+        output.inputProc = Render;
+        output.inputProcRefCon = this;
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &output, sizeof(output));
+        if (err1 != noErr) {
+            jack_error("Error calling  AudioUnitSetProperty - kAudioUnitProperty_SetRenderCallback 1");
+            printError(err1);
+            goto error;
+        }
+    } else {
+        AURenderCallbackStruct output;
+        output.inputProc = Render;
+        output.inputProcRefCon = this;
+        err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &output, sizeof(output));
+        if (err1 != noErr) {
+            jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_SetRenderCallback 0");
+            printError(err1);
+            goto error;
+        }
+    }
+
+    return 0;
+    
+error:
+    CloseAUHAL();
+    return -1;
+}
+
+int JackCoreAudioDriver::SetupBuffers(int inchannels)
+{
+    // Prepare buffers
+    fJackInputData = (AudioBufferList*)malloc(sizeof(UInt32) + inchannels * sizeof(AudioBuffer));
+    fJackInputData->mNumberBuffers = inchannels;
+    for (int i = 0; i < fCaptureChannels; i++) {
+        fJackInputData->mBuffers[i].mNumberChannels = 1;
+        fJackInputData->mBuffers[i].mDataByteSize = fEngineControl->fBufferSize * sizeof(float);
+    }
+    return 0;
+}
+
+void JackCoreAudioDriver::DisposeBuffers()
+{
+    if (fJackInputData) {
+        free(fJackInputData);
+        fJackInputData = 0;
+    }
+}
+
+void JackCoreAudioDriver::CloseAUHAL()
+{
+    AudioUnitUninitialize(fAUHAL);
+    CloseComponent(fAUHAL);
+}
+
+int JackCoreAudioDriver::AddListeners()
+{
+    OSStatus err = noErr;
+
+    // Add listeners
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDeviceProcessorOverload, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDeviceProcessorOverload");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioHardwarePropertyDevices, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioHardwarePropertyDevices");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDevicePropertyNominalSampleRate, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyNominalSampleRate");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDevicePropertyDeviceIsRunning, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyDeviceIsRunning");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, true, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyStreamConfiguration");
+        printError(err);
+        return -1;
+    }
+
+    err = AudioDeviceAddPropertyListener(fDeviceID, 0, false, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback, this);
+    if (err != noErr) {
+        jack_error("Error calling AudioDeviceAddPropertyListener with kAudioDevicePropertyStreamConfiguration");
+        printError(err);
+        return -1;
+    }
+
+    if (!fEngineControl->fSyncMode && fIOUsage != 1.f) {
+        UInt32 outSize = sizeof(float);
+        err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false, kAudioDevicePropertyIOCycleUsage, outSize, &fIOUsage);
+        if (err != noErr) {
+            jack_error("Error calling AudioDeviceSetProperty kAudioDevicePropertyIOCycleUsage");
+            printError(err);
+        }
+    }
+
+    return 0;
+}
+
+void JackCoreAudioDriver::RemoveListeners()
+{
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDeviceProcessorOverload, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioHardwarePropertyDevices, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDevicePropertyNominalSampleRate, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDevicePropertyDeviceIsRunning, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, true, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback);
+    AudioDeviceRemovePropertyListener(fDeviceID, 0, false, kAudioDevicePropertyStreamConfiguration, DeviceNotificationCallback);
+}
+
+int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,
+                              jack_nframes_t samplerate,
+                              bool capturing,
+                              bool playing,
+                              int inchannels,
+                              int outchannels,
+                              bool monitor,
+                              const char* capture_driver_uid,
+                              const char* playback_driver_uid,
+                              jack_nframes_t capture_latency,
+                              jack_nframes_t playback_latency,
+                              int async_output_latency,
+                              int computation_grain,
+                              bool hogged,
+                              bool clock_drift)
+{
+    int in_nChannels = 0;
+    int out_nChannels = 0;
+    char capture_driver_name[256];
+    char playback_driver_name[256];
+
+    // Keep initial state
+    fCapturing = capturing;
+    fPlaying = playing;
+    fInChannels = inchannels;
+    fOutChannels = outchannels;
+    fMonitor = monitor;
+    strcpy(fCaptureUID, capture_driver_uid);
+    strcpy(fPlaybackUID, playback_driver_uid);
+    fCaptureLatency = capture_latency;
+    fPlaybackLatency = playback_latency;
+    fIOUsage = float(async_output_latency) / 100.f;
+    fComputationGrain = float(computation_grain) / 100.f;
+    fHogged = hogged;
+    fClockDriftCompensate = clock_drift;
+    
+    SInt32 major;
+    SInt32 minor;
+    Gestalt(gestaltSystemVersionMajor, &major);
+    Gestalt(gestaltSystemVersionMinor, &minor);
+    
+    // Starting with 10.6 systems, the HAL notification thread is created internally
+    if (major == 10 && minor >= 6) {
+        CFRunLoopRef theRunLoop = NULL;
+        AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+        OSStatus osErr = AudioObjectSetPropertyData (kAudioObjectSystemObject, &theAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);
+        if (osErr != noErr) {
+            jack_error("JackCoreAudioDriver::Open kAudioHardwarePropertyRunLoop error");
+            printError(osErr);
+        }
+    }
+
+    if (SetupDevices(capture_driver_uid, playback_driver_uid, capture_driver_name, playback_driver_name, samplerate) < 0)
+        goto error;
+
+    // Generic JackAudioDriver Open
+    if (JackAudioDriver::Open(buffer_size, samplerate, capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency) != 0)
+        goto error;
+
+    if (SetupChannels(capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels, true) < 0)
+        goto error;
+
+    if (SetupBufferSize(buffer_size) < 0)
+        goto error;
+        
+    if (SetupSampleRate(samplerate) < 0)
+        goto error;
+ 
+    if (OpenAUHAL(capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels, buffer_size, samplerate) < 0)
+        goto error;
+
+    if (capturing && inchannels > 0)
+        if (SetupBuffers(inchannels) < 0)
+            goto error;
+
+    if (AddListeners() < 0)
+        goto error;
+  
+    // Core driver may have changed the in/out values
+    fCaptureChannels = inchannels;
+    fPlaybackChannels = outchannels;
+    return noErr;
+
+error:
+    Close();
+    return -1;
+}
+
+int JackCoreAudioDriver::Close()
+{
+    jack_log("JackCoreAudioDriver::Close");
+    Stop();
+    JackAudioDriver::Close();
+    RemoveListeners();
+    DisposeBuffers();
+    CloseAUHAL();
+    DestroyAggregateDevice();
+    return 0;
+}
+
+int JackCoreAudioDriver::Attach()
+{
+    OSStatus err;
+    JackPort* port;
+    jack_port_id_t port_index;
+    UInt32 size;
+    Boolean isWritable;
+    char channel_name[64];
+    char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+ 
+    jack_log("JackCoreAudioDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    for (int i = 0; i < fCaptureChannels; i++) {
+
+        err = AudioDeviceGetPropertyInfo(fDeviceID, i + 1, true, kAudioDevicePropertyChannelName, &size, &isWritable);
+        if (err != noErr)
+            jack_log("AudioDeviceGetPropertyInfo kAudioDevicePropertyChannelName error ");
+        if (err == noErr && size > 0) {
+            err = AudioDeviceGetProperty(fDeviceID, i + 1, true, kAudioDevicePropertyChannelName, &size, channel_name);
+            if (err != noErr)
+                jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error ");
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:out_%s%u", fAliasName, fCaptureDriverName, channel_name, i + 1);
+        } else {
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:out%u", fAliasName, fCaptureDriverName, i + 1);
+        }
+
+        snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
+
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("Cannot register port for %s", name);
+            return -1;
+        }
+
+        size = sizeof(UInt32);
+        UInt32 value1 = 0;
+        UInt32 value2 = 0;
+        err = AudioDeviceGetProperty(fDeviceID, 0, true, kAudioDevicePropertyLatency, &size, &value1);
+        if (err != noErr)
+            jack_log("AudioDeviceGetProperty kAudioDevicePropertyLatency error ");
+        err = AudioDeviceGetProperty(fDeviceID, 0, true, kAudioDevicePropertySafetyOffset, &size, &value2);
+        if (err != noErr)
+            jack_log("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error ");
+
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fCaptureLatency);
+        fCapturePortList[i] = port_index;
+    }
+
+    for (int i = 0; i < fPlaybackChannels; i++) {
+
+        err = AudioDeviceGetPropertyInfo(fDeviceID, i + 1, false, kAudioDevicePropertyChannelName, &size, &isWritable);
+        if (err != noErr)
+            jack_log("AudioDeviceGetPropertyInfo kAudioDevicePropertyChannelName error ");
+        if (err == noErr && size > 0) {
+            err = AudioDeviceGetProperty(fDeviceID, i + 1, false, kAudioDevicePropertyChannelName, &size, channel_name);
+            if (err != noErr)
+                jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error ");
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:in_%s%u", fAliasName, fPlaybackDriverName, channel_name, i + 1);
+        } else {
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:in%u", fAliasName, fPlaybackDriverName, i + 1);
+        }
+
+        snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
+
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("Cannot register port for %s", name);
+            return -1;
+        }
+
+        size = sizeof(UInt32);
+        UInt32 value1 = 0;
+        UInt32 value2 = 0;
+        err = AudioDeviceGetProperty(fDeviceID, 0, false, kAudioDevicePropertyLatency, &size, &value1);
+        if (err != noErr)
+            jack_log("AudioDeviceGetProperty kAudioDevicePropertyLatency error ");
+        err = AudioDeviceGetProperty(fDeviceID, 0, false, kAudioDevicePropertySafetyOffset, &size, &value2);
+        if (err != noErr)
+            jack_log("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error ");
+
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        // Add more latency if "async" mode is used...
+        port->SetLatency(fEngineControl->fBufferSize + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize * fIOUsage) + value1 + value2 + fPlaybackLatency);
+        fPlaybackPortList[i] = port_index;
+
+        // Monitor ports
+        if (fWithMonitorPorts) {
+            jack_log("Create monitor port ");
+            snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
+            if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+                jack_error("Cannot register monitor port for %s", name);
+                return -1;
+            } else {
+                port = fGraphManager->GetPort(port_index);
+                port->SetAlias(alias);
+                port->SetLatency(fEngineControl->fBufferSize);
+                fMonitorPortList[i] = port_index;
+            }
+        }
+    }
+
+    // Input buffers do no change : prepare them only once
+    for (int i = 0; i < fCaptureChannels; i++) {
+        fJackInputData->mBuffers[i].mData = GetInputBuffer(i);
+    }
+
+    return 0;
+}
+
+int JackCoreAudioDriver::Start()
+{
+    jack_log("JackCoreAudioDriver::Start");
+    JackAudioDriver::Start();
+/*
+#ifdef MAC_OS_X_VERSION_10_5
+    OSStatus err = AudioDeviceCreateIOProcID(fDeviceID, MeasureCallback, this, &fMesureCallbackID);
+#else
+    OSStatus err = AudioDeviceAddIOProc(fDeviceID, MeasureCallback, this);
+#endif
+*/
+    OSStatus err = AudioDeviceAddIOProc(fDeviceID, MeasureCallback, this);
+    
+    if (err != noErr)
+        return -1;
+
+    err = AudioOutputUnitStart(fAUHAL);
+    if (err != noErr)
+        return -1;
+
+    if ((err = AudioDeviceStart(fDeviceID, MeasureCallback)) != noErr) {
+        jack_error("Cannot start MeasureCallback");
+        printError(err);
+        return -1;
+    }
+    
+    // Waiting for Measure callback to be called (= driver has started)
+    fState = false;
+    int count = 0;
+    while (!fState && count++ < WAIT_COUNTER) {
+        usleep(100000);
+        jack_log("JackCoreAudioDriver::Start wait count = %d", count);
+    }
+    
+    if (count < WAIT_COUNTER) {
+        jack_info("CoreAudio driver is running...");
+        return 0;
+    } else {
+        jack_error("CoreAudio driver cannot start...");
+        return -1;
+    }
+}
+
+int JackCoreAudioDriver::Stop()
+{
+    jack_log("JackCoreAudioDriver::Stop");
+    AudioDeviceStop(fDeviceID, MeasureCallback);
+/*
+#ifdef MAC_OS_X_VERSION_10_5
+    AudioDeviceDestroyIOProcID(fDeviceID, fMesureCallbackID);
+#else
+    AudioDeviceRemoveIOProc(fDeviceID, MeasureCallback);
+#endif
+*/
+    AudioDeviceRemoveIOProc(fDeviceID, MeasureCallback);
+    return (AudioOutputUnitStop(fAUHAL) == noErr) ? 0 : -1;
+}
+
+int JackCoreAudioDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    OSStatus err;
+    UInt32 outSize = sizeof(UInt32);
+
+    err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false, kAudioDevicePropertyBufferFrameSize, outSize, &buffer_size);
+    if (err != noErr) {
+        jack_error("Cannot set buffer size %ld", buffer_size);
+        printError(err);
+        return -1;
+    }
+
+    JackAudioDriver::SetBufferSize(buffer_size); // never fails
+
+    // Input buffers do no change : prepare them only once
+    for (int i = 0; i < fCaptureChannels; i++) {
+        fJackInputData->mBuffers[i].mNumberChannels = 1;
+        fJackInputData->mBuffers[i].mDataByteSize = fEngineControl->fBufferSize * sizeof(float);
+        fJackInputData->mBuffers[i].mData = GetInputBuffer(i);
+    }
+
+    return 0;
+}
+
+bool JackCoreAudioDriver::TakeHogAux(AudioDeviceID deviceID, bool isInput)
+{
+    pid_t hog_pid;
+    OSStatus err;
+
+    UInt32 propSize = sizeof(hog_pid);
+    err = AudioDeviceGetProperty(deviceID, 0, isInput, kAudioDevicePropertyHogMode, &propSize, &hog_pid);
+    if (err) {
+        jack_error("Cannot read hog state...");
+        printError(err);
+    }
+
+    if (hog_pid != getpid()) {
+        hog_pid = getpid();
+        err = AudioDeviceSetProperty(deviceID, 0, 0, isInput, kAudioDevicePropertyHogMode, propSize, &hog_pid);
+        if (err != noErr) {
+            jack_error("Can't hog device = %d because it's being hogged by another program or cannot be hogged", deviceID);
+            return false;
+        }
+    }
+    
+    return true;
+}
+    
+bool JackCoreAudioDriver::TakeHog()
+{
+    OSStatus err = noErr;
+    AudioObjectID sub_device[32];
+    UInt32 outSize = sizeof(sub_device);
+    err = AudioDeviceGetProperty(fDeviceID, 0, kAudioDeviceSectionGlobal, kAudioAggregateDevicePropertyActiveSubDeviceList, &outSize, sub_device);
+    
+    if (err != noErr) {
+        jack_log("Device does not have subdevices");
+        return TakeHogAux(fDeviceID, true);
+    } else {
+        int num_devices = outSize / sizeof(AudioObjectID);
+        jack_log("Device does has %d subdevices", num_devices);
+        for (int i = 0; i < num_devices; i++) {
+            if (!TakeHogAux(sub_device[i], true)) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
+    
+bool JackCoreAudioDriver::IsAggregateDevice(AudioDeviceID device)
+{
+    UInt32 deviceType, outSize = sizeof(UInt32);
+    OSStatus err = AudioDeviceGetProperty(device, 0, kAudioDeviceSectionGlobal, kAudioDevicePropertyTransportType, &outSize, &deviceType);
+    
+    if (err != noErr) {
+        jack_log("JackCoreAudioDriver::IsAggregateDevice kAudioDevicePropertyTransportType error");
+        return false;
+    } else {
+        return (deviceType == kAudioDeviceTransportTypeAggregate);
+    }
+}
+
+
+} // end of namespace
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor() 
+    {
+        jack_driver_desc_t *desc;
+        unsigned int i;
+        desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+        strcpy(desc->name, "coreaudio");                                    // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Apple CoreAudio API based audio backend");      // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+        
+        desc->nparams = 17;
+        desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy(desc->params[i].name, "channels");
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = -1;
+        strcpy(desc->params[i].short_desc, "Maximum number of channels");
+        strcpy(desc->params[i].long_desc, "Maximum number of channels. If -1, max possible number of channels will be used");
+
+        i++;
+        strcpy(desc->params[i].name, "inchannels");
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = -1;
+        strcpy(desc->params[i].short_desc, "Maximum number of input channels");
+        strcpy(desc->params[i].long_desc, "Maximum number of input channels. If -1, max possible number of input channels will be used");
+
+        i++;
+        strcpy(desc->params[i].name, "outchannels");
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = -1;
+        strcpy(desc->params[i].short_desc, "Maximum number of output channels");
+        strcpy(desc->params[i].long_desc, "Maximum number of output channels. If -1, max possible number of output channels will be used");
+
+        i++;
+        strcpy(desc->params[i].name, "capture");
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].short_desc, "Input CoreAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "playback");
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].short_desc, "Output CoreAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy (desc->params[i].name, "monitor");
+        desc->params[i].character = 'm';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Provide monitor ports for the output");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "duplex");
+        desc->params[i].character = 'D';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = TRUE;
+        strcpy(desc->params[i].short_desc, "Provide both capture and playback ports");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "rate");
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 44100U;
+        strcpy(desc->params[i].short_desc, "Sample rate");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "period");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 128U;
+        strcpy(desc->params[i].short_desc, "Frames per period");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "device");
+        desc->params[i].character = 'd';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].short_desc, "CoreAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "input-latency");
+        desc->params[i].character = 'I';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Extra input latency (frames)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "output-latency");
+        desc->params[i].character = 'O';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Extra output latency (frames)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "list-devices");
+        desc->params[i].character = 'l';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Display available CoreAudio devices");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "hog");
+        desc->params[i].character = 'H';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Take exclusive access of the audio device");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "async-latency");
+        desc->params[i].character = 'L';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 100;
+        strcpy(desc->params[i].short_desc, "Extra output latency in asynchronous mode (percent)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "grain");
+        desc->params[i].character = 'G';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 100;
+        strcpy(desc->params[i].short_desc, "Computation grain in RT thread (percent)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "clock-drift");
+        desc->params[i].character = 's';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = FALSE;
+        strcpy(desc->params[i].short_desc, "Clock drift compensation");
+        strcpy(desc->params[i].long_desc, "Whether to compensate clock drift in dynamically created aggregate device");
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) 
+    {
+        jack_nframes_t srate = 44100;
+        jack_nframes_t frames_per_interrupt = 128;
+        bool capture = false;
+        bool playback = false;
+        int chan_in = -1;   // Default: if not explicitely set, then max possible will be used...
+        int chan_out = -1;  // Default: ifà not explicitely set, then max possible will be used...
+        bool monitor = false;
+        const char* capture_driver_uid = "";
+        const char* playback_driver_uid = "";
+        const JSList *node;
+        const jack_driver_param_t *param;
+        jack_nframes_t systemic_input_latency = 0;
+        jack_nframes_t systemic_output_latency = 0;
+        int async_output_latency = 100;
+        int computation_grain = -1;
+        bool hogged = false;
+        bool clock_drift = false;
+    
+        for (node = params; node; node = jack_slist_next(node)) {
+            param = (const jack_driver_param_t *) node->data;
+       
+            switch (param->character) {
+
+                case 'd':
+                    capture_driver_uid = strdup(param->value.str);
+                    playback_driver_uid = strdup(param->value.str);
+                    break;
+
+                case 'D':
+                    capture = true;
+                    playback = true;
+                    break;
+
+                case 'c':
+                    chan_in = chan_out = (int)param->value.ui;
+                    break;
+
+                case 'i':
+                    chan_in = (int)param->value.ui;
+                    break;
+
+                case 'o':
+                    chan_out = (int)param->value.ui;
+                    break;
+
+                case 'C':
+                    capture = true;
+                    if (strcmp(param->value.str, "none") != 0) {
+                        capture_driver_uid = strdup(param->value.str);
+                    }
+                    break;
+
+                case 'P':
+                    playback = true;
+                    if (strcmp(param->value.str, "none") != 0) {
+                        playback_driver_uid = strdup(param->value.str);
+                    }
+                    break;
+
+                case 'm':
+                    monitor = param->value.i;
+                    break;
+
+                case 'r':
+                    srate = param->value.ui;
+                    break;
+
+                case 'p':
+                    frames_per_interrupt = (unsigned int)param->value.ui;
+                    break;
+
+                case 'I':
+                    systemic_input_latency = param->value.ui;
+                    break;
+
+                case 'O':
+                    systemic_output_latency = param->value.ui;
+                    break;
+
+                case 'l':
+                    Jack::DisplayDeviceNames();
+                    break;
+                    
+                case 'H':
+                    hogged = true;
+                    break;
+                    
+                case 'L':
+                    async_output_latency = param->value.ui;
+                    break;
+                    
+                case 'G':
+                    computation_grain = param->value.ui;
+                    break;
+                    
+                case 's':
+                    clock_drift = true;
+                    break;
+            }
+        }
+
+        /* duplex is the default */
+        if (!capture && !playback) {
+            capture = true;
+            playback = true;
+        }
+
+        Jack::JackCoreAudioDriver* driver = new Jack::JackCoreAudioDriver("system", "coreaudio", engine, table);
+        if (driver->Open(frames_per_interrupt, srate, capture, playback, chan_in, chan_out, monitor, capture_driver_uid, 
+            playback_driver_uid, systemic_input_latency, systemic_output_latency, async_output_latency, computation_grain, hogged, clock_drift) == 0) {
+            return driver;
+        } else {
+            delete driver;
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/macosx/coreaudio/JackCoreAudioDriver.h b/macosx/coreaudio/JackCoreAudioDriver.h
new file mode 100644
index 0000000..f17bbf1
--- /dev/null
+++ b/macosx/coreaudio/JackCoreAudioDriver.h
@@ -0,0 +1,210 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackCoreAudioDriver__
+#define __JackCoreAudioDriver__
+
+#include <AudioToolbox/AudioConverter.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioUnit/AudioUnit.h>
+#include "JackAudioDriver.h"
+#include "JackTime.h"
+
+#include <vector>
+
+using namespace std;
+
+namespace Jack
+{
+
+#define kVersion 102
+
+typedef	UInt8	CAAudioHardwareDeviceSectionID;
+#define	kAudioDeviceSectionInput	((CAAudioHardwareDeviceSectionID)0x01)
+#define	kAudioDeviceSectionOutput	((CAAudioHardwareDeviceSectionID)0x00)
+#define	kAudioDeviceSectionGlobal	((CAAudioHardwareDeviceSectionID)0x00)
+#define	kAudioDeviceSectionWildcard	((CAAudioHardwareDeviceSectionID)0xFF)
+    
+#define WAIT_COUNTER 60
+
+/*!
+\brief The CoreAudio driver.
+
+\todo hardware monitoring
+*/
+
+class JackCoreAudioDriver : public JackAudioDriver
+{
+
+    private:
+
+        AudioUnit fAUHAL;
+
+        AudioBufferList* fJackInputData;
+        AudioBufferList* fDriverOutputData;
+
+        AudioDeviceID fDeviceID;    // Used "duplex" device
+        AudioObjectID fPluginID;    // Used for aggregate device
+
+        AudioUnitRenderActionFlags* fActionFags;
+        AudioTimeStamp* fCurrentTime;
+
+        bool fState;
+        bool fHogged;
+
+        // Initial state
+        bool fCapturing;
+        bool fPlaying;
+
+        int fInChannels;
+        int fOutChannels;
+
+        char fCaptureUID[256];
+        char fPlaybackUID[256];
+
+        bool fMonitor;
+        float fIOUsage;
+        float fComputationGrain;
+        bool fClockDriftCompensate;
+    
+        /*    
+    #ifdef MAC_OS_X_VERSION_10_5
+        AudioDeviceIOProcID fMesureCallbackID;
+    #endif
+        */
+    
+        static	OSStatus Render(void *inRefCon,
+                               AudioUnitRenderActionFlags *ioActionFlags,
+                               const AudioTimeStamp *inTimeStamp,
+                               UInt32 inBusNumber,
+                               UInt32 inNumberFrames,
+                               AudioBufferList *ioData);
+
+        static OSStatus MeasureCallback(AudioDeviceID inDevice,
+                                        const AudioTimeStamp* inNow,
+                                        const AudioBufferList* inInputData,
+                                        const AudioTimeStamp* inInputTime,
+                                        AudioBufferList* outOutputData,
+                                        const AudioTimeStamp* inOutputTime,
+                                        void* inClientData);
+
+        static OSStatus DeviceNotificationCallback(AudioDeviceID inDevice,
+                UInt32 inChannel,
+                Boolean	isInput,
+                AudioDevicePropertyID inPropertyID,
+                void* inClientData);
+
+        static OSStatus SRNotificationCallback(AudioDeviceID inDevice,
+                                               UInt32 inChannel,
+                                               Boolean	isInput,
+                                               AudioDevicePropertyID inPropertyID,
+                                               void* inClientData);
+
+        OSStatus GetDeviceIDFromUID(const char* UID, AudioDeviceID* id);
+        OSStatus GetDefaultDevice(AudioDeviceID* id);
+        OSStatus GetDefaultInputDevice(AudioDeviceID* id);
+        OSStatus GetDefaultOutputDevice(AudioDeviceID* id);
+        OSStatus GetDeviceNameFromID(AudioDeviceID id, char* name);
+        OSStatus GetTotalChannels(AudioDeviceID device, int& channelCount, bool isInput);
+   
+        // Setup
+        OSStatus CreateAggregateDevice(AudioDeviceID captureDeviceID, AudioDeviceID playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice);
+        OSStatus CreateAggregateDeviceAux(vector<AudioDeviceID> captureDeviceID, vector<AudioDeviceID> playbackDeviceID, jack_nframes_t samplerate, AudioDeviceID* outAggregateDevice);
+        OSStatus DestroyAggregateDevice();
+        bool IsAggregateDevice(AudioDeviceID device);
+        
+        int SetupDevices(const char* capture_driver_uid,
+                         const char* playback_driver_uid,
+                         char* capture_driver_name,
+                         char* playback_driver_name,
+                         jack_nframes_t samplerate);
+
+        int SetupChannels(bool capturing,
+                          bool playing,
+                          int& inchannels,
+                          int& outchannels,
+                          int& in_nChannels,
+                          int& out_nChannels,
+                          bool strict);
+
+        int SetupBuffers(int inchannels);
+        void DisposeBuffers();
+
+        int SetupBufferSize(jack_nframes_t buffer_size);
+        int SetupSampleRate(jack_nframes_t samplerate);
+        int SetupSampleRateAux(AudioDeviceID inDevice, jack_nframes_t samplerate);
+
+        int OpenAUHAL(bool capturing,
+                      bool playing,
+                      int inchannels,
+                      int outchannels,
+                      int in_nChannels,
+                      int out_nChannels,
+                      jack_nframes_t nframes,
+                      jack_nframes_t samplerate);
+        void CloseAUHAL();
+
+        int AddListeners();
+        void RemoveListeners();
+        
+        bool TakeHogAux(AudioDeviceID deviceID, bool isInput);
+        bool TakeHog();
+
+    public:
+
+        JackCoreAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        virtual ~JackCoreAudioDriver();
+
+        int Open(jack_nframes_t buffer_size,
+                 jack_nframes_t samplerate,
+                 bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency,
+                 int async_output_latency,
+                 int computation_grain,
+                 bool hogged,
+                 bool clock_drift);
+        int Close();
+
+        int Attach();
+
+        int Start();
+        int Stop();
+
+        int Read();
+        int Write();
+
+        // BufferSize can be changed
+        bool IsFixedBufferSize()
+        {
+            return false;
+        }
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+};
+
+} // end of namespace
+
+#endif
diff --git a/macosx/coremidi/JackCoreMidiDriver.cpp b/macosx/coremidi/JackCoreMidiDriver.cpp
new file mode 100644
index 0000000..0f52e90
--- /dev/null
+++ b/macosx/coremidi/JackCoreMidiDriver.cpp
@@ -0,0 +1,421 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackCoreMidiDriver.h"
+#include "JackGraphManager.h"
+#include "JackServer.h"
+#include "JackEngineControl.h"
+#include "JackDriverLoader.h"
+
+#include <mach/mach_time.h>
+#include <assert.h>
+#include <iostream>
+#include <sstream>
+#include <string>
+
+namespace Jack
+{
+
+static MIDITimeStamp MIDIGetCurrentHostTime()
+{
+	return mach_absolute_time();
+}
+
+void JackCoreMidiDriver::ReadProcAux(const MIDIPacketList *pktlist, jack_ringbuffer_t* ringbuffer)
+{
+    // Write the number of packets
+    size_t size = jack_ringbuffer_write(ringbuffer, (char*)&pktlist->numPackets, sizeof(UInt32));
+    if (size != sizeof(UInt32)) {
+        jack_error("ReadProc : ring buffer is full, skip events...");
+        return;
+    }    
+    
+    for (unsigned int i = 0; i < pktlist->numPackets; ++i) {
+    
+        MIDIPacket *packet = (MIDIPacket *)pktlist->packet;
+        
+        // TODO : use timestamp
+        
+        // Check available size first..
+        size = jack_ringbuffer_write_space(ringbuffer);
+        if (size < (sizeof(UInt16) + packet->length)) {
+           jack_error("ReadProc : ring buffer is full, skip events...");
+           return;
+        }
+        // Write length of each packet first
+        jack_ringbuffer_write(ringbuffer, (char*)&packet->length, sizeof(UInt16));
+        // Write event actual data
+        jack_ringbuffer_write(ringbuffer, (char*)packet->data, packet->length);
+            
+        packet = MIDIPacketNext(packet);
+    }
+}
+
+void JackCoreMidiDriver::ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon)
+{
+    jack_ringbuffer_t* ringbuffer = (jack_ringbuffer_t*)connRefCon;
+    ReadProcAux(pktlist, ringbuffer);
+}
+
+void JackCoreMidiDriver::ReadVirtualProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon)
+{
+    jack_ringbuffer_t* ringbuffer = (jack_ringbuffer_t*)refCon;
+    ReadProcAux(pktlist, ringbuffer);
+}
+
+void JackCoreMidiDriver::NotifyProc(const MIDINotification *message, void *refCon)
+{
+	jack_info("NotifyProc %d", message->messageID);
+}
+
+JackCoreMidiDriver::JackCoreMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+    : JackMidiDriver(name, alias, engine, table), fMidiClient(NULL), fInputPort(NULL), fOutputPort(NULL), fRealCaptureChannels(0), fRealPlaybackChannels(0)
+{}
+
+JackCoreMidiDriver::~JackCoreMidiDriver()
+{}
+
+int JackCoreMidiDriver::Open(bool capturing,
+                             bool playing,
+                             int inchannels,
+                             int outchannels,
+                             bool monitor,
+                             const char* capture_driver_name,
+                             const char* playback_driver_name,
+                             jack_nframes_t capture_latency,
+                             jack_nframes_t playback_latency)
+                    {
+    OSStatus err;
+	CFStringRef coutputStr;
+	std::string str;
+    
+    // Get real input/output number
+    fRealCaptureChannels = MIDIGetNumberOfSources();
+    fRealPlaybackChannels = MIDIGetNumberOfDestinations();
+    
+    // Generic JackMidiDriver Open
+    if (JackMidiDriver::Open(capturing, playing, inchannels + fRealCaptureChannels, outchannels + fRealPlaybackChannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency) != 0)
+        return -1;
+    
+    coutputStr = CFStringCreateWithCString(0, "JackMidi", CFStringGetSystemEncoding());
+	err = MIDIClientCreate(coutputStr, NotifyProc, this, &fMidiClient);
+	CFRelease(coutputStr);
+	if (!fMidiClient) {
+        jack_error("Cannot create CoreMidi client");
+		goto error;
+	}
+    
+   	err = MIDIInputPortCreate(fMidiClient, CFSTR("Input port"), ReadProc, this, &fInputPort);
+   	if (!fInputPort) {
+		jack_error("Cannot open CoreMidi in port\n");
+		goto error;
+	}
+
+	err = MIDIOutputPortCreate(fMidiClient, CFSTR("Output port"), &fOutputPort);
+	if (!fOutputPort) {
+		jack_error("Cannot open CoreMidi out port\n");
+		goto error;
+	}
+  	
+    fMidiDestination = new MIDIEndpointRef[inchannels + fRealCaptureChannels];
+    assert(fMidiDestination);
+    
+    // Virtual input
+    for (int i = 0; i < inchannels; i++)  {
+        std::stringstream num;
+        num << i;
+        str = "JackMidi" + num.str();
+        coutputStr = CFStringCreateWithCString(0, str.c_str(), CFStringGetSystemEncoding());
+        err = MIDIDestinationCreate(fMidiClient, coutputStr, ReadVirtualProc, fRingBuffer[i], &fMidiDestination[i]);
+        CFRelease(coutputStr);
+        if (!fMidiDestination[i]) {
+            jack_error("Cannot create CoreMidi destination");
+            goto error;
+        }
+    }
+    
+    // Real input
+    for (int i = 0; i < fRealCaptureChannels; i++)  {
+        fMidiDestination[i + inchannels] = MIDIGetSource(i);
+        MIDIPortConnectSource(fInputPort, fMidiDestination[i + inchannels], fRingBuffer[i + inchannels]);
+    }
+	
+    fMidiSource = new MIDIEndpointRef[outchannels + fRealPlaybackChannels];
+    assert(fMidiSource);
+
+    // Virtual output
+    for (int i = 0; i < outchannels; i++)  {
+        std::stringstream num;
+        num << i;
+        str = "JackMidi" + num.str();
+        coutputStr = CFStringCreateWithCString(0, str.c_str(), CFStringGetSystemEncoding());
+        err = MIDISourceCreate(fMidiClient, coutputStr, &fMidiSource[i]);
+        CFRelease(coutputStr);
+        if (!fMidiSource[i]) {
+            jack_error("Cannot create CoreMidi source");
+            goto error;
+        }	
+    }
+    
+     // Real output
+    for (int i = 0; i < fRealPlaybackChannels; i++)  {
+        fMidiSource[i + outchannels] = MIDIGetDestination(i);
+    }
+ 
+    return 0;
+    
+error:
+    Close();
+	return -1;
+}
+         
+int JackCoreMidiDriver::Close()
+{
+    if (fInputPort)
+		 MIDIPortDispose(fInputPort);
+         
+    if (fOutputPort) 
+		MIDIPortDispose(fOutputPort);
+    
+    // Only dispose "virtual" endpoints
+    for (int i = 0; i < fCaptureChannels - fRealCaptureChannels; i++)  {
+        if (fMidiDestination)   
+            MIDIEndpointDispose(fMidiDestination[i]);
+    }
+    delete[] fMidiDestination;
+    
+    // Only dispose "virtual" endpoints
+    for (int i = 0; i < fPlaybackChannels - fRealPlaybackChannels; i++)  {
+        if (fMidiSource[i]) 
+            MIDIEndpointDispose(fMidiSource[i]);
+    }
+    delete[] fMidiSource;
+     
+	if (fMidiClient) 
+        MIDIClientDispose(fMidiClient);
+        
+    return 0;
+}
+
+int JackCoreMidiDriver::Attach()
+{
+    OSStatus err;
+    JackPort* port;
+    CFStringRef pname;
+    jack_port_id_t port_index;
+    char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char endpoint_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    int i;
+
+    jack_log("JackCoreMidiDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    for (i = 0; i < fCaptureChannels; i++) {
+    
+        err = MIDIObjectGetStringProperty(fMidiDestination[i], kMIDIPropertyName, &pname);
+        if (err == noErr) {
+            CFStringGetCString(pname, endpoint_name, sizeof(endpoint_name), 0);
+            CFRelease(pname);
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, endpoint_name, i + 1);
+        } else {
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
+        }
+        
+        snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        fCapturePortList[i] = port_index;
+        jack_log("JackCoreMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
+    }
+
+    for (i = 0; i < fPlaybackChannels; i++) {
+        
+        err = MIDIObjectGetStringProperty(fMidiSource[i], kMIDIPropertyName, &pname);
+        if (err == noErr) {
+            CFStringGetCString(pname, endpoint_name, sizeof(endpoint_name), 0);
+            CFRelease(pname);
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, endpoint_name, i + 1);
+        } else {
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
+        }
+        
+        snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        fPlaybackPortList[i] = port_index;
+        jack_log("JackCoreMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
+    }
+
+    return 0;
+}
+int JackCoreMidiDriver::Read()
+{
+    for (int chan = 0; chan < fCaptureChannels; chan++)  {
+    
+        if (fGraphManager->GetConnectionsNum(fCapturePortList[chan]) > 0) {
+        
+            // Get JACK port
+            JackMidiBuffer* midi_buffer = GetInputBuffer(chan);
+   
+            if (jack_ringbuffer_read_space(fRingBuffer[chan]) == 0) {
+                // Reset buffer
+                midi_buffer->Reset(midi_buffer->nframes);
+            } else {
+        
+                while (jack_ringbuffer_read_space(fRingBuffer[chan]) > 0) {
+            
+                    // Read event number
+                    int ev_count = 0;
+                    jack_ringbuffer_read(fRingBuffer[chan], (char*)&ev_count, sizeof(int));
+                
+                    for (int j = 0; j < ev_count; j++)  {
+                        // Read event length
+                        UInt16 event_len;
+                        jack_ringbuffer_read(fRingBuffer[chan], (char*)&event_len, sizeof(UInt16));
+                        // Read event actual data
+                        jack_midi_data_t* dest = midi_buffer->ReserveEvent(0, event_len);
+                        jack_ringbuffer_read(fRingBuffer[chan], (char*)dest, event_len);
+                    }
+                }
+            }
+            
+        } else {
+            // Consume ring buffer
+            jack_ringbuffer_read_advance(fRingBuffer[chan], jack_ringbuffer_read_space(fRingBuffer[chan]));
+        }
+    }
+    return 0;
+}
+
+int JackCoreMidiDriver::Write()
+{
+    MIDIPacketList* pktlist = (MIDIPacketList*)fMIDIBuffer;
+     
+    for (int chan = 0; chan < fPlaybackChannels; chan++)  {
+    
+         if (fGraphManager->GetConnectionsNum(fPlaybackPortList[chan]) > 0) {
+        
+            MIDIPacket* packet = MIDIPacketListInit(pktlist);
+            JackMidiBuffer* midi_buffer = GetOutputBuffer(chan);
+            
+            // TODO : use timestamp
+            
+            for (unsigned int j = 0; j < midi_buffer->event_count; j++) {
+                JackMidiEvent* ev = &midi_buffer->events[j];
+                packet = MIDIPacketListAdd(pktlist, sizeof(fMIDIBuffer), packet, MIDIGetCurrentHostTime(), ev->size, ev->GetData(midi_buffer));
+            }
+           
+            if (packet) {
+                if (chan < fPlaybackChannels - fRealPlaybackChannels) {
+                    OSStatus err = MIDIReceived(fMidiSource[chan], pktlist);
+                    if (err != noErr) 
+                        jack_error("MIDIReceived error");
+                } else {
+                    OSStatus err = MIDISend(fOutputPort, fMidiSource[chan], pktlist);
+                    if (err != noErr) 
+                        jack_error("MIDISend error");
+                }
+            }
+        }
+    }
+    
+    return 0;
+}
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor() 
+    {
+        jack_driver_desc_t * desc;
+        unsigned int i;
+
+        desc = (jack_driver_desc_t*)calloc (1, sizeof (jack_driver_desc_t));
+        strcpy(desc->name, "coremidi");                                     // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "Apple CoreMIDI API based MIDI backend");      // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 2;
+        desc->params = (jack_driver_param_desc_t*)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+        
+        i = 0;
+        strcpy(desc->params[i].name, "inchannels");
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "CoreMIDI virtual bus");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "outchannels");
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "CoreMIDI virtual bus");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) 
+    {
+        const JSList * node;
+        const jack_driver_param_t * param;
+        int virtual_in = 0;
+        int virtual_out = 0;
+
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (const jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+
+                case 'i':
+                    virtual_in = param->value.ui;
+                    break;
+
+                case 'o':
+                    virtual_out = param->value.ui;
+                    break;
+                }
+        }
+      
+        Jack::JackDriverClientInterface* driver = new Jack::JackCoreMidiDriver("system_midi", "coremidi", engine, table);
+        if (driver->Open(1, 1, virtual_in, virtual_out, false, "in", "out", 0, 0) == 0) {
+            return driver;
+        } else {
+            delete driver;
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/macosx/coremidi/JackCoreMidiDriver.h b/macosx/coremidi/JackCoreMidiDriver.h
new file mode 100644
index 0000000..190e9cd
--- /dev/null
+++ b/macosx/coremidi/JackCoreMidiDriver.h
@@ -0,0 +1,80 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackCoreMidiDriver__
+#define __JackCoreMidiDriver__
+
+#include <CoreMIDI/CoreMIDI.h>
+#include "JackMidiDriver.h"
+#include "JackTime.h"
+
+namespace Jack
+{
+
+/*!
+\brief The CoreMidi driver.
+*/
+
+class JackCoreMidiDriver : public JackMidiDriver
+{
+
+    private:
+
+        MIDIClientRef fMidiClient;
+        MIDIPortRef fInputPort;
+        MIDIPortRef fOutputPort;
+        MIDIEndpointRef* fMidiDestination;
+        MIDIEndpointRef* fMidiSource;
+        
+        char fMIDIBuffer[BUFFER_SIZE_MAX * sizeof(float)]; 
+        
+        int fRealCaptureChannels;
+        int fRealPlaybackChannels;
+         
+        static void ReadProcAux(const MIDIPacketList *pktlist, jack_ringbuffer_t* ringbuffer);
+        static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
+        static void ReadVirtualProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
+        static void NotifyProc(const MIDINotification *message, void *refCon);
+     
+    public:
+
+        JackCoreMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        virtual ~JackCoreMidiDriver();
+
+        int Open( bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency);
+        int Close();
+        
+        int Attach();
+
+        int Read();
+        int Write();
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/macosx/install_jackdmp b/macosx/install_jackdmp
new file mode 100755
index 0000000..e1c5007
--- /dev/null
+++ b/macosx/install_jackdmp
@@ -0,0 +1,39 @@
+# Install jackdmp and owerwrite jack installation
+
+# Plug-ins
+[ -d Panda.framework ] && sudo cp -r Panda.framework /Library/Frameworks
+[ -d JackRouter.plugin ] && sudo cp -r JackRouter.plugin /Library/Audio/Plug-Ins/HAL/
+
+# Copy libraries and exe
+sudo cp -r Jackmp.framework /Library/Frameworks/  
+sudo cp -r Jackservermp.framework /Library/Frameworks/   
+sudo install -d /usr/local/bin 
+sudo cp jackdmp /usr/local/bin  
+[ -f jack_load ] && sudo cp jack_load /usr/local/bin 
+[ -f jack_unload ] && sudo cp jack_unload /usr/local/bin 
+[ -f jack_netsource ] && sudo cp jack_netsource /usr/local/bin 
+
+# Copy drivers
+sudo install -d  /usr/local/lib/jackmp 
+sudo cp  jack_coreaudio.so  /usr/local/lib/jackmp 
+sudo cp  jack_coremidi.so  /usr/local/lib/jackmp
+sudo cp  jack_dummy.so  /usr/local/lib/jackmp
+sudo cp  jack_loopback.so  /usr/local/lib/jackmp
+[ -f jack_net.so ] && sudo cp jack_net.so /usr/local/lib/jackmp
+[ -f jack_netone.so ] && sudo cp jack_netone.so /usr/local/lib/jackmp
+
+# Copy tools
+[ -f netmanager.so ] && sudo cp  netmanager.so /usr/local/lib/jackmp
+[ -f netadapter.so ] && sudo cp  netadapter.so /usr/local/lib/jackmp
+[ -f audioadapter.so ] && sudo cp  audioadapter.so /usr/local/lib/jackmp
+
+# Create links to jackmp ressources
+cd /usr/local/lib && [ -f libjack.0.dylib ] && sudo mv -f libjack.0.dylib tmp_libjack.0.dylib 
+cd /usr/local/lib && [ -f jackd ] && sudo mv -f jackd tmp_jackd 
+cd /usr/local/lib && [ -f libjack.dylib ] && sudo rm libjack.dylib
+cd /usr/local/bin && [ -f jackd ] && sudo rm jackd
+cd /usr/local/lib && sudo ln -s /Library/Frameworks/Jackmp.framework/Jackmp libjack.dylib
+cd /usr/local/lib && sudo ln -s /Library/Frameworks/Jackmp.framework/Jackmp libjack.0.dylib
+cd /usr/local/bin && sudo ln -s jackdmp jackd
+
+
diff --git a/macosx/libportaudio.a b/macosx/libportaudio.a
new file mode 100644
index 0000000..cbf792a
Binary files /dev/null and b/macosx/libportaudio.a differ
diff --git a/macosx/remove_jackdmp b/macosx/remove_jackdmp
new file mode 100755
index 0000000..050d7c7
--- /dev/null
+++ b/macosx/remove_jackdmp
@@ -0,0 +1,15 @@
+# Remove jackdmp resources
+sudo rm -r "/usr/local/lib/jackmp"
+sudo rm "/usr/local/bin/jackdmp"
+sudo rm -r "/usr/local/lib/jackd"
+sudo rm "/usr/local/lib/libjackmp.dylib"
+sudo rm -r "/Library/Frameworks/Jackmp.framework"
+sudo rm -r "/Library/Frameworks/Jackservermp.framework"
+sudo rm -r "/Library/Audio/Plug-Ins/HAL/JackRouter.plugin"
+
+# Tries to restore jack
+cd /usr/local/lib && sudo rm -r libjack.0.dylib
+cd /usr/local/lib && [ -f tmp_libjack.0.dylib ] && sudo  mv -f tmp_libjack.0.dylib libjack.0.dylib
+cd /usr/local/lib && ln -s libjack.0.dylib libjack.dylib
+cd /usr/local/bin && [ -f tmp_jackd ] && sudo  mv -f tmp_jackd jackd
+
diff --git a/macosx/wscript b/macosx/wscript
new file mode 100644
index 0000000..8fa9bd3
--- /dev/null
+++ b/macosx/wscript
@@ -0,0 +1,84 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+def create_jack_driver_obj(bld, target, sources, uselib = None):
+    driver = bld.new_task_gen('cxx', 'shlib')
+    driver.features.append('cc')
+    driver.env['shlib_PATTERN'] = 'jack_%s.so'
+    driver.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
+    # Seems uneeded here...
+    #if bld.env['HAVE_CELT']:
+	#if bld.env['HAVE_CELT_API_0_5']:
+	#    driver.defines +=  ['HAVE_CELT', 'HAVE_CELT_API_0_5']
+	#elif bld.env['HAVE_CELT_API_0_7']:
+	#    driver.defines +=  ['HAVE_CELT', 'HAVE_CELT_API_0_7']
+    driver.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
+    driver.target = target
+    driver.source = sources
+    driver.install_path = '${ADDON_DIR}/'
+    driver.uselib_local = 'serverlib'
+    if uselib:
+        driver.uselib = uselib
+    return driver
+
+def create_jack_audio_driver_obj(bld, target, sources, uselib = None):
+    driver = bld.new_task_gen('cxx', 'shlib')
+    driver.features.append('cc')
+    driver.env['shlib_PATTERN'] = 'jack_%s.so'
+    driver.defines = 'HAVE_CONFIG_H'
+    driver.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
+    driver.target = target
+    driver.source = sources
+    driver.install_path = '${ADDON_DIR}/'
+    driver.uselib_local = 'serverlib'
+    driver.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreServices -framework AudioUnit")
+    if uselib:
+        driver.uselib = uselib
+    return driver
+
+def create_jack_midi_driver_obj(bld, target, sources, uselib = None):
+    driver = bld.new_task_gen('cxx', 'shlib')
+    driver.features.append('cc')
+    driver.env['shlib_PATTERN'] = 'jack_%s.so'
+    driver.defines = 'HAVE_CONFIG_H'
+    driver.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
+    driver.target = target
+    driver.source = sources
+    driver.install_path = '${ADDON_DIR}/'
+    driver.uselib_local = 'serverlib'
+    driver.env.append_value("LINKFLAGS", "-framework CoreMIDI -framework CoreServices -framework AudioUnit")
+    if uselib:
+        driver.uselib = uselib
+    return driver
+
+def build(bld):
+    if bld.env['BUILD_JACKD'] == True:
+    	jackd = bld.new_task_gen('cxx', 'program')
+    	jackd.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
+    	jackd.defines = 'HAVE_CONFIG_H'
+    	jackd.source = ['../common/Jackdmp.cpp']
+    	jackd.uselib = 'PTHREAD DL'
+    	jackd.uselib_local = 'serverlib'
+    	jackd.env.append_value("LINKFLAGS", "-framework CoreFoundation")
+    	jackd.target = 'jackd'
+
+    create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp')
+
+    create_jack_driver_obj(bld, 'loopback', '../common/JackLoopbackDriver.cpp')
+
+    create_jack_audio_driver_obj(bld, 'coreaudio', 'coreaudio/JackCoreAudioDriver.cpp')
+
+    create_jack_midi_driver_obj(bld, 'coremidi', 'coremidi/JackCoreMidiDriver.cpp')
+    
+    portaudio_src = [
+        '../windows/JackPortAudioDriver.cpp',
+        '../windows/JackPortAudioDevices.cpp',
+    	]
+
+    #create_jack_audio_driver_obj(bld, 'portaudio', portaudio_src)
+
+    create_jack_driver_obj(bld, 'net', '../common/JackNetDriver.cpp')
+
+    create_jack_driver_obj(bld, 'netone', [ '../common/JackNetOneDriver.cpp',
+		                            '../common/netjack.c',
+					    '../common/netjack_packet.c' ], "SAMPLERATE CELT" )
diff --git a/man/Makefile.am b/man/Makefile.am
deleted file mode 100644
index ca68b74..0000000
--- a/man/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-.0.1:
-	@sed -e "s/!VERSION!/@JACK_RELEASE@/g" -e "s/!DATE!/`date '+%B %Y'`/g" < $*.0 > $@
-	@echo Built $*.1 from template
-
-manpages = $(patsubst %.0,%.1,$(wildcard *.0))
-
-clean-local:
-	-rm -rf $(manpages)
-
-man1_MANS = $(manpages)
-
-BUILT_SOURCES = $(manpages)
-
-#dist_man_MANS = $(manpages)
diff --git a/man/alsa_in.0 b/man/alsa_in.0
deleted file mode 100644
index 91956a0..0000000
--- a/man/alsa_in.0
+++ /dev/null
@@ -1,97 +0,0 @@
-.TH ALSA_IO "1" "!DATE!" "!VERSION!"
-.SH NAME
-\fBalsa_in\fR, \fBalsa_out\fR \- Jack clients that perform I/O with an alternate audio interface
-.SH SYNOPSIS
-\fBalsa_in\fR [\fIoptions\fR]
-.br
-\fBalsa_out\fR [\fIoptions\fR]
-
-.SH DESCRIPTION
-A JACK client that opens a specified audio interface (different to the
-one used by the JACK server, if any) and moves audio data between its
-JACK ports and the interface. alsa_in will provide data from the
-interface (potentially for capture); alsa_out will deliver data to it
-(for playback).
-
-The audio interface used by alsa_in/alsa_out does not need to be
-synchronized with JACK backend (or the hardware it might be using).
-alsa_in/alsa_out tries to resample the output stream in an attempt to
-compensate for drift between the two clocks.
-
-As of jack-0.116.3 this works almost perfectly. It takes some time, to reach
-absolute resample-rate stability. So give it some minutes (its intended to be
-running permanently anyways)
-
-.SH OPTIONS
-.TP
-\fB\-j \fI jack_client_name\fR
-.br
-Set Client Name.
-.TP
-\fB\-d \fI alsa_device\fR  
-.br
-Use this Soundcard.
-.TP
-\fB\-v\fR  
-.br
-Verbose, prints out resample coefficient and other parameters useful for debugging, every 500ms.
-also reports soft xruns. 
-.TP
-\fB\-i\fR  
-.br
-Instrumentation. This logs the 4 important parameters of the samplerate control algorithm every 1ms.
-You can pipe this into a file, and plot it. Should only be necessary, if it does not work as
-expected, and we need to adjust some of the obscure parameters, to make it work. 
-Find me on irc.freenode.org #jack in order to set this up correctly.
-.TP
-\fB\-c \fI channels\fR  
-.br
-Set Number of channels.
-.TP
-\fB\-r \fI sample_rate\fR  
-.br
-Set sample_rate. The program resamples as necessary.
-So you can connect a 44k1 jackd to a soundcard only supporting
-48k. (default is jack sample_rate)
-.TP
-\fB\-p \fI period_size\fR  
-.br
-Set the period size. It is not related to the jackd period_size.
-Sometimes it affects the quality of the delay measurements.
-Setting this lower than the jackd period_size will only work, if you
-use a higher number of periods. 
-.TP
-\fB\-n \fI num_period\fR  
-.br
-Set number of periods. See note for period_size.
-.TP
-\fB\-q \fI quality\fR  
-.br
-Set the quality of the resampler from 0 to 4. can significanly reduce cpu usage.
-.TP
-\fB\-m \fI max_diff\fR  
-.br
-The value when a soft xrun occurs. Basically the window, in which
-the dma pointer may jitter. I don't think its necessary to play with this anymore. 
-.TP
-\fB\-t \fI target_delay\fR  
-.br
-The delay alsa_io should try to approach. Same as for max_diff. It will be setup based on \-p and \-n
-which is generally sufficient.
-.TP
-\fB\-s \fI smooth_array_size\fR  
-.br
-This parameter controls the size of the array used for smoothing the delay measurement. Its default is 256.
-If you use a pretty low period size, you can lower the CPU usage a bit by decreasing this parameter.
-However most CPU time is spent in the resampling so this will not be much.
-.TP
-\fB\-C \fI P Control Clamp\fR  
-.br
-If you have a PCI card, then the default value (15) of this parameter is too high for \-p64 \-n2... Setting it to 5 should fix that.
-Be aware that setting this parameter too low, lets the hf noise on the delay measurement come through onto the resamplerate, so this
-might degrade the quality of the output. (but its a threshold value, and it has been chosen, to mask the noise of a USB card,
-which has an amplitude which is 50 times higher than that of a PCI card, so 5 wont loose you any quality on a PCI card)
-
-.SH AUTHOR
-Torben Hohn
-
diff --git a/man/alsa_out.0 b/man/alsa_out.0
deleted file mode 100644
index 7b63b85..0000000
--- a/man/alsa_out.0
+++ /dev/null
@@ -1 +0,0 @@
-.so man1/alsa_in.1
diff --git a/man/jack_bufsize.0 b/man/jack_bufsize.0
deleted file mode 100644
index f9d0dd6..0000000
--- a/man/jack_bufsize.0
+++ /dev/null
@@ -1,14 +0,0 @@
-.TH JACK_BUFSIZE "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_bufsize \- JACK toolkit client to change the JACK buffer size
-.SH SYNOPSIS
-.B jack_bufsize bufsize
-.SH DESCRIPTION
-.B jack_bufsize
-jack_bufsize sets the size of the buffer (frames per period) used in JACK. 
-This change happens on-line (the JACK server and its clients do not need to be 
-restarted).
-.br
-When invoked without arguments, it prints the current bufsize, and exits.
-
-
diff --git a/man/jack_connect.0 b/man/jack_connect.0
deleted file mode 100644
index 602ac39..0000000
--- a/man/jack_connect.0
+++ /dev/null
@@ -1,11 +0,0 @@
-.TH JACK_CONNECT "1" "!DATE!" "!VERSION!"
-.SH NAME
-\fBjack_connect\fR, \fBjack_disconnect\fR \- JACK toolkit clients for connecting & disconnecting ports
-.SH SYNOPSIS
-\fB jack_connect\fR [ \fI-s\fR | \fI--server servername\fR ] [\fI-h\fR | \fI--help\fR ] port1 port2
-\fB jack_disconnect\fR [ \fI-s\fR | \fI--server servername\fR ] [\fI-h\fR | \fI--help\fR ] port1 port2
-.SH DESCRIPTION
-\fBjack_connect\fR connects the two named ports. \fBjack_connect\fR disconnects the two named ports.
-.SH RETURNS
-The exit status is zero if successful, 1 otherwise
-
diff --git a/man/jack_disconnect.0 b/man/jack_disconnect.0
deleted file mode 100644
index 90300cc..0000000
--- a/man/jack_disconnect.0
+++ /dev/null
@@ -1 +0,0 @@
-.so man1/jack_connect.1
diff --git a/man/jack_freewheel.0 b/man/jack_freewheel.0
deleted file mode 100644
index 0941ffd..0000000
--- a/man/jack_freewheel.0
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH JACK_FREEWHEEL "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_freewheel \- JACK toolkit client to control freewheeling mode
-.SH SYNOPSIS
-.B jack_freewheel [y|n]
-.SH DESCRIPTION
-.B jack_freewheel
-Turns freewheeling mode on (y) or off (n). While in freewheeling mode,
-the JACK server does not wait in between process() calls, and does not
-read or write data from/to any audio interface. That results in the JACK graph
-processing data as fast as possible. Freewheeling makes fast exports to 
-files possible.
-.PP
-There is no useful reason to use this tool other than testing. JACK
-clients that use freewheeling will turn it on and off themselves.
-
diff --git a/man/jack_impulse_grabber.0 b/man/jack_impulse_grabber.0
deleted file mode 100644
index 544716b..0000000
--- a/man/jack_impulse_grabber.0
+++ /dev/null
@@ -1,11 +0,0 @@
-.TH JACK_IMPULSE_GRABBER "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_impulse_grabber \- JACK toolkit client to grab an impulse (response)
-.SH SYNOPSIS
-\fBjack_impulse_grabber\fR \fB-d\fR \fIduration\fR [\fI-f\fR (C|gnuplot)]
-.SH DESCRIPTION
-\fBjack_impulse_grabber\fR is a JACK example client for collecting
-impulses recordings from JACK ports.
-
-
-
diff --git a/man/jack_load.0 b/man/jack_load.0
deleted file mode 100644
index 599116e..0000000
--- a/man/jack_load.0
+++ /dev/null
@@ -1,28 +0,0 @@
-.TH JACK_LOAD "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_load \- JACK toolkit client for loading in-process clients
-.SH SYNOPSIS
-\fBjack_load\fR [ \fI-i\fR initstring ] [ \fI-s\fR servername ] [\fI-w\fR ] client-name so-name [ initstring ]
-.SH DESCRIPTION
-\fBjack_load\fR is a JACK toolkit client. It loads the specified plugin and creates an in-process client.
-.SH ARGUMENTS
-.PP
-The client-name must be a currently unused client name.
-.PP
-The so-name is the name of file that client code is stored in (typically, \fIclientname.so\fR)
-.SH OPTIONS
-.TP
-\fB-i\fR, \fB--init\fR init-string
-.br
-initialization string passed to the in-process client. Note that this can also be specified as the last argument on the command line.
-.TP
-\fB-s\fR, \fB--server\fR servername
-.br
-Name of JACK server to connect to
-.TP
-\fB-w\fR, \fB--wait\fR
-Wait for a signal (eg. from Ctrl-c) and then unload the client.
-.SH AUTHOR
-Jeremy Hall
-
-
diff --git a/man/jack_lsp.0 b/man/jack_lsp.0
deleted file mode 100644
index a54ba5e..0000000
--- a/man/jack_lsp.0
+++ /dev/null
@@ -1,47 +0,0 @@
-.TH JACK_LSP "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_lsp \- JACK toolkit client to list informtion on ports
-.SH SYNOPSIS
-\fBjack_lsp\fR [ \fI-s\fR | \fI--server\fR servername ] [ \fI-AclLptvh\fR ]
-.SH DESCRIPTION
-\fBjack_lsp\fR lists all known ports associated with a JACK
-server. It can also optionally list various kinds of information about each port.
-.SH OPTIONS
-.TP
-\fB-s\fR, \fB--server\fR \fIservername\fR
-.br
-Connect to the jack server named \fIservername\fR
-.TP
-\fB-A\fR, \fB--aliases\fR
-.br
-List aliases for each port
-.TP
-\fB-c\fR, \fB--connections\fR
-.br
-List connections to/from each port
-.TP
-\fB-l\fR, \fB--latency\fR
-.br
-Display per-port latency in frames at each port
-.TP
-\fB-L\fR, \fI--latency\fR
-.br
-Display total latency in frames at each port
-.TP
-\fB-p\fR, \fB--properties\fR
-.br
-Display port properties. Output may include input|output, can-monitor, physical, terminal
-.TP
-\fB-t\fR, \fB--type\fR
-.br
-Display port type
-.TP
-\fB-h\fR, \fB--help\fR
-.br
-Display help/usage message
-.TP
-\fB-v\fR, \fB--version\fR
-.br
-Output version information and exit
-
-
diff --git a/man/jack_metro.0 b/man/jack_metro.0
deleted file mode 100644
index e38a954..0000000
--- a/man/jack_metro.0
+++ /dev/null
@@ -1,40 +0,0 @@
-.TH JACK_METRO "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_metro \- JACK toolkit metronome
-.SH SYNOPSIS
-\fBjack_metro\fR [ \fI-n\fR name ] [ \fI-f\fR hz ] [ \fI-D\fR msecs ] [\fI-a\fR % ] [ \fI-d\fR % ] \fI-b\fR bpm 
-.SH DESCRIPTION
-\fBjack_metro\fR is a simple metronome for JACK. It generates a
-synthetic "tick" sound for every beat. Note that is does \fBnot\fR
-connect its output port by default - to hear the sound it makes you must
-connect them using some other tool.
-.SH OPTIONS
-.TP
-\fB-n\fR, \fB--name\fR
-.br
-Specify a name for this instance of the metronome.
-.TP
-\fB-f\fR, \fB--frequency\fR Hz
-.br
-Define the frequency of the "tick" in Hz.
-.TP
-\fB-D\fR, \fB--duration\fR msecs
-.br
-Define the duration of the "tick" in milliseconds.
-.TP
-\fB-a\fR, \fB--attack\fR %-age
-.br
-Define the duration of the attack phase of the "tick" as a percentage
-of the duration.
-.TP
-\fB-d\fR, \fB--decay\fR %-age
-.br
-Define the duration of the decay phase of the "tick" as a percentage
-of the duration.
-.TP
-\fB--b\fR, \fB--bpm\fR bpm
-.br
-Define the number of beats per minute.
-.SH AUTHOR
-Anthony Van Groningen
-
diff --git a/man/jack_monitor_client.0 b/man/jack_monitor_client.0
deleted file mode 100644
index 0991107..0000000
--- a/man/jack_monitor_client.0
+++ /dev/null
@@ -1,18 +0,0 @@
-.TH JACK_CONNECT "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_monitor_client \- The JACK Audio Connection Kit example client
-.SH SYNOPSIS
-.B jack_monitor_client
-client-name
-.PP
-The client-name must be the name of a existing client that monitoring is 
-to be enabled for.
-.SH DESCRIPTION
-.B jack_monitor_client
-is an example client for the JACK Audio Connection Kit. It enables
-monitoring for the specified client.
-.SH AUTHOR
-Jeremy Hall
-.PP
-This manpage was written by Robert Jordens <jordens at debian.org> for Debian.
-
diff --git a/man/jack_netsource.0 b/man/jack_netsource.0
deleted file mode 100644
index 5de4af7..0000000
--- a/man/jack_netsource.0
+++ /dev/null
@@ -1,109 +0,0 @@
-.TH JACK_NETSOURCE "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_netsource \- Netjack Master client for one slave
-.SH SYNOPSIS
-\fBjack_netsource\fR [ \fI-H\fR hostname ] [ \fIoptions\fR ]
-
-.SH DESCRIPTION
-\fBjack_netsource\fR The Master side of a netjack connection. Represents the slave jackd -dnet in the master jack graph.
-Most connection parameters are configured via the netsource, and the slave will set itself up according to the commandline
-option given to jack_netsource.
-.br
-Netjack allows low latency audio connections over general IP networks. When using celt for compression, it is even possible
-to establish transatlantic links, with latencies not much over the actual ping time. 
-.br
-But the main usecase is of course a LAN, where it can achieve one jack period of latency.
-
-.SH OPTIONS
-.TP
-\fB-h\fR this help text
-.TP
-\fB-H\fR \fIslave host\fR
-.br
-Host name of the slave JACK
-.TP
-\fB-o\fR \fInum channels\fR
-.br
-Number of audio playback channels
-.TP
-\fB-i\fR \fInum channels\fR
-.br
-Number of audio capture channels
-.TP
-\fB-O\fR \fInum channels\fR
-.br
-Number of midi playback channels
-.TP
-\fB-I\fR \fInum channels\fR
-.br
-Number of midi capture channels
-.TP
-\fB-n\fR \fIperiods\fR
-.br
-Network latency in JACK periods
-.TP
-\fB-p\fR \fIport\fR
-.br
-UDP port that the slave is listening on
-.TP
-\fB-r\fR \fIreply port\fR
-.br
-UDP port that we are listening on
-.TP
-\fB-B\fR \fIbind port\fR
-.br
-reply port, for use in NAT environments
-.TP
-\fB-b\fR \fIbitdepth\fR
-.br
-Set transport to use 16bit or 8bit
-.TP
-\fB-c\fR \fIbytes\fR
-.br
-Use CELT encoding with <bytes> per period and channel
-.TP
-\fB-m\fR \fImtu\fR
-.br
-Assume this mtu for the link
-.TP
-\fB-R\fR \fIN\fR
-.br
-Redundancy: send out packets N times.
-.TP
-\fB-e\fR
-.br
-skip host-to-network endianness conversion
-.TP
-\fB-N\fR \fIjack name\fR
-.br
-Reports a different client name to jack
-.TP
-.TP
-\fB-s\fR, \fB--server\fR \fIservername\fR
-.br
-Connect to the jack server named \fIservername\fR
-.TP
-\fB-h\fR, \fB--help\fR
-.br
-Display help/usage message
-.TP
-\fB-v\fR, \fB--version\fR
-.br
-Output version information and exit
-
-
-.SH EXAMPLES
-
-.PP
-run a 4 audio channel bidirectional link with one period of latency and no midi channels. Audio data is flowing uncompressed over the wire:
-.br
-On \fIhostA\fR:
-.IP
-\fBjackd \-d alsa \fR
-.br
-\fBjack_netsource \-H hostB -n1 -i4 -o4 -I0 -O0 \fR
-.PP
-On \fIhostB\fR:
-.IP
-\fBjackd \-d net \fR
-
diff --git a/man/jack_samplerate.0 b/man/jack_samplerate.0
deleted file mode 100644
index ef11ed0..0000000
--- a/man/jack_samplerate.0
+++ /dev/null
@@ -1,9 +0,0 @@
-.TH JACK_SAMPLERATE "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_samplerate \- JACK toolkit client to print current samplerate
-.SH SYNOPSIS
-.B jack_samplerate
-.SH DESCRIPTION
-.B jack_samplerate prints the current samplerate, and exits.
-
-
diff --git a/man/jack_showtime.0 b/man/jack_showtime.0
deleted file mode 100644
index 210caa7..0000000
--- a/man/jack_showtime.0
+++ /dev/null
@@ -1,13 +0,0 @@
-.TH JACK_SHOWTIME "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_showtime \- The JACK Audio Connection Kit example client
-.SH SYNOPSIS
-.B jack_showtime
-.SH DESCRIPTION
-.B jack_showtime
-prints the current timebase information to stdout
-.SH AUTHOR
-Paul Davis
-.PP
-This manpage was written by Stefan Schwandter <swan at debian.org>
-
diff --git a/man/jack_transport.0 b/man/jack_transport.0
deleted file mode 100644
index 6aa8ddd..0000000
--- a/man/jack_transport.0
+++ /dev/null
@@ -1,13 +0,0 @@
-.TH JACK_TRANSPORT "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_transport \- JACK toolkit client for transport control
-.SH SYNOPSIS
-.B jack_transport
-.SH DESCRIPTION
-.B jack_transport
-is a toolkit client for the JACK Audio Connection Kit. It provides command-line
-control over the JACK transport system. Type help at jack_transport's
-command prompt to see the available commands.
-.SH AUTHOR
-Jeremy Hall
-
diff --git a/man/jack_unload.0 b/man/jack_unload.0
deleted file mode 100644
index 79b1e33..0000000
--- a/man/jack_unload.0
+++ /dev/null
@@ -1,19 +0,0 @@
-.TH JACK_UNLOAD "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_unload \- The JACK Audio Connection Kit example client
-.SH SYNOPSIS
-.B jack_unload 
-client-name
-.PP
-The client-name must be the name of a loaded client that can be unloaded.
-.SH DESCRIPTION
-.B jack_unload
-is the counterpart to 
-.B jack_load
-and unloads the specified client.
-.SH EXAMPLE
-.B jack_unload in_process_test
-.SH AUTHOR
-Jeremy Hall
-.PP
-This manpage was written by Robert Jordens <jordens at debian.org> for Debian.
diff --git a/man/jack_wait.0 b/man/jack_wait.0
deleted file mode 100644
index 239e8c2..0000000
--- a/man/jack_wait.0
+++ /dev/null
@@ -1,41 +0,0 @@
-.TH JACK_WAIT "1" "!DATE!" "!VERSION!"
-.SH NAME
-jack_wait \- JACK toolkit client to check and wait for existence/exit of jackd.  
-.SH SYNOPSIS
-\fBjack_wait\fR [ \fI-s\fR | \fI--server\fR servername ] [ \fI-t\fR | \fI--timeout\fR timeout_seconds [ \fI-cqwhv\fR ]
-.SH DESCRIPTION
-\fBjack_wait\fR When invoked with \fI-c\fR it only checks for the existence of a jack server. When invoked with \fI-w\fR the
-program will wait for a jackd to be available.
-The \fI-q\fR makes it wait for the jackd to exit.
-
-.SH OPTIONS
-.TP
-\fB-w\fR, \fB--wait\fR
-.br
-Wait for jackd to be available.
-.TP
-\fB-q\fR, \fB--quit\fR
-.br
-Wait for jackd quit.
-.TP
-\fB-c\fR, \fB--check\fR
-.br
-Only check for existence of jackd, and exit.
-.TP
-\fB-s\fR, \fB--server\fR \fIservername\fR
-.br
-Connect to the jack server named \fIservername\fR
-.TP
-\fB-t\fR, \fB--timeout\fR \fItimeout_seconds\fR
-.br
-Only wait \fItimeout_seconds\fR.
-.TP
-\fB-h\fR, \fB--help\fR
-.br
-Display help/usage message
-.TP
-\fB-v\fR, \fB--version\fR
-.br
-Output version information and exit
-
-
diff --git a/man/jackrec.0 b/man/jackrec.0
deleted file mode 100644
index 1ea2a6f..0000000
--- a/man/jackrec.0
+++ /dev/null
@@ -1,23 +0,0 @@
-.TH JACKREC "1" "!DATE!" "!VERSION!"
-.SH NAME
-jackrec \- JACK toolkit client for recording audio
-.SH SYNOPSIS
-.B jackrec
-\-f filename \-d seconds [ \-b bitdepth ] port1 [ port2 ... ]
-.SH DESCRIPTION
-.B jackrec is a basic, but useful, audio recorder that will record
-audio from 1 or more JACK ports to a file on disk. The file format is
-always RIFF/WAV, with samples stored as signed integers. The sample
-bit depth can be selected using the \fI-b\fR option. The file will
-have as many channels as there are ports specified on the command line
-- each channel will contain the data recorded from one port. The user
-should generally specify the duration (in seconds) using the \fI-d\fR
-option. If not specified, jackrec will record until terminated by a
-signal (eg. from Ctrl-c).
-.PP
-This application is not intended to be a heavy duty audio recorder,
-and originated as an example client to show how to handle threading
-and disk I/O in a JACK client. However, it is a useful, simple
-recorder and is included in the JACK toolkit as a result.
-
-
diff --git a/posix/JackCompilerDeps_os.h b/posix/JackCompilerDeps_os.h
new file mode 100644
index 0000000..767674e
--- /dev/null
+++ b/posix/JackCompilerDeps_os.h
@@ -0,0 +1,61 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackCompilerDeps_POSIX__
+#define __JackCompilerDeps_POSIX__
+
+#include "JackConstants.h"
+
+#if __GNUC__
+    #ifndef POST_PACKED_STRUCTURE
+        /* POST_PACKED_STRUCTURE needs to be a macro which
+        expands into a compiler directive. The directive must
+        tell the compiler to arrange the preceding structure
+        declaration so that it is packed on byte-boundaries rather
+        than use the natural alignment of the processor and/or
+        compiler.
+        */
+        #if (__GNUC__< 4)  /* Does not seem to work with GCC 3.XX serie */
+            #define POST_PACKED_STRUCTURE
+        #elif defined(JACK_32_64)
+            #define POST_PACKED_STRUCTURE __attribute__((__packed__))
+        #else
+            #define POST_PACKED_STRUCTURE
+        #endif
+    #endif
+    #define MEM_ALIGN(x,y) x __attribute__((aligned(y)))
+    #define EXPORT __attribute__((visibility("default")))
+    #ifdef SERVER_SIDE
+        #if (__GNUC__< 4)
+            #define SERVER_EXPORT
+        #else
+            #define SERVER_EXPORT __attribute__((visibility("default")))
+        #endif
+    #else
+        #define SERVER_EXPORT
+    #endif
+#else
+    #define MEM_ALIGN(x,y) x
+    #define EXPORT
+    #define SERVER_EXPORT
+    /* Add other things here for non-gcc platforms for POST_PACKED_STRUCTURE */
+#endif
+
+#endif
+
diff --git a/posix/JackFifo.cpp b/posix/JackFifo.cpp
new file mode 100644
index 0000000..1cd3e5d
--- /dev/null
+++ b/posix/JackFifo.cpp
@@ -0,0 +1,228 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackFifo.h"
+#include "JackTools.h"
+#include "JackError.h"
+#include "JackConstants.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+namespace Jack
+{
+
+void JackFifo::BuildName(const char* client_name, const char* server_name, char* res)
+{
+    char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
+    JackTools::RewriteName(client_name, ext_client_name);
+    sprintf(res, "%s/jack_fifo.%d_%s_%s", jack_client_dir, JackTools::GetUID(), server_name, ext_client_name);
+}
+
+bool JackFifo::Signal()
+{
+    bool res;
+    char c = 0;
+
+    if (fFifo < 0) {
+        jack_error("JackFifo::Signal name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if (fFlush)
+        return true;
+
+    if ((res = (write(fFifo, &c, sizeof(c)) != sizeof(c)))) {
+        jack_error("JackFifo::Signal name = %s err = %s", fName, strerror(errno));
+    }
+    return !res;
+}
+
+bool JackFifo::SignalAll()
+{
+    bool res;
+    char c = 0;
+
+    if (fFifo < 0) {
+        jack_error("JackFifo::SignalAll name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if (fFlush)
+        return true;
+
+    if ((res = (write(fFifo, &c, sizeof(c)) != sizeof(c)))) {
+        jack_error("JackFifo::SignalAll name = %s err = %s", fName, strerror(errno));
+    }
+    return !res;
+}
+
+bool JackFifo::Wait()
+{
+    bool res;
+    char c;
+
+    if (fFifo < 0) {
+        jack_error("JackFifo::Wait name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if ((res = (read(fFifo, &c, sizeof(c)) != sizeof(c)))) {
+        jack_error("JackFifo::Wait name = %s err = %s", fName, strerror(errno));
+    }
+    return !res;
+}
+
+#ifdef __APPLE__
+#warning JackFifo::TimedWait not available : synchronous mode may not work correctly if FIFO are used
+bool JackFifo::TimedWait(long usec)
+{
+    return Wait();
+}
+#else
+// Does not work on OSX ??
+bool JackFifo::TimedWait(long usec)
+{
+    int res;
+    
+    if (fFifo < 0) {
+        jack_error("JackFifo::TimedWait name = %s already desallocated!!", fName);
+        return false;
+    }
+   
+    do {
+        res = poll(&fPoll, 1, usec / 1000);
+    } while (res < 0 && errno == EINTR);
+
+    if (fPoll.revents & POLLIN) {
+        return Wait();
+    } else {
+        // Wait failure but we still continue...
+        jack_log("JackFifo::TimedWait name = %s usec = %ld err = %s", fName, usec, strerror(errno));
+        return true;
+    }
+}
+#endif
+
+// Server side
+bool JackFifo::Allocate(const char* name, const char* server_name, int value)
+{
+    struct stat statbuf;
+    BuildName(name, server_name, fName);
+    jack_log("JackFifo::Allocate name = %s", fName);
+
+    if (stat(fName, &statbuf) < 0) {
+        if (errno == ENOENT || errno == EPERM) {
+            if (mkfifo(fName, 0666) < 0) {
+                jack_error("Cannot create inter-client FIFO name = %s err = %s", name, strerror(errno));
+                return false;
+            }
+        } else {
+            jack_error("Cannot check on FIFO %s", name);
+            return false;
+        }
+    } else {
+        if (!S_ISFIFO(statbuf.st_mode)) {
+            jack_error("FIFO name = %s already exists, but is not a FIFO", name);
+            return false;
+        }
+    }
+
+    if ((fFifo = open(fName, O_RDWR | O_CREAT, 0666)) < 0) {
+        jack_error("Cannot open FIFO name = %s err = %s", name, strerror(errno));
+        return false;
+    } else {
+        fPoll.fd = fFifo;
+        fPoll.events = POLLERR | POLLIN | POLLHUP | POLLNVAL;
+        return true;
+    }
+}
+
+// Client side
+bool JackFifo::ConnectAux(const char* name, const char* server_name, int access)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackFifo::ConnectAux name = %s", fName);
+
+    // Temporary...
+    if (fFifo >= 0) {
+        jack_log("Already connected name = %s", name);
+        return true;
+    }
+
+    if ((fFifo = open(fName, access)) < 0) {
+        jack_error("Connect: can't connect named fifo name = %s err = %s", fName, strerror(errno));
+        return false;
+    } else {
+        fPoll.fd = fFifo;
+        fPoll.events = POLLERR | POLLIN | POLLHUP | POLLNVAL;
+        return true;
+    }
+}
+
+bool JackFifo::Connect(const char* name, const char* server_name)
+{
+    return ConnectAux(name, server_name, O_RDWR);
+}
+
+bool JackFifo::ConnectOutput(const char* name, const char* server_name)
+{
+    return ConnectAux(name, server_name, O_WRONLY | O_NONBLOCK);
+}
+
+bool JackFifo::ConnectInput(const char* name, const char* server_name)
+{
+    return ConnectAux(name, server_name, O_RDONLY);
+}
+
+bool JackFifo::Disconnect()
+{
+    if (fFifo >= 0) {
+        jack_log("JackFifo::Disconnect %s", fName);
+        if (close(fFifo) != 0) {
+            jack_error("Disconnect: can't disconnect named fifo name = %s err = %s", fName, strerror(errno));
+            return false;
+        } else {
+            fFifo = -1;
+            return true;
+        }
+    } else {
+        return true;
+    }
+}
+
+// Server side : destroy the fifo
+void JackFifo::Destroy()
+{
+    if (fFifo > 0) {
+        jack_log("JackFifo::Destroy name = %s", fName);
+        unlink(fName);
+        if (close(fFifo) != 0) {
+            jack_error("Destroy: can't destroy fifo name = %s err = %s", fName, strerror(errno));
+        }
+        fFifo = -1;
+    } else {
+        jack_error("JackFifo::Destroy fifo < 0");
+    }
+}
+
+} // end of namespace
+
diff --git a/posix/JackFifo.h b/posix/JackFifo.h
new file mode 100644
index 0000000..8ac7259
--- /dev/null
+++ b/posix/JackFifo.h
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackFifo__
+#define __JackFifo__
+
+#include "JackSynchro.h"
+#include "JackCompilerDeps.h"
+#include <assert.h>
+#include <poll.h>
+
+namespace Jack
+{
+
+/*!
+\brief Inter process synchronization using Fifo.
+*/
+
+class SERVER_EXPORT JackFifo : public detail::JackSynchro
+{
+
+    private:
+
+        int fFifo;
+        pollfd fPoll;
+
+        bool ConnectAux(const char* name, const char* server_name, int access);
+
+    protected:
+
+        void BuildName(const char* name, const char* server_name, char* res);
+
+    public:
+
+        JackFifo():JackSynchro(), fFifo(-1)
+        {}
+
+        bool Signal();
+        bool SignalAll();
+        bool Wait();
+        bool TimedWait(long usec);
+
+        bool Allocate(const char* name, const char* server_name, int value);
+        bool Connect(const char* name, const char* server_name);
+        bool ConnectInput(const char* name, const char* server_name);
+        bool ConnectOutput(const char* name, const char* server_name);
+        bool Disconnect();
+        void Destroy();
+};
+
+} // end of namespace
+
+
+#endif
+
diff --git a/posix/JackNetUnixSocket.cpp b/posix/JackNetUnixSocket.cpp
new file mode 100644
index 0000000..7649ca8
--- /dev/null
+++ b/posix/JackNetUnixSocket.cpp
@@ -0,0 +1,416 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackNetUnixSocket.h"
+#include <unistd.h>
+#include <fcntl.h>
+
+namespace Jack
+{
+    //utility *********************************************************************************************************
+    int GetHostName ( char * name, int size )
+    {
+        if ( gethostname ( name, size ) == SOCKET_ERROR )
+        {
+            jack_error ( "Can't get 'hostname' : %s", strerror ( NET_ERROR_CODE ) );
+            strcpy ( name, "default" );
+            return SOCKET_ERROR;
+        }
+        return 0;
+    }
+
+    //construct/destruct***********************************************************************************************
+    JackNetUnixSocket::JackNetUnixSocket()
+    {
+        fSockfd = 0;
+        fPort = 0;
+        fTimeOut = 0;
+        fSendAddr.sin_family = AF_INET;
+        fSendAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fSendAddr.sin_zero, 0, 8 );
+        fRecvAddr.sin_family = AF_INET;
+        fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fRecvAddr.sin_zero, 0, 8 );
+    }
+
+    JackNetUnixSocket::JackNetUnixSocket ( const char* ip, int port )
+    {
+        fSockfd = 0;
+        fPort = port;
+        fTimeOut = 0;
+        fSendAddr.sin_family = AF_INET;
+        fSendAddr.sin_port = htons ( port );
+        inet_aton ( ip, &fSendAddr.sin_addr );
+        memset ( &fSendAddr.sin_zero, 0, 8 );
+        fRecvAddr.sin_family = AF_INET;
+        fRecvAddr.sin_port = htons ( port );
+        fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fRecvAddr.sin_zero, 0, 8 );
+    }
+
+    JackNetUnixSocket::JackNetUnixSocket ( const JackNetUnixSocket& socket )
+    {
+        fSockfd = 0;
+        fTimeOut = 0;
+        fPort = socket.fPort;
+        fSendAddr = socket.fSendAddr;
+        fRecvAddr = socket.fRecvAddr;
+    }
+
+    JackNetUnixSocket::~JackNetUnixSocket()
+    {
+        Close();
+    }
+
+    JackNetUnixSocket& JackNetUnixSocket::operator= ( const JackNetUnixSocket& socket )
+    {
+        if ( this != &socket )
+        {
+            fSockfd = 0;
+            fPort = socket.fPort;
+            fSendAddr = socket.fSendAddr;
+            fRecvAddr = socket.fRecvAddr;
+        }
+        return *this;
+    }
+
+    //socket***********************************************************************************************************
+    int JackNetUnixSocket::NewSocket()
+    {
+        if ( fSockfd )
+        {
+            Close();
+            Reset();
+        }
+        fSockfd = socket ( AF_INET, SOCK_DGRAM, 0 );
+        return fSockfd;
+    }
+
+    int JackNetUnixSocket::Bind()
+    {
+        return bind ( fSockfd, reinterpret_cast<socket_address_t*> ( &fRecvAddr ), sizeof ( socket_address_t ) );
+    }
+
+    int JackNetUnixSocket::BindWith ( const char* ip )
+    {
+        int addr_conv = inet_aton ( ip, &fRecvAddr.sin_addr );
+        if ( addr_conv < 0 )
+            return addr_conv;
+        return Bind();
+    }
+
+    int JackNetUnixSocket::BindWith ( int port )
+    {
+        fRecvAddr.sin_port = htons ( port );
+        return Bind();
+    }
+
+    int JackNetUnixSocket::Connect()
+    {
+        return connect ( fSockfd, reinterpret_cast<socket_address_t*> ( &fSendAddr ), sizeof ( socket_address_t ) );
+    }
+
+    int JackNetUnixSocket::ConnectTo ( const char* ip )
+    {
+        int addr_conv = inet_aton ( ip, &fSendAddr.sin_addr );
+        if ( addr_conv < 0 )
+            return addr_conv;
+        return Connect();
+    }
+
+    void JackNetUnixSocket::Close()
+    {
+        if ( fSockfd )
+            close ( fSockfd );
+        fSockfd = 0;
+    }
+
+    void JackNetUnixSocket::Reset()
+    {
+        fSendAddr.sin_family = AF_INET;
+        fSendAddr.sin_port = htons ( fPort );
+        fSendAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fSendAddr.sin_zero, 0, 8 );
+        fRecvAddr.sin_family = AF_INET;
+        fRecvAddr.sin_port = htons ( fPort );
+        fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fRecvAddr.sin_zero, 0, 8 );
+    }
+
+    bool JackNetUnixSocket::IsSocket()
+    {
+        return ( fSockfd ) ? true : false;
+    }
+
+    //IP/PORT***********************************************************************************************************
+    void JackNetUnixSocket::SetPort ( int port )
+    {
+        fPort = port;
+        fSendAddr.sin_port = htons ( port );
+        fRecvAddr.sin_port = htons ( port );
+    }
+
+    int JackNetUnixSocket::GetPort()
+    {
+        return fPort;
+    }
+
+    //address***********************************************************************************************************
+    int JackNetUnixSocket::SetAddress ( const char* ip, int port )
+    {
+        int addr_conv = inet_aton ( ip, &fSendAddr.sin_addr );
+        if ( addr_conv < 0 )
+            return addr_conv;
+        fSendAddr.sin_port = htons ( port );
+        return 0;
+    }
+
+    char* JackNetUnixSocket::GetSendIP()
+    {
+        return inet_ntoa ( fSendAddr.sin_addr );
+    }
+
+    char* JackNetUnixSocket::GetRecvIP()
+    {
+        return inet_ntoa ( fRecvAddr.sin_addr );
+    }
+
+    //utility************************************************************************************************************
+    int JackNetUnixSocket::GetName ( char* name )
+    {
+        return gethostname ( name, 255 );
+    }
+
+    int JackNetUnixSocket::JoinMCastGroup ( const char* ip )
+    {
+        struct ip_mreq multicast_req;
+        inet_aton ( ip, &multicast_req.imr_multiaddr );
+        multicast_req.imr_interface.s_addr = htonl ( INADDR_ANY );
+        return SetOption ( IPPROTO_IP, IP_ADD_MEMBERSHIP, &multicast_req, sizeof ( multicast_req ) );
+    }
+
+    //options************************************************************************************************************
+    int JackNetUnixSocket::SetOption ( int level, int optname, const void* optval, socklen_t optlen )
+    {
+        return setsockopt ( fSockfd, level, optname, optval, optlen );
+    }
+
+    int JackNetUnixSocket::GetOption ( int level, int optname, void* optval, socklen_t* optlen )
+    {
+        return getsockopt ( fSockfd, level, optname, optval, optlen );
+    }
+
+    //timeout************************************************************************************************************
+
+#if defined(__sun__) || defined(sun)
+    int JackNetUnixSocket::SetTimeOut ( int us )
+    {
+        int	flags;
+        fTimeOut = us;
+    
+        if ((flags = fcntl(fSockfd, F_GETFL, 0)) < 0) {
+		    jack_error("JackNetUnixSocket::SetTimeOut error in fcntl F_GETFL");
+		    return -1;
+	    }
+    
+	    flags |= O_NONBLOCK;
+	    if (fcntl(fSockfd, F_SETFL, flags) < 0) {
+		    jack_error("JackNetUnixSocket::SetTimeOut error in fcntl F_SETFL");
+		    return 1;
+	    }
+
+        return 0;
+    }
+
+    int JackNetUnixSocket::WaitRead()
+    {
+        if (fTimeOut > 0) {
+
+            struct timeval tv;
+	        fd_set fdset;
+            ssize_t	res;
+    
+            tv.tv_sec = fTimeOut / 1000000;
+	        tv.tv_usec = fTimeOut % 1000000;
+    
+	        FD_ZERO(&fdset);
+	        FD_SET(fSockfd, &fdset);
+    
+	        do {
+		        res = select(fSockfd + 1, &fdset, NULL, NULL, &tv);
+	        } while (res < 0 && errno == EINTR);
+    
+	        if (res < 0) {
+ 		        return res;
+            } else if (res == 0) {
+                errno = ETIMEDOUT;
+		        return -1;
+	        }
+        }
+
+        return 0;
+    }
+
+    int JackNetUnixSocket::WaitWrite()
+    {
+        if (fTimeOut > 0) {
+
+            struct timeval tv;
+	        fd_set fdset;
+            ssize_t	res;
+    
+            tv.tv_sec = fTimeOut / 1000000;
+	        tv.tv_usec = fTimeOut % 1000000;
+    
+	        FD_ZERO(&fdset);
+	        FD_SET(fSockfd, &fdset);
+    
+	        do {
+		        res = select(fSockfd + 1, NULL, &fdset, NULL, &tv);
+	        } while (res < 0 && errno == EINTR);
+    
+	        if (res < 0) {
+		        return res;
+            } else if (res == 0) {
+                errno = ETIMEDOUT;
+		        return -1;
+	        }
+        }
+
+        return 0;
+    }
+
+#else
+    int JackNetUnixSocket::SetTimeOut ( int us )
+    {
+        jack_log ( "JackNetUnixSocket::SetTimeout %d usecs", us );
+
+        //negative timeout, or exceding 10s, return
+        if ( ( us < 0 ) || ( us > 10000000 ) )
+            return SOCKET_ERROR;
+        struct timeval timeout;
+
+        //less than 1sec
+        if ( us < 1000000 )
+        {
+            timeout.tv_sec = 0;
+            timeout.tv_usec = us;
+        }
+        //more than 1sec
+        else
+        {
+            float sec = static_cast<float> ( us ) / 1000000.f;
+            timeout.tv_sec = ( int ) sec;
+            float usec = ( sec - static_cast<float> ( timeout.tv_sec ) ) * 1000000;
+            timeout.tv_usec = ( int ) usec;
+        }
+        return SetOption ( SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof ( timeout ) );
+    }
+#endif
+
+    //local loop**********************************************************************************************************
+    int JackNetUnixSocket::SetLocalLoop()
+    {
+        char disable = 0;
+        return SetOption ( IPPROTO_IP, IP_MULTICAST_LOOP, &disable, sizeof ( disable ) );
+    }
+
+    //network operations**************************************************************************************************
+    int JackNetUnixSocket::SendTo ( const void* buffer, size_t nbytes, int flags )
+    {
+    #if defined(__sun__) || defined(sun)
+        if (WaitWrite() < 0)
+            return -1;
+    #endif
+        return sendto ( fSockfd, buffer, nbytes, flags, reinterpret_cast<socket_address_t*> ( &fSendAddr ), sizeof ( socket_address_t ) );
+    }
+
+    int JackNetUnixSocket::SendTo ( const void* buffer, size_t nbytes, int flags, const char* ip )
+    {
+        int addr_conv = inet_aton ( ip, &fSendAddr.sin_addr );
+        if ( addr_conv < 1 )
+            return addr_conv;
+    #if defined(__sun__) || defined(sun)
+        if (WaitWrite() < 0)
+            return -1;
+    #endif
+        return SendTo ( buffer, nbytes, flags );
+    }
+
+    int JackNetUnixSocket::Send ( const void* buffer, size_t nbytes, int flags )
+    {
+    #if defined(__sun__) || defined(sun)
+        if (WaitWrite() < 0)
+            return -1;
+    #endif
+        return send ( fSockfd, buffer, nbytes, flags );
+    }
+
+    int JackNetUnixSocket::RecvFrom ( void* buffer, size_t nbytes, int flags )
+    {
+        socklen_t addr_len = sizeof ( socket_address_t );
+    #if defined(__sun__) || defined(sun)
+        if (WaitRead() < 0)
+            return -1;
+    #endif  
+        return recvfrom ( fSockfd, buffer, nbytes, flags, reinterpret_cast<socket_address_t*> ( &fRecvAddr ), &addr_len );
+    }
+
+    int JackNetUnixSocket::Recv ( void* buffer, size_t nbytes, int flags )
+    {
+    #if defined(__sun__) || defined(sun)
+        if (WaitRead() < 0)
+            return -1;
+    #endif    
+        return recv ( fSockfd, buffer, nbytes, flags );
+    }
+
+    int JackNetUnixSocket::CatchHost ( void* buffer, size_t nbytes, int flags )
+    {
+        socklen_t addr_len = sizeof ( socket_address_t );
+    #if defined(__sun__) || defined(sun)
+        if (WaitRead() < 0)
+            return -1;
+    #endif    
+        return recvfrom ( fSockfd, buffer, nbytes, flags, reinterpret_cast<socket_address_t*> ( &fSendAddr ), &addr_len );
+    }
+
+    net_error_t JackNetUnixSocket::GetError()
+    {
+        switch ( errno )
+        {
+            case EAGAIN:
+            case ETIMEDOUT:
+                return NET_NO_DATA;
+                
+            case ECONNABORTED:
+            case ECONNREFUSED:
+            case ECONNRESET:
+            case EINVAL:
+            case EHOSTDOWN:
+            case EHOSTUNREACH:
+            case ENETDOWN:
+            case ENETUNREACH:
+                return NET_CONN_ERROR;
+                
+            default:
+                return NET_OP_ERROR;
+        }
+    }
+}
diff --git a/posix/JackNetUnixSocket.h b/posix/JackNetUnixSocket.h
new file mode 100644
index 0000000..34e69b0
--- /dev/null
+++ b/posix/JackNetUnixSocket.h
@@ -0,0 +1,108 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetUnixSocket__
+#define __JackNetUnixSocket__
+
+#include "JackNetSocket.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+namespace Jack
+{
+#define NET_ERROR_CODE errno
+#define SOCKET_ERROR -1
+#define StrError strerror
+
+    typedef struct sockaddr socket_address_t;
+    typedef struct in_addr address_t;
+
+    //JackNetUnixSocket********************************************
+    class SERVER_EXPORT JackNetUnixSocket
+    {
+        private:
+            int fSockfd;
+            int fPort;
+            int fTimeOut;
+
+            struct sockaddr_in fSendAddr;
+            struct sockaddr_in fRecvAddr;
+        #if defined(__sun__) || defined(sun)
+            int WaitRead();
+            int WaitWrite();
+        #endif
+        public:
+            JackNetUnixSocket();
+            JackNetUnixSocket ( const char* ip, int port );
+            JackNetUnixSocket ( const JackNetUnixSocket& );
+            ~JackNetUnixSocket();
+
+            JackNetUnixSocket& operator= ( const JackNetUnixSocket& socket );
+
+            //socket management
+            int NewSocket();
+            int Bind();
+            int BindWith ( const char* ip );
+            int BindWith ( int port );
+            int Connect();
+            int ConnectTo ( const char* ip );
+            void Close();
+            void Reset();
+            bool IsSocket();
+
+            //IP/PORT management
+            void SetPort ( int port );
+            int GetPort();
+
+            //address management
+            int SetAddress ( const char* ip, int port );
+            char* GetSendIP();
+            char* GetRecvIP();
+
+            //utility
+            int GetName ( char* name );
+            int JoinMCastGroup ( const char* mcast_ip );
+
+            //options management
+            int SetOption ( int level, int optname, const void* optval, socklen_t optlen );
+            int GetOption ( int level, int optname, void* optval, socklen_t* optlen );
+
+            //timeout
+            int SetTimeOut ( int us );
+
+            //disable local loop
+            int SetLocalLoop();
+
+            //network operations
+            int SendTo ( const void* buffer, size_t nbytes, int flags );
+            int SendTo ( const void* buffer, size_t nbytes, int flags, const char* ip );
+            int Send ( const void* buffer, size_t nbytes, int flags );
+            int RecvFrom ( void* buffer, size_t nbytes, int flags );
+            int Recv ( void* buffer, size_t nbytes, int flags );
+            int CatchHost ( void* buffer, size_t nbytes, int flags );
+
+            //error management
+            net_error_t GetError();
+    };
+}
+
+#endif
diff --git a/posix/JackPosixMutex.h b/posix/JackPosixMutex.h
new file mode 100644
index 0000000..ddf8955
--- /dev/null
+++ b/posix/JackPosixMutex.h
@@ -0,0 +1,132 @@
+/*
+ Copyright (C) 2006 Grame
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+ Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
+ grame at grame.fr
+*/
+
+#ifndef __JackPosixMutex__
+#define __JackPosixMutex__
+
+#include <pthread.h>
+#include <stdio.h>
+#include <assert.h>
+#include "JackError.h"
+
+namespace Jack
+{
+/*!
+\brief Mutex abstraction.
+*/
+
+    
+class JackBasePosixMutex
+{
+    
+    protected:
+        
+        pthread_mutex_t fMutex;
+        
+    public:
+        
+        JackBasePosixMutex()
+        {
+            pthread_mutex_init(&fMutex, NULL);        
+        }
+        
+        virtual ~JackBasePosixMutex()
+        {
+            pthread_mutex_destroy(&fMutex);
+        }
+        
+        void Lock()
+        {
+            int res = pthread_mutex_lock(&fMutex);
+            if (res != 0)
+                jack_error("JackBasePosixMutex::Lock res = %d", res);
+        }
+        
+        bool Trylock()
+        {
+            return (pthread_mutex_trylock(&fMutex) == 0);
+        }
+        
+        void Unlock()
+        {
+            int res = pthread_mutex_unlock(&fMutex);
+            if (res != 0)
+                jack_error("JackBasePosixMutex::Unlock res = %d", res);
+        }
+    
+};
+    
+class JackPosixMutex
+{
+
+    protected:
+
+        pthread_mutex_t fMutex;
+
+    public:
+
+        JackPosixMutex()
+        {
+            // Use recursive mutex
+            pthread_mutexattr_t mutex_attr;
+            int res;
+            res = pthread_mutexattr_init(&mutex_attr);
+            assert(res == 0);
+            res = pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
+            assert(res == 0);
+            res = pthread_mutex_init(&fMutex, &mutex_attr);
+            assert(res == 0);
+            res = pthread_mutexattr_destroy(&mutex_attr);
+            assert(res == 0);
+        }
+        
+        virtual ~JackPosixMutex()
+        {
+            pthread_mutex_destroy(&fMutex);
+        }
+
+        bool Lock()
+        {
+            int res = pthread_mutex_lock(&fMutex);
+            if (res != 0)
+                jack_error("JackPosixMutex::Lock res = %d", res);
+            return (res == 0);
+        }
+
+        bool Trylock()
+        {
+            return (pthread_mutex_trylock(&fMutex) == 0);
+        }
+
+        bool Unlock()
+        {
+            int res = pthread_mutex_unlock(&fMutex);
+            if (res != 0)
+                jack_error("JackPosixMutex::Unlock res = %d", res);
+            return (res == 0);
+        }
+
+};
+
+
+} // namespace
+
+#endif
diff --git a/posix/JackPosixSemaphore.cpp b/posix/JackPosixSemaphore.cpp
new file mode 100644
index 0000000..30530e1
--- /dev/null
+++ b/posix/JackPosixSemaphore.cpp
@@ -0,0 +1,218 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackPosixSemaphore.h"
+#include "JackTools.h"
+#include "JackConstants.h"
+#include "JackError.h"
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+namespace Jack
+{
+
+void JackPosixSemaphore::BuildName(const char* client_name, const char* server_name, char* res)
+{
+    char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
+    JackTools::RewriteName(client_name, ext_client_name);
+    sprintf(res, "jack_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name);
+}
+
+bool JackPosixSemaphore::Signal()
+{
+    int res;
+
+    if (!fSemaphore) {
+        jack_error("JackPosixSemaphore::Signal name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if (fFlush)
+        return true;
+
+    if ((res = sem_post(fSemaphore)) != 0) {
+        jack_error("JackPosixSemaphore::Signal name = %s err = %s", fName, strerror(errno));
+    }
+    return (res == 0);
+}
+
+bool JackPosixSemaphore::SignalAll()
+{
+    int res;
+
+    if (!fSemaphore) {
+        jack_error("JackPosixSemaphore::SignalAll name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if (fFlush)
+        return true;
+
+    if ((res = sem_post(fSemaphore)) != 0) {
+        jack_error("JackPosixSemaphore::SignalAll name = %s err = %s", fName, strerror(errno));
+    }
+    return (res == 0);
+}
+
+/*
+bool JackPosixSemaphore::Wait()
+{
+    int res;
+
+    if (!fSemaphore) {
+        jack_error("JackPosixSemaphore::Wait name = %s already desallocated!!", fName);
+        return false;
+    }
+
+    if ((res = sem_wait(fSemaphore)) != 0) {
+        jack_error("JackPosixSemaphore::Wait name = %s err = %s", fName, strerror(errno));
+    }
+    return (res == 0);
+}
+*/
+
+bool JackPosixSemaphore::Wait()
+{
+    int res;
+
+    while ((res = sem_wait(fSemaphore) < 0)) {
+        jack_error("JackPosixSemaphore::Wait name = %s err = %s", fName, strerror(errno));
+        if (errno != EINTR)
+            break;
+    }
+    return (res == 0);
+}
+
+#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) // glibc feature test
+
+bool JackPosixSemaphore::TimedWait(long usec) 
+{
+	int res;
+	struct timeval now;
+	timespec time;
+
+	if (!fSemaphore) {
+		jack_error("JackPosixSemaphore::TimedWait name = %s already desallocated!!", fName);
+		return false;
+	}
+	gettimeofday(&now, 0);
+	time.tv_sec = now.tv_sec + usec / 1000000;
+    long tv_usec = (now.tv_usec + (usec % 1000000));
+    time.tv_sec += tv_usec / 1000000;
+    time.tv_nsec = (tv_usec % 1000000) * 1000;
+
+    if ((res = sem_timedwait(fSemaphore, &time)) != 0) {
+        jack_error("JackPosixSemaphore::TimedWait err = %s", strerror(errno));
+        jack_log("now %ld %ld ", now.tv_sec, now.tv_usec);
+        jack_log("next %ld %ld ", time.tv_sec, time.tv_nsec/1000);
+    }
+    return (res == 0);
+}
+
+#else
+#warning "JackPosixSemaphore::TimedWait is not supported: Jack in SYNC mode with JackPosixSemaphore will not run properly !!"
+
+bool JackPosixSemaphore::TimedWait(long usec)
+{
+	return Wait();
+}
+#endif
+
+// Server side : publish the semaphore in the global namespace
+bool JackPosixSemaphore::Allocate(const char* name, const char* server_name, int value)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackPosixSemaphore::Allocate name = %s val = %ld", fName, value);
+
+    if ((fSemaphore = sem_open(fName, O_CREAT, 0777, value)) == (sem_t*)SEM_FAILED) {
+        jack_error("Allocate: can't check in named semaphore name = %s err = %s", fName, strerror(errno));
+        return false;
+    } else {
+        return true;
+    }
+}
+
+// Client side : get the published semaphore from server
+bool JackPosixSemaphore::ConnectInput(const char* name, const char* server_name)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackPosixSemaphore::Connect %s", fName);
+
+    // Temporary...
+    if (fSemaphore) {
+        jack_log("Already connected name = %s", name);
+        return true;
+    }
+
+    if ((fSemaphore = sem_open(fName, O_CREAT)) == (sem_t*)SEM_FAILED) {
+        jack_error("Connect: can't connect named semaphore name = %s err = %s", fName, strerror(errno));
+        return false;
+    } else {
+        int val = 0;
+        sem_getvalue(fSemaphore, &val);
+        jack_log("JackPosixSemaphore::Connect sem_getvalue %ld", val);
+        return true;
+    }
+}
+
+bool JackPosixSemaphore::Connect(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackPosixSemaphore::ConnectOutput(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackPosixSemaphore::Disconnect()
+{
+    jack_log("JackPosixSemaphore::Disconnect %s", fName);
+
+    if (fSemaphore) {
+        if (sem_close(fSemaphore) != 0) {
+            jack_error("Disconnect: can't disconnect named semaphore name = %s err = %s", fName, strerror(errno));
+            return false;
+        } else {
+            fSemaphore = NULL;
+            return true;
+        }
+    } else {
+        return true;
+    }
+}
+
+// Server side : destroy the semaphore
+void JackPosixSemaphore::Destroy()
+{
+    if (fSemaphore != NULL) {
+        jack_log("JackPosixSemaphore::Destroy");
+        sem_unlink(fName);
+        if (sem_close(fSemaphore) != 0) {
+            jack_error("Destroy: can't destroy semaphore name = %s err = %s", fName, strerror(errno));
+        }
+        fSemaphore = NULL;
+    } else {
+        jack_error("JackPosixSemaphore::Destroy semaphore == NULL");
+    }
+}
+
+} // end of namespace
+
diff --git a/posix/JackPosixSemaphore.h b/posix/JackPosixSemaphore.h
new file mode 100644
index 0000000..226db2a
--- /dev/null
+++ b/posix/JackPosixSemaphore.h
@@ -0,0 +1,69 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPosixSemaphore__
+#define __JackPosixSemaphore__
+
+#include "JackSynchro.h"
+#include "JackCompilerDeps.h"
+#include <semaphore.h>
+#include <time.h>
+#include <assert.h>
+
+namespace Jack
+{
+
+/*!
+\brief Inter process synchronization using POSIX semaphore.
+*/
+
+class SERVER_EXPORT JackPosixSemaphore : public detail::JackSynchro
+{
+
+    private:
+
+        sem_t* fSemaphore;
+
+    protected:
+
+        void BuildName(const char* name, const char* server_name, char* res);
+
+    public:
+
+        JackPosixSemaphore():JackSynchro(), fSemaphore(NULL)
+        {}
+
+        bool Signal();
+        bool SignalAll();
+        bool Wait();
+        bool TimedWait(long usec);
+
+        bool Allocate(const char* name, const char* server_name, int value);
+        bool Connect(const char* name, const char* server_name);
+        bool ConnectInput(const char* name, const char* server_name);
+        bool ConnectOutput(const char* name, const char* server_name);
+        bool Disconnect();
+        void Destroy();
+};
+
+} // end of namespace
+
+
+#endif
+
diff --git a/posix/JackPosixServerLaunch.cpp b/posix/JackPosixServerLaunch.cpp
new file mode 100644
index 0000000..855a2c5
--- /dev/null
+++ b/posix/JackPosixServerLaunch.cpp
@@ -0,0 +1,238 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackConstants.h"
+#include "JackChannel.h"
+#include "JackLibGlobals.h"
+#include "JackServerLaunch.h"
+#include "JackPlatformPlug.h"
+
+using namespace Jack;
+
+#if defined(USE_LIBDBUS_AUTOLAUNCH)
+
+#include <dbus/dbus.h>
+
+static int start_server_dbus(const char* server_name)
+{
+    DBusError err;
+    DBusConnection *conn;
+    DBusMessage *msg;
+
+    // initialise the errors
+    dbus_error_init(&err);
+
+    // connect to the bus
+    conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
+    if (dbus_error_is_set(&err)) {
+        fprintf(stderr, "Connection Error (%s)\n", err.message);
+        dbus_error_free(&err);
+    }
+    if (NULL == conn) {
+        return 1;
+    }
+
+    msg = dbus_message_new_method_call(
+        "org.jackaudio.service",     // target for the method call
+        "/org/jackaudio/Controller", // object to call on
+        "org.jackaudio.JackControl", // interface to call on
+        "StartServer");              // method name
+    if (NULL == msg) {
+        fprintf(stderr, "Message Null\n");
+        return 1;
+    }
+
+    // send message and get a handle for a reply
+    if (!dbus_connection_send(conn, msg, NULL))
+    {
+        fprintf(stderr, "Out Of Memory!\n");
+        return 1;
+    }
+
+    dbus_message_unref(msg);
+    dbus_connection_flush(conn);
+    dbus_error_free(&err);
+
+    return 0;
+}
+
+#else
+
+/* Exec the JACK server in this process.  Does not return. */
+static void start_server_classic_aux(const char* server_name)
+{
+    FILE* fp = 0;
+    char filename[255];
+    char arguments[255];
+    char buffer[255];
+    char* command = 0;
+    size_t pos = 0;
+    size_t result = 0;
+    char** argv = 0;
+    int i = 0;
+    int good = 0;
+    int ret;
+
+    snprintf(filename, 255, "%s/.jackdrc", getenv("HOME"));
+    fp = fopen(filename, "r");
+
+    if (!fp) {
+        fp = fopen("/etc/jackdrc", "r");
+    }
+    /* if still not found, check old config name for backwards compatability */
+    if (!fp) {
+        fp = fopen("/etc/jackd.conf", "r");
+    }
+
+    if (fp) {
+        arguments[0] = '\0';
+        ret = fscanf(fp, "%s", buffer);
+        while (ret != 0 && ret != EOF) {
+            strcat(arguments, buffer);
+            strcat(arguments, " ");
+            ret = fscanf(fp, "%s", buffer);
+        }
+        if (strlen(arguments) > 0) {
+            good = 1;
+        }
+        fclose(fp);
+    }
+
+    if (!good) {
+        command = (char*)(JACK_LOCATION "/jackd");
+        strncpy(arguments, JACK_LOCATION "/jackd -T -d "JACK_DEFAULT_DRIVER, 255);
+    } else {
+        result = strcspn(arguments, " ");
+        command = (char*)malloc(result + 1);
+        strncpy(command, arguments, result);
+        command[result] = '\0';
+    }
+
+    argv = (char**)malloc(255);
+
+    while (1) {
+        /* insert -T and -nserver_name in front of arguments */
+        if (i == 1) {
+            argv[i] = (char*)malloc(strlen ("-T") + 1);
+            strcpy (argv[i++], "-T");
+            if (server_name) {
+                size_t optlen = strlen("-n");
+                char* buf = (char*)malloc(optlen + strlen(server_name) + 1);
+                strcpy(buf, "-n");
+                strcpy(buf + optlen, server_name);
+                argv[i++] = buf;
+            }
+        }
+
+        result = strcspn(arguments + pos, " ");
+        if (result == 0) {
+            break;
+        }
+        argv[i] = (char*)malloc(result + 1);
+        strncpy(argv[i], arguments + pos, result);
+        argv[i][result] = '\0';
+        pos += result + 1;
+        ++i;
+    }
+    argv[i] = 0;
+    execv(command, argv);
+
+    /* If execv() succeeds, it does not return. There's no point
+     * in calling jack_error() here in the child process. */
+    fprintf(stderr, "exec of JACK server (command = \"%s\") failed: %s\n", command, strerror(errno));
+}
+
+static int start_server_classic(const char* server_name)
+{
+    /* The double fork() forces the server to become a child of
+     * init, which will always clean up zombie process state on
+     * termination. This even works in cases where the server
+     * terminates but this client does not.
+     *
+     * Since fork() is usually implemented using copy-on-write
+     * virtual memory tricks, the overhead of the second fork() is
+     * probably relatively small.
+     */
+    switch (fork()) {
+        case 0:					/* child process */
+            switch (fork()) {
+                case 0:			/* grandchild process */
+                    start_server_classic_aux(server_name);
+                    _exit(99);	/* exec failed */
+                case - 1:
+                    _exit(98);
+                default:
+                    _exit(0);
+            }
+        case - 1:			/* fork() error */
+            return 1;		/* failed to start server */
+    }
+
+    /* only the original parent process goes here */
+    return 0;			/* (probably) successful */
+}
+
+#endif
+
+static int start_server(const char* server_name, jack_options_t options)
+{
+    if ((options & JackNoStartServer) || getenv("JACK_NO_START_SERVER")) {
+        return 1;
+    }
+
+#if defined(USE_LIBDBUS_AUTOLAUNCH)
+    return start_server_dbus(server_name);
+#else
+    return start_server_classic(server_name);
+#endif
+}
+
+static int server_connect(char* server_name)
+{
+    JackClientChannel channel;
+    int res = channel.ServerCheck(server_name);
+    channel.Close();
+    return res;
+}
+
+int try_start_server(jack_varargs_t* va, jack_options_t options, jack_status_t* status)
+{
+    if (server_connect(va->server_name) < 0) {
+        int trys;
+        if (start_server(va->server_name, options)) {
+            int my_status1 = *status | JackFailure | JackServerFailed;
+            *status = (jack_status_t)my_status1;
+            return -1;
+        }
+        trys = 5;
+        do {
+            sleep(1);
+            if (--trys < 0) {
+                int my_status1 = *status | JackFailure | JackServerFailed;
+                *status = (jack_status_t)my_status1;
+                return -1;
+            }
+        } while (server_connect(va->server_name) < 0);
+        int my_status1 = *status | JackServerStarted;
+        *status = (jack_status_t)my_status1;
+    }
+
+    return 0;
+}
diff --git a/posix/JackPosixThread.cpp b/posix/JackPosixThread.cpp
new file mode 100644
index 0000000..67d2d0c
--- /dev/null
+++ b/posix/JackPosixThread.cpp
@@ -0,0 +1,360 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackPosixThread.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include "JackGlobals.h"
+#include <string.h> // for memset
+#include <unistd.h> // for _POSIX_PRIORITY_SCHEDULING check
+
+//#define JACK_SCHED_POLICY SCHED_RR
+#define JACK_SCHED_POLICY SCHED_FIFO
+
+namespace Jack
+{
+
+void* JackPosixThread::ThreadHandler(void* arg)
+{
+    JackPosixThread* obj = (JackPosixThread*)arg;
+    JackRunnableInterface* runnable = obj->fRunnable;
+    int err;
+
+    if ((err = pthread_setcanceltype(obj->fCancellation, NULL)) != 0) {
+        jack_error("pthread_setcanceltype err = %s", strerror(err));
+    }
+    
+    // Signal creation thread when started with StartSync
+    jack_log("ThreadHandler: start");
+    obj->fStatus = kIniting;
+    
+    // Call Init method
+    if (!runnable->Init()) {
+        jack_error("Thread init fails: thread quits");
+        return 0;
+    }
+    
+    obj->fStatus = kRunning;
+    
+    // If Init succeed, start the thread loop
+    bool res = true;
+    while (obj->fStatus == kRunning && res) {
+        res = runnable->Execute();
+    }
+
+    jack_log("ThreadHandler: exit");
+    pthread_exit(0);
+    return 0; // never reached
+}
+
+int JackPosixThread::Start()
+{
+    fStatus = kStarting;
+
+    // Check if the thread was correctly started
+    if (StartImp(&fThread, fPriority, fRealTime, ThreadHandler, this) < 0) {
+        fStatus = kIdle;
+        return -1;
+    } else {
+        return 0;
+    }
+}
+    
+int JackPosixThread::StartSync()
+{
+    fStatus = kStarting;
+    
+    if (StartImp(&fThread, fPriority, fRealTime, ThreadHandler, this) < 0) {
+        fStatus = kIdle;
+        return -1;
+    } else {
+        int count = 0;
+        while (fStatus == kStarting && ++count < 1000) {
+            JackSleep(1000);
+        }
+        return (count == 1000) ? -1 : 0;
+    }    
+}
+    
+int JackPosixThread::StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg)
+{
+    pthread_attr_t attributes;
+    struct sched_param rt_param;
+    pthread_attr_init(&attributes);
+    int res;
+
+    if ((res = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_JOINABLE))) {
+        jack_error("Cannot request joinable thread creation for thread res = %d", res);
+        return -1;
+    }
+
+    if ((res = pthread_attr_setscope(&attributes, PTHREAD_SCOPE_SYSTEM))) {
+        jack_error("Cannot set scheduling scope for thread res = %d", res);
+        return -1;
+    }
+
+    if (realtime) {
+    
+        jack_log("Create RT thread");
+
+        if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) {
+            jack_error("Cannot request explicit scheduling for RT thread res = %d", res);
+            return -1;
+    	}
+    
+        if ((res = pthread_attr_setschedpolicy(&attributes, JACK_SCHED_POLICY))) {
+            jack_error("Cannot set RR scheduling class for RT thread res = %d", res);
+            return -1;
+        }
+        
+        memset(&rt_param, 0, sizeof(rt_param));
+        rt_param.sched_priority = priority;
+
+        if ((res = pthread_attr_setschedparam(&attributes, &rt_param))) {
+            jack_error("Cannot set scheduling priority for RT thread res = %d", res);
+            return -1;
+        }
+
+    } else {
+        jack_log("Create non RT thread");
+    }
+
+    if ((res = pthread_attr_setstacksize(&attributes, THREAD_STACK))) {
+        jack_error("Cannot set thread stack size res = %d", res);
+        return -1;
+    }
+
+    if ((res = JackGlobals::fJackThreadCreator(thread, &attributes, start_routine, arg))) {
+        jack_error("Cannot create thread res = %d", res);
+        return -1;
+    }
+
+    pthread_attr_destroy(&attributes);
+    return 0;
+}
+
+int JackPosixThread::Kill()
+{
+    if (fThread != (pthread_t)NULL) { // If thread has been started
+        jack_log("JackPosixThread::Kill");
+        void* status;
+        pthread_cancel(fThread);
+        pthread_join(fThread, &status);
+        fStatus = kIdle;
+        fThread = (pthread_t)NULL;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackPosixThread::Stop()
+{
+    if (fThread != (pthread_t)NULL) { // If thread has been started
+        jack_log("JackPosixThread::Stop");
+        void* status;
+        fStatus = kIdle; // Request for the thread to stop
+        pthread_join(fThread, &status);
+        fThread = (pthread_t)NULL;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackPosixThread::KillImp(pthread_t thread)
+{
+    if (thread != (pthread_t)NULL) { // If thread has been started
+        jack_log("JackPosixThread::Kill");
+        void* status;
+        pthread_cancel(thread);
+        pthread_join(thread, &status);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackPosixThread::StopImp(pthread_t thread)
+{
+    if (thread != (pthread_t)NULL) { // If thread has been started
+        jack_log("JackPosixThread::Stop");
+        void* status;
+        pthread_join(thread, &status);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackPosixThread::AcquireRealTime()
+{
+    return (fThread != (pthread_t)NULL) ? AcquireRealTimeImp(fThread, fPriority) : -1;
+}
+
+int JackPosixThread::AcquireSelfRealTime()
+{
+    return AcquireRealTimeImp(pthread_self(), fPriority);
+}
+
+int JackPosixThread::AcquireRealTime(int priority)
+{
+    fPriority = priority;
+    return AcquireRealTime();
+}
+
+int JackPosixThread::AcquireSelfRealTime(int priority)
+{
+    fPriority = priority;
+    return AcquireSelfRealTime();
+}
+int JackPosixThread::AcquireRealTimeImp(pthread_t thread, int priority)
+{
+    struct sched_param rtparam;
+    int res;
+    memset(&rtparam, 0, sizeof(rtparam));
+    rtparam.sched_priority = priority;
+
+    if ((res = pthread_setschedparam(thread, JACK_SCHED_POLICY, &rtparam)) != 0) {
+        jack_error("Cannot use real-time scheduling (RR/%d)"
+                   "(%d: %s)", rtparam.sched_priority, res,
+                   strerror(res));
+        return -1;
+    }
+    return 0;
+}
+
+int JackPosixThread::DropRealTime()
+{
+    return (fThread != (pthread_t)NULL) ? DropRealTimeImp(fThread) : -1;
+}
+
+int JackPosixThread::DropSelfRealTime()
+{
+    return DropRealTimeImp(pthread_self());
+}
+
+int JackPosixThread::DropRealTimeImp(pthread_t thread)
+{
+    struct sched_param rtparam;
+    int res;
+    memset(&rtparam, 0, sizeof(rtparam));
+    rtparam.sched_priority = 0;
+
+    if ((res = pthread_setschedparam(thread, SCHED_OTHER, &rtparam)) != 0) {
+        jack_error("Cannot switch to normal scheduling priority(%s)", strerror(errno));
+        return -1;
+    }
+    return 0;
+}
+
+pthread_t JackPosixThread::GetThreadID()
+{
+    return fThread;
+}
+
+void JackPosixThread::Terminate()
+{
+    jack_log("JackPosixThread::Terminate");
+    pthread_exit(0);
+}
+
+SERVER_EXPORT void ThreadExit()
+{
+    jack_log("ThreadExit");
+    pthread_exit(0);
+}
+
+} // end of namespace
+
+bool jack_get_thread_realtime_priority_range(int * min_ptr, int * max_ptr)
+{
+#if defined(_POSIX_PRIORITY_SCHEDULING) && !defined(__APPLE__)
+    int min, max;
+
+    min = sched_get_priority_min(JACK_SCHED_POLICY);
+    if (min == -1)
+    {
+        jack_error("sched_get_priority_min() failed.");
+        return false;
+    }
+
+    max = sched_get_priority_max(JACK_SCHED_POLICY);
+    if (max == -1)
+    {
+        jack_error("sched_get_priority_max() failed.");
+        return false;
+    }
+
+    *min_ptr = min;
+    *max_ptr = max;
+
+    return true;
+#else
+    return false;
+#endif
+}
+
+bool jack_tls_allocate_key(jack_tls_key *key_ptr)
+{
+    int ret;
+    
+    ret = pthread_key_create(key_ptr, NULL);
+    if (ret != 0)
+    {
+        jack_error("pthread_key_create() failed with error %d", ret);
+        return false;
+    }
+    
+    return true;
+}
+
+bool jack_tls_free_key(jack_tls_key key)
+{
+    int ret;
+    
+    ret = pthread_key_delete(key);
+    if (ret != 0)
+    {
+        jack_error("pthread_key_delete() failed with error %d", ret);
+        return false;
+    }
+    
+    return true;
+}
+
+bool jack_tls_set(jack_tls_key key, void *data_ptr)
+{
+    int ret;
+    
+    ret = pthread_setspecific(key, (const void *)data_ptr);
+    if (ret != 0)
+    {
+        jack_error("pthread_setspecific() failed with error %d", ret);
+        return false;
+    }
+    
+    return true;
+}
+
+void *jack_tls_get(jack_tls_key key)
+{
+    return pthread_getspecific(key);
+}
diff --git a/posix/JackPosixThread.h b/posix/JackPosixThread.h
new file mode 100644
index 0000000..73345e1
--- /dev/null
+++ b/posix/JackPosixThread.h
@@ -0,0 +1,86 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPosixThread__
+#define __JackPosixThread__
+
+#include "JackThread.h"
+#include <pthread.h>
+
+namespace Jack
+{
+
+/* use 512KB stack per thread - the default is way too high to be feasible
+ * with mlockall() on many systems */
+#define THREAD_STACK 524288
+
+/*!
+\brief The POSIX thread base class.
+*/
+
+class SERVER_EXPORT JackPosixThread : public detail::JackThreadInterface
+{
+
+    protected:
+
+        pthread_t fThread;
+        static void* ThreadHandler(void* arg);
+
+    public:
+
+        JackPosixThread(JackRunnableInterface* runnable, bool real_time, int priority, int cancellation)
+                : JackThreadInterface(runnable, priority, real_time, cancellation), fThread((pthread_t)NULL)
+        {}
+        JackPosixThread(JackRunnableInterface* runnable, int cancellation = PTHREAD_CANCEL_ASYNCHRONOUS)
+                : JackThreadInterface(runnable, 0, false, cancellation), fThread((pthread_t)NULL)
+        {}
+
+        int Start();
+        int StartSync();
+        int Kill();
+        int Stop();
+        void Terminate();
+
+        int AcquireRealTime();                  // Used when called from another thread
+        int AcquireSelfRealTime();              // Used when called from thread itself
+        
+        int AcquireRealTime(int priority);      // Used when called from another thread
+        int AcquireSelfRealTime(int priority);  // Used when called from thread itself
+        
+        int DropRealTime();                     // Used when called from another thread
+        int DropSelfRealTime();                 // Used when called from thread itself
+
+        pthread_t GetThreadID();
+
+        static int AcquireRealTimeImp(pthread_t thread, int priority);
+        static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
+		{ return JackPosixThread::AcquireRealTimeImp(thread, priority); }
+        static int DropRealTimeImp(pthread_t thread);
+        static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg);
+        static int StopImp(pthread_t thread);
+        static int KillImp(pthread_t thread);
+};
+
+SERVER_EXPORT void ThreadExit();
+
+} // end of namespace
+
+
+#endif
diff --git a/posix/JackProcessSync.cpp b/posix/JackProcessSync.cpp
new file mode 100644
index 0000000..2daa49b
--- /dev/null
+++ b/posix/JackProcessSync.cpp
@@ -0,0 +1,146 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackProcessSync.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+void JackProcessSync::Signal()
+{
+    int res = pthread_cond_signal(&fCond);
+    if (res != 0)
+        jack_error("JackProcessSync::Signal error err = %s", strerror(res));
+}
+
+void JackProcessSync::LockedSignal()
+{
+    int res = pthread_mutex_lock(&fMutex);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedSignal error err = %s", strerror(res));
+    res = pthread_cond_signal(&fCond);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedSignal error err = %s", strerror(res));
+    res = pthread_mutex_unlock(&fMutex);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedSignal error err = %s", strerror(res));
+}
+
+void JackProcessSync::SignalAll()
+{
+    int res = pthread_cond_broadcast(&fCond);
+    if (res != 0)
+        jack_error("JackProcessSync::SignalAll error err = %s", strerror(res));
+}
+
+void JackProcessSync::LockedSignalAll()
+{
+    int res = pthread_mutex_lock(&fMutex);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedSignalAll error err = %s", strerror(res));
+    res = pthread_cond_broadcast(&fCond);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedSignalAll error err = %s", strerror(res));
+    res = pthread_mutex_unlock(&fMutex);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedSignalAll error err = %s", strerror(res));
+}
+
+void JackProcessSync::Wait()
+{
+    int res;
+    if ((res = pthread_cond_wait(&fCond, &fMutex)) != 0)
+        jack_error("JackProcessSync::Wait error err = %s", strerror(res));
+ }
+
+void JackProcessSync::LockedWait()
+{
+    int res;
+    res = pthread_mutex_lock(&fMutex);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedWait error err = %s", strerror(res));
+    if ((res = pthread_cond_wait(&fCond, &fMutex)) != 0)
+        jack_error("JackProcessSync::LockedWait error err = %s", strerror(res));
+    res = pthread_mutex_unlock(&fMutex);
+    if (res != 0)
+        jack_error("JackProcessSync::LockedWait error err = %s", strerror(res));
+}
+
+bool JackProcessSync::TimedWait(long usec)
+{
+    struct timeval T0, T1;
+    timespec time;
+    struct timeval now;
+    int res;
+
+    jack_log("JackProcessSync::TimedWait time out = %ld", usec);
+    gettimeofday(&T0, 0);
+
+    gettimeofday(&now, 0);
+    unsigned int next_date_usec = now.tv_usec + usec;
+    time.tv_sec = now.tv_sec + (next_date_usec / 1000000);
+    time.tv_nsec = (next_date_usec % 1000000) * 1000;
+    res = pthread_cond_timedwait(&fCond, &fMutex, &time);
+    if (res != 0)
+        jack_error("JackProcessSync::TimedWait error usec = %ld err = %s", usec, strerror(res));
+
+    gettimeofday(&T1, 0);
+    jack_log("JackProcessSync::TimedWait finished delta = %5.1lf",
+             (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec));
+    
+    return (res == 0);
+}
+
+bool JackProcessSync::LockedTimedWait(long usec)
+{
+    struct timeval T0, T1;
+    timespec time;
+    struct timeval now;
+    int res1, res2;
+
+    res1 = pthread_mutex_lock(&fMutex);
+    if (res1 != 0)
+        jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
+        
+    jack_log("JackProcessSync::TimedWait time out = %ld", usec);
+    gettimeofday(&T0, 0);
+
+    gettimeofday(&now, 0);
+    unsigned int next_date_usec = now.tv_usec + usec;
+    time.tv_sec = now.tv_sec + (next_date_usec / 1000000);
+    time.tv_nsec = (next_date_usec % 1000000) * 1000;
+    res2 = pthread_cond_timedwait(&fCond, &fMutex, &time);
+    if (res2 != 0)
+        jack_error("JackProcessSync::LockedTimedWait error usec = %ld err = %s", usec, strerror(res2));
+
+    gettimeofday(&T1, 0);
+    res1 = pthread_mutex_unlock(&fMutex);
+    if (res1 != 0)
+        jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
+        
+    jack_log("JackProcessSync::TimedWait finished delta = %5.1lf",
+             (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec));
+    
+    return (res2 == 0);
+}
+
+
+} // end of namespace
+
diff --git a/posix/JackProcessSync.h b/posix/JackProcessSync.h
new file mode 100644
index 0000000..5f45a01
--- /dev/null
+++ b/posix/JackProcessSync.h
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackProcessSync__
+#define __JackProcessSync__
+
+#include "JackPlatformPlug.h"
+#include "JackPosixMutex.h"
+#include <sys/time.h>
+#include <unistd.h>
+
+namespace Jack
+{
+
+/*!
+\brief  A synchronization primitive built using a condition variable.
+*/
+
+class JackProcessSync : public JackBasePosixMutex
+{
+
+    private:
+
+        pthread_cond_t fCond;   // Condition variable
+
+    public:
+
+        JackProcessSync():JackBasePosixMutex()
+        {
+            pthread_cond_init(&fCond, NULL);
+        }
+
+        virtual ~JackProcessSync()
+        {
+            pthread_cond_destroy(&fCond);
+        }
+
+        bool TimedWait(long usec);
+        bool LockedTimedWait(long usec);
+        
+        void Wait();
+        void LockedWait();
+         
+        void Signal();
+        void LockedSignal();
+         
+        void SignalAll();
+        void LockedSignalAll();
+  
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/posix/JackShmMem_os.h b/posix/JackShmMem_os.h
new file mode 100644
index 0000000..651eee9
--- /dev/null
+++ b/posix/JackShmMem_os.h
@@ -0,0 +1,32 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackShmMem_POSIX__
+#define __JackShmMem_POSIX__
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+#define CHECK_MLOCK(ptr, size) (mlock((ptr), (size)) == 0)
+#define CHECK_MUNLOCK(ptr, size) (munlock((ptr), (size)) == 0)
+#define CHECK_MLOCKALL() (mlockall(MCL_CURRENT | MCL_FUTURE) == 0)
+#define CHECK_MUNLOCKALL() (munlockall() == 0)
+
+#endif
diff --git a/posix/JackSocket.cpp b/posix/JackSocket.cpp
new file mode 100644
index 0000000..ec891ac
--- /dev/null
+++ b/posix/JackSocket.cpp
@@ -0,0 +1,309 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackSocket.h"
+#include "JackConstants.h"
+#include "JackTools.h"
+#include "JackError.h"
+#include <string.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <fcntl.h>
+
+namespace Jack
+{
+
+static void BuildName(const char* client_name, char* res, const char* dir, int which)
+{
+    char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
+    JackTools::RewriteName(client_name, ext_client_name);
+    sprintf(res, "%s/jack_%s_%d_%d", dir, ext_client_name, JackTools::GetUID(), which);
+}
+
+JackClientSocket::JackClientSocket(int socket): fSocket(socket),fTimeOut(0)
+{}
+
+#if defined(__sun__) || defined(sun)
+
+void JackClientSocket::SetReadTimeOut(long sec)
+{
+    int	flags;
+    fTimeOut = sec;
+    
+    if ((flags = fcntl(fSocket, F_GETFL, 0)) < 0) {
+		jack_error("JackClientSocket::SetReadTimeOut error in fcntl F_GETFL");
+		return;
+	}
+    
+	flags |= O_NONBLOCK;
+	if (fcntl(fSocket, F_SETFL, flags) < 0) {
+		jack_error("JackClientSocket::SetReadTimeOut error in fcntl F_SETFL");
+		return;
+	}
+}
+
+void JackClientSocket::SetWriteTimeOut(long sec)
+{
+    int	flags;
+    fTimeOut = sec;
+    
+    if ((flags = fcntl(fSocket, F_GETFL, 0)) < 0) {
+		jack_error("JackClientSocket::SetWriteTimeOut error in fcntl F_GETFL");
+		return;
+	}
+    
+	flags |= O_NONBLOCK;
+	if (fcntl(fSocket, F_SETFL, flags) < 0) {
+		jack_error("JackClientSocket::SetWriteTimeOut error in fcntl F_SETFL");
+		return;
+	}
+}
+
+#else
+
+void JackClientSocket::SetReadTimeOut(long sec)
+{
+    struct timeval timout;
+    timout.tv_sec = sec;
+    timout.tv_usec = 0;
+    if (setsockopt(fSocket, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timout, sizeof(timeval)) < 0) {
+        jack_error("SetReadTimeOut fd = %ld err = %s", fSocket, strerror(errno));
+    }
+}
+
+void JackClientSocket::SetWriteTimeOut(long sec)
+{
+    struct timeval timout;
+    timout.tv_sec = sec ;
+    timout.tv_usec = 0;
+    if (setsockopt(fSocket, SOL_SOCKET, SO_SNDTIMEO, (const char*)&timout, sizeof(timeval)) < 0) {
+        jack_error("SetWriteTimeOut fd = %ld err = %s", fSocket, strerror(errno));
+    }
+}
+
+#endif
+
+void JackClientSocket::SetNonBlocking(bool onoff)
+{   
+    if (onoff) {
+        long flags = 0;
+        if (fcntl(fSocket, F_SETFL, flags | O_NONBLOCK) < 0) {
+            jack_error("SetNonBlocking fd = %ld err = %s", fSocket, strerror(errno));
+        }
+    }
+}
+
+int JackClientSocket::Connect(const char* dir, const char* name, int which) // A revoir : utilisation de "which"
+{
+    struct sockaddr_un addr;
+
+    if ((fSocket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+        jack_error("Cannot create socket err = %s", strerror(errno));
+        return -1;
+    }
+
+    addr.sun_family = AF_UNIX;
+    BuildName(name, addr.sun_path, dir, which);
+    jack_log("Connect: addr.sun_path %s", addr.sun_path);
+
+    if (connect(fSocket, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+        jack_error("Cannot connect to server socket err = %s", strerror(errno));
+        close(fSocket);
+        return -1;
+    }
+
+#ifdef __APPLE__
+    int on = 1 ;
+    if (setsockopt(fSocket, SOL_SOCKET, SO_NOSIGPIPE, (const char*)&on, sizeof(on)) < 0) {
+        jack_log("setsockopt SO_NOSIGPIPE fd = %ld err = %s", fSocket, strerror(errno));
+    }
+#endif
+
+    return 0;
+}
+
+int JackClientSocket::Close()
+{
+    jack_log("JackClientSocket::Close");   
+    if (fSocket > 0) {
+        shutdown(fSocket, SHUT_RDWR);
+        close(fSocket);
+        fSocket = -1;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackClientSocket::Read(void* data, int len)
+{
+    int res;
+
+#if defined(__sun__) || defined(sun)
+    if (fTimeOut > 0) {
+
+        struct timeval tv;
+	    fd_set fdset;
+        ssize_t	res;
+    
+        tv.tv_sec = fTimeOut;
+	    tv.tv_usec = 0;
+    
+	    FD_ZERO(&fdset);
+	    FD_SET(fSocket, &fdset);
+    
+	    do {
+		    res = select(fSocket + 1, &fdset, NULL, NULL, &tv);
+	    } while (res < 0 && errno == EINTR);
+    
+	    if (res < 0) {
+		    return res;
+        } else if (res == 0) {
+		    return -1;
+	    }
+    }
+#endif
+        
+    if ((res = read(fSocket, data, len)) != len) {
+        if (errno == EWOULDBLOCK) {
+            jack_error("JackClientSocket::Read time out");
+            return 0;  // For a non blocking socket, a read failure is not considered as an error
+        } else if (res != 0) {
+            jack_error("Cannot read socket fd = %d err = %s", fSocket, strerror(errno));
+            return 0;
+        } else {
+            return -1;
+        }
+    } else {
+        return 0;
+    }
+}
+
+int JackClientSocket::Write(void* data, int len)
+{
+    int res;
+
+#if defined(__sun__) || defined(sun)
+    if (fTimeOut > 0) {
+ 
+        struct timeval tv;
+	    fd_set fdset;
+        ssize_t res;
+    
+        tv.tv_sec = fTimeOut;
+	    tv.tv_usec = 0;
+    
+	    FD_ZERO(&fdset);
+	    FD_SET(fSocket, &fdset);
+    
+	    do {
+		    res = select(fSocket + 1, NULL, &fdset, NULL, &tv);
+	    } while (res < 0 && errno == EINTR);
+    
+	    if (res < 0) {
+		    return res;
+        } else if (res == 0) {
+		   return -1;
+	    }
+   }
+#endif
+
+    if ((res = write(fSocket, data, len)) != len) {
+        if (errno == EWOULDBLOCK) {
+            jack_log("JackClientSocket::Write time out");
+            return 0;  // For a non blocking socket, a write failure is not considered as an error
+        } else if (res != 0) {
+            jack_error("Cannot write socket fd = %ld err = %s", fSocket, strerror(errno));
+            return 0;
+        } else {
+            return -1;
+        }
+    } else {
+        return 0;
+    }
+}
+
+int JackServerSocket::Bind(const char* dir, const char* name, int which) // A revoir : utilisation de "which"
+{
+    struct sockaddr_un addr;
+
+    if ((fSocket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+        jack_error("Cannot create server socket err = %s", strerror(errno));
+        return -1;
+    }
+
+    addr.sun_family = AF_UNIX;
+    BuildName(name, fName, dir, which);
+    strncpy(addr.sun_path, fName, sizeof(addr.sun_path) - 1);
+  
+    jack_log("Bind: addr.sun_path %s", addr.sun_path);
+    unlink(fName); // Security...
+
+    if (bind(fSocket, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+        jack_error("Cannot bind server to socket err = %s", strerror(errno));
+        goto error;
+    }
+
+    if (listen(fSocket, 1) < 0) {
+        jack_error("Cannot enable listen on server socket err = %s", strerror(errno));
+        goto error;
+    }
+
+    return 0;
+
+error:
+    unlink(fName);
+    close(fSocket);
+    return -1;
+}
+
+JackClientSocket* JackServerSocket::Accept()
+{
+    struct sockaddr_un client_addr;
+    socklen_t client_addrlen;
+
+    memset(&client_addr, 0, sizeof(client_addr));
+    client_addrlen = sizeof(client_addr);
+
+    int fd = accept(fSocket, (struct sockaddr*)&client_addr, &client_addrlen);
+    if (fd < 0) {
+        jack_error("Cannot accept new connection err = %s", strerror(errno));
+        return 0;
+    } else {
+        return new JackClientSocket(fd);
+    }
+}
+
+int JackServerSocket::Close()
+{
+    if (fSocket > 0) {
+        jack_log("JackServerSocket::Close %s", fName);
+        shutdown(fSocket, SHUT_RDWR);
+        close(fSocket);
+        unlink(fName);
+        fSocket = -1;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/posix/JackSocket.h b/posix/JackSocket.h
new file mode 100644
index 0000000..01e4953
--- /dev/null
+++ b/posix/JackSocket.h
@@ -0,0 +1,101 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackSocket__
+#define __JackSocket__
+
+#include <sys/types.h>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h> 
+#include <sys/time.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <unistd.h>
+
+namespace Jack
+{
+
+/*!
+\brief Client socket.
+*/
+
+class JackClientSocket
+{
+
+    private:
+
+        int fSocket;
+        int fTimeOut;
+   
+    public:
+
+        JackClientSocket(): fSocket( -1),fTimeOut(0)
+        {}
+        JackClientSocket(int socket);
+
+        int Connect(const char* dir, const char* name, int which);
+        int Close();
+        int Read(void* data, int len);
+        int Write(void* data, int len);
+        int GetFd()
+        {
+            return fSocket;
+        }
+        void SetReadTimeOut(long sec);
+        void SetWriteTimeOut(long sec);
+        
+        void SetNonBlocking(bool onoff);
+};
+
+/*!
+\brief Server socket.
+*/
+
+#define SOCKET_MAX_NAME_SIZE 256
+
+
+class JackServerSocket
+{
+
+    private:
+
+        int fSocket;
+        char fName[SOCKET_MAX_NAME_SIZE];
+
+    public:
+
+        JackServerSocket(): fSocket( -1)
+        {}
+        ~JackServerSocket()
+        {}
+
+        int Bind(const char* dir, const char* name, int which);
+        JackClientSocket* Accept();
+        int Close();
+        int GetFd()
+        {
+            return fSocket;
+        }
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/posix/JackSocketClientChannel.cpp b/posix/JackSocketClientChannel.cpp
new file mode 100644
index 0000000..d2d4b67
--- /dev/null
+++ b/posix/JackSocketClientChannel.cpp
@@ -0,0 +1,344 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackSocketClientChannel.h"
+#include "JackRequest.h"
+#include "JackClient.h"
+#include "JackGlobals.h"
+
+namespace Jack
+{
+
+JackSocketClientChannel::JackSocketClientChannel():
+    fThread(this)
+{
+    fNotificationSocket = NULL;
+    fClient = NULL;
+}
+
+JackSocketClientChannel::~JackSocketClientChannel()
+{
+    delete fNotificationSocket;
+}
+
+int JackSocketClientChannel::ServerCheck(const char* server_name)
+{
+    jack_log("JackSocketClientChannel::ServerCheck = %s", server_name);
+
+    // Connect to server
+    if (fRequestSocket.Connect(jack_server_dir, server_name, 0) < 0) {
+        jack_error("Cannot connect to server socket");
+        fRequestSocket.Close();
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackSocketClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
+{
+    int result = 0;
+    jack_log("JackSocketClientChannel::Open name = %s", name);
+
+    if (fRequestSocket.Connect(jack_server_dir, server_name, 0) < 0) {
+        jack_error("Cannot connect to server socket");
+        goto error;
+    }
+
+    // Check name in server
+    ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
+    if (result < 0) {
+        int status1 = *status;
+        if (status1 & JackVersionError)
+            jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
+        else
+            jack_error("Client name = %s conflits with another running client", name);
+        goto error;
+    }
+
+    if (fNotificationListenSocket.Bind(jack_client_dir, name_res, 0) < 0) {
+        jack_error("Cannot bind socket");
+        goto error;
+    }
+
+    fClient = obj;
+    return 0;
+
+error:
+    fRequestSocket.Close();
+    fNotificationListenSocket.Close();
+    return -1;
+}
+
+void JackSocketClientChannel::Close()
+{
+    fRequestSocket.Close();
+    fNotificationListenSocket.Close();
+    if (fNotificationSocket)
+        fNotificationSocket->Close();
+}
+
+int JackSocketClientChannel::Start()
+{
+    jack_log("JackSocketClientChannel::Start");
+    /*
+     To be sure notification thread is started before ClientOpen is called.
+    */
+    if (fThread.StartSync() != 0) {
+        jack_error("Cannot start Jack client listener");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+
+void JackSocketClientChannel::Stop()
+{
+    jack_log("JackSocketClientChannel::Stop");
+    fThread.Kill();
+}
+
+void JackSocketClientChannel::ServerSyncCall(JackRequest* req, JackResult* res, int* result)
+{
+    if (req->Write(&fRequestSocket) < 0) {
+        jack_error("Could not write request type = %ld", req->fType);
+        *result = -1;
+        return;
+    }
+
+    if (res->Read(&fRequestSocket) < 0) {
+        jack_error("Could not read result type = %ld", req->fType);
+        *result = -1;
+        return;
+    }
+
+    *result = res->fResult;
+}
+
+void JackSocketClientChannel::ServerAsyncCall(JackRequest* req, JackResult* res, int* result)
+{
+    if (req->Write(&fRequestSocket) < 0) {
+        jack_error("Could not write request type = %ld", req->fType);
+        *result = -1;
+    } else {
+        *result = 0;
+    }
+}
+
+void JackSocketClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
+{
+    JackClientCheckRequest req(name, protocol, options);
+    JackClientCheckResult res;
+    ServerSyncCall(&req, &res, result);
+    *status = res.fStatus;
+    strcpy(name_res, res.fName);
+}
+
+void JackSocketClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    JackClientOpenRequest req(name, pid);
+    JackClientOpenResult res;
+    ServerSyncCall(&req, &res, result);
+    *shared_engine = res.fSharedEngine;
+    *shared_client = res.fSharedClient;
+    *shared_graph = res.fSharedGraph;
+}
+
+void JackSocketClientChannel::ClientClose(int refnum, int* result)
+{
+    JackClientCloseRequest req(refnum);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::ClientActivate(int refnum, int is_real_time, int* result)
+{
+    JackActivateRequest req(refnum, is_real_time);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::ClientDeactivate(int refnum, int* result)
+{
+    JackDeactivateRequest req(refnum);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
+{
+    JackPortRegisterRequest req(refnum, name, type, flags, buffer_size);
+    JackPortRegisterResult res;
+    ServerSyncCall(&req, &res, result);
+    *port_index = res.fPortIndex;
+}
+
+void JackSocketClientChannel::PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
+{
+    JackPortUnRegisterRequest req(refnum, port_index);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::PortConnect(int refnum, const char* src, const char* dst, int* result)
+{
+    JackPortConnectNameRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::PortDisconnect(int refnum, const char* src, const char* dst, int* result)
+{
+    JackPortDisconnectNameRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+{
+    JackPortConnectRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+{
+    JackPortDisconnectRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
+{
+    JackPortRenameRequest req(refnum, port, name);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::SetBufferSize(jack_nframes_t buffer_size, int* result)
+{
+    JackSetBufferSizeRequest req(buffer_size);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::SetFreewheel(int onoff, int* result)
+{
+    JackSetFreeWheelRequest req(onoff);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::ReleaseTimebase(int refnum, int* result)
+{
+    JackReleaseTimebaseRequest req(refnum);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::SetTimebaseCallback(int refnum, int conditional, int* result)
+{
+    JackSetTimebaseCallbackRequest req(refnum, conditional);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackSocketClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
+{
+    JackGetInternalClientNameRequest req(refnum, int_ref);
+    JackGetInternalClientNameResult res;
+    ServerSyncCall(&req, &res, result);
+    strcpy(name_res, res.fName);
+}
+
+void JackSocketClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
+{
+    JackInternalClientHandleRequest req(refnum, client_name);
+    JackInternalClientHandleResult res;
+    ServerSyncCall(&req, &res, result);
+    *int_ref = res.fIntRefNum;
+    *status = res.fStatus;
+}
+
+void JackSocketClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
+{
+    JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options);
+    JackInternalClientLoadResult res;
+    ServerSyncCall(&req, &res, result);
+    *int_ref = res.fIntRefNum;
+    *status = res.fStatus;
+}
+
+void JackSocketClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result)
+{
+    JackInternalClientUnloadRequest req(refnum, int_ref);
+    JackInternalClientUnloadResult res;
+    ServerSyncCall(&req, &res, result);
+    *status = res.fStatus;
+}
+
+bool JackSocketClientChannel::Init()
+{
+    jack_log("JackSocketClientChannel::Init");
+    fNotificationSocket = fNotificationListenSocket.Accept();
+    // No more needed
+    fNotificationListenSocket.Close();
+
+    if (!fNotificationSocket) {
+        jack_error("JackSocketClientChannel: cannot establish notication socket");
+        return false;
+    } else {
+        return fClient->Init();
+    }
+}
+
+bool JackSocketClientChannel::Execute()
+{
+    JackClientNotification event;
+    JackResult res;
+
+    if (event.Read(fNotificationSocket) < 0) {
+        fNotificationSocket->Close();
+        jack_error("JackSocketClientChannel read fail");
+        goto error;
+    }
+
+    res.fResult = fClient->ClientNotify(event.fRefNum, event.fName, event.fNotify, event.fSync, event.fMessage, event.fValue1, event.fValue2);
+
+    if (event.fSync) {
+        if (res.Write(fNotificationSocket) < 0) {
+            fNotificationSocket->Close();
+            jack_error("JackSocketClientChannel write fail");
+            goto error;
+        }
+    }
+    return true;
+
+error:
+    fClient->ShutDown();
+    return false;
+}
+
+} // end of namespace
+
+
+
+
+
diff --git a/posix/JackSocketClientChannel.h b/posix/JackSocketClientChannel.h
new file mode 100644
index 0000000..c900429
--- /dev/null
+++ b/posix/JackSocketClientChannel.h
@@ -0,0 +1,102 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackSocketClientChannel__
+#define __JackSocketClientChannel__
+
+#include "JackChannel.h"
+#include "JackSocket.h"
+#include "JackPlatformPlug.h"
+#include "JackRequest.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackClientChannel using sockets.
+*/
+
+class JackSocketClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface
+{
+
+    private:
+
+        JackClientSocket fRequestSocket;			// Socket to communicate with the server
+        JackServerSocket fNotificationListenSocket;	// Socket listener for server notification
+        JackClientSocket* fNotificationSocket;		// Socket for server notification
+        JackThread fThread;                         // Thread to execute the event loop
+        JackClient*	fClient;
+
+        void ServerSyncCall(JackRequest* req, JackResult* res, int* result);
+        void ServerAsyncCall(JackRequest* req, JackResult* res, int* result);
+
+    public:
+
+        JackSocketClientChannel();
+        virtual ~JackSocketClientChannel();
+
+        int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
+        void Close();
+
+        int Start();
+        void Stop();
+
+        int ServerCheck(const char* server_name);
+
+        void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result);
+        void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
+        void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
+        {}
+        void ClientClose(int refnum, int* result);
+
+        void ClientActivate(int refnum, int is_real_time, int* result);
+        void ClientDeactivate(int refnum, int* result);
+
+        void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result);
+        void PortUnRegister(int refnum, jack_port_id_t port_index, int* result);
+
+        void PortConnect(int refnum, const char* src, const char* dst, int* result);
+        void PortDisconnect(int refnum, const char* src, const char* dst, int* result);
+
+        void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
+        void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
+        
+        void PortRename(int refnum, jack_port_id_t port, const char* name, int* result);
+
+        void SetBufferSize(jack_nframes_t buffer_size, int* result);
+        void SetFreewheel(int onoff, int* result);
+
+        void ReleaseTimebase(int refnum, int* result);
+        void SetTimebaseCallback(int refnum, int conditional, int* result);
+
+        void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
+        void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
+        void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
+        void InternalClientUnload(int refnum, int int_ref, int* status, int* result);
+
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/posix/JackSocketNotifyChannel.cpp b/posix/JackSocketNotifyChannel.cpp
new file mode 100644
index 0000000..35737b0
--- /dev/null
+++ b/posix/JackSocketNotifyChannel.cpp
@@ -0,0 +1,80 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackRequest.h"
+#include "JackSocketNotifyChannel.h"
+#include "JackError.h"
+#include "JackConstants.h"
+
+namespace Jack
+{
+
+// Server to client
+int JackSocketNotifyChannel::Open(const char* name)
+{
+    jack_log("JackSocketNotifyChannel::Open name = %s", name);
+
+    // Connect to client listen socket
+    if (fNotifySocket.Connect(jack_client_dir, name, 0) < 0) {
+        jack_error("Cannot connect client socket");
+        return -1;
+    }
+    
+    // Use a time out for notifications
+    fNotifySocket.SetReadTimeOut(SOCKET_TIME_OUT);
+    return 0;
+}
+
+void JackSocketNotifyChannel::Close()
+{
+    jack_log("JackSocketNotifyChannel::Close");
+    fNotifySocket.Close();
+}
+
+void JackSocketNotifyChannel::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result)
+{
+    JackClientNotification event(name, refnum, notify, sync, message, value1, value2);
+    JackResult res;
+
+    // Send notification
+    if (event.Write(&fNotifySocket) < 0) {
+        jack_error("Could not write notification");
+        fNotifySocket.Close();
+        *result = -1;
+        return;
+    }
+
+    // Read the result in "synchronous" mode only
+    if (sync) {
+        // Get result : use a time out
+        if (res.Read(&fNotifySocket) < 0) {
+            jack_error("Could not read result");
+            fNotifySocket.Close();
+            *result = -1;
+        } else {
+            *result = res.fResult;
+        }
+    } else {
+        *result = 0;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/posix/JackSocketNotifyChannel.h b/posix/JackSocketNotifyChannel.h
new file mode 100644
index 0000000..5d53291
--- /dev/null
+++ b/posix/JackSocketNotifyChannel.h
@@ -0,0 +1,54 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackSocketNotifyChannel__
+#define __JackSocketNotifyChannel__
+
+#include "JackChannel.h"
+#include "JackSocket.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackNotifyChannel using sockets.
+*/
+
+class JackSocketNotifyChannel
+{
+
+    private:
+
+        JackClientSocket fNotifySocket;    // Socket to communicate with the server : from server to client
+
+    public:
+
+        JackSocketNotifyChannel()
+        {}
+
+        int Open(const char* name);		// Open the Server/Client connection
+        void Close();					// Close the Server/Client connection
+
+        void ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result);
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/posix/JackSocketServerChannel.cpp b/posix/JackSocketServerChannel.cpp
new file mode 100644
index 0000000..d2a59b3
--- /dev/null
+++ b/posix/JackSocketServerChannel.cpp
@@ -0,0 +1,487 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackSocketServerChannel.h"
+#include "JackRequest.h"
+#include "JackServer.h"
+#include "JackLockedEngine.h"
+#include "JackGlobals.h"
+#include "JackServerGlobals.h"
+#include "JackClient.h"
+#include "JackTools.h"
+#include "JackNotification.h"
+#include "JackException.h"
+
+#include <assert.h>
+#include <signal.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+JackSocketServerChannel::JackSocketServerChannel():
+    fThread(this)
+{
+    fPollTable = NULL;
+    fRebuild = true;
+}
+
+JackSocketServerChannel::~JackSocketServerChannel()
+{
+    delete[] fPollTable;
+}
+
+int JackSocketServerChannel::Open(const char* server_name, JackServer* server)
+{
+    jack_log("JackSocketServerChannel::Open");
+   
+    // Prepare request socket
+    if (fRequestListenSocket.Bind(jack_server_dir, server_name, 0) < 0) {
+        jack_log("JackSocketServerChannel::Open : cannot create result listen socket");
+        return -1;
+    }
+
+    // Prepare for poll
+    BuildPoolTable();
+    fServer = server;
+    return 0;
+}
+
+void JackSocketServerChannel::Close()
+{
+    fThread.Stop();
+    fRequestListenSocket.Close();
+
+    // Close remaining client sockets
+    std::map<int, std::pair<int, JackClientSocket*> >::iterator it;
+    for (it = fSocketTable.begin(); it != fSocketTable.end(); it++) {
+        pair<int, JackClientSocket*> elem = (*it).second;
+        JackClientSocket* socket = elem.second;
+        assert(socket);
+        socket->Close();
+        delete socket;
+    }
+}
+    
+int JackSocketServerChannel::Start()
+{
+    if (fThread.Start() != 0) {
+        jack_error("Cannot start Jack server listener");
+        return -1;
+    }  
+    
+    return 0;
+}
+
+void JackSocketServerChannel::ClientCreate()
+{
+    jack_log("JackSocketServerChannel::ClientCreate socket");
+    JackClientSocket* socket = fRequestListenSocket.Accept();
+    if (socket) {
+        fSocketTable[socket->GetFd()] = make_pair( -1, socket);
+        fRebuild = true;
+    } else {
+        jack_error("Client socket cannot be created");
+    }
+}
+
+void JackSocketServerChannel::ClientAdd(int fd, char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    jack_log("JackSocketServerChannel::ClientAdd");
+    int refnum = -1;
+    *result = fServer->GetEngine()->ClientExternalOpen(name, pid, &refnum, shared_engine, shared_client, shared_graph);
+    if (*result == 0) {
+        fSocketTable[fd].first = refnum;
+        fRebuild = true;
+    } else {
+        jack_error("Cannot create new client");
+    }
+}
+
+void JackSocketServerChannel::ClientRemove(int fd, int refnum)
+{
+    pair<int, JackClientSocket*> elem = fSocketTable[fd];
+    JackClientSocket* socket = elem.second;
+    assert(socket);
+    jack_log("JackSocketServerChannel::ClientRemove ref = %d", refnum);
+    fSocketTable.erase(fd);
+    socket->Close();
+    delete socket;
+    fRebuild = true;
+}
+
+void JackSocketServerChannel::ClientKill(int fd)
+{
+    pair<int, JackClientSocket*> elem = fSocketTable[fd];
+    JackClientSocket* socket = elem.second;
+    int refnum = elem.first;
+
+    assert(socket);
+    jack_log("JackSocketServerChannel::ClientKill ref = %d", refnum);
+
+    if (refnum == -1) {  // Should never happen... correspond to a client that started the socket but never opened...
+        jack_log("Client was not opened : probably correspond to server_check");
+    } else {
+        fServer->ClientKill(refnum);
+    }
+
+    fSocketTable.erase(fd);
+    socket->Close();
+    delete socket;
+    fRebuild = true;
+}
+
+bool JackSocketServerChannel::HandleRequest(int fd)
+{
+    pair<int, JackClientSocket*> elem = fSocketTable[fd];
+    JackClientSocket* socket = elem.second;
+    assert(socket);
+
+    // Read header
+    JackRequest header;
+    if (header.Read(socket) < 0) {
+        jack_log("HandleRequest: cannot read header");
+        ClientKill(fd);  // TO CHECK SOLARIS
+        return false;
+    }
+
+    // Read data
+    switch (header.fType) {
+
+        case JackRequest::kClientCheck: {
+            jack_log("JackRequest::ClientCheck");
+            JackClientCheckRequest req;
+            JackClientCheckResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->ClientCheck(req.fName, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ClientCheck write error name = %s", req.fName);
+            break;
+        }
+
+        case JackRequest::kClientOpen: {
+            jack_log("JackRequest::ClientOpen");
+            JackClientOpenRequest req;
+            JackClientOpenResult res;
+            if (req.Read(socket) == 0)
+                ClientAdd(fd, req.fName, req.fPID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ClientOpen write error name = %s", req.fName);
+            break;
+        }
+
+        case JackRequest::kClientClose: {
+            jack_log("JackRequest::ClientClose");
+            JackClientCloseRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->ClientExternalClose(req.fRefNum);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ClientClose write error ref = %d", req.fRefNum);
+            ClientRemove(fd, req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kActivateClient: {
+            JackActivateRequest req;
+            JackResult res;
+            jack_log("JackRequest::ActivateClient");
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->ClientActivate(req.fRefNum, req.fIsRealTime);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ActivateClient write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kDeactivateClient: {
+            jack_log("JackRequest::DeactivateClient");
+            JackDeactivateRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->ClientDeactivate(req.fRefNum);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::DeactivateClient write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kRegisterPort: {
+            jack_log("JackRequest::RegisterPort");
+            JackPortRegisterRequest req;
+            JackPortRegisterResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortRegister(req.fRefNum, req.fName, req.fPortType, req.fFlags, req.fBufferSize, &res.fPortIndex);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::RegisterPort write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kUnRegisterPort: {
+            jack_log("JackRequest::UnRegisterPort");
+            JackPortUnRegisterRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortUnRegister(req.fRefNum, req.fPortIndex);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::UnRegisterPort write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kConnectNamePorts: {
+            jack_log("JackRequest::ConnectNamePorts");
+            JackPortConnectNameRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortConnect(req.fRefNum, req.fSrc, req.fDst);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ConnectNamePorts write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kDisconnectNamePorts: {
+            jack_log("JackRequest::DisconnectNamePorts");
+            JackPortDisconnectNameRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortDisconnect(req.fRefNum, req.fSrc, req.fDst);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::DisconnectNamePorts write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kConnectPorts: {
+            jack_log("JackRequest::ConnectPorts");
+            JackPortConnectRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortConnect(req.fRefNum, req.fSrc, req.fDst);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ConnectPorts write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kDisconnectPorts: {
+            jack_log("JackRequest::DisconnectPorts");
+            JackPortDisconnectRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortDisconnect(req.fRefNum, req.fSrc, req.fDst);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::DisconnectPorts write error ref = %d", req.fRefNum);
+            break;
+        }
+        
+        case JackRequest::kPortRename: {
+            jack_log("JackRequest::PortRename");
+            JackPortRenameRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->PortRename(req.fRefNum, req.fPort, req.fName);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::PortRename write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kSetBufferSize: {
+            jack_log("JackRequest::SetBufferSize");
+            JackSetBufferSizeRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->SetBufferSize(req.fBufferSize);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::SetBufferSize write error");
+            break;
+        }
+
+        case JackRequest::kSetFreeWheel: {
+            jack_log("JackRequest::SetFreeWheel");
+            JackSetFreeWheelRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->SetFreewheel(req.fOnOff);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::SetFreeWheel write error");
+            break;
+        }
+
+        case JackRequest::kReleaseTimebase: {
+            jack_log("JackRequest::ReleaseTimebase");
+            JackReleaseTimebaseRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->ReleaseTimebase(req.fRefNum);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::ReleaseTimebase write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kSetTimebaseCallback: {
+            jack_log("JackRequest::SetTimebaseCallback");
+            JackSetTimebaseCallbackRequest req;
+            JackResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->SetTimebaseCallback(req.fRefNum, req.fConditionnal);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::SetTimebaseCallback write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kGetInternalClientName: {
+            jack_log("JackRequest::GetInternalClientName");
+            JackGetInternalClientNameRequest req;
+            JackGetInternalClientNameResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->GetInternalClientName(req.fIntRefNum, res.fName);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::GetInternalClientName write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kInternalClientHandle: {
+            jack_log("JackRequest::InternalClientHandle");
+            JackInternalClientHandleRequest req;
+            JackInternalClientHandleResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->InternalClientHandle(req.fName, &res.fStatus, &res.fIntRefNum);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::InternalClientHandle write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kInternalClientLoad: {
+            jack_log("JackRequest::InternalClientLoad");
+            JackInternalClientLoadRequest req;
+            JackInternalClientLoadResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, &res.fStatus);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::InternalClientLoad write error name = %s", req.fName);
+            break;
+        }
+
+        case JackRequest::kInternalClientUnload: {
+            jack_log("JackRequest::InternalClientUnload");
+            JackInternalClientUnloadRequest req;
+            JackInternalClientUnloadResult res;
+            if (req.Read(socket) == 0)
+                res.fResult = fServer->GetEngine()->InternalClientUnload(req.fIntRefNum, &res.fStatus);
+            if (res.Write(socket) < 0)
+                jack_error("JackRequest::InternalClientUnload write error ref = %d", req.fRefNum);
+            break;
+        }
+
+        case JackRequest::kNotification: {
+            jack_log("JackRequest::Notification");
+            JackClientNotificationRequest req;
+            if (req.Read(socket) == 0) {
+                if (req.fNotify == kQUIT) {
+                    jack_log("JackRequest::Notification kQUIT");
+                    throw JackQuitException();
+                } else {
+                    fServer->Notify(req.fRefNum, req.fNotify, req.fValue);
+                }
+            }
+            break;
+        }
+
+        default:
+            jack_error("Unknown request %ld", header.fType);
+            break;
+    }
+     
+    return true;
+}
+
+void JackSocketServerChannel::BuildPoolTable()
+{
+    if (fRebuild) {
+        fRebuild = false;
+        delete[] fPollTable;
+        fPollTable = new pollfd[fSocketTable.size() + 1];
+
+        jack_log("JackSocketServerChannel::BuildPoolTable size = %d", fSocketTable.size() + 1);
+
+        // First fd is the server request socket
+        fPollTable[0].fd = fRequestListenSocket.GetFd();
+        fPollTable[0].events = POLLIN | POLLERR;
+
+        // Next fd for clients
+        map<int, pair<int, JackClientSocket*> >::iterator it;
+        int i;
+
+        for (i = 1, it = fSocketTable.begin(); it != fSocketTable.end(); it++, i++) {
+            jack_log("fSocketTable i = %ld fd = %ld", i, it->first);
+            fPollTable[i].fd = it->first;
+            fPollTable[i].events = POLLIN | POLLPRI | POLLERR | POLLHUP | POLLNVAL;
+        }
+    }
+}
+
+bool JackSocketServerChannel::Init()
+{
+    sigset_t set;
+    sigemptyset(&set);
+    sigaddset(&set, SIGPIPE);
+    pthread_sigmask(SIG_BLOCK, &set, 0);
+    return true;
+}
+
+bool JackSocketServerChannel::Execute()
+{
+    try {
+    
+        // Global poll
+        if ((poll(fPollTable, fSocketTable.size() + 1, 10000) < 0) && (errno != EINTR)) {
+            jack_error("Engine poll failed err = %s request thread quits...", strerror(errno));
+            return false;
+        } else {
+
+            // Poll all clients
+            for (unsigned int i = 1; i < fSocketTable.size() + 1; i++) {
+                int fd = fPollTable[i].fd;
+                jack_log("fPollTable i = %ld fd = %ld", i, fd);
+                if (fPollTable[i].revents & ~POLLIN) {
+                    jack_log("Poll client error err = %s", strerror(errno));
+                    ClientKill(fd);
+                } else if (fPollTable[i].revents & POLLIN) {
+                    if (!HandleRequest(fd)) 
+                        jack_log("Could not handle external client request");
+                }
+            }
+
+            // Check the server request socket */
+            if (fPollTable[0].revents & POLLERR) 
+                jack_error("Error on server request socket err = %s", strerror(errno));
+       
+            if (fPollTable[0].revents & POLLIN) 
+                ClientCreate();
+        }
+
+        BuildPoolTable();
+        return true;
+        
+    } catch (JackQuitException& e) {
+        jack_log("JackMachServerChannel::Execute JackQuitException");
+        return false;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/posix/JackSocketServerChannel.h b/posix/JackSocketServerChannel.h
new file mode 100644
index 0000000..60b8632
--- /dev/null
+++ b/posix/JackSocketServerChannel.h
@@ -0,0 +1,75 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackSocketServerChannel__
+#define __JackSocketServerChannel__
+
+#include "JackSocket.h"
+#include "JackPlatformPlug.h"
+#include <poll.h>
+#include <map>
+
+namespace Jack
+{
+
+class JackServer;
+
+/*!
+\brief JackServerChannel using sockets.
+*/
+
+class JackSocketServerChannel : public JackRunnableInterface
+{
+
+    private:
+
+        JackServerSocket fRequestListenSocket;	// Socket to create request socket for the client
+        JackThread fThread;                     // Thread to execute the event loop
+        JackServer*	fServer;
+        pollfd*	fPollTable;
+        bool fRebuild;
+        std::map<int, std::pair<int, JackClientSocket*> > fSocketTable;
+
+        bool HandleRequest(int fd);
+        void BuildPoolTable();
+
+        void ClientCreate();
+        void ClientAdd(int fd, char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
+        void ClientRemove(int fd, int refnum);
+        void ClientKill(int fd);
+
+    public:
+
+        JackSocketServerChannel();
+        ~JackSocketServerChannel();
+
+        int Open(const char* server_name, JackServer* server);  // Open the Server/Client connection
+        void Close();                                           // Close the Server/Client connection
+    
+        int Start();
+
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/posix/JackSocketServerNotifyChannel.cpp b/posix/JackSocketServerNotifyChannel.cpp
new file mode 100644
index 0000000..df7381f
--- /dev/null
+++ b/posix/JackSocketServerNotifyChannel.cpp
@@ -0,0 +1,70 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackSocketServerNotifyChannel.h"
+#include "JackError.h"
+#include "JackRequest.h"
+#include "JackConstants.h"
+#include "JackNotification.h"
+
+namespace Jack
+{
+
+int JackSocketServerNotifyChannel::Open(const char* server_name)
+{
+    if (fRequestSocket.Connect(jack_server_dir, server_name, 0) < 0) {
+        jack_error("Cannot connect to server socket");
+        return -1;
+    } else {
+        fRequestSocket.SetNonBlocking(true);
+        return 0;
+    }
+}
+
+void JackSocketServerNotifyChannel::Close()
+{
+    fRequestSocket.Close();
+}
+
+/*
+The requirement is that the Notification from RT thread can be delivered... not sure using a socket is adequate here...
+Can the write operation block?
+A non blocking write operation shoud be used : check if write can succeed, and ignore the notification otherwise
+(since its mainly used for XRun, ignoring a notification is OK, successive XRun will come...)
+*/
+void JackSocketServerNotifyChannel::Notify(int refnum, int notify, int value)
+{
+    JackClientNotificationRequest req(refnum, notify, value);
+    if (req.Write(&fRequestSocket) < 0) {
+        jack_error("Could not write request ref = %d notify = %d", refnum, notify);
+    }
+}
+
+void JackSocketServerNotifyChannel::NotifyQuit()
+{
+    JackClientNotificationRequest req(-1, kQUIT, 0);
+    if (req.Write(&fRequestSocket) < 0) {
+        jack_error("Could not write request ref = %d notify = %d", -1, kQUIT);
+    }
+}
+    
+
+} // end of namespace
+
+
diff --git a/posix/JackSocketServerNotifyChannel.h b/posix/JackSocketServerNotifyChannel.h
new file mode 100644
index 0000000..261ddbd
--- /dev/null
+++ b/posix/JackSocketServerNotifyChannel.h
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackSocketServerNotifyChannel__
+#define __JackSocketServerNotifyChannel__
+
+#include "JackSocket.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackServerNotifyChannel using sockets.
+*/
+
+class JackSocketServerNotifyChannel
+{
+    private:
+
+        JackClientSocket fRequestSocket;
+
+    public:
+
+        JackSocketServerNotifyChannel()
+        {}
+
+        int Open(const char* server_name);
+        void Close();
+
+        void Notify(int refnum, int notify, int value);
+        void NotifyQuit();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/posix/JackSystemDeps_os.h b/posix/JackSystemDeps_os.h
new file mode 100644
index 0000000..cbddb0b
--- /dev/null
+++ b/posix/JackSystemDeps_os.h
@@ -0,0 +1,40 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackSystemDeps_POSIX__
+#define __JackSystemDeps_POSIX__
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <dlfcn.h>
+
+#define DRIVER_HANDLE void*
+#define LoadDriverModule(name) dlopen((name), RTLD_NOW | RTLD_GLOBAL)
+#define UnloadDriverModule(handle) dlclose((handle))
+#define GetDriverProc(handle, name) dlsym((handle), (name))
+
+#define JACK_HANDLE void*
+#define LoadJackModule(name) dlopen((name), RTLD_NOW | RTLD_LOCAL);
+#define UnloadJackModule(handle) dlclose((handle));
+#define GetJackProc(handle, name) dlsym((handle), (name));
+
+#define JACK_DEBUG (getenv("JACK_CLIENT_DEBUG") && strcmp(getenv("JACK_CLIENT_DEBUG"), "on") == 0)
+
+#endif
diff --git a/posix/JackTypes_os.h b/posix/JackTypes_os.h
new file mode 100644
index 0000000..01e6c9b
--- /dev/null
+++ b/posix/JackTypes_os.h
@@ -0,0 +1,31 @@
+/*
+  Copyright (C) 2001 Paul Davis
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackTypes_POSIX__
+#define __JackTypes_POSIX__
+
+#include <stdint.h>
+#include <pthread.h>
+
+typedef unsigned long long UInt64;
+typedef pthread_key_t jack_tls_key;
+
+typedef int (*jack_thread_creator_t)(pthread_t*, const pthread_attr_t*, void* (*function)(void*), void* arg);
+
+#endif
diff --git a/solaris/JackAtomic_os.h b/solaris/JackAtomic_os.h
new file mode 100644
index 0000000..c136805
--- /dev/null
+++ b/solaris/JackAtomic_os.h
@@ -0,0 +1,32 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackAtomic_sun__
+#define __JackAtomic_sun__
+
+#include "JackTypes.h"
+#include <atomic.h>
+
+static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
+{
+     return (atomic_cas_32((uint32_t*)addr, value, newvalue) == value);
+}
+
+#endif
+
diff --git a/solaris/JackPlatformPlug_os.h b/solaris/JackPlatformPlug_os.h
new file mode 100644
index 0000000..a244010
--- /dev/null
+++ b/solaris/JackPlatformPlug_os.h
@@ -0,0 +1,80 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPlatformPlug_sun__
+#define __JackPlatformPlug_sun__
+
+namespace Jack
+{
+    struct JackRequest;
+	struct JackResult;
+    
+    class JackPosixMutex;
+	class JackPosixThread;
+	class JackFifo;
+
+	class JackSocketServerChannel;
+	class JackSocketClientChannel;
+	class JackSocketServerNotifyChannel;
+	class JackSocketNotifyChannel;
+	class JackClientSocket;
+	class JackNetUnixSocket;
+}
+
+/* __JackPlatformMutex__ */
+#include "JackPosixMutex.h"
+namespace Jack {typedef JackPosixMutex JackMutex; }
+
+/* __JackPlatformThread__ */
+#include "JackPosixThread.h"
+namespace Jack { typedef JackPosixThread JackThread; }
+
+/* __JackPlatformSynchro__  client activation */
+#include "JackFifo.h"
+namespace Jack { typedef JackFifo JackSynchro; }
+
+/* __JackPlatformChannelTransaction__ */
+#include "JackSocket.h"
+namespace Jack { typedef JackClientSocket JackChannelTransaction; }
+
+#include "JackProcessSync.h"
+/* __JackPlatformProcessSync__ */
+/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */
+
+/* __JackPlatformServerChannel__ */ 
+#include "JackSocketServerChannel.h"
+namespace Jack { typedef JackSocketServerChannel JackServerChannel; }
+
+/* __JackPlatformClientChannel__ */
+#include "JackSocketClientChannel.h"
+namespace Jack { typedef JackSocketClientChannel JackClientChannel; }
+
+/* __JackPlatformServerNotifyChannel__ */
+#include "JackSocketServerNotifyChannel.h"
+namespace Jack { typedef JackSocketServerNotifyChannel JackServerNotifyChannel; }
+
+/* __JackPlatformNotifyChannel__ */
+#include "JackSocketNotifyChannel.h"
+namespace Jack { typedef JackSocketNotifyChannel JackNotifyChannel; }
+
+/* __JackPlatformNetSocket__ */
+#include "JackNetUnixSocket.h"
+namespace Jack { typedef JackNetUnixSocket JackNetSocket; }
+
+#endif
diff --git a/solaris/JackSolarisTime.c b/solaris/JackSolarisTime.c
new file mode 100644
index 0000000..46fa0fc
--- /dev/null
+++ b/solaris/JackSolarisTime.c
@@ -0,0 +1,45 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackTime.h"
+#include "JackTypes.h"
+#include <unistd.h>
+#include <time.h>
+
+SERVER_EXPORT void JackSleep(long usec) 
+{
+    usleep(usec);
+}
+
+SERVER_EXPORT void InitTime()
+{}
+	
+SERVER_EXPORT jack_time_t GetMicroSeconds(void) 
+{
+    return (jack_time_t)(gethrtime() / 1000);
+}
+
+SERVER_EXPORT void SetClockSource(jack_timer_type_t source)
+{}
+
+SERVER_EXPORT const char* ClockSourceName(jack_timer_type_t source)
+{
+    return "";
+}
diff --git a/solaris/oss/JackBoomerDriver.cpp b/solaris/oss/JackBoomerDriver.cpp
new file mode 100644
index 0000000..2505632
--- /dev/null
+++ b/solaris/oss/JackBoomerDriver.cpp
@@ -0,0 +1,1042 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "driver_interface.h"
+#include "JackThreadedDriver.h"
+#include "JackDriverLoader.h"
+#include "JackBoomerDriver.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include "JackShmMem.h"
+#include "JackGlobals.h"
+#include "memops.h"
+
+#include <sys/ioctl.h>
+#include <sys/soundcard.h>
+#include <fcntl.h>
+#include <iostream>
+#include <assert.h>
+#include <stdio.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+#ifdef JACK_MONITOR
+
+#define CYCLE_POINTS 500000
+
+struct OSSCycle {
+    jack_time_t fBeforeRead;
+    jack_time_t fAfterRead;
+    jack_time_t fAfterReadConvert;
+    jack_time_t fBeforeWrite;
+    jack_time_t fAfterWrite;
+    jack_time_t fBeforeWriteConvert;
+};
+
+struct OSSCycleTable {
+    jack_time_t fBeforeFirstWrite;
+    jack_time_t fAfterFirstWrite;
+    OSSCycle fTable[CYCLE_POINTS];
+};
+
+OSSCycleTable gCycleTable;
+int gCycleReadCount = 0;
+int gCycleWriteCount = 0;
+
+#endif
+
+inline int int2pow2(int x)	{ int r = 0; while ((1 << r) < x) r++; return r; }
+
+static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframes, int channel, int byte_skip, int bits)
+{
+    switch (bits) {
+
+		case 16: {
+		    signed short *s16src = (signed short*)src;
+            s16src += channel;
+            sample_move_dS_s16(dst, (char*)s16src, nframes, byte_skip);
+			break;
+        }
+		case 24: {
+			signed int *s32src = (signed int*)src;
+            s32src += channel;
+            sample_move_dS_s24(dst, (char*)s32src, nframes, byte_skip);
+			break;
+        }
+		case 32: {
+			signed int *s32src = (signed int*)src;
+            s32src += channel;
+            sample_move_dS_s32u24(dst, (char*)s32src, nframes, byte_skip);
+			break;
+        }
+	}
+}
+
+static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nframes, int channel, int byte_skip, int bits)
+{
+	switch (bits) {
+
+		case 16: {
+			signed short *s16dst = (signed short*)dst;
+            s16dst += channel;
+            sample_move_d16_sS((char*)s16dst, src, nframes, byte_skip, NULL); // No dithering for now...
+			break;
+        }
+		case 24: {
+			signed int *s32dst = (signed int*)dst;
+            s32dst += channel;
+            sample_move_d24_sS((char*)s32dst, src, nframes, byte_skip, NULL); 
+			break;
+        }    
+		case 32: {
+            signed int *s32dst = (signed int*)dst;
+            s32dst += channel;
+            sample_move_d32u24_sS((char*)s32dst, src, nframes, byte_skip, NULL);
+			break;  
+        }
+	}
+}
+
+void JackBoomerDriver::SetSampleFormat()
+{
+    switch (fBits) {
+
+	    case 24:	/* native-endian LSB aligned 24-bits in 32-bits integer */
+            fSampleFormat = AFMT_S24_NE;
+            fSampleSize = 4;
+			break;
+		case 32:	/* native-endian 32-bit integer */
+            fSampleFormat = AFMT_S32_NE; 
+            fSampleSize = 4;
+			break;
+		case 16:	/* native-endian 16-bit integer */
+		default:
+            fSampleFormat = AFMT_S16_NE;
+            fSampleSize = 2;
+			break;
+    }
+}
+
+void JackBoomerDriver::DisplayDeviceInfo()
+{
+    audio_buf_info info;
+    oss_audioinfo ai_in, ai_out;
+    memset(&info, 0, sizeof(audio_buf_info));
+    int cap = 0;
+    
+    // Duplex cards : http://manuals.opensound.com/developer/full_duplex.html
+    jack_info("Audio Interface Description :");
+    jack_info("Sampling Frequency : %d, Sample Format : %d, Mode : %d", fEngineControl->fSampleRate, fSampleFormat, fRWMode);
+    
+    if (fRWMode & kWrite) {
+	
+        oss_sysinfo si;
+        if (ioctl(fOutFD, OSS_SYSINFO, &si) == -1) {
+            jack_error("JackBoomerDriver::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("OSS product %s", si.product);
+            jack_info("OSS version %s", si.version);
+            jack_info("OSS version num %d", si.versionnum);
+            jack_info("OSS numaudios %d", si.numaudios);
+            jack_info("OSS numaudioengines %d", si.numaudioengines);
+            jack_info("OSS numcards %d", si.numcards);
+        }
+	
+        jack_info("Output capabilities - %d channels : ", fPlaybackChannels);
+        jack_info("Output block size = %d", fOutputBufferSize);
+    
+        if (ioctl(fOutFD, SNDCTL_DSP_GETOSPACE, &info) == -1)  {
+            jack_error("JackBoomerDriver::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("output space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d", 
+                info.fragments, info.fragstotal, info.fragsize, info.bytes);
+            fFragmentSize = info.fragsize;
+        }
+    
+        if (ioctl(fOutFD, SNDCTL_DSP_GETCAPS, &cap) == -1)  {
+            jack_error("JackBoomerDriver::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            if (cap & DSP_CAP_DUPLEX) 	jack_info(" DSP_CAP_DUPLEX");
+            if (cap & DSP_CAP_REALTIME) jack_info(" DSP_CAP_REALTIME");
+            if (cap & DSP_CAP_BATCH) 	jack_info(" DSP_CAP_BATCH");
+            if (cap & DSP_CAP_COPROC) 	jack_info(" DSP_CAP_COPROC");
+            if (cap & DSP_CAP_TRIGGER)  jack_info(" DSP_CAP_TRIGGER");
+            if (cap & DSP_CAP_MMAP) 	jack_info(" DSP_CAP_MMAP");
+            if (cap & DSP_CAP_MULTI) 	jack_info(" DSP_CAP_MULTI");
+            if (cap & DSP_CAP_BIND) 	jack_info(" DSP_CAP_BIND");
+        }
+    }	
+    
+    if (fRWMode & kRead) {
+    
+      	oss_sysinfo si;
+        if (ioctl(fInFD, OSS_SYSINFO, &si) == -1) {
+            jack_error("JackBoomerDriver::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("OSS product %s", si.product);
+            jack_info("OSS version %s", si.version);
+            jack_info("OSS version num %d", si.versionnum);
+            jack_info("OSS numaudios %d", si.numaudios);
+            jack_info("OSS numaudioengines %d", si.numaudioengines);
+            jack_info("OSS numcards %d", si.numcards);
+        }
+    
+        jack_info("Input capabilities - %d channels : ", fCaptureChannels);
+        jack_info("Input block size = %d", fInputBufferSize);
+    
+        if (ioctl(fInFD, SNDCTL_DSP_GETISPACE, &info) == -1) { 
+            jack_error("JackBoomerDriver::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("input space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d", 
+                info.fragments, info.fragstotal, info.fragsize, info.bytes);
+        }
+
+        if (ioctl(fInFD, SNDCTL_DSP_GETCAPS, &cap) == -1) {
+            jack_error("JackBoomerDriver::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            if (cap & DSP_CAP_DUPLEX) 	jack_info(" DSP_CAP_DUPLEX");
+            if (cap & DSP_CAP_REALTIME) jack_info(" DSP_CAP_REALTIME");
+            if (cap & DSP_CAP_BATCH) 	jack_info(" DSP_CAP_BATCH");
+            if (cap & DSP_CAP_COPROC) 	jack_info(" DSP_CAP_COPROC");
+            if (cap & DSP_CAP_TRIGGER)  jack_info(" DSP_CAP_TRIGGER");
+            if (cap & DSP_CAP_MMAP) 	jack_info(" DSP_CAP_MMAP");
+            if (cap & DSP_CAP_MULTI) 	jack_info(" DSP_CAP_MULTI");
+            if (cap & DSP_CAP_BIND) 	jack_info(" DSP_CAP_BIND");
+        }
+    }
+     
+    if (ai_in.rate_source != ai_out.rate_source) {
+        jack_info("Warning : input and output are not necessarily driven by the same clock!");
+    }
+}
+
+JackBoomerDriver::JackBoomerDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+                : JackAudioDriver(name, alias, engine, table),
+                fInFD(-1), fOutFD(-1), fBits(0), 
+                fSampleFormat(0), fNperiods(0), fSampleSize(0), fFragmentSize(0),
+                fRWMode(0), fExcl(false), fSyncIO(false),
+                fInputBufferSize(0), fOutputBufferSize(0),
+                fInputBuffer(NULL), fOutputBuffer(NULL),
+                fInputThread(&fInputHandler), fOutputThread(&fOutputHandler),
+                fInputHandler(this), fOutputHandler(this)
+               
+{
+    sem_init(&fReadSema, 0, 0); 
+    sem_init(&fWriteSema, 0, 0); 
+}
+
+JackBoomerDriver::~JackBoomerDriver()
+{
+    sem_destroy(&fReadSema); 
+    sem_destroy(&fWriteSema); 
+}
+
+int JackBoomerDriver::OpenInput()
+{
+    int flags = 0;
+    int gFragFormat;
+    int cur_capture_channels;
+    int cur_sample_format;
+    jack_nframes_t cur_sample_rate;
+
+    if (fCaptureChannels == 0) fCaptureChannels = 2;
+  
+    if ((fInFD = open(fCaptureDriverName, O_RDONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
+        jack_error("JackBoomerDriver::OpenInput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        return -1;
+    }
+
+    jack_log("JackBoomerDriver::OpenInput input fInFD = %d", fInFD);
+
+    if (fExcl) {
+        if (ioctl(fInFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
+            jack_error("JackBoomerDriver::OpenInput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            goto error;
+        }
+    }
+
+    gFragFormat = (2 << 16) + int2pow2(fEngineControl->fBufferSize * fSampleSize * fCaptureChannels);	
+    if (ioctl(fInFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
+        jack_error("JackBoomerDriver::OpenInput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+
+    cur_sample_format = fSampleFormat;
+    if (ioctl(fInFD, SNDCTL_DSP_SETFMT, &fSampleFormat) == -1) {
+        jack_error("JackBoomerDriver::OpenInput failed to set format : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_format != fSampleFormat) {
+        jack_info("JackBoomerDriver::OpenInput driver forced the sample format %ld", fSampleFormat);
+    }
+    
+    cur_capture_channels = fCaptureChannels;
+    if (ioctl(fInFD, SNDCTL_DSP_CHANNELS, &fCaptureChannels) == -1) {
+        jack_error("JackBoomerDriver::OpenInput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_capture_channels != fCaptureChannels) {
+        jack_info("JackBoomerDriver::OpenInput driver forced the number of capture channels %ld", fCaptureChannels);
+    }
+       
+    cur_sample_rate = fEngineControl->fSampleRate;
+    if (ioctl(fInFD, SNDCTL_DSP_SPEED, &fEngineControl->fSampleRate) == -1) {
+        jack_error("JackBoomerDriver::OpenInput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_rate != fEngineControl->fSampleRate) {
+        jack_info("JackBoomerDriver::OpenInput driver forced the sample rate %ld", fEngineControl->fSampleRate);
+    }
+
+    // Just set the read size to the value we want...
+    fInputBufferSize = fEngineControl->fBufferSize * fSampleSize * fCaptureChannels;
+
+    fInputBuffer = (void*)calloc(fInputBufferSize, 1);
+    assert(fInputBuffer);
+    return 0;
+    
+error:
+    ::close(fInFD);
+    return -1;
+}
+
+int JackBoomerDriver::OpenOutput()
+{
+    int flags = 0;
+    int gFragFormat;
+    int cur_sample_format;
+    int cur_playback_channels;
+    jack_nframes_t cur_sample_rate;
+
+    if (fPlaybackChannels == 0) fPlaybackChannels = 2;
+    
+    if ((fOutFD = open(fPlaybackDriverName, O_WRONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
+       jack_error("JackBoomerDriver::OpenOutput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+       return -1;
+    }
+
+    jack_log("JackBoomerDriver::OpenOutput output fOutFD = %d", fOutFD);
+    
+    if (fExcl) {
+        if (ioctl(fOutFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
+            jack_error("JackBoomerDriver::OpenOutput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            goto error;
+        }  
+    } 
+
+    gFragFormat = (2 << 16) + int2pow2(fEngineControl->fBufferSize * fSampleSize * fPlaybackChannels);	
+    if (ioctl(fOutFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
+        jack_error("JackBoomerDriver::OpenOutput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+   
+    cur_sample_format = fSampleFormat;
+    if (ioctl(fOutFD, SNDCTL_DSP_SETFMT, &fSampleFormat) == -1) {
+        jack_error("JackBoomerDriver::OpenOutput failed to set format : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_format != fSampleFormat) {
+        jack_info("JackBoomerDriver::OpenOutput driver forced the sample format %ld", fSampleFormat);
+    }
+    
+    cur_playback_channels = fPlaybackChannels;
+    if (ioctl(fOutFD, SNDCTL_DSP_CHANNELS, &fPlaybackChannels) == -1) {
+        jack_error("JackBoomerDriver::OpenOutput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_playback_channels != fPlaybackChannels) {
+        jack_info("JackBoomerDriver::OpenOutput driver forced the number of playback channels %ld", fPlaybackChannels);
+    }
+
+    cur_sample_rate = fEngineControl->fSampleRate;
+    if (ioctl(fOutFD, SNDCTL_DSP_SPEED, &fEngineControl->fSampleRate) == -1) {
+        jack_error("JackBoomerDriver::OpenOutput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_rate != fEngineControl->fSampleRate) {
+        jack_info("JackBoomerDriver::OpenInput driver forced the sample rate %ld", fEngineControl->fSampleRate);
+    }
+
+    // Just set the write size to the value we want...
+    fOutputBufferSize = fEngineControl->fBufferSize * fSampleSize * fPlaybackChannels;
+    
+    fOutputBuffer = (void*)calloc(fOutputBufferSize, 1);
+    assert(fOutputBuffer);
+    return 0;
+    
+error:
+    ::close(fOutFD);
+    return -1;
+}
+
+int JackBoomerDriver::Open(jack_nframes_t nframes,
+                      int user_nperiods, 
+                      jack_nframes_t samplerate,
+                      bool capturing,
+                      bool playing,
+                      int inchannels,
+                      int outchannels,
+                      bool excl,
+                      bool monitor,
+                      const char* capture_driver_uid,
+                      const char* playback_driver_uid,
+                      jack_nframes_t capture_latency,
+                      jack_nframes_t playback_latency,
+                      int bits, bool syncio)
+{
+    // Generic JackAudioDriver Open
+    if (JackAudioDriver::Open(nframes, samplerate, capturing, playing, inchannels, outchannels, monitor, 
+        capture_driver_uid, playback_driver_uid, capture_latency, playback_latency) != 0) {
+        return -1;
+    } else {
+
+        if (!fEngineControl->fSyncMode) {
+            jack_error("Cannot run in asynchronous mode, use the -S parameter for jackd");
+            return -1;
+        }
+
+        fRWMode |= ((capturing) ? kRead : 0);
+        fRWMode |= ((playing) ? kWrite : 0);
+        fBits = bits;
+        fExcl = excl;
+        fNperiods = (user_nperiods == 0) ? 1 : user_nperiods ;
+        fSyncIO = syncio;
+   
+    #ifdef JACK_MONITOR
+        // Force memory page in
+        memset(&gCycleTable, 0, sizeof(gCycleTable));
+    #endif
+        
+        if (OpenAux() < 0) {
+            Close();
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+}
+
+int JackBoomerDriver::Close()
+{
+ #ifdef JACK_MONITOR
+    FILE* file = fopen("OSSProfiling.log", "w");
+    
+    if (file) {
+        jack_info("Writing OSS driver timing data....");
+        for (int i = 1; i < std::min(gCycleReadCount, gCycleWriteCount); i++) {
+            int d1 = gCycleTable.fTable[i].fAfterRead - gCycleTable.fTable[i].fBeforeRead;
+            int d2 = gCycleTable.fTable[i].fAfterReadConvert - gCycleTable.fTable[i].fAfterRead;
+            int d3 = gCycleTable.fTable[i].fAfterWrite - gCycleTable.fTable[i].fBeforeWrite;
+            int d4 = gCycleTable.fTable[i].fBeforeWrite - gCycleTable.fTable[i].fBeforeWriteConvert;     
+            fprintf(file, "%d \t %d \t %d \t %d \t \n", d1, d2, d3, d4);
+        }
+        fclose(file);
+    } else {
+        jack_error("JackBoomerDriver::Close : cannot open OSSProfiling.log file");
+    }
+
+    file = fopen("TimingOSS.plot", "w");
+
+    if (file == NULL) {
+        jack_error("JackBoomerDriver::Close cannot open TimingOSS.plot file");
+    } else {
+        
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"OSS audio driver timing\"\n");
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"usec\"\n");
+        fprintf(file, "plot \"OSSProfiling.log\" using 1 title \"Driver read wait\" with lines, \
+                            \"OSSProfiling.log\" using 2 title \"Driver read convert duration\" with lines, \
+                            \"OSSProfiling.log\" using 3 title \"Driver write wait\" with lines, \
+                            \"OSSProfiling.log\" using 4 title \"Driver write convert duration\" with lines\n");
+    
+        fprintf(file, "set output 'TimingOSS.pdf\n");
+        fprintf(file, "set terminal pdf\n");
+    
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"OSS audio driver timing\"\n");
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"usec\"\n");
+        fprintf(file, "plot \"OSSProfiling.log\" using 1 title \"Driver read wait\" with lines, \
+                            \"OSSProfiling.log\" using 2 title \"Driver read convert duration\" with lines, \
+                            \"OSSProfiling.log\" using 3 title \"Driver write wait\" with lines, \
+                            \"OSSProfiling.log\" using 4 title \"Driver write convert duration\" with lines\n");
+      
+        fclose(file);
+    }
+ #endif
+    int res = JackAudioDriver::Close();
+    CloseAux();    
+    return res;
+}
+
+int JackBoomerDriver::OpenAux()
+{
+    SetSampleFormat();
+
+    if ((fRWMode & kRead) && (OpenInput() < 0)) {
+        return -1;
+    }
+  
+    if ((fRWMode & kWrite) && (OpenOutput() < 0)) { 
+        return -1;
+    }
+    
+    DisplayDeviceInfo();  
+    return 0;
+}
+
+void JackBoomerDriver::CloseAux()
+{
+    if (fRWMode & kRead && fInFD >= 0) {
+        close(fInFD);
+        fInFD = -1;
+    }
+    
+    if (fRWMode & kWrite && fOutFD >= 0) {
+        close(fOutFD);
+        fOutFD = -1;
+    }
+    
+    if (fInputBuffer)
+        free(fInputBuffer);
+    fInputBuffer = NULL;
+    
+    if (fOutputBuffer)
+        free(fOutputBuffer);
+    fOutputBuffer = NULL;
+}
+
+int JackBoomerDriver::Start()
+{
+    jack_log("JackBoomerDriver::Start");
+    JackAudioDriver::Start();
+
+    // Input/output synchronisation 
+    if (fInFD >= 0 && fOutFD >= 0 && fSyncIO) {
+
+        jack_log("JackBoomerDriver::Start sync input/output"); 
+
+        // Create and fill synch group
+        int id;
+        oss_syncgroup group;
+        group.id = 0;
+  
+        group.mode = PCM_ENABLE_INPUT;
+        if (ioctl(fInFD, SNDCTL_DSP_SYNCGROUP, &group) == -1) 
+            jack_error("JackBoomerDriver::Start failed to use SNDCTL_DSP_SYNCGROUP : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+   
+        group.mode = PCM_ENABLE_OUTPUT;
+        if (ioctl(fOutFD, SNDCTL_DSP_SYNCGROUP, &group) == -1) 
+            jack_error("JackBoomerDriver::Start failed to use SNDCTL_DSP_SYNCGROUP : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+
+        // Prefill output buffer : 2 fragments of silence as described in http://manuals.opensound.com/developer/synctest.c.html#LOC6
+        char* silence_buf = (char*)malloc(fFragmentSize);
+        memset(silence_buf, 0, fFragmentSize);
+
+        jack_log ("JackBoomerDriver::Start prefill size = %d", fFragmentSize); 
+
+        for (int i = 0; i < 2; i++) {
+            ssize_t count = ::write(fOutFD, silence_buf, fFragmentSize);
+            if (count < (int)fFragmentSize) {
+                jack_error("JackBoomerDriver::Start error bytes written = %ld", count);
+            }
+        }
+
+        free(silence_buf);
+
+        // Start input/output in sync
+        id = group.id;
+
+        if (ioctl(fInFD, SNDCTL_DSP_SYNCSTART, &id) == -1) 
+            jack_error("JackBoomerDriver::Start failed to use SNDCTL_DSP_SYNCSTART : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+
+    } else if (fOutFD >= 0) {
+        
+        // Maybe necessary to write an empty output buffer first time : see http://manuals.opensound.com/developer/fulldup.c.html   
+        memset(fOutputBuffer, 0, fOutputBufferSize);
+
+        // Prefill ouput buffer
+        for (int i = 0; i < fNperiods; i++) {
+            ssize_t count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
+            if (count < (int)fOutputBufferSize) {
+                jack_error("JackBoomerDriver::Start error bytes written = %ld", count);
+            }
+        }
+    } 
+   
+    // Start input thread only when needed
+    if (fInFD >= 0) {
+        if (fInputThread.StartSync() < 0) {
+            jack_error("Cannot start input thread");
+            return -1;
+        }
+    }
+
+    // Start output thread only when needed
+    if (fOutFD >= 0) {
+        if (fOutputThread.StartSync() < 0) {
+            jack_error("Cannot start output thread");
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+int JackBoomerDriver::Stop()
+{
+    // Stop input thread only when needed
+    if (fInFD >= 0) {
+        fInputThread.Kill();
+    }
+
+    // Stop output thread only when needed
+    if (fOutFD >= 0) {
+        fOutputThread.Kill();
+    }
+
+    return 0;
+}
+
+bool JackBoomerDriver::JackBoomerDriverInput::Init()
+{
+    if (fDriver->IsRealTime()) {
+        jack_log("JackBoomerDriverInput::Init IsRealTime");
+        if (fDriver->fInputThread.AcquireRealTime(GetEngineControl()->fServerPriority) < 0) {
+            jack_error("AcquireRealTime error");
+        } else {
+            set_threaded_log_function(); 
+        }
+    }
+    
+    return true;
+}
+
+bool JackBoomerDriver::JackBoomerDriverInput::Execute()
+{
+  
+#ifdef JACK_MONITOR
+    gCycleTable.fTable[gCycleReadCount].fBeforeRead = GetMicroSeconds();
+#endif
+
+    audio_errinfo ei_in;
+    ssize_t count = ::read(fDriver->fInFD, fDriver->fInputBuffer, fDriver->fInputBufferSize);  
+ 
+#ifdef JACK_MONITOR
+    if (count > 0 && count != (int)fDriver->fInputBufferSize)
+        jack_log("JackBoomerDriverInput::Execute count = %ld", count / (fDriver->fSampleSize * fDriver->fCaptureChannels));
+    gCycleTable.fTable[gCycleReadCount].fAfterRead = GetMicroSeconds();
+#endif
+    
+    // XRun detection
+    if (ioctl(fDriver->fInFD, SNDCTL_DSP_GETERROR, &ei_in) == 0) {
+
+        if (ei_in.rec_overruns > 0 ) {
+            jack_error("JackBoomerDriverInput::Execute overruns");
+            jack_time_t cur_time = GetMicroSeconds();
+            fDriver->NotifyXRun(cur_time, float(cur_time - fDriver->fBeginDateUst));   // Better this value than nothing... 
+        }
+
+        if (ei_in.rec_errorcount > 0 && ei_in.rec_lasterror != 0) {
+            jack_error("%d OSS rec event(s), last=%05d:%d", ei_in.rec_errorcount, ei_in.rec_lasterror, ei_in.rec_errorparm);
+        }
+    }   
+    
+    if (count < 0) {
+        jack_log("JackBoomerDriverInput::Execute error = %s", strerror(errno));
+    } else if (count < (int)fDriver->fInputBufferSize) {
+        jack_error("JackBoomerDriverInput::Execute error bytes read = %ld", count);
+    } else {
+
+        // Keep begin cycle time
+        fDriver->CycleTakeBeginTime();
+        for (int i = 0; i < fDriver->fCaptureChannels; i++) {
+            if (fDriver->fGraphManager->GetConnectionsNum(fDriver->fCapturePortList[i]) > 0) {
+                CopyAndConvertIn(fDriver->GetInputBuffer(i), 
+                                fDriver->fInputBuffer, 
+                                fDriver->fEngineControl->fBufferSize, 
+                                i, 
+                                fDriver->fCaptureChannels * fDriver->fSampleSize, 
+                                fDriver->fBits);
+            }
+        }
+
+    #ifdef JACK_MONITOR
+        gCycleTable.fTable[gCycleReadCount].fAfterReadConvert = GetMicroSeconds();
+        gCycleReadCount = (gCycleReadCount == CYCLE_POINTS - 1) ? gCycleReadCount: gCycleReadCount + 1;
+    #endif
+    }
+
+    // Duplex : sync with write thread
+    if (fDriver->fInFD >= 0 && fDriver->fOutFD >= 0) {
+        fDriver->SynchronizeRead();
+    } else {
+        // Otherwise direct process
+        fDriver->Process();
+    }
+    return true;
+}
+
+bool JackBoomerDriver::JackBoomerDriverOutput::Init()
+{
+    if (fDriver->IsRealTime()) {
+        jack_log("JackBoomerDriverOutput::Init IsRealTime");
+        if (fDriver->fOutputThread.AcquireRealTime(GetEngineControl()->fServerPriority) < 0) {
+            jack_error("AcquireRealTime error");
+        } else {
+            set_threaded_log_function(); 
+        }
+    }
+      
+    int delay;
+    if (ioctl(fDriver->fOutFD, SNDCTL_DSP_GETODELAY, &delay) == -1) {
+        jack_error("JackBoomerDriverOutput::Init error get out delay : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+    }
+        
+    delay /= fDriver->fSampleSize * fDriver->fPlaybackChannels;
+    jack_info("JackBoomerDriverOutput::Init output latency frames = %ld", delay);
+ 
+    return true;
+}
+
+bool JackBoomerDriver::JackBoomerDriverOutput::Execute()
+{
+    memset(fDriver->fOutputBuffer, 0, fDriver->fOutputBufferSize);
+
+#ifdef JACK_MONITOR
+    gCycleTable.fTable[gCycleWriteCount].fBeforeWriteConvert = GetMicroSeconds();
+#endif
+   
+    for (int i = 0; i < fDriver->fPlaybackChannels; i++) {
+        if (fDriver->fGraphManager->GetConnectionsNum(fDriver->fPlaybackPortList[i]) > 0) {
+              CopyAndConvertOut(fDriver->fOutputBuffer, 
+                                fDriver->GetOutputBuffer(i), 
+                                fDriver->fEngineControl->fBufferSize, 
+                                i, 
+                                fDriver->fPlaybackChannels * fDriver->fSampleSize, 
+                                fDriver->fBits);
+        }
+    }
+    
+#ifdef JACK_MONITOR
+    gCycleTable.fTable[gCycleWriteCount].fBeforeWrite = GetMicroSeconds();
+#endif    
+
+    ssize_t count = ::write(fDriver->fOutFD, fDriver->fOutputBuffer, fDriver->fOutputBufferSize);
+
+#ifdef JACK_MONITOR
+    if (count > 0 && count != (int)fDriver->fOutputBufferSize)
+        jack_log("JackBoomerDriverOutput::Execute count = %ld", count / (fDriver->fSampleSize * fDriver->fPlaybackChannels));
+    gCycleTable.fTable[gCycleWriteCount].fAfterWrite = GetMicroSeconds();
+    gCycleWriteCount = (gCycleWriteCount == CYCLE_POINTS - 1) ? gCycleWriteCount: gCycleWriteCount + 1;
+#endif
+
+    // XRun detection
+    audio_errinfo ei_out;
+    if (ioctl(fDriver->fOutFD, SNDCTL_DSP_GETERROR, &ei_out) == 0) {
+
+        if (ei_out.play_underruns > 0) {
+            jack_error("JackBoomerDriverOutput::Execute underruns");
+            jack_time_t cur_time = GetMicroSeconds();
+            fDriver->NotifyXRun(cur_time, float(cur_time - fDriver->fBeginDateUst));   // Better this value than nothing... 
+        }
+
+        if (ei_out.play_errorcount > 0 && ei_out.play_lasterror != 0) {
+            jack_error("%d OSS play event(s), last=%05d:%d",ei_out.play_errorcount, ei_out.play_lasterror, ei_out.play_errorparm);
+        }
+    }
+     
+    if (count < 0) {
+        jack_log("JackBoomerDriverOutput::Execute error = %s", strerror(errno));
+    } else if (count < (int)fDriver->fOutputBufferSize) {
+        jack_error("JackBoomerDriverOutput::Execute error bytes written = %ld", count);
+    }
+    
+    // Duplex : sync with read thread
+    if (fDriver->fInFD >= 0 && fDriver->fOutFD >= 0) {
+        fDriver->SynchronizeWrite();
+    } else {
+        // Otherwise direct process
+        fDriver->CycleTakeBeginTime();
+        fDriver->Process();
+    }
+    return true;
+}
+
+void JackBoomerDriver::SynchronizeRead()
+{
+    sem_wait(&fWriteSema);
+    Process();
+    sem_post(&fReadSema);
+}
+
+void JackBoomerDriver::SynchronizeWrite()
+{
+    sem_post(&fWriteSema);
+    sem_wait(&fReadSema);
+}
+
+int JackBoomerDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    CloseAux(); 
+    JackAudioDriver::SetBufferSize(buffer_size); // never fails
+    return OpenAux();
+}
+
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
+{
+    jack_driver_desc_t *desc;
+    unsigned int i;
+    desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+    strcpy(desc->name, "boomer");                              // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+    strcpy(desc->desc, "Boomer/OSS API based audio backend");  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+       
+    desc->nparams = OSS_DRIVER_N_PARAMS;
+    desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+    i = 0;
+    strcpy(desc->params[i].name, "rate");
+    desc->params[i].character = 'r';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_FS;
+    strcpy(desc->params[i].short_desc, "Sample rate");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "period");
+    desc->params[i].character = 'p';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_BLKSIZE;
+    strcpy(desc->params[i].short_desc, "Frames per period");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "nperiods");
+    desc->params[i].character = 'n';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_NPERIODS;
+    strcpy(desc->params[i].short_desc, "Number of periods to prefill output buffer");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "wordlength");
+    desc->params[i].character = 'w';
+    desc->params[i].type = JackDriverParamInt;
+    desc->params[i].value.i = OSS_DRIVER_DEF_BITS;
+    strcpy(desc->params[i].short_desc, "Word length");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "inchannels");
+    desc->params[i].character = 'i';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_INS;
+    strcpy(desc->params[i].short_desc, "Capture channels");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+    
+    i++;
+    strcpy(desc->params[i].name, "outchannels");
+    desc->params[i].character = 'o';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_OUTS;
+    strcpy(desc->params[i].short_desc, "Playback channels");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+    
+    i++;
+    strcpy(desc->params[i].name, "excl");
+    desc->params[i].character = 'e';
+    desc->params[i].type = JackDriverParamBool;
+    desc->params[i].value.i = false;
+    strcpy(desc->params[i].short_desc, "Exclusif (O_EXCL) access mode");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "capture");
+    desc->params[i].character = 'C';
+    desc->params[i].type = JackDriverParamString;
+    strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+    strcpy(desc->params[i].short_desc, "Input device");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+    
+    i++;
+    strcpy(desc->params[i].name, "playback");
+    desc->params[i].character = 'P';
+    desc->params[i].type = JackDriverParamString;
+    strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+    strcpy(desc->params[i].short_desc, "Output device");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy (desc->params[i].name, "device");
+    desc->params[i].character = 'd';
+    desc->params[i].type = JackDriverParamString;
+    strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+    strcpy(desc->params[i].short_desc, "OSS device name");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+    
+    i++;
+    strcpy(desc->params[i].name, "input-latency");
+    desc->params[i].character = 'I';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.i = 0;
+    strcpy(desc->params[i].short_desc, "Extra input latency");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "output-latency");
+    desc->params[i].character = 'O';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.i = 0;
+    strcpy(desc->params[i].short_desc, "Extra output latency");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "sync-io");
+    desc->params[i].character = 'S';
+    desc->params[i].type = JackDriverParamBool;
+    desc->params[i].value.i = false;
+    strcpy(desc->params[i].short_desc, "In duplex mode, synchronize input and output");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    return desc;
+}
+
+EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
+{
+    int bits = OSS_DRIVER_DEF_BITS;
+    jack_nframes_t srate = OSS_DRIVER_DEF_FS;
+    jack_nframes_t frames_per_interrupt = OSS_DRIVER_DEF_BLKSIZE;
+    const char* capture_pcm_name = OSS_DRIVER_DEF_DEV;
+    const char* playback_pcm_name = OSS_DRIVER_DEF_DEV;
+    bool capture = false;
+    bool playback = false;
+    int chan_in = 0;
+    int chan_out = 0;
+    bool monitor = false;
+    bool excl = false;
+    bool syncio = false;
+    unsigned int nperiods = OSS_DRIVER_DEF_NPERIODS;
+    const JSList *node;
+    const jack_driver_param_t *param;
+    jack_nframes_t systemic_input_latency = 0;
+    jack_nframes_t systemic_output_latency = 0;
+ 
+    for (node = params; node; node = jack_slist_next(node)) {
+    
+        param = (const jack_driver_param_t *)node->data;
+
+        switch (param->character) {
+        
+        case 'r':
+            srate = param->value.ui;
+            break;
+
+        case 'p':
+            frames_per_interrupt = (unsigned int)param->value.ui;
+            break;
+
+        case 'n':
+            nperiods = (unsigned int)param->value.ui;
+            break;
+
+        case 'w':
+            bits = param->value.i;
+            break;
+
+        case 'i':
+            chan_in = (int)param->value.ui;
+            break;
+
+        case 'o':
+            chan_out = (int)param->value.ui;
+            break;
+            
+        case 'C':
+            capture = true;
+            if (strcmp(param->value.str, "none") != 0) {
+                capture_pcm_name = strdup(param->value.str);
+            }
+            break;
+
+        case 'P':
+            playback = true;
+            if (strcmp(param->value.str, "none") != 0) {
+                playback_pcm_name = strdup(param->value.str);
+            }
+            break;
+
+        case 'd':
+            playback_pcm_name = strdup (param->value.str);
+            capture_pcm_name = strdup (param->value.str);
+            break;
+            
+        case 'e':
+            excl = true;
+            break;
+		
+        case 'I':
+            systemic_input_latency = param->value.ui;
+            break;
+
+        case 'O':
+            systemic_output_latency = param->value.ui;
+            break;
+
+        case 'S':
+            syncio = true;
+            break;
+        }
+    }
+
+    // duplex is the default
+    if (!capture && !playback) {
+        capture = true;
+        playback = true;
+    }
+
+    Jack::JackBoomerDriver* boomer_driver = new Jack::JackBoomerDriver("system", "boomer", engine, table);
+    
+    // Special open for Boomer driver...
+    if (boomer_driver->Open(frames_per_interrupt, nperiods, srate, capture, playback, chan_in, chan_out, excl, 
+        monitor, capture_pcm_name, playback_pcm_name, systemic_input_latency, systemic_output_latency, bits, syncio) == 0) {
+        return boomer_driver;
+    } else {
+        delete boomer_driver; // Delete the driver
+        return NULL;
+    }
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/solaris/oss/JackBoomerDriver.h b/solaris/oss/JackBoomerDriver.h
new file mode 100644
index 0000000..61fc5c5
--- /dev/null
+++ b/solaris/oss/JackBoomerDriver.h
@@ -0,0 +1,163 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackBoomerDriver__
+#define __JackBoomerDriver__
+
+#include "JackAudioDriver.h"
+#include "JackPlatformPlug.h"
+#include "ringbuffer.h"
+#include <semaphore.h>
+
+namespace Jack
+{
+
+typedef jack_default_audio_sample_t jack_sample_t;
+
+#define OSS_DRIVER_N_PARAMS	13
+#define OSS_DRIVER_DEF_DEV	"/dev/dsp"
+#define OSS_DRIVER_DEF_FS	48000
+#define OSS_DRIVER_DEF_BLKSIZE	1024
+#define OSS_DRIVER_DEF_NPERIODS	1
+#define OSS_DRIVER_DEF_BITS	16
+#define OSS_DRIVER_DEF_INS	2
+#define OSS_DRIVER_DEF_OUTS	2
+
+/*!
+\brief The Boomer driver.
+*/
+
+class JackBoomerDriver : public JackAudioDriver
+{
+
+    enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
+
+    private:
+
+        class JackBoomerDriverInput : public JackRunnableInterface {
+
+            private:
+    
+                JackBoomerDriver* fDriver;
+
+            public:
+
+                JackBoomerDriverInput(JackBoomerDriver* driver): fDriver(driver)
+                {}
+                ~JackBoomerDriverInput()
+                {}
+
+                bool Init();
+                bool Execute();
+        };
+
+        class JackBoomerDriverOutput : public JackRunnableInterface {
+
+            private:
+    
+                JackBoomerDriver* fDriver;
+
+            public:
+
+                JackBoomerDriverOutput(JackBoomerDriver* driver): fDriver(driver)
+                {}
+                ~JackBoomerDriverOutput()
+                {}
+
+                bool Init();
+                bool Execute();
+        };
+
+        int fInFD;
+        int fOutFD;
+        
+        int fBits;
+        int fSampleFormat;
+        int fNperiods;
+        unsigned int fSampleSize;
+        unsigned int fFragmentSize;
+        int fRWMode;
+        bool fExcl;
+        bool fSyncIO;
+       
+        unsigned int fInputBufferSize;
+        unsigned int fOutputBufferSize;
+        
+        void* fInputBuffer;
+        void* fOutputBuffer;
+  
+        sem_t fReadSema;
+        sem_t fWriteSema;
+
+        JackThread fInputThread;
+        JackThread fOutputThread;
+     
+        JackBoomerDriverInput fInputHandler;
+        JackBoomerDriverOutput fOutputHandler;
+         
+        int OpenInput();
+        int OpenOutput();
+        int OpenAux();
+        void CloseAux();
+        void SetSampleFormat();
+        void DisplayDeviceInfo();
+        void SynchronizeRead();
+        void SynchronizeWrite();
+
+    public:
+
+        JackBoomerDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        virtual ~JackBoomerDriver();
+ 
+        int Open(jack_nframes_t frames_per_cycle,
+                 int user_nperiods, 
+                 jack_nframes_t rate,
+                 bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool excl,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency,
+                 int bits, bool syncio);
+
+        int Close();
+
+        int Start();
+        int Stop();
+
+        // BufferSize can be changed
+        bool IsFixedBufferSize()
+        {
+            return false;
+        }
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+        
+        bool Init();
+        bool Execute();
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/solaris/oss/JackOSSAdapter.cpp b/solaris/oss/JackOSSAdapter.cpp
new file mode 100644
index 0000000..de3fe89
--- /dev/null
+++ b/solaris/oss/JackOSSAdapter.cpp
@@ -0,0 +1,756 @@
+/*
+Copyright (C) 2008 Grame & RTL 2008
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackOSSAdapter.h"
+#include "JackServerGlobals.h"
+#include "JackEngineControl.h"
+#include "memops.h"
+
+#include <sys/ioctl.h>
+#include <sys/soundcard.h>
+#include <fcntl.h>
+#include <iostream>
+#include <assert.h>
+
+namespace Jack
+{
+
+inline int int2pow2(int x)	{ int r = 0; while ((1 << r) < x) r++; return r; }
+
+static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframes, int channel, int chcount, int bits)
+{
+    switch (bits) {
+
+		case 16: {
+		    signed short *s16src = (signed short*)src;
+            s16src += channel;
+            sample_move_dS_s16(dst, (char*)s16src, nframes, chcount<<1);
+			break;
+        }
+		case 24: {
+			signed int *s32src = (signed int*)src;
+            s32src += channel;
+            sample_move_dS_s24(dst, (char*)s32src, nframes, chcount<<2);
+			break;
+        }
+		case 32: {
+			signed int *s32src = (signed int*)src;
+            s32src += channel;
+            sample_move_dS_s32u24(dst, (char*)s32src, nframes, chcount<<2);
+			break;
+        }
+	}
+}
+
+static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nframes, int channel, int chcount, int bits)
+{
+	switch (bits) {
+
+		case 16: {
+			signed short *s16dst = (signed short*)dst;
+            s16dst += channel;
+            sample_move_d16_sS((char*)s16dst, src, nframes, chcount<<1, NULL); // No dithering for now...
+			break;
+        }
+		case 24: {
+			signed int *s32dst = (signed int*)dst;
+            s32dst += channel;
+            sample_move_d24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); // No dithering for now...
+			break;
+        }    
+		case 32: {
+            signed int *s32dst = (signed int*)dst;
+            s32dst += channel;
+            sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL);
+			break;  
+        }
+	}
+}
+
+void JackOSSAdapter::SetSampleFormat()
+{
+    switch (fBits) {
+
+	    case 24:	/* native-endian LSB aligned 24-bits in 32-bits  integer */
+            fSampleFormat = AFMT_S24_NE;
+            fSampleSize = sizeof(int);
+			break;
+		case 32:	/* native-endian 32-bit integer */
+            fSampleFormat = AFMT_S32_NE; 
+            fSampleSize = sizeof(int);
+			break;
+		case 16:	/* native-endian 16-bit integer */
+		default:
+            fSampleFormat = AFMT_S16_NE;
+            fSampleSize = sizeof(short);
+			break;
+    }
+}
+
+JackOSSAdapter::JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params)
+                :JackAudioAdapterInterface(buffer_size, sample_rate)
+                ,fThread(this), 
+                fInFD(-1), fOutFD(-1), fBits(OSS_DRIVER_DEF_BITS), 
+                fSampleFormat(0), fNperiods(OSS_DRIVER_DEF_NPERIODS), fRWMode(0), fIgnoreHW(true), fExcl(false),
+                fInputBufferSize(0), fOutputBufferSize(0),
+                fInputBuffer(NULL), fOutputBuffer(NULL), fFirstCycle(true)
+{
+    const JSList* node;
+    const jack_driver_param_t* param;
+   
+    fCaptureChannels = 2;
+    fPlaybackChannels = 2;
+
+    strcpy(fCaptureDriverName, OSS_DRIVER_DEF_DEV);
+    strcpy(fPlaybackDriverName, OSS_DRIVER_DEF_DEV);
+    
+    for (node = params; node; node = jack_slist_next(node)) {
+        param = (const jack_driver_param_t*) node->data;
+        
+        switch (param->character) {
+
+            case 'r':
+                SetAdaptedSampleRate(param->value.ui);
+                break;
+   
+            case 'p':
+                SetAdaptedBufferSize(param->value.ui);
+                break;
+
+            case 'n':
+                fNperiods = param->value.ui;
+                break;
+     
+            case 'w':
+                fBits = param->value.i;
+                break;
+     
+            case 'i':
+                fCaptureChannels = param->value.ui;
+                break;
+       
+            case 'o':
+                fPlaybackChannels = param->value.ui;
+                break;
+
+            case 'e':
+                fExcl = true;
+                break;
+                
+            case 'C':
+                fRWMode |= kRead;
+                if (strcmp(param->value.str, "none") != 0) {
+                   strcpy(fCaptureDriverName, param->value.str);
+                }
+                break;
+                
+            case 'P':
+                fRWMode |= kWrite;
+                if (strcmp(param->value.str, "none") != 0) {
+                   strcpy(fPlaybackDriverName, param->value.str);
+                }
+                break;
+                
+            case 'd':
+               fRWMode |= kRead;
+               fRWMode |= kWrite;
+               strcpy(fCaptureDriverName, param->value.str);
+               strcpy(fPlaybackDriverName, param->value.str);
+               break;
+
+            case 'b':
+                fIgnoreHW = true;
+                break;
+                
+            case 'q':
+                fQuality = param->value.ui;
+                break;
+                
+            case 'g':
+                fRingbufferCurSize = param->value.ui;
+                fAdaptative = false;
+                break;
+
+           }
+    }
+
+    fRWMode |= kRead;
+    fRWMode |= kWrite;
+}
+
+void JackOSSAdapter::DisplayDeviceInfo()
+{
+    audio_buf_info info;
+    oss_audioinfo ai_in, ai_out;
+    memset(&info, 0, sizeof(audio_buf_info));
+    int cap = 0;
+    
+    // Duplex cards : http://manuals.opensound.com/developer/full_duplex.html
+    
+    jack_info("Audio Interface Description :");
+    jack_info("Sampling Frequency : %d, Sample Format : %d, Mode : %d", fAdaptedSampleRate, fSampleFormat, fRWMode);
+    
+    if (fRWMode & kWrite) {
+    
+       oss_sysinfo si;
+        if (ioctl(fOutFD, OSS_SYSINFO, &si) == -1) {
+            jack_error("JackOSSAdapter::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("OSS product %s", si.product);
+            jack_info("OSS version %s", si.version);
+            jack_info("OSS version num %d", si.versionnum);
+            jack_info("OSS numaudios %d", si.numaudios);
+            jack_info("OSS numaudioengines %d", si.numaudioengines);
+            jack_info("OSS numcards %d", si.numcards);
+        }
+    
+        jack_info("Output capabilities - %d channels : ", fPlaybackChannels);
+        jack_info("Output block size = %d", fOutputBufferSize);
+    
+        if (ioctl(fOutFD, SNDCTL_DSP_GETOSPACE, &info) == -1)  {
+            jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("output space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d", 
+                info.fragments, info.fragstotal, info.fragsize, info.bytes);
+        }
+    
+        if (ioctl(fOutFD, SNDCTL_DSP_GETCAPS, &cap) == -1)  {
+            jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            if (cap & DSP_CAP_DUPLEX) 	jack_info(" DSP_CAP_DUPLEX");
+            if (cap & DSP_CAP_REALTIME) jack_info(" DSP_CAP_REALTIME");
+            if (cap & DSP_CAP_BATCH) 	jack_info(" DSP_CAP_BATCH");
+            if (cap & DSP_CAP_COPROC) 	jack_info(" DSP_CAP_COPROC");
+            if (cap & DSP_CAP_TRIGGER)  jack_info(" DSP_CAP_TRIGGER");
+            if (cap & DSP_CAP_MMAP) 	jack_info(" DSP_CAP_MMAP");
+            if (cap & DSP_CAP_MULTI) 	jack_info(" DSP_CAP_MULTI");
+            if (cap & DSP_CAP_BIND) 	jack_info(" DSP_CAP_BIND");
+        }
+    }	
+    
+    if (fRWMode & kRead) {
+    
+        oss_sysinfo si;
+        if (ioctl(fInFD, OSS_SYSINFO, &si) == -1) {
+            jack_error("JackOSSAdapter::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("OSS product %s", si.product);
+            jack_info("OSS version %s", si.version);
+            jack_info("OSS version num %d", si.versionnum);
+            jack_info("OSS numaudios %d", si.numaudios);
+            jack_info("OSS numaudioengines %d", si.numaudioengines);
+            jack_info("OSS numcards %d", si.numcards);
+        }
+   
+        jack_info("Input capabilities - %d channels : ", fCaptureChannels);
+        jack_info("Input block size = %d", fInputBufferSize);
+    
+        if (ioctl(fInFD, SNDCTL_DSP_GETOSPACE, &info) == -1) { 
+            jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("input space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d", 
+                info.fragments, info.fragstotal, info.fragsize, info.bytes);
+        }
+
+        if (ioctl(fInFD, SNDCTL_DSP_GETCAPS, &cap) == -1) {
+            jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            if (cap & DSP_CAP_DUPLEX) 	jack_info(" DSP_CAP_DUPLEX");
+            if (cap & DSP_CAP_REALTIME) jack_info(" DSP_CAP_REALTIME");
+            if (cap & DSP_CAP_BATCH) 	jack_info(" DSP_CAP_BATCH");
+            if (cap & DSP_CAP_COPROC) 	jack_info(" DSP_CAP_COPROC");
+            if (cap & DSP_CAP_TRIGGER)  jack_info(" DSP_CAP_TRIGGER");
+            if (cap & DSP_CAP_MMAP) 	jack_info(" DSP_CAP_MMAP");
+            if (cap & DSP_CAP_MULTI) 	jack_info(" DSP_CAP_MULTI");
+            if (cap & DSP_CAP_BIND) 	jack_info(" DSP_CAP_BIND");
+        }
+    }
+    
+    if (ioctl(fInFD, SNDCTL_AUDIOINFO, &ai_in) != -1) {
+        jack_info("Using audio engine %d = %s for input", ai_in.dev, ai_in.name);
+    }
+    
+    if (ioctl(fOutFD, SNDCTL_AUDIOINFO, &ai_out) != -1) {
+        jack_info("Using audio engine %d = %s for output", ai_out.dev, ai_out.name);
+    }
+    
+    if (ai_in.rate_source != ai_out.rate_source) {
+        jack_info("Warning : input and output are not necessarily driven by the same clock!");
+    }
+}
+
+int JackOSSAdapter::OpenInput()
+{
+    int flags = 0;
+    int gFragFormat;
+    int cur_sample_format, cur_capture_channels;
+    jack_nframes_t cur_sample_rate;
+  
+    if (fCaptureChannels == 0) fCaptureChannels = 2;
+  
+    if ((fInFD = open(fCaptureDriverName, O_RDONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
+        jack_error("JackOSSAdapter::OpenInput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        return -1;
+    }
+
+    if (fExcl) {
+        if (ioctl(fInFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
+            jack_error("JackOSSAdapter::OpenInput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            goto error;
+        }
+    }
+
+    gFragFormat = (2 << 16) + int2pow2(fAdaptedBufferSize * fSampleSize * fCaptureChannels);	
+    if (ioctl(fInFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
+        jack_error("JackOSSAdapter::OpenInput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+
+    cur_sample_format = fSampleFormat;
+    if (ioctl(fInFD, SNDCTL_DSP_SETFMT, &fSampleFormat) == -1) {
+        jack_error("JackOSSAdapter::OpenInput failed to set format : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_format != fSampleFormat) {
+        jack_info("JackOSSAdapter::OpenInput driver forced the sample format %ld", fSampleFormat);
+    }
+    
+    cur_capture_channels = fCaptureChannels;
+    if (ioctl(fInFD, SNDCTL_DSP_CHANNELS, &fCaptureChannels) == -1) {
+        jack_error("JackOSSAdapter::OpenInput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_capture_channels != fCaptureChannels) {
+        jack_info("JackOSSAdapter::OpenInput driver forced the number of capture channels %ld", fCaptureChannels);
+    }
+       
+    cur_sample_rate = fAdaptedSampleRate;
+    if (ioctl(fInFD, SNDCTL_DSP_SPEED, &fAdaptedSampleRate) == -1) {
+        jack_error("JackOSSAdapter::OpenInput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_rate != fAdaptedSampleRate) {
+        jack_info("JackOSSAdapter::OpenInput driver forced the sample rate %ld", fAdaptedSampleRate);
+    }
+
+    fInputBufferSize = 0;
+    if (ioctl(fInFD, SNDCTL_DSP_GETBLKSIZE, &fInputBufferSize) == -1) {
+        jack_error("JackOSSAdapter::OpenInput failed to get fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+        
+    if (fInputBufferSize != fAdaptedBufferSize * fSampleSize * fCaptureChannels) {
+       if (fIgnoreHW) {
+           jack_info("JackOSSAdapter::OpenInput driver forced buffer size %ld", fOutputBufferSize);
+       } else {
+           jack_error("JackOSSAdapter::OpenInput wanted buffer size cannot be obtained");
+           goto error;
+       }
+    }
+
+    fInputBuffer = (void*)calloc(fInputBufferSize, 1);
+    assert(fInputBuffer);
+    
+    fInputSampleBuffer = (float**)malloc(fCaptureChannels * sizeof(float*));
+    assert(fInputSampleBuffer);
+    
+    for (int i = 0; i < fCaptureChannels; i++) {
+        fInputSampleBuffer[i] = (float*)malloc(fAdaptedBufferSize * sizeof(float));
+        assert(fInputSampleBuffer[i]);
+    }
+    return 0;
+    
+error:
+    ::close(fInFD);
+    return -1;
+}
+
+int JackOSSAdapter::OpenOutput()
+{
+    int flags = 0;
+    int gFragFormat;
+    int cur_sample_format, cur_playback_channels;
+    jack_nframes_t cur_sample_rate;
+ 
+    if (fPlaybackChannels == 0) fPlaybackChannels = 2;
+    
+    if ((fOutFD = open(fPlaybackDriverName, O_WRONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
+       jack_error("JackOSSAdapter::OpenOutput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+       return -1;
+    }
+    
+    if (fExcl) {
+        if (ioctl(fOutFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
+            jack_error("JackOSSAdapter::OpenOutput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            goto error;
+        }  
+    } 
+
+    gFragFormat = (2 << 16) + int2pow2(fAdaptedBufferSize * fSampleSize * fPlaybackChannels);	
+    if (ioctl(fOutFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
+        jack_error("JackOSSAdapter::OpenOutput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+
+    cur_sample_format = fSampleFormat;
+    if (ioctl(fOutFD, SNDCTL_DSP_SETFMT, &fSampleFormat) == -1) {
+        jack_error("JackOSSAdapter::OpenOutput failed to set format : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_format != fSampleFormat) {
+        jack_info("JackOSSAdapter::OpenOutput driver forced the sample format %ld", fSampleFormat);
+    }
+    
+    cur_playback_channels = fPlaybackChannels;
+    if (ioctl(fOutFD, SNDCTL_DSP_CHANNELS, &fPlaybackChannels) == -1) {
+        jack_error("JackOSSAdapter::OpenOutput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_playback_channels != fPlaybackChannels) {
+        jack_info("JackOSSAdapter::OpenOutput driver forced the number of playback channels %ld", fPlaybackChannels);
+    }
+
+    cur_sample_rate = fAdaptedSampleRate;
+    if (ioctl(fOutFD, SNDCTL_DSP_SPEED, &fAdaptedSampleRate) == -1) {
+        jack_error("JackOSSAdapter::OpenOutput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_rate != fAdaptedSampleRate) {
+        jack_info("JackOSSAdapter::OpenInput driver forced the sample rate %ld", fAdaptedSampleRate);
+    }
+
+    fOutputBufferSize = 0;
+    if (ioctl(fOutFD, SNDCTL_DSP_GETBLKSIZE, &fOutputBufferSize) == -1) {
+        jack_error("JackOSSAdapter::OpenOutput failed to get fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+         
+    if (fOutputBufferSize != fAdaptedBufferSize * fSampleSize * fPlaybackChannels) {
+       if (fIgnoreHW) {
+           jack_info("JackOSSAdapter::OpenOutput driver forced buffer size %ld", fOutputBufferSize);
+       } else {
+           jack_error("JackOSSAdapter::OpenInput wanted buffer size cannot be obtained");
+           goto error;
+       }
+    }
+
+    fOutputBuffer = (void*)calloc(fOutputBufferSize, 1);
+    assert(fOutputBuffer);
+    
+    fOutputSampleBuffer = (float**)malloc(fPlaybackChannels * sizeof(float*));
+    assert(fOutputSampleBuffer);
+    
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        fOutputSampleBuffer[i] = (float*)malloc(fAdaptedBufferSize * sizeof(float));
+        assert(fOutputSampleBuffer[i]);
+    }
+    
+    fFirstCycle = true;
+    return 0;
+    
+error:
+    ::close(fOutFD);
+    return -1;
+}
+
+int JackOSSAdapter::Open()
+{
+    SetSampleFormat();
+    
+    if ((fRWMode & kRead) && (OpenInput() < 0)) {
+        return -1;
+    }
+    
+    if ((fRWMode & kWrite) && (OpenOutput() < 0)) { 
+       return -1;
+    }
+    
+    // In duplex mode, check that input and output use the same buffer size
+    if ((fRWMode & kRead) && (fRWMode & kWrite) && (fInputBufferSize != fOutputBufferSize)) {
+       jack_error("JackOSSAdapter::OpenAux input and output buffer size are not the same!!");
+       goto error;
+    }
+
+    DisplayDeviceInfo(); 
+
+    //start adapter thread
+    if (fThread.StartSync() < 0) {
+        jack_error ( "Cannot start audioadapter thread" );
+        return -1;
+    }
+  
+    //turn the thread realtime
+    fThread.AcquireRealTime(JackServerGlobals::fInstance->GetEngineControl()->fClientPriority);
+    return 0;
+    
+error:
+    CloseAux();
+    return -1;
+}
+
+ 
+int JackOSSAdapter::Close()
+{
+#ifdef JACK_MONITOR
+    fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
+#endif
+    fThread.Stop();
+    CloseAux();  
+    return 0;
+}
+
+void JackOSSAdapter::CloseAux()
+{
+    if (fRWMode & kRead) {
+        close(fInFD);
+        fInFD = -1;
+    }
+    
+    if (fRWMode & kWrite) {
+        close(fOutFD);
+        fOutFD = -1;
+    }
+    
+    free(fInputBuffer);
+    fInputBuffer = NULL;
+    
+    free(fOutputBuffer);
+    fOutputBuffer = NULL;
+    
+    for (int i = 0; i < fCaptureChannels; i++) {
+        free(fInputSampleBuffer[i]);
+    }
+    free(fInputSampleBuffer);
+    
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        free(fOutputSampleBuffer[i]);
+    }
+    free(fOutputSampleBuffer);
+ }
+
+int JackOSSAdapter::Read()
+{
+    ssize_t count = ::read(fInFD, fInputBuffer, fInputBufferSize);
+    
+    if (count < fInputBufferSize) {
+        jack_error("JackOSSAdapter::Read error bytes read = %ld", count);
+        return -1;
+    } else {
+        for (int i = 0; i < fCaptureChannels; i++) {
+             CopyAndConvertIn(fInputSampleBuffer[i], fInputBuffer, fAdaptedBufferSize, i, fCaptureChannels, fBits);        
+        }
+        return 0;
+    }
+}
+
+int JackOSSAdapter::Write()
+{
+    ssize_t count;
+   
+    // Maybe necessay to write an empty output buffer first time : see http://manuals.opensound.com/developer/fulldup.c.html
+    if (fFirstCycle) {
+    
+        fFirstCycle = false;
+        memset(fOutputBuffer, 0, fOutputBufferSize);
+
+        // Prefill ouput buffer
+        for (int i = 0; i < fNperiods; i++) {
+           count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
+           if (count < fOutputBufferSize) {
+                jack_error("JackOSSDriver::Write error bytes written = %ld", count);
+                return -1;
+            }
+        }
+        
+        int delay;
+        if (ioctl(fOutFD, SNDCTL_DSP_GETODELAY, &delay) == -1) {
+            jack_error("JackOSSDriver::Write error get out delay : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            return -1;
+        }
+        
+        delay /= fSampleSize * fPlaybackChannels;
+        jack_info("JackOSSDriver::Write output latency frames = %ld", delay);
+    }
+    
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        CopyAndConvertOut(fOutputBuffer, fOutputSampleBuffer[i], fAdaptedBufferSize, i, fCaptureChannels, fBits);
+    }
+    
+    count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
+  
+    if (count < fOutputBufferSize) {
+        jack_error("JackOSSAdapter::Write error bytes written = %ld", count);
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+bool JackOSSAdapter::Execute()
+{
+    //read data from audio interface
+    if (Read() < 0)
+        return false;
+        
+    PushAndPull(fInputSampleBuffer, fOutputSampleBuffer, fAdaptedBufferSize);
+        
+    //write data to audio interface
+    if (Write() < 0)
+        return false;
+   
+    return true;
+}
+
+int JackOSSAdapter::SetBufferSize(jack_nframes_t buffer_size)
+{
+    JackAudioAdapterInterface::SetBufferSize(buffer_size);
+    Close();
+    return Open();
+}
+        
+} // namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+    {
+        jack_driver_desc_t *desc;
+        unsigned int i;
+        desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+        strcpy(desc->name, "audioadapter");                              // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "netjack audio <==> net backend adapter");    // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+           
+        desc->nparams = OSS_DRIVER_N_PARAMS;
+        desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy(desc->params[i].name, "rate");
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = OSS_DRIVER_DEF_FS;
+        strcpy(desc->params[i].short_desc, "Sample rate");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "period");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = OSS_DRIVER_DEF_BLKSIZE;
+        strcpy(desc->params[i].short_desc, "Frames per period");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "nperiods");
+        desc->params[i].character = 'n';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = OSS_DRIVER_DEF_NPERIODS;
+        strcpy(desc->params[i].short_desc, "Number of periods to prefill output buffer");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "wordlength");
+        desc->params[i].character = 'w';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.i = OSS_DRIVER_DEF_BITS;
+        strcpy(desc->params[i].short_desc, "Word length");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "inchannels");
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = OSS_DRIVER_DEF_INS;
+        strcpy(desc->params[i].short_desc, "Capture channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "outchannels");
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = OSS_DRIVER_DEF_OUTS;
+        strcpy(desc->params[i].short_desc, "Playback channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "excl");
+        desc->params[i].character = 'e';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = false;
+        strcpy(desc->params[i].short_desc, "Exclusif (O_EXCL) access mode");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "capture");
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+        strcpy(desc->params[i].short_desc, "Input device");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "playback");
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+        strcpy(desc->params[i].short_desc, "Output device");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy (desc->params[i].name, "device");
+        desc->params[i].character = 'd';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+        strcpy(desc->params[i].short_desc, "OSS device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+      
+        i++;
+        strcpy(desc->params[i].name, "ignorehwbuf");
+        desc->params[i].character = 'b';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = true;
+        strcpy(desc->params[i].short_desc, "Ignore hardware period size");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "quality");
+        desc->params[i].character = 'q';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Resample algorithm quality (0 - 4)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+        
+        i++;
+        strcpy(desc->params[i].name, "ring-buffer");
+        desc->params[i].character = 'g';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 32768;
+        strcpy(desc->params[i].short_desc, "Fixed ringbuffer size");
+        strcpy(desc->params[i].long_desc, "Fixed ringbuffer size (if not set => automatic adaptative)");
+   
+        return desc;
+    }
+   
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/solaris/oss/JackOSSAdapter.h b/solaris/oss/JackOSSAdapter.h
new file mode 100644
index 0000000..6e739f8
--- /dev/null
+++ b/solaris/oss/JackOSSAdapter.h
@@ -0,0 +1,123 @@
+/*
+Copyright (C) 2008 Grame & RTL 2008
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackOSSAdapter__
+#define __JackOSSAdapter__
+
+#include <math.h>
+#include <limits.h>
+#include <assert.h>
+#include "JackAudioAdapterInterface.h"
+#include "JackPlatformPlug.h"
+#include "JackError.h"
+#include "jack.h"
+#include "jslist.h"
+
+namespace Jack
+{
+
+typedef jack_default_audio_sample_t jack_sample_t;
+
+#define OSS_DRIVER_N_PARAMS	13
+#define OSS_DRIVER_DEF_DEV	"/dev/dsp"
+#define OSS_DRIVER_DEF_FS	48000
+#define OSS_DRIVER_DEF_BLKSIZE	1024
+#define OSS_DRIVER_DEF_NPERIODS	2
+#define OSS_DRIVER_DEF_BITS	16
+#define OSS_DRIVER_DEF_INS	2
+#define OSS_DRIVER_DEF_OUTS	2
+
+/*!
+\brief The OSS adapter.
+*/
+
+class JackOSSAdapter : public JackAudioAdapterInterface, public JackRunnableInterface
+{
+
+    enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
+     
+    private:
+    
+        JackThread fThread;
+        
+        char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1];
+        char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1];
+        
+        int fInFD;
+        int fOutFD;
+        
+        int fBits;
+        int fSampleFormat;
+        int fNperiods;
+        unsigned int fSampleSize;
+        int	fRWMode;
+        bool fIgnoreHW;
+        bool fExcl;
+        
+        unsigned int fInputBufferSize;
+        unsigned int fOutputBufferSize;
+        
+        void* fInputBuffer;
+        void* fOutputBuffer;
+        
+        float** fInputSampleBuffer;
+        float** fOutputSampleBuffer;
+        
+        bool fFirstCycle;
+        
+        int OpenInput();
+        int OpenOutput();
+        void CloseAux();
+        void SetSampleFormat();
+        void DisplayDeviceInfo();
+   
+    public:
+    
+        JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params);
+        ~JackOSSAdapter()
+        {}
+        
+        int Open();
+        int Close();
+        
+        int Read();
+        int Write();
+         
+        int SetBufferSize(jack_nframes_t buffer_size);
+        
+        bool Execute();
+};
+
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "JackCompilerDeps.h"
+#include "driver_interface.h"
+
+EXPORT jack_driver_desc_t* jack_get_descriptor();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/solaris/oss/JackOSSDriver.cpp b/solaris/oss/JackOSSDriver.cpp
new file mode 100644
index 0000000..af0ed43
--- /dev/null
+++ b/solaris/oss/JackOSSDriver.cpp
@@ -0,0 +1,962 @@
+/*
+Copyright (C) 2003-2007 Jussi Laako <jussi at sonarnerd.net>
+Copyright (C) 2008 Grame & RTL 2008
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "driver_interface.h"
+#include "JackThreadedDriver.h"
+#include "JackDriverLoader.h"
+#include "JackOSSDriver.h"
+#include "JackEngineControl.h"
+#include "JackGraphManager.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include "JackShmMem.h"
+#include "memops.h"
+
+#include <sys/ioctl.h>
+#include <sys/soundcard.h>
+#include <fcntl.h>
+#include <iostream>
+#include <assert.h>
+#include <stdio.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+#ifdef JACK_MONITOR
+
+#define CYCLE_POINTS 500000
+
+struct OSSCycle {
+    jack_time_t fBeforeRead;
+    jack_time_t fAfterRead;
+    jack_time_t fAfterReadConvert;
+    jack_time_t fBeforeWrite;
+    jack_time_t fAfterWrite;
+    jack_time_t fBeforeWriteConvert;
+};
+
+struct OSSCycleTable {
+    jack_time_t fBeforeFirstWrite;
+    jack_time_t fAfterFirstWrite;
+    OSSCycle fTable[CYCLE_POINTS];
+};
+
+OSSCycleTable gCycleTable;
+int gCycleCount = 0;
+
+#endif
+
+inline int int2pow2(int x)	{ int r = 0; while ((1 << r) < x) r++; return r; }
+
+static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframes, int channel, int chcount, int bits)
+{
+    switch (bits) {
+
+		case 16: {
+		    signed short *s16src = (signed short*)src;
+            s16src += channel;
+            sample_move_dS_s16(dst, (char*)s16src, nframes, chcount<<1);
+			break;
+        }
+		case 24: {
+			signed int *s32src = (signed int*)src;
+            s32src += channel;
+            sample_move_dS_s24(dst, (char*)s32src, nframes, chcount<<2);
+			break;
+        }
+		case 32: {
+			signed int *s32src = (signed int*)src;
+            s32src += channel;
+            sample_move_dS_s32u24(dst, (char*)s32src, nframes, chcount<<2);
+			break;
+        }
+	}
+}
+
+static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nframes, int channel, int chcount, int bits)
+{
+	switch (bits) {
+
+		case 16: {
+			signed short *s16dst = (signed short*)dst;
+            s16dst += channel;
+            sample_move_d16_sS((char*)s16dst, src, nframes, chcount<<1, NULL); // No dithering for now...
+			break;
+        }
+		case 24: {
+			signed int *s32dst = (signed int*)dst;
+            s32dst += channel;
+            sample_move_d24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); // No dithering for now...
+			break;
+        }    
+		case 32: {
+            signed int *s32dst = (signed int*)dst;
+            s32dst += channel;
+            sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL);
+			break;  
+        }
+	}
+}
+
+void JackOSSDriver::SetSampleFormat()
+{
+    switch (fBits) {
+
+	    case 24:	/* native-endian LSB aligned 24-bits in 32-bits integer */
+            fSampleFormat = AFMT_S24_NE;
+            fSampleSize = sizeof(int);
+			break;
+		case 32:	/* native-endian 32-bit integer */
+            fSampleFormat = AFMT_S32_NE; 
+            fSampleSize = sizeof(int);
+			break;
+		case 16:	/* native-endian 16-bit integer */
+		default:
+            fSampleFormat = AFMT_S16_NE;
+            fSampleSize = sizeof(short);
+			break;
+    }
+}
+
+void JackOSSDriver::DisplayDeviceInfo()
+{
+    audio_buf_info info;
+    oss_audioinfo ai_in, ai_out;
+    memset(&info, 0, sizeof(audio_buf_info));
+    int cap = 0;
+    
+    // Duplex cards : http://manuals.opensound.com/developer/full_duplex.html
+    jack_info("Audio Interface Description :");
+    jack_info("Sampling Frequency : %d, Sample Format : %d, Mode : %d", fEngineControl->fSampleRate, fSampleFormat, fRWMode);
+    
+    if (fRWMode & kWrite) {
+	
+        oss_sysinfo si;
+        if (ioctl(fOutFD, OSS_SYSINFO, &si) == -1) {
+            jack_error("JackOSSDriver::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("OSS product %s", si.product);
+            jack_info("OSS version %s", si.version);
+            jack_info("OSS version num %d", si.versionnum);
+            jack_info("OSS numaudios %d", si.numaudios);
+            jack_info("OSS numaudioengines %d", si.numaudioengines);
+            jack_info("OSS numcards %d", si.numcards);
+        }
+	
+        jack_info("Output capabilities - %d channels : ", fPlaybackChannels);
+        jack_info("Output block size = %d", fOutputBufferSize);
+    
+        if (ioctl(fOutFD, SNDCTL_DSP_GETOSPACE, &info) == -1)  {
+            jack_error("JackOSSDriver::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("output space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d", 
+                info.fragments, info.fragstotal, info.fragsize, info.bytes);
+        }
+    
+        if (ioctl(fOutFD, SNDCTL_DSP_GETCAPS, &cap) == -1)  {
+            jack_error("JackOSSDriver::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            if (cap & DSP_CAP_DUPLEX) 	jack_info(" DSP_CAP_DUPLEX");
+            if (cap & DSP_CAP_REALTIME) jack_info(" DSP_CAP_REALTIME");
+            if (cap & DSP_CAP_BATCH) 	jack_info(" DSP_CAP_BATCH");
+            if (cap & DSP_CAP_COPROC) 	jack_info(" DSP_CAP_COPROC");
+            if (cap & DSP_CAP_TRIGGER)  jack_info(" DSP_CAP_TRIGGER");
+            if (cap & DSP_CAP_MMAP) 	jack_info(" DSP_CAP_MMAP");
+            if (cap & DSP_CAP_MULTI) 	jack_info(" DSP_CAP_MULTI");
+            if (cap & DSP_CAP_BIND) 	jack_info(" DSP_CAP_BIND");
+        }
+    }	
+    
+    if (fRWMode & kRead) {
+    
+      	oss_sysinfo si;
+        if (ioctl(fInFD, OSS_SYSINFO, &si) == -1) {
+            jack_error("JackOSSDriver::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("OSS product %s", si.product);
+            jack_info("OSS version %s", si.version);
+            jack_info("OSS version num %d", si.versionnum);
+            jack_info("OSS numaudios %d", si.numaudios);
+            jack_info("OSS numaudioengines %d", si.numaudioengines);
+            jack_info("OSS numcards %d", si.numcards);
+        }
+    
+        jack_info("Input capabilities - %d channels : ", fCaptureChannels);
+        jack_info("Input block size = %d", fInputBufferSize);
+    
+        if (ioctl(fInFD, SNDCTL_DSP_GETISPACE, &info) == -1) { 
+            jack_error("JackOSSDriver::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            jack_info("input space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d", 
+                info.fragments, info.fragstotal, info.fragsize, info.bytes);
+        }
+
+        if (ioctl(fInFD, SNDCTL_DSP_GETCAPS, &cap) == -1) {
+            jack_error("JackOSSDriver::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        } else {
+            if (cap & DSP_CAP_DUPLEX) 	jack_info(" DSP_CAP_DUPLEX");
+            if (cap & DSP_CAP_REALTIME) jack_info(" DSP_CAP_REALTIME");
+            if (cap & DSP_CAP_BATCH) 	jack_info(" DSP_CAP_BATCH");
+            if (cap & DSP_CAP_COPROC) 	jack_info(" DSP_CAP_COPROC");
+            if (cap & DSP_CAP_TRIGGER)  jack_info(" DSP_CAP_TRIGGER");
+            if (cap & DSP_CAP_MMAP) 	jack_info(" DSP_CAP_MMAP");
+            if (cap & DSP_CAP_MULTI) 	jack_info(" DSP_CAP_MULTI");
+            if (cap & DSP_CAP_BIND) 	jack_info(" DSP_CAP_BIND");
+        }
+    }
+     
+    if (ai_in.rate_source != ai_out.rate_source) {
+        jack_info("Warning : input and output are not necessarily driven by the same clock!");
+    }
+}
+
+int JackOSSDriver::OpenInput()
+{
+    int flags = 0;
+    int gFragFormat;
+    int cur_capture_channels;
+    int cur_sample_format;
+    jack_nframes_t cur_sample_rate;
+
+    if (fCaptureChannels == 0) fCaptureChannels = 2;
+  
+    if ((fInFD = open(fCaptureDriverName, O_RDONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
+        jack_error("JackOSSDriver::OpenInput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        return -1;
+    }
+
+    jack_log("JackOSSDriver::OpenInput input fInFD = %d", fInFD);
+
+    if (fExcl) {
+        if (ioctl(fInFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
+            jack_error("JackOSSDriver::OpenInput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            goto error;
+        }
+    }
+
+    gFragFormat = (2 << 16) + int2pow2(fEngineControl->fBufferSize * fSampleSize * fCaptureChannels);	
+    if (ioctl(fInFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
+        jack_error("JackOSSDriver::OpenInput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+
+    cur_sample_format = fSampleFormat;
+    if (ioctl(fInFD, SNDCTL_DSP_SETFMT, &fSampleFormat) == -1) {
+        jack_error("JackOSSDriver::OpenInput failed to set format : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_format != fSampleFormat) {
+        jack_info("JackOSSDriver::OpenInput driver forced the sample format %ld", fSampleFormat);
+    }
+    
+    cur_capture_channels = fCaptureChannels;
+    if (ioctl(fInFD, SNDCTL_DSP_CHANNELS, &fCaptureChannels) == -1) {
+        jack_error("JackOSSDriver::OpenInput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_capture_channels != fCaptureChannels) {
+        jack_info("JackOSSDriver::OpenInput driver forced the number of capture channels %ld", fCaptureChannels);
+    }
+       
+    cur_sample_rate = fEngineControl->fSampleRate;
+    if (ioctl(fInFD, SNDCTL_DSP_SPEED, &fEngineControl->fSampleRate) == -1) {
+        jack_error("JackOSSDriver::OpenInput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_rate != fEngineControl->fSampleRate) {
+        jack_info("JackOSSDriver::OpenInput driver forced the sample rate %ld", fEngineControl->fSampleRate);
+    }
+
+    fInputBufferSize = 0;
+    if (ioctl(fInFD, SNDCTL_DSP_GETBLKSIZE, &fInputBufferSize) == -1) {
+        jack_error("JackOSSDriver::OpenInput failed to get fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+        
+    if (fInputBufferSize != fEngineControl->fBufferSize * fSampleSize * fCaptureChannels) {
+       if (fIgnoreHW) {
+           int new_buffer_size = fInputBufferSize / (fSampleSize * fCaptureChannels);
+           jack_info("JackOSSDriver::OpenInput driver forced buffer size %ld", new_buffer_size);
+           JackAudioDriver::SetBufferSize(new_buffer_size); // never fails
+       } else {
+           jack_error("JackOSSDriver::OpenInput wanted buffer size cannot be obtained");
+           goto error;
+       }
+    }
+
+    fInputBuffer = (void*)calloc(fInputBufferSize, 1);
+    assert(fInputBuffer);
+    return 0;
+    
+error:
+    ::close(fInFD);
+    return -1;
+}
+
+int JackOSSDriver::OpenOutput()
+{
+    int flags = 0;
+    int gFragFormat;
+    int cur_sample_format;
+    int cur_playback_channels;
+    jack_nframes_t cur_sample_rate;
+
+    if (fPlaybackChannels == 0) fPlaybackChannels = 2;
+    
+    if ((fOutFD = open(fPlaybackDriverName, O_WRONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
+       jack_error("JackOSSDriver::OpenOutput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+       return -1;
+    }
+
+    jack_log("JackOSSDriver::OpenOutput output fOutFD = %d", fOutFD);
+    
+    if (fExcl) {
+        if (ioctl(fOutFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
+            jack_error("JackOSSDriver::OpenOutput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            goto error;
+        }  
+    } 
+
+    gFragFormat = (2 << 16) + int2pow2(fEngineControl->fBufferSize * fSampleSize * fPlaybackChannels);	
+    if (ioctl(fOutFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
+        jack_error("JackOSSDriver::OpenOutput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+   
+    cur_sample_format = fSampleFormat;
+    if (ioctl(fOutFD, SNDCTL_DSP_SETFMT, &fSampleFormat) == -1) {
+        jack_error("JackOSSDriver::OpenOutput failed to set format : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_format != fSampleFormat) {
+        jack_info("JackOSSDriver::OpenOutput driver forced the sample format %ld", fSampleFormat);
+    }
+    
+    cur_playback_channels = fPlaybackChannels;
+    if (ioctl(fOutFD, SNDCTL_DSP_CHANNELS, &fPlaybackChannels) == -1) {
+        jack_error("JackOSSDriver::OpenOutput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_playback_channels != fPlaybackChannels) {
+        jack_info("JackOSSDriver::OpenOutput driver forced the number of playback channels %ld", fPlaybackChannels);
+    }
+
+    cur_sample_rate = fEngineControl->fSampleRate;
+    if (ioctl(fOutFD, SNDCTL_DSP_SPEED, &fEngineControl->fSampleRate) == -1) {
+        jack_error("JackOSSDriver::OpenOutput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+    if (cur_sample_rate != fEngineControl->fSampleRate) {
+        jack_info("JackOSSDriver::OpenInput driver forced the sample rate %ld", fEngineControl->fSampleRate);
+    }
+
+    fOutputBufferSize = 0;
+    if (ioctl(fOutFD, SNDCTL_DSP_GETBLKSIZE, &fOutputBufferSize) == -1) {
+        jack_error("JackOSSDriver::OpenOutput failed to get fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+        goto error;
+    }
+         
+    if (fOutputBufferSize != fEngineControl->fBufferSize * fSampleSize * fPlaybackChannels) {
+       if (fIgnoreHW) {
+           int new_buffer_size = fOutputBufferSize / (fSampleSize * fPlaybackChannels);
+           jack_info("JackOSSDriver::OpenOutput driver forced buffer size %ld", new_buffer_size);
+           JackAudioDriver::SetBufferSize(new_buffer_size); // never fails
+       } else {
+           jack_error("JackOSSDriver::OpenInput wanted buffer size cannot be obtained");
+           goto error;
+       }
+    }
+    
+    fOutputBuffer = (void*)calloc(fOutputBufferSize, 1);
+    fFirstCycle = true;
+    assert(fOutputBuffer);
+    return 0;
+    
+error:
+    ::close(fOutFD);
+    return -1;
+}
+
+int JackOSSDriver::Open(jack_nframes_t nframes,
+                      int user_nperiods, 
+                      jack_nframes_t samplerate,
+                      bool capturing,
+                      bool playing,
+                      int inchannels,
+                      int outchannels,
+                      bool excl,
+                      bool monitor,
+                      const char* capture_driver_uid,
+                      const char* playback_driver_uid,
+                      jack_nframes_t capture_latency,
+                      jack_nframes_t playback_latency,
+                      int bits,
+                      bool ignorehwbuf)
+{
+    // Generic JackAudioDriver Open
+    if (JackAudioDriver::Open(nframes, samplerate, capturing, playing, inchannels, outchannels, monitor, 
+        capture_driver_uid, playback_driver_uid, capture_latency, playback_latency) != 0) {
+        return -1;
+    } else {
+
+        if (!fEngineControl->fSyncMode) {
+            jack_error("Cannot run in asynchronous mode, use the -S parameter for jackd");
+            return -1;
+        }
+     
+        fRWMode |= ((capturing) ? kRead : 0);
+        fRWMode |= ((playing) ? kWrite : 0);
+        fBits = bits;
+        fIgnoreHW = ignorehwbuf;
+        fNperiods = user_nperiods;
+        fExcl = excl;
+
+    #ifdef JACK_MONITOR
+        // Force memory page in
+        memset(&gCycleTable, 0, sizeof(gCycleTable));
+    #endif
+        
+        if (OpenAux() < 0) {
+            Close();
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+}
+
+int JackOSSDriver::Close()
+{
+ #ifdef JACK_MONITOR
+    FILE* file = fopen("OSSProfiling.log", "w");
+    
+    if (file) {
+        jack_info("Writing OSS driver timing data....");
+        for (int i = 1; i < gCycleCount; i++) {
+            int d1 = gCycleTable.fTable[i].fAfterRead - gCycleTable.fTable[i].fBeforeRead;
+            int d2 = gCycleTable.fTable[i].fAfterReadConvert - gCycleTable.fTable[i].fAfterRead;
+            int d3 = gCycleTable.fTable[i].fAfterWrite - gCycleTable.fTable[i].fBeforeWrite;
+            int d4 = gCycleTable.fTable[i].fBeforeWrite - gCycleTable.fTable[i].fBeforeWriteConvert;     
+            fprintf(file, "%d \t %d \t %d \t %d \t \n", d1, d2, d3, d4);
+        }
+        fclose(file);
+    } else {
+        jack_error("JackOSSDriver::Close : cannot open OSSProfiling.log file");
+    }
+
+    file = fopen("TimingOSS.plot", "w");
+
+    if (file == NULL) {
+        jack_error("JackOSSDriver::Close cannot open TimingOSS.plot file");
+    } else {
+        
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"OSS audio driver timing\"\n");
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"usec\"\n");
+        fprintf(file, "plot \"OSSProfiling.log\" using 1 title \"Driver read wait\" with lines, \
+                            \"OSSProfiling.log\" using 2 title \"Driver read convert duration\" with lines, \
+                            \"OSSProfiling.log\" using 3 title \"Driver write wait\" with lines, \
+                            \"OSSProfiling.log\" using 4 title \"Driver write convert duration\" with lines\n");
+    
+        fprintf(file, "set output 'TimingOSS.pdf\n");
+        fprintf(file, "set terminal pdf\n");
+    
+        fprintf(file, "set grid\n");
+        fprintf(file, "set title \"OSS audio driver timing\"\n");
+        fprintf(file, "set xlabel \"audio cycles\"\n");
+        fprintf(file, "set ylabel \"usec\"\n");
+        fprintf(file, "plot \"OSSProfiling.log\" using 1 title \"Driver read wait\" with lines, \
+                            \"OSSProfiling.log\" using 2 title \"Driver read convert duration\" with lines, \
+                            \"OSSProfiling.log\" using 3 title \"Driver write wait\" with lines, \
+                            \"OSSProfiling.log\" using 4 title \"Driver write convert duration\" with lines\n");
+      
+        fclose(file);
+    }
+ #endif
+    int res = JackAudioDriver::Close();
+    CloseAux();    
+    return res;
+}
+
+
+int JackOSSDriver::OpenAux()
+{
+    SetSampleFormat();
+
+    if ((fRWMode & kRead) && (OpenInput() < 0)) {
+        return -1;
+    }
+  
+    if ((fRWMode & kWrite) && (OpenOutput() < 0)) { 
+        return -1;
+    }
+
+    // In duplex mode, check that input and output use the same buffer size
+    /*
+
+    10/02/09 : desactivated for now, needs more check (only needed when *same* device is used for input and output ??)
+
+    if ((fRWMode & kRead) && (fRWMode & kWrite) && (fInputBufferSize != fOutputBufferSize)) {
+       jack_error("JackOSSDriver::OpenAux input and output buffer size are not the same!!");
+       return -1;
+    }
+    */
+
+    DisplayDeviceInfo();  
+    return 0;
+}
+
+void JackOSSDriver::CloseAux()
+{
+    if (fRWMode & kRead && fInFD > 0) {
+        close(fInFD);
+        fInFD = -1;
+    }
+    
+    if (fRWMode & kWrite && fOutFD > 0) {
+        close(fOutFD);
+        fOutFD = -1;
+    }
+    
+    if (fInputBuffer)
+        free(fInputBuffer);
+    fInputBuffer = NULL;
+    
+    if (fOutputBuffer)
+        free(fOutputBuffer);
+    fOutputBuffer = NULL;
+}
+
+int JackOSSDriver::Read()
+{
+    if (fInFD < 0) {
+        // Keep begin cycle time
+        JackDriver::CycleTakeBeginTime();
+        return 0;
+    }
+    
+    ssize_t count;
+
+#ifdef JACK_MONITOR
+    gCycleTable.fTable[gCycleCount].fBeforeRead = GetMicroSeconds();
+#endif
+
+    audio_errinfo ei_in;
+    count = ::read(fInFD, fInputBuffer, fInputBufferSize);  
+ 
+#ifdef JACK_MONITOR
+    if (count > 0 && count != (int)fInputBufferSize)
+        jack_log("JackOSSDriver::Read count = %ld", count / (fSampleSize * fCaptureChannels));
+    gCycleTable.fTable[gCycleCount].fAfterRead = GetMicroSeconds();
+#endif
+    
+    // XRun detection
+    if (ioctl(fInFD, SNDCTL_DSP_GETERROR, &ei_in) == 0) {
+
+        if (ei_in.rec_overruns > 0 ) {
+            jack_error("JackOSSDriver::Read overruns");
+            jack_time_t cur_time = GetMicroSeconds();
+            NotifyXRun(cur_time, float(cur_time - fBeginDateUst));   // Better this value than nothing... 
+        }
+
+        if (ei_in.rec_errorcount > 0 && ei_in.rec_lasterror != 0) {
+            jack_error("%d OSS rec event(s), last=%05d:%d", ei_in.rec_errorcount, ei_in.rec_lasterror, ei_in.rec_errorparm);
+        }
+    }   
+    
+    if (count < 0) {
+        jack_log("JackOSSDriver::Read error = %s", strerror(errno));
+        return -1;
+    } else if (count < (int)fInputBufferSize) {
+        jack_error("JackOSSDriver::Read error bytes read = %ld", count);
+        return -1;
+    } else {
+
+        // Keep begin cycle time
+        JackDriver::CycleTakeBeginTime();
+        for (int i = 0; i < fCaptureChannels; i++) {
+            if (fGraphManager->GetConnectionsNum(fCapturePortList[i]) > 0) {
+                CopyAndConvertIn(GetInputBuffer(i), fInputBuffer, fEngineControl->fBufferSize, i, fCaptureChannels, fBits);
+            }
+        }
+
+    #ifdef JACK_MONITOR
+        gCycleTable.fTable[gCycleCount].fAfterReadConvert = GetMicroSeconds();
+    #endif
+        
+        return 0;
+    }
+}
+
+int JackOSSDriver::Write()
+{
+    if (fOutFD < 0) {
+        // Keep end cycle time
+        JackDriver::CycleTakeEndTime();
+        return 0;
+    }
+
+    ssize_t count;
+    audio_errinfo ei_out;
+   
+    // Maybe necessary to write an empty output buffer first time : see http://manuals.opensound.com/developer/fulldup.c.html   
+    if (fFirstCycle) {
+    
+        fFirstCycle = false;
+        memset(fOutputBuffer, 0, fOutputBufferSize);
+
+        // Prefill ouput buffer
+        for (int i = 0; i < fNperiods; i++) {
+           count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
+           if (count < (int)fOutputBufferSize) {
+                jack_error("JackOSSDriver::Write error bytes written = %ld", count);
+                return -1;
+            }
+        }
+        
+        int delay;
+        if (ioctl(fOutFD, SNDCTL_DSP_GETODELAY, &delay) == -1) {
+            jack_error("JackOSSDriver::Write error get out delay : %s@%i, errno = %d", __FILE__, __LINE__, errno);
+            return -1;
+        }
+        
+        delay /= fSampleSize * fPlaybackChannels;
+        jack_info("JackOSSDriver::Write output latency frames = %ld", delay);
+    }
+  
+#ifdef JACK_MONITOR
+    gCycleTable.fTable[gCycleCount].fBeforeWriteConvert = GetMicroSeconds();
+#endif
+
+    memset(fOutputBuffer, 0, fOutputBufferSize);
+    for (int i = 0; i < fPlaybackChannels; i++) {
+        if (fGraphManager->GetConnectionsNum(fPlaybackPortList[i]) > 0) {
+            CopyAndConvertOut(fOutputBuffer, GetOutputBuffer(i), fEngineControl->fBufferSize, i, fPlaybackChannels, fBits);
+        }
+    }
+
+  #ifdef JACK_MONITOR
+    gCycleTable.fTable[gCycleCount].fBeforeWrite = GetMicroSeconds();
+  #endif    
+
+    // Keep end cycle time
+    JackDriver::CycleTakeEndTime();
+    count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
+
+  #ifdef JACK_MONITOR
+    if (count > 0 && count != (int)fOutputBufferSize)
+        jack_log("JackOSSDriver::Write count = %ld", count / (fSampleSize * fPlaybackChannels));
+    gCycleTable.fTable[gCycleCount].fAfterWrite = GetMicroSeconds();
+    gCycleCount = (gCycleCount == CYCLE_POINTS - 1) ? gCycleCount: gCycleCount + 1;
+  #endif
+
+    // XRun detection
+    if (ioctl(fOutFD, SNDCTL_DSP_GETERROR, &ei_out) == 0) {
+
+        if (ei_out.play_underruns > 0) {
+            jack_error("JackOSSDriver::Write underruns");
+            jack_time_t cur_time = GetMicroSeconds();
+            NotifyXRun(cur_time, float(cur_time - fBeginDateUst));   // Better this value than nothing... 
+        }
+
+        if (ei_out.play_errorcount > 0 && ei_out.play_lasterror != 0) {
+            jack_error("%d OSS play event(s), last=%05d:%d",ei_out.play_errorcount, ei_out.play_lasterror, ei_out.play_errorparm);
+        }
+    }
+     
+    if (count < 0) {
+        jack_log("JackOSSDriver::Write error = %s", strerror(errno));
+        return -1;
+    } else if (count < (int)fOutputBufferSize) {
+        jack_error("JackOSSDriver::Write error bytes written = %ld", count);
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackOSSDriver::SetBufferSize(jack_nframes_t buffer_size)
+{
+    CloseAux(); 
+    JackAudioDriver::SetBufferSize(buffer_size); // never fails
+    return OpenAux();
+}
+
+int JackOSSDriver::ProcessSync()
+{
+    // Read input buffers for the current cycle
+    if (Read() < 0) { 
+        jack_error("ProcessSync: read error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+
+    if (fIsMaster) {
+        ProcessGraphSync();
+    } else {
+        fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
+    }
+    
+    // Write output buffers for the current cycle
+    if (Write() < 0) { 
+        jack_error("JackAudioDriver::ProcessSync: write error, skip cycle");
+        return 0;   // Skip cycle, but continue processing...
+    }
+    
+    return 0;
+}
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
+{
+    jack_driver_desc_t *desc;
+    unsigned int i;
+    desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+    strcpy(desc->name, "oss");                              // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+    strcpy(desc->desc, "OSS API based audio backend");      // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+       
+    desc->nparams = OSS_DRIVER_N_PARAMS;
+    desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+    i = 0;
+    strcpy(desc->params[i].name, "rate");
+    desc->params[i].character = 'r';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_FS;
+    strcpy(desc->params[i].short_desc, "Sample rate");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "period");
+    desc->params[i].character = 'p';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_BLKSIZE;
+    strcpy(desc->params[i].short_desc, "Frames per period");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "nperiods");
+    desc->params[i].character = 'n';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_NPERIODS;
+    strcpy(desc->params[i].short_desc, "Number of periods to prefill output buffer");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "wordlength");
+    desc->params[i].character = 'w';
+    desc->params[i].type = JackDriverParamInt;
+    desc->params[i].value.i = OSS_DRIVER_DEF_BITS;
+    strcpy(desc->params[i].short_desc, "Word length");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "inchannels");
+    desc->params[i].character = 'i';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_INS;
+    strcpy(desc->params[i].short_desc, "Capture channels");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+    
+    i++;
+    strcpy(desc->params[i].name, "outchannels");
+    desc->params[i].character = 'o';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.ui = OSS_DRIVER_DEF_OUTS;
+    strcpy(desc->params[i].short_desc, "Playback channels");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "excl");
+    desc->params[i].character = 'e';
+    desc->params[i].type = JackDriverParamBool;
+    desc->params[i].value.i = false;
+    strcpy(desc->params[i].short_desc, "Exclusif (O_EXCL) access mode");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "capture");
+    desc->params[i].character = 'C';
+    desc->params[i].type = JackDriverParamString;
+    strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+    strcpy(desc->params[i].short_desc, "Input device");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+    
+    i++;
+    strcpy(desc->params[i].name, "playback");
+    desc->params[i].character = 'P';
+    desc->params[i].type = JackDriverParamString;
+    strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+    strcpy(desc->params[i].short_desc, "Output device");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy (desc->params[i].name, "device");
+    desc->params[i].character = 'd';
+    desc->params[i].type = JackDriverParamString;
+    strcpy(desc->params[i].value.str, OSS_DRIVER_DEF_DEV);
+    strcpy(desc->params[i].short_desc, "OSS device name");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+  
+    i++;
+    strcpy(desc->params[i].name, "ignorehwbuf");
+    desc->params[i].character = 'b';
+    desc->params[i].type = JackDriverParamBool;
+    desc->params[i].value.i = false;
+    strcpy(desc->params[i].short_desc, "Ignore hardware period size");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+   
+    i++;
+    strcpy(desc->params[i].name, "input-latency");
+    desc->params[i].character = 'I';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.i = 0;
+    strcpy(desc->params[i].short_desc, "Extra input latency");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    i++;
+    strcpy(desc->params[i].name, "output-latency");
+    desc->params[i].character = 'O';
+    desc->params[i].type = JackDriverParamUInt;
+    desc->params[i].value.i = 0;
+    strcpy(desc->params[i].short_desc, "Extra output latency");
+    strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+    return desc;
+}
+
+EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
+{
+    int bits = OSS_DRIVER_DEF_BITS;
+    jack_nframes_t srate = OSS_DRIVER_DEF_FS;
+    jack_nframes_t frames_per_interrupt = OSS_DRIVER_DEF_BLKSIZE;
+    const char* capture_pcm_name = OSS_DRIVER_DEF_DEV;
+    const char* playback_pcm_name = OSS_DRIVER_DEF_DEV;
+    bool capture = false;
+    bool playback = false;
+    int chan_in = 0;
+    int chan_out = 0;
+    bool monitor = false;
+    bool excl = false;
+    unsigned int nperiods = OSS_DRIVER_DEF_NPERIODS;
+    const JSList *node;
+    const jack_driver_param_t *param;
+    bool ignorehwbuf = false;
+    jack_nframes_t systemic_input_latency = 0;
+    jack_nframes_t systemic_output_latency = 0;
+ 
+    for (node = params; node; node = jack_slist_next(node)) {
+    
+        param = (const jack_driver_param_t *)node->data;
+
+        switch (param->character) {
+        
+        case 'r':
+            srate = param->value.ui;
+            break;
+
+        case 'p':
+            frames_per_interrupt = (unsigned int)param->value.ui;
+            break;
+
+        case 'n':
+            nperiods = (unsigned int)param->value.ui;
+            break;
+
+        case 'w':
+            bits = param->value.i;
+            break;
+
+        case 'i':
+            chan_in = (int)param->value.ui;
+            break;
+
+        case 'o':
+            chan_out = (int)param->value.ui;
+            break;
+            
+        case 'C':
+            capture = true;
+            if (strcmp(param->value.str, "none") != 0) {
+                capture_pcm_name = strdup(param->value.str);
+            }
+            break;
+
+        case 'P':
+            playback = true;
+            if (strcmp(param->value.str, "none") != 0) {
+                playback_pcm_name = strdup(param->value.str);
+            }
+            break;
+
+        case 'd':
+            playback_pcm_name = strdup (param->value.str);
+            capture_pcm_name = strdup (param->value.str);
+            break;
+    
+        case 'b':
+            ignorehwbuf = true;
+            break;
+
+        case 'e':
+            excl = true;
+            break;
+		
+        case 'I':
+            systemic_input_latency = param->value.ui;
+            break;
+
+        case 'O':
+            systemic_output_latency = param->value.ui;
+            break;
+        }
+    }
+
+    // duplex is the default
+    if (!capture && !playback) {
+        capture = true;
+        playback = true;
+    }
+
+    Jack::JackOSSDriver* oss_driver = new Jack::JackOSSDriver("system", "oss", engine, table);
+    Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(oss_driver);
+    
+    // Special open for OSS driver...
+    if (oss_driver->Open(frames_per_interrupt, nperiods, srate, capture, playback, chan_in, chan_out, 
+        excl, monitor, capture_pcm_name, playback_pcm_name, systemic_input_latency, systemic_output_latency, bits, ignorehwbuf) == 0) {
+        return threaded_driver;
+    } else {
+        delete threaded_driver; // Delete the decorated driver
+        return NULL;
+    }
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/solaris/oss/JackOSSDriver.h b/solaris/oss/JackOSSDriver.h
new file mode 100644
index 0000000..bedd72b
--- /dev/null
+++ b/solaris/oss/JackOSSDriver.h
@@ -0,0 +1,126 @@
+/*
+Copyright (C) 2003-2007 Jussi Laako <jussi at sonarnerd.net>
+Copyright (C) 2008 Grame & RTL 2008
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackOSSDriver__
+#define __JackOSSDriver__
+
+#include "JackAudioDriver.h"
+
+namespace Jack
+{
+
+typedef jack_default_audio_sample_t jack_sample_t;
+
+#define OSS_DRIVER_N_PARAMS	13
+#define OSS_DRIVER_DEF_DEV	"/dev/dsp"
+#define OSS_DRIVER_DEF_FS	48000
+#define OSS_DRIVER_DEF_BLKSIZE	1024
+#define OSS_DRIVER_DEF_NPERIODS	1
+#define OSS_DRIVER_DEF_BITS	16
+#define OSS_DRIVER_DEF_INS	2
+#define OSS_DRIVER_DEF_OUTS	2
+
+/*!
+\brief The OSS driver.
+*/
+
+class JackOSSDriver : public JackAudioDriver
+{
+
+    enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
+
+    private:
+    
+        int fInFD;
+        int fOutFD;
+        
+        int fBits;
+        int fSampleFormat;
+        int fNperiods;
+        unsigned int fSampleSize;
+        int fRWMode;
+        bool fExcl;
+        bool fIgnoreHW;
+        
+        unsigned int fInputBufferSize;
+        unsigned int fOutputBufferSize;
+        
+        void* fInputBuffer;
+        void* fOutputBuffer;
+        
+        bool fFirstCycle;
+        
+        int OpenInput();
+        int OpenOutput();
+        int OpenAux();
+        void CloseAux();
+        void SetSampleFormat();
+        void DisplayDeviceInfo();
+
+        // Redefining since timing for CPU load is specific
+        int ProcessSync();
+
+    public:
+
+        JackOSSDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+                : JackAudioDriver(name, alias, engine, table),
+                fInFD(-1), fOutFD(-1), fBits(0), 
+                fSampleFormat(0), fNperiods(0), fRWMode(0), fExcl(false), fIgnoreHW(true),
+                fInputBufferSize(0), fOutputBufferSize(0),
+                fInputBuffer(NULL), fOutputBuffer(NULL), fFirstCycle(true)
+        {}
+
+        virtual ~JackOSSDriver()
+        {}
+
+        int Open(jack_nframes_t frames_per_cycle,
+                 int user_nperiods, 
+                 jack_nframes_t rate,
+                 bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool vmix,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency,
+                 int bits,
+                 bool ignorehwbuf);
+
+        int Close();
+
+        int Read();
+        int Write();
+
+        // BufferSize can be changed
+        bool IsFixedBufferSize()
+        {
+            return false;
+        }
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/solaris/wscript b/solaris/wscript
new file mode 100644
index 0000000..77838cf
--- /dev/null
+++ b/solaris/wscript
@@ -0,0 +1,37 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+def create_jack_driver_obj(bld, target, sources, uselib = None):
+    driver = bld.new_task_gen('cxx', 'shlib')
+    driver.features.append('cc')
+    driver.env['shlib_PATTERN'] = 'jack_%s.so'
+    #driver.env.append_unique('CXXFLAGS', '-march=i686 -msse3 -ffast-math')
+    #driver.env.append_unique('CCFLAGS', '-march=i686  -msse3  -ffast-math')
+    driver.defines = 'HAVE_CONFIG_H'
+    driver.includes = ['.', '..','../posix', '../common', '../common/jack']
+    driver.target = target
+    driver.source = sources
+    driver.install_path = '${ADDON_DIR}/'
+    driver.uselib_local = 'serverlib'
+    if uselib:
+        driver.uselib = uselib
+    return driver
+
+def build(bld):
+    jackd = bld.new_task_gen('cxx', 'program')
+    jackd.includes = ['.','..', '../posix', '../common/jack', '../common']
+    jackd.defines = 'HAVE_CONFIG_H'
+    jackd.source = ['../common/Jackdmp.cpp']
+    jackd.uselib = 'PTHREAD DL'
+    jackd.uselib_local = 'serverlib'
+    jackd.target = 'jackd'
+
+    create_jack_driver_obj(bld, 'oss', ['oss/JackOSSDriver.cpp', '../common/memops.c'])
+
+    create_jack_driver_obj(bld, 'boomer', ['oss/JackBoomerDriver.cpp', '../common/memops.c'])
+
+    create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp')
+
+    create_jack_driver_obj(bld, 'net', '../common/JackNetDriver.cpp')
+
+    create_jack_driver_obj(bld, 'loopback', '../common/JackLoopbackDriver.cpp')
diff --git a/svnversion.h b/svnversion.h
new file mode 100644
index 0000000..30125b6
--- /dev/null
+++ b/svnversion.h
@@ -0,0 +1 @@
+#define SVN_VERSION "3909"
diff --git a/tests/cpu.c b/tests/cpu.c
new file mode 100644
index 0000000..a9e2e06
--- /dev/null
+++ b/tests/cpu.c
@@ -0,0 +1,260 @@
+/*
+    Copyright (C) 2005 Samuel TRACOL
+	Copyright (C) 2008 Grame
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file jack_cpu.c
+ *
+ * @brief This client test the capacity for jackd to kick out a to heavy cpu client.
+ * 
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <jack/jack.h>
+
+jack_port_t *input_port;
+jack_port_t *output_port;
+jack_client_t *client;
+unsigned long sr;
+jack_nframes_t idle_time = 0;
+int percent_cpu = 0;
+int time_to_run = 0;
+int time_before_run = 0;
+int time_before_exit = 1;
+jack_nframes_t cur_buffer_size;
+
+/* a simple state machine for this client */
+volatile enum {
+	Init,
+	Run,
+	Exit
+} client_state = Init;
+
+void usage()
+{
+	fprintf (stderr, "\n"
+					"usage: jack_cpu \n"
+					"              [ --name OR -n client_name ]\n"
+					"              [ --time OR -t time_to_run (in seconds) ]\n"
+					"              [ --delay OR -d delay_before_cpuload__is_applied (in seconds) ]\n"
+					"                --cpu OR -c percent_cpu_load (1-99)\n"
+	);
+}
+
+int update_buffer_size(jack_nframes_t nframes, void *arg)
+{
+	cur_buffer_size = nframes;
+	printf("Buffer size = %d \n", cur_buffer_size);
+	idle_time = (jack_nframes_t) (cur_buffer_size * percent_cpu / 100);
+	printf("CPU load applies as %d sample delay.\n", idle_time);
+	return 0;
+}
+
+/**
+ * The process callback for this JACK application is called in a
+ * special realtime thread once for each audio cycle.
+ *
+ */
+
+int process(jack_nframes_t nframes, void *arg)
+{
+	jack_default_audio_sample_t *in, *out;
+	jack_nframes_t start_frame = jack_frame_time(client);
+	
+	in = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port, nframes);
+	out = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port, nframes);
+	memset(out, 0, sizeof (jack_default_audio_sample_t) * nframes); 
+    
+	while ((client_state == Run) && (jack_frame_time(client) < (start_frame + idle_time))) {}
+ 	return 0;      
+}
+
+/**
+ * JACK calls this shutdown_callback if the server ever shuts down or
+ * decides to disconnect the client.
+ */
+ 
+void jack_shutdown(void *arg)
+{
+	printf("Jack_cpu has been kicked out by jackd !\n");
+	exit (1);
+}
+
+int main(int argc, char *argv[])
+{
+	const char **ports;
+	const char *client_name;
+	int got_time = 0;
+    jack_status_t status;
+
+	int option_index;
+	int opt;
+	const char *options = "t:t:d:c:";
+	struct option long_options[] =
+	{
+		{"time", 1, 0, 't'},
+		{"name", 1, 0, 'n'},
+		{"delay", 1, 0, 'd'},
+		{"cpu", 1, 0, 'c'},
+		{0, 0, 0, 0}
+	};
+	
+	client_name = "jack-cpu";
+	while ((opt = getopt_long (argc, argv, options, long_options, &option_index)) != EOF) {
+		switch (opt) {
+			case 'n':
+				client_name = optarg;
+				break;
+			case 't':
+				time_to_run = atoi(optarg);
+				break;
+			case 'd':
+				time_before_run = atoi(optarg);
+				break;
+			case 'c':
+				percent_cpu = atoi(optarg);
+				got_time = 1;
+				break;
+			default:
+				fprintf(stderr, "unknown option %c\n", opt); 
+				usage();
+		}
+	}
+	
+	if (!got_time) {
+		fprintf(stderr, "CPU load not specified ! See usage as following :\n");
+		usage();
+		return -1;
+	}
+	
+	if (time_to_run != 0)
+		printf("Running jack-cpu for %d seconds...\n", time_to_run);
+	
+	/* open a client connection to the JACK server */
+
+	client = jack_client_open (client_name, JackNoStartServer, &status);
+ 	
+	if (client == NULL) {
+		fprintf(stderr, "jack_client_open() failed : is jack server running ?\n");
+		exit(1);
+	}
+    
+    cur_buffer_size = jack_get_buffer_size(client);
+	printf("engine buffer size = %d \n", cur_buffer_size);
+    printf("engine sample rate: %d Hz\n", jack_get_sample_rate(client));
+	idle_time = (jack_nframes_t) (cur_buffer_size * percent_cpu / 100);
+	printf("CPU load applies as %d sample delay.\n", idle_time);
+	
+	/* tell the JACK server to call `process()' whenever
+	   there is work to be done.
+	*/
+
+	jack_set_process_callback(client, process, 0);
+
+	/* tell the JACK server to call `jack_shutdown()' if
+	   it ever shuts down, either entirely, or if it
+	   just decides to stop calling us.
+	*/
+
+	jack_on_shutdown(client, jack_shutdown, 0);
+
+	/* create two ports */
+
+	input_port = jack_port_register (client, "input", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+	output_port = jack_port_register (client, "output", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+	printf("registering ports...\n");
+	if ((input_port == NULL) || (output_port == NULL)) {
+		fprintf(stderr, "no more JACK ports available\n");
+		exit(1);
+	}
+	
+	if (jack_set_buffer_size_callback(client, update_buffer_size, 0) != 0) {
+		printf("Error when calling buffer_size_callback !");
+		return -1;
+	}
+	
+	/* Tell the JACK server that we are ready to roll.  Our
+	 * process() callback will start running now. */
+	
+	printf("Activating as jackd client...\n");
+	if (jack_activate(client)) {
+		fprintf(stderr, "cannot activate client");
+		exit(1);
+	}
+
+	/* Connect the ports.  You can't do this before the client is
+	 * activated, because we can't make connections to clients
+	 * that aren't running.  Note the confusing (but necessary)
+	 * orientation of the driver backend ports: playback ports are
+	 * "input" to the backend, and capture ports are "output" from
+	 * it.
+	 */
+
+	ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
+	if (ports == NULL) {
+		fprintf(stderr, "no physical capture ports\n");
+		exit (1);
+	}
+
+	if (jack_connect(client, ports[0], jack_port_name(input_port))) {
+		fprintf (stderr, "cannot connect input ports\n");
+	}
+	free(ports);
+	
+	ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
+	if (ports == NULL) {
+		fprintf(stderr, "no physical playback ports\n");
+		exit(1);
+	}
+
+	if (jack_connect(client, jack_port_name (output_port), ports[0])) {
+		fprintf(stderr, "cannot connect output ports\n");
+	}
+	free(ports);
+	
+	if (time_before_run == 0) {
+		client_state = Run;
+		printf("Activating cpu load...\n");
+	}
+		
+	if (time_to_run !=0) 
+		time_before_exit = time_to_run + time_before_run;
+	
+	while (client_state != Exit) {
+		if ((time_before_run > 0) && (client_state == Init))
+			time_before_run--;
+		sleep(1);
+		if ((time_before_run < 1) && (client_state != Run)) {
+			client_state = Run;
+			printf("Activating cpu load...\n");
+		}
+		if (time_to_run != 0)
+			time_before_exit--;
+		if (time_before_exit < 1)
+			client_state = Exit; 
+	}
+	jack_client_close(client);
+	printf("Exiting after a %d seconds run.\n", time_to_run);
+	exit(0);
+}
diff --git a/tests/external_metro.cpp b/tests/external_metro.cpp
new file mode 100644
index 0000000..25600eb
--- /dev/null
+++ b/tests/external_metro.cpp
@@ -0,0 +1,204 @@
+/*
+ Copyright (C) 2002 Anthony Van Groningen
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "external_metro.h"
+#include <stdio.h>
+
+typedef jack_default_audio_sample_t sample_t;
+
+const double PI = 3.14;
+
+static void JackSleep(int sec)
+{
+	#ifdef WIN32
+		Sleep(sec * 1000);
+	#else
+		sleep(sec);
+	#endif
+}
+
+int ExternalMetro::process_audio (jack_nframes_t nframes, void* arg)
+{
+    ExternalMetro* metro = (ExternalMetro*)arg;
+    sample_t *buffer = (sample_t *) jack_port_get_buffer (metro->output_port, nframes);
+    jack_nframes_t frames_left = nframes;
+
+    while (metro->wave_length - metro->offset < frames_left) {
+        memcpy (buffer + (nframes - frames_left), metro->wave + metro->offset, sizeof (sample_t) * (metro->wave_length - metro->offset));
+        frames_left -= metro->wave_length - metro->offset;
+        metro->offset = 0;
+    }
+    if (frames_left > 0) {
+        memcpy (buffer + (nframes - frames_left), metro->wave + metro->offset, sizeof (sample_t) * frames_left);
+        metro->offset += frames_left;
+    }
+
+    return 0;
+}
+
+void ExternalMetro::shutdown (void* arg)
+{
+    printf("shutdown called..\n");
+}
+
+ExternalMetro::ExternalMetro(int freq, double max_amp, int dur_arg, int bpm, const char* client_name)
+{
+    sample_t scale;
+    int i, attack_length, decay_length;
+    double *amp;
+    int attack_percent = 1, decay_percent = 10;
+    const char *bpm_string = "bpm";
+    jack_options_t options = JackNullOption;
+    jack_status_t status;
+    offset = 0;
+
+    /* Initial Jack setup, get sample rate */
+    if ((client = jack_client_open (client_name, options, &status)) == 0) {
+        fprintf (stderr, "jack server not running?\n");
+        throw -1;
+    }
+
+    jack_set_process_callback (client, process_audio, this);
+    jack_on_shutdown (client, shutdown, this);
+    output_port = jack_port_register (client, bpm_string, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+    input_port = jack_port_register (client, "metro_in", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+
+    sr = jack_get_sample_rate (client);
+
+    /* setup wave table parameters */
+    wave_length = 60 * sr / bpm;
+    tone_length = sr * dur_arg / 1000;
+    attack_length = tone_length * attack_percent / 100;
+    decay_length = tone_length * decay_percent / 100;
+    scale = 2 * PI * freq / sr;
+
+    if (tone_length >= wave_length) {
+        /*
+        fprintf (stderr, "invalid duration (tone length = %" PRIu32
+        	 ", wave length = %" PRIu32 "\n", tone_length,
+        	 wave_length);
+        */
+        return ;
+    }
+    if (attack_length + decay_length > (int)tone_length) {
+        fprintf (stderr, "invalid attack/decay\n");
+        return ;
+    }
+
+    /* Build the wave table */
+    wave = (sample_t *) malloc (wave_length * sizeof(sample_t));
+    amp = (double *) malloc (tone_length * sizeof(double));
+
+    for (i = 0; i < attack_length; i++) {
+        amp[i] = max_amp * i / ((double) attack_length);
+    }
+    for (i = attack_length; i < (int) tone_length - decay_length; i++) {
+        amp[i] = max_amp;
+    }
+    for (i = (int)tone_length - decay_length; i < (int)tone_length; i++) {
+        amp[i] = - max_amp * (i - (double) tone_length) / ((double) decay_length);
+    }
+    for (i = 0; i < (int) tone_length; i++) {
+        wave[i] = amp[i] * sin (scale * i);
+    }
+    for (i = tone_length; i < (int) wave_length; i++) {
+        wave[i] = 0;
+    }
+
+    if (jack_activate (client)) {
+        fprintf (stderr, "cannot activate client");
+    }
+}
+
+ExternalMetro::~ExternalMetro()
+{
+    jack_deactivate(client);
+    jack_port_unregister(client, input_port);
+    jack_port_unregister(client, output_port);
+    jack_client_close(client);
+}
+
+int main (int argc, char *argv[])
+{
+    ExternalMetro* client1 = NULL;
+    ExternalMetro* client2 = NULL;
+    ExternalMetro* client3 = NULL;
+    ExternalMetro* client4 = NULL;
+    ExternalMetro* client5 = NULL;
+
+    printf("Testing multiple Jack clients in one process: open 5 metro clients...\n");
+    client1 = new ExternalMetro(1200, 0.4, 20, 80, "t1");
+    client2 = new ExternalMetro(600, 0.4, 20, 150, "t2");
+    client3 = new ExternalMetro(1000, 0.4, 20, 110, "t3");
+	client4 = new ExternalMetro(400, 0.4, 20, 200, "t4");
+    client5 = new ExternalMetro(1500, 0.4, 20, 150, "t5");
+
+    printf("Type 'c' to close all clients and go to next test...\n");
+    while ((getchar() != 'c')) {
+        JackSleep(1);
+    };
+
+    delete client1;
+    delete client2;
+    delete client3;
+    delete client4;
+    delete client5;
+
+    printf("Testing quitting the server while a client is running...\n");
+    client1 = new ExternalMetro(1200, 0.4, 20, 80, "t1");
+
+    printf("Now quit the server, shutdown callback should be called...\n");
+    printf("Type 'c' to move on...\n");
+    while ((getchar() != 'c')) {
+        JackSleep(1);
+    };
+
+    printf("Closing client...\n");
+    delete client1;
+
+    printf("Now start the server again...\n");
+    printf("Type 'c' to move on...\n");
+    while ((getchar() != 'c')) {
+        JackSleep(1);
+    };
+
+    printf("Opening a new client....\n");
+    client1 = new ExternalMetro(1200, 0.4, 20, 80, "t1");
+    
+    printf("Now quit the server, shutdown callback should be called...\n");
+    printf("Type 'c' to move on...\n");
+    while ((getchar() != 'c')) {
+        JackSleep(1);
+    };
+
+    printf("Simulating client not correctly closed...\n");
+    
+    printf("Opening a new client....\n"); 
+    try {
+        client1 = new ExternalMetro(1200, 0.4, 20, 80, "t1");
+    } catch (int num) {
+        printf("Cannot open a new client since old one was not closed correctly... OK\n"); 
+    }
+
+    printf("Type 'q' to quit...\n");
+    while ((getchar() != 'q')) {
+        JackSleep(1);
+    };
+    delete client1;
+    return 0;
+}
diff --git a/tests/external_metro.h b/tests/external_metro.h
new file mode 100644
index 0000000..e0bcc18
--- /dev/null
+++ b/tests/external_metro.h
@@ -0,0 +1,69 @@
+/*
+ Copyright (C) 2001 Paul Davis
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software 
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ $Id: external_metro.h,v 1.3.2.1 2006/06/20 14:44:00 letz Exp $
+*/
+
+#ifndef __external_metro__
+#define __external_metro__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <math.h>
+#include <getopt.h>
+#include <string.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+    typedef jack_default_audio_sample_t sample_t;
+
+    /*!
+    \brief A class to test external clients
+    */
+
+    struct ExternalMetro {
+
+        jack_client_t *client;
+        jack_port_t *input_port;
+        jack_port_t *output_port;
+
+        unsigned long sr;
+        int freq;
+        int bpm;
+        jack_nframes_t tone_length, wave_length;
+        sample_t *wave;
+        long offset ;
+
+        ExternalMetro(int freq, double max_amp, int dur_arg, int bpm, const char* client_name = "metro");
+        virtual ~ExternalMetro();
+
+        static int process_audio (jack_nframes_t nframes, void* arg);
+        static void shutdown (void* arg);
+    };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tests/jdelay.cpp b/tests/jdelay.cpp
new file mode 100644
index 0000000..709fd7e
--- /dev/null
+++ b/tests/jdelay.cpp
@@ -0,0 +1,227 @@
+/*
+    Copyright (C) 2003-2008 Fons Adriaensen <fons at kokkinizita.net>
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+// --------------------------------------------------------------------------------
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <unistd.h>
+#include <jack/jack.h>
+
+class Freq
+{
+public:
+
+    int   p;
+    int   f;
+    float a;
+    float xa;
+    float ya;
+    float xf;
+    float yf;
+};
+
+class MTDM
+{
+public:
+
+    MTDM (void);
+    int process (size_t len, float *inp, float *out);
+    int resolve (void);
+    void invert (void) { _inv ^= 1; }
+    int    inv (void) { return _inv; }
+    double del (void) { return _del; }
+    double err (void) { return _err; }
+
+private:
+
+    double  _del;
+    double  _err;
+    int     _cnt;
+    int     _inv;
+    Freq    _freq [5];
+};
+
+MTDM::MTDM (void) : _cnt (0), _inv (0)
+{
+    int   i;
+    Freq  *F;
+
+    _freq [0].f = 4096;
+    _freq [1].f =  512;
+    _freq [2].f = 1088;
+    _freq [3].f = 1544;
+    _freq [4].f = 2049;
+
+    _freq [0].a = 0.2f;
+    _freq [1].a = 0.1f;
+    _freq [2].a = 0.1f;
+    _freq [3].a = 0.1f;
+    _freq [4].a = 0.1f;
+
+    for (i = 0, F = _freq; i < 5; i++, F++)
+    {
+	F->p = 128;
+	F->xa = F->ya = 0.0f;
+	F->xf = F->yf = 0.0f;
+    }
+}
+
+int MTDM::process (size_t len, float *ip, float *op)
+{
+    int    i;
+    float  vip, vop, a, c, s;
+    Freq   *F;
+
+    while (len--)
+    {
+        vop = 0.0f;
+	vip = *ip++;
+	for (i = 0, F = _freq; i < 5; i++, F++)
+	{
+	    a = 2 * (float) M_PI * (F->p & 65535) / 65536.0; 
+	    F->p += F->f;
+	    c =  cosf (a); 
+	    s = -sinf (a); 
+	    vop += F->a * s;
+	    F->xa += s * vip;
+	    F->ya += c * vip;
+	} 
+	*op++ = vop;
+	if (++_cnt == 16)
+	{
+	    for (i = 0, F = _freq; i < 5; i++, F++)
+	    {
+		F->xf += 1e-3f * (F->xa - F->xf + 1e-20);
+		F->yf += 1e-3f * (F->ya - F->yf + 1e-20);
+		F->xa = F->ya = 0.0f;
+	    }
+            _cnt = 0;
+	}
+    }
+
+    return 0;
+}
+
+int MTDM::resolve (void)
+{
+    int     i, k, m;
+    double  d, e, f0, p;
+    Freq    *F = _freq;
+
+    if (hypot (F->xf, F->yf) < 0.01) return -1;
+    d = atan2 (F->yf, F->xf) / (2 * M_PI);
+    if (_inv) d += 0.5f;
+    if (d > 0.5f) d -= 1.0f;
+    f0 = _freq [0].f;
+    m = 1;
+    _err = 0.0;
+    for (i = 0; i < 4; i++)
+    {
+	F++;
+	p = atan2 (F->yf, F->xf) / (2 * M_PI) - d * F->f / f0;
+        if (_inv) p += 0.5f;
+	p -= floor (p);
+	p *= 8;
+	k = (int)(floor (p + 0.5));
+	e = fabs (p - k);
+        if (e > _err) _err = e;
+        if (e > 0.4) return 1; 
+	d += m * (k & 7);
+	m *= 8;
+    }  
+    _del = 16 * d;
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------------
+
+static MTDM            mtdm;
+static jack_client_t  *jack_handle;
+static jack_port_t    *jack_capt;
+static jack_port_t    *jack_play;
+
+int jack_callback (jack_nframes_t nframes, void *arg)
+{
+    float *ip, *op;
+
+    ip = (float *)(jack_port_get_buffer (jack_capt, nframes));
+    op = (float *)(jack_port_get_buffer (jack_play, nframes));
+    mtdm.process (nframes, ip, op);
+    return 0;
+}
+
+int main (int ac, char *av [])
+{
+    float          t;
+    jack_status_t  s;
+
+    jack_handle = jack_client_open ("jack_delay", JackNoStartServer, &s);
+    if (jack_handle == 0)
+    {
+        fprintf (stderr, "Can't connect to Jack, is the server running ?\n");
+        exit (1);
+    }
+
+    jack_set_process_callback (jack_handle, jack_callback, 0);
+
+    jack_capt = jack_port_register (jack_handle, "in",  JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+    jack_play = jack_port_register (jack_handle, "out", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+    printf ("capture latency  = %d\n",
+            jack_port_get_latency (jack_port_by_name (jack_handle, "system:capture_1")));
+    printf ("playback_latency = %d\n",
+            jack_port_get_latency (jack_port_by_name (jack_handle, "system:playback_1")));
+
+    t = 1000.0f / jack_get_sample_rate (jack_handle);
+
+    if (jack_activate (jack_handle))
+    {
+        fprintf(stderr, "Can't activate Jack");
+        return 1;
+    }
+
+    while (1)
+    {
+ 
+    #ifdef WIN32 
+        Sleep (250); 
+    #else 
+        usleep (250000); 
+ 	#endif        
+        if (mtdm.resolve () < 0) printf ("Signal below threshold...\n");
+        else 
+        {
+            if (mtdm.err () > 0.3) 
+            {
+                mtdm.invert ();
+                mtdm.resolve ();
+            }
+            printf ("%10.3lf frames %10.3lf ms", mtdm.del (), mtdm.del () * t);
+            if (mtdm.err () > 0.2) printf (" ??");
+                if (mtdm.inv ()) printf (" Inv");
+            printf ("\n");
+        }
+    }
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------------
diff --git a/tests/test.cpp b/tests/test.cpp
new file mode 100644
index 0000000..4e025c0
--- /dev/null
+++ b/tests/test.cpp
@@ -0,0 +1,1993 @@
+/*
+  Copyright (C) 2005 Samuel TRACOL for GRAME
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file jack_test.c
+ *
+ * @brief This client test the jack API.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <getopt.h>
+#include <math.h>
+#include <assert.h>
+#include <stdarg.h>
+#include <jack/jack.h>
+#include <jack/transport.h>
+
+
+#if defined(WIN32) && !defined(M_PI)
+#define M_PI 3.151592653
+#endif
+
+#ifdef WIN32
+#define jack_sleep(val) Sleep((val))
+#else
+#define jack_sleep(val) usleep((val) * 1000)
+#endif
+
+typedef struct
+{
+    jack_nframes_t ft;		// running counter frame time
+    jack_nframes_t fcs;		// from sycle start...
+    jack_nframes_t lft;		// last frame time...
+}
+FrameTimeCollector;
+
+FILE *file;
+FrameTimeCollector* framecollect;
+FrameTimeCollector perpetualcollect;
+FrameTimeCollector lastperpetualcollect;
+int frames_collected = 0;
+
+// ports
+jack_port_t *output_port1;
+jack_port_t *output_port1b;
+jack_port_t *input_port2;
+jack_port_t *output_port2;
+jack_port_t *input_port1;
+
+// clients
+jack_client_t *client1;
+jack_client_t *client2;
+const char *client_name1;
+const char *client_name2;
+
+unsigned long sr;	// sample rate
+// for time -t option
+int time_to_run = 0;
+int time_before_exit = 1;
+// standard error count
+int t_error = 0;
+int reorder = 0;	// graph reorder callback
+int RT = 0;			// is real time or not...
+int FW = 0;			// freewheel mode
+int init_clbk = 0;	// init callback
+int port_rename_clbk = 0;	// portrename callback
+int i, j, k = 0;
+int port_callback_reg = 0;
+jack_nframes_t cur_buffer_size, old_buffer_size, cur_pos;
+int activated = 0;
+int count1, count2 = 0;			// for freewheel
+int xrun = 0;
+int have_xrun = 0;				// msg to tell the process1 function to write a special thing in the frametime file.
+int process1_activated = -1;	// to control processing...
+int process2_activated = -1;	// to control processing...
+unsigned long int index1 = 0;
+unsigned long int index2 = 0;
+jack_default_audio_sample_t *signal1;	// signal source d'emission
+jack_default_audio_sample_t *signal2;	// tableau de reception
+jack_transport_state_t ts;
+jack_position_t pos;
+jack_position_t request_pos;
+int silent_error = 0;	// jack silent mode
+int verbose_mode = 0;
+int transport_mode = 1;
+jack_nframes_t input_ext_latency = 0;	// test latency for PHY devices
+jack_nframes_t output_ext_latency = 0;	// test latency for PHY devices
+
+int sync_called = 0;
+int starting_state = 1;
+
+int linecount = 0;		// line counter for log file of sampleframe counter --> for graph function.
+int linebuf = 0;		// reminders for graph analysis
+int linetransport = 0;
+int linefw = 0;
+int lineports = 0;
+int linecl2 = 0;
+
+int client_register = 0;
+
+/**
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+
+							Callbacks & basics functions
+
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*/
+
+void usage()
+{
+    fprintf (stderr, "\n\n"
+             "usage: jack_test \n"
+             "              [ --time OR -t time_to_run (in seconds) ]\n"
+             "              [ --quiet OR -q (quiet mode : without jack server errors) ]\n"
+             "              [ --verbose OR -v (verbose mode : no details on tests done. Only main results & errors) ]\n"
+             "              [ --transport OR -k (Do not test transport functions.) ]\n"
+             "                --realtime OR -R (jack is in rt mode)\n\n\n"
+            );
+    exit(1);
+}
+
+void Log(const char *fmt, ...)
+{
+    if (verbose_mode) {
+        va_list ap;
+        va_start(ap, fmt);
+        vfprintf(stderr, fmt, ap);
+        va_end(ap);
+    }
+}
+
+void Collect(FrameTimeCollector* TheFrame)
+{
+    TheFrame->lft = jack_last_frame_time(client1);
+    TheFrame->ft = jack_frame_time(client1);
+    TheFrame->fcs = jack_frames_since_cycle_start(client1);
+}
+
+void Jack_Thread_Init_Callback(void *arg)
+{
+    Log("Init callback has been successfully called. (msg from callback)\n");
+    init_clbk = 1;
+}
+
+void Jack_Freewheel_Callback(int starting, void *arg)
+{
+    Log("Freewhell callback has been successfully called with value %i. (msg from callback)\n", starting);
+    FW = starting;
+}
+
+void Jack_Client_Registration_Callback(const char* name, int val, void *arg)
+{
+    Log("Client registration callback name = %s has been successfully called with value %i. (msg from callback)\n", name, val);
+	if (val)
+		client_register++;
+	else
+		client_register--;
+}
+
+int Jack_Port_Rename_Callback(jack_port_id_t port, const char* old_name, const char* new_name, void *arg)
+{
+     Log("Rename callback has been successfully called with old_name '%s' and new_name '%s'. (msg from callback)\n", old_name, new_name);
+     port_rename_clbk = 1;
+     return 0;
+}
+
+int Jack_Update_Buffer_Size(jack_nframes_t nframes, void *arg)
+{
+    cur_buffer_size = jack_get_buffer_size(client1);
+    Log("Buffer size = %d (msg from callback)\n", cur_buffer_size);
+    return 0;
+}
+
+int Jack_XRun_Callback(void *arg)
+{
+    xrun++;
+    have_xrun = 1;
+    Log("Xrun has been detected ! (msg from callback)\n");
+    return 0;
+}
+
+int Jack_Graph_Order_Callback(void *arg)
+{
+    reorder++;
+    return 0;
+}
+
+int Jack_Sample_Rate_Callback(jack_nframes_t nframes, void *arg)
+{
+    Log("Sample rate : %i.\n", nframes);
+    return 0;
+}
+
+void Jack_Error_Callback(const char *msg)
+{
+    if (silent_error == 0) {
+        fprintf(stderr, "error : %s (msg from callback)\n", msg);
+    }
+}
+
+void jack_shutdown(void *arg)
+{
+    printf("Jack_test has been kicked out by jackd !\n");
+    exit(1);
+}
+
+void jack_info_shutdown(jack_status_t code, const char* reason, void *arg)
+{
+    printf("JACK server failure : %s\n", reason);
+    exit(1);
+}
+
+void Jack_Port_Register(jack_port_id_t port, int mode, void *arg)
+{
+    port_callback_reg++;
+}
+
+void Jack_Port_Connect(jack_port_id_t a, jack_port_id_t b, int connect, void* arg)
+{
+	Log("PortConnect src = %ld dst = %ld  onoff = %ld (msg from callback)\n", a, b, connect);
+}
+
+int Jack_Sync_Callback(jack_transport_state_t state, jack_position_t *pos, void *arg)
+{
+    int res = 0;
+
+    switch (state) {
+
+        case JackTransportStarting:
+            sync_called++;
+            if (starting_state == 0) {
+                Log("sync callback : Releasing status : now ready...\n");
+                res = 1;
+            } else {
+                if (sync_called == 1) {
+                    Log("sync callback : Holding status...\n");
+                }
+                res = 0;
+            }
+            break;
+
+        case JackTransportStopped:
+            Log("sync callback : JackTransportStopped...\n");
+            res = 0;
+            break;
+
+        default:
+            res = 0;
+            break;
+    }
+
+    return res;
+}
+
+
+/**
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+
+							processing functions
+
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+ * Proccess1 is for client1
+ * 4 modes, activated with process1_activated
+ *
+ * -1 : idle mode
+ *  0 : write zeros to output 1
+ *  1 : write continuously signal1 (sinusoidal test signal) to output1
+ *  3 : mode for summation test. While record (done by process2) is not running, write signal1 to both out1 & out1b.
+ *      when record begin (index2 > 0), write signal1 in phase opposition to out1 & out2
+ *  5 : Frames Time checking mode : write the array containing the three values of frame_time, frames cycles start and
+ *      last frame time during 150 cycles.
+ */
+
+int process1(jack_nframes_t nframes, void *arg)
+{
+    if (FW == 0) {
+        Collect(&perpetualcollect);
+        if (have_xrun) {
+            fprintf(file, "%i	%i\n", (perpetualcollect.ft - lastperpetualcollect.ft), (2*cur_buffer_size));
+            have_xrun = 0;
+        } else {
+            fprintf(file, "%i	0\n", (perpetualcollect.ft - lastperpetualcollect.ft));
+        }
+        linecount++;
+        lastperpetualcollect.ft = perpetualcollect.ft;
+    }
+
+    jack_default_audio_sample_t *out1;
+    jack_default_audio_sample_t *out1b;
+    activated++; // counter of callback activation
+    if (process1_activated == 1) {
+        out1 = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port1, nframes);
+        for (jack_nframes_t p = 0; p < nframes; p++) {
+            out1[p] = signal1[index1];
+            index1++;
+            if (index1 == 48000)
+                index1 = 0;
+        }
+    }
+    if (process1_activated == 3) {
+        out1 = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port1, nframes);
+        out1b = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port1b, nframes);
+        for (jack_nframes_t p = 0; p < nframes; p++) {
+            out1[p] = signal1[index1];
+            if (index2 != 0) {
+                out1b[p] = ( -1 * signal1[index1]);
+            } else {
+                out1b[p] = signal1[index1];
+            }
+            index1++;
+            if (index1 == 48000)
+                index1 = 0;
+        }
+    }
+    if (process1_activated == 0) {
+        out1 = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port1, nframes);
+        memset (out1, 0, sizeof (jack_default_audio_sample_t) * nframes); //�crit des z�ros en sortie...
+    }
+    if (process1_activated == 5) {
+        Collect(&framecollect[frames_collected]);
+        frames_collected++;
+        if (frames_collected > 798) {
+            process1_activated = -1;
+        }
+    }
+    return 0;
+}
+
+/**
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+ * Proccess2 is for client2
+ * 3 modes, activated with process1_activated
+ *
+ * -1 : idle mode
+ *  0 : idle mode
+ *  1 : record in2 into signal2.(for first transmit test)
+ *  2 : record in2 into signal2 while send signal1 in out2. used dor Tie data test.
+ *  3 : record in2 into sigal2 for summation data test.
+ * In records modes, at the end of the record (signal2 is full), it stop the test, setting both activation states to -1.
+ */
+
+int process2(jack_nframes_t nframes, void *arg)
+{
+    jack_default_audio_sample_t *out2;
+    jack_default_audio_sample_t *in2;
+
+    if (process2_activated == 1) { // Reception du process1 pour comparer les donnees
+        in2 = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port2, nframes);
+        for (unsigned int p = 0; p < nframes; p++) {
+            signal2[index2] = in2[p];
+            if (index2 == 95999) {
+                process2_activated = 0;
+                process1_activated = 0;
+                //index2 = 0;
+            } else {
+                index2++;
+            }
+        }
+    }
+
+    if (process2_activated == 2) { // envoie de signal1 pour test tie mode et le r�cup�re direct + latence de la boucle jack...
+        out2 = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port2, nframes);
+        in2 = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port2, nframes);
+
+        for (unsigned int p = 0; p < nframes; p++) {
+            out2[p] = signal1[index1];
+            index1++;
+            if (index1 == 48000)
+                index1 = 0;
+            signal2[index2] = in2[p];
+            if (index2 == 95999) {
+                process2_activated = -1;
+                //index2 = 0;
+            } else {
+                index2++;
+            }
+        }
+    }
+
+    if (process2_activated == 3) { // envoie de -signal1 pour sommation en oppo de phase par jack
+        in2 = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port2, nframes);
+
+        for (unsigned int p = 0; p < nframes;p++) {
+            signal2[index2] = in2[p];
+            if (index2 == 95999) {
+                process2_activated = 0;
+                process1_activated = 0;
+                //index2 = 0;
+            } else {
+                index2++;
+            }
+        }
+    }
+
+    return 0;
+}
+
+// Alternate thread model
+static int _process (jack_nframes_t nframes)
+{
+	jack_default_audio_sample_t *in, *out;
+	in = (jack_default_audio_sample_t *)jack_port_get_buffer (input_port1, nframes);
+	out = (jack_default_audio_sample_t *)jack_port_get_buffer (output_port1, nframes);
+	memcpy (out, in,
+		sizeof (jack_default_audio_sample_t) * nframes);
+	return 0;
+}
+
+static void* jack_thread(void *arg)
+{
+	jack_client_t* client = (jack_client_t*) arg;
+	jack_nframes_t last_thread_time = jack_frame_time(client);
+
+	while (1) {
+		jack_nframes_t frames = jack_cycle_wait (client);
+		jack_nframes_t current_thread_time = jack_frame_time(client);
+		jack_nframes_t delta_time = current_thread_time - last_thread_time;
+		Log("jack_thread : delta_time = %ld\n", delta_time);
+		int status = _process(frames);
+		last_thread_time = current_thread_time;
+		jack_cycle_signal (client, status);
+	}
+
+	return 0;
+}
+
+// To test callback exiting
+int process3(jack_nframes_t nframes, void *arg)
+{
+	static int process3_call = 0;
+
+	if (process3_call++ > 10) {
+		Log("process3 callback : exiting...\n");
+		return -1;
+	} else {
+		Log("calling process3 callback : process3_call = %ld\n", process3_call);
+		return 0;
+	}
+}
+
+int process4(jack_nframes_t nframes, void *arg)
+{
+	jack_client_t* client = (jack_client_t*) arg;
+
+	static jack_nframes_t last_time = jack_frame_time(client);
+	static jack_nframes_t tolerance = (jack_nframes_t)(cur_buffer_size * 0.1f);
+
+	jack_nframes_t cur_time = jack_frame_time(client);
+	jack_nframes_t delta_time = cur_time - last_time;
+
+	Log("calling process4 callback : jack_frame_time = %ld delta_time = %ld\n", cur_time, delta_time);
+	if (delta_time > 0  && (unsigned int)abs(delta_time - cur_buffer_size) > tolerance) {
+		printf("!!! ERROR !!! jack_frame_time seems to return incorrect values cur_buffer_size = %d, delta_time = %d\n", cur_buffer_size, delta_time);
+	}
+
+	last_time = cur_time;
+	return 0;
+}
+
+static void display_transport_state()
+{
+    jack_transport_state_t ts;
+    jack_position_t pos;
+
+    ts = jack_transport_query(client2, &pos);
+    switch (ts) {
+        case JackTransportStopped:
+            Log("Transport is stopped...\n");
+            break;
+        case JackTransportRolling:
+            Log("Transport is rolling...\n");
+            break;
+        case JackTransportLooping:
+            Log("Transport is looping...\n");
+            break;
+        case JackTransportStarting:
+            Log("Transport is starting...\n");
+            break;
+        case JackTransportNetStarting:
+            Log("Transport is starting with network sync...\n");
+            break;
+    }
+}
+
+/**
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+							MAIN FUNCTION
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+*/
+int main (int argc, char *argv[])
+{
+    const char **inports; // array of PHY input/output
+    const char **outports; // array of PHY input/outputs
+    const char *server_name = NULL;
+	const char **connexions1;
+    const char **connexions2;
+    jack_status_t status;
+    char portname[128] = "port";
+    char filename[128] = "framefile.ext";
+    const char *nullportname = "";
+    int option_index;
+    int opt;
+    int a = 0;			// working number for in/out port (PHY)...
+    int test_link = 0;	// for testing the "overconnect" function
+    int flag;			// flag for ports...
+    int is_mine = 0;	// to test jack_port_is_mine function...
+    const char *options = "kRnqvt:";
+    float ratio;		// for speed calculation in freewheel mode
+    jack_options_t jack_options = JackNullOption;
+	struct option long_options[] = {
+                                       {"realtime", 0, 0, 'R'},
+                                       {"non-realtime", 0, 0, 'n'},
+                                       {"time", 0, 0, 't'},
+                                       {"quiet", 0, 0, 'q'},
+                                       {"verbose", 0, 0, 'v'},
+                                       {"transport", 0, 0, 'k'},
+                                       {0, 0, 0, 0}
+                                   };
+
+    client_name1 = "jack_test";
+    time_to_run = 1;
+    while ((opt = getopt_long (argc, argv, options, long_options, &option_index)) != EOF) {
+        switch (opt) {
+            case 'k':
+                transport_mode = 0;
+                break;
+            case 'q':
+                silent_error = 1;
+                break;
+            case 'v':
+                verbose_mode = 1;
+                printf("Verbose mode is activated...\n");
+                break;
+            case 't':
+                time_to_run = atoi(optarg);
+                break;
+            case 'R':
+                RT = 1;
+                break;
+            default:
+                fprintf (stderr, "unknown option %c\n", opt);
+                usage ();
+        }
+    }
+
+    if (RT) {
+        printf("Jack server is said being in realtime mode...\n");
+    } else {
+        printf("Jack server is said being in non-realtime mode...\n");
+    }
+    /**
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    						init signal data for test
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    */
+    framecollect = (FrameTimeCollector *) malloc(800 * sizeof(FrameTimeCollector));
+
+    signal1 = (jack_default_audio_sample_t *) malloc(48000 * sizeof(jack_default_audio_sample_t));
+    signal2 = (jack_default_audio_sample_t *) malloc(96000 * sizeof(jack_default_audio_sample_t));
+    signal1[0] = 0;
+    int p;
+    for (p = 1; p < 48000;p++) {
+        signal1[p] = (float)(sin((p * 2 * M_PI * 1000 ) / 48000));
+    }
+    for (p = 0; p < 95999;p++) {
+        signal2[p] = 0.0 ;
+    }
+    index1 = 0;
+    index2 = 0;
+    /**
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    						begin test
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    */
+    printf("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");
+    printf("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");
+    printf("*-*-*-*-*-*-*-*-*-*-*-*-*-* Start jack server stress test  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");
+    printf("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");
+    printf("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");
+
+    /**
+     * Register a client...
+     *
+     */
+	Log("Register a client using jack_client_open()...\n");
+    client1 = jack_client_open(client_name1, jack_options, &status, server_name);
+    if (client1 == NULL) {
+        fprintf (stderr, "jack_client_open() failed, "
+                 "status = 0x%2.0x\n", status);
+        if (status & JackServerFailed) {
+            fprintf(stderr, "Unable to connect to JACK server\n");
+        }
+        exit (1);
+    }
+    if (status & JackServerStarted) {
+        fprintf(stderr, "JACK server started\n");
+    }
+
+    /**
+     * try to register another one with the same name...
+     *
+     */
+    Log("trying to register a new jackd client with name %s using jack_client_new()...\n", client_name1);
+    client2 = jack_client_new(client_name1);
+    if (client2 == NULL) {
+        Log ("valid : a second client with the same name cannot be registered\n");
+    } else {
+        printf("!!! ERROR !!! Jackd server has accepted multiples client with the same name !\n");
+        jack_client_close(client2);
+    }
+
+	/**
+     * try to register another one with the same name using jack_client_open ==> since JackUseExactName is not used, an new client should be opened...
+     *
+     */
+    Log("trying to register a new jackd client with name %s using jack_client_open()...\n", client_name1);
+    client2 = jack_client_open(client_name1, jack_options, &status, server_name);
+    if (client2 != NULL) {
+        Log ("valid : a second client with the same name can be registered (client automatic renaming)\n");
+		jack_client_close(client2);
+    } else {
+        printf("!!! ERROR !!! Jackd server automatic renaming feature does not work!\n");
+    }
+
+    /**
+     * testing client name...
+     * Verify that the name sended at registration and the one returned by jack server is the same...
+     *
+     */
+    Log("Testing name...");
+    client_name2 = jack_get_client_name(client1);
+    if (strcmp(client_name1, client_name2) == 0)
+        Log(" ok\n");
+    else
+        printf("\n!!! ERROR !!! name returned different from the one given : %s\n", client_name2);
+
+    /**
+     * Test RT mode...
+     * verify if the real time mode returned by jack match the optional argument defined when launching jack_test*/
+    if (jack_is_realtime(client1) == RT)
+        Log("Jackd is in realtime mode (RT = %i).\n", RT);
+    else
+        printf("!!! ERROR !!! Jackd is in a non-expected realtime mode (RT = %i).\n", RT);
+
+    /**
+     * Register all callbacks...
+     *
+     */
+    if (jack_set_thread_init_callback(client1, Jack_Thread_Init_Callback, 0) != 0)
+        printf("!!! ERROR !!! while calling jack_set_thread_init_callback()...\n");
+    if (jack_set_freewheel_callback(client1, Jack_Freewheel_Callback, 0) != 0 )
+        printf("\n!!! ERROR !!! while calling jack_set_freewheel_callback()...\n");
+  
+
+    if (jack_set_process_callback(client1, process1, 0) != 0) {
+        printf("Error when calling jack_set_process_callback() !\n");
+    }
+
+    jack_on_shutdown(client1, jack_shutdown, 0);
+    jack_on_info_shutdown(client1, jack_info_shutdown, 0);
+
+    if (jack_set_buffer_size_callback(client1, Jack_Update_Buffer_Size, 0) != 0) {
+        printf("Error when calling buffer_size_callback !\n");
+    }
+
+    if (jack_set_graph_order_callback(client1, Jack_Graph_Order_Callback, 0) != 0) {
+        printf("Error when calling Jack_Graph_Order_Callback() !\n");
+    }
+    
+    if (jack_set_port_rename_callback(client1, Jack_Port_Rename_Callback, 0) != 0 )
+        printf("\n!!! ERROR !!! while calling jack_set_rename_callback()...\n");
+
+    if (jack_set_xrun_callback(client1, Jack_XRun_Callback, 0 ) != 0) {
+        printf("Error when calling jack_set_xrun_callback() !\n");
+    }
+
+    if (jack_set_sample_rate_callback(client1, Jack_Sample_Rate_Callback, 0 ) != 0) {
+        printf("Error when calling Jack_Sample_Rate_Callback() !\n");
+    }
+
+    if (jack_set_port_registration_callback(client1, Jack_Port_Register, 0) != 0) {
+        printf("Error when calling jack_set_port_registration_callback() !\n");
+    }
+
+    if (jack_set_port_connect_callback(client1, Jack_Port_Connect, 0) != 0) {
+        printf("Error when calling jack_set_port_connect_callback() !\n");
+    }
+
+	if (jack_set_client_registration_callback(client1, Jack_Client_Registration_Callback, 0) != 0) {
+		printf("Error when calling jack_set_client_registration_callback() !\n");
+	}
+
+    jack_set_error_function(Jack_Error_Callback);
+
+    /**
+     * Create file for clock "frame time" analysis
+     *
+     */
+    cur_buffer_size = jack_get_buffer_size(client1);
+    sprintf (filename, "framefile-%i.dat", cur_buffer_size);
+    file = fopen(filename, "w");
+    if (file == NULL) {
+        fprintf(stderr, "Erreur dans l'ouverture du fichier log framefile.dat");
+        exit(-1);
+    }
+
+    /**
+     * Try to register a client with a NULL name/zero length name...
+     *
+     */
+    output_port1 = jack_port_register(client1, nullportname,
+                                      JACK_DEFAULT_AUDIO_TYPE,
+                                      JackPortIsOutput, 0);
+    if (output_port1 == NULL) {
+        Log("Can't register a port with a NULL portname... ok.\n");
+    } else {
+        printf("!!! ERROR !!! Can register a port with a NULL portname !\n");
+        jack_port_unregister(client1, output_port1);
+    }
+
+    /**
+     * Register 1 port in order to stress other functions.
+     *
+     */
+    output_port1 = jack_port_register(client1, portname,
+                                      JACK_DEFAULT_AUDIO_TYPE,
+                                      JackPortIsOutput, 0);
+    if (output_port1 == NULL) {
+        printf("!!! ERROR !!! Can't register any port for the client !\n");
+        exit(1);
+    }
+
+   /**
+     * Test port type of the just registered port.
+     *
+     */
+    if (strcmp(jack_port_type(output_port1), JACK_DEFAULT_AUDIO_TYPE) != 0) {
+        printf("!!! ERROR !!! jack_port_type returns an incorrect value!\n");
+	} else {
+		Log("Checking jack_port_type()... ok.\n");
+	}
+
+    /**
+     * Try to register another port with the same name...
+     *
+     */
+    output_port2 = jack_port_register(client1, portname,
+                                      JACK_DEFAULT_AUDIO_TYPE,
+                                      JackPortIsOutput, 0);
+    if (output_port2 == NULL) {
+        Log("Can't register two ports with the same name... ok\n");
+    } else {
+        if (strcmp (jack_port_name(output_port1), jack_port_name(output_port2)) == 0) {
+            printf("!!! ERROR !!! Can register two ports with the same name ! (%px : %s & %px : %s).\n", output_port1, jack_port_name(output_port1), output_port2, jack_port_name(output_port2));
+            jack_port_unregister(client1, output_port2);
+        } else {
+            Log("Can't register two ports with the same name... ok (auto-rename %s into %s).\n", jack_port_name(output_port1), jack_port_name(output_port2));
+            jack_port_unregister(client1, output_port2);
+        }
+    }
+
+    /**
+     * Verify that both port_name and port_short_name return correct results...
+     *
+     */
+    sprintf (portname, "%s:%s", jack_get_client_name(client1), jack_port_short_name(output_port1));
+    if (strcmp(jack_port_name(output_port1), portname) != 0) {
+        printf("!!! ERROR !!! functions jack_port_name and/or jack_short_port_name seems to be invalid !\n");
+        printf("client_name = %s\n short_port_name = %s\n port_name = %s\n", jack_get_client_name(client1), jack_port_short_name(output_port1), jack_port_name(output_port1));
+    }
+
+    /**
+     * Verify the function port_set_name
+     *
+     */
+    if (jack_port_set_name (output_port1, "renamed-port#") == 0 ) {
+        if (strcmp(jack_port_name(output_port1), "renamed-port#") == 0) {
+            printf("!!! ERROR !!! functions jack_port_set_name seems to be invalid !\n");
+            printf("jack_port_name return '%s' whereas 'renamed-port#' was expected...\n", jack_port_name(output_port1));
+        } else {
+            Log("Checking jack_port_set_name()... ok\n");
+            jack_port_set_name (output_port1, "port");
+        }
+    } else {
+        printf("error : port_set_name function can't be tested...\n");
+    }
+
+    port_callback_reg = 0;	// number of port registration received by the callback
+    
+    /**
+     * Activate the client
+     *
+     */
+    if (jack_activate(client1) < 0) {
+        printf ("Fatal error : cannot activate client1\n");
+        exit(1);
+    }
+    
+    /**
+     * Test if portrename callback have been called.
+     *
+     */
+    jack_port_set_name (output_port1, "renamed-port#");
+    jack_sleep(1 * 1000); 
+
+    if (port_rename_clbk == 0)
+        printf("!!! ERROR !!! Jack_Port_Rename_Callback was not called !!.\n");
+        
+        
+    /**
+     * Test if portregistration callback have been called.
+     *
+     */
+     
+    jack_sleep(1 * 1000); 
+
+    if (1 == port_callback_reg) {
+        Log("%i ports have been successfully created, and %i callback reg ports have been received... ok\n", 1, port_callback_reg);
+    } else {
+        printf("!!! ERROR !!! %i ports have been created, and %i callback reg ports have been received !\n", 1, port_callback_reg);
+    }
+ 
+    /**
+     * Test if init callback initThread have been called.
+     *
+     */
+    if (init_clbk == 0)
+        printf("!!! ERROR !!! Jack_Thread_Init_Callback was not called !!.\n");
+
+    jack_sleep(10 * 1000); // test see the clock in the graph at the begining...
+
+    /**
+     * Stress Freewheel mode...
+     * Try to enter freewheel mode. Check the realtime mode de-activation.
+     * Check that the number of call of the process callback is greater than in non-freewheel mode.
+     * Give an approximated speed ratio (number of process call) between the two modes.
+     * Then return in normal mode.
+     */
+    t_error = 0;
+    activated = 0;
+    jack_sleep(1 * 1000);
+    count1 = activated;
+    Log("Testing activation freewheel mode...\n");
+    linefw = linecount; // count for better graph reading with gnuplot
+    jack_set_freewheel(client1, 1);
+    activated = 0;
+    jack_sleep(1 * 1000);
+    count2 = activated;
+    if (jack_is_realtime(client1) == 0) {
+        t_error = 0;
+    } else {
+        printf("\n!!! ERROR !!! RT mode is always activated while freewheel mode is applied !\n");
+        t_error = 1;
+    }
+    if (activated == 0)
+        printf("!!! ERROR !!! Freewheel mode doesn't activate audio callback !!\n");
+
+    jack_set_freewheel(client1, 0);
+    jack_sleep(7 * 1000);
+
+	if (jack_is_realtime(client1) == 1) {}
+    else {
+        printf("\n!!! ERROR !!! freewheel mode fail to reactivate RT mode when exiting !\n");
+        t_error = 1;
+    }
+    if (t_error == 0) {
+        Log("Freewheel mode appears to work well...\n");
+    }
+    if (count1 == 0) {
+        Log("Audio Callback in 'standard' (non-freewheel) mode seems not to be called...\n");
+        Log("Ratio speed would be unavailable...\n");
+    } else {
+        ratio = (float) ((count2 - count1) / count1);
+        Log("Approximative speed ratio of freewheel mode = %f : 1.00\n", ratio);
+    }
+
+    /**
+     * Stress buffer function...
+     * get current buffer size.
+     * Try to apply a new buffer size value ( 2 x the precedent buffer size value)
+     * Then return in previous buffer size mode.
+     *
+     */
+
+    float factor = 0.5f;
+    old_buffer_size = jack_get_buffer_size(client1);
+    Log("Testing BufferSize change & Callback...\n--> Current buffer size : %i.\n", old_buffer_size);
+    linebuf = linecount;
+    if (jack_set_buffer_size(client1, (jack_nframes_t)(old_buffer_size * factor)) < 0) {
+        printf("!!! ERROR !!! jack_set_buffer_size fails !\n");
+    }
+    jack_sleep(1 * 1000);
+    cur_buffer_size = jack_get_buffer_size(client1);
+    if ((old_buffer_size * factor) != cur_buffer_size) {
+        printf("!!! ERROR !!! Buffer size has not been changed !\n");
+        printf("!!! Maybe jack was compiled without the '--enable-resize' flag...\n");
+    } else {
+        Log("jack_set_buffer_size() command successfully applied...\n");
+    }
+    jack_sleep(3 * 1000);
+    jack_set_buffer_size(client1, old_buffer_size);
+    cur_buffer_size = jack_get_buffer_size(client1);
+
+    /**
+     * Test the last regestered port to see if port_is_mine function the right value.
+     * A second test will be performed later.
+     * The result will be printed at the end.
+     *
+     */
+    if (jack_port_is_mine(client1, output_port1)) {
+        is_mine = 1;
+    } else {
+        is_mine = 0;
+    }
+
+    /**
+     * Check that the ID returned by the port_by_name is right.
+     * (it seems there is a problem here in some jack versions).
+     *
+    */
+    if (output_port1 != jack_port_by_name(client1, jack_port_name(output_port1))) {
+        printf("!!! ERROR !!! function jack_port_by_name() return bad value !\n");
+        printf("!!! jack_port_by_name(jack_port_name(_ID_) ) != _ID_returned_at_port_registering ! (%px != %px)\n", jack_port_by_name(client1, jack_port_name(output_port1)), output_port1);
+    } else {
+        Log("Checking jack_port_by_name() return value... ok\n");
+    }
+    if (NULL != jack_port_by_name(client1, jack_port_short_name(output_port1))) {
+        printf("!!! ERROR !!! function jack_port_by_name() return a value (%px) while name is incomplete !\n", jack_port_by_name(client1, jack_port_short_name(output_port1)));
+    } else {
+        Log("Checking jack_port_by_name() with bad argument... ok (returned id 0)\n");
+    }
+
+    /**
+    * remove the output port previously created
+    * no more ports should subsist here for our client.
+    *
+    */
+    if (jack_port_unregister(client1, output_port1) != 0) {
+        printf("!!! ERROR !!! while unregistering port %s.\n", jack_port_name(output_port1));
+    }
+
+    /**
+     * list all in ports
+     *
+     */
+    inports = jack_get_ports(client1, NULL, NULL, 0);
+
+    /**
+     * Test the first PHY (physical) connection to see if it's "mine".
+     * and report the result in the test that began before.
+     * The result is printed later.
+     *
+     */
+    if (jack_port_is_mine(client1, jack_port_by_name(client1, inports[0]))) {
+        is_mine = 0;
+    }
+
+    /**
+     * List all devices' flags and print them...
+     *
+     */
+    Log("\nTry functions jack_get_ports, jack_port_flag & jack_port_by_name to list PHY devices...\n");
+    Log("-----------------------------------------------------------\n");
+    Log("---------------------------DEVICES-------------------------\n");
+    Log("-----------------------------------------------------------\n");
+    a = 0;
+    while (inports[a] != NULL) {
+        flag = jack_port_flags(jack_port_by_name(client1, inports[a]) );
+        Log("   * %s (id : %i)\n", inports[a], jack_port_by_name(client1, inports[a]));
+        Log("    (");
+        if (flag & JackPortIsInput)
+            Log("JackPortIsInput ");
+        if (flag & JackPortIsOutput)
+            Log("JackPortIsOutput ");
+        if (flag & JackPortIsPhysical)
+            Log("JackPortIsPhysical ");
+        if (flag & JackPortCanMonitor)
+            Log("JackPortCanMonitor ");
+        if (flag & JackPortIsTerminal)
+            Log("JackPortIsTerminal ");
+        Log(")\n\n");
+        a++;
+    }
+    Log("-----------------------------------------------------------\n\n");
+
+    /**
+     * list all PHY in/out ports...
+     * This list will be used later many times.
+     *
+     */
+    outports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsOutput);
+    inports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
+
+    if (outports == NULL) {
+        printf("!!! WARNING !!! no physical capture ports founded !\n");
+    }
+    if (inports == NULL) {
+        printf("!!! WARNING !!! no physical output ports founded !\n");
+    }
+
+    /**
+     * Brute test : try to create as many ports as possible.
+     * It stops when jack returns an error.
+     * Then try to connect each port to physical entry...
+     * Check also that graph reorder callback is called.
+     *
+     */
+    Log("Registering as many ports as possible and connect them to physical entries...\n");
+    lineports = linecount;
+    t_error = 0;
+
+    i = 0;	// number of couple 'input-ouput'
+    j = 0;	// number of ports created
+    port_callback_reg = 0;	// number of port registration received by the callback
+    reorder = 0;			// number of graph reorder callback activation
+    test_link = 0 ;			// Test the "overconnect" function only one time
+    while (t_error == 0) {
+        sprintf (portname, "input_%d", i);
+        input_port1 = jack_port_register(client1, portname,
+                                         JACK_DEFAULT_AUDIO_TYPE,
+                                         JackPortIsInput, 0);
+        j++;
+        if (input_port1 == NULL) {
+            j--;
+            t_error = 1;
+        } else {
+            // Connect created input to PHY output
+            a = 0;
+            while (outports[a] != NULL) {
+                if (jack_connect(client1, outports[a], jack_port_name(input_port1))) {
+                    printf ("error : cannot connect input PHY port to client port %s\n", jack_port_name(input_port1));
+                } else {
+                    // printf ("input PHY port %s connected to client port %s\n", outports[a], jack_port_name(input_port1));
+                }
+                a++;
+            }
+            // Try one time to "overconnect" 2 ports (the latest created)...
+            if (test_link == 0) {
+                if (jack_connect(client1, outports[a - 1], jack_port_name(input_port1)) == EEXIST) {
+                    // cannot over-connect input PHY port to client port. ok.
+                    test_link = 1;
+                }
+            }
+        }
+
+        sprintf(portname, "output_%d", i);
+        output_port1 = jack_port_register(client1, portname,
+                                          JACK_DEFAULT_AUDIO_TYPE,
+                                          JackPortIsOutput, 0);
+        j++;
+        if (output_port1 == NULL) {
+            t_error = 1;
+            j--;
+        } else {
+            // Connect created input to PHY output
+            a = 0;
+            while (inports[a] != NULL) {
+                if (jack_connect(client1, jack_port_name(output_port1), inports[a])) {
+                    printf ("error : cannot connect input PHY port %s to client port %s\n", inports[a], jack_port_name(output_port1));
+                } else {
+                    // output PHY port %s connected to client port. ok.
+                }
+                a++;
+            }
+            // Try one time to "overconnect" 2 ports (the latest created)...
+            if (test_link == 0) {
+                if (jack_connect(client1, jack_port_name(output_port1), inports[a - 1]) == EEXIST) {
+                    // cannot over-connect output PHY port to client port. ok.
+                    test_link = 1;
+                }
+            }
+        }
+        i++;
+    }
+
+    jack_sleep(1 * 1000); // To hope all port registration and reorder callback have been received...
+    
+    // Check port registration callback
+    if (j == port_callback_reg) {
+        Log("%i ports have been successfully created, and %i callback reg ports have been received... ok\n", j, port_callback_reg);
+    } else {
+        printf("!!! ERROR !!! %i ports have been created, and %i callback reg ports have been received !\n", j, port_callback_reg);
+    }
+    
+    if (reorder == (2 * j)) {
+        Log("%i graph reorder callback have been received... ok\n", reorder);
+    } else {
+        printf("!!! ERROR !!! %i graph reorder callback have been received (maybe non-valid value)...\n", reorder);
+    }
+    /**
+     * print basic test connection functions result ...
+     * over-connected means here that we try to connect 2 ports that are already connected.
+     *
+     */
+    if (test_link) {
+        Log("Jack links can't be 'over-connected'... ok\n");
+    } else {
+        printf("!!! ERROR !!! Jack links can be 'over-connected'...\n");
+    }
+    /**
+     * Print the result of the two jack_is_mine test.
+     *
+     */
+    if (is_mine == 1) {
+        Log("Checking jack_port_is_mine()... ok\n");
+    } else {
+        printf("!!! ERROR !!! jack_port_is_mine() function seems to send non-valid datas !\n");
+    }
+    /**
+     * Free the array of the physical input and ouput ports.
+     * (as mentionned in the doc of jack_get_ports)
+     *
+     */
+    free(inports);
+    free(outports);
+
+    /**
+     * Try to "reactivate" the client whereas it's already activated...
+     *
+     */
+    if (jack_activate(client1) < 0) {
+        printf("!!! ERROR !!! Cannot activate client1 a second time...\n");
+        exit(1);
+    } else {
+        Log("jackd server accept client.jack_activate() re-activation (while client was already activated).\n");
+    }
+
+    /**
+     * Deregister all ports previously created.
+     *
+     */
+    port_callback_reg = 0; // to check registration callback
+    Log("Deregistering all ports of the client...\n");
+    inports = jack_get_ports(client1, NULL, NULL, 0);
+    a = 0;
+    while (inports[a] != NULL) {
+        flag = jack_port_flags(jack_port_by_name(client1, inports[a]));
+        input_port1 = jack_port_by_name(client1, inports[a]);
+        if (jack_port_is_mine(client1, input_port1)) {
+            if (jack_port_unregister(client1, input_port1) != 0) {
+                printf("!!! ERROR !!! while unregistering port %s.\n", jack_port_name(output_port1));
+            }
+        }
+        a++;
+    }
+    
+    // Check port registration callback again
+    if (j == port_callback_reg) { 
+        Log("%i ports have been successfully created, and %i callback reg ports have been received... ok\n", j, port_callback_reg);
+    } else {
+        printf("!!! ERROR !!! %i ports have been created, and %i callback reg ports have been received !\n", j, port_callback_reg);
+    }
+
+    free(inports); // free array of ports (as mentionned in the doc of jack_get_ports)
+
+    /**
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     				Open a new client (second one) to test some other things...
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     */
+
+    Log("\n\n----------------------------------------------------------------------\n");
+    Log("Starting second new client 'jack_test_#2'...\n");
+    /* open a client connection to the JACK server */
+    client_name2 = "jack_test_#2";
+    linecl2 = linecount; // reminders for graph analysis
+    client2 = jack_client_new(client_name2);
+
+    if (client2 == NULL) {
+        fprintf(stderr, "jack_client_new() failed for %s.\n"
+                "status = 0x%2.0x\n", client_name2, status);
+        if (status & JackServerFailed) {
+            fprintf(stderr, "Unable to connect client2 to JACK server\n");
+        }
+        exit(1);
+    }
+
+	// Check client registration callback
+	jack_sleep(1000);
+	if (client_register == 0)
+		printf("!!! ERROR !!! Client registration callback not called!\n");
+
+    /**
+     * Register callback for this client.
+     * Callbacks are the same as the first client for most of them, excepted for process audio callback.
+     *
+     */
+    jack_set_port_registration_callback(client2, Jack_Port_Register, 0);
+
+    jack_set_process_callback(client2, process2, 0);
+
+    jack_on_shutdown(client2, jack_shutdown, 0);
+
+    /**
+     * Register one input and one output for each client.
+     *
+     */
+    Log("registering 1 input/output ports for each client...\n");
+
+    output_port1 = jack_port_register(client1, "out1",
+                                      JACK_DEFAULT_AUDIO_TYPE,
+                                      JackPortIsOutput, 0);
+    output_port2 = jack_port_register(client2, "out2",
+                                      JACK_DEFAULT_AUDIO_TYPE,
+                                      JackPortIsOutput, 0);
+    input_port1 = jack_port_register(client1, "in1",
+                                     JACK_DEFAULT_AUDIO_TYPE,
+                                     JackPortIsInput, 0);
+    input_port2 = jack_port_register(client2, "in2",
+                                     JACK_DEFAULT_AUDIO_TYPE,
+                                     JackPortIsInput, 0);
+    if ((output_port1 == NULL) || (output_port2 == NULL) || (input_port1 == NULL) || (input_port2 == NULL)) {
+        printf("!!! ERROR !!! Unable to register ports...\n");
+    }
+
+    /**
+     * Set each process mode to idle and activate client2
+     *
+     */
+    process2_activated = -1;
+    process1_activated = -1;
+    if (jack_activate(client2) < 0) {
+        printf ("Fatal error : cannot activate client2\n");
+        exit (1);
+    }
+
+    /**
+     * Connect the two clients and check that all connections are well-done.
+     *
+     */
+    Log("Testing connections functions between clients...\n");
+    if (jack_connect(client1, jack_port_name(output_port1), jack_port_name(input_port2)) != 0) {
+        printf("!!! ERROR !!! while client1 intenting to connect ports...\n");
+    }
+    if (jack_connect(client2, jack_port_name(output_port2), jack_port_name(input_port1)) != 0) {
+        printf("!!! ERROR !!! while client2 intenting to connect ports...\n");
+    }
+    if (jack_connect(client1, jack_port_name(output_port1), jack_port_name(input_port1)) != 0) {
+        printf("!!! ERROR !!! while client1 intenting to connect ports...\n");
+    }
+
+    /**
+     * Test the port_connected function...
+     *
+     */
+    if ((jack_port_connected(output_port1) == jack_port_connected(input_port1)) &&
+            (jack_port_connected(output_port2) == jack_port_connected(input_port2)) &&
+            (jack_port_connected(output_port2) == 1) &&
+            (jack_port_connected(output_port1) == 2)
+       ) {
+        Log("Checking jack_port_connected()... ok.\n");
+    } else {
+        printf("!!! ERROR !!! function jack_port_connected() return a bad value !\n");
+        printf("jack_port_connected(output_port1) %d\n", jack_port_connected(output_port1));
+        printf("jack_port_connected(output_port2) %d\n", jack_port_connected(output_port2));
+        printf("jack_port_connected(input_port1) %d\n", jack_port_connected(input_port1));
+        printf("jack_port_connected(input_port2) %d\n", jack_port_connected(input_port2));
+    }
+
+    /**
+     * Test a new time the port_by_name function...(now we are in multi-client mode)
+     *
+     */
+    Log("Testing again jack_port_by_name...\n");
+    if (output_port1 != jack_port_by_name(client1, jack_port_name(output_port1))) {
+        printf("!!! ERROR !!! function jack_port_by_name() return bad value in a multi-client application!\n");
+        printf("!!! jack_port_by_name(jack_port_name(_ID_) ) != _ID_ in multiclient application.\n");
+    } else {
+        Log("Checking jack_port_by_name() function with a multi-client application... ok\n");
+    }
+
+    /**
+     * Test the port_connected_to function...
+     *
+     */
+    if ((jack_port_connected_to (output_port1, jack_port_name(input_port2))) &&
+            (!(jack_port_connected_to (output_port2, jack_port_name(input_port2))))) {
+        Log("checking jack_port_connected_to()... ok\n");
+    } else {
+        printf("!!! ERROR !!! jack_port_connected_to() return bad value !\n");
+    }
+
+    /**
+     * Test the port_get_connections & port_get_all_connections functions...
+     *
+     */
+    Log("Testing jack_port_get_connections and jack_port_get_all_connections...\n");
+    a = 0;
+    t_error = 0;
+    connexions1 = jack_port_get_connections (output_port1);
+    connexions2 = jack_port_get_all_connections(client1, output_port1);
+    if ((connexions1 == NULL) || (connexions2 == NULL)) {
+        printf("!!! ERROR !!! port_get_connexions or port_get_all_connexions return a NULL pointer !\n");
+    } else {
+        while ((connexions1[a] != NULL) && (connexions2[a] != NULL) && (t_error == 0)) {
+            t_error = strcmp(connexions1[a], connexions2[a]);
+            a++;
+        }
+
+        if (t_error == 0) {
+            Log("Checking jack_port_get_connections Vs jack_port_get_all_connections... ok\n");
+        } else {
+            printf("!!! ERROR !!! while checking jack_port_get_connections Vs jack_port_get_all_connections...\n");
+        }
+    }
+    a = 0;
+    t_error = 0;
+    inports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
+    connexions1 = NULL;
+    assert(inports != NULL);
+    if (inports[0] != NULL) {
+        connexions1 = jack_port_get_connections (jack_port_by_name(client1, inports[0]));
+        connexions2 = jack_port_get_all_connections(client1, jack_port_by_name(client1, inports[0]));
+    }
+
+    free (inports);
+    if (connexions1 == NULL) {
+        Log("checking jack_port_get_connections() for external client... ok\n");
+    } else {
+        while ((connexions1[a] != NULL) && (connexions2[a] != NULL) && (t_error == 0)) {
+            t_error = strcmp(connexions1[a], connexions2[a]);
+            a++;
+        }
+    }
+    if (t_error == 0) {
+        Log("Checking jack_port_get_connections() Vs jack_port_get_all_connections() on PHY port... ok\n");
+    } else {
+        printf("!!! ERROR !!! while checking jack_port_get_connections() Vs jack_port_get_all_connections() on PHY port...\n");
+    }
+
+	if (jack_disconnect(client1, jack_port_name(output_port1), jack_port_name(input_port1)) != 0) {
+        printf("!!! ERROR !!! while client1 intenting to disconnect ports...\n");
+    }
+    if (jack_disconnect(client1, jack_port_name(output_port2), jack_port_name(input_port1)) != 0) {
+        printf("!!! ERROR !!! while client1 intenting to disconnect ports...\n");
+    }
+    // No links should subsist now...
+
+    /**
+     * Checking data connexion
+     * establishing a link between client1.out1 --> client2.in2
+     * Send the signal1 test on out1. Record the result into signal2. (see process functions).
+    ---------------------------------------------------------------------------*/
+    Log("Testing connections datas between clients...\n");
+    jack_connect(client2, jack_port_name(output_port1), jack_port_name(input_port2) );
+    process2_activated = -1;
+    process1_activated = -1;
+    Log("process 2 : idle mode...\n");
+    Log("Sending datas...");
+    index1 = 0;
+    index2 = 0;
+    process1_activated = 1; // We start emitting first.
+    process2_activated = 1; // So record begin at least when we just begin to emitt the signal, else at next call of process with
+    // nframe = jack buffersize shifting.
+
+    while (process2_activated == 1) {
+        jack_sleep(1 * 1000);
+        Log(".");
+    }
+    index2 = 0;
+    Log("\nAnalysing datas...\n"); // search the first occurence of the first element of the reference signal in the recorded signal
+    while (signal2[index2] != signal1[1] ) {
+        index2++;
+        if (index2 == 95999) {
+            printf("!!! ERROR !!! Data not found in first connexion data check!\n");
+            break;
+        }
+    }
+    index1 = index2;
+    Log("Data founded at offset %i.\n", index2);
+    // And now we founded were the recorded data are, we can see if the two signals matches...
+    while ( (signal2[index2] == signal1[index2 - index1 + 1]) || (index2 == 95999) || ((index2 - index1 + 1) == 47999) ) {
+        index2++;
+    }
+    Log("Checking difference between datas... %i have the same value...\n", index2 - index1);
+    if ((index2 - index1) == 48000) {
+        Log("Data received are valid...\n");
+    } else {
+        printf("!!! ERROR !!! data transmission seems not to be valid in first connexion data check!\n");
+    }
+    if (jack_disconnect(client1, jack_port_name(output_port1), jack_port_name(input_port2) ) != 0)
+        // no more connection between ports exist now...
+    {
+        printf("Error while establishing new connexion (disconnect).\n");
+    }
+
+    /**
+     * Test TIE MODE
+     * (This mode seems to be problematic in standard jack version 0.100. It seems that nobody
+     * is used to apply this mode because the tie mode doesn't work at all. A patch seems difficult to produce
+     * in this version of jack. Tie mode work well in MP version.)
+     * Test some basic thinks (tie with 2 differents client, tie non-owned ports...)
+     * Tie client1.in1 and client1.out1 ports, and make some data test to check the validity of the tie.
+     *
+     */
+    Log("Testing tie mode...\n");
+    if (jack_port_tie(input_port1, output_port2) != 0) {
+        Log("not possible to tie two ports from two differents clients... ok\n");
+    } else {
+        printf("!!! ERROR !!! port_tie has allowed a connexion between two differents clients !\n");
+        jack_port_untie(output_port2);
+    }
+    Log("Testing connections datas in tie mode...\n");
+    int g;
+    for (g = 0; g < 96000; g++)
+        signal2[g] = 0.0;
+    // Create a loop (emit test) client2.out2----client.in1--tie--client1.out1-----client2.in1 (receive test)
+    if (jack_port_tie(input_port1, output_port1) != 0) {
+        printf("Unable to tie... fatal error : data test will not be performed on tie mode !!\n");
+    } else { // begin of tie
+        if (jack_connect(client1, jack_port_name(output_port1), jack_port_name(input_port2)) != 0) {
+            printf("!!! ERROR !!! while client1 intenting to connect ports...\n");
+        }
+        if (jack_connect(client1, jack_port_name(output_port2), jack_port_name(input_port1)) != 0) {
+            printf("!!! ERROR !!! while client1 intenting to connect ports...\n");
+        }
+
+        process1_activated = -1;
+        process2_activated = -1;
+
+        //		We can manualy check here that the tie is effective.
+        //		ie : playing a wav with a client, connecting ports manualy with qjackctl, and listen...
+        // 		printf("manual test\n");
+        // 		jack_sleep(50);
+        // 		printf("end of manual test\n");
+
+        index1 = 0;
+        index2 = 0;
+        process1_activated = -1;
+        process2_activated = 2;
+
+        Log("Sending datas...");
+
+        while (process2_activated == 2) {
+            jack_sleep(1 * 1000);
+            Log(".");
+        }
+        process1_activated = -1;
+        process2_activated = -1;
+        index2 = 0;
+        Log("\nAnalysing datas...\n");
+        // We must find at least 2 identical values to ensure we are at the right place in the siusoidal array...
+        while (!((signal2[index2] == signal1[1]) && (signal2[index2 + 1] == signal1[2]))) {
+            index2++;
+            if (index2 == 95999) {
+                printf("!!! ERROR !!! Data not found in connexion check of tie mode!\n");
+                break;
+            }
+        }
+        index1 = index2;
+        Log("Tie mode : Data founded at offset %i.\n", index2);
+        while (signal2[index2] == signal1[index2 - index1 + 1]) {
+            index2++;
+            if ((index2 == 95999) || ((index2 - index1 + 1) == 47999)) {
+                break;
+            }
+        }
+        Log("Checking difference between datas... %i have the same value...\n", index2 - index1);
+        if ((index2 - index1) > 47995) {
+            Log("Data received in tie mode are valid...\n");
+        } else {
+            // in tie mode, the buffers adress should be the same for the two tied ports.
+            printf("!!! ERROR !!! data transmission seems not to be valid !\n");
+            printf("Links topology : (emitt) client2.out2 ----> client1.in1--(tie)--client1.out1----->client2.in2 (recive)\n");
+            printf("  port_name    : Port_adress \n");
+            printf("  output_port1 : %px\n", jack_port_get_buffer(output_port1, cur_buffer_size));
+            printf("  input_port2  : %px\n", jack_port_get_buffer(input_port2, cur_buffer_size));
+            printf("  output_port2 : %px\n", jack_port_get_buffer(output_port2, cur_buffer_size));
+            printf("  input_port1  : %px\n", jack_port_get_buffer(input_port1, cur_buffer_size));
+        }
+
+        jack_port_untie(output_port1);
+        jack_port_disconnect(client1, output_port2);
+        jack_port_disconnect(client1, output_port1);
+
+    } //end of tie
+
+
+    /**
+     * Testing SUMMATION CAPABILITIES OF JACK CONNECTIONS
+     *
+     * In a short test, we just check a simple summation in jack.
+     * A first client(client1) send two signal in phase opposition
+     * A second client(client2) record the summation at one of his port
+     * So, the result must be zero...
+     * See process1 for details about steps of this test
+     *
+     */
+    // fprintf(file, "Sum test\n");
+    Log("Checking summation capabilities of patching...\n");
+    output_port1b = jack_port_register(client1, "out1b",
+                                       JACK_DEFAULT_AUDIO_TYPE,
+                                       JackPortIsOutput, 0);
+    jack_connect(client2, jack_port_name(output_port1), jack_port_name(input_port2));
+    jack_connect(client2, jack_port_name(output_port1b), jack_port_name(input_port2));
+
+    process1_activated = 3;
+    process2_activated = -1;
+    for (g = 0; g < 96000; g++)
+        signal2[g] = 0.0;
+    index1 = 0;
+    index2 = 0;
+
+    Log("Sending datas...");
+    process2_activated = 3;
+
+    while (process2_activated == 3) {
+        jack_sleep(1 * 1000);
+        Log(".");
+    }
+    process1_activated = -1;
+    process2_activated = -1;
+    index2 = 0;
+    Log("\nAnalysing datas...\n"); // same idea as above, with first data check...
+    while (!((signal2[index2] == 0.0 ) && (signal2[(index2 + 1)] == 0.0 ))) {
+        index2++;
+        if (index2 == 95999) {
+            printf("!!! ERROR !!! Data not found in summation check!\n");
+            break;
+        }
+    }
+    index1 = index2;
+    Log("Data founded at offset %i.\n", index2);
+
+    while ( signal2[index2] == 0.0 ) {
+        index2++;
+        if ((index2 > 95998) || ((index2 - index1 + 1) > 47998)) {
+            break;
+        }
+    }
+    Log("Checking difference between datas...\n");
+    if ((index2 - index1) > 47996) {
+        Log("Data mixed received are valid...\nSummation is well done.\n");
+    } else {
+        printf("!!! ERROR !!! data transmission / summation seems not to be valid !\n");
+    }
+    jack_port_disconnect(client1, output_port1);
+    jack_port_disconnect(client1, output_port1b);
+    jack_port_unregister(client1, output_port1b);
+
+    if (jack_port_name(output_port1b) != NULL ) {
+        printf("!!! WARNING !!! port_name return something while the port have been unregistered !\n");
+        printf("!!! Name of unregistered port : %s !\n", jack_port_name(output_port1b));
+    } else {
+        Log("Checking jack_port_name() with a non valid port... ok\n");
+    }
+
+    if (jack_port_set_name(output_port1b, "new_name") == 0 ) {
+        printf("!!! WARNING !!! An unregistered port can be renamed successfully !\n");
+    } else {
+        Log("Checking renaming of an unregistered port... ok\n");
+    }
+    inports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
+    if (jack_port_set_name(jack_port_by_name(client1, inports[0]), "new_name") == 0 ) {
+        printf("!!! WARNING !!! A PHYSICAL port can be renamed successfully !\n");
+    } else {
+        Log("Checking renaming of an unregistered port... ok\n");
+    }
+    free (inports);
+
+
+    /**
+     * Checking latency issues
+     * here are simple latency check
+     * We simply check that the value returned by jack seems ok
+     * Latency compensation is a difficult point.
+     * Actually, jack is not able to see "thru" client to build a full latency chain.
+     * Ardour use theses informations to do internally his compensations.
+     *
+     * 3 test are done : one with no connections between client, one with a serial connection, and one with parallel connection
+     */
+    Log("Checking about latency functions...\n");
+    t_error = 0;
+    jack_recompute_total_latencies(client1);
+    if ((jack_port_get_latency (output_port1) != 0) ||
+            (jack_port_get_total_latency(client1, output_port1) != 0) ) {
+        t_error = 1;
+        printf("!!! ERROR !!! default latency of a non-PHY device is not set to zero !\n");
+    }
+
+    inports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
+    outports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsOutput);
+    if (inports[0] != NULL) {
+        output_ext_latency = jack_port_get_latency (jack_port_by_name(client1, inports[0]));  // from client to out driver (which has "inputs" ports..)
+		input_ext_latency = jack_port_get_latency (jack_port_by_name(client1, outports[0]));  // from in driver (which has "output" ports..) to client
+        if (output_ext_latency != jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0]))) {
+            t_error = 1;
+            printf("!!! ERROR !!! get_latency & get_all_latency for a PHY device (unconnected) didn't return the same value !\n");
+        }
+        Log("Checking a serial model with 2 clients...\n");
+
+        jack_connect(client1, jack_port_name(output_port1), jack_port_name(input_port2));
+        jack_connect(client1, outports[0], jack_port_name(input_port1));
+        jack_connect(client2, jack_port_name(output_port2), inports[0]);
+        jack_port_set_latency(output_port2, 256);
+        jack_recompute_total_latencies(client1);
+
+        if ((jack_port_get_latency (output_port1) != 0) ||
+                (jack_port_get_total_latency(client1, output_port1) != 0) ||
+                (jack_port_get_latency (jack_port_by_name(client1, inports[0])) != (output_ext_latency)) ||
+                (jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) != (output_ext_latency + 256)) ||
+                (jack_port_get_total_latency(client1, output_port2) != (output_ext_latency + 256)) ||
+                (jack_port_get_total_latency(client1, input_port2) != 0) ||
+                (jack_port_get_total_latency(client1, input_port1) != input_ext_latency) ||
+                (jack_port_get_latency (jack_port_by_name(client1, outports[0])) != input_ext_latency) ||
+                (jack_port_get_total_latency(client1, jack_port_by_name(client1, outports[0])) != input_ext_latency)
+           ) {
+            printf("!!! WARNING !!! get_latency functions may have a problem : bad value returned !\n");
+            printf("!!! get_latency(output_port1) : %i (must be 0)\n", jack_port_get_latency(output_port1));
+            printf("!!! get_total_latency(output_port1) : %i (must be 0)\n", jack_port_get_total_latency(client1, output_port1));
+            printf("!!! get_latency(PHY[0]) : %i (must be external latency : %i)\n", jack_port_get_latency(jack_port_by_name(client1, inports[0])), output_ext_latency);
+            printf("!!! get_total_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) , (output_ext_latency + 256));
+            printf("!!! get_total_latency(output_port2) : %i (must be %i)\n", jack_port_get_total_latency(client1, output_port2), (output_ext_latency + 256));
+            printf("!!! get_total_latency(input_port2) : %i (must be 0)\n", jack_port_get_total_latency(client1, input_port2));
+            printf("!!! get_total_latency(input_port1) : %i (must be %i)\n", jack_port_get_total_latency(client1, input_port1), input_ext_latency);
+            printf("!!! get_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_latency(jack_port_by_name(client1, outports[0])), input_ext_latency);
+            printf("!!! get_total_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, outports[0])), input_ext_latency);
+
+        } else {
+            Log("get_latency & get_total_latency seems quite ok...\n");
+        }
+
+        jack_port_disconnect(client1, output_port1);
+	    jack_port_disconnect(client1, output_port2);
+		jack_port_disconnect(client1, input_port1);
+	    jack_port_disconnect(client1, input_port2);
+	    Log("Checking a parallel model with 2 clients...\n");
+        jack_connect(client2, outports[0], jack_port_name(input_port1));
+        jack_connect(client2, outports[0], jack_port_name(input_port2));
+        jack_connect(client2, jack_port_name(output_port1), inports[0]);
+        jack_connect(client2, jack_port_name(output_port2), inports[0]);
+        jack_port_set_latency(output_port1, 256);
+        jack_port_set_latency(output_port2, 512);
+        jack_recompute_total_latencies(client1);
+
+        if ((jack_port_get_latency(output_port1) != 256 ) ||
+			(jack_port_get_total_latency(client1, output_port1) != (256 + output_ext_latency)) ||
+			(jack_port_get_latency(output_port2) != 512) ||
+			(jack_port_get_total_latency(client1, output_port2) != (512 + output_ext_latency)) ||
+			(jack_port_get_latency(jack_port_by_name(client1, inports[0])) != output_ext_latency) ||
+			(jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) != (512 + output_ext_latency))
+           ) {
+            printf("!!! WARNING !!! get_latency functions may have a problem : bad value returned !\n");
+			printf("!!! get_latency(output_port1) : %i (must be 256)\n", jack_port_get_latency(output_port1));
+			printf("!!! get_total_latency(output_port1) : %i (must be 256 + output_ext_latency)\n", jack_port_get_total_latency(client1, output_port1));
+			printf("!!! get_latency(output_port2) : %i (must 512)\n", jack_port_get_latency(output_port2));
+			printf("!!! get_total_latency(output_port2) : %i (must 512 + output_ext_latency)\n", jack_port_get_total_latency(client1, output_port2));
+			printf("!!! get_latency(inports[0])) : %i (must output_ext_latency)\n", jack_port_get_latency(jack_port_by_name(client1, inports[0])));
+			printf("!!! get_total_latency(inports[0]) : %i (must 512 + output_ext_latency)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])));
+        } else {
+            Log("get_latency & get_total_latency seems quite ok...\n");
+        }
+    } else {
+        printf("No physical port founded : not able to test latency functions...");
+    }
+
+    jack_port_disconnect(client1, input_port1);
+    jack_port_disconnect(client1, input_port2);
+    jack_port_disconnect(client1, output_port1);
+    jack_port_disconnect(client1, output_port2);
+
+	jack_sleep(1000);
+
+    free(inports);
+    free(outports);
+
+    /**
+     * Checking transport API.
+     * Simple transport test.
+     * Check a transport start with a "slow" client, simulating a delay around 1 sec before becoming ready.
+     *
+     */
+	Log("-----------------------------------------------------------\n");
+    Log("---------------------------TRANSPORT-----------------------\n");
+    Log("-----------------------------------------------------------\n");
+
+    lineports = linecount;
+
+    if (transport_mode) {
+        int wait_count;
+        ts = jack_transport_query(client1, &pos);
+        if (ts == JackTransportStopped) {
+            Log("Transport is stopped...\n");
+        } else {
+            jack_transport_stop(client1);
+            Log("Transport state : %i\n", ts);
+        }
+        if (jack_set_sync_callback(client2, Jack_Sync_Callback, 0) != 0)
+            printf("error while calling set_sync_callback...\n");
+
+        Log("starting transport...\n");
+
+        starting_state = 1; // Simulate starting state
+        jack_transport_start(client1);
+
+        // Wait until sync callback is called
+        while (!(sync_called)) {
+            jack_sleep(1 * 1000);
+        }
+
+        // Wait untill rolling : simulate sync time out
+        Log("Simulate a slow-sync client exceeding the time-out\n");
+        wait_count = 0;
+
+        do {
+            jack_sleep(100); // Wait 100 ms each cycle
+            wait_count++;
+            if (wait_count == 100) {
+                Log("!!! ERROR !!! max time-out exceedeed : sync time-out does not work correctly\n");
+                break;
+            }
+            ts = jack_transport_query(client2, &pos);
+            Log("Waiting....pos = %ld\n", pos.frame);
+            display_transport_state();
+
+        } while (ts != JackTransportRolling);
+
+        Log("Sync callback have been called %i times.\n", sync_called);
+        jack_transport_stop(client1);
+
+        // Wait until stopped
+        ts = jack_transport_query(client2, &pos);
+        while (ts != JackTransportStopped) {
+            jack_sleep(1 * 1000);
+            ts = jack_transport_query(client2, &pos);
+        }
+
+        // Simulate starting a slow-sync client that rolls after 0.5 sec
+        Log("Simulate a slow-sync client that needs 0.5 sec to start\n");
+        sync_called = 0;
+        wait_count = 0;
+        starting_state = 1; // Simulate starting state
+
+        Log("Starting transport...\n");
+        jack_transport_start(client1);
+        display_transport_state();
+
+        Log("Waiting 0.5 sec...\n");
+        jack_sleep(500);
+        starting_state = 0; // Simulate end of starting state after 0.5 sec
+
+        // Wait untill rolling
+        ts = jack_transport_query(client2, &pos);
+        while (ts != JackTransportRolling) {
+            jack_sleep(100); // Wait 100 ms each cycle
+            wait_count++;
+            if (wait_count == 10) {
+                Log("!!! ERROR !!! starting a slow-sync client does not work correctly\n");
+                break;
+            }
+            ts = jack_transport_query(client2, &pos);
+        }
+
+        if (sync_called == 0)
+            Log("!!! ERROR !!! starting a slow-sync client does not work correctly\n");
+
+        Log("Sync callback have been called %i times.\n", sync_called);
+        display_transport_state();
+
+        // Test jack_transport_locate while rolling
+        Log("Test jack_transport_locate while rolling\n");
+        ts = jack_transport_query(client2, &pos);
+        Log("Transport current frame = %ld\n", pos.frame);
+        jack_nframes_t cur_frame = pos.frame;
+
+        wait_count = 0;
+        do {
+            display_transport_state();
+            jack_sleep(10);  // 10 ms
+            // locate at first...
+            wait_count++;
+            if (wait_count == 1) {
+                Log("Do jack_transport_locate\n");
+                jack_transport_locate(client1, cur_frame / 2);
+            } else if (wait_count == 100) {
+                break;
+            }
+            ts = jack_transport_query(client2, &pos);
+            Log("Locating.... frame = %ld\n", pos.frame);
+        } while (pos.frame > cur_frame);
+
+        ts = jack_transport_query(client2, &pos);
+        Log("Transport current frame = %ld\n", pos.frame);
+        if (wait_count == 100) {
+            printf("!!! ERROR !!! jack_transport_locate does not work correctly\n");
+        }
+
+        // Test jack_transport_reposition while rolling
+        Log("Test jack_transport_reposition while rolling\n");
+        ts = jack_transport_query(client2, &pos);
+        Log("Transport current frame = %ld\n", pos.frame);
+        cur_frame = pos.frame;
+
+        wait_count = 0;
+        do {
+            display_transport_state();
+            jack_sleep(10);  // 10 ms
+            // locate at first...
+            wait_count++;
+            if (wait_count == 1) {
+                Log("Do jack_transport_reposition\n");
+                request_pos.frame = cur_frame / 2;
+                jack_transport_reposition(client1, &request_pos);
+            } else if (wait_count == 100) {
+                break;
+            }
+            ts = jack_transport_query(client2, &pos);
+            Log("Locating.... frame = %ld\n", pos.frame);
+        } while (pos.frame > cur_frame);
+
+        ts = jack_transport_query(client2, &pos);
+        Log("Transport current frame = %ld\n", pos.frame);
+        if (wait_count == 100) {
+            printf("!!! ERROR !!! jack_transport_reposition does not work correctly\n");
+        }
+
+        // Test jack_transport_reposition while stopped
+        jack_transport_stop(client1);
+        ts = jack_transport_query(client2, &pos);
+        Log("Transport current frame = %ld\n", pos.frame);
+
+        Log("Test jack_transport_reposition while stopped\n");
+        wait_count = 0;
+        request_pos.frame = 10000;
+        jack_transport_reposition(client1, &request_pos);
+
+        do {
+            display_transport_state();
+            jack_sleep(100); // 100 ms
+            if (wait_count++ == 10)
+                break;
+            ts = jack_transport_query(client2, &pos);
+            Log("Locating.... frame = %ld\n", pos.frame);
+        } while (pos.frame != 10000);
+
+        ts = jack_transport_query(client2, &pos);
+        Log("Transport current frame = %ld\n", pos.frame);
+        if (pos.frame != 10000) {
+            printf("!!! ERROR !!! jack_transport_reposition does not work correctly\n");
+        }
+
+        jack_transport_stop(client1);
+
+        /* Tell the JACK server that we are ready to roll.  Our
+         * process() callback will start running now. */
+
+    } else {
+        printf("Transport check is disabled...\n");
+    }
+
+    time_before_exit = time_to_run;
+    while (time_before_exit != 0) {
+        jack_sleep (1 * 1000);
+        time_before_exit--;
+    }
+
+	if (jack_deactivate(client2) != 0) {
+        printf("!!! ERROR !!! jack_deactivate does not return 0 for client2 !\n");
+    }
+    if (jack_deactivate(client1) != 0) {
+        printf("!!! ERROR !!! jack_deactivate does not return 0 for client1 !\n");
+    }
+
+	/**
+     * Checking jack_frame_time.
+    */
+	Log("Testing jack_frame_time...\n");
+	jack_set_process_callback(client1, process4, client1);
+	jack_activate(client1);
+	jack_sleep(2 * 1000);
+
+
+	/**
+     * Checking alternate thread model
+    */
+	Log("Testing alternate thread model...\n");
+	jack_deactivate(client1);
+	jack_set_process_callback(client1, NULL, NULL);  // remove callback
+	jack_set_process_thread(client1, jack_thread, client1);
+	jack_activate(client1);
+	jack_sleep(2 * 1000);
+
+	/**
+     * Checking callback exiting : when the return code is != 0, the client is desactivated.
+    */
+	Log("Testing callback exiting...\n");
+	jack_deactivate(client1);
+	jack_set_process_thread(client1, NULL, NULL); // remove thread callback
+	jack_set_process_callback(client1, process3, 0);
+	jack_activate(client1);
+	jack_sleep(3 * 1000);
+
+    /**
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+     						Closing program
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+	*/
+
+    if (jack_deactivate(client2) != 0) {
+        printf("!!! ERROR !!! jack_deactivate does not return 0 for client2 !\n");
+    }
+    if (jack_deactivate(client1) != 0) {
+        printf("!!! ERROR !!! jack_deactivate does not return 0 for client1 !\n");
+    }
+    if (jack_client_close(client2) != 0) {
+        printf("!!! ERROR !!! jack_client_close does not return 0 for client2 !\n");
+    }
+    if (jack_client_close(client1) != 0) {
+        printf("!!! ERROR !!! jack_client_close does not return 0 for client1 !\n");
+    }
+
+    if (xrun == 0) {
+        Log("No Xrun have been detected during this test... cool !\n");
+    } else {
+        printf("%i Xrun have been detected during this session (seen callback messages to see where are the problems).\n", xrun);
+    }
+    free(framecollect);
+    free(signal1);
+    free(signal2);
+    Log("Exiting jack_test...\n");
+    fclose(file);
+    printf("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");
+    sprintf (filename, "framegraph-%i.gnu", cur_buffer_size);
+    file = fopen(filename, "w");
+    if (file == NULL) {
+        fprintf(stderr, "Erreur dans l'ouverture du fichier");
+        exit( -1);
+    }
+    fprintf(file, "reset\n");
+    fprintf(file, "set terminal png transparent nocrop enhanced\n");
+    fprintf(file, "set output 'framegraph-%i-1.png'\n", cur_buffer_size);
+    fprintf(file, "set title \"Frame time evolution during jack_test run\"\n");
+    fprintf(file, "set yrange [ %i.00000 : %i.0000 ] noreverse nowriteback\n", cur_buffer_size - (cur_buffer_size / 8), cur_buffer_size + (cur_buffer_size / 8));
+    fprintf(file, "set xrange [ 0.00000 : %i.0000 ] noreverse nowriteback\n" , linecount - 1);
+    fprintf(file, "set ylabel \"Frametime evolution (d(ft)/dt)\"\n");
+    fprintf(file, "set xlabel \"FrameTime\"\n");
+    fprintf(file, "set label \"| buf.siz:%i | fr.wl:%i | rg.ports:%i | 2nd.client:%i | trsprt:%i |\" at graph 0.01, 0.04\n", linebuf, linefw, lineports, linecl2, linetransport);
+    fprintf(file, "plot 'framefile-%i.dat' using 2 with impulses title \"Xruns\",'framefile-%i.dat' using 1 with line title \"Sampletime variation at %i\"\n", cur_buffer_size, cur_buffer_size, cur_buffer_size);
+
+    fprintf(file, "set output 'framegraph-%i-2.png'\n", cur_buffer_size);
+    fprintf(file, "set title \"Frame time evolution during jack_test run\"\n");
+    fprintf(file, "set yrange [ %i.00000 : %i.0000 ] noreverse nowriteback\n", (int) (cur_buffer_size / 2), (int) (2*cur_buffer_size + (cur_buffer_size / 8)));
+    fprintf(file, "set xrange [ 0.00000 : %i.0000 ] noreverse nowriteback\n" , linecount - 1);
+    fprintf(file, "set ylabel \"Frametime evolution (d(ft)/dt)\"\n");
+    fprintf(file, "set xlabel \"FrameTime\"\n");
+    fprintf(file, "set label \"| buf.siz:%i | fr.wl:%i | rg.ports:%i | 2nd.client:%i | trsprt:%i |\" at graph 0.01, 0.04\n", linebuf, linefw, lineports, linecl2, linetransport);
+    fprintf(file, "plot 'framefile-%i.dat' using 2 with impulses title \"Xruns\",'framefile-%i.dat' using 1 with line title \"Sampletime variation at %i\"\n", cur_buffer_size, cur_buffer_size, cur_buffer_size);
+    fclose(file);
+    return 0;
+}
diff --git a/tests/testAtomic.cpp b/tests/testAtomic.cpp
new file mode 100644
index 0000000..4c79cc5
--- /dev/null
+++ b/tests/testAtomic.cpp
@@ -0,0 +1,256 @@
+/*
+	Copyright (C) 2004-2008 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <unistd.h>
+
+#include "JackAtomicState.h"
+#include "JackPosixThread.h"
+
+using namespace Jack;
+
+#define SIZE 1024
+
+struct TestState {
+
+	long fTable[SIZE];
+	long fReadCounter;
+	long fWriteCounter;
+	
+	TestState()
+	{
+		for (int i = 0; i < SIZE; i++) {
+			fTable[i] = 0;
+		}
+		fReadCounter = 0;
+		fWriteCounter = 0;
+	}
+	virtual ~TestState()
+	{}
+
+	void Write() 
+	{
+        fWriteCounter++;
+		for (int i = 0; i < SIZE; i++) {
+			fTable[i] = fTable[i] + 10;
+		}
+	}
+	
+	bool Read() 
+	{
+		int val = fTable[0];
+		fReadCounter++;
+		for (int i = 0; i < SIZE; i++) {
+			if (fTable[i] != val) {
+				printf("Read error fReadCounter %ld, i %ld, curVal %ld, oldVal %ld\n", fReadCounter, i, fTable[i], val);
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	bool ReadCopy(long* result) 
+	{
+		int val = fTable[0];
+		fReadCounter++;
+		for (int i = 0; i < SIZE; i++) {
+			result[i] = fTable[i];
+			if (fTable[i] != val) {
+				//printf("ReadCopy error fReadCounter %ld, i %ld, curVal %ld, oldVal %ld\n", fReadCounter, i, fTable[i], val);
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	bool Check(long* result) 
+	{
+		int val = result[0];
+		for (int i = 0; i < SIZE; i++) {
+			if (result[i] != val) {
+				printf("Check error fReadCounter %ld, i %ld, curVal %ld, oldVal %ld\n", fReadCounter, i, fTable[i], val);
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	int GetVal() 
+	{
+		return fTable[10];
+	}
+	
+}; 
+
+/*!
+\brief The state wrapped with the 2 state atomic class.
+*/
+
+class TestStateUser : public JackAtomicState<TestState> {
+
+	public:
+	
+		TestStateUser(){}
+		virtual ~TestStateUser(){}
+		
+		void TestWriteMethod() 
+		{
+			TestState* state = WriteNextStateStart();
+			state->Write();
+			state->Write();
+			state->Write();
+			WriteNextStateStop(); 
+		}
+			
+		void TestReadMethod() 
+		{
+			TestState* state;
+			int fCount = 0;
+			long result[SIZE];
+            UInt16 cur_index;
+            UInt16 next_index;
+			do {
+                cur_index = GetCurrentIndex();
+                fCount++;
+				state = ReadCurrentState();
+				bool res = state->ReadCopy(result);
+			    next_index = GetCurrentIndex();
+                if (!res) 
+                    printf("TestReadMethod fCount %ld cur %ld next %ld\n", fCount, cur_index, next_index);
+        	}while (cur_index != next_index);
+			state->Check(result);
+		}
+		
+		void TestReadRTMethod1() 
+		{
+			TestState* state = TrySwitchState();
+			bool res = state->Read();
+		}
+		
+		void TestReadRTMethod2() 
+		{
+			TestState* state = ReadCurrentState();
+			state->Read();
+		}
+};
+
+/*!
+\brief Base class for reader/writer threads.
+*/
+
+struct TestThread : public JackRunnableInterface {
+
+	JackPosixThread* fThread;
+	TestStateUser* fObject;
+	
+	TestThread(TestStateUser* state):fObject(state)
+	{
+		fThread = new JackPosixThread(this);
+		int res = fThread->Start();
+	}
+
+	virtual ~TestThread()
+	{
+		fThread->Kill();
+		delete fThread;
+	}
+	
+};
+
+/*!
+\brief "Real-time" reader thread.
+*/
+
+struct RTReaderThread : public TestThread {
+	
+	RTReaderThread(TestStateUser* state):TestThread(state) 
+	{}
+	
+	bool Execute()
+	{
+		fObject->TestReadRTMethod1();
+		
+		for (int i = 0; i < 5; i++) {
+			fObject->TestReadRTMethod2();
+		}
+	
+		usleep(50);
+		return true;
+	}
+};
+
+/*!
+\brief Non "Real-time" reader thread.
+*/
+
+struct ReaderThread : public TestThread {
+
+	ReaderThread(TestStateUser* state):TestThread(state)
+	{}
+	
+	bool Execute()
+	{
+		 fObject->TestReadMethod();
+         usleep(56);
+		 return true;
+	}
+};
+
+/*!
+\brief Writer thread.
+*/
+
+struct WriterThread : public TestThread {
+
+	WriterThread(TestStateUser* state):TestThread(state)
+	{}
+	
+	bool Execute()
+	{
+		fObject->TestWriteMethod();
+		usleep(75);
+		return true;
+	}
+};
+
+
+int main(int argc, char * const argv[])
+{
+	char c;
+	
+	printf("Test concurrent access to a TestState data structure protected with the 2 state JackAtomicState class\n"); 
+	
+	TestStateUser fObject;
+	WriterThread writer(&fObject);
+	RTReaderThread readerRT1(&fObject);
+  	ReaderThread reader1(&fObject);
+	
+	/*
+	ReaderThread reader2(&fObject);
+	ReaderThread reader3(&fObject);
+	ReaderThread reader4(&fObject);
+	ReaderThread reader5(&fObject);
+	ReaderThread reader6(&fObject);
+	*/
+
+	while ((c = getchar()) != 'q') {}
+	return 1;
+}
+
+
diff --git a/tests/testMutex.cpp b/tests/testMutex.cpp
new file mode 100644
index 0000000..234fd06
--- /dev/null
+++ b/tests/testMutex.cpp
@@ -0,0 +1,308 @@
+/*
+	Copyright (C) 2004-2008 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef __APPLE__
+#include "JackMachThread.h"
+#endif
+
+#include "JackPosixThread.h"
+#include "JackMutex.h"
+#include "thread.h"
+
+using namespace Jack;
+
+static void CleanupHandler(void * arg)
+{
+    JackLockAble* locked = (JackLockAble*)arg;
+    printf("CleanupHandler locked %px \n", locked);
+    locked->Unlock();
+}
+
+struct LockedObject : public JackLockAble {
+
+    int fCount;
+ 	
+	LockedObject():fCount(0)
+	{}
+    
+    virtual ~LockedObject()
+	{}
+    
+    /*
+    void LockedMethod1()
+    {   
+        JackLock lock(this);
+        fCount++;
+        printf("LockedMethod1 self %x fCount %d\n", pthread_self(), fCount);
+        if (fCount >= 1000) {
+            printf("Terminate self %x\n", pthread_self());
+            pthread_exit(NULL);
+        }
+   }
+    
+    void LockedMethod2()
+    {   
+        JackLock lock(this);
+        fCount++;
+        printf("LockedMethod2 self %x fCount %d\n", pthread_self(), fCount);
+        if (fCount >= 1500) {
+            printf("Terminate self %x\n", pthread_self());
+            pthread_exit(NULL);
+        }
+    }
+    
+    void LockedMethod3()
+    {   
+        JackLock lock(this);
+        fCount++;
+        printf("LockedMethod3 self %x fCount %d\n", pthread_self(), fCount);
+        if (fCount >= 3000) {
+            printf("Terminate self %x\n", pthread_self());
+            pthread_exit(NULL);
+        }
+    }
+    */
+    
+    void LockedMethod1()
+    {   
+        pthread_cleanup_push(CleanupHandler, this);
+        Lock();
+        fCount++;
+        //printf("LockedMethod1 self %x fCount %d\n", pthread_self(), fCount);
+        if (fCount >= 1000) {
+            printf("Terminate self = %px  count = %d\n", pthread_self(), fCount);
+            pthread_exit(NULL);
+        }
+        Unlock();
+        pthread_cleanup_pop(0);
+    }
+    
+    void LockedMethod2()
+    {   
+        pthread_cleanup_push(CleanupHandler, this);
+        Lock();
+
+        fCount++;
+        //printf("LockedMethod2 self %x fCount %d\n", pthread_self(), fCount);
+        if (fCount >= 1500) {
+            printf("Terminate self = %px  count = %d\n", pthread_self(), fCount);
+            pthread_exit(NULL);
+        }
+        Unlock();
+        pthread_cleanup_pop(0);
+    }
+    
+    void LockedMethod3()
+    {   
+        pthread_cleanup_push(CleanupHandler, this);
+        Lock();
+
+        fCount++;
+        //printf("LockedMethod3 self %x fCount %d\n", pthread_self(), fCount);
+        if (fCount >= 3000) {
+            printf("Terminate self = %px  count = %d\n", pthread_self(), fCount);
+            pthread_exit(NULL);
+        }
+        Unlock();
+        pthread_cleanup_pop(0);
+    }
+
+
+};
+
+struct TestThread : public JackRunnableInterface {
+
+	JackMachThread* fThread;
+    LockedObject* fObject;
+    int fNum;
+ 	
+	TestThread(LockedObject* obj, int num)
+	{
+        printf("TestThread\n");
+        fThread = new JackMachThread(this);
+        fObject = obj;
+        fNum = num;
+	    fThread->StartSync();
+   }
+
+	virtual ~TestThread()
+	{
+        printf("DELETE %px\n", fThread);
+        fThread->Kill();
+		delete fThread;
+	}
+     
+    bool Execute()
+    {
+		//printf("TestThread Execute\n");
+        switch (fNum) {
+        
+            case 1:
+                fObject->LockedMethod1();
+                /*
+                if (fObject->fCount >= 500) {
+                    printf("Terminate self %x\n", pthread_self());
+                    fThread->Terminate();
+                }
+                */
+                break;
+                
+            case 2:
+                fObject->LockedMethod2();
+                /*
+                if (fObject->fCount >= 1500) {
+                    printf("Terminate self %x\n", pthread_self());
+                    fThread->Terminate();
+                }
+                */
+                break;
+        
+            case 3:
+                fObject->LockedMethod3();
+                /*
+                if (fObject->fCount >= 2000) {
+                    printf("Terminate self %x\n", pthread_self());
+                    fThread->Terminate();
+                }
+                */
+                break;
+        };
+   		
+        //usleep(fNum * 1000);
+		return true;
+    }
+	
+};
+
+static void* TestThread1_Execute(void* arg);
+
+struct TestThread1 : public JackRunnableInterface {
+
+	pthread_t fThread;
+    LockedObject* fObject;
+    int fNum;
+ 	
+	TestThread1(LockedObject* obj, int num)
+	{
+        if (jack_client_create_thread(NULL, &fThread, 0, 0, TestThread1_Execute, this))
+			jack_error( "Can't create the network manager control thread." );
+        fObject = obj;
+        fNum = num;
+ 	}
+
+	virtual ~TestThread1()
+	{}
+     
+    bool Execute()
+    {
+		printf("TestThread Execute\n");
+        switch (fNum) {
+        
+            case 1:
+                fObject->LockedMethod1();
+                break;
+                
+            case 2:
+                fObject->LockedMethod2();
+                break;
+        
+            case 3:
+                fObject->LockedMethod3();
+                break;
+        };
+   		
+        //usleep(fNum * 1000);
+		return true;
+    }
+	
+};
+
+static void* TestThread1_Execute(void* arg)
+{
+    TestThread1* obj = (TestThread1*)arg;
+    
+    while (true) {
+        //printf("TestThread Execute\n");
+        switch (obj->fNum) {
+            
+                case 1:
+                    obj->fObject->LockedMethod1();
+                    break;
+                    
+                case 2:
+                    obj->fObject->LockedMethod2();
+                    break;
+            
+                case 3:
+                    obj->fObject->LockedMethod3();
+                    break;
+        };
+            
+        //usleep(obj->fNum * 1000);
+    }
+    
+    return 0;
+}
+
+int main (int argc, char * const argv[])
+{
+    char c;
+      
+    LockedObject obj;
+   
+    TestThread th1(&obj, 1);
+    TestThread th2(&obj, 2);
+    TestThread th3(&obj, 3);
+     
+    /*
+    LockedObject obj;
+    TestThread1 th1(&obj, 1);
+    TestThread th2(&obj, 2);
+    TestThread th3(&obj, 3);
+    */
+      
+    /*  
+    while ((c = getchar()) != 'q') {
+    
+    }
+    */
+    
+    while (true) {
+        usleep(1000);
+        th1.fThread->Kill();
+    }
+   
+    /*
+    th1.fThread->Kill();
+    th2.fThread->Kill();
+    th3.fThread->Kill();
+    
+     while (true) {
+        //usleep(100000);
+        th1.fThread->Kill();
+    }
+    */
+    
+}
diff --git a/tests/testSem.cpp b/tests/testSem.cpp
new file mode 100644
index 0000000..a3e9c4c
--- /dev/null
+++ b/tests/testSem.cpp
@@ -0,0 +1,208 @@
+/*
+	Copyright (C) 2004-2008 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __APPLE__
+#include "JackMachSemaphore.h"
+#endif
+
+#include "JackPosixSemaphore.h"
+#include "JackFifo.h"
+
+#include "JackPlatformPlug.h"
+
+#define ITER 500000
+
+using namespace Jack;
+
+struct ServerThread : public JackRunnableInterface {
+
+	JackThread* fThread;
+    detail::JackSynchro* fServerSem;
+    detail::JackSynchro* fClientSem;
+	
+	ServerThread()
+	{
+        fServerSem->Allocate("JackSemServer", "default", 0);
+        fClientSem->Allocate("JackSemClient", "default", 0);
+		//fThread = new JackMachThread(this);
+		fThread->SetParams(0, 500*1000, 500*1000);
+        fThread->Start();
+		//fThread->AcquireRealTime();
+	}
+
+	virtual ~ServerThread()
+	{
+        fThread->Kill();
+		delete fThread;
+	}
+     
+    bool Execute()
+    {
+		printf("Execute Server\n");
+   		for (int i = 0; i < ITER; i++) {
+			fClientSem->Signal();
+            fServerSem->Wait();
+		}
+		return true;
+    }
+	
+};
+
+struct ClientThread : public JackRunnableInterface {
+
+	JackThread* fThread;
+    detail::JackSynchro* fServerSem;
+    detail::JackSynchro* fClientSem;
+	
+	ClientThread()
+	{
+        fServerSem->Connect("JackSemServer", "default");
+        fClientSem->Connect("JackSemClient", "default");
+		//fThread = new JackMachThread(this);
+		fThread->SetParams(0, 500*1000, 500*1000);
+		fThread->Start();
+		//fThread->AcquireRealTime();
+	}
+
+	virtual ~ClientThread()
+	{
+		fThread->Kill();
+		delete fThread;
+	}
+    
+    bool Execute()
+    {
+		struct timeval T0, T1;
+        printf("Execute Client\n");
+        fClientSem->Wait();
+    	gettimeofday(&T0, 0); 
+		 
+		for (int i = 0; i < ITER; i++) {
+			fServerSem->Signal();
+            fClientSem->Wait();
+		}
+		
+		gettimeofday(&T1, 0); 
+		printf("%5.1lf usec\n", (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec) / (2.0 * ITER));
+		return true;
+    }
+	
+};
+
+void server(detail::JackSynchro* sem)
+{
+	char c;
+	printf("server\n");
+	
+	sem->Allocate("JackSem", "default", 0);
+	
+	while (((c = getchar()) != 'q')) {
+	
+		switch(c) {
+		
+			case 's':
+				printf("SynchroSignal....\n");
+				//sem->Signal();
+				sem->SignalAll();
+				printf("SynchroSignal OK\n");
+				break;
+				
+			case 'w':
+				printf("SemaphoreWait....\n");
+				sem->Wait();
+				printf("SemaphoreWait OK\n");
+				break;
+		}
+	}
+}
+
+void client(detail::JackSynchro* sem)
+{
+	char c;
+	printf("client\n");
+	
+	sem->Connect("JackSem", "default");
+	
+	while (((c = getchar()) != 'q')) {
+	
+		switch(c) {
+		
+			case 's':
+				printf("SemaphoreSignal....\n");
+				sem->Signal();
+				printf("SemaphoreSignal OK\n");
+				break;
+				
+			case 'w':
+				printf("SemaphoreWait....\n");
+				sem->Wait();
+				printf("SemaphoreWait OK\n");
+				break;
+		}
+	}
+}
+
+int main (int argc, char * const argv[])
+{
+    char c;
+    ServerThread* serverthread = NULL;
+    ClientThread* clientthread = NULL;
+    detail::JackSynchro* sem1 = NULL;
+	
+	if (strcmp(argv[1],"-s") == 0) {
+		printf("Posix semaphore\n");
+		sem1 = new JackPosixSemaphore();
+	}
+			
+	if (strcmp(argv[1],"-f") == 0) {
+		printf("Fifo\n");
+		sem1 = new JackFifo();
+	}
+
+#ifdef __APPLE__			
+	if (strcmp(argv[1],"-m") == 0) {
+		printf("Mach semaphore\n");
+		sem1 = new JackMachSemaphore();
+	}
+#endif 
+	
+	/*  
+    if (strcmp(argv[2], "server") == 0) {
+		serverthread = new ServerThread();
+    } else {
+		clientthread = new ClientThread();
+    }
+	*/
+	
+	if (strcmp(argv[2], "server") == 0) {
+		server(sem1);
+    } else {
+		client(sem1);
+    }
+    
+    while (((c = getchar()) != 'q')) {}
+    
+    delete serverthread;
+    delete clientthread;
+}
diff --git a/tests/testSynchroClient.cpp b/tests/testSynchroClient.cpp
new file mode 100644
index 0000000..6da201c
--- /dev/null
+++ b/tests/testSynchroClient.cpp
@@ -0,0 +1,167 @@
+/*
+	Copyright (C) 2004-2008 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef WIN32
+
+#else
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <sys/time.h>
+#include <time.h>
+
+#endif
+
+#ifdef __APPLE__
+	#include "JackMachSemaphore.h"
+#endif
+
+#ifdef WIN32
+	#include "JackWinEvent.h"
+#endif
+
+#ifdef linux
+	#include "JackPosixSemaphore.h"
+	#include "JackFifo.h"
+#endif
+
+#include "JackPlatformPlug.h"
+
+#define ITER 1000
+
+#define SERVER "serveur3"
+#define CLIENT "client3"
+
+using namespace Jack;
+
+class Test2 : public JackRunnableInterface
+{
+
+    private:
+
+        detail::JackSynchro* fSynchro1;
+        detail::JackSynchro* fSynchro2;
+
+    public:
+
+        Test2(detail::JackSynchro* synchro1, detail::JackSynchro* synchro2)
+                : fSynchro1(synchro1), fSynchro2(synchro2)
+        {}
+
+        bool Execute()
+        {
+			int a = 1;
+            for (int i = 0; i < ITER; i++) {
+                fSynchro2->Wait();
+				for (int j = 0; j < 2000000; j++) {
+					 a += j;
+				}
+                fSynchro1->Signal();
+            }
+            return true;
+        }
+
+};
+
+int main(int ac, char *av [])
+{
+    Test2* obj;
+    detail::JackSynchro* sem1 = NULL;
+    detail::JackSynchro* sem2 = NULL;
+    JackThread* thread;
+
+    printf("Test of synchronization primitives : client side\n");
+    printf("type -s to test Posix semaphore\n");
+    printf("type -f to test Fifo\n");
+    printf("type -m to test Mach semaphore\n");
+    printf("type -e to test Windows event\n");
+
+#ifdef __APPLE__
+    if (strcmp(av[1], "-m") == 0) {
+        printf("Mach semaphore\n");
+        sem1 = new JackMachSemaphore();
+        sem2 = new JackMachSemaphore();
+    }
+#endif
+
+#ifdef WIN32
+    if (strcmp(av[1], "-e") == 0) {
+        printf("Win event\n");
+        sem1 = new JackWinEvent();
+        sem2 = new JackWinEvent();
+    }
+#endif
+
+#ifdef linux
+    if (strcmp(av[1], "-s") == 0) {
+        printf("Posix semaphore\n");
+        sem1 = new JackPosixSemaphore();
+        sem2 = new JackPosixSemaphore();
+    }
+
+    if (strcmp(av[1], "-f") == 0) {
+        printf("Fifo\n");
+        sem1 = new JackFifo();
+        sem2 = new JackFifo();
+    }
+#endif
+
+    if (!sem1->ConnectOutput(SERVER, "default"))
+        return -1;
+    if (!sem2->ConnectInput(CLIENT, "default"))
+        return -1;
+
+    obj = new Test2(sem1, sem2);
+
+#ifdef __APPLE__
+    thread = new JackMachThread(obj, 10000 * 1000, 500 * 1000, 10000 * 1000);
+#endif
+
+#ifdef WIN32
+    thread = new JackWinThread(obj);
+#endif
+
+#ifdef linux
+    thread = new JackPosixThread(obj, false, 50, PTHREAD_CANCEL_DEFERRED);
+#endif
+
+    thread->Start();
+    thread->AcquireRealTime();
+#ifdef WIN32
+    Sleep(30 * 1000);
+#else
+    sleep(30);
+#endif
+    //thread->Stop();
+    thread->Kill();
+    sem1->Disconnect();
+    sem2->Disconnect();
+    delete obj;
+    delete thread;
+    delete sem1;
+    delete sem2;
+    return 0;
+}
+
diff --git a/tests/testSynchroServer.cpp b/tests/testSynchroServer.cpp
new file mode 100644
index 0000000..561988d
--- /dev/null
+++ b/tests/testSynchroServer.cpp
@@ -0,0 +1,223 @@
+/*
+	Copyright (C) 2004-2008 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef WIN32
+
+#else
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <sys/time.h>
+#include <time.h>
+
+#endif
+
+#ifdef __APPLE__
+	#include "JackMachSemaphore.h"
+#endif
+
+#ifdef WIN32
+	#include "JackWinEvent.h"
+#endif
+
+#ifdef linux
+	#include "JackPosixSemaphore.h"
+	#include "JackFifo.h"
+#endif
+
+#include "JackPlatformPlug.h"
+
+#define ITER 1000
+
+#define SERVER "serveur3"
+#define CLIENT "client3"
+
+using namespace Jack;
+
+#ifdef WIN32
+LARGE_INTEGER gFreq;
+long gQueryOverhead;
+
+static long elapsed (LARGE_INTEGER* t1, LARGE_INTEGER* t2)
+{
+    long high = t1->HighPart - t2->HighPart;
+    double low = t1->LowPart - t2->LowPart;
+    // ignore values when high part changes
+    return high ? 0 : (long)((low * 1000000) / gFreq.LowPart);
+}
+
+static BOOL overhead (long * overhead)
+{
+    LARGE_INTEGER t1, t2;
+    BOOL r1, r2;
+    int i = 50;
+    r1 = QueryPerformanceCounter (&t1);
+    while (i--)
+        QueryPerformanceCounter (&t2);
+    r2 = QueryPerformanceCounter (&t2);
+    if (!r1 || !r2)
+        return FALSE;
+    *overhead = elapsed(&t2, &t1) / 50;
+    return TRUE;
+}
+
+#endif
+
+class Test1 : public JackRunnableInterface
+{
+
+    private:
+
+        detail::JackSynchro* fSynchro1;
+        detail::JackSynchro* fSynchro2;
+
+    public:
+
+        Test1(detail::JackSynchro* synchro1, detail::JackSynchro* synchro2)
+                : fSynchro1(synchro1), fSynchro2(synchro2)
+        {}
+
+        bool Execute()
+        {
+
+	#ifdef WIN32
+            LARGE_INTEGER t1, t2;
+            BOOL r1, r2;
+            r1 = QueryPerformanceCounter(&t1);
+	#else
+           struct timeval T0, T1;
+            clock_t time1, time2;
+            // Get total time for 2 * ITER process swaps
+            time1 = clock();
+            gettimeofday(&T0, 0);
+	#endif
+            printf("Execute loop\n");
+            for (int i = 0; i < ITER; i++) {
+                fSynchro2->Signal();
+                fSynchro1->Wait();
+            }
+
+	#ifdef WIN32
+            r2 = QueryPerformanceCounter (&t2);
+            elapsed(&t2, &t1);
+            printf ("%5.1lf usec for inter process swap\n", elapsed(&t2, &t1) / (2.0 * ITER));
+	#else
+            time2 = clock();
+            gettimeofday(&T1, 0);
+            printf ("%5.1lf usec for inter process swap\n", (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec) / (2.0 * ITER));
+            printf ("%f usec for inter process swap \n", (1e6 * ((time2 - time1) / (double(CLOCKS_PER_SEC)))) / (2.0 * ITER));
+	#endif
+           return true;
+        }
+
+};
+
+int main(int ac, char *av [])
+{
+    Test1* obj;
+    detail::JackSynchro* sem1 = NULL;
+    detail::JackSynchro* sem2 = NULL;
+    JackThread* thread;
+
+#ifdef WIN32
+    if (!QueryPerformanceFrequency (&gFreq) ||
+            !overhead (&gQueryOverhead)) {
+        printf ("cannot query performance counter\n");
+    }
+#endif
+
+    printf("Test of synchronization primitives : server side\n");
+    printf("type -s to test Posix semaphore\n");
+    printf("type -f to test Fifo\n");
+    printf("type -m to test Mach semaphore\n");
+    printf("type -e to test Windows event\n");
+
+#ifdef __APPLE__
+    if (strcmp(av[1], "-m") == 0) {
+        printf("Mach semaphore\n");
+        sem1 = new JackMachSemaphore();
+        sem2 = new JackMachSemaphore();
+    }
+#endif
+
+#ifdef WIN32
+    if (strcmp(av[1], "-e") == 0) {
+        printf("Win event\n");
+        sem1 = new JackWinEvent();
+        sem2 = new JackWinEvent();
+    }
+#endif
+
+#ifdef linux
+    if (strcmp(av[1], "-s") == 0) {
+        printf("Posix semaphore\n");
+        sem1 = new JackPosixSemaphore();
+        sem2 = new JackPosixSemaphore();
+    }
+
+    if (strcmp(av[1], "-f") == 0) {
+        printf("Fifo\n");
+        sem1 = new JackFifo();
+        sem2 = new JackFifo();
+    }
+#endif
+
+    if (!sem1->Allocate(SERVER, "default", 0))
+        return -1;
+    if (!sem2->Allocate(CLIENT, "default", 0))
+        return -1;
+
+    // run test in RT thread
+    obj = new Test1(sem1, sem2);
+
+#ifdef __APPLE__
+    thread = new JackMachThread(obj, 10000 * 1000, 500 * 1000, 10000 * 1000);
+#endif
+
+#ifdef  WIN32
+    thread = new JackWinThread(obj);
+#endif
+
+#ifdef linux
+    thread = new JackPosixThread(obj, false, 50, PTHREAD_CANCEL_DEFERRED);
+#endif
+
+    thread->Start();
+    thread->AcquireRealTime();
+#ifdef  WIN32
+	Sleep(90 * 1000);
+#else
+    sleep(30);
+#endif
+
+    thread->Stop();
+    sem1->Destroy();
+    sem2->Destroy();
+    delete obj;
+    delete thread;
+    delete sem1;
+    delete sem2;
+    return 0;
+}
diff --git a/tests/testSynchroServerClient.cpp b/tests/testSynchroServerClient.cpp
new file mode 100644
index 0000000..1e1f460
--- /dev/null
+++ b/tests/testSynchroServerClient.cpp
@@ -0,0 +1,259 @@
+/*
+	Copyright (C) 2004-2008 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful, 
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef WIN32
+
+#else
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <sys/time.h>
+#include <time.h>
+
+#endif
+
+#ifdef __APPLE__
+	#include "JackMachSemaphore.h"
+#endif
+
+#ifdef WIN32
+	#include "JackWinEvent.h"
+#endif
+
+#ifdef linux
+	#include "JackPosixSemaphore.h"
+	#include "JackFifo.h"
+#endif
+
+#include "JackPlatformPlug.h"
+
+#define ITER 100000
+
+#define SERVER "serveur1"
+#define CLIENT "client1"
+
+using namespace Jack;
+
+#ifdef WIN32
+LARGE_INTEGER gFreq;
+long gQueryOverhead;
+
+static long elapsed (LARGE_INTEGER * t1, LARGE_INTEGER *t2)
+{
+    long high = t1->HighPart - t2->HighPart;
+    double low = t1->LowPart - t2->LowPart;
+    // ignore values when high part changes
+    return high ? 0 : (long)((low * 1000000) / gFreq.LowPart);
+}
+
+static BOOL overhead (long * overhead)
+{
+    LARGE_INTEGER t1, t2;
+    BOOL r1, r2;
+    int i = 50;
+    r1 = QueryPerformanceCounter (&t1);
+    while (i--)
+        QueryPerformanceCounter (&t2);
+    r2 = QueryPerformanceCounter (&t2);
+    if (!r1 || !r2)
+        return FALSE;
+    *overhead = elapsed(&t2, &t1) / 50;
+    return TRUE;
+}
+
+#endif
+
+template <typename sync_type>
+class Test1 : public JackRunnableInterface
+{
+
+    private:
+
+        sync_type* fSynchro1;
+        sync_type* fSynchro2;
+
+    public:
+
+        Test1(sync_type* synchro1, sync_type* synchro2)
+                : fSynchro1(synchro1), fSynchro2(synchro2)
+        {}
+
+        bool Execute()
+        {
+
+		#ifdef WIN32
+            LARGE_INTEGER t1, t2;
+            BOOL r1, r2;
+            r1 = QueryPerformanceCounter (&t1);
+		#else
+			struct timeval T0, T1;
+            clock_t time1, time2;
+            // Get total time for 2 * ITER process swaps
+            time1 = clock();
+            gettimeofday(&T0, 0);
+		#endif
+
+            printf("Execute loop Test1\n");
+            for (int i = 0; i < ITER; i++) {
+                fSynchro2->Signal();
+                fSynchro1->Wait();
+            }
+
+		#ifdef WIN32
+            r2 = QueryPerformanceCounter (&t2);
+            elapsed(&t2, &t1);
+            printf ("%5.1lf usec for inter process swap\n", elapsed(&t2, &t1) / (2.0 * ITER));
+		#else
+			time2 = clock();
+            gettimeofday(&T1, 0);
+            printf ("%5.1lf usec for inter process swap\n", (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec) / (2.0 * ITER));
+            printf ("%f usec for inter process swap \n", (1e6 * ((time2 - time1) / (double(CLOCKS_PER_SEC)))) / (2.0 * ITER));
+		#endif
+            return true;
+        }
+
+};
+
+template <typename sync_type>
+class Test2 : public JackRunnableInterface
+{
+
+    private:
+
+        sync_type* fSynchro1;
+        sync_type* fSynchro2;
+
+    public:
+
+        Test2(sync_type* synchro1, sync_type* synchro2)
+                : fSynchro1(synchro1), fSynchro2(synchro2)
+        {}
+
+        bool Execute()
+        {
+            printf("Execute loop Test2\n");
+            for (int i = 0; i < ITER; i++) {
+                fSynchro2->Wait();
+                fSynchro1->Signal();
+            }
+            return true;
+        }
+
+};
+
+template <typename sync_type>
+void run_tests(void)
+{
+    sync_type sem1, sem2, sem3, sem4;
+
+    sem1.Allocate(SERVER, "default", 0);
+    sem2.Allocate(CLIENT, "default", 0);
+    sem3.ConnectOutput(SERVER, "default");
+    sem4.ConnectInput(CLIENT, "default");
+
+    Test1<sync_type> obj1(&sem1, &sem2);
+    Test2<sync_type> obj2(&sem3, &sem4);
+
+    JackThread* thread1;
+    JackThread* thread2;
+
+#ifdef __APPLE__
+    thread1 = new JackMachThread(&obj1, 10000 * 1000, 500 * 1000, 10000 * 1000);
+    thread2 = new JackMachThread(&obj2, 10000 * 1000, 500 * 1000, 10000 * 1000);
+#endif
+
+#ifdef  WIN32
+    thread1 = new JackWinThread(&obj1);
+    thread2 = new JackWinThread(&obj2);
+#endif
+
+#ifdef linux
+    thread1 = new JackPosixThread(&obj1, false, 50, PTHREAD_CANCEL_DEFERRED);
+    thread2 = new JackPosixThread(&obj2, false, 50, PTHREAD_CANCEL_DEFERRED);
+#endif
+    thread1->Start();
+    thread2->Start();
+    //thread1->AcquireRealTime();
+    //thread2->AcquireRealTime();
+#ifdef  WIN32
+    Sleep(30 * 1000);
+#else
+    sleep (30);
+#endif
+
+    thread1->Stop();
+    thread2->Stop();
+    sem3.Disconnect();
+    sem4.Disconnect();
+    sem1.Destroy();
+    sem2.Destroy();
+
+    delete thread1;
+    delete thread2;
+}
+
+int main(int ac, char *av [])
+{
+#ifdef WIN32
+    if (!QueryPerformanceFrequency (&gFreq) ||
+            !overhead (&gQueryOverhead)) {
+        printf ("cannot query performance counter\n");
+    }
+#endif
+
+    printf("Test of synchronization primitives : inside a process\n");
+    printf("type -s to test Posix semaphore\n");
+    printf("type -f to test Fifo\n");
+    printf("type -m to test Mach semaphore\n");
+    printf("type -e to test Windows event\n");
+
+#ifdef __APPLE__
+    if (strcmp(av[1], "-m") == 0) {
+        printf("Mach semaphore\n");
+        run_tests<JackMachSemaphore>();
+    }
+#endif
+
+#ifdef WIN32
+    if (strcmp(av[1], "-e") == 0) {
+        printf("Win event\n");
+        run_tests<JackWinEvent>();
+    }
+#endif
+
+#ifdef linux
+    if (strcmp(av[1], "-s") == 0) {
+        printf("Posix semaphore\n");
+        run_tests<JackPosixSemaphore>();
+    }
+
+    if (strcmp(av[1], "-f") == 0) {
+        printf("Fifo\n");
+        run_tests<JackFifo>();
+    }
+
+ #endif
+    return 0;
+}
diff --git a/tests/testThread.cpp b/tests/testThread.cpp
new file mode 100644
index 0000000..de012f7
--- /dev/null
+++ b/tests/testThread.cpp
@@ -0,0 +1,92 @@
+/*
+	Copyright (C) 2004-2005 Grame
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <exception>
+
+pthread_t fThread;
+char fName[256];
+int fFifo;
+
+void* ThreadHandler(void* arg)
+{
+	char c;
+	printf("ThreadHandler\n");
+	try {
+		while (1) {
+			read(fFifo, &c, sizeof(c));
+			sleep(1);
+			//pthread_testcancel();
+		}
+	} catch (std::exception e) {}
+}
+
+
+int main(int argc, char * const argv[])
+{
+ 	int res;
+	void* status;
+	struct stat statbuf;
+	
+	printf("Thread test\n");
+	std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+
+	sprintf(fName, "/tmp/fifo");
+
+	if (stat(fName, &statbuf)) {
+		if (errno == ENOENT) {
+			if (mkfifo(fName, 0666) < 0) {
+				printf("Cannot create inter-client FIFO [%s]\n", fName);
+				return 0;
+			}
+		} else {
+			printf("Cannot check on FIFO %s\n", fName);
+			return 0;
+		}
+	} else {
+		if (!S_ISFIFO(statbuf.st_mode)) {
+			printf("FIFO (%s) already exists, but is not a FIFO!\n", fName);
+			return 0;
+		}
+	}
+
+	if ((fFifo = open(fName, O_RDWR|O_CREAT, 0666)) < 0) {
+		printf("Cannot open fifo [%s]", fName);
+		return 0;
+	} 
+	
+    if (res = pthread_create(&fThread, 0, ThreadHandler, NULL)) {
+		printf("Cannot set create thread %d\n", res);
+		return 0;
+	}
+	
+	sleep(3);
+	printf("Cancel Thread\n");
+	pthread_cancel(fThread);
+	pthread_join(fThread, &status);
+}
diff --git a/tests/wscript b/tests/wscript
new file mode 100644
index 0000000..6693eba
--- /dev/null
+++ b/tests/wscript
@@ -0,0 +1,34 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+test_programs = {
+    # For testing purposes
+    #'synchroClient': ['testSynchroClient.cpp'],
+    #'synchroServer': ['testSynchroServer.cpp'],
+    #'synchroServerClient': ['testSynchroServerClient.cpp'],
+    #'testSem': ['testSem.cpp'],
+    'jack_test': ['test.cpp'],
+    'jack_cpu': ['cpu.c'],
+    'jack_delay': ['jdelay.cpp'],
+    'jack_multiple_metro' : ['external_metro.cpp'],
+    }
+
+def build(bld):
+    for test_program, test_program_sources in test_programs.items():
+        prog = bld.new_task_gen('cxx', 'program')
+        prog.features.append('cc')
+        if bld.env['IS_MACOSX']:
+	        prog.includes = ['..','../macosx', '../posix', '../common/jack', '../common']
+        if bld.env['IS_LINUX']:
+	        prog.includes = ['..','../linux', '../posix', '../common/jack', '../common']
+        if bld.env['IS_SUN']:
+	        prog.includes = ['..','../solaris', '../posix', '../common/jack', '../common']
+        prog.source = test_program_sources
+        if bld.env['IS_LINUX']:
+            prog.uselib = 'RT'
+        if bld.env['IS_MACOSX']:
+            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
+            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
+	    prog.env.append_value("LINKFLAGS", "")
+        prog.uselib_local = 'clientlib'
+        prog.target = test_program
diff --git a/tools/Makefile.am b/tools/Makefile.am
deleted file mode 100644
index 9ac94c4..0000000
--- a/tools/Makefile.am
+++ /dev/null
@@ -1,139 +0,0 @@
-MAINTAINERCLEANFILES    = Makefile.in
-
-if HAVE_READLINE
-JACK_TRANSPORT = jack_transport
-dist-check-readline:
-else
-JACK_TRANSPORT =
-dist-check-readline:
-	@echo
-	@echo ' ******' You need readline installed to make dist.' ******'
-	@echo
-	@false
-endif
-
-NETJACK_TOOLS = jack_netsource
-
-if HAVE_SAMPLERATE
-if HAVE_ALSA
-NETJACK_TOOLS += alsa_in alsa_out
-endif
-dist-check-samplerate:
-else
-dist-check-samplerate:
-	@echo
-	@echo ' ******' You need libsamplerate installed to make dist.' ******'
-	@echo
-	@false
-endif
-
-bin_PROGRAMS = jack_load \
-	       jack_unload \
-	       jack_monitor_client \
-	       jack_connect \
-	       jack_disconnect \
-	       jack_lsp \
-	       jack_freewheel \
-	       jack_evmon \
-	       jack_alias \
-	       jack_bufsize \
-	       jack_samplerate \
-	       jack_wait \
-	       $(JACK_TRANSPORT) \
-	       $(NETJACK_TOOLS)
-
-noinst_PROGRAMS = jack_thread_wait
-
-if HAVE_SNDFILE
-# note! jackrec_CFLAGS syntax not supported by automake-1.4
-sndfile_cflags = @SNDFILE_CFLAGS@
-endif
-
-AM_CFLAGS = -I.. $(JACK_CFLAGS) $(sndfile_cflags)
-AM_CXXFLAGS = -I.. $(JACK_CFLAGS) $(sndfile_cflags)
-
-jack_connect_SOURCES = connect.c
-jack_connect_LDFLAGS = @OS_LDFLAGS@
-jack_connect_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_disconnect_SOURCES = connect.c
-jack_disconnect_LDFLAGS = @OS_LDFLAGS@
-jack_disconnect_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_monitor_client_SOURCES = monitor_client.c
-jack_monitor_client_LDFLAGS = @OS_LDFLAGS@
-jack_monitor_client_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_thread_wait_SOURCES = tw.c
-jack_thread_wait_LDFLAGS = @OS_LDFLAGS@
-jack_thread_wait_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_wait_SOURCES = wait.c
-jack_wait_LDFLAGS = @OS_LDFLAGS@
-jack_wait_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_evmon_SOURCES = evmon.c
-jack_evmon_LDFLAGS = @OS_LDFLAGS@
-jack_evmon_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_alias_SOURCES = alias.c
-jack_alias_LDFLAGS = @OS_LDFLAGS@
-jack_alias_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_lsp_SOURCES = lsp.c
-jack_lsp_LDFLAGS = @OS_LDFLAGS@
-jack_lsp_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_freewheel_SOURCES = freewheel.c
-jack_freewheel_LDFLAGS = @OS_LDFLAGS@
-jack_freewheel_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_bufsize_SOURCES = bufsize.c
-jack_bufsize_LDFLAGS = @OS_LDFLAGS@
-jack_bufsize_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_samplerate_SOURCES = samplerate.c
-jack_samplerate_LDFLAGS = @OS_LDFLAGS@
-jack_samplerate_LDADD = $(top_builddir)/libjack/libjack.la
-
-if HAVE_READLINE
-jack_transport_SOURCES = transport.c
-jack_transport_LDFLAGS = -lreadline @READLINE_DEPS@ @OS_LDFLAGS@
-jack_transport_LDADD = $(top_builddir)/libjack/libjack.la
-endif
-
-#
-# General purpose in-process loader/unloader
-#
-
-jack_load_SOURCES = ipload.c
-jack_load_LDFLAGS = @OS_LDFLAGS@
-jack_load_LDADD = $(top_builddir)/libjack/libjack.la
-
-jack_unload_SOURCES = ipunload.c
-jack_unload_LDFLAGS = @OS_LDFLAGS@
-jack_unload_LDADD = $(top_builddir)/libjack/libjack.la
-
-#
-# Netjack slave tools
-#
-jack_netsource_SOURCES = netsource.c $(top_builddir)/drivers/netjack/netjack_packet.c
-jack_netsource_CFLAGS = @NETJACK_CFLAGS@ -I$(top_srcdir)/drivers/netjack
-jack_netsource_LDFLAGS = @NETJACK_LIBS@ @OS_LDFLAGS@ 
-jack_netsource_LDADD = $(top_builddir)/libjack/libjack.la
-
-if HAVE_SAMPLERATE
-if HAVE_ALSA
-alsa_in_SOURCES = alsa_in.c $(top_builddir)/drivers/alsa/memops.c
-alsa_in_CFLAGS = @NETJACK_CFLAGS@ -I$(top_builddir)/drivers/alsa
-alsa_in_LDFLAGS = -lasound -lsamplerate @OS_LDFLAGS@
-alsa_in_LDADD = $(top_builddir)/libjack/libjack.la
-
-alsa_out_SOURCES = alsa_out.c $(top_builddir)/drivers/alsa/memops.c
-alsa_out_CFLAGS = @NETJACK_CFLAGS@ -I$(top_builddir)/drivers/alsa
-alsa_out_LDFLAGS = -lasound -lsamplerate @OS_LDFLAGS@
-alsa_out_LDADD = $(top_builddir)/libjack/libjack.la
-endif #HAVE_ALSA
-endif #HAVE_SAMPLERATE
-
-# XXX ? dist-hook: dist-check-sndfile dist-check-samplerate
diff --git a/tools/alias.c b/tools/alias.c
deleted file mode 100644
index 5a5d523..0000000
--- a/tools/alias.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-
-#include <config.h>
-
-#include <jack/jack.h>
-
-char * my_name;
-
-void
-show_version (void)
-{
-	fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n",
-		my_name);
-}
-
-void
-show_usage (void)
-{
-	show_version ();
-	fprintf (stderr, "\nUsage: %s [options] portname alias\n", my_name);
-	fprintf (stderr, "List active Jack ports, and optionally display extra information.\n\n");
-	fprintf (stderr, "Display options:\n");
-	fprintf (stderr, "        -u, --unalias         remove `alias' as an alias for `port'\n");
-	fprintf (stderr, "        -h, --help            Display this help message\n");
-	fprintf (stderr, "        --version             Output version information and exit\n\n");
-	fprintf (stderr, "For more information see http://jackaudio.org/\n");
-}
-
-int
-main (int argc, char *argv[])
-{
-	jack_client_t *client;
-	jack_status_t status;
-	char* portname;
-	char* alias;
-	int unset = 0;
-	int ret;
-	int c;
-	int option_index;
-	extern int optind;
-	jack_port_t* port;
-	
-	struct option long_options[] = {
-		{ "unalias", 0, 0, 'u' },
-		{ "help", 0, 0, 'h' },
-		{ "version", 0, 0, 'v' },
-		{ 0, 0, 0, 0 }
-	};
-
-	if (argc < 3) {
-		show_usage ();
-		return 1;
-	}
-
-	my_name = strrchr(argv[0], '/');
-	if (my_name == 0) {
-		my_name = argv[0];
-	} else {
-		my_name ++;
-	}
-
-	while ((c = getopt_long (argc, argv, "uhv", long_options, &option_index)) >= 0) {
-		switch (c) {
-		case 'u':
-			unset = 1;
-			break;
-		case 'h':
-			show_usage ();
-			return 1;
-			break;
-		case 'v':
-			show_version ();
-			return 1;
-			break;
-		default:
-			show_usage ();
-			return 1;
-			break;
-		}
-	}
-
-	portname = argv[optind++];
-	alias = argv[optind];
-
-	/* Open a client connection to the JACK server.  Starting a
-	 * new server only to list its ports seems pointless, so we
-	 * specify JackNoStartServer. */
-	//JOQ: need a new server name option
-
-	client = jack_client_open ("lsp", JackNoStartServer, &status);
-
-	if (client == NULL) {
-		if (status & JackServerFailed) {
-			fprintf (stderr, "JACK server not running\n");
-		} else {
-			fprintf (stderr, "jack_client_open() failed, "
-				 "status = 0x%2.0x\n", status);
-		}
-		return 1;
-	}
-
-	if ((port = jack_port_by_name (client, portname)) == 0) {
-		fprintf (stderr, "No port named \"%s\"\n", portname);
-		return 1;
-	}
-
-	if (!unset) {
-		ret = jack_port_set_alias (port, alias);
-	} else {
-		ret = jack_port_unset_alias (port, alias);
-	}
-
-	jack_client_close (client);
-
-	return ret;
-	
-}
diff --git a/tools/alsa_in.c b/tools/alsa_in.c
deleted file mode 100644
index ba29764..0000000
--- a/tools/alsa_in.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/** @file simple_client.c
- *
- * @brief This simple client demonstrates the basic features of JACK
- * as they would be used by many applications.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include <math.h>
-
-#include <jack/jack.h>
-#include <jack/jslist.h>
-#include <jack/memops.h>
-
-#include "alsa/asoundlib.h"
-
-#include <samplerate.h>
-
-// Here are the lists of the jack ports...
-
-JSList	   *capture_ports = NULL;
-JSList	   *capture_srcs = NULL;
-JSList	   *playback_ports = NULL;
-JSList	   *playback_srcs = NULL;
-jack_client_t *client;
-
-snd_pcm_t *alsa_handle;
-
-int jack_sample_rate;
-int jack_buffer_size;
-
-int quit = 0;
-double resample_mean = 1.0;
-double static_resample_factor = 1.0;
-
-double *offset_array;
-double *window_array;
-int offset_differential_index = 0;
-
-double offset_integral = 0;
-
-// ------------------------------------------------------ commandline parameters
-
-int sample_rate = 0;				 /* stream rate */
-int num_channels = 2;				 /* count of channels */
-int period_size = 1024;
-int num_periods = 2;
-
-int target_delay = 0;	    /* the delay which the program should try to approach. */
-int max_diff = 0;	    /* the diff value, when a hard readpointer skip should occur */
-int catch_factor = 100000;
-int catch_factor2 = 10000;
-double pclamp = 15.0;
-double controlquant = 10000.0;
-int smooth_size = 256;
-int good_window=0;
-int verbose = 0;
-int instrument = 0;
-int samplerate_quality = 2;
-
-// Debug stuff:
-
-volatile float output_resampling_factor = 1.0;
-volatile int output_new_delay = 0;
-volatile float output_offset = 0.0;
-volatile float output_integral = 0.0;
-volatile float output_diff = 0.0;
-
-snd_pcm_uframes_t real_buffer_size;
-snd_pcm_uframes_t real_period_size;
-
-// format selection, and corresponding functions from memops in a nice set of structs.
-
-typedef struct alsa_format {
-	snd_pcm_format_t format_id;
-	size_t sample_size;
-	void (*jack_to_soundcard) (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-	void (*soundcard_to_jack) (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-	const char *name;
-} alsa_format_t;
-
-alsa_format_t formats[] = {
-	{ SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" },
-	{ SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" },
-	{ SND_PCM_FORMAT_S24_3LE, 3, sample_move_d24_sS, sample_move_dS_s24, "24bit - real" },
-	{ SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" },
-	{ SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" }
-};
-#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
-int format=0;
-
-// Alsa stuff... i dont want to touch this bullshit in the next years.... please...
-
-static int xrun_recovery(snd_pcm_t *handle, int err) {
-//    printf( "xrun !!!.... %d\n", err );
-	if (err == -EPIPE) {	/* under-run */
-		err = snd_pcm_prepare(handle);
-		if (err < 0)
-			printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
-		return 0;
-	} else if (err == -EAGAIN) {
-		while ((err = snd_pcm_resume(handle)) == -EAGAIN)
-			usleep(100);	/* wait until the suspend flag is released */
-		if (err < 0) {
-			err = snd_pcm_prepare(handle);
-			if (err < 0)
-				printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
-		}
-		return 0;
-	}
-	return err;
-}
-
-static int set_hwformat( snd_pcm_t *handle, snd_pcm_hw_params_t *params )
-{
-	int i;
-	int err;
-
-	for( i=0; i<NUMFORMATS; i++ ) {
-		/* set the sample format */
-		err = snd_pcm_hw_params_set_format(handle, params, formats[i].format_id);
-		if (err == 0) {
-			format = i;
-			return 0;
-		}
-	}
-
-	return err;
-}
-
-static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access, int rate, int channels, int period, int nperiods ) {
-	int err, dir=0;
-	unsigned int buffer_time;
-	unsigned int period_time;
-	unsigned int rrate;
-	unsigned int rchannels;
-
-	/* choose all parameters */
-	err = snd_pcm_hw_params_any(handle, params);
-	if (err < 0) {
-		printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* set the interleaved read/write format */
-	err = snd_pcm_hw_params_set_access(handle, params, access);
-	if (err < 0) {
-		printf("Access type not available for playback: %s\n", snd_strerror(err));
-		return err;
-	}
-
-	/* set the sample format */
-	err = set_hwformat(handle, params);
-	if (err < 0) {
-		printf("Sample format not available for playback: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* set the count of channels */
-	rchannels = channels;
-	err = snd_pcm_hw_params_set_channels_near(handle, params, &rchannels);
-	if (err < 0) {
-		printf("Channels count (%i) not available for record: %s\n", channels, snd_strerror(err));
-		return err;
-	}
-	if (rchannels != channels) {
-		printf("WARNING: chennel count does not match (requested %d got %d)\n", channels, rchannels);
-		num_channels = rchannels;
-	}
-	/* set the stream rate */
-	rrate = rate;
-	err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
-	if (err < 0) {
-		printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
-		return err;
-	}
-	if (rrate != rate) {
-		printf("WARNING: Rate doesn't match (requested %iHz, get %iHz)\n", rate, rrate);
-		sample_rate = rrate;
-	}
-	/* set the buffer time */
-
-	buffer_time = 1000000*period*nperiods/rate;
-	err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir);
-	if (err < 0) {
-		printf("Unable to set buffer time %i for playback: %s\n",  1000000*period*nperiods/rate, snd_strerror(err));
-		return err;
-	}
-	err = snd_pcm_hw_params_get_buffer_size( params, &real_buffer_size );
-	if (err < 0) {
-		printf("Unable to get buffer size back: %s\n", snd_strerror(err));
-		return err;
-	}
-	if( real_buffer_size != nperiods * period ) {
-	    printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size );
-	}
-	/* set the period time */
-	period_time = 1000000*period/rate;
-	err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
-	if (err < 0) {
-		printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err));
-		return err;
-	}
-	err = snd_pcm_hw_params_get_period_size(params, &real_period_size, NULL );
-	if (err < 0) {
-		printf("Unable to get period size back: %s\n", snd_strerror(err));
-		return err;
-	}
-	if( real_period_size != period ) {
-	    printf( "WARNING: period size does not match: (requested %i, got %i)\n", period, (int)real_period_size );
-	}
-	/* write the parameters to device */
-	err = snd_pcm_hw_params(handle, params);
-	if (err < 0) {
-		printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
-		return err;
-	}
-	return 0;
-}
-
-static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, int period) {
-	int err;
-
-	/* get the current swparams */
-	err = snd_pcm_sw_params_current(handle, swparams);
-	if (err < 0) {
-		printf("Unable to determine current swparams for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* start the transfer when the buffer is full */
-	err = snd_pcm_sw_params_set_start_threshold(handle, swparams, period );
-	if (err < 0) {
-		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, -1 );
-	if (err < 0) {
-		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* allow the transfer when at least period_size samples can be processed */
-	err = snd_pcm_sw_params_set_avail_min(handle, swparams, 2*period );
-	if (err < 0) {
-		printf("Unable to set avail min for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* align all transfers to 1 sample */
-	err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
-	if (err < 0) {
-		printf("Unable to set transfer align for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* write the parameters to the playback device */
-	err = snd_pcm_sw_params(handle, swparams);
-	if (err < 0) {
-		printf("Unable to set sw params for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	return 0;
-}
-
-// ok... i only need this function to communicate with the alsa bloat api...
-
-static snd_pcm_t *open_audiofd( char *device_name, int capture, int rate, int channels, int period, int nperiods ) {
-  int err;
-  snd_pcm_t *handle;
-  snd_pcm_hw_params_t *hwparams;
-  snd_pcm_sw_params_t *swparams;
-
-  snd_pcm_hw_params_alloca(&hwparams);
-  snd_pcm_sw_params_alloca(&swparams);
-
-  if ((err = snd_pcm_open(&(handle), device_name, capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK )) < 0) {
-      printf("Capture open error: %s\n", snd_strerror(err));
-      return NULL;
-  }
-
-  if ((err = set_hwparams(handle, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED, rate, channels, period, nperiods )) < 0) {
-      printf("Setting of hwparams failed: %s\n", snd_strerror(err));
-      return NULL;
-  }
-  if ((err = set_swparams(handle, swparams, period)) < 0) {
-      printf("Setting of swparams failed: %s\n", snd_strerror(err));
-      return NULL;
-  }
-
-  snd_pcm_start( handle );
-  snd_pcm_wait( handle, 200 );
-
-  return handle;
-}
-
-double hann( double x )
-{
-	return 0.5 * (1.0 - cos( 2*M_PI * x ) );
-}
-
-/**
- * The process callback for this JACK application.
- * It is called by JACK at the appropriate times.
- */
-int process (jack_nframes_t nframes, void *arg) {
-
-    char *outbuf;
-    float *resampbuf;
-    int rlen;
-    int err;
-    snd_pcm_sframes_t delay = target_delay;
-    int put_back_samples=0;
-    int i;
-
-    delay = snd_pcm_avail( alsa_handle );
-
-    delay -= jack_frames_since_cycle_start( client );
-    // Do it the hard way.
-    // this is for compensating xruns etc...
-
-    if( delay > (target_delay+max_diff) ) {
-	char *tmp = alloca( (delay-target_delay) * formats[format].sample_size * num_channels ); 
-	snd_pcm_readi( alsa_handle, tmp, delay-target_delay );
-	output_new_delay = (int) delay;
-
-	delay = target_delay;
-
-	// Set the resample_rate... we need to adjust the offset integral, to do this.
-	// first look at the PI controller, this code is just a special case, which should never execute once
-	// everything is swung in. 
-	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
-	// Also clear the array. we are beginning a new control cycle.
-	for( i=0; i<smooth_size; i++ )
-		offset_array[i] = 0.0;
-    }
-    if( delay < (target_delay-max_diff) ) {
-	snd_pcm_rewind( alsa_handle, target_delay - delay );
-	output_new_delay = (int) delay;
-	delay = target_delay;
-
-	// Set the resample_rate... we need to adjust the offset integral, to do this.
-	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
-	// Also clear the array. we are beginning a new control cycle.
-	for( i=0; i<smooth_size; i++ )
-		offset_array[i] = 0.0;
-    }
-    /* ok... now we should have target_delay +- max_diff on the alsa side.
-     *
-     * calculate the number of frames, we want to get.
-     */
-
-    double offset = delay - target_delay;
-
-    // Save offset.
-    offset_array[(offset_differential_index++)% smooth_size ] = offset;
-
-    // Build the mean of the windowed offset array
-    // basically fir lowpassing.
-    double smooth_offset = 0.0;
-    for( i=0; i<smooth_size; i++ )
-	    smooth_offset +=
-		    offset_array[ (i + offset_differential_index-1) % smooth_size] * window_array[i];
-    smooth_offset /= (double) smooth_size;
-
-    // this is the integral of the smoothed_offset
-    offset_integral += smooth_offset;
-
-    // Clamp offset.
-    // the smooth offset still contains unwanted noise
-    // which would go straigth onto the resample coeff.
-    // it only used in the P component and the I component is used for the fine tuning anyways.
-    if( fabs( smooth_offset ) < pclamp )
-	    smooth_offset = 0.0;
-
-    // ok. now this is the PI controller. 
-    // u(t) = K * ( e(t) + 1/T \int e(t') dt' )
-    // K = 1/catch_factor and T = catch_factor2
-    double current_resample_factor = static_resample_factor - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2;
-
-    // now quantize this value around resample_mean, so that the noise which is in the integral component doesnt hurt.
-    current_resample_factor = floor( (current_resample_factor - resample_mean) * controlquant + 0.5 ) / controlquant + resample_mean;
-
-    // Output "instrumentatio" gonna change that to real instrumentation in a few.
-    output_resampling_factor = (float) current_resample_factor;
-    output_diff = (float) smooth_offset;
-    output_integral = (float) offset_integral;
-    output_offset = (float) offset;
-
-    // Clamp a bit.
-    if( current_resample_factor < 0.25 ) current_resample_factor = 0.25;
-    if( current_resample_factor > 4 ) current_resample_factor = 4;
-
-    // Now Calculate how many samples we need.
-    rlen = ceil( ((double)nframes) / current_resample_factor )+2;
-    assert( rlen > 2 );
-
-    // Calculate resample_mean so we can init ourselves to saner values.
-    resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor;
-    /*
-     * now this should do it...
-     */
-
-    outbuf = alloca( rlen * formats[format].sample_size * num_channels );
-
-    resampbuf = alloca( rlen * sizeof( float ) );
-
-    // get the data...
-again:
-    err = snd_pcm_readi(alsa_handle, outbuf, rlen);
-    if( err < 0 ) {
-	printf( "err = %d\n", err );
-	if (xrun_recovery(alsa_handle, err) < 0) {
-	    //printf("Write error: %s\n", snd_strerror(err));
-	    //exit(EXIT_FAILURE);
-	}
-	goto again;
-    }
-    if( err != rlen ) {
-	//printf( "read = %d\n", rlen );
-    }
-
-    /*
-     * render jack ports to the outbuf...
-     */
-
-    int chn = 0;
-    JSList *node = capture_ports;
-    JSList *src_node = capture_srcs;
-    SRC_DATA src;
-
-    while ( node != NULL)
-    {
-	jack_port_t *port = (jack_port_t *) node->data;
-	float *buf = jack_port_get_buffer (port, nframes);
-
-	SRC_STATE *src_state = src_node->data;
-
-	formats[format].soundcard_to_jack( resampbuf, outbuf + format[formats].sample_size * chn, rlen, num_channels*format[formats].sample_size );
-
-	src.data_in = resampbuf;
-	src.input_frames = rlen;
-
-	src.data_out = buf;
-	src.output_frames = nframes;
-	src.end_of_input = 0;
-
-	src.src_ratio = current_resample_factor;
-
-	src_process( src_state, &src );
-
-	put_back_samples = rlen-src.input_frames_used;
-
-	src_node = jack_slist_next (src_node);
-	node = jack_slist_next (node);
-	chn++;
-    }
-
-    // Put back the samples libsamplerate did not consume.
-    //printf( "putback = %d\n", put_back_samples );
-    snd_pcm_rewind( alsa_handle, put_back_samples );
-
-    return 0;      
-}
-
-
-/**
- * Allocate the necessary jack ports...
- */
-
-void alloc_ports( int n_capture, int n_playback ) {
-
-    int port_flags = JackPortIsOutput;
-    int chn;
-    jack_port_t *port;
-    char buf[32];
-
-    capture_ports = NULL;
-    for (chn = 0; chn < n_capture; chn++)
-    {
-	snprintf (buf, sizeof(buf) - 1, "capture_%u", chn+1);
-
-	port = jack_port_register (client, buf,
-		JACK_DEFAULT_AUDIO_TYPE,
-		port_flags, 0);
-
-	if (!port)
-	{
-	    printf( "jacknet_client: cannot register port for %s", buf);
-	    break;
-	}
-
-	capture_srcs = jack_slist_append( capture_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
-	capture_ports = jack_slist_append (capture_ports, port);
-    }
-
-    port_flags = JackPortIsInput;
-
-    playback_ports = NULL;
-    for (chn = 0; chn < n_playback; chn++)
-    {
-	snprintf (buf, sizeof(buf) - 1, "playback_%u", chn+1);
-
-	port = jack_port_register (client, buf,
-		JACK_DEFAULT_AUDIO_TYPE,
-		port_flags, 0);
-
-	if (!port)
-	{
-	    printf( "jacknet_client: cannot register port for %s", buf);
-	    break;
-	}
-
-	playback_srcs = jack_slist_append( playback_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
-	playback_ports = jack_slist_append (playback_ports, port);
-    }
-}
-
-/**
- * This is the shutdown callback for this JACK application.
- * It is called by JACK if the server ever shuts down or
- * decides to disconnect the client.
- */
-
-void jack_shutdown (void *arg) {
-
-	exit (1);
-}
-
-/**
- * be user friendly.
- * be user friendly.
- * be user friendly.
- */
-
-void printUsage() {
-fprintf(stderr, "usage: alsa_out [options]\n"
-		"\n"
-		"  -j <jack name> - client name\n"
-		"  -d <alsa_device> \n"
-		"  -c <channels> \n"
-		"  -p <period_size> \n"
-		"  -n <num_period> \n"
-		"  -r <sample_rate> \n"
-		"  -q <sample_rate quality [0..4]\n"
-		"  -m <max_diff> \n"
-		"  -t <target_delay> \n"
-		"  -i  turns on instrumentation\n"
-		"  -v  turns on printouts\n"
-		"\n");
-}
-
-
-/**
- * the main function....
- */
-
-void
-sigterm_handler( int signal )
-{
-	quit = 1;
-}
-
-
-int main (int argc, char *argv[]) {
-    char jack_name[30] = "alsa_in";
-    char alsa_device[30] = "hw:0";
-
-    extern char *optarg;
-    extern int optind, optopt;
-    int errflg=0;
-    int c;
-
-    while ((c = getopt(argc, argv, "ivj:r:c:p:n:d:q:m:t:f:F:C:Q:s:")) != -1) {
-	switch(c) {
-	    case 'j':
-		strcpy(jack_name,optarg);
-		break;
-	    case 'r':
-		sample_rate = atoi(optarg);
-		break;
-	    case 'c':
-		num_channels = atoi(optarg);
-		break;
-	    case 'p':
-		period_size = atoi(optarg);
-		break;
-	    case 'n':
-		num_periods = atoi(optarg);
-		break;
-	    case 'd':
-		strcpy(alsa_device,optarg);
-		break;
-	    case 't':
-		target_delay = atoi(optarg);
-		break;
-	    case 'q':
-		samplerate_quality = atoi(optarg);
-		break;
-	    case 'm':
-		max_diff = atoi(optarg);
-		break;
-	    case 'f':
-		catch_factor = atoi(optarg);
-		break;
-	    case 'F':
-		catch_factor2 = atoi(optarg);
-		break;
-	    case 'C':
-		pclamp = (double) atoi(optarg);
-		break;
-	    case 'Q':
-		controlquant = (double) atoi(optarg);
-		break;
-	    case 'v':
-		verbose = 1;
-		break;
-	    case 'i':
-		instrument = 1;
-		break;
-	    case 's':
-		smooth_size = atoi(optarg);
-		break;
-	    case ':':
-		fprintf(stderr,
-			"Option -%c requires an operand\n", optopt);
-		errflg++;
-		break;
-	    case '?':
-		fprintf(stderr,
-			"Unrecognized option: -%c\n", optopt);
-		errflg++;
-	}
-    }
-    if (errflg) {
-	printUsage();
-	exit(2);
-    }
-
-    if( (samplerate_quality < 0) || (samplerate_quality > 4) ) {
-	fprintf (stderr, "invalid samplerate quality\n");
-	return 1;
-    }
-    if ((client = jack_client_open (jack_name, 0, NULL)) == 0) {
-	fprintf (stderr, "jack server not running?\n");
-	return 1;
-    }
-
-    /* tell the JACK server to call `process()' whenever
-       there is work to be done.
-       */
-
-    jack_set_process_callback (client, process, 0);
-
-    /* tell the JACK server to call `jack_shutdown()' if
-       it ever shuts down, either entirely, or if it
-       just decides to stop calling us.
-       */
-
-    jack_on_shutdown (client, jack_shutdown, 0);
-
-
-    // get jack sample_rate
-    
-    jack_sample_rate = jack_get_sample_rate( client );
-
-    if( !sample_rate )
-	sample_rate = jack_sample_rate;
-
-    // now open the alsa fd...
-    alsa_handle = open_audiofd( alsa_device, 1, sample_rate, num_channels, period_size, num_periods);
-    if( alsa_handle == 0 )
-	exit(20);
-
-    printf( "selected sample format: %s\n", formats[format].name );
-
-    static_resample_factor = (double) jack_sample_rate / (double) sample_rate;
-    resample_mean = static_resample_factor;
-
-    offset_array = malloc( sizeof(double) * smooth_size );
-    if( offset_array == NULL ) {
-	    fprintf( stderr, "no memory for offset_array !!!\n" );
-	    exit(20);
-    }
-    window_array = malloc( sizeof(double) * smooth_size );
-    if( window_array == NULL ) {
-	    fprintf( stderr, "no memory for window_array !!!\n" );
-	    exit(20);
-    }
-    int i;
-    for( i=0; i<smooth_size; i++ ) {
-	    offset_array[i] = 0.0;
-	    window_array[i] = hann( (double) i / ((double) smooth_size - 1.0) );
-    }
-
-    jack_buffer_size = jack_get_buffer_size( client );
-    // Setup target delay and max_diff for the normal user, who does not play with them...
-    if( !target_delay ) 
-	target_delay = (num_periods*period_size / 2) + jack_buffer_size/2;
-
-    if( !max_diff )
-	max_diff = num_periods*period_size - target_delay ;	
-
-    if( max_diff > target_delay ) {
-	    fprintf( stderr, "target_delay (%d) cant be smaller than max_diff(%d)\n", target_delay, max_diff );
-	    exit(20);
-    }
-    if( (target_delay+max_diff) > (num_periods*period_size) ) {
-	    fprintf( stderr, "target_delay+max_diff (%d) cant be bigger than buffersize(%d)\n", target_delay+max_diff, num_periods*period_size );
-	    exit(20);
-    }
-    // alloc input ports, which are blasted out to alsa...
-    alloc_ports( num_channels, 0 );
-
-
-    /* tell the JACK server that we are ready to roll */
-
-    if (jack_activate (client)) {
-	fprintf (stderr, "cannot activate client");
-	return 1;
-    }
-
-    signal( SIGTERM, sigterm_handler );
-    signal( SIGINT, sigterm_handler );
-
-    if( verbose ) {
-	    while(!quit) {
-		    usleep(500000);
-		    if( output_new_delay ) {
-			    printf( "delay = %d\n", output_new_delay );
-			    output_new_delay = 0;
-		    }
-		    printf( "res: %f, \tdiff = %f, \toffset = %f \n", output_resampling_factor, output_diff, output_offset );
-	    }
-    } else if( instrument ) {
-	    printf( "# n\tresamp\tdiff\toffseti\tintegral\n");
-	    int n=0;
-	    while(!quit) {
-		    usleep(1000);
-		    printf( "%d\t%f\t%f\t%f\t%f\n", n++, output_resampling_factor, output_diff, output_offset, output_integral );
-	    }
-    } else {
-	    while(!quit)
-	    {
-		    usleep(500000);
-		    if( output_new_delay ) {
-			    printf( "delay = %d\n", output_new_delay );
-			    output_new_delay = 0;
-		    }
-	    }
-    }
-
-    jack_deactivate( client );
-    jack_client_close (client);
-    exit (0);
-}
-
diff --git a/tools/alsa_out.c b/tools/alsa_out.c
deleted file mode 100644
index 6d7e097..0000000
--- a/tools/alsa_out.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/** @file simple_client.c
- *
- * @brief This simple client demonstrates the basic features of JACK
- * as they would be used by many applications.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include <math.h>
-
-#include <jack/jack.h>
-#include <jack/jslist.h>
-#include <jack/memops.h>
-
-#include "alsa/asoundlib.h"
-
-#include <samplerate.h>
-
-// Here are the lists of the jack ports...
-
-JSList	   *capture_ports = NULL;
-JSList	   *capture_srcs = NULL;
-JSList	   *playback_ports = NULL;
-JSList	   *playback_srcs = NULL;
-jack_client_t *client;
-
-snd_pcm_t *alsa_handle;
-
-int jack_sample_rate;
-int jack_buffer_size;
-
-double resample_mean = 1.0;
-double static_resample_factor = 1.0;
-
-double *offset_array;
-double *window_array;
-int offset_differential_index = 0;
-
-double offset_integral = 0;
-int quit = 0;
-
-// ------------------------------------------------------ commandline parameters
-
-int sample_rate = 0;				 /* stream rate */
-int num_channels = 2;				 /* count of channels */
-int period_size = 1024;
-int num_periods = 2;
-
-int target_delay = 0;	    /* the delay which the program should try to approach. */
-int max_diff = 0;	    /* the diff value, when a hard readpointer skip should occur */
-int catch_factor = 100000;
-int catch_factor2 = 10000;
-double pclamp = 15.0;
-double controlquant = 10000.0;
-int smooth_size = 256;
-int good_window=0;
-int verbose = 0;
-int instrument = 0;
-int samplerate_quality = 2;
-
-// Debug stuff:
-
-volatile float output_resampling_factor = 1.0;
-volatile int output_new_delay = 0;
-volatile float output_offset = 0.0;
-volatile float output_integral = 0.0;
-volatile float output_diff = 0.0;
-
-snd_pcm_uframes_t real_buffer_size;
-snd_pcm_uframes_t real_period_size;
-
-// format selection, and corresponding functions from memops in a nice set of structs.
-
-typedef struct alsa_format {
-	snd_pcm_format_t format_id;
-	size_t sample_size;
-	void (*jack_to_soundcard) (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-	void (*soundcard_to_jack) (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-	const char *name;
-} alsa_format_t;
-
-alsa_format_t formats[] = {
-	{ SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" },
-	{ SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" },
-	{ SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" },
-	{ SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" }
-};
-#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
-int format=0;
-
-// Alsa stuff... i dont want to touch this bullshit in the next years.... please...
-
-static int xrun_recovery(snd_pcm_t *handle, int err) {
-//    printf( "xrun !!!.... %d\n", err );
-	if (err == -EPIPE) {	/* under-run */
-		err = snd_pcm_prepare(handle);
-		if (err < 0)
-			printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
-		return 0;
-	} else if (err == -EAGAIN) {
-		while ((err = snd_pcm_resume(handle)) == -EAGAIN)
-			usleep(100);	/* wait until the suspend flag is released */
-		if (err < 0) {
-			err = snd_pcm_prepare(handle);
-			if (err < 0)
-				printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
-		}
-		return 0;
-	}
-	return err;
-}
-
-static int set_hwformat( snd_pcm_t *handle, snd_pcm_hw_params_t *params )
-{
-	int i;
-	int err;
-
-	for( i=0; i<NUMFORMATS; i++ ) {
-		/* set the sample format */
-		err = snd_pcm_hw_params_set_format(handle, params, formats[i].format_id);
-		if (err == 0) {
-			format = i;
-			return 0;
-		}
-	}
-
-	return err;
-}
-
-static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access, int rate, int channels, int period, int nperiods ) {
-	int err, dir=0;
-	unsigned int buffer_time;
-	unsigned int period_time;
-	unsigned int rrate;
-	unsigned int rchannels;
-
-	/* choose all parameters */
-	err = snd_pcm_hw_params_any(handle, params);
-	if (err < 0) {
-		printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* set the interleaved read/write format */
-	err = snd_pcm_hw_params_set_access(handle, params, access);
-	if (err < 0) {
-		printf("Access type not available for playback: %s\n", snd_strerror(err));
-		return err;
-	}
-
-	/* set the sample format */
-	err = set_hwformat(handle, params);
-	if (err < 0) {
-		printf("Sample format not available for playback: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* set the count of channels */
-	rchannels = channels;
-	err = snd_pcm_hw_params_set_channels_near(handle, params, &rchannels);
-	if (err < 0) {
-		printf("Channels count (%i) not available for record: %s\n", channels, snd_strerror(err));
-		return err;
-	}
-	if (rchannels != channels) {
-		printf("WARNING: chennel count does not match (requested %d got %d)\n", channels, rchannels);
-		num_channels = rchannels;
-	}
-	/* set the stream rate */
-	rrate = rate;
-	err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
-	if (err < 0) {
-		printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
-		return err;
-	}
-	if (rrate != rate) {
-		printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, rrate);
-		return -EINVAL;
-	}
-	/* set the buffer time */
-
-	buffer_time = 1000000*period*nperiods/rate;
-	err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir);
-	if (err < 0) {
-		printf("Unable to set buffer time %i for playback: %s\n",  1000000*period*nperiods/rate, snd_strerror(err));
-		return err;
-	}
-	err = snd_pcm_hw_params_get_buffer_size( params, &real_buffer_size );
-	if (err < 0) {
-		printf("Unable to get buffer size back: %s\n", snd_strerror(err));
-		return err;
-	}
-	if( real_buffer_size != nperiods * period ) {
-	    printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size );
-	}
-	/* set the period time */
-	period_time = 1000000*period/rate;
-	err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
-	if (err < 0) {
-		printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err));
-		return err;
-	}
-	err = snd_pcm_hw_params_get_period_size(params, &real_period_size, NULL );
-	if (err < 0) {
-		printf("Unable to get period size back: %s\n", snd_strerror(err));
-		return err;
-	}
-	if( real_period_size != period ) {
-	    printf( "WARNING: period size does not match: (requested %i, got %i)\n", period, (int)real_period_size );
-	}
-	/* write the parameters to device */
-	err = snd_pcm_hw_params(handle, params);
-	if (err < 0) {
-		printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
-		return err;
-	}
-	return 0;
-}
-
-static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, int period, int nperiods) {
-	int err;
-
-	/* get the current swparams */
-	err = snd_pcm_sw_params_current(handle, swparams);
-	if (err < 0) {
-		printf("Unable to determine current swparams for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* start the transfer when the buffer is full */
-	err = snd_pcm_sw_params_set_start_threshold(handle, swparams, period );
-	if (err < 0) {
-		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, -1 );
-	if (err < 0) {
-		printf("Unable to set start threshold mode for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* allow the transfer when at least period_size samples can be processed */
-	err = snd_pcm_sw_params_set_avail_min(handle, swparams, 1 );
-	if (err < 0) {
-		printf("Unable to set avail min for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* align all transfers to 1 sample */
-	err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
-	if (err < 0) {
-		printf("Unable to set transfer align for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	/* write the parameters to the playback device */
-	err = snd_pcm_sw_params(handle, swparams);
-	if (err < 0) {
-		printf("Unable to set sw params for capture: %s\n", snd_strerror(err));
-		return err;
-	}
-	return 0;
-}
-
-// ok... i only need this function to communicate with the alsa bloat api...
-
-static snd_pcm_t *open_audiofd( char *device_name, int capture, int rate, int channels, int period, int nperiods ) {
-  int err;
-  snd_pcm_t *handle;
-  snd_pcm_hw_params_t *hwparams;
-  snd_pcm_sw_params_t *swparams;
-
-  snd_pcm_hw_params_alloca(&hwparams);
-  snd_pcm_sw_params_alloca(&swparams);
-
-  if ((err = snd_pcm_open(&(handle), device_name, capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK )) < 0) {
-      printf("Capture open error: %s\n", snd_strerror(err));
-      return NULL;
-  }
-
-  if ((err = set_hwparams(handle, hwparams,SND_PCM_ACCESS_RW_INTERLEAVED, rate, channels, period, nperiods )) < 0) {
-      printf("Setting of hwparams failed: %s\n", snd_strerror(err));
-      return NULL;
-  }
-  if ((err = set_swparams(handle, swparams, period, nperiods)) < 0) {
-      printf("Setting of swparams failed: %s\n", snd_strerror(err));
-      return NULL;
-  }
-
-  //snd_pcm_start( handle );
-  //snd_pcm_wait( handle, 200 );
-  int num_null_samples = nperiods * period * channels;
-  char *tmp = alloca( num_null_samples * formats[format].sample_size ); 
-  memset( tmp, 0, num_null_samples * formats[format].sample_size );
-  snd_pcm_writei( handle, tmp, num_null_samples );
-  
-
-  return handle;
-}
-
-double hann( double x )
-{
-	return 0.5 * (1.0 - cos( 2*M_PI * x ) );
-}
-
-/**
- * The process callback for this JACK application.
- * It is called by JACK at the appropriate times.
- */
-int process (jack_nframes_t nframes, void *arg) {
-
-    char *outbuf;
-    float *resampbuf;
-    int rlen;
-    int err;
-    snd_pcm_sframes_t delay = target_delay;
-    int i;
-
-    delay = (num_periods*period_size)-snd_pcm_avail( alsa_handle ) ;
-
-    delay -= jack_frames_since_cycle_start( client );
-    delay += jack_get_buffer_size( client ) / 2;
-    // Do it the hard way.
-    // this is for compensating xruns etc...
-
-    if( delay > (target_delay+max_diff) ) {
-	snd_pcm_rewind( alsa_handle, delay - target_delay );
-	output_new_delay = (int) delay;
-
-	delay = target_delay;
-
-	// Set the resample_rate... we need to adjust the offset integral, to do this.
-	// first look at the PI controller, this code is just a special case, which should never execute once
-	// everything is swung in. 
-	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
-	// Also clear the array. we are beginning a new control cycle.
-	for( i=0; i<smooth_size; i++ )
-		offset_array[i] = 0.0;
-    }
-    if( delay < (target_delay-max_diff) ) {
-	char *tmp = alloca( (target_delay-delay) * formats[format].sample_size * num_channels ); 
-	memset( tmp, 0,  formats[format].sample_size * num_channels * (target_delay-delay) );
-	snd_pcm_writei( alsa_handle, tmp, target_delay-delay );
-
-	output_new_delay = (int) delay;
-
-	delay = target_delay;
-
-	// Set the resample_rate... we need to adjust the offset integral, to do this.
-	offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
-	// Also clear the array. we are beginning a new control cycle.
-	for( i=0; i<smooth_size; i++ )
-		offset_array[i] = 0.0;
-    }
-    /* ok... now we should have target_delay +- max_diff on the alsa side.
-     *
-     * calculate the number of frames, we want to get.
-     */
-
-    double offset = delay - target_delay;
-
-    // Save offset.
-    offset_array[(offset_differential_index++)% smooth_size ] = offset;
-
-    // Build the mean of the windowed offset array
-    // basically fir lowpassing.
-    double smooth_offset = 0.0;
-    for( i=0; i<smooth_size; i++ )
-	    smooth_offset +=
-		    offset_array[ (i + offset_differential_index-1) % smooth_size] * window_array[i];
-    smooth_offset /= (double) smooth_size;
-
-    // this is the integral of the smoothed_offset
-    offset_integral += smooth_offset;
-
-    // Clamp offset.
-    // the smooth offset still contains unwanted noise
-    // which would go straigth onto the resample coeff.
-    // it only used in the P component and the I component is used for the fine tuning anyways.
-    if( fabs( smooth_offset ) < pclamp )
-	    smooth_offset = 0.0;
-
-    // ok. now this is the PI controller. 
-    // u(t) = K * ( e(t) + 1/T \int e(t') dt' )
-    // K = 1/catch_factor and T = catch_factor2
-    double current_resample_factor = static_resample_factor - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2;
-
-    // now quantize this value around resample_mean, so that the noise which is in the integral component doesnt hurt.
-    current_resample_factor = floor( (current_resample_factor - resample_mean) * controlquant + 0.5 ) / controlquant + resample_mean;
-
-    // Output "instrumentatio" gonna change that to real instrumentation in a few.
-    output_resampling_factor = (float) current_resample_factor;
-    output_diff = (float) smooth_offset;
-    output_integral = (float) offset_integral;
-    output_offset = (float) offset;
-
-    // Clamp a bit.
-    if( current_resample_factor < 0.25 ) current_resample_factor = 0.25;
-    if( current_resample_factor > 4 ) current_resample_factor = 4;
-
-    // Now Calculate how many samples we need.
-    rlen = ceil( ((double)nframes) * current_resample_factor )+2;
-    assert( rlen > 2 );
-
-    // Calculate resample_mean so we can init ourselves to saner values.
-    resample_mean = 0.9999 * resample_mean + 0.0001 * current_resample_factor;
-    /*
-     * now this should do it...
-     */
-
-    outbuf = alloca( rlen * formats[format].sample_size * num_channels );
-
-    resampbuf = alloca( rlen * sizeof( float ) );
-    /*
-     * render jack ports to the outbuf...
-     */
-
-    int chn = 0;
-    JSList *node = playback_ports;
-    JSList *src_node = playback_srcs;
-    SRC_DATA src;
-
-    while ( node != NULL)
-    {
-	jack_port_t *port = (jack_port_t *) node->data;
-	float *buf = jack_port_get_buffer (port, nframes);
-
-	SRC_STATE *src_state = src_node->data;
-
-	src.data_in = buf;
-	src.input_frames = nframes;
-
-	src.data_out = resampbuf;
-	src.output_frames = rlen;
-	src.end_of_input = 0;
-
-	src.src_ratio = current_resample_factor;
-
-	src_process( src_state, &src );
-
-	formats[format].jack_to_soundcard( outbuf + format[formats].sample_size * chn, resampbuf, src.output_frames_gen, num_channels*format[formats].sample_size, NULL);
-
-	src_node = jack_slist_next (src_node);
-	node = jack_slist_next (node);
-	chn++;
-    }
-
-    // now write the output...
-again:
-  err = snd_pcm_writei(alsa_handle, outbuf, src.output_frames_gen);
-  //err = snd_pcm_writei(alsa_handle, outbuf, src.output_frames_gen);
-  if( err < 0 ) {
-      printf( "err = %d\n", err );
-      if (xrun_recovery(alsa_handle, err) < 0) {
-	  printf("Write error: %s\n", snd_strerror(err));
-	  exit(EXIT_FAILURE);
-      }
-      goto again;
-  }
-
-    return 0;      
-}
-
-
-/**
- * Allocate the necessary jack ports...
- */
-
-void alloc_ports( int n_capture, int n_playback ) {
-
-    int port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
-    int chn;
-    jack_port_t *port;
-    char buf[32];
-
-    capture_ports = NULL;
-    for (chn = 0; chn < n_capture; chn++)
-    {
-	snprintf (buf, sizeof(buf) - 1, "capture_%u", chn+1);
-
-	port = jack_port_register (client, buf,
-		JACK_DEFAULT_AUDIO_TYPE,
-		port_flags, 0);
-
-	if (!port)
-	{
-	    printf( "jacknet_client: cannot register port for %s", buf);
-	    break;
-	}
-
-	capture_srcs = jack_slist_append( capture_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
-	capture_ports = jack_slist_append (capture_ports, port);
-    }
-
-    port_flags = JackPortIsInput;
-
-    playback_ports = NULL;
-    for (chn = 0; chn < n_playback; chn++)
-    {
-	snprintf (buf, sizeof(buf) - 1, "playback_%u", chn+1);
-
-	port = jack_port_register (client, buf,
-		JACK_DEFAULT_AUDIO_TYPE,
-		port_flags, 0);
-
-	if (!port)
-	{
-	    printf( "jacknet_client: cannot register port for %s", buf);
-	    break;
-	}
-
-	playback_srcs = jack_slist_append( playback_srcs, src_new( 4-samplerate_quality, 1, NULL ) );
-	playback_ports = jack_slist_append (playback_ports, port);
-    }
-}
-
-/**
- * This is the shutdown callback for this JACK application.
- * It is called by JACK if the server ever shuts down or
- * decides to disconnect the client.
- */
-
-void jack_shutdown (void *arg) {
-
-	exit (1);
-}
-
-/**
- * be user friendly.
- * be user friendly.
- * be user friendly.
- */
-
-void printUsage() {
-fprintf(stderr, "usage: alsa_out [options]\n"
-		"\n"
-		"  -j <jack name> - client name\n"
-		"  -d <alsa_device> \n"
-		"  -c <channels> \n"
-		"  -p <period_size> \n"
-		"  -n <num_period> \n"
-		"  -r <sample_rate> \n"
-		"  -q <sample_rate quality [0..4]\n"
-		"  -m <max_diff> \n"
-		"  -t <target_delay> \n"
-		"  -i  turns on instrumentation\n"
-		"  -v  turns on printouts\n"
-		"\n");
-}
-
-
-/**
- * the main function....
- */
-
-void
-sigterm_handler( int signal )
-{
-	quit = 1;
-}
-
-
-int main (int argc, char *argv[]) {
-    char jack_name[30] = "alsa_out";
-    char alsa_device[30] = "hw:0";
-
-    extern char *optarg;
-    extern int optind, optopt;
-    int errflg=0;
-    int c;
-
-    while ((c = getopt(argc, argv, "ivj:r:c:p:n:d:q:m:t:f:F:C:Q:s:")) != -1) {
-	switch(c) {
-	    case 'j':
-		strcpy(jack_name,optarg);
-		break;
-	    case 'r':
-		sample_rate = atoi(optarg);
-		break;
-	    case 'c':
-		num_channels = atoi(optarg);
-		break;
-	    case 'p':
-		period_size = atoi(optarg);
-		break;
-	    case 'n':
-		num_periods = atoi(optarg);
-		break;
-	    case 'd':
-		strcpy(alsa_device,optarg);
-		break;
-	    case 't':
-		target_delay = atoi(optarg);
-		break;
-	    case 'q':
-		samplerate_quality = atoi(optarg);
-		break;
-	    case 'm':
-		max_diff = atoi(optarg);
-		break;
-	    case 'f':
-		catch_factor = atoi(optarg);
-		break;
-	    case 'F':
-		catch_factor2 = atoi(optarg);
-		break;
-	    case 'C':
-		pclamp = (double) atoi(optarg);
-		break;
-	    case 'Q':
-		controlquant = (double) atoi(optarg);
-		break;
-	    case 'v':
-		verbose = 1;
-		break;
-	    case 'i':
-		instrument = 1;
-		break;
-	    case 's':
-		smooth_size = atoi(optarg);
-		break;
-	    case ':':
-		fprintf(stderr,
-			"Option -%c requires an operand\n", optopt);
-		errflg++;
-		break;
-	    case '?':
-		fprintf(stderr,
-			"Unrecognized option: -%c\n", optopt);
-		errflg++;
-	}
-    }
-    if (errflg) {
-	printUsage();
-	exit(2);
-    }
-
-    if( (samplerate_quality < 0) || (samplerate_quality > 4) ) {
-	fprintf (stderr, "invalid samplerate quality\n");
-	return 1;
-    }
-    if ((client = jack_client_open (jack_name, 0, NULL)) == 0) {
-	fprintf (stderr, "jack server not running?\n");
-	return 1;
-    }
-
-    /* tell the JACK server to call `process()' whenever
-       there is work to be done.
-       */
-
-    jack_set_process_callback (client, process, 0);
-
-    /* tell the JACK server to call `jack_shutdown()' if
-       it ever shuts down, either entirely, or if it
-       just decides to stop calling us.
-       */
-
-    jack_on_shutdown (client, jack_shutdown, 0);
-
-
-    // get jack sample_rate
-    
-    jack_sample_rate = jack_get_sample_rate( client );
-
-    if( !sample_rate )
-	sample_rate = jack_sample_rate;
-
-    static_resample_factor =  (double) sample_rate / (double) jack_sample_rate;
-    resample_mean = static_resample_factor;
-
-    offset_array = malloc( sizeof(double) * smooth_size );
-    if( offset_array == NULL ) {
-	    fprintf( stderr, "no memory for offset_array !!!\n" );
-	    exit(20);
-    }
-    window_array = malloc( sizeof(double) * smooth_size );
-    if( window_array == NULL ) {
-	    fprintf( stderr, "no memory for window_array !!!\n" );
-	    exit(20);
-    }
-    int i;
-    for( i=0; i<smooth_size; i++ ) {
-	    offset_array[i] = 0.0;
-	    window_array[i] = hann( (double) i / ((double) smooth_size - 1.0) );
-    }
-
-    jack_buffer_size = jack_get_buffer_size( client );
-    // Setup target delay and max_diff for the normal user, who does not play with them...
-    if( !target_delay ) 
-	target_delay = (num_periods*period_size / 2) - jack_buffer_size/2;
-
-    if( !max_diff )
-	max_diff = target_delay;	
-
-    if( max_diff > target_delay ) {
-	    fprintf( stderr, "target_delay (%d) cant be smaller than max_diff(%d)\n", target_delay, max_diff );
-	    exit(20);
-    }
-    if( (target_delay+max_diff) > (num_periods*period_size) ) {
-	    fprintf( stderr, "target_delay+max_diff (%d) cant be bigger than buffersize(%d)\n", target_delay+max_diff, num_periods*period_size );
-	    exit(20);
-    }
-    // now open the alsa fd...
-    alsa_handle = open_audiofd( alsa_device, 0, sample_rate, num_channels, period_size, num_periods);
-    if( alsa_handle == 0 )
-	exit(20);
-
-    printf( "selected sample format: %s\n", formats[format].name );
-
-    // alloc input ports, which are blasted out to alsa...
-    alloc_ports( 0, num_channels );
-
-
-    /* tell the JACK server that we are ready to roll */
-
-    if (jack_activate (client)) {
-	fprintf (stderr, "cannot activate client");
-	return 1;
-    }
-
-    signal( SIGTERM, sigterm_handler );
-    signal( SIGINT, sigterm_handler );
-
-    if( verbose ) {
-	    while(!quit) {
-		    usleep(500000);
-		    if( output_new_delay ) {
-			    printf( "delay = %d\n", output_new_delay );
-			    output_new_delay = 0;
-		    }
-		    printf( "res: %f, \tdiff = %f, \toffset = %f \n", output_resampling_factor, output_diff, output_offset );
-	    }
-    } else if( instrument ) {
-	    printf( "# n\tresamp\tdiff\toffseti\tintegral\n");
-	    int n=0;
-	    while(!quit) {
-		    usleep(1000);
-		    printf( "%d\t%f\t%f\t%f\t%f\n", n++, output_resampling_factor, output_diff, output_offset, output_integral );
-	    }
-    } else {
-	    while(!quit)
-	    {
-		    usleep(500000);
-		    if( output_new_delay ) {
-			    printf( "delay = %d\n", output_new_delay );
-			    output_new_delay = 0;
-		    }
-	    }
-    }
-
-    jack_deactivate( client );
-    jack_client_close (client);
-    exit (0);
-}
-
diff --git a/tools/bufsize.c b/tools/bufsize.c
deleted file mode 100644
index c9f1ae0..0000000
--- a/tools/bufsize.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  bufsize.c -- change JACK buffer size.
- *
- *  Copyright (C) 2003 Jack O'Quin.
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <jack/jack.h>
-#include <jack/transport.h>
-
-char *package;				/* program name */
-jack_client_t *client;
-jack_nframes_t nframes;
-int just_print_bufsize=0;
-
-void jack_shutdown(void *arg)
-{
-	fprintf(stderr, "JACK shut down, exiting ...\n");
-	exit(1);
-}
-
-void signal_handler(int sig)
-{
-	jack_client_close(client);
-	fprintf(stderr, "signal received, exiting ...\n");
-	exit(0);
-}
-
-void parse_arguments(int argc, char *argv[])
-{
-
-	/* basename $0 */
-	package = strrchr(argv[0], '/');
-	if (package == 0)
-		package = argv[0];
-	else
-		package++;
-
-	if (argc==1) {
-		just_print_bufsize = 1;
-		return;
-	}
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <bufsize>\n", package);
-		exit(9);
-	}
-
-	nframes = strtoul(argv[1], NULL, 0);
-	if (errno == ERANGE) {
-		fprintf(stderr, "%s: invalid buffer size: %s\n",
-			package, argv[1]);
-		exit(2);
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	int rc;
-
-	parse_arguments(argc, argv);
-
-	/* become a JACK client */
-	if ((client = jack_client_new(package)) == 0) {
-		fprintf(stderr, "JACK server not running?\n");
-		exit(1);
-	}
-
-	signal(SIGQUIT, signal_handler);
-	signal(SIGTERM, signal_handler);
-	signal(SIGHUP, signal_handler);
-	signal(SIGINT, signal_handler);
-
-	jack_on_shutdown(client, jack_shutdown, 0);
-
-	if (just_print_bufsize) {
-		fprintf(stdout, "%d\n", jack_get_buffer_size( client ) );
-		rc=0;
-	}
-	else
-	{
-		rc = jack_set_buffer_size(client, nframes);
-		if (rc)
-			fprintf(stderr, "jack_set_buffer_size(): %s\n", strerror(rc));
-	}
-	jack_client_close(client);
-
-	return rc;
-}
diff --git a/tools/connect.c b/tools/connect.c
deleted file mode 100644
index 23189a3..0000000
--- a/tools/connect.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-    Copyright (C) 2002 Jeremy Hall
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <getopt.h>
-
-#include <config.h>
-
-#include <jack/jack.h>
-
-#define TRUE 1
-#define FALSE 0
-
-void
-show_version (char *my_name)
-{
-	fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n", my_name);
-}
-
-void
-show_usage (char *my_name)
-{
-	show_version (my_name);
-	fprintf (stderr, "\nusage: %s [options] port1 port2\n", my_name);
-	fprintf (stderr, "Connects two JACK ports together.\n\n");
-	fprintf (stderr, "        -s, --server <name>   Connect to the jack server named <name>\n");
-	fprintf (stderr, "        -v, --version         Output version information and exit\n");
-	fprintf (stderr, "        -h, --help            Display this help message\n\n");
-	fprintf (stderr, "For more information see http://jackaudio.org/\n");
-}
-
-int
-main (int argc, char *argv[])
-{
-	jack_client_t *client;
-	jack_status_t status;
-	char *server_name = NULL;
-	int c;
-	int option_index;
-	jack_options_t options = JackNoStartServer;
-	char *my_name = strrchr(argv[0], '/');
-	jack_port_t *src_port = 0;
-	jack_port_t *dst_port = 0;
-	jack_port_t *port1 = 0;
-	jack_port_t *port2 = 0;
-	int connecting, disconnecting;
-	int port1_flags, port2_flags;
-	int rc = 1;
-
-	struct option long_options[] = {
-	    { "server", 1, 0, 's' },
-	    { "help", 0, 0, 'h' },
-	    { "version", 0, 0, 'v' },
-	    { 0, 0, 0, 0 }
-	};
-
-	while ((c = getopt_long (argc, argv, "s:hv", long_options, &option_index)) >= 0) {
-		switch (c) {
-		case 's':
-			server_name = (char *) malloc (sizeof (char) * strlen(optarg));
-			strcpy (server_name, optarg);
-			options |= JackServerName;
-			break;
-		case 'h':
-			show_usage (my_name);
-			return 1;
-			break;
-		case 'v':
-			show_version (my_name);
-			return 1;
-			break;
-		default:
-			show_usage (my_name);
-			return 1;
-			break;
-		}
-	}
-
-	connecting = disconnecting = FALSE;
-	if (my_name == 0) {
-		my_name = argv[0];
-	} else {
-		my_name ++;
-	}
-
-	if (strstr(my_name, "disconnect")) {
-		disconnecting = 1;
-	} else if (strstr(my_name, "connect")) {
-		connecting = 1;
-	} else {
-		fprintf(stderr, "ERROR! client should be called jack_connect or jack_disconnect. client is called %s\n", my_name);
-		return 1;
-	}
-	
-	if (argc < 3) show_usage(my_name);
-
-	/* try to become a client of the JACK server */
-
-	if ((client = jack_client_open (my_name, options, &status, server_name)) == 0) {
-		fprintf (stderr, "jack server not running?\n");
-		return 1;
-	}
-
-	/* find the two ports */
-
-	if ((port1 = jack_port_by_name(client, argv[argc-1])) == 0) {
-		fprintf (stderr, "ERROR %s not a valid port\n", argv[argc-1]);
-		goto exit;
-		}
-	if ((port2 = jack_port_by_name(client, argv[argc-2])) == 0) {
-		fprintf (stderr, "ERROR %s not a valid port\n", argv[argc-2]);
-		goto exit;
-		}
-
-	port1_flags = jack_port_flags (port1);
-	port2_flags = jack_port_flags (port2);
-
-	if (port1_flags & JackPortIsInput) {
-		if (port2_flags & JackPortIsOutput) {
-			src_port = port2;
-			dst_port = port1;
-		}
-	} else {
-		if (port2_flags & JackPortIsInput) {
-			src_port = port1;
-			dst_port = port2;
-		}
-	}
-
-	if (!src_port || !dst_port) {
-		fprintf (stderr, "arguments must include 1 input port and 1 output port\n");
-		goto exit;
-	}
-
-	/* connect the ports. Note: you can't do this before
-	   the client is activated (this may change in the future).
-	*/
-
-	if (connecting) {
-		if (jack_connect(client, jack_port_name(src_port), jack_port_name(dst_port))) {
-			goto exit;
-		}
-	}
-	if (disconnecting) {
-		if (jack_disconnect(client, jack_port_name(src_port), jack_port_name(dst_port))) {
-			goto exit;
-		}
-	}
-
-	/* everything was ok, so setting exitcode to 0 */
-	rc = 0;
-
-exit:
-	jack_client_close (client);
-	exit (rc);
-}
-
diff --git a/tools/evmon.c b/tools/evmon.c
deleted file mode 100644
index 32b9978..0000000
--- a/tools/evmon.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-    Copyright (C) 2007 Paul Davis
-    
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <jack/jack.h>
-
-void
-port_callback (jack_port_id_t port, int yn, void* arg)
-{
-	printf ("Port %d %s\n", port, (yn ? "registered" : "unregistered"));
-}
-
-void
-connect_callback (jack_port_id_t a, jack_port_id_t b, int yn, void* arg)
-{
-	printf ("Ports %d and %d %s\n", a, b, (yn ? "connected" : "disconnected"));
-}
-
-void
-client_callback (const char* client, int yn, void* arg)
-{
-	printf ("Client %s %s\n", client, (yn ? "registered" : "unregistered"));
-}
-
-int
-graph_callback (void* arg)
-{
-	printf ("Graph reordered\n");
-	return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
-	jack_client_t *client;
-	jack_options_t options = JackNullOption;
-	jack_status_t status;
-
-	if ((client = jack_client_open ("event-monitor", options, &status, NULL)) == 0) {
-		fprintf (stderr, "jack_client_open() failed, "
-			 "status = 0x%2.0x\n", status);
-		if (status & JackServerFailed) {
-			fprintf (stderr, "Unable to connect to JACK server\n");
-		}
-		return 1;
-	}
-	
-	if (jack_set_port_registration_callback (client, port_callback, NULL)) {
-		fprintf (stderr, "cannot set port registration callback\n");
-		return 1;
-	}
-	if (jack_set_port_connect_callback (client, connect_callback, NULL)) {
-		fprintf (stderr, "cannot set port connect callback\n");
-		return 1;
-	}
-	if (jack_set_client_registration_callback (client, client_callback, NULL)) {
-		fprintf (stderr, "cannot set client registration callback\n");
-		return 1;
-	}
-	if (jack_set_graph_order_callback (client, graph_callback, NULL)) {
-		fprintf (stderr, "cannot set graph order registration callback\n");
-		return 1;
-	}
-	if (jack_activate (client)) {
-		fprintf (stderr, "cannot activate client");
-		return 1;
-	}
-
-	sleep (-1);
-	exit (0);
-}
-
diff --git a/tools/freewheel.c b/tools/freewheel.c
deleted file mode 100644
index 9e4b80f..0000000
--- a/tools/freewheel.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  freewheel - start/stop JACK "freewheeling" mode
- *
- *  Copyright (C) 2003 Paul Davis.
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <jack/jack.h>
-#include <jack/transport.h>
-
-char *package;				/* program name */
-jack_client_t *client;
-int onoff;
-
-void jack_shutdown(void *arg)
-{
-	fprintf(stderr, "JACK shut down, exiting ...\n");
-	exit(1);
-}
-
-void signal_handler(int sig)
-{
-	jack_client_close(client);
-	fprintf(stderr, "signal received, exiting ...\n");
-	exit(0);
-}
-
-void parse_arguments(int argc, char *argv[])
-{
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s y|n\n", package);
-		exit(9);
-	}
-
-	if (argv[1][0] == 'y' || argv[1][0] == 'Y' || argv[1][0] == '1') {
-		onoff = 1;
-	} else {
-		onoff = 0;
-	}
-}
-
-int 
-main (int argc, char *argv[])
-{
-	parse_arguments (argc, argv);
-
-	/* become a JACK client */
-	if ((client = jack_client_new ("freewheel")) == 0) {
-		fprintf (stderr, "JACK server not running?\n");
-		exit(1);
-	}
-
-	signal (SIGQUIT, signal_handler);
-	signal (SIGTERM, signal_handler);
-	signal (SIGHUP, signal_handler);
-	signal (SIGINT, signal_handler);
-
-	jack_on_shutdown (client, jack_shutdown, 0);
-
-	if (jack_set_freewheel (client, onoff)) {
-		fprintf (stderr, "failed to reset freewheel mode\n");
-	}
-
-	jack_client_close(client);
-
-	return 0;
-}
diff --git a/tools/ipload.c b/tools/ipload.c
deleted file mode 100644
index 4ce9369..0000000
--- a/tools/ipload.c
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <jack/jack.h>
-#include <jack/intclient.h>
-
-jack_client_t *client;
-jack_intclient_t intclient;
-char *client_name;
-char *intclient_name;
-char *load_name;
-char *load_init = NULL;
-char *server_name = NULL;
-int wait_opt = 0;
-
-void
-signal_handler (int sig)
-{
-	jack_status_t status;
-
-	fprintf (stderr, "signal received, unloading...");
-	status = jack_internal_client_unload (client, intclient);
-	if (status & JackFailure)
-		fprintf (stderr, "(failed), status = 0x%2.0x\n", status);
-	else
-		fprintf (stderr, "(succeeded)\n");
-	jack_client_close (client);
-	exit (0);
-}
-
-void
-show_usage ()
-{
-	fprintf (stderr, "usage: %s [ options ] client-name [ load-name "
-		 "[ init-string]]\n\noptions:\n", client_name);
-	fprintf (stderr,
-		 "\t-h, --help \t\t print help message\n"
-		 "\t-i, --init string\t initialize string\n"
-		 "\t-s, --server name\t select JACK server\n"
-		 "\t-w, --wait \t\t wait for signal, then unload\n"
-		 "\n"
-		);
-}
-
-int
-parse_args (int argc, char *argv[])
-{
-	int c;
-	int option_index = 0;
-	char *short_options = "hi:s:w";
-	struct option long_options[] = {
-		{ "help", 0, 0, 'h' },
-		{ "init", required_argument, 0, 'i' },
-		{ "server", required_argument, 0, 's' },
-		{ "wait", 0, 0, 'w' },
-		{ 0, 0, 0, 0 }
-	};
-
-	client_name = strrchr(argv[0], '/');
-	if (client_name == NULL) {
-		client_name = argv[0];
-	} else {
-		client_name++;
-	}
-
-	while ((c = getopt_long (argc, argv, short_options, long_options,
-				 &option_index)) >= 0) {
-		switch (c) {
-		case 'i':
-			load_init = optarg;
-			break;
-		case 's':
-			server_name = optarg;
-			break;
-		case 'w':
-			wait_opt = 1;
-			break;
-		case 'h':
-		default:
-			show_usage ();
-			return 1;
-		}
-	}
-
-	if (optind == argc) {		/* no positional args? */
-		show_usage ();
-		return 1;
-	}
-	if (optind < argc)
-		load_name = intclient_name = argv[optind++];
-
-	if (optind < argc)
-		load_name = argv[optind++];
-
-	if (optind < argc)
-		load_init = argv[optind++];
-
-	//fprintf (stderr, "client-name = `%s', load-name = `%s', "
-	//	 "load-init = `%s', wait = %d\n",
-	//	 intclient_name, load_name, load_init, wait_opt);
-
-	return 0;			/* args OK */
-}
-
-int
-main (int argc, char *argv[])
-{
-	jack_status_t status;
-
-	/* parse and validate command arguments */
-	if (parse_args (argc, argv))
-		exit (1);		/* invalid command line */
-
-	/* first, become a JACK client */
-	client = jack_client_open (client_name, JackServerName,
-				   &status, server_name);
-	if (client == NULL) {
-		fprintf (stderr, "jack_client_open() failed, "
-			 "status = 0x%2.0x\n", status);
-		if (status & JackServerFailed) {
-			fprintf (stderr, "Unable to connect to JACK server\n");
-		}
-		exit (1);
-	}
-	if (status & JackServerStarted) {
-		fprintf (stderr, "JACK server started\n");
-	}
-	if (status & JackNameNotUnique) {
-		client_name = jack_get_client_name(client);
-		fprintf (stderr, "unique name `%s' assigned\n", client_name);
-	}
-
-	/* then, load the internal client */
-	intclient = jack_internal_client_load (client, intclient_name,
-					       (JackLoadName|JackLoadInit),
-					       &status, load_name, load_init);
-	if (status & JackFailure) {
-		fprintf (stderr, "could not load %s, status = 0x%2.0x\n",
-			 load_name, status);
-		return 2;
-	}
-	if (status & JackNameNotUnique) {
-		intclient_name =
-			jack_get_internal_client_name (client, intclient);
-		fprintf (stderr, "unique internal client name `%s' assigned\n",
-			 intclient_name);
-	}
-
-	fprintf (stdout, "%s is running.\n", load_name);
-
-	if (wait_opt) {
-		/* define a signal handler to unload the client, then
-		 * wait for it to exit */
-		signal (SIGQUIT, signal_handler);
-		signal (SIGTERM, signal_handler);
-		signal (SIGHUP, signal_handler);
-		signal (SIGINT, signal_handler);
-
-		while (1) {
-			sleep (1);
-		}
-	}
-
-	return 0;
-}
-	
-		
diff --git a/tools/ipunload.c b/tools/ipunload.c
deleted file mode 100644
index a49418c..0000000
--- a/tools/ipunload.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <jack/jack.h>
-#include <jack/intclient.h>
-
-int
-main (int argc, char *argv[])
-{
-	char *my_name;
-	char *client_name;
-	jack_client_t *client;
-	jack_status_t status;
-	jack_intclient_t intclient;
-
-	/* validate args */
-	if ((argc < 2) || (argc > 3)) {
-		fprintf (stderr, "usage: %s client-name [ server-name ]]\n",
-			 argv[0]);
-		return 1;
-	}
-
-	/* use `basename $0` for my own client name */
-	my_name = strrchr(argv[0], '/');
-	if (my_name == 0) {
-		my_name = argv[0];
-	} else {
-		my_name++;
-	}
-
-	/* first, become a JACK client */
-	if (argc > 2) {
-		client = jack_client_open (my_name,
-					   (JackServerName|JackNoStartServer),
-					   &status, argv[2]);
-	} else {
-		client = jack_client_open (my_name, JackNoStartServer, &status);
-	}
-
-	if (client == NULL) {
-		if (status & JackServerFailed) {
-			fprintf (stderr, "JACK server not running.\n");
-		} else {
-			fprintf (stderr, "JACK open failed, "
-				 "status = 0x%2.0x\n", status);
-		}
-		exit (1);
-	}
-
-	/* then, get the internal client handle */
-	client_name = argv[1];
-	intclient = jack_internal_client_handle (client, client_name, &status);
-	if (status & JackFailure) {
-		fprintf (stderr, "client %s not found.\n", client_name);
-		exit (2);
-	}
-
-	/* now, unload the internal client */
-	status = jack_internal_client_unload (client, intclient);
-	if (status & JackFailure) {
-		if (status & JackNoSuchClient) {
-			fprintf (stderr, "client %s is gone.\n",
-				 client_name);
-		} else {
-			fprintf (stderr, "could not unload %s, "
-				 "returns 0x%2.0x\n", client_name, status);
-		}
-		exit (3);
-	} else {
-		fprintf (stdout, "%s unloaded.\n", client_name);
-	}
-
-	return 0;
-}
-	
-		
diff --git a/tools/lsp.c b/tools/lsp.c
deleted file mode 100644
index 450df32..0000000
--- a/tools/lsp.c
+++ /dev/null
@@ -1,216 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-
-#include <config.h>
-
-#include <jack/jack.h>
-
-char * my_name;
-
-void
-show_version (void)
-{
-	fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n",
-		my_name);
-}
-
-void
-show_usage (void)
-{
-	show_version ();
-	fprintf (stderr, "\nUsage: %s [options] [filter string]\n", my_name);
-	fprintf (stderr, "List active Jack ports, and optionally display extra information.\n");
-	fprintf (stderr, "Optionally filter ports which match ALL strings provided after any options.\n\n");
-	fprintf (stderr, "Display options:\n");
-	fprintf (stderr, "        -s, --server <name>   Connect to the jack server named <name>\n");
-	fprintf (stderr, "        -A, --aliases         List aliases for each port\n");
-	fprintf (stderr, "        -c, --connections     List connections to/from each port\n");
-	fprintf (stderr, "        -l, --latency         Display per-port latency in frames at each port\n");
-	fprintf (stderr, "        -L, --latency         Display total latency in frames at each port\n");
-	fprintf (stderr, "        -p, --properties      Display port properties. Output may include:\n"
-			 "                              input|output, can-monitor, physical, terminal\n\n");
-	fprintf (stderr, "        -t, --type            Display port type\n");
-	fprintf (stderr, "        -h, --help            Display this help message\n");
-	fprintf (stderr, "        --version             Output version information and exit\n\n");
-	fprintf (stderr, "For more information see http://jackaudio.org/\n");
-}
-
-int
-main (int argc, char *argv[])
-{
-	jack_client_t *client;
-	jack_status_t status;
-    jack_options_t options = JackNoStartServer;
-	const char **ports, **connections;
-	unsigned int i, j, k;
-	int skip_port;
-	int show_aliases = 0;
-	int show_con = 0;
-	int show_port_latency = 0;
-	int show_total_latency = 0;
-	int show_properties = 0;
-	int show_type = 0;
-	int c;
-	int option_index;
-	char* aliases[2];
-	char *server_name = NULL;
-
-	
-	struct option long_options[] = {
-	    { "server", 1, 0, 's' },
-		{ "aliases", 0, 0, 'A' },
-		{ "connections", 0, 0, 'c' },
-		{ "port-latency", 0, 0, 'l' },
-		{ "total-latency", 0, 0, 'L' },
-		{ "properties", 0, 0, 'p' },
-		{ "type", 0, 0, 't' },
-		{ "help", 0, 0, 'h' },
-		{ "version", 0, 0, 'v' },
-		{ 0, 0, 0, 0 }
-	};
-
-	my_name = strrchr(argv[0], '/');
-	if (my_name == 0) {
-		my_name = argv[0];
-	} else {
-		my_name ++;
-	}
-
-	while ((c = getopt_long (argc, argv, "s:AclLphvt", long_options, &option_index)) >= 0) {
-		switch (c) {
-		case 's':
-            server_name = (char *) malloc (sizeof (char) * strlen(optarg));
-            strcpy (server_name, optarg);
-            options |= JackServerName;
-            break;
-		case 'A':
-			aliases[0] = (char *) malloc (jack_port_name_size());
-			aliases[1] = (char *) malloc (jack_port_name_size());
-			show_aliases = 1;
-			break;
-		case 'c':
-			show_con = 1;
-			break;
-		case 'l':
-			show_port_latency = 1;
-			break;
-		case 'L':
-			show_total_latency = 1;
-			break;
-		case 'p':
-			show_properties = 1;
-			break;
-		case 't':
-			show_type = 1;
-			break;
-		case 'h':
-			show_usage ();
-			return 1;
-			break;
-		case 'v':
-			show_version ();
-			return 1;
-			break;
-		default:
-			show_usage ();
-			return 1;
-			break;
-		}
-	}
-
-	/* Open a client connection to the JACK server.  Starting a
-	 * new server only to list its ports seems pointless, so we
-	 * specify JackNoStartServer. */
-	client = jack_client_open ("lsp", options, &status, server_name);
-	if (client == NULL) {
-		if (status & JackServerFailed) {
-			fprintf (stderr, "JACK server not running\n");
-		} else {
-			fprintf (stderr, "jack_client_open() failed, "
-				 "status = 0x%2.0x\n", status);
-		}
-		return 1;
-	}
-
-	ports = jack_get_ports (client, NULL, NULL, 0);
-
-	for (i = 0; ports[i]; ++i) {
-		// skip over any that don't match ALL of the strings presented at command line
-		skip_port = 0;
-		for(k=optind; k < argc; k++){
-			if(strstr(ports[i], argv[k]) == NULL ){
-				skip_port = 1;
-			}
-		}
-		if(skip_port) continue;
-
-		printf ("%s\n", ports[i]);
-
-		jack_port_t *port = jack_port_by_name (client, ports[i]);
-
-		if (show_aliases) {
-			int cnt;
-			int i;
-
-			cnt = jack_port_get_aliases (port, aliases);
-			for (i = 0; i < cnt; ++i) {
-				printf ("   %s\n", aliases[i]);
-			}
-		}
-				
-		if (show_con) {
-			if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) {
-				for (j = 0; connections[j]; j++) {
-					printf ("   %s\n", connections[j]);
-				}
-				free (connections);
-			} 
-		}
-		if (show_port_latency) {
-			if (port) {
-				printf ("	port latency = %" PRIu32 " frames\n",
-					jack_port_get_latency (port));
-			}
-		}
-		if (show_total_latency) {
-			if (port) {
-				printf ("	total latency = %" PRIu32 " frames\n",
-					jack_port_get_total_latency (client, port));
-			}
-		}
-		if (show_properties) {
-			if (port) {
-				int flags = jack_port_flags (port);
-				printf ("	properties: ");
-				if (flags & JackPortIsInput) {
-					fputs ("input,", stdout);
-				}
-				if (flags & JackPortIsOutput) {
-					fputs ("output,", stdout);
-				}
-				if (flags & JackPortCanMonitor) {
-					fputs ("can-monitor,", stdout);
-				}
-				if (flags & JackPortIsPhysical) {
-					fputs ("physical,", stdout);
-				}
-				if (flags & JackPortIsTerminal) {
-					fputs ("terminal,", stdout);
-				}
-				putc ('\n', stdout);
-			}
-		}
-		if (show_type) {
-			if (port) {
-				putc ('\t', stdout);
-				fputs (jack_port_type (port), stdout);
-				putc ('\n', stdout);
-			}
-		}
-	}
-	jack_client_close (client);
-	exit (0);
-}
diff --git a/tools/monitor_client.c b/tools/monitor_client.c
deleted file mode 100644
index 18934b1..0000000
--- a/tools/monitor_client.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <jack/jack.h>
-
-#define TRUE 1
-#define FALSE 0
-
-int
-main (int argc, char *argv[])
-
-{
-	jack_client_t *client;
-	char *my_name = strrchr(argv[0], '/');
-
-	if (my_name == 0) {
-		my_name = argv[0];
-	} else {
-		my_name ++;
-	}
-
-	if (argc != 2) {
-		fprintf (stderr, "Usage: %s client\n", my_name);
-		return 1;
-	}
-
-	if ((client = jack_client_new ("input monitoring")) == 0) {
-		fprintf (stderr, "jack server not running?\n");
-		return 1;
-	}
-
-	if (jack_port_request_monitor_by_name (client, argv[1], TRUE)) {
-		fprintf (stderr, "could not enable monitoring for %s\n", argv[1]);
-		jack_client_close (client);
-		return 1;
-	}
-	sleep (30);
-	if (jack_port_request_monitor_by_name (client, argv[1], FALSE)) {
-		fprintf (stderr, "could not disable monitoring for %s\n", argv[1]);
-	}
-	jack_client_close (client);
-	exit (0);
-}
-
diff --git a/tools/netsource.c b/tools/netsource.c
deleted file mode 100644
index 42fc8a6..0000000
--- a/tools/netsource.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/*
-NetJack Client
-
-Copyright (C) 2008 Marc-Olivier Barre <marco at marcochapeau.org>
-Copyright (C) 2008 Pieter Palmers <pieterpalmers at users.sourceforge.net>
-Copyright (C) 2006 Torben Hohn <torbenh at gmx.de>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file netsource.c
- *
- * @brief This client connects a remote slave JACK to a local JACK server assumed to be the master
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#ifdef WIN32
-#include <winsock2.h>
-#include <malloc.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#endif
-
-/* These two required by FreeBSD. */
-#include <sys/types.h>
-
-
-#include <jack/jack.h>
-
-//#include <net_driver.h>
-#include <netjack_packet.h>
-#if HAVE_SAMPLERATE
-#include <samplerate.h>
-#endif
-
-#if HAVE_CELT
-#include <celt/celt.h>
-#endif
-
-#include <math.h>
-
-JSList *capture_ports = NULL;
-JSList *capture_srcs = NULL;
-int capture_channels = 0;
-int capture_channels_audio = 2;
-int capture_channels_midi = 1;
-JSList *playback_ports = NULL;
-JSList *playback_srcs = NULL;
-int playback_channels = 0;
-int playback_channels_audio = 2;
-int playback_channels_midi = 1;
-int dont_htonl_floats = 0;
-
-int latency = 5;
-jack_nframes_t factor = 1;
-int bitdepth = 0;
-int mtu = 1400;
-int reply_port = 0;
-int bind_port = 0;
-int redundancy = 1;
-jack_client_t *client;
-
-int state_connected = 0;
-int state_latency = 0;
-int state_netxruns = 0;
-int state_currentframe = 0;
-int state_recv_packet_queue_time = 0;
-
-int quit=0;
-
-
-int outsockfd;
-int insockfd;
-#ifdef WIN32
-struct sockaddr_in destaddr;
-struct sockaddr_in bindaddr;
-#else
-struct sockaddr destaddr;
-struct sockaddr bindaddr;
-#endif
-
-int sync_state;
-jack_transport_state_t last_transport_state;
-
-int framecnt = 0;
-
-int cont_miss = 0;
-
-int freewheeling = 0;
-
-/**
- * This Function allocates all the I/O Ports which are added the lists.
- */
-void
-alloc_ports (int n_capture_audio, int n_playback_audio, int n_capture_midi, int n_playback_midi)
-{
-
-    int port_flags = JackPortIsOutput;
-    int chn;
-    jack_port_t *port;
-    char buf[32];
-
-    capture_ports = NULL;
-    /* Allocate audio capture channels */
-    for (chn = 0; chn < n_capture_audio; chn++)
-    {
-        snprintf (buf, sizeof (buf) - 1, "capture_%u", chn + 1);
-        port = jack_port_register (client, buf, JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
-        if (!port)
-        {
-            printf( "jack_netsource: cannot register %s port\n", buf);
-            break;
-        }
-	if( bitdepth == 1000 ) {
-#if HAVE_CELT
-#if HAVE_CELT_API_0_7
-	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate( client ), jack_get_buffer_size(client), NULL );
-	    capture_srcs = jack_slist_append(capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
-#else
-	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate( client ), 1, jack_get_buffer_size(client), NULL );
-	    capture_srcs = jack_slist_append(capture_srcs, celt_decoder_create( celt_mode ) );
-#endif
-#endif
-	} else {
-#if HAVE_SAMPLERATE
-	    capture_srcs = jack_slist_append (capture_srcs, src_new (SRC_LINEAR, 1, NULL));
-#endif
-	}
-        capture_ports = jack_slist_append (capture_ports, port);
-    }
-
-    /* Allocate midi capture channels */
-    for (chn = n_capture_audio; chn < n_capture_midi + n_capture_audio; chn++)
-    {
-        snprintf (buf, sizeof (buf) - 1, "capture_%u", chn + 1);
-        port = jack_port_register (client, buf, JACK_DEFAULT_MIDI_TYPE, port_flags, 0);
-        if (!port)
-        {
-            printf ("jack_netsource: cannot register %s port\n", buf);
-            break;
-        }
-        capture_ports = jack_slist_append(capture_ports, port);
-    }
-
-    /* Allocate audio playback channels */
-    port_flags = JackPortIsInput;
-    playback_ports = NULL;
-    for (chn = 0; chn < n_playback_audio; chn++)
-    {
-        snprintf (buf, sizeof (buf) - 1, "playback_%u", chn + 1);
-        port = jack_port_register (client, buf, JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
-        if (!port)
-        {
-            printf ("jack_netsource: cannot register %s port\n", buf);
-            break;
-        }
-	if( bitdepth == 1000 ) {
-#if HAVE_CELT
-#if HAVE_CELT_API_0_7
-	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate (client), jack_get_buffer_size(client), NULL );
-	    playback_srcs = jack_slist_append(playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
-#else
-	    CELTMode *celt_mode = celt_mode_create( jack_get_sample_rate (client), 1, jack_get_buffer_size(client), NULL );
-	    playback_srcs = jack_slist_append(playback_srcs, celt_encoder_create( celt_mode ) );
-#endif
-#endif
-	} else {
-#if HAVE_SAMPLERATE
-	    playback_srcs = jack_slist_append (playback_srcs, src_new (SRC_LINEAR, 1, NULL));
-#endif
-	}
-	playback_ports = jack_slist_append (playback_ports, port);
-    }
-
-    /* Allocate midi playback channels */
-    for (chn = n_playback_audio; chn < n_playback_midi + n_playback_audio; chn++)
-    {
-        snprintf (buf, sizeof (buf) - 1, "playback_%u", chn + 1);
-        port = jack_port_register (client, buf, JACK_DEFAULT_MIDI_TYPE, port_flags, 0);
-        if (!port)
-        {
-            printf ("jack_netsource: cannot register %s port\n", buf);
-            break;
-        }
-        playback_ports = jack_slist_append (playback_ports, port);
-    }
-}
-
-/**
- * The Sync callback... sync state is set elsewhere...
- * we will see if this is working correctly.
- * i dont really believe in it yet.
- */
-int
-sync_cb (jack_transport_state_t state, jack_position_t *pos, void *arg)
-{
-    static int latency_count = 0;
-    int retval = sync_state;
-
-    if (latency_count) {
-        latency_count--;
-        retval = 0;
-    }
-
-    else if (state == JackTransportStarting && last_transport_state != JackTransportStarting)
-    {
-        retval = 0;
-        latency_count = latency - 1;
-    }
-
-    last_transport_state = state;
-    return retval;
-}
-
-void
-freewheel_cb (int starting, void *arg)
-{
-	freewheeling = starting;
-}
-
-    int deadline_goodness=0;
-/**
- * The process callback for this JACK application.
- * It is called by JACK at the appropriate times.
- */
-int
-process (jack_nframes_t nframes, void *arg)
-{
-    jack_nframes_t net_period;
-    int rx_bufsize, tx_bufsize;
-
-    jack_default_audio_sample_t *buf;
-    jack_port_t *port;
-    JSList *node;
-    int chn;
-    int size, i;
-    const char *porttype;
-    int input_fd;
-
-    jack_position_t local_trans_pos;
-
-    uint32_t *packet_buf, *packet_bufX;
-    uint32_t *rx_packet_ptr;
-    jack_time_t packet_recv_timestamp;
-
-    if( bitdepth == 1000 )
-	net_period = (factor * jack_get_buffer_size(client) * 1024 / jack_get_sample_rate(client) / 8)&(~1) ;
-    else
-	net_period = (float) nframes / (float) factor;
-
-    rx_bufsize =  get_sample_size (bitdepth) * capture_channels * net_period + sizeof (jacknet_packet_header);
-    tx_bufsize =  get_sample_size (bitdepth) * playback_channels * net_period + sizeof (jacknet_packet_header);
-
-
-    /* Allocate a buffer where both In and Out Buffer will fit */
-    packet_buf = alloca ((rx_bufsize > tx_bufsize) ? rx_bufsize : tx_bufsize);
-
-    jacknet_packet_header *pkthdr = (jacknet_packet_header *) packet_buf;
-
-    /*
-     * for latency==0 we need to send out the packet before we wait on the reply.
-     * but this introduces a cycle of latency, when netsource is connected to itself.
-     * so we send out before read only in zero latency mode.
-     *
-     */
-
-    if( latency == 0 ) {
-	    /* reset packet_bufX... */
-	    packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
-
-	    /* ---------- Send ---------- */
-	    render_jack_ports_to_payload (bitdepth, playback_ports, playback_srcs, nframes,
-			    packet_bufX, net_period, dont_htonl_floats);
-
-	    /* fill in packet hdr */
-	    pkthdr->transport_state = jack_transport_query (client, &local_trans_pos);
-	    pkthdr->transport_frame = local_trans_pos.frame;
-	    pkthdr->framecnt = framecnt;
-	    pkthdr->latency = latency;
-	    pkthdr->reply_port = reply_port;
-	    pkthdr->sample_rate = jack_get_sample_rate (client);
-	    pkthdr->period_size = nframes;
-
-	    /* playback for us is capture on the other side */
-	    pkthdr->capture_channels_audio = playback_channels_audio;
-	    pkthdr->playback_channels_audio = capture_channels_audio;
-	    pkthdr->capture_channels_midi = playback_channels_midi;
-	    pkthdr->playback_channels_midi = capture_channels_midi;
-	    pkthdr->mtu = mtu;
-	    if( freewheeling!= 0 )
-		    pkthdr->sync_state = (jack_nframes_t)MASTER_FREEWHEELS;
-	    else
-		    pkthdr->sync_state = (jack_nframes_t)deadline_goodness;
-	    //printf("goodness=%d\n", deadline_goodness );
-
-	    packet_header_hton (pkthdr);
-	    if (cont_miss < 3*latency+5) {
-		    int r;
-		    for( r=0; r<redundancy; r++ )
-			    netjack_sendto (outsockfd, (char *) packet_buf, tx_bufsize, 0, &destaddr, sizeof (destaddr), mtu);
-	    }
-	    else if (cont_miss > 50+5*latency)
-	    {
-		    state_connected = 0;
-		    packet_cache_reset_master_address( global_packcache );
-		    //printf ("Frame %d  \tRealy too many packets missed (%d). Let's reset the counter\n", framecnt, cont_miss);
-		    cont_miss = 0;
-	    }
-    }
-
-    /*
-     * ok... now the RECEIVE code.
-     *
-     */
-
-    /* reset packet_bufX... */
-    packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
-
-    if( reply_port )
-	input_fd = insockfd;
-    else
-	input_fd = outsockfd;
-
-    // for latency == 0 we can poll.
-    if( (latency == 0) || (freewheeling!=0)  ) {
-	jack_time_t deadline = jack_get_time() + 1000000 * jack_get_buffer_size(client)/jack_get_sample_rate(client);
-	// Now loop until we get the right packet.
-	while(1) {
-	    jack_nframes_t got_frame;
-	    if ( ! netjack_poll_deadline( input_fd, deadline ) )
-		break;
-
-	    packet_cache_drain_socket(global_packcache, input_fd);
-
-	    if (packet_cache_get_next_available_framecnt( global_packcache, framecnt - latency, &got_frame ))
-		if( got_frame == (framecnt - latency) )
-		    break;
-	}
-    } else {
-	// normally:
-	// only drain socket.
-	packet_cache_drain_socket(global_packcache, input_fd);
-    }
-
-    size = packet_cache_retreive_packet_pointer( global_packcache, framecnt - latency, (char**)&rx_packet_ptr, rx_bufsize, &packet_recv_timestamp );
-    /* First alternative : we received what we expected. Render the data
-     * to the JACK ports so it can be played. */
-    if (size == rx_bufsize)
-    {
-	packet_buf = rx_packet_ptr;
-	pkthdr = (jacknet_packet_header *) packet_buf;
-	packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
-	// calculate how much time there would have been, if this packet was sent at the deadline.
-
-	int recv_time_offset = (int) (jack_get_time() - packet_recv_timestamp);
-	packet_header_ntoh (pkthdr);
-	deadline_goodness = recv_time_offset - (int)pkthdr->latency;
-	//printf( "deadline goodness = %d ---> off: %d\n", deadline_goodness, recv_time_offset );
-
-        if (cont_miss)
-        {
-            //printf("Frame %d  \tRecovered from dropouts\n", framecnt);
-            cont_miss = 0;
-        }
-        render_payload_to_jack_ports (bitdepth, packet_bufX, net_period,
-		capture_ports, capture_srcs, nframes, dont_htonl_floats);
-
-	state_currentframe = framecnt;
-	state_recv_packet_queue_time = recv_time_offset;
-	state_connected = 1;
-        sync_state = pkthdr->sync_state;
-	packet_cache_release_packet( global_packcache, framecnt - latency );
-    }
-    /* Second alternative : we've received something that's not
-     * as big as expected or we missed a packet. We render silence
-     * to the ouput ports */
-    else
-    {
-	jack_nframes_t latency_estimate;
-	if( packet_cache_find_latency( global_packcache, framecnt, &latency_estimate ) )
-	    //if( (state_latency == 0) || (latency_estimate < state_latency) )
-		state_latency = latency_estimate;
-
-	// Set the counters up.
-	state_currentframe = framecnt;
-	//state_latency = framecnt - pkthdr->framecnt;
-	state_netxruns += 1;
-
-        //printf ("Frame %d  \tPacket missed or incomplete (expected: %d bytes, got: %d bytes)\n", framecnt, rx_bufsize, size);
-        //printf ("Frame %d  \tPacket missed or incomplete\n", framecnt);
-        cont_miss += 1;
-        chn = 0;
-        node = capture_ports;
-        while (node != NULL)
-        {
-            port = (jack_port_t *) node->data;
-            buf = jack_port_get_buffer (port, nframes);
-            porttype = jack_port_type (port);
-            if (strncmp (porttype, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size ()) == 0)
-                for (i = 0; i < nframes; i++)
-                    buf[i] = 0.0;
-            else if (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size ()) == 0)
-                jack_midi_clear_buffer (buf);
-            node = jack_slist_next (node);
-            chn++;
-        }
-    }
-    if( latency != 0 ) {
-	    /* reset packet_bufX... */
-	    packet_bufX = packet_buf + sizeof (jacknet_packet_header) / sizeof (jack_default_audio_sample_t);
-
-	    /* ---------- Send ---------- */
-	    render_jack_ports_to_payload (bitdepth, playback_ports, playback_srcs, nframes,
-			    packet_bufX, net_period, dont_htonl_floats);
-
-	    /* fill in packet hdr */
-	    pkthdr->transport_state = jack_transport_query (client, &local_trans_pos);
-	    pkthdr->transport_frame = local_trans_pos.frame;
-	    pkthdr->framecnt = framecnt;
-	    pkthdr->latency = latency;
-	    pkthdr->reply_port = reply_port;
-	    pkthdr->sample_rate = jack_get_sample_rate (client);
-	    pkthdr->period_size = nframes;
-
-	    /* playback for us is capture on the other side */
-	    pkthdr->capture_channels_audio = playback_channels_audio;
-	    pkthdr->playback_channels_audio = capture_channels_audio;
-	    pkthdr->capture_channels_midi = playback_channels_midi;
-	    pkthdr->playback_channels_midi = capture_channels_midi;
-	    pkthdr->mtu = mtu;
-	    if( freewheeling!= 0 )
-		    pkthdr->sync_state = (jack_nframes_t)MASTER_FREEWHEELS;
-	    else
-		    pkthdr->sync_state = (jack_nframes_t)deadline_goodness;
-	    //printf("goodness=%d\n", deadline_goodness );
-
-	    packet_header_hton (pkthdr);
-	    if (cont_miss < 3*latency+5) {
-		    int r;
-		    for( r=0; r<redundancy; r++ )
-			    netjack_sendto (outsockfd, (char *) packet_buf, tx_bufsize, 0, &destaddr, sizeof (destaddr), mtu);
-	    }
-	    else if (cont_miss > 50+5*latency)
-	    {
-		    state_connected = 0;
-		    packet_cache_reset_master_address( global_packcache );
-		    //printf ("Frame %d  \tRealy too many packets missed (%d). Let's reset the counter\n", framecnt, cont_miss);
-		    cont_miss = 0;
-	    }
-    }
-
-    framecnt++;
-    return 0;
-}
-
-/**
- * This is the shutdown callback for this JACK application.
- * It is called by JACK if the server ever shuts down or
- * decides to disconnect the client.
- */
-
-void
-jack_shutdown (void *arg)
-{
-    exit (1);
-}
-
-void
-init_sockaddr_in (struct sockaddr_in *name , const char *hostname , uint16_t port)
-{
-    name->sin_family = AF_INET ;
-    name->sin_port = htons (port);
-    if (hostname)
-    {
-        struct hostent *hostinfo = gethostbyname (hostname);
-        if (hostinfo == NULL) {
-            fprintf (stderr, "init_sockaddr_in: unknown host: %s.\n", hostname);
-	    fflush( stderr );
-	}
-#ifdef WIN32
-        name->sin_addr.s_addr = inet_addr( hostname );
-#else
-        name->sin_addr = *(struct in_addr *) hostinfo->h_addr ;
-#endif
-    }
-    else
-        name->sin_addr.s_addr = htonl (INADDR_ANY) ;
-
-}
-
-void
-printUsage ()
-{
-fprintf (stderr, "usage: jack_netsource [options]\n"
-        "\n"
-        "  -h this help text\n"
-        "  -H <slave host> - Host name of the slave JACK\n"
-        "  -o <num channels> - Number of audio playback channels\n"
-        "  -i <num channels> - Number of audio capture channels\n"
-        "  -O <num channels> - Number of midi playback channels\n"
-        "  -I <num channels> - Number of midi capture channels\n"
-        "  -n <periods> - Network latency in JACK periods\n"
-        "  -p <port> - UDP port that the slave is listening on\n"
-        "  -r <reply port> - UDP port that we are listening on\n"
-	"  -B <bind port> - reply port, for use in NAT environments\n"
-        "  -b <bitdepth> - Set transport to use 16bit or 8bit\n"
-	"  -c <kbits> - Use CELT encoding with <kbits> kbits per channel\n"
-        "  -m <mtu> - Assume this mtu for the link\n"
-	"  -R <N> - Redundancy: send out packets N times.\n"
-	"  -e - skip host-to-network endianness conversion\n"
-        "  -N <jack name> - Reports a different name to jack\n"
-        "  -s <server name> - The name of the local jack server\n"
-        "\n");
-}
-
-void
-sigterm_handler( int signal )
-{
-	quit = 1;
-}
-
-int
-main (int argc, char *argv[])
-{
-    /* Some startup related basics */
-    char *client_name, *server_name = NULL, *peer_ip;
-    int peer_port = 3000;
-    jack_options_t options = JackNullOption;
-    jack_status_t status;
-#ifdef WIN32
-    WSADATA wsa;
-    int rc = WSAStartup(MAKEWORD(2,0),&wsa);
-#endif
-    /* Torben's famous state variables, aka "the reporting API" ! */
-    /* heh ? these are only the copies of them ;)                 */
-    int statecopy_connected, statecopy_latency, statecopy_netxruns;
-    jack_nframes_t net_period;
-    /* Argument parsing stuff */
-    extern char *optarg;
-    extern int optind, optopt;
-    int errflg=0, c;
-
-    if (argc < 3)
-    {
-        printUsage ();
-        return 1;
-    }
-
-    client_name = (char *) malloc (sizeof (char) * 10);
-    peer_ip = (char *) malloc (sizeof (char) * 10);
-    sprintf(client_name, "netjack");
-    sprintf(peer_ip, "localhost");
-
-    while ((c = getopt (argc, argv, ":h:H:o:i:O:I:n:p:r:B:b:c:m:R:e:N:s:")) != -1)
-    {
-        switch (c)
-        {
-            case 'h':
-                printUsage();
-                exit (0);
-                break;
-            case 'H':
-                free(peer_ip);
-                peer_ip = (char *) malloc (sizeof (char) * strlen (optarg)+1);
-                strcpy (peer_ip, optarg);
-                break;
-            case 'o':
-                playback_channels_audio = atoi (optarg);
-                break;
-            case 'i':
-                capture_channels_audio = atoi (optarg);
-                break;
-            case 'O':
-                playback_channels_midi = atoi (optarg);
-                break;
-            case 'I':
-                capture_channels_midi = atoi (optarg);
-                break;
-            case 'n':
-                latency = atoi (optarg);
-                break;
-            case 'p':
-                peer_port = atoi (optarg);
-                break;
-            case 'r':
-                reply_port = atoi (optarg);
-                break;
-            case 'B':
-                bind_port = atoi (optarg);
-                break;
-            case 'f':
-                factor = atoi (optarg);
-                printf("This feature is deprecated and will be removed in future netjack versions. CELT offers a superiour way to conserve bandwidth");
-                break;
-            case 'b':
-                bitdepth = atoi (optarg);
-                break;
-	    case 'c':
-#if HAVE_CELT
-	        bitdepth = 1000;
-                factor = atoi (optarg);
-#else
-                printf( "not built with celt supprt\n" );
-                exit(10);
-#endif
-	        break;
-            case 'm':
-                mtu = atoi (optarg);
-                break;
-            case 'R':
-                redundancy = atoi (optarg);
-                break;
-            case 'e':
-                dont_htonl_floats = 1;
-                break;
-            case 'N':
-                free(client_name);
-                client_name = (char *) malloc (sizeof (char) * strlen (optarg)+1);
-                strcpy (client_name, optarg);
-                break;
-            case 's':
-                server_name = (char *) malloc (sizeof (char) * strlen (optarg)+1);
-                strcpy (server_name, optarg);
-                options |= JackServerName;
-                break;
-            case ':':
-                fprintf (stderr, "Option -%c requires an operand\n", optopt);
-                errflg++;
-                break;
-            case '?':
-                fprintf (stderr, "Unrecognized option: -%c\n", optopt);
-                errflg++;
-        }
-    }
-    if (errflg)
-    {
-        printUsage ();
-        exit (2);
-    }
-
-    capture_channels = capture_channels_audio + capture_channels_midi;
-    playback_channels = playback_channels_audio + playback_channels_midi;
-
-    outsockfd = socket (AF_INET, SOCK_DGRAM, 0);
-    insockfd = socket (AF_INET, SOCK_DGRAM, 0);
-
-    if( (outsockfd == -1) || (insockfd == -1) ) {
-        fprintf (stderr, "cant open sockets\n" );
-        return 1;
-    }
-
-    init_sockaddr_in ((struct sockaddr_in *) &destaddr, peer_ip, peer_port);
-    if(bind_port) {
-        init_sockaddr_in ((struct sockaddr_in *) &bindaddr, NULL, bind_port);
-        if( bind (outsockfd, &bindaddr, sizeof (bindaddr)) ) {
-		fprintf (stderr, "bind failure\n" );
-	}
-    }
-    if(reply_port)
-    {
-        init_sockaddr_in ((struct sockaddr_in *) &bindaddr, NULL, reply_port);
-        if( bind (insockfd, &bindaddr, sizeof (bindaddr)) ) {
-		fprintf (stderr, "bind failure\n" );
-	}
-    }
-
-    /* try to become a client of the JACK server */
-    client = jack_client_open (client_name, options, &status, server_name);
-    if (client == NULL)
-    {
-        fprintf (stderr, "jack_client_open() failed, status = 0x%2.0x\n"
-                         "Is the JACK server running ?\n", status);
-        return 1;
-    }
-
-    /* Set up jack callbacks */
-    jack_set_process_callback (client, process, 0);
-    jack_set_sync_callback (client, sync_cb, 0);
-    jack_set_freewheel_callback (client, freewheel_cb, 0);
-    jack_on_shutdown (client, jack_shutdown, 0);
-
-    alloc_ports (capture_channels_audio, playback_channels_audio, capture_channels_midi, playback_channels_midi);
-
-    if( bitdepth == 1000 )
-	net_period = (factor * jack_get_buffer_size(client) * 1024 / jack_get_sample_rate(client) / 8)&(~1) ;
-    else
-	net_period = ceilf((float) jack_get_buffer_size (client) / (float) factor);
-
-    int rx_bufsize =  get_sample_size (bitdepth) * capture_channels * net_period + sizeof (jacknet_packet_header);
-    global_packcache = packet_cache_new (latency + 50, rx_bufsize, mtu);
-
-    /* tell the JACK server that we are ready to roll */
-    if (jack_activate (client))
-    {
-        fprintf (stderr, "Cannot activate client");
-        return 1;
-    }
-
-    /* Now sleep forever... and evaluate the state_ vars */
-
-    signal( SIGTERM, sigterm_handler );
-    signal( SIGINT, sigterm_handler );
-
-    statecopy_connected = 2; // make it report unconnected on start.
-    statecopy_latency = state_latency;
-    statecopy_netxruns = state_netxruns;
-
-    while ( !quit )
-    {
-#ifdef WIN32
-        Sleep (1000);
-#else
-        sleep(1);
-#endif
-        if (statecopy_connected != state_connected)
-        {
-            statecopy_connected = state_connected;
-            if (statecopy_connected)
-            {
-                state_netxruns = 1; // We want to reset the netxrun count on each new connection
-                printf ("Connected :-)\n");
-            }
-            else
-                printf ("Not Connected\n");
-
-	    fflush(stdout);
-        }
-
-	if (statecopy_connected)
-	{
-            if (statecopy_netxruns != state_netxruns) {
-		statecopy_netxruns = state_netxruns;
-		printf ("%s: at frame %06d -> total netxruns %d  (%d%%) queue time= %d\n",
-				client_name, 
-				state_currentframe,
-				statecopy_netxruns,
-				100*statecopy_netxruns/state_currentframe,
-				state_recv_packet_queue_time);
-
-		fflush(stdout);
-            }
-        }
-        else
-        {
-            if (statecopy_latency != state_latency)
-            {
-                statecopy_latency = state_latency;
-                if (statecopy_latency > 1)
-                printf ("current latency %d\n", statecopy_latency);
-		fflush(stdout);
-            }
-        }
-    }
-
-    jack_client_close (client);
-    packet_cache_free (global_packcache);
-    exit (0);
-}
diff --git a/tools/samplerate.c b/tools/samplerate.c
deleted file mode 100644
index b45cea8..0000000
--- a/tools/samplerate.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  smaplerate.c -- get current samplerate
- *
- *  Copyright (C) 2003 Jack O'Quin.
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <jack/jack.h>
-#include <jack/transport.h>
-
-char *package;				/* program name */
-jack_client_t *client;
-
-void jack_shutdown(void *arg)
-{
-	fprintf(stderr, "JACK shut down, exiting ...\n");
-	exit(1);
-}
-
-void signal_handler(int sig)
-{
-	jack_client_close(client);
-	fprintf(stderr, "signal received, exiting ...\n");
-	exit(0);
-}
-
-void parse_arguments(int argc, char *argv[])
-{
-
-	/* basename $0 */
-	package = strrchr(argv[0], '/');
-	if (package == 0)
-		package = argv[0];
-	else
-		package++;
-
-	if (argc==1) {
-		return;
-	}
-	fprintf(stderr, "usage: %s [bufsize]\n", package);
-	exit(9);
-}
-
-int main(int argc, char *argv[])
-{
-	parse_arguments(argc, argv);
-
-	/* become a JACK client */
-	if ((client = jack_client_new(package)) == 0) {
-		fprintf(stderr, "JACK server not running?\n");
-		exit(1);
-	}
-
-	signal(SIGQUIT, signal_handler);
-	signal(SIGTERM, signal_handler);
-	signal(SIGHUP, signal_handler);
-	signal(SIGINT, signal_handler);
-
-	jack_on_shutdown(client, jack_shutdown, 0);
-
-	fprintf(stdout, "%d\n", jack_get_sample_rate( client ) );
-
-	jack_client_close(client);
-
-	return 0;
-}
diff --git a/tools/transport.c b/tools/transport.c
deleted file mode 100644
index a1b0ab7..0000000
--- a/tools/transport.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- *  transport.c -- JACK transport master example client.
- *
- *  Copyright (C) 2003 Jack O'Quin.
- *  
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <readline/readline.h>
-#include <readline/history.h>
-#include <jack/jack.h>
-#include <jack/transport.h>
-
-char *package;				/* program name */
-int done = 0;
-jack_client_t *client;
-
-/* Time and tempo variables.  These are global to the entire,
- * transport timeline.  There is no attempt to keep a true tempo map.
- * The default time signature is: "march time", 4/4, 120bpm
- */
-float time_beats_per_bar = 4.0;
-float time_beat_type = 4.0;
-double time_ticks_per_beat = 1920.0;
-double time_beats_per_minute = 120.0;
-volatile int time_reset = 1;		/* true when time values change */
-volatile int avr_set = 0;
-float audio_frames_per_video_frame;
-
-/* JACK timebase callback.
- *
- * Runs in the process thread.  Realtime, must not wait.
- */
-void timebase(jack_transport_state_t state, jack_nframes_t nframes, 
-	      jack_position_t *pos, int new_pos, void *arg)
-{
-	double min;			/* minutes since frame 0 */
-	long abs_tick;			/* ticks since frame 0 */
-	long abs_beat;			/* beats since frame 0 */
-
-	if (new_pos || time_reset) {
-
-		pos->valid = JackPositionBBT;
-		pos->beats_per_bar = time_beats_per_bar;
-		pos->beat_type = time_beat_type;
-		pos->ticks_per_beat = time_ticks_per_beat;
-		pos->beats_per_minute = time_beats_per_minute;
-
-		time_reset = 0;		/* time change complete */
-
-		/* Compute BBT info from frame number.  This is relatively
-		 * simple here, but would become complex if we supported tempo
-		 * or time signature changes at specific locations in the
-		 * transport timeline. 
-		 */
-
-		min = pos->frame / ((double) pos->frame_rate * 60.0);
-		abs_tick = min * pos->beats_per_minute * pos->ticks_per_beat;
-		abs_beat = abs_tick / pos->ticks_per_beat;
-
-		pos->bar = abs_beat / pos->beats_per_bar;
-		pos->beat = abs_beat - (pos->bar * pos->beats_per_bar) + 1;
-		pos->tick = abs_tick - (abs_beat * pos->ticks_per_beat);
-		pos->bar_start_tick = pos->bar * pos->beats_per_bar *
-			pos->ticks_per_beat;
-		pos->bar++;		/* adjust start to bar 1 */
-
-#if 0
-		/* some debug code... */
-		fprintf(stderr, "\nnew position: %" PRIu32 "\tBBT: %3"
-			PRIi32 "|%" PRIi32 "|%04" PRIi32 "\n",
-			pos->frame, pos->bar, pos->beat, pos->tick);
-#endif
-
-	} else {
-
-		/* Compute BBT info based on previous period. */
-		pos->tick +=
-			nframes * pos->ticks_per_beat * pos->beats_per_minute
-			/ (pos->frame_rate * 60);
-
-		while (pos->tick >= pos->ticks_per_beat) {
-			pos->tick -= pos->ticks_per_beat;
-			if (++pos->beat > pos->beats_per_bar) {
-				pos->beat = 1;
-				++pos->bar;
-				pos->bar_start_tick +=
-					pos->beats_per_bar
-					* pos->ticks_per_beat;
-			}
-		}
-	}
-
-	if (avr_set) {
-		pos->valid |= JackAudioVideoRatio;
-		pos->audio_frames_per_video_frame = audio_frames_per_video_frame;
-	}
-}
-
-void jack_shutdown(void *arg)
-{
-#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0400
-	rl_cleanup_after_signal();
-#endif
-	fprintf(stderr, "JACK shut down, exiting ...\n");
-	exit(1);
-}
-
-void signal_handler(int sig)
-{
-	jack_client_close(client);
-	fprintf(stderr, "signal received, exiting ...\n");
-	exit(0);
-}
-
-
-/* Command functions: see commands[] table following. */
-
-void com_activate(char *arg)
-{
-	if (jack_activate(client)) {
-		fprintf(stderr, "cannot activate client");
-	}
-}
-
-void com_deactivate(char *arg)
-{
-	if (jack_deactivate(client)) {
-		fprintf(stderr, "cannot deactivate client");
-	}
-}
-
-void com_exit(char *arg)
-{
-	done = 1;
-}
-
-void com_help(char *);			/* forward declaration */
-
-void com_locate(char *arg)
-{
-	jack_nframes_t frame = 0;
-
-	if (*arg != '\0')
-		frame = atoi(arg);
-
-	jack_transport_locate(client, frame);
-}
-
-void com_master(char *arg)
-{
-	int cond = (*arg != '\0');
-	if (jack_set_timebase_callback(client, cond, timebase, NULL) != 0)
-		fprintf(stderr, "Unable to take over timebase.\n");
-}
-
-void com_play(char *arg)
-{
-	jack_transport_start(client);
-}
-
-void com_release(char *arg)
-{
-	jack_release_timebase(client);
-}
-
-void com_stop(char *arg)
-{
-	jack_transport_stop(client);
-}
-
-/* Change the tempo for the entire timeline, not just from the current
- * location. */
-void com_tempo(char *arg)
-{
-	float tempo = 120.0;
-
-	if (*arg != '\0')
-		tempo = atof(arg);
-
-	time_beats_per_minute = tempo;
-	time_reset = 1;
-}
-
-/* Set sync timeout in seconds. */
-void com_timeout(char *arg)
-{
-	double timeout = 2.0;
-
-	if (*arg != '\0')
-		timeout = atof(arg);
-
-	jack_set_sync_timeout(client, (jack_time_t) (timeout*1000000));
-}
-
-
-/* Change the tempo for the entire timeline, not just from the current
- * location. */
-void com_av_ratio(char *arg)
-{
-	float avr = 0;
-
-	if (*arg != '\0')
-		avr = atof(arg);
-
-	audio_frames_per_video_frame = avr;
-	avr_set = 1;
-}
-
-/* Command parsing based on GNU readline info examples. */
-
-typedef void cmd_function_t(char *);	/* command function type */
-
-/* Transport command table. */
-typedef struct {
-	char *name;			/* user printable name */
-	cmd_function_t *func;		/* function to call */
-	char *doc;			/* documentation  */
-} command_t;
-
-/* command table must be in alphabetical order */
-command_t commands[] = {
-	{"activate",	com_activate,	"Call jack_activate()"},
-	{"avr",	        com_av_ratio,	"Set audio/video frame ratio <audio frames per video frame>"},
-	{"exit",	com_exit,	"Exit transport program"},
-	{"deactivate",	com_deactivate,	"Call jack_deactivate()"},
-	{"help",	com_help,	"Display help text [<command>]"},
-	{"locate",	com_locate,	"Locate to frame <position>"},
-	{"master",	com_master,	"Become timebase master "
-					"[<conditionally>]"},
-	{"play",	com_play,	"Start transport rolling"},
-	{"quit",	com_exit,	"Synonym for `exit'"},
-	{"release",	com_release,	"Release timebase"},
-	{"stop",	com_stop,	"Stop transport"},
-	{"tempo",	com_tempo,	"Set beat tempo <beats_per_min>"},
-	{"timeout",	com_timeout,	"Set sync timeout in <seconds>"},
-	{"?",		com_help,	"Synonym for `help'" },
-	{(char *)NULL, (cmd_function_t *)NULL, (char *)NULL }
-};
-     
-command_t *find_command(char *name)
-{
-	register int i;
-	size_t namelen;
-
-	if ((name == NULL) || (*name == '\0'))
-		return ((command_t *)NULL);
-
-	namelen = strlen(name);
-	for (i = 0; commands[i].name; i++)
-		if (strncmp(name, commands[i].name, namelen) == 0) {
-
-			/* make sure the match is unique */
-			if ((commands[i+1].name) &&
-			    (strncmp(name, commands[i+1].name, namelen) == 0))
-				return ((command_t *)NULL);
-			else
-				return (&commands[i]);
-		}
-     
-	return ((command_t *)NULL);
-}
-
-void com_help(char *arg)
-{
-	register int i;
-	command_t *cmd;
-
-	if (!*arg) {
-		/* print help for all commands */
-		for (i = 0; commands[i].name; i++) {
-			printf("%s\t\t%s.\n", commands[i].name,
-			       commands[i].doc);
-		}
-
-	} else if ((cmd = find_command(arg))) {
-		printf("%s\t\t%s.\n", cmd->name, cmd->doc);
-
-	} else {
-		int printed = 0;
-
-		printf("No `%s' command.  Valid command names are:\n", arg);
-
-		for (i = 0; commands[i].name; i++) {
-			/* Print in six columns. */
-			if (printed == 6) {
-				printed = 0;
-				printf ("\n");
-			}
-
-			printf ("%s\t", commands[i].name);
-			printed++;
-		}
-
-		printf("\n\nTry `help [command]\' for more information.\n");
-	}
-}
-
-void execute_command(char *line)
-{
-	register int i;
-	command_t *command;
-	char *word;
-     
-	/* Isolate the command word. */
-	i = 0;
-	while (line[i] && whitespace(line[i]))
-		i++;
-	word = line + i;
-     
-	while (line[i] && !whitespace(line[i]))
-		i++;
-     
-	if (line[i])
-		line[i++] = '\0';
-     
-	command = find_command(word);
-     
-	if (!command) {
-		fprintf(stderr, "%s: No such command.  There is `help\'.\n",
-			word);
-		return;
-	}
-     
-	/* Get argument to command, if any. */
-	while (whitespace(line[i]))
-		i++;
-     
-	word = line + i;
-     
-	/* invoke the command function. */
-	(*command->func)(word);
-}
-
-
-/* Strip whitespace from the start and end of string. */
-char *stripwhite(char *string)
-{
-	register char *s, *t;
-
-	s = string;
-	while (whitespace(*s))
-		s++;
-
-	if (*s == '\0')
-		return s;
-     
-	t = s + strlen (s) - 1;
-	while (t > s && whitespace(*t))
-		t--;
-	*++t = '\0';
-     
-	return s;
-}
-     
-char *dupstr(char *s)
-{
-	char *r = malloc(strlen(s) + 1);
-	strcpy(r, s);
-	return r;
-}
-     
-/* Readline generator function for command completion. */
-char *command_generator (const char *text, int state)
-{
-	static int list_index, len;
-	char *name;
-     
-	/* If this is a new word to complete, initialize now.  This
-	   includes saving the length of TEXT for efficiency, and
-	   initializing the index variable to 0. */
-	if (!state) {
-		list_index = 0;
-		len = strlen (text);
-	}
-     
-	/* Return the next name which partially matches from the
-	   command list. */
-	while ((name = commands[list_index].name)) {
-		list_index++;
-     
-		if (strncmp(name, text, len) == 0)
-			return dupstr(name);
-	}
-     
-	return (char *) NULL;		/* No names matched. */
-}
-
-void command_loop()
-{
-	char *line, *cmd;
-	char prompt[32];
-
-	snprintf(prompt, sizeof(prompt), "%s> ", package);
-
-	/* Allow conditional parsing of the ~/.inputrc file. */
-	rl_readline_name = package;
-     
-	/* Define a custom completion function. */
-	rl_completion_entry_function = command_generator;
-
-	/* Read and execute commands until the user quits. */
-	while (!done) {
-
-		line = readline(prompt);
-     
-		if (line == NULL) {	/* EOF? */
-			printf("\n");	/* close out prompt */
-			done = 1;
-			break;
-		}
-     
-		/* Remove leading and trailing whitespace from the line. */
-		cmd = stripwhite(line);
-
-		/* If anything left, add to history and execute it. */
-		if (*cmd)
-		{
-			add_history(cmd);
-			execute_command(cmd);
-		}
-     
-		free(line);		/* realine() called malloc() */
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	jack_status_t status;
-
-	/* basename $0 */
-	package = strrchr(argv[0], '/');
-	if (package == 0)
-		package = argv[0];
-	else
-		package++;
-
-	/* open a connection to the JACK server */
-	client = jack_client_open (package, JackNullOption, &status);
-	if (client == NULL) {
-		fprintf (stderr, "jack_client_open() failed, "
-			 "status = 0x%2.0x\n", status);
-		return 1;
-	}
-
-	signal(SIGQUIT, signal_handler);
-	signal(SIGTERM, signal_handler);
-	signal(SIGHUP, signal_handler);
-	signal(SIGINT, signal_handler);
-
-	jack_on_shutdown(client, jack_shutdown, 0);
-
-	if (jack_activate(client)) {
-		fprintf(stderr, "cannot activate client");
-		return 1;
-	}
-
-	/* execute commands until done */
-	command_loop();
-
-	jack_client_close(client);
-	exit(0);
-}
diff --git a/tools/tw.c b/tools/tw.c
deleted file mode 100644
index 3ba62cc..0000000
--- a/tools/tw.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/** @file simple_client.c
- *
- * @brief This simple client demonstrates the basic features of JACK
- * as they would be used by many applications.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <jack/jack.h>
-
-jack_port_t *input_port;
-jack_port_t *output_port;
-jack_client_t *client;
-
-/* a simple state machine for this client */
-volatile enum {
-	Init,
-	Run,
-	Exit
-} client_state = Init;
-
-/**
- * The process callback for this JACK application is called in a
- * special realtime thread once for each audio cycle.
- *
- * This client follows a simple rule: when the JACK transport is
- * running, copy the input port to the output.  When it stops, exit.
- */
-int
-_process (jack_nframes_t nframes)
-{
-	jack_default_audio_sample_t *in, *out;
-	jack_transport_state_t ts = jack_transport_query(client, NULL);
-	
-	if (ts == JackTransportRolling) {
-		
-		if (client_state == Init)
-			client_state = Run;
-		
-		in = jack_port_get_buffer (input_port, nframes);
-		out = jack_port_get_buffer (output_port, nframes);
-		memcpy (out, in,
-			sizeof (jack_default_audio_sample_t) * nframes);
-		
-	} else if (ts == JackTransportStopped) {
-		
-		if (client_state == Run)
-			client_state = Exit;
-	}
-
-	return 0;      
-}
-
-int
-process (jack_nframes_t nframes, void* arg)
-{
-	jack_client_t* client = (jack_client_t*) arg;
-
-	while ((nframes = jack_thread_wait (client, _process (nframes))) != 0);
-
-	return 0;
-}
-
-/**
- * JACK calls this shutdown_callback if the server ever shuts down or
- * decides to disconnect the client.
- */
-void
-jack_shutdown (void *arg)
-{
-	exit (1);
-}
-
-int
-main (int argc, char *argv[])
-{
-	const char **ports;
-	const char *client_name;
-	const char *server_name = NULL;
-	jack_options_t options = JackNullOption;
-	jack_status_t status;
-
-	if (argc >= 2) {		/* client name specified? */
-		client_name = argv[1];
-		if (argc >= 3) {	/* server name specified? */
-			server_name = argv[2];
-			options |= JackServerName;
-		}
-	} else {			/* use basename of argv[0] */
-		client_name = strrchr(argv[0], '/');
-		if (client_name == 0) {
-			client_name = argv[0];
-		} else {
-			client_name++;
-		}
-	}
-
-	/* open a client connection to the JACK server */
-
-	client = jack_client_open (client_name, options, &status, server_name);
-	if (client == NULL) {
-		fprintf (stderr, "jack_client_open() failed, "
-			 "status = 0x%2.0x\n", status);
-		if (status & JackServerFailed) {
-			fprintf (stderr, "Unable to connect to JACK server\n");
-		}
-		exit (1);
-	}
-	if (status & JackServerStarted) {
-		fprintf (stderr, "JACK server started\n");
-	}
-	if (status & JackNameNotUnique) {
-		client_name = jack_get_client_name(client);
-		fprintf (stderr, "unique name `%s' assigned\n", client_name);
-	}
-
-	/* tell the JACK server to call `process()' whenever
-	   there is work to be done.
-	*/
-
-	jack_set_process_callback (client, process, client);
-
-	/* tell the JACK server to call `jack_shutdown()' if
-	   it ever shuts down, either entirely, or if it
-	   just decides to stop calling us.
-	*/
-
-	jack_on_shutdown (client, jack_shutdown, 0);
-
-	/* display the current sample rate. 
-	 */
-
-	printf ("engine sample rate: %" PRIu32 "\n",
-		jack_get_sample_rate (client));
-
-	/* create two ports */
-
-	input_port = jack_port_register (client, "input",
-					 JACK_DEFAULT_AUDIO_TYPE,
-					 JackPortIsInput, 0);
-	output_port = jack_port_register (client, "output",
-					  JACK_DEFAULT_AUDIO_TYPE,
-					  JackPortIsOutput, 0);
-
-	if ((input_port == NULL) || (output_port == NULL)) {
-		fprintf(stderr, "no more JACK ports available\n");
-		exit (1);
-	}
-
-	/* Tell the JACK server that we are ready to roll.  Our
-	 * process() callback will start running now. */
-
-	if (jack_activate (client)) {
-		fprintf (stderr, "cannot activate client");
-		exit (1);
-	}
-
-	/* Connect the ports.  You can't do this before the client is
-	 * activated, because we can't make connections to clients
-	 * that aren't running.  Note the confusing (but necessary)
-	 * orientation of the driver backend ports: playback ports are
-	 * "input" to the backend, and capture ports are "output" from
-	 * it.
-	 */
-
-	ports = jack_get_ports (client, NULL, NULL,
-				JackPortIsPhysical|JackPortIsOutput);
-	if (ports == NULL) {
-		fprintf(stderr, "no physical capture ports\n");
-		exit (1);
-	}
-
-	if (jack_connect (client, ports[0], jack_port_name (input_port))) {
-		fprintf (stderr, "cannot connect input ports\n");
-	}
-
-	free (ports);
-	
-	ports = jack_get_ports (client, NULL, NULL,
-				JackPortIsPhysical|JackPortIsInput);
-	if (ports == NULL) {
-		fprintf(stderr, "no physical playback ports\n");
-		exit (1);
-	}
-
-	if (jack_connect (client, jack_port_name (output_port), ports[0])) {
-		fprintf (stderr, "cannot connect output ports\n");
-	}
-
-	free (ports);
-
-	/* keep running until the transport stops */
-
-	while (client_state != Exit) {
-		sleep (1);
-	}
-
-	jack_client_close (client);
-	exit (0);
-}
diff --git a/tools/wait.c b/tools/wait.c
deleted file mode 100644
index 67e0b35..0000000
--- a/tools/wait.c
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-
-#include <time.h>
-
-#include <config.h>
-
-#include <jack/jack.h>
-
-char * my_name;
-
-void
-show_version (void)
-{
-	fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n",
-		my_name);
-}
-
-void
-show_usage (void)
-{
-	show_version ();
-	fprintf (stderr, "\nUsage: %s [options]\n", my_name);
-	fprintf (stderr, "Check for jack existence, or wait, until it either quits, or gets started\n");
-	fprintf (stderr, "options:\n");
-	fprintf (stderr, "        -s, --server <name>   Connect to the jack server named <name>\n");
-	fprintf (stderr, "        -w, --wait            Wait for server to become available\n");
-	fprintf (stderr, "        -q, --quit            Wait until server is quit\n");
-	fprintf (stderr, "        -c, --check           Check wether server is running\n");
-	fprintf (stderr, "        -t, --timeout         Wait timeout in seconds\n");
-	fprintf (stderr, "        -h, --help            Display this help message\n");
-	fprintf (stderr, "        --version             Output version information and exit\n\n");
-	fprintf (stderr, "For more information see http://jackaudio.org/\n");
-}
-
-int
-main (int argc, char *argv[])
-{
-	jack_client_t *client;
-	jack_status_t status;
-	jack_options_t options = JackNoStartServer;
-	int c;
-	int option_index;
-	char *server_name = NULL;
-	int wait_for_start = 0;
-	int wait_for_quit = 0;
-	int just_check = 0;
-	int wait_timeout = 0;
-	time_t start_timestamp;
-
-	
-	struct option long_options[] = {
-		{ "server", 1, 0, 's' },
-		{ "wait", 0, 0, 'w' },
-		{ "quit", 0, 0, 'q' },
-		{ "check", 0, 0, 'c' },
-		{ "timeout", 1, 0, 't' },
-		{ "help", 0, 0, 'h' },
-		{ "version", 0, 0, 'v' },
-		{ 0, 0, 0, 0 }
-	};
-
-	my_name = strrchr(argv[0], '/');
-	if (my_name == 0) {
-		my_name = argv[0];
-	} else {
-		my_name ++;
-	}
-
-	while ((c = getopt_long (argc, argv, "s:wqct:hv", long_options, &option_index)) >= 0) {
-		switch (c) {
-		case 's':
-			server_name = (char *) malloc (sizeof (char) * strlen(optarg));
-			strcpy (server_name, optarg);
-			options |= JackServerName;
-			break;
-		case 'w':
-			wait_for_start = 1;
-			break;
-		case 'q':
-			wait_for_quit = 1;
-			break;
-		case 'c':
-			just_check = 1;
-			break;
-		case 't':
-			wait_timeout = atoi(optarg);
-			break;
-		case 'h':
-			show_usage ();
-			return 1;
-			break;
-		case 'v':
-			show_version ();
-			return 1;
-			break;
-		default:
-			show_usage ();
-			return 1;
-			break;
-		}
-	}
-
-	/* try to open server in a loop. breaking under certein conditions */
-
-	start_timestamp = time( NULL );
-
-	while(1) {
-		client = jack_client_open ("wait", options, &status, server_name);
-		/* check for some real error and bail out */
-		if( (client == NULL) && !(status & JackServerFailed) ) {
-			fprintf (stderr, "jack_client_open() failed, "
-					"status = 0x%2.0x\n", status);
-			return 1;
-		}
-
-		if( client == NULL ) {
-			if( wait_for_quit ) {
-				fprintf( stdout, "server is gone\n" );
-				break;
-			}
-			if( just_check ) {
-				fprintf( stdout, "not running\n" );
-				break;
-			}
-		} else {
-			jack_client_close( client );
-			if( wait_for_start ) {
-				fprintf( stdout, "server is available\n" );
-				break;
-			}
-			if( just_check ) {
-				fprintf( stdout, "running\n" );
-				break;
-			}
-		}
-		if( wait_timeout ) {
-		       if( (time( NULL ) - start_timestamp) > wait_timeout ) {
-			       fprintf( stdout, "timeout\n" );
-			       break;
-		       }
-		}
-
-		// Wait a second, and repeat
-		sleep(1);
-	}
-
-	exit (0);
-}
diff --git a/waf b/waf
new file mode 100755
index 0000000..f0f7f63
Binary files /dev/null and b/waf differ
diff --git a/windows/JackAtomic_os.h b/windows/JackAtomic_os.h
new file mode 100644
index 0000000..0a393f7
--- /dev/null
+++ b/windows/JackAtomic_os.h
@@ -0,0 +1,76 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackAtomic_WIN32__
+#define __JackAtomic_WIN32__
+
+#include "JackTypes.h"
+
+#ifndef __MINGW32__
+#ifdef __SMP__
+#	define LOCK lock
+#else
+#	define LOCK
+#endif
+
+#ifndef inline
+	#define inline __inline
+#endif
+
+//----------------------------------------------------------------
+// CAS functions
+//----------------------------------------------------------------
+inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void * addr)
+{
+    register char c;
+    __asm {
+        push	ebx
+        push	esi
+        mov	esi, addr
+        mov	eax, value
+        mov	ebx, newvalue
+        LOCK cmpxchg dword ptr [esi], ebx
+        sete	c
+        pop	esi
+        pop	ebx
+    }
+    return c;
+}
+
+#else
+
+#define LOCK "lock ; "
+
+static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
+{
+    register char ret;
+    __asm__ __volatile__ (
+        "# CAS \n\t"
+        LOCK "cmpxchg %2, (%1) \n\t"
+        "sete %0               \n\t"
+    : "=a" (ret)
+                : "c" (addr), "d" (newvalue), "a" (value)
+            );
+    return ret;
+}
+
+#endif
+
+#endif
+
diff --git a/windows/JackCompilerDeps_os.h b/windows/JackCompilerDeps_os.h
new file mode 100644
index 0000000..858cbd8
--- /dev/null
+++ b/windows/JackCompilerDeps_os.h
@@ -0,0 +1,57 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackCompilerDeps_WIN32__
+#define __JackCompilerDeps_WIN32__
+
+#if __GNUC__
+    #ifndef POST_PACKED_STRUCTURE
+        /* POST_PACKED_STRUCTURE needs to be a macro which
+        expands into a compiler directive. The directive must
+        tell the compiler to arrange the preceding structure
+        declaration so that it is packed on byte-boundaries rather
+        than use the natural alignment of the processor and/or
+        compiler.
+        */
+        #if (__GNUC__< 4)  /* Does not seem to work with GCC 3.XX serie */
+            #define POST_PACKED_STRUCTURE
+        #elif defined(JACK_32_64)
+            #define POST_PACKED_STRUCTURE __attribute__((__packed__))
+        #else
+            #define POST_PACKED_STRUCTURE
+        #endif
+    #endif
+	#define MEM_ALIGN(x,y) x __attribute__((aligned(y)))
+	#define	EXPORT __declspec(dllexport)
+    #ifdef SERVER_SIDE
+        #define	SERVER_EXPORT __declspec(dllexport)
+    #else
+        #define	SERVER_EXPORT
+    #endif
+#else
+	#define MEM_ALIGN(x,y) x
+	#define	EXPORT __declspec(dllexport)
+    #ifdef SERVER_SIDE
+        #define	SERVER_EXPORT __declspec(dllexport)
+    #else
+        #define	SERVER_EXPORT
+    #endif
+#endif
+
+#endif
diff --git a/windows/JackNetWinSocket.cpp b/windows/JackNetWinSocket.cpp
new file mode 100644
index 0000000..94390b4
--- /dev/null
+++ b/windows/JackNetWinSocket.cpp
@@ -0,0 +1,360 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackNetWinSocket.h"
+
+namespace Jack
+{
+    //utility *********************************************************************************************************
+    SERVER_EXPORT int GetHostName ( char * name, int size )
+    {
+        if ( gethostname ( name, size ) == SOCKET_ERROR )
+        {
+            jack_error ( "Can't get 'hostname' : %s", strerror ( NET_ERROR_CODE ) );
+            strcpy ( name, "default" );
+            return -1;
+        }
+        return 0;
+    }
+
+    win_net_error_t NetErrorList[] =
+    {
+        E ( 0,                  "No error" ),
+        E ( WSAEINTR,           "Interrupted system call" ),
+        E ( WSAEBADF,           "Bad file number" ),
+        E ( WSAEACCES,          "Permission denied" ),
+        E ( WSAEFAULT,          "Bad address" ),
+        E ( WSAEINVAL,          "Invalid argument" ),
+        E ( WSAEMFILE,          "Too many open sockets" ),
+        E ( WSAEWOULDBLOCK,     "Operation would block" ),
+        E ( WSAEINPROGRESS,     "Operation now in progress" ),
+        E ( WSAEALREADY,        "Operation already in progress" ),
+        E ( WSAENOTSOCK,        "Socket operation on non-socket" ),
+        E ( WSAEDESTADDRREQ,    "Destination address required" ),
+        E ( WSAEMSGSIZE,        "Message too long" ),
+        E ( WSAEPROTOTYPE,      "Protocol wrong type for socket" ),
+        E ( WSAENOPROTOOPT,     "Bad protocol option" ),
+        E ( WSAEPROTONOSUPPORT, "Protocol not supported" ),
+        E ( WSAESOCKTNOSUPPORT, "Socket type not supported" ),
+        E ( WSAEOPNOTSUPP,      "Operation not supported on socket" ),
+        E ( WSAEPFNOSUPPORT,    "Protocol family not supported" ),
+        E ( WSAEAFNOSUPPORT,    "Address family not supported" ),
+        E ( WSAEADDRINUSE,      "Address already in use" ),
+        E ( WSAEADDRNOTAVAIL,   "Can't assign requested address" ),
+        E ( WSAENETDOWN,        "Network is down" ),
+        E ( WSAENETUNREACH,     "Network is unreachable" ),
+        E ( WSAENETRESET,       "Net connection reset" ),
+        E ( WSAECONNABORTED,    "Software caused connection abort" ),
+        E ( WSAECONNRESET,      "Connection reset by peer" ),
+        E ( WSAENOBUFS,         "No buffer space available" ),
+        E ( WSAEISCONN,         "Socket is already connected" ),
+        E ( WSAENOTCONN,        "Socket is not connected" ),
+        E ( WSAESHUTDOWN,       "Can't send after socket shutdown" ),
+        E ( WSAETOOMANYREFS,    "Too many references, can't splice" ),
+        E ( WSAETIMEDOUT,       "Connection timed out" ),
+        E ( WSAECONNREFUSED,    "Connection refused" ),
+        E ( WSAELOOP,           "Too many levels of symbolic links" ),
+        E ( WSAENAMETOOLONG,    "File name too long" ),
+        E ( WSAEHOSTDOWN,       "Host is down" ),
+        E ( WSAEHOSTUNREACH,    "No route to host" ),
+        E ( WSAENOTEMPTY,       "Directory not empty" ),
+        E ( WSAEPROCLIM,        "Too many processes" ),
+        E ( WSAEUSERS,          "Too many users" ),
+        E ( WSAEDQUOT,          "Disc quota exceeded" ),
+        E ( WSAESTALE,          "Stale NFS file handle" ),
+        E ( WSAEREMOTE,         "Too many levels of remote in path" ),
+        E ( WSASYSNOTREADY,     "Network system is unavailable" ),
+        E ( WSAVERNOTSUPPORTED, "Winsock version out of range" ),
+        E ( WSANOTINITIALISED,  "WSAStartup not yet called" ),
+        E ( WSAEDISCON,         "Graceful shutdown in progress" ),
+        E ( WSAHOST_NOT_FOUND,  "Host not found" ),
+        E ( WSANO_DATA,         "No host data of that type was found" ),
+        { -1, NULL },
+    };
+
+    SERVER_EXPORT const char* PrintError ( int error )
+    {
+        int i;
+        for ( i = 0; NetErrorList[i].code >= 0; ++i )
+        {
+            if ( error == NetErrorList[i].code )
+                return NetErrorList[i].msg;
+        }
+        return strerror ( error );
+    }
+
+    //construct/destruct***********************************************************************************************
+    JackNetWinSocket::JackNetWinSocket()
+    {
+        fSockfd = 0;
+        fSendAddr.sin_family = AF_INET;
+        fSendAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fSendAddr.sin_zero, 0, 8 );
+        fRecvAddr.sin_family = AF_INET;
+        fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fRecvAddr.sin_zero, 0, 8 );
+    }
+
+    JackNetWinSocket::JackNetWinSocket ( const char* ip, int port )
+    {
+        fSockfd = 0;
+        fPort = port;
+        fSendAddr.sin_family = AF_INET;
+        fSendAddr.sin_port = htons ( port );
+        fSendAddr.sin_addr.s_addr = inet_addr ( ip );
+        memset ( &fSendAddr.sin_zero, 0, 8 );
+        fRecvAddr.sin_family = AF_INET;
+        fRecvAddr.sin_port = htons ( port );
+        fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fRecvAddr.sin_zero, 0, 8 );
+    }
+
+    JackNetWinSocket::JackNetWinSocket ( const JackNetWinSocket& socket )
+    {
+        fSockfd = 0;
+        fPort = socket.fPort;
+        fSendAddr = socket.fSendAddr;
+        fRecvAddr = socket.fRecvAddr;
+    }
+
+    JackNetWinSocket::~JackNetWinSocket()
+    {
+        Close();
+    }
+
+    JackNetWinSocket& JackNetWinSocket::operator= ( const JackNetWinSocket& socket )
+    {
+        if ( this != &socket )
+        {
+            fSockfd = 0;
+            fPort = socket.fPort;
+            fSendAddr = socket.fSendAddr;
+            fRecvAddr = socket.fRecvAddr;
+        }
+        return *this;
+    }
+
+    //socket***********************************************************************************************************
+    int JackNetWinSocket::NewSocket()
+    {
+        if ( fSockfd )
+        {
+            Close();
+            Reset();
+        }
+        fSockfd = socket ( AF_INET, SOCK_DGRAM, 0 );
+        return fSockfd;
+    }
+
+    int JackNetWinSocket::Bind()
+    {
+        return bind ( fSockfd, reinterpret_cast<SOCKADDR*> ( &fRecvAddr ), sizeof ( SOCKADDR ) );
+    }
+
+    int JackNetWinSocket::BindWith ( const char* ip )
+    {
+        fRecvAddr.sin_addr.s_addr = inet_addr ( ip );
+        return Bind();
+    }
+
+    int JackNetWinSocket::BindWith ( int port )
+    {
+        fRecvAddr.sin_port = htons ( port );
+        return Bind();
+    }
+
+    int JackNetWinSocket::Connect()
+    {
+        return connect ( fSockfd, reinterpret_cast<SOCKADDR*> ( &fSendAddr ), sizeof ( SOCKADDR ) );
+    }
+
+    int JackNetWinSocket::ConnectTo ( const char* ip )
+    {
+        fSendAddr.sin_addr.s_addr = inet_addr ( ip );
+        return Connect();
+    }
+
+    void JackNetWinSocket::Close()
+    {
+        if ( fSockfd )
+            closesocket ( fSockfd );
+        fSockfd = 0;
+    }
+
+    void JackNetWinSocket::Reset()
+    {
+        fSendAddr.sin_family = AF_INET;
+        fSendAddr.sin_port = htons ( fPort );
+        fSendAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fSendAddr.sin_zero, 0, 8 );
+        fRecvAddr.sin_family = AF_INET;
+        fRecvAddr.sin_port = htons ( fPort );
+        fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY );
+        memset ( &fRecvAddr.sin_zero, 0, 8 );
+    }
+
+    bool JackNetWinSocket::IsSocket()
+    {
+        return ( fSockfd ) ? true : false;
+    }
+
+    //IP/PORT***********************************************************************************************************
+    void JackNetWinSocket::SetPort ( int port )
+    {
+        fPort = port;
+        fSendAddr.sin_port = htons ( port );
+        fRecvAddr.sin_port = htons ( port );
+    }
+
+    int JackNetWinSocket::GetPort()
+    {
+        return fPort;
+    }
+
+    //address***********************************************************************************************************
+    int JackNetWinSocket::SetAddress ( const char* ip, int port )
+    {
+        fSendAddr.sin_addr.s_addr = inet_addr ( ip );
+        fSendAddr.sin_port = htons ( port );
+        return 0;
+    }
+
+    char* JackNetWinSocket::GetSendIP()
+    {
+        return inet_ntoa ( fSendAddr.sin_addr );
+    }
+
+    char* JackNetWinSocket::GetRecvIP()
+    {
+        return inet_ntoa ( fRecvAddr.sin_addr );
+    }
+
+    //utility************************************************************************************************************
+    int JackNetWinSocket::GetName ( char* name )
+    {
+        return gethostname ( name, 255 );
+    }
+
+    int JackNetWinSocket::JoinMCastGroup ( const char* ip )
+    {
+        struct ip_mreq multicast_req;
+        multicast_req.imr_multiaddr.s_addr = inet_addr ( ip );
+        multicast_req.imr_interface.s_addr = htonl ( INADDR_ANY );
+        //12 is IP_ADD_MEMBERSHIP in winsock2 (differs from winsock1...)
+        return SetOption ( IPPROTO_IP, 12, &multicast_req, sizeof ( multicast_req ) );
+    }
+
+    //options************************************************************************************************************
+    int JackNetWinSocket::SetOption ( int level, int optname, const void* optval, SOCKLEN optlen )
+    {
+        return setsockopt ( fSockfd, level, optname, static_cast<const char*> ( optval ), optlen );
+    }
+
+    int JackNetWinSocket::GetOption ( int level, int optname, void* optval, SOCKLEN* optlen )
+    {
+        return getsockopt ( fSockfd, level, optname, static_cast<char*> ( optval ), optlen );
+    }
+
+    //tiemout************************************************************************************************************
+    int JackNetWinSocket::SetTimeOut ( int usec )
+    {
+        jack_log ( "JackNetWinSocket::SetTimeout %d usec", usec );
+
+        //negative timeout, or exceeding 10s, return
+        if ( ( usec < 0 ) || ( usec > 10000000 ) )
+            return SOCKET_ERROR;
+        int time = usec / 1000;
+        return SetOption ( SOL_SOCKET, SO_RCVTIMEO, &time, sizeof ( time ) );
+    }
+
+    //local loop*********************************************************************************************************
+    int JackNetWinSocket::SetLocalLoop()
+    {
+        //char disable = 0;
+        /*
+        see http://msdn.microsoft.com/en-us/library/aa916098.aspx
+        Default value is TRUE. When TRUE, data that is sent from the local interface to the multicast group to
+        which the socket is joined, including data sent from the same socket, will be echoed to its receive buffer.
+        */
+        char disable = 1;
+        return SetOption ( IPPROTO_IP, IP_MULTICAST_LOOP, &disable, sizeof ( disable ) );
+    }
+
+    //network operations*************************************************************************************************
+    int JackNetWinSocket::SendTo ( const void* buffer, size_t nbytes, int flags )
+    {
+        return sendto ( fSockfd, reinterpret_cast<const char*> ( buffer ), nbytes, flags, reinterpret_cast<SOCKADDR*> ( &fSendAddr ), sizeof ( SOCKADDR ) );
+    }
+
+    int JackNetWinSocket::SendTo ( const void* buffer, size_t nbytes, int flags, const char* ip )
+    {
+        fSendAddr.sin_addr.s_addr = inet_addr ( ip );
+        return SendTo ( buffer, nbytes, flags );
+    }
+
+    int JackNetWinSocket::Send ( const void* buffer, size_t nbytes, int flags )
+    {
+        return send ( fSockfd, reinterpret_cast<const char*> ( buffer ), nbytes, flags );
+    }
+
+    int JackNetWinSocket::RecvFrom ( void* buffer, size_t nbytes, int flags )
+    {
+        SOCKLEN addr_len = sizeof ( SOCKADDR );
+        return recvfrom ( fSockfd, reinterpret_cast<char*> ( buffer ), nbytes, flags, reinterpret_cast<SOCKADDR*> ( &fRecvAddr ), &addr_len );
+    }
+
+    int JackNetWinSocket::Recv ( void* buffer, size_t nbytes, int flags )
+    {
+        return recv ( fSockfd, reinterpret_cast<char*> ( buffer ), nbytes, flags );
+    }
+
+    int JackNetWinSocket::CatchHost ( void* buffer, size_t nbytes, int flags )
+    {
+        SOCKLEN addr_len = sizeof ( SOCKADDR );
+        return recvfrom ( fSockfd, reinterpret_cast<char*> ( buffer ), nbytes, flags, reinterpret_cast<SOCKADDR*> ( &fSendAddr ), &addr_len );
+    }
+
+    net_error_t JackNetWinSocket::GetError()
+    {
+        switch ( NET_ERROR_CODE )
+        {
+            case WSABASEERR:
+                return NET_NO_ERROR;
+            case WSAETIMEDOUT:
+                return NET_NO_DATA;
+            case WSAEWOULDBLOCK:
+                return NET_NO_DATA;
+            case WSAECONNREFUSED:
+                return NET_CONN_ERROR;
+            case WSAECONNRESET:
+                return NET_CONN_ERROR;
+            case WSAEACCES:
+                return NET_CONN_ERROR;
+            case WSAECONNABORTED:
+                return NET_CONN_ERROR;
+            case WSAEHOSTDOWN:
+                return NET_CONN_ERROR;
+            case WSAEHOSTUNREACH:
+                return NET_CONN_ERROR;
+            default:
+                return NET_OP_ERROR;
+        }
+    }
+}
+
diff --git a/windows/JackNetWinSocket.h b/windows/JackNetWinSocket.h
new file mode 100644
index 0000000..21ad275
--- /dev/null
+++ b/windows/JackNetWinSocket.h
@@ -0,0 +1,111 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackNetWinSocket__
+#define __JackNetWinSocket__
+
+#include "JackNetSocket.h"
+#ifdef __MINGW32__
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+
+
+namespace Jack
+{
+#define E(code, s) { code, s }
+#define NET_ERROR_CODE WSAGetLastError()
+#define StrError PrintError
+
+    typedef uint32_t uint;
+    typedef int SOCKLEN;
+    typedef struct _win_net_error win_net_error_t;
+
+    struct _win_net_error
+    {
+        int code;
+        const char* msg;
+    };
+
+    SERVER_EXPORT const char* PrintError ( int error );
+
+    //JeckNetWinSocket***************************************************************************
+    class SERVER_EXPORT JackNetWinSocket
+    {
+        private:
+            int fSockfd;
+            int fPort;
+            SOCKADDR_IN fSendAddr;
+            SOCKADDR_IN fRecvAddr;
+        public:
+            JackNetWinSocket();
+            JackNetWinSocket ( const char* ip, int port );
+            JackNetWinSocket ( const JackNetWinSocket& );
+            ~JackNetWinSocket();
+
+            JackNetWinSocket& operator= ( const JackNetWinSocket& );
+
+            //socket management
+            int NewSocket();
+            int Bind();
+            int BindWith ( const char* ip );
+            int BindWith ( int port );
+            int Connect();
+            int ConnectTo ( const char* ip );
+            void Close();
+            void Reset();
+            bool IsSocket();
+
+            //IP/PORT management
+            void SetPort ( int port );
+            int GetPort();
+
+            //address management
+            int SetAddress ( const char* ip, int port );
+            char* GetSendIP();
+            char* GetRecvIP();
+
+            //utility
+            int GetName ( char* name );
+            int JoinMCastGroup ( const char* mcast_ip );
+
+            //options management
+            int SetOption ( int level, int optname, const void* optval, SOCKLEN optlen );
+            int GetOption ( int level, int optname, void* optval, SOCKLEN* optlen );
+
+            //timeout
+            int SetTimeOut ( int usec );
+
+            //disable local loop
+            int SetLocalLoop();
+
+            //network operations
+            int SendTo ( const void* buffer, size_t nbytes, int flags );
+            int SendTo ( const void* buffer, size_t nbytes, int flags, const char* ip );
+            int Send ( const void* buffer, size_t nbytes, int flags );
+            int RecvFrom ( void* buffer, size_t nbytes, int flags );
+            int Recv ( void* buffer, size_t nbytes, int flags );
+            int CatchHost ( void* buffer, size_t nbytes, int flags );
+
+            //error management
+            net_error_t GetError();
+    };
+}
+
+#endif
diff --git a/windows/JackPlatformPlug_os.h b/windows/JackPlatformPlug_os.h
new file mode 100644
index 0000000..536a601
--- /dev/null
+++ b/windows/JackPlatformPlug_os.h
@@ -0,0 +1,80 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackPlatformPlug_WIN32__
+#define __JackPlatformPlug_WIN32__
+
+namespace Jack
+{
+    struct JackRequest;
+	struct JackResult;
+
+	class JackWinMutex;
+	class JackWinThread;
+	class JackWinSemaphore;
+	class JackWinProcessSync;
+	class JackWinNamedPipeServerChannel;
+	class JackWinNamedPipeClientChannel;
+	class JackWinNamedPipeServerNotifyChannel;
+	class JackWinNamedPipeNotifyChannel;
+	class JackWinNamedPipe;
+	class JackNetWinSocket;
+}
+
+/* __JackPlatformMutex__ */
+#include "JackWinMutex.h"
+namespace Jack {typedef JackWinMutex JackMutex; }
+
+/* __JackPlatformThread__ */
+#include "JackWinThread.h"
+namespace Jack { typedef JackWinThread JackThread; }
+
+/* __JackPlatformSynchro__  client activation */
+#include "JackWinSemaphore.h"
+namespace Jack { typedef JackWinSemaphore JackSynchro; }
+
+/* __JackPlatformChannelTransaction__ */
+#include "JackWinNamedPipe.h"
+namespace Jack { typedef JackWinNamedPipe JackChannelTransaction; }
+
+/* __JackPlatformProcessSync__ */
+#include "JackWinProcessSync.h"
+namespace Jack { typedef JackWinProcessSync JackProcessSync; }
+
+/* __JackPlatformServerChannel__ */ 
+#include "JackWinNamedPipeServerChannel.h"
+namespace Jack { typedef JackWinNamedPipeServerChannel JackServerChannel; }
+
+/* __JackPlatformClientChannel__ */
+#include "JackWinNamedPipeClientChannel.h"
+namespace Jack { typedef JackWinNamedPipeClientChannel JackClientChannel; }
+
+/* __JackPlatformServerNotifyChannel__ */
+#include "JackWinNamedPipeServerNotifyChannel.h"
+namespace Jack { typedef JackWinNamedPipeServerNotifyChannel JackServerNotifyChannel; }
+
+/* __JackPlatformNotifyChannel__ */
+#include "JackWinNamedPipeNotifyChannel.h"
+namespace Jack { typedef JackWinNamedPipeNotifyChannel JackNotifyChannel; }
+
+/* __JackPlatformNetSocket__ */
+#include "JackNetWinSocket.h"
+namespace Jack { typedef JackNetWinSocket JackNetSocket; }
+
+#endif
diff --git a/windows/JackRouter/JackRouter.cpp b/windows/JackRouter/JackRouter.cpp
new file mode 100644
index 0000000..47727af
--- /dev/null
+++ b/windows/JackRouter/JackRouter.cpp
@@ -0,0 +1,840 @@
+/*
+Copyright (C) 2006 Grame  
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef WIN32
+#pragma warning (disable : 4786)
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <process.h>
+#include "JackRouter.h"
+#include "profport.h"
+
+/*
+
+	08/07/2007 SL : USe jack_client_open instead of jack_client_new (automatic client renaming).
+	09/08/2007 SL : Add JackRouter.ini parameter file.
+	09/20/2007 SL : Better error report in DllRegisterServer (for Vista).
+	09/27/2007 SL : Add AUDO_CONNECT property in JackRouter.ini file.
+	10/10/2007 SL : Use ASIOSTInt32LSB instead of ASIOSTInt16LSB.
+
+ */
+
+//------------------------------------------------------------------------------------------
+// extern
+void getNanoSeconds(ASIOTimeStamp *time);
+
+// local
+double AsioSamples2double (ASIOSamples* samples);
+
+static const double twoRaisedTo32 = 4294967296.;
+static const double twoRaisedTo32Reciprocal = 1. / twoRaisedTo32;
+
+//------------------------------------------------------------------------------------------
+// on windows, we do the COM stuff.
+
+#if WINDOWS
+#include "windows.h"
+#include "mmsystem.h"
+#include "psapi.h"
+
+using namespace std;
+
+// class id. 
+// {838FE50A-C1AB-4b77-B9B6-0A40788B53F3}
+CLSID IID_ASIO_DRIVER = { 0x838fe50a, 0xc1ab, 0x4b77, { 0xb9, 0xb6, 0xa, 0x40, 0x78, 0x8b, 0x53, 0xf3 } };
+
+
+CFactoryTemplate g_Templates[1] = {
+    {L"ASIOJACK", &IID_ASIO_DRIVER, JackRouter::CreateInstance} 
+};
+int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
+
+CUnknown* JackRouter::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr)
+{
+	return (CUnknown*)new JackRouter(pUnk,phr);
+};
+
+STDMETHODIMP JackRouter::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
+{
+	if (riid == IID_ASIO_DRIVER) {
+		return GetInterface(this, ppv);
+	}
+	return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//		Register ASIO Driver
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+extern LONG RegisterAsioDriver(CLSID,char *,char *,char *,char *);
+extern LONG UnregisterAsioDriver(CLSID,char *,char *);
+
+//
+// Server registration, called on REGSVR32.EXE "the dllname.dll"
+//
+HRESULT _stdcall DllRegisterServer()
+{
+	LONG	rc;
+	char	errstr[128];
+
+	rc = RegisterAsioDriver (IID_ASIO_DRIVER,"JackRouter.dll","JackRouter","JackRouter","Apartment");
+
+	if (rc) {
+		memset(errstr,0,128);
+		sprintf(errstr,"Register Server failed ! (%d)",rc);
+		MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"JackRouter",MB_OK);
+		return -1;
+	}
+
+	return S_OK;
+}
+
+//
+// Server unregistration
+//
+HRESULT _stdcall DllUnregisterServer()
+{
+	LONG	rc;
+	char	errstr[128];
+
+	rc = UnregisterAsioDriver (IID_ASIO_DRIVER,"JackRouter.dll","JackRouter");
+
+	if (rc) {
+		memset(errstr,0,128);
+		sprintf(errstr,"Unregister Server failed ! (%d)",rc);
+		MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"JackRouter",MB_OK);
+		return -1;
+	}
+
+	return S_OK;
+}
+
+// Globals
+
+list<pair<string, string> > JackRouter::fConnections;
+bool JackRouter::fFirstActivate = true;
+
+//------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------
+JackRouter::JackRouter (LPUNKNOWN pUnk, HRESULT *phr)
+	: CUnknown("ASIOJACK", pUnk, phr)
+
+//------------------------------------------------------------------------------------------
+
+#else
+
+// when not on windows, we derive from AsioDriver
+JackRouter::JackRouter() : AsioDriver()
+
+#endif
+{
+	long i;
+
+	fSamplePosition = 0;
+	fActive = false;
+	fStarted = false;
+	fTimeInfoMode = false;
+	fTcRead = false;
+	fClient = NULL;
+	fAutoConnectIn = true;
+	fAutoConnectOut = true;
+
+	for (i = 0; i < kNumInputs; i++) {
+		fInputBuffers[i] = 0;
+		fInputPorts[i] = 0;
+		fInMap[i] = 0;
+	}
+	for (i = 0; i < kNumOutputs; i++) {
+		fOutputBuffers[i] = 0;
+		fOutputPorts[i] = 0;
+		fOutMap[i] = 0;
+	}
+	fCallbacks = 0;
+	fActiveInputs = fActiveOutputs = 0;
+	fToggle = 0;
+	fBufferSize = 512;
+	fSampleRate = 44100;
+	printf("Constructor\n");
+
+	// Use "jackrouter.ini" parameters if available
+	HMODULE handle = LoadLibrary("JackRouter.dll");
+
+	if (handle) {
+
+		// Get JackRouter.dll path
+		char dllName[512];
+		string confPath;
+		DWORD res = GetModuleFileName(handle, dllName, 512);
+		
+		// Compute .ini file path
+		string fullPath = dllName;
+		int lastPos = fullPath.find_last_of(PATH_SEP);
+		string  dllFolder =  fullPath.substr(0, lastPos);
+		confPath = dllFolder + PATH_SEP + "JackRouter.ini";
+
+		// Get parameters
+		kNumInputs = get_private_profile_int("IO", "input", 2, confPath.c_str());
+		kNumOutputs = get_private_profile_int("IO", "output", 2, confPath.c_str());
+
+		fAutoConnectIn = get_private_profile_int("AUTO_CONNECT", "input", 1, confPath.c_str());
+		fAutoConnectOut = get_private_profile_int("AUTO_CONNECT", "output", 1, confPath.c_str());
+
+		FreeLibrary(handle);
+
+	} else {
+		printf("LoadLibrary error\n");
+	}
+}
+
+//------------------------------------------------------------------------------------------
+JackRouter::~JackRouter()
+{
+	stop ();
+	disposeBuffers ();
+	printf("Destructor\n");
+	jack_client_close(fClient);
+}
+
+//------------------------------------------------------------------------------------------
+#include <windows.h>
+#include <stdio.h>
+#include <tchar.h>
+#include "psapi.h"
+
+static bool GetEXEName(DWORD dwProcessID, char* name)
+{
+    DWORD aProcesses [1024], cbNeeded, cProcesses;
+    unsigned int i;
+        
+    // Enumerate all processes
+    if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
+        return false;
+
+    // Calculate how many process identifiers were returned.
+    cProcesses = cbNeeded / sizeof(DWORD);
+
+    TCHAR szEXEName[MAX_PATH];
+    // Loop through all process to find the one that matches
+    // the one we are looking for
+
+    for (i = 0; i < cProcesses; i++) {
+        if (aProcesses [i] == dwProcessID) {
+            // Get a handle to the process
+            HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |
+                              PROCESS_VM_READ, FALSE, dwProcessID);
+        
+            // Get the process name
+            if (NULL != hProcess) {
+                HMODULE hMod;
+                DWORD cbNeeded;
+            
+                if(EnumProcessModules(hProcess, &hMod, 
+                                      sizeof(hMod), &cbNeeded)) {
+                    //Get the name of the exe file
+                    GetModuleBaseName(hProcess, hMod, szEXEName, 
+                        sizeof(szEXEName)/sizeof(TCHAR));
+					int len = strlen((char*)szEXEName) - 4; // remove ".exe"
+					strncpy(name, (char*)szEXEName, len); 
+					name[len] = '\0';
+					return true;
+                 }
+            }
+        }    
+    }
+
+    return false;
+}
+
+ //------------------------------------------------------------------------------------------
+static inline float ClipFloat(float sample)
+{
+     return (sample < -1.0f) ? -1.0f : (sample > 1.0f) ? 1.0f : sample;
+}
+
+//------------------------------------------------------------------------------------------
+void JackRouter::shutdown(void* arg)
+{
+	JackRouter* driver = (JackRouter*)arg;
+	/*
+	//exit(1);
+	char errstr[128];
+
+	memset(errstr,0,128);
+	sprintf(errstr,"JACK server has quitted");
+	MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"JackRouter",MB_OK);
+	*/
+}
+
+//------------------------------------------------------------------------------------------
+int JackRouter::process(jack_nframes_t nframes, void* arg)
+{
+	JackRouter* driver = (JackRouter*)arg;
+	int i,j;
+	int pos = (driver->fToggle) ? 0 : driver->fBufferSize ;	
+	
+	for (i = 0; i < driver->fActiveInputs; i++) {	
+		
+#ifdef LONG_SAMPLE		
+		float* buffer = (float*)jack_port_get_buffer(driver->fInputPorts[i], nframes);
+		long* in = driver->fInputBuffers[i] + pos;
+		for (j = 0; j < nframes; j++) {
+			in[j] = buffer[j] * float(0x7fffffff);
+		}
+#else
+		memcpy(driver->fInputBuffers[i] + pos,
+				jack_port_get_buffer(driver->fInputPorts[i], nframes),
+				nframes * sizeof(float));
+#endif
+
+	}	
+
+	driver->bufferSwitch();
+
+	for (i = 0; i < driver->fActiveOutputs; i++) {
+
+#ifdef LONG_SAMPLE
+		float* buffer = (float*)jack_port_get_buffer(driver->fOutputPorts[i], nframes);
+		long* out = driver->fOutputBuffers[i] + pos;
+		float gain = 1.f/float(0x7fffffff);
+		for (j = 0; j < nframes; j++) {
+			buffer[j] = out[j] * gain;
+		}
+#else
+		memcpy(jack_port_get_buffer(driver->fOutputPorts[i], nframes),
+				driver->fOutputBuffers[i] + pos,
+				nframes * sizeof(float));
+#endif
+	}
+	
+	return 0;
+}
+
+//------------------------------------------------------------------------------------------
+void JackRouter::getDriverName(char *name)
+{
+	strcpy (name, "JackRouter");
+}
+
+//------------------------------------------------------------------------------------------
+long JackRouter::getDriverVersion()
+{
+	return 0x00000001L;
+}
+
+//------------------------------------------------------------------------------------------
+void JackRouter::getErrorMessage(char *string)
+{
+	strcpy (string, fErrorMessage);
+}
+
+//------------------------------------------------------------------------------------------
+ASIOBool JackRouter::init(void* sysRef)
+{
+	char name[MAX_PATH];
+	sysRef = sysRef;
+
+	if (fActive)
+		return true;
+
+	HANDLE win = (HANDLE)sysRef;
+	int	my_pid = _getpid();
+	
+	if (!GetEXEName(my_pid, name)) { // If getting the .exe name fails, takes a generic one.
+		_snprintf(name, sizeof(name) - 1, "JackRouter_%d", my_pid);
+	}
+
+	if (fClient) {
+		printf("Error: jack client still present...\n");
+		return true;
+	}
+		
+	fClient = jack_client_open(name, JackNullOption, NULL);
+	if (fClient == NULL) {
+		strcpy (fErrorMessage, "Open error: is jack server running?");
+		printf("Open error: is jack server running?\n");
+		return false;
+	}
+	
+	fBufferSize = jack_get_buffer_size(fClient);
+	fSampleRate = jack_get_sample_rate(fClient);
+	jack_set_process_callback(fClient, process, this);
+	jack_on_shutdown(fClient, shutdown, this);
+  	
+	fInputLatency = fBufferSize;		// typically
+	fOutputLatency = fBufferSize * 2;
+	fMilliSeconds = (long)((double)(fBufferSize * 1000) / fSampleRate);
+
+	// Typically fBufferSize * 2; try to get 1 by offering direct buffer
+	// access, and using asioPostOutput for lower latency
+
+	printf("Init ASIO Jack\n");
+	fActive = true;
+	return true;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::start()
+{
+	if (fCallbacks) {
+		fSamplePosition = 0;
+		fTheSystemTime.lo = fTheSystemTime.hi = 0;
+		fToggle = 0;
+		fStarted = true;
+		printf("Start ASIO Jack\n");
+	
+		if (jack_activate(fClient) == 0) {
+
+			if (fFirstActivate) {
+				AutoConnect();
+				fFirstActivate = false;
+			} else {
+				RestoreConnections();
+			}
+
+			return ASE_OK;
+
+		} else {
+			return ASE_NotPresent;
+		}		
+	}
+	
+	return ASE_NotPresent;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::stop()
+{
+	fStarted = false;
+	printf("Stop ASIO Jack\n");
+	SaveConnections();
+	jack_deactivate(fClient);
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getChannels(long *numInputChannels, long *numOutputChannels)
+{
+	*numInputChannels = kNumInputs;
+	*numOutputChannels = kNumOutputs;
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getLatencies(long *_inputLatency, long *_outputLatency)
+{
+	*_inputLatency = fInputLatency;
+	*_outputLatency = fOutputLatency;
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity)
+{
+	*minSize = *maxSize = *preferredSize = fBufferSize;		// allow this size only
+	*granularity = 0;
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::canSampleRate(ASIOSampleRate sampleRate)
+{
+	return (sampleRate == fSampleRate) ? ASE_OK : ASE_NoClock;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getSampleRate(ASIOSampleRate *sampleRate)
+{
+	*sampleRate = fSampleRate;
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::setSampleRate(ASIOSampleRate sampleRate)
+{
+	return (sampleRate == fSampleRate) ? ASE_OK : ASE_NoClock;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getClockSources(ASIOClockSource *clocks, long *numSources)
+{
+	// Internal
+	if (clocks && numSources) {
+		clocks->index = 0;
+		clocks->associatedChannel = -1;
+		clocks->associatedGroup = -1;
+		clocks->isCurrentSource = ASIOTrue;
+		strcpy(clocks->name, "Internal");
+		*numSources = 1;
+		return ASE_OK;
+	} else {
+		return ASE_InvalidParameter;
+	}
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::setClockSource(long index)
+{
+	if (!index) {
+		fAsioTime.timeInfo.flags |= kClockSourceChanged;
+		return ASE_OK;
+	} else {
+		return ASE_NotPresent;
+	}
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
+{
+	tStamp->lo = fTheSystemTime.lo;
+	tStamp->hi = fTheSystemTime.hi;
+
+	if (fSamplePosition >= twoRaisedTo32) {
+		sPos->hi = (unsigned long)(fSamplePosition * twoRaisedTo32Reciprocal);
+		sPos->lo = (unsigned long)(fSamplePosition - (sPos->hi * twoRaisedTo32));
+	} else {
+		sPos->hi = 0;
+		sPos->lo = (unsigned long)fSamplePosition;
+	}
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::getChannelInfo(ASIOChannelInfo *info)
+{
+	if (info->channel < 0 || (info->isInput ? info->channel >= kNumInputs : info->channel >= kNumOutputs))
+		return ASE_InvalidParameter;
+#ifdef LONG_SAMPLE
+	info->type = ASIOSTInt32LSB;
+#else
+	info->type = ASIOSTFloat32LSB;
+#endif
+
+	info->channelGroup = 0;
+	info->isActive = ASIOFalse;
+	long i;
+	char buf[32];
+
+	if (info->isInput) {
+		for (i = 0; i < fActiveInputs; i++) {		
+			if (fInMap[i] == info->channel) { 
+				info->isActive = ASIOTrue;
+				//_snprintf(buf, sizeof(buf) - 1, "Jack::In%d ", info->channel);
+				//strcpy(info->name, buf);
+				//strcpy(info->name, jack_port_name(fInputPorts[i]));
+				break;
+			}
+		}
+		_snprintf(buf, sizeof(buf) - 1, "In%d ", info->channel);
+		strcpy(info->name, buf);
+	} else {
+		for (i = 0; i < fActiveOutputs; i++) {	
+			if (fOutMap[i] == info->channel) {  //NOT USED !!
+				info->isActive = ASIOTrue;
+				//_snprintf(buf, sizeof(buf) - 1, "Jack::Out%d ", info->channel);
+				//strcpy(info->name, buf);
+				//strcpy(info->name, jack_port_name(fOutputPorts[i]));
+				break;
+			}
+		}
+		_snprintf(buf, sizeof(buf) - 1, "Out%d ", info->channel);
+		strcpy(info->name, buf);
+	}
+	return ASE_OK;
+}
+
+//------------------------------------------------------------------------------------------
+ASIOError JackRouter::createBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
+	long bufferSize, ASIOCallbacks *callbacks)
+{
+	ASIOBufferInfo *info = bufferInfos;
+	long i;
+	bool notEnoughMem = false;
+	char buf[256];
+	fActiveInputs = 0;
+	fActiveOutputs = 0;
+
+	for (i = 0; i < numChannels; i++, info++) {
+		if (info->isInput) {
+			if (info->channelNum < 0 || info->channelNum >= kNumInputs)
+				goto error;
+			fInMap[fActiveInputs] = info->channelNum;
+		#ifdef LONG_SAMPLE
+			fInputBuffers[fActiveInputs] = new long[fBufferSize * 2];	// double buffer
+		#else
+			fInputBuffers[fActiveInputs] = new float[fBufferSize * 2];	// double buffer
+		#endif
+			if (fInputBuffers[fActiveInputs]) {
+				info->buffers[0] = fInputBuffers[fActiveInputs];
+				info->buffers[1] = fInputBuffers[fActiveInputs] + fBufferSize;
+			} else {
+				info->buffers[0] = info->buffers[1] = 0;
+				notEnoughMem = true;
+			}
+			
+			_snprintf(buf, sizeof(buf) - 1, "in%d", fActiveInputs + 1);
+			fInputPorts[fActiveInputs] 
+				= jack_port_register(fClient, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput,0);
+			if (fInputPorts[fActiveInputs] == NULL)
+				goto error;
+
+			fActiveInputs++;
+			if (fActiveInputs > kNumInputs) {
+error:
+				disposeBuffers();
+				return ASE_InvalidParameter;
+			}
+		} else {	// output			
+			if (info->channelNum < 0 || info->channelNum >= kNumOutputs)
+				goto error;
+			fOutMap[fActiveOutputs] = info->channelNum;
+	
+		#ifdef LONG_SAMPLE
+			fOutputBuffers[fActiveOutputs] = new long[fBufferSize * 2];	// double buffer
+		#else
+			fOutputBuffers[fActiveOutputs] = new float[fBufferSize * 2];	// double buffer
+		#endif
+	
+			if (fOutputBuffers[fActiveOutputs]) {
+				info->buffers[0] = fOutputBuffers[fActiveOutputs];
+				info->buffers[1] = fOutputBuffers[fActiveOutputs] + fBufferSize;
+			} else {
+				info->buffers[0] = info->buffers[1] = 0;
+				notEnoughMem = true;
+			}
+			
+			_snprintf(buf, sizeof(buf) - 1, "out%d", fActiveOutputs + 1);
+			fOutputPorts[fActiveOutputs] 
+				= jack_port_register(fClient, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput,0);
+			if (fOutputPorts[fActiveOutputs] == NULL)
+				goto error;
+
+			fActiveOutputs++;
+			if (fActiveOutputs > kNumOutputs) {
+				fActiveOutputs--;
+				disposeBuffers();
+				return ASE_InvalidParameter;
+			}
+		}
+	}		
+
+	if (notEnoughMem) {
+		disposeBuffers();
+		return ASE_NoMemory;
+	}
+
+	this->fCallbacks = callbacks;
+	if (callbacks->asioMessage (kAsioSupportsTimeInfo, 0, 0, 0)) {
+		fTimeInfoMode = true;
+		fAsioTime.timeInfo.speed = 1.;
+		fAsioTime.timeInfo.systemTime.hi = fAsioTime.timeInfo.systemTime.lo = 0;
+		fAsioTime.timeInfo.samplePosition.hi = fAsioTime.timeInfo.samplePosition.lo = 0;
+		fAsioTime.timeInfo.sampleRate = fSampleRate;
+		fAsioTime.timeInfo.flags = kSystemTimeValid | kSamplePositionValid | kSampleRateValid;
+
+		fAsioTime.timeCode.speed = 1.;
+		fAsioTime.timeCode.timeCodeSamples.lo = fAsioTime.timeCode.timeCodeSamples.hi = 0;
+		fAsioTime.timeCode.flags = kTcValid | kTcRunning ;
+	} else {
+		fTimeInfoMode = false;	
+	}
+	
+	return ASE_OK;
+}
+
+//---------------------------------------------------------------------------------------------
+ASIOError JackRouter::disposeBuffers()
+{
+	long i;
+	
+	fCallbacks = 0;
+	stop();
+
+	for (i = 0; i < fActiveInputs; i++) {
+		delete[] fInputBuffers[i];
+		jack_port_unregister(fClient, fInputPorts[i]);
+	}		
+	fActiveInputs = 0;
+
+	for (i = 0; i < fActiveOutputs; i++) {
+		delete[] fOutputBuffers[i];
+		jack_port_unregister(fClient, fOutputPorts[i]);
+	}
+	fActiveOutputs = 0;
+
+	return ASE_OK;
+}
+
+//---------------------------------------------------------------------------------------------
+ASIOError JackRouter::controlPanel()
+{
+	return ASE_NotPresent;
+}
+
+//---------------------------------------------------------------------------------------------
+ASIOError JackRouter::future(long selector, void* opt)	// !!! check properties 
+{
+	ASIOTransportParameters* tp = (ASIOTransportParameters*)opt;
+	switch (selector)
+	{
+		case kAsioEnableTimeCodeRead:	fTcRead = true;	return ASE_SUCCESS;
+		case kAsioDisableTimeCodeRead:	fTcRead = false; return ASE_SUCCESS;
+		case kAsioSetInputMonitor:		return ASE_SUCCESS;	// for testing!!!
+		case kAsioCanInputMonitor:		return ASE_SUCCESS;	// for testing!!!
+		case kAsioCanTimeInfo:			return ASE_SUCCESS;
+		case kAsioCanTimeCode:			return ASE_SUCCESS;
+	}
+	return ASE_NotPresent;
+}
+
+//--------------------------------------------------------------------------------------------------------
+// private methods
+//--------------------------------------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------------------------
+void JackRouter::bufferSwitch()
+{
+	if (fStarted && fCallbacks) {
+		getNanoSeconds(&fTheSystemTime);			// latch system time
+		fSamplePosition += fBufferSize;
+		if (fTimeInfoMode) {
+			bufferSwitchX ();
+		} else {
+			fCallbacks->bufferSwitch (fToggle, ASIOFalse);
+		}
+		fToggle = fToggle ? 0 : 1;
+	}
+}
+
+//---------------------------------------------------------------------------------------------
+// asio2 buffer switch
+void JackRouter::bufferSwitchX ()
+{
+	getSamplePosition (&fAsioTime.timeInfo.samplePosition, &fAsioTime.timeInfo.systemTime);
+	long offset = fToggle ? fBufferSize : 0;
+	if (fTcRead) {
+		// Create a fake time code, which is 10 minutes ahead of the card's sample position
+		// Please note that for simplicity here time code will wrap after 32 bit are reached
+		fAsioTime.timeCode.timeCodeSamples.lo = fAsioTime.timeInfo.samplePosition.lo + 600.0 * fSampleRate;
+		fAsioTime.timeCode.timeCodeSamples.hi = 0;
+	}
+	fCallbacks->bufferSwitchTimeInfo (&fAsioTime, fToggle, ASIOFalse);
+	fAsioTime.timeInfo.flags &= ~(kSampleRateChanged | kClockSourceChanged);
+}
+
+//---------------------------------------------------------------------------------------------
+ASIOError JackRouter::outputReady()
+{
+	return ASE_NotPresent;
+}
+
+//---------------------------------------------------------------------------------------------
+double AsioSamples2double(ASIOSamples* samples)
+{
+	double a = (double)(samples->lo);
+	if (samples->hi)
+		a += (double)(samples->hi) * twoRaisedTo32;
+	return a;
+}
+
+//---------------------------------------------------------------------------------------------
+void getNanoSeconds(ASIOTimeStamp* ts)
+{
+	double nanoSeconds = (double)((unsigned long)timeGetTime ()) * 1000000.;
+	ts->hi = (unsigned long)(nanoSeconds / twoRaisedTo32);
+	ts->lo = (unsigned long)(nanoSeconds - (ts->hi * twoRaisedTo32));
+}
+
+//------------------------------------------------------------------------
+void JackRouter::SaveConnections()
+{
+    const char** connections;
+ 	int i;
+
+    for (i = 0; i < fActiveInputs; ++i) {
+        if (fInputPorts[i] && (connections = jack_port_get_connections(fInputPorts[i])) != 0) {
+            for (int j = 0; connections[j]; j++) {
+                fConnections.push_back(make_pair(connections[j], jack_port_name(fInputPorts[i])));
+            }
+            jack_free(connections);
+        }
+    }
+
+    for (i = 0; i < fActiveOutputs; ++i) {
+        if (fOutputPorts[i] && (connections = jack_port_get_connections(fOutputPorts[i])) != 0) {
+            for (int j = 0; connections[j]; j++) {
+                fConnections.push_back(make_pair(jack_port_name(fOutputPorts[i]), connections[j]));
+            }
+            jack_free(connections);
+        }
+    }
+}
+
+//------------------------------------------------------------------------
+void JackRouter::RestoreConnections()
+{
+    list<pair<string, string> >::const_iterator it;
+
+    for (it = fConnections.begin(); it != fConnections.end(); it++) {
+        pair<string, string> connection = *it;
+        jack_connect(fClient, connection.first.c_str(), connection.second.c_str());
+    }
+
+    fConnections.clear();
+}
+
+//------------------------------------------------------------------------------------------
+void JackRouter::AutoConnect()
+{
+	const char** ports;
+	
+	if ((ports = jack_get_ports(fClient, NULL, NULL, JackPortIsPhysical | JackPortIsOutput)) == NULL) {
+		printf("Cannot find any physical capture ports\n");
+	} else {
+		if (fAutoConnectIn) {
+			for (int i = 0; i < fActiveInputs; i++) {
+				if (!ports[i]) {
+					printf("source port is null i = %ld\n", i);
+					break;
+				} else if (jack_connect(fClient, ports[i], jack_port_name(fInputPorts[i])) != 0) {
+					printf("Cannot connect input ports\n");
+				}
+			}
+		}
+		jack_free(ports); 
+	}
+	
+	if ((ports = jack_get_ports(fClient, NULL, NULL, JackPortIsPhysical | JackPortIsInput)) == NULL) {
+		printf("Cannot find any physical playback ports");
+	} else {
+		if (fAutoConnectOut) {
+			for (int i = 0; i < fActiveOutputs; i++) {
+				if (!ports[i]){
+					printf("destination port is null i = %ld\n", i);
+					break;
+				} else if (jack_connect(fClient, jack_port_name(fOutputPorts[i]), ports[i]) != 0) {
+					printf("Cannot connect output ports\n");
+				}
+			}
+		}
+		jack_free(ports); 
+	}
+}
+
diff --git a/windows/JackRouter/JackRouter.def b/windows/JackRouter/JackRouter.def
new file mode 100644
index 0000000..1316d71
--- /dev/null
+++ b/windows/JackRouter/JackRouter.def
@@ -0,0 +1,9 @@
+LIBRARY			JackRouter
+DESCRIPTION		'ASIO Jack Driver'
+PROTMODE
+EXPORTS	
+				DllMain
+				DllGetClassObject
+				DllCanUnloadNow
+				DllRegisterServer
+				DllUnregisterServer
diff --git a/windows/JackRouter/JackRouter.dsp b/windows/JackRouter/JackRouter.dsp
new file mode 100644
index 0000000..c92ddf9
--- /dev/null
+++ b/windows/JackRouter/JackRouter.dsp
@@ -0,0 +1,163 @@
+# Microsoft Developer Studio Project File - Name="JackRouter" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=JackRouter - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "JackRouter.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "JackRouter.mak" CFG="JackRouter - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "JackRouter - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "JackRouter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "JackRouter - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\..\ASIOSDK2\common" /I "..\..\common" /I "..\..\common\jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /dll /machine:I386
+
+!ELSEIF  "$(CFG)" == "JackRouter - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
+# ADD CPP /nologo /G5 /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\..\ASIOSDK2\common" /I "..\..\common" /I "..\..\common\jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/JackRouter_debug.dll" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "JackRouter - Win32 Release"
+# Name "JackRouter - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\..\..\..\ASIOSDK2\common\combase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\ASIOSDK2\common\dllentry.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackRouter.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackRouter.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\profport.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\ASIOSDK2\common\register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\..\common\asio.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\Asiodrvr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\asiosmpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\common\asiosys.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\common\combase.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\common\iasiodrv.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\Psapi.Lib
+# End Source File
+# Begin Source File
+
+SOURCE=..\Release\bin\libjack.lib
+# End Source File
+# End Target
+# End Project
diff --git a/windows/JackRouter/JackRouter.dsw b/windows/JackRouter/JackRouter.dsw
new file mode 100644
index 0000000..e26ab1e
--- /dev/null
+++ b/windows/JackRouter/JackRouter.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "JackRouter"=".\JackRouter.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/windows/JackRouter/JackRouter.h b/windows/JackRouter/JackRouter.h
new file mode 100644
index 0000000..bf5d44c
--- /dev/null
+++ b/windows/JackRouter/JackRouter.h
@@ -0,0 +1,174 @@
+/*
+Copyright (C) 2006 Grame  
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef _asiosmpl_
+#define _asiosmpl_
+
+#include "asiosys.h"
+
+
+// Globals
+static int	kBlockFrames = 256;
+static int	kNumInputs = 4;
+static int	kNumOutputs = 4;
+
+
+#if WINDOWS
+
+#include "jack.h"
+#include "rpc.h"
+#include "rpcndr.h"
+#ifndef COM_NO_WINDOWS_H
+#include <windows.h>
+#include "ole2.h"
+
+#endif
+
+#include "combase.h"
+#include "iasiodrv.h"
+
+#define MAX_PORTS 32
+
+#define LONG_SAMPLE 1
+
+#define PATH_SEP "\\"
+
+#include <list>
+#include <string>
+
+class JackRouter : public IASIO, public CUnknown
+{
+public:
+	JackRouter(LPUNKNOWN pUnk, HRESULT *phr);
+	~JackRouter();
+
+	DECLARE_IUNKNOWN
+    //STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {      \
+    //    return GetOwner()->QueryInterface(riid,ppv);            \
+    //};                                                          \
+    //STDMETHODIMP_(ULONG) AddRef() {                             \
+    //    return GetOwner()->AddRef();                            \
+    //};                                                          \
+    //STDMETHODIMP_(ULONG) Release() {                            \
+    //    return GetOwner()->Release();                           \
+    //};
+
+	// Factory method
+	static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
+	// IUnknown
+	virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject);
+#else
+
+#include "asiodrvr.h"
+
+
+//---------------------------------------------------------------------------------------------
+class JackRouter : public AsioDriver
+{
+public:
+	JackRouter();
+	~JackRouter();
+#endif
+
+	static int process(jack_nframes_t nframes, void* arg);
+	static void shutdown(void* arg);
+
+	ASIOBool init(void* sysRef);
+	void getDriverName(char *name);		// max 32 bytes incl. terminating zero
+	long getDriverVersion();
+	void getErrorMessage(char *string);	// max 128 bytes incl.
+
+	ASIOError start();
+	ASIOError stop();
+
+	ASIOError getChannels(long *numInputChannels, long *numOutputChannels);
+	ASIOError getLatencies(long *inputLatency, long *outputLatency);
+	ASIOError getBufferSize(long *minSize, long *maxSize,
+		long *preferredSize, long *granularity);
+
+	ASIOError canSampleRate(ASIOSampleRate sampleRate);
+	ASIOError getSampleRate(ASIOSampleRate *sampleRate);
+	ASIOError setSampleRate(ASIOSampleRate sampleRate);
+	ASIOError getClockSources(ASIOClockSource *clocks, long *numSources);
+	ASIOError setClockSource(long index);
+
+	ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp);
+	ASIOError getChannelInfo(ASIOChannelInfo *info);
+
+	ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
+		long bufferSize, ASIOCallbacks *callbacks);
+	ASIOError disposeBuffers();
+
+	ASIOError controlPanel();
+	ASIOError future(long selector, void *opt);
+	ASIOError outputReady();
+
+	void bufferSwitch();
+	long getMilliSeconds() {return fMilliSeconds;}
+
+	static bool fFirstActivate;
+	static std::list<std::pair<std::string, std::string> > fConnections;  // Connections list
+
+private:
+
+	void bufferSwitchX();
+
+	double fSamplePosition;
+	ASIOCallbacks* fCallbacks;
+	ASIOTime fAsioTime;
+	ASIOTimeStamp fTheSystemTime;
+
+#ifdef LONG_SAMPLE
+	long* fInputBuffers[MAX_PORTS * 2];
+	long* fOutputBuffers[MAX_PORTS * 2];
+#else
+	float* fInputBuffers[MAX_PORTS * 2];
+	float* fOutputBuffers[MAX_PORTS * 2];
+#endif
+	long fInMap[MAX_PORTS];
+	long fOutMap[MAX_PORTS];
+
+	long fInputLatency;
+	long fOutputLatency;
+	long fActiveInputs;
+	long fActiveOutputs;
+	long fToggle;
+	long fMilliSeconds;
+	bool fActive, fStarted;
+	bool fTimeInfoMode, fTcRead;
+	char fErrorMessage[128];
+
+	bool fAutoConnectIn;
+	bool fAutoConnectOut;
+
+	// Jack part
+	jack_client_t* fClient;
+	jack_port_t* fInputPorts[MAX_PORTS];
+	jack_port_t* fOutputPorts[MAX_PORTS];
+	long fBufferSize;
+	ASIOSampleRate fSampleRate;
+
+	void AutoConnect();
+	void SaveConnections();
+    void RestoreConnections();
+
+};
+
+#endif
+
diff --git a/windows/JackRouter/Psapi.Lib b/windows/JackRouter/Psapi.Lib
new file mode 100644
index 0000000..ae89691
Binary files /dev/null and b/windows/JackRouter/Psapi.Lib differ
diff --git a/windows/JackRouter/README b/windows/JackRouter/README
new file mode 100644
index 0000000..5f2bce1
--- /dev/null
+++ b/windows/JackRouter/README
@@ -0,0 +1,3 @@
+This folder contains the sources for ASIO/JACK bridge ASIO driver called "JackRouter". The included project is a Microsoft VC++ 6 one. 
+It requires some files (combase.cpp, dllentry.cpp, register.cpp) that are part on the ASIO driver SDK. The produced "JackRouter.dll" file
+has to be registered in the system using the "regsvr32" tool.
\ No newline at end of file
diff --git a/windows/JackRouter/profport.cpp b/windows/JackRouter/profport.cpp
new file mode 100644
index 0000000..eb77937
--- /dev/null
+++ b/windows/JackRouter/profport.cpp
@@ -0,0 +1,315 @@
+/*
+History : 
+01-28-02 : Change the location of temporary files created in write_private_profile_string
+		   now done in TmpDirectory.
+01-29-02 : Correct bug when the '=' character is not present.
+06-18-02 : Return default value if file does not exist, new write_private_profile_int function.
+*/
+
+/***** Routines to read profile strings --  by Joseph J. Graf ******/
+/***** corrections and improvements -- by D. Fober - Grame ******/
+/*
+	corrections: buffer sizes control
+	improvements: behavior more similar to windows
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <string>
+
+#include <ctype.h> 
+#include "profport.h"   /* function prototypes in here */
+
+#ifndef WIN32
+
+static int read_line (FILE *fp, char *bp, int size);
+static int read_section(FILE *fp, char *section);
+static int read_entry (FILE *fp, char *entry, char *buff, int size);
+static char * read_value (char *buff);
+static int read_int_value (char *buff, int def);
+static char * read_file (char *file);
+static char * str_search (char * buff, char * str, int stopCond);
+
+/*****************************************************************
+* Function:     read_line()
+* Arguments:    <FILE *> fp - a pointer to the file to be read from
+*               <char *> bp - a pointer to the copy buffer
+*               <int>  size - size of the copy buffer
+* Returns:      the line length if successful -1 otherwise
+******************************************************************/
+static int read_line(FILE *fp, char *bp, int size)
+{  
+	char c = '\0';
+	int i = 0, limit = size-2;
+
+	/* Read one line from the source file */
+	while (((c = getc(fp)) != '\n') && (i < limit)) {
+		if (c == EOF) {
+			if (!i) return -1;
+			else break;
+		}
+		bp[i++] = c;
+	}
+	bp[i] = '\0';
+	return i;
+}
+
+static int read_section (FILE *fp, char *section)
+{  
+	char buff[MAX_LINE_LENGTH];
+	char t_section[MAX_LINE_LENGTH];
+	int n, slen;
+
+	sprintf(t_section,"[%s]", section); /* Format the section name */
+	slen = strlen (t_section);
+	/*  Move through file 1 line at a time until a section is matched or EOF */
+	do {
+		n = read_line(fp, buff, MAX_LINE_LENGTH); 
+		if (n == -1)   
+			return 0;
+	} while (strncmp (buff,t_section, slen));
+	return 1;
+ }
+
+static int read_entry (FILE *fp, char *entry, char *buff, int size)
+{  
+	int n, elen = strlen (entry);
+
+	do {
+		n = read_line(fp, buff, size); 
+		if (n == -1) 
+			return 0;
+		else if (*buff == '[')
+			return 0;	
+	} while (strncmp (buff, entry, elen));
+	return 1;
+ }
+
+#define isBlank(c)	((c == ' ') || (c == '\t'))
+static char * read_value (char *buff)
+{  
+    char * eq = strrchr (buff,'=');    /* Parse out the equal sign */
+    if (eq) {
+    	eq++;
+    	while (*eq && isBlank(*eq))
+    		eq++;
+//    	return *eq ? eq : 0;
+    	return eq;
+    }
+    return eq;
+ }
+
+#define isSignedDigit(c)	(isdigit(c) || (c == '+') || (c == '-'))
+static int read_int_value (char *buff, int def)
+{  
+    char * val = read_value (buff);
+    char value[20]; int i;
+    
+    if (!*val) return def;
+    
+	for (i = 0; isSignedDigit(*val) && (i <= 10); i++ )
+		value[i] = *val++;
+	value[i] = '\0';
+    return value[0] ? atoi(value) : def;
+}
+ 
+static char * read_file (char *file)
+{
+	FILE *fd = fopen (file,"r");
+	int size; char * buff = 0;
+	
+	if (!fd) return 0;
+	if (fseek (fd, 0, SEEK_END) == -1) goto err;
+	size = ftell (fd);
+	if (size < 0) goto err;
+	if (fseek (fd, 0, SEEK_SET) == -1) goto err;
+	buff = (char *) malloc (size+1);
+	if (buff) {
+		*buff = 0;
+		fread (buff, 1, size, fd);
+		buff[size] = 0;
+	}
+err:
+	fclose (fd);
+	return buff;
+}
+ 
+static char * str_search (char * buff, char * str, int stopCond)
+{
+	char *ptr = buff;
+	int len = strlen (str);
+	while (*ptr && strncmp (ptr, str, len)) {
+		while (*ptr && (*ptr++ != '\n')) 
+			;
+		if (*ptr == stopCond)
+			return 0;
+	}
+	return *ptr ? ptr : 0;
+}
+
+/**************************************************************************
+* Function:     get_private_profile_int()
+* Arguments:    <char *> section - the name of the section to search for
+*               <char *> entry - the name of the entry to find the value of
+*               <int> def - the default value in the event of a failed read
+*               <char *> file_name - the name of the .ini file to read from
+* Returns:      the value located at entry
+***************************************************************************/
+int get_private_profile_int(char *section,
+    char *entry, int def, char *file_name)
+{   
+    FILE *fp = fopen(file_name,"r");
+    char buff[MAX_LINE_LENGTH];
+    
+    if( !fp ) return def; /* Return default value if file does not exist */
+    if (!read_section (fp, section)) goto err;
+    if (!read_entry (fp, entry, buff, MAX_LINE_LENGTH)) goto err;
+	def = read_int_value (buff, def);
+err:
+	fclose (fp);
+	return def;
+}
+
+/**************************************************************************
+* Function:     get_private_profile_string()
+* Arguments:    <char *> section - the name of the section to search for
+*               <char *> entry - the name of the entry to find the value of
+*               <char *> def - default string in the event of a failed read
+*               <char *> buffer - a pointer to the buffer to copy into
+*               <int> buffer_len - the max number of characters to copy
+*               <char *> file_name - the name of the .ini file to read from
+* Returns:      the number of characters copied into the supplied buffer
+***************************************************************************/
+
+int get_private_profile_string(char *section, char *entry, char *def,
+    char *buffer, int buffer_len, char *file_name)
+{   
+    FILE *fp = fopen (file_name,"r");
+    char buff[MAX_LINE_LENGTH];
+    char *val;
+    
+    if( !fp ) goto err; /* Return default value if file does not exist */
+    if (!read_section (fp, section)) goto err;
+    if (!read_entry (fp, entry, buff, MAX_LINE_LENGTH)) goto err;
+	val = read_value (buff);
+    if(val) def = val;
+
+err:
+	if (fp) fclose (fp);
+	if (def) {
+		strncpy (buffer, def, buffer_len - 1);
+		buffer[buffer_len] = '\0';
+	}
+	else buffer[buffer_len] = '\0';
+	return strlen (buffer);
+}
+
+
+/***************************************************************************
+ * Function:    write_private_profile_string()
+ * Arguments:   <char *> section - the name of the section to search for
+ *              <char *> entry - the name of the entry to find the value of
+ *              <char *> buffer - pointer to the buffer that holds the string
+ *              <char *> file_name - the name of the .ini file to read from
+ * Returns:     TRUE if successful, otherwise FALSE
+ ***************************************************************************/
+int write_private_profile_string(char *section,
+    char *entry, char *buffer, char *file_name)
+
+{
+	char * content = read_file(file_name);
+	FILE * fd = fopen(file_name,"w");
+    char t_section[MAX_LINE_LENGTH], *ptr;
+    int ret = 0;
+	
+	if (!fd) goto end;
+	if (!content) {
+    	fprintf (fd, "[%s]\n%s = %s\n", section, entry, buffer);
+    	ret = 1;
+    	goto end;
+	}
+    sprintf(t_section,"[%s]",section);         /* Format the section name */
+    ptr = str_search (content, t_section, 0);  /* look for the section start */
+    if (!ptr) {
+    	/* no such section: add the new section at end of file */
+    	fprintf (fd, "%s\n[%s]\n%s = %s\n", content, section, entry, buffer);
+    }
+    else {
+    	char * eptr;
+    	eptr = str_search (ptr, entry, '[');
+    	if (!eptr) {
+    		/* no such entry: looks for next section */
+    		eptr = str_search (++ptr, "[", 0);
+	    	if (!eptr) {
+    			/* section is the last one */
+	    		fprintf (fd, "%s\n%s = %s\n", content, entry, buffer);
+	    	}
+	    	else {
+	    		while (*ptr && (*ptr != '\n')) ptr++;
+	    		*ptr = 0;
+	    		fprintf (fd, "%s\n%s = %s", content, entry, buffer);
+	    		*ptr = '\n';
+	    		fprintf (fd, "%s", ptr);
+	    	}
+	    }
+	    else {
+	    	*eptr++ = 0;
+	    	fprintf (fd, "%s%s = %s", content, entry, buffer);
+	    	while (*eptr && (*eptr != '\n')) eptr++;
+	    	if (eptr) fprintf (fd, "%s", eptr);
+	    }
+    }
+    ret = 1;
+
+end:
+	if (content) free(content);
+	if (fd) fclose(fd);
+	return 0;
+}
+
+/***************************************************************************
+ * Function:    write_private_profile_int()
+ * Arguments:   <char *> section - the name of the section to search for
+ *              <char *> entry - the name of the entry to find the value of
+ *              <int> buffer - the value to be written
+ *              <char *> file_name - the name of the .ini file to read from
+ * Returns:     TRUE if successful, otherwise FALSE
+ ***************************************************************************/
+int write_private_profile_int(char *section,
+    char *entry, int val, char *file_name)
+{
+    char buffer [64];
+    sprintf(buffer, "%d", val);
+    return write_private_profile_string (section,entry, buffer, file_name);
+}
+
+#endif // #ifndef WIN32
+
+
+/**************************************************************************
+* Function:     get_private_profile_float()
+* Arguments:    <char *> section - the name of the section to search for
+*               <char *> entry - the name of the entry to find the value of
+*               <float> def - the default value in the event of a failed read
+*               <char *> file_name - the name of the .ini file to read from
+* Returns:      the value located at entry
+* Warning:		The float value to be read must not contain more than 100 digits.
+* Author:		CD, 15/11/2006.
+***************************************************************************/
+#define maxFloatLen	100
+float get_private_profile_float	(char * section, char * entry, float def, char * file_name)
+{
+	float result = def;
+	char buffer[ maxFloatLen ], *endptr;
+
+	if ( get_private_profile_string(section, entry, "", buffer, maxFloatLen, file_name) > 0 )
+	{
+		result = (float)strtod(buffer, &endptr);
+		if ((result==0) && (endptr==buffer))
+			result = def;
+	}
+	return result;
+}
diff --git a/windows/JackRouter/profport.h b/windows/JackRouter/profport.h
new file mode 100644
index 0000000..2f71717
--- /dev/null
+++ b/windows/JackRouter/profport.h
@@ -0,0 +1,37 @@
+
+/******************************************************************************
+ PORTABLE ROUTINES FOR WRITING PRIVATE PROFILE STRINGS --  by Joseph J. Graf
+ Header file containing prototypes and compile-time configuration.
+ 
+ [09/05/02] D. Fober - Windows definitions added
+******************************************************************************/
+
+#ifndef __profport__
+#define __profport__
+
+#define MAX_LINE_LENGTH    1024
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef WIN32
+#include "Windows.h"
+#define get_private_profile_int        GetPrivateProfileInt
+#define get_private_profile_string     GetPrivateProfileString
+#define write_private_profile_string   WritePrivateProfileString
+#define write_private_profile_int      WritePrivateProfileInt
+#else
+int get_private_profile_int      (char * section, char * entry, int def, char * file_name);
+int get_private_profile_string   (char * section, char * entry, char * def, char * buffer, int buffer_len, char * file_name);
+int write_private_profile_string (char * section, char * entry, char * buffer, char * file_name);
+int write_private_profile_int    (char * section, char * entry, int val, char * file_name);
+#endif
+
+float get_private_profile_float	(char * section, char * entry, float def, char * file_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__profport__
diff --git a/windows/JackRouter/psapi.dll b/windows/JackRouter/psapi.dll
new file mode 100644
index 0000000..ff4c964
Binary files /dev/null and b/windows/JackRouter/psapi.dll differ
diff --git a/windows/JackRouter/psapi.h b/windows/JackRouter/psapi.h
new file mode 100644
index 0000000..af72931
--- /dev/null
+++ b/windows/JackRouter/psapi.h
@@ -0,0 +1,95 @@
+/*
+	psapi.h - Include file for PSAPI.DLL APIs
+
+	Written by Mumit Khan <khan at nanotech.wisc.edu>
+
+	This file is part of a free library for the Win32 API.
+
+	NOTE: This strictly does not belong in the Win32 API since it's
+	really part of Platform SDK. However,GDB needs it and we might
+	as well provide it here.
+
+	This library is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+*/
+#ifndef _PSAPI_H
+#define _PSAPI_H
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef RC_INVOKED
+
+typedef struct _MODULEINFO {
+	LPVOID lpBaseOfDll;
+	DWORD SizeOfImage;
+	LPVOID EntryPoint;
+} MODULEINFO,*LPMODULEINFO;
+
+typedef struct _PSAPI_WS_WATCH_INFORMATION {
+	LPVOID FaultingPc;
+	LPVOID FaultingVa;
+} PSAPI_WS_WATCH_INFORMATION,*PPSAPI_WS_WATCH_INFORMATION;
+
+typedef struct _PROCESS_MEMORY_COUNTERS {
+	DWORD cb;
+	DWORD PageFaultCount;
+	DWORD PeakWorkingSetSize;
+	DWORD WorkingSetSize;
+	DWORD QuotaPeakPagedPoolUsage;
+	DWORD QuotaPagedPoolUsage;
+	DWORD QuotaPeakNonPagedPoolUsage;
+	DWORD QuotaNonPagedPoolUsage;
+	DWORD PagefileUsage;
+	DWORD PeakPagefileUsage;
+} PROCESS_MEMORY_COUNTERS,*PPROCESS_MEMORY_COUNTERS;
+
+/* Grouped by application,not in alphabetical order. */
+BOOL WINAPI EnumProcesses(DWORD *,DWORD,DWORD *);
+BOOL WINAPI EnumProcessModules(HANDLE,HMODULE *,DWORD,LPDWORD);
+DWORD WINAPI GetModuleBaseNameA(HANDLE,HMODULE,LPSTR,DWORD);
+DWORD WINAPI GetModuleBaseNameW(HANDLE,HMODULE,LPWSTR,DWORD);
+DWORD WINAPI GetModuleFileNameExA(HANDLE,HMODULE,LPSTR,DWORD);
+DWORD WINAPI GetModuleFileNameExW(HANDLE,HMODULE,LPWSTR,DWORD);
+BOOL WINAPI GetModuleInformation(HANDLE,HMODULE,LPMODULEINFO,DWORD);
+BOOL WINAPI EmptyWorkingSet(HANDLE);
+BOOL WINAPI QueryWorkingSet(HANDLE,PVOID,DWORD);
+BOOL WINAPI InitializeProcessForWsWatch(HANDLE);
+BOOL WINAPI GetWsChanges(HANDLE,PPSAPI_WS_WATCH_INFORMATION,DWORD);
+DWORD WINAPI GetMappedFileNameW(HANDLE,LPVOID,LPWSTR,DWORD);
+DWORD WINAPI GetMappedFileNameA(HANDLE,LPVOID,LPSTR,DWORD);
+BOOL WINAPI EnumDeviceDrivers(LPVOID *,DWORD,LPDWORD);
+DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID,LPSTR,DWORD);
+DWORD WINAPI GetDeviceDriverBaseNameW(LPVOID,LPWSTR,DWORD);
+DWORD WINAPI GetDeviceDriverFileNameA(LPVOID,LPSTR,DWORD);
+DWORD WINAPI GetDeviceDriverFileNameW(LPVOID,LPWSTR,DWORD);
+BOOL WINAPI GetProcessMemoryInfo(HANDLE,PPROCESS_MEMORY_COUNTERS,DWORD);
+
+#endif /* not RC_INVOKED */
+
+#ifdef UNICODE
+#define GetModuleBaseName GetModuleBaseNameW
+#define GetModuleFileNameEx GetModuleFileNameExW
+#define GetMappedFilenameEx GetMappedFilenameExW
+#define GetDeviceDriverBaseName GetDeviceDriverBaseNameW
+#define GetDeviceDriverFileName GetDeviceDriverFileNameW
+#else
+#define GetModuleBaseName GetModuleBaseNameA
+#define GetModuleFileNameEx GetModuleFileNameExA
+#define GetMappedFilenameEx GetMappedFilenameExA
+#define GetDeviceDriverBaseName GetDeviceDriverBaseNameA
+#define GetDeviceDriverFileName GetDeviceDriverFileNameA
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PSAPI_H */
+
diff --git a/windows/JackRouter/resource.h b/windows/JackRouter/resource.h
new file mode 100644
index 0000000..673206e
--- /dev/null
+++ b/windows/JackRouter/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        102
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/windows/JackRouter/resource.rc b/windows/JackRouter/resource.rc
new file mode 100644
index 0000000..e158022
--- /dev/null
+++ b/windows/JackRouter/resource.rc
@@ -0,0 +1,109 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// French (France) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,2,1,0
+ PRODUCTVERSION 0,2,1,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "JackRouter ASIO driver\0"
+            VALUE "FileVersion", "0, 2, 1, 0\0"
+            VALUE "InternalName", "JackRouter\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "JackRouter.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "JackRouter\0"
+            VALUE "ProductVersion", "0, 2, 1, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x40c, 1200
+    END
+END
+
+#endif    // !_MAC
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // French (France) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/windows/JackShmMem_os.h b/windows/JackShmMem_os.h
new file mode 100644
index 0000000..37a419f
--- /dev/null
+++ b/windows/JackShmMem_os.h
@@ -0,0 +1,33 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackShmMem_WIN32__
+#define __JackShmMem_WIN32__
+
+#include <windows.h>
+
+// See GetProcessWorkingSetSize and SetProcessWorkingSetSize
+
+#define CHECK_MLOCK(ptr, size) (VirtualLock((ptr), (size)) != 0)
+#define CHECK_MUNLOCK(ptr, size) (VirtualUnlock((ptr), (size)) != 0)
+#define CHECK_MLOCKALL()(false)
+#define CHECK_MUNLOCKALL()(false)
+
+#endif
diff --git a/windows/JackSystemDeps_os.h b/windows/JackSystemDeps_os.h
new file mode 100644
index 0000000..69b842b
--- /dev/null
+++ b/windows/JackSystemDeps_os.h
@@ -0,0 +1,39 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackSystemDeps_WIN32__
+#define __JackSystemDeps_WIN32__
+
+#include <windows.h>
+
+#define DRIVER_HANDLE HINSTANCE
+#define LoadDriverModule(name) LoadLibrary((name))
+#define UnloadDriverModule(handle) (FreeLibrary(((HMODULE)handle)))
+#define GetDriverProc(handle, name) GetProcAddress(((HMODULE)handle), (name))
+
+#define JACK_HANDLE HINSTANCE
+#define LoadJackModule(name) LoadLibrary((name));
+#define UnloadJackModule(handle) FreeLibrary((handle));
+#define GetJackProc(handle, name) GetProcAddress((handle), (name));
+
+#define ENOBUFS 55
+#define JACK_DEBUG false
+
+#endif
+
diff --git a/windows/JackTypes_os.h b/windows/JackTypes_os.h
new file mode 100644
index 0000000..13e6734
--- /dev/null
+++ b/windows/JackTypes_os.h
@@ -0,0 +1,31 @@
+/*
+  Copyright (C) 2001 Paul Davis
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackTypes_WIN32__
+#define __JackTypes_WIN32__
+
+#include <windows.h>
+#include "types.h"
+
+typedef ULONGLONG UInt64;
+typedef unsigned short uint16_t;
+typedef DWORD jack_tls_key;
+
+#endif
+
diff --git a/windows/JackWinEvent.cpp b/windows/JackWinEvent.cpp
new file mode 100644
index 0000000..c64fcf9
--- /dev/null
+++ b/windows/JackWinEvent.cpp
@@ -0,0 +1,162 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinEvent.h"
+#include "JackTools.h"
+#include "JackError.h"
+#include <assert.h>
+
+// http://www.codeproject.com/win32/Win32_Event_Handling.asp
+// http://www.codeproject.com/threads/Synchronization.asp
+
+namespace Jack
+{
+
+void JackWinEvent::BuildName(const char* name, const char* server_name, char* res)
+{
+    sprintf(res, "jack_pipe.%s_%s", server_name, name);
+}
+
+bool JackWinEvent::Signal()
+{
+    BOOL res;
+    assert(fEvent);
+
+    if (fFlush)
+        return true;
+
+    if (!(res = SetEvent(fEvent))) {
+        jack_error("JackWinEvent::Signal name = %s err = %ld", fName, GetLastError());
+    }
+
+    return res;
+}
+
+bool JackWinEvent::SignalAll()
+{
+    BOOL res;
+    assert(fEvent);
+
+    if (fFlush)
+        return true;
+
+    if (!(res = SetEvent(fEvent))) {
+        jack_error("JackWinEvent::SignalAll name = %s err = %ld", fName, GetLastError());
+    }
+
+    return res;
+}
+
+bool JackWinEvent::Wait()
+{
+    DWORD res;
+
+    if ((res = WaitForSingleObject(fEvent, INFINITE)) == WAIT_TIMEOUT) {
+        jack_error("JackWinEvent::TimedWait name = %s time_out", fName);
+    }
+
+    return (res == WAIT_OBJECT_0);
+}
+
+bool JackWinEvent::TimedWait(long usec)
+{
+    DWORD res;
+
+    if ((res = WaitForSingleObject(fEvent, usec / 1000)) == WAIT_TIMEOUT) {
+        jack_error("JackWinEvent::TimedWait name = %s time_out", fName);
+    }
+
+    return (res == WAIT_OBJECT_0);
+}
+
+// Client side : get the published semaphore from server
+bool JackWinEvent::ConnectInput(const char* name, const char* server_name)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackWinEvent::Connect %s", fName);
+
+    // Temporary...
+    if (fEvent) {
+        jack_log("Already connected name = %s", name);
+        return true;
+    }
+
+    if ((fEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, fName)) == NULL) {
+        jack_error("Connect: can't check in named event name = %s err = %ld", fName, GetLastError());
+        return false;
+    } else {
+        return true;
+    }
+}
+
+bool JackWinEvent::Connect(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackWinEvent::ConnectOutput(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackWinEvent::Disconnect()
+{
+    if (fEvent) {
+        jack_log("JackWinEvent::Disconnect %s", fName);
+        CloseHandle(fEvent);
+        fEvent = NULL;
+        return true;
+    } else {
+        return false;
+    }
+}
+
+bool JackWinEvent::Allocate(const char* name, const char* server_name, int value)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackWinEvent::Allocate name = %s val = %ld", fName, value);
+
+    /* create an auto reset event */
+    if ((fEvent = CreateEvent(NULL, FALSE, FALSE, fName)) == NULL) {
+        jack_error("Allocate: can't check in named event name = %s err = %ld", fName, GetLastError());
+        return false;
+    } else if (GetLastError() == ERROR_ALREADY_EXISTS) {
+        jack_error("Allocate: named event already exist name = %s", fName);
+        CloseHandle(fEvent);
+        fEvent = NULL;
+        return false;
+    } else {
+        return true;
+    }
+}
+
+void JackWinEvent::Destroy()
+{
+    if (fEvent != NULL) {
+        jack_log("JackWinEvent::Destroy %s", fName);
+        CloseHandle(fEvent);
+        fEvent = NULL;
+    } else {
+        jack_error("JackWinEvent::Destroy synchro == NULL");
+    }
+}
+
+
+} // end of namespace
+
diff --git a/windows/JackWinEvent.h b/windows/JackWinEvent.h
new file mode 100644
index 0000000..35fcb2f
--- /dev/null
+++ b/windows/JackWinEvent.h
@@ -0,0 +1,69 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackWinEvent__
+#define __JackWinEvent__
+
+#include "JackSynchro.h"
+#include <windows.h>
+
+namespace Jack
+{
+
+// http://bob.developpez.com/tutapiwin/article_56.php
+
+/*!
+\brief Inter process synchronization using system wide events.
+*/
+
+class JackWinEvent : public JackSynchro
+{
+
+    private:
+
+        HANDLE fEvent;
+
+    protected:
+
+        void BuildName(const char* name, const char* server_name, char* res);
+
+    public:
+
+        JackWinEvent(): JackSynchro(), fEvent(NULL)
+        {}
+        virtual ~JackWinEvent()
+        {}
+
+        bool Signal();
+        bool SignalAll();
+        bool Wait();
+        bool TimedWait(long usec);
+
+        bool Allocate(const char* name, const char* server_name, int value);
+        bool Connect(const char* name, const char* server_name);
+        bool ConnectInput(const char* name, const char* server_name);
+        bool ConnectOutput(const char* name, const char* server_name);
+        bool Disconnect();
+        void Destroy();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinMutex.h b/windows/JackWinMutex.h
new file mode 100644
index 0000000..55434ac
--- /dev/null
+++ b/windows/JackWinMutex.h
@@ -0,0 +1,71 @@
+/*
+ Copyright (C) 2006 Grame
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+ Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
+ grame at grame.fr
+*/
+
+#ifndef __JackWinMutex__
+#define __JackWinMutex__
+
+#include <windows.h>
+
+namespace Jack
+{
+/*!
+\brief Mutex abstraction.
+*/
+class JackWinMutex
+{
+
+    protected:
+
+        HANDLE fMutex;
+
+    public:
+
+        JackWinMutex()
+        {
+            // In recursive mode by default
+            fMutex = (HANDLE)CreateMutex(0, FALSE, 0);
+        }
+
+        virtual ~JackWinMutex()
+        {
+            CloseHandle(fMutex);
+        }
+
+        bool Lock()
+        {
+            return (WAIT_OBJECT_0 == WaitForSingleObject(fMutex, INFINITE));
+        }
+
+        bool Trylock()
+        {
+            return (WAIT_OBJECT_0 == WaitForSingleObject(fMutex, 0));
+        }
+
+        bool Unlock()
+        {
+            return(ReleaseMutex(fMutex) != 0);
+        }
+
+};
+
+} // namespace
+
+#endif
diff --git a/windows/JackWinNamedPipe.cpp b/windows/JackWinNamedPipe.cpp
new file mode 100644
index 0000000..d332905
--- /dev/null
+++ b/windows/JackWinNamedPipe.cpp
@@ -0,0 +1,393 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinNamedPipe.h"
+#include "JackError.h"
+#include <assert.h>
+#include <stdio.h>
+
+#define BUFSIZE 4096
+
+namespace Jack
+{
+
+int JackWinNamedPipe::Read(void* data, int len)
+{
+    DWORD read;
+    BOOL res = ReadFile(fNamedPipe, data, len, &read, NULL);
+    if (res && read == (DWORD)len) {
+        return 0;
+    } else {
+        jack_error("Cannot read named pipe err = %ld", GetLastError());
+        return -1;
+    }
+}
+
+int JackWinNamedPipe::Write(void* data, int len)
+{
+    DWORD written;
+    BOOL res = WriteFile(fNamedPipe, data, len, &written, NULL);
+    if (res && written == (DWORD)len) {
+        return 0;
+    } else {
+        jack_error("Cannot write named pipe err = %ld", GetLastError());
+        return -1;
+    }
+}
+
+int JackWinNamedPipeClient::Connect(const char* dir, int which)
+{
+    sprintf(fName, "\\\\.\\pipe\\%s_jack_%d", dir, which);
+    jack_log("Connect: fName %s", fName);
+
+    fNamedPipe = CreateFile(fName, 			 // pipe name
+                            GENERIC_READ |   // read and write access
+                            GENERIC_WRITE,
+                            0,               // no sharing
+                            NULL,            // default security attributes
+                            OPEN_EXISTING,   // opens existing pipe
+                            0,               // default attributes
+                            NULL);          // no template file
+
+    if (fNamedPipe == INVALID_HANDLE_VALUE) {
+        jack_error("Cannot connect to named pipe = %s err = %ld", fName, GetLastError());
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackWinNamedPipeClient::Connect(const char* dir, const char* name, int which)
+{
+    sprintf(fName, "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which);
+    jack_log("Connect: fName %s", fName);
+
+    fNamedPipe = CreateFile(fName, 			 // pipe name
+                            GENERIC_READ |   // read and write access
+                            GENERIC_WRITE,
+                            0,               // no sharing
+                            NULL,            // default security attributes
+                            OPEN_EXISTING,   // opens existing pipe
+                            0,               // default attributes
+                            NULL);          // no template file
+
+    if (fNamedPipe == INVALID_HANDLE_VALUE) {
+        jack_error("Cannot connect to named pipe = %s err = %ld", fName, GetLastError());
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackWinNamedPipeClient::Close()
+{
+    if (fNamedPipe != INVALID_HANDLE_VALUE) {
+        CloseHandle(fNamedPipe);
+        fNamedPipe = INVALID_HANDLE_VALUE;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+void JackWinNamedPipeClient::SetReadTimeOut(long sec)
+{}
+
+void JackWinNamedPipeClient::SetWriteTimeOut(long sec)
+{}
+
+JackWinAsyncNamedPipeClient::JackWinAsyncNamedPipeClient()
+        : JackWinNamedPipeClient(), fPendingIO(false), fIOState(kIdle)
+{
+    fIOState = kIdle;
+    fOverlap.hEvent = CreateEvent(NULL,     // default security attribute
+                                  TRUE,     // manual-reset event
+                                  TRUE,     // initial state = signaled
+                                  NULL);    // unnamed event object
+}
+
+JackWinAsyncNamedPipeClient::JackWinAsyncNamedPipeClient(HANDLE pipe, bool pending)
+        : JackWinNamedPipeClient(pipe), fPendingIO(pending), fIOState(kIdle)
+{
+    fOverlap.hEvent = CreateEvent(NULL,     // default security attribute
+                                  TRUE,     // manual-reset event
+                                  TRUE,     // initial state = signaled
+                                  NULL);	// unnamed event object
+
+    if (!fPendingIO)
+        SetEvent(fOverlap.hEvent);
+
+    fIOState = (fPendingIO) ? kConnecting : kReading;
+}
+
+JackWinAsyncNamedPipeClient::~JackWinAsyncNamedPipeClient()
+{
+    CloseHandle(fOverlap.hEvent);
+}
+
+int JackWinAsyncNamedPipeClient::FinishIO()
+{
+    DWORD success, ret;
+    success = GetOverlappedResult(fNamedPipe, 	// handle to pipe
+                                  &fOverlap, 	// OVERLAPPED structure
+                                  &ret,         // bytes transferred
+                                  FALSE);       // do not wait
+
+    switch (fIOState) {
+
+        case kConnecting:
+            if (!success) {
+                jack_error("Conection error");
+                return -1;
+            } else {
+                fIOState = kReading;
+                // Prepare connection for new client ??
+            }
+            break;
+
+        case kReading:
+            if (!success || ret == 0) {
+                return -1;
+            }
+            fIOState = kWriting;
+            break;
+
+        case kWriting:
+            if (!success || ret == 0) {
+                return -1;
+            }
+            fIOState = kReading;
+            break;
+
+        default:
+            break;
+    }
+
+    return 0;
+}
+
+int JackWinAsyncNamedPipeClient::Read(void* data, int len)
+{
+    DWORD read;
+    jack_log("JackWinNamedPipeClient::Read len = %ld", len);
+    BOOL res = ReadFile(fNamedPipe, data, len, &read, &fOverlap);
+    jack_log("JackWinNamedPipeClient::Read res = %ld read %ld", res, read);
+
+    if (res && read != 0) {
+        fPendingIO = false;
+        fIOState = kWriting;
+        return 0;
+    } else if (!res && GetLastError() == ERROR_IO_PENDING) {
+        fPendingIO = true;
+        return 0;
+    } else {
+        jack_error("Cannot read named pipe err = %ld", GetLastError());
+        return -1;
+    }
+}
+
+int JackWinAsyncNamedPipeClient::Write(void* data, int len)
+{
+    DWORD written;
+    jack_log("JackWinNamedPipeClient::Write len = %ld", len);
+    BOOL res = WriteFile(fNamedPipe, data, len, &written, &fOverlap);
+
+    if (res && written != 0) {
+        fPendingIO = false;
+        fIOState = kWriting;
+        return 0;
+    } else if (!res && GetLastError() == ERROR_IO_PENDING) {
+        fPendingIO = true;
+        return 0;
+    } else {
+        jack_error("Cannot write named pipe err = %ld", GetLastError());
+        return -1;
+    }
+}
+
+// Server side
+
+int JackWinNamedPipeServer::Bind(const char* dir, int which)
+{
+    sprintf(fName, "\\\\.\\pipe\\%s_jack_%d", dir, which);
+    jack_log("Bind: fName %s", fName);
+
+    if ((fNamedPipe = CreateNamedPipe(fName,
+                                      PIPE_ACCESS_DUPLEX,  // read/write access
+                                      PIPE_TYPE_MESSAGE |  // message type pipe
+                                      PIPE_READMODE_MESSAGE |  // message-read mode
+                                      PIPE_WAIT,  // blocking mode
+                                      PIPE_UNLIMITED_INSTANCES,  // max. instances
+                                      BUFSIZE,  // output buffer size
+                                      BUFSIZE,  // input buffer size
+                                      INFINITE,  // client time-out
+                                      NULL)) == INVALID_HANDLE_VALUE) { // no security a
+        jack_error("Cannot bind server to pipe err = %ld", GetLastError());
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackWinNamedPipeServer::Bind(const char* dir, const char* name, int which)
+{
+    sprintf(fName, "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which);
+    jack_log("Bind: fName %s", fName);
+
+    if ((fNamedPipe = CreateNamedPipe(fName,
+                                      PIPE_ACCESS_DUPLEX,  // read/write access
+                                      PIPE_TYPE_MESSAGE |  // message type pipe
+                                      PIPE_READMODE_MESSAGE |  // message-read mode
+                                      PIPE_WAIT,  // blocking mode
+                                      PIPE_UNLIMITED_INSTANCES,  // max. instances
+                                      BUFSIZE,  // output buffer size
+                                      BUFSIZE,  // input buffer size
+                                      INFINITE,  // client time-out
+                                      NULL)) == INVALID_HANDLE_VALUE) { // no security a
+        jack_error("Cannot bind server to pipe err = %ld", GetLastError());
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+bool JackWinNamedPipeServer::Accept()
+{
+    if (ConnectNamedPipe(fNamedPipe, NULL)) {
+        return true;
+    } else {
+        jack_error("Cannot bind server pipe name = %s err = %ld", fName, GetLastError());
+        if (GetLastError() == ERROR_PIPE_CONNECTED) {
+            jack_error("pipe already connnected = %s ", fName);
+            return true;
+        } else {
+            return false;
+        }
+    }
+}
+
+JackWinNamedPipeClient* JackWinNamedPipeServer::AcceptClient()
+{
+    if (ConnectNamedPipe(fNamedPipe, NULL)) {
+        JackWinNamedPipeClient* client = new JackWinNamedPipeClient(fNamedPipe);
+        // Init the pipe to the default value
+        fNamedPipe = INVALID_HANDLE_VALUE;
+        return client;
+    } else {
+        switch (GetLastError()) {
+
+            case ERROR_PIPE_CONNECTED:
+                return new JackWinNamedPipeClient(fNamedPipe);
+
+            default:
+                jack_error("Cannot connect server pipe name = %s  err = %ld", fName, GetLastError());
+                return NULL;
+                break;
+        }
+    }
+}
+
+int JackWinNamedPipeServer::Close()
+{
+    jack_log("JackWinNamedPipeServer::Close");
+
+    if (fNamedPipe != INVALID_HANDLE_VALUE) {
+        DisconnectNamedPipe(fNamedPipe);
+        CloseHandle(fNamedPipe);
+        fNamedPipe = INVALID_HANDLE_VALUE;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+// Server side
+
+int JackWinAsyncNamedPipeServer::Bind(const char* dir, int which)
+{
+    sprintf(fName, "\\\\.\\pipe\\%s_jack_%d", dir, which);
+    jack_log("Bind: fName %s", fName);
+
+    if ((fNamedPipe = CreateNamedPipe(fName,
+                                      PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,  // read/write access
+                                      PIPE_TYPE_MESSAGE |  // message type pipe
+                                      PIPE_READMODE_MESSAGE |  // message-read mode
+                                      PIPE_WAIT,  // blocking mode
+                                      PIPE_UNLIMITED_INSTANCES,  // max. instances
+                                      BUFSIZE,  // output buffer size
+                                      BUFSIZE,  // input buffer size
+                                      INFINITE,  // client time-out
+                                      NULL)) == INVALID_HANDLE_VALUE) { // no security a
+        jack_error("Cannot bind server to pipe err = %ld", GetLastError());
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackWinAsyncNamedPipeServer::Bind(const char* dir, const char* name, int which)
+{
+    sprintf(fName, "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which);
+    jack_log("Bind: fName %s", fName);
+
+    if ((fNamedPipe = CreateNamedPipe(fName,
+                                      PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,  // read/write access
+                                      PIPE_TYPE_MESSAGE |  // message type pipe
+                                      PIPE_READMODE_MESSAGE |  // message-read mode
+                                      PIPE_WAIT,  // blocking mode
+                                      PIPE_UNLIMITED_INSTANCES,  // max. instances
+                                      BUFSIZE,  // output buffer size
+                                      BUFSIZE,  // input buffer size
+                                      INFINITE,  // client time-out
+                                      NULL)) == INVALID_HANDLE_VALUE) { // no security a
+        jack_error("Cannot bind server to pipe err = %ld", GetLastError());
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+bool JackWinAsyncNamedPipeServer::Accept()
+{
+    return false;
+}
+
+JackWinNamedPipeClient* JackWinAsyncNamedPipeServer::AcceptClient()
+{
+    if (ConnectNamedPipe(fNamedPipe, NULL)) {
+        return new JackWinAsyncNamedPipeClient(fNamedPipe, false);
+    } else {
+        switch (GetLastError()) {
+
+            case ERROR_IO_PENDING:
+                return new JackWinAsyncNamedPipeClient(fNamedPipe, true);
+
+            case ERROR_PIPE_CONNECTED:
+                return new JackWinAsyncNamedPipeClient(fNamedPipe, false);
+
+            default:
+                jack_error("Cannot connect server pipe name = %s  err = %ld", fName, GetLastError());
+                return NULL;
+                break;
+        }
+    }
+}
+
+} // end of namespace
+
diff --git a/windows/JackWinNamedPipe.h b/windows/JackWinNamedPipe.h
new file mode 100644
index 0000000..864b6c9
--- /dev/null
+++ b/windows/JackWinNamedPipe.h
@@ -0,0 +1,156 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackWinNamedPipe__
+#define __JackWinNamedPipe__
+
+#include <windows.h>
+
+namespace Jack
+{
+
+class JackWinNamedPipe
+{
+
+    protected:
+
+        HANDLE fNamedPipe;
+        char fName[256];
+
+    public:
+
+        JackWinNamedPipe(): fNamedPipe(INVALID_HANDLE_VALUE)
+        {}
+        JackWinNamedPipe(HANDLE pipe): fNamedPipe(pipe)
+        {}
+        virtual ~JackWinNamedPipe()
+        {}
+
+        virtual int Read(void* data, int len);
+        virtual int Write(void* data, int len);
+};
+
+/*!
+\brief Client named pipe.
+*/
+
+class JackWinNamedPipeClient : public JackWinNamedPipe
+{
+
+    public:
+
+        JackWinNamedPipeClient(): JackWinNamedPipe()
+        {}
+        JackWinNamedPipeClient(HANDLE pipe): JackWinNamedPipe(pipe)
+        {}
+
+        virtual ~JackWinNamedPipeClient()
+        {}
+
+        virtual int Connect(const char* dir, int which);
+        virtual int Connect(const char* dir, const char* name, int which);
+        virtual int Close();
+        virtual void SetReadTimeOut(long sec);
+        virtual void SetWriteTimeOut(long sec);
+};
+
+class JackWinAsyncNamedPipeClient : public JackWinNamedPipeClient
+{
+        enum kIOState {kIdle = 0, kConnecting, kReading, kWriting};
+
+    private:
+
+        bool fPendingIO;
+        kIOState fIOState;
+        OVERLAPPED fOverlap;
+
+    public:
+
+        JackWinAsyncNamedPipeClient();
+        JackWinAsyncNamedPipeClient(HANDLE pipe, bool pending);
+        virtual ~JackWinAsyncNamedPipeClient();
+
+        virtual int Read(void* data, int len);
+        virtual int Write(void* data, int len);
+
+        HANDLE GetEvent()
+        {
+            return (HANDLE)fOverlap.hEvent;
+        }
+
+        kIOState GetIOState()
+        {
+            return fIOState;
+        }
+
+        bool GetPending()
+        {
+            return fPendingIO;
+        }
+
+        int FinishIO();
+};
+
+/*!
+\brief Server named pipe.
+*/
+
+class JackWinNamedPipeServer : public JackWinNamedPipe
+{
+
+    public:
+
+        JackWinNamedPipeServer(): JackWinNamedPipe()
+        {}
+        virtual ~JackWinNamedPipeServer()
+        {}
+
+        virtual int Bind(const char* dir, int which);
+        virtual int Bind(const char* dir, const char* name, int which);
+        virtual bool Accept();
+        virtual JackWinNamedPipeClient* AcceptClient();
+        int Close();
+};
+
+/*!
+\brief Server async named pipe.
+*/
+
+class JackWinAsyncNamedPipeServer : public JackWinNamedPipeServer
+{
+
+    public:
+
+        JackWinAsyncNamedPipeServer(): JackWinNamedPipeServer()
+        {}
+        virtual ~JackWinAsyncNamedPipeServer()
+        {}
+
+        int Bind(const char* dir, int which);
+        int Bind(const char* dir, const char* name, int which);
+        bool Accept();
+        JackWinNamedPipeClient* AcceptClient();
+        int Close();
+};
+
+} // end of namespace
+
+
+#endif
+
diff --git a/windows/JackWinNamedPipeClientChannel.cpp b/windows/JackWinNamedPipeClientChannel.cpp
new file mode 100644
index 0000000..fedc109
--- /dev/null
+++ b/windows/JackWinNamedPipeClientChannel.cpp
@@ -0,0 +1,338 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackWinNamedPipeClientChannel.h"
+#include "JackRequest.h"
+#include "JackClient.h"
+#include "JackGlobals.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+JackWinNamedPipeClientChannel::JackWinNamedPipeClientChannel():fThread(this)
+{
+    fClient = NULL;
+}
+
+JackWinNamedPipeClientChannel::~JackWinNamedPipeClientChannel()
+{}
+
+int JackWinNamedPipeClientChannel::ServerCheck(const char* server_name)
+{
+    jack_log("JackWinNamedPipeClientChannel::ServerCheck = %s", server_name);
+
+    // Connect to server
+    if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) {
+        jack_error("Cannot connect to server pipe");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
+{
+    int result = 0;
+    jack_log("JackWinNamedPipeClientChannel::Open name = %s", name);
+
+    /*
+    16/08/07: was called before doing "fRequestPipe.Connect" .... still necessary?
+       if (fNotificationListenPipe.Bind(jack_client_dir, name, 0) < 0) {
+           jack_error("Cannot bind pipe");
+           goto error;
+       }
+    */
+
+    if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) {
+        jack_error("Cannot connect to server pipe");
+        goto error;
+    }
+
+    // Check name in server
+    ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
+    if (result < 0) {
+        jack_error("Client name = %s conflits with another running client", name);
+        goto error;
+    }
+
+    if (fNotificationListenPipe.Bind(jack_client_dir, name_res, 0) < 0) {
+        jack_error("Cannot bind pipe");
+        goto error;
+    }
+
+    fClient = obj;
+    return 0;
+
+error:
+    fRequestPipe.Close();
+    fNotificationListenPipe.Close();
+    return -1;
+}
+
+void JackWinNamedPipeClientChannel::Close()
+{
+    fRequestPipe.Close();
+    fNotificationListenPipe.Close();
+    // Here the thread will correctly stop when the pipe are closed
+    fThread.Stop();
+}
+
+int JackWinNamedPipeClientChannel::Start()
+{
+    jack_log("JackWinNamedPipeClientChannel::Start");
+    /*
+     To be sure notification thread is started before ClientOpen is called.
+    */
+    if (fThread.StartSync() != 0) {
+        jack_error("Cannot start Jack client listener");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+void JackWinNamedPipeClientChannel::Stop()
+{
+    jack_log("JackWinNamedPipeClientChannel::Stop");
+    fThread.Kill();  // Unsafe on WIN32... TODO : solve WIN32 thread Kill issue
+}
+
+void JackWinNamedPipeClientChannel::ServerSyncCall(JackRequest* req, JackResult* res, int* result)
+{
+    if (req->Write(&fRequestPipe) < 0) {
+        jack_error("Could not write request type = %ld", req->fType);
+        *result = -1;
+        return ;
+    }
+
+    if (res->Read(&fRequestPipe) < 0) {
+        jack_error("Could not read result type = %ld", req->fType);
+        *result = -1;
+        return ;
+    }
+
+    *result = res->fResult;
+}
+
+void JackWinNamedPipeClientChannel::ServerAsyncCall(JackRequest* req, JackResult* res, int* result)
+{
+    if (req->Write(&fRequestPipe) < 0) {
+        jack_error("Could not write request type = %ld", req->fType);
+        *result = -1;
+    } else {
+        *result = 0;
+    }
+}
+
+void JackWinNamedPipeClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
+{
+    JackClientCheckRequest req(name, protocol, options);
+    JackClientCheckResult res;
+    ServerSyncCall(&req, &res, result);
+    *status = res.fStatus;
+    strcpy(name_res, res.fName);
+}
+
+void JackWinNamedPipeClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    JackClientOpenRequest req(name, pid);
+    JackClientOpenResult res;
+    ServerSyncCall(&req, &res, result);
+    *shared_engine = res.fSharedEngine;
+    *shared_client = res.fSharedClient;
+    *shared_graph = res.fSharedGraph;
+}
+
+void JackWinNamedPipeClientChannel::ClientClose(int refnum, int* result)
+{
+    JackClientCloseRequest req(refnum);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::ClientActivate(int refnum, int is_real_time, int* result)
+{
+    JackActivateRequest req(refnum, is_real_time);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::ClientDeactivate(int refnum, int* result)
+{
+    JackDeactivateRequest req(refnum);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
+{
+    JackPortRegisterRequest req(refnum, name, type, flags, buffer_size);
+    JackPortRegisterResult res;
+    ServerSyncCall(&req, &res, result);
+    *port_index = res.fPortIndex;
+}
+
+void JackWinNamedPipeClientChannel::PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
+{
+    JackPortUnRegisterRequest req(refnum, port_index);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::PortConnect(int refnum, const char* src, const char* dst, int* result)
+{
+    JackPortConnectNameRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::PortDisconnect(int refnum, const char* src, const char* dst, int* result)
+{
+    JackPortDisconnectNameRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+{
+    JackPortConnectRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
+{
+    JackPortDisconnectRequest req(refnum, src, dst);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
+{
+    JackPortRenameRequest req(refnum, port, name);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::SetBufferSize(jack_nframes_t buffer_size, int* result)
+{
+    JackSetBufferSizeRequest req(buffer_size);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::SetFreewheel(int onoff, int* result)
+{
+    JackSetFreeWheelRequest req(onoff);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::ReleaseTimebase(int refnum, int* result)
+{
+    JackReleaseTimebaseRequest req(refnum);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::SetTimebaseCallback(int refnum, int conditional, int* result)
+{
+    JackSetTimebaseCallbackRequest req(refnum, conditional);
+    JackResult res;
+    ServerSyncCall(&req, &res, result);
+}
+
+void JackWinNamedPipeClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
+{
+    JackGetInternalClientNameRequest req(refnum, int_ref);
+    JackGetInternalClientNameResult res;
+    ServerSyncCall(&req, &res, result);
+    strcpy(name_res, res.fName);
+}
+
+void JackWinNamedPipeClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
+{
+    JackInternalClientHandleRequest req(refnum, client_name);
+    JackInternalClientHandleResult res;
+    ServerSyncCall(&req, &res, result);
+    *int_ref = res.fIntRefNum;
+    *status = res.fStatus;
+}
+
+void JackWinNamedPipeClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
+{
+    JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options);
+    JackInternalClientLoadResult res;
+    ServerSyncCall(&req, &res, result);
+    *int_ref = res.fIntRefNum;
+    *status = res.fStatus;
+}
+
+void JackWinNamedPipeClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result)
+{
+    JackInternalClientUnloadRequest req(refnum, int_ref);
+    JackInternalClientUnloadResult res;
+    ServerSyncCall(&req, &res, result);
+    *status = res.fStatus;
+}
+
+bool JackWinNamedPipeClientChannel::Init()
+{
+    jack_log("JackWinNamedPipeClientChannel::Init");
+
+    if (!fNotificationListenPipe.Accept()) {
+        jack_error("JackWinNamedPipeClientChannel: cannot establish notification pipe");
+        return false;
+    } else {
+        return fClient->Init();
+    }
+}
+
+bool JackWinNamedPipeClientChannel::Execute()
+{
+    JackClientNotification event;
+    JackResult res;
+
+    if (event.Read(&fNotificationListenPipe) < 0) {
+        jack_error("JackWinNamedPipeClientChannel read fail");
+        goto error;
+    }
+
+    res.fResult = fClient->ClientNotify(event.fRefNum, event.fName, event.fNotify, event.fSync, event.fMessage, event.fValue1, event.fValue2);
+
+    if (event.fSync) {
+        if (res.Write(&fNotificationListenPipe) < 0) {
+            jack_error("JackWinNamedPipeClientChannel write fail");
+            goto error;
+        }
+    }
+    return true;
+
+error:
+    // Close the pipes, server wont be able to create them otherwise.
+    fNotificationListenPipe.Close();
+    fRequestPipe.Close();
+    fClient->ShutDown();
+    return false;
+}
+
+} // end of namespace
+
+
diff --git a/windows/JackWinNamedPipeClientChannel.h b/windows/JackWinNamedPipeClientChannel.h
new file mode 100644
index 0000000..32bf6a5
--- /dev/null
+++ b/windows/JackWinNamedPipeClientChannel.h
@@ -0,0 +1,100 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackWinNamedPipeClientChannel__
+#define __JackWinNamedPipeClientChannel__
+
+#include "JackChannel.h"
+#include "JackWinNamedPipe.h"
+#include "JackPlatformPlug.h"
+#include "JackRequest.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackClientChannel using pipes.
+*/
+
+class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface
+{
+
+    private:
+
+        JackWinNamedPipeClient fRequestPipe;			// Pipe to communicate with the server
+        JackWinNamedPipeServer fNotificationListenPipe;	// Pipe listener for server notification
+        JackThread fThread;                             // Thread to execute the event loop
+        JackClient*	fClient;
+
+        void ServerSyncCall(JackRequest* req, JackResult* res, int* result);
+        void ServerAsyncCall(JackRequest* req, JackResult* res, int* result);
+
+    public:
+
+        JackWinNamedPipeClientChannel();
+        virtual ~JackWinNamedPipeClientChannel();
+
+        int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
+        void Close();
+
+        int Start();
+        void Stop();
+
+        int ServerCheck(const char* server_name);
+
+        void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result);
+        void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
+        void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
+        {}
+        void ClientClose(int refnum, int* result);
+
+        void ClientActivate(int refnum, int is_real_time, int* result);
+        void ClientDeactivate(int refnum, int* result);
+
+        void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result);
+        void PortUnRegister(int refnum, jack_port_id_t port_index, int* result);
+
+        void PortConnect(int refnum, const char* src, const char* dst, int* result);
+        void PortDisconnect(int refnum, const char* src, const char* dst, int* result);
+
+        void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
+        void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
+        
+        void PortRename(int refnum, jack_port_id_t port, const char* name, int* result);
+
+        void SetBufferSize(jack_nframes_t buffer_size, int* result);
+        void SetFreewheel(int onoff, int* result);
+
+        void ReleaseTimebase(int refnum, int* result);
+        void SetTimebaseCallback(int refnum, int conditional, int* result);
+
+        void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
+        void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
+        void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
+        void InternalClientUnload(int refnum, int int_ref, int* status, int* result);
+
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinNamedPipeNotifyChannel.cpp b/windows/JackWinNamedPipeNotifyChannel.cpp
new file mode 100644
index 0000000..a737508
--- /dev/null
+++ b/windows/JackWinNamedPipeNotifyChannel.cpp
@@ -0,0 +1,79 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackRequest.h"
+#include "JackWinNamedPipeNotifyChannel.h"
+#include "JackError.h"
+#include "JackConstants.h"
+
+namespace Jack
+{
+
+// Server to client
+int JackWinNamedPipeNotifyChannel::Open(const char* name)
+{
+    jack_log("JackWinNamedPipeNotifyChannel::Open name = %s", name);
+
+    // Connect to client listen pipe
+    if (fNotifyPipe.Connect(jack_client_dir, name, 0) < 0) {
+        jack_error("Cannot connect client pipe");
+        return -1;
+    }
+    // TODO : use a time out for notifications
+    fNotifyPipe.SetReadTimeOut(SOCKET_TIME_OUT);
+    return 0;
+}
+
+void JackWinNamedPipeNotifyChannel::Close()
+{
+    jack_log("JackWinNamedPipeNotifyChannel::Close");
+    fNotifyPipe.Close();
+}
+
+void JackWinNamedPipeNotifyChannel::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result)
+{
+    JackClientNotification event(name, refnum, notify, sync, message, value1, value2);
+    JackResult res;
+
+    // Send notification
+    if (event.Write(&fNotifyPipe) < 0) {
+        jack_error("Could not write notification");
+        fNotifyPipe.Close();
+        *result = -1;
+        return;
+    }
+
+    // Read the result in "synchronous" mode only
+    if (sync) {
+        // Get result : use a time out
+        if (res.Read(&fNotifyPipe) < 0) {
+            jack_error("Could not read result");
+            fNotifyPipe.Close();
+            *result = -1;
+        } else {
+            *result = res.fResult;
+        }
+    } else {
+        *result = 0;
+    }
+}
+
+} // end of namespace
+
+
diff --git a/windows/JackWinNamedPipeNotifyChannel.h b/windows/JackWinNamedPipeNotifyChannel.h
new file mode 100644
index 0000000..9d90e26
--- /dev/null
+++ b/windows/JackWinNamedPipeNotifyChannel.h
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackWinNamedPipeNotifyChannel__
+#define __JackWinNamedPipeNotifyChannel__
+
+#include "JackWinNamedPipe.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackNotifyChannel using named pipe.
+*/
+
+class JackWinNamedPipeNotifyChannel
+{
+
+    private:
+
+        JackWinNamedPipeClient fNotifyPipe;    // Pipe to communicate with the server : from server to client
+
+    public:
+
+        JackWinNamedPipeNotifyChannel()
+        {}
+
+        int Open(const char* name);		// Open the Server/Client connection
+        void Close();					// Close the Server/Client connection
+
+        void ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result);
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinNamedPipeServerChannel.cpp b/windows/JackWinNamedPipeServerChannel.cpp
new file mode 100644
index 0000000..3e6daa9
--- /dev/null
+++ b/windows/JackWinNamedPipeServerChannel.cpp
@@ -0,0 +1,484 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackWinNamedPipeServerChannel.h"
+#include "JackNotification.h"
+#include "JackRequest.h"
+#include "JackServer.h"
+#include "JackLockedEngine.h"
+#include "JackGlobals.h"
+#include "JackClient.h"
+#include "JackNotification.h"
+#include "JackException.h"
+#include <assert.h>
+
+using namespace std;
+
+namespace Jack
+{
+
+HANDLE JackClientPipeThread::fMutex = NULL;  // Never released....
+
+// fRefNum = -1 correspond to already removed client
+
+JackClientPipeThread::JackClientPipeThread(JackWinNamedPipeClient* pipe)
+    :fPipe(pipe), fServer(NULL), fThread(this), fRefNum(0)
+{
+    // First one allocated the static fMutex
+    if (fMutex == NULL) {
+        fMutex = CreateMutex(NULL, FALSE, NULL);
+    }
+}
+
+JackClientPipeThread::~JackClientPipeThread()
+{
+    jack_log("JackClientPipeThread::~JackClientPipeThread");
+    delete fPipe;
+}
+
+int JackClientPipeThread::Open(JackServer* server)	// Open the Server/Client connection
+{
+    // Start listening
+    if (fThread.Start() != 0) {
+        jack_error("Cannot start Jack server listener\n");
+        return -1;
+    }
+
+    fServer = server;
+    return 0;
+}
+
+void JackClientPipeThread::Close()					// Close the Server/Client connection
+{
+    jack_log("JackClientPipeThread::Close %x %ld", this, fRefNum);
+    /*
+    	TODO : solve WIN32 thread Kill issue
+    	This would hang.. since Close will be followed by a delete,
+    	all ressources will be desallocated at the end.
+    */
+
+    fThread.Stop();
+    fPipe->Close();
+    fRefNum = -1;
+}
+
+bool JackClientPipeThread::Execute()
+{
+    try{
+        jack_log("JackClientPipeThread::Execute");
+        return (HandleRequest());
+    } catch (JackQuitException& e) {
+        jack_log("JackMachServerChannel::Execute JackQuitException");
+        return false;
+    }
+}
+
+bool JackClientPipeThread::HandleRequest()
+{
+    // Read header
+    JackRequest header;
+    int res = header.Read(fPipe);
+    bool ret = true;
+
+    // Lock the global mutex
+    if (WaitForSingleObject(fMutex, INFINITE) == WAIT_FAILED)
+        jack_error("JackClientPipeThread::HandleRequest: mutex wait error");
+
+    if (res < 0) {
+        jack_error("HandleRequest: cannot read header");
+        ClientKill();
+        ret = false;
+    } else {
+
+        // Read data
+        switch (header.fType) {
+
+            case JackRequest::kClientCheck: {
+                jack_log("JackRequest::ClientCheck");
+                JackClientCheckRequest req;
+                JackClientCheckResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->ClientCheck(req.fName, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kClientOpen: {
+                jack_log("JackRequest::ClientOpen");
+                JackClientOpenRequest req;
+                JackClientOpenResult res;
+                if (req.Read(fPipe) == 0)
+                    ClientAdd(req.fName, req.fPID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kClientClose: {
+                jack_log("JackRequest::ClientClose");
+                JackClientCloseRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->ClientExternalClose(req.fRefNum);
+                res.Write(fPipe);
+                ClientRemove();
+                ret = false;
+                break;
+            }
+
+            case JackRequest::kActivateClient: {
+                JackActivateRequest req;
+                JackResult res;
+                jack_log("JackRequest::ActivateClient");
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->ClientActivate(req.fRefNum, req.fIsRealTime);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kDeactivateClient: {
+                jack_log("JackRequest::DeactivateClient");
+                JackDeactivateRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->ClientDeactivate(req.fRefNum);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kRegisterPort: {
+                jack_log("JackRequest::RegisterPort");
+                JackPortRegisterRequest req;
+                JackPortRegisterResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortRegister(req.fRefNum, req.fName, req.fPortType, req.fFlags, req.fBufferSize, &res.fPortIndex);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kUnRegisterPort: {
+                jack_log("JackRequest::UnRegisterPort");
+                JackPortUnRegisterRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortUnRegister(req.fRefNum, req.fPortIndex);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kConnectNamePorts: {
+                jack_log("JackRequest::ConnectNamePorts");
+                JackPortConnectNameRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortConnect(req.fRefNum, req.fSrc, req.fDst);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kDisconnectNamePorts: {
+                jack_log("JackRequest::DisconnectNamePorts");
+                JackPortDisconnectNameRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortDisconnect(req.fRefNum, req.fSrc, req.fDst);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kConnectPorts: {
+                jack_log("JackRequest::ConnectPorts");
+                JackPortConnectRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortConnect(req.fRefNum, req.fSrc, req.fDst);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kDisconnectPorts: {
+                jack_log("JackRequest::DisconnectPorts");
+                JackPortDisconnectRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortDisconnect(req.fRefNum, req.fSrc, req.fDst);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kPortRename: {
+                jack_log("JackRequest::PortRename");
+                JackPortRenameRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->PortRename(req.fRefNum, req.fPort, req.fName);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kSetBufferSize: {
+                jack_log("JackRequest::SetBufferSize");
+                JackSetBufferSizeRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->SetBufferSize(req.fBufferSize);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kSetFreeWheel: {
+                jack_log("JackRequest::SetFreeWheel");
+                JackSetFreeWheelRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->SetFreewheel(req.fOnOff);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kReleaseTimebase: {
+                jack_log("JackRequest::ReleaseTimebase");
+                JackReleaseTimebaseRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->ReleaseTimebase(req.fRefNum);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kSetTimebaseCallback: {
+                jack_log("JackRequest::SetTimebaseCallback");
+                JackSetTimebaseCallbackRequest req;
+                JackResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->SetTimebaseCallback(req.fRefNum, req.fConditionnal);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kGetInternalClientName: {
+                jack_log("JackRequest::GetInternalClientName");
+                JackGetInternalClientNameRequest req;
+                JackGetInternalClientNameResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->GetInternalClientName(req.fIntRefNum, res.fName);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kInternalClientHandle: {
+                jack_log("JackRequest::InternalClientHandle");
+                JackInternalClientHandleRequest req;
+                JackInternalClientHandleResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->InternalClientHandle(req.fName, &res.fStatus, &res.fIntRefNum);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kInternalClientLoad: {
+                jack_log("JackRequest::InternalClientLoad");
+                JackInternalClientLoadRequest req;
+                JackInternalClientLoadResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, &res.fStatus);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kInternalClientUnload: {
+                jack_log("JackRequest::InternalClientUnload");
+                JackInternalClientUnloadRequest req;
+                JackInternalClientUnloadResult res;
+                if (req.Read(fPipe) == 0)
+                    res.fResult = fServer->GetEngine()->InternalClientUnload(req.fIntRefNum, &res.fStatus);
+                res.Write(fPipe);
+                break;
+            }
+
+            case JackRequest::kNotification: {
+                jack_log("JackRequest::Notification");
+                JackClientNotificationRequest req;
+                if (req.Read(fPipe) == 0) {
+                    if (req.fNotify == kQUIT) {
+                        jack_log("JackRequest::Notification kQUIT");
+                        throw JackQuitException();
+                    } else {
+                        fServer->Notify(req.fRefNum, req.fNotify, req.fValue);
+                    }
+                }
+                break;
+            }
+
+            default:
+                jack_log("Unknown request %ld", header.fType);
+                break;
+        }
+    }
+
+    // Unlock the global mutex
+    ReleaseMutex(fMutex);
+    return ret;
+}
+
+void JackClientPipeThread::ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
+{
+    jack_log("JackClientPipeThread::ClientAdd %s", name);
+    fRefNum = -1;
+    *result = fServer->GetEngine()->ClientExternalOpen(name, pid, &fRefNum, shared_engine, shared_client, shared_graph);
+}
+
+void JackClientPipeThread::ClientRemove()
+{
+    jack_log("JackClientPipeThread::ClientRemove ref = %d", fRefNum);
+    /* TODO : solve WIN32 thread Kill issue
+    Close();
+    */
+    fRefNum = -1;
+    fPipe->Close();
+}
+
+void JackClientPipeThread::ClientKill()
+{
+    jack_log("JackClientPipeThread::ClientKill ref = %d", fRefNum);
+
+    if (fRefNum == -1) {		// Correspond to an already removed client.
+        jack_log("Kill a closed client");
+    } else if (fRefNum == 0) {  // Correspond to a still not opened client.
+        jack_log("Kill a not opened client");
+    } else {
+        fServer->ClientKill(fRefNum);
+    }
+
+    Close();
+}
+
+JackWinNamedPipeServerChannel::JackWinNamedPipeServerChannel():fThread(this)
+{}
+
+JackWinNamedPipeServerChannel::~JackWinNamedPipeServerChannel()
+{
+    std::list<JackClientPipeThread*>::iterator it;
+
+    for (it = fClientList.begin(); it !=  fClientList.end(); it++) {
+        JackClientPipeThread* client = *it;
+        client->Close();
+        delete client;
+    }
+}
+
+int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* server)
+{
+    jack_log("JackWinNamedPipeServerChannel::Open ");
+    snprintf(fServerName, sizeof(fServerName), server_name);
+
+    // Needed for internal connection from JackWinNamedPipeServerNotifyChannel object
+    if (fRequestListenPipe.Bind(jack_server_dir, server_name, 0) < 0) {
+        jack_error("JackWinNamedPipeServerChannel::Open : cannot create result listen pipe");
+        return -1;
+    }
+
+    fServer = server;
+    return 0;
+}
+
+void JackWinNamedPipeServerChannel::Close()
+{
+    /* TODO : solve WIN32 thread Kill issue
+    	This would hang the server... since we are quitting it, its not really problematic,
+    	all ressources will be desallocated at the end.
+
+    	fRequestListenPipe.Close();
+        fThread.Stop();
+    */
+
+    fThread.Kill();
+    fRequestListenPipe.Close();
+}
+
+int JackWinNamedPipeServerChannel::Start()
+{
+    if (fThread.Start() != 0) {
+        jack_error("Cannot start Jack server listener");
+        return -1;
+    }
+
+    return 0;
+}
+
+bool JackWinNamedPipeServerChannel::Init()
+{
+    jack_log("JackWinNamedPipeServerChannel::Init ");
+    JackWinNamedPipeClient* pipe;
+
+    // Accept first client, that is the JackWinNamedPipeServerNotifyChannel object
+    if ((pipe = fRequestListenPipe.AcceptClient()) == NULL) {
+        jack_error("JackWinNamedPipeServerChannel::Init : cannot connect pipe");
+        return false;
+    } else {
+        ClientAdd(pipe);
+        return true;
+    }
+}
+
+bool JackWinNamedPipeServerChannel::Execute()
+{
+    JackWinNamedPipeClient* pipe;
+
+    if (fRequestListenPipe.Bind(jack_server_dir, fServerName, 0) < 0) {
+        jack_error("JackWinNamedPipeServerChannel::Open : cannot create result listen pipe");
+        return false;
+    }
+
+    if ((pipe = fRequestListenPipe.AcceptClient()) == NULL) {
+        jack_error("JackWinNamedPipeServerChannel::Open : cannot connect pipe");
+        return false;
+    }
+
+    ClientAdd(pipe);
+    return true;
+}
+
+void JackWinNamedPipeServerChannel::ClientAdd(JackWinNamedPipeClient* pipe)
+{
+    // Remove dead (= not running anymore) clients.
+    std::list<JackClientPipeThread*>::iterator it = fClientList.begin();
+    JackClientPipeThread* client;
+
+    jack_log("ClientAdd size  %ld", fClientList.size());
+
+    while (it != fClientList.end()) {
+        client = *it;
+        jack_log("Remove dead client = %x running =  %ld", client, client->IsRunning());
+        if (client->IsRunning()) {
+            it++;
+        } else {
+            it = fClientList.erase(it);
+            delete client;
+        }
+    }
+
+    client = new JackClientPipeThread(pipe);
+    client->Open(fServer);
+    // Here we are sure that the client is running (because it's thread is in "running" state).
+    fClientList.push_back(client);
+}
+
+} // end of namespace
+
+
diff --git a/windows/JackWinNamedPipeServerChannel.h b/windows/JackWinNamedPipeServerChannel.h
new file mode 100644
index 0000000..7404f04
--- /dev/null
+++ b/windows/JackWinNamedPipeServerChannel.h
@@ -0,0 +1,105 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackWinNamedPipeServerChannel__
+#define __JackWinNamedPipeServerChannel__
+
+#include "JackWinNamedPipe.h"
+#include "JackPlatformPlug.h"
+#include <list>
+
+namespace Jack
+{
+
+class JackServer;
+
+class JackClientPipeThread : public JackRunnableInterface
+{
+
+    private:
+
+        JackWinNamedPipeClient* fPipe;
+        JackServer*	fServer;
+        JackThread fThread;
+        int fRefNum;
+
+        void ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
+        void ClientRemove();
+        void ClientKill();
+
+        static HANDLE fMutex;
+
+    public:
+
+        JackClientPipeThread(JackWinNamedPipeClient* pipe);
+        virtual ~JackClientPipeThread();
+
+        int Open(JackServer* server);   // Open the Server/Client connection
+        void Close();                   // Close the Server/Client connection
+   
+        bool HandleRequest();
+
+        // JackRunnableInterface interface
+        bool Execute();
+
+        // To be used for find out if the object can be deleted
+        bool IsRunning()
+        {
+            return (fRefNum >= 0);
+        }
+};
+
+/*!
+\brief JackServerChannel using pipe.
+*/
+
+class JackWinNamedPipeServerChannel : public JackRunnableInterface
+{
+
+    private:
+
+        JackWinNamedPipeServer fRequestListenPipe;	// Pipe to create request socket for the client
+        JackServer*	fServer;
+        JackThread fThread;                         // Thread to execute the event loop
+        char fServerName[64];
+
+        std::list<JackClientPipeThread*> fClientList;
+
+        void ClientAdd(JackWinNamedPipeClient* pipe);
+
+    public:
+
+        JackWinNamedPipeServerChannel();
+        ~JackWinNamedPipeServerChannel();
+
+        int Open(const char* server_name, JackServer* server);  // Open the Server/Client connection
+        void Close();                                           // Close the Server/Client connection
+    
+        int Start();
+
+        // JackRunnableInterface interface
+        bool Init();
+        bool Execute();
+};
+
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinNamedPipeServerNotifyChannel.cpp b/windows/JackWinNamedPipeServerNotifyChannel.cpp
new file mode 100644
index 0000000..8036d81
--- /dev/null
+++ b/windows/JackWinNamedPipeServerNotifyChannel.cpp
@@ -0,0 +1,68 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinNamedPipeServerNotifyChannel.h"
+#include "JackError.h"
+#include "JackRequest.h"
+#include "JackConstants.h"
+#include "JackNotification.h"
+
+namespace Jack
+{
+
+int JackWinNamedPipeServerNotifyChannel::Open(const char* server_name)
+{
+    if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) {
+        jack_error("Cannot connect to server pipe");
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+void JackWinNamedPipeServerNotifyChannel::Close()
+{
+    fRequestPipe.Close();
+}
+
+/*
+The requirement is that the Notification from RT thread can be delivered... not sure using a pipe is adequate here...
+Can the write operation block?
+A non blocking write operation shoud be used : check if write can succeed, and ignore the notification otherwise
+(since its mainly used for XRun, ignoring a notification is OK, successive XRun will come...)
+*/
+void JackWinNamedPipeServerNotifyChannel::Notify(int refnum, int notify, int value)
+{
+    JackClientNotificationRequest req(refnum, notify, value);
+    if (req.Write(&fRequestPipe) < 0) {
+        jack_error("Could not write request ref = %d notify = %d", refnum, notify);
+    }
+}
+
+void JackWinNamedPipeServerNotifyChannel::NotifyQuit()
+{
+    JackClientNotificationRequest req(-1, kQUIT, 0);
+    if (req.Write(&fRequestPipe) < 0) {
+        jack_error("Could not write request ref = %d notify = %d", -1, kQUIT);
+    }
+}
+
+} // end of namespace
+
+
diff --git a/windows/JackWinNamedPipeServerNotifyChannel.h b/windows/JackWinNamedPipeServerNotifyChannel.h
new file mode 100644
index 0000000..be4d7ff
--- /dev/null
+++ b/windows/JackWinNamedPipeServerNotifyChannel.h
@@ -0,0 +1,54 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __JackWinNamedPipeServerNotifyChannel__
+#define __JackWinNamedPipeServerNotifyChannel__
+
+#include "JackChannel.h"
+#include "JackWinNamedPipe.h"
+
+namespace Jack
+{
+
+/*!
+\brief JackServerNotifyChannel using pipes.
+*/
+
+class JackWinNamedPipeServerNotifyChannel
+{
+    private:
+
+        JackWinNamedPipeClient fRequestPipe;
+
+    public:
+
+        JackWinNamedPipeServerNotifyChannel()
+        {}
+
+        int Open(const char* server_name);
+        void Close();
+
+        void Notify(int refnum, int notify, int value);
+        void NotifyQuit();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinProcessSync.cpp b/windows/JackWinProcessSync.cpp
new file mode 100644
index 0000000..56171fb
--- /dev/null
+++ b/windows/JackWinProcessSync.cpp
@@ -0,0 +1,125 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinProcessSync.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+void JackWinProcessSync::Signal()
+{
+    SetEvent(fEvent);
+}
+
+void JackWinProcessSync::LockedSignal()
+{
+    WaitForSingleObject(fMutex, INFINITE);
+    SetEvent(fEvent);
+    ReleaseMutex(fMutex);
+}
+
+void JackWinProcessSync::SignalAll()
+{
+    SetEvent(fEvent);
+}
+
+void JackWinProcessSync::LockedSignalAll()
+{
+    WaitForSingleObject(fMutex, INFINITE);
+    SetEvent(fEvent);
+    ReleaseMutex(fMutex);
+}
+
+void JackWinProcessSync::Wait()
+{
+    ReleaseMutex(fMutex);
+	WaitForSingleObject(fEvent, INFINITE);
+}
+
+void JackWinProcessSync::LockedWait()
+{
+    /* Does it make sense on Windows, use non-locked version for now... */
+	Wait();
+}
+
+bool JackWinProcessSync::TimedWait(long usec)
+{
+    ReleaseMutex(fMutex);
+	DWORD res = WaitForSingleObject(fEvent, usec / 1000);
+	return (res == WAIT_OBJECT_0);
+}
+
+bool JackWinProcessSync::LockedTimedWait(long usec)
+{
+    /* Does it make sense on Windows, use non-locked version for now...*/
+    return TimedWait(usec);
+}
+
+/*
+Code from CAGuard.cpp : does ot sees to work as expected..
+
+void JackWinProcessSync::Wait()
+{
+    ReleaseMutex(fMutex);
+	HANDLE handles[] = { fMutex, fEvent };
+	DWORD res = WaitForMultipleObjects(2, handles, true, INFINITE);
+	if ((res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT))
+        jack_error("Wait error err = %d", GetLastError());
+    ResetEvent(fEvent);
+}
+
+void JackWinProcessSync::LockedWait()
+{
+    WaitForSingleObject(fMutex, INFINITE);
+    ReleaseMutex(fMutex);
+	HANDLE handles[] = { fMutex, fEvent };
+	DWORD res = WaitForMultipleObjects(2, handles, true, INFINITE);
+	if ((res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT))
+        jack_error("LockedWait error err = %d", GetLastError());
+    ResetEvent(fEvent);
+}
+
+bool JackWinProcessSync::TimedWait(long usec)
+{
+  	ReleaseMutex(fMutex);
+	HANDLE handles[] = { fMutex, fEvent };
+	DWORD res = WaitForMultipleObjects(2, handles, true, usec / 1000);
+	if ((res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT))
+        jack_error("Wait error err = %d", GetLastError());
+    ResetEvent(fEvent);
+}
+
+bool JackWinProcessSync::LockedTimedWait(long usec)
+{
+    WaitForSingleObject(fMutex, INFINITE);
+    ReleaseMutex(fMutex);
+    HANDLE handles[] = { fMutex, fEvent };
+	DWORD res = WaitForMultipleObjects(2, handles, true, usec / 1000);
+    if ((res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT))
+        jack_error("LockedTimedWait error err = %d", GetLastError());
+    ResetEvent(fEvent);
+	return (res == WAIT_OBJECT_0);
+}
+*/
+
+} // end of namespace
+
+
+
diff --git a/windows/JackWinProcessSync.h b/windows/JackWinProcessSync.h
new file mode 100644
index 0000000..33a340c
--- /dev/null
+++ b/windows/JackWinProcessSync.h
@@ -0,0 +1,66 @@
+/*
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackWinProcessSync__
+#define __JackWinProcessSync__
+
+#include "JackWinMutex.h"
+
+namespace Jack
+{
+
+/*!
+\brief  A synchronization primitive built using a condition variable.
+*/
+
+class JackWinProcessSync : public JackWinMutex
+{
+
+    private:
+
+        HANDLE fEvent;
+
+    public:
+
+        JackWinProcessSync():JackWinMutex()
+        {
+            fEvent = (HANDLE)CreateEvent(NULL, FALSE, FALSE, NULL);
+        }
+        ~JackWinProcessSync()
+        {
+            CloseHandle(fEvent);
+        }
+        
+        bool TimedWait(long usec);
+        bool LockedTimedWait(long usec);
+        
+        void Wait();
+        void LockedWait();
+         
+        void Signal();
+        void LockedSignal();
+         
+        void SignalAll();
+        void LockedSignalAll();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinSemaphore.cpp b/windows/JackWinSemaphore.cpp
new file mode 100644
index 0000000..8ce52d6
--- /dev/null
+++ b/windows/JackWinSemaphore.cpp
@@ -0,0 +1,161 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinSemaphore.h"
+#include "JackConstants.h"
+#include "JackTools.h"
+#include "JackError.h"
+#include <stdio.h>
+
+namespace Jack
+{
+
+void JackWinSemaphore::BuildName(const char* client_name, const char* server_name, char* res)
+{
+    char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
+    JackTools::RewriteName(client_name, ext_client_name);
+    sprintf(res, "jack_pipe.%s_%s", server_name, ext_client_name);
+}
+
+bool JackWinSemaphore::Signal()
+{
+    BOOL res;
+    assert(fSemaphore);
+
+    if (fFlush)
+        return true;
+
+    if (!(res = ReleaseSemaphore(fSemaphore, 1, NULL))) {
+        jack_error("JackWinSemaphore::Signal name = %s err = %ld", fName, GetLastError());
+    }
+
+    return res;
+}
+
+bool JackWinSemaphore::SignalAll()
+{
+    BOOL res;
+    assert(fSemaphore);
+
+    if (fFlush)
+        return true;
+
+    if (!(res = ReleaseSemaphore(fSemaphore, 1, NULL))) {
+        jack_error("JackWinSemaphore::SignalAll name = %s err = %ld", fName, GetLastError());
+    }
+
+    return res;
+}
+
+bool JackWinSemaphore::Wait()
+{
+    DWORD res;
+
+    if ((res = WaitForSingleObject(fSemaphore, INFINITE)) == WAIT_TIMEOUT) {
+        jack_error("JackWinSemaphore::TimedWait name = %s time_out", fName);
+    }
+
+    return (res == WAIT_OBJECT_0);
+}
+
+bool JackWinSemaphore::TimedWait(long usec)
+{
+    DWORD res;
+
+    if ((res = WaitForSingleObject(fSemaphore, usec / 1000)) == WAIT_TIMEOUT) {
+        jack_error("JackWinSemaphore::TimedWait name = %s time_out", fName);
+    }
+
+    return (res == WAIT_OBJECT_0);
+}
+
+// Client side : get the published semaphore from server
+bool JackWinSemaphore::ConnectInput(const char* name, const char* server_name)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackWinSemaphore::Connect %s", fName);
+
+    // Temporary...
+    if (fSemaphore) {
+        jack_log("Already connected name = %s", name);
+        return true;
+    }
+
+    if ((fSemaphore = OpenSemaphore(SEMAPHORE_ALL_ACCESS , FALSE, fName)) == NULL) {
+        jack_error("Connect: can't check in named event name = %s err = %ld", fName, GetLastError());
+        return false;
+    } else {
+        return true;
+    }
+}
+
+bool JackWinSemaphore::Connect(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackWinSemaphore::ConnectOutput(const char* name, const char* server_name)
+{
+    return ConnectInput(name, server_name);
+}
+
+bool JackWinSemaphore::Disconnect()
+{
+    if (fSemaphore) {
+        jack_log("JackWinSemaphore::Disconnect %s", fName);
+        CloseHandle(fSemaphore);
+        fSemaphore = NULL;
+        return true;
+    } else {
+        return false;
+    }
+}
+
+bool JackWinSemaphore::Allocate(const char* name, const char* server_name, int value)
+{
+    BuildName(name, server_name, fName);
+    jack_log("JackWinSemaphore::Allocate name = %s val = %ld", fName, value);
+
+    if ((fSemaphore = CreateSemaphore(NULL, value, 32767, fName)) == NULL) {
+        jack_error("Allocate: can't check in named semaphore name = %s err = %ld", fName, GetLastError());
+        return false;
+    } else if (GetLastError() == ERROR_ALREADY_EXISTS) {
+        jack_error("Allocate: named semaphore already exist name = %s", fName);
+        // Try to open it 
+        fSemaphore = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, fName);
+        return (fSemaphore != NULL);
+    } else {
+        return true;
+    }
+}
+
+void JackWinSemaphore::Destroy()
+{
+    if (fSemaphore != NULL) {
+        jack_log("JackWinSemaphore::Destroy %s", fName);
+        CloseHandle(fSemaphore);
+        fSemaphore = NULL;
+    } else {
+        jack_error("JackWinSemaphore::Destroy synchro == NULL");
+    }
+}
+
+
+} // end of namespace
+
diff --git a/windows/JackWinSemaphore.h b/windows/JackWinSemaphore.h
new file mode 100644
index 0000000..d4330e5
--- /dev/null
+++ b/windows/JackWinSemaphore.h
@@ -0,0 +1,66 @@
+/*
+Copyright (C) 2004-2005 Grame
+
+This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackWinSemaphore__
+#define __JackWinSemaphore__
+
+#include "JackSynchro.h"
+#include <windows.h>
+#include <assert.h>
+
+namespace Jack
+{
+
+/*!
+\brief Inter process synchronization using system wide semaphore.
+*/
+
+class JackWinSemaphore : public detail::JackSynchro
+{
+
+    private:
+
+        HANDLE fSemaphore;
+
+    protected:
+
+        void BuildName(const char* name, const char* server_name, char* res);
+
+    public:
+
+        JackWinSemaphore():JackSynchro(), fSemaphore(NULL)
+        {}
+
+        bool Signal();
+        bool SignalAll();
+        bool Wait();
+        bool TimedWait(long usec);
+
+        bool Allocate(const char* name, const char* server_name, int value);
+        bool Connect(const char* name, const char* server_name);
+        bool ConnectInput(const char* name, const char* server_name);
+        bool ConnectOutput(const char* name, const char* server_name);
+        bool Disconnect();
+        void Destroy();
+};
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinServerLaunch.cpp b/windows/JackWinServerLaunch.cpp
new file mode 100644
index 0000000..895c9bd
--- /dev/null
+++ b/windows/JackWinServerLaunch.cpp
@@ -0,0 +1,26 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackServerLaunch.h"
+
+int try_start_server(jack_varargs_t* va, jack_options_t options, jack_status_t* status)
+{
+    return 0;
+}
diff --git a/windows/JackWinThread.cpp b/windows/JackWinThread.cpp
new file mode 100644
index 0000000..3893d22
--- /dev/null
+++ b/windows/JackWinThread.cpp
@@ -0,0 +1,297 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinThread.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include <assert.h>
+
+namespace Jack
+{
+
+DWORD WINAPI JackWinThread::ThreadHandler(void* arg)
+{
+    JackWinThread* obj = (JackWinThread*)arg;
+    JackRunnableInterface* runnable = obj->fRunnable;
+   
+    // Signal creation thread when started with StartSync
+    jack_log("ThreadHandler: start");
+    obj->fStatus = kIniting;
+    
+    // Call Init method
+    if (!runnable->Init()) {
+        jack_error("Thread init fails: thread quits");
+        return 0;
+    }
+    
+    obj->fStatus = kRunning;
+    
+    // If Init succeed, start the thread loop
+    bool res = true;
+    while (obj->fStatus == kRunning && res) {
+        res = runnable->Execute();
+    }
+
+    SetEvent(obj->fEvent);
+    jack_log("ThreadHandler: exit");
+    return 0;
+}
+
+JackWinThread::JackWinThread(JackRunnableInterface* runnable)
+        : JackThreadInterface(runnable, 0, false, 0)
+{
+    fEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    fThread = (HANDLE)NULL;
+    assert(fEvent);
+}
+
+JackWinThread::~JackWinThread()
+{
+    CloseHandle(fEvent);
+    CloseHandle(fThread);
+}
+
+int JackWinThread::Start()
+{
+    fStatus = kStarting;
+
+    // Check if the thread was correctly started
+    if (StartImp(&fThread, fPriority, fRealTime, ThreadHandler, this) < 0) {
+        fStatus = kIdle;
+        return -1;
+    } else {
+        return 0;
+    }
+}
+    
+int JackWinThread::StartSync()
+{
+    fStatus = kStarting;
+    
+    if (StartImp(&fThread, fPriority, fRealTime, ThreadHandler, this) < 0) {
+        fStatus = kIdle;
+        return -1;
+    } else {
+        int count = 0;
+        while (fStatus == kStarting && ++count < 1000) {
+            JackSleep(1000);
+        }
+        return (count == 1000) ? -1 : 0;
+    }
+}
+
+int JackWinThread::StartImp(pthread_t* thread, int priority, int realtime, ThreadCallback start_routine, void* arg)
+{
+    DWORD id;
+    *thread = CreateThread(NULL, 0, start_routine, arg, 0, &id);
+
+    if (*thread == NULL) {
+        jack_error("Cannot create thread error = %d", GetLastError());
+        return -1;
+    }
+
+    if (realtime) {
+        
+        jack_log("Create RT thread");
+        if (!SetThreadPriority(*thread, THREAD_PRIORITY_TIME_CRITICAL)) {
+            jack_error("Cannot set priority class = %d", GetLastError());
+            return -1;
+        }
+
+    } else {
+        jack_log("Create non RT thread");
+    }
+    
+    return 0;
+}
+
+// voir http://www.microsoft.com/belux/msdn/nl/community/columns/ldoc/multithread1.mspx
+
+int JackWinThread::Kill()
+{
+    if (fThread != (HANDLE)NULL) { // If thread has been started
+        TerminateThread(fThread, 0);
+        WaitForSingleObject(fThread, INFINITE);
+        CloseHandle(fThread);
+        jack_log("JackWinThread::Kill");
+        fThread = (HANDLE)NULL;
+        fStatus = kIdle;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackWinThread::Stop()
+{
+    if (fThread != (HANDLE)NULL) { // If thread has been started
+        jack_log("JackWinThread::Stop");
+        fStatus = kIdle; // Request for the thread to stop
+        WaitForSingleObject(fEvent, INFINITE);
+        CloseHandle(fThread);
+        fThread = (HANDLE)NULL;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackWinThread::KillImp(pthread_t thread)
+{
+    if (thread != (HANDLE)NULL) { // If thread has been started
+        TerminateThread(thread, 0);
+        WaitForSingleObject(thread, INFINITE);
+        CloseHandle(thread);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackWinThread::StopImp(pthread_t thread)
+{
+    if (thread) { // If thread has been started
+        WaitForSingleObject(thread, INFINITE);
+        CloseHandle(thread);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+int JackWinThread::AcquireRealTime()
+{
+    return (fThread != (HANDLE)NULL) ? AcquireRealTimeImp(fThread, fPriority) : -1;
+}
+
+int JackWinThread::AcquireSelfRealTime()
+{
+    return AcquireRealTimeImp(GetCurrentThread(), fPriority);
+}
+
+int JackWinThread::AcquireRealTime(int priority)
+{
+    fPriority = priority;
+    return AcquireRealTime();
+}
+
+int JackWinThread::AcquireSelfRealTime(int priority)
+{
+    fPriority = priority;
+    return AcquireSelfRealTime();
+}
+
+int JackWinThread::AcquireRealTimeImp(pthread_t thread, int priority)
+{
+    jack_log("JackWinThread::AcquireRealTime");
+
+    if (SetThreadPriority(thread, THREAD_PRIORITY_TIME_CRITICAL)) {
+        return 0;
+    } else {
+        jack_error("Cannot set thread priority = %d", GetLastError());
+        return -1;
+    }
+}
+
+int JackWinThread::DropRealTime()
+{
+    return (fThread != (HANDLE)NULL) ? DropRealTimeImp(fThread) : -1;
+}
+
+int JackWinThread::DropSelfRealTime()
+{
+    return DropRealTimeImp(GetCurrentThread());
+}
+
+int JackWinThread::DropRealTimeImp(pthread_t thread)
+{
+    if (SetThreadPriority(thread, THREAD_PRIORITY_NORMAL)) {
+        return 0;
+    } else {
+        jack_error("Cannot set thread priority = %d", GetLastError());
+        return -1;
+    }
+}
+
+pthread_t JackWinThread::GetThreadID()
+{
+    return fThread;
+}
+
+void JackWinThread::Terminate()
+{
+    jack_log("JackWinThread::Terminate");
+    ExitThread(0);
+}
+
+SERVER_EXPORT void ThreadExit()
+{
+    jack_log("ThreadExit");
+    ExitThread(0);
+}
+
+} // end of namespace
+
+bool jack_get_thread_realtime_priority_range(int * min_ptr, int * max_ptr)
+{
+    return false;
+}
+
+bool jack_tls_allocate_key(jack_tls_key *key_ptr)
+{
+    DWORD key;
+    
+    key = TlsAlloc();
+    if (key == TLS_OUT_OF_INDEXES)
+    {
+        jack_error("TlsAlloc() failed. Error is %d", (unsigned int)GetLastError());
+        return false;
+    }
+    
+    *key_ptr = key;
+    return true;
+}
+
+bool jack_tls_free_key(jack_tls_key key)
+{
+    if (!TlsFree(key))
+    {
+        jack_error("TlsFree() failed. Error is %d", (unsigned int)GetLastError());
+        return false;
+    }
+    
+    return true;
+}
+
+bool jack_tls_set(jack_tls_key key, void *data_ptr)
+{
+    if (!TlsSetValue(key, data_ptr))
+    {
+        jack_error("TlsSetValue() failed. Error is %d", (unsigned int)GetLastError());
+        return false;
+    }
+    
+    return true;
+}
+
+void *jack_tls_get(jack_tls_key key)
+{
+    return TlsGetValue(key);
+}
diff --git a/windows/JackWinThread.h b/windows/JackWinThread.h
new file mode 100644
index 0000000..a3a5a25
--- /dev/null
+++ b/windows/JackWinThread.h
@@ -0,0 +1,92 @@
+/*
+Copyright (C) 2001 Paul Davis
+Copyright (C) 2004-2006 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+
+#ifndef __JackWinThread__
+#define __JackWinThread__
+
+#include "JackThread.h"
+#include "JackCompilerDeps.h"
+#include "JackSystemDeps.h"
+#include <windows.h>
+
+namespace Jack
+{
+
+typedef DWORD (WINAPI *ThreadCallback)(void *arg);
+
+/*!
+\brief Windows threads.
+*/
+
+class SERVER_EXPORT JackWinThread : public detail::JackThreadInterface
+{
+
+    private:
+
+        HANDLE fThread;
+        HANDLE fEvent;
+
+        static DWORD WINAPI ThreadHandler(void* arg);
+
+    public:
+
+        JackWinThread(JackRunnableInterface* runnable);
+        ~JackWinThread();
+
+        int Start();
+        int StartSync();
+        int Kill();
+        int Stop();
+        void Terminate();
+
+        int AcquireRealTime();                  // Used when called from another thread
+        int AcquireSelfRealTime();              // Used when called from thread itself
+        
+        int AcquireRealTime(int priority);      // Used when called from another thread
+        int AcquireSelfRealTime(int priority);  // Used when called from thread itself
+        
+        int DropRealTime();                     // Used when called from another thread
+        int DropSelfRealTime();                 // Used when called from thread itself
+   
+        pthread_t GetThreadID();
+
+        static int AcquireRealTimeImp(pthread_t thread, int priority);
+        static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
+        { 
+            return JackWinThread::AcquireRealTimeImp(thread, priority); 
+        }
+        static int DropRealTimeImp(pthread_t thread);
+        static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg)
+        { 
+            return JackWinThread::StartImp(thread, priority, realtime, (ThreadCallback) start_routine, arg); 
+        }
+        static int StartImp(pthread_t* thread, int priority, int realtime, ThreadCallback start_routine, void* arg);
+        static int StopImp(pthread_t thread);
+        static int KillImp(pthread_t thread);
+
+};
+
+SERVER_EXPORT void ThreadExit();
+
+} // end of namespace
+
+#endif
+
diff --git a/windows/JackWinTime.c b/windows/JackWinTime.c
new file mode 100644
index 0000000..bd95080
--- /dev/null
+++ b/windows/JackWinTime.c
@@ -0,0 +1,48 @@
+/*
+Copyright (C) 2001-2003 Paul Davis
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "JackTime.h"
+
+static LARGE_INTEGER _jack_freq;
+
+SERVER_EXPORT void JackSleep(long usec)
+{
+	Sleep(usec / 1000);
+}
+
+SERVER_EXPORT void InitTime()
+{
+	QueryPerformanceFrequency(&_jack_freq);
+}
+
+SERVER_EXPORT jack_time_t GetMicroSeconds(void)
+{
+	LARGE_INTEGER t1;
+	QueryPerformanceCounter(&t1);
+	return (jack_time_t)(((double)t1.QuadPart) / ((double)_jack_freq.QuadPart) * 1000000.0);
+}
+
+SERVER_EXPORT void SetClockSource(jack_timer_type_t source)
+{}
+
+SERVER_EXPORT const char* ClockSourceName(jack_timer_type_t source)
+{
+    return "";
+}
diff --git a/windows/README b/windows/README
new file mode 100644
index 0000000..f7cbebb
--- /dev/null
+++ b/windows/README
@@ -0,0 +1,58 @@
+-------------------------------
+Jackmp on Windows
+-------------------------------
+
+This folder contains all the windows specific sources.
+You will also find two sets of files :
+- VisualC++6 workspace and project files, in order to compile Jack with MSVC
+- Code::Blocks (8.02) workspace and project files, in order to compile Jack with MingW
+
+The built binaries will be located in '/Release/bin' (or '/Debug/bin' if you build the Debug target). Once compiled, you'll find there everything you need :
+- the two 'libjackmp.dll' and 'libjackservermp.dll', client and server jack libraries
+- the 'jackdmp.exe', main application : the jack server
+- the 'jack_xxx.exe' utilities and examples
+- in the jackmp directory, you'll find the driver's DLL's ('jack_portaudio.dll' and 'jack_netdriver.dll') and some tools ( 'netmanager.dll', 'audioadapter.dll', 'netadapter.dll' for example )
+
+In Code::Blocks all the projects are automatically built in a correct order (dll's then apps) by doing 'build->build workspace'.
+In VC6, you'll have to build the projects one by one.
+
+-------------------------------
+Notes about VC and GCC versions
+-------------------------------
+
+The Visual Studio workspace is limited to VC6. Jack will not compile on most recent MSVC's. The fact is recent compilers (MSVC7, 8 or 9) don't agree with some of the Jack sources.
+But now you can compile Jack using GCC, with MingW.
+The project is actually organized in a Code::Blocks workspace. This is a simple and efficient way to compile the whole project.
+
+But for some reasons, you need to compile Jack using a SJLJ version of G++ (available on MingW website).
+Current GCC/G++ version (3.4.5) doesn't includes SJLJ so you'll have to use another one.
+Jack needs the use of SJLJ exceptions instead of DW2 because exceptions are exchanged between DLL's, and DW2 does not allow to throw an exception out of a DLL, so it wouldn't be cought.
+
+The ressources files has been created with ResEdit (ANSI build). VisualStudio uses 'ressource.rc' and 'ressource_vc.h'. The other files are used by MingW.
+
+You can make a small installer ('setup.exe') with CreateInstallFree, a little freeware. For this you have the little script 'jack.ci'.The installer contains everything jack needs to be intagreted in windows (including register entries and shortcuts).
+A binary version of qjackctl is also included.
+
+-------------------------------
+Running Jack on Windows
+-------------------------------
+
+You can use two drivers : PortAudio and NetDriver.
+The PortAudio backend allow the use of many soundcards, using ASIO, DirectSound or WMME drivers (any ASIO driver can be seen by PortAudio).
+The NetDriver allow you to use NetJack2 on windows. Thus you can easily exchange midi and audio streams bitween computers (Linux, MacOSX or Windows).
+In both cases, you have to use the minimalist :
+    'jackd -R -d ...'
+        command. With PortAudio, you can have a list of supported drivers with :
+    'jackd -R -S -d portaudio -l'
+
+Other options still stay the same.
+You can also pick a binary of Qjackctl, but this is still in development.
+
+-------------------------------
+Running Jack on windows
+-------------------------------
+
+More information at : 'http://www.grame.fr/~letz/jackdmp.html'.
+
+For any question or suggestion, you can refer to the mailing list 'jack-devel at jackaudio.org'
+Enjoy Jack on windows... ;-)
diff --git a/windows/Release/bin/libsamplerate-0.dll b/windows/Release/bin/libsamplerate-0.dll
new file mode 100644
index 0000000..ceadc59
Binary files /dev/null and b/windows/Release/bin/libsamplerate-0.dll differ
diff --git a/windows/Release/bin/portaudio_x86.dll b/windows/Release/bin/portaudio_x86.dll
new file mode 100644
index 0000000..ec08374
Binary files /dev/null and b/windows/Release/bin/portaudio_x86.dll differ
diff --git a/windows/Setup/JackRouter.dll b/windows/Setup/JackRouter.dll
new file mode 100644
index 0000000..d74a292
Binary files /dev/null and b/windows/Setup/JackRouter.dll differ
diff --git a/windows/Setup/JackRouter.ini b/windows/Setup/JackRouter.ini
new file mode 100644
index 0000000..8a62b6a
--- /dev/null
+++ b/windows/Setup/JackRouter.ini
@@ -0,0 +1,7 @@
+[IO]
+input=4
+output=4
+
+[AUTO_CONNECT]
+input=1
+output=1
diff --git a/windows/Setup/README b/windows/Setup/README
new file mode 100644
index 0000000..78588ec
--- /dev/null
+++ b/windows/Setup/README
@@ -0,0 +1,17 @@
+This folder contains a script to create an installer for windows.
+It uses 'CreateInstall Free'(http://www.createinstall.com), a little software allowing to make simple installers.
+
+You can use the 'jack.ci' script to make the installer. For that, you need to build the Code::Blocks workspace in order to have '.exe' and libraries. 
+You also need 'qjackctl' binaries and libraries ('qjackctl.exe', 'mingwm10.dll', 'QtCore4.dll', 'QtGui.dll' and 'QtXml4.dll'). 
+You can recompile qjackctl with qt4 or directly get the binaries. The five files are expected in the 'qjackctl' folder.
+
+You also need the Microsoft Visual C++ 2008 Redistributable Package (x86) (the vcrdist_x86.exe file) to be in src folder.
+
+If you need libjack.lib and libjackserver.lib to link with in MS Visual Studio, you can use the MS Tool lib.exe to create the .lib file from de .def.
+Just use : 'lib /DEF:libjackserver.def /OUT:libjackserver.lib' and 'lib /DEF:libjack.def /OUT:libjack.lib' to create the lib file.
+Or you can also use dlltool, from mingw suite :
+Just use : 'dlltool -l libjackserver.lib -D libjackserver.dll -d libjackserver.def' and 'dlltool -l libjack.lib -D libjack.dll -d libjack.def'
+
+Once all binaries are available, just execute the script in 'CreateInstall' to make 'setup.exe'.
+The setup will copy all binaries to a specified folder, register the JackRouter (in order to have it in the ASIO drivers list) and create some shortcuts in the start menu.
+It's a good and proper way to get jack installed on windows.
\ No newline at end of file
diff --git a/windows/Setup/jack.ci b/windows/Setup/jack.ci
new file mode 100644
index 0000000..2523339
--- /dev/null
+++ b/windows/Setup/jack.ci
@@ -0,0 +1,140 @@
+<*project
+      version = 4 civer = "Free v4.14.5" winver = "2.6/5.1.2600" > 
+   <output> .</>
+   <exename> Jack_v1.9.5_setup.exe</>
+   <digitsign> </>
+   <appname> Jack v1.9.5</>
+   <password> </>
+   <addlang> </>
+   <icon> Default - 2</>
+   <selfextr> 1</>
+   <voltype> nolimit</>
+   <volsize> </>
+   <volpattern> disk%i.pak</>
+   <load> </>
+   <loadtime> 1000</>
+   <checktype> admin</>
+   <chkname> </>
+   <chkmsg> </>
+   <dlgfont> Verdana,8</>
+   <lang> English</>
+   <theme> Green</>
+   <iface> leftlogo</>
+   <leftlogo> .\src\logo_installer.bmp</>
+   <logo> </>
+   <vb> </>
+   <dao> </>
+   <background> 0</>
+   <dlgwelcome> 1</>
+   <dlgreadme> .\src\README</>
+   <dlglic> .\src\gpl_installer.rtf</>
+   <dlgcustpath> </>
+   <dlgenfpath> 0</>
+   <dlgsavepath> 1</>
+   <dlgautoprog> 1</>
+   <dlgfinish> 1</>
+   <comptype> defnorm</>
+   <solid> 0</>
+   <srcfolder> </>
+   <ifexist> over</>
+   <runafter> </>
+   <runconfirm> 1</>
+   <uninclude> 1</>
+   <unicon> Uninstall - 2</>
+   <unshortcut> 1</>
+   <unrun> </>
+   <silent> 0</>
+   <unfeed> </>
+   <unautoclose> 1</>
+   <unfinish> 1</>
+   <bl> My Demo</>
+   <blurl> </>
+   <bghead> </>
+   <bgfoot> </> 
+   <bgback> </>
+   <files listview >
+      <_><src>..\Release\bin\libjack.a</><dest>inst</><custom>lib</><ifexist>overnewer</><recurs>0</></>
+<_><src>.\src\vcredist_x86.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjack.lib</><dest>inst</><custom>lib</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjack.def</><dest>inst</><custom>lib</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjackserver.a</><dest>inst</><custom>lib</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjackserver.lib</><dest>inst</><custom>lib</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjackserver.def</><dest>inst</><custom>lib</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_connect.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_disconnect.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_load.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_lsp.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_metro.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_unload.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jackd.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjack.dll</><dest>sys</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libjackserver.dll</><dest>sys</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\libsamplerate-0.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\portaudio_x86.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\jack_net.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\jack_netone.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack_netsource.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\jack_dummy.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\jack_loopback.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\jack_winmme.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\jack_portaudio.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\netmanager.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\audioadapter.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\Release\bin\jack\netadapter.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\control.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\intclient.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\jack.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\jslist.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\midiport.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\ringbuffer.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\statistics.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\thread.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\transport.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\types.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
+<_><src>..\..\common\jack\systemdeps.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>1</></>
+<_><src>.\JackRouter.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\JackRouter.ini</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\qjackctl\mingwm10.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\qjackctl\qjackctl.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\qjackctl\QtCore4.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\qjackctl\QtGui4.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\qjackctl\QtXml4.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\src\COPYING</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+<_><src>.\src\README</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
+
+   </files>
+   <runx listview >
+      <_><type>app</><path>inst</><file>vcredist_x86.exe</><cmdline></><wait>1</><workdir>inst</><custdir></><when>end</></>
+
+   </runx>
+   <registry listview >
+      
+   </registry>
+   <shcut listview >
+      <_><shpath>prog</><shname>Jack NetDriver</><tarpath>inst</><tarname>jackd.exe</><cmdline>-R -S -d net</><workpath>inst</><workcust></><icon></></>
+<_><shpath>prog</><shname>Jack Portaudio</><tarpath>inst</><tarname>jackd.exe</><cmdline>-R -S -d portaudio</><workpath>inst</><workcust></><icon></></>
+<_><shpath>prog</><shname>Jack Control</><tarpath>inst</><tarname>qjackctl.exe</><cmdline></><workpath>inst</><workcust></><icon>jackdmp.exe</></>
+<_><shpath>prog</><shname>Jack Command</><tarpath>sys</><tarname>cmd.exe</><cmdline></><workpath>inst</><workcust></><icon></></>
+
+   </shcut>
+   <ini listview >
+      
+   </ini>
+   <copy listview >
+      
+   </copy>
+   <activex listview >
+      <_><path>inst</><name>JackRouter.dll</></>
+
+   </activex>
+   <font listview >
+      
+   </font>
+   <ext listview >
+      
+   </ext>
+   <mreg listview >
+      
+   </mreg>
+   <macros> Pathadd=</>
+</project>
\ No newline at end of file
diff --git a/windows/Setup/src/COPYING b/windows/Setup/src/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/windows/Setup/src/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/windows/Setup/src/README b/windows/Setup/src/README
new file mode 100644
index 0000000..a33ec51
--- /dev/null
+++ b/windows/Setup/src/README
@@ -0,0 +1,68 @@
+=============================================
+JACK on Windows
+=============================================
+
+This installer will install everything to use Jack Audio Connection Kit (JACK) (www.jackaudio.org) on Windows.
+
+
+=============================================
+QJACKCTL on Windows
+=============================================
+
+This is a latest version of Rui Nuno Capela QJACKCTL application (http://qjackctl.sourceforge.net/) compiled on Windows. 
+It is compiled from the latest CVS version which is using QT4 framework. To uses it:
+
+- start qjackctl.exe and configure it the following way:
+
+	- in Setup/Setting, use "jackd -S" at the "Server Path" item. WARNING: on Windows the "-S" parameter is *mandatory* to have the jack server correctly working!!
+
+	- in Setup/Setting, use "portaudio" at the "Driver" item
+
+	- in Setup/Misc, check the "Start JACK audio server at application startup" box
+
+- quit QJACKCTL and start is again, it should now launch the jack server. Quitting QJACKCTL will now close the jack server.
+
+Starting the jack server with another audio device installed on the machine (like an ASIO card) can now be done directly in QJACKCTL. 
+A ">" button at the right of the interface button allows to list the name of all available devices, driven either by "MME", "DirectSound", or "ASIO".
+Alternatively using the following command allows to display the names of available devices:
+
+- jackd -d portaudio -l to display the entire list of available audio devices. (jackd -d portaudio -h will display all portaudio driver features)
+
+Then start jackd with the device you want, by using its name, for example:
+
+- jackd -R -S -d portaudio -d "ASIO::MOTU Audio ASIO", then start QJACKCTL. QJACKCTL will see the jackd server already running and then can be used normally.
+
+
+=============================================
+Jack MIDI
+=============================================
+
+A first version of a JACK MIDI <==> Windows MIDI bridge (using Windows MME API) is available. 
+If can be activated using the -X parameter in jackd command line. So add "-X winmme" in QJACKCTL settings (something like "jackd -S -X winmme"). 
+The WinMME driver will scan MIDI input/output ports, open corresponding JACK MIDI ports and convert MIDI in/out into JACK MIDI messages. 
+QJACKCTL MIDI connection windows can then be used.
+
+
+=============================================
+JackRouter JACK/ASIO driver
+=============================================
+
+JackRouter is an ASIO driver that allows any ASIO compatible application to become a JACK client, thus exchange audio with any other "native" or "Jackified" application. This driver is registered in the system by the installer and becomes available in the list of ASIO drivers when the JACK server is running. A "JackRouter.ini" configuration file allows the application to configure how the JackRouter driver behaves.
+
+	- [IO]: the application can obtain any number if JACK input/output ports (not necessarily equal to the audio card input/output number). [Note that some applications force their input/output channel number].
+
+	- [AUTO_CONNECT] : when 1, the application JACK port will automatically be connected to the machine input/output JACK ports.
+
+
+=============================================
+Known problems
+=============================================
+
+- starting/stopping the server several times in QJACKCTL may not work correctly. You may have to quit QJACKCTL and launch it again.
+
+
+=============================================
+Grame : Computer Music Research Laboratory
+Web : http://www.grame.fr/Research
+E-mail : letz at grame.fr
+=============================================
\ No newline at end of file
diff --git a/windows/Setup/src/gpl_installer.rtf b/windows/Setup/src/gpl_installer.rtf
new file mode 100644
index 0000000..cc8bcb4
Binary files /dev/null and b/windows/Setup/src/gpl_installer.rtf differ
diff --git a/windows/Setup/src/jack.ico b/windows/Setup/src/jack.ico
new file mode 100644
index 0000000..905c8be
Binary files /dev/null and b/windows/Setup/src/jack.ico differ
diff --git a/windows/Setup/src/logo_installer.bmp b/windows/Setup/src/logo_installer.bmp
new file mode 100644
index 0000000..f3a1843
Binary files /dev/null and b/windows/Setup/src/logo_installer.bmp differ
diff --git a/windows/getopt.c b/windows/getopt.c
new file mode 100644
index 0000000..ca5cb5c
--- /dev/null
+++ b/windows/getopt.c
@@ -0,0 +1,1047 @@
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to drepper at gnu.org
+   before changing it!
+
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
+   	Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+   Ditto for AIX 3.2 and <stdlib.h>.  */
+#ifndef _NO_PROTO
+# define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+# ifndef const
+#  define const
+# endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+# include <gnu-versions.h>
+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#  define ELIDE_CODE
+# endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef	__GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+# include <stdlib.h>
+# include <unistd.h>
+#endif	/* GNU C library.  */
+
+#ifdef VMS
+# include <unixlib.h>
+# if HAVE_STRING_H - 0
+#  include <string.h>
+# endif
+#endif
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.
+   When compiling libc, the _ macro is predefined.  */
+# ifdef HAVE_LIBINTL_H
+#  include <libintl.h>
+#  define _(msgid)	gettext (msgid)
+# else
+#  define _(msgid)	(msgid)
+# endif
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+   causes problems with re-calling getopt as programs generally don't
+   know that. */
+
+int __getopt_initialized;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable.  */
+static char *posixly_correct;
+
+#ifdef	__GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+# include <string.h>
+# define my_index	strchr
+#else
+
+#include <string.h>
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+#ifndef getenv
+extern char *getenv ();
+#endif
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+	return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.  */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+   That was relevant to code that was here before.  */
+# if (!defined __STDC__ || !__STDC__) && !defined strlen
+/* gcc with -traditional declares the built-in strlen to return int,
+   and has done so at least since version 2.4.5. -- rms.  */
+extern int strlen (const char *);
+# endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+
+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+#ifdef _LIBC
+/* Bash 2.0 gives us an environment variable containing flags
+   indicating ARGV elements that should not be considered arguments.  */
+
+/* Defined in getopt_init.c  */
+extern char *__getopt_nonoption_flags;
+
+static int nonoption_flags_max_len;
+static int nonoption_flags_len;
+
+static int original_argc;
+static char *const *original_argv;
+
+/* Make sure the environment variable bash 2.0 puts in the environment
+   is valid for the getopt call we must make sure that the ARGV passed
+   to getopt is that one passed to the process.  */
+static void
+__attribute__ ((unused))
+store_args_and_env (int argc, char *const *argv)
+{
+  /* XXX This is no good solution.  We should rather copy the args so
+     that we can compare them later.  But we must not use malloc(3).  */
+  original_argc = argc;
+  original_argv = argv;
+}
+# ifdef text_set_element
+text_set_element (__libc_subinit, store_args_and_env);
+# endif /* text_set_element */
+
+# define SWAP_FLAGS(ch1, ch2) \
+  if (nonoption_flags_len > 0)						      \
+    {									      \
+      char __tmp = __getopt_nonoption_flags[ch1];			      \
+      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];	      \
+      __getopt_nonoption_flags[ch2] = __tmp;				      \
+    }
+#else	/* !_LIBC */
+# define SWAP_FLAGS(ch1, ch2)
+#endif	/* _LIBC */
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+#if defined __STDC__ && __STDC__
+static void exchange (char **);
+#endif
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+#ifdef _LIBC
+  /* First make sure the handling of the `__getopt_nonoption_flags'
+     string can work normally.  Our top argument must be in the range
+     of the string.  */
+  if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
+    {
+      /* We must extend the array.  The user plays games with us and
+	 presents new arguments.  */
+      char *new_str = malloc (top + 1);
+      if (new_str == NULL)
+	nonoption_flags_len = nonoption_flags_max_len = 0;
+      else
+	{
+	  memset (__mempcpy (new_str, __getopt_nonoption_flags,
+			     nonoption_flags_max_len),
+		  '\0', top + 1 - nonoption_flags_max_len);
+	  nonoption_flags_max_len = top + 1;
+	  __getopt_nonoption_flags = new_str;
+	}
+    }
+#endif
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+	{
+	  /* Bottom segment is the short one.  */
+	  int len = middle - bottom;
+	  register int i;
+
+	  /* Swap it with the top part of the top segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[top - (middle - bottom) + i];
+	      argv[top - (middle - bottom) + i] = tem;
+	      SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+	    }
+	  /* Exclude the moved bottom segment from further swapping.  */
+	  top -= len;
+	}
+      else
+	{
+	  /* Top segment is the short one.  */
+	  int len = top - middle;
+	  register int i;
+
+	  /* Swap it with the bottom part of the bottom segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[middle + i];
+	      argv[middle + i] = tem;
+	      SWAP_FLAGS (bottom + i, middle + i);
+	    }
+	  /* Exclude the moved top segment from further swapping.  */
+	  bottom += len;
+	}
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made.  */
+
+#if defined __STDC__ && __STDC__
+static const char *_getopt_initialize (int, char *const *, const char *);
+#endif
+static const char *
+_getopt_initialize (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  first_nonopt = last_nonopt = optind;
+
+  nextchar = NULL;
+
+  posixly_correct = getenv ("POSIXLY_CORRECT");
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+
+  if (optstring[0] == '-')
+    {
+      ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (posixly_correct != NULL)
+    ordering = REQUIRE_ORDER;
+  else
+    ordering = PERMUTE;
+
+#ifdef _LIBC
+  if (posixly_correct == NULL
+      && argc == original_argc && argv == original_argv)
+    {
+      if (nonoption_flags_max_len == 0)
+	{
+	  if (__getopt_nonoption_flags == NULL
+	      || __getopt_nonoption_flags[0] == '\0')
+	    nonoption_flags_max_len = -1;
+	  else
+	    {
+	      const char *orig_str = __getopt_nonoption_flags;
+	      int len = nonoption_flags_max_len = strlen (orig_str);
+	      if (nonoption_flags_max_len < argc)
+		nonoption_flags_max_len = argc;
+	      __getopt_nonoption_flags =
+		(char *) malloc (nonoption_flags_max_len);
+	      if (__getopt_nonoption_flags == NULL)
+		nonoption_flags_max_len = -1;
+	      else
+		memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+			'\0', nonoption_flags_max_len - len);
+	    }
+	}
+      nonoption_flags_len = nonoption_flags_max_len;
+    }
+  else
+    nonoption_flags_len = 0;
+#endif
+
+  return optstring;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns -1.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  optarg = NULL;
+
+  if (optind == 0 || !__getopt_initialized)
+    {
+      if (optind == 0)
+	optind = 1;	/* Don't scan ARGV[0], the program name.  */
+      optstring = _getopt_initialize (argc, argv, optstring);
+      __getopt_initialized = 1;
+    }
+
+  /* Test whether ARGV[optind] points to a non-option argument.
+     Either it does not have option syntax, or there is an environment flag
+     from the shell indicating it is not an option.  The later information
+     is only used when the used in the GNU libc.  */
+#ifdef _LIBC
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'	      \
+		      || (optind < nonoption_flags_len			      \
+			  && __getopt_nonoption_flags[optind] == '1'))
+#else
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#endif
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      /* Advance to the next ARGV-element.  */
+
+      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+	 moved back by the user (who may also have changed the arguments).  */
+      if (last_nonopt > optind)
+	last_nonopt = optind;
+      if (first_nonopt > optind)
+	first_nonopt = optind;
+
+      if (ordering == PERMUTE)
+	{
+	  /* If we have just processed some options following some non-options,
+	     exchange them so that the options come first.  */
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (last_nonopt != optind)
+	    first_nonopt = optind;
+
+	  /* Skip any additional non-options
+	     and extend the range of non-options previously skipped.  */
+
+	  while (optind < argc && NONOPTION_P)
+	    optind++;
+	  last_nonopt = optind;
+	}
+
+      /* The special ARGV-element `--' means premature end of options.
+	 Skip it like a null option,
+	 then exchange with previous non-options as if it were an option,
+	 then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+	{
+	  optind++;
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (first_nonopt == last_nonopt)
+	    first_nonopt = optind;
+	  last_nonopt = argc;
+
+	  optind = argc;
+	}
+
+      /* If we have done all the ARGV-elements, stop the scan
+	 and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+	{
+	  /* Set the next-arg-index to point at the non-options
+	     that we previously skipped, so the caller will digest them.  */
+	  if (first_nonopt != last_nonopt)
+	    optind = first_nonopt;
+	  return -1;
+	}
+
+      /* If we have come to a non-option and did not permute it,
+	 either stop the scan or describe it to the caller and pass it by.  */
+
+      if (NONOPTION_P)
+	{
+	  if (ordering == REQUIRE_ORDER)
+	    return -1;
+	  optarg = argv[optind++];
+	  return 1;
+	}
+
+      /* We have found another option-ARGV-element.
+	 Skip the initial punctuation.  */
+
+      nextchar = (argv[optind] + 1
+		  + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  /* Decode the current option-ARGV-element.  */
+
+  /* Check whether the ARGV-element is a long option.
+
+     If long_only and the ARGV-element has the form "-f", where f is
+     a valid short option, don't consider it an abbreviated form of
+     a long option that starts with f.  Otherwise there would be no
+     way to give the -f short option.
+
+     On the other hand, if there's a long option "fubar" and
+     the ARGV-element is "-fu", do consider that an abbreviation of
+     the long option, just like "--fu", and not "-f" with arg "u".
+
+     This distinction seems to be the most useful approach.  */
+
+  if (longopts != NULL
+      && (argv[optind][1] == '-'
+	  || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+    {
+      char *nameend;
+      const struct option *p;
+      const struct option *pfound = NULL;
+      int exact = 0;
+      int ambig = 0;
+      int indfound = -1;
+      int option_index;
+
+      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+	/* Do nothing.  */ ;
+
+      /* Test all long options for either exact match
+	 or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+	if (!strncmp (p->name, nextchar, nameend - nextchar))
+	  {
+	    if ((unsigned int) (nameend - nextchar)
+		== (unsigned int) strlen (p->name))
+	      {
+		/* Exact match found.  */
+		pfound = p;
+		indfound = option_index;
+		exact = 1;
+		break;
+	      }
+	    else if (pfound == NULL)
+	      {
+		/* First nonexact match found.  */
+		pfound = p;
+		indfound = option_index;
+	      }
+	    else
+	      /* Second or later nonexact match found.  */
+	      ambig = 1;
+	  }
+
+      if (ambig && !exact)
+	{
+	  if (opterr)
+	    fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+		     argv[0], argv[optind]);
+	  nextchar += strlen (nextchar);
+	  optind++;
+	  optopt = 0;
+	  return '?';
+	}
+
+      if (pfound != NULL)
+	{
+	  option_index = indfound;
+	  optind++;
+	  if (*nameend)
+	    {
+	      /* Don't test has_arg with >, because some C compilers don't
+		 allow it to be used on enums.  */
+	      if (pfound->has_arg)
+		optarg = nameend + 1;
+	      else
+		{
+		  if (opterr)
+		    {
+		      if (argv[optind - 1][1] == '-')
+			/* --option */
+			fprintf (stderr,
+				 _("%s: option `--%s' doesn't allow an argument\n"),
+				 argv[0], pfound->name);
+		      else
+			/* +option or -option */
+			fprintf (stderr,
+				 _("%s: option `%c%s' doesn't allow an argument\n"),
+				 argv[0], argv[optind - 1][0], pfound->name);
+		    }
+
+		  nextchar += strlen (nextchar);
+
+		  optopt = pfound->val;
+		  return '?';
+		}
+	    }
+	  else if (pfound->has_arg == 1)
+	    {
+	      if (optind < argc)
+		optarg = argv[optind++];
+	      else
+		{
+		  if (opterr)
+		    fprintf (stderr,
+			   _("%s: option `%s' requires an argument\n"),
+			   argv[0], argv[optind - 1]);
+		  nextchar += strlen (nextchar);
+		  optopt = pfound->val;
+		  return optstring[0] == ':' ? ':' : '?';
+		}
+	    }
+	  nextchar += strlen (nextchar);
+	  if (longind != NULL)
+	    *longind = option_index;
+	  if (pfound->flag)
+	    {
+	      *(pfound->flag) = pfound->val;
+	      return 0;
+	    }
+	  return pfound->val;
+	}
+
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+	 or the option starts with '--' or is not a valid short
+	 option, then it's an error.
+	 Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+	  || my_index (optstring, *nextchar) == NULL)
+	{
+	  if (opterr)
+	    {
+	      if (argv[optind][1] == '-')
+		/* --option */
+		fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+			 argv[0], nextchar);
+	      else
+		/* +option or -option */
+		fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+			 argv[0], argv[optind][0], nextchar);
+	    }
+	  nextchar = (char *) "";
+	  optind++;
+	  optopt = 0;
+	  return '?';
+	}
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+	if (opterr)
+	  {
+	    if (posixly_correct)
+	      /* 1003.2 specifies the format of this message.  */
+	      fprintf (stderr, _("%s: illegal option -- %c\n"),
+		       argv[0], c);
+	    else
+	      fprintf (stderr, _("%s: invalid option -- %c\n"),
+		       argv[0], c);
+	  }
+	optopt = c;
+	return '?';
+      }
+    /* Convenience. Treat POSIX -W foo same as long option --foo */
+    if (temp[0] == 'W' && temp[1] == ';')
+      {
+	char *nameend;
+	const struct option *p;
+	const struct option *pfound = NULL;
+	int exact = 0;
+	int ambig = 0;
+	int indfound = 0;
+	int option_index;
+
+	/* This is an option that requires an argument.  */
+	if (*nextchar != '\0')
+	  {
+	    optarg = nextchar;
+	    /* If we end this ARGV-element by taking the rest as an arg,
+	       we must advance to the next element now.  */
+	    optind++;
+	  }
+	else if (optind == argc)
+	  {
+	    if (opterr)
+	      {
+		/* 1003.2 specifies the format of this message.  */
+		fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+			 argv[0], c);
+	      }
+	    optopt = c;
+	    if (optstring[0] == ':')
+	      c = ':';
+	    else
+	      c = '?';
+	    return c;
+	  }
+	else
+	  /* We already incremented `optind' once;
+	     increment it again when taking next ARGV-elt as argument.  */
+	  optarg = argv[optind++];
+
+	/* optarg is now the argument, see if it's in the
+	   table of longopts.  */
+
+	for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+	  /* Do nothing.  */ ;
+
+	/* Test all long options for either exact match
+	   or abbreviated matches.  */
+	for (p = longopts, option_index = 0; p->name; p++, option_index++)
+	  if (!strncmp (p->name, nextchar, nameend - nextchar))
+	    {
+	      if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+		{
+		  /* Exact match found.  */
+		  pfound = p;
+		  indfound = option_index;
+		  exact = 1;
+		  break;
+		}
+	      else if (pfound == NULL)
+		{
+		  /* First nonexact match found.  */
+		  pfound = p;
+		  indfound = option_index;
+		}
+	      else
+		/* Second or later nonexact match found.  */
+		ambig = 1;
+	    }
+	if (ambig && !exact)
+	  {
+	    if (opterr)
+	      fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+		       argv[0], argv[optind]);
+	    nextchar += strlen (nextchar);
+	    optind++;
+	    return '?';
+	  }
+	if (pfound != NULL)
+	  {
+	    option_index = indfound;
+	    if (*nameend)
+	      {
+		/* Don't test has_arg with >, because some C compilers don't
+		   allow it to be used on enums.  */
+		if (pfound->has_arg)
+		  optarg = nameend + 1;
+		else
+		  {
+		    if (opterr)
+		      fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+			       argv[0], pfound->name);
+
+		    nextchar += strlen (nextchar);
+		    return '?';
+		  }
+	      }
+	    else if (pfound->has_arg == 1)
+	      {
+		if (optind < argc)
+		  optarg = argv[optind++];
+		else
+		  {
+		    if (opterr)
+		      fprintf (stderr,
+			       _("%s: option `%s' requires an argument\n"),
+			       argv[0], argv[optind - 1]);
+		    nextchar += strlen (nextchar);
+		    return optstring[0] == ':' ? ':' : '?';
+		  }
+	      }
+	    nextchar += strlen (nextchar);
+	    if (longind != NULL)
+	      *longind = option_index;
+	    if (pfound->flag)
+	      {
+		*(pfound->flag) = pfound->val;
+		return 0;
+	      }
+	    return pfound->val;
+	  }
+	  nextchar = NULL;
+	  return 'W';	/* Let the application handle it.   */
+      }
+    if (temp[1] == ':')
+      {
+	if (temp[2] == ':')
+	  {
+	    /* This is an option that accepts an argument optionally.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		optind++;
+	      }
+	    else
+	      optarg = NULL;
+	    nextchar = NULL;
+	  }
+	else
+	  {
+	    /* This is an option that requires an argument.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		/* If we end this ARGV-element by taking the rest as an arg,
+		   we must advance to the next element now.  */
+		optind++;
+	      }
+	    else if (optind == argc)
+	      {
+		if (opterr)
+		  {
+		    /* 1003.2 specifies the format of this message.  */
+		    fprintf (stderr,
+			   _("%s: option requires an argument -- %c\n"),
+			   argv[0], c);
+		  }
+		optopt = c;
+		if (optstring[0] == ':')
+		  c = ':';
+		else
+		  c = '?';
+	      }
+	    else
+	      /* We already incremented `optind' once;
+		 increment it again when taking next ARGV-elt as argument.  */
+	      optarg = argv[optind++];
+	    nextchar = NULL;
+	  }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+			   (const struct option *) 0,
+			   (int *) 0,
+			   0);
+}
+
+#endif	/* Not ELIDE_CODE.  */
+
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == -1)
+	break;
+
+      switch (c)
+	{
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/windows/getopt.h b/windows/getopt.h
new file mode 100644
index 0000000..b65740d
--- /dev/null
+++ b/windows/getopt.h
@@ -0,0 +1,172 @@
+/* Declarations for getopt.
+  Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
+  This file is part of the GNU C Library.
+
+  The GNU C Library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public License as
+  published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  The GNU C Library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public
+  License along with the GNU C Library; see the file COPYING.LIB.  If not,
+  write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+  Boston, MA 02111-1307, USA.  */
+
+#ifndef _GETOPT_H
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+#ifdef	__cplusplus
+extern "C"
+{
+#endif
+
+    /* For communication from `getopt' to the caller.
+       When `getopt' finds an option that takes an argument,
+       the argument value is returned here.
+       Also, when `ordering' is RETURN_IN_ORDER,
+       each non-option ARGV-element is returned here.  */
+
+    extern char *optarg;
+
+    /* Index in ARGV of the next element to be scanned.
+       This is used for communication to and from the caller
+       and for communication between successive calls to `getopt'.
+     
+       On entry to `getopt', zero means this is the first call; initialize.
+     
+       When `getopt' returns -1, this is the index of the first of the
+       non-option elements that the caller should itself scan.
+     
+       Otherwise, `optind' communicates from one call to the next
+       how much of ARGV has been scanned so far.  */
+
+    extern int optind;
+
+    /* Callers store zero here to inhibit the error message `getopt' prints
+       for unrecognized options.  */
+
+    extern int opterr;
+
+    /* Set to an option character which was unrecognized.  */
+
+    extern int optopt;
+
+#ifndef __need_getopt
+    /* Describe the long-named options requested by the application.
+       The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+       of `struct option' terminated by an element containing a name which is
+       zero.
+     
+       The field `has_arg' is:
+       no_argument		(or 0) if the option does not take an argument,
+       required_argument	(or 1) if the option requires an argument,
+       optional_argument 	(or 2) if the option takes an optional argument.
+     
+       If the field `flag' is not NULL, it points to a variable that is set
+       to the value given in the field `val' when the option is found, but
+       left unchanged if the option is not found.
+     
+       To have a long-named option do something other than set an `int' to
+       a compiled-in constant, such as set a value from `optarg', set the
+       option's `flag' field to zero and its `val' field to a nonzero
+       value (the equivalent single-letter option character, if there is
+       one).  For long options that have a zero `flag' field, `getopt'
+       returns the contents of the `val' field.  */
+
+    struct option {
+# if defined __STDC__ && __STDC__
+        const char *name;
+# else
+
+        char *name;
+# endif
+        /* has_arg can't be an enum because some compilers complain about
+           type mismatches in all the code that assumes it is an int.  */
+        int has_arg;
+        int *flag;
+        int val;
+    };
+
+    /* Names for the values of the `has_arg' field of `struct option'.  */
+
+# define no_argument		0
+# define required_argument	1
+# define optional_argument	2
+#endif	/* need getopt */
+
+
+    /* Get definitions and prototypes for functions to process the
+       arguments in ARGV (ARGC of them, minus the program name) for
+       options given in OPTS.
+     
+       Return the option character from OPTS just read.  Return -1 when
+       there are no more options.  For unrecognized options, or options
+       missing arguments, `optopt' is set to the option letter, and '?' is
+       returned.
+     
+       The OPTS string is a list of characters which are recognized option
+       letters, optionally followed by colons, specifying that that letter
+       takes an argument, to be placed in `optarg'.
+     
+       If a letter in OPTS is followed by two colons, its argument is
+       optional.  This behavior is specific to the GNU `getopt'.
+     
+       The argument `--' causes premature termination of argument
+       scanning, explicitly telling `getopt' that there are no more
+       options.
+     
+       If OPTS begins with `--', then non-option arguments are treated as
+       arguments to the option '\0'.  This behavior is specific to the GNU
+       `getopt'.  */
+
+#if defined __STDC__ && __STDC__
+# ifdef __GNU_LIBRARY__
+    /* Many other libraries have conflicting prototypes for getopt, with
+       differences in the consts, in stdlib.h.  To avoid compilation
+       errors, only prototype getopt for the GNU C library.  */
+    extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
+    extern int getopt ();
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+
+    extern int getopt_long (int argc, char ** argv, const char * shortopts,
+                                const struct option * longopts, int * longind);
+
+    extern int getopt_long_only (int __argc, char *const *__argv,
+                                     const char *__shortopts,
+                                     const struct option *__longopts, int *__longind);
+
+    /* Internal only.  Users should not call this directly.  */
+    extern int _getopt_internal (int __argc, char *const *__argv,
+                                     const char *__shortopts,
+                                     const struct option *__longopts, int *__longind,
+                                     int __long_only);
+# endif
+#else /* not __STDC__ */
+    extern int getopt ();
+# ifndef __need_getopt
+    extern int getopt_long ();
+    extern int getopt_long_only ();
+
+    extern int _getopt_internal ();
+# endif
+#endif /* __STDC__ */
+
+#ifdef	__cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* getopt.h */
diff --git a/windows/getopt1.c b/windows/getopt1.c
new file mode 100644
index 0000000..00c3071
--- /dev/null
+++ b/windows/getopt1.c
@@ -0,0 +1,188 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
+     Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "getopt.h"
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#endif
+
+#ifndef	NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char **argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif	/* Not ELIDE_CODE.  */
+
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+	{"add", 1, 0, 0},
+	{"append", 0, 0, 0},
+	{"delete", 1, 0, 0},
+	{"verbose", 0, 0, 0},
+	{"create", 0, 0, 0},
+	{"file", 1, 0, 0},
+	{0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+		       long_options, &option_index);
+      if (c == -1)
+	break;
+
+      switch (c)
+	{
+	case 0:
+	  printf ("option %s", long_options[option_index].name);
+	  if (optarg)
+	    printf (" with arg %s", optarg);
+	  printf ("\n");
+	  break;
+
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case 'd':
+	  printf ("option d with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/windows/jack_audioadapter.cbp b/windows/jack_audioadapter.cbp
new file mode 100644
index 0000000..77ad24c
--- /dev/null
+++ b/windows/jack_audioadapter.cbp
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_audioadapter" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\audioadapter" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-D__SMP__" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="portaudio" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\audioadapter" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-D__SMP__" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="portaudio" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\audioadapter" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-D__SMP__" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="portaudio" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libsamplerate-0" />
+			<Add library="libjackserver" />
+			<Add library="portaudio_x86" />
+		</Linker>
+		<Unit filename="..\common\JackAudioAdapter.cpp" />
+		<Unit filename="..\common\JackAudioAdapterFactory.cpp" />
+		<Unit filename="..\common\JackAudioAdapterInterface.cpp" />
+		<Unit filename="..\common\JackLibSampleRateResampler.cpp" />
+		<Unit filename="..\common\JackResampler.cpp" />
+		<Unit filename="jackaudioadapter.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Unit filename="portaudio\JackPortAudioAdapter.cpp" />
+		<Unit filename="portaudio\JackPortAudioDevices.cpp" />
+		<Extensions>
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+			<code_completion />
+			<envvars />
+			<debugger />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_connect.cbp b/windows/jack_connect.cbp
new file mode 100644
index 0000000..928821d
--- /dev/null
+++ b/windows/jack_connect.cbp
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_connect" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_connect" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_connect" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_connect" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\example-clients\connect.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt1.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+			<envvars />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_connect.dsp b/windows/jack_connect.dsp
new file mode 100644
index 0000000..50ecdb6
--- /dev/null
+++ b/windows/jack_connect.dsp
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="jack_connect" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_connect - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_connect.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_connect.mak" CFG="jack_connect - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_connect - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_connect - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_connect - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../common/" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_connect - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_connect.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_connect - Win32 Release"
+# Name "jack_connect - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\example-clients\connect.c"
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_disconnect.cbp b/windows/jack_disconnect.cbp
new file mode 100644
index 0000000..994f212
--- /dev/null
+++ b/windows/jack_disconnect.cbp
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_disconnect" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_disconnect" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_disconnect" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_disconnect" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+			<Add directory="..\example-clients" />
+			<Add directory="..\windows" />
+			<Add directory="..\common\jack" />
+			<Add directory="..\common" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\example-clients\connect.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt1.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<debugger />
+			<envvars />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_dummy.cbp b/windows/jack_dummy.cbp
new file mode 100644
index 0000000..ad23c3b
--- /dev/null
+++ b/windows/jack_dummy.cbp
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_dummy" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\jack_dummy" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\jack_dummy" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\jack_dummy" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+		</Linker>
+		<Unit filename="..\common\JackDummyDriver.cpp" />
+		<Extensions>
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+			<code_completion />
+			<envvars />
+			<debugger />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_freeverb.dsp b/windows/jack_freeverb.dsp
new file mode 100644
index 0000000..a5cf577
--- /dev/null
+++ b/windows/jack_freeverb.dsp
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="jack_freeverb" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_freeverb - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_freeverb.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_freeverb.mak" CFG="jack_freeverb - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_freeverb - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_freeverb - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_freeverb - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_freeverb.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_freeverb - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../common" /I "." /I "../common/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_freeverb.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_freeverb - Win32 Release"
+# Name "jack_freeverb - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\example-clients\freeverb.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_load.cbp b/windows/jack_load.cbp
new file mode 100644
index 0000000..875eea9
--- /dev/null
+++ b/windows/jack_load.cbp
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_load" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_load" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_load" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_load" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\example-clients\ipload.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_load.dsp b/windows/jack_load.dsp
new file mode 100644
index 0000000..9a9d021
--- /dev/null
+++ b/windows/jack_load.dsp
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="jack_load" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_load - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_load.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_load.mak" CFG="jack_load - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_load - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_load - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_load - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "jack_load___Win32_Release"
+# PROP BASE Intermediate_Dir "jack_load___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /I "../common/jack" /I "../example-clients" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_load.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_load - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "jack_load___Win32_Debug"
+# PROP BASE Intermediate_Dir "jack_load___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /I "../example-clients" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_load.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_load - Win32 Release"
+# Name "jack_load - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\example-clients\ipload.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_loopback.cbp b/windows/jack_loopback.cbp
new file mode 100644
index 0000000..87edea4
--- /dev/null
+++ b/windows/jack_loopback.cbp
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_loopback" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\jack_loopback" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\jack_loopback" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\jack_loopback" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+		</Linker>
+		<Unit filename="..\common\JackLoopbackDriver.cpp" />
+		<Extensions>
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+			<code_completion />
+			<envvars />
+			<debugger />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_lsp.cbp b/windows/jack_lsp.cbp
new file mode 100644
index 0000000..0154e53
--- /dev/null
+++ b/windows/jack_lsp.cbp
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_lsp" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_lsp" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_lsp" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_lsp" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\example-clients\lsp.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_lsp.dsp b/windows/jack_lsp.dsp
new file mode 100644
index 0000000..4a84c5c
--- /dev/null
+++ b/windows/jack_lsp.dsp
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="jack_lsp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_lsp - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_lsp.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_lsp.mak" CFG="jack_lsp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_lsp - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_lsp - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_lsp - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_lsp.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_lsp - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_lsp.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_lsp - Win32 Release"
+# Name "jack_lsp - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\example-clients\lsp.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_metro.cbp b/windows/jack_metro.cbp
new file mode 100644
index 0000000..e5f88e4
--- /dev/null
+++ b/windows/jack_metro.cbp
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_metro" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_metro" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_metro" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_metro" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\example-clients\metro.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_metro.dsp b/windows/jack_metro.dsp
new file mode 100644
index 0000000..6b01acd
--- /dev/null
+++ b/windows/jack_metro.dsp
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="jack_metro" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_metro - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_metro.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_metro.mak" CFG="jack_metro - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_metro - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_metro - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_metro - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_metro.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_metro - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_metro.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_metro - Win32 Release"
+# Name "jack_metro - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\example-clients\metro.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_netadapter.cbp b/windows/jack_netadapter.cbp
new file mode 100644
index 0000000..024e13b
--- /dev/null
+++ b/windows/jack_netadapter.cbp
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_netadapter" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\netadapter" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\netadapter" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\netadapter" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+			<Add directory="..\windows" />
+			<Add directory="..\common\jack" />
+			<Add directory="..\common" />
+		</Compiler>
+		<Linker>
+			<Add option="-enable-auto-import" />
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+			<Add library="libsamplerate-0" />
+			<Add directory="Release\bin" />
+		</Linker>
+		<Unit filename="..\common\JackAudioAdapter.cpp" />
+		<Unit filename="..\common\JackAudioAdapterInterface.cpp" />
+		<Unit filename="..\common\JackLibSampleRateResampler.cpp" />
+		<Unit filename="..\common\JackNetAdapter.cpp" />
+		<Unit filename="..\common\JackResampler.cpp" />
+		<Unit filename="jacknetadapter.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Extensions>
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+			<code_completion />
+			<envvars />
+			<debugger />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_netdriver.cbp b/windows/jack_netdriver.cbp
new file mode 100644
index 0000000..89cd14c
--- /dev/null
+++ b/windows/jack_netdriver.cbp
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_netdriver" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\jack_net" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\jack_net" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\jack_net" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add option="-enable-auto-import" />
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+			<Add library="ws2_32" />
+		</Linker>
+		<Unit filename="..\common\JackNetDriver.cpp" />
+		<Unit filename="jacknetdriver.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_netdriver.dsp b/windows/jack_netdriver.dsp
new file mode 100644
index 0000000..dac81a3
--- /dev/null
+++ b/windows/jack_netdriver.dsp
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="jack_netdriver" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=jack_netdriver - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_netdriver.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_netdriver.mak" CFG="jack_netdriver - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_netdriver - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "jack_netdriver - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_netdriver - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "jack_netdriver___Win32_Release"
+# PROP BASE Intermediate_Dir "jack_netdriver___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETDRIVER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETDRIVER_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackservermp.lib ws2_32.lib /nologo /dll /machine:I386 /out:"./Release/bin/jackmp/jack_net.dll" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_netdriver - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "jack_netdriver___Win32_Debug"
+# PROP BASE Intermediate_Dir "jack_netdriver___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETDRIVER_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETDRIVER_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackservermp.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"./Debug/bin/jackmp/jack_net.dll" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_netdriver - Win32 Release"
+# Name "jack_netdriver - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\common\JackNetDriver.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_netmanager.cbp b/windows/jack_netmanager.cbp
new file mode 100644
index 0000000..bc97506
--- /dev/null
+++ b/windows/jack_netmanager.cbp
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_netmanager" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\netmanager" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\netmanager" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\netmanager" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add option="-enable-auto-import" />
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="ws2_32" />
+			<Add library="libjackserver" />
+		</Linker>
+		<Unit filename="..\common\JackNetManager.cpp" />
+		<Unit filename="jacknetmanager.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_netmanager.dsp b/windows/jack_netmanager.dsp
new file mode 100644
index 0000000..48e4812
--- /dev/null
+++ b/windows/jack_netmanager.dsp
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="jack_netmanager" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=jack_netmanager - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_netmanager.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_netmanager.mak" CFG="jack_netmanager - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_netmanager - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "jack_netmanager - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_netmanager - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "jack_netmanager___Win32_Release"
+# PROP BASE Intermediate_Dir "jack_netmanager___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETMANAGER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETMANAGER_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackservermp.lib ws2_32.lib /nologo /dll /machine:I386 /out:"./Release/bin/jackmp/netmanager.dll" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_netmanager - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "jack_netmanager___Win32_Debug"
+# PROP BASE Intermediate_Dir "jack_netmanager___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Deubg"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETMANAGER_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_NETMANAGER_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackservermp.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"./Debug/bin/jackmp/netmanager.dll" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_netmanager - Win32 Release"
+# Name "jack_netmanager - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\common\JackNetManager.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_netonedriver.cbp b/windows/jack_netonedriver.cbp
new file mode 100644
index 0000000..0aa9703
--- /dev/null
+++ b/windows/jack_netonedriver.cbp
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_netonedriver" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\jack_netone" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\jack_netone" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\jack_netone" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DBUILD_DLL" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add option="-enable-auto-import" />
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+			<Add library="ws2_32" />
+		</Linker>
+		<Unit filename="..\common\JackNetOneDriver.cpp" />
+		<Unit filename="..\common\netjack.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="..\common\netjack_packet.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="jacknetonedriver.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_netsource.cbp b/windows/jack_netsource.cbp
new file mode 100644
index 0000000..ddfe02e
--- /dev/null
+++ b/windows/jack_netsource.cbp
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_netsource" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_netsource" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_netsource" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_netsource" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+			<Add directory="..\example-clients" />
+			<Add directory="..\windows" />
+			<Add directory="..\common\jack" />
+			<Add directory="..\common" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+			<Add library="libsamplerate-0" />
+			<Add library="ws2_32" />
+			<Add directory="Release\bin" />
+		</Linker>
+		<Unit filename="..\common\netjack_packet.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="..\example-clients\netsource.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt1.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_portaudio.cbp b/windows/jack_portaudio.cbp
new file mode 100644
index 0000000..e93760d
--- /dev/null
+++ b/windows/jack_portaudio.cbp
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_portaudio" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\jack_portaudio" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DJACK_PORTAUDIO_EXPORTS" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="portaudio" />
+				</Compiler>
+				<Linker>
+					<Add directory="..\windows" />
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\jack_portaudio" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-W" />
+					<Add option="-g" />
+					<Add option="-DWIN32" />
+					<Add option="-D_DEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DJACK_PORTAUDIO_EXPORTS" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="portaudio" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+					<Add directory="..\windows" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\jack_portaudio" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DJACK_PORTAUDIO_EXPORTS" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="portaudio" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+					<Add directory="..\windows" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+			<Add library="portaudio_x86" />
+		</Linker>
+		<Unit filename="jackportaudio.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Unit filename="portaudio\JackPortAudioDevices.cpp" />
+		<Unit filename="portaudio\JackPortAudioDriver.cpp" />
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_portaudio.dsp b/windows/jack_portaudio.dsp
new file mode 100644
index 0000000..1c2a87e
--- /dev/null
+++ b/windows/jack_portaudio.dsp
@@ -0,0 +1,115 @@
+# Microsoft Developer Studio Project File - Name="jack_portaudio" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=jack_portaudio - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_portaudio.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_portaudio.mak" CFG="jack_portaudio - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_portaudio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "jack_portaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_portaudio - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_PORTAUDIO_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_PORTAUDIO_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib portaudio_x86.lib libjackservermp.lib /nologo /dll /machine:I386 /out:"./Release/bin/jackmp/jack_portaudio.dll" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_portaudio - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_PORTAUDIO_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JACK_PORTAUDIO_EXPORTS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib portaudio_x86.lib libjackservermp.lib /nologo /dll /debug /machine:I386 /out:"./Debug/bin/jackmp/jack_portaudio_debug.dll" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_portaudio - Win32 Release"
+# Name "jack_portaudio - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\JackPortAudioDevices.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackPortAudioDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_simple_client.dsp b/windows/jack_simple_client.dsp
new file mode 100644
index 0000000..b3bb3b0
--- /dev/null
+++ b/windows/jack_simple_client.dsp
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="jack_simple_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_simple_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_simple_client.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_simple_client.mak" CFG="jack_simple_client - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_simple_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_simple_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_simple_client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_simple_client.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_simple_client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../common/" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_simple_client.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_simple_client - Win32 Release"
+# Name "jack_simple_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\example-clients\simple_client.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_test.cbp b/windows/jack_test.cbp
new file mode 100644
index 0000000..c50b21a
--- /dev/null
+++ b/windows/jack_test.cbp
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_test" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_test" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_test" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_test" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\tests\test.cpp">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_test.dsp b/windows/jack_test.dsp
new file mode 100644
index 0000000..81aa65b
--- /dev/null
+++ b/windows/jack_test.dsp
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="jack_test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_test.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_test.mak" CFG="jack_test - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_test.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_test.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_test - Win32 Release"
+# Name "jack_test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\tests\jack_test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_unload.cbp b/windows/jack_unload.cbp
new file mode 100644
index 0000000..fd8795a
--- /dev/null
+++ b/windows/jack_unload.cbp
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_unload" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack_unload" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack_unload" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack_unload" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\example-clients\ipunload.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jack_unload.dsp b/windows/jack_unload.dsp
new file mode 100644
index 0000000..982075d
--- /dev/null
+++ b/windows/jack_unload.dsp
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="jack_unload" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jack_unload - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_unload.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jack_unload.mak" CFG="jack_unload - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jack_unload - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jack_unload - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jack_unload - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "jack_unload___Win32_Release"
+# PROP BASE Intermediate_Dir "jack_unload___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /I "../common/jack" /I "../example-clients" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jack_unload.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jack_unload - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "jack_unload___Win32_Debug"
+# PROP BASE Intermediate_Dir "jack_unload___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /I "../example-clients" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jack_unload.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jack_unload - Win32 Release"
+# Name "jack_unload - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\example-clients\ipunload.c"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jack_winmme.cbp b/windows/jack_winmme.cbp
new file mode 100644
index 0000000..2c6d8bb
--- /dev/null
+++ b/windows/jack_winmme.cbp
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack_winmme" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jack\jack_winmme" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="winmme" />
+				</Compiler>
+				<Linker>
+					<Add directory="..\windows" />
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jack\jack_winmme" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-W" />
+					<Add option="-g" />
+					<Add option="-DWIN32" />
+					<Add option="-D_DEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="winmme" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+					<Add directory="..\windows" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jack\jack_winmme" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DJACK_MONITOR" />
+					<Add option="-DSERVER_SIDE" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+					<Add directory="winmme" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+					<Add directory="..\windows" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+			<Add library="winmm" />
+		</Linker>
+		<Unit filename="jackwinmme.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Unit filename="winmme\JackWinMMEDriver.cpp" />
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<lib_finder disable_auto="1" />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jackaudioadapter.rc b/windows/jackaudioadapter.rc
new file mode 100644
index 0000000..25d4b15
--- /dev/null
+++ b/windows/jackaudioadapter.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp Audio Adapter for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "audioadapter\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "audioadapter.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "audioadapter\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jackd.cbp b/windows/jackd.cbp
new file mode 100644
index 0000000..94fef99
--- /dev/null
+++ b/windows/jackd.cbp
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jackd" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\jackd" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Option parameters="-R -S -d net" />
+				<Option host_application="jackdmp.exe" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_CONSOLE" />
+					<Add option="-D_MBCS" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\jackd" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Option parameters="-R -S -d net" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DWIN32" />
+					<Add option="-D_DEBUG" />
+					<Add option="-D_CONSOLE" />
+					<Add option="-D_MBCS" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\jackd" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Option parameters="-R -S -d net" />
+				<Option host_application="jackdmp.exe" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_CONSOLE" />
+					<Add option="-D_MBCS" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjackserver" />
+		</Linker>
+		<Unit filename="..\common\Jackdmp.cpp" />
+		<Unit filename="getopt.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt1.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="jackd.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/jackd.rc b/windows/jackd.rc
new file mode 100644
index 0000000..db62e72
--- /dev/null
+++ b/windows/jackd.rc
@@ -0,0 +1,48 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_APP
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jack server for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "jackd\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "jackd.exe\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "jackd\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
+
+
+//
+// Icon resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+IDI_ICON1          ICON           ".\\Setup\\src\\jack.ico"
diff --git a/windows/jackd.workspace b/windows/jackd.workspace
new file mode 100644
index 0000000..2e5823e
--- /dev/null
+++ b/windows/jackd.workspace
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_workspace_file>
+	<Workspace title="jack">
+		<Project filename="libjackserver.cbp" />
+		<Project filename="jackd.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_portaudio.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_netdriver.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_netonedriver.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_dummy.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_netmanager.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_audioadapter.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="jack_netadapter.cbp">
+			<Depends filename="libjackserver.cbp" />
+		</Project>
+		<Project filename="libjack.cbp" />
+		<Project filename="jack_load.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_unload.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_lsp.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_netsource.cbp" active="1">
+			<Depends filename="libjack.cbp" />
+			<Depends filename="jack_netonedriver.cbp" />
+		</Project>
+		<Project filename="jack_metro.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_connect.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_disconnect.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_test.cbp" />
+		<Project filename="multiple_metro.cbp">
+			<Depends filename="libjack.cbp" />
+		</Project>
+		<Project filename="jack_winmme.cbp" />
+		<Project filename="jack_loopback.cbp" />
+	</Workspace>
+</CodeBlocks_workspace_file>
diff --git a/windows/jackdmp.dsp b/windows/jackdmp.dsp
new file mode 100644
index 0000000..755f175
--- /dev/null
+++ b/windows/jackdmp.dsp
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="jackdmp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jackdmp - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jackdmp.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jackdmp.mak" CFG="jackdmp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jackdmp - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jackdmp - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jackdmp - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackservermp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jackdmp.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jackdmp - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jackdmp.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jackdmp - Win32 Release"
+# Name "jackdmp - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\Jackdmp.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/jackdmp.dsw b/windows/jackdmp.dsw
new file mode 100644
index 0000000..d51b5f5
--- /dev/null
+++ b/windows/jackdmp.dsw
@@ -0,0 +1,272 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "jack_connect"=".\jack_connect.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_freeverb"=".\jack_freeverb.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_load"=".\jack_load.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_lsp"=".\jack_lsp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_metro"=".\jack_metro.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_netdriver"=".\jack_netdriver.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackservermp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_netmanager"=".\jack_netmanager.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackservermp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_portaudio"=".\jack_portaudio.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackservermp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_simple_client"=".\jack_simple_client.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_test"=".\jack_test.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jack_unload"=".\jack_unload.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jackdmp"=".\jackdmp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackservermp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "jdelay"=".\jdelay.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libjackmp
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libjackmp"=".\libjackmp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libjackservermp"=".\libjackservermp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "testSynchoServerClient"=".\testSynchoServerClient.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "testSynchroClient"=".\testSynchroClient.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "testSynchroServer"=".\testSynchroServer.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/windows/jacknetadapter.rc b/windows/jacknetadapter.rc
new file mode 100644
index 0000000..7488ea9
--- /dev/null
+++ b/windows/jacknetadapter.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp Net Adapter for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "netadapter\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "netadapter.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "netadapter\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jacknetdriver.rc b/windows/jacknetdriver.rc
new file mode 100644
index 0000000..a98f2fc
--- /dev/null
+++ b/windows/jacknetdriver.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp Net Driver for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "jack_netdriver\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "jack_netdriver.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "jack_netdriver\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jacknetmanager.rc b/windows/jacknetmanager.rc
new file mode 100644
index 0000000..c440861
--- /dev/null
+++ b/windows/jacknetmanager.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp Net Manager for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "netmanager\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "netmanager.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "netmanager\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jacknetonedriver.rc b/windows/jacknetonedriver.rc
new file mode 100644
index 0000000..9c184d3
--- /dev/null
+++ b/windows/jacknetonedriver.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp NetOne Driver for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "jack_netonedriver\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "jack_netonedriver.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "jack_netonedriver\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jackportaudio.rc b/windows/jackportaudio.rc
new file mode 100644
index 0000000..2c4e66d
--- /dev/null
+++ b/windows/jackportaudio.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp PortAudio Driver for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "jack_portaudio\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "jack_portaudio.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "jack_portaudio\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jackwinmme.rc b/windows/jackwinmme.rc
new file mode 100644
index 0000000..6d8e19f
--- /dev/null
+++ b/windows/jackwinmme.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp WinMMEo Driver for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "jack_portaudio\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "jack_winmme.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "jack_winmme\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/jdelay.dsp b/windows/jdelay.dsp
new file mode 100644
index 0000000..ceb0815
--- /dev/null
+++ b/windows/jdelay.dsp
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="jdelay" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=jdelay - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "jdelay.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "jdelay.mak" CFG="jdelay - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "jdelay - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "jdelay - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "jdelay - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../common" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libjackmp.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/jdelay.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "jdelay - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../common" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/jdelay.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "jdelay - Win32 Release"
+# Name "jdelay - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\tests\jdelay.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/libjack.cbp b/windows/libjack.cbp
new file mode 100644
index 0000000..6c1e5ba
--- /dev/null
+++ b/windows/libjack.cbp
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="libjack" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\libjack" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Option createStaticLib="1" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DLIBJACKMP_EXPORTS" />
+					<Add option="-DREGEX_MALLOC" />
+					<Add option="-DSTDC_HEADERS" />
+					<Add option="-D__SMP__" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add library="kernel32" />
+					<Add library="user32" />
+					<Add library="gdi32" />
+					<Add library="winspool" />
+					<Add library="comdlg32" />
+					<Add library="advapi32" />
+					<Add library="shell32" />
+					<Add library="ole32" />
+					<Add library="oleaut32" />
+					<Add library="uuid" />
+					<Add library="odbc32" />
+					<Add library="odbccp32" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\libjack" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Option createStaticLib="1" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DWIN32" />
+					<Add option="-D_DEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DLIBJACKMP_EXPORTS" />
+					<Add option="-DREGEX_MALLOC" />
+					<Add option="-DSTDC_HEADERS" />
+					<Add option="-D__SMP__" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add library="kernel32" />
+					<Add library="user32" />
+					<Add library="gdi32" />
+					<Add library="winspool" />
+					<Add library="comdlg32" />
+					<Add library="advapi32" />
+					<Add library="shell32" />
+					<Add library="ole32" />
+					<Add library="oleaut32" />
+					<Add library="uuid" />
+					<Add library="odbc32" />
+					<Add library="odbccp32" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\libjack" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Option createStaticLib="1" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DLIBJACKMP_EXPORTS" />
+					<Add option="-DREGEX_MALLOC" />
+					<Add option="-DSTDC_HEADERS" />
+					<Add option="-D__SMP__" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add library="kernel32" />
+					<Add library="user32" />
+					<Add library="gdi32" />
+					<Add library="winspool" />
+					<Add library="comdlg32" />
+					<Add library="advapi32" />
+					<Add library="shell32" />
+					<Add library="ole32" />
+					<Add library="oleaut32" />
+					<Add library="uuid" />
+					<Add library="odbc32" />
+					<Add library="odbccp32" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+		</Linker>
+		<Unit filename="..\common\JackAPI.cpp" />
+		<Unit filename="..\common\JackActivationCount.cpp" />
+		<Unit filename="..\common\JackAudioPort.cpp" />
+		<Unit filename="..\common\JackClient.cpp" />
+		<Unit filename="..\common\JackConnectionManager.cpp" />
+		<Unit filename="..\common\JackEngineControl.cpp" />
+		<Unit filename="..\common\JackEngineProfiling.cpp">
+			<Option target="Win32 Profiling" />
+		</Unit>
+		<Unit filename="..\common\JackError.cpp" />
+		<Unit filename="..\common\JackFrameTimer.cpp" />
+		<Unit filename="..\common\JackGlobals.cpp" />
+		<Unit filename="..\common\JackGraphManager.cpp" />
+		<Unit filename="..\common\JackLibAPI.cpp" />
+		<Unit filename="..\common\JackLibClient.cpp" />
+		<Unit filename="..\common\JackMessageBuffer.cpp" />
+		<Unit filename="..\common\JackMidiAPI.cpp" />
+		<Unit filename="..\common\JackMidiPort.cpp" />
+		<Unit filename="..\common\JackPort.cpp" />
+		<Unit filename="..\common\JackPortType.cpp" />
+		<Unit filename="..\common\JackShmMem.cpp" />
+		<Unit filename="..\common\JackTools.cpp" />
+		<Unit filename="..\common\JackTransportEngine.cpp" />
+		<Unit filename="..\common\shm.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="JackWinNamedPipe.cpp" />
+		<Unit filename="JackWinNamedPipeClientChannel.cpp" />
+		<Unit filename="JackWinProcessSync.cpp" />
+		<Unit filename="JackWinSemaphore.cpp" />
+		<Unit filename="JackWinServerLaunch.cpp" />
+		<Unit filename="JackWinThread.cpp" />
+		<Unit filename="JackWinTime.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libjack.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Unit filename="regex.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/libjack.rc b/windows/libjack.rc
new file mode 100644
index 0000000..7beda3d
--- /dev/null
+++ b/windows/libjack.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jack client library for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "libjack\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "libjack.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "libjack\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/libjackmp.dsp b/windows/libjackmp.dsp
new file mode 100644
index 0000000..43db3fd
--- /dev/null
+++ b/windows/libjackmp.dsp
@@ -0,0 +1,219 @@
+# Microsoft Developer Studio Project File - Name="libjackmp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libjackmp - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libjackmp.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libjackmp.mak" CFG="libjackmp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libjackmp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libjackmp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libjackmp - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKMP_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKMP_EXPORTS" /D "__STDC__" /D "REGEX_MALLOC" /D "STDC_HEADERS" /D "__SMP__" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllEntryPoint" /dll /machine:I386 /out:"./Release/bin/libjackmp.dll" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "libjackmp - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKMP_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKMP_EXPORTS" /D "__STDC__" /D "REGEX_MALLOC" /D "STDC_HEADERS" /D "__SMP__" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./Debug/bin/libjackmp.dll" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libjackmp - Win32 Release"
+# Name "libjackmp - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\common\JackActivationCount.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackAPI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackAudioPort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackClient.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackConnectionManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackEngineControl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackError.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackFrameTimer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackGlobals.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackGraphManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackLibAPI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackLibClient.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackMessageBuffer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackMidiAPI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackMidiPort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackPort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackPortType.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackShmMem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackTime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackTools.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackTransportEngine.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipe.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipeClientChannel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinProcessSync.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinSemaphore.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinThread.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\regex.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\shm.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/libjackserver.cbp b/windows/libjackserver.cbp
new file mode 100644
index 0000000..b0b76f1
--- /dev/null
+++ b/windows/libjackserver.cbp
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="libjackserver" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\libjackserver" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Option createStaticLib="1" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DLIBJACKDMP_EXPORTS" />
+					<Add option="-DREGEX_MALLOC" />
+					<Add option="-DSTDC_HEADERS" />
+					<Add option="-DSERVER_SIDE" />
+					<Add option="-D__SMP__" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\libjackserver" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Option createStaticLib="1" />
+				<Compiler>
+					<Add option="-Wall" />
+					<Add option="-g" />
+					<Add option="-DWIN32" />
+					<Add option="-D_DEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DLIBJACKDMP_EXPORTS" />
+					<Add option="-DREGEX_MALLOC" />
+					<Add option="-DSTDC_HEADERS" />
+					<Add option="-DSERVER_SIDE" />
+					<Add option="-D__SMP__" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\libjackserver" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release" />
+				<Option type="3" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Option createStaticLib="1" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DWIN32" />
+					<Add option="-DNDEBUG" />
+					<Add option="-D_WINDOWS" />
+					<Add option="-D_MBCS" />
+					<Add option="-D_USRDLL" />
+					<Add option="-DLIBJACKDMP_EXPORTS" />
+					<Add option="-DREGEX_MALLOC" />
+					<Add option="-DSTDC_HEADERS" />
+					<Add option="-DSERVER_SIDE" />
+					<Add option="-D__SMP__" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="." />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+			<Add directory="." />
+			<Add directory="..\common" />
+			<Add directory="..\common\jack" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="ws2_32" />
+		</Linker>
+		<Unit filename="..\common\JackAPI.cpp" />
+		<Unit filename="..\common\JackActivationCount.cpp" />
+		<Unit filename="..\common\JackArgParser.cpp" />
+		<Unit filename="..\common\JackAudioDriver.cpp" />
+		<Unit filename="..\common\JackAudioPort.cpp" />
+		<Unit filename="..\common\JackClient.cpp" />
+		<Unit filename="..\common\JackConnectionManager.cpp" />
+		<Unit filename="..\common\JackControlAPI.cpp" />
+		<Unit filename="..\common\JackDriver.cpp" />
+		<Unit filename="..\common\JackDriverLoader.cpp" />
+		<Unit filename="..\common\JackEngine.cpp" />
+		<Unit filename="..\common\JackEngineControl.cpp" />
+		<Unit filename="..\common\JackEngineProfiling.cpp">
+			<Option target="Win32 Profiling" />
+		</Unit>
+		<Unit filename="..\common\JackError.cpp" />
+		<Unit filename="..\common\JackExternalClient.cpp" />
+		<Unit filename="..\common\JackFrameTimer.cpp" />
+		<Unit filename="..\common\JackFreewheelDriver.cpp" />
+		<Unit filename="..\common\JackGlobals.cpp" />
+		<Unit filename="..\common\JackGraphManager.cpp" />
+		<Unit filename="..\common\JackInternalClient.cpp" />
+		<Unit filename="..\common\JackLoopbackDriver.cpp" />
+		<Unit filename="..\common\JackMessageBuffer.cpp" />
+		<Unit filename="..\common\JackMidiAPI.cpp" />
+		<Unit filename="..\common\JackMidiDriver.cpp" />
+		<Unit filename="..\common\JackMidiPort.cpp" />
+		<Unit filename="..\common\JackNetInterface.cpp" />
+		<Unit filename="..\common\JackNetTool.cpp" />
+		<Unit filename="..\common\JackPort.cpp" />
+		<Unit filename="..\common\JackPortType.cpp" />
+		<Unit filename="..\common\JackRestartThreadedDriver.cpp" />
+		<Unit filename="..\common\JackServer.cpp" />
+		<Unit filename="..\common\JackServerAPI.cpp" />
+		<Unit filename="..\common\JackServerGlobals.cpp" />
+		<Unit filename="..\common\JackShmMem.cpp" />
+		<Unit filename="..\common\JackThreadedDriver.cpp" />
+		<Unit filename="..\common\JackTools.cpp" />
+		<Unit filename="..\common\JackTransportEngine.cpp" />
+		<Unit filename="..\common\JackWaitThreadedDriver.cpp" />
+		<Unit filename="..\common\JackPhysicalMidiInput.cpp" />
+		<Unit filename="..\common\JackPhysicalMidiOutput.cpp" />
+		<Unit filename="..\common\ringbuffer.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="..\common\shm.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="JackNetWinSocket.cpp" />
+		<Unit filename="JackWinNamedPipe.cpp" />
+		<Unit filename="JackWinNamedPipeClientChannel.cpp" />
+		<Unit filename="JackWinNamedPipeNotifyChannel.cpp" />
+		<Unit filename="JackWinNamedPipeServerChannel.cpp" />
+		<Unit filename="JackWinNamedPipeServerNotifyChannel.cpp" />
+		<Unit filename="JackWinProcessSync.cpp" />
+		<Unit filename="JackWinSemaphore.cpp" />
+		<Unit filename="JackWinThread.cpp" />
+		<Unit filename="JackWinTime.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="getopt1.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libjackserver.rc">
+			<Option compilerVar="WINDRES" />
+		</Unit>
+		<Unit filename="regex.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="0" date_declarations="0" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/libjackserver.rc b/windows/libjackserver.rc
new file mode 100644
index 0000000..b62a275
--- /dev/null
+++ b/windows/libjackserver.rc
@@ -0,0 +1,41 @@
+// Generated by ResEdit 1.4.3
+// Copyright (C) 2006-2008
+// http://www.resedit.net
+
+#include "resource.h"
+#include "afxres.h"
+
+
+//
+// Version Information resources
+//
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+1 VERSIONINFO
+    FILEVERSION     1,9,5,0
+    PRODUCTVERSION  1,9,5,0
+    FILEOS          VOS_UNKNOWN
+    FILETYPE        VFT_DLL
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jack server library for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "libjackserver\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "libjackserver.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "libjackserver\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 1036, 1200
+    END
+END
diff --git a/windows/libjackservermp.dsp b/windows/libjackservermp.dsp
new file mode 100644
index 0000000..9401830
--- /dev/null
+++ b/windows/libjackservermp.dsp
@@ -0,0 +1,303 @@
+# Microsoft Developer Studio Project File - Name="libjackservermp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libjackservermp - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libjackservermp.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libjackservermp.mak" CFG="libjackservermp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libjackservermp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libjackservermp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libjackservermp - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKDMP_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKDMP_EXPORTS" /D "__STDC__" /D "REGEX_MALLOC" /D "STDC_HEADERS" /D "__SMP__" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /entry:"DllEntryPoint" /dll /machine:I386 /out:"./Release/bin/libjackservermp.dll" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "libjackservermp - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKDMP_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../common" /I "../common/jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBJACKDMP_EXPORTS" /D "__STDC__" /D "REGEX_MALLOC" /D "STDC_HEADERS" /D "__SMP__" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"./Debug/bin/libjackservermp.dll" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libjackservermp - Win32 Release"
+# Name "libjackservermp - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getopt1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackActivationCount.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackAPI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackAudioDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackAudioPort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackClient.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackConnectionManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackControl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackDriverLoader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackEngine.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackEngineControl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackError.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackExternalClient.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackFrameTimer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackFreewheelDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackGlobals.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackGraphManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackInternalClient.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackLoopbackDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackMessageBuffer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackMidiAPI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackMidiPort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackNetTool.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackNetWinSocket.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackPort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackPortType.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackRestartThreadedDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackServer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackServerAPI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackServerGlobals.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackShmMem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackThreadedDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackTime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackTools.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackTransportEngine.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\JackWaitThreadedDriver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipe.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipeClientChannel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipeNotifyChannel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipeServerChannel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinNamedPipeServerNotifyChannel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinProcessSync.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinSemaphore.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinThread.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\regex.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\shm.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\common\JackMidiPort.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/libsamplerate-0.lib b/windows/libsamplerate-0.lib
new file mode 100644
index 0000000..847b842
Binary files /dev/null and b/windows/libsamplerate-0.lib differ
diff --git a/windows/multiple_metro.cbp b/windows/multiple_metro.cbp
new file mode 100644
index 0000000..dde3ac7
--- /dev/null
+++ b/windows/multiple_metro.cbp
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="multiple_metro" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Win32 Release">
+				<Option output="Release\bin\multiple_metro" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add directory="..\example-clients" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Debug">
+				<Option output="Debug\bin\multiple_metro" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-g" />
+					<Add directory="..\tests" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Debug\bin" />
+				</Linker>
+			</Target>
+			<Target title="Win32 Profiling">
+				<Option output="Release\bin\multiple_metro" prefix_auto="1" extension_auto="1" />
+				<Option object_output="Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+					<Add option="-Wall" />
+					<Add option="-DJACK_MONITOR" />
+					<Add directory="..\tests" />
+					<Add directory="..\windows" />
+					<Add directory="..\common\jack" />
+					<Add directory="..\common" />
+				</Compiler>
+				<Linker>
+					<Add directory="Release\bin" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="kernel32" />
+			<Add library="user32" />
+			<Add library="gdi32" />
+			<Add library="winspool" />
+			<Add library="comdlg32" />
+			<Add library="advapi32" />
+			<Add library="shell32" />
+			<Add library="ole32" />
+			<Add library="oleaut32" />
+			<Add library="uuid" />
+			<Add library="odbc32" />
+			<Add library="odbccp32" />
+			<Add library="libjack" />
+		</Linker>
+		<Unit filename="..\tests\external_metro.cpp">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<code_completion />
+			<envvars />
+			<debugger />
+			<AutoVersioning>
+				<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" />
+				<Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
+				<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
+			</AutoVersioning>
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/windows/portaudio/JackPortAudioAdapter.cpp b/windows/portaudio/JackPortAudioAdapter.cpp
new file mode 100644
index 0000000..0f5e161
--- /dev/null
+++ b/windows/portaudio/JackPortAudioAdapter.cpp
@@ -0,0 +1,311 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "JackPortAudioAdapter.h"
+#include "JackError.h"
+
+namespace Jack
+{
+
+    int JackPortAudioAdapter::Render(const void* inputBuffer,
+                                    void* outputBuffer,
+                                    unsigned long framesPerBuffer,
+                                    const PaStreamCallbackTimeInfo* timeInfo,
+                                    PaStreamCallbackFlags statusFlags,
+                                    void* userData)
+    {
+        JackPortAudioAdapter* adapter = static_cast<JackPortAudioAdapter*>(userData);
+        adapter->PushAndPull((float**)inputBuffer, (float**)outputBuffer, framesPerBuffer);
+        return paContinue;
+    }
+
+    JackPortAudioAdapter::JackPortAudioAdapter ( jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params )
+            : JackAudioAdapterInterface ( buffer_size, sample_rate )
+    {
+        jack_log ( "JackPortAudioAdapter::JackPortAudioAdapter buffer_size = %d, sample_rate = %d", buffer_size, sample_rate );
+
+        const JSList* node;
+        const jack_driver_param_t* param;
+        int in_max = 0;
+        int out_max = 0;
+
+        fInputDevice = Pa_GetDefaultInputDevice();
+        fOutputDevice = Pa_GetDefaultOutputDevice();
+
+        for (node = params; node; node = jack_slist_next(node))
+        {
+            param = (const jack_driver_param_t*) node->data;
+
+            switch (param->character)
+            {
+            case 'i' :
+                fCaptureChannels = param->value.ui;
+                break;
+            case 'o' :
+                fPlaybackChannels = param->value.ui;
+                break;
+            case 'C' :
+                if ( fPaDevices.GetInputDeviceFromName(param->value.str, fInputDevice, in_max) < 0 )
+                {
+                    jack_error ( "Can't use %s, taking default input device", param->value.str );
+                    fInputDevice = Pa_GetDefaultInputDevice();
+                }
+                break;
+            case 'P' :
+                if ( fPaDevices.GetOutputDeviceFromName(param->value.str, fOutputDevice, out_max) < 0 )
+                {
+                    jack_error ( "Can't use %s, taking default output device", param->value.str );
+                    fOutputDevice = Pa_GetDefaultOutputDevice();
+                }
+                break;
+            case 'r' :
+                SetAdaptedSampleRate ( param->value.ui );
+                break;
+            case 'p' :
+                SetAdaptedBufferSize ( param->value.ui );
+                break;
+            case 'd' :
+                if ( fPaDevices.GetInputDeviceFromName ( param->value.str, fInputDevice, in_max ) < 0 )
+                    jack_error ( "Can't use %s, taking default input device", param->value.str );
+                if ( fPaDevices.GetOutputDeviceFromName ( param->value.str, fOutputDevice, out_max ) < 0 )
+                    jack_error ( "Can't use %s, taking default output device", param->value.str );
+                break;
+            case 'l' :
+                fPaDevices.DisplayDevicesNames();
+                break;
+            case 'q':
+                fQuality = param->value.ui;
+                break;
+            case 'g':
+                fRingbufferCurSize = param->value.ui;
+                fAdaptative = false;
+                break;
+            }
+        }
+
+        //max channels
+        if ( in_max == 0 )
+            in_max = fPaDevices.GetDeviceInfo ( fInputDevice )->maxInputChannels;
+        if ( out_max == 0 )
+            out_max = fPaDevices.GetDeviceInfo ( fOutputDevice )->maxOutputChannels;
+
+        //effective channels
+        if ( ( fCaptureChannels == 0 ) || ( fCaptureChannels > in_max ) )
+            fCaptureChannels = in_max;
+        if ( ( fPlaybackChannels == 0 ) || ( fPlaybackChannels > out_max ) )
+            fPlaybackChannels = out_max;
+
+        //set adapter interface channels
+        SetInputs ( fCaptureChannels );
+        SetOutputs ( fPlaybackChannels );
+    }
+
+    int JackPortAudioAdapter::Open()
+    {
+        PaError err;
+        PaStreamParameters inputParameters;
+        PaStreamParameters outputParameters;
+
+        if ( JackAudioAdapterInterface::Open() < 0 )
+            return -1;
+
+        jack_log("JackPortAudioAdapter::Open fInputDevice = %d DeviceName %s", fInputDevice, fPaDevices.GetFullName(fInputDevice).c_str());
+        jack_log("JackPortAudioAdapter::Open fOutputDevice = %d DeviceName %s", fOutputDevice, fPaDevices.GetFullName(fOutputDevice).c_str());
+        jack_log("JackPortAudioAdapter::Open fAdaptedBufferSize = %u fAdaptedSampleRate %u", fAdaptedBufferSize, fAdaptedSampleRate);
+
+        inputParameters.device = fInputDevice;
+        inputParameters.channelCount = fCaptureChannels;
+        inputParameters.sampleFormat = paFloat32 | paNonInterleaved;		// 32 bit floating point output
+        inputParameters.suggestedLatency = ( fInputDevice != paNoDevice )   // TODO: check how to setup this on ASIO
+                                           ? fPaDevices.GetDeviceInfo(fInputDevice)->defaultLowInputLatency
+                                           : 0;
+        inputParameters.hostApiSpecificStreamInfo = NULL;
+
+        outputParameters.device = fOutputDevice;
+        outputParameters.channelCount = fPlaybackChannels;
+        outputParameters.sampleFormat = paFloat32 | paNonInterleaved;		// 32 bit floating point output
+        outputParameters.suggestedLatency = ( fOutputDevice != paNoDevice )	// TODO: check how to setup this on ASIO
+                                            ? fPaDevices.GetDeviceInfo(fOutputDevice)->defaultLowOutputLatency
+                                            : 0;
+        outputParameters.hostApiSpecificStreamInfo = NULL;
+
+        err = Pa_OpenStream( &fStream,
+                            ( fInputDevice == paNoDevice ) ? 0 : &inputParameters,
+                            ( fOutputDevice == paNoDevice ) ? 0 : &outputParameters,
+                            fAdaptedSampleRate,
+                            fAdaptedBufferSize,
+                            paNoFlag,  // Clipping is on...
+                            Render,
+                            this );
+
+        if ( err != paNoError )
+        {
+            jack_error ( "Pa_OpenStream error = %s", Pa_GetErrorText ( err ) );
+            return -1;
+        }
+
+        err = Pa_StartStream ( fStream );
+
+        if ( err != paNoError )
+        {
+            jack_error ( "Pa_StartStream error = %s", Pa_GetErrorText ( err ) );
+            return -1;
+        }
+
+        jack_log ( "JackPortAudioAdapter::Open OK" );
+        return 0;
+    }
+
+    int JackPortAudioAdapter::Close()
+    {
+#ifdef JACK_MONITOR
+        fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
+#endif
+        jack_log ( "JackPortAudioAdapter::Close" );
+        Pa_StopStream ( fStream );
+        jack_log ( "JackPortAudioAdapter:: Pa_StopStream" );
+        Pa_CloseStream ( fStream );
+        jack_log ( "JackPortAudioAdapter:: Pa_CloseStream" );
+        return JackAudioAdapterInterface::Close();
+    }
+
+    int JackPortAudioAdapter::SetSampleRate ( jack_nframes_t sample_rate )
+    {
+        JackAudioAdapterInterface::SetHostSampleRate ( sample_rate );
+        Close();
+        return Open();
+    }
+
+    int JackPortAudioAdapter::SetBufferSize ( jack_nframes_t buffer_size )
+    {
+        JackAudioAdapterInterface::SetHostBufferSize ( buffer_size );
+        Close();
+        return Open();
+    }
+
+} // namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
+    {
+        jack_driver_desc_t *desc;
+        unsigned int i;
+        desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+        strcpy(desc->name, "audioadapter");                            // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "netjack audio <==> net backend adapter");  // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 10;
+        desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy(desc->params[i].name, "inchannels");
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Maximum number of input channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "outchannels");
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Maximum number of output channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "capture");
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, "default input device");
+        strcpy(desc->params[i].short_desc, "Provide capture ports. Optionally set PortAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "playback");
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, "default output device");
+        strcpy(desc->params[i].short_desc, "Provide playback ports. Optionally set PortAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "rate");
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 44100U;
+        strcpy(desc->params[i].short_desc, "Sample rate");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "periodsize");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 512U;
+        strcpy(desc->params[i].short_desc, "Period size");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "device");
+        desc->params[i].character = 'd';
+        desc->params[i].type = JackDriverParamString;
+        desc->params[i].value.ui = 128U;
+        strcpy(desc->params[i].value.str, "default device");
+        strcpy(desc->params[i].short_desc, "PortAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "list-devices");
+        desc->params[i].character = 'l';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = true;
+        strcpy(desc->params[i].short_desc, "Display available PortAudio devices");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "quality");
+        desc->params[i].character = 'q';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Resample algorithm quality (0 - 4)");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "ring-buffer");
+        desc->params[i].character = 'g';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 32768;
+        strcpy(desc->params[i].short_desc, "Fixed ringbuffer size");
+        strcpy(desc->params[i].long_desc, "Fixed ringbuffer size (if not set => automatic adaptative)");
+
+        return desc;
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/windows/portaudio/JackPortAudioAdapter.h b/windows/portaudio/JackPortAudioAdapter.h
new file mode 100644
index 0000000..73205a4
--- /dev/null
+++ b/windows/portaudio/JackPortAudioAdapter.h
@@ -0,0 +1,80 @@
+/*
+Copyright (C) 2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackPortAudioAdapter__
+#define __JackPortAudioAdapter__
+
+#include "JackAudioAdapter.h"
+#include "JackPortAudioDevices.h"
+#include "jslist.h"
+
+namespace Jack
+{
+
+    /*!
+    \brief Audio adapter using PortAudio API.
+    */
+
+    class JackPortAudioAdapter : public JackAudioAdapterInterface
+    {
+
+    private:
+
+        PortAudioDevices fPaDevices;
+        PaStream* fStream;
+        PaDeviceIndex fInputDevice;
+        PaDeviceIndex fOutputDevice;
+
+        static int Render ( const void* inputBuffer, void* outputBuffer,
+                            unsigned long framesPerBuffer,
+                            const PaStreamCallbackTimeInfo* timeInfo,
+                            PaStreamCallbackFlags statusFlags,
+                            void* userData );
+
+    public:
+
+        JackPortAudioAdapter ( jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params );
+        ~JackPortAudioAdapter()
+        {}
+
+        int Open();
+        int Close();
+
+        int SetSampleRate ( jack_nframes_t sample_rate );
+        int SetBufferSize ( jack_nframes_t buffer_size );
+
+    };
+
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "JackCompilerDeps.h"
+#include "driver_interface.h"
+
+    EXPORT jack_driver_desc_t* jack_get_descriptor();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/windows/portaudio/JackPortAudioDevices.cpp b/windows/portaudio/JackPortAudioDevices.cpp
new file mode 100644
index 0000000..d12cfca
--- /dev/null
+++ b/windows/portaudio/JackPortAudioDevices.cpp
@@ -0,0 +1,292 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackPortAudioDevices.h"
+#include "JackError.h"
+
+using namespace std;
+
+PortAudioDevices::PortAudioDevices()
+{
+    PaError err;
+	PaDeviceIndex id;
+	jack_log("Initializing PortAudio...");
+    if ( ( err = Pa_Initialize() ) == paNoError )
+    {
+        fNumHostApi = Pa_GetHostApiCount();
+        fNumDevice = Pa_GetDeviceCount();
+        fDeviceInfo = new PaDeviceInfo*[fNumDevice];
+        for ( id = 0; id < fNumDevice; id++ )
+            fDeviceInfo[id] = const_cast<PaDeviceInfo*>(Pa_GetDeviceInfo(id));
+        fHostName = new string[fNumHostApi];
+        for ( id = 0; id < fNumHostApi; id++ )
+            fHostName[id] = string ( Pa_GetHostApiInfo(id)->name );
+    }
+    else
+		jack_error("JackPortAudioDriver::Pa_Initialize error = %s", Pa_GetErrorText(err));
+}
+
+PortAudioDevices::~PortAudioDevices()
+{
+    // Desactivate for now: crash the server..
+    //Pa_Terminate();
+
+    delete[] fDeviceInfo;
+    delete[] fHostName;
+}
+
+PaDeviceIndex PortAudioDevices::GetNumDevice()
+{
+    return fNumDevice;
+}
+
+PaDeviceInfo* PortAudioDevices::GetDeviceInfo ( PaDeviceIndex id )
+{
+    return fDeviceInfo[id];
+}
+
+string PortAudioDevices::GetDeviceName ( PaDeviceIndex id )
+{
+    return string ( fDeviceInfo[id]->name );
+}
+
+string PortAudioDevices::GetHostFromDevice ( PaDeviceInfo* device )
+{
+    return fHostName[device->hostApi];
+}
+
+string PortAudioDevices::GetHostFromDevice ( PaDeviceIndex id )
+{
+    return fHostName[fDeviceInfo[id]->hostApi];
+}
+
+string PortAudioDevices::GetFullName ( PaDeviceIndex id )
+{
+    string hostname = GetHostFromDevice ( id );
+    string devicename = GetDeviceName ( id );
+    //some hostname are quite long...use shortcuts
+    if ( hostname.compare ( "Windows DirectSound" ) == 0 )
+        hostname = string ( "DirectSound" );
+    return ( hostname + "::" + devicename );
+}
+
+string PortAudioDevices::GetFullName ( std::string hostname, std::string devicename )
+{
+    //some hostname are quite long...use shortcuts
+    if ( hostname.compare ( "Windows DirectSound" ) == 0 )
+        hostname = string ( "DirectSound" );
+    return ( hostname + "::" + devicename );
+}
+
+PaDeviceInfo* PortAudioDevices::GetDeviceFromFullName ( string fullname, PaDeviceIndex& id, bool isInput )
+{
+    PaDeviceInfo* ret = NULL;
+    //no driver to find
+    if ( fullname.size() == 0 )
+        return NULL;
+    //first get host and device names from fullname
+    string::size_type separator = fullname.find ( "::", 0 );
+    if ( separator == 0 )
+        return NULL;
+    char* hostname = (char*)malloc(separator + 9);
+    fill_n ( hostname, separator + 9, 0 );
+    fullname.copy ( hostname, separator );
+
+    //we need the entire hostname, replace shortcuts
+    if ( strcmp ( hostname, "DirectSound" ) == 0 )
+        strcpy ( hostname, "Windows DirectSound" );
+    string devicename = fullname.substr ( separator + 2 );
+    //then find the corresponding device
+    for ( PaDeviceIndex dev_id = 0; dev_id < fNumDevice; dev_id++ )
+    {
+        bool flag = (isInput) ? (fDeviceInfo[dev_id]->maxInputChannels > 0) : (fDeviceInfo[dev_id]->maxOutputChannels > 0);
+        if ( ( GetHostFromDevice(dev_id).compare(hostname) == 0 )
+            && ( GetDeviceName(dev_id).compare(devicename) == 0 )
+            && flag )
+        {
+            id = dev_id;
+            ret = fDeviceInfo[dev_id];
+        }
+    }
+	free(hostname);
+    return ret;
+}
+
+void PortAudioDevices::PrintSupportedStandardSampleRates(const PaStreamParameters* inputParameters, const PaStreamParameters* outputParameters)
+{
+    static double standardSampleRates[] =
+    {
+        8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
+        44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1 /* negative terminated  list */
+    };
+    int i, printCount;
+    PaError err;
+
+    printCount = 0;
+    for (i = 0; standardSampleRates[i] > 0; i++)
+    {
+        err = Pa_IsFormatSupported(inputParameters, outputParameters, standardSampleRates[i]);
+        if (err == paFormatIsSupported)
+        {
+            if (printCount == 0)
+            {
+                jack_info("\t%8.2f", standardSampleRates[i]);
+                printCount = 1;
+            }
+            else if (printCount == 4)
+            {
+                jack_info(",\n\t%8.2f", standardSampleRates[i]);
+                printCount = 1;
+            }
+            else
+            {
+                jack_info(", %8.2f", standardSampleRates[i]);
+                ++printCount;
+            }
+        }
+    }
+    if (!printCount) {
+        jack_info("None");
+	} else {
+        jack_info("\n");
+	}
+}
+
+int PortAudioDevices::GetInputDeviceFromName(const char* devicename, PaDeviceIndex& id, int& max_input)
+{
+    string fullname = string ( devicename );
+    PaDeviceInfo* device = GetDeviceFromFullName ( fullname, id, true );
+    if ( device )
+        max_input = device->maxInputChannels;
+    else
+    {
+        id = Pa_GetDefaultInputDevice();
+        if ( fullname.size() )
+            jack_error("Can't open %s, PortAudio will use default input device.", devicename);
+        if ( id == paNoDevice )
+            return -1;
+        max_input = GetDeviceInfo(id)->maxInputChannels;
+    }
+    return id;
+}
+
+int PortAudioDevices::GetOutputDeviceFromName(const char* devicename, PaDeviceIndex& id, int& max_output)
+{
+    string fullname = string ( devicename );
+    PaDeviceInfo* device = GetDeviceFromFullName ( fullname, id, false );
+    if ( device )
+        max_output = device->maxOutputChannels;
+    else
+    {
+        id = Pa_GetDefaultOutputDevice();
+        if ( fullname.size() )
+            jack_error("Can't open %s, PortAudio will use default output device.", devicename);
+        if ( id == paNoDevice )
+            return -1;
+        max_output = GetDeviceInfo(id)->maxOutputChannels;
+    }
+    return id;
+}
+
+void PortAudioDevices::DisplayDevicesNames()
+{
+    PaDeviceIndex id;
+    PaStreamParameters inputParameters, outputParameters;
+    jack_info ( "********************** Devices list, %d detected **********************", fNumDevice );
+
+    for ( id = 0; id < fNumDevice; id++ )
+    {
+        jack_info ( "-------- device #%d ------------------------------------------------", id );
+
+        if ( id == Pa_GetDefaultInputDevice() )
+        {
+            jack_info("[ Default Input ]");
+        }
+        else if ( id == Pa_GetHostApiInfo ( fDeviceInfo[id]->hostApi)->defaultInputDevice )
+        {
+            const PaHostApiInfo *host_info = Pa_GetHostApiInfo ( fDeviceInfo[id]->hostApi );
+            jack_info ( "[ Default %s Input ]", host_info->name );
+        }
+
+        if ( id == Pa_GetDefaultOutputDevice() )
+        {
+            jack_info ( "[ Default Output ]" );
+        }
+        else if ( id == Pa_GetHostApiInfo ( fDeviceInfo[id]->hostApi )->defaultOutputDevice )
+        {
+            const PaHostApiInfo *host_info = Pa_GetHostApiInfo ( fDeviceInfo[id]->hostApi );
+            jack_info ( "[ Default %s Output ]", host_info->name );
+        }
+
+        /* print device info fields */
+        jack_info ( "Name                        = %s", GetFullName ( id ).c_str() );
+        jack_info ( "Max inputs                  = %d", fDeviceInfo[id]->maxInputChannels );
+        jack_info ( "Max outputs                 = %d", fDeviceInfo[id]->maxOutputChannels );
+
+#ifdef WIN32
+        /* ASIO specific latency information */
+        if ( Pa_GetHostApiInfo(fDeviceInfo[id]->hostApi)->type == paASIO )
+        {
+            long minLatency, maxLatency, preferredLatency, granularity;
+
+            PaAsio_GetAvailableLatencyValues ( id, &minLatency, &maxLatency, &preferredLatency, &granularity );
+
+            jack_info ( "ASIO minimum buffer size    = %ld", minLatency );
+            jack_info ( "ASIO maximum buffer size    = %ld", maxLatency );
+            jack_info ( "ASIO preferred buffer size  = %ld", preferredLatency );
+
+            if ( granularity == -1 )
+                jack_info ( "ASIO buffer granularity     = power of 2" );
+            else
+                jack_info ( "ASIO buffer granularity     = %ld", granularity );
+        }
+#endif
+
+        jack_info ( "Default sample rate         = %8.2f", fDeviceInfo[id]->defaultSampleRate );
+
+        /* poll for standard sample rates */
+        inputParameters.device = id;
+        inputParameters.channelCount = fDeviceInfo[id]->maxInputChannels;
+        inputParameters.sampleFormat = paInt16;
+        inputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
+        inputParameters.hostApiSpecificStreamInfo = NULL;
+
+        outputParameters.device = id;
+        outputParameters.channelCount = fDeviceInfo[id]->maxOutputChannels;
+        outputParameters.sampleFormat = paInt16;
+        outputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
+        outputParameters.hostApiSpecificStreamInfo = NULL;
+    }
+    jack_info ( "**************************** End of list ****************************" );
+}
+
+bool PortAudioDevices::IsDuplex ( PaDeviceIndex id )
+{
+    //does the device has in and out facilities
+    if ( fDeviceInfo[id]->maxInputChannels && fDeviceInfo[id]->maxOutputChannels )
+        return true;
+    //else is another complementary device ? (search in devices with the same name)
+    for ( PaDeviceIndex i = 0; i < fNumDevice; i++ )
+        if ( ( i != id ) && ( GetDeviceName ( i ) == GetDeviceName ( id ) ) )
+            if ( ( fDeviceInfo[i]->maxInputChannels && fDeviceInfo[id]->maxOutputChannels )
+                    || ( fDeviceInfo[i]->maxOutputChannels && fDeviceInfo[id]->maxInputChannels ) )
+                return true;
+    //then the device isn't full duplex
+    return false;
+}
diff --git a/windows/portaudio/JackPortAudioDevices.h b/windows/portaudio/JackPortAudioDevices.h
new file mode 100644
index 0000000..c8ab656
--- /dev/null
+++ b/windows/portaudio/JackPortAudioDevices.h
@@ -0,0 +1,59 @@
+/*
+Copyright (C) 2008 Romain Moret at Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __PortAudioDevices__
+#define __PortAudioDevices__
+
+#include <cstdio>
+#include <string>
+
+#include "portaudio.h"
+#include "pa_asio.h"
+
+/*!
+\brief A PortAudio Devices manager.
+*/
+
+class PortAudioDevices
+{
+    private:
+        PaHostApiIndex fNumHostApi;     //number of hosts
+        PaDeviceIndex fNumDevice;       //number of devices
+        PaDeviceInfo** fDeviceInfo;     //array of device info
+        std::string* fHostName;         //array of host names (matched with host id's)
+    public:
+        PortAudioDevices();
+        ~PortAudioDevices();
+
+        PaDeviceIndex GetNumDevice();
+        PaDeviceInfo* GetDeviceInfo(PaDeviceIndex id);
+        std::string GetDeviceName(PaDeviceIndex id);
+        std::string GetHostFromDevice(PaDeviceInfo* device);
+        std::string GetHostFromDevice(PaDeviceIndex id);
+        std::string GetFullName(PaDeviceIndex id);
+        std::string GetFullName(std::string hostname, std::string devicename);
+        PaDeviceInfo* GetDeviceFromFullName(std::string fullname, PaDeviceIndex& id, bool isInput );
+        void PrintSupportedStandardSampleRates(const PaStreamParameters* inputParameters, const PaStreamParameters* outputParameters);
+        int GetInputDeviceFromName(const char* name, PaDeviceIndex& device, int& in_max);
+        int GetOutputDeviceFromName(const char* name, PaDeviceIndex& device, int& out_max);
+        void DisplayDevicesNames();
+        bool IsDuplex ( PaDeviceIndex id );
+};
+
+#endif
diff --git a/windows/portaudio/JackPortAudioDriver.cpp b/windows/portaudio/JackPortAudioDriver.cpp
new file mode 100644
index 0000000..01e3d94
--- /dev/null
+++ b/windows/portaudio/JackPortAudioDriver.cpp
@@ -0,0 +1,488 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackDriverLoader.h"
+#include "driver_interface.h"
+#include "JackPortAudioDriver.h"
+#include "JackEngineControl.h"
+#include "JackError.h"
+#include "JackTime.h"
+#include "JackCompilerDeps.h"
+#include <iostream>
+#include <assert.h>
+
+using namespace std;
+
+namespace Jack
+{
+    int JackPortAudioDriver::Render(const void* inputBuffer, void* outputBuffer,
+                                    unsigned long framesPerBuffer,
+                                    const PaStreamCallbackTimeInfo* timeInfo,
+                                    PaStreamCallbackFlags statusFlags,
+                                    void* userData)
+    {
+        JackPortAudioDriver* driver = (JackPortAudioDriver*)userData;
+        driver->fInputBuffer = (float**)inputBuffer;
+        driver->fOutputBuffer = (float**)outputBuffer;
+        // Setup threadded based log function
+        set_threaded_log_function();
+        driver->CycleTakeBeginTime();
+        return (driver->Process() == 0) ? paContinue : paAbort;
+    }
+
+    int JackPortAudioDriver::Read()
+    {
+        for (int i = 0; i < fCaptureChannels; i++)
+            memcpy(GetInputBuffer(i), fInputBuffer[i], sizeof(float) * fEngineControl->fBufferSize);
+        return 0;
+    }
+
+    int JackPortAudioDriver::Write()
+    {
+        for (int i = 0; i < fPlaybackChannels; i++)
+            memcpy(fOutputBuffer[i], GetOutputBuffer(i), sizeof(float) * fEngineControl->fBufferSize);
+        return 0;
+    }
+
+    int JackPortAudioDriver::Open(jack_nframes_t buffer_size,
+                                  jack_nframes_t samplerate,
+                                  bool capturing,
+                                  bool playing,
+                                  int inchannels,
+                                  int outchannels,
+                                  bool monitor,
+                                  const char* capture_driver_uid,
+                                  const char* playback_driver_uid,
+                                  jack_nframes_t capture_latency,
+                                  jack_nframes_t playback_latency)
+    {
+        PaError err = paNoError;
+        PaStreamParameters inputParameters;
+        PaStreamParameters outputParameters;
+        int in_max = 0;
+        int out_max = 0;
+
+        jack_log("JackPortAudioDriver::Open nframes = %ld in = %ld out = %ld capture name = %s playback name = %s samplerate = %ld",
+                 buffer_size, inchannels, outchannels, capture_driver_uid, playback_driver_uid, samplerate);
+
+        // Generic JackAudioDriver Open
+        if (JackAudioDriver::Open(buffer_size, samplerate, capturing, playing, inchannels, outchannels, monitor, capture_driver_uid, playback_driver_uid, capture_latency, playback_latency) != 0)
+            return -1;
+
+        //get devices
+        if (capturing)
+        {
+            if (fPaDevices->GetInputDeviceFromName(capture_driver_uid, fInputDevice, in_max) < 0)
+                goto error;
+        }
+        if (playing)
+        {
+            if (fPaDevices->GetOutputDeviceFromName(playback_driver_uid, fOutputDevice, out_max) < 0)
+                goto error;
+        }
+
+        jack_log("JackPortAudioDriver::Open fInputDevice = %d, fOutputDevice %d", fInputDevice, fOutputDevice);
+
+        //default channels number required
+        if (inchannels == 0)
+        {
+            jack_log("JackPortAudioDriver::Open setup max in channels = %ld", in_max);
+            inchannels = in_max;
+        }
+        if (outchannels == 0)
+        {
+            jack_log("JackPortAudioDriver::Open setup max out channels = %ld", out_max);
+            outchannels = out_max;
+        }
+
+        //too many channels required, take max available
+        if (inchannels > in_max)
+        {
+            jack_error("This device has only %d available input channels.", in_max);
+            inchannels = in_max;
+        }
+        if (outchannels > out_max)
+        {
+            jack_error("This device has only %d available output channels.", out_max);
+            outchannels = out_max;
+        }
+
+        //in/out streams parametering
+        inputParameters.device = fInputDevice;
+        inputParameters.channelCount = inchannels;
+        inputParameters.sampleFormat = paFloat32 | paNonInterleaved;		// 32 bit floating point output
+        inputParameters.suggestedLatency = (fInputDevice != paNoDevice)		// TODO: check how to setup this on ASIO
+										   ? fPaDevices->GetDeviceInfo(fInputDevice)->defaultLowInputLatency
+                                           : 0;
+        inputParameters.hostApiSpecificStreamInfo = NULL;
+
+        outputParameters.device = fOutputDevice;
+        outputParameters.channelCount = outchannels;
+        outputParameters.sampleFormat = paFloat32 | paNonInterleaved;		// 32 bit floating point output
+        outputParameters.suggestedLatency = (fOutputDevice != paNoDevice)	// TODO: check how to setup this on ASIO
+                                            ? fPaDevices->GetDeviceInfo(fOutputDevice)->defaultLowOutputLatency
+                                            : 0;
+        outputParameters.hostApiSpecificStreamInfo = NULL;
+
+        err = Pa_OpenStream(&fStream,
+                            (fInputDevice == paNoDevice) ? 0 : &inputParameters,
+                            (fOutputDevice == paNoDevice) ? 0 : &outputParameters,
+                            samplerate,
+                            buffer_size,
+                            paNoFlag,  // Clipping is on...
+                            Render,
+                            this);
+        if (err != paNoError)
+        {
+            jack_error("Pa_OpenStream error = %s", Pa_GetErrorText(err));
+            goto error;
+        }
+
+#ifdef __APPLE__
+        fEngineControl->fPeriod = fEngineControl->fPeriodUsecs * 1000;
+        fEngineControl->fComputation = 500 * 1000;
+        fEngineControl->fConstraint = fEngineControl->fPeriodUsecs * 1000;
+#endif
+
+        // Core driver may have changed the in/out values
+        fCaptureChannels = inchannels;
+        fPlaybackChannels = outchannels;
+
+        assert(strlen(capture_driver_uid) < JACK_CLIENT_NAME_SIZE);
+        assert(strlen(playback_driver_uid) < JACK_CLIENT_NAME_SIZE);
+
+        strcpy(fCaptureDriverName, capture_driver_uid);
+        strcpy(fPlaybackDriverName, playback_driver_uid);
+
+        return 0;
+
+error:
+        JackAudioDriver::Close();
+        jack_error("Can't open default PortAudio device : %s", Pa_GetErrorText(err));
+        return -1;
+    }
+
+    int JackPortAudioDriver::Close()
+    {
+        int res = JackAudioDriver::Close();
+        jack_log("JackPortAudioDriver::Close");
+        Pa_CloseStream(fStream);
+        return res;
+    }
+
+    int JackPortAudioDriver::Start()
+    {
+        jack_log("JackPortAudioDriver::Start");
+        JackAudioDriver::Start();
+        PaError err = Pa_StartStream(fStream);
+        return (err == paNoError) ? 0 : -1;
+    }
+
+    int JackPortAudioDriver::Stop()
+    {
+        jack_log("JackPortAudioDriver::Stop");
+        PaError err = Pa_StopStream(fStream);
+        return (err == paNoError) ? 0 : -1;
+    }
+
+    int JackPortAudioDriver::SetBufferSize(jack_nframes_t buffer_size)
+    {
+        PaError err;
+        PaStreamParameters inputParameters;
+        PaStreamParameters outputParameters;
+
+        if ((err = Pa_CloseStream(fStream)) != paNoError)
+        {
+            jack_error("Pa_CloseStream error = %s", Pa_GetErrorText(err));
+            return -1;
+        }
+
+        //change parametering
+        inputParameters.device = fInputDevice;
+        inputParameters.channelCount = fCaptureChannels;
+        inputParameters.sampleFormat = paFloat32 | paNonInterleaved;		// 32 bit floating point output
+        inputParameters.suggestedLatency = (fInputDevice != paNoDevice)		// TODO: check how to setup this on ASIO
+                                           ? Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency
+                                           : 0;
+        inputParameters.hostApiSpecificStreamInfo = NULL;
+
+        outputParameters.device = fOutputDevice;
+        outputParameters.channelCount = fPlaybackChannels;
+        outputParameters.sampleFormat = paFloat32 | paNonInterleaved;		// 32 bit floating point output
+        outputParameters.suggestedLatency = (fOutputDevice != paNoDevice)	// TODO: check how to setup this on ASIO
+                                            ? Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency
+                                            : 0;
+        outputParameters.hostApiSpecificStreamInfo = NULL;
+
+        err = Pa_OpenStream(&fStream,
+                            (fInputDevice == paNoDevice) ? 0 : &inputParameters,
+                            (fOutputDevice == paNoDevice) ? 0 : &outputParameters,
+                            fEngineControl->fSampleRate,
+                            buffer_size,
+                            paNoFlag,  // Clipping is on...
+                            Render,
+                            this);
+
+        if (err != paNoError)
+        {
+            jack_error("Pa_OpenStream error = %s", Pa_GetErrorText(err));
+            return -1;
+        }
+        else
+        {
+            // Only done when success
+            return JackAudioDriver::SetBufferSize(buffer_size); // never fails
+        }
+    }
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "JackCompilerDeps.h"
+
+    SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
+    {
+        jack_driver_desc_t *desc;
+        unsigned int i;
+        desc = (jack_driver_desc_t*)calloc(1, sizeof(jack_driver_desc_t));
+
+        strcpy(desc->name, "portaudio");                             // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "PortAudio API based audio backend");     // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 13;
+        desc->params = (jack_driver_param_desc_t*)calloc(desc->nparams, sizeof(jack_driver_param_desc_t));
+
+        i = 0;
+        strcpy(desc->params[i].name, "channels");
+        desc->params[i].character = 'c';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Maximum number of channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "inchannels");
+        desc->params[i].character = 'i';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Maximum number of input channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "outchannels");
+        desc->params[i].character = 'o';
+        desc->params[i].type = JackDriverParamInt;
+        desc->params[i].value.ui = 0;
+        strcpy(desc->params[i].short_desc, "Maximum number of output channels");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "capture");
+        desc->params[i].character = 'C';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, "will take default PortAudio input device");
+        strcpy(desc->params[i].short_desc, "Provide capture ports. Optionally set PortAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "playback");
+        desc->params[i].character = 'P';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, "will take default PortAudio output device");
+        strcpy(desc->params[i].short_desc, "Provide playback ports. Optionally set PortAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy (desc->params[i].name, "monitor");
+        desc->params[i].character = 'm';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Provide monitor ports for the output");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "duplex");
+        desc->params[i].character = 'D';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = TRUE;
+        strcpy(desc->params[i].short_desc, "Provide both capture and playback ports");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "rate");
+        desc->params[i].character = 'r';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 44100U;
+        strcpy(desc->params[i].short_desc, "Sample rate");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "period");
+        desc->params[i].character = 'p';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.ui = 128U;
+        strcpy(desc->params[i].short_desc, "Frames per period");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "device");
+        desc->params[i].character = 'd';
+        desc->params[i].type = JackDriverParamString;
+        strcpy(desc->params[i].value.str, "will take default PortAudio device name");
+        strcpy(desc->params[i].short_desc, "PortAudio device name");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "input-latency");
+        desc->params[i].character = 'I';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Extra input latency");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "output-latency");
+        desc->params[i].character = 'O';
+        desc->params[i].type = JackDriverParamUInt;
+        desc->params[i].value.i = 0;
+        strcpy(desc->params[i].short_desc, "Extra output latency");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        i++;
+        strcpy(desc->params[i].name, "list-devices");
+        desc->params[i].character = 'l';
+        desc->params[i].type = JackDriverParamBool;
+        desc->params[i].value.i = TRUE;
+        strcpy(desc->params[i].short_desc, "Display available PortAudio devices");
+        strcpy(desc->params[i].long_desc, desc->params[i].short_desc);
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
+    {
+        jack_nframes_t srate = 44100;
+        jack_nframes_t frames_per_interrupt = 512;
+        const char* capture_pcm_name = "";
+        const char* playback_pcm_name = "";
+        bool capture = false;
+        bool playback = false;
+        int chan_in = 0;
+        int chan_out = 0;
+        bool monitor = false;
+        const JSList *node;
+        const jack_driver_param_t *param;
+        jack_nframes_t systemic_input_latency = 0;
+        jack_nframes_t systemic_output_latency = 0;
+        PortAudioDevices* pa_devices = new PortAudioDevices();
+
+        for (node = params; node; node = jack_slist_next(node))
+        {
+            param = (const jack_driver_param_t *) node->data;
+
+            switch (param->character)
+            {
+
+            case 'd':
+                capture_pcm_name = strdup(param->value.str);
+                playback_pcm_name = strdup(param->value.str);
+                break;
+
+            case 'D':
+                capture = true;
+                playback = true;
+                break;
+
+            case 'c':
+                chan_in = chan_out = (int)param->value.ui;
+                break;
+
+            case 'i':
+                chan_in = (int)param->value.ui;
+                break;
+
+            case 'o':
+                chan_out = (int)param->value.ui;
+                break;
+
+            case 'C':
+                capture = true;
+                if (strcmp(param->value.str, "none") != 0) {
+                    capture_pcm_name = strdup(param->value.str);
+                }
+                break;
+
+            case 'P':
+                playback = TRUE;
+                if (strcmp(param->value.str, "none") != 0) {
+                    playback_pcm_name = strdup(param->value.str);
+                }
+                break;
+
+            case 'm':
+                monitor = param->value.i;
+                break;
+
+            case 'r':
+                srate = param->value.ui;
+                break;
+
+            case 'p':
+                frames_per_interrupt = (unsigned int)param->value.ui;
+                break;
+
+            case 'I':
+                systemic_input_latency = param->value.ui;
+                break;
+
+            case 'O':
+                systemic_output_latency = param->value.ui;
+                break;
+
+            case 'l':
+                pa_devices->DisplayDevicesNames();
+                break;
+            }
+        }
+
+        // duplex is the default
+        if (!capture && !playback) {
+            capture = true;
+            playback = true;
+        }
+
+        Jack::JackDriverClientInterface* driver = new Jack::JackPortAudioDriver("system", "portaudio", engine, table, pa_devices);
+        if (driver->Open(frames_per_interrupt, srate, capture, playback, chan_in, chan_out, monitor, capture_pcm_name, playback_pcm_name, systemic_input_latency, systemic_output_latency) == 0)
+        {
+            return driver;
+        }
+        else
+        {
+            delete driver;
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/windows/portaudio/JackPortAudioDriver.h b/windows/portaudio/JackPortAudioDriver.h
new file mode 100644
index 0000000..a5995cd
--- /dev/null
+++ b/windows/portaudio/JackPortAudioDriver.h
@@ -0,0 +1,90 @@
+/*
+Copyright (C) 2004-2008 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackPortAudioDriver__
+#define __JackPortAudioDriver__
+
+#include "JackAudioDriver.h"
+#include "JackPortAudioDevices.h"
+
+namespace Jack
+{
+
+/*!
+\brief The PortAudio driver.
+*/
+
+class JackPortAudioDriver : public JackAudioDriver
+{
+
+    private:
+
+        PortAudioDevices* fPaDevices;
+        PaStream* fStream;
+        float** fInputBuffer;
+        float** fOutputBuffer;
+        PaDeviceIndex fInputDevice;
+        PaDeviceIndex fOutputDevice;
+
+        static int Render(const void* inputBuffer, void* outputBuffer,
+                          unsigned long framesPerBuffer,
+                          const PaStreamCallbackTimeInfo* timeInfo,
+                          PaStreamCallbackFlags statusFlags,
+                          void* userData);
+
+    public:
+
+        JackPortAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, PortAudioDevices* pa_devices)
+                : JackAudioDriver(name, alias, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
+                fInputDevice(paNoDevice), fOutputDevice(paNoDevice)
+        {
+            fPaDevices = pa_devices;
+        }
+
+        virtual ~JackPortAudioDriver()
+        {
+            delete fPaDevices;
+        }
+
+        int Open(jack_nframes_t buffe_size,
+                 jack_nframes_t samplerate,
+                 bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency);
+
+        int Close();
+
+        int Start();
+        int Stop();
+
+        int Read();
+        int Write();
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+};
+
+} // end of namespace
+
+#endif
diff --git a/windows/portaudio/pa_asio.h b/windows/portaudio/pa_asio.h
new file mode 100644
index 0000000..64e075b
--- /dev/null
+++ b/windows/portaudio/pa_asio.h
@@ -0,0 +1,123 @@
+#ifndef PA_ASIO_H
+#define PA_ASIO_H
+/*
+ * $Id: pa_asio.h,v 1.1.2.2 2006/06/20 14:44:48 letz Exp $
+ * PortAudio Portable Real-Time Audio Library
+ * ASIO specific extensions
+ *
+ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/** @file
+ @brief ASIO-specific PortAudio API extension header file.
+*/
+
+
+#include "portaudio.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+    /** Retrieve legal latency settings for the specificed device, in samples.
+     
+     @param device The global index of the device about which the query is being made.
+     @param minLatency A pointer to the location which will recieve the minimum latency value.
+     @param maxLatency A pointer to the location which will recieve the maximum latency value.
+     @param preferredLatency A pointer to the location which will recieve the preferred latency value.
+     @param granularity A pointer to the location which will recieve the granularity. This value 
+     determines which values between minLatency and maxLatency are available. ie the step size,
+     if granularity is -1 then available latency settings are powers of two.
+     
+     @see ASIOGetBufferSize in the ASIO SDK.
+     
+     @todo This function should have a better name, any suggestions?
+    */
+    PaError PaAsio_GetAvailableLatencyValues( PaDeviceIndex device,
+            long *minLatency, long *maxLatency, long *preferredLatency, long *granularity );
+
+
+    /** Display the ASIO control panel for the specified device.
+     
+      @param device The global index of the device whose control panel is to be displayed.
+      @param systemSpecific On Windows, the calling application's main window handle,
+      on Macintosh this value should be zero.
+    */
+    PaError PaAsio_ShowControlPanel( PaDeviceIndex device, void* systemSpecific );
+
+
+
+
+    /** Retrieve a pointer to a string containing the name of the specified
+     input channel. The string is valid until Pa_Terminate is called.
+     
+     The string will be no longer than 32 characters including the null terminator.
+    */
+    PaError PaAsio_GetInputChannelName( PaDeviceIndex device, int channelIndex,
+                                        const char** channelName );
+
+
+    /** Retrieve a pointer to a string containing the name of the specified
+     input channel. The string is valid until Pa_Terminate is called.
+     
+     The string will be no longer than 32 characters including the null terminator.
+    */
+    PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex,
+                                         const char** channelName );
+
+
+#define paAsioUseChannelSelectors      (0x01)
+
+    typedef struct PaAsioStreamInfo {
+        unsigned long size;             /**< sizeof(PaAsioStreamInfo) */
+        PaHostApiTypeId hostApiType;    /**< paASIO */
+        unsigned long version;          /**< 1 */
+
+        unsigned long flags;
+
+        /* Support for opening only specific channels of an ASIO device.
+            If the paAsioUseChannelSelectors flag is set, channelSelectors is a
+            pointer to an array of integers specifying the device channels to use.
+            When used, the length of the channelSelectors array must match the
+            corresponding channelCount parameter to Pa_OpenStream() otherwise a
+            crash may result.
+            The values in the selectors array must specify channels within the
+            range of supported channels for the device or paInvalidChannelCount will
+            result.
+        */
+        int *channelSelectors;
+    }
+    PaAsioStreamInfo;
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* PA_ASIO_H */
diff --git a/windows/portaudio/portaudio.h b/windows/portaudio/portaudio.h
new file mode 100644
index 0000000..09a4398
--- /dev/null
+++ b/windows/portaudio/portaudio.h
@@ -0,0 +1,1127 @@
+
+#ifndef PORTAUDIO_H
+#define PORTAUDIO_H
+/*
+ * $Id: portaudio.h,v 1.1.2.2 2006/06/20 14:44:48 letz Exp $
+ * PortAudio Portable Real-Time Audio Library
+ * PortAudio API Header File
+ * Latest version available at: http://www.portaudio.com/
+ *
+ * Copyright (c) 1999-2002 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/** @file
+ @brief The PortAudio API.
+*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+    /** Retrieve the release number of the currently running PortAudio build,
+     eg 1900.
+    */
+    int Pa_GetVersion( void );
+
+
+    /** Retrieve a textual description of the current PortAudio build,
+     eg "PortAudio V19-devel 13 October 2002".
+    */
+    const char* Pa_GetVersionText( void );
+
+
+    /** Error codes returned by PortAudio functions.
+     Note that with the exception of paNoError, all PaErrorCodes are negative.
+    */
+
+    typedef int PaError;
+    typedef enum PaErrorCode {
+        paNoError = 0,
+
+        paNotInitialized = -10000,
+        paUnanticipatedHostError,
+        paInvalidChannelCount,
+        paInvalidSampleRate,
+        paInvalidDevice,
+        paInvalidFlag,
+        paSampleFormatNotSupported,
+        paBadIODeviceCombination,
+        paInsufficientMemory,
+        paBufferTooBig,
+        paBufferTooSmall,
+        paNullCallback,
+        paBadStreamPtr,
+        paTimedOut,
+        paInternalError,
+        paDeviceUnavailable,
+        paIncompatibleHostApiSpecificStreamInfo,
+        paStreamIsStopped,
+        paStreamIsNotStopped,
+        paInputOverflowed,
+        paOutputUnderflowed,
+        paHostApiNotFound,
+        paInvalidHostApi,
+        paCanNotReadFromACallbackStream,       /**< @todo review error code name */
+        paCanNotWriteToACallbackStream,        /**< @todo review error code name */
+        paCanNotReadFromAnOutputOnlyStream,    /**< @todo review error code name */
+        paCanNotWriteToAnInputOnlyStream,      /**< @todo review error code name */
+        paIncompatibleStreamHostApi,
+        paBadBufferPtr
+    }
+    PaErrorCode;
+
+
+    /** Translate the supplied PortAudio error code into a human readable
+     message.
+    */
+    const char *Pa_GetErrorText( PaError errorCode );
+
+
+    /** Library initialization function - call this before using PortAudio.
+     This function initialises internal data structures and prepares underlying
+     host APIs for use. This function MUST be called before using any other
+     PortAudio API functions.
+     
+     If Pa_Initialize() is called multiple times, each successful 
+     call must be matched with a corresponding call to Pa_Terminate(). 
+     Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not 
+     required to be fully nested.
+     
+     Note that if Pa_Initialize() returns an error code, Pa_Terminate() should
+     NOT be called.
+     
+     @return paNoError if successful, otherwise an error code indicating the cause
+     of failure.
+     
+     @see Pa_Terminate
+    */
+    PaError Pa_Initialize( void );
+
+
+    /** Library termination function - call this when finished using PortAudio.
+     This function deallocates all resources allocated by PortAudio since it was
+     initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has
+     been called multiple times, each call must be matched with a corresponding call
+     to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically
+     close any PortAudio streams that are still open.
+     
+     Pa_Terminate() MUST be called before exiting a program which uses PortAudio.
+     Failure to do so may result in serious resource leaks, such as audio devices
+     not being available until the next reboot.
+     
+     @return paNoError if successful, otherwise an error code indicating the cause
+     of failure.
+     
+     @see Pa_Initialize
+    */
+    PaError Pa_Terminate( void );
+
+
+
+    /** The type used to refer to audio devices. Values of this type usually
+     range from 0 to (Pa_DeviceCount-1), and may also take on the PaNoDevice
+     and paUseHostApiSpecificDeviceSpecification values.
+     
+     @see Pa_DeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification
+    */
+    typedef int PaDeviceIndex;
+
+
+    /** A special PaDeviceIndex value indicating that no device is available,
+     or should be used.
+     
+     @see PaDeviceIndex
+    */
+#define paNoDevice ((PaDeviceIndex)-1)
+
+
+    /** A special PaDeviceIndex value indicating that the device(s) to be used
+     are specified in the host api specific stream info structure.
+     
+     @see PaDeviceIndex
+    */
+#define paUseHostApiSpecificDeviceSpecification ((PaDeviceIndex)-2)
+
+
+    /* Host API enumeration mechanism */
+
+    /** The type used to enumerate to host APIs at runtime. Values of this type
+     range from 0 to (Pa_GetHostApiCount()-1).
+     
+     @see Pa_GetHostApiCount
+    */
+    typedef int PaHostApiIndex;
+
+
+    /** Retrieve the number of available host APIs. Even if a host API is
+     available it may have no devices available.
+     
+     @return A non-negative value indicating the number of available host APIs
+     or, a PaErrorCode (which are always negative) if PortAudio is not initialized
+     or an error is encountered.
+     
+     @see PaHostApiIndex
+    */
+    PaHostApiIndex Pa_GetHostApiCount( void );
+
+
+    /** Retrieve the index of the default host API. The default host API will be
+     the lowest common denominator host API on the current platform and is
+     unlikely to provide the best performance.
+     
+     @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1)
+     indicating the default host API index or, a PaErrorCode (which are always
+     negative) if PortAudio is not initialized or an error is encountered.
+    */
+    PaHostApiIndex Pa_GetDefaultHostApi( void );
+
+
+    /** Unchanging unique identifiers for each supported host API. This type
+     is used in the PaHostApiInfo structure. The values are guaranteed to be
+     unique and to never change, thus allowing code to be written that
+     conditionally uses host API specific extensions.
+     
+     New type ids will be allocated when support for a host API reaches
+     "public alpha" status, prior to that developers should use the
+     paInDevelopment type id.
+     
+     @see PaHostApiInfo
+    */
+    typedef enum PaHostApiTypeId {
+        paInDevelopment = 0,  /* use while developing support for a new host API */
+        paDirectSound = 1,
+        paMME = 2,
+        paASIO = 3,
+        paSoundManager = 4,
+        paCoreAudio = 5,
+        paOSS = 7,
+        paALSA = 8,
+        paAL = 9,
+        paBeOS = 10,
+        paWDMKS = 11,
+        paJACK = 12,
+        paWASAPI = 13
+    }
+    PaHostApiTypeId;
+
+
+    /** A structure containing information about a particular host API. */
+
+    typedef struct PaHostApiInfo {
+        /** this is struct version 1 */
+        int structVersion;
+        /** The well known unique identifier of this host API @see PaHostApiTypeId */
+        PaHostApiTypeId type;
+        /** A textual description of the host API for display on user interfaces. */
+        const char *name;
+
+        /**  The number of devices belonging to this host API. This field may be
+         used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate
+         all devices for this host API.
+         @see Pa_HostApiDeviceIndexToDeviceIndex
+        */
+        int deviceCount;
+
+        /** The default input device for this host API. The value will be a
+         device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice
+         if no default input device is available.
+        */
+        PaDeviceIndex defaultInputDevice;
+
+        /** The default output device for this host API. The value will be a
+         device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice
+         if no default output device is available.
+        */
+        PaDeviceIndex defaultOutputDevice;
+
+    }
+    PaHostApiInfo;
+
+
+    /** Retrieve a pointer to a structure containing information about a specific
+     host Api.
+     
+     @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1)
+     
+     @return A pointer to an immutable PaHostApiInfo structure describing
+     a specific host API. If the hostApi parameter is out of range or an error
+     is encountered, the function returns NULL.
+     
+     The returned structure is owned by the PortAudio implementation and must not
+     be manipulated or freed. The pointer is only guaranteed to be valid between
+     calls to Pa_Initialize() and Pa_Terminate().
+    */
+    const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi );
+
+
+    /** Convert a static host API unique identifier, into a runtime
+     host API index.
+     
+     @param type A unique host API identifier belonging to the PaHostApiTypeId
+     enumeration.
+     
+     @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or,
+     a PaErrorCode (which are always negative) if PortAudio is not initialized
+     or an error is encountered.
+     
+     The paHostApiNotFound error code indicates that the host API specified by the
+     type parameter is not available.
+     
+     @see PaHostApiTypeId
+    */
+    PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type );
+
+
+    /** Convert a host-API-specific device index to standard PortAudio device index.
+     This function may be used in conjunction with the deviceCount field of
+     PaHostApiInfo to enumerate all devices for the specified host API.
+     
+     @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1)
+     
+     @param hostApiDeviceIndex A valid per-host device index in the range
+     0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1)
+     
+     @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1)
+     or, a PaErrorCode (which are always negative) if PortAudio is not initialized
+     or an error is encountered.
+     
+     A paInvalidHostApi error code indicates that the host API index specified by
+     the hostApi parameter is out of range.
+     
+     A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter
+     is out of range.
+     
+     @see PaHostApiInfo
+    */
+    PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi,
+            int hostApiDeviceIndex );
+
+
+
+    /** Structure used to return information about a host error condition.
+    */
+    typedef struct PaHostErrorInfo {
+        PaHostApiTypeId hostApiType;    /**< the host API which returned the error code */
+        long errorCode;                 /**< the error code returned */
+        const char *errorText;          /**< a textual description of the error if available, otherwise a zero-length string */
+    }
+    PaHostErrorInfo;
+
+
+    /** Return information about the last host error encountered. The error
+     information returned by Pa_GetLastHostErrorInfo() will never be modified
+     asyncronously by errors occurring in other PortAudio owned threads
+     (such as the thread that manages the stream callback.)
+     
+     This function is provided as a last resort, primarily to enhance debugging
+     by providing clients with access to all available error information.
+     
+     @return A pointer to an immutable structure constaining information about
+     the host error. The values in this structure will only be valid if a
+     PortAudio function has previously returned the paUnanticipatedHostError
+     error code.
+    */
+    const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void );
+
+
+
+    /* Device enumeration and capabilities */
+
+    /** Retrieve the number of available devices. The number of available devices
+     may be zero.
+     
+     @return A non-negative value indicating the number of available devices or,
+     a PaErrorCode (which are always negative) if PortAudio is not initialized
+     or an error is encountered.
+    */
+    PaDeviceIndex Pa_GetDeviceCount( void );
+
+
+    /** Retrieve the index of the default input device. The result can be
+     used in the inputDevice parameter to Pa_OpenStream().
+     
+     @return The default input device index for the default host API, or paNoDevice
+     if no default input device is available or an error was encountered.
+    */
+    PaDeviceIndex Pa_GetDefaultInputDevice( void );
+
+
+    /** Retrieve the index of the default output device. The result can be
+     used in the outputDevice parameter to Pa_OpenStream().
+     
+     @return The default output device index for the defualt host API, or paNoDevice
+     if no default output device is available or an error was encountered.
+     
+     @note
+     On the PC, the user can specify a default device by
+     setting an environment variable. For example, to use device #1.
+    <pre>
+     set PA_RECOMMENDED_OUTPUT_DEVICE=1
+    </pre>
+     The user should first determine the available device ids by using
+     the supplied application "pa_devs".
+    */
+    PaDeviceIndex Pa_GetDefaultOutputDevice( void );
+
+
+    /** The type used to represent monotonic time in seconds that can be used
+     for syncronisation. The type is used for the outTime argument to the
+     PaStreamCallback and as the result of Pa_GetStreamTime().
+        
+     @see PaStreamCallback, Pa_GetStreamTime
+    */
+    typedef double PaTime;
+
+
+    /** A type used to specify one or more sample formats. Each value indicates
+     a possible format for sound data passed to and from the stream callback,
+     Pa_ReadStream and Pa_WriteStream.
+     
+     The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8
+     and aUInt8 are usually implemented by all implementations.
+     
+     The floating point representation (paFloat32) uses +1.0 and -1.0 as the
+     maximum and minimum respectively.
+     
+     paUInt8 is an unsigned 8 bit format where 128 is considered "ground"
+     
+     The paNonInterleaved flag indicates that a multichannel buffer is passed
+     as a set of non-interleaved pointers.
+     
+     @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo
+     @see paFloat32, paInt16, paInt32, paInt24, paInt8
+     @see paUInt8, paCustomFormat, paNonInterleaved
+    */
+    typedef unsigned long PaSampleFormat;
+
+
+#define paFloat32        ((PaSampleFormat) 0x00000001) /**< @see PaSampleFormat */
+#define paInt32          ((PaSampleFormat) 0x00000002) /**< @see PaSampleFormat */
+#define paInt24          ((PaSampleFormat) 0x00000004) /**< Packed 24 bit format. @see PaSampleFormat */
+#define paInt16          ((PaSampleFormat) 0x00000008) /**< @see PaSampleFormat */
+#define paInt8           ((PaSampleFormat) 0x00000010) /**< @see PaSampleFormat */
+#define paUInt8          ((PaSampleFormat) 0x00000020) /**< @see PaSampleFormat */
+#define paCustomFormat   ((PaSampleFormat) 0x00010000)/**< @see PaSampleFormat */
+
+#define paNonInterleaved ((PaSampleFormat) 0x80000000)
+
+    /** A structure providing information and capabilities of PortAudio devices.
+     Devices may support input, output or both input and output.
+    */
+    typedef struct PaDeviceInfo {
+        int structVersion;  /* this is struct version 2 */
+        const char *name;
+        PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/
+
+        int maxInputChannels;
+        int maxOutputChannels;
+
+        /* Default latency values for interactive performance. */
+        PaTime defaultLowInputLatency;
+        PaTime defaultLowOutputLatency;
+        /* Default latency values for robust non-interactive applications (eg. playing sound files). */
+        PaTime defaultHighInputLatency;
+        PaTime defaultHighOutputLatency;
+
+        double defaultSampleRate;
+    }
+    PaDeviceInfo;
+
+
+    /** Retrieve a pointer to a PaDeviceInfo structure containing information
+     about the specified device.
+     @return A pointer to an immutable PaDeviceInfo structure. If the device
+     parameter is out of range the function returns NULL.
+     
+     @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1)
+     
+     @note PortAudio manages the memory referenced by the returned pointer,
+     the client must not manipulate or free the memory. The pointer is only
+     guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate().
+     
+     @see PaDeviceInfo, PaDeviceIndex
+    */
+    const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device );
+
+
+    /** Parameters for one direction (input or output) of a stream.
+    */
+    typedef struct PaStreamParameters {
+        /** A valid device index in the range 0 to (Pa_GetDeviceCount()-1)
+         specifying the device to be used or the special constant
+         paUseHostApiSpecificDeviceSpecification which indicates that the actual
+         device(s) to use are specified in hostApiSpecificStreamInfo.
+         This field must not be set to paNoDevice.
+        */
+        PaDeviceIndex device;
+
+        /** The number of channels of sound to be delivered to the
+         stream callback or accessed by Pa_ReadStream() or Pa_WriteStream().
+         It can range from 1 to the value of maxInputChannels in the
+         PaDeviceInfo record for the device specified by the device parameter.
+        */
+        int channelCount;
+
+        /** The sample format of the buffer provided to the stream callback,
+         a_ReadStream() or Pa_WriteStream(). It may be any of the formats described
+         by the PaSampleFormat enumeration.
+        */
+        PaSampleFormat sampleFormat;
+
+        /** The desired latency in seconds. Where practical, implementations should
+         configure their latency based on these parameters, otherwise they may
+         choose the closest viable latency instead. Unless the suggested latency
+         is greater than the absolute upper limit for the device implementations
+         should round the suggestedLatency up to the next practial value - ie to
+         provide an equal or higher latency than suggestedLatency wherever possibe.
+         Actual latency values for an open stream may be retrieved using the
+         inputLatency and outputLatency fields of the PaStreamInfo structure
+         returned by Pa_GetStreamInfo().
+         @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo
+        */
+        PaTime suggestedLatency;
+
+        /** An optional pointer to a host api specific data structure
+         containing additional information for device setup and/or stream processing.
+         hostApiSpecificStreamInfo is never required for correct operation,
+         if not used it should be set to NULL.
+        */
+        void *hostApiSpecificStreamInfo;
+
+    }
+    PaStreamParameters;
+
+
+    /** Return code for Pa_IsFormatSupported indicating success. */
+#define paFormatIsSupported (0)
+
+    /** Determine whether it would be possible to open a stream with the specified
+     parameters.
+     
+     @param inputParameters A structure that describes the input parameters used to
+     open a stream. The suggestedLatency field is ignored. See PaStreamParameters
+     for a description of these parameters. inputParameters must be NULL for
+     output-only streams.
+     
+     @param outputParameters A structure that describes the output parameters used
+     to open a stream. The suggestedLatency field is ignored. See PaStreamParameters
+     for a description of these parameters. outputParameters must be NULL for
+     input-only streams.
+     
+     @param sampleRate The required sampleRate. For full-duplex streams it is the
+     sample rate for both input and output
+     
+     @return Returns 0 if the format is supported, and an error code indicating why
+     the format is not supported otherwise. The constant paFormatIsSupported is
+     provided to compare with the return value for success.
+     
+     @see paFormatIsSupported, PaStreamParameters
+    */
+    PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
+                                  const PaStreamParameters *outputParameters,
+                                  double sampleRate );
+
+
+
+    /* Streaming types and functions */
+
+
+    /**
+     A single PaStream can provide multiple channels of real-time
+     streaming audio input and output to a client application. A stream
+     provides access to audio hardware represented by one or more
+     PaDevices. Depending on the underlying Host API, it may be possible 
+     to open multiple streams using the same device, however this behavior 
+     is implementation defined. Portable applications should assume that 
+     a PaDevice may be simultaneously used by at most one PaStream.
+     
+     Pointers to PaStream objects are passed between PortAudio functions that
+     operate on streams.
+     
+     @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream,
+     Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive,
+     Pa_GetStreamTime, Pa_GetStreamCpuLoad
+     
+    */
+    typedef void PaStream;
+
+
+    /** Can be passed as the framesPerBuffer parameter to Pa_OpenStream()
+     or Pa_OpenDefaultStream() to indicate that the stream callback will
+     accept buffers of any size.
+    */
+#define paFramesPerBufferUnspecified  (0)
+
+
+    /** Flags used to control the behavior of a stream. They are passed as
+     parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be
+     ORed together.
+     
+     @see Pa_OpenStream, Pa_OpenDefaultStream
+     @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput,
+      paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags
+    */
+    typedef unsigned long PaStreamFlags;
+
+    /** @see PaStreamFlags */
+#define   paNoFlag          ((PaStreamFlags) 0)
+
+    /** Disable default clipping of out of range samples.
+     @see PaStreamFlags
+    */
+#define   paClipOff         ((PaStreamFlags) 0x00000001)
+
+    /** Disable default dithering.
+     @see PaStreamFlags
+    */
+#define   paDitherOff       ((PaStreamFlags) 0x00000002)
+
+    /** Flag requests that where possible a full duplex stream will not discard
+     overflowed input samples without calling the stream callback. This flag is
+     only valid for full duplex callback streams and only when used in combination
+     with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using
+     this flag incorrectly results in a paInvalidFlag error being returned from
+     Pa_OpenStream and Pa_OpenDefaultStream.
+     
+     @see PaStreamFlags, paFramesPerBufferUnspecified
+    */
+#define   paNeverDropInput  ((PaStreamFlags) 0x00000004)
+
+    /** Call the stream callback to fill initial output buffers, rather than the
+     default behavior of priming the buffers with zeros (silence). This flag has
+     no effect for input-only and blocking read/write streams.
+     
+     @see PaStreamFlags
+    */
+#define   paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008)
+
+    /** A mask specifying the platform specific bits.
+     @see PaStreamFlags
+    */
+#define   paPlatformSpecificFlags ((PaStreamFlags)0xFFFF0000)
+
+    /**
+     Timing information for the buffers passed to the stream callback.
+    */
+    typedef struct PaStreamCallbackTimeInfo {
+        PaTime inputBufferAdcTime;
+        PaTime currentTime;
+        PaTime outputBufferDacTime;
+    }
+    PaStreamCallbackTimeInfo;
+
+
+    /**
+     Flag bit constants for the statusFlags to PaStreamCallback.
+     
+     @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow,
+     paPrimingOutput
+    */
+    typedef unsigned long PaStreamCallbackFlags;
+
+    /** In a stream opened with paFramesPerBufferUnspecified, indicates that
+     input data is all silence (zeros) because no real data is available. In a
+     stream opened without paFramesPerBufferUnspecified, it indicates that one or
+     more zero samples have been inserted into the input buffer to compensate
+     for an input underflow.
+     @see PaStreamCallbackFlags
+    */
+#define paInputUnderflow   ((PaStreamCallbackFlags) 0x00000001)
+
+    /** In a stream opened with paFramesPerBufferUnspecified, indicates that data
+     prior to the first sample of the input buffer was discarded due to an
+     overflow, possibly because the stream callback is using too much CPU time.
+     Otherwise indicates that data prior to one or more samples in the
+     input buffer was discarded.
+     @see PaStreamCallbackFlags
+    */
+#define paInputOverflow    ((PaStreamCallbackFlags) 0x00000002)
+
+    /** Indicates that output data (or a gap) was inserted, possibly because the
+     stream callback is using too much CPU time.
+     @see PaStreamCallbackFlags
+    */
+#define paOutputUnderflow  ((PaStreamCallbackFlags) 0x00000004)
+
+    /** Indicates that output data will be discarded because no room is available.
+     @see PaStreamCallbackFlags
+    */
+#define paOutputOverflow   ((PaStreamCallbackFlags) 0x00000008)
+
+    /** Some of all of the output data will be used to prime the stream, input
+     data may be zero.
+     @see PaStreamCallbackFlags
+    */
+#define paPrimingOutput    ((PaStreamCallbackFlags) 0x00000010)
+
+    /**
+     Allowable return values for the PaStreamCallback.
+     @see PaStreamCallback
+    */
+    typedef enum PaStreamCallbackResult
+    {
+        paContinue = 0,
+        paComplete = 1,
+        paAbort = 2
+    } PaStreamCallbackResult;
+
+
+    /**
+     Functions of type PaStreamCallback are implemented by PortAudio clients.
+     They consume, process or generate audio in response to requests from an
+     active PortAudio stream.
+        
+     @param input and @param output are arrays of interleaved samples,
+     the format, packing and number of channels used by the buffers are
+     determined by parameters to Pa_OpenStream().
+        
+     @param frameCount The number of sample frames to be processed by
+     the stream callback.
+     
+     @param timeInfo The time in seconds when the first sample of the input
+     buffer was received at the audio input, the time in seconds when the first
+     sample of the output buffer will begin being played at the audio output, and
+     the time in seconds when the stream callback was called.
+     See also Pa_GetStreamTime()
+     
+     @param statusFlags Flags indicating whether input and/or output buffers
+     have been inserted or will be dropped to overcome underflow or overflow
+     conditions.
+     
+     @param userData The value of a user supplied pointer passed to
+     Pa_OpenStream() intended for storing synthesis data etc.
+     
+     @return
+     The stream callback should return one of the values in the
+     PaStreamCallbackResult enumeration. To ensure that the callback continues
+     to be called, it should return paContinue (0). Either paComplete or paAbort
+     can be returned to finish stream processing, after either of these values is
+     returned the callback will not be called again. If paAbort is returned the
+     stream will finish as soon as possible. If paComplete is returned, the stream
+     will continue until all buffers generated by the callback have been played.
+     This may be useful in applications such as soundfile players where a specific
+     duration of output is required. However, it is not necessary to utilise this
+     mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also
+     be used to stop the stream. The callback must always fill the entire output
+     buffer irrespective of its return value.
+     
+     @see Pa_OpenStream, Pa_OpenDefaultStream
+     
+     @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call
+     PortAudio API functions from within the stream callback.
+    */
+    typedef int PaStreamCallback(
+        const void *input, void *output,
+        unsigned long frameCount,
+        const PaStreamCallbackTimeInfo* timeInfo,
+        PaStreamCallbackFlags statusFlags,
+        void *userData );
+
+
+    /** Opens a stream for either input, output or both.
+        
+     @param stream The address of a PaStream pointer which will receive
+     a pointer to the newly opened stream.
+        
+     @param inputParameters A structure that describes the input parameters used by
+     the opened stream. See PaStreamParameters for a description of these parameters.
+     inputParameters must be NULL for output-only streams.
+     
+     @param outputParameters A structure that describes the output parameters used by
+     the opened stream. See PaStreamParameters for a description of these parameters.
+     outputParameters must be NULL for input-only streams.
+     
+     @param sampleRate The desired sampleRate. For full-duplex streams it is the
+     sample rate for both input and output
+        
+     @param framesPerBuffer The number of frames passed to the stream callback
+     function, or the preferred block granularity for a blocking read/write stream.
+     The special value paFramesPerBufferUnspecified (0) may be used to request that
+     the stream callback will recieve an optimal (and possibly varying) number of
+     frames based on host requirements and the requested latency settings.
+     Note: With some host APIs, the use of non-zero framesPerBuffer for a callback
+     stream may introduce an additional layer of buffering which could introduce
+     additional latency. PortAudio guarantees that the additional latency
+     will be kept to the theoretical minimum however, it is strongly recommended
+     that a non-zero framesPerBuffer value only be used when your algorithm
+     requires a fixed number of frames per stream callback.
+     
+     @param streamFlags Flags which modify the behaviour of the streaming process.
+     This parameter may contain a combination of flags ORed together. Some flags may
+     only be relevant to certain buffer formats.
+        
+     @param streamCallback A pointer to a client supplied function that is responsible
+     for processing and filling input and output buffers. If this parameter is NULL
+     the stream will be opened in 'blocking read/write' mode. In blocking mode,
+     the client can receive sample data using Pa_ReadStream and write sample data
+     using Pa_WriteStream, the number of samples that may be read or written
+     without blocking is returned by Pa_GetStreamReadAvailable and
+     Pa_GetStreamWriteAvailable respectively.
+     
+     @param userData A client supplied pointer which is passed to the stream callback
+     function. It could for example, contain a pointer to instance data necessary
+     for processing the audio buffers. This parameter is ignored if streamCallback
+     is NULL.
+        
+     @return
+     Upon success Pa_OpenStream() returns paNoError and places a pointer to a
+     valid PaStream in the stream argument. The stream is inactive (stopped).
+     If a call to Pa_OpenStream() fails, a non-zero error code is returned (see
+     PaError for possible error codes) and the value of stream is invalid.
+     
+     @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream,
+     Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable
+    */
+    PaError Pa_OpenStream( PaStream** stream,
+                           const PaStreamParameters *inputParameters,
+                           const PaStreamParameters *outputParameters,
+                           double sampleRate,
+                           unsigned long framesPerBuffer,
+                           PaStreamFlags streamFlags,
+                           PaStreamCallback *streamCallback,
+                           void *userData );
+
+
+    /** A simplified version of Pa_OpenStream() that opens the default input
+     and/or output devices.
+     
+     @param stream The address of a PaStream pointer which will receive
+     a pointer to the newly opened stream.
+     
+     @param numInputChannels  The number of channels of sound that will be supplied
+     to the stream callback or returned by Pa_ReadStream. It can range from 1 to
+     the value of maxInputChannels in the PaDeviceInfo record for the default input
+     device. If 0 the stream is opened as an output-only stream.
+     
+     @param numOutputChannels The number of channels of sound to be delivered to the
+     stream callback or passed to Pa_WriteStream. It can range from 1 to the value
+     of maxOutputChannels in the PaDeviceInfo record for the default output dvice.
+     If 0 the stream is opened as an output-only stream.
+     
+     @param sampleFormat The sample format of both the input and output buffers
+     provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream.
+     sampleFormat may be any of the formats described by the PaSampleFormat
+     enumeration.
+     
+     @param sampleRate Same as Pa_OpenStream parameter of the same name.
+     @param framesPerBuffer Same as Pa_OpenStream parameter of the same name.
+     @param streamCallback Same as Pa_OpenStream parameter of the same name.
+     @param userData Same as Pa_OpenStream parameter of the same name.
+     
+     @return As for Pa_OpenStream
+     
+     @see Pa_OpenStream, PaStreamCallback
+    */
+    PaError Pa_OpenDefaultStream( PaStream** stream,
+                                  int numInputChannels,
+                                  int numOutputChannels,
+                                  PaSampleFormat sampleFormat,
+                                  double sampleRate,
+                                  unsigned long framesPerBuffer,
+                                  PaStreamCallback *streamCallback,
+                                  void *userData );
+
+
+    /** Closes an audio stream. If the audio stream is active it
+     discards any pending buffers as if Pa_AbortStream() had been called.
+    */
+    PaError Pa_CloseStream( PaStream *stream );
+
+
+    /** Functions of type PaStreamFinishedCallback are implemented by PortAudio
+     clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback
+     function. Once registered they are called when the stream becomes inactive
+     (ie once a call to Pa_StopStream() will not block).
+     A stream will become inactive after the stream callback returns non-zero,
+     or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio
+     output, if the stream callback returns paComplete, or Pa_StopStream is called,
+     the stream finished callback will not be called until all generated sample data
+     has been played.
+     
+     @param userData The userData parameter supplied to Pa_OpenStream()
+     
+     @see Pa_SetStreamFinishedCallback
+    */
+    typedef void PaStreamFinishedCallback( void *userData );
+
+
+    /** Register a stream finished callback function which will be called when the
+     stream becomes inactive. See the description of PaStreamFinishedCallback for 
+     further details about when the callback will be called.
+     
+     @param stream a pointer to a PaStream that is in the stopped state - if the
+     stream is not stopped, the stream's finished callback will remain unchanged 
+     and an error code will be returned.
+     
+     @param streamFinishedCallback a pointer to a function with the same signature
+     as PaStreamFinishedCallback, that will be called when the stream becomes
+     inactive. Passing NULL for this parameter will un-register a previously
+     registered stream finished callback function.
+     
+     @return on success returns paNoError, otherwise an error code indicating the cause
+     of the error.
+     
+     @see PaStreamFinishedCallback
+    */
+    PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback );
+
+
+    /** Commences audio processing.
+    */
+    PaError Pa_StartStream( PaStream *stream );
+
+
+    /** Terminates audio processing. It waits until all pending
+     audio buffers have been played before it returns.
+    */
+    PaError Pa_StopStream( PaStream *stream );
+
+
+    /** Terminates audio processing immediately without waiting for pending
+     buffers to complete.
+    */
+    PaError Pa_AbortStream( PaStream *stream );
+
+
+    /** Determine whether the stream is stopped.
+     A stream is considered to be stopped prior to a successful call to
+     Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream.
+     If a stream callback returns a value other than paContinue the stream is NOT
+     considered to be stopped.
+     
+     @return Returns one (1) when the stream is stopped, zero (0) when
+     the stream is running or, a PaErrorCode (which are always negative) if
+     PortAudio is not initialized or an error is encountered.
+     
+     @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive
+    */
+    PaError Pa_IsStreamStopped( PaStream *stream );
+
+
+    /** Determine whether the stream is active.
+     A stream is active after a successful call to Pa_StartStream(), until it
+     becomes inactive either as a result of a call to Pa_StopStream() or
+     Pa_AbortStream(), or as a result of a return value other than paContinue from
+     the stream callback. In the latter case, the stream is considered inactive
+     after the last buffer has finished playing.
+     
+     @return Returns one (1) when the stream is active (ie playing or recording
+     audio), zero (0) when not playing or, a PaErrorCode (which are always negative)
+     if PortAudio is not initialized or an error is encountered.
+     
+     @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped
+    */
+    PaError Pa_IsStreamActive( PaStream *stream );
+
+
+
+    /** A structure containing unchanging information about an open stream.
+     @see Pa_GetStreamInfo
+    */
+
+    typedef struct PaStreamInfo {
+        /** this is struct version 1 */
+        int structVersion;
+
+        /** The input latency of the stream in seconds. This value provides the most
+         accurate estimate of input latency available to the implementation. It may
+         differ significantly from the suggestedLatency value passed to Pa_OpenStream().
+         The value of this field will be zero (0.) for output-only streams.
+         @see PaTime
+        */
+        PaTime inputLatency;
+
+        /** The output latency of the stream in seconds. This value provides the most
+         accurate estimate of output latency available to the implementation. It may
+         differ significantly from the suggestedLatency value passed to Pa_OpenStream().
+         The value of this field will be zero (0.) for input-only streams.
+         @see PaTime
+        */
+        PaTime outputLatency;
+
+        /** The sample rate of the stream in Hertz (samples per second). In cases
+         where the hardware sample rate is inaccurate and PortAudio is aware of it,
+         the value of this field may be different from the sampleRate parameter
+         passed to Pa_OpenStream(). If information about the actual hardware sample
+         rate is not available, this field will have the same value as the sampleRate
+         parameter passed to Pa_OpenStream().
+        */
+        double sampleRate;
+
+    }
+    PaStreamInfo;
+
+
+    /** Retrieve a pointer to a PaStreamInfo structure containing information
+     about the specified stream.
+     @return A pointer to an immutable PaStreamInfo structure. If the stream
+     parameter invalid, or an error is encountered, the function returns NULL.
+     
+     @param stream A pointer to an open stream previously created with Pa_OpenStream.
+     
+     @note PortAudio manages the memory referenced by the returned pointer,
+     the client must not manipulate or free the memory. The pointer is only
+     guaranteed to be valid until the specified stream is closed.
+     
+     @see PaStreamInfo
+    */
+    const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream );
+
+
+    /** Determine the current time for the stream according to the same clock used
+     to generate buffer timestamps. This time may be used for syncronising other
+     events to the audio stream, for example synchronizing audio to MIDI.
+        
+     @return The stream's current time in seconds, or 0 if an error occurred.
+     
+     @see PaTime, PaStreamCallback
+    */
+    PaTime Pa_GetStreamTime( PaStream *stream );
+
+
+    /** Retrieve CPU usage information for the specified stream.
+     The "CPU Load" is a fraction of total CPU time consumed by a callback stream's
+     audio processing routines including, but not limited to the client supplied
+     stream callback. This function does not work with blocking read/write streams.
+     
+     This function may be called from the stream callback function or the
+     application.
+        
+     @return
+     A floating point value, typically between 0.0 and 1.0, where 1.0 indicates
+     that the stream callback is consuming the maximum number of CPU cycles possible
+     to maintain real-time operation. A value of 0.5 would imply that PortAudio and
+     the stream callback was consuming roughly 50% of the available CPU time. The
+     return value may exceed 1.0. A value of 0.0 will always be returned for a
+     blocking read/write stream, or if an error occurrs.
+    */
+    double Pa_GetStreamCpuLoad( PaStream* stream );
+
+
+    /** Read samples from an input stream. The function doesn't return until
+     the entire buffer has been filled - this may involve waiting for the operating
+     system to supply the data.
+     
+     @param stream A pointer to an open stream previously created with Pa_OpenStream.
+     
+     @param buffer A pointer to a buffer of sample frames. The buffer contains
+     samples in the format specified by the inputParameters->sampleFormat field
+     used to open the stream, and the number of channels specified by
+     inputParameters->numChannels. If non-interleaved samples were requested,
+     buffer is a pointer to the first element of an array of non-interleaved
+     buffer pointers, one for each channel.
+     
+     @param frames The number of frames to be read into buffer. This parameter
+     is not constrained to a specific range, however high performance applications
+     will want to match this parameter to the framesPerBuffer parameter used
+     when opening the stream.
+     
+     @return On success PaNoError will be returned, or PaInputOverflowed if input
+     data was discarded by PortAudio after the previous call and before this call.
+    */
+    PaError Pa_ReadStream( PaStream* stream,
+                           void *buffer,
+                           unsigned long frames );
+
+
+    /** Write samples to an output stream. This function doesn't return until the
+     entire buffer has been consumed - this may involve waiting for the operating
+     system to consume the data.
+     
+     @param stream A pointer to an open stream previously created with Pa_OpenStream.
+     
+     @param buffer A pointer to a buffer of sample frames. The buffer contains
+     samples in the format specified by the outputParameters->sampleFormat field
+     used to open the stream, and the number of channels specified by
+     outputParameters->numChannels. If non-interleaved samples were requested,
+     buffer is a pointer to the first element of an array of non-interleaved
+     buffer pointers, one for each channel.
+     
+     @param frames The number of frames to be written from buffer. This parameter
+     is not constrained to a specific range, however high performance applications
+     will want to match this parameter to the framesPerBuffer parameter used
+     when opening the stream.
+     
+     @return On success PaNoError will be returned, or paOutputUnderflowed if
+     additional output data was inserted after the previous call and before this
+     call.
+    */
+    PaError Pa_WriteStream( PaStream* stream,
+                            const void *buffer,
+                            unsigned long frames );
+
+
+    /** Retrieve the number of frames that can be read from the stream without
+     waiting.
+     
+     @return Returns a non-negative value representing the maximum number of frames
+     that can be read from the stream without blocking or busy waiting or, a
+     PaErrorCode (which are always negative) if PortAudio is not initialized or an
+     error is encountered.
+    */
+    signed long Pa_GetStreamReadAvailable( PaStream* stream );
+
+
+    /** Retrieve the number of frames that can be written to the stream without
+     waiting.
+     
+     @return Returns a non-negative value representing the maximum number of frames
+     that can be written to the stream without blocking or busy waiting or, a
+     PaErrorCode (which are always negative) if PortAudio is not initialized or an
+     error is encountered.
+    */
+    signed long Pa_GetStreamWriteAvailable( PaStream* stream );
+
+
+    /* Miscellaneous utilities */
+
+
+    /** Retrieve the size of a given sample format in bytes.
+     
+     @return The size in bytes of a single sample in the specified format,
+     or paSampleFormatNotSupported if the format is not supported.
+    */
+    PaError Pa_GetSampleSize( PaSampleFormat format );
+
+
+    /** Put the caller to sleep for at least 'msec' milliseconds. This function is
+     provided only as a convenience for authors of portable code (such as the tests
+     and examples in the PortAudio distribution.)
+     
+     The function may sleep longer than requested so don't rely on this for accurate
+     musical timing.
+    */
+    void Pa_Sleep( long msec );
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* PORTAUDIO_H */
diff --git a/windows/portaudio/portaudio_x86.lib b/windows/portaudio/portaudio_x86.lib
new file mode 100644
index 0000000..47d2551
Binary files /dev/null and b/windows/portaudio/portaudio_x86.lib differ
diff --git a/windows/regex.c b/windows/regex.c
new file mode 100644
index 0000000..db61116
--- /dev/null
+++ b/windows/regex.c
@@ -0,0 +1,4949 @@
+/* Extended regular expression matching and search library,
+   version 0.12.
+   (Implements POSIX draft P10003.2/D11.2, except for
+   internationalization features.)
+
+   Copyright (C) 1993 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* AIX requires this to be the first thing in the file. */
+#if defined (_AIX) && !defined (REGEX_MALLOC)
+  #pragma alloca
+#endif
+
+#define _GNU_SOURCE
+
+/* We need this for `regex.h', and perhaps for the Emacs include files.  */
+#include <sys/types.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* The `emacs' switch turns on certain matching commands
+   that make sense only in Emacs. */
+#ifdef emacs
+
+#include "lisp.h"
+#include "buffer.h"
+#include "syntax.h"
+
+/* Emacs uses `NULL' as a predicate.  */
+#undef NULL
+
+#else  /* not emacs */
+
+/* We used to test for `BSTRING' here, but only GCC and Emacs define
+   `BSTRING', as far as I know, and neither of them use this code.  */
+#if HAVE_STRING_H || STDC_HEADERS
+#include <string.h>
+#ifndef bcmp
+#define bcmp(s1, s2, n)	memcmp ((s1), (s2), (n))
+#endif
+#ifndef bcopy
+#define bcopy(s, d, n)	memcpy ((d), (s), (n))
+#endif
+#ifndef bzero
+#define bzero(s, n)	memset ((s), 0, (n))
+#endif
+#else
+#include <strings.h>
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#else
+char *malloc ();
+char *realloc ();
+#endif
+
+
+/* Define the syntax stuff for \<, \>, etc.  */
+
+/* This must be nonzero for the wordchar and notwordchar pattern
+   commands in re_match_2.  */
+#ifndef Sword 
+#define Sword 1
+#endif
+
+#ifdef SYNTAX_TABLE
+
+extern char *re_syntax_table;
+
+#else /* not SYNTAX_TABLE */
+
+/* How many characters in the character set.  */
+#define CHAR_SET_SIZE 256
+
+static char re_syntax_table[CHAR_SET_SIZE];
+
+static void
+init_syntax_once ()
+{
+   register int c;
+   static int done = 0;
+
+   if (done)
+     return;
+
+   bzero (re_syntax_table, sizeof re_syntax_table);
+
+   for (c = 'a'; c <= 'z'; c++)
+     re_syntax_table[c] = Sword;
+
+   for (c = 'A'; c <= 'Z'; c++)
+     re_syntax_table[c] = Sword;
+
+   for (c = '0'; c <= '9'; c++)
+     re_syntax_table[c] = Sword;
+
+   re_syntax_table['_'] = Sword;
+
+   done = 1;
+}
+
+#endif /* not SYNTAX_TABLE */
+
+#define SYNTAX(c) re_syntax_table[c]
+
+#endif /* not emacs */
+
+/* Get the interface, including the syntax bits.  */
+#include "regex.h"
+
+/* isalpha etc. are used for the character classes.  */
+#include <ctype.h>
+
+#ifndef isascii
+#define isascii(c) 1
+#endif
+
+#ifdef isblank
+#define ISBLANK(c) (isascii (c) && isblank (c))
+#else
+#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
+#endif
+#ifdef isgraph
+#define ISGRAPH(c) (isascii (c) && isgraph (c))
+#else
+#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
+#endif
+
+#define ISPRINT(c) (isascii (c) && isprint (c))
+#define ISDIGIT(c) (isascii (c) && isdigit (c))
+#define ISALNUM(c) (isascii (c) && isalnum (c))
+#define ISALPHA(c) (isascii (c) && isalpha (c))
+#define ISCNTRL(c) (isascii (c) && iscntrl (c))
+#define ISLOWER(c) (isascii (c) && islower (c))
+#define ISPUNCT(c) (isascii (c) && ispunct (c))
+#define ISSPACE(c) (isascii (c) && isspace (c))
+#define ISUPPER(c) (isascii (c) && isupper (c))
+#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* We remove any previous definition of `SIGN_EXTEND_CHAR',
+   since ours (we hope) works properly with all combinations of
+   machines, compilers, `char' and `unsigned char' argument types.
+   (Per Bothner suggested the basic approach.)  */
+#undef SIGN_EXTEND_CHAR
+#if __STDC__
+#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
+#else  /* not __STDC__ */
+/* As in Harbison and Steele.  */
+#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
+#endif
+
+/* Should we use malloc or alloca?  If REGEX_MALLOC is not defined, we
+   use `alloca' instead of `malloc'.  This is because using malloc in
+   re_search* or re_match* could cause memory leaks when C-g is used in
+   Emacs; also, malloc is slower and causes storage fragmentation.  On
+   the other hand, malloc is more portable, and easier to debug.  
+   
+   Because we sometimes use alloca, some routines have to be macros,
+   not functions -- `alloca'-allocated space disappears at the end of the
+   function it is called in.  */
+
+#ifdef REGEX_MALLOC
+
+#define REGEX_ALLOCATE malloc
+#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
+
+#else /* not REGEX_MALLOC  */
+
+/* Emacs already defines alloca, sometimes.  */
+#ifndef alloca
+
+/* Make alloca work the best possible way.  */
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#else /* not __GNUC__ */
+#if HAVE_ALLOCA_H
+#include <alloca.h>
+#else /* not __GNUC__ or HAVE_ALLOCA_H */
+#ifndef _AIX /* Already did AIX, up at the top.  */
+char *alloca ();
+#endif /* not _AIX */
+#endif /* not HAVE_ALLOCA_H */ 
+#endif /* not __GNUC__ */
+
+#endif /* not alloca */
+
+#define REGEX_ALLOCATE alloca
+
+/* Assumes a `char *destination' variable.  */
+#define REGEX_REALLOCATE(source, osize, nsize)				\
+  (destination = (char *) alloca (nsize),				\
+   bcopy (source, destination, osize),					\
+   destination)
+
+#endif /* not REGEX_MALLOC */
+
+
+/* True if `size1' is non-NULL and PTR is pointing anywhere inside
+   `string1' or just past its end.  This works if PTR is NULL, which is
+   a good thing.  */
+#define FIRST_STRING_P(ptr) 					\
+  (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
+
+/* (Re)Allocate N items of type T using malloc, or fail.  */
+#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
+#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
+#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
+
+#define BYTEWIDTH 8 /* In bits.  */
+
+#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+typedef char boolean;
+#define false 0
+#define true 1
+
+/* These are the command codes that appear in compiled regular
+   expressions.  Some opcodes are followed by argument bytes.  A
+   command code can specify any interpretation whatsoever for its
+   arguments.  Zero bytes may appear in the compiled regular expression.
+
+   The value of `exactn' is needed in search.c (search_buffer) in Emacs.
+   So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of
+   `exactn' we use here must also be 1.  */
+
+typedef enum
+{
+  no_op = 0,
+
+        /* Followed by one byte giving n, then by n literal bytes.  */
+  exactn = 1,
+
+        /* Matches any (more or less) character.  */
+  anychar,
+
+        /* Matches any one char belonging to specified set.  First
+           following byte is number of bitmap bytes.  Then come bytes
+           for a bitmap saying which chars are in.  Bits in each byte
+           are ordered low-bit-first.  A character is in the set if its
+           bit is 1.  A character too large to have a bit in the map is
+           automatically not in the set.  */
+  charset,
+
+        /* Same parameters as charset, but match any character that is
+           not one of those specified.  */
+  charset_not,
+
+        /* Start remembering the text that is matched, for storing in a
+           register.  Followed by one byte with the register number, in
+           the range 0 to one less than the pattern buffer's re_nsub
+           field.  Then followed by one byte with the number of groups
+           inner to this one.  (This last has to be part of the
+           start_memory only because we need it in the on_failure_jump
+           of re_match_2.)  */
+  start_memory,
+
+        /* Stop remembering the text that is matched and store it in a
+           memory register.  Followed by one byte with the register
+           number, in the range 0 to one less than `re_nsub' in the
+           pattern buffer, and one byte with the number of inner groups,
+           just like `start_memory'.  (We need the number of inner
+           groups here because we don't have any easy way of finding the
+           corresponding start_memory when we're at a stop_memory.)  */
+  stop_memory,
+
+        /* Match a duplicate of something remembered. Followed by one
+           byte containing the register number.  */
+  duplicate,
+
+        /* Fail unless at beginning of line.  */
+  begline,
+
+        /* Fail unless at end of line.  */
+  endline,
+
+        /* Succeeds if at beginning of buffer (if emacs) or at beginning
+           of string to be matched (if not).  */
+  begbuf,
+
+        /* Analogously, for end of buffer/string.  */
+  endbuf,
+ 
+        /* Followed by two byte relative address to which to jump.  */
+  jump, 
+
+	/* Same as jump, but marks the end of an alternative.  */
+  jump_past_alt,
+
+        /* Followed by two-byte relative address of place to resume at
+           in case of failure.  */
+  on_failure_jump,
+	
+        /* Like on_failure_jump, but pushes a placeholder instead of the
+           current string position when executed.  */
+  on_failure_keep_string_jump,
+  
+        /* Throw away latest failure point and then jump to following
+           two-byte relative address.  */
+  pop_failure_jump,
+
+        /* Change to pop_failure_jump if know won't have to backtrack to
+           match; otherwise change to jump.  This is used to jump
+           back to the beginning of a repeat.  If what follows this jump
+           clearly won't match what the repeat does, such that we can be
+           sure that there is no use backtracking out of repetitions
+           already matched, then we change it to a pop_failure_jump.
+           Followed by two-byte address.  */
+  maybe_pop_jump,
+
+        /* Jump to following two-byte address, and push a dummy failure
+           point. This failure point will be thrown away if an attempt
+           is made to use it for a failure.  A `+' construct makes this
+           before the first repeat.  Also used as an intermediary kind
+           of jump when compiling an alternative.  */
+  dummy_failure_jump,
+
+	/* Push a dummy failure point and continue.  Used at the end of
+	   alternatives.  */
+  push_dummy_failure,
+
+        /* Followed by two-byte relative address and two-byte number n.
+           After matching N times, jump to the address upon failure.  */
+  succeed_n,
+
+        /* Followed by two-byte relative address, and two-byte number n.
+           Jump to the address N times, then fail.  */
+  jump_n,
+
+        /* Set the following two-byte relative address to the
+           subsequent two-byte number.  The address *includes* the two
+           bytes of number.  */
+  set_number_at,
+
+  wordchar,	/* Matches any word-constituent character.  */
+  notwordchar,	/* Matches any char that is not a word-constituent.  */
+
+  wordbeg,	/* Succeeds if at word beginning.  */
+  wordend,	/* Succeeds if at word end.  */
+
+  wordbound,	/* Succeeds if at a word boundary.  */
+  notwordbound	/* Succeeds if not at a word boundary.  */
+
+#ifdef emacs
+  ,before_dot,	/* Succeeds if before point.  */
+  at_dot,	/* Succeeds if at point.  */
+  after_dot,	/* Succeeds if after point.  */
+
+	/* Matches any character whose syntax is specified.  Followed by
+           a byte which contains a syntax code, e.g., Sword.  */
+  syntaxspec,
+
+	/* Matches any character whose syntax is not that specified.  */
+  notsyntaxspec
+#endif /* emacs */
+} re_opcode_t;
+
+/* Common operations on the compiled pattern.  */
+
+/* Store NUMBER in two contiguous bytes starting at DESTINATION.  */
+
+#define STORE_NUMBER(destination, number)				\
+  do {									\
+    (destination)[0] = (number) & 0377;					\
+    (destination)[1] = (number) >> 8;					\
+  } while (0)
+
+/* Same as STORE_NUMBER, except increment DESTINATION to
+   the byte after where the number is stored.  Therefore, DESTINATION
+   must be an lvalue.  */
+
+#define STORE_NUMBER_AND_INCR(destination, number)			\
+  do {									\
+    STORE_NUMBER (destination, number);					\
+    (destination) += 2;							\
+  } while (0)
+
+/* Put into DESTINATION a number stored in two contiguous bytes starting
+   at SOURCE.  */
+
+#define EXTRACT_NUMBER(destination, source)				\
+  do {									\
+    (destination) = *(source) & 0377;					\
+    (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8;		\
+  } while (0)
+
+#ifdef DEBUG
+static void
+extract_number (dest, source)
+    int *dest;
+    unsigned char *source;
+{
+  int temp = SIGN_EXTEND_CHAR (*(source + 1)); 
+  *dest = *source & 0377;
+  *dest += temp << 8;
+}
+
+#ifndef EXTRACT_MACROS /* To debug the macros.  */
+#undef EXTRACT_NUMBER
+#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
+#endif /* not EXTRACT_MACROS */
+
+#endif /* DEBUG */
+
+/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
+   SOURCE must be an lvalue.  */
+
+#define EXTRACT_NUMBER_AND_INCR(destination, source)			\
+  do {									\
+    EXTRACT_NUMBER (destination, source);				\
+    (source) += 2; 							\
+  } while (0)
+
+#ifdef DEBUG
+static void
+extract_number_and_incr (destination, source)
+    int *destination;
+    unsigned char **source;
+{ 
+  extract_number (destination, *source);
+  *source += 2;
+}
+
+#ifndef EXTRACT_MACROS
+#undef EXTRACT_NUMBER_AND_INCR
+#define EXTRACT_NUMBER_AND_INCR(dest, src) \
+  extract_number_and_incr (&dest, &src)
+#endif /* not EXTRACT_MACROS */
+
+#endif /* DEBUG */
+
+/* If DEBUG is defined, Regex prints many voluminous messages about what
+   it is doing (if the variable `debug' is nonzero).  If linked with the
+   main program in `iregex.c', you can enter patterns and strings
+   interactively.  And if linked with the main program in `main.c' and
+   the other test files, you can run the already-written tests.  */
+
+#ifdef DEBUG
+
+/* We use standard I/O for debugging.  */
+#include <stdio.h>
+
+/* It is useful to test things that ``must'' be true when debugging.  */
+#include <assert.h>
+
+static int debug = 0;
+
+#define DEBUG_STATEMENT(e) e
+#define DEBUG_PRINT1(x) if (debug) printf (x)
+#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
+#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
+#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
+#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) 				\
+  if (debug) print_partial_compiled_pattern (s, e)
+#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)			\
+  if (debug) print_double_string (w, s1, sz1, s2, sz2)
+
+
+//extern void printchar ();
+void printchar( int i ) {}
+
+/* Print the fastmap in human-readable form.  */
+
+void
+print_fastmap (fastmap)
+    char *fastmap;
+{
+  unsigned was_a_range = 0;
+  unsigned i = 0;  
+  
+  while (i < (1 << BYTEWIDTH))
+    {
+      if (fastmap[i++])
+	{
+	  was_a_range = 0;
+          printchar (i - 1);
+          while (i < (1 << BYTEWIDTH)  &&  fastmap[i])
+            {
+              was_a_range = 1;
+              i++;
+            }
+	  if (was_a_range)
+            {
+              printf ("-");
+              printchar (i - 1);
+            }
+        }
+    }
+  putchar ('\n'); 
+}
+
+
+/* Print a compiled pattern string in human-readable form, starting at
+   the START pointer into it and ending just before the pointer END.  */
+
+void
+print_partial_compiled_pattern (start, end)
+    unsigned char *start;
+    unsigned char *end;
+{
+  int mcnt, mcnt2;
+  unsigned char *p = start;
+  unsigned char *pend = end;
+
+  if (start == NULL)
+    {
+      printf ("(null)\n");
+      return;
+    }
+    
+  /* Loop over pattern commands.  */
+  while (p < pend)
+    {
+      switch ((re_opcode_t) *p++)
+	{
+        case no_op:
+          printf ("/no_op");
+          break;
+
+	case exactn:
+	  mcnt = *p++;
+          printf ("/exactn/%d", mcnt);
+          do
+	    {
+              putchar ('/');
+	      printchar (*p++);
+            }
+          while (--mcnt);
+          break;
+
+	case start_memory:
+          mcnt = *p++;
+          printf ("/start_memory/%d/%d", mcnt, *p++);
+          break;
+
+	case stop_memory:
+          mcnt = *p++;
+	  printf ("/stop_memory/%d/%d", mcnt, *p++);
+          break;
+
+	case duplicate:
+	  printf ("/duplicate/%d", *p++);
+	  break;
+
+	case anychar:
+	  printf ("/anychar");
+	  break;
+
+	case charset:
+        case charset_not:
+          {
+            register int c;
+
+            printf ("/charset%s",
+	            (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
+            
+            assert (p + *p < pend);
+
+            for (c = 0; c < *p; c++)
+              {
+                unsigned bit;
+                unsigned char map_byte = p[1 + c];
+                
+                putchar ('/');
+
+		for (bit = 0; bit < BYTEWIDTH; bit++)
+                  if (map_byte & (1 << bit))
+                    printchar (c * BYTEWIDTH + bit);
+              }
+	    p += 1 + *p;
+	    break;
+	  }
+
+	case begline:
+	  printf ("/begline");
+          break;
+
+	case endline:
+          printf ("/endline");
+          break;
+
+	case on_failure_jump:
+          extract_number_and_incr (&mcnt, &p);
+  	  printf ("/on_failure_jump/0/%d", mcnt);
+          break;
+
+	case on_failure_keep_string_jump:
+          extract_number_and_incr (&mcnt, &p);
+  	  printf ("/on_failure_keep_string_jump/0/%d", mcnt);
+          break;
+
+	case dummy_failure_jump:
+          extract_number_and_incr (&mcnt, &p);
+  	  printf ("/dummy_failure_jump/0/%d", mcnt);
+          break;
+
+	case push_dummy_failure:
+          printf ("/push_dummy_failure");
+          break;
+          
+        case maybe_pop_jump:
+          extract_number_and_incr (&mcnt, &p);
+  	  printf ("/maybe_pop_jump/0/%d", mcnt);
+	  break;
+
+        case pop_failure_jump:
+	  extract_number_and_incr (&mcnt, &p);
+  	  printf ("/pop_failure_jump/0/%d", mcnt);
+	  break;          
+          
+        case jump_past_alt:
+	  extract_number_and_incr (&mcnt, &p);
+  	  printf ("/jump_past_alt/0/%d", mcnt);
+	  break;          
+          
+        case jump:
+	  extract_number_and_incr (&mcnt, &p);
+  	  printf ("/jump/0/%d", mcnt);
+	  break;
+
+        case succeed_n: 
+          extract_number_and_incr (&mcnt, &p);
+          extract_number_and_incr (&mcnt2, &p);
+ 	  printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2);
+          break;
+        
+        case jump_n: 
+          extract_number_and_incr (&mcnt, &p);
+          extract_number_and_incr (&mcnt2, &p);
+ 	  printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2);
+          break;
+        
+        case set_number_at: 
+          extract_number_and_incr (&mcnt, &p);
+          extract_number_and_incr (&mcnt2, &p);
+ 	  printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2);
+          break;
+        
+        case wordbound:
+	  printf ("/wordbound");
+	  break;
+
+	case notwordbound:
+	  printf ("/notwordbound");
+          break;
+
+	case wordbeg:
+	  printf ("/wordbeg");
+	  break;
+          
+	case wordend:
+	  printf ("/wordend");
+          
+#ifdef emacs
+	case before_dot:
+	  printf ("/before_dot");
+          break;
+
+	case at_dot:
+	  printf ("/at_dot");
+          break;
+
+	case after_dot:
+	  printf ("/after_dot");
+          break;
+
+	case syntaxspec:
+          printf ("/syntaxspec");
+	  mcnt = *p++;
+	  printf ("/%d", mcnt);
+          break;
+	  
+	case notsyntaxspec:
+          printf ("/notsyntaxspec");
+	  mcnt = *p++;
+	  printf ("/%d", mcnt);
+	  break;
+#endif /* emacs */
+
+	case wordchar:
+	  printf ("/wordchar");
+          break;
+	  
+	case notwordchar:
+	  printf ("/notwordchar");
+          break;
+
+	case begbuf:
+	  printf ("/begbuf");
+          break;
+
+	case endbuf:
+	  printf ("/endbuf");
+          break;
+
+        default:
+          printf ("?%d", *(p-1));
+	}
+    }
+  printf ("/\n");
+}
+
+
+void
+print_compiled_pattern (bufp)
+    struct re_pattern_buffer *bufp;
+{
+  unsigned char *buffer = bufp->buffer;
+
+  print_partial_compiled_pattern (buffer, buffer + bufp->used);
+  printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated);
+
+  if (bufp->fastmap_accurate && bufp->fastmap)
+    {
+      printf ("fastmap: ");
+      print_fastmap (bufp->fastmap);
+    }
+
+  printf ("re_nsub: %d\t", bufp->re_nsub);
+  printf ("regs_alloc: %d\t", bufp->regs_allocated);
+  printf ("can_be_null: %d\t", bufp->can_be_null);
+  printf ("newline_anchor: %d\n", bufp->newline_anchor);
+  printf ("no_sub: %d\t", bufp->no_sub);
+  printf ("not_bol: %d\t", bufp->not_bol);
+  printf ("not_eol: %d\t", bufp->not_eol);
+  printf ("syntax: %d\n", bufp->syntax);
+  /* Perhaps we should print the translate table?  */
+}
+
+
+void
+print_double_string (where, string1, size1, string2, size2)
+    const char *where;
+    const char *string1;
+    const char *string2;
+    int size1;
+    int size2;
+{
+  unsigned this_char;
+  
+  if (where == NULL)
+    printf ("(null)");
+  else
+    {
+      if (FIRST_STRING_P (where))
+        {
+          for (this_char = where - string1; this_char < size1; this_char++)
+            printchar (string1[this_char]);
+
+          where = string2;    
+        }
+
+      for (this_char = where - string2; this_char < size2; this_char++)
+        printchar (string2[this_char]);
+    }
+}
+
+#else /* not DEBUG */
+
+#undef assert
+#define assert(e)
+
+#define DEBUG_STATEMENT(e)
+#define DEBUG_PRINT1(x)
+#define DEBUG_PRINT2(x1, x2)
+#define DEBUG_PRINT3(x1, x2, x3)
+#define DEBUG_PRINT4(x1, x2, x3, x4)
+#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
+#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
+
+#endif /* not DEBUG */
+
+/* Set by `re_set_syntax' to the current regexp syntax to recognize.  Can
+   also be assigned to arbitrarily: each pattern buffer stores its own
+   syntax, so it can be changed between regex compilations.  */
+reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
+
+
+/* Specify the precise syntax of regexps for compilation.  This provides
+   for compatibility for various utilities which historically have
+   different, incompatible syntaxes.
+
+   The argument SYNTAX is a bit mask comprised of the various bits
+   defined in regex.h.  We return the old syntax.  */
+
+reg_syntax_t
+re_set_syntax (syntax)
+    reg_syntax_t syntax;
+{
+  reg_syntax_t ret = re_syntax_options;
+  
+  re_syntax_options = syntax;
+  return ret;
+}
+
+/* This table gives an error message for each of the error codes listed
+   in regex.h.  Obviously the order here has to be same as there.  */
+
+static const char *re_error_msg[] =
+  { NULL,					/* REG_NOERROR */
+    "No match",					/* REG_NOMATCH */
+    "Invalid regular expression",		/* REG_BADPAT */
+    "Invalid collation character",		/* REG_ECOLLATE */
+    "Invalid character class name",		/* REG_ECTYPE */
+    "Trailing backslash",			/* REG_EESCAPE */
+    "Invalid back reference",			/* REG_ESUBREG */
+    "Unmatched [ or [^",			/* REG_EBRACK */
+    "Unmatched ( or \\(",			/* REG_EPAREN */
+    "Unmatched \\{",				/* REG_EBRACE */
+    "Invalid content of \\{\\}",		/* REG_BADBR */
+    "Invalid range end",			/* REG_ERANGE */
+    "Memory exhausted",				/* REG_ESPACE */
+    "Invalid preceding regular expression",	/* REG_BADRPT */
+    "Premature end of regular expression",	/* REG_EEND */
+    "Regular expression too big",		/* REG_ESIZE */
+    "Unmatched ) or \\)",			/* REG_ERPAREN */
+  };
+
+/* Subroutine declarations and macros for regex_compile.  */
+
+static void store_op1 (), store_op2 ();
+static void insert_op1 (), insert_op2 ();
+static boolean at_begline_loc_p (), at_endline_loc_p ();
+static boolean group_in_compile_stack ();
+static reg_errcode_t compile_range ();
+
+/* Fetch the next character in the uncompiled pattern---translating it 
+   if necessary.  Also cast from a signed character in the constant
+   string passed to us by the user to an unsigned char that we can use
+   as an array index (in, e.g., `translate').  */
+#define PATFETCH(c)							\
+  do {if (p == pend) return REG_EEND;					\
+    c = (unsigned char) *p++;						\
+    if (translate) c = translate[c]; 					\
+  } while (0)
+
+/* Fetch the next character in the uncompiled pattern, with no
+   translation.  */
+#define PATFETCH_RAW(c)							\
+  do {if (p == pend) return REG_EEND;					\
+    c = (unsigned char) *p++; 						\
+  } while (0)
+
+/* Go backwards one character in the pattern.  */
+#define PATUNFETCH p--
+
+
+/* If `translate' is non-null, return translate[D], else just D.  We
+   cast the subscript to translate because some data is declared as
+   `char *', to avoid warnings when a string constant is passed.  But
+   when we use a character as a subscript we must make it unsigned.  */
+#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d))
+
+
+/* Macros for outputting the compiled pattern into `buffer'.  */
+
+/* If the buffer isn't allocated when it comes in, use this.  */
+#define INIT_BUF_SIZE  32
+
+/* Make sure we have at least N more bytes of space in buffer.  */
+#define GET_BUFFER_SPACE(n)						\
+    while (b - bufp->buffer + (n) > bufp->allocated)			\
+      EXTEND_BUFFER ()
+
+/* Make sure we have one more byte of buffer space and then add C to it.  */
+#define BUF_PUSH(c)							\
+  do {									\
+    GET_BUFFER_SPACE (1);						\
+    *b++ = (unsigned char) (c);						\
+  } while (0)
+
+
+/* Ensure we have two more bytes of buffer space and then append C1 and C2.  */
+#define BUF_PUSH_2(c1, c2)						\
+  do {									\
+    GET_BUFFER_SPACE (2);						\
+    *b++ = (unsigned char) (c1);					\
+    *b++ = (unsigned char) (c2);					\
+  } while (0)
+
+
+/* As with BUF_PUSH_2, except for three bytes.  */
+#define BUF_PUSH_3(c1, c2, c3)						\
+  do {									\
+    GET_BUFFER_SPACE (3);						\
+    *b++ = (unsigned char) (c1);					\
+    *b++ = (unsigned char) (c2);					\
+    *b++ = (unsigned char) (c3);					\
+  } while (0)
+
+
+/* Store a jump with opcode OP at LOC to location TO.  We store a
+   relative address offset by the three bytes the jump itself occupies.  */
+#define STORE_JUMP(op, loc, to) \
+  store_op1 (op, loc, (to) - (loc) - 3)
+
+/* Likewise, for a two-argument jump.  */
+#define STORE_JUMP2(op, loc, to, arg) \
+  store_op2 (op, loc, (to) - (loc) - 3, arg)
+
+/* Like `STORE_JUMP', but for inserting.  Assume `b' is the buffer end.  */
+#define INSERT_JUMP(op, loc, to) \
+  insert_op1 (op, loc, (to) - (loc) - 3, b)
+
+/* Like `STORE_JUMP2', but for inserting.  Assume `b' is the buffer end.  */
+#define INSERT_JUMP2(op, loc, to, arg) \
+  insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
+
+
+/* This is not an arbitrary limit: the arguments which represent offsets
+   into the pattern are two bytes long.  So if 2^16 bytes turns out to
+   be too small, many things would have to change.  */
+#define MAX_BUF_SIZE (1L << 16)
+
+
+/* Extend the buffer by twice its current size via realloc and
+   reset the pointers that pointed into the old block to point to the
+   correct places in the new one.  If extending the buffer results in it
+   being larger than MAX_BUF_SIZE, then flag memory exhausted.  */
+#define EXTEND_BUFFER()							\
+  do { 									\
+    unsigned char *old_buffer = bufp->buffer;				\
+    if (bufp->allocated == MAX_BUF_SIZE) 				\
+      return REG_ESIZE;							\
+    bufp->allocated <<= 1;						\
+    if (bufp->allocated > MAX_BUF_SIZE)					\
+      bufp->allocated = MAX_BUF_SIZE; 					\
+    bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
+    if (bufp->buffer == NULL)						\
+      return REG_ESPACE;						\
+    /* If the buffer moved, move all the pointers into it.  */		\
+    if (old_buffer != bufp->buffer)					\
+      {									\
+        b = (b - old_buffer) + bufp->buffer;				\
+        begalt = (begalt - old_buffer) + bufp->buffer;			\
+        if (fixup_alt_jump)						\
+          fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
+        if (laststart)							\
+          laststart = (laststart - old_buffer) + bufp->buffer;		\
+        if (pending_exact)						\
+          pending_exact = (pending_exact - old_buffer) + bufp->buffer;	\
+      }									\
+  } while (0)
+
+
+/* Since we have one byte reserved for the register number argument to
+   {start,stop}_memory, the maximum number of groups we can report
+   things about is what fits in that byte.  */
+#define MAX_REGNUM 255
+
+/* But patterns can have more than `MAX_REGNUM' registers.  We just
+   ignore the excess.  */
+typedef unsigned regnum_t;
+
+
+/* Macros for the compile stack.  */
+
+/* Since offsets can go either forwards or backwards, this type needs to
+   be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1.  */
+typedef int pattern_offset_t;
+
+typedef struct
+{
+  pattern_offset_t begalt_offset;
+  pattern_offset_t fixup_alt_jump;
+  pattern_offset_t inner_group_offset;
+  pattern_offset_t laststart_offset;  
+  regnum_t regnum;
+} compile_stack_elt_t;
+
+
+typedef struct
+{
+  compile_stack_elt_t *stack;
+  unsigned size;
+  unsigned avail;			/* Offset of next open position.  */
+} compile_stack_type;
+
+
+#define INIT_COMPILE_STACK_SIZE 32
+
+#define COMPILE_STACK_EMPTY  (compile_stack.avail == 0)
+#define COMPILE_STACK_FULL  (compile_stack.avail == compile_stack.size)
+
+/* The next available element.  */
+#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
+
+
+/* Set the bit for character C in a list.  */
+#define SET_LIST_BIT(c)                               \
+  (b[((unsigned char) (c)) / BYTEWIDTH]               \
+   |= 1 << (((unsigned char) c) % BYTEWIDTH))
+
+
+/* Get the next unsigned number in the uncompiled pattern.  */
+#define GET_UNSIGNED_NUMBER(num) 					\
+  { if (p != pend)							\
+     {									\
+       PATFETCH (c); 							\
+       while (ISDIGIT (c)) 						\
+         { 								\
+           if (num < 0)							\
+              num = 0;							\
+           num = num * 10 + c - '0'; 					\
+           if (p == pend) 						\
+              break; 							\
+           PATFETCH (c);						\
+         } 								\
+       } 								\
+    }		
+
+#define CHAR_CLASS_MAX_LENGTH  6 /* Namely, `xdigit'.  */
+
+#define IS_CHAR_CLASS(string)						\
+   (STREQ (string, "alpha") || STREQ (string, "upper")			\
+    || STREQ (string, "lower") || STREQ (string, "digit")		\
+    || STREQ (string, "alnum") || STREQ (string, "xdigit")		\
+    || STREQ (string, "space") || STREQ (string, "print")		\
+    || STREQ (string, "punct") || STREQ (string, "graph")		\
+    || STREQ (string, "cntrl") || STREQ (string, "blank"))
+
+/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
+   Returns one of error codes defined in `regex.h', or zero for success.
+
+   Assumes the `allocated' (and perhaps `buffer') and `translate'
+   fields are set in BUFP on entry.
+
+   If it succeeds, results are put in BUFP (if it returns an error, the
+   contents of BUFP are undefined):
+     `buffer' is the compiled pattern;
+     `syntax' is set to SYNTAX;
+     `used' is set to the length of the compiled pattern;
+     `fastmap_accurate' is zero;
+     `re_nsub' is the number of subexpressions in PATTERN;
+     `not_bol' and `not_eol' are zero;
+   
+   The `fastmap' and `newline_anchor' fields are neither
+   examined nor set.  */
+
+static reg_errcode_t
+regex_compile (pattern, size, syntax, bufp)
+     const char *pattern;
+     int size;
+     reg_syntax_t syntax;
+     struct re_pattern_buffer *bufp;
+{
+  /* We fetch characters from PATTERN here.  Even though PATTERN is
+     `char *' (i.e., signed), we declare these variables as unsigned, so
+     they can be reliably used as array indices.  */
+  register unsigned char c, c1;
+  
+  /* A random tempory spot in PATTERN.  */
+  const char *p1;
+
+  /* Points to the end of the buffer, where we should append.  */
+  register unsigned char *b;
+  
+  /* Keeps track of unclosed groups.  */
+  compile_stack_type compile_stack;
+
+  /* Points to the current (ending) position in the pattern.  */
+  const char *p = pattern;
+  const char *pend = pattern + size;
+  
+  /* How to translate the characters in the pattern.  */
+  char *translate = bufp->translate;
+
+  /* Address of the count-byte of the most recently inserted `exactn'
+     command.  This makes it possible to tell if a new exact-match
+     character can be added to that command or if the character requires
+     a new `exactn' command.  */
+  unsigned char *pending_exact = 0;
+
+  /* Address of start of the most recently finished expression.
+     This tells, e.g., postfix * where to find the start of its
+     operand.  Reset at the beginning of groups and alternatives.  */
+  unsigned char *laststart = 0;
+
+  /* Address of beginning of regexp, or inside of last group.  */
+  unsigned char *begalt;
+
+  /* Place in the uncompiled pattern (i.e., the {) to
+     which to go back if the interval is invalid.  */
+  const char *beg_interval;
+                
+  /* Address of the place where a forward jump should go to the end of
+     the containing expression.  Each alternative of an `or' -- except the
+     last -- ends with a forward jump of this sort.  */
+  unsigned char *fixup_alt_jump = 0;
+
+  /* Counts open-groups as they are encountered.  Remembered for the
+     matching close-group on the compile stack, so the same register
+     number is put in the stop_memory as the start_memory.  */
+  regnum_t regnum = 0;
+
+#ifdef DEBUG
+  DEBUG_PRINT1 ("\nCompiling pattern: ");
+  if (debug)
+    {
+      unsigned debug_count;
+      
+      for (debug_count = 0; debug_count < size; debug_count++)
+        printchar (pattern[debug_count]);
+      putchar ('\n');
+    }
+#endif /* DEBUG */
+
+  /* Initialize the compile stack.  */
+  compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
+  if (compile_stack.stack == NULL)
+    return REG_ESPACE;
+
+  compile_stack.size = INIT_COMPILE_STACK_SIZE;
+  compile_stack.avail = 0;
+
+  /* Initialize the pattern buffer.  */
+  bufp->syntax = syntax;
+  bufp->fastmap_accurate = 0;
+  bufp->not_bol = bufp->not_eol = 0;
+
+  /* Set `used' to zero, so that if we return an error, the pattern
+     printer (for debugging) will think there's no pattern.  We reset it
+     at the end.  */
+  bufp->used = 0;
+  
+  /* Always count groups, whether or not bufp->no_sub is set.  */
+  bufp->re_nsub = 0;				
+
+#if !defined (emacs) && !defined (SYNTAX_TABLE)
+  /* Initialize the syntax table.  */
+   init_syntax_once ();
+#endif
+
+  if (bufp->allocated == 0)
+    {
+      if (bufp->buffer)
+	{ /* If zero allocated, but buffer is non-null, try to realloc
+             enough space.  This loses if buffer's address is bogus, but
+             that is the user's responsibility.  */
+          RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
+        }
+      else
+        { /* Caller did not allocate a buffer.  Do it for them.  */
+          bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
+        }
+      if (!bufp->buffer) return REG_ESPACE;
+
+      bufp->allocated = INIT_BUF_SIZE;
+    }
+
+  begalt = b = bufp->buffer;
+
+  /* Loop through the uncompiled pattern until we're at the end.  */
+  while (p != pend)
+    {
+      PATFETCH (c);
+
+      switch (c)
+        {
+        case '^':
+          {
+            if (   /* If at start of pattern, it's an operator.  */
+                   p == pattern + 1
+                   /* If context independent, it's an operator.  */
+                || syntax & RE_CONTEXT_INDEP_ANCHORS
+                   /* Otherwise, depends on what's come before.  */
+                || at_begline_loc_p (pattern, p, syntax))
+              BUF_PUSH (begline);
+            else
+              goto normal_char;
+          }
+          break;
+
+
+        case '$':
+          {
+            if (   /* If at end of pattern, it's an operator.  */
+                   p == pend 
+                   /* If context independent, it's an operator.  */
+                || syntax & RE_CONTEXT_INDEP_ANCHORS
+                   /* Otherwise, depends on what's next.  */
+                || at_endline_loc_p (p, pend, syntax))
+               BUF_PUSH (endline);
+             else
+               goto normal_char;
+           }
+           break;
+
+
+	case '+':
+        case '?':
+          if ((syntax & RE_BK_PLUS_QM)
+              || (syntax & RE_LIMITED_OPS))
+            goto normal_char;
+        handle_plus:
+        case '*':
+          /* If there is no previous pattern... */
+          if (!laststart)
+            {
+              if (syntax & RE_CONTEXT_INVALID_OPS)
+                return REG_BADRPT;
+              else if (!(syntax & RE_CONTEXT_INDEP_OPS))
+                goto normal_char;
+            }
+
+          {
+            /* Are we optimizing this jump?  */
+            boolean keep_string_p = false;
+            
+            /* 1 means zero (many) matches is allowed.  */
+            char zero_times_ok = 0, many_times_ok = 0;
+
+            /* If there is a sequence of repetition chars, collapse it
+               down to just one (the right one).  We can't combine
+               interval operators with these because of, e.g., `a{2}*',
+               which should only match an even number of `a's.  */
+
+            for (;;)
+              {
+                zero_times_ok |= c != '+';
+                many_times_ok |= c != '?';
+
+                if (p == pend)
+                  break;
+
+                PATFETCH (c);
+
+                if (c == '*'
+                    || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
+                  ;
+
+                else if (syntax & RE_BK_PLUS_QM  &&  c == '\\')
+                  {
+                    if (p == pend) return REG_EESCAPE;
+
+                    PATFETCH (c1);
+                    if (!(c1 == '+' || c1 == '?'))
+                      {
+                        PATUNFETCH;
+                        PATUNFETCH;
+                        break;
+                      }
+
+                    c = c1;
+                  }
+                else
+                  {
+                    PATUNFETCH;
+                    break;
+                  }
+
+                /* If we get here, we found another repeat character.  */
+               }
+
+            /* Star, etc. applied to an empty pattern is equivalent
+               to an empty pattern.  */
+            if (!laststart)  
+              break;
+
+            /* Now we know whether or not zero matches is allowed
+               and also whether or not two or more matches is allowed.  */
+            if (many_times_ok)
+              { /* More than one repetition is allowed, so put in at the
+                   end a backward relative jump from `b' to before the next
+                   jump we're going to put in below (which jumps from
+                   laststart to after this jump).  
+
+                   But if we are at the `*' in the exact sequence `.*\n',
+                   insert an unconditional jump backwards to the .,
+                   instead of the beginning of the loop.  This way we only
+                   push a failure point once, instead of every time
+                   through the loop.  */
+                assert (p - 1 > pattern);
+
+                /* Allocate the space for the jump.  */
+                GET_BUFFER_SPACE (3);
+
+                /* We know we are not at the first character of the pattern,
+                   because laststart was nonzero.  And we've already
+                   incremented `p', by the way, to be the character after
+                   the `*'.  Do we have to do something analogous here
+                   for null bytes, because of RE_DOT_NOT_NULL?  */
+                if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
+		    && zero_times_ok
+                    && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
+                    && !(syntax & RE_DOT_NEWLINE))
+                  { /* We have .*\n.  */
+                    STORE_JUMP (jump, b, laststart);
+                    keep_string_p = true;
+                  }
+                else
+                  /* Anything else.  */
+                  STORE_JUMP (maybe_pop_jump, b, laststart - 3);
+
+                /* We've added more stuff to the buffer.  */
+                b += 3;
+              }
+
+            /* On failure, jump from laststart to b + 3, which will be the
+               end of the buffer after this jump is inserted.  */
+            GET_BUFFER_SPACE (3);
+            INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
+                                       : on_failure_jump,
+                         laststart, b + 3);
+            pending_exact = 0;
+            b += 3;
+
+            if (!zero_times_ok)
+              {
+                /* At least one repetition is required, so insert a
+                   `dummy_failure_jump' before the initial
+                   `on_failure_jump' instruction of the loop. This
+                   effects a skip over that instruction the first time
+                   we hit that loop.  */
+                GET_BUFFER_SPACE (3);
+                INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6);
+                b += 3;
+              }
+            }
+	  break;
+
+
+	case '.':
+          laststart = b;
+          BUF_PUSH (anychar);
+          break;
+
+
+        case '[':
+          {
+            boolean had_char_class = false;
+
+            if (p == pend) return REG_EBRACK;
+
+            /* Ensure that we have enough space to push a charset: the
+               opcode, the length count, and the bitset; 34 bytes in all.  */
+	    GET_BUFFER_SPACE (34);
+
+            laststart = b;
+
+            /* We test `*p == '^' twice, instead of using an if
+               statement, so we only need one BUF_PUSH.  */
+            BUF_PUSH (*p == '^' ? charset_not : charset); 
+            if (*p == '^')
+              p++;
+
+            /* Remember the first position in the bracket expression.  */
+            p1 = p;
+
+            /* Push the number of bytes in the bitmap.  */
+            BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
+
+            /* Clear the whole map.  */
+            bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
+
+            /* charset_not matches newline according to a syntax bit.  */
+            if ((re_opcode_t) b[-2] == charset_not
+                && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
+              SET_LIST_BIT ('\n');
+
+            /* Read in characters and ranges, setting map bits.  */
+            for (;;)
+              {
+                if (p == pend) return REG_EBRACK;
+
+                PATFETCH (c);
+
+                /* \ might escape characters inside [...] and [^...].  */
+                if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
+                  {
+                    if (p == pend) return REG_EESCAPE;
+
+                    PATFETCH (c1);
+                    SET_LIST_BIT (c1);
+                    continue;
+                  }
+
+                /* Could be the end of the bracket expression.  If it's
+                   not (i.e., when the bracket expression is `[]' so
+                   far), the ']' character bit gets set way below.  */
+                if (c == ']' && p != p1 + 1)
+                  break;
+
+                /* Look ahead to see if it's a range when the last thing
+                   was a character class.  */
+                if (had_char_class && c == '-' && *p != ']')
+                  return REG_ERANGE;
+
+                /* Look ahead to see if it's a range when the last thing
+                   was a character: if this is a hyphen not at the
+                   beginning or the end of a list, then it's the range
+                   operator.  */
+                if (c == '-' 
+                    && !(p - 2 >= pattern && p[-2] == '[') 
+                    && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
+                    && *p != ']')
+                  {
+                    reg_errcode_t ret
+                      = compile_range (&p, pend, translate, syntax, b);
+                    if (ret != REG_NOERROR) return ret;
+                  }
+
+                else if (p[0] == '-' && p[1] != ']')
+                  { /* This handles ranges made up of characters only.  */
+                    reg_errcode_t ret;
+
+		    /* Move past the `-'.  */
+                    PATFETCH (c1);
+                    
+                    ret = compile_range (&p, pend, translate, syntax, b);
+                    if (ret != REG_NOERROR) return ret;
+                  }
+
+                /* See if we're at the beginning of a possible character
+                   class.  */
+
+                else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
+                  { /* Leave room for the null.  */
+                    char str[CHAR_CLASS_MAX_LENGTH + 1];
+
+                    PATFETCH (c);
+                    c1 = 0;
+
+                    /* If pattern is `[[:'.  */
+                    if (p == pend) return REG_EBRACK;
+
+                    for (;;)
+                      {
+                        PATFETCH (c);
+                        if (c == ':' || c == ']' || p == pend
+                            || c1 == CHAR_CLASS_MAX_LENGTH)
+                          break;
+                        str[c1++] = c;
+                      }
+                    str[c1] = '\0';
+
+                    /* If isn't a word bracketed by `[:' and:`]':
+                       undo the ending character, the letters, and leave 
+                       the leading `:' and `[' (but set bits for them).  */
+                    if (c == ':' && *p == ']')
+                      {
+                        int ch;
+                        boolean is_alnum = STREQ (str, "alnum");
+                        boolean is_alpha = STREQ (str, "alpha");
+                        boolean is_blank = STREQ (str, "blank");
+                        boolean is_cntrl = STREQ (str, "cntrl");
+                        boolean is_digit = STREQ (str, "digit");
+                        boolean is_graph = STREQ (str, "graph");
+                        boolean is_lower = STREQ (str, "lower");
+                        boolean is_print = STREQ (str, "print");
+                        boolean is_punct = STREQ (str, "punct");
+                        boolean is_space = STREQ (str, "space");
+                        boolean is_upper = STREQ (str, "upper");
+                        boolean is_xdigit = STREQ (str, "xdigit");
+                        
+                        if (!IS_CHAR_CLASS (str)) return REG_ECTYPE;
+
+                        /* Throw away the ] at the end of the character
+                           class.  */
+                        PATFETCH (c);					
+
+                        if (p == pend) return REG_EBRACK;
+
+                        for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
+                          {
+                            if (   (is_alnum  && ISALNUM (ch))
+                                || (is_alpha  && ISALPHA (ch))
+                                || (is_blank  && ISBLANK (ch))
+                                || (is_cntrl  && ISCNTRL (ch))
+                                || (is_digit  && ISDIGIT (ch))
+                                || (is_graph  && ISGRAPH (ch))
+                                || (is_lower  && ISLOWER (ch))
+                                || (is_print  && ISPRINT (ch))
+                                || (is_punct  && ISPUNCT (ch))
+                                || (is_space  && ISSPACE (ch))
+                                || (is_upper  && ISUPPER (ch))
+                                || (is_xdigit && ISXDIGIT (ch)))
+                            SET_LIST_BIT (ch);
+                          }
+                        had_char_class = true;
+                      }
+                    else
+                      {
+                        c1++;
+                        while (c1--)    
+                          PATUNFETCH;
+                        SET_LIST_BIT ('[');
+                        SET_LIST_BIT (':');
+                        had_char_class = false;
+                      }
+                  }
+                else
+                  {
+                    had_char_class = false;
+                    SET_LIST_BIT (c);
+                  }
+              }
+
+            /* Discard any (non)matching list bytes that are all 0 at the
+               end of the map.  Decrease the map-length byte too.  */
+            while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) 
+              b[-1]--; 
+            b += b[-1];
+          }
+          break;
+
+
+	case '(':
+          if (syntax & RE_NO_BK_PARENS)
+            goto handle_open;
+          else
+            goto normal_char;
+
+
+        case ')':
+          if (syntax & RE_NO_BK_PARENS)
+            goto handle_close;
+          else
+            goto normal_char;
+
+
+        case '\n':
+          if (syntax & RE_NEWLINE_ALT)
+            goto handle_alt;
+          else
+            goto normal_char;
+
+
+	case '|':
+          if (syntax & RE_NO_BK_VBAR)
+            goto handle_alt;
+          else
+            goto normal_char;
+
+
+        case '{':
+           if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
+             goto handle_interval;
+           else
+             goto normal_char;
+
+
+        case '\\':
+          if (p == pend) return REG_EESCAPE;
+
+          /* Do not translate the character after the \, so that we can
+             distinguish, e.g., \B from \b, even if we normally would
+             translate, e.g., B to b.  */
+          PATFETCH_RAW (c);
+
+          switch (c)
+            {
+            case '(':
+              if (syntax & RE_NO_BK_PARENS)
+                goto normal_backslash;
+
+            handle_open:
+              bufp->re_nsub++;
+              regnum++;
+
+              if (COMPILE_STACK_FULL)
+                { 
+                  RETALLOC (compile_stack.stack, compile_stack.size << 1,
+                            compile_stack_elt_t);
+                  if (compile_stack.stack == NULL) return REG_ESPACE;
+
+                  compile_stack.size <<= 1;
+                }
+
+              /* These are the values to restore when we hit end of this
+                 group.  They are all relative offsets, so that if the
+                 whole pattern moves because of realloc, they will still
+                 be valid.  */
+              COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
+              COMPILE_STACK_TOP.fixup_alt_jump 
+                = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
+              COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer;
+              COMPILE_STACK_TOP.regnum = regnum;
+
+              /* We will eventually replace the 0 with the number of
+                 groups inner to this one.  But do not push a
+                 start_memory for groups beyond the last one we can
+                 represent in the compiled pattern.  */
+              if (regnum <= MAX_REGNUM)
+                {
+                  COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2;
+                  BUF_PUSH_3 (start_memory, regnum, 0);
+                }
+                
+              compile_stack.avail++;
+
+              fixup_alt_jump = 0;
+              laststart = 0;
+              begalt = b;
+	      /* If we've reached MAX_REGNUM groups, then this open
+		 won't actually generate any code, so we'll have to
+		 clear pending_exact explicitly.  */
+	      pending_exact = 0;
+              break;
+
+
+            case ')':
+              if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
+
+              if (COMPILE_STACK_EMPTY)
+                if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
+                  goto normal_backslash;
+                else
+                  return REG_ERPAREN;
+
+            handle_close:
+              if (fixup_alt_jump)
+                { /* Push a dummy failure point at the end of the
+                     alternative for a possible future
+                     `pop_failure_jump' to pop.  See comments at
+                     `push_dummy_failure' in `re_match_2'.  */
+                  BUF_PUSH (push_dummy_failure);
+                  
+                  /* We allocated space for this jump when we assigned
+                     to `fixup_alt_jump', in the `handle_alt' case below.  */
+                  STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
+                }
+
+              /* See similar code for backslashed left paren above.  */
+              if (COMPILE_STACK_EMPTY)
+                if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
+                  goto normal_char;
+                else
+                  return REG_ERPAREN;
+
+              /* Since we just checked for an empty stack above, this
+                 ``can't happen''.  */
+              assert (compile_stack.avail != 0);
+              {
+                /* We don't just want to restore into `regnum', because
+                   later groups should continue to be numbered higher,
+                   as in `(ab)c(de)' -- the second group is #2.  */
+                regnum_t this_group_regnum;
+
+                compile_stack.avail--;		
+                begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
+                fixup_alt_jump
+                  = COMPILE_STACK_TOP.fixup_alt_jump
+                    ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 
+                    : 0;
+                laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
+                this_group_regnum = COMPILE_STACK_TOP.regnum;
+		/* If we've reached MAX_REGNUM groups, then this open
+		   won't actually generate any code, so we'll have to
+		   clear pending_exact explicitly.  */
+		pending_exact = 0;
+
+                /* We're at the end of the group, so now we know how many
+                   groups were inside this one.  */
+                if (this_group_regnum <= MAX_REGNUM)
+                  {
+                    unsigned char *inner_group_loc
+                      = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset;
+                    
+                    *inner_group_loc = regnum - this_group_regnum;
+                    BUF_PUSH_3 (stop_memory, this_group_regnum,
+                                regnum - this_group_regnum);
+                  }
+              }
+              break;
+
+
+            case '|':					/* `\|'.  */
+              if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
+                goto normal_backslash;
+            handle_alt:
+              if (syntax & RE_LIMITED_OPS)
+                goto normal_char;
+
+              /* Insert before the previous alternative a jump which
+                 jumps to this alternative if the former fails.  */
+              GET_BUFFER_SPACE (3);
+              INSERT_JUMP (on_failure_jump, begalt, b + 6);
+              pending_exact = 0;
+              b += 3;
+
+              /* The alternative before this one has a jump after it
+                 which gets executed if it gets matched.  Adjust that
+                 jump so it will jump to this alternative's analogous
+                 jump (put in below, which in turn will jump to the next
+                 (if any) alternative's such jump, etc.).  The last such
+                 jump jumps to the correct final destination.  A picture:
+                          _____ _____ 
+                          |   | |   |   
+                          |   v |   v 
+                         a | b   | c   
+
+                 If we are at `b', then fixup_alt_jump right now points to a
+                 three-byte space after `a'.  We'll put in the jump, set
+                 fixup_alt_jump to right after `b', and leave behind three
+                 bytes which we'll fill in when we get to after `c'.  */
+
+              if (fixup_alt_jump)
+                STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
+
+              /* Mark and leave space for a jump after this alternative,
+                 to be filled in later either by next alternative or
+                 when know we're at the end of a series of alternatives.  */
+              fixup_alt_jump = b;
+              GET_BUFFER_SPACE (3);
+              b += 3;
+
+              laststart = 0;
+              begalt = b;
+              break;
+
+
+            case '{': 
+              /* If \{ is a literal.  */
+              if (!(syntax & RE_INTERVALS)
+                     /* If we're at `\{' and it's not the open-interval 
+                        operator.  */
+                  || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
+                  || (p - 2 == pattern  &&  p == pend))
+                goto normal_backslash;
+
+            handle_interval:
+              {
+                /* If got here, then the syntax allows intervals.  */
+
+                /* At least (most) this many matches must be made.  */
+                int lower_bound = -1, upper_bound = -1;
+
+                beg_interval = p - 1;
+
+                if (p == pend)
+                  {
+                    if (syntax & RE_NO_BK_BRACES)
+                      goto unfetch_interval;
+                    else
+                      return REG_EBRACE;
+                  }
+
+                GET_UNSIGNED_NUMBER (lower_bound);
+
+                if (c == ',')
+                  {
+                    GET_UNSIGNED_NUMBER (upper_bound);
+                    if (upper_bound < 0) upper_bound = RE_DUP_MAX;
+                  }
+                else
+                  /* Interval such as `{1}' => match exactly once. */
+                  upper_bound = lower_bound;
+
+                if (lower_bound < 0 || upper_bound > RE_DUP_MAX
+                    || lower_bound > upper_bound)
+                  {
+                    if (syntax & RE_NO_BK_BRACES)
+                      goto unfetch_interval;
+                    else 
+                      return REG_BADBR;
+                  }
+
+                if (!(syntax & RE_NO_BK_BRACES)) 
+                  {
+                    if (c != '\\') return REG_EBRACE;
+
+                    PATFETCH (c);
+                  }
+
+                if (c != '}')
+                  {
+                    if (syntax & RE_NO_BK_BRACES)
+                      goto unfetch_interval;
+                    else 
+                      return REG_BADBR;
+                  }
+
+                /* We just parsed a valid interval.  */
+
+                /* If it's invalid to have no preceding re.  */
+                if (!laststart)
+                  {
+                    if (syntax & RE_CONTEXT_INVALID_OPS)
+                      return REG_BADRPT;
+                    else if (syntax & RE_CONTEXT_INDEP_OPS)
+                      laststart = b;
+                    else
+                      goto unfetch_interval;
+                  }
+
+                /* If the upper bound is zero, don't want to succeed at
+                   all; jump from `laststart' to `b + 3', which will be
+                   the end of the buffer after we insert the jump.  */
+                 if (upper_bound == 0)
+                   {
+                     GET_BUFFER_SPACE (3);
+                     INSERT_JUMP (jump, laststart, b + 3);
+                     b += 3;
+                   }
+
+                 /* Otherwise, we have a nontrivial interval.  When
+                    we're all done, the pattern will look like:
+                      set_number_at <jump count> <upper bound>
+                      set_number_at <succeed_n count> <lower bound>
+                      succeed_n <after jump addr> <succed_n count>
+                      <body of loop>
+                      jump_n <succeed_n addr> <jump count>
+                    (The upper bound and `jump_n' are omitted if
+                    `upper_bound' is 1, though.)  */
+                 else 
+                   { /* If the upper bound is > 1, we need to insert
+                        more at the end of the loop.  */
+                     unsigned nbytes = 10 + (upper_bound > 1) * 10;
+
+                     GET_BUFFER_SPACE (nbytes);
+
+                     /* Initialize lower bound of the `succeed_n', even
+                        though it will be set during matching by its
+                        attendant `set_number_at' (inserted next),
+                        because `re_compile_fastmap' needs to know.
+                        Jump to the `jump_n' we might insert below.  */
+                     INSERT_JUMP2 (succeed_n, laststart,
+                                   b + 5 + (upper_bound > 1) * 5,
+                                   lower_bound);
+                     b += 5;
+
+                     /* Code to initialize the lower bound.  Insert 
+                        before the `succeed_n'.  The `5' is the last two
+                        bytes of this `set_number_at', plus 3 bytes of
+                        the following `succeed_n'.  */
+                     insert_op2 (set_number_at, laststart, 5, lower_bound, b);
+                     b += 5;
+
+                     if (upper_bound > 1)
+                       { /* More than one repetition is allowed, so
+                            append a backward jump to the `succeed_n'
+                            that starts this interval.
+                            
+                            When we've reached this during matching,
+                            we'll have matched the interval once, so
+                            jump back only `upper_bound - 1' times.  */
+                         STORE_JUMP2 (jump_n, b, laststart + 5,
+                                      upper_bound - 1);
+                         b += 5;
+
+                         /* The location we want to set is the second
+                            parameter of the `jump_n'; that is `b-2' as
+                            an absolute address.  `laststart' will be
+                            the `set_number_at' we're about to insert;
+                            `laststart+3' the number to set, the source
+                            for the relative address.  But we are
+                            inserting into the middle of the pattern --
+                            so everything is getting moved up by 5.
+                            Conclusion: (b - 2) - (laststart + 3) + 5,
+                            i.e., b - laststart.
+                            
+                            We insert this at the beginning of the loop
+                            so that if we fail during matching, we'll
+                            reinitialize the bounds.  */
+                         insert_op2 (set_number_at, laststart, b - laststart,
+                                     upper_bound - 1, b);
+                         b += 5;
+                       }
+                   }
+                pending_exact = 0;
+                beg_interval = NULL;
+              }
+              break;
+
+            unfetch_interval:
+              /* If an invalid interval, match the characters as literals.  */
+               assert (beg_interval);
+               p = beg_interval;
+               beg_interval = NULL;
+
+               /* normal_char and normal_backslash need `c'.  */
+               PATFETCH (c);	
+
+               if (!(syntax & RE_NO_BK_BRACES))
+                 {
+                   if (p > pattern  &&  p[-1] == '\\')
+                     goto normal_backslash;
+                 }
+               goto normal_char;
+
+#ifdef emacs
+            /* There is no way to specify the before_dot and after_dot
+               operators.  rms says this is ok.  --karl  */
+            case '=':
+              BUF_PUSH (at_dot);
+              break;
+
+            case 's':	
+              laststart = b;
+              PATFETCH (c);
+              BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
+              break;
+
+            case 'S':
+              laststart = b;
+              PATFETCH (c);
+              BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
+              break;
+#endif /* emacs */
+
+
+            case 'w':
+              laststart = b;
+              BUF_PUSH (wordchar);
+              break;
+
+
+            case 'W':
+              laststart = b;
+              BUF_PUSH (notwordchar);
+              break;
+
+
+            case '<':
+              BUF_PUSH (wordbeg);
+              break;
+
+            case '>':
+              BUF_PUSH (wordend);
+              break;
+
+            case 'b':
+              BUF_PUSH (wordbound);
+              break;
+
+            case 'B':
+              BUF_PUSH (notwordbound);
+              break;
+
+            case '`':
+              BUF_PUSH (begbuf);
+              break;
+
+            case '\'':
+              BUF_PUSH (endbuf);
+              break;
+
+            case '1': case '2': case '3': case '4': case '5':
+            case '6': case '7': case '8': case '9':
+              if (syntax & RE_NO_BK_REFS)
+                goto normal_char;
+
+              c1 = c - '0';
+
+              if (c1 > regnum)
+                return REG_ESUBREG;
+
+              /* Can't back reference to a subexpression if inside of it.  */
+              if (group_in_compile_stack (compile_stack, c1))
+                goto normal_char;
+
+              laststart = b;
+              BUF_PUSH_2 (duplicate, c1);
+              break;
+
+
+            case '+':
+            case '?':
+              if (syntax & RE_BK_PLUS_QM)
+                goto handle_plus;
+              else
+                goto normal_backslash;
+
+            default:
+            normal_backslash:
+              /* You might think it would be useful for \ to mean
+                 not to translate; but if we don't translate it
+                 it will never match anything.  */
+              c = TRANSLATE (c);
+              goto normal_char;
+            }
+          break;
+
+
+	default:
+        /* Expects the character in `c'.  */
+	normal_char:
+	      /* If no exactn currently being built.  */
+          if (!pending_exact 
+
+              /* If last exactn not at current position.  */
+              || pending_exact + *pending_exact + 1 != b
+              
+              /* We have only one byte following the exactn for the count.  */
+	      || *pending_exact == (1 << BYTEWIDTH) - 1
+
+              /* If followed by a repetition operator.  */
+              || *p == '*' || *p == '^'
+	      || ((syntax & RE_BK_PLUS_QM)
+		  ? *p == '\\' && (p[1] == '+' || p[1] == '?')
+		  : (*p == '+' || *p == '?'))
+	      || ((syntax & RE_INTERVALS)
+                  && ((syntax & RE_NO_BK_BRACES)
+		      ? *p == '{'
+                      : (p[0] == '\\' && p[1] == '{'))))
+	    {
+	      /* Start building a new exactn.  */
+              
+              laststart = b;
+
+	      BUF_PUSH_2 (exactn, 0);
+	      pending_exact = b - 1;
+            }
+            
+	  BUF_PUSH (c);
+          (*pending_exact)++;
+	  break;
+        } /* switch (c) */
+    } /* while p != pend */
+
+  
+  /* Through the pattern now.  */
+  
+  if (fixup_alt_jump)
+    STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
+
+  if (!COMPILE_STACK_EMPTY) 
+    return REG_EPAREN;
+
+  free (compile_stack.stack);
+
+  /* We have succeeded; set the length of the buffer.  */
+  bufp->used = b - bufp->buffer;
+
+#ifdef DEBUG
+  if (debug)
+    {
+      DEBUG_PRINT1 ("\nCompiled pattern: ");
+      print_compiled_pattern (bufp);
+    }
+#endif /* DEBUG */
+
+  return REG_NOERROR;
+} /* regex_compile */
+
+/* Subroutines for `regex_compile'.  */
+
+/* Store OP at LOC followed by two-byte integer parameter ARG.  */
+
+static void
+store_op1 (op, loc, arg)
+    re_opcode_t op;
+    unsigned char *loc;
+    int arg;
+{
+  *loc = (unsigned char) op;
+  STORE_NUMBER (loc + 1, arg);
+}
+
+
+/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2.  */
+
+static void
+store_op2 (op, loc, arg1, arg2)
+    re_opcode_t op;
+    unsigned char *loc;
+    int arg1, arg2;
+{
+  *loc = (unsigned char) op;
+  STORE_NUMBER (loc + 1, arg1);
+  STORE_NUMBER (loc + 3, arg2);
+}
+
+
+/* Copy the bytes from LOC to END to open up three bytes of space at LOC
+   for OP followed by two-byte integer parameter ARG.  */
+
+static void
+insert_op1 (op, loc, arg, end)
+    re_opcode_t op;
+    unsigned char *loc;
+    int arg;
+    unsigned char *end;    
+{
+  register unsigned char *pfrom = end;
+  register unsigned char *pto = end + 3;
+
+  while (pfrom != loc)
+    *--pto = *--pfrom;
+    
+  store_op1 (op, loc, arg);
+}
+
+
+/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2.  */
+
+static void
+insert_op2 (op, loc, arg1, arg2, end)
+    re_opcode_t op;
+    unsigned char *loc;
+    int arg1, arg2;
+    unsigned char *end;    
+{
+  register unsigned char *pfrom = end;
+  register unsigned char *pto = end + 5;
+
+  while (pfrom != loc)
+    *--pto = *--pfrom;
+    
+  store_op2 (op, loc, arg1, arg2);
+}
+
+
+/* P points to just after a ^ in PATTERN.  Return true if that ^ comes
+   after an alternative or a begin-subexpression.  We assume there is at
+   least one character before the ^.  */
+
+static boolean
+at_begline_loc_p (pattern, p, syntax)
+    const char *pattern, *p;
+    reg_syntax_t syntax;
+{
+  const char *prev = p - 2;
+  boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
+  
+  return
+       /* After a subexpression?  */
+       (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
+       /* After an alternative?  */
+    || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
+}
+
+
+/* The dual of at_begline_loc_p.  This one is for $.  We assume there is
+   at least one character after the $, i.e., `P < PEND'.  */
+
+static boolean
+at_endline_loc_p (p, pend, syntax)
+    const char *p, *pend;
+    int syntax;
+{
+  const char *next = p;
+  boolean next_backslash = *next == '\\';
+  const char *next_next = p + 1 < pend ? p + 1 : NULL;
+  
+  return
+       /* Before a subexpression?  */
+       (syntax & RE_NO_BK_PARENS ? *next == ')'
+        : next_backslash && next_next && *next_next == ')')
+       /* Before an alternative?  */
+    || (syntax & RE_NO_BK_VBAR ? *next == '|'
+        : next_backslash && next_next && *next_next == '|');
+}
+
+
+/* Returns true if REGNUM is in one of COMPILE_STACK's elements and 
+   false if it's not.  */
+
+static boolean
+group_in_compile_stack (compile_stack, regnum)
+    compile_stack_type compile_stack;
+    regnum_t regnum;
+{
+  int this_element;
+
+  for (this_element = compile_stack.avail - 1;  
+       this_element >= 0; 
+       this_element--)
+    if (compile_stack.stack[this_element].regnum == regnum)
+      return true;
+
+  return false;
+}
+
+
+/* Read the ending character of a range (in a bracket expression) from the
+   uncompiled pattern *P_PTR (which ends at PEND).  We assume the
+   starting character is in `P[-2]'.  (`P[-1]' is the character `-'.)
+   Then we set the translation of all bits between the starting and
+   ending characters (inclusive) in the compiled pattern B.
+   
+   Return an error code.
+   
+   We use these short variable names so we can use the same macros as
+   `regex_compile' itself.  */
+
+static reg_errcode_t
+compile_range (p_ptr, pend, translate, syntax, b)
+    const char **p_ptr, *pend;
+    char *translate;
+    reg_syntax_t syntax;
+    unsigned char *b;
+{
+  unsigned this_char;
+
+  const char *p = *p_ptr;
+  int range_start, range_end;
+  
+  if (p == pend)
+    return REG_ERANGE;
+
+  /* Even though the pattern is a signed `char *', we need to fetch
+     with unsigned char *'s; if the high bit of the pattern character
+     is set, the range endpoints will be negative if we fetch using a
+     signed char *.
+
+     We also want to fetch the endpoints without translating them; the 
+     appropriate translation is done in the bit-setting loop below.  */
+  range_start = ((unsigned char *) p)[-2];
+  range_end   = ((unsigned char *) p)[0];
+
+  /* Have to increment the pointer into the pattern string, so the
+     caller isn't still at the ending character.  */
+  (*p_ptr)++;
+
+  /* If the start is after the end, the range is empty.  */
+  if (range_start > range_end)
+    return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
+
+  /* Here we see why `this_char' has to be larger than an `unsigned
+     char' -- the range is inclusive, so if `range_end' == 0xff
+     (assuming 8-bit characters), we would otherwise go into an infinite
+     loop, since all characters <= 0xff.  */
+  for (this_char = range_start; this_char <= range_end; this_char++)
+    {
+      SET_LIST_BIT (TRANSLATE (this_char));
+    }
+  
+  return REG_NOERROR;
+}
+
+/* Failure stack declarations and macros; both re_compile_fastmap and
+   re_match_2 use a failure stack.  These have to be macros because of
+   REGEX_ALLOCATE.  */
+   
+
+/* Number of failure points for which to initially allocate space
+   when matching.  If this number is exceeded, we allocate more
+   space, so it is not a hard limit.  */
+#ifndef INIT_FAILURE_ALLOC
+#define INIT_FAILURE_ALLOC 5
+#endif
+
+/* Roughly the maximum number of failure points on the stack.  Would be
+   exactly that if always used MAX_FAILURE_SPACE each time we failed.
+   This is a variable only so users of regex can assign to it; we never
+   change it ourselves.  */
+int re_max_failures = 2000;
+
+typedef const unsigned char *fail_stack_elt_t;
+
+typedef struct
+{
+  fail_stack_elt_t *stack;
+  unsigned size;
+  unsigned avail;			/* Offset of next open position.  */
+} fail_stack_type;
+
+#define FAIL_STACK_EMPTY()     (fail_stack.avail == 0)
+#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
+#define FAIL_STACK_FULL()      (fail_stack.avail == fail_stack.size)
+#define FAIL_STACK_TOP()       (fail_stack.stack[fail_stack.avail])
+
+
+/* Initialize `fail_stack'.  Do `return -2' if the alloc fails.  */
+
+#define INIT_FAIL_STACK()						\
+  do {									\
+    fail_stack.stack = (fail_stack_elt_t *)				\
+      REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t));	\
+									\
+    if (fail_stack.stack == NULL)					\
+      return -2;							\
+									\
+    fail_stack.size = INIT_FAILURE_ALLOC;				\
+    fail_stack.avail = 0;						\
+  } while (0)
+
+
+/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
+
+   Return 1 if succeeds, and 0 if either ran out of memory
+   allocating space for it or it was already too large.  
+   
+   REGEX_REALLOCATE requires `destination' be declared.   */
+
+#define DOUBLE_FAIL_STACK(fail_stack)					\
+  ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS		\
+   ? 0									\
+   : ((fail_stack).stack = (fail_stack_elt_t *)				\
+        REGEX_REALLOCATE ((fail_stack).stack, 				\
+          (fail_stack).size * sizeof (fail_stack_elt_t),		\
+          ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)),	\
+									\
+      (fail_stack).stack == NULL					\
+      ? 0								\
+      : ((fail_stack).size <<= 1, 					\
+         1)))
+
+
+/* Push PATTERN_OP on FAIL_STACK. 
+
+   Return 1 if was able to do so and 0 if ran out of memory allocating
+   space to do so.  */
+#define PUSH_PATTERN_OP(pattern_op, fail_stack)				\
+  ((FAIL_STACK_FULL ()							\
+    && !DOUBLE_FAIL_STACK (fail_stack))					\
+    ? 0									\
+    : ((fail_stack).stack[(fail_stack).avail++] = pattern_op,		\
+       1))
+
+/* This pushes an item onto the failure stack.  Must be a four-byte
+   value.  Assumes the variable `fail_stack'.  Probably should only
+   be called from within `PUSH_FAILURE_POINT'.  */
+#define PUSH_FAILURE_ITEM(item)						\
+  fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
+
+/* The complement operation.  Assumes `fail_stack' is nonempty.  */
+#define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail]
+
+/* Used to omit pushing failure point id's when we're not debugging.  */
+#ifdef DEBUG
+#define DEBUG_PUSH PUSH_FAILURE_ITEM
+#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM ()
+#else
+#define DEBUG_PUSH(item)
+#define DEBUG_POP(item_addr)
+#endif
+
+
+/* Push the information about the state we will need
+   if we ever fail back to it.  
+   
+   Requires variables fail_stack, regstart, regend, reg_info, and
+   num_regs be declared.  DOUBLE_FAIL_STACK requires `destination' be
+   declared.
+   
+   Does `return FAILURE_CODE' if runs out of memory.  */
+
+#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code)	\
+  do {									\
+    char *destination;							\
+    /* Must be int, so when we don't save any registers, the arithmetic	\
+       of 0 + -1 isn't done as unsigned.  */				\
+    int this_reg;							\
+    									\
+    DEBUG_STATEMENT (failure_id++);					\
+    DEBUG_STATEMENT (nfailure_points_pushed++);				\
+    DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id);		\
+    DEBUG_PRINT2 ("  Before push, next avail: %d\n", (fail_stack).avail);\
+    DEBUG_PRINT2 ("                     size: %d\n", (fail_stack).size);\
+									\
+    DEBUG_PRINT2 ("  slots needed: %d\n", NUM_FAILURE_ITEMS);		\
+    DEBUG_PRINT2 ("     available: %d\n", REMAINING_AVAIL_SLOTS);	\
+									\
+    /* Ensure we have enough space allocated for what we will push.  */	\
+    while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS)			\
+      {									\
+        if (!DOUBLE_FAIL_STACK (fail_stack))			\
+          return failure_code;						\
+									\
+        DEBUG_PRINT2 ("\n  Doubled stack; size now: %d\n",		\
+		       (fail_stack).size);				\
+        DEBUG_PRINT2 ("  slots available: %d\n", REMAINING_AVAIL_SLOTS);\
+      }									\
+									\
+    /* Push the info, starting with the registers.  */			\
+    DEBUG_PRINT1 ("\n");						\
+									\
+    for (this_reg = lowest_active_reg; this_reg <= highest_active_reg;	\
+         this_reg++)							\
+      {									\
+	DEBUG_PRINT2 ("  Pushing reg: %d\n", this_reg);			\
+        DEBUG_STATEMENT (num_regs_pushed++);				\
+									\
+	DEBUG_PRINT2 ("    start: 0x%x\n", regstart[this_reg]);		\
+        PUSH_FAILURE_ITEM (regstart[this_reg]);				\
+                                                                        \
+	DEBUG_PRINT2 ("    end: 0x%x\n", regend[this_reg]);		\
+        PUSH_FAILURE_ITEM (regend[this_reg]);				\
+									\
+	DEBUG_PRINT2 ("    info: 0x%x\n      ", reg_info[this_reg]);	\
+        DEBUG_PRINT2 (" match_null=%d",					\
+                      REG_MATCH_NULL_STRING_P (reg_info[this_reg]));	\
+        DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg]));	\
+        DEBUG_PRINT2 (" matched_something=%d",				\
+                      MATCHED_SOMETHING (reg_info[this_reg]));		\
+        DEBUG_PRINT2 (" ever_matched=%d",				\
+                      EVER_MATCHED_SOMETHING (reg_info[this_reg]));	\
+	DEBUG_PRINT1 ("\n");						\
+        PUSH_FAILURE_ITEM (reg_info[this_reg].word);			\
+      }									\
+									\
+    DEBUG_PRINT2 ("  Pushing  low active reg: %d\n", lowest_active_reg);\
+    PUSH_FAILURE_ITEM (lowest_active_reg);				\
+									\
+    DEBUG_PRINT2 ("  Pushing high active reg: %d\n", highest_active_reg);\
+    PUSH_FAILURE_ITEM (highest_active_reg);				\
+									\
+    DEBUG_PRINT2 ("  Pushing pattern 0x%x: ", pattern_place);		\
+    DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend);		\
+    PUSH_FAILURE_ITEM (pattern_place);					\
+									\
+    DEBUG_PRINT2 ("  Pushing string 0x%x: `", string_place);		\
+    DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2,   \
+				 size2);				\
+    DEBUG_PRINT1 ("'\n");						\
+    PUSH_FAILURE_ITEM (string_place);					\
+									\
+    DEBUG_PRINT2 ("  Pushing failure id: %u\n", failure_id);		\
+    DEBUG_PUSH (failure_id);						\
+  } while (0)
+
+/* This is the number of items that are pushed and popped on the stack
+   for each register.  */
+#define NUM_REG_ITEMS  3
+
+/* Individual items aside from the registers.  */
+#ifdef DEBUG
+#define NUM_NONREG_ITEMS 5 /* Includes failure point id.  */
+#else
+#define NUM_NONREG_ITEMS 4
+#endif
+
+/* We push at most this many items on the stack.  */
+#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
+
+/* We actually push this many items.  */
+#define NUM_FAILURE_ITEMS						\
+  ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS 	\
+    + NUM_NONREG_ITEMS)
+
+/* How many items can still be added to the stack without overflowing it.  */
+#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
+
+
+/* Pops what PUSH_FAIL_STACK pushes.
+
+   We restore into the parameters, all of which should be lvalues:
+     STR -- the saved data position.
+     PAT -- the saved pattern position.
+     LOW_REG, HIGH_REG -- the highest and lowest active registers.
+     REGSTART, REGEND -- arrays of string positions.
+     REG_INFO -- array of information about each subexpression.
+   
+   Also assumes the variables `fail_stack' and (if debugging), `bufp',
+   `pend', `string1', `size1', `string2', and `size2'.  */
+
+#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
+{									\
+  DEBUG_STATEMENT (fail_stack_elt_t failure_id;)			\
+  int this_reg;								\
+  const unsigned char *string_temp;					\
+									\
+  assert (!FAIL_STACK_EMPTY ());					\
+									\
+  /* Remove failure points and point to how many regs pushed.  */	\
+  DEBUG_PRINT1 ("POP_FAILURE_POINT:\n");				\
+  DEBUG_PRINT2 ("  Before pop, next avail: %d\n", fail_stack.avail);	\
+  DEBUG_PRINT2 ("                    size: %d\n", fail_stack.size);	\
+									\
+  assert (fail_stack.avail >= NUM_NONREG_ITEMS);			\
+									\
+  DEBUG_POP (&failure_id);						\
+  DEBUG_PRINT2 ("  Popping failure id: %u\n", failure_id);		\
+									\
+  /* If the saved string location is NULL, it came from an		\
+     on_failure_keep_string_jump opcode, and we want to throw away the	\
+     saved NULL, thus retaining our current position in the string.  */	\
+  string_temp = POP_FAILURE_ITEM ();					\
+  if (string_temp != NULL)						\
+    str = (const char *) string_temp;					\
+									\
+  DEBUG_PRINT2 ("  Popping string 0x%x: `", str);			\
+  DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2);	\
+  DEBUG_PRINT1 ("'\n");							\
+									\
+  pat = (unsigned char *) POP_FAILURE_ITEM ();				\
+  DEBUG_PRINT2 ("  Popping pattern 0x%x: ", pat);			\
+  DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend);			\
+									\
+  /* Restore register info.  */						\
+  high_reg = (unsigned) POP_FAILURE_ITEM ();				\
+  DEBUG_PRINT2 ("  Popping high active reg: %d\n", high_reg);		\
+									\
+  low_reg = (unsigned) POP_FAILURE_ITEM ();				\
+  DEBUG_PRINT2 ("  Popping  low active reg: %d\n", low_reg);		\
+									\
+  for (this_reg = high_reg; this_reg >= low_reg; this_reg--)		\
+    {									\
+      DEBUG_PRINT2 ("    Popping reg: %d\n", this_reg);			\
+									\
+      reg_info[this_reg].word = POP_FAILURE_ITEM ();			\
+      DEBUG_PRINT2 ("      info: 0x%x\n", reg_info[this_reg]);		\
+									\
+      regend[this_reg] = (const char *) POP_FAILURE_ITEM ();		\
+      DEBUG_PRINT2 ("      end: 0x%x\n", regend[this_reg]);		\
+									\
+      regstart[this_reg] = (const char *) POP_FAILURE_ITEM ();		\
+      DEBUG_PRINT2 ("      start: 0x%x\n", regstart[this_reg]);		\
+    }									\
+									\
+  DEBUG_STATEMENT (nfailure_points_popped++);				\
+} /* POP_FAILURE_POINT */
+
+/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
+   BUFP.  A fastmap records which of the (1 << BYTEWIDTH) possible
+   characters can start a string that matches the pattern.  This fastmap
+   is used by re_search to skip quickly over impossible starting points.
+
+   The caller must supply the address of a (1 << BYTEWIDTH)-byte data
+   area as BUFP->fastmap.
+   
+   We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
+   the pattern buffer.
+
+   Returns 0 if we succeed, -2 if an internal error.   */
+
+int
+re_compile_fastmap (bufp)
+     struct re_pattern_buffer *bufp;
+{
+  int j, k;
+  fail_stack_type fail_stack;
+#ifndef REGEX_MALLOC
+  char *destination;
+#endif
+  /* We don't push any register information onto the failure stack.  */
+  unsigned num_regs = 0;
+  
+  register char *fastmap = bufp->fastmap;
+  unsigned char *pattern = bufp->buffer;
+  unsigned long size = bufp->used;
+  const unsigned char *p = pattern;
+  register unsigned char *pend = pattern + size;
+
+  /* Assume that each path through the pattern can be null until
+     proven otherwise.  We set this false at the bottom of switch
+     statement, to which we get only if a particular path doesn't
+     match the empty string.  */
+  boolean path_can_be_null = true;
+
+  /* We aren't doing a `succeed_n' to begin with.  */
+  boolean succeed_n_p = false;
+
+  assert (fastmap != NULL && p != NULL);
+  
+  INIT_FAIL_STACK ();
+  bzero (fastmap, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
+  bufp->fastmap_accurate = 1;	    /* It will be when we're done.  */
+  bufp->can_be_null = 0;
+      
+  while (p != pend || !FAIL_STACK_EMPTY ())
+    {
+      if (p == pend)
+        {
+          bufp->can_be_null |= path_can_be_null;
+          
+          /* Reset for next path.  */
+          path_can_be_null = true;
+          
+          p = fail_stack.stack[--fail_stack.avail];
+	}
+
+      /* We should never be about to go beyond the end of the pattern.  */
+      assert (p < pend);
+      
+#ifdef SWITCH_ENUM_BUG
+      switch ((int) ((re_opcode_t) *p++))
+#else
+      switch ((re_opcode_t) *p++)
+#endif
+	{
+
+        /* I guess the idea here is to simply not bother with a fastmap
+           if a backreference is used, since it's too hard to figure out
+           the fastmap for the corresponding group.  Setting
+           `can_be_null' stops `re_search_2' from using the fastmap, so
+           that is all we do.  */
+	case duplicate:
+	  bufp->can_be_null = 1;
+          return 0;
+
+
+      /* Following are the cases which match a character.  These end
+         with `break'.  */
+
+	case exactn:
+          fastmap[p[1]] = 1;
+	  break;
+
+
+        case charset:
+          for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
+	    if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
+              fastmap[j] = 1;
+	  break;
+
+
+	case charset_not:
+	  /* Chars beyond end of map must be allowed.  */
+	  for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
+            fastmap[j] = 1;
+
+	  for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
+	    if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
+              fastmap[j] = 1;
+          break;
+
+
+	case wordchar:
+	  for (j = 0; j < (1 << BYTEWIDTH); j++)
+	    if (SYNTAX (j) == Sword)
+	      fastmap[j] = 1;
+	  break;
+
+
+	case notwordchar:
+	  for (j = 0; j < (1 << BYTEWIDTH); j++)
+	    if (SYNTAX (j) != Sword)
+	      fastmap[j] = 1;
+	  break;
+
+
+        case anychar:
+          /* `.' matches anything ...  */
+	  for (j = 0; j < (1 << BYTEWIDTH); j++)
+            fastmap[j] = 1;
+
+          /* ... except perhaps newline.  */
+          if (!(bufp->syntax & RE_DOT_NEWLINE))
+            fastmap['\n'] = 0;
+
+          /* Return if we have already set `can_be_null'; if we have,
+             then the fastmap is irrelevant.  Something's wrong here.  */
+	  else if (bufp->can_be_null)
+	    return 0;
+
+          /* Otherwise, have to check alternative paths.  */
+	  break;
+
+
+#ifdef emacs
+        case syntaxspec:
+	  k = *p++;
+	  for (j = 0; j < (1 << BYTEWIDTH); j++)
+	    if (SYNTAX (j) == (enum syntaxcode) k)
+	      fastmap[j] = 1;
+	  break;
+
+
+	case notsyntaxspec:
+	  k = *p++;
+	  for (j = 0; j < (1 << BYTEWIDTH); j++)
+	    if (SYNTAX (j) != (enum syntaxcode) k)
+	      fastmap[j] = 1;
+	  break;
+
+
+      /* All cases after this match the empty string.  These end with
+         `continue'.  */
+
+
+	case before_dot:
+	case at_dot:
+	case after_dot:
+          continue;
+#endif /* not emacs */
+
+
+        case no_op:
+        case begline:
+        case endline:
+	case begbuf:
+	case endbuf:
+	case wordbound:
+	case notwordbound:
+	case wordbeg:
+	case wordend:
+        case push_dummy_failure:
+          continue;
+
+
+	case jump_n:
+        case pop_failure_jump:
+	case maybe_pop_jump:
+	case jump:
+        case jump_past_alt:
+	case dummy_failure_jump:
+          EXTRACT_NUMBER_AND_INCR (j, p);
+	  p += j;	
+	  if (j > 0)
+	    continue;
+            
+          /* Jump backward implies we just went through the body of a
+             loop and matched nothing.  Opcode jumped to should be
+             `on_failure_jump' or `succeed_n'.  Just treat it like an
+             ordinary jump.  For a * loop, it has pushed its failure
+             point already; if so, discard that as redundant.  */
+          if ((re_opcode_t) *p != on_failure_jump
+	      && (re_opcode_t) *p != succeed_n)
+	    continue;
+
+          p++;
+          EXTRACT_NUMBER_AND_INCR (j, p);
+          p += j;		
+	  
+          /* If what's on the stack is where we are now, pop it.  */
+          if (!FAIL_STACK_EMPTY () 
+	      && fail_stack.stack[fail_stack.avail - 1] == p)
+            fail_stack.avail--;
+
+          continue;
+
+
+        case on_failure_jump:
+        case on_failure_keep_string_jump:
+	handle_on_failure_jump:
+          EXTRACT_NUMBER_AND_INCR (j, p);
+
+          /* For some patterns, e.g., `(a?)?', `p+j' here points to the
+             end of the pattern.  We don't want to push such a point,
+             since when we restore it above, entering the switch will
+             increment `p' past the end of the pattern.  We don't need
+             to push such a point since we obviously won't find any more
+             fastmap entries beyond `pend'.  Such a pattern can match
+             the null string, though.  */
+          if (p + j < pend)
+            {
+              if (!PUSH_PATTERN_OP (p + j, fail_stack))
+                return -2;
+            }
+          else
+            bufp->can_be_null = 1;
+
+          if (succeed_n_p)
+            {
+              EXTRACT_NUMBER_AND_INCR (k, p);	/* Skip the n.  */
+              succeed_n_p = false;
+	    }
+
+          continue;
+
+
+	case succeed_n:
+          /* Get to the number of times to succeed.  */
+          p += 2;		
+
+          /* Increment p past the n for when k != 0.  */
+          EXTRACT_NUMBER_AND_INCR (k, p);
+          if (k == 0)
+	    {
+              p -= 4;
+  	      succeed_n_p = true;  /* Spaghetti code alert.  */
+              goto handle_on_failure_jump;
+            }
+          continue;
+
+
+	case set_number_at:
+          p += 4;
+          continue;
+
+
+	case start_memory:
+        case stop_memory:
+	  p += 2;
+	  continue;
+
+
+	default:
+          abort (); /* We have listed all the cases.  */
+        } /* switch *p++ */
+
+      /* Getting here means we have found the possible starting
+         characters for one path of the pattern -- and that the empty
+         string does not match.  We need not follow this path further.
+         Instead, look at the next alternative (remembered on the
+         stack), or quit if no more.  The test at the top of the loop
+         does these things.  */
+      path_can_be_null = false;
+      p = pend;
+    } /* while p */
+
+  /* Set `can_be_null' for the last path (also the first path, if the
+     pattern is empty).  */
+  bufp->can_be_null |= path_can_be_null;
+  return 0;
+} /* re_compile_fastmap */
+
+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
+   ENDS.  Subsequent matches using PATTERN_BUFFER and REGS will use
+   this memory for recording register information.  STARTS and ENDS
+   must be allocated using the malloc library routine, and must each
+   be at least NUM_REGS * sizeof (regoff_t) bytes long.
+
+   If NUM_REGS == 0, then subsequent matches should allocate their own
+   register data.
+
+   Unless this function is called, the first search or match using
+   PATTERN_BUFFER will allocate its own register data, without
+   freeing the old data.  */
+
+void
+re_set_registers (bufp, regs, num_regs, starts, ends)
+    struct re_pattern_buffer *bufp;
+    struct re_registers *regs;
+    unsigned num_regs;
+    regoff_t *starts, *ends;
+{
+  if (num_regs)
+    {
+      bufp->regs_allocated = REGS_REALLOCATE;
+      regs->num_regs = num_regs;
+      regs->start = starts;
+      regs->end = ends;
+    }
+  else
+    {
+      bufp->regs_allocated = REGS_UNALLOCATED;
+      regs->num_regs = 0;
+      regs->start = regs->end = (regoff_t) 0;
+    }
+}
+
+/* Searching routines.  */
+
+/* Like re_search_2, below, but only one string is specified, and
+   doesn't let you say where to stop matching. */
+
+int
+re_search (bufp, string, size, startpos, range, regs)
+     struct re_pattern_buffer *bufp;
+     const char *string;
+     int size, startpos, range;
+     struct re_registers *regs;
+{
+  return re_search_2 (bufp, NULL, 0, string, size, startpos, range, 
+		      regs, size);
+}
+
+
+/* Using the compiled pattern in BUFP->buffer, first tries to match the
+   virtual concatenation of STRING1 and STRING2, starting first at index
+   STARTPOS, then at STARTPOS + 1, and so on.
+   
+   STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
+   
+   RANGE is how far to scan while trying to match.  RANGE = 0 means try
+   only at STARTPOS; in general, the last start tried is STARTPOS +
+   RANGE.
+   
+   In REGS, return the indices of the virtual concatenation of STRING1
+   and STRING2 that matched the entire BUFP->buffer and its contained
+   subexpressions.
+   
+   Do not consider matching one past the index STOP in the virtual
+   concatenation of STRING1 and STRING2.
+
+   We return either the position in the strings at which the match was
+   found, -1 if no match, or -2 if error (such as failure
+   stack overflow).  */
+
+int
+re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
+     struct re_pattern_buffer *bufp;
+     const char *string1, *string2;
+     int size1, size2;
+     int startpos;
+     int range;
+     struct re_registers *regs;
+     int stop;
+{
+  int val;
+  register char *fastmap = bufp->fastmap;
+  register char *translate = bufp->translate;
+  int total_size = size1 + size2;
+  int endpos = startpos + range;
+
+  /* Check for out-of-range STARTPOS.  */
+  if (startpos < 0 || startpos > total_size)
+    return -1;
+    
+  /* Fix up RANGE if it might eventually take us outside
+     the virtual concatenation of STRING1 and STRING2.  */
+  if (endpos < -1)
+    range = -1 - startpos;
+  else if (endpos > total_size)
+    range = total_size - startpos;
+
+  /* If the search isn't to be a backwards one, don't waste time in a
+     search for a pattern that must be anchored.  */
+  if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
+    {
+      if (startpos > 0)
+	return -1;
+      else
+	range = 1;
+    }
+
+  /* Update the fastmap now if not correct already.  */
+  if (fastmap && !bufp->fastmap_accurate)
+    if (re_compile_fastmap (bufp) == -2)
+      return -2;
+  
+  /* Loop through the string, looking for a place to start matching.  */
+  for (;;)
+    { 
+      /* If a fastmap is supplied, skip quickly over characters that
+         cannot be the start of a match.  If the pattern can match the
+         null string, however, we don't need to skip characters; we want
+         the first null string.  */
+      if (fastmap && startpos < total_size && !bufp->can_be_null)
+	{
+	  if (range > 0)	/* Searching forwards.  */
+	    {
+	      register const char *d;
+	      register int lim = 0;
+	      int irange = range;
+
+              if (startpos < size1 && startpos + range >= size1)
+                lim = range - (size1 - startpos);
+
+	      d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
+   
+              /* Written out as an if-else to avoid testing `translate'
+                 inside the loop.  */
+	      if (translate)
+                while (range > lim
+                       && !fastmap[(unsigned char)
+				   translate[(unsigned char) *d++]])
+                  range--;
+	      else
+                while (range > lim && !fastmap[(unsigned char) *d++])
+                  range--;
+
+	      startpos += irange - range;
+	    }
+	  else				/* Searching backwards.  */
+	    {
+	      register char c = (size1 == 0 || startpos >= size1
+                                 ? string2[startpos - size1] 
+                                 : string1[startpos]);
+
+	      if (!fastmap[(unsigned char) TRANSLATE (c)])
+		goto advance;
+	    }
+	}
+
+      /* If can't match the null string, and that's all we have left, fail.  */
+      if (range >= 0 && startpos == total_size && fastmap
+          && !bufp->can_be_null)
+	return -1;
+
+      val = re_match_2 (bufp, string1, size1, string2, size2,
+	                startpos, regs, stop);
+      if (val >= 0)
+	return startpos;
+        
+      if (val == -2)
+	return -2;
+
+    advance:
+      if (!range) 
+        break;
+      else if (range > 0) 
+        {
+          range--; 
+          startpos++;
+        }
+      else
+        {
+          range++; 
+          startpos--;
+        }
+    }
+  return -1;
+} /* re_search_2 */
+
+/* Declarations and macros for re_match_2.  */
+
+static int bcmp_translate ();
+static boolean alt_match_null_string_p (),
+               common_op_match_null_string_p (),
+               group_match_null_string_p ();
+
+/* Structure for per-register (a.k.a. per-group) information.
+   This must not be longer than one word, because we push this value
+   onto the failure stack.  Other register information, such as the
+   starting and ending positions (which are addresses), and the list of
+   inner groups (which is a bits list) are maintained in separate
+   variables.  
+   
+   We are making a (strictly speaking) nonportable assumption here: that
+   the compiler will pack our bit fields into something that fits into
+   the type of `word', i.e., is something that fits into one item on the
+   failure stack.  */
+typedef union
+{
+  fail_stack_elt_t word;
+  struct
+  {
+      /* This field is one if this group can match the empty string,
+         zero if not.  If not yet determined,  `MATCH_NULL_UNSET_VALUE'.  */
+#define MATCH_NULL_UNSET_VALUE 3
+    unsigned match_null_string_p : 2;
+    unsigned is_active : 1;
+    unsigned matched_something : 1;
+    unsigned ever_matched_something : 1;
+  } bits;
+} register_info_type;
+
+#define REG_MATCH_NULL_STRING_P(R)  ((R).bits.match_null_string_p)
+#define IS_ACTIVE(R)  ((R).bits.is_active)
+#define MATCHED_SOMETHING(R)  ((R).bits.matched_something)
+#define EVER_MATCHED_SOMETHING(R)  ((R).bits.ever_matched_something)
+
+
+/* Call this when have matched a real character; it sets `matched' flags
+   for the subexpressions which we are currently inside.  Also records
+   that those subexprs have matched.  */
+#define SET_REGS_MATCHED()						\
+  do									\
+    {									\
+      unsigned r;							\
+      for (r = lowest_active_reg; r <= highest_active_reg; r++)		\
+        {								\
+          MATCHED_SOMETHING (reg_info[r])				\
+            = EVER_MATCHED_SOMETHING (reg_info[r])			\
+            = 1;							\
+        }								\
+    }									\
+  while (0)
+
+
+/* This converts PTR, a pointer into one of the search strings `string1'
+   and `string2' into an offset from the beginning of that string.  */
+#define POINTER_TO_OFFSET(ptr)						\
+  (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)
+
+/* Registers are set to a sentinel when they haven't yet matched.  */
+#define REG_UNSET_VALUE ((char *) -1)
+#define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
+
+
+/* Macros for dealing with the split strings in re_match_2.  */
+
+#define MATCHING_IN_FIRST_STRING  (dend == end_match_1)
+
+/* Call before fetching a character with *d.  This switches over to
+   string2 if necessary.  */
+#define PREFETCH()							\
+  while (d == dend)						    	\
+    {									\
+      /* End of string2 => fail.  */					\
+      if (dend == end_match_2) 						\
+        goto fail;							\
+      /* End of string1 => advance to string2.  */ 			\
+      d = string2;						        \
+      dend = end_match_2;						\
+    }
+
+
+/* Test if at very beginning or at very end of the virtual concatenation
+   of `string1' and `string2'.  If only one string, it's `string2'.  */
+#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
+#define AT_STRINGS_END(d) ((d) == end2)	
+
+
+/* Test if D points to a character which is word-constituent.  We have
+   two special cases to check for: if past the end of string1, look at
+   the first character in string2; and if before the beginning of
+   string2, look at the last character in string1.  */
+#define WORDCHAR_P(d)							\
+  (SYNTAX ((d) == end1 ? *string2					\
+           : (d) == string2 - 1 ? *(end1 - 1) : *(d))			\
+   == Sword)
+
+/* Test if the character before D and the one at D differ with respect
+   to being word-constituent.  */
+#define AT_WORD_BOUNDARY(d)						\
+  (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)				\
+   || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
+
+
+/* Free everything we malloc.  */
+#ifdef REGEX_MALLOC
+#define FREE_VAR(var) if (var) free (var); var = NULL
+#define FREE_VARIABLES()						\
+  do {									\
+    FREE_VAR (fail_stack.stack);					\
+    FREE_VAR (regstart);						\
+    FREE_VAR (regend);							\
+    FREE_VAR (old_regstart);						\
+    FREE_VAR (old_regend);						\
+    FREE_VAR (best_regstart);						\
+    FREE_VAR (best_regend);						\
+    FREE_VAR (reg_info);						\
+    FREE_VAR (reg_dummy);						\
+    FREE_VAR (reg_info_dummy);						\
+  } while (0)
+#else /* not REGEX_MALLOC */
+/* Some MIPS systems (at least) want this to free alloca'd storage.  */
+#define FREE_VARIABLES() alloca (0)
+#endif /* not REGEX_MALLOC */
+
+
+/* These values must meet several constraints.  They must not be valid
+   register values; since we have a limit of 255 registers (because
+   we use only one byte in the pattern for the register number), we can
+   use numbers larger than 255.  They must differ by 1, because of
+   NUM_FAILURE_ITEMS above.  And the value for the lowest register must
+   be larger than the value for the highest register, so we do not try
+   to actually save any registers when none are active.  */
+#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
+#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
+
+/* Matching routines.  */
+
+#ifndef emacs   /* Emacs never uses this.  */
+/* re_match is like re_match_2 except it takes only a single string.  */
+
+int
+re_match (bufp, string, size, pos, regs)
+     struct re_pattern_buffer *bufp;
+     const char *string;
+     int size, pos;
+     struct re_registers *regs;
+ {
+  return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size); 
+}
+#endif /* not emacs */
+
+
+/* re_match_2 matches the compiled pattern in BUFP against the
+   the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
+   and SIZE2, respectively).  We start matching at POS, and stop
+   matching at STOP.
+   
+   If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
+   store offsets for the substring each group matched in REGS.  See the
+   documentation for exactly how many groups we fill.
+
+   We return -1 if no match, -2 if an internal error (such as the
+   failure stack overflowing).  Otherwise, we return the length of the
+   matched substring.  */
+
+int
+re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
+     struct re_pattern_buffer *bufp;
+     const char *string1, *string2;
+     int size1, size2;
+     int pos;
+     struct re_registers *regs;
+     int stop;
+{
+  /* General temporaries.  */
+  int mcnt;
+  unsigned char *p1;
+
+  /* Just past the end of the corresponding string.  */
+  const char *end1, *end2;
+
+  /* Pointers into string1 and string2, just past the last characters in
+     each to consider matching.  */
+  const char *end_match_1, *end_match_2;
+
+  /* Where we are in the data, and the end of the current string.  */
+  const char *d, *dend;
+  
+  /* Where we are in the pattern, and the end of the pattern.  */
+  unsigned char *p = bufp->buffer;
+  register unsigned char *pend = p + bufp->used;
+
+  /* We use this to map every character in the string.  */
+  char *translate = bufp->translate;
+
+  /* Failure point stack.  Each place that can handle a failure further
+     down the line pushes a failure point on this stack.  It consists of
+     restart, regend, and reg_info for all registers corresponding to
+     the subexpressions we're currently inside, plus the number of such
+     registers, and, finally, two char *'s.  The first char * is where
+     to resume scanning the pattern; the second one is where to resume
+     scanning the strings.  If the latter is zero, the failure point is
+     a ``dummy''; if a failure happens and the failure point is a dummy,
+     it gets discarded and the next next one is tried.  */
+  fail_stack_type fail_stack;
+#ifdef DEBUG
+  static unsigned failure_id = 0;
+  unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
+#endif
+
+  /* We fill all the registers internally, independent of what we
+     return, for use in backreferences.  The number here includes
+     an element for register zero.  */
+  unsigned num_regs = bufp->re_nsub + 1;
+  
+  /* The currently active registers.  */
+  unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
+  unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
+
+  /* Information on the contents of registers. These are pointers into
+     the input strings; they record just what was matched (on this
+     attempt) by a subexpression part of the pattern, that is, the
+     regnum-th regstart pointer points to where in the pattern we began
+     matching and the regnum-th regend points to right after where we
+     stopped matching the regnum-th subexpression.  (The zeroth register
+     keeps track of what the whole pattern matches.)  */
+  const char **regstart, **regend;
+
+  /* If a group that's operated upon by a repetition operator fails to
+     match anything, then the register for its start will need to be
+     restored because it will have been set to wherever in the string we
+     are when we last see its open-group operator.  Similarly for a
+     register's end.  */
+  const char **old_regstart, **old_regend;
+
+  /* The is_active field of reg_info helps us keep track of which (possibly
+     nested) subexpressions we are currently in. The matched_something
+     field of reg_info[reg_num] helps us tell whether or not we have
+     matched any of the pattern so far this time through the reg_num-th
+     subexpression.  These two fields get reset each time through any
+     loop their register is in.  */
+  register_info_type *reg_info; 
+
+  /* The following record the register info as found in the above
+     variables when we find a match better than any we've seen before. 
+     This happens as we backtrack through the failure points, which in
+     turn happens only if we have not yet matched the entire string. */
+  unsigned best_regs_set = false;
+  const char **best_regstart, **best_regend;
+  
+  /* Logically, this is `best_regend[0]'.  But we don't want to have to
+     allocate space for that if we're not allocating space for anything
+     else (see below).  Also, we never need info about register 0 for
+     any of the other register vectors, and it seems rather a kludge to
+     treat `best_regend' differently than the rest.  So we keep track of
+     the end of the best match so far in a separate variable.  We
+     initialize this to NULL so that when we backtrack the first time
+     and need to test it, it's not garbage.  */
+  const char *match_end = NULL;
+
+  /* Used when we pop values we don't care about.  */
+  const char **reg_dummy;
+  register_info_type *reg_info_dummy;
+
+#ifdef DEBUG
+  /* Counts the total number of registers pushed.  */
+  unsigned num_regs_pushed = 0; 	
+#endif
+
+  DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
+  
+  INIT_FAIL_STACK ();
+  
+  /* Do not bother to initialize all the register variables if there are
+     no groups in the pattern, as it takes a fair amount of time.  If
+     there are groups, we include space for register 0 (the whole
+     pattern), even though we never use it, since it simplifies the
+     array indexing.  We should fix this.  */
+  if (bufp->re_nsub)
+    {
+      regstart = REGEX_TALLOC (num_regs, const char *);
+      regend = REGEX_TALLOC (num_regs, const char *);
+      old_regstart = REGEX_TALLOC (num_regs, const char *);
+      old_regend = REGEX_TALLOC (num_regs, const char *);
+      best_regstart = REGEX_TALLOC (num_regs, const char *);
+      best_regend = REGEX_TALLOC (num_regs, const char *);
+      reg_info = REGEX_TALLOC (num_regs, register_info_type);
+      reg_dummy = REGEX_TALLOC (num_regs, const char *);
+      reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type);
+
+      if (!(regstart && regend && old_regstart && old_regend && reg_info 
+            && best_regstart && best_regend && reg_dummy && reg_info_dummy)) 
+        {
+          FREE_VARIABLES ();
+          return -2;
+        }
+    }
+#ifdef REGEX_MALLOC
+  else
+    {
+      /* We must initialize all our variables to NULL, so that
+         `FREE_VARIABLES' doesn't try to free them.  */
+      regstart = regend = old_regstart = old_regend = best_regstart
+        = best_regend = reg_dummy = NULL;
+      reg_info = reg_info_dummy = (register_info_type *) NULL;
+    }
+#endif /* REGEX_MALLOC */
+
+  /* The starting position is bogus.  */
+  if (pos < 0 || pos > size1 + size2)
+    {
+      FREE_VARIABLES ();
+      return -1;
+    }
+    
+  /* Initialize subexpression text positions to -1 to mark ones that no
+     start_memory/stop_memory has been seen for. Also initialize the
+     register information struct.  */
+  for (mcnt = 1; mcnt < num_regs; mcnt++)
+    {
+      regstart[mcnt] = regend[mcnt] 
+        = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
+        
+      REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
+      IS_ACTIVE (reg_info[mcnt]) = 0;
+      MATCHED_SOMETHING (reg_info[mcnt]) = 0;
+      EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
+    }
+  
+  /* We move `string1' into `string2' if the latter's empty -- but not if
+     `string1' is null.  */
+  if (size2 == 0 && string1 != NULL)
+    {
+      string2 = string1;
+      size2 = size1;
+      string1 = 0;
+      size1 = 0;
+    }
+  end1 = string1 + size1;
+  end2 = string2 + size2;
+
+  /* Compute where to stop matching, within the two strings.  */
+  if (stop <= size1)
+    {
+      end_match_1 = string1 + stop;
+      end_match_2 = string2;
+    }
+  else
+    {
+      end_match_1 = end1;
+      end_match_2 = string2 + stop - size1;
+    }
+
+  /* `p' scans through the pattern as `d' scans through the data. 
+     `dend' is the end of the input string that `d' points within.  `d'
+     is advanced into the following input string whenever necessary, but
+     this happens before fetching; therefore, at the beginning of the
+     loop, `d' can be pointing at the end of a string, but it cannot
+     equal `string2'.  */
+  if (size1 > 0 && pos <= size1)
+    {
+      d = string1 + pos;
+      dend = end_match_1;
+    }
+  else
+    {
+      d = string2 + pos - size1;
+      dend = end_match_2;
+    }
+
+  DEBUG_PRINT1 ("The compiled pattern is: ");
+  DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
+  DEBUG_PRINT1 ("The string to match is: `");
+  DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
+  DEBUG_PRINT1 ("'\n");
+  
+  /* This loops over pattern commands.  It exits by returning from the
+     function if the match is complete, or it drops through if the match
+     fails at this starting point in the input data.  */
+  for (;;)
+    {
+      DEBUG_PRINT2 ("\n0x%x: ", p);
+
+      if (p == pend)
+	{ /* End of pattern means we might have succeeded.  */
+          DEBUG_PRINT1 ("end of pattern ... ");
+          
+	  /* If we haven't matched the entire string, and we want the
+             longest match, try backtracking.  */
+          if (d != end_match_2)
+	    {
+              DEBUG_PRINT1 ("backtracking.\n");
+              
+              if (!FAIL_STACK_EMPTY ())
+                { /* More failure points to try.  */
+                  boolean same_str_p = (FIRST_STRING_P (match_end) 
+	        	                == MATCHING_IN_FIRST_STRING);
+
+                  /* If exceeds best match so far, save it.  */
+                  if (!best_regs_set
+                      || (same_str_p && d > match_end)
+                      || (!same_str_p && !MATCHING_IN_FIRST_STRING))
+                    {
+                      best_regs_set = true;
+                      match_end = d;
+                      
+                      DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
+                      
+                      for (mcnt = 1; mcnt < num_regs; mcnt++)
+                        {
+                          best_regstart[mcnt] = regstart[mcnt];
+                          best_regend[mcnt] = regend[mcnt];
+                        }
+                    }
+                  goto fail;	       
+                }
+
+              /* If no failure points, don't restore garbage.  */
+              else if (best_regs_set)   
+                {
+  	        restore_best_regs:
+                  /* Restore best match.  It may happen that `dend ==
+                     end_match_1' while the restored d is in string2.
+                     For example, the pattern `x.*y.*z' against the
+                     strings `x-' and `y-z-', if the two strings are
+                     not consecutive in memory.  */
+                  DEBUG_PRINT1 ("Restoring best registers.\n");
+                  
+                  d = match_end;
+                  dend = ((d >= string1 && d <= end1)
+		           ? end_match_1 : end_match_2);
+
+		  for (mcnt = 1; mcnt < num_regs; mcnt++)
+		    {
+		      regstart[mcnt] = best_regstart[mcnt];
+		      regend[mcnt] = best_regend[mcnt];
+		    }
+                }
+            } /* d != end_match_2 */
+
+          DEBUG_PRINT1 ("Accepting match.\n");
+
+          /* If caller wants register contents data back, do it.  */
+          if (regs && !bufp->no_sub)
+	    {
+              /* Have the register data arrays been allocated?  */
+              if (bufp->regs_allocated == REGS_UNALLOCATED)
+                { /* No.  So allocate them with malloc.  We need one
+                     extra element beyond `num_regs' for the `-1' marker
+                     GNU code uses.  */
+                  regs->num_regs = MAX (RE_NREGS, num_regs + 1);
+                  regs->start = TALLOC (regs->num_regs, regoff_t);
+                  regs->end = TALLOC (regs->num_regs, regoff_t);
+                  if (regs->start == NULL || regs->end == NULL)
+                    return -2;
+                  bufp->regs_allocated = REGS_REALLOCATE;
+                }
+              else if (bufp->regs_allocated == REGS_REALLOCATE)
+                { /* Yes.  If we need more elements than were already
+                     allocated, reallocate them.  If we need fewer, just
+                     leave it alone.  */
+                  if (regs->num_regs < num_regs + 1)
+                    {
+                      regs->num_regs = num_regs + 1;
+                      RETALLOC (regs->start, regs->num_regs, regoff_t);
+                      RETALLOC (regs->end, regs->num_regs, regoff_t);
+                      if (regs->start == NULL || regs->end == NULL)
+                        return -2;
+                    }
+                }
+              else
+                assert (bufp->regs_allocated == REGS_FIXED);
+
+              /* Convert the pointer data in `regstart' and `regend' to
+                 indices.  Register zero has to be set differently,
+                 since we haven't kept track of any info for it.  */
+              if (regs->num_regs > 0)
+                {
+                  regs->start[0] = pos;
+                  regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1
+			          : d - string2 + size1);
+                }
+              
+              /* Go through the first `min (num_regs, regs->num_regs)'
+                 registers, since that is all we initialized.  */
+	      for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
+		{
+                  if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
+                    regs->start[mcnt] = regs->end[mcnt] = -1;
+                  else
+                    {
+		      regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]);
+                      regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]);
+                    }
+		}
+              
+              /* If the regs structure we return has more elements than
+                 were in the pattern, set the extra elements to -1.  If
+                 we (re)allocated the registers, this is the case,
+                 because we always allocate enough to have at least one
+                 -1 at the end.  */
+              for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
+                regs->start[mcnt] = regs->end[mcnt] = -1;
+	    } /* regs && !bufp->no_sub */
+
+          FREE_VARIABLES ();
+          DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
+                        nfailure_points_pushed, nfailure_points_popped,
+                        nfailure_points_pushed - nfailure_points_popped);
+          DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
+
+          mcnt = d - pos - (MATCHING_IN_FIRST_STRING 
+			    ? string1 
+			    : string2 - size1);
+
+          DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
+
+          return mcnt;
+        }
+
+      /* Otherwise match next pattern command.  */
+#ifdef SWITCH_ENUM_BUG
+      switch ((int) ((re_opcode_t) *p++))
+#else
+      switch ((re_opcode_t) *p++)
+#endif
+	{
+        /* Ignore these.  Used to ignore the n of succeed_n's which
+           currently have n == 0.  */
+        case no_op:
+          DEBUG_PRINT1 ("EXECUTING no_op.\n");
+          break;
+
+
+        /* Match the next n pattern characters exactly.  The following
+           byte in the pattern defines n, and the n bytes after that
+           are the characters to match.  */
+	case exactn:
+	  mcnt = *p++;
+          DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
+
+          /* This is written out as an if-else so we don't waste time
+             testing `translate' inside the loop.  */
+          if (translate)
+	    {
+	      do
+		{
+		  PREFETCH ();
+		  if (translate[(unsigned char) *d++] != (char) *p++)
+                    goto fail;
+		}
+	      while (--mcnt);
+	    }
+	  else
+	    {
+	      do
+		{
+		  PREFETCH ();
+		  if (*d++ != (char) *p++) goto fail;
+		}
+	      while (--mcnt);
+	    }
+	  SET_REGS_MATCHED ();
+          break;
+
+
+        /* Match any character except possibly a newline or a null.  */
+	case anychar:
+          DEBUG_PRINT1 ("EXECUTING anychar.\n");
+
+          PREFETCH ();
+
+          if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
+              || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
+	    goto fail;
+
+          SET_REGS_MATCHED ();
+          DEBUG_PRINT2 ("  Matched `%d'.\n", *d);
+          d++;
+	  break;
+
+
+	case charset:
+	case charset_not:
+	  {
+	    register unsigned char c;
+	    boolean not = (re_opcode_t) *(p - 1) == charset_not;
+
+            DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
+
+	    PREFETCH ();
+	    c = TRANSLATE (*d); /* The character to match.  */
+
+            /* Cast to `unsigned' instead of `unsigned char' in case the
+               bit list is a full 32 bytes long.  */
+	    if (c < (unsigned) (*p * BYTEWIDTH)
+		&& p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
+	      not = !not;
+
+	    p += 1 + *p;
+
+	    if (!not) goto fail;
+            
+	    SET_REGS_MATCHED ();
+            d++;
+	    break;
+	  }
+
+
+        /* The beginning of a group is represented by start_memory.
+           The arguments are the register number in the next byte, and the
+           number of groups inner to this one in the next.  The text
+           matched within the group is recorded (in the internal
+           registers data structure) under the register number.  */
+        case start_memory:
+	  DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
+
+          /* Find out if this group can match the empty string.  */
+	  p1 = p;		/* To send to group_match_null_string_p.  */
+          
+          if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
+            REG_MATCH_NULL_STRING_P (reg_info[*p]) 
+              = group_match_null_string_p (&p1, pend, reg_info);
+
+          /* Save the position in the string where we were the last time
+             we were at this open-group operator in case the group is
+             operated upon by a repetition operator, e.g., with `(a*)*b'
+             against `ab'; then we want to ignore where we are now in
+             the string in case this attempt to match fails.  */
+          old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
+                             ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
+                             : regstart[*p];
+	  DEBUG_PRINT2 ("  old_regstart: %d\n", 
+			 POINTER_TO_OFFSET (old_regstart[*p]));
+
+          regstart[*p] = d;
+	  DEBUG_PRINT2 ("  regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
+
+          IS_ACTIVE (reg_info[*p]) = 1;
+          MATCHED_SOMETHING (reg_info[*p]) = 0;
+          
+          /* This is the new highest active register.  */
+          highest_active_reg = *p;
+          
+          /* If nothing was active before, this is the new lowest active
+             register.  */
+          if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
+            lowest_active_reg = *p;
+
+          /* Move past the register number and inner group count.  */
+          p += 2;
+          break;
+
+
+        /* The stop_memory opcode represents the end of a group.  Its
+           arguments are the same as start_memory's: the register
+           number, and the number of inner groups.  */
+	case stop_memory:
+	  DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
+             
+          /* We need to save the string position the last time we were at
+             this close-group operator in case the group is operated
+             upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
+             against `aba'; then we want to ignore where we are now in
+             the string in case this attempt to match fails.  */
+          old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
+                           ? REG_UNSET (regend[*p]) ? d : regend[*p]
+			   : regend[*p];
+	  DEBUG_PRINT2 ("      old_regend: %d\n", 
+			 POINTER_TO_OFFSET (old_regend[*p]));
+
+          regend[*p] = d;
+	  DEBUG_PRINT2 ("      regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
+
+          /* This register isn't active anymore.  */
+          IS_ACTIVE (reg_info[*p]) = 0;
+          
+          /* If this was the only register active, nothing is active
+             anymore.  */
+          if (lowest_active_reg == highest_active_reg)
+            {
+              lowest_active_reg = NO_LOWEST_ACTIVE_REG;
+              highest_active_reg = NO_HIGHEST_ACTIVE_REG;
+            }
+          else
+            { /* We must scan for the new highest active register, since
+                 it isn't necessarily one less than now: consider
+                 (a(b)c(d(e)f)g).  When group 3 ends, after the f), the
+                 new highest active register is 1.  */
+              unsigned char r = *p - 1;
+              while (r > 0 && !IS_ACTIVE (reg_info[r]))
+                r--;
+              
+              /* If we end up at register zero, that means that we saved
+                 the registers as the result of an `on_failure_jump', not
+                 a `start_memory', and we jumped to past the innermost
+                 `stop_memory'.  For example, in ((.)*) we save
+                 registers 1 and 2 as a result of the *, but when we pop
+                 back to the second ), we are at the stop_memory 1.
+                 Thus, nothing is active.  */
+	      if (r == 0)
+                {
+                  lowest_active_reg = NO_LOWEST_ACTIVE_REG;
+                  highest_active_reg = NO_HIGHEST_ACTIVE_REG;
+                }
+              else
+                highest_active_reg = r;
+            }
+          
+          /* If just failed to match something this time around with a
+             group that's operated on by a repetition operator, try to
+             force exit from the ``loop'', and restore the register
+             information for this group that we had before trying this
+             last match.  */
+          if ((!MATCHED_SOMETHING (reg_info[*p])
+               || (re_opcode_t) p[-3] == start_memory)
+	      && (p + 2) < pend)              
+            {
+              boolean is_a_jump_n = false;
+              
+              p1 = p + 2;
+              mcnt = 0;
+              switch ((re_opcode_t) *p1++)
+                {
+                  case jump_n:
+		    is_a_jump_n = true;
+                  case pop_failure_jump:
+		  case maybe_pop_jump:
+		  case jump:
+		  case dummy_failure_jump:
+                    EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+		    if (is_a_jump_n)
+		      p1 += 2;
+                    break;
+                  
+                  default:
+                    /* do nothing */ ;
+                }
+	      p1 += mcnt;
+        
+              /* If the next operation is a jump backwards in the pattern
+	         to an on_failure_jump right before the start_memory
+                 corresponding to this stop_memory, exit from the loop
+                 by forcing a failure after pushing on the stack the
+                 on_failure_jump's jump in the pattern, and d.  */
+              if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
+                  && (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
+		{
+                  /* If this group ever matched anything, then restore
+                     what its registers were before trying this last
+                     failed match, e.g., with `(a*)*b' against `ab' for
+                     regstart[1], and, e.g., with `((a*)*(b*)*)*'
+                     against `aba' for regend[3].
+                     
+                     Also restore the registers for inner groups for,
+                     e.g., `((a*)(b*))*' against `aba' (register 3 would
+                     otherwise get trashed).  */
+                     
+                  if (EVER_MATCHED_SOMETHING (reg_info[*p]))
+		    {
+		      unsigned r; 
+        
+                      EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
+                      
+		      /* Restore this and inner groups' (if any) registers.  */
+                      for (r = *p; r < *p + *(p + 1); r++)
+                        {
+                          regstart[r] = old_regstart[r];
+
+                          /* xx why this test?  */
+                          if ((int) old_regend[r] >= (int) regstart[r])
+                            regend[r] = old_regend[r];
+                        }     
+                    }
+		  p1++;
+                  EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+                  PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
+
+                  goto fail;
+                }
+            }
+          
+          /* Move past the register number and the inner group count.  */
+          p += 2;
+          break;
+
+
+	/* \<digit> has been turned into a `duplicate' command which is
+           followed by the numeric value of <digit> as the register number.  */
+        case duplicate:
+	  {
+	    register const char *d2, *dend2;
+	    int regno = *p++;   /* Get which register to match against.  */
+	    DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
+
+	    /* Can't back reference a group which we've never matched.  */
+            if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
+              goto fail;
+              
+            /* Where in input to try to start matching.  */
+            d2 = regstart[regno];
+            
+            /* Where to stop matching; if both the place to start and
+               the place to stop matching are in the same string, then
+               set to the place to stop, otherwise, for now have to use
+               the end of the first string.  */
+
+            dend2 = ((FIRST_STRING_P (regstart[regno]) 
+		      == FIRST_STRING_P (regend[regno]))
+		     ? regend[regno] : end_match_1);
+	    for (;;)
+	      {
+		/* If necessary, advance to next segment in register
+                   contents.  */
+		while (d2 == dend2)
+		  {
+		    if (dend2 == end_match_2) break;
+		    if (dend2 == regend[regno]) break;
+
+                    /* End of string1 => advance to string2. */
+                    d2 = string2;
+                    dend2 = regend[regno];
+		  }
+		/* At end of register contents => success */
+		if (d2 == dend2) break;
+
+		/* If necessary, advance to next segment in data.  */
+		PREFETCH ();
+
+		/* How many characters left in this segment to match.  */
+		mcnt = dend - d;
+                
+		/* Want how many consecutive characters we can match in
+                   one shot, so, if necessary, adjust the count.  */
+                if (mcnt > dend2 - d2)
+		  mcnt = dend2 - d2;
+                  
+		/* Compare that many; failure if mismatch, else move
+                   past them.  */
+		if (translate 
+                    ? bcmp_translate (d, d2, mcnt, translate) 
+                    : bcmp (d, d2, mcnt))
+		  goto fail;
+		d += mcnt, d2 += mcnt;
+	      }
+	  }
+	  break;
+
+
+        /* begline matches the empty string at the beginning of the string
+           (unless `not_bol' is set in `bufp'), and, if
+           `newline_anchor' is set, after newlines.  */
+	case begline:
+          DEBUG_PRINT1 ("EXECUTING begline.\n");
+          
+          if (AT_STRINGS_BEG (d))
+            {
+              if (!bufp->not_bol) break;
+            }
+          else if (d[-1] == '\n' && bufp->newline_anchor)
+            {
+              break;
+            }
+          /* In all other cases, we fail.  */
+          goto fail;
+
+
+        /* endline is the dual of begline.  */
+	case endline:
+          DEBUG_PRINT1 ("EXECUTING endline.\n");
+
+          if (AT_STRINGS_END (d))
+            {
+              if (!bufp->not_eol) break;
+            }
+          
+          /* We have to ``prefetch'' the next character.  */
+          else if ((d == end1 ? *string2 : *d) == '\n'
+                   && bufp->newline_anchor)
+            {
+              break;
+            }
+          goto fail;
+
+
+	/* Match at the very beginning of the data.  */
+        case begbuf:
+          DEBUG_PRINT1 ("EXECUTING begbuf.\n");
+          if (AT_STRINGS_BEG (d))
+            break;
+          goto fail;
+
+
+	/* Match at the very end of the data.  */
+        case endbuf:
+          DEBUG_PRINT1 ("EXECUTING endbuf.\n");
+	  if (AT_STRINGS_END (d))
+	    break;
+          goto fail;
+
+
+        /* on_failure_keep_string_jump is used to optimize `.*\n'.  It
+           pushes NULL as the value for the string on the stack.  Then
+           `pop_failure_point' will keep the current value for the
+           string, instead of restoring it.  To see why, consider
+           matching `foo\nbar' against `.*\n'.  The .* matches the foo;
+           then the . fails against the \n.  But the next thing we want
+           to do is match the \n against the \n; if we restored the
+           string value, we would be back at the foo.
+           
+           Because this is used only in specific cases, we don't need to
+           check all the things that `on_failure_jump' does, to make
+           sure the right things get saved on the stack.  Hence we don't
+           share its code.  The only reason to push anything on the
+           stack at all is that otherwise we would have to change
+           `anychar's code to do something besides goto fail in this
+           case; that seems worse than this.  */
+        case on_failure_keep_string_jump:
+          DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
+          
+          EXTRACT_NUMBER_AND_INCR (mcnt, p);
+          DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
+
+          PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
+          break;
+
+
+	/* Uses of on_failure_jump:
+        
+           Each alternative starts with an on_failure_jump that points
+           to the beginning of the next alternative.  Each alternative
+           except the last ends with a jump that in effect jumps past
+           the rest of the alternatives.  (They really jump to the
+           ending jump of the following alternative, because tensioning
+           these jumps is a hassle.)
+
+           Repeats start with an on_failure_jump that points past both
+           the repetition text and either the following jump or
+           pop_failure_jump back to this on_failure_jump.  */
+	case on_failure_jump:
+        on_failure:
+          DEBUG_PRINT1 ("EXECUTING on_failure_jump");
+
+          EXTRACT_NUMBER_AND_INCR (mcnt, p);
+          DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
+
+          /* If this on_failure_jump comes right before a group (i.e.,
+             the original * applied to a group), save the information
+             for that group and all inner ones, so that if we fail back
+             to this point, the group's information will be correct.
+             For example, in \(a*\)*\1, we need the preceding group,
+             and in \(\(a*\)b*\)\2, we need the inner group.  */
+
+          /* We can't use `p' to check ahead because we push
+             a failure point to `p + mcnt' after we do this.  */
+          p1 = p;
+
+          /* We need to skip no_op's before we look for the
+             start_memory in case this on_failure_jump is happening as
+             the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
+             against aba.  */
+          while (p1 < pend && (re_opcode_t) *p1 == no_op)
+            p1++;
+
+          if (p1 < pend && (re_opcode_t) *p1 == start_memory)
+            {
+              /* We have a new highest active register now.  This will
+                 get reset at the start_memory we are about to get to,
+                 but we will have saved all the registers relevant to
+                 this repetition op, as described above.  */
+              highest_active_reg = *(p1 + 1) + *(p1 + 2);
+              if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
+                lowest_active_reg = *(p1 + 1);
+            }
+
+          DEBUG_PRINT1 (":\n");
+          PUSH_FAILURE_POINT (p + mcnt, d, -2);
+          break;
+
+
+        /* A smart repeat ends with `maybe_pop_jump'.
+	   We change it to either `pop_failure_jump' or `jump'.  */
+        case maybe_pop_jump:
+          EXTRACT_NUMBER_AND_INCR (mcnt, p);
+          DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
+          {
+	    register unsigned char *p2 = p;
+
+            /* Compare the beginning of the repeat with what in the
+               pattern follows its end. If we can establish that there
+               is nothing that they would both match, i.e., that we
+               would have to backtrack because of (as in, e.g., `a*a')
+               then we can change to pop_failure_jump, because we'll
+               never have to backtrack.
+               
+               This is not true in the case of alternatives: in
+               `(a|ab)*' we do need to backtrack to the `ab' alternative
+               (e.g., if the string was `ab').  But instead of trying to
+               detect that here, the alternative has put on a dummy
+               failure point which is what we will end up popping.  */
+
+	    /* Skip over open/close-group commands.  */
+	    while (p2 + 2 < pend
+		   && ((re_opcode_t) *p2 == stop_memory
+		       || (re_opcode_t) *p2 == start_memory))
+	      p2 += 3;			/* Skip over args, too.  */
+
+            /* If we're at the end of the pattern, we can change.  */
+            if (p2 == pend)
+	      {
+		/* Consider what happens when matching ":\(.*\)"
+		   against ":/".  I don't really understand this code
+		   yet.  */
+  	        p[-3] = (unsigned char) pop_failure_jump;
+                DEBUG_PRINT1
+                  ("  End of pattern: change to `pop_failure_jump'.\n");
+              }
+
+            else if ((re_opcode_t) *p2 == exactn
+		     || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
+	      {
+		register unsigned char c
+                  = *p2 == (unsigned char) endline ? '\n' : p2[2];
+		p1 = p + mcnt;
+
+                /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
+                   to the `maybe_finalize_jump' of this case.  Examine what 
+                   follows.  */
+                if ((re_opcode_t) p1[3] == exactn && p1[5] != c)
+                  {
+  		    p[-3] = (unsigned char) pop_failure_jump;
+                    DEBUG_PRINT3 ("  %c != %c => pop_failure_jump.\n",
+                                  c, p1[5]);
+                  }
+                  
+		else if ((re_opcode_t) p1[3] == charset
+			 || (re_opcode_t) p1[3] == charset_not)
+		  {
+		    int not = (re_opcode_t) p1[3] == charset_not;
+                    
+		    if (c < (unsigned char) (p1[4] * BYTEWIDTH)
+			&& p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
+		      not = !not;
+
+                    /* `not' is equal to 1 if c would match, which means
+                        that we can't change to pop_failure_jump.  */
+		    if (!not)
+                      {
+  		        p[-3] = (unsigned char) pop_failure_jump;
+                        DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
+                      }
+		  }
+	      }
+	  }
+	  p -= 2;		/* Point at relative address again.  */
+	  if ((re_opcode_t) p[-1] != pop_failure_jump)
+	    {
+	      p[-1] = (unsigned char) jump;
+              DEBUG_PRINT1 ("  Match => jump.\n");
+	      goto unconditional_jump;
+	    }
+        /* Note fall through.  */
+
+
+	/* The end of a simple repeat has a pop_failure_jump back to
+           its matching on_failure_jump, where the latter will push a
+           failure point.  The pop_failure_jump takes off failure
+           points put on by this pop_failure_jump's matching
+           on_failure_jump; we got through the pattern to here from the
+           matching on_failure_jump, so didn't fail.  */
+        case pop_failure_jump:
+          {
+            /* We need to pass separate storage for the lowest and
+               highest registers, even though we don't care about the
+               actual values.  Otherwise, we will restore only one
+               register from the stack, since lowest will == highest in
+               `pop_failure_point'.  */
+            unsigned dummy_low_reg, dummy_high_reg;
+            unsigned char *pdummy;
+            const char *sdummy;
+
+            DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
+            POP_FAILURE_POINT (sdummy, pdummy,
+                               dummy_low_reg, dummy_high_reg,
+                               reg_dummy, reg_dummy, reg_info_dummy);
+          }
+          /* Note fall through.  */
+
+          
+        /* Unconditionally jump (without popping any failure points).  */
+        case jump:
+	unconditional_jump:
+	  EXTRACT_NUMBER_AND_INCR (mcnt, p);	/* Get the amount to jump.  */
+          DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
+	  p += mcnt;				/* Do the jump.  */
+          DEBUG_PRINT2 ("(to 0x%x).\n", p);
+	  break;
+
+	
+        /* We need this opcode so we can detect where alternatives end
+           in `group_match_null_string_p' et al.  */
+        case jump_past_alt:
+          DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
+          goto unconditional_jump;
+
+
+        /* Normally, the on_failure_jump pushes a failure point, which
+           then gets popped at pop_failure_jump.  We will end up at
+           pop_failure_jump, also, and with a pattern of, say, `a+', we
+           are skipping over the on_failure_jump, so we have to push
+           something meaningless for pop_failure_jump to pop.  */
+        case dummy_failure_jump:
+          DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
+          /* It doesn't matter what we push for the string here.  What
+             the code at `fail' tests is the value for the pattern.  */
+          PUSH_FAILURE_POINT (0, 0, -2);
+          goto unconditional_jump;
+
+
+        /* At the end of an alternative, we need to push a dummy failure
+           point in case we are followed by a `pop_failure_jump', because
+           we don't want the failure point for the alternative to be
+           popped.  For example, matching `(a|ab)*' against `aab'
+           requires that we match the `ab' alternative.  */
+        case push_dummy_failure:
+          DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
+          /* See comments just above at `dummy_failure_jump' about the
+             two zeroes.  */
+          PUSH_FAILURE_POINT (0, 0, -2);
+          break;
+
+        /* Have to succeed matching what follows at least n times.
+           After that, handle like `on_failure_jump'.  */
+        case succeed_n: 
+          EXTRACT_NUMBER (mcnt, p + 2);
+          DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
+
+          assert (mcnt >= 0);
+          /* Originally, this is how many times we HAVE to succeed.  */
+          if (mcnt > 0)
+            {
+               mcnt--;
+	       p += 2;
+               STORE_NUMBER_AND_INCR (p, mcnt);
+               DEBUG_PRINT3 ("  Setting 0x%x to %d.\n", p, mcnt);
+            }
+	  else if (mcnt == 0)
+            {
+              DEBUG_PRINT2 ("  Setting two bytes from 0x%x to no_op.\n", p+2);
+	      p[2] = (unsigned char) no_op;
+              p[3] = (unsigned char) no_op;
+              goto on_failure;
+            }
+          break;
+        
+        case jump_n: 
+          EXTRACT_NUMBER (mcnt, p + 2);
+          DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
+
+          /* Originally, this is how many times we CAN jump.  */
+          if (mcnt)
+            {
+               mcnt--;
+               STORE_NUMBER (p + 2, mcnt);
+	       goto unconditional_jump;	     
+            }
+          /* If don't have to jump any more, skip over the rest of command.  */
+	  else      
+	    p += 4;		     
+          break;
+        
+	case set_number_at:
+	  {
+            DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
+
+            EXTRACT_NUMBER_AND_INCR (mcnt, p);
+            p1 = p + mcnt;
+            EXTRACT_NUMBER_AND_INCR (mcnt, p);
+            DEBUG_PRINT3 ("  Setting 0x%x to %d.\n", p1, mcnt);
+	    STORE_NUMBER (p1, mcnt);
+            break;
+          }
+
+        case wordbound:
+          DEBUG_PRINT1 ("EXECUTING wordbound.\n");
+          if (AT_WORD_BOUNDARY (d))
+	    break;
+          goto fail;
+
+	case notwordbound:
+          DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
+	  if (AT_WORD_BOUNDARY (d))
+	    goto fail;
+          break;
+
+	case wordbeg:
+          DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
+	  if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
+	    break;
+          goto fail;
+
+	case wordend:
+          DEBUG_PRINT1 ("EXECUTING wordend.\n");
+	  if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
+              && (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
+	    break;
+          goto fail;
+
+#ifdef emacs
+#ifdef emacs19
+  	case before_dot:
+          DEBUG_PRINT1 ("EXECUTING before_dot.\n");
+ 	  if (PTR_CHAR_POS ((unsigned char *) d) >= point)
+  	    goto fail;
+  	  break;
+  
+  	case at_dot:
+          DEBUG_PRINT1 ("EXECUTING at_dot.\n");
+ 	  if (PTR_CHAR_POS ((unsigned char *) d) != point)
+  	    goto fail;
+  	  break;
+  
+  	case after_dot:
+          DEBUG_PRINT1 ("EXECUTING after_dot.\n");
+          if (PTR_CHAR_POS ((unsigned char *) d) <= point)
+  	    goto fail;
+  	  break;
+#else /* not emacs19 */
+	case at_dot:
+          DEBUG_PRINT1 ("EXECUTING at_dot.\n");
+	  if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point)
+	    goto fail;
+	  break;
+#endif /* not emacs19 */
+
+	case syntaxspec:
+          DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
+	  mcnt = *p++;
+	  goto matchsyntax;
+
+        case wordchar:
+          DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
+	  mcnt = (int) Sword;
+        matchsyntax:
+	  PREFETCH ();
+	  if (SYNTAX (*d++) != (enum syntaxcode) mcnt)
+            goto fail;
+          SET_REGS_MATCHED ();
+	  break;
+
+	case notsyntaxspec:
+          DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
+	  mcnt = *p++;
+	  goto matchnotsyntax;
+
+        case notwordchar:
+          DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
+	  mcnt = (int) Sword;
+        matchnotsyntax:
+	  PREFETCH ();
+	  if (SYNTAX (*d++) == (enum syntaxcode) mcnt)
+            goto fail;
+	  SET_REGS_MATCHED ();
+          break;
+
+#else /* not emacs */
+	case wordchar:
+          DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
+	  PREFETCH ();
+          if (!WORDCHAR_P (d))
+            goto fail;
+	  SET_REGS_MATCHED ();
+          d++;
+	  break;
+	  
+	case notwordchar:
+          DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
+	  PREFETCH ();
+	  if (WORDCHAR_P (d))
+            goto fail;
+          SET_REGS_MATCHED ();
+          d++;
+	  break;
+#endif /* not emacs */
+          
+        default:
+          abort ();
+	}
+      continue;  /* Successfully executed one pattern command; keep going.  */
+
+
+    /* We goto here if a matching operation fails. */
+    fail:
+      if (!FAIL_STACK_EMPTY ())
+	{ /* A restart point is known.  Restore to that state.  */
+          DEBUG_PRINT1 ("\nFAIL:\n");
+          POP_FAILURE_POINT (d, p,
+                             lowest_active_reg, highest_active_reg,
+                             regstart, regend, reg_info);
+
+          /* If this failure point is a dummy, try the next one.  */
+          if (!p)
+	    goto fail;
+
+          /* If we failed to the end of the pattern, don't examine *p.  */
+	  assert (p <= pend);
+          if (p < pend)
+            {
+              boolean is_a_jump_n = false;
+              
+              /* If failed to a backwards jump that's part of a repetition
+                 loop, need to pop this failure point and use the next one.  */
+              switch ((re_opcode_t) *p)
+                {
+                case jump_n:
+                  is_a_jump_n = true;
+                case maybe_pop_jump:
+                case pop_failure_jump:
+                case jump:
+                  p1 = p + 1;
+                  EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+                  p1 += mcnt;	
+
+                  if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
+                      || (!is_a_jump_n
+                          && (re_opcode_t) *p1 == on_failure_jump))
+                    goto fail;
+                  break;
+                default:
+                  /* do nothing */ ;
+                }
+            }
+
+          if (d >= string1 && d <= end1)
+	    dend = end_match_1;
+        }
+      else
+        break;   /* Matching at this starting point really fails.  */
+    } /* for (;;) */
+
+  if (best_regs_set)
+    goto restore_best_regs;
+
+  FREE_VARIABLES ();
+
+  return -1;         			/* Failure to match.  */
+} /* re_match_2 */
+
+/* Subroutine definitions for re_match_2.  */
+
+
+/* We are passed P pointing to a register number after a start_memory.
+   
+   Return true if the pattern up to the corresponding stop_memory can
+   match the empty string, and false otherwise.
+   
+   If we find the matching stop_memory, sets P to point to one past its number.
+   Otherwise, sets P to an undefined byte less than or equal to END.
+
+   We don't handle duplicates properly (yet).  */
+
+static boolean
+group_match_null_string_p (p, end, reg_info)
+    unsigned char **p, *end;
+    register_info_type *reg_info;
+{
+  int mcnt;
+  /* Point to after the args to the start_memory.  */
+  unsigned char *p1 = *p + 2;
+  
+  while (p1 < end)
+    {
+      /* Skip over opcodes that can match nothing, and return true or
+	 false, as appropriate, when we get to one that can't, or to the
+         matching stop_memory.  */
+      
+      switch ((re_opcode_t) *p1)
+        {
+        /* Could be either a loop or a series of alternatives.  */
+        case on_failure_jump:
+          p1++;
+          EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+          
+          /* If the next operation is not a jump backwards in the
+	     pattern.  */
+
+	  if (mcnt >= 0)
+	    {
+              /* Go through the on_failure_jumps of the alternatives,
+                 seeing if any of the alternatives cannot match nothing.
+                 The last alternative starts with only a jump,
+                 whereas the rest start with on_failure_jump and end
+                 with a jump, e.g., here is the pattern for `a|b|c':
+
+                 /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
+                 /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
+                 /exactn/1/c						
+
+                 So, we have to first go through the first (n-1)
+                 alternatives and then deal with the last one separately.  */
+
+
+              /* Deal with the first (n-1) alternatives, which start
+                 with an on_failure_jump (see above) that jumps to right
+                 past a jump_past_alt.  */
+
+              while ((re_opcode_t) p1[mcnt-3] == jump_past_alt)
+                {
+                  /* `mcnt' holds how many bytes long the alternative
+                     is, including the ending `jump_past_alt' and
+                     its number.  */
+
+                  if (!alt_match_null_string_p (p1, p1 + mcnt - 3, 
+				                      reg_info))
+                    return false;
+
+                  /* Move to right after this alternative, including the
+		     jump_past_alt.  */
+                  p1 += mcnt;	
+
+                  /* Break if it's the beginning of an n-th alternative
+                     that doesn't begin with an on_failure_jump.  */
+                  if ((re_opcode_t) *p1 != on_failure_jump)
+                    break;
+		
+		  /* Still have to check that it's not an n-th
+		     alternative that starts with an on_failure_jump.  */
+		  p1++;
+                  EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+                  if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
+                    {
+		      /* Get to the beginning of the n-th alternative.  */
+                      p1 -= 3;
+                      break;
+                    }
+                }
+
+              /* Deal with the last alternative: go back and get number
+                 of the `jump_past_alt' just before it.  `mcnt' contains
+                 the length of the alternative.  */
+              EXTRACT_NUMBER (mcnt, p1 - 2);
+
+              if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
+                return false;
+
+              p1 += mcnt;	/* Get past the n-th alternative.  */
+            } /* if mcnt > 0 */
+          break;
+
+          
+        case stop_memory:
+	  assert (p1[1] == **p);
+          *p = p1 + 2;
+          return true;
+
+        
+        default: 
+          if (!common_op_match_null_string_p (&p1, end, reg_info))
+            return false;
+        }
+    } /* while p1 < end */
+
+  return false;
+} /* group_match_null_string_p */
+
+
+/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
+   It expects P to be the first byte of a single alternative and END one
+   byte past the last. The alternative can contain groups.  */
+   
+static boolean
+alt_match_null_string_p (p, end, reg_info)
+    unsigned char *p, *end;
+    register_info_type *reg_info;
+{
+  int mcnt;
+  unsigned char *p1 = p;
+  
+  while (p1 < end)
+    {
+      /* Skip over opcodes that can match nothing, and break when we get 
+         to one that can't.  */
+      
+      switch ((re_opcode_t) *p1)
+        {
+	/* It's a loop.  */
+        case on_failure_jump:
+          p1++;
+          EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+          p1 += mcnt;
+          break;
+          
+	default: 
+          if (!common_op_match_null_string_p (&p1, end, reg_info))
+            return false;
+        }
+    }  /* while p1 < end */
+
+  return true;
+} /* alt_match_null_string_p */
+
+
+/* Deals with the ops common to group_match_null_string_p and
+   alt_match_null_string_p.  
+   
+   Sets P to one after the op and its arguments, if any.  */
+
+static boolean
+common_op_match_null_string_p (p, end, reg_info)
+    unsigned char **p, *end;
+    register_info_type *reg_info;
+{
+  int mcnt;
+  boolean ret;
+  int reg_no;
+  unsigned char *p1 = *p;
+
+  switch ((re_opcode_t) *p1++)
+    {
+    case no_op:
+    case begline:
+    case endline:
+    case begbuf:
+    case endbuf:
+    case wordbeg:
+    case wordend:
+    case wordbound:
+    case notwordbound:
+#ifdef emacs
+    case before_dot:
+    case at_dot:
+    case after_dot:
+#endif
+      break;
+
+    case start_memory:
+      reg_no = *p1;
+      assert (reg_no > 0 && reg_no <= MAX_REGNUM);
+      ret = group_match_null_string_p (&p1, end, reg_info);
+      
+      /* Have to set this here in case we're checking a group which
+         contains a group and a back reference to it.  */
+
+      if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
+        REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
+
+      if (!ret)
+        return false;
+      break;
+          
+    /* If this is an optimized succeed_n for zero times, make the jump.  */
+    case jump:
+      EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+      if (mcnt >= 0)
+        p1 += mcnt;
+      else
+        return false;
+      break;
+
+    case succeed_n:
+      /* Get to the number of times to succeed.  */
+      p1 += 2;		
+      EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+
+      if (mcnt == 0)
+        {
+          p1 -= 4;
+          EXTRACT_NUMBER_AND_INCR (mcnt, p1);
+          p1 += mcnt;
+        }
+      else
+        return false;
+      break;
+
+    case duplicate: 
+      if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
+        return false;
+      break;
+
+    case set_number_at:
+      p1 += 4;
+
+    default:
+      /* All other opcodes mean we cannot match the empty string.  */
+      return false;
+  }
+
+  *p = p1;
+  return true;
+} /* common_op_match_null_string_p */
+
+
+/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
+   bytes; nonzero otherwise.  */
+   
+static int
+bcmp_translate (s1, s2, len, translate)
+     unsigned char *s1, *s2;
+     register int len;
+     char *translate;
+{
+  register unsigned char *p1 = s1, *p2 = s2;
+  while (len)
+    {
+      if (translate[*p1++] != translate[*p2++]) return 1;
+      len--;
+    }
+  return 0;
+}
+
+/* Entry points for GNU code.  */
+
+/* re_compile_pattern is the GNU regular expression compiler: it
+   compiles PATTERN (of length SIZE) and puts the result in BUFP.
+   Returns 0 if the pattern was valid, otherwise an error string.
+   
+   Assumes the `allocated' (and perhaps `buffer') and `translate' fields
+   are set in BUFP on entry.
+   
+   We call regex_compile to do the actual compilation.  */
+
+const char *
+re_compile_pattern (pattern, length, bufp)
+     const char *pattern;
+     int length;
+     struct re_pattern_buffer *bufp;
+{
+  reg_errcode_t ret;
+  
+  /* GNU code is written to assume at least RE_NREGS registers will be set
+     (and at least one extra will be -1).  */
+  bufp->regs_allocated = REGS_UNALLOCATED;
+  
+  /* And GNU code determines whether or not to get register information
+     by passing null for the REGS argument to re_match, etc., not by
+     setting no_sub.  */
+  bufp->no_sub = 0;
+  
+  /* Match anchors at newline.  */
+  bufp->newline_anchor = 1;
+  
+  ret = regex_compile (pattern, length, re_syntax_options, bufp);
+
+  return re_error_msg[(int) ret];
+}     
+
+/* Entry points compatible with 4.2 BSD regex library.  We don't define
+   them if this is an Emacs or POSIX compilation.  */
+
+#if !defined (emacs) && !defined (_POSIX_SOURCE)
+
+/* BSD has one and only one pattern buffer.  */
+static struct re_pattern_buffer re_comp_buf;
+
+char *
+re_comp (s)
+    const char *s;
+{
+  reg_errcode_t ret;
+  
+  if (!s)
+    {
+      if (!re_comp_buf.buffer)
+	return "No previous regular expression";
+      return 0;
+    }
+
+  if (!re_comp_buf.buffer)
+    {
+      re_comp_buf.buffer = (unsigned char *) malloc (200);
+      if (re_comp_buf.buffer == NULL)
+        return "Memory exhausted";
+      re_comp_buf.allocated = 200;
+
+      re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
+      if (re_comp_buf.fastmap == NULL)
+	return "Memory exhausted";
+    }
+
+  /* Since `re_exec' always passes NULL for the `regs' argument, we
+     don't need to initialize the pattern buffer fields which affect it.  */
+
+  /* Match anchors at newlines.  */
+  re_comp_buf.newline_anchor = 1;
+
+  ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
+  
+  /* Yes, we're discarding `const' here.  */
+  return (char *) re_error_msg[(int) ret];
+}
+
+
+int
+re_exec (s)
+    const char *s;
+{
+  const int len = strlen (s);
+  return
+    0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
+}
+#endif /* not emacs and not _POSIX_SOURCE */
+
+/* POSIX.2 functions.  Don't define these for Emacs.  */
+
+#ifndef emacs
+
+/* regcomp takes a regular expression as a string and compiles it.
+
+   PREG is a regex_t *.  We do not expect any fields to be initialized,
+   since POSIX says we shouldn't.  Thus, we set
+
+     `buffer' to the compiled pattern;
+     `used' to the length of the compiled pattern;
+     `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
+       REG_EXTENDED bit in CFLAGS is set; otherwise, to
+       RE_SYNTAX_POSIX_BASIC;
+     `newline_anchor' to REG_NEWLINE being set in CFLAGS;
+     `fastmap' and `fastmap_accurate' to zero;
+     `re_nsub' to the number of subexpressions in PATTERN.
+
+   PATTERN is the address of the pattern string.
+
+   CFLAGS is a series of bits which affect compilation.
+
+     If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
+     use POSIX basic syntax.
+
+     If REG_NEWLINE is set, then . and [^...] don't match newline.
+     Also, regexec will try a match beginning after every newline.
+
+     If REG_ICASE is set, then we considers upper- and lowercase
+     versions of letters to be equivalent when matching.
+
+     If REG_NOSUB is set, then when PREG is passed to regexec, that
+     routine will report only success or failure, and nothing about the
+     registers.
+
+   It returns 0 if it succeeds, nonzero if it doesn't.  (See regex.h for
+   the return codes and their meanings.)  */
+
+int
+regcomp (preg, pattern, cflags)
+    regex_t *preg;
+    const char *pattern; 
+    int cflags;
+{
+  reg_errcode_t ret;
+  unsigned syntax
+    = (cflags & REG_EXTENDED) ?
+      RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
+
+  /* regex_compile will allocate the space for the compiled pattern.  */
+  preg->buffer = 0;
+  preg->allocated = 0;
+  
+  /* Don't bother to use a fastmap when searching.  This simplifies the
+     REG_NEWLINE case: if we used a fastmap, we'd have to put all the
+     characters after newlines into the fastmap.  This way, we just try
+     every character.  */
+  preg->fastmap = 0;
+  
+  if (cflags & REG_ICASE)
+    {
+      unsigned i;
+      
+      preg->translate = (char *) malloc (CHAR_SET_SIZE);
+      if (preg->translate == NULL)
+        return (int) REG_ESPACE;
+
+      /* Map uppercase characters to corresponding lowercase ones.  */
+      for (i = 0; i < CHAR_SET_SIZE; i++)
+        preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
+    }
+  else
+    preg->translate = NULL;
+
+  /* If REG_NEWLINE is set, newlines are treated differently.  */
+  if (cflags & REG_NEWLINE)
+    { /* REG_NEWLINE implies neither . nor [^...] match newline.  */
+      syntax &= ~RE_DOT_NEWLINE;
+      syntax |= RE_HAT_LISTS_NOT_NEWLINE;
+      /* It also changes the matching behavior.  */
+      preg->newline_anchor = 1;
+    }
+  else
+    preg->newline_anchor = 0;
+
+  preg->no_sub = !!(cflags & REG_NOSUB);
+
+  /* POSIX says a null character in the pattern terminates it, so we 
+     can use strlen here in compiling the pattern.  */
+  ret = regex_compile (pattern, strlen (pattern), syntax, preg);
+  
+  /* POSIX doesn't distinguish between an unmatched open-group and an
+     unmatched close-group: both are REG_EPAREN.  */
+  if (ret == REG_ERPAREN) ret = REG_EPAREN;
+  
+  return (int) ret;
+}
+
+
+/* regexec searches for a given pattern, specified by PREG, in the
+   string STRING.
+   
+   If NMATCH is zero or REG_NOSUB was set in the cflags argument to
+   `regcomp', we ignore PMATCH.  Otherwise, we assume PMATCH has at
+   least NMATCH elements, and we set them to the offsets of the
+   corresponding matched substrings.
+   
+   EFLAGS specifies `execution flags' which affect matching: if
+   REG_NOTBOL is set, then ^ does not match at the beginning of the
+   string; if REG_NOTEOL is set, then $ does not match at the end.
+   
+   We return 0 if we find a match and REG_NOMATCH if not.  */
+
+int
+regexec (preg, string, nmatch, pmatch, eflags)
+    const regex_t *preg;
+    const char *string; 
+    size_t nmatch; 
+    regmatch_t pmatch[]; 
+    int eflags;
+{
+  int ret;
+  struct re_registers regs;
+  regex_t private_preg;
+  int len = strlen (string);
+  boolean want_reg_info = !preg->no_sub && nmatch > 0;
+
+  private_preg = *preg;
+  
+  private_preg.not_bol = !!(eflags & REG_NOTBOL);
+  private_preg.not_eol = !!(eflags & REG_NOTEOL);
+  
+  /* The user has told us exactly how many registers to return
+     information about, via `nmatch'.  We have to pass that on to the
+     matching routines.  */
+  private_preg.regs_allocated = REGS_FIXED;
+  
+  if (want_reg_info)
+    {
+      regs.num_regs = nmatch;
+      regs.start = TALLOC (nmatch, regoff_t);
+      regs.end = TALLOC (nmatch, regoff_t);
+      if (regs.start == NULL || regs.end == NULL)
+        return (int) REG_NOMATCH;
+    }
+
+  /* Perform the searching operation.  */
+  ret = re_search (&private_preg, string, len,
+                   /* start: */ 0, /* range: */ len,
+                   want_reg_info ? &regs : (struct re_registers *) 0);
+  
+  /* Copy the register information to the POSIX structure.  */
+  if (want_reg_info)
+    {
+      if (ret >= 0)
+        {
+          unsigned r;
+
+          for (r = 0; r < nmatch; r++)
+            {
+              pmatch[r].rm_so = regs.start[r];
+              pmatch[r].rm_eo = regs.end[r];
+            }
+        }
+
+      /* If we needed the temporary register info, free the space now.  */
+      free (regs.start);
+      free (regs.end);
+    }
+
+  /* We want zero return to mean success, unlike `re_search'.  */
+  return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
+}
+
+
+/* Returns a message corresponding to an error code, ERRCODE, returned
+   from either regcomp or regexec.   We don't use PREG here.  */
+
+size_t
+regerror (errcode_vc, preg, errbuf, errbuf_size)
+    int errcode_vc; 
+    const regex_t *preg; 
+    char *errbuf; 
+    size_t errbuf_size; 
+{
+  const char *msg;
+  size_t msg_size;
+
+  if (errcode_vc < 0
+      || errcode_vc >= (sizeof (re_error_msg) / sizeof (re_error_msg[0])))
+    /* Only error codes returned by the rest of the code should be passed 
+       to this routine.  If we are given anything else, or if other regex
+       code generates an invalid error code, then the program has a bug.
+       Dump core so we can fix it.  */
+    abort ();
+
+  msg = re_error_msg[errcode_vc];
+
+  /* POSIX doesn't require that we do anything in this case, but why
+     not be nice.  */
+  if (! msg)
+    msg = "Success";
+
+  msg_size = strlen (msg) + 1; /* Includes the null.  */
+  
+  if (errbuf_size != 0)
+    {
+      if (msg_size > errbuf_size)
+        {
+          strncpy (errbuf, msg, errbuf_size - 1);
+          errbuf[errbuf_size - 1] = 0;
+        }
+      else
+        strcpy (errbuf, msg);
+    }
+
+  return msg_size;
+}
+
+
+/* Free dynamically allocated space used by PREG.  */
+
+void
+regfree (preg)
+    regex_t *preg;
+{
+  if (preg->buffer != NULL)
+    free (preg->buffer);
+  preg->buffer = NULL;
+  
+  preg->allocated = 0;
+  preg->used = 0;
+
+  if (preg->fastmap != NULL)
+    free (preg->fastmap);
+  preg->fastmap = NULL;
+  preg->fastmap_accurate = 0;
+
+  if (preg->translate != NULL)
+    free (preg->translate);
+  preg->translate = NULL;
+}
+
+#endif /* not emacs  */
+
+/*
+Local variables:
+make-backup-files: t
+version-control: t
+trim-versions-without-asking: nil
+End:
+*/
diff --git a/windows/regex.h b/windows/regex.h
new file mode 100644
index 0000000..adcf40c
--- /dev/null
+++ b/windows/regex.h
@@ -0,0 +1,506 @@
+/* Definitions for data structures and routines for the regular
+  expression library, version 0.12.
+
+  Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2, or (at your option)
+  any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifndef __REGEXP_LIBRARY_H__
+#define __REGEXP_LIBRARY_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /* POSIX says that <sys/types.h> must be included (by the caller) before
+       <regex.h>.  */
+
+#ifdef VMS
+    /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
+       should be there.  */
+#include <stddef.h>
+#endif
+
+
+    /* The following bits are used to determine the regexp syntax we
+       recognize.  The set/not-set meanings are chosen so that Emacs syntax
+       remains the value 0.  The bits are given in alphabetical order, and
+       the definitions shifted by one from the previous bit; thus, when we
+       add or remove a bit, only one other definition need change.  */
+    typedef unsigned reg_syntax_t;
+
+    /* If this bit is not set, then \ inside a bracket expression is literal.
+       If set, then such a \ quotes the following character.  */
+#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
+
+    /* If this bit is not set, then + and ? are operators, and \+ and \? are
+         literals. 
+       If set, then \+ and \? are operators and + and ? are literals.  */
+#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
+
+    /* If this bit is set, then character classes are supported.  They are:
+         [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],
+         [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
+       If not set, then character classes are not supported.  */
+#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
+
+    /* If this bit is set, then ^ and $ are always anchors (outside bracket
+         expressions, of course).
+       If this bit is not set, then it depends:
+            ^  is an anchor if it is at the beginning of a regular
+               expression or after an open-group or an alternation operator;
+            $  is an anchor if it is at the end of a regular expression, or
+               before a close-group or an alternation operator.  
+     
+       This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
+       POSIX draft 11.2 says that * etc. in leading positions is undefined.
+       We already implemented a previous draft which made those constructs
+       invalid, though, so we haven't changed the code back.  */
+#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
+
+    /* If this bit is set, then special characters are always special
+         regardless of where they are in the pattern.
+       If this bit is not set, then special characters are special only in
+         some contexts; otherwise they are ordinary.  Specifically, 
+         * + ? and intervals are only special when not after the beginning,
+         open-group, or alternation operator.  */
+#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
+
+    /* If this bit is set, then *, +, ?, and { cannot be first in an re or
+         immediately after an alternation or begin-group operator.  */
+#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
+
+    /* If this bit is set, then . matches newline.
+       If not set, then it doesn't.  */
+#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
+
+    /* If this bit is set, then . doesn't match NUL.
+       If not set, then it does.  */
+#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
+
+    /* If this bit is set, nonmatching lists [^...] do not match newline.
+       If not set, they do.  */
+#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
+
+    /* If this bit is set, either \{...\} or {...} defines an
+         interval, depending on RE_NO_BK_BRACES. 
+       If not set, \{, \}, {, and } are literals.  */
+#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
+
+    /* If this bit is set, +, ? and | aren't recognized as operators.
+       If not set, they are.  */
+#define RE_LIMITED_OPS (RE_INTERVALS << 1)
+
+    /* If this bit is set, newline is an alternation operator.
+       If not set, newline is literal.  */
+#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
+
+    /* If this bit is set, then `{...}' defines an interval, and \{ and \}
+         are literals.
+      If not set, then `\{...\}' defines an interval.  */
+#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
+
+    /* If this bit is set, (...) defines a group, and \( and \) are literals.
+       If not set, \(...\) defines a group, and ( and ) are literals.  */
+#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
+
+    /* If this bit is set, then \<digit> matches <digit>.
+       If not set, then \<digit> is a back-reference.  */
+#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
+
+    /* If this bit is set, then | is an alternation operator, and \| is literal.
+       If not set, then \| is an alternation operator, and | is literal.  */
+#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
+
+    /* If this bit is set, then an ending range point collating higher
+         than the starting range point, as in [z-a], is invalid.
+       If not set, then when ending range point collates higher than the
+         starting range point, the range is ignored.  */
+#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
+
+    /* If this bit is set, then an unmatched ) is ordinary.
+       If not set, then an unmatched ) is invalid.  */
+#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
+
+    /* This global variable defines the particular regexp syntax to use (for
+       some interfaces).  When a regexp is compiled, the syntax used is
+       stored in the pattern buffer, so changing this does not affect
+       already-compiled regexps.  */
+    extern reg_syntax_t re_syntax_options;
+    
+    /* Define combinations of the above bits for the standard possibilities.
+       (The [[[ comments delimit what gets put into the Texinfo file, so
+       don't delete them!)  */
+    /* [[[begin syntaxes]]] */
+#define RE_SYNTAX_EMACS 0
+
+#define RE_SYNTAX_AWK							\
+  (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL			\
+   | RE_NO_BK_PARENS            | RE_NO_BK_REFS				\
+   | RE_NO_BK_VBAR               | RE_NO_EMPTY_RANGES			\
+   | RE_UNMATCHED_RIGHT_PAREN_ORD)
+
+#define RE_SYNTAX_POSIX_AWK 						\
+  (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
+
+#define RE_SYNTAX_GREP							\
+  (RE_BK_PLUS_QM              | RE_CHAR_CLASSES				\
+   | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS				\
+   | RE_NEWLINE_ALT)
+
+#define RE_SYNTAX_EGREP							\
+  (RE_CHAR_CLASSES        | RE_CONTEXT_INDEP_ANCHORS			\
+   | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE			\
+   | RE_NEWLINE_ALT       | RE_NO_BK_PARENS				\
+   | RE_NO_BK_VBAR)
+
+#define RE_SYNTAX_POSIX_EGREP						\
+  (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
+
+    /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
+#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
+
+#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
+
+    /* Syntax bits common to both basic and extended POSIX regex syntax.  */
+#define _RE_SYNTAX_POSIX_COMMON						\
+  (RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL		\
+   | RE_INTERVALS  | RE_NO_EMPTY_RANGES)
+
+#define RE_SYNTAX_POSIX_BASIC						\
+  (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
+
+    /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
+       RE_LIMITED_OPS, i.e., \? \+ \| are not recognized.  Actually, this
+       isn't minimal, since other operators, such as \`, aren't disabled.  */
+#define RE_SYNTAX_POSIX_MINIMAL_BASIC					\
+  (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
+
+#define RE_SYNTAX_POSIX_EXTENDED					\
+  (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS			\
+   | RE_CONTEXT_INDEP_OPS  | RE_NO_BK_BRACES				\
+   | RE_NO_BK_PARENS       | RE_NO_BK_VBAR				\
+   | RE_UNMATCHED_RIGHT_PAREN_ORD)
+
+    /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
+       replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added.  */
+#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED				\
+  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS			\
+   | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES				\
+   | RE_NO_BK_PARENS        | RE_NO_BK_REFS				\
+   | RE_NO_BK_VBAR	    | RE_UNMATCHED_RIGHT_PAREN_ORD)
+    /* [[[end syntaxes]]] */
+    
+    /* Maximum number of duplicates an interval can allow.  Some systems
+       (erroneously) define this in other header files, but we want our
+       value, so remove any previous define.  */
+#ifdef RE_DUP_MAX
+#undef RE_DUP_MAX
+#endif
+#define RE_DUP_MAX ((1 << 15) - 1)
+
+
+    /* POSIX `cflags' bits (i.e., information for `regcomp').  */
+
+    /* If this bit is set, then use extended regular expression syntax.
+       If not set, then use basic regular expression syntax.  */
+#define REG_EXTENDED 1
+
+    /* If this bit is set, then ignore case when matching.
+       If not set, then case is significant.  */
+#define REG_ICASE (REG_EXTENDED << 1)
+
+    /* If this bit is set, then anchors do not match at newline
+         characters in the string.
+       If not set, then anchors do match at newlines.  */
+#define REG_NEWLINE (REG_ICASE << 1)
+
+    /* If this bit is set, then report only success or fail in regexec.
+       If not set, then returns differ between not matching and errors.  */
+#define REG_NOSUB (REG_NEWLINE << 1)
+
+
+    /* POSIX `eflags' bits (i.e., information for regexec).  */
+
+    /* If this bit is set, then the beginning-of-line operator doesn't match
+         the beginning of the string (presumably because it's not the
+         beginning of a line).
+       If not set, then the beginning-of-line operator does match the
+         beginning of the string.  */
+#define REG_NOTBOL 1
+
+    /* Like REG_NOTBOL, except for the end-of-line.  */
+#define REG_NOTEOL (1 << 1)
+
+
+    /* If any error codes are removed, changed, or added, update the
+       `re_error_msg' table in regex.c.  */
+    typedef enum {
+        REG_NOERROR = 0, 	/* Success.  */
+        REG_NOMATCH, 		/* Didn't find a match (for regexec).  */
+
+        /* POSIX regcomp return error codes.  (In the order listed in the
+           standard.)  */
+        REG_BADPAT, 		/* Invalid pattern.  */
+        REG_ECOLLATE, 		/* Not implemented.  */
+        REG_ECTYPE, 		/* Invalid character class name.  */
+        REG_EESCAPE, 		/* Trailing backslash.  */
+        REG_ESUBREG, 		/* Invalid back reference.  */
+        REG_EBRACK, 		/* Unmatched left bracket.  */
+        REG_EPAREN, 		/* Parenthesis imbalance.  */
+        REG_EBRACE, 		/* Unmatched \{.  */
+        REG_BADBR, 		/* Invalid contents of \{\}.  */
+        REG_ERANGE, 		/* Invalid range end.  */
+        REG_ESPACE, 		/* Ran out of memory.  */
+        REG_BADRPT, 		/* No preceding re for repetition op.  */
+
+        /* Error codes we've added.  */
+        REG_EEND, 		/* Premature end.  */
+        REG_ESIZE, 		/* Compiled pattern bigger than 2^16 bytes.  */
+        REG_ERPAREN		/* Unmatched ) or \); not returned from regcomp.  */
+    }
+    reg_errcode_t;
+    
+    /* This data structure represents a compiled pattern.  Before calling
+       the pattern compiler, the fields `buffer', `allocated', `fastmap',
+       `translate', and `no_sub' can be set.  After the pattern has been
+       compiled, the `re_nsub' field is available.  All other fields are
+       private to the regex routines.  */
+
+    struct re_pattern_buffer {
+        /* [[[begin pattern_buffer]]] */
+        /* Space that holds the compiled pattern.  It is declared as
+                 `unsigned char *' because its elements are
+                  sometimes used as array indexes.  */
+        unsigned char *buffer;
+
+        /* Number of bytes to which `buffer' points.  */
+        unsigned long allocated;
+
+        /* Number of bytes actually used in `buffer'.  */
+        unsigned long used;
+
+        /* Syntax setting with which the pattern was compiled.  */
+        reg_syntax_t syntax;
+
+        /* Pointer to a fastmap, if any, otherwise zero.  re_search uses
+           the fastmap, if there is one, to skip over impossible
+           starting points for matches.  */
+        char *fastmap;
+
+        /* Either a translate table to apply to all characters before
+           comparing them, or zero for no translation.  The translation
+           is applied to a pattern when it is compiled and to a string
+           when it is matched.  */
+        char *translate;
+
+        /* Number of subexpressions found by the compiler.  */
+        size_t re_nsub;
+
+        /* Zero if this pattern cannot match the empty string, one else.
+           Well, in truth it's used only in `re_search_2', to see
+           whether or not we should use the fastmap, so we don't set
+           this absolutely perfectly; see `re_compile_fastmap' (the
+           `duplicate' case).  */
+unsigned can_be_null :
+        1;
+
+        /* If REGS_UNALLOCATED, allocate space in the `regs' structure
+             for `max (RE_NREGS, re_nsub + 1)' groups.
+           If REGS_REALLOCATE, reallocate space if necessary.
+           If REGS_FIXED, use what's there.  */
+#define REGS_UNALLOCATED 0
+#define REGS_REALLOCATE 1
+#define REGS_FIXED 2
+
+unsigned regs_allocated :
+        2;
+
+        /* Set to zero when `regex_compile' compiles a pattern; set to one
+           by `re_compile_fastmap' if it updates the fastmap.  */
+unsigned fastmap_accurate :
+        1;
+
+        /* If set, `re_match_2' does not return information about
+           subexpressions.  */
+unsigned no_sub :
+        1;
+
+        /* If set, a beginning-of-line anchor doesn't match at the
+           beginning of the string.  */
+unsigned not_bol :
+        1;
+
+        /* Similarly for an end-of-line anchor.  */
+unsigned not_eol :
+        1;
+
+        /* If true, an anchor at a newline matches.  */
+unsigned newline_anchor :
+        1;
+
+        /* [[[end pattern_buffer]]] */
+    };
+
+    typedef struct re_pattern_buffer regex_t;
+
+
+    /* search.c (search_buffer) in Emacs needs this one opcode value.  It is
+       defined both in `regex.c' and here.  */
+#define RE_EXACTN_VALUE 1
+    
+    /* Type for byte offsets within the string.  POSIX mandates this.  */
+    typedef int regoff_t;
+
+
+    /* This is the structure we store register match data in.  See
+       regex.texinfo for a full description of what registers match.  */
+    struct re_registers {
+        unsigned num_regs;
+        regoff_t *start;
+        regoff_t *end;
+    };
+
+
+    /* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
+       `re_match_2' returns information about at least this many registers
+       the first time a `regs' structure is passed.  */
+#ifndef RE_NREGS
+#define RE_NREGS 30
+#endif
+
+
+    /* POSIX specification for registers.  Aside from the different names than
+       `re_registers', POSIX uses an array of structures, instead of a
+       structure of arrays.  */
+    typedef struct {
+        regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
+        regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
+    }
+    regmatch_t;
+    
+    /* Declarations for routines.  */
+
+    /* To avoid duplicating every routine declaration -- once with a
+       prototype (if we are ANSI), and once without (if we aren't) -- we
+       use the following macro to declare argument types.  This
+       unfortunately clutters up the declarations a bit, but I think it's
+       worth it.  */
+
+#if __STDC__
+
+#define _RE_ARGS(args) args
+
+#else /* not __STDC__ */
+
+#define _RE_ARGS(args) ()
+
+#endif /* not __STDC__ */
+
+    /* Sets the current default syntax to SYNTAX, and return the old syntax.
+       You can also simply assign to the `re_syntax_options' variable.  */
+    extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
+
+    /* Compile the regular expression PATTERN, with length LENGTH
+       and syntax given by the global `re_syntax_options', into the buffer
+       BUFFER.  Return NULL if successful, and an error string if not.  */
+    extern const char *re_compile_pattern
+        _RE_ARGS ((const char *pattern, int length,
+                   struct re_pattern_buffer *buffer));
+
+
+    /* Compile a fastmap for the compiled pattern in BUFFER; used to
+       accelerate searches.  Return 0 if successful and -2 if was an
+       internal error.  */
+    extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
+
+
+    /* Search in the string STRING (with length LENGTH) for the pattern
+       compiled into BUFFER.  Start searching at position START, for RANGE
+       characters.  Return the starting position of the match, -1 for no
+       match, or -2 for an internal error.  Also return register
+       information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
+    extern int re_search
+        _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
+                   int length, int start, int range, struct re_registers *regs));
+
+
+    /* Like `re_search', but search in the concatenation of STRING1 and
+       STRING2.  Also, stop searching at index START + STOP.  */
+    extern int re_search_2
+        _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
+                   int length1, const char *string2, int length2,
+                   int start, int range, struct re_registers *regs, int stop));
+
+
+    /* Like `re_search', but return how many characters in STRING the regexp
+       in BUFFER matched, starting at position START.  */
+    extern int re_match
+        _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
+                   int length, int start, struct re_registers *regs));
+
+
+    /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
+    extern int re_match_2
+        _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
+                   int length1, const char *string2, int length2,
+                   int start, struct re_registers *regs, int stop));
+
+
+    /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
+       ENDS.  Subsequent matches using BUFFER and REGS will use this memory
+       for recording register information.  STARTS and ENDS must be
+       allocated with malloc, and must each be at least `NUM_REGS * sizeof
+       (regoff_t)' bytes long.
+     
+       If NUM_REGS == 0, then subsequent matches should allocate their own
+       register data.
+     
+       Unless this function is called, the first search or match using
+       PATTERN_BUFFER will allocate its own register data, without
+       freeing the old data.  */
+    extern void re_set_registers
+        _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
+                   unsigned num_regs, regoff_t *starts, regoff_t *ends));
+
+    /* 4.2 bsd compatibility.  */
+    extern char *re_comp _RE_ARGS ((const char *));
+    extern int re_exec _RE_ARGS ((const char *));
+
+    /* POSIX compatibility.  */
+    extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
+    extern int regexec
+        _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
+                   regmatch_t pmatch[], int eflags));
+    extern size_t regerror
+        _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
+                   size_t errbuf_size));
+    extern void regfree _RE_ARGS ((regex_t *preg));
+
+#endif /* not __REGEXP_LIBRARY_H__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*
+Local variables:
+make-backup-files: t
+version-control: t
+trim-versions-without-asking: nil
+End:
+*/
diff --git a/windows/resource.h b/windows/resource.h
new file mode 100644
index 0000000..2dc6545
--- /dev/null
+++ b/windows/resource.h
@@ -0,0 +1,4 @@
+#ifndef IDC_STATIC
+#define IDC_STATIC (-1)
+#endif
+
diff --git a/windows/resource.rc b/windows/resource.rc
new file mode 100644
index 0000000..e5d5f15
--- /dev/null
+++ b/windows/resource.rc
@@ -0,0 +1,76 @@
+
+#include "resource_vc.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+#include "afxres.h"
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
+
+#ifdef _WIN32
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
+#pragma code_page(1252)
+#endif
+
+#ifndef _MAC
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,9,5,0
+ PRODUCTVERSION 1,9,5,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040c04b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Grame\0"
+            VALUE "FileDescription", "Jackmp for Windows\0"
+            VALUE "FileVersion", "1, 9, 5, 0\0"
+            VALUE "InternalName", "libjackmp\0"
+            VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "libjackmp.dll\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "libjackmp\0"
+            VALUE "ProductVersion", "1, 9, 5, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x40c, 1200
+    END
+END
+#endif
+
+#ifdef APSTUDIO_INVOKED
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+    "resource_vc.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+    "\r\n"
+    "\0"
+END
+#endif
+
+#endif
+
+#ifndef APSTUDIO_INVOKED
+#endif
diff --git a/windows/resource_vc.h b/windows/resource_vc.h
new file mode 100644
index 0000000..9916ed3
--- /dev/null
+++ b/windows/resource_vc.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        102
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/windows/samplerate.h b/windows/samplerate.h
new file mode 100644
index 0000000..9651e63
--- /dev/null
+++ b/windows/samplerate.h
@@ -0,0 +1,197 @@
+/*
+** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd at mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/*
+** This code is part of Secret Rabibt Code aka libsamplerate. A commercial
+** use license for this code is available, please see:
+**		http://www.mega-nerd.com/SRC/procedure.html
+*/
+
+/*
+** API documentation is available here:
+**     http://www.mega-nerd.com/SRC/api.html
+*/
+
+#ifndef SAMPLERATE_H
+#define SAMPLERATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif	/* __cplusplus */
+
+
+/* Opaque data type SRC_STATE. */
+typedef struct SRC_STATE_tag SRC_STATE ;
+
+/* SRC_DATA is used to pass data to src_simple() and src_process(). */
+typedef struct
+{	float	*data_in, *data_out ;
+
+	long	input_frames, output_frames ;
+	long	input_frames_used, output_frames_gen ;
+
+	int		end_of_input ;
+
+	double	src_ratio ;
+} SRC_DATA ;
+
+/* SRC_CB_DATA is used with callback based API. */
+typedef struct
+{	long	frames ;
+	float	*data_in ;
+} SRC_CB_DATA ;
+
+/*
+** User supplied callback function type for use with src_callback_new()
+** and src_callback_read(). First parameter is the same pointer that was
+** passed into src_callback_new(). Second parameter is pointer to a
+** pointer. The user supplied callback function must modify *data to
+** point to the start of the user supplied float array. The user supplied
+** function must return the number of frames that **data points to.
+*/
+
+typedef long (*src_callback_t) (void *cb_data, float **data) ;
+
+/*
+**	Standard initialisation function : return an anonymous pointer to the
+**	internal state of the converter. Choose a converter from the enums below.
+**	Error returned in *error.
+*/
+
+SRC_STATE* src_new (int converter_type, int channels, int *error) ;
+
+/*
+**	Initilisation for callback based API : return an anonymous pointer to the
+**	internal state of the converter. Choose a converter from the enums below.
+**	The cb_data pointer can point to any data or be set to NULL. Whatever the
+**	value, when processing, user supplied function "func" gets called with
+**	cb_data as first parameter.
+*/
+
+SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels,
+				int *error, void* cb_data) ;
+
+/*
+**	Cleanup all internal allocations.
+**	Always returns NULL.
+*/
+
+SRC_STATE* src_delete (SRC_STATE *state) ;
+
+/*
+**	Standard processing function.
+**	Returns non zero on error.
+*/
+
+int src_process (SRC_STATE *state, SRC_DATA *data) ;
+
+/*
+**	Callback based processing function. Read up to frames worth of data from
+**	the converter int *data and return frames read or -1 on error.
+*/
+long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) ;
+
+/*
+**	Simple interface for performing a single conversion from input buffer to
+**	output buffer at a fixed conversion ratio.
+**	Simple interface does not require initialisation as it can only operate on
+**	a single buffer worth of audio.
+*/
+
+int src_simple (SRC_DATA *data, int converter_type, int channels) ;
+
+/*
+** This library contains a number of different sample rate converters,
+** numbered 0 through N.
+**
+** Return a string giving either a name or a more full description of each
+** sample rate converter or NULL if no sample rate converter exists for
+** the given value. The converters are sequentially numbered from 0 to N.
+*/
+
+const char *src_get_name (int converter_type) ;
+const char *src_get_description (int converter_type) ;
+const char *src_get_version (void) ;
+
+/*
+**	Set a new SRC ratio. This allows step responses
+**	in the conversion ratio.
+**	Returns non zero on error.
+*/
+
+int src_set_ratio (SRC_STATE *state, double new_ratio) ;
+
+/*
+**	Reset the internal SRC state.
+**	Does not modify the quality settings.
+**	Does not free any memory allocations.
+**	Returns non zero on error.
+*/
+
+int src_reset (SRC_STATE *state) ;
+
+/*
+** Return TRUE if ratio is a valid conversion ratio, FALSE
+** otherwise.
+*/
+
+int src_is_valid_ratio (double ratio) ;
+
+/*
+**	Return an error number.
+*/
+
+int src_error (SRC_STATE *state) ;
+
+/*
+**	Convert the error number into a string.
+*/
+const char* src_strerror (int error) ;
+
+/*
+** The following enums can be used to set the interpolator type
+** using the function src_set_converter().
+*/
+
+enum
+{
+	SRC_SINC_BEST_QUALITY		= 0,
+	SRC_SINC_MEDIUM_QUALITY		= 1,
+	SRC_SINC_FASTEST			= 2,
+	SRC_ZERO_ORDER_HOLD			= 3,
+	SRC_LINEAR					= 4,
+} ;
+
+/*
+** Extra helper functions for converting from short to float and
+** back again.
+*/
+
+void src_short_to_float_array (const short *in, float *out, int len) ;
+void src_float_to_short_array (const float *in, short *out, int len) ;
+
+void src_int_to_float_array (const int *in, float *out, int len) ;
+void src_float_to_int_array (const float *in, int *out, int len) ;
+
+
+#ifdef __cplusplus
+}		/* extern "C" */
+#endif	/* __cplusplus */
+
+#endif	/* SAMPLERATE_H */
+
diff --git a/windows/testSynchoServerClient.dsp b/windows/testSynchoServerClient.dsp
new file mode 100644
index 0000000..6da9e92
--- /dev/null
+++ b/windows/testSynchoServerClient.dsp
@@ -0,0 +1,114 @@
+# Microsoft Developer Studio Project File - Name="testSynchoServerClient" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=testSynchoServerClient - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "testSynchoServerClient.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "testSynchoServerClient.mak" CFG="testSynchoServerClient - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "testSynchoServerClient - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "testSynchoServerClient - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "testSynchoServerClient - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/testSynchoServerClient.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "testSynchoServerClient - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/testSynchoServerClient.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "testSynchoServerClient - Win32 Release"
+# Name "testSynchoServerClient - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\common\JackError.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinEvent.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinThread.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tests\testSynchroServerClient.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/testSynchroClient.dsp b/windows/testSynchroClient.dsp
new file mode 100644
index 0000000..cf824d1
--- /dev/null
+++ b/windows/testSynchroClient.dsp
@@ -0,0 +1,150 @@
+# Microsoft Developer Studio Project File - Name="testSynchroClient" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=testSynchroClient - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "testSynchroClient.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "testSynchroClient.mak" CFG="testSynchroClient - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "testSynchroClient - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "testSynchroClient - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "testSynchroClient - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/testSynchroClient.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "testSynchroClient - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/testSynchroClient.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "testSynchroClient - Win32 Release"
+# Name "testSynchroClient - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\common\JackError.c
+
+!IF  "$(CFG)" == "testSynchroClient - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "testSynchroClient - Win32 Debug"
+
+# ADD CPP /U "." /U "../common"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinEvent.cpp
+
+!IF  "$(CFG)" == "testSynchroClient - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "testSynchroClient - Win32 Debug"
+
+# ADD CPP /U "." /U "../common"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinThread.cpp
+
+!IF  "$(CFG)" == "testSynchroClient - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "testSynchroClient - Win32 Debug"
+
+# ADD CPP /U "." /U "../common"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\tests\testSynchroClient.cpp
+
+!IF  "$(CFG)" == "testSynchroClient - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "testSynchroClient - Win32 Debug"
+
+# ADD CPP /U "." /U "../common"
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/testSynchroServer.dsp b/windows/testSynchroServer.dsp
new file mode 100644
index 0000000..fb8d266
--- /dev/null
+++ b/windows/testSynchroServer.dsp
@@ -0,0 +1,114 @@
+# Microsoft Developer Studio Project File - Name="testSynchroServer" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=testSynchroServer - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "testSynchroServer.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "testSynchroServer.mak" CFG="testSynchroServer - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "testSynchroServer - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "testSynchroServer - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "testSynchroServer - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "./Release"
+# PROP Intermediate_Dir "./Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"./Release/bin/testSynchroServer.exe" /libpath:"./Release" /libpath:"./Release/bin"
+
+!ELSEIF  "$(CFG)" == "testSynchroServer - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "./Debug"
+# PROP Intermediate_Dir "./Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./Debug/bin/testSynchroServer.exe" /pdbtype:sept /libpath:"./Debug" /libpath:"./Debug/bin"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "testSynchroServer - Win32 Release"
+# Name "testSynchroServer - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\common\JackError.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinEvent.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JackWinThread.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tests\testSynchroServer.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/windows/winmme/JackWinMMEDriver.cpp b/windows/winmme/JackWinMMEDriver.cpp
new file mode 100644
index 0000000..b76a829
--- /dev/null
+++ b/windows/winmme/JackWinMMEDriver.cpp
@@ -0,0 +1,503 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JackWinMMEDriver.h"
+#include "JackGraphManager.h"
+#include "JackEngineControl.h"
+#include "JackDriverLoader.h"
+
+#include <assert.h>
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include <windows.h>
+#include <windowsx.h>
+#include <mmsystem.h>
+
+namespace Jack
+{
+
+static bool InitHeaders(MidiSlot* slot)
+{
+    slot->fHeader = (LPMIDIHDR)GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT, sizeof(MIDIHDR) + kBuffSize);
+ 	if (!slot->fHeader)
+        return false;
+
+	slot->fHeader->lpData = (LPSTR)((LPBYTE)slot->fHeader + sizeof(MIDIHDR));
+	slot->fHeader->dwBufferLength = kBuffSize;
+	slot->fHeader->dwFlags = 0;
+	slot->fHeader->dwUser = 0;
+	slot->fHeader->lpNext = 0;
+	slot->fHeader->dwBytesRecorded = 0;
+	return true;
+}
+
+void CALLBACK JackWinMMEDriver::MidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD userData, DWORD dwParam1, DWORD dwParam2)
+{
+    jack_ringbuffer_t* ringbuffer = (jack_ringbuffer_t*)userData;
+    //jack_info("JackWinMMEDriver::MidiInProc 0\n");
+
+	switch (wMsg) {
+		case MIM_OPEN:
+            break;
+
+		case MIM_ERROR:
+		case MIM_DATA: {
+
+            //jack_info("JackWinMMEDriver::MidiInProc");
+
+            // One event
+            unsigned int num_packet = 1;
+            jack_ringbuffer_write(ringbuffer, (char*)&num_packet, sizeof(unsigned int));
+
+            // Write event actual data
+            jack_ringbuffer_write(ringbuffer, (char*)&dwParam1, 3);
+       		break;
+		}
+
+		case MIM_LONGERROR:
+		case MIM_LONGDATA:
+            /*
+			Nothing for now
+            */
+			break;
+	}
+}
+
+JackWinMMEDriver::JackWinMMEDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
+    : JackMidiDriver(name, alias, engine, table),
+    fRealCaptureChannels(0),
+    fRealPlaybackChannels(0),
+    fMidiSource(NULL),
+    fMidiDestination(NULL)
+{}
+
+JackWinMMEDriver::~JackWinMMEDriver()
+{}
+
+int JackWinMMEDriver::Open(bool capturing,
+         bool playing,
+         int inchannels,
+         int outchannels,
+         bool monitor,
+         const char* capture_driver_name,
+         const char* playback_driver_name,
+         jack_nframes_t capture_latency,
+         jack_nframes_t playback_latency)
+{
+
+    jack_log("JackWinMMEDriver::Open");
+
+    fRealCaptureChannels = midiInGetNumDevs();
+	fRealPlaybackChannels = midiOutGetNumDevs();
+
+    // Generic JackMidiDriver Open
+    if (JackMidiDriver::Open(capturing, playing, fRealCaptureChannels, fRealPlaybackChannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency) != 0)
+        return -1;
+
+    fMidiDestination = new MidiSlot[fRealCaptureChannels];
+    assert(fMidiDestination);
+
+    // Real input
+    int devindex = 0;
+    for (int i = 0; i < fRealCaptureChannels; i++)  {
+
+        HMIDIIN handle;
+        fMidiDestination[devindex].fIndex = i;
+        MMRESULT ret = midiInOpen(&handle, fMidiDestination[devindex].fIndex, (DWORD)MidiInProc, (DWORD)fRingBuffer[devindex], CALLBACK_FUNCTION);
+
+        if (ret == MMSYSERR_NOERROR) {
+            fMidiDestination[devindex].fHandle = handle;
+            if (!InitHeaders(&fMidiDestination[devindex])) {
+                jack_error("memory allocation failed");
+                midiInClose(handle);
+                continue;
+            }
+            ret = midiInPrepareHeader(handle, fMidiDestination[devindex].fHeader, sizeof(MIDIHDR));
+
+            if (ret == MMSYSERR_NOERROR) {
+                fMidiDestination[devindex].fHeader->dwUser = 1;
+                ret = midiInAddBuffer(handle, fMidiDestination[devindex].fHeader, sizeof(MIDIHDR));
+                if (ret == MMSYSERR_NOERROR) {
+                    ret = midiInStart(handle);
+                    if (ret != MMSYSERR_NOERROR) {
+                        jack_error("midiInStart error");
+                        CloseInput(&fMidiDestination[devindex]);
+                        continue;
+                    }
+                } else {
+                    jack_error ("midiInAddBuffer error");
+                    CloseInput(&fMidiDestination[devindex]);
+                    continue;
+                }
+            } else {
+                jack_error("midiInPrepareHeader error");
+                midiInClose(handle);
+                continue;
+            }
+        } else {
+            jack_error ("midiInOpen error");
+            continue;
+        }
+        devindex += 1;
+    }
+    fRealCaptureChannels = devindex;
+    fCaptureChannels = devindex;
+
+    fMidiSource = new MidiSlot[fRealPlaybackChannels];
+    assert(fMidiSource);
+
+    // Real output
+    devindex = 0;
+    for (int i = 0; i < fRealPlaybackChannels; i++)  {
+        MMRESULT res;
+        HMIDIOUT handle;
+        fMidiSource[devindex].fIndex = i;
+        UINT ret = midiOutOpen(&handle, fMidiSource[devindex].fIndex, 0L, 0L, CALLBACK_NULL);
+        if (ret == MMSYSERR_NOERROR) {
+            fMidiSource[devindex].fHandle = handle;
+            if (!InitHeaders(&fMidiSource[devindex])) {
+                jack_error("memory allocation failed");
+                midiOutClose(handle);
+                continue;
+            }
+            res = midiOutPrepareHeader(handle, fMidiSource[devindex].fHeader, sizeof(MIDIHDR));
+            if (res != MMSYSERR_NOERROR) {
+                jack_error("midiOutPrepareHeader error %d %d %d", i, handle, res);
+                continue;
+            } else {
+                fMidiSource[devindex].fHeader->dwUser = 1;
+            }
+        } else {
+            jack_error("midiOutOpen error");
+            continue;
+        }
+        devindex += 1;
+    }
+    fRealPlaybackChannels = devindex;
+    fPlaybackChannels = devindex;
+    return 0;
+}
+
+void JackWinMMEDriver::CloseInput(MidiSlot* slot)
+{
+    MMRESULT res;
+    int retry = 0;
+
+    if (slot->fHandle == 0)
+        return;
+
+    HMIDIIN handle = (HMIDIIN)slot->fHandle;
+    slot->fHeader->dwUser = 0;
+    res = midiInStop(handle);
+    if (res != MMSYSERR_NOERROR) {
+        jack_error("midiInStop error");
+    }
+    res = midiInReset(handle);
+    if (res != MMSYSERR_NOERROR) {
+        jack_error("midiInReset error");
+    }
+    res = midiInUnprepareHeader(handle, slot->fHeader, sizeof(MIDIHDR));
+    if (res != MMSYSERR_NOERROR) {
+        jack_error("midiInUnprepareHeader error");
+    }
+    do {
+        res = midiInClose(handle);
+        if (res != MMSYSERR_NOERROR) {
+            jack_error("midiInClose error");
+        }
+        if (res == MIDIERR_STILLPLAYING)
+            midiInReset(handle);
+        Sleep (10);
+        retry++;
+    } while ((res == MIDIERR_STILLPLAYING) && (retry < 10));
+
+    if (slot->fHeader) {
+        GlobalFreePtr(slot->fHeader);
+    }
+}
+
+void JackWinMMEDriver::CloseOutput(MidiSlot* slot)
+{
+    MMRESULT res;
+    int retry = 0;
+
+    if (slot->fHandle == 0)
+        return;
+
+    HMIDIOUT handle = (HMIDIOUT)slot->fHandle;
+    res = midiOutReset(handle);
+    if (res != MMSYSERR_NOERROR)
+        jack_error("midiOutReset error");
+    midiOutUnprepareHeader(handle, slot->fHeader, sizeof(MIDIHDR));
+    do {
+        res = midiOutClose(handle);
+        if (res != MMSYSERR_NOERROR)
+            jack_error("midiOutClose error");
+        Sleep(10);
+        retry++;
+    } while ((res == MIDIERR_STILLPLAYING) && (retry < 10));
+
+    if (slot->fHeader) {
+        GlobalFreePtr(slot->fHeader);
+    }
+}
+
+int JackWinMMEDriver::Close()
+{
+    jack_log("JackWinMMEDriver::Close");
+
+    // Close input
+    if (fMidiDestination) {
+        for (int i = 0; i < fRealCaptureChannels; i++)  {
+            CloseInput(&fMidiDestination[i]);
+        }
+        delete[] fMidiDestination;
+    }
+
+    // Close output
+    if (fMidiSource) {
+        for (int i = 0; i < fRealPlaybackChannels; i++)  {
+            CloseOutput(&fMidiSource[i]);
+        }
+        delete[] fMidiSource;
+    }
+
+    return 0;
+}
+
+int JackWinMMEDriver::Attach()
+{
+    JackPort* port;
+    jack_port_id_t port_index;
+    char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+    MMRESULT res;
+    int i;
+
+    jack_log("JackMidiDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
+
+    for (i = 0; i < fCaptureChannels; i++) {
+        MIDIINCAPS caps;
+		res = midiInGetDevCaps(fMidiDestination[i].fIndex, &caps, sizeof(caps));
+		if (res == MMSYSERR_NOERROR) {
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, caps.szPname, i + 1);
+		} else {
+		    snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
+		}
+        snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
+
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        fCapturePortList[i] = port_index;
+        jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
+    }
+
+    for (i = 0; i < fPlaybackChannels; i++) {
+        MIDIOUTCAPS caps;
+		res = midiOutGetDevCaps(fMidiSource[i].fIndex, &caps, sizeof(caps));
+        if (res == MMSYSERR_NOERROR) {
+            snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, caps.szPname, i + 1);
+		} else {
+		    snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fPlaybackDriverName, i + 1);
+		}
+        snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
+
+        if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
+            jack_error("driver: cannot register port for %s", name);
+            return -1;
+        }
+        port = fGraphManager->GetPort(port_index);
+        port->SetAlias(alias);
+        fPlaybackPortList[i] = port_index;
+        jack_log("JackMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
+    }
+
+    return 0;
+}
+
+int JackWinMMEDriver::Read()
+{
+    size_t size;
+
+    for (int chan = 0; chan < fCaptureChannels; chan++)  {
+
+        if (fGraphManager->GetConnectionsNum(fCapturePortList[chan]) > 0) {
+
+            JackMidiBuffer* midi_buffer = GetInputBuffer(chan);
+
+            if (jack_ringbuffer_read_space (fRingBuffer[chan]) == 0) {
+                // Reset buffer
+                midi_buffer->Reset(midi_buffer->nframes);
+            } else {
+
+                while ((size = jack_ringbuffer_read_space (fRingBuffer[chan])) > 0) {
+
+                    //jack_info("jack_ringbuffer_read_space %d", size);
+                    int ev_count = 0;
+                    jack_ringbuffer_read(fRingBuffer[chan], (char*)&ev_count, sizeof(int));
+
+                    if (ev_count > 0) {
+                        for (int j = 0; j < ev_count; j++)  {
+                            unsigned int event_len = 3;
+                            // Read event actual data
+                            jack_midi_data_t* dest = midi_buffer->ReserveEvent(0, event_len);
+                            jack_ringbuffer_read(fRingBuffer[chan], (char*)dest, event_len);
+                        }
+                    }
+                }
+            }
+        } else {
+            //jack_info("Consume ring buffer");
+            jack_ringbuffer_read_advance(fRingBuffer[chan], jack_ringbuffer_read_space(fRingBuffer[chan]));
+        }
+    }
+    return 0;
+}
+
+int JackWinMMEDriver::Write()
+{
+    for (int chan = 0; chan < fPlaybackChannels; chan++)  {
+
+        if (fGraphManager->GetConnectionsNum(fPlaybackPortList[chan]) > 0) {
+
+            JackMidiBuffer* midi_buffer = GetOutputBuffer(chan);
+
+            // TODO : use timestamp
+
+            for (unsigned int j = 0; j < midi_buffer->event_count; j++) {
+                JackMidiEvent* ev = &midi_buffer->events[j];
+                if (ev->size <= 3) {
+                    jack_midi_data_t *d = ev->GetData(midi_buffer);
+                    DWORD winev = 0;
+                    if (ev->size > 0) winev |= d[0];
+                    if (ev->size > 1) winev |= (d[1] << 8);
+                    if (ev->size > 2) winev |= (d[2] << 16);
+                    MMRESULT res = midiOutShortMsg((HMIDIOUT)fMidiSource[chan].fHandle, winev);
+                    if (res != MMSYSERR_NOERROR)
+                        jack_error ("midiOutShortMsg error res %d", res);
+                } else  {
+
+                }
+            }
+        }
+    }
+
+    return 0;
+}
+
+} // end of namespace
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor()
+    {
+        jack_driver_desc_t * desc;
+        //unsigned int i;
+
+        desc = (jack_driver_desc_t*)calloc (1, sizeof (jack_driver_desc_t));
+        strcpy(desc->name, "winmme");                             // size MUST be less then JACK_DRIVER_NAME_MAX + 1
+        strcpy(desc->desc, "WinMME API based MIDI backend");      // size MUST be less then JACK_DRIVER_PARAM_DESC + 1
+
+        desc->nparams = 0;
+        desc->params = (jack_driver_param_desc_t*)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
+
+        return desc;
+    }
+
+    SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
+    {
+        /*
+        unsigned int capture_ports = 2;
+        unsigned int playback_ports = 2;
+        unsigned long wait_time = 0;
+        const JSList * node;
+        const jack_driver_param_t * param;
+        bool monitor = false;
+
+        for (node = params; node; node = jack_slist_next (node)) {
+            param = (const jack_driver_param_t *) node->data;
+
+            switch (param->character) {
+
+                case 'C':
+                    capture_ports = param->value.ui;
+                    break;
+
+                case 'P':
+                    playback_ports = param->value.ui;
+                    break;
+
+                case 'r':
+                    sample_rate = param->value.ui;
+                    break;
+
+                case 'p':
+                    period_size = param->value.ui;
+                    break;
+
+                case 'w':
+                    wait_time = param->value.ui;
+                    break;
+
+                case 'm':
+                    monitor = param->value.i;
+                    break;
+            }
+        }
+        */
+
+        Jack::JackDriverClientInterface* driver = new Jack::JackWinMMEDriver("system_midi", "winmme", engine, table);
+        if (driver->Open(1, 1, 0, 0, false, "in", "out", 0, 0) == 0) {
+            return driver;
+        } else {
+            delete driver;
+            return NULL;
+        }
+    }
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*
+jack_connect system:midi_capture_1 system_midi:playback_1
+jack_connect system:midi_capture_1 system_midi:playback_2
+
+jack_connect system:midi_capture_1 system_midi:playback_1
+
+jack_connect system:midi_capture_1 system_midi:playback_1
+
+jack_connect system:midi_capture_1 system_midi:playback_1
+
+jack_connect system_midi:capture_1 system:midi_playback_1
+jack_connect system_midi:capture_2 system:midi_playback_1
+
+jack_connect system_midi:capture_1  system_midi:playback_1
+
+*/
diff --git a/windows/winmme/JackWinMMEDriver.h b/windows/winmme/JackWinMMEDriver.h
new file mode 100644
index 0000000..6c28a0e
--- /dev/null
+++ b/windows/winmme/JackWinMMEDriver.h
@@ -0,0 +1,87 @@
+/*
+Copyright (C) 2009 Grame
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __JackWinMMEDriver__
+#define __JackWinMMEDriver__
+
+#include "JackMidiDriver.h"
+#include "JackTime.h"
+
+namespace Jack
+{
+
+/*!
+\brief The WinMME driver.
+*/
+
+#define kBuffSize	512
+
+struct MidiSlot {
+
+	LPVOID	    fHandle;    // MMSystem handler
+	short		fIndex;     // MMSystem dev index
+	LPMIDIHDR	fHeader;    // for long msg output
+
+	MidiSlot():fHandle(0),fIndex(0)
+	{}
+
+};
+
+class JackWinMMEDriver : public JackMidiDriver
+{
+
+    private:
+
+        int fRealCaptureChannels;
+        int fRealPlaybackChannels;
+
+        MidiSlot* fMidiSource;
+        MidiSlot* fMidiDestination;
+
+        void CloseInput(MidiSlot* slot);
+        void CloseOutput(MidiSlot* slot);
+
+        static void CALLBACK MidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
+
+    public:
+
+        JackWinMMEDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
+        virtual ~JackWinMMEDriver();
+
+        int Open(bool capturing,
+                 bool playing,
+                 int chan_in,
+                 int chan_out,
+                 bool monitor,
+                 const char* capture_driver_name,
+                 const char* playback_driver_name,
+                 jack_nframes_t capture_latency,
+                 jack_nframes_t playback_latency);
+        int Close();
+
+        int Attach();
+
+        int Read();
+        int Write();
+
+};
+
+} // end of namespace
+
+#endif
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..8d8d8e6
--- /dev/null
+++ b/wscript
@@ -0,0 +1,305 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import os
+import Utils
+import Options
+import commands
+g_maxlen = 40
+import shutil
+import Task
+import re
+import Logs
+
+VERSION='1.9.5'
+APPNAME='jack'
+JACK_API_VERSION = '0.1.0'
+
+# these variables are mandatory ('/' are converted automatically)
+srcdir = '.'
+blddir = 'build'
+
+def display_msg(msg, status = None, color = None):
+    sr = msg
+    global g_maxlen
+    g_maxlen = max(g_maxlen, len(msg))
+    if status:
+        print "%s :" % msg.ljust(g_maxlen),
+        Utils.pprint(color, status)
+    else:
+        print "%s" % msg.ljust(g_maxlen)
+
+def display_feature(msg, build):
+    if build:
+        display_msg(msg, "yes", 'GREEN')
+    else:
+        display_msg(msg, "no", 'YELLOW')
+
+def create_svnversion_task(bld, header='svnversion.h', define=None):
+    import Constants, Build
+
+    cmd = '../svnversion_regenerate.sh ${TGT}'
+    if define:
+        cmd += " " + define
+
+    cls = Task.simple_task_type('svnversion', cmd, color='BLUE', before='cc')
+    cls.runnable_status = lambda self: Constants.RUN_ME
+
+    def post_run(self):
+        sg = Utils.h_file(self.outputs[0].abspath(self.env))
+        #print sg.encode('hex')
+        Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
+    cls.post_run = post_run
+
+    tsk = cls(bld.env.copy())
+    tsk.inputs = []
+    tsk.outputs = [bld.path.find_or_declare(header)]
+
+def set_options(opt):
+    # options provided by the modules
+    opt.tool_options('compiler_cxx')
+    opt.tool_options('compiler_cc')
+
+    opt.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]")
+    opt.add_option('--libdir32', type='string', help="32bit Library directory [Default: <prefix>/lib32]")
+    opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
+    opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
+    opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
+    opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
+    opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
+    opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients')
+    opt.add_option('--ports-per-application', default=768, type="int", dest="application_ports", help='Maximum number of ports per application')
+    opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries")
+    opt.sub_options('dbus')
+
+def configure(conf):
+    platform = Utils.detect_platform()
+    conf.env['IS_MACOSX'] = platform == 'darwin'
+    conf.env['IS_LINUX'] = platform == 'linux'
+    conf.env['IS_SUN'] = platform == 'sunos'
+
+    if conf.env['IS_LINUX']:
+        Utils.pprint('CYAN', "Linux detected")
+
+    if conf.env['IS_MACOSX']:
+        Utils.pprint('CYAN', "MacOS X detected")
+
+    if conf.env['IS_SUN']:
+        Utils.pprint('CYAN', "SunOS detected")
+
+    if conf.env['IS_LINUX']:
+        conf.check_tool('compiler_cxx')
+        conf.check_tool('compiler_cc')
+
+    if conf.env['IS_MACOSX']:
+        conf.check_tool('compiler_cxx')
+        conf.check_tool('compiler_cc')
+
+    # waf 1.5 : check_tool('compiler_cxx') and check_tool('compiler_cc') do not work correctly, so explicit use of gcc and g++
+    if conf.env['IS_SUN']:
+        conf.check_tool('g++')
+        conf.check_tool('gcc')
+
+    #if conf.env['IS_SUN']:
+    #   conf.check_tool('compiler_cxx')
+    #   conf.check_tool('compiler_cc')
+ 
+    conf.env.append_unique('CXXFLAGS', '-O3 -Wall')
+    conf.env.append_unique('CCFLAGS', '-O3 -Wall')
+
+    conf.sub_config('common')
+    if conf.env['IS_LINUX']:
+        conf.sub_config('linux')
+    if Options.options.dbus:
+        conf.sub_config('dbus')
+        if conf.env['BUILD_JACKDBUS'] != True:
+            conf.fatal('jackdbus was explicitly requested but cannot be built')
+    conf.sub_config('example-clients')
+
+    if conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs'):
+        conf.define('HAVE_CELT', 1)
+        conf.define('HAVE_CELT_API_0_7', 1)
+        conf.define('HAVE_CELT_API_0_5', 0)
+    elif conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs', required=True):
+        conf.define('HAVE_CELT', 1)
+        conf.define('HAVE_CELT_API_0_5', 1)
+        conf.define('HAVE_CELT_API_0_7', 0)
+    else:
+        conf.define('HAVE_CELT', 0)
+        conf.define('HAVE_CELT_API_0_5', 0)
+        conf.define('HAVE_CELT_API_0_7', 0)
+
+    conf.env['LIB_PTHREAD'] = ['pthread']
+    conf.env['LIB_DL'] = ['dl']
+    conf.env['LIB_RT'] = ['rt']
+    conf.env['JACK_API_VERSION'] = JACK_API_VERSION
+    conf.env['JACK_VERSION'] = VERSION
+
+    conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen
+    conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
+    conf.env['BUILD_WITH_32_64'] = Options.options.mixed
+    conf.env['BUILD_CLASSIC'] = Options.options.classic
+    conf.env['BUILD_DEBUG'] = Options.options.debug
+
+    if conf.env['BUILD_JACKDBUS']:
+        conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
+    else:
+        conf.env['BUILD_JACKD'] = True
+
+    if Options.options.libdir:
+        conf.env['LIBDIR'] = conf.env['PREFIX'] + Options.options.libdir
+    else:
+        conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
+
+    if conf.env['BUILD_DEBUG']:
+        conf.env.append_unique('CXXFLAGS', '-g')
+        conf.env.append_unique('CCFLAGS', '-g')
+        conf.env.append_unique('LINKFLAGS', '-g')
+
+    conf.define('CLIENT_NUM', Options.options.clients)
+    conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
+
+    conf.define('ADDON_DIR', os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack')))
+    conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
+    conf.define('USE_POSIX_SHM', 1)
+    conf.define('JACKMP', 1)
+    if conf.env['BUILD_JACKDBUS'] == True:
+        conf.define('JACK_DBUS', 1)
+        if conf.env['BUILD_JACKD'] == False:
+            conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
+    if conf.env['BUILD_WITH_PROFILE'] == True:
+        conf.define('JACK_MONITOR', 1)
+    if conf.env['BUILD_WITH_32_64'] == True:
+        conf.define('JACK_32_64', 1)
+    conf.write_config_header('config.h')
+
+    svnrev = None
+    if os.access('svnversion.h', os.R_OK):
+        data = file('svnversion.h').read()
+        m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
+        if m != None:
+            svnrev = m.group(1)
+
+    print
+    display_msg("==================")
+    version_msg = "JACK " + VERSION
+    if svnrev:
+        version_msg += " exported from r" + svnrev
+    else:
+        version_msg += " svn revision will checked and eventually updated during build"
+    print version_msg
+
+    print "Build with a maximum of %d JACK clients" % conf.env['CLIENT_NUM']
+    print "Build with a maximum of %d ports per application" % conf.env['PORT_NUM_FOR_CLIENT']
+ 
+    display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
+    display_msg("Library directory", conf.env['LIBDIR'], 'CYAN')
+    display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN')
+    display_feature('Build debuggable binaries', conf.env['BUILD_DEBUG'])
+    display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS'])
+    display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
+    display_feature('Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
+
+    display_feature('Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
+    display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
+
+    if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
+        print Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL
+        print Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL
+
+    if conf.env['IS_LINUX']:
+        display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True)
+        display_feature('Build with FireWire (FreeBob) support', conf.env['BUILD_DRIVER_FREEBOB'] == True)
+        display_feature('Build with FireWire (FFADO) support', conf.env['BUILD_DRIVER_FFADO'] == True)
+       
+    if conf.env['BUILD_JACKDBUS'] == True:
+        display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
+        #display_msg('Settings persistence', xxx)
+
+        if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
+            print
+            print Logs.colors.RED + "WARNING: D-Bus session services directory as reported by pkg-config is"
+            print Logs.colors.RED + "WARNING:",
+            print Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL']
+            print Logs.colors.RED + 'WARNING: but service file will be installed in'
+            print Logs.colors.RED + "WARNING:",
+            print Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR']
+            print Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
+            print 'WARNING: You can override dbus service install directory'
+            print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
+            print Logs.colors.NORMAL,
+    print
+
+    if Options.options.mixed == True:
+	env_variant2 = conf.env.copy()
+	conf.set_env_name('lib32', env_variant2)
+	env_variant2.set_variant('lib32')
+	conf.setenv('lib32')
+    	conf.env.append_unique('CXXFLAGS', '-m32')
+    	conf.env.append_unique('CCFLAGS', '-m32')
+    	conf.env.append_unique('LINKFLAGS', '-m32')
+    	if Options.options.libdir32:
+	    conf.env['LIBDIR'] = conf.env['PREFIX'] + Options.options.libdir32
+    	else:
+	    conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
+	conf.write_config_header('config.h')
+
+def build(bld):
+    print ("make[1]: Entering directory `" + os.getcwd() + "/" + blddir + "'" )
+    if not os.access('svnversion.h', os.R_OK):
+        create_svnversion_task(bld)
+
+   # process subfolders from here
+    bld.add_subdirs('common')
+    if bld.env['IS_LINUX']:
+        bld.add_subdirs('linux')
+        bld.add_subdirs('example-clients')
+        bld.add_subdirs('tests')
+        if bld.env['BUILD_JACKDBUS'] == True:
+           bld.add_subdirs('dbus')
+  
+    if bld.env['IS_MACOSX']:
+        bld.add_subdirs('macosx')
+        bld.add_subdirs('example-clients')
+        bld.add_subdirs('tests')
+        if bld.env['BUILD_JACKDBUS'] == True:
+            bld.add_subdirs('dbus')
+
+    if bld.env['IS_SUN']:
+        bld.add_subdirs('solaris')
+        bld.add_subdirs('example-clients')
+        bld.add_subdirs('tests')
+        if bld.env['BUILD_JACKDBUS'] == True:
+            bld.add_subdirs('dbus')
+
+    if bld.env['BUILD_DOXYGEN_DOCS'] == True:
+        share_dir = bld.env.get_destdir() + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
+        html_docs_source_dir = "build/default/html"
+        html_docs_install_dir = share_dir + '/reference/html/'
+        if Options.commands['install']:
+            if os.path.isdir(html_docs_install_dir):
+                Utils.pprint('CYAN', "Removing old doxygen documentation installation...")
+                shutil.rmtree(html_docs_install_dir)
+                Utils.pprint('CYAN', "Removing old doxygen documentation installation done.")
+            Utils.pprint('CYAN', "Installing doxygen documentation...")
+            shutil.copytree(html_docs_source_dir, html_docs_install_dir)
+            Utils.pprint('CYAN', "Installing doxygen documentation done.")
+        elif Options.commands['uninstall']:
+            Utils.pprint('CYAN', "Uninstalling doxygen documentation...")
+            if os.path.isdir(share_dir):
+                shutil.rmtree(share_dir)
+            Utils.pprint('CYAN', "Uninstalling doxygen documentation done.")
+        elif Options.commands['clean']:
+            if os.access(html_docs_source_dir, os.R_OK):
+                Utils.pprint('CYAN', "Removing doxygen generated documentation...")
+                shutil.rmtree(html_docs_source_dir)
+                Utils.pprint('CYAN', "Removing doxygen generated documentation done.")
+        elif Options.commands['build']:
+            if not os.access(html_docs_source_dir, os.R_OK):
+                os.popen("doxygen").read()
+            else:
+                Utils.pprint('CYAN', "doxygen documentation already built.")
+
+def dist_hook():
+    os.remove('svnversion_regenerate.sh')
+    os.system('../svnversion_regenerate.sh svnversion.h')

-- 
Debian packaging for jack-audio-connection-kit



More information about the pkg-multimedia-commits mailing list