Fix bug: don't normalize or compress AC3 samples.

This commit is contained in:
Johns 2012-04-24 16:02:07 +02:00
parent 47d840bbff
commit 3b5c1adef2
2 changed files with 28 additions and 20 deletions

View File

@ -1,6 +1,8 @@
User johns User johns
Date: Date:
Release Version 0.5.1
Fix bug: don't normalize or compress pass-through samples.
Make audio ring buffer size a multiple of 3,5,7,8. Make audio ring buffer size a multiple of 3,5,7,8.
Add reset ring buffer support. Add reset ring buffer support.
Fix bug: alloca wrong size for audio buffer. Fix bug: alloca wrong size for audio buffer.

46
audio.c
View File

@ -3570,7 +3570,7 @@ void AudioEnqueue(const void *samples, int count)
int16_t *buffer; int16_t *buffer;
int frames; int frames;
#ifdef DEBUG #ifdef noDEBUG
static uint32_t last_tick; static uint32_t last_tick;
uint32_t tick; uint32_t tick;
@ -3585,28 +3585,34 @@ void AudioEnqueue(const void *samples, int count)
Debug(3, "audio: enqueue not ready\n"); Debug(3, "audio: enqueue not ready\n");
return; // no setup yet return; // no setup yet
} }
// if (AudioRing[AudioRingWrite].UseAc3) {
// Convert / resample input to hardware format buffer = (void*)samples;
// } else {
frames = //
count / (AudioRing[AudioRingWrite].InChannels * AudioBytesProSample); // Convert / resample input to hardware format
buffer = //
alloca(frames * AudioRing[AudioRingWrite].HwChannels * frames =
AudioBytesProSample); count / (AudioRing[AudioRingWrite].InChannels *
AudioResample(samples, AudioRing[AudioRingWrite].InChannels, frames, AudioBytesProSample);
buffer, AudioRing[AudioRingWrite].HwChannels); buffer =
alloca(frames * AudioRing[AudioRingWrite].HwChannels *
AudioBytesProSample);
AudioResample(samples, AudioRing[AudioRingWrite].InChannels, frames,
buffer, AudioRing[AudioRingWrite].HwChannels);
count = count =
frames * AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample; frames * AudioRing[AudioRingWrite].HwChannels *
AudioBytesProSample;
// resample into ring-buffer is too complex in the case of a roundabout // resample into ring-buffer is too complex in the case of a roundabout
// just use a temporary buffer // just use a temporary buffer
if (AudioCompression) { // in place operation if (AudioCompression) { // in place operation
AudioCompressor(buffer, count); AudioCompressor(buffer, count);
} }
if (AudioNormalize) { // in place operation if (AudioNormalize) { // in place operation
AudioNormalizer(buffer, count); AudioNormalizer(buffer, count);
}
} }
n = RingBufferWrite(AudioRing[AudioRingWrite].RingBuffer, buffer, count); n = RingBufferWrite(AudioRing[AudioRingWrite].RingBuffer, buffer, count);