Commit 2ad999fe authored by sletz's avatar sletz
Browse files

Florian Faber patch for 32 bit float (LE only) support to jack's alsa driver.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2738 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 6701f1db
......@@ -16,12 +16,17 @@ Marc-Olivier Barre
Nedko Arnaudov
Fernando Lopez-Lezcano
Romain Moret
Florian Faber
---------------------------
Jackdmp changes log
---------------------------
2008-07-14 Stephane Letz <letz@grame.fr>
2008-07-25 Stephane Letz <letz@grame.fr>
* Florian Faber patch for 32 bit float (LE only) support to jack's alsa driver.
2008-07-24 Stephane Letz <letz@grame.fr>
* Fix server client OSX special notification mechanism, CoreAudio driver compilation back for 10.4.
......
......@@ -251,6 +251,18 @@ JackAlsaDriver::alsa_driver_hw_specific (alsa_driver_t *driver, int hw_monitorin
void
JackAlsaDriver::alsa_driver_setup_io_function_pointers (alsa_driver_t *driver)
{
if (SND_PCM_FORMAT_FLOAT_LE == driver->playback_sample_format) {
if (driver->playback_interleaved) {
driver->channel_copy = memcpy_interleave_d32_s32;
} else {
driver->channel_copy = memcpy_fake;
}
driver->read_via_copy = sample_move_floatLE_sSs;
driver->write_via_copy = sample_move_dS_floatLE;
return;
}
switch (driver->playback_sample_bytes) {
case 2:
if (driver->playback_interleaved) {
......@@ -396,6 +408,7 @@ JackAlsaDriver::alsa_driver_configure_stream (alsa_driver_t *driver, char *devic
int swapped;
}
formats[] = {
{"32bit float little-endian", SND_PCM_FORMAT_FLOAT_LE},
{"32bit little-endian", SND_PCM_FORMAT_S32_LE, IS_LE},
{"32bit big-endian", SND_PCM_FORMAT_S32_BE, IS_BE},
{"24bit little-endian", SND_PCM_FORMAT_S24_3LE, IS_LE},
......@@ -404,7 +417,7 @@ JackAlsaDriver::alsa_driver_configure_stream (alsa_driver_t *driver, char *devic
{"16bit big-endian", SND_PCM_FORMAT_S16_BE, IS_BE},
};
#define NUMFORMATS (sizeof(formats)/sizeof(formats[0]))
#define FIRST_16BIT_FORMAT 4
#define FIRST_16BIT_FORMAT 5
if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0) {
jack_error ("ALSA: no playback configurations available (%s)",
......@@ -778,6 +791,7 @@ JackAlsaDriver::alsa_driver_set_parameters (alsa_driver_t *driver,
if (driver->playback_handle) {
switch (driver->playback_sample_format) {
case SND_PCM_FORMAT_FLOAT_LE:
case SND_PCM_FORMAT_S32_LE:
case SND_PCM_FORMAT_S24_3LE:
case SND_PCM_FORMAT_S24_3BE:
......@@ -795,6 +809,7 @@ JackAlsaDriver::alsa_driver_set_parameters (alsa_driver_t *driver,
if (driver->capture_handle) {
switch (driver->capture_sample_format) {
case SND_PCM_FORMAT_FLOAT_LE:
case SND_PCM_FORMAT_S32_LE:
case SND_PCM_FORMAT_S24_3LE:
case SND_PCM_FORMAT_S24_3BE:
......
......@@ -54,6 +54,30 @@ inline unsigned int fast_rand() {
return seed;
}
/* functions for native float sample data */
void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) {
while (nsamples--) {
*dst = *((float *) src);
dst++;
src += src_skip;
}
}
void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) {
while (nsamples--) {
*((float *) dst) = *src;
dst += dst_skip;
src++;
}
}
/* functions for native integer sample data */
void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state)
{
......
......@@ -47,6 +47,11 @@ extern "C"
{
#endif
/* float functions */
void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
/* integer functions */
void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment