Browse Source

alsa_io tweaks

tags/v1.9.4
Torben Hohn 15 years ago
parent
commit
04e6a0088e
2 changed files with 6 additions and 6 deletions
  1. +5
    -5
      example-clients/alsa_in.c
  2. +1
    -1
      example-clients/alsa_out.c

+ 5
- 5
example-clients/alsa_in.c View File

@@ -86,9 +86,9 @@ typedef struct alsa_format {
} alsa_format_t;

alsa_format_t formats[] = {
{ SND_PCM_FORMAT_S24_3LE, 3, sample_move_d24_sS, sample_move_dS_s24, "24bit - real" },
{ SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" },
{ SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" },
{ SND_PCM_FORMAT_S24_3LE, 3, sample_move_d24_sS, sample_move_dS_s24, "24bit - real" },
{ SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" },
{ SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" }
};
@@ -313,9 +313,9 @@ int process (jack_nframes_t nframes, void *arg) {
int put_back_samples=0;
int i;

snd_pcm_delay( alsa_handle, &delay );
delay = snd_pcm_avail( alsa_handle );

//delay -= jack_frames_since_cycle_start( client );
delay -= jack_frames_since_cycle_start( client );
// Do it the hard way.
// this is for compensating xruns etc...

@@ -696,10 +696,10 @@ int main (int argc, char *argv[]) {
jack_buffer_size = jack_get_buffer_size( client );
// Setup target delay and max_diff for the normal user, who does not play with them...
if( !target_delay )
target_delay = (num_periods*period_size / 2) - jack_buffer_size/2;
target_delay = (num_periods*period_size / 2) + jack_buffer_size/2;

if( !max_diff )
max_diff = target_delay;
max_diff = num_periods*period_size - target_delay ;

if( max_diff > target_delay ) {
fprintf( stderr, "target_delay (%d) cant be smaller than max_diff(%d)\n", target_delay, max_diff );


+ 1
- 1
example-clients/alsa_out.c View File

@@ -316,7 +316,7 @@ int process (jack_nframes_t nframes, void *arg) {
snd_pcm_sframes_t delay = target_delay;
int i;

snd_pcm_delay( alsa_handle, &delay );
delay = (num_periods*period_size)-snd_pcm_avail( alsa_handle ) ;

delay -= jack_frames_since_cycle_start( client );
delay += jack_get_buffer_size( client ) / 2;


Loading…
Cancel
Save