	Introduction to the netaudio system

With version 1.1, netaudio supports

	remote floppy
	operation of CDROM to play music CD
	operation of the soundcard

Goal:

	The netaudio package has been created to make linux based X terminal
	more complete. When using an X terminal, there are 3 local resources
	you need to access

		cdrom
		floppy
		soundcard

	While there are various protocols, especially for sound, that have
	been created, very few software are using it. The netaudio package
	is a solution you may use now.

		-It is not a driver (a kernel module)
		-no need to recompile any application
		-the installation is very easy
		-the operation is transparent for X users

Technology:

	The trick behind netaudio is a preloaded share object that intercept
	some low level system call such as open,close,read,write and act on
	them specially if the target is one of the special files

		/dev/cdrom
		/dev/dsp
		/dev/mixer
		/dev/audio
		/dev/fd0
		/dev/fd0H1440
		/dev/fd1
		/dev/fd1H1440

	Since it is a preloaded share object, there is no need to recompile
	any software. All is needed to activate netaudio is a single line
	in /etc/profile on the application server

		export LD_PRELOAD=/usr/lib/netaudio.so.1.0.0

	and on the workstation or Xterminal, you must run the netaudioserv
	command

		/usr/sbin/netaudioserv &

	That's all. The performance hit of this strategy is almost nil.

Current state:

	netaudio is already useful. There are still few ioctl which are not
	supported, but so far, most apps I am tried (mixer, cdplayer,tar) work.
	If you get one application that does not behave properly, please tell
	me.

Motivation:

	Many people are using linux based X terminal equipped with a sound
	card and run most of their software on nice and powerful linux
	server. They would like to use stuff like realaudio for example, but
	can't since realaudio insist on using the local /dev/audio.

	There are at least two remote sound support protocol available:
	Rplay and NAS. Both are nice. Both are ignored by most package.
	This is unfortunate.

Principles:

	It uses the variable DISPLAY to locate the audioserver (part of this
	distribution).

	To understand how it works, here is a simple example

	start audioserver on your workstation/Xterminal

		audioserver &

	Then start a shell on a server or another workstation. Make sure that
	the DISPLAY variable is correctly set to point to your screen. Then do

	   (export LD_PRELOAD=netaudio.so.1.0.0; cp ring.au /dev/audio)

	You should have sound on your workstation. The same apply to realaudio

	   (export LD_PRELOAD=netaudio.so.1.0.0; rvplayer)

Some tricks

	netaudio.so use the variable DISPLAY to define where the audio,cdrom and
	floppy management are redirected. Another variable may be used:
	NETAUDIOHOST. This variable override any other. So it is possible to
	have your display on one station, but redirect the cdrom and audio
	management on another station. This also allows non X user to benefit
	from netaudio also.

	The /usr/bin/netaudio command provide a nice way to set a shell pointing
	to another station. You can do either

		netaudio station command

	or

		netaudio station

	The later provides a shell and you exit when done!

How it works

	The linux libc has a nice technology called weak symbol. Weak symbols
	normally point to normal libc entry points. For example

		open	-> __libc_open
		close	-> __libc_close

	if an application or a library define its own open or close, then
	the dynamic linker will give preference to this open ot this close.
	This is true even for calls inside libc itself.

	So netaudio is just a share object that is preloaded in front of libc
	and redefined a bunch of key function and change behavior according
	to the file which is act upon.

Usage restriction

	The "stat" function can't be easily override using weak symbol. Because
	of this, some commands do not work.

		cat sample.au >/dev/audio

	does not work because of this. But

		cp sample.au /dev/audio

	has no problem.

License

	Under GPL. Have fun!

Conclusion:

This is a new package. I feel it solve a real problem. Some part
of the protocol (some ioctls) are not implemented, so not all
audio software will work. I suspect that most should though.

Comments are welcome

Jacques Gelinas jack@solucorp.qc.ca

