summaryrefslogtreecommitdiff
path: root/plugins/oss
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-09 18:09:41 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-09 18:09:41 +0200
commitc434654bd8739b077004e0fd216cabf55187543b (patch)
tree46b32ff63dce29b2413f03c590ba162229abba28 /plugins/oss
parent28a5fdf77fa3fdcf1d056a95258299283e9a1d66 (diff)
added ability to change oss device file (config file)
Diffstat (limited to 'plugins/oss')
-rw-r--r--plugins/oss/oss.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c
index 7d05727c..53ba8575 100644
--- a/plugins/oss/oss.c
+++ b/plugins/oss/oss.c
@@ -35,8 +35,8 @@
#include <stdlib.h>
#include "../../deadbeef.h"
-#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-//#define trace(fmt,...)
+//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+#define trace(fmt,...)
static DB_output_t plugin;
DB_functions_t *deadbeef;
@@ -64,10 +64,10 @@ oss_init (void) {
mutex = 0;
// prepare oss for playback
- const char *name = "/dev/dsp";
+ const char *name = deadbeef->conf_get_str ("oss.device", "/dev/dsp");
fd = open (name, O_WRONLY);
if (fd == -1) {
- trace ("oss: failed to open file\n");
+ fprintf (stderr, "oss: failed to open file %s\n", name);
perror (name);
plugin.free ();
return -1;
@@ -87,7 +87,7 @@ oss_init (void) {
int fmt = AFMT_S16_NE;
if (ioctl (fd, SNDCTL_DSP_SETFMT, &fmt) == -1) {
- trace ("oss: failed to set format\n");
+ fprintf (stderr, "oss: failed to set format\n");
perror ("SNDCTL_DSP_SETFMT");
plugin.free ();
return -1;
@@ -101,19 +101,19 @@ oss_init (void) {
int channels = 2;
if (ioctl (fd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
- trace ("oss: failed to set channels\n");
+ fprintf (stderr, "oss: failed to set channels\n");
perror ("SNDCTL_DSP_CHANNELS");
plugin.free ();
return -1;
}
if (channels != 2) {
- trace ("oss: device doesn't support stereo output\n");
+ fprintf (stderr, "oss: device doesn't support stereo output\n");
plugin.free ();
return -1;
}
if (ioctl (fd, SNDCTL_DSP_SPEED, &oss_rate) == -1) {
- trace ("oss: failed to set samplerate\n");
+ fprintf (stderr, "oss: failed to set samplerate\n");
perror ("SNDCTL_DSP_CHANNELS");
plugin.free ();
return -1;
@@ -138,7 +138,7 @@ oss_change_rate (int rate) {
}
deadbeef->mutex_lock (mutex);
if (ioctl (fd, SNDCTL_DSP_SPEED, &rate) == -1) {
- trace ("oss: can't switch to %d samplerate\n", rate);
+ fprintf (stderr, "oss: can't switch to %d samplerate\n", rate);
perror ("SNDCTL_DSP_CHANNELS");
plugin.free ();
return -1;