OpenBSD CVS

CVS log for src/usr.bin/aucat/Attic/aproc.h


[BACK] Up to [local] / src / usr.bin / aucat

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.46, Wed Jan 21 08:43:55 2015 UTC (9 years, 3 months ago) by ratchov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.45: +1 -1 lines
FILE REMOVED

Simplify internals and rewrite file header parsing code:
- remove -M, -t, -w, -C, -x flags that don't make sense anymore
- make "-j off" the default (sndiod already does the job)
- don't limit the number of played/recorded files.
- add support for floating-point encoded files.
- add support for apple .aiff and sun/next .au files

Revision 1.45 / (download) - annotate - [select for diffs], Mon Nov 18 17:37:45 2013 UTC (10 years, 6 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.44: +2 -1 lines
Diff to previous 1.44 (colored)

add missing prototypes

Revision 1.44 / (download) - annotate - [select for diffs], Wed Apr 11 06:05:43 2012 UTC (12 years, 1 month ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.43: +31 -31 lines
Diff to previous 1.43 (colored)

Use "unsigned int" rather than "unsigned". No object change.
suggested by deraadt@

Revision 1.43 / (download) - annotate - [select for diffs], Fri Mar 23 11:59:54 2012 UTC (12 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.42: +3 -2 lines
Diff to previous 1.42 (colored)

add a MIDI-controlled master volume knob to adjust the mix of
all playback stream, discussed with armani@

Revision 1.42 / (download) - annotate - [select for diffs], Fri Dec 2 10:34:50 2011 UTC (12 years, 5 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.41: +3 -5 lines
Diff to previous 1.41 (colored)

reuse midi-control code to implement midi thru boxes and remove
the old midithru implementation; less code, less bugs. As a side
effect, midi output doesn't implement running status "compression"
any more.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Nov 20 22:54:51 2011 UTC (12 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.40: +1 -27 lines
Diff to previous 1.40 (colored)

Move mmc/mtc and volume control bits from struct aproc to struct
dev. Allows volume settings to be saved while the device is kept
closed. Besides that, no behabiour changes.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Nov 15 20:41:54 2011 UTC (12 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.39: +1 -2 lines
Diff to previous 1.39 (colored)

make midi 'owner' pointer per-output

Revision 1.39 / (download) - annotate - [select for diffs], Thu May 26 07:18:40 2011 UTC (12 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.38: +3 -2 lines
Diff to previous 1.38 (colored)

add a new -w flag to control whether master volume is automatically
adjusted when new streams are connected and disconnected. Disabling
automatic volume adjustment makes sense if all streams are recorded
with properly lowered volumes.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Nov 4 17:55:28 2010 UTC (13 years, 6 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Replace ``short'' by a new ``adata_t'' typedef corresponding to
audio samples and cleanup ADATA_XXX macros. This allows easilly
switching to 24 bit fixed point arithmetic by simply redefining
the adata_t typedef to int and updating ADATA_XXX macros. No
object change.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jun 4 06:15:28 2010 UTC (13 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.36: +3 -1 lines
Diff to previous 1.36 (colored)

Allow the audio device to be opened only while it's actually used.
This is necessary for uaudio devices, for instance to start aucat
before the device is plugged. Or to unplug a device whithout
having to restart aucat when another device is plugged.  This is
controlled with the new -a option.

Allow multiple audio devices to be used concurently, i.e.
multiple ``-f devname'' options to be used; -f options must follow
per-device options, which is what we do for other options.

Revision 1.36 / (download) - annotate - [select for diffs], Sun May 2 11:12:31 2010 UTC (14 years ago) by ratchov
Branch: MAIN
Changes since 1.35: +4 -3 lines
Diff to previous 1.35 (colored)

Don't systematically fill with silence the mixer output. This
might result in extra samples being written to the device
when the mixer is closed.

Revision 1.35 / (download) - annotate - [select for diffs], Sat Apr 24 06:18:23 2010 UTC (14 years ago) by ratchov
Branch: MAIN
Changes since 1.34: +3 -3 lines
Diff to previous 1.34 (colored)

rename ibuflist/obuflist -> ins/outs to cut long lines
from Thomas Pfaff, thanks

Revision 1.34 / (download) - annotate - [select for diffs], Wed Apr 21 06:13:07 2010 UTC (14 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

adds the necessary bits to join channels (ex stereo->mono) or
expand channels (ex mono->stereo).  It's switched on/off with
the ``-j'' option, (default is "on").

Revision 1.33 / (download) - annotate - [select for diffs], Sat Apr 17 09:16:57 2010 UTC (14 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.32: +1 -5 lines
Diff to previous 1.32 (colored)

Allow the mixer to handle inputs with channel ranges outside
the device channel range. This makes the channel mapping code
no longer usefuli, so remove it. No behaviour change.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Apr 6 20:07:01 2010 UTC (14 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.31: +52 -5 lines
Diff to previous 1.31 (colored)

aucat (server):

  - make the ``-m mode'' option per subdevice, allowing
    subdevices to be play-only or rec-only even if the
    server is full-duplex

  - add ``monitoring'' mode (with ``-m mon''). This is a
    record-only stream from which played streams can be
    recorded (kind of ``record what you hear'').

  - allow MIDI devices to be subscribed to the controlling
    MIDI port of the server, ie what midicat does (with -f
    option), but using the -q option.

  - add flow control to the protocol, and serialize clock
    ticks (sio_onmove() calls) and data chunks.  This should
    fix certain full-duplex programs, broken with ``magic''
    block/buffer size combinations.

  - enable 3 block latency which is the minimum theoretical.
    Make -z and -b options correspond to device parameters.

  - make sio_getcap(3) the same for aucat and sun backends,
    ie return whatever is supported (``everything'' in the
    aucat case, since everything is actulally supported).

aucat (player):

  - enable ``-m mode'' option  to select between monitoring
    and recording when ``-o file'' is used.

  - plug MIDI code to non-server codepath. The MIDI control
    device is specified with the ``-q device'' option, as in
    server mode.

  - impliment lseek()'ing within files (controlled
    through MIDI). Necessary to use aucat with a MIDI
    sequencer.

midicat (thrubox):

  - rename ``-f'' flag to ``-q'', so it has the
    same name as in aucat (-f is still working)

ok jakemsr@, tweaks from jmc@

Revision 1.31 / (download) - annotate - [select for diffs], Sat Apr 3 17:59:17 2010 UTC (14 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.30: +4 -51 lines
Diff to previous 1.30 (colored)

backout last change, committed by mistake, sorry...

Revision 1.30 / (download) - annotate - [select for diffs], Sat Apr 3 17:40:33 2010 UTC (14 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.29: +52 -5 lines
Diff to previous 1.29 (colored)

doc fixes from jmc

Revision 1.29 / (download) - annotate - [select for diffs], Mon Jan 11 13:06:32 2010 UTC (14 years, 4 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

When resuming from suspend, prime play buffers with silence,
otherwise the client would underrun by more than its own buffer
size, which currently is not allowed (causes the client to
deadlock).

Set the minimum client buffer size to two blocks. Single block
buffers don't work properly yet.

with help from jakemsr

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jan 5 10:18:12 2010 UTC (14 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.27: +3 -15 lines
Diff to previous 1.27 (colored)

Make the way .wav files are handled closer to the way sockets are
handled, which is conceptually simpler. No behaviour changes.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Nov 3 21:31:37 2009 UTC (14 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.26: +30 -14 lines
Diff to previous 1.26 (colored)

Allow any program using aucat to act as MMC slave and MTC master
transparently.  Multiple audio applications can be started
synchronously from external software/hardware supporting the
standard Start/Stop/Relocate messages. The server clock is exposed
through MTC, allowing non-audio software/hardware to be
synchronized to audio applications.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Oct 27 22:41:03 2009 UTC (14 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.25: +4 -2 lines
Diff to previous 1.25 (colored)

slightly cleanup the socket and control bits:
- reject bogus clients ignoring flow control during the start phase
- don't check if dev_midi is NULL, it can't be NULL anymore
- use ``struct ctl_ops'' instead of a simple call-backs
- don't try to flush play buffer if it's not attached yet

Revision 1.25 / (download) - annotate - [select for diffs], Sat Oct 10 12:43:09 2009 UTC (14 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.24: +3 -1 lines
Diff to previous 1.24 (colored)

make dev_done() common to audio and MIDI, and drop dev_thrudone()

Revision 1.24 / (download) - annotate - [select for diffs], Tue Oct 6 18:06:55 2009 UTC (14 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.23: +2 -1 lines
Diff to previous 1.23 (colored)

prevent aproc structures to be deleted twice. Doesn't change anything
for now but will be used in future code.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Sep 27 11:51:20 2009 UTC (14 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored)

remove all debug traces

Revision 1.22 / (download) - annotate - [select for diffs], Thu Aug 27 06:31:13 2009 UTC (14 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (colored)

when an audio program connects to aucat, restore the volume it
had the last time. For instance, this fixes the problem of programs
reopenning the connection to aucat very often and thus resetting
the volume setting all the time.

Revision 1.21 / (download) - annotate - [select for diffs], Wed Aug 26 08:28:21 2009 UTC (14 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.20: +3 -1 lines
Diff to previous 1.20 (colored)

when allocating the midi channel for the volume control of a new
client, pick the oldest unused channel rather than the first found.
This way new clients don't reuse channels of recently used applications,
thus improving a lot the client<->channel affinity.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Aug 26 06:10:15 2009 UTC (14 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.19: +3 -2 lines
Diff to previous 1.19 (colored)

don't mess with audio internals from within the midi bits. Instead
use a call-back interface. This allows easily sending volume changes
feedback to audio applications.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Aug 21 16:48:03 2009 UTC (14 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.18: +10 -1 lines
Diff to previous 1.18 (colored)

make aucat(1) expose a MIDI device to control server behaviour in
realtime.  For now only the playback volume of individual streams can be
changed/monitored. To each stream is assigned a MIDI channel; the volume
is changed/monitored using the standard controller number 7.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Jul 25 10:52:18 2009 UTC (14 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.17: +5 -5 lines
Diff to previous 1.17 (colored)

fix comments, remove no longer needed declaration, reorder includes
from Thomas Pfaff

Revision 1.17 / (download) - annotate - [select for diffs], Sat Jul 25 08:44:27 2009 UTC (14 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.16: +7 -1 lines
Diff to previous 1.16 (colored)

Currently midi capable programs can control midi hardware, but
cannot cooperate with other programs.  The aim of this change is
to allow any program to send midi data to other programs as they
were midi hardware. For instance, this change should solve the
longstanding problem of using a midi sequencer with software
synthesizers. More precisely:

 - new midicat(1) utility (actually hardlink to aucat(1)).
   it creates software midi thru boxes, allowing programs
   to send midi messages to other programs as they were
   midi(4) hardware.

 - new midi api in libsndio (see mio_open(3)), to access
   midi(4) devices and midicat(1) sockets in a uniform way.

 - new device naming scheme <service>:<unit>[.<option>],
   common to audio and midi.

 - new sndio(7) manual describing concepts and naming

The current audio device naming still works, but people having
scripts or configuration files containing device names could read
the sndio(7) man page and slowly start updating device names.

discussed with jakemsr@ and deraadt@, help form jmc@

Revision 1.16 / (download) - annotate - [select for diffs], Fri Jan 23 17:38:15 2009 UTC (15 years, 3 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

spacing + typo fix from Matt Jibson <matt.jibson(at)gmail.com>

Revision 1.15 / (download) - annotate - [select for diffs], Mon Dec 29 17:59:08 2008 UTC (15 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)

make the code "more correct": add reference counters to aproc
structures so we can keep a pointer to the device. Beside some
simplifications, this allows to easily handle the situation
where the audio device desappears. No change in the behaviour.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Dec 19 08:01:06 2008 UTC (15 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.13: +5 -3 lines
Diff to previous 1.13 (colored)

use simple linear interpolation in the resampling code.
This partially removes the ``metallic'' noise audible
especially when upsampling 8k -> 44.1k.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Dec 7 17:10:41 2008 UTC (15 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

When resampling, don't require the sample frequency to be an integer.
This removes the arithmetic constraint between the sample frequency
and the block size and all the associated code. Now aucat can work
in server mode with any block size.
ok jakemsr

Revision 1.12 / (download) - annotate - [select for diffs], Sun Nov 9 16:26:07 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.11: +5 -1 lines
Diff to previous 1.11 (colored)

make aucat(1) stop automatically the audio(1) device if it's idle. This
way, when in server mode, it consumes no CPU if there are no clients.
Later, this will allow to start aucat(1) at session or system startup.

Revision 1.11 / (download) - annotate - [select for diffs], Tue Nov 4 22:18:12 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.10: +12 -19 lines
Diff to previous 1.10 (colored)

split code that converts any->any in two parts: one to encode
native->any and one to decode any->native. It is simpler and
faster this way.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Nov 4 18:24:06 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.9: +1 -5 lines
Diff to previous 1.9 (colored)

cleanup: remove channel mapping bits from encoding conversion code.
As a side effect, reduce CPU usage by ~10% on envy(4) devices.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Nov 4 17:51:46 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.8: +5 -1 lines
Diff to previous 1.8 (colored)

add "new" conversion code to map any channel range into any other
channel range (based on the encoding conversion code). Will allow to
unentangle channel mapping from encoding conversion. As a side effect,
greatly reduces CPU usage for channel mapping. No functionnal change.

Revision 1.8 / (download) - annotate - [select for diffs], Tue Nov 4 15:22:40 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.7: +1 -4 lines
Diff to previous 1.7 (colored)

cleanup: resample stream while in native format and remove resampling
bits from the encoding conversion code. As a side effect this reduces
CPU usage by 30% on envy(4).

Revision 1.7 / (download) - annotate - [select for diffs], Tue Nov 4 14:16:09 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.6: +8 -1 lines
Diff to previous 1.6 (colored)

optimization: add "new" resampling code (actually based on the existing
conversion bits) and use it when resampling only is required (ie for
clients using s16 encoding), this is the most common case. Reduces CPU
usage by ~50%. No functional change.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Oct 26 08:49:43 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.5: +23 -6 lines
Diff to previous 1.5 (colored)

add minimal server capability to aucat(1). When started in server
mode, it listens on an unix socket and mixes/demultiplexes any number
of full-duplex streams, doing necessary format conversions and
resampling on the fly.

programs can use the new libsa(3) library to play and record audio.
The library provides a very simple API to connect to the audio server;
if aucat(1) isn't running, it uses the audio(4) driver transparently
instead.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Aug 14 09:58:55 2008 UTC (15 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.4: +4 -1 lines
Diff to previous 1.4 (colored)

move all device related stuff from aucat.c to a new dev.c file.
The new dev_xxx() routines expose a "high level" self-contained
interface to the device. At initialization, the device is opened
and two chains of aproc structures are created:

 * a playback chain that exposes a (initially) empty mix
   aproc to which the rest of the code can attach new
   streams to be played

 * record chain that exposes a (initially) empty sub aproc
   to which the rest of the code can attach new stream to
   to record

The rest of the code, has just to use dev_attach() routine to
attach streams. While we're at it, add a ``devops'' structure
containing pointers to the device-specific routines. This will
allow later to add support for other type of device than the
Sun API.

Also, write the .wav headers in file_del(), so put all header
related data in the file strucuture. This allows to close() the
file, as soon as wpipe_xxx() aproc terminates. This will be
useful for the server, because it will need to close() descripts
of closed connections immediately.

add mix_pushzero() routine to fill the mixer with silence. It
will be used to avoid the mixer to underrun when there are no
input streams. Since we always have at least one input stream
there's no behaviour change.

ok jakemsr

Revision 1.4 / (download) - annotate - [select for diffs], Thu Aug 14 09:47:51 2008 UTC (15 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.3: +5 -3 lines
Diff to previous 1.3 (colored)

add an "AUTOQUIT" flag to mix and sub aprocs. If the flag is
set, the mix aproc will exit once there are no more input
streams, similarly the sub aproc will exit once there are no
more ouput streams. If the flag is not set, the mix aproc will
generate silence, and the sub aproc will drop samples. By
default this flag is set, so no behaviour change.

ok jakemsr

Revision 1.3 / (download) - annotate - [select for diffs], Thu Aug 14 09:45:23 2008 UTC (15 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.2: +20 -1 lines
Diff to previous 1.2 (colored)

add a xxx_done() method to aproc structures, that cleans up just
before free()ing the aproc structure, this is cleaner and will
allow to reuse wpipe_xxx() and rpipe_xxx() when defining new
aprocs. No behaviour change.

ok jakemsr

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jun 2 17:06:36 2008 UTC (15 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.1: +9 -1 lines
Diff to previous 1.1 (colored)

allow the user to choose the aucat behaviour when underruns/overruns
occur on a per-stream basis, using -Xx flags.  There are 3 possible
policies:

 - ignore : ignores underruns/overruns, for instance, this mode
   could be used for creating simple pipes with utilities; like in
   your last cdio diff.

 - sync : insert/discard samples in order to keep all streams in
   sync, useful for multi-tracker-like apps and/or to sync
   midi/video/whatever on audio streams (this was the previous
   behaviour)

 - error : if overruns/underruns occur, consider it as fatal error
   and kill the corresponding stream (without disturbing others).
   Useful, for reliable recordings (and/or debugging aucat
   itself:).

ok jakemsr

Revision 1.1 / (download) - annotate - [select for diffs], Fri May 23 07:15:46 2008 UTC (16 years ago) by ratchov
Branch: MAIN

add support for:
 - recording, full-duplex operation
 - format conversions and resampling on the fly
 - mixing on the fly of multiple inputs of different formats
 - up to 16 channels, simplistic "routing" of channel ranges
 - more linear encodings (in raw and wav files)
the old behaviour is fully preserved if none of the new -i and -o
options are used.

code and fixes from jakemsr@ and eric@, suggestions by others.
ok "go ahead" deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.