LiVES 1.4.9

src/jack.h

Go to the documentation of this file.
00001 // jack.h
00002 // LiVES (lives-exe)
00003 // (c) G. Finch 2005 - 2009
00004 // Released under the GPL 3 or later
00005 // see file ../COPYING for licensing details
00006 
00007 #ifndef _HAS_LIVES_JACK_H
00008 #define _HAS_LIVES_JACK_H
00009 
00010 #ifdef ENABLE_JACK
00011 
00012 
00013 
00014 
00016 // Transport
00017 #include <jack/jack.h>
00018 #include <jack/transport.h>
00019 
00020 gboolean lives_jack_init (void); 
00021 gboolean lives_jack_poll(void); 
00022 void lives_jack_end (void);
00023 
00024 int lives_start_ready_callback (jack_transport_state_t state, jack_position_t *pos, void *arg);
00025 
00026 void jack_pb_start (void); 
00027 void jack_pb_stop (void); 
00030 
00031 // Audio
00032 
00033 #include "audio.h"
00034 
00035 #define JACK_MAX_OUTPUT_PORTS 10
00036 #define JACK_MAX_INPUT_PORTS 10
00037 
00038 #define ERR_PORT_NOT_FOUND 10
00039 
00040 
00041 typedef jack_nframes_t nframes_t;
00042 
00043 
00044 
00045 // let's hope these are well above the standard jack transport states...
00046 #define JackTClosed 1024
00047 #define JackTReset 1025
00048 #define JackTStopped 1026
00049 
00050 typedef struct {
00051   gint      dev_idx;                      
00052   glong     sample_out_rate;                   
00053   glong     sample_in_rate;                   
00054   gulong    num_input_channels;            
00055   gulong    num_output_channels;           
00056   gulong    bytes_per_channel;
00057 
00058   gulong    num_calls;                     
00060   jack_port_t*     output_port[JACK_MAX_OUTPUT_PORTS]; 
00061   jack_port_t*     input_port[JACK_MAX_INPUT_PORTS]; 
00062   jack_client_t*   client;                        
00064   gchar             **jack_port_name;              
00065   unsigned int     jack_port_name_count;          
00066   gulong    jack_port_flags;               
00068   lives_audio_loop_t loop;
00069 
00070   jack_transport_state_t state;
00071 
00072   float     volume[JACK_MAX_OUTPUT_PORTS];      
00073 
00074   gboolean          in_use;                        
00075   gboolean mute;
00076 
00077   volatile aserver_message_t   *msgq;          
00079   off_t seek_pos;
00080   off_t seek_end;
00081   gboolean usigned;
00082   gboolean reverse_endian;
00083 
00084   lives_whentostop_t *whentostop; 
00085   volatile lives_cancel_t *cancelled; 
00086 
00087   /* variables used for trying to restart the connection to jack */
00088   gboolean             jackd_died;                    
00089   struct timeval   last_reconnect_attempt;
00090 
00091   gboolean play_when_stopped; 
00092   gint64 audio_ticks; 
00093   gulong frames_written;
00094 
00095   gint out_chans_available;
00096   gint in_chans_available;
00097 
00098   gboolean is_paused;
00099 
00100   gboolean is_output; 
00101 
00102   gboolean is_silent;
00103 
00104   gboolean is_active;
00105 
00106   gint playing_file;
00107 
00108   volatile float jack_pulse[1024];
00109 
00110   lives_audio_buf_t **abufs;
00111   volatile gint read_abuf;
00112 
00113   volatile int astream_fd;
00114 
00115 } jack_driver_t;
00116 
00117 
00118 #define JACK_MAX_OUTDEVICES 10
00119 #define JACK_MAX_INDEVICES 10
00120 
00121 
00123 
00124 jack_driver_t *jack_get_driver(gint dev_idx, gboolean is_output); 
00125 
00126 int jack_audio_init(void); 
00127 int jack_audio_read_init(void); 
00128 
00129 int jack_open_device(jack_driver_t *); 
00130 int jack_open_device_read(jack_driver_t *); 
00131 
00132 int jack_driver_activate (jack_driver_t *); 
00133 int jack_read_driver_activate (jack_driver_t *); 
00134 
00135 void jack_close_device(jack_driver_t*);
00136 
00137 
00138 // utils
00139 volatile aserver_message_t *jack_get_msgq(jack_driver_t *); 
00140 gint64 lives_jack_get_time(jack_driver_t *, gboolean absolute); 
00141 void jack_audio_seek_frame (jack_driver_t *, gint frame); 
00142 long jack_audio_seek_bytes (jack_driver_t *, long bytes); 
00143 
00144 void jack_get_rec_avals(jack_driver_t *);
00145 
00146 gdouble jack_transport_get_time(void);
00147 
00148 gdouble lives_jack_get_pos(jack_driver_t *);
00149 
00150 #endif
00151 
00152 
00153 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines