mirror of https://github.com/ericonr/sndio.git
move server specific bits into new sndiod daemon
This commit is contained in:
parent
b218a19c35
commit
073a090888
|
@ -23,23 +23,24 @@ MAN1_DIR = @mandir@/man1
|
||||||
#
|
#
|
||||||
# programs to build
|
# programs to build
|
||||||
#
|
#
|
||||||
PROG = aucat
|
PROG = aucat sndiod
|
||||||
MAN1 = aucat.1
|
MAN1 = aucat.1 sndiod.1
|
||||||
|
|
||||||
all: ${PROG}
|
all: ${PROG} ${MAN1}
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p ${DESTDIR}${BIN_DIR} ${DESTDIR}${MAN1_DIR}
|
mkdir -p ${DESTDIR}${BIN_DIR} ${DESTDIR}${MAN1_DIR}
|
||||||
cp aucat ${DESTDIR}${BIN_DIR}
|
cp aucat ${DESTDIR}${BIN_DIR}
|
||||||
cd ${DESTDIR}${BIN_DIR}
|
cp aucat.1 ${DESTDIR}${MAN1_DIR}
|
||||||
cp ${MAN1} ${DESTDIR}${MAN1_DIR}
|
ln -sf aucat ${DESTDIR}${BIN_DIR}/sndiod
|
||||||
|
ln -sf aucat.1 ${DESTDIR}${MAN1_DIR}/sndiod.1
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
cd ${DESTDIR}${BIN_DIR} && rm -f ${PROG}
|
cd ${DESTDIR}${BIN_DIR} && rm -f ${PROG}
|
||||||
cd ${DESTDIR}${MAN1_DIR} && rm -f ${MAN1}
|
cd ${DESTDIR}${MAN1_DIR} && rm -f ${MAN1}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f -- ${PROG} *.o *~ *.bak *.tmp *.core core
|
rm -f -- *.o aucat sndiod sndiod.1
|
||||||
|
|
||||||
# ---------------------------------------------------------- dependencies ---
|
# ---------------------------------------------------------- dependencies ---
|
||||||
|
|
||||||
|
@ -51,6 +52,12 @@ wav.o
|
||||||
aucat: ${OBJS}
|
aucat: ${OBJS}
|
||||||
${CC} ${LDFLAGS} ${LIB} -o aucat ${OBJS} ${LDADD}
|
${CC} ${LDFLAGS} ${LIB} -o aucat ${OBJS} ${LDADD}
|
||||||
|
|
||||||
|
sndiod:
|
||||||
|
ln -sf aucat sndiod
|
||||||
|
|
||||||
|
sndiod.1:
|
||||||
|
ln -sf aucat.1 sndiod.1
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
${CC} ${CFLAGS} ${INCLUDE} ${DEFS} -c $<
|
${CC} ${CFLAGS} ${INCLUDE} ${DEFS} -c $<
|
||||||
|
|
||||||
|
|
190
aucat/aucat.1
190
aucat/aucat.1
|
@ -18,13 +18,13 @@
|
||||||
.Dt AUCAT 1
|
.Dt AUCAT 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm aucat
|
.Nm aucat ,
|
||||||
|
.Nm sndiod
|
||||||
.Nd audio/MIDI server and stream manipulation tool
|
.Nd audio/MIDI server and stream manipulation tool
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm aucat
|
.Nm aucat
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl dlMn
|
.Op Fl dn
|
||||||
.Op Fl a Ar flag
|
|
||||||
.Op Fl b Ar nframes
|
.Op Fl b Ar nframes
|
||||||
.Op Fl C Ar min : Ns Ar max
|
.Op Fl C Ar min : Ns Ar max
|
||||||
.Op Fl c Ar min : Ns Ar max
|
.Op Fl c Ar min : Ns Ar max
|
||||||
|
@ -33,11 +33,30 @@
|
||||||
.Op Fl h Ar fmt
|
.Op Fl h Ar fmt
|
||||||
.Op Fl i Ar file
|
.Op Fl i Ar file
|
||||||
.Op Fl j Ar flag
|
.Op Fl j Ar flag
|
||||||
.Op Fl L Ar addr
|
|
||||||
.Op Fl m Ar mode
|
.Op Fl m Ar mode
|
||||||
.Op Fl o Ar file
|
.Op Fl o Ar file
|
||||||
.Op Fl q Ar port
|
.Op Fl q Ar port
|
||||||
.Op Fl r Ar rate
|
.Op Fl r Ar rate
|
||||||
|
.Op Fl t Ar mode
|
||||||
|
.Op Fl v Ar volume
|
||||||
|
.Op Fl w Ar flag
|
||||||
|
.Op Fl x Ar policy
|
||||||
|
.Op Fl z Ar nframes
|
||||||
|
.Ek
|
||||||
|
.Nm sndiod
|
||||||
|
.Bk -words
|
||||||
|
.Op Fl dM
|
||||||
|
.Op Fl a Ar flag
|
||||||
|
.Op Fl b Ar nframes
|
||||||
|
.Op Fl C Ar min : Ns Ar max
|
||||||
|
.Op Fl c Ar min : Ns Ar max
|
||||||
|
.Op Fl e Ar enc
|
||||||
|
.Op Fl f Ar device
|
||||||
|
.Op Fl j Ar flag
|
||||||
|
.Op Fl L Ar addr
|
||||||
|
.Op Fl m Ar mode
|
||||||
|
.Op Fl q Ar port
|
||||||
|
.Op Fl r Ar rate
|
||||||
.Op Fl s Ar name
|
.Op Fl s Ar name
|
||||||
.Op Fl t Ar mode
|
.Op Fl t Ar mode
|
||||||
.Op Fl U Ar unit
|
.Op Fl U Ar unit
|
||||||
|
@ -50,30 +69,30 @@
|
||||||
.Nm
|
.Nm
|
||||||
is an audio utility which can simultaneously play and record
|
is an audio utility which can simultaneously play and record
|
||||||
any number of audio
|
any number of audio
|
||||||
.Em streams
|
.Em streams ,
|
||||||
on any number of audio devices,
|
|
||||||
possibly controlled through MIDI.
|
possibly controlled through MIDI.
|
||||||
It can also act as an audio server, in which case streams
|
|
||||||
correspond to client connections rather than plain files.
|
|
||||||
.Pp
|
|
||||||
Audio devices are independent.
|
|
||||||
A list of streams is attached to each audio device,
|
|
||||||
as well as an optional list of MIDI ports to control the device.
|
|
||||||
A typical invocation of
|
A typical invocation of
|
||||||
.Nm
|
.Nm
|
||||||
consists in providing streams to play and record,
|
consists in providing streams to play and record,
|
||||||
and possibly the audio device to use, if the default is not desired.
|
and possibly the audio device to use.
|
||||||
.Pp
|
.Pp
|
||||||
This also applies to server mode, except that streams are created
|
The
|
||||||
|
.Nm sndiod
|
||||||
|
daemon acts as an audio server.
|
||||||
|
Its functionality is identical to
|
||||||
|
.Nm aucat ,
|
||||||
|
except that streams are created
|
||||||
dynamically when clients connect to the server.
|
dynamically when clients connect to the server.
|
||||||
Thus, instead of actual streams (paths to plain files),
|
Thus, instead of actual streams (paths to plain files),
|
||||||
templates for client streams (sub-device names) must be provided.
|
templates for client streams (sub-device names) must be provided.
|
||||||
|
Multiple independent audio devices are supported,
|
||||||
|
each has its own list of streams and MIDI control ports.
|
||||||
.Pp
|
.Pp
|
||||||
The options are as follows:
|
The options are as follows:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl a Ar flag
|
.It Fl a Ar flag
|
||||||
Control whether
|
Control whether
|
||||||
.Nm
|
.Nm sndiod
|
||||||
opens the audio device only when needed or keeps it open all the time.
|
opens the audio device only when needed or keeps it open all the time.
|
||||||
This applies to MIDI ports controlling the device as well.
|
This applies to MIDI ports controlling the device as well.
|
||||||
If the flag is
|
If the flag is
|
||||||
|
@ -101,7 +120,7 @@ respectively.
|
||||||
The default is 0:1, i.e. stereo.
|
The default is 0:1, i.e. stereo.
|
||||||
.It Fl d
|
.It Fl d
|
||||||
Increase log verbosity.
|
Increase log verbosity.
|
||||||
.Nm
|
.Nm sndiod
|
||||||
logs on
|
logs on
|
||||||
.Em stderr
|
.Em stderr
|
||||||
until it daemonizes.
|
until it daemonizes.
|
||||||
|
@ -146,23 +165,23 @@ be sent on multiple outputs or to record a stereo input into a mono stream.
|
||||||
The default is
|
The default is
|
||||||
.Ar on .
|
.Ar on .
|
||||||
.It Fl L Ar addr
|
.It Fl L Ar addr
|
||||||
Specify a local network address to listen on in server mode.
|
Specify a local network address
|
||||||
.Nm
|
.Nm sndiod
|
||||||
|
should listen;
|
||||||
|
.Nm sndiod
|
||||||
will listen on TCP port 11025+n, where n is the unit number
|
will listen on TCP port 11025+n, where n is the unit number
|
||||||
specified with
|
specified with
|
||||||
.Fl U .
|
.Fl U .
|
||||||
Without this option,
|
Without this option,
|
||||||
.Nm
|
.Nm sndiod
|
||||||
listens on the
|
listens on the
|
||||||
.Ux Ns -domain
|
.Ux Ns -domain
|
||||||
socket only, and is not reachable from any network.
|
socket only, and is not reachable from any network.
|
||||||
If the option argument is
|
If the option argument is
|
||||||
.Sq -
|
.Sq -
|
||||||
then
|
then
|
||||||
.Nm
|
.Nm sndiod
|
||||||
will accept connections from any address.
|
will accept connections from any address.
|
||||||
.It Fl l
|
|
||||||
Detach and become a daemon.
|
|
||||||
.It Fl M
|
.It Fl M
|
||||||
Create a MIDI thru box
|
Create a MIDI thru box
|
||||||
.Pq i.e. MIDI-only pseudo device .
|
.Pq i.e. MIDI-only pseudo device .
|
||||||
|
@ -177,9 +196,9 @@ preceded by
|
||||||
.Fl m Ar midi
|
.Fl m Ar midi
|
||||||
.Pc
|
.Pc
|
||||||
can be attached to it.
|
can be attached to it.
|
||||||
If sub-devices are exposed
|
Exposed sub-devices by
|
||||||
.Pq Fl s
|
.Nm sndiod
|
||||||
they behave like software MIDI ports,
|
behave like software MIDI ports,
|
||||||
allowing any MIDI-capable application to send MIDI messages to
|
allowing any MIDI-capable application to send MIDI messages to
|
||||||
MIDI hardware or to another application in a uniform way.
|
MIDI hardware or to another application in a uniform way.
|
||||||
.It Fl m Ar mode
|
.It Fl m Ar mode
|
||||||
|
@ -208,10 +227,6 @@ It requires at least one input
|
||||||
.Pq Fl i
|
.Pq Fl i
|
||||||
and one output
|
and one output
|
||||||
.Pq Fl o .
|
.Pq Fl o .
|
||||||
It doesn't support MIDI control
|
|
||||||
.Pq Fl q
|
|
||||||
and can't expose sub-devices
|
|
||||||
.Pq Fl s .
|
|
||||||
.It Fl o Ar file
|
.It Fl o Ar file
|
||||||
Add this file to the list of recording streams.
|
Add this file to the list of recording streams.
|
||||||
If the option argument is
|
If the option argument is
|
||||||
|
@ -233,9 +248,9 @@ The default is 44100Hz.
|
||||||
.It Fl s Ar name
|
.It Fl s Ar name
|
||||||
Add
|
Add
|
||||||
.Ar name
|
.Ar name
|
||||||
to the list of sub-devices to expose in server mode.
|
to the list of sub-devices to expose.
|
||||||
This allows clients to use
|
This allows clients to use
|
||||||
.Nm
|
.Nm sndiod
|
||||||
instead of the physical audio device for audio input and output
|
instead of the physical audio device for audio input and output
|
||||||
in order to share the physical device with other clients.
|
in order to share the physical device with other clients.
|
||||||
Defining multiple sub-devices allows splitting a physical audio device
|
Defining multiple sub-devices allows splitting a physical audio device
|
||||||
|
@ -262,15 +277,15 @@ to audio streams.
|
||||||
.It Fl U Ar unit
|
.It Fl U Ar unit
|
||||||
Unit number to use when running in server mode.
|
Unit number to use when running in server mode.
|
||||||
Each
|
Each
|
||||||
.Nm
|
.Nm sndiod
|
||||||
server instance has an unique unit number,
|
server instance has an unique unit number,
|
||||||
used in
|
used in
|
||||||
.Xr sndio 7
|
.Xr sndio 7
|
||||||
device names.
|
device names.
|
||||||
The default is 0.
|
The default is 0.
|
||||||
The unit number must be set before any server-specific
|
The unit number must be set before any
|
||||||
options are used
|
.Fl L
|
||||||
.Pq Fl Ls .
|
is used.
|
||||||
.It Fl v Ar volume
|
.It Fl v Ar volume
|
||||||
Software volume attenuation of the playback stream.
|
Software volume attenuation of the playback stream.
|
||||||
The value must be between 1 and 127,
|
The value must be between 1 and 127,
|
||||||
|
@ -284,6 +299,8 @@ The default is 127 i.e. no attenuation.
|
||||||
.It Fl w Ar flag
|
.It Fl w Ar flag
|
||||||
Control
|
Control
|
||||||
.Nm
|
.Nm
|
||||||
|
and
|
||||||
|
.Nm sndiod
|
||||||
behaviour when the maximum volume of the hardware is reached
|
behaviour when the maximum volume of the hardware is reached
|
||||||
and a new stream is connected.
|
and a new stream is connected.
|
||||||
This happens only when stream volumes
|
This happens only when stream volumes
|
||||||
|
@ -357,21 +374,18 @@ and stream definitions
|
||||||
must follow the definition of the device
|
must follow the definition of the device
|
||||||
.Pq Fl fMn
|
.Pq Fl fMn
|
||||||
to which they are attached.
|
to which they are attached.
|
||||||
Global parameters
|
|
||||||
.Pq Fl dl
|
|
||||||
are position-independent.
|
|
||||||
.Pp
|
.Pp
|
||||||
If no audio devices
|
If no audio devices
|
||||||
.Pq Fl fMn
|
.Pq Fl fMn
|
||||||
are specified,
|
are specified,
|
||||||
settings are applied as if
|
settings are applied as if
|
||||||
the default device is specified.
|
the default device is specified.
|
||||||
If no streams
|
If no
|
||||||
.Pq Fl ios
|
.Nm sndiod
|
||||||
|
sub-devices
|
||||||
|
.Pq Fl s
|
||||||
are specified for a device, a default server sub-device is
|
are specified for a device, a default server sub-device is
|
||||||
created attached to it, meaning that
|
created attached to it.
|
||||||
.Nm
|
|
||||||
behaves as an audio server.
|
|
||||||
If a device
|
If a device
|
||||||
.Pq Fl fMn
|
.Pq Fl fMn
|
||||||
is defined twice, both definitions are merged:
|
is defined twice, both definitions are merged:
|
||||||
|
@ -382,12 +396,19 @@ and MIDI control ports
|
||||||
of both definitions are created.
|
of both definitions are created.
|
||||||
The default
|
The default
|
||||||
.Xr sndio 7
|
.Xr sndio 7
|
||||||
device is
|
device used by
|
||||||
.Pa snd/0
|
.Nm sndiod
|
||||||
.Pq also known as Pa snd/0.default .
|
is
|
||||||
|
.Pa rsnd/0 ,
|
||||||
|
and the default sub-device exposed by
|
||||||
|
.Nm sndiod
|
||||||
|
is
|
||||||
|
.Pa snd/0 .
|
||||||
.Pp
|
.Pp
|
||||||
If
|
If
|
||||||
.Nm
|
.Nm sndiod
|
||||||
|
or
|
||||||
|
.Nm aucat
|
||||||
is sent
|
is sent
|
||||||
.Dv SIGHUP ,
|
.Dv SIGHUP ,
|
||||||
.Dv SIGINT
|
.Dv SIGINT
|
||||||
|
@ -475,14 +496,8 @@ signed 18-bit, packed in 3 bytes, little endian
|
||||||
unsigned 18-bit, packed in 3 bytes, big endian
|
unsigned 18-bit, packed in 3 bytes, big endian
|
||||||
.El
|
.El
|
||||||
.Sh SERVER MODE
|
.Sh SERVER MODE
|
||||||
If at least one sub-device
|
.Nm sndiod
|
||||||
.Pq Fl s
|
can be used
|
||||||
is exposed by
|
|
||||||
.Nm ,
|
|
||||||
including the case when no stream options are given,
|
|
||||||
then
|
|
||||||
.Nm
|
|
||||||
can be used as a server
|
|
||||||
to overcome hardware limitations and allow applications
|
to overcome hardware limitations and allow applications
|
||||||
to run on fixed sample rate devices or on devices
|
to run on fixed sample rate devices or on devices
|
||||||
supporting only unusual encodings.
|
supporting only unusual encodings.
|
||||||
|
@ -502,10 +517,10 @@ MIDI ports
|
||||||
.Pq Fl q
|
.Pq Fl q
|
||||||
and allows audio device properties to be controlled
|
and allows audio device properties to be controlled
|
||||||
through MIDI.
|
through MIDI.
|
||||||
If running in server mode
|
Additionally,
|
||||||
.Nm
|
.Nm sndiod
|
||||||
creates a MIDI port with the same name as the default audio
|
creates a MIDI port with the same name as the exposed audio
|
||||||
device to which MIDI programs can connect.
|
sub-device to which MIDI programs can connect.
|
||||||
.Pp
|
.Pp
|
||||||
A MIDI channel is assigned to each stream, and the volume
|
A MIDI channel is assigned to each stream, and the volume
|
||||||
is changed using the standard volume controller (number 7).
|
is changed using the standard volume controller (number 7).
|
||||||
|
@ -524,32 +539,42 @@ relative to the beginning of the stream, at which playback
|
||||||
and recording must start.
|
and recording must start.
|
||||||
If the requested position is beyond the end of file,
|
If the requested position is beyond the end of file,
|
||||||
the stream is temporarly disabled until a valid position is requested.
|
the stream is temporarly disabled until a valid position is requested.
|
||||||
This message is ignored by client streams (server mode).
|
This message is ignored by audio
|
||||||
The given time position is sent to MIDI ports as an MTC
|
.Nm sndiod
|
||||||
|
clients, but the given time position is sent to MIDI ports as an MTC
|
||||||
.Dq "full frame"
|
.Dq "full frame"
|
||||||
message forcing all MTC-slaves to relocate to the given
|
message forcing all MTC-slaves to relocate to the given
|
||||||
position (see below).
|
position (see below).
|
||||||
.It start
|
.It start
|
||||||
Put all streams in starting mode.
|
Put all streams in starting mode.
|
||||||
In this mode,
|
In this mode,
|
||||||
.Nm
|
.Nm sndiod
|
||||||
|
or
|
||||||
|
.Nm aucat
|
||||||
waits for all streams to become ready
|
waits for all streams to become ready
|
||||||
to start, and then starts them synchronously.
|
to start, and then starts them synchronously.
|
||||||
Once started, new streams can be created (server mode)
|
Once started, new streams can be created
|
||||||
|
.Pq Nm sndiod
|
||||||
but they will be blocked
|
but they will be blocked
|
||||||
until the next stop-to-start transition.
|
until the next stop-to-start transition.
|
||||||
.It stop
|
.It stop
|
||||||
Put all streams in stopped mode (the default).
|
Put all streams in stopped mode (the default).
|
||||||
In this mode, any stream attempting to start playback or recording
|
In this mode, any stream attempting to start playback or recording
|
||||||
is paused.
|
is paused.
|
||||||
Files are stopped and rewound back to the starting position,
|
Files
|
||||||
while client streams (server mode) that are already
|
.Pq Nm aucat
|
||||||
|
are stopped and rewound back to the starting position,
|
||||||
|
while client streams
|
||||||
|
.Pq Nm sndiod
|
||||||
|
that are already
|
||||||
started are not affected until they stop and try to start again.
|
started are not affected until they stop and try to start again.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Streams created with the
|
Streams created with the
|
||||||
.Fl t
|
.Fl t
|
||||||
option export the server clock using MTC, allowing non-audio
|
option export the
|
||||||
|
.Nm sndiod
|
||||||
|
device clock using MTC, allowing non-audio
|
||||||
software or hardware to be synchronized to the audio stream.
|
software or hardware to be synchronized to the audio stream.
|
||||||
Maximum accuracy is achieved when the number of blocks per
|
Maximum accuracy is achieved when the number of blocks per
|
||||||
second is equal to one of the standard MTC clock rates (96, 100 and 120Hz).
|
second is equal to one of the standard MTC clock rates (96, 100 and 120Hz).
|
||||||
|
@ -576,7 +601,7 @@ the default
|
||||||
and a MIDI-controlled
|
and a MIDI-controlled
|
||||||
.Va snd/0.mmc :
|
.Va snd/0.mmc :
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ aucat -l -r 48000 -z 400 -s default -t slave -s mmc
|
$ sndiod -r 48000 -z 400 -s default -t slave -s mmc
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
Streams connected to
|
Streams connected to
|
||||||
|
@ -634,9 +659,7 @@ $ aucat -n -j off -i stereo.wav -C 0:0 -o left.wav -C 1:1 \e
|
||||||
-o right.wav
|
-o right.wav
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
Start
|
Start server using default parameters, creating an
|
||||||
.Nm
|
|
||||||
in server mode using default parameters, creating an
|
|
||||||
additional sub-device for output to channels 2:3 only (rear speakers
|
additional sub-device for output to channels 2:3 only (rear speakers
|
||||||
on most cards), exposing the
|
on most cards), exposing the
|
||||||
.Pa snd/0
|
.Pa snd/0
|
||||||
|
@ -644,30 +667,26 @@ and
|
||||||
.Pa snd/0.rear
|
.Pa snd/0.rear
|
||||||
devices:
|
devices:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ aucat -l -s default -c 2:3 -s rear
|
$ sndiod -s default -c 2:3 -s rear
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
Start
|
Start server creating the default sub-device with low volume and
|
||||||
.Nm
|
|
||||||
in server mode, creating the default sub-device with low volume and
|
|
||||||
an additional sub-device for high volume output, exposing the
|
an additional sub-device for high volume output, exposing the
|
||||||
.Pa snd/0
|
.Pa snd/0
|
||||||
and
|
and
|
||||||
.Pa snd/0.max
|
.Pa snd/0.max
|
||||||
devices:
|
devices:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ aucat -l -v 65 -s default -v 127 -s max
|
$ sndiod -v 65 -s default -v 127 -s max
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
Start
|
Start server configuring the audio device to use
|
||||||
.Nm
|
|
||||||
in server mode, configuring the audio device to use
|
|
||||||
a 48kHz sample frequency, 240-frame block size,
|
a 48kHz sample frequency, 240-frame block size,
|
||||||
and 2-block buffers.
|
and 2-block buffers.
|
||||||
The corresponding latency is 10ms, which is
|
The corresponding latency is 10ms, which is
|
||||||
the time it takes the sound to propagate 3.5 meters.
|
the time it takes the sound to propagate 3.5 meters.
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ aucat -l -r 48000 -b 480 -z 240
|
$ sndiod -r 48000 -b 480 -z 240
|
||||||
.Ed
|
.Ed
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr audioctl 1 ,
|
.Xr audioctl 1 ,
|
||||||
|
@ -682,10 +701,11 @@ utility assumes non-blocking I/O for input and output streams.
|
||||||
It will not work reliably on files that may block
|
It will not work reliably on files that may block
|
||||||
(ordinary files block, pipes don't).
|
(ordinary files block, pipes don't).
|
||||||
To avoid audio underruns/overruns or MIDI jitter caused by file I/O,
|
To avoid audio underruns/overruns or MIDI jitter caused by file I/O,
|
||||||
it's recommended to use two
|
it's recommended to use two processes: a
|
||||||
|
.Nm sndiod
|
||||||
|
server handling audio and MIDI I/O and a
|
||||||
.Nm
|
.Nm
|
||||||
processes: a server handling audio and MIDI I/O and a client handling
|
client handling disk I/O.
|
||||||
disk I/O.
|
|
||||||
.Pp
|
.Pp
|
||||||
Resampling is low quality; down-sampling especially should be avoided
|
Resampling is low quality; down-sampling especially should be avoided
|
||||||
when recording.
|
when recording.
|
||||||
|
@ -696,12 +716,12 @@ thus samples with more than 16 bits are rounded.
|
||||||
.Pp
|
.Pp
|
||||||
If
|
If
|
||||||
.Fl a Ar off
|
.Fl a Ar off
|
||||||
is used in server mode,
|
is used,
|
||||||
.Nm
|
.Nm sndiod
|
||||||
creates sub-devices to expose first
|
creates sub-devices to expose first
|
||||||
and then opens the audio hardware on demand.
|
and then opens the audio hardware on demand.
|
||||||
Technically, this allows
|
Technically, this allows
|
||||||
.Nm
|
.Nm sndiod
|
||||||
to attempt to use one of the sub-devices it exposes as an audio device,
|
to attempt to use one of the sub-devices it exposes as an audio device,
|
||||||
creating a deadlock.
|
creating a deadlock.
|
||||||
To avoid this,
|
To avoid this,
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#define SNDIO_PRIO (-20)
|
#define SNDIO_PRIO (-20)
|
||||||
|
|
||||||
#define PROG_AUCAT "aucat"
|
#define PROG_AUCAT "aucat"
|
||||||
|
#define PROG_SNDIOD "sndiod"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sample rate if no ``-r'' is used
|
* sample rate if no ``-r'' is used
|
||||||
|
@ -84,12 +85,17 @@ volatile sig_atomic_t debug_level = 1;
|
||||||
#endif
|
#endif
|
||||||
volatile sig_atomic_t quit_flag = 0;
|
volatile sig_atomic_t quit_flag = 0;
|
||||||
|
|
||||||
char aucat_usage[] = "usage: " PROG_AUCAT " [-dlMn] [-a flag] [-b nframes] "
|
char aucat_usage[] = "usage: " PROG_AUCAT " [-dlMn] [-b nframes] "
|
||||||
"[-C min:max] [-c min:max] [-e enc]\n\t"
|
"[-C min:max] [-c min:max] [-e enc]\n\t"
|
||||||
"[-f device] [-h fmt] [-i file] [-j flag] [-L addr] [-m mode] "
|
"[-f device] [-h fmt] [-i file] [-j flag] [-m mode] [-o file]\n\t"
|
||||||
"[-o file]\n\t"
|
"[-q port] [-r rate] [-t mode] [-v volume] [-w flag] [-x policy]\n\t"
|
||||||
"[-q port] [-r rate] [-s name] [-t mode] [-U unit] [-v volume]\n\t"
|
"[-z nframes]\n";
|
||||||
"[-w flag] [-x policy] [-z nframes]\n";
|
|
||||||
|
char sndiod_usage[] = "usage: " PROG_SNDIOD " [-dlM] [-a flag] [-b nframes] "
|
||||||
|
"[-C min:max] [-c min:max] [-e enc]\n\t"
|
||||||
|
"[-f device] [-j flag] [-L addr] [-m mode] [-q port] [-r rate]\n\t"
|
||||||
|
"[-s name] [-t mode] [-U unit] [-v volume] [-w flag] [-x policy]\n\t"
|
||||||
|
"[-z nframes]\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SIGINT handler, it raises the quit flag. If the flag is already set,
|
* SIGINT handler, it raises the quit flag. If the flag is already set,
|
||||||
|
@ -416,6 +422,11 @@ main(int argc, char **argv)
|
||||||
if (strcmp(prog, PROG_AUCAT) == 0) {
|
if (strcmp(prog, PROG_AUCAT) == 0) {
|
||||||
optstr = "a:b:c:C:de:f:h:i:j:lL:m:Mno:q:r:s:t:U:v:w:x:z:";
|
optstr = "a:b:c:C:de:f:h:i:j:lL:m:Mno:q:r:s:t:U:v:w:x:z:";
|
||||||
usagestr = aucat_usage;
|
usagestr = aucat_usage;
|
||||||
|
} else if (strcmp(prog, PROG_SNDIOD) == 0) {
|
||||||
|
optstr = "a:b:c:C:de:f:j:L:m:Mq:r:s:t:U:v:w:x:z:";
|
||||||
|
usagestr = sndiod_usage;
|
||||||
|
background = 1;
|
||||||
|
hold = 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: can't determine program to run\n", prog);
|
fprintf(stderr, "%s: can't determine program to run\n", prog);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -428,6 +439,7 @@ main(int argc, char **argv)
|
||||||
if (debug_level < 4)
|
if (debug_level < 4)
|
||||||
debug_level++;
|
debug_level++;
|
||||||
#endif
|
#endif
|
||||||
|
background = 0;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
if (listen_list)
|
if (listen_list)
|
||||||
|
@ -494,7 +506,7 @@ main(int argc, char **argv)
|
||||||
dev_adjpar(d, w->mode, &w->hpar, NULL);
|
dev_adjpar(d, w->mode, &w->hpar, NULL);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
d = mkdev(NULL, 0, bufsz, round, 1, autovol);
|
d = mkdev(DEFAULT_DEV, 0, bufsz, round, 1, autovol);
|
||||||
mkopt(optarg, d, &rpar, &ppar,
|
mkopt(optarg, d, &rpar, &ppar,
|
||||||
mode, vol, mmc, join);
|
mode, vol, mmc, join);
|
||||||
/* XXX: set device rate, if never set */
|
/* XXX: set device rate, if never set */
|
||||||
|
|
|
@ -51,7 +51,7 @@ The
|
||||||
library allows user processes to access
|
library allows user processes to access
|
||||||
.Xr midi 4
|
.Xr midi 4
|
||||||
hardware and
|
hardware and
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
MIDI thru boxes and control ports in a uniform way.
|
MIDI thru boxes and control ports in a uniform way.
|
||||||
.Ss Opening and closing an MIDI stream
|
.Ss Opening and closing an MIDI stream
|
||||||
First the application must call the
|
First the application must call the
|
||||||
|
@ -63,7 +63,7 @@ argument of most other functions.
|
||||||
The
|
The
|
||||||
.Fn mio_open
|
.Fn mio_open
|
||||||
function tries to connect to the
|
function tries to connect to the
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
MIDI thru box or to use the
|
MIDI thru box or to use the
|
||||||
.Xr midi 4
|
.Xr midi 4
|
||||||
hardware port.
|
hardware port.
|
||||||
|
@ -241,13 +241,13 @@ may be a value between 0 and 2.
|
||||||
.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
|
.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
|
||||||
.It Pa /tmp/aucat-<uid>/aucat0
|
.It Pa /tmp/aucat-<uid>/aucat0
|
||||||
Default path to
|
Default path to
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
socket to connect to.
|
socket to connect to.
|
||||||
.It Pa /dev/rmidiX
|
.It Pa /dev/rmidiX
|
||||||
.Xr midi 4
|
.Xr midi 4
|
||||||
devices.
|
devices.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr aucat 1 ,
|
.Xr sndiod 1 ,
|
||||||
.Xr midi 4 ,
|
.Xr midi 4 ,
|
||||||
.Xr sndio 7
|
.Xr sndio 7
|
||||||
|
|
|
@ -80,11 +80,11 @@ The
|
||||||
library allows user processes to access
|
library allows user processes to access
|
||||||
.Xr audio 4
|
.Xr audio 4
|
||||||
hardware and the
|
hardware and the
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
audio server in a uniform way.
|
audio server in a uniform way.
|
||||||
It supports full-duplex operation, and when
|
It supports full-duplex operation, and when
|
||||||
used with the
|
used with the
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
server it supports resampling and format
|
server it supports resampling and format
|
||||||
conversions on the fly.
|
conversions on the fly.
|
||||||
.Ss Opening and closing an audio stream
|
.Ss Opening and closing an audio stream
|
||||||
|
@ -97,7 +97,7 @@ argument of most other functions.
|
||||||
The
|
The
|
||||||
.Fn sio_open
|
.Fn sio_open
|
||||||
function first tries to connect to the
|
function first tries to connect to the
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
audio server.
|
audio server.
|
||||||
If that fails, it then tries to use the
|
If that fails, it then tries to use the
|
||||||
.Xr audio 4
|
.Xr audio 4
|
||||||
|
@ -273,7 +273,7 @@ must be called before parameters can be changed.
|
||||||
If
|
If
|
||||||
.Nm libsndio
|
.Nm libsndio
|
||||||
is used to connect to the
|
is used to connect to the
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
server, a transparent emulation layer will
|
server, a transparent emulation layer will
|
||||||
automatically be set up, and in this case any
|
automatically be set up, and in this case any
|
||||||
parameters are supported.
|
parameters are supported.
|
||||||
|
@ -737,7 +737,7 @@ may be a value between 0 and 2.
|
||||||
.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
|
.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
|
||||||
.It Pa /tmp/aucat-<uid>/aucat0
|
.It Pa /tmp/aucat-<uid>/aucat0
|
||||||
Default path to
|
Default path to
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
socket to connect to.
|
socket to connect to.
|
||||||
.It Pa /dev/audio
|
.It Pa /dev/audio
|
||||||
Default
|
Default
|
||||||
|
@ -748,7 +748,7 @@ device to use.
|
||||||
.\".Bd -literal -offset indent
|
.\".Bd -literal -offset indent
|
||||||
.\".Ed
|
.\".Ed
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr aucat 1 ,
|
.Xr sndiod 1 ,
|
||||||
.Xr audio 4 ,
|
.Xr audio 4 ,
|
||||||
.Xr sndio 7 ,
|
.Xr sndio 7 ,
|
||||||
.Xr audio 9
|
.Xr audio 9
|
||||||
|
@ -765,7 +765,7 @@ the
|
||||||
function will stop playback immediately.
|
function will stop playback immediately.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
server doesn't implement flow control (for performance reasons).
|
server doesn't implement flow control (for performance reasons).
|
||||||
If the application doesn't consume recorded data fast enough then
|
If the application doesn't consume recorded data fast enough then
|
||||||
.Dq "control messages"
|
.Dq "control messages"
|
||||||
|
|
|
@ -25,7 +25,7 @@ The
|
||||||
.Nm sndio
|
.Nm sndio
|
||||||
audio and MIDI system provides access to audio and MIDI hardware and
|
audio and MIDI system provides access to audio and MIDI hardware and
|
||||||
to services provided by
|
to services provided by
|
||||||
.Xr aucat 1 ,
|
.Xr sndiod 1 ,
|
||||||
summarized below.
|
summarized below.
|
||||||
.Pp
|
.Pp
|
||||||
Hardware
|
Hardware
|
||||||
|
@ -38,7 +38,7 @@ audio programs.
|
||||||
.Pp
|
.Pp
|
||||||
To overcome hardware limitations and to allow multiple applications
|
To overcome hardware limitations and to allow multiple applications
|
||||||
to share the hardware,
|
to share the hardware,
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
can be used.
|
can be used.
|
||||||
It exposes one or more software subdevices backed by the underlying hardware,
|
It exposes one or more software subdevices backed by the underlying hardware,
|
||||||
while doing all necessary conversions on the fly.
|
while doing all necessary conversions on the fly.
|
||||||
|
@ -57,15 +57,15 @@ Software MIDI thru boxes allow one application to send MIDI data to other
|
||||||
applications connected to the thru box (for instance a software sequencer
|
applications connected to the thru box (for instance a software sequencer
|
||||||
can send events to multiple software synthesizers).
|
can send events to multiple software synthesizers).
|
||||||
There's no hardware involved: thru boxes are created by
|
There's no hardware involved: thru boxes are created by
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.Pp
|
.Pp
|
||||||
Additionally,
|
Additionally,
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
exposes a MIDI port used to control and monitor audio streams
|
exposes a MIDI port used to control and monitor audio streams
|
||||||
in real time using MIDI.
|
in real time using MIDI.
|
||||||
.Sh DEVICE NAMES
|
.Sh DEVICE NAMES
|
||||||
From the user's perspective every audio interface, MIDI port, and
|
From the user's perspective every audio interface, MIDI port, and
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
service has a name of the form:
|
service has a name of the form:
|
||||||
.Bd -literal -offset center
|
.Bd -literal -offset center
|
||||||
type[@hostname][,unit]/devnum[.option]
|
type[@hostname][,unit]/devnum[.option]
|
||||||
|
@ -89,31 +89,31 @@ Raw
|
||||||
port.
|
port.
|
||||||
.It Pa snd
|
.It Pa snd
|
||||||
Audio device exposed by
|
Audio device exposed by
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.It Pa midithru
|
.It Pa midithru
|
||||||
MIDI thru box created with
|
MIDI thru box created with
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.El
|
.El
|
||||||
.It Pa hostname
|
.It Pa hostname
|
||||||
The hostname or address where the remote
|
The hostname or address where the remote
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
server to connect to is running.
|
server to connect to is running.
|
||||||
.It Pa unit
|
.It Pa unit
|
||||||
The number of the
|
The number of the
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
server to connect to, corresponding to the integer specified using the
|
server to connect to, corresponding to the integer specified using the
|
||||||
.Fl U
|
.Fl U
|
||||||
option of
|
option of
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
Useful only if multiple
|
Useful only if multiple
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
servers are running on the same system.
|
servers are running on the same system.
|
||||||
.It Pa devnum
|
.It Pa devnum
|
||||||
Device number.
|
Device number.
|
||||||
For hardware audio or MIDI ports, this corresponds to
|
For hardware audio or MIDI ports, this corresponds to
|
||||||
the character device minor number.
|
the character device minor number.
|
||||||
For audio devices or MIDI ports created with
|
For audio devices or MIDI ports created with
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
it corresponds to the number of the corresponding
|
it corresponds to the number of the corresponding
|
||||||
.Fl fM
|
.Fl fM
|
||||||
option on the command line.
|
option on the command line.
|
||||||
|
@ -121,7 +121,7 @@ option on the command line.
|
||||||
Corresponds to the sub-device string registered using the
|
Corresponds to the sub-device string registered using the
|
||||||
.Fl s
|
.Fl s
|
||||||
option of
|
option of
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
For example:
|
For example:
|
||||||
|
@ -133,17 +133,17 @@ First hardware audio device.
|
||||||
Hardware MIDI port number 5.
|
Hardware MIDI port number 5.
|
||||||
.It Pa snd/0
|
.It Pa snd/0
|
||||||
First audio device exposed by
|
First audio device exposed by
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.It Pa snd/0.rear
|
.It Pa snd/0.rear
|
||||||
Sub-device registered with
|
Sub-device registered with
|
||||||
.Fl s Fa rear .
|
.Fl s Fa rear .
|
||||||
.It Pa midithru/0
|
.It Pa midithru/0
|
||||||
First MIDI thru box created with
|
First MIDI thru box created with
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.El
|
.El
|
||||||
.Sh AUTHENTICATION
|
.Sh AUTHENTICATION
|
||||||
If a shared
|
If a shared
|
||||||
.Xr aucat 1
|
.Xr sndiod 1
|
||||||
server is running, for privacy reasons only one user may have
|
server is running, for privacy reasons only one user may have
|
||||||
connections to it at a given time
|
connections to it at a given time
|
||||||
(though the same user could have multiple connections to it).
|
(though the same user could have multiple connections to it).
|
||||||
|
@ -162,7 +162,7 @@ can connect to the server using the same cookie.
|
||||||
.It AUCAT_COOKIE
|
.It AUCAT_COOKIE
|
||||||
Path to file containing the session cookie to be used
|
Path to file containing the session cookie to be used
|
||||||
when connecting to
|
when connecting to
|
||||||
.Xr aucat 1 .
|
.Xr sndiod 1 .
|
||||||
.It Ev AUDIODEVICE
|
.It Ev AUDIODEVICE
|
||||||
Audio device to use if the application provides
|
Audio device to use if the application provides
|
||||||
no device chooser.
|
no device chooser.
|
||||||
|
@ -181,7 +181,7 @@ Audio devices.
|
||||||
MIDI ports.
|
MIDI ports.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr aucat 1 ,
|
.Xr sndiod 1 ,
|
||||||
.Xr mio_open 3 ,
|
.Xr mio_open 3 ,
|
||||||
.Xr sio_open 3 ,
|
.Xr sio_open 3 ,
|
||||||
.Xr audio 4 ,
|
.Xr audio 4 ,
|
||||||
|
|
Loading…
Reference in New Issue