Browse Source

- Introduce jack backend for FFADO with the name 'firewire'. (experimental)

- bump version to 0.105.1



git-svn-id: svn+ssh://jackaudio.org/trunk/jack@1040 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pieterpalmers 19 years ago
parent
commit
9638e0b9d6
5 changed files with 1509 additions and 4 deletions
  1. +21
    -2
      configure.ac
  2. +8
    -2
      drivers/Makefile.am
  3. +20
    -0
      drivers/firewire/Makefile.am
  4. +1216
    -0
      drivers/firewire/ffado_driver.c
  5. +244
    -0
      drivers/firewire/ffado_driver.h

+ 21
- 2
configure.ac View File

@@ -17,7 +17,7 @@ dnl changes are made
dnl ---
JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=105
JACK_MICRO_VERSION=0
JACK_MICRO_VERSION=1

dnl ---
dnl HOWTO: updating the jack protocol version
@@ -612,6 +612,23 @@ then
fi
AM_CONDITIONAL(HAVE_FREEBOB,$HAVE_FREEBOB)

AC_ARG_ENABLE(firewire, [ --disable-firewire ignore FireWire driver (FFADO) ],
TRY_FIREWIRE=$enableval , TRY_FIREWIRE=yes )
HAVE_FIREWIRE="false"
if test "x$TRY_FIREWIRE" = "xyes"
then
# check for FFADO libraries
PKG_CHECK_MODULES(LIBFFADO, libffado >= 1.999.0,
[HAVE_FIREWIRE="true"
JACK_DEFAULT_DRIVER=\"firewire\"
], AC_MSG_RESULT([no]))

AC_SUBST([LIBFFADO_CFLAGS])
AC_SUBST([LIBFFADO_LIBS])

fi
AM_CONDITIONAL(HAVE_FIREWIRE,$HAVE_FIREWIRE)

AC_ARG_ENABLE(alsa, [ --disable-alsa ignore ALSA driver ],
TRY_ALSA=$enableval , TRY_ALSA=yes )
HAVE_ALSA="false"
@@ -702,6 +719,7 @@ drivers/oss/Makefile
drivers/portaudio/Makefile
drivers/coreaudio/Makefile
drivers/freebob/Makefile
drivers/firewire/Makefile
example-clients/Makefile
jack.pc
jack.spec
@@ -720,7 +738,8 @@ echo
echo $PACKAGE $VERSION :
echo
echo \| Build with ALSA support............................... : $HAVE_ALSA
echo \| Build with FreeBob support............................ : $HAVE_FREEBOB
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 CoreAudio support.......................... : $HAVE_COREAUDIO
echo \| Build with PortAudio support.......................... : $HAVE_PA


+ 8
- 2
drivers/Makefile.am View File

@@ -36,5 +36,11 @@ else
FREEBOB_DIR =
endif

SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR)
DIST_SUBDIRS = alsa alsa-midi dummy oss portaudio coreaudio freebob
if HAVE_FIREWIRE
FIREWIRE_DIR = firewire
else
FIREWIRE_DIR =
endif

SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR)
DIST_SUBDIRS = alsa alsa-midi dummy oss portaudio coreaudio freebob firewire

+ 20
- 0
drivers/firewire/Makefile.am View File

@@ -0,0 +1,20 @@
# plugin is called 'firewire',
# driver code is called 'ffado*' because it is an implementation
# of a firewire backend

MAINTAINERCLEANFILES=Makefile.in

AM_CFLAGS = $(JACK_CFLAGS) $(LIBFFADO_CFLAGS) $(ALSA_CFLAGS)

plugindir = $(ADDON_DIR)

plugin_LTLIBRARIES = jack_firewire.la

jack_firewire_la_SOURCES = ffado_driver.c

jack_firewire_la_LIBADD = $(LIBFFADO_LIBS) $(ALSA_LIBS)

jack_firewire_la_LDFLAGS = -module -avoid-version

noinst_HEADERS = ffado_driver.h


+ 1216
- 0
drivers/firewire/ffado_driver.c
File diff suppressed because it is too large
View File


+ 244
- 0
drivers/firewire/ffado_driver.h View File

@@ -0,0 +1,244 @@
/*
* FireWire Backend for Jack
* using FFADO
* FFADO = Firewire (pro-)audio for linux
*
* http://www.ffado.org
* http://www.jackaudio.org
*
* Copyright (C) 2005-2007 Pieter Palmers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/*
* Main Jack driver entry routines
*
*/
#ifndef __JACK_FFADO_DRIVER_H__
#define __JACK_FFADO_DRIVER_H__

#define FFADO_DRIVER_WITH_ASEQ_MIDI

#include <libffado/ffado.h>

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

#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <poll.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <endian.h>

#include <pthread.h>
#include <semaphore.h>

#include <jack/internal.h>
#include <jack/types.h>
#include <jack/ringbuffer.h>
#include <jack/driver.h>
#include <jack/engine.h>
#include <jack/types.h>
#include <jack/thread.h>

#include <alsa/asoundlib.h>

// debug print control flags
#define DEBUG_LEVEL_BUFFERS (1<<0)
#define DEBUG_LEVEL_HANDLERS (1<<1)
#define DEBUG_LEVEL_XRUN_RECOVERY (1<<2)
#define DEBUG_LEVEL_WAIT (1<<3)

#define DEBUG_LEVEL_RUN_CYCLE (1<<8)

#define DEBUG_LEVEL_PACKETCOUNTER (1<<16)
#define DEBUG_LEVEL_STARTUP (1<<17)
#define DEBUG_LEVEL_THREADS (1<<18)


#ifdef DEBUG_ENABLED

// default debug level
#define DEBUG_LEVEL ( DEBUG_LEVEL_RUN_CYCLE | \
(DEBUG_LEVEL_XRUN_RECOVERY)| DEBUG_LEVEL_STARTUP | DEBUG_LEVEL_WAIT | DEBUG_LEVEL_PACKETCOUNTER)

#warning Building debug build!

#define printMessage(format, args...) jack_error( "FreeBoB MSG: %s:%d (%s): " format, __FILE__, __LINE__, __FUNCTION__, ##args )
#define printError(format, args...) jack_error( "FreeBoB ERR: %s:%d (%s): " format, __FILE__, __LINE__, __FUNCTION__, ##args )
//#define printEnter() jack_error( "FBDRV ENTERS: %s (%s)\n", __FUNCTION__, __FILE__)
//#define printExit() jack_error( "FBDRV EXITS: %s (%s)\n", __FUNCTION__, __FILE__)
#define printEnter()
#define printExit()
#define debugError(format, args...) jack_error( "FREEBOB ERR: %s:%d (%s): " format, __FILE__, __LINE__, __FUNCTION__, ##args )
#define debugPrint(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error("DEBUG %s:%d (%s) :" format, __FILE__, __LINE__, __FUNCTION__, ##args );
#define debugPrintShort(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( format,##args );
#define debugPrintWithTimeStamp(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( "%16lu: "format, debugGetCurrentUTime(),##args );
#define SEGFAULT int *test=NULL; *test=1;
#else
#define DEBUG_LEVEL
#define printMessage(format, args...) if(g_verbose) \
jack_error("FreeBoB MSG: " format, ##args )
#define printError(format, args...) jack_error("FreeBoB ERR: " format, ##args )
#define printEnter()
#define printExit()
#define debugError(format, args...)
#define debugPrint(Level, format, args...)
#define debugPrintShort(Level, format, args...)
#define debugPrintWithTimeStamp(Level, format, args...)
#endif

// thread priority setup
#define FFADO_RT_PRIORITY_PACKETIZER_RELATIVE 5

#ifdef FFADO_DRIVER_WITH_ASEQ_MIDI

#define ALSA_SEQ_BUFF_SIZE 1024
#define MIDI_TRANSMIT_BUFFER_SIZE 1024
#define MIDI_THREAD_SLEEP_TIME_USECS 100
// midi priority should be higher than the audio priority in order to
// make sure events are not only delivered on period boundarys
// but I think it should be smaller than the packetizer thread in order not
// to lose any packets
#define FFADO_RT_PRIORITY_MIDI_RELATIVE 4

#endif

typedef struct _ffado_driver ffado_driver_t;

/*
* Jack Driver command line parameters
*/

typedef struct _ffado_jack_settings ffado_jack_settings_t;
struct _ffado_jack_settings {
int period_size_set;
jack_nframes_t period_size;
int sample_rate_set;
int sample_rate;
int buffer_size_set;
jack_nframes_t buffer_size;
int port_set;
int port;
int node_id_set;
int node_id;
int playback_ports;
int capture_ports;
int slave_mode;
int snoop_mode;
ffado_handle_t fb_handle;
};

#ifdef FFADO_DRIVER_WITH_ASEQ_MIDI

typedef struct {
int stream_nr;
int seq_port_nr;
snd_midi_event_t *parser;
snd_seq_t *seq_handle;
} ffado_midi_port_t;

typedef struct _ffado_driver_midi_handle {
ffado_device_t *dev;
ffado_driver_t *driver;

snd_seq_t *seq_handle;
pthread_t queue_thread;
pthread_t dequeue_thread;
int queue_thread_realtime;
int queue_thread_priority;

int nb_input_ports;
int nb_output_ports;

ffado_midi_port_t **input_ports;
ffado_midi_port_t **output_ports;

ffado_midi_port_t **input_stream_port_map;
int *output_port_stream_map;


} ffado_driver_midi_handle_t;

#endif
/*
* JACK driver structure
*/

struct _ffado_driver
{
JACK_DRIVER_NT_DECL
jack_nframes_t sample_rate;
jack_nframes_t period_size;
unsigned long wait_time;

jack_time_t wait_last;
jack_time_t wait_next;
int wait_late;
jack_client_t *client;
int xrun_detected;
int xrun_count;
int process_count;
/* settings from the command line */
ffado_jack_settings_t settings;
/* the freebob virtual device */
ffado_device_t *dev;
JSList *capture_ports;
JSList *playback_ports;
JSList *monitor_ports;
channel_t playback_nchannels;
channel_t capture_nchannels;
ffado_device_info_t device_info;
ffado_options_t device_options;

#ifdef FFADO_DRIVER_WITH_ASEQ_MIDI
ffado_driver_midi_handle_t *midi_handle;
#endif

};



#endif /* __JACK_FFADO_DRIVER_H__ */



Loading…
Cancel
Save