Browse Source

channel count/period fixes + ADDON_DIR from andy la-a-foe

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@10 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pbd 24 years ago
parent
commit
fbf3f3ba10
4 changed files with 33 additions and 15 deletions
  1. +4
    -0
      Makefile.am
  2. +24
    -14
      alsa_driver.c
  3. +4
    -0
      configure.in
  4. +1
    -1
      jackd.c

+ 4
- 0
Makefile.am View File

@@ -10,6 +10,10 @@ EXTRA_PROGRAMS = jack_fltk_client

bin_PROGRAMS = jackd jack_simple_client jack_monitor_client @XTRA@

EXTRA_CFLAGS = -DADDON_DIR=\"$(ADDON_DIR)\" @GLIB_CFLAGS@

CFLAGS += $(EXTRA_CFLAGS)

jackd_SOURCES = jackd.c
jackd_LDFLAGS = -L. -ljack -lltdl -lpthread



+ 24
- 14
alsa_driver.c View File

@@ -209,7 +209,7 @@ alsa_driver_configure_stream (alsa_driver_t *driver,
return -1;
}
}
if ((err = snd_pcm_hw_params_set_format (handle, hw_params, SND_PCM_FORMAT_S32_LE)) < 0) {
if ((err = snd_pcm_hw_params_set_format (handle, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
jack_error ("Sorry. The audio interface \"%s\""
@@ -226,21 +226,31 @@ alsa_driver_configure_stream (alsa_driver_t *driver,

*nchns = snd_pcm_hw_params_get_channels_max (hw_params);

if (*nchns > 1024) {
/* the hapless user is an unwitting victim of the "default"
ALSA PCM device, which can support up to 16 million
channels. since they can't be bothered to set up
a proper default device, limit the number of channels
for them to a sane default.
*/
*nchns = 2;
}

if ((err = snd_pcm_hw_params_set_channels (handle, hw_params, *nchns)) < 0) {
jack_error ("ALSA: cannot set channel count to %u for %s", *nchns, stream_name);
return -1;
}

if ((err = snd_pcm_hw_params_set_periods (handle, hw_params, 2, 0)) < 0) {
jack_error ("ALSA: cannot set fragment count minimum to 2 for %s", stream_name);
if ((err = snd_pcm_hw_params_set_period_size (handle, hw_params, driver->frames_per_cycle, 0)) < 0) {
jack_error ("ALSA: cannot set period size to %u frames for %s", driver->frames_per_cycle, stream_name);
return -1;
}

if ((err = snd_pcm_hw_params_set_period_size (handle, hw_params, driver->frames_per_cycle, 0)) < 0) {
jack_error ("ALSA: cannot set fragment length to %u for %s", stream_name);
if ((err = snd_pcm_hw_params_set_periods (handle, hw_params, 2, 0)) < 0) {
jack_error ("ALSA: cannot set number of periods to 2 for %s", stream_name);
return -1;
}
if ((err = snd_pcm_hw_params_set_buffer_size (handle, hw_params, 2 * driver->frames_per_cycle)) < 0) {
jack_error ("ALSA: cannot set buffer length to %u for %s", 2 * driver->frames_per_cycle, stream_name);
return -1;
@@ -300,22 +310,22 @@ alsa_driver_set_parameters (alsa_driver_t *driver, nframes_t frames_per_cycle, n

driver->frame_rate = rate;
driver->frames_per_cycle = frames_per_cycle;
if (alsa_driver_configure_stream (driver, "capture",
driver->capture_handle,
driver->capture_hw_params,
driver->capture_sw_params,
&driver->capture_nchannels)) {
jack_error ("ALSA-MCD: cannot configure capture channel");
jack_error ("ALSA: cannot configure capture channel");
return -1;
}
if (alsa_driver_configure_stream (driver, "playback",
driver->playback_handle,
driver->playback_hw_params,
driver->playback_sw_params,
&driver->playback_nchannels)) {
jack_error ("ALSA-MCD: cannot configure playback channel");
jack_error ("ALSA: cannot configure playback channel");
return -1;
}
@@ -708,7 +718,7 @@ alsa_driver_wait (alsa_driver_t *driver)
driver->time_at_interrupt = current_usecs();
if (driver->pfd.revents & POLLERR) {
jack_error ("ALSA-MCD: poll reports error.");
jack_error ("ALSA: poll reports error.");
return -1;
}
@@ -1139,7 +1149,7 @@ alsa_driver_new (char *name, char *alsa_device,
driver->playback_ports = 0;
if ((err = snd_pcm_open (&driver->playback_handle, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
jack_error ("ALSA-MCD: Cannot open PCM device %s/%s", name, alsa_device);
jack_error ("ALSA: Cannot open PCM device %s/%s", name, alsa_device);
free (driver);
return 0;
}
@@ -1147,7 +1157,7 @@ alsa_driver_new (char *name, char *alsa_device,
driver->alsa_name = strdup (alsa_device);

if ((err = snd_pcm_open (&driver->capture_handle, alsa_device, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
jack_error ("ALSA-MCD: Cannot open PCM device %s", name);
jack_error ("ALSA: Cannot open PCM device %s", name);
free (driver);
return 0;
}


+ 4
- 0
configure.in View File

@@ -54,6 +54,10 @@ AC_PROG_CXX
AC_PROG_LD
AM_PROG_LIBTOOL

ADDON_DIR=${libdir}

AC_SUBST(ADDON_DIR)

dnl check for the libraries we need

AC_OUTPUT(Makefile


+ 1
- 1
jackd.c View File

@@ -138,7 +138,7 @@ main (int argc, char *argv[])
return 1;
}

if ((driver = jack_driver_load ("/usr/local/lib/jack_alsa.so", alsa_pcm_name, frames_per_interrupt, srate)) == 0) {
if ((driver = jack_driver_load (ADDON_DIR "/jack_alsa.so", alsa_pcm_name, frames_per_interrupt, srate)) == 0) {
fprintf (stderr, "cannot load ALSA driver module\n");
return 1;
}


Loading…
Cancel
Save