Merge "Fix indentation and whitespace"

This commit is contained in:
Glenn Kasten
2011-12-14 17:35:36 -08:00
committed by Android (Google) Code Review
5 changed files with 78 additions and 80 deletions

View File

@@ -106,7 +106,7 @@ class AudioTrackJniStorage {
#define AUDIOTRACK_ERROR_BAD_VALUE -2
#define AUDIOTRACK_ERROR_INVALID_OPERATION -3
#define AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM -16
#define AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK -17
#define AUDIOTRACK_ERROR_SETUP_INVALIDCHANNELMASK -17
#define AUDIOTRACK_ERROR_SETUP_INVALIDFORMAT -18
#define AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE -19
#define AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED -20

View File

@@ -449,7 +449,7 @@ public class AudioTrack
// AudioTrack subclasses too.
try {
stop();
} catch(IllegalStateException ise) {
} catch(IllegalStateException ise) {
// don't raise an exception, we're releasing the resources.
}
native_release();
@@ -488,7 +488,7 @@ public class AudioTrack
public int getSampleRate() {
return mSampleRate;
}
/**
* Returns the current playback rate in Hz.
*/
@@ -590,22 +590,22 @@ public class AudioTrack
static public int getNativeOutputSampleRate(int streamType) {
return native_get_output_sample_rate(streamType);
}
/**
* Returns the minimum buffer size required for the successful creation of an AudioTrack
* object to be created in the {@link #MODE_STREAM} mode. Note that this size doesn't
* guarantee a smooth playback under load, and higher values should be chosen according to
* the expected frequency at which the buffer will be refilled with additional data to play.
* the expected frequency at which the buffer will be refilled with additional data to play.
* @param sampleRateInHz the sample rate expressed in Hertz.
* @param channelConfig describes the configuration of the audio channels.
* @param channelConfig describes the configuration of the audio channels.
* See {@link AudioFormat#CHANNEL_OUT_MONO} and
* {@link AudioFormat#CHANNEL_OUT_STEREO}
* @param audioFormat the format in which the audio data is represented.
* See {@link AudioFormat#ENCODING_PCM_16BIT} and
* @param audioFormat the format in which the audio data is represented.
* See {@link AudioFormat#ENCODING_PCM_16BIT} and
* {@link AudioFormat#ENCODING_PCM_8BIT}
* @return {@link #ERROR_BAD_VALUE} if an invalid parameter was passed,
* or {@link #ERROR} if the implementation was unable to query the hardware for its output
* properties,
* or {@link #ERROR} if the implementation was unable to query the hardware for its output
* properties,
* or the minimum buffer size expressed in bytes.
*/
static public int getMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat) {
@@ -623,18 +623,18 @@ public class AudioTrack
loge("getMinBufferSize(): Invalid channel configuration.");
return AudioTrack.ERROR_BAD_VALUE;
}
if ((audioFormat != AudioFormat.ENCODING_PCM_16BIT)
if ((audioFormat != AudioFormat.ENCODING_PCM_16BIT)
&& (audioFormat != AudioFormat.ENCODING_PCM_8BIT)) {
loge("getMinBufferSize(): Invalid audio format.");
return AudioTrack.ERROR_BAD_VALUE;
}
if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) {
loge("getMinBufferSize(): " + sampleRateInHz +"Hz is not a supported sample rate.");
return AudioTrack.ERROR_BAD_VALUE;
}
int size = native_get_min_buff_size(sampleRateInHz, channelCount, audioFormat);
if ((size == -1) || (size == 0)) {
loge("getMinBufferSize(): error querying hardware");
@@ -667,7 +667,7 @@ public class AudioTrack
public void setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener listener) {
setPlaybackPositionUpdateListener(listener, null);
}
/**
* Sets the listener the AudioTrack notifies when a previously set marker is reached or
* for each periodic playback head position update.
@@ -676,7 +676,7 @@ public class AudioTrack
* @param listener
* @param handler the Handler that will receive the event notification messages.
*/
public void setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener listener,
public void setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener listener,
Handler handler) {
synchronized (mPositionListenerLock) {
mPositionListener = listener;
@@ -684,7 +684,7 @@ public class AudioTrack
if (listener != null) {
mEventHandlerDelegate = new NativeEventHandlerDelegate(this, handler);
}
}
@@ -917,7 +917,7 @@ public class AudioTrack
return ERROR_INVALID_OPERATION;
}
if ( (audioData == null) || (offsetInBytes < 0 ) || (sizeInBytes < 0)
if ( (audioData == null) || (offsetInBytes < 0 ) || (sizeInBytes < 0)
|| (offsetInBytes + sizeInBytes > audioData.length)) {
return ERROR_BAD_VALUE;
}
@@ -948,12 +948,12 @@ public class AudioTrack
&& (sizeInShorts > 0)) {
mState = STATE_INITIALIZED;
}
if (mState != STATE_INITIALIZED) {
return ERROR_INVALID_OPERATION;
}
if ( (audioData == null) || (offsetInShorts < 0 ) || (sizeInShorts < 0)
if ( (audioData == null) || (offsetInShorts < 0 ) || (sizeInShorts < 0)
|| (offsetInShorts + sizeInShorts > audioData.length)) {
return ERROR_BAD_VALUE;
}
@@ -1047,7 +1047,7 @@ public class AudioTrack
* by the playback head.
*/
void onMarkerReached(AudioTrack track);
/**
* Called on the listener to periodically notify it that the playback head has reached
* a multiple of the notification period.
@@ -1066,7 +1066,7 @@ public class AudioTrack
private class NativeEventHandlerDelegate {
private final AudioTrack mAudioTrack;
private final Handler mHandler;
NativeEventHandlerDelegate(AudioTrack track, Handler handler) {
mAudioTrack = track;
// find the looper for our new event handler
@@ -1077,7 +1077,7 @@ public class AudioTrack
// no given handler, use the looper the AudioTrack was created in
looper = mInitializationLooper;
}
// construct the event handler with this looper
if (looper != null) {
// implement the event handler delegate
@@ -1111,9 +1111,9 @@ public class AudioTrack
};
} else {
mHandler = null;
}
}
}
Handler getHandler() {
return mHandler;
}
@@ -1133,7 +1133,7 @@ public class AudioTrack
}
if (track.mEventHandlerDelegate != null) {
Message m =
Message m =
track.mEventHandlerDelegate.getHandler().obtainMessage(what, arg1, arg2, obj);
track.mEventHandlerDelegate.getHandler().sendMessage(m);
}

View File

@@ -1467,4 +1467,3 @@ bool audio_track_cblk_t::tryLock()
// -------------------------------------------------------------------------
}; // namespace android

View File

@@ -1973,7 +1973,7 @@ bool AudioFlinger::MixerThread::threadLoop()
// during mixing and effect process as the audio buffers could be deleted
// or modified if an effect is created or deleted
lockEffectChains_l(effectChains);
}
}
if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) {
// mix buffers...
@@ -2018,11 +2018,11 @@ bool AudioFlinger::MixerThread::threadLoop()
}
// sleepTime == 0 means we must write to audio hardware
if (sleepTime == 0) {
for (size_t i = 0; i < effectChains.size(); i ++) {
effectChains[i]->process_l();
}
// enable changes in effect chain
unlockEffectChains(effectChains);
for (size_t i = 0; i < effectChains.size(); i ++) {
effectChains[i]->process_l();
}
// enable changes in effect chain
unlockEffectChains(effectChains);
mLastWriteTime = systemTime();
mInWrite = true;
mBytesWritten += mixBufferSize;

View File

@@ -84,19 +84,19 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate)
}
}
AudioMixer::~AudioMixer()
{
track_t* t = mState.tracks;
for (int i=0 ; i<32 ; i++) {
delete t->resampler;
t++;
}
delete [] mState.outputTemp;
delete [] mState.resampleTemp;
}
AudioMixer::~AudioMixer()
{
track_t* t = mState.tracks;
for (int i=0 ; i<32 ; i++) {
delete t->resampler;
t++;
}
delete [] mState.outputTemp;
delete [] mState.resampleTemp;
}
int AudioMixer::getTrackName()
{
int AudioMixer::getTrackName()
{
uint32_t names = mTrackNames;
uint32_t mask = 1;
int n = 0;
@@ -110,18 +110,18 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate)
return TRACK0 + n;
}
return -1;
}
}
void AudioMixer::invalidateState(uint32_t mask)
{
void AudioMixer::invalidateState(uint32_t mask)
{
if (mask) {
mState.needsChanged |= mask;
mState.hook = process__validate;
}
}
void AudioMixer::deleteTrackName(int name)
{
void AudioMixer::deleteTrackName(int name)
{
name -= TRACK0;
if (uint32_t(name) < MAX_NUM_TRACKS) {
ALOGV("deleteTrackName(%d)", name);
@@ -141,7 +141,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate)
track.volumeInc[1] = 0;
mTrackNames &= ~(1<<name);
}
}
}
status_t AudioMixer::enable(int name)
{
@@ -456,33 +456,33 @@ void AudioMixer::process__validate(state_t* state)
countActiveTracks, state->enabledTracks,
all16BitsStereoNoResample, resampling, volumeRamp);
state->hook(state);
state->hook(state);
// Now that the volume ramp has been done, set optimal state and
// track hooks for subsequent mixer process
if (countActiveTracks) {
int allMuted = 1;
uint32_t en = state->enabledTracks;
while (en) {
const int i = 31 - __builtin_clz(en);
en &= ~(1<<i);
track_t& t = state->tracks[i];
if (!t.doesResample() && t.volumeRL == 0)
{
t.needs |= NEEDS_MUTE_ENABLED;
t.hook = track__nop;
} else {
allMuted = 0;
}
}
if (allMuted) {
state->hook = process__nop;
} else if (all16BitsStereoNoResample) {
if (countActiveTracks == 1) {
state->hook = process__OneTrack16BitsStereoNoResampling;
}
}
}
// Now that the volume ramp has been done, set optimal state and
// track hooks for subsequent mixer process
if (countActiveTracks) {
int allMuted = 1;
uint32_t en = state->enabledTracks;
while (en) {
const int i = 31 - __builtin_clz(en);
en &= ~(1<<i);
track_t& t = state->tracks[i];
if (!t.doesResample() && t.volumeRL == 0)
{
t.needs |= NEEDS_MUTE_ENABLED;
t.hook = track__nop;
} else {
allMuted = 0;
}
}
if (allMuted) {
state->hook = process__nop;
} else if (all16BitsStereoNoResample) {
if (countActiveTracks == 1) {
state->hook = process__OneTrack16BitsStereoNoResampling;
}
}
}
}
static inline
@@ -999,7 +999,7 @@ void AudioMixer::process__genericNoResampling(state_t* state)
}
// generic code with resampling
// generic code with resampling
void AudioMixer::process__genericResampling(state_t* state)
{
int32_t* const outTemp = state->outputTemp;
@@ -1179,7 +1179,7 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state)
}
in1 = buff;
b1.frameCount = numFrames;
} else {
} else {
in1 = b1.i16;
}
frameCount1 = b1.frameCount;
@@ -1221,4 +1221,3 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state)
// ----------------------------------------------------------------------------
}; // namespace android