Browse Source

alsa: Whitespace only

pull/7/head
Erik de Castro Lopo 10 years ago
parent
commit
35c11a9424
2 changed files with 16 additions and 16 deletions
  1. +8
    -8
      alsa_in.c
  2. +8
    -8
      alsa_out.c

+ 8
- 8
alsa_in.c View File

@@ -312,7 +312,7 @@ void freewheel (int freewheel_starting, void *ignored_arg)
if( freewheel_starting ) {
snd_pcm_close( alsa_handle );
alsa_handle = 0;
// reset resampling parameters
// reset resampling parameters
resample_mean = 1.0;
static_resample_factor = 1.0;
resample_lower_limit = 0.25;
@@ -342,7 +342,7 @@ int process (jack_nframes_t nframes, void *arg) {
/* freewheeling, or some other error */
return 0;
}
delay = snd_pcm_avail( alsa_handle );

delay -= jack_frames_since_cycle_start( client );
@@ -363,7 +363,7 @@ int process (jack_nframes_t nframes, void *arg) {

// Set the resample_rate... we need to adjust the offset integral, to do this.
// first look at the PI controller, this code is just a special case, which should never execute once
// everything is swung in.
// everything is swung in.
offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
// Also clear the array. we are beginning a new control cycle.
for( i=0; i<smooth_size; i++ )
@@ -408,7 +408,7 @@ int process (jack_nframes_t nframes, void *arg) {
if( fabs( smooth_offset ) < pclamp )
smooth_offset = 0.0;

// ok. now this is the PI controller.
// ok. now this is the PI controller.
// u(t) = K * ( e(t) + 1/T \int e(t') dt' )
// K = 1/catch_factor and T = catch_factor2
double current_resample_factor = static_resample_factor - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2;
@@ -488,7 +488,7 @@ again:
//printf( "putback = %d\n", put_back_samples );
snd_pcm_rewind( alsa_handle, put_back_samples );

return 0;
return 0;
}

/**
@@ -720,7 +720,7 @@ int main (int argc, char *argv[]) {
jack_set_latency_callback (client, latency_cb, 0);

// get jack sample_rate
jack_sample_rate = jack_get_sample_rate( client );

if( !sample_rate )
@@ -756,11 +756,11 @@ 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 )
if( !target_delay )
target_delay = (num_periods*period_size / 2) + jack_buffer_size/2;

if( !max_diff )
max_diff = num_periods*period_size - 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 );


+ 8
- 8
alsa_out.c View File

@@ -298,10 +298,10 @@ static snd_pcm_t *open_audiofd( char *device_name, int capture, int rate, int ch
//snd_pcm_start( handle );
//snd_pcm_wait( handle, 200 );
int num_null_samples = nperiods * period * channels;
char *tmp = alloca( num_null_samples * formats[format].sample_size );
char *tmp = alloca( num_null_samples * formats[format].sample_size );
memset( tmp, 0, num_null_samples * formats[format].sample_size );
snd_pcm_writei( handle, tmp, num_null_samples );

return handle;
}
@@ -336,7 +336,7 @@ int process (jack_nframes_t nframes, void *arg) {

// Set the resample_rate... we need to adjust the offset integral, to do this.
// first look at the PI controller, this code is just a special case, which should never execute once
// everything is swung in.
// everything is swung in.
offset_integral = - (resample_mean - static_resample_factor) * catch_factor * catch_factor2;
// Also clear the array. we are beginning a new control cycle.
for( i=0; i<smooth_size; i++ )
@@ -388,7 +388,7 @@ int process (jack_nframes_t nframes, void *arg) {
if( fabs( smooth_offset ) < pclamp )
smooth_offset = 0.0;

// ok. now this is the PI controller.
// ok. now this is the PI controller.
// u(t) = K * ( e(t) + 1/T \int e(t') dt' )
// K = 1/catch_factor and T = catch_factor2
double current_resample_factor = static_resample_factor - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2;
@@ -466,7 +466,7 @@ again:
goto again;
}

return 0;
return 0;
}

/**
@@ -695,7 +695,7 @@ int main (int argc, char *argv[]) {
jack_set_latency_callback (client, latency_cb, 0);

// get jack sample_rate
jack_sample_rate = jack_get_sample_rate( client );

if( !sample_rate )
@@ -724,11 +724,11 @@ 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 )
if( !target_delay )
target_delay = (num_periods*period_size / 2) - jack_buffer_size/2;

if( !max_diff )
max_diff = target_delay;
max_diff = target_delay;

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


Loading…
Cancel
Save