aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/pcm.c b/src/pcm.c
index a45ce75..b185f5e 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -796,10 +796,22 @@ struct pcm *pcm_open(unsigned int card, unsigned int device,
int rc;
pcm = calloc(1, sizeof(struct pcm));
- if (!pcm || !config)
- return &bad_pcm; /* TODO: could support default config here */
-
- pcm->config = *config;
+ if (!pcm)
+ return &bad_pcm;
+
+ if (config == NULL) {
+ config = &pcm->config;
+ config->channels = 2;
+ config->rate = 48000;
+ config->period_size = 1024;
+ config->period_count = 4;
+ config->format = PCM_FORMAT_S16_LE;
+ config->start_threshold = config->period_count * config->period_size;
+ config->stop_threshold = config->period_count * config->period_size;
+ config->silence_threshold = 0;
+ } else {
+ pcm->config = *config;
+ }
snprintf(fn, sizeof(fn), "/dev/snd/pcmC%uD%u%c", card, device,
flags & PCM_IN ? 'c' : 'p');