sndio/libsndio/sndio.7

227 lines
6.1 KiB
Groff
Raw Normal View History

.\" $OpenBSD$
2010-08-19 15:38:45 -05:00
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
2010-08-19 15:38:45 -05:00
.Dt SNDIO 7
.Os
.Sh NAME
.Nm sndio
.Nd interface to audio and MIDI
.Sh DESCRIPTION
The
.Nm sndio
audio and MIDI system provides access to audio and MIDI hardware and
to services provided by
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 ,
2010-08-19 15:38:45 -05:00
summarized below.
.Pp
Hardware
.Xr audio 4
devices correspond to peripherals.
Only one application may use any device at a given time.
Generally a limited number of encodings, sample rates and channel numbers are
supported by the hardware, which may not meet the requirements of
audio programs.
.Pp
To overcome hardware limitations and to allow multiple applications
to share the hardware,
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
2010-08-19 15:38:45 -05:00
can be used.
2013-01-06 12:14:55 -06:00
It exposes one or more software sub-devices backed by the underlying hardware,
2010-08-19 15:38:45 -05:00
while doing all necessary conversions on the fly.
It can mix multiple streams or split the hardware into
2013-01-06 12:14:55 -06:00
multiple sub-devices, to allow programs to use the hardware
concurrently.
2010-08-19 15:38:45 -05:00
.Pp
Hardware MIDI ports correspond to serial connectors provided by the
.Xr midi 4
driver.
They are typically used to access MIDI hardware (synthesizers, keyboards,
control surfaces, etc.), but they do not allow applications to exchange
information using the MIDI protocol.
.Pp
Software MIDI thru boxes allow one application to send MIDI data to other
applications connected to the thru box (for instance a software sequencer
can send events to multiple software synthesizers).
There's no hardware involved: thru boxes are created by
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2010-08-19 15:38:45 -05:00
.Pp
Additionally,
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
2011-10-17 17:29:58 -05:00
exposes a MIDI port used to control and monitor audio streams
2010-08-19 15:38:45 -05:00
in real time using MIDI.
.Sh DEVICE NAMES
2011-11-01 12:01:52 -05:00
From the user's perspective every audio interface, MIDI port, and
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
2010-08-19 15:38:45 -05:00
service has a name of the form:
.Bd -literal -offset center
type[@hostname][,unit]/devnum[.option]
2010-08-19 15:38:45 -05:00
.Ed
.Pp
This information is used by audio and MIDI applications to determine
2011-10-17 17:29:58 -05:00
how to access the audio device or MIDI port.
.Bl -tag -width "hostname"
2018-01-10 09:45:02 -06:00
.It Ar type
2011-10-17 17:29:58 -05:00
The type of the audio device or MIDI port.
Possible values are:
.Pp
.Bl -tag -width "midithru" -offset 3n -compact
2018-01-10 09:45:02 -06:00
.It Cm rsnd
Raw
2010-08-19 15:38:45 -05:00
.Xr audio 4
device.
2018-01-10 09:45:02 -06:00
.It Cm rmidi
Raw
2011-10-17 17:29:58 -05:00
.Xr midi 4
port.
2018-01-10 09:45:02 -06:00
.It Cm snd
Audio device exposed by
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2018-01-10 09:45:02 -06:00
.It Cm midithru
MIDI thru box created with
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2018-01-10 09:45:02 -06:00
.It Cm midi
2012-11-06 13:52:40 -06:00
MIDI port exposed by
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2018-01-10 09:45:02 -06:00
.It Cm default
Default audio device or MIDI port (see below).
.El
2018-01-10 09:45:02 -06:00
.It Ar hostname
The hostname or address where the remote
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
2011-04-18 08:17:04 -05:00
server to connect to is running.
2018-01-10 09:45:02 -06:00
.It Ar unit
The number of the
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
2011-11-09 02:35:18 -06:00
server to connect to, corresponding to the integer specified using the
.Fl U
option of
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
Useful only if multiple
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
servers are running on the same system.
2018-01-10 09:45:02 -06:00
.It Ar devnum
Device number.
2011-10-17 17:29:58 -05:00
For hardware audio or MIDI ports, this corresponds to
2010-08-19 15:38:45 -05:00
the character device minor number.
2011-10-17 17:29:58 -05:00
For audio devices or MIDI ports created with
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
it corresponds to the number of the corresponding
.Fl fq
option on the command line.
2018-01-10 09:45:02 -06:00
.It Ar option
Corresponds to the sub-device string registered using the
2010-08-19 15:38:45 -05:00
.Fl s
option of
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2010-08-19 15:38:45 -05:00
.El
.Pp
For example:
.Pp
.Bl -tag -width "snd/0.rear" -offset 3n -compact
2018-01-10 09:45:02 -06:00
.It Li rsnd/0
2010-08-19 15:38:45 -05:00
First hardware audio device.
2018-01-10 09:45:02 -06:00
.It Li rmidi/5
2010-08-19 15:38:45 -05:00
Hardware MIDI port number 5.
2018-01-10 09:45:02 -06:00
.It Li snd/0
First audio device exposed by
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2018-01-10 09:45:02 -06:00
.It Li snd/0.rear
Sub-device registered with
.Fl s Fa rear .
2018-01-10 09:45:02 -06:00
.It Li midithru/0
First MIDI thru box created with
2016-01-07 10:48:47 -06:00
.Xr sndiod 8 .
2010-08-19 15:38:45 -05:00
.El
.Sh DEFAULTS
If
2018-01-10 09:45:02 -06:00
.Cm default
is used as the audio device, the program will use the
one specified in the
.Ev AUDIODEVICE
environment variable.
If it is not set, the program first tries to connect to
2018-01-10 09:45:02 -06:00
.Li snd/0 .
If that fails, it then tries to use
2018-01-10 09:45:02 -06:00
.Li rsnd/0 .
This allows the
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
audio server to be used by default and the bare hardware as fallback;
programs don't have to be reconfigured when
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
is started or stopped.
.Pp
If
2018-01-10 09:45:02 -06:00
.Cm default
is used as the MIDI port, the program will use the
one specified in the
.Ev MIDIDEVICE
environment variable.
If it is not set, the program first tries to connect to
2018-01-10 09:45:02 -06:00
.Li midithru/0 .
If that fails, it then tries to use
2018-01-10 09:45:02 -06:00
.Li rmidi/0 .
As long as
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
is running, this allows programs to exchange MIDI data on
machines with no MIDI hardware by default, e.g. a MIDI player
could use a software synthesizer with no manual configuration
required.
2011-04-16 11:30:24 -05:00
.Sh AUTHENTICATION
If a shared
2016-01-07 10:48:47 -06:00
.Xr sndiod 8
2011-04-16 11:30:24 -05:00
server is running, for privacy reasons only one user may have
connections to it at a given time
(though the same user could have multiple connections to it).
Users are identified by their
.Em session cookie ,
which is automatically generated by audio or MIDI applications
upon the first connection to the server.
The cookie is stored in
.Pa "$HOME/.sndio/cookie"
2011-04-18 08:50:25 -05:00
and contains 128 bits of raw random data.
2011-04-16 11:30:24 -05:00
.Pp
If a session needs to be shared between multiple users, they
can connect to the server using the same cookie.
2010-08-19 15:38:45 -05:00
.Sh ENVIRONMENT
.Bl -tag -width "AUDIODEVICEXXX" -compact
.It Ev AUDIODEVICE
2018-01-10 09:45:02 -06:00
Audio device that
.Xr sio_open 3
uses if the application provides no device chooser.
2010-08-19 15:38:45 -05:00
.It Ev MIDIDEVICE
2018-01-10 09:45:02 -06:00
MIDI port that
.Xr mio_open 3
uses if the application provides no MIDI port chooser.
2010-08-19 15:38:45 -05:00
.El
.Pp
2018-01-10 09:45:02 -06:00
These environment variables are ignored by
.Nm
if the program has the set-user-ID or set-group-ID bits set.
2010-08-19 15:38:45 -05:00
.Sh FILES
.Bl -tag -width "/dev/audioNXXX" -compact
2010-08-19 15:38:45 -05:00
.It Pa /dev/audioN
Audio devices.
.It Pa /dev/rmidiN
MIDI ports.
.El
.Sh SEE ALSO
.Xr mio_open 3 ,
.Xr sio_open 3 ,
.Xr audio 4 ,
2016-01-07 10:48:47 -06:00
.Xr midi 4 ,
.Xr sndiod 8