mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
spark: fix cAudio::PrepareClipPlay
this makes the neutrino audioplayer work fine ;-)
Origin commit data
------------------
Branch: master
Commit: e8f63b0bf4
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-02-18 (Sat, 18 Feb 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -98,18 +98,16 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
|
|||||||
|
|
||||||
volume = (left + right) / 2;
|
volume = (left + right) / 2;
|
||||||
int v = map_volume(volume);
|
int v = map_volume(volume);
|
||||||
#if 0
|
|
||||||
if (clipfd != -1 && mixer_fd != -1) {
|
if (clipfd != -1 && mixer_fd != -1) {
|
||||||
int tmp = 0;
|
int tmp = 0;
|
||||||
/* not sure if left / right is correct here, but it is always the same anyways ;-) */
|
/* not sure if left / right is correct here, but it is always the same anyways ;-) */
|
||||||
if (! Muted)
|
if (! Muted)
|
||||||
tmp = left << 8 | right;
|
tmp = left << 8 | right;
|
||||||
ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp);
|
int ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp);
|
lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
char str[4];
|
char str[4];
|
||||||
sprintf(str, "%d", v);
|
sprintf(str, "%d", v);
|
||||||
|
|
||||||
@@ -206,25 +204,22 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
|||||||
mixer_num = -1;
|
mixer_num = -1;
|
||||||
mixer_fd = -1;
|
mixer_fd = -1;
|
||||||
/* a different DSP device can be given with DSP_DEVICE and MIX_DEVICE
|
/* a different DSP device can be given with DSP_DEVICE and MIX_DEVICE
|
||||||
* if this device cannot be opened, we fall back to the internal TD OSS device
|
* if this device cannot be opened, we fall back to the internal OSS device
|
||||||
* Example:
|
* Example:
|
||||||
* modprobe ohci-hcd
|
* modprobe snd-usb-audio
|
||||||
* modprobe audio
|
* export DSP_DEVICE=/dev/sound/dsp2
|
||||||
* export DSP_DEVICE=/dev/sound/dsp1
|
* export MIX_DEVICE=/dev/sound/mixer2
|
||||||
* export MIX_DEVICE=/dev/sound/mixer1
|
|
||||||
* neutrino
|
* neutrino
|
||||||
*/
|
*/
|
||||||
if ((!dsp_dev) || (access(dsp_dev, W_OK))) {
|
if ((!dsp_dev) || (access(dsp_dev, W_OK))) {
|
||||||
if (dsp_dev)
|
if (dsp_dev)
|
||||||
lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened,"
|
lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened,"
|
||||||
" fall back to /dev/sound/dsp\n", __func__, dsp_dev);
|
" fall back to /dev/dsp1\n", __func__, dsp_dev);
|
||||||
dsp_dev = "/dev/sound/dsp";
|
dsp_dev = "/dev/dsp1";
|
||||||
}
|
}
|
||||||
lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
|
lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
|
||||||
/* the tdoss dsp driver seems to work only on the second open(). really. */
|
/* the tdoss dsp driver seems to work only on the second open(). really. */
|
||||||
clipfd = open(dsp_dev, O_WRONLY);
|
clipfd = open(dsp_dev, O_WRONLY);
|
||||||
close(clipfd);
|
|
||||||
clipfd = open(dsp_dev, O_WRONLY);
|
|
||||||
if (clipfd < 0) {
|
if (clipfd < 0) {
|
||||||
lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__);
|
lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user