Reverting to the full lsr API. Turns out the simple API needs all of the

audio at once, so it won't work for us.  The old full API code was still
heavily broken, as each call to pcm_convertSampleRate() used the same
state, even if it was processing two streams of audio.  The new code keeps
a separate state for each audio stream that's being converted.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6255 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
J. Alexander Treuman
2007-05-24 21:15:37 +00:00
parent 7ba357a04e
commit 2814b7cfc6
7 changed files with 85 additions and 36 deletions
+20 -2
View File
@@ -25,14 +25,32 @@
#include <stdlib.h>
#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;
mpd_sint32 lastInSampleRate;
mpd_sint32 lastOutSampleRate;
int error;
#endif
} ConvState;
void pcm_volumeChange(char *buffer, int bufferSize, AudioFormat * format,
int volume);
void pcm_mix(char *buffer1, char *buffer2, size_t bufferSize1,
size_t bufferSize2, AudioFormat * format, float portion1);
void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer, size_t
inSize, AudioFormat * outFormat, char *outBuffer);
void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
size_t inSize, AudioFormat * outFormat,
char *outBuffer, ConvState *convState);
size_t pcm_sizeOfConvBuffer(AudioFormat * inFormat, size_t inSize,
AudioFormat * outFormat);