Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --enable-oss-cookedmode configure argument to force SNDCTL_DSP_COOKEDMODE=1 on OSS. #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,28 @@ AM_CONDITIONAL(HAVE_COREAUDIO, $HAVE_COREAUDIO)
AC_ARG_ENABLE(oss, AC_HELP_STRING([--disable-oss],[ignore OSS driver ]),
TRY_OSS=$enableval , TRY_OSS=yes )
HAVE_OSS="false"
USE_OSS_COOKEDMODE="false"
if test "x$TRY_OSS" = "xyes"
then
# check for Open Sound System
AC_CHECK_HEADER([sys/soundcard.h],
[HAVE_OSS="true"
JACK_DEFAULT_DRIVER=\"oss\"])

# enable OSS cookedmode to allow hardware with mismatching sample rates
if test "x$HAVE_OSS" = "xtrue"
then
AC_ARG_ENABLE(oss-cookedmode, AC_HELP_STRING([--enable-oss-cookedmode],[Enable cooked mode in OSS to accommodate hardware with mismatching sample rate]),
ENABLE_OSS_COOKEDMODE=$enableval, ENABLE_OSS_COOKEDMODE=no)
if test "x$ENABLE_OSS_COOKEDMODE" = "xyes"
then
USE_OSS_COOKEDMODE=true
AC_DEFINE(USE_OSS_COOKEDMODE, 1, [Enable cooked mode in OSS to accommodate hardware with mismatching sample rate])
fi
fi
fi
AM_CONDITIONAL(HAVE_OSS, $HAVE_OSS)
AM_CONDITIONAL(USE_OSS_COOKEDMODE, $USE_OSS_COOKEDMODE)

AC_ARG_ENABLE(sun, AC_HELP_STRING([--disable-sun],[ignore Sun driver ]),
TRY_SUN=$enableval , TRY_SUN=yes )
Expand Down Expand Up @@ -1008,6 +1022,7 @@ echo \| Build with ALSA support............................... : $HAVE_ALSA
echo \| Build with old FireWire \(FreeBob\) support............. : $HAVE_FREEBOB
echo \| Build with new FireWire \(FFADO\) support............... : $HAVE_FIREWIRE
echo \| Build with OSS support................................ : $HAVE_OSS
echo \| Enable OSS COOKEDMODE for hardware flexibility........ : $USE_OSS_COOKEDMODE
echo \| Build with Sun audio support.......................... : $HAVE_SUN
echo \| Build with Sndio audio support........................ : $HAVE_SNDIO
echo \| Build with CoreAudio support.......................... : $HAVE_COREAUDIO
Expand Down
16 changes: 10 additions & 6 deletions drivers/oss/oss_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,11 @@ static int oss_driver_detach (oss_driver_t *driver, jack_engine_t *engine)

static int oss_driver_start (oss_driver_t *driver)
{
int flags = 0;
#if defined(USE_OSS_COOKEDMODE)
int cookedmode = 1;
#else
int cookedmode = 0;
#endif
int format;
int channels;
int samplerate;
Expand Down Expand Up @@ -464,7 +468,7 @@ static int oss_driver_start (oss_driver_t *driver)
indev, __FILE__, __LINE__, errno);
}
#ifndef OSS_NO_COOKED_MODE
ioctl (infd, SNDCTL_DSP_COOKEDMODE, &flags);
ioctl (infd, SNDCTL_DSP_COOKEDMODE, &cookedmode);
#endif
fragsize = driver->period_size *
driver->capture_channels * samplesize;
Expand All @@ -479,7 +483,7 @@ static int oss_driver_start (oss_driver_t *driver)
outdev, __FILE__, __LINE__, errno);
}
#ifndef OSS_NO_COOKED_MODE
ioctl (outfd, SNDCTL_DSP_COOKEDMODE, &flags);
ioctl (outfd, SNDCTL_DSP_COOKEDMODE, &cookedmode);
#endif
fragsize = driver->period_size *
driver->playback_channels * samplesize;
Expand All @@ -497,7 +501,7 @@ static int oss_driver_start (oss_driver_t *driver)
return -1;
}
#ifndef OSS_NO_COOKED_MODE
ioctl (infd, SNDCTL_DSP_COOKEDMODE, &flags);
ioctl (infd, SNDCTL_DSP_COOKEDMODE, &cookedmode);
#endif
} else if (driver->capture_channels == 0 &&
driver->playback_channels != 0) {
Expand All @@ -510,7 +514,7 @@ static int oss_driver_start (oss_driver_t *driver)
return -1;
}
#ifndef OSS_NO_COOKED_MODE
ioctl (outfd, SNDCTL_DSP_COOKEDMODE, &flags);
ioctl (outfd, SNDCTL_DSP_COOKEDMODE, &cookedmode);
#endif
} else {
infd = outfd = open (indev, O_RDWR | O_EXCL);
Expand All @@ -521,7 +525,7 @@ static int oss_driver_start (oss_driver_t *driver)
return -1;
}
#ifndef OSS_NO_COOKED_MODE
ioctl (infd, SNDCTL_DSP_COOKEDMODE, &flags);
ioctl (infd, SNDCTL_DSP_COOKEDMODE, &cookedmode);
#endif
}
if (infd >= 0 && outfd >= 0) {
Expand Down