Merge change 1131 into donut

* changes:
  fix issue 1641535: SoundPool should use AudioTrack with shared memory buffer
This commit is contained in:
Android (Google) Code Review
2009-05-07 07:46:42 -07:00

View File

@@ -18,7 +18,8 @@
#define LOG_TAG "SoundPool" #define LOG_TAG "SoundPool"
#include <utils/Log.h> #include <utils/Log.h>
//#define USE_SHARED_MEM_BUFFER //
#define USE_SHARED_MEM_BUFFER
// XXX needed for timing latency // XXX needed for timing latency
#include <utils/Timers.h> #include <utils/Timers.h>
@@ -507,10 +508,12 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV
frameCount = sample->size()/numChannels/((sample->format() == AudioSystem::PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t)); frameCount = sample->size()/numChannels/((sample->format() == AudioSystem::PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t));
} }
#ifndef USE_SHARED_MEM_BUFFER
// Ensure minimum audio buffer size in case of short looped sample // Ensure minimum audio buffer size in case of short looped sample
if(frameCount < kDefaultBufferCount * bufferFrames) { if(frameCount < kDefaultBufferCount * bufferFrames) {
frameCount = kDefaultBufferCount * bufferFrames; frameCount = kDefaultBufferCount * bufferFrames;
} }
#endif
AudioTrack* newTrack; AudioTrack* newTrack;