OpenBSD CVS

CVS log for src/usr.bin/aucat/Attic/file.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.32, Wed Jan 21 08:43:55 2015 UTC (9 years, 3 months ago) by ratchov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.31: +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.31 / (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.30: +6 -1 lines
Diff to previous 1.30 (colored)

add missing prototypes

Revision 1.30 / (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.29: +12 -12 lines
Diff to previous 1.29 (colored)

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

Revision 1.29 / (download) - annotate - [select for diffs], Thu Mar 29 20:08:22 2012 UTC (12 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (colored)

Don't spin if accept() fails because it is out of file descriptors,
instead set a flag that skips the listening socket from the poll()
event loop. The flag is cleared whenever a file descriptor is closed
allowing accept() to be retried.
Explained by deraadt@

Revision 1.28 / (download) - annotate - [select for diffs], Wed Oct 12 07:20:04 2011 UTC (12 years, 7 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.27: +5 -6 lines
Diff to previous 1.27 (colored)

Simplify and improve the way options are parsed and remove ~300 lines
of code that becomes unused. Few command line arguments changes are
required though:

  - stream definitions (-ios) now must follow devices definitions they
    are attached to (-fMn)

  - the -n option is now a special "loopback" device and is thus used
    like -f, eg it must precede streams

  - in midicat, midi thru boxes are not created automatically anymore,
    the new "-M" option must be used for that

  - channel numbers (-Cc options) correspond always to channel numbers
    of the hardware.

  - the -u option isn't needed anymore

  - increase the log verbosity so user errors are logged
    without using -d

tested by many, help from jmc

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jun 27 07:22:00 2011 UTC (12 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.26: +27 -8 lines
Diff to previous 1.26 (colored)

Display the CPU usage when -ddddd is used, ie the time spent on
calculations compared to the time spend on sleeping in poll().

Revision 1.26 / (download) - annotate - [select for diffs], Thu Jun 2 19:03:58 2011 UTC (12 years, 11 months ago) by ratchov
Branch: MAIN
Changes since 1.25: +22 -16 lines
Diff to previous 1.25 (colored)

If there are no descriptors to poll, just sleep until SIGALRM
is posted and then update all timers and restart the event loop.
Fixes throtteling while midi inputs are drained.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Jun 2 16:58:02 2011 UTC (12 years, 11 months ago) by ratchov
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

don't exit from the main loop if there are pending time outs.
Fixes midi inputs not being properly drained when they are
temporarily blocked to limit input data rate

Revision 1.24 / (download) - annotate - [select for diffs], Tue Mar 15 10:31:31 2011 UTC (13 years, 2 months ago) by okan
Branch: MAIN
Changes since 1.23: +3 -5 lines
Diff to previous 1.23 (colored)

use timerclear macro

ok ratchov@

Revision 1.23 / (download) - annotate - [select for diffs], Fri Nov 5 16:09:50 2010 UTC (13 years, 6 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.22: +3 -1 lines
Diff to previous 1.22 (colored)

unbreak compilation without DEBUG defined

Revision 1.22 / (download) - annotate - [select for diffs], Fri Aug 20 06:56:54 2010 UTC (13 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.21: +4 -2 lines
Diff to previous 1.21 (colored)

polish the code: remove few unused #includes, add missing ones,
fix NULL vs 0, etc. No behaviour change.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Jul 10 12:32:45 2010 UTC (13 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

When a file is created, initialize its ``busy cycles'' counter to zero.

Revision 1.20 / (download) - annotate - [select for diffs], Tue Jul 6 20:06:35 2010 UTC (13 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.19: +15 -1 lines
Diff to previous 1.19 (colored)

Try to detect busy loops caused by misbehaving audio drivers
or hardware. If a busy loop is found, then close the device that
caused the loop.

Revision 1.19 / (download) - annotate - [select for diffs], Sun May 2 10:43:30 2010 UTC (14 years ago) by ratchov
Branch: MAIN
Changes since 1.18: +80 -45 lines
Diff to previous 1.18 (colored)

use clock_gettime() and interval timers instead of gettimeofday()
and poll()'s timeout. Simpler and more accurate, from midish

Revision 1.18 / (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.17: +3 -20 lines
Diff to previous 1.17 (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.17 / (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.16: +19 -2 lines
Diff to previous 1.16 (colored)

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

Revision 1.16 / (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.15: +3 -20 lines
Diff to previous 1.15 (colored)

doc fixes from jmc

Revision 1.15 / (download) - annotate - [select for diffs], Sun Jan 10 21:47:41 2010 UTC (14 years, 4 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.14: +263 -1 lines
Diff to previous 1.14 (colored)

Add traces to help tracking subtle timing bugs often causing
underuns and overruns; such bugs are hard to debug with ktrace
or a debugger. They are also handy to debug or monitor code
using aucat.

To enable traces, compile aucat with ``make DEBUG=-DDEBUG'' and
use the -d option multiple times.

ok jakemsr

Revision 1.14 / (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.13: +15 -80 lines
Diff to previous 1.13 (colored)

remove all debug traces

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

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

Revision 1.12 / (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.11: +205 -41 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Wed Feb 4 20:35:14 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.10: +5 -4 lines
Diff to previous 1.10 (colored)

if there are too many connections, stop acceping new ones rather
than exit()ing with ``too many open files'' fatal error

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jan 23 17:38:15 2009 UTC (15 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

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

Revision 1.9 / (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.8: +31 -5 lines
Diff to previous 1.8 (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.8 / (download) - annotate - [select for diffs], Sat Dec 27 14:23:40 2008 UTC (15 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.7: +6 -3 lines
Diff to previous 1.7 (colored)

complain about a deadlock only if there are descriptors waiting
for i/o and none of them is polled. This avoids false positives
caused by listening sockets in server mode.

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

trigger rproc->eof() and and wproc->hup() if POLLHUP event is set.
Fixes aucat sleeping forever when the devices disappears

Revision 1.6 / (download) - annotate - [select for diffs], Sun Nov 16 17:08:32 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.5: +3 -1 lines
Diff to previous 1.5 (colored)

make aucat compile without DEBUG defined (still defined by default)

Revision 1.5 / (download) - annotate - [select for diffs], Sun Nov 16 17:01:58 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.4: +12 -2 lines
Diff to previous 1.4 (colored)

in file_poll() the number of polled file structures is not equal to the
number of polled descriptors. Count the number of polled structrues to
detect deadlocks rather than the number of descriptors, avoinding false
positives.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Oct 26 08:49:44 2008 UTC (15 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.3: +130 -162 lines
Diff to previous 1.3 (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.3 / (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.2: +30 -4 lines
Diff to previous 1.2 (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.2 / (download) - annotate - [select for diffs], Thu Aug 14 09:48:50 2008 UTC (15 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.1: +12 -5 lines
Diff to previous 1.1 (colored)

in file.c, before dereferencing pointers to in(), out(), eof(),
hup() routines of the aproc strucure check that the aproc
structure has not desappeared. This never happens currently, but
will be allowed later. No behaviour change.

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
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4

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.