29 |
|
|
30 |
#include "rdesktop.h" |
#include "rdesktop.h" |
31 |
#include "rdpsnd.h" |
#include "rdpsnd.h" |
32 |
|
#include "rdpsnd_dsp.h" |
33 |
#include <unistd.h> |
#include <unistd.h> |
34 |
#include <fcntl.h> |
#include <fcntl.h> |
35 |
#include <errno.h> |
#include <errno.h> |
43 |
static int snd_rate; |
static int snd_rate; |
44 |
static short samplewidth; |
static short samplewidth; |
45 |
static char *dsp_dev; |
static char *dsp_dev; |
46 |
|
static struct audio_driver oss_driver; |
47 |
|
|
48 |
BOOL |
BOOL |
49 |
oss_open(void) |
oss_open(void) |
155 |
void |
void |
156 |
oss_volume(uint16 left, uint16 right) |
oss_volume(uint16 left, uint16 right) |
157 |
{ |
{ |
|
static BOOL use_dev_mixer = False; |
|
158 |
uint32 volume; |
uint32 volume; |
|
int fd_mix = -1; |
|
159 |
|
|
160 |
volume = left / (65536 / 100); |
volume = left / (65536 / 100); |
161 |
volume |= right / (65536 / 100) << 8; |
volume |= right / (65536 / 100) << 8; |
162 |
|
|
|
if (use_dev_mixer) |
|
|
{ |
|
|
if ((fd_mix = open("/dev/mixer", O_RDWR | O_NONBLOCK)) == -1) |
|
|
{ |
|
|
perror("open /dev/mixer"); |
|
|
return; |
|
|
} |
|
|
|
|
|
if (ioctl(fd_mix, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) |
|
|
{ |
|
|
perror("MIXER_WRITE(SOUND_MIXER_PCM)"); |
|
|
return; |
|
|
} |
|
|
|
|
|
close(fd_mix); |
|
|
} |
|
|
|
|
163 |
if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) |
if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) |
164 |
{ |
{ |
165 |
perror("MIXER_WRITE(SOUND_MIXER_PCM)"); |
perror("MIXER_WRITE(SOUND_MIXER_PCM)"); |
166 |
use_dev_mixer = True; |
oss_driver.wave_out_volume = rdpsnd_dsp_softvol_set; |
167 |
return; |
return; |
168 |
} |
} |
169 |
} |
} |
238 |
struct audio_driver * |
struct audio_driver * |
239 |
oss_register(char *options) |
oss_register(char *options) |
240 |
{ |
{ |
|
static struct audio_driver oss_driver; |
|
|
|
|
241 |
oss_driver.wave_out_write = rdpsnd_queue_write; |
oss_driver.wave_out_write = rdpsnd_queue_write; |
242 |
oss_driver.wave_out_open = oss_open; |
oss_driver.wave_out_open = oss_open; |
243 |
oss_driver.wave_out_close = oss_close; |
oss_driver.wave_out_close = oss_close; |
248 |
oss_driver.name = xstrdup("oss"); |
oss_driver.name = xstrdup("oss"); |
249 |
oss_driver.description = |
oss_driver.description = |
250 |
xstrdup("OSS output driver, default device: " DEFAULTDEVICE " or $AUDIODEV"); |
xstrdup("OSS output driver, default device: " DEFAULTDEVICE " or $AUDIODEV"); |
251 |
|
oss_driver.need_byteswap_on_be = 0; |
252 |
oss_driver.next = NULL; |
oss_driver.next = NULL; |
253 |
|
|
254 |
if (options) |
if (options) |