diff options
Diffstat (limited to 'drivers/alsa_midi/a2j.h')
-rw-r--r-- | drivers/alsa_midi/a2j.h | 131 |
1 files changed, 63 insertions, 68 deletions
diff --git a/drivers/alsa_midi/a2j.h b/drivers/alsa_midi/a2j.h index e8145b3..c536448 100644 --- a/drivers/alsa_midi/a2j.h +++ b/drivers/alsa_midi/a2j.h @@ -39,100 +39,95 @@ #define PORT_HASH_SIZE (1 << PORT_HASH_BITS) /* Beside enum use, these are indeces for (struct a2j).stream array */ -#define A2J_PORT_CAPTURE 0 // ALSA playback port -> JACK capture port -#define A2J_PORT_PLAYBACK 1 // JACK playback port -> ALSA capture port +#define A2J_PORT_CAPTURE 0 // ALSA playback port -> JACK capture port +#define A2J_PORT_PLAYBACK 1 // JACK playback port -> ALSA capture port typedef struct a2j_port * a2j_port_hash_t[PORT_HASH_SIZE]; struct alsa_midi_driver; -struct a2j_port -{ - struct a2j_port * next; /* hash - jack */ - struct list_head siblings; /* list - main loop */ - struct alsa_midi_driver * driver_ptr; - bool is_dead; - char name[64]; - snd_seq_addr_t remote; - jack_port_t * jack_port; - - jack_ringbuffer_t * inbound_events; // alsa_midi_event_t + data - int64_t last_out_time; - - void * jack_buf; +struct a2j_port { + struct a2j_port * next; /* hash - jack */ + struct list_head siblings; /* list - main loop */ + struct alsa_midi_driver * driver_ptr; + bool is_dead; + char name[64]; + snd_seq_addr_t remote; + jack_port_t * jack_port; + + jack_ringbuffer_t * inbound_events; // alsa_midi_event_t + data + int64_t last_out_time; + + void * jack_buf; }; -struct a2j_stream -{ - snd_midi_event_t *codec; - - jack_ringbuffer_t *new_ports; - - a2j_port_hash_t port_hash; - struct list_head list; +struct a2j_stream { + snd_midi_event_t *codec; + + jack_ringbuffer_t *new_ports; + + a2j_port_hash_t port_hash; + struct list_head list; }; -typedef struct alsa_midi_driver -{ - JACK_DRIVER_DECL; - - jack_client_t * jack_client; - - snd_seq_t *seq; - pthread_t alsa_input_thread; - pthread_t alsa_output_thread; - int client_id; - int port_id; - int queue; - bool freewheeling; - bool running; - bool finishing; - - jack_ringbuffer_t* port_del; // struct a2j_port* - jack_ringbuffer_t* outbound_events; // struct a2j_delivery_event - jack_nframes_t cycle_start; - - sem_t output_semaphore; - - struct a2j_stream stream[2]; +typedef struct alsa_midi_driver { + JACK_DRIVER_DECL; + + jack_client_t * jack_client; + + snd_seq_t *seq; + pthread_t alsa_input_thread; + pthread_t alsa_output_thread; + int client_id; + int port_id; + int queue; + bool freewheeling; + bool running; + bool finishing; + + jack_ringbuffer_t* port_del; // struct a2j_port* + jack_ringbuffer_t* outbound_events; // struct a2j_delivery_event + jack_nframes_t cycle_start; + + sem_t output_semaphore; + + struct a2j_stream stream[2]; } alsa_midi_driver_t; -#define NSEC_PER_SEC ((int64_t)1000*1000*1000) +#define NSEC_PER_SEC ((int64_t)1000 * 1000 * 1000) -struct a2j_alsa_midi_event -{ - int64_t time; - int size; +struct a2j_alsa_midi_event { + int64_t time; + int size; }; #define MAX_JACKMIDI_EV_SIZE 64 -struct a2j_delivery_event -{ - struct list_head siblings; - - /* a jack MIDI event, plus the port its destined for: everything - the ALSA output thread needs to deliver the event. time is - part of the jack_event. - */ - jack_midi_event_t jack_event; - jack_nframes_t time; /* realtime, not offset time */ - struct a2j_port* port; - char midistring[MAX_JACKMIDI_EV_SIZE]; +struct a2j_delivery_event { + struct list_head siblings; + + /* a jack MIDI event, plus the port its destined for: everything + the ALSA output thread needs to deliver the event. time is + part of the jack_event. + */ + jack_midi_event_t jack_event; + jack_nframes_t time; /* realtime, not offset time */ + struct a2j_port* port; + char midistring[MAX_JACKMIDI_EV_SIZE]; }; -void a2j_error (const char* fmt, ...); +void a2j_error(const char* fmt, ...); #define A2J_DEBUG /*#undef A2J_DEBUG*/ #ifdef A2J_DEBUG extern bool a2j_do_debug; -extern void _a2j_debug (const char* fmt, ...); -#define a2j_debug(fmt, ...) if (a2j_do_debug) { _a2j_debug ((fmt), ##__VA_ARGS__); } +extern void _a2j_debug(const char* fmt, ...); +#define a2j_debug(fmt, ...) if (a2j_do_debug) { _a2j_debug ((fmt), ## __VA_ARGS__); } #else -#define a2j_debug(fmt,...) +#define a2j_debug(fmt, ...) #endif #endif /* __jack_alsa_midi_h__ */ |