Browse Source

Merge pull request #43 from devnexen/master

OpenBSD compilable :
tags/0.125.0
Paul Davis GitHub 8 years ago
parent
commit
7695d4e287
11 changed files with 1167 additions and 9 deletions
  1. +24
    -2
      configure.ac
  2. +8
    -2
      drivers/Makefile.am
  3. +4
    -1
      drivers/dummy/dummy_driver.c
  4. +13
    -0
      drivers/sndio/Makefile.am
  5. +997
    -0
      drivers/sndio/sndio_driver.c
  6. +74
    -0
      drivers/sndio/sndio_driver.h
  7. +4
    -0
      jackd/Makefile.am
  8. +1
    -1
      jackd/controlapi.c
  9. +1
    -1
      jackd/engine.c
  10. +40
    -1
      jackd/jackd.1.in
  11. +1
    -1
      jackd/jackd.c

+ 24
- 2
configure.ac View File

@@ -165,15 +165,18 @@ CFLAGS="$ORIGINAL_CFLAGS"
AC_MSG_CHECKING([platform dependencies])

HOST_DEFAULT_TMP_DIR=/dev/shm
USE_MD5SUM=1
case "${host_os}" in
freebsd*)
# current FreeBSD header files conflict with the OSS driver's
# barrier code, this may be fixed in 5.3, stay tuned.
USE_BARRIER="no"
USE_MD5SUM=0
;;
openbsd*)
# pthread_barrier* not implemented
USE_BARRIER="no"
USE_MD5SUM=0
# need small realtime stack
JACK_THREAD_STACK_TOUCH=10000
;;
@@ -189,6 +192,9 @@ case "${host_os}" in
esac

AC_SUBST(OS_LDFLAGS)
AC_SUBST(USE_MD5SUM)
AC_DEFINE_UNQUOTED(USE_MD5SUM,"$USE_MD5SUM",[Using md5sum command line if available])
AM_CONDITIONAL(USE_MD5SUM, $USE_MD5SUM)

#
# We need to establish suitable defaults for a 64-bit OS
@@ -228,7 +234,7 @@ if test "x$JACK_USE_MACH_THREADS" != "x"; then
fi

# headers
AC_CHECK_HEADERS(string.h strings.h alloca.h db.h, [],
AC_CHECK_HEADERS(string.h strings.h db.h, [],
AC_MSG_ERROR([*** a required header file is missing]))

AC_CHECK_HEADERS(getopt.h, [], [
@@ -797,7 +803,7 @@ AC_SUBST(NETJACK_CFLAGS)

# Check which backend drivers can be built. The last one successfully
# configured becomes the default JACK driver; so the order of
# precedence is: alsa, sun, oss, coreaudio, portaudio, dummy.
# precedence is: alsa, sun, oss, coreaudio, portaudio, sndio, dummy.

JACK_DEFAULT_DRIVER=\"dummy\"

@@ -857,6 +863,20 @@ then
fi
AM_CONDITIONAL(HAVE_SUN, $HAVE_SUN)

AC_ARG_ENABLE(sndio, AC_HELP_STRING([--disable-sndio],[ignore sndio driver ]),
TRY_SNDIO=$enableval , TRY_SNDIO=yes )
HAVE_SNDIO="false"
if test "x$TRY_SNDIO" = "xyes"
then
# check for sndio audio API
AC_CHECK_HEADER([sndio.h],
[HAVE_SNDIO="true"
JACK_DEFAULT_DRIVER=\"sndio\"])
SNDIO_LIBS="-lsndio"
AC_SUBST([SNDIO_LIBS])
fi
AM_CONDITIONAL(HAVE_SNDIO, $HAVE_SNDIO)

AC_ARG_ENABLE(freebob, AC_HELP_STRING([--disable-freebob],[ignore FreeBob driver ]),
TRY_FREEBOB=$enableval , TRY_FREEBOB=yes )
HAVE_FREEBOB="false"
@@ -989,6 +1009,7 @@ drivers/alsa_midi/Makefile
drivers/dummy/Makefile
drivers/oss/Makefile
drivers/sun/Makefile
drivers/sndio/Makefile
drivers/portaudio/Makefile
drivers/coreaudio/Makefile
drivers/freebob/Makefile
@@ -1020,6 +1041,7 @@ echo \| Build with old FireWire \(FreeBob\) support............. : $HAVE_FREEBOB
echo \| Build with new FireWire \(FFADO\) support............... : $HAVE_FIREWIRE
echo \| Build with OSS support................................ : $HAVE_OSS
echo \| Build with Sun audio support.......................... : $HAVE_SUN
echo \| Build with Sndio audio support........................ : $HAVE_SNDIO
echo \| Build with CoreAudio support.......................... : $HAVE_COREAUDIO
echo \| Build with PortAudio support.......................... : $HAVE_PA
echo \| Build with Celt support............................... : $HAVE_CELT


+ 8
- 2
drivers/Makefile.am View File

@@ -48,5 +48,11 @@ else
FIREWIRE_DIR =
endif

SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR) netjack
DIST_SUBDIRS = alsa alsa_midi dummy oss sun portaudio coreaudio freebob firewire netjack
if HAVE_SNDIO
SNDIO_DIR = sndio
else
SNDIO_DIR =
endif

SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR) ${SNDIO_DIR} netjack
DIST_SUBDIRS = alsa alsa_midi dummy oss sun portaudio coreaudio freebob firewire netjack sndio

+ 4
- 1
drivers/dummy/dummy_driver.c View File

@@ -111,6 +111,7 @@ dummy_driver_wait (dummy_driver_t *driver, int extra_fd, int *status,
{
jack_nframes_t nframes = driver->period_size;
struct timespec now;
struct timespec ts;

*status = 0;
/* this driver doesn't work so well if we report a delay */
@@ -136,7 +137,9 @@ dummy_driver_wait (dummy_driver_t *driver, int extra_fd, int *status,
}
driver->next_wakeup = add_ts (driver->next_wakeup, driver->wait_time);
} else {
if (clock_nanosleep (CLOCK_REALTIME, TIMER_ABSTIME, &driver->next_wakeup, NULL)) {
ts.tv_sec = 0;
ts.tv_nsec = ts_to_nsec(driver->next_wakeup) - ts_to_nsec(now);
if (nanosleep (&ts, NULL)) {
jack_error ("error while sleeping");
*status = -1;
} else {


+ 13
- 0
drivers/sndio/Makefile.am View File

@@ -0,0 +1,13 @@
MAINTAINCLEANFILES = Makefile.in

AM_CFLAGS = $(JACK_CFLAGS)

plugindir = $(ADDON_DIR)

plugin_LTLIBRARIES = jack_sndio.la

jack_sndio_la_LDFLAGS = -module -avoid-version
jack_sndio_la_LIBADD = $(SNDIO_LIBS)
jack_sndio_la_SOURCES = sndio_driver.c sndio_driver.h

noinst_HEADERS = sndio_driver.h

+ 997
- 0
drivers/sndio/sndio_driver.c
File diff suppressed because it is too large
View File


+ 74
- 0
drivers/sndio/sndio_driver.h View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2009 Jacob Meuser <jakemsr@sdf.lonestar.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.
*/

#ifndef __JACK_SNDIO_DRIVER_H__
#define __JACK_SNDIO_DRIVER_H__

#include <sys/types.h>
#include <pthread.h>
#include <semaphore.h>

#include <jack/types.h>
#include <jack/jslist.h>
#include <driver.h>
#include <jack/jack.h>

#define SNDIO_DRIVER_DEF_DEV "default"
#define SNDIO_DRIVER_DEF_FS 44100
#define SNDIO_DRIVER_DEF_BLKSIZE 1024
#define SNDIO_DRIVER_DEF_NPERIODS 2
#define SNDIO_DRIVER_DEF_BITS 16
#define SNDIO_DRIVER_DEF_INS 2
#define SNDIO_DRIVER_DEF_OUTS 2

typedef jack_default_audio_sample_t jack_sample_t;

typedef struct _sndio_driver
{
JACK_DRIVER_NT_DECL

jack_nframes_t sample_rate;
jack_nframes_t period_size;
jack_nframes_t orig_period_size;
unsigned int nperiods;
int bits;
unsigned int capture_channels;
unsigned int playback_channels;
jack_nframes_t sys_cap_latency;
jack_nframes_t sys_play_latency;
int ignorehwbuf;

struct sio_hdl *hdl;
char *dev;

void *capbuf;
size_t capbufsize;
void *playbuf;
size_t playbufsize;
JSList *capture_ports;
JSList *playback_ports;

int sample_bytes;
size_t pprime;

int poll_timeout;
jack_time_t poll_next;

jack_client_t *client;

} sndio_driver_t;

#endif

+ 4
- 0
jackd/Makefile.am View File

@@ -37,7 +37,11 @@ jack_md5.h: jackd
if STRIPPED_JACKD
strip -R .note -R .comment .libs/jackd
endif
if USE_MD5SUM
echo "#define JACKD_MD5_SUM \"`md5sum .libs/jackd | awk '{print $$1}'`\"" > jack_md5.h
else
echo "#define JACKD_MD5_SUM \"`md5 -q .libs/jackd | awk '{print $$1}'`\"" > jack_md5.h
endif

jackstart_SOURCES = jackstart.c md5.c
jackstart_LDFLAGS = -lcap


+ 1
- 1
jackd/controlapi.c View File

@@ -843,7 +843,7 @@ get_realtime_priority_constraint ()

return constraint_ptr;
#else
return NULL
return NULL;
#endif
}



+ 1
- 1
jackd/engine.c View File

@@ -1435,7 +1435,7 @@ handle_external_client_request (jack_engine_t *engine, int fd)
if ((r = read (client->request_fd, &req, sizeof(req)))
< (ssize_t)sizeof(req)) {
if (r == 0) {
#ifdef JACK_USE_MACH_THREADS
#if defined(JACK_USE_MACH_THREADS) || defined(__OpenBSD__)
/* poll is implemented using
select (see the macosx/fakepoll
code). When the socket is closed


+ 40
- 1
jackd/jackd.1.in View File

@@ -28,7 +28,7 @@ For the latest JACK information, please consult the web site,
.br
Select the audio interface backend. The current list of supported
backends is: \fBalsa\fR, \fBcoreaudio\fR, \fBdummy\fR, \fBfreebob\fR,
\fBoss\fR \fBsun\fR and \fBportaudio\fR. They are not all available
\fBoss\fR \fBsun\fR \fBportaudio\fR and \fB sndio. They are not all available
on all platforms. All \fIbackend\-parameters\fR are optional.
.TP
\fB\-h, \-\-help\fR
@@ -523,6 +523,43 @@ Driver name (default: none)
.TP
\fB\-z \-\-dither\fR
Dithering mode (default: none)
.SS SNDIO BACKEND PARAMETERS
.TP
\fB\-r, \-\-rate \fIint\fR
Specify the sample rate. The default is 44100.
.TP
\fB\-p, \-\-period \fIint\fR
Specify the number of frames between JACK \fBprocess()\fR calls. This
value must be a power of 2, and the default is 1024. If you need low
latency, set \fB\-p\fR as low as you can go without seeing xruns. A larger
period size yields higher latency, but makes xruns less likely. The JACK
capture latency in seconds is \fB\-\-period\fR divided by \fB\-\-rate\fR.
Note that this value is mostly advisory when aucat server is running
and may be updated internally.
.TP
\fB\-n, \-\-nperiods \fIint\fR
Specify the number of periods in the hardware buffer. The default is
2. The period size (\fB\-p\fR) times \fB\-\-nperiods\fR times four
(assuming 2 channels 16-bit samples) is the JACK buffer size in bytes.
The JACK output latency in seconds is \fB\-\-nperiods\fR times
\fB\-\-period\fR divided by \fB\-\-rate\fR.
Note that this value is mostly advisory when aucat server is running
and may be updated internally.
.TP
\fB\-w, \-\-wordlength \fIint\fR
Specify the sample size in bits. The default is 16.
.TP
\fB\-i, \-\-inchannels \fIint\fR
Specify how many channels to capture (default: 2)
.TP
\fB\-o, \-\-outchannels \fIint\fR
Specify number of playback channels (default: 2)
.TP
\fB\-d, \-\-device \fIdevice_file\fR
Specify device for capture and playback (default: NULL)
.TP
\fB\-b, \-\-ignorehwbuf \fIboolean\fR
Specify, whether to ignore hardware period size (default: false)
.SH "EXAMPLES"
.PP
Print usage message for the parameters specific to each backend.
@@ -544,6 +581,8 @@ Print usage message for the parameters specific to each backend.
\fBjackd \-d sun \-\-help\fR
.br
\fBjackd \-d portaudio \-\-help\fR
.br
\fBjackd \-d sndio \-\-help\fR
.PP
Run the JACK daemon with realtime priority using the first ALSA
hardware card defined in \fB/etc/modules.conf\fR.


+ 1
- 1
jackd/jackd.c View File

@@ -537,7 +537,7 @@ static void usage (FILE *file)
#ifdef __APPLE__
" Available backends may include: coreaudio, dummy, net, portaudio.\n\n"
#else
" Available backends may include: alsa, dummy, freebob, firewire, net, oss, sun, or portaudio.\n\n"
" Available backends may include: alsa, dummy, freebob, firewire, net, oss, sun, portaudio or sndio.\n\n"
#endif
" jackd -d backend --help\n"
" to display options for each backend\n\n");


Loading…
Cancel
Save