Browse Source

ALSA driver: check frame rate after configuration and report error if different from requested rate

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@600 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pbd 21 years ago
parent
commit
bd731d8e75
2 changed files with 28 additions and 1 deletions
  1. +1
    -1
      configure.in
  2. +27
    -0
      drivers/alsa/alsa_driver.c

+ 1
- 1
configure.in View File

@@ -15,7 +15,7 @@ dnl changes are made
dnl --- dnl ---
JACK_MAJOR_VERSION=0 JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=93 JACK_MINOR_VERSION=93
JACK_MICRO_VERSION=3
JACK_MICRO_VERSION=4


dnl --- dnl ---
dnl HOWTO: updating the jack protocal version dnl HOWTO: updating the jack protocal version


+ 27
- 0
drivers/alsa/alsa_driver.c View File

@@ -512,6 +512,8 @@ alsa_driver_set_parameters (alsa_driver_t *driver,
unsigned int p_nfragments = 0; unsigned int p_nfragments = 0;
unsigned int c_nfragments = 0; unsigned int c_nfragments = 0;
channel_t chn; channel_t chn;
unsigned int pr = 0;
unsigned int cr = 0;


driver->frame_rate = rate; driver->frame_rate = rate;
driver->frames_per_cycle = frames_per_cycle; driver->frames_per_cycle = frames_per_cycle;
@@ -551,6 +553,30 @@ alsa_driver_set_parameters (alsa_driver_t *driver,
} }
} }
/* check the rate, since thats rather important */

if (driver->playback_handle) {
int dir;
pr = snd_pcm_hw_params_get_rate (driver->playback_hw_params, &dir);
}

if (driver->capture_handle) {
int dir;
cr = snd_pcm_hw_params_get_rate (driver->capture_hw_params, &dir);
}

if (cr != pr) {
jack_error ("playback and capture sample rates do not match (%d vs. %d)",
pr, cr);
return -1;
}
if (cr != driver->frame_rate) {
jack_error ("sample rate in use (%d Hz) does not match requested rate (%d Hz)",
cr, driver->frame_rate);
driver->frame_rate = cr;
}

/* check the fragment size, since thats non-negotiable */ /* check the fragment size, since thats non-negotiable */
if (driver->playback_handle) { if (driver->playback_handle) {
@@ -2383,6 +2409,7 @@ driver_initialize (jack_client_t *client, const JSList * params)


case 'r': case 'r':
srate = param->value.ui; srate = param->value.ui;
fprintf (stderr, "apparent rate = %d\n", srate);
break; break;
case 'p': case 'p':


Loading…
Cancel
Save