~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
JACK/drivers/alsa/alsa_driver.h


** Warning: Cannot open xref database.

1 /* 2 Copyright (C) 2001 Paul Davis 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 18 $Id: alsa_driver.h,v 1.4 2003/12/31 21:28:55 joq Exp $ 19 */ 20 21 #ifndef __jack_alsa_driver_h__ 22 #define __jack_alsa_driver_h__ 23 24 #define ALSA_PCM_OLD_HW_PARAMS_API 25 #define ALSA_PCM_OLD_SW_PARAMS_API 26 #include <alsa/asoundlib.h> 27 28 #if __BYTE_ORDER == __LITTLE_ENDIAN 29 #define SND_PCM_FORMAT_S24_3 SND_PCM_FORMAT_S24_3LE 30 #elif __BYTE_ORDER == __BIG_ENDIAN 31 #define SND_PCM_FORMAT_S24_3 SND_PCM_FORMAT_S24_3BE 32 #endif 33 34 35 36 #include <jack/types.h> 37 #include <jack/hardware.h> 38 #include <jack/driver.h> 39 #include "memops.h" 40 #include <jack/jack.h> 41 42 typedef void (*ReadCopyFunction) (jack_default_audio_sample_t *dst, char *src, 43 unsigned long src_bytes, 44 unsigned long src_skip_bytes); 45 typedef void (*WriteCopyFunction) (char *dst, jack_default_audio_sample_t *src, 46 unsigned long src_bytes, 47 unsigned long dst_skip_bytes, 48 dither_state_t *state); 49 typedef void (*CopyCopyFunction) (char *dst, char *src, 50 unsigned long src_bytes, 51 unsigned long dst_skip_bytes, 52 unsigned long src_skip_byte); 53 54 typedef struct { 55 56 JACK_DRIVER_NT_DECL 57 58 int poll_timeout; 59 jack_time_t poll_last; 60 jack_time_t poll_next; 61 char **playback_addr; 62 char **capture_addr; 63 const snd_pcm_channel_area_t *capture_areas; 64 const snd_pcm_channel_area_t *playback_areas; 65 struct pollfd *pfd; 66 unsigned int playback_nfds; 67 unsigned int capture_nfds; 68 unsigned long interleave_unit; 69 unsigned long capture_interleave_skip; 70 unsigned long playback_interleave_skip; 71 channel_t max_nchannels; 72 channel_t user_nchannels; 73 channel_t playback_nchannels; 74 channel_t capture_nchannels; 75 unsigned long playback_sample_bytes; 76 unsigned long capture_sample_bytes; 77 78 jack_nframes_t frame_rate; 79 jack_nframes_t frames_per_cycle; 80 jack_nframes_t capture_frame_latency; 81 jack_nframes_t playback_frame_latency; 82 83 unsigned long *silent; 84 char *alsa_name_playback; 85 char *alsa_name_capture; 86 char *alsa_driver; 87 snd_pcm_uframes_t buffer_frames; 88 unsigned long channels_not_done; 89 unsigned long channel_done_bits; 90 snd_pcm_format_t playback_sample_format; 91 snd_pcm_format_t capture_sample_format; 92 float max_sample_val; 93 unsigned long user_nperiods; 94 unsigned long nfragments; 95 unsigned long last_mask; 96 snd_ctl_t *ctl_handle; 97 snd_pcm_t *playback_handle; 98 snd_pcm_t *capture_handle; 99 snd_pcm_hw_params_t *playback_hw_params; 100 snd_pcm_sw_params_t *playback_sw_params; 101 snd_pcm_hw_params_t *capture_hw_params; 102 snd_pcm_sw_params_t *capture_sw_params; 103 jack_hardware_t *hw; 104 ClockSyncStatus *clock_sync_data; 105 jack_client_t *client; 106 JSList *capture_ports; 107 JSList *playback_ports; 108 109 unsigned long input_monitor_mask; 110 111 char soft_mode : 1; 112 char hw_monitoring : 1; 113 char hw_metering : 1; 114 char all_monitor_in : 1; 115 char capture_and_playback_not_synced : 1; 116 char playback_interleaved : 1; 117 char capture_interleaved : 1; 118 char with_monitor_ports : 1; 119 120 ReadCopyFunction read_via_copy; 121 WriteCopyFunction write_via_copy; 122 CopyCopyFunction channel_copy; 123 124 int dither; 125 dither_state_t *dither_state; 126 127 SampleClockMode clock_mode; 128 JSList *clock_sync_listeners; 129 pthread_mutex_t clock_sync_lock; 130 unsigned long next_clock_sync_listener_id; 131 char has_clock_sync_reporting : 1; 132 char has_hw_monitoring : 1; 133 char has_hw_metering : 1; 134 135 int running; 136 int run; 137 138 int xrun_count; 139 int process_count; 140 141 } alsa_driver_t; 142 143 static __inline__ void alsa_driver_mark_channel_done (alsa_driver_t *driver, channel_t chn) { 144 driver->channels_not_done &= ~(1<<chn); 145 driver->silent[chn] = 0; 146 } 147 148 static __inline__ void alsa_driver_silence_on_channel (alsa_driver_t *driver, channel_t chn, jack_nframes_t nframes) { 149 if (driver->playback_interleaved) { 150 memset_interleave 151 (driver->playback_addr[chn], 152 0, nframes * driver->playback_sample_bytes, 153 driver->interleave_unit, 154 driver->playback_interleave_skip); 155 } else { 156 memset (driver->playback_addr[chn], 0, nframes * driver->playback_sample_bytes); 157 } 158 alsa_driver_mark_channel_done (driver,chn); 159 } 160 161 static __inline__ void alsa_driver_silence_on_channel_no_mark (alsa_driver_t *driver, channel_t chn, jack_nframes_t nframes) { 162 if (driver->playback_interleaved) { 163 memset_interleave 164 (driver->playback_addr[chn], 165 0, nframes * driver->playback_sample_bytes, 166 driver->interleave_unit, 167 driver->playback_interleave_skip); 168 } else { 169 memset (driver->playback_addr[chn], 0, nframes * driver->playback_sample_bytes); 170 } 171 } 172 173 static __inline__ void alsa_driver_read_from_channel (alsa_driver_t *driver, 174 channel_t channel, jack_default_audio_sample_t *buf, 175 jack_nframes_t nsamples) 176 { 177 driver->read_via_copy (buf, 178 driver->capture_addr[channel], 179 nsamples, 180 driver->capture_interleave_skip); 181 } 182 183 static __inline__ void alsa_driver_write_to_channel (alsa_driver_t *driver, 184 channel_t channel, 185 jack_default_audio_sample_t *buf, 186 jack_nframes_t nsamples) 187 { 188 driver->write_via_copy (driver->playback_addr[channel], 189 buf, 190 nsamples, 191 driver->playback_interleave_skip, 192 driver->dither_state+channel); 193 alsa_driver_mark_channel_done (driver, channel); 194 } 195 196 static __inline__ void alsa_driver_copy_channel (alsa_driver_t *driver, 197 channel_t input_channel, 198 channel_t output_channel, 199 jack_nframes_t nsamples) { 200 201 driver->channel_copy (driver->playback_addr[output_channel], 202 driver->capture_addr[input_channel], 203 nsamples * driver->playback_sample_bytes, 204 driver->playback_interleave_skip, 205 driver->capture_interleave_skip); 206 alsa_driver_mark_channel_done (driver, output_channel); 207 } 208 209 void alsa_driver_set_clock_sync_status (alsa_driver_t *driver, channel_t chn, ClockSyncStatus status); 210 int alsa_driver_listen_for_clock_sync_status (alsa_driver_t *, ClockSyncListenerFunction, void *arg); 211 int alsa_driver_stop_listen_for_clock_sync_status (alsa_driver_t *, unsigned int); 212 void alsa_driver_clock_sync_notify (alsa_driver_t *, channel_t chn, ClockSyncStatus); 213 214 215 #endif /* __jack_alsa_driver_h__ */ 216

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.