2004-02-24 18:06:14 +01:00
|
|
|
/* the Music Player Daemon (MPD)
|
2007-04-05 05:22:33 +02:00
|
|
|
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
|
2004-02-24 18:06:14 +01:00
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#ifndef PCM_UTILS_H
|
2006-07-26 19:41:03 +02:00
|
|
|
#define PCM_UTILS_H
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2004-03-18 04:29:25 +01:00
|
|
|
#include "../config.h"
|
|
|
|
|
2008-08-26 08:27:06 +02:00
|
|
|
#include "audio_format.h"
|
2008-01-03 08:29:49 +01:00
|
|
|
#include "os_compat.h"
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2007-05-24 23:15:37 +02:00
|
|
|
#ifdef HAVE_LIBSAMPLERATE
|
|
|
|
#include <samplerate.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct _ConvState {
|
|
|
|
#ifdef HAVE_LIBSAMPLERATE
|
|
|
|
SRC_STATE *state;
|
|
|
|
SRC_DATA data;
|
|
|
|
size_t dataInSize;
|
|
|
|
size_t dataOutSize;
|
|
|
|
mpd_sint8 lastChannels;
|
2008-04-12 06:15:10 +02:00
|
|
|
mpd_uint32 lastInSampleRate;
|
|
|
|
mpd_uint32 lastOutSampleRate;
|
2007-05-24 23:15:37 +02:00
|
|
|
#endif
|
2007-11-21 15:02:03 +01:00
|
|
|
/* Strict C99 doesn't allow empty structs */
|
|
|
|
int error;
|
2007-05-24 23:15:37 +02:00
|
|
|
} ConvState;
|
|
|
|
|
2008-04-15 07:56:35 +02:00
|
|
|
void pcm_volumeChange(char *buffer, int bufferSize, const AudioFormat * format,
|
2007-05-23 01:11:36 +02:00
|
|
|
int volume);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-04-12 06:07:11 +02:00
|
|
|
void pcm_mix(char *buffer1, const char *buffer2, size_t bufferSize1,
|
|
|
|
size_t bufferSize2, const AudioFormat * format, float portion1);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-04-15 07:56:35 +02:00
|
|
|
size_t pcm_convertAudioFormat(const AudioFormat * inFormat,
|
|
|
|
const char *inBuffer, size_t inSize,
|
|
|
|
const AudioFormat * outFormat,
|
2007-05-26 18:39:55 +02:00
|
|
|
char *outBuffer, ConvState *convState);
|
2004-05-10 16:06:23 +02:00
|
|
|
|
2008-04-12 06:07:11 +02:00
|
|
|
size_t pcm_sizeOfConvBuffer(const AudioFormat * inFormat, size_t inSize,
|
|
|
|
const AudioFormat * outFormat);
|
2004-02-24 00:41:20 +01:00
|
|
|
#endif
|