chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge config aliasing bug fix.
[disorder]
/
lib
/
uaudio-oss.c
diff --git
a/lib/uaudio-oss.c
b/lib/uaudio-oss.c
index d4c3711561c1eb0e678080dd89ad8fefa6d2a6c1..6d902cb60108225a77c4624dce52c7a1cfafe250 100644
(file)
--- a/
lib/uaudio-oss.c
+++ b/
lib/uaudio-oss.c
@@
-32,6
+32,7
@@
#include "mem.h"
#include "log.h"
#include "uaudio.h"
#include "mem.h"
#include "log.h"
#include "uaudio.h"
+#include "configuration.h"
#ifndef AFMT_U16_NE
# if BYTE_ORDER == BIG_ENDIAN
#ifndef AFMT_U16_NE
# if BYTE_ORDER == BIG_ENDIAN
@@
-127,13
+128,15
@@
static void oss_start(uaudio_callback *callback,
/* Very specific buffer size requirements here apparently */
uaudio_thread_start(callback, userdata, oss_play,
4608 / uaudio_sample_size,
/* Very specific buffer size requirements here apparently */
uaudio_thread_start(callback, userdata, oss_play,
4608 / uaudio_sample_size,
- 4608 / uaudio_sample_size);
+ 4608 / uaudio_sample_size,
+ 0);
#else
/* We could SNDCTL_DSP_GETBLKSIZE but only when the device is already open,
* which is kind of inconvenient. We go with 1-4Kbyte for now. */
uaudio_thread_start(callback, userdata, oss_play,
32 / uaudio_sample_size,
#else
/* We could SNDCTL_DSP_GETBLKSIZE but only when the device is already open,
* which is kind of inconvenient. We go with 1-4Kbyte for now. */
uaudio_thread_start(callback, userdata, oss_play,
32 / uaudio_sample_size,
- 4096 / uaudio_sample_size);
+ 4096 / uaudio_sample_size,
+ 0);
#endif
}
#endif
}
@@
-145,11
+148,11
@@
static void oss_stop(void) {
static const char *oss_channels[] = SOUND_DEVICE_NAMES;
static int oss_mixer_find_channel(const char *channel) {
static const char *oss_channels[] = SOUND_DEVICE_NAMES;
static int oss_mixer_find_channel(const char *channel) {
- if(!channel[strspn(c, "0123456789")])
+ if(!channel[strspn(c
hannel
, "0123456789")])
return atoi(channel);
else {
return atoi(channel);
else {
- for(
int
n = 0; n < sizeof oss_channels / sizeof *oss_channels; ++n)
- if(!strcmp(oss_channels[n], channel
s
))
+ for(
unsigned
n = 0; n < sizeof oss_channels / sizeof *oss_channels; ++n)
+ if(!strcmp(oss_channels[n], channel))
return n;
return -1;
}
return n;
return -1;
}
@@
-175,7
+178,7
@@
static void oss_get_volume(int *left, int *right) {
int r;
*left = *right = 0;
int r;
*left = *right = 0;
- if(ioctl(oss_mixer_fd, SOUND_MIXER_READ(
ch
), &r) < 0)
+ if(ioctl(oss_mixer_fd, SOUND_MIXER_READ(
oss_mixer_channel
), &r) < 0)
error(errno, "error getting volume");
else {
*left = r & 0xff;
error(errno, "error getting volume");
else {
*left = r & 0xff;
@@
-185,9
+188,9
@@
static void oss_get_volume(int *left, int *right) {
static void oss_set_volume(int *left, int *right) {
int r = (*left & 0xff) + (*right & 0xff) * 256;
static void oss_set_volume(int *left, int *right) {
int r = (*left & 0xff) + (*right & 0xff) * 256;
- if(ioctl(
fd, SOUND_MIXER_WRITE(ch
), &r) == -1)
+ if(ioctl(
oss_mixer_fd, SOUND_MIXER_WRITE(oss_mixer_channel
), &r) == -1)
error(errno, "error setting volume");
error(errno, "error setting volume");
- else if(ioctl(oss_mixer_fd, SOUND_MIXER_READ(
ch
), &r) < 0)
+ else if(ioctl(oss_mixer_fd, SOUND_MIXER_READ(
oss_mixer_channel
), &r) < 0)
error(errno, "error getting volume");
else {
*left = r & 0xff;
error(errno, "error getting volume");
else {
*left = r & 0xff;
@@
-195,6
+198,12
@@
static void oss_set_volume(int *left, int *right) {
}
}
}
}
+static void oss_configure(void) {
+ uaudio_set("device", config->device);
+ uaudio_set("mixer-device", config->mixer);
+ uaudio_set("mixer-channel", config->channel);
+}
+
const struct uaudio uaudio_oss = {
.name = "oss",
.options = oss_options,
const struct uaudio uaudio_oss = {
.name = "oss",
.options = oss_options,
@@
-206,6
+215,7
@@
const struct uaudio uaudio_oss = {
.close_mixer = oss_close_mixer,
.get_volume = oss_get_volume,
.set_volume = oss_set_volume,
.close_mixer = oss_close_mixer,
.get_volume = oss_get_volume,
.set_volume = oss_set_volume,
+ .configure = oss_configure,
};
#endif
};
#endif