2006-01-09 11:22:36 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 by Nick Lanham
|
2010-05-15 21:02:47 +00:00
|
|
|
* Copyright (C) 2010 by Thomas Martitz
|
2006-01-09 11:22:36 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-01-09 11:22:36 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "autoconf.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2006-02-13 21:46:28 +00:00
|
|
|
#include <stdbool.h>
|
2010-05-15 21:02:47 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include "config.h"
|
|
|
|
#include "debug.h"
|
2006-01-09 11:22:36 +00:00
|
|
|
#include "sound.h"
|
2010-04-25 22:54:58 +00:00
|
|
|
#include "audiohw.h"
|
2010-05-15 21:02:47 +00:00
|
|
|
#include "system.h"
|
2011-06-29 06:37:04 +00:00
|
|
|
#include "panic.h"
|
2007-05-04 15:39:01 +00:00
|
|
|
|
2010-07-04 13:37:52 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
#include "audiohw.h"
|
2010-07-04 13:50:16 +00:00
|
|
|
#ifdef HAVE_SPDIF_IN
|
|
|
|
#include "spdif.h"
|
|
|
|
#endif
|
2010-07-04 13:37:52 +00:00
|
|
|
#endif
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
#include "pcm.h"
|
2011-06-29 06:37:04 +00:00
|
|
|
#include "pcm-internal.h"
|
2007-05-04 15:14:56 +00:00
|
|
|
#include "pcm_sampr.h"
|
2006-02-13 21:46:28 +00:00
|
|
|
|
2010-05-17 21:43:06 +00:00
|
|
|
/*#define LOGF_ENABLE*/
|
|
|
|
#include "logf.h"
|
|
|
|
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
#include <stdio.h>
|
|
|
|
extern bool debug_audio;
|
|
|
|
#endif
|
2010-05-04 14:41:30 +00:00
|
|
|
|
2010-04-25 22:54:58 +00:00
|
|
|
static int sim_volume = 0;
|
|
|
|
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2007-05-04 15:14:56 +00:00
|
|
|
static int cvt_status = -1;
|
2006-01-09 11:22:36 +00:00
|
|
|
|
2006-02-13 21:46:28 +00:00
|
|
|
static Uint8* pcm_data;
|
2006-03-22 16:04:01 +00:00
|
|
|
static size_t pcm_data_size;
|
2007-05-04 15:14:56 +00:00
|
|
|
static size_t pcm_sample_bytes;
|
|
|
|
static size_t pcm_channel_bytes;
|
|
|
|
|
2010-05-17 21:43:06 +00:00
|
|
|
static struct pcm_udata
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
|
|
|
Uint8 *stream;
|
|
|
|
Uint32 num_in;
|
|
|
|
Uint32 num_out;
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
2007-05-04 15:14:56 +00:00
|
|
|
FILE *debug;
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2007-05-04 15:14:56 +00:00
|
|
|
} udata;
|
2006-01-09 11:22:36 +00:00
|
|
|
|
2007-01-05 10:30:18 +00:00
|
|
|
static SDL_AudioSpec obtained;
|
|
|
|
static SDL_AudioCVT cvt;
|
2011-06-29 06:37:04 +00:00
|
|
|
static int audio_locked = 0;
|
|
|
|
static SDL_mutex *audio_lock;
|
2007-01-05 10:30:18 +00:00
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_play_lock(void)
|
|
|
|
{
|
2011-06-29 06:37:04 +00:00
|
|
|
if (++audio_locked == 1)
|
|
|
|
SDL_LockMutex(audio_lock);
|
2007-10-06 22:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pcm_play_unlock(void)
|
|
|
|
{
|
2011-06-29 06:37:04 +00:00
|
|
|
if (--audio_locked == 0)
|
|
|
|
SDL_UnlockMutex(audio_lock);
|
2007-10-06 22:27:27 +00:00
|
|
|
}
|
|
|
|
|
2008-12-12 11:01:07 +00:00
|
|
|
static void pcm_dma_apply_settings_nolock(void)
|
2006-01-09 11:22:36 +00:00
|
|
|
{
|
2008-12-12 11:01:07 +00:00
|
|
|
cvt_status = SDL_BuildAudioCVT(&cvt, AUDIO_S16SYS, 2, pcm_sampr,
|
2007-05-04 15:14:56 +00:00
|
|
|
obtained.format, obtained.channels, obtained.freq);
|
|
|
|
|
|
|
|
if (cvt_status < 0) {
|
2008-12-12 11:01:07 +00:00
|
|
|
cvt.len_ratio = (double)obtained.freq / (double)pcm_sampr;
|
2007-05-04 15:14:56 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-13 21:46:28 +00:00
|
|
|
|
2008-12-12 11:01:07 +00:00
|
|
|
void pcm_dma_apply_settings(void)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
2007-10-06 22:27:27 +00:00
|
|
|
pcm_play_lock();
|
2008-12-12 11:01:07 +00:00
|
|
|
pcm_dma_apply_settings_nolock();
|
2007-10-06 22:27:27 +00:00
|
|
|
pcm_play_unlock();
|
2007-05-04 15:14:56 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_play_dma_start(const void *addr, size_t size)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
2008-12-12 11:01:07 +00:00
|
|
|
pcm_dma_apply_settings_nolock();
|
2007-05-04 15:14:56 +00:00
|
|
|
|
2006-02-13 21:46:28 +00:00
|
|
|
pcm_data = (Uint8 *) addr;
|
|
|
|
pcm_data_size = size;
|
|
|
|
|
|
|
|
SDL_PauseAudio(0);
|
2006-01-09 11:22:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_play_dma_stop(void)
|
2006-01-09 11:22:36 +00:00
|
|
|
{
|
2006-02-13 21:46:28 +00:00
|
|
|
SDL_PauseAudio(1);
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
2009-06-17 07:55:50 +00:00
|
|
|
if (udata.debug != NULL) {
|
|
|
|
fclose(udata.debug);
|
|
|
|
udata.debug = NULL;
|
|
|
|
DEBUGF("Audio debug file closed\n");
|
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2006-01-09 11:22:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_play_dma_pause(bool pause)
|
2006-01-09 11:22:36 +00:00
|
|
|
{
|
2007-10-06 22:27:27 +00:00
|
|
|
if (pause)
|
|
|
|
SDL_PauseAudio(1);
|
|
|
|
else
|
|
|
|
SDL_PauseAudio(0);
|
2006-02-13 21:46:28 +00:00
|
|
|
}
|
2006-01-09 11:22:36 +00:00
|
|
|
|
2006-02-13 21:46:28 +00:00
|
|
|
size_t pcm_get_bytes_waiting(void)
|
|
|
|
{
|
|
|
|
return pcm_data_size;
|
|
|
|
}
|
2006-01-13 13:38:31 +00:00
|
|
|
|
2010-05-17 21:43:06 +00:00
|
|
|
static void write_to_soundcard(struct pcm_udata *udata)
|
2010-05-15 21:02:47 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2009-06-17 07:55:50 +00:00
|
|
|
if (debug_audio && (udata->debug == NULL)) {
|
|
|
|
udata->debug = fopen("audiodebug.raw", "ab");
|
|
|
|
DEBUGF("Audio debug file open\n");
|
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2007-01-05 10:30:18 +00:00
|
|
|
if (cvt.needed) {
|
2007-05-04 15:14:56 +00:00
|
|
|
Uint32 rd = udata->num_in;
|
|
|
|
Uint32 wr = (double)rd * cvt.len_ratio;
|
2007-01-05 10:30:18 +00:00
|
|
|
|
2007-05-04 15:14:56 +00:00
|
|
|
if (wr > udata->num_out) {
|
|
|
|
wr = udata->num_out;
|
|
|
|
rd = (double)wr / cvt.len_ratio;
|
2007-01-05 10:30:18 +00:00
|
|
|
|
2007-05-04 15:14:56 +00:00
|
|
|
if (rd > udata->num_in)
|
|
|
|
{
|
|
|
|
rd = udata->num_in;
|
|
|
|
wr = (double)rd * cvt.len_ratio;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wr == 0 || rd == 0)
|
|
|
|
{
|
|
|
|
udata->num_out = udata->num_in = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cvt_status > 0) {
|
|
|
|
cvt.len = rd * pcm_sample_bytes;
|
|
|
|
cvt.buf = (Uint8 *) malloc(cvt.len * cvt.len_mult);
|
|
|
|
|
|
|
|
memcpy(cvt.buf, pcm_data, cvt.len);
|
|
|
|
|
|
|
|
SDL_ConvertAudio(&cvt);
|
2007-07-31 11:41:42 +00:00
|
|
|
SDL_MixAudio(udata->stream, cvt.buf, cvt.len_cvt, sim_volume);
|
2007-05-04 15:14:56 +00:00
|
|
|
|
|
|
|
udata->num_in = cvt.len / pcm_sample_bytes;
|
|
|
|
udata->num_out = cvt.len_cvt / pcm_sample_bytes;
|
|
|
|
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
2007-05-04 15:14:56 +00:00
|
|
|
if (udata->debug != NULL) {
|
|
|
|
fwrite(cvt.buf, sizeof(Uint8), cvt.len_cvt, udata->debug);
|
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2007-05-04 15:14:56 +00:00
|
|
|
free(cvt.buf);
|
2007-01-05 10:30:18 +00:00
|
|
|
}
|
2007-05-04 15:14:56 +00:00
|
|
|
else {
|
|
|
|
/* Convert is bad, so do silence */
|
|
|
|
Uint32 num = wr*obtained.channels;
|
|
|
|
udata->num_in = rd;
|
|
|
|
udata->num_out = wr;
|
|
|
|
|
|
|
|
switch (pcm_channel_bytes)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
Uint8 *stream = udata->stream;
|
|
|
|
while (num-- > 0)
|
|
|
|
*stream++ = obtained.silence;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
Uint16 *stream = (Uint16 *)udata->stream;
|
|
|
|
while (num-- > 0)
|
|
|
|
*stream++ = obtained.silence;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
2007-05-04 15:14:56 +00:00
|
|
|
if (udata->debug != NULL) {
|
|
|
|
fwrite(udata->stream, sizeof(Uint8), wr, udata->debug);
|
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2007-05-04 15:14:56 +00:00
|
|
|
}
|
2007-01-05 10:30:18 +00:00
|
|
|
} else {
|
2007-05-04 15:14:56 +00:00
|
|
|
udata->num_in = udata->num_out = MIN(udata->num_in, udata->num_out);
|
2007-07-31 11:41:42 +00:00
|
|
|
SDL_MixAudio(udata->stream, pcm_data,
|
|
|
|
udata->num_out * pcm_sample_bytes, sim_volume);
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
2007-05-04 15:14:56 +00:00
|
|
|
if (udata->debug != NULL) {
|
|
|
|
fwrite(pcm_data, sizeof(Uint8), udata->num_out * pcm_sample_bytes,
|
|
|
|
udata->debug);
|
2007-01-05 10:30:18 +00:00
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2007-01-05 10:30:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-17 21:43:06 +00:00
|
|
|
static void sdl_audio_callback(struct pcm_udata *udata, Uint8 *stream, int len)
|
2006-02-13 21:46:28 +00:00
|
|
|
{
|
2010-05-17 21:43:06 +00:00
|
|
|
logf("sdl_audio_callback: len %d, pcm %d\n", len, pcm_data_size);
|
2011-06-29 06:37:04 +00:00
|
|
|
|
|
|
|
bool new_buffer = false;
|
2007-05-04 15:14:56 +00:00
|
|
|
udata->stream = stream;
|
2006-02-13 21:46:28 +00:00
|
|
|
|
2011-06-29 06:37:04 +00:00
|
|
|
SDL_LockMutex(audio_lock);
|
|
|
|
|
2007-01-05 10:30:18 +00:00
|
|
|
/* Write what we have in the PCM buffer */
|
2007-05-04 15:14:56 +00:00
|
|
|
if (pcm_data_size > 0)
|
|
|
|
goto start;
|
2006-02-21 21:48:06 +00:00
|
|
|
|
2007-01-05 10:30:18 +00:00
|
|
|
/* Audio card wants more? Get some more then. */
|
|
|
|
while (len > 0) {
|
2011-06-29 06:37:04 +00:00
|
|
|
new_buffer = true;
|
2010-05-24 16:57:48 +00:00
|
|
|
pcm_play_get_more_callback((void **)&pcm_data, &pcm_data_size);
|
2007-05-04 15:14:56 +00:00
|
|
|
start:
|
2010-05-24 16:42:32 +00:00
|
|
|
if (pcm_data_size != 0) {
|
2007-05-04 15:14:56 +00:00
|
|
|
udata->num_in = pcm_data_size / pcm_sample_bytes;
|
|
|
|
udata->num_out = len / pcm_sample_bytes;
|
|
|
|
|
|
|
|
write_to_soundcard(udata);
|
|
|
|
|
|
|
|
udata->num_in *= pcm_sample_bytes;
|
|
|
|
udata->num_out *= pcm_sample_bytes;
|
|
|
|
|
2011-06-29 06:37:04 +00:00
|
|
|
|
|
|
|
if (new_buffer)
|
|
|
|
{
|
|
|
|
new_buffer = false;
|
|
|
|
pcm_play_dma_started_callback();
|
|
|
|
|
|
|
|
if ((size_t)len > udata->num_out)
|
|
|
|
{
|
|
|
|
int delay = pcm_data_size*250 / pcm_sampr - 1;
|
|
|
|
|
|
|
|
if (delay > 0)
|
|
|
|
{
|
|
|
|
SDL_UnlockMutex(audio_lock);
|
|
|
|
SDL_Delay(delay);
|
|
|
|
SDL_LockMutex(audio_lock);
|
|
|
|
|
|
|
|
if (!pcm_is_playing())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-04 15:14:56 +00:00
|
|
|
pcm_data += udata->num_in;
|
|
|
|
pcm_data_size -= udata->num_in;
|
|
|
|
udata->stream += udata->num_out;
|
|
|
|
len -= udata->num_out;
|
2006-03-11 10:22:20 +00:00
|
|
|
} else {
|
|
|
|
DEBUGF("sdl_audio_callback: No Data.\n");
|
|
|
|
break;
|
2006-02-21 21:48:06 +00:00
|
|
|
}
|
2006-02-22 22:45:10 +00:00
|
|
|
}
|
2011-06-29 06:37:04 +00:00
|
|
|
|
|
|
|
SDL_UnlockMutex(audio_lock);
|
2006-02-13 21:46:28 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
const void * pcm_play_dma_get_peak_buffer(int *count)
|
|
|
|
{
|
|
|
|
uintptr_t addr = (uintptr_t)pcm_data;
|
|
|
|
*count = pcm_data_size / 4;
|
|
|
|
return (void *)((addr + 2) & ~3);
|
|
|
|
}
|
|
|
|
|
2007-05-04 15:14:56 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_rec_lock(void)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_rec_unlock(void)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_rec_dma_init(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void pcm_rec_dma_close(void)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_rec_dma_start(void *start, size_t size)
|
|
|
|
{
|
2007-10-07 06:13:05 +00:00
|
|
|
(void)start;
|
|
|
|
(void)size;
|
2007-10-06 22:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pcm_rec_dma_stop(void)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-07-04 13:37:52 +00:00
|
|
|
const void * pcm_rec_dma_get_peak_buffer(void)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
2010-07-04 13:37:52 +00:00
|
|
|
return NULL;
|
2007-05-04 15:14:56 +00:00
|
|
|
}
|
|
|
|
|
2010-07-04 13:37:52 +00:00
|
|
|
void audiohw_set_recvol(int left, int right, int type)
|
2007-05-04 15:14:56 +00:00
|
|
|
{
|
2010-07-04 13:37:52 +00:00
|
|
|
(void)left;
|
|
|
|
(void)right;
|
|
|
|
(void)type;
|
2007-05-04 15:14:56 +00:00
|
|
|
}
|
|
|
|
|
2010-07-04 13:50:16 +00:00
|
|
|
#ifdef HAVE_SPDIF_IN
|
|
|
|
unsigned long spdif_measure_frequency(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2010-07-04 13:37:52 +00:00
|
|
|
|
2007-05-04 15:14:56 +00:00
|
|
|
#endif /* HAVE_RECORDING */
|
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
void pcm_play_dma_init(void)
|
2006-02-13 21:46:28 +00:00
|
|
|
{
|
2010-05-15 21:02:47 +00:00
|
|
|
if (SDL_InitSubSystem(SDL_INIT_AUDIO))
|
|
|
|
{
|
|
|
|
DEBUGF("Could not initialize SDL audio subsystem!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-29 06:37:04 +00:00
|
|
|
audio_lock = SDL_CreateMutex();
|
|
|
|
|
|
|
|
if (!audio_lock)
|
|
|
|
{
|
|
|
|
panicf("Could not create audio_lock\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-01-05 10:30:18 +00:00
|
|
|
SDL_AudioSpec wanted_spec;
|
2010-05-15 21:02:47 +00:00
|
|
|
#ifdef DEBUG
|
2007-05-04 15:14:56 +00:00
|
|
|
udata.debug = NULL;
|
2006-02-21 21:48:06 +00:00
|
|
|
if (debug_audio) {
|
2007-05-04 15:14:56 +00:00
|
|
|
udata.debug = fopen("audiodebug.raw", "wb");
|
2009-06-17 07:55:50 +00:00
|
|
|
DEBUGF("Audio debug file open\n");
|
2006-02-21 21:48:06 +00:00
|
|
|
}
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif
|
2006-02-13 21:46:28 +00:00
|
|
|
/* Set 16-bit stereo audio at 44Khz */
|
2007-01-05 10:30:18 +00:00
|
|
|
wanted_spec.freq = 44100;
|
|
|
|
wanted_spec.format = AUDIO_S16SYS;
|
|
|
|
wanted_spec.channels = 2;
|
|
|
|
wanted_spec.samples = 2048;
|
2007-05-04 15:14:56 +00:00
|
|
|
wanted_spec.callback =
|
|
|
|
(void (SDLCALL *)(void *userdata,
|
|
|
|
Uint8 *stream, int len))sdl_audio_callback;
|
|
|
|
wanted_spec.userdata = &udata;
|
2006-02-13 21:46:28 +00:00
|
|
|
|
|
|
|
/* Open the audio device and start playing sound! */
|
2007-01-05 10:30:18 +00:00
|
|
|
if(SDL_OpenAudio(&wanted_spec, &obtained) < 0) {
|
2010-05-15 21:02:47 +00:00
|
|
|
DEBUGF("Unable to open audio: %s\n", SDL_GetError());
|
2007-10-06 22:27:27 +00:00
|
|
|
return;
|
2006-02-13 21:46:28 +00:00
|
|
|
}
|
2006-02-21 21:48:06 +00:00
|
|
|
|
2007-05-04 15:14:56 +00:00
|
|
|
switch (obtained.format)
|
|
|
|
{
|
|
|
|
case AUDIO_U8:
|
|
|
|
case AUDIO_S8:
|
|
|
|
pcm_channel_bytes = 1;
|
|
|
|
break;
|
|
|
|
case AUDIO_U16LSB:
|
|
|
|
case AUDIO_S16LSB:
|
|
|
|
case AUDIO_U16MSB:
|
|
|
|
case AUDIO_S16MSB:
|
|
|
|
pcm_channel_bytes = 2;
|
|
|
|
break;
|
|
|
|
default:
|
2010-05-15 21:02:47 +00:00
|
|
|
DEBUGF("Unknown sample format obtained: %u\n",
|
2007-05-04 15:14:56 +00:00
|
|
|
(unsigned)obtained.format);
|
2007-10-06 22:27:27 +00:00
|
|
|
return;
|
2007-05-04 15:14:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pcm_sample_bytes = obtained.channels * pcm_channel_bytes;
|
|
|
|
|
2008-12-12 11:01:07 +00:00
|
|
|
pcm_dma_apply_settings_nolock();
|
2006-01-09 11:22:36 +00:00
|
|
|
}
|
|
|
|
|
2011-09-01 12:15:43 +00:00
|
|
|
void pcm_play_dma_postinit(void)
|
2007-03-11 06:21:43 +00:00
|
|
|
{
|
|
|
|
}
|
2010-04-25 22:54:58 +00:00
|
|
|
|
2010-05-15 21:02:47 +00:00
|
|
|
void pcm_set_mixer_volume(int volume)
|
2010-04-25 22:54:58 +00:00
|
|
|
{
|
2010-05-15 21:02:47 +00:00
|
|
|
sim_volume = volume;
|
2010-04-25 22:54:58 +00:00
|
|
|
}
|
|
|
|
|
2010-05-15 21:02:47 +00:00
|
|
|
#endif /* CONFIG_CODEC == SWCODEC */
|