Browse Source

Soft-mode improvements.

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@294 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
kaiv 23 years ago
parent
commit
7cd1a63871
2 changed files with 27 additions and 11 deletions
  1. +26
    -10
      drivers/alsa/alsa_driver.c
  2. +1
    -1
      jackd/engine.c

+ 26
- 10
drivers/alsa/alsa_driver.c View File

@@ -337,12 +337,19 @@ alsa_driver_configure_stream (alsa_driver_t *driver,
jack_error ("ALSA: cannot set start mode for %s", stream_name); jack_error ("ALSA: cannot set start mode for %s", stream_name);
return -1; return -1;
} }
if ((err = snd_pcm_sw_params_set_stop_threshold (handle, sw_params, driver->user_nperiods * driver->frames_per_cycle)) < 0) {
jack_error ("ALSA: cannot set stop mode for %s", stream_name);
return -1;
}


{
snd_pcm_uframes_t stop_th = driver->user_nperiods * driver->frames_per_cycle;
if (driver->soft_mode) {
stop_th = (snd_pcm_uframes_t)-1;
}

if ((err = snd_pcm_sw_params_set_stop_threshold (handle, sw_params, stop_th)) < 0) {
jack_error ("ALSA: cannot set stop mode for %s", stream_name);
return -1;
}
}
if ((err = snd_pcm_sw_params_set_silence_threshold (handle, sw_params, 0)) < 0) { if ((err = snd_pcm_sw_params_set_silence_threshold (handle, sw_params, 0)) < 0) {
jack_error ("ALSA: cannot set silence threshold for %s", stream_name); jack_error ("ALSA: cannot set silence threshold for %s", stream_name);
return -1; return -1;
@@ -1393,15 +1400,16 @@ alsa_driver_new (char *name, char *alsa_device,
int hw_monitoring, int hw_monitoring,
int capturing, int capturing,
int playing, int playing,
DitherAlgorithm dither)
DitherAlgorithm dither,
int soft_mode)
{ {
int err; int err;


alsa_driver_t *driver; alsa_driver_t *driver;


printf ("creating alsa driver ... %s|%lu|%lu|%lu|%s\n",
printf ("creating alsa driver ... %s|%lu|%lu|%lu|%s|%s\n",
alsa_device, frames_per_cycle, user_nperiods, rate, alsa_device, frames_per_cycle, user_nperiods, rate,
hw_monitoring ? "hwmon":"swmon");
hw_monitoring ? "hwmon":"swmon", soft_mode ? "soft-mode":"rt");


driver = (alsa_driver_t *) calloc (1, sizeof (alsa_driver_t)); driver = (alsa_driver_t *) calloc (1, sizeof (alsa_driver_t));


@@ -1441,6 +1449,7 @@ alsa_driver_new (char *name, char *alsa_device,
driver->capture_nfds = 0; driver->capture_nfds = 0;


driver->dither = dither; driver->dither = dither;
driver->soft_mode = soft_mode;


pthread_mutex_init (&driver->clock_sync_lock, 0); pthread_mutex_init (&driver->clock_sync_lock, 0);
driver->clock_sync_listeners = 0; driver->clock_sync_listeners = 0;
@@ -1595,6 +1604,7 @@ alsa PCM driver args:
-C (capture, default: duplex) -C (capture, default: duplex)
-P (playback, default: duplex) -P (playback, default: duplex)
-z[r|t|s|-] (dither, rect|tri|shaped|off, default: off) -z[r|t|s|-] (dither, rect|tri|shaped|off, default: off)
-s soft-mode, no xrun handling (default: off)
"); ");
} }


@@ -1608,6 +1618,7 @@ driver_initialize (int argc, char **argv)
int hw_monitoring = FALSE; int hw_monitoring = FALSE;
int capture = FALSE; int capture = FALSE;
int playback = FALSE; int playback = FALSE;
int soft_mode = FALSE;
DitherAlgorithm dither = None; DitherAlgorithm dither = None;
int i; int i;


@@ -1653,7 +1664,7 @@ driver_initialize (int argc, char **argv)
break; break;
case 'H': case 'H':
hw_monitoring = 1;
hw_monitoring = TRUE;
break; break;


case 'z': case 'z':
@@ -1676,6 +1687,11 @@ driver_initialize (int argc, char **argv)
break; break;
} }
break; break;

case 's':
soft_mode = TRUE;
break;

default: default:
alsa_usage (); alsa_usage ();
@@ -1696,7 +1712,7 @@ driver_initialize (int argc, char **argv)


return alsa_driver_new ("alsa_pcm", pcm_name, frames_per_interrupt, return alsa_driver_new ("alsa_pcm", pcm_name, frames_per_interrupt,
user_nperiods, srate, hw_monitoring, capture, user_nperiods, srate, hw_monitoring, capture,
playback, dither);
playback, dither, soft_mode);
} }


void void


+ 1
- 1
jackd/engine.c View File

@@ -1677,7 +1677,7 @@ jack_main_thread (void *arg)


#define WORK_SCALE 1.0f #define WORK_SCALE 1.0f


if (engine->spare_usecs && ((WORK_SCALE * engine->spare_usecs) <= delayed_usecs)) {
if (engine->control->real_time != 0 && engine->spare_usecs && ((WORK_SCALE * engine->spare_usecs) <= delayed_usecs)) {
printf ("delay of %.3f usecs exceeds estimated spare time of %.3f; restart ...\n", printf ("delay of %.3f usecs exceeds estimated spare time of %.3f; restart ...\n",
delayed_usecs, WORK_SCALE * engine->spare_usecs); delayed_usecs, WORK_SCALE * engine->spare_usecs);


Loading…
Cancel
Save