<commit_before>package org.anddev.andengine.audio.sound;

import org.anddev.andengine.audio.BaseAudioEntity;

/**
 * @author <NAME>
 * @since 13:22:15 - 11.03.2010
 */
public class Sound extends BaseAudioEntity {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	private final int mSoundID;
	private int mStreamID = 0;

	private int mLoopCount = 0;
	private float mRate = 1.0f;

	// ===========================================================
	// Constructors
	// ===========================================================

	Sound(final SoundManager pSoundManager, final int pSoundID) {
		super(pSoundManager);
		this.mSoundID = pSoundID;
	}

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	public void setLoopCount(final int pLoopCount) {
		this.mLoopCount = pLoopCount;
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().setLoop(this.mStreamID, pLoopCount);
		}
	}

	public void setRate(final float pRate) {
		this.mRate  = pRate;
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().setRate(this.mStreamID, pRate);
		}
	}

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================

	// ===========================================================
	// Methods
	// ===========================================================

	@Override
	protected SoundManager getAudioManager() {
		return (SoundManager)super.getAudioManager();
	}

	public void play() {
		final float masterVolume = this.getMasterVolume();
		final float leftVolume = this.mLeftVolume * masterVolume;
		final float rightVolume = this.mRightVolume * masterVolume;
		this.mStreamID = this.getAudioManager().getSoundPool().play(this.mSoundID, leftVolume, rightVolume, 1, this.mLoopCount, this.mRate);
	}

	public void stop() {
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().stop(this.mStreamID);
		}
	}

	public void resume() {
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().resume(this.mStreamID);
		}
	}

	public void pause() {
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().pause(this.mStreamID);
		}
	}

	@Override
	public void release() {

	}

	public void setLooping(final boolean pLooping) {
		this.setLoopCount((pLooping) ? -1 : 0);
	}

	@Override
	public void setVolume(final float pLeftVolume, final float pRightVolume) {
		super.setVolume(pLeftVolume, pRightVolume);
		if(this.mStreamID != 0){
			final float masterVolume = this.getMasterVolume();
			final float leftVolume = this.mLeftVolume * masterVolume;
			final float rightVolume = this.mRightVolume * masterVolume;

			this.getAudioManager().getSoundPool().setVolume(this.mStreamID, leftVolume, rightVolume);
		}
	}

	@Override
	public void onMasterVolumeChanged(final float pMasterVolume) {
		this.setVolume(this.mLeftVolume, this.mRightVolume);
	}

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}
<commit_msg>Added @Override annotations.<commit_after>package org.anddev.andengine.audio.sound;

import org.anddev.andengine.audio.BaseAudioEntity;

/**
 * @author <NAME>
 * @since 13:22:15 - 11.03.2010
 */
public class Sound extends BaseAudioEntity {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	private final int mSoundID;
	private int mStreamID = 0;

	private int mLoopCount = 0;
	private float mRate = 1.0f;

	// ===========================================================
	// Constructors
	// ===========================================================

	Sound(final SoundManager pSoundManager, final int pSoundID) {
		super(pSoundManager);
		this.mSoundID = pSoundID;
	}

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	public void setLoopCount(final int pLoopCount) {
		this.mLoopCount = pLoopCount;
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().setLoop(this.mStreamID, pLoopCount);
		}
	}

	public void setRate(final float pRate) {
		this.mRate  = pRate;
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().setRate(this.mStreamID, pRate);
		}
	}

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================

	// ===========================================================
	// Methods
	// ===========================================================

	@Override
	protected SoundManager getAudioManager() {
		return (SoundManager)super.getAudioManager();
	}

	@Override
	public void play() {
		final float masterVolume = this.getMasterVolume();
		final float leftVolume = this.mLeftVolume * masterVolume;
		final float rightVolume = this.mRightVolume * masterVolume;
		this.mStreamID = this.getAudioManager().getSoundPool().play(this.mSoundID, leftVolume, rightVolume, 1, this.mLoopCount, this.mRate);
	}

	@Override
	public void stop() {
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().stop(this.mStreamID);
		}
	}

	@Override
	public void resume() {
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().resume(this.mStreamID);
		}
	}

	@Override
	public void pause() {
		if(this.mStreamID != 0) {
			this.getAudioManager().getSoundPool().pause(this.mStreamID);
		}
	}

	@Override
	public void release() {

	}

	public void setLooping(final boolean pLooping) {
		this.setLoopCount((pLooping) ? -1 : 0);
	}

	@Override
	public void setVolume(final float pLeftVolume, final float pRightVolume) {
		super.setVolume(pLeftVolume, pRightVolume);
		if(this.mStreamID != 0){
			final float masterVolume = this.getMasterVolume();
			final float leftVolume = this.mLeftVolume * masterVolume;
			final float rightVolume = this.mRightVolume * masterVolume;

			this.getAudioManager().getSoundPool().setVolume(this.mStreamID, leftVolume, rightVolume);
		}
	}

	@Override
	public void onMasterVolumeChanged(final float pMasterVolume) {
		this.setVolume(this.mLeftVolume, this.mRightVolume);
	}

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}

{'fraction_non_alphanumeric': 0.32728806410797134, 'fraction_numerical': 0.007591733445803458, 'mean_word_length': 4.324850299401198, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5892932', 'n_tokens_mistral': 2221, 'n_tokens_neox': 1858, 'n_words': 350}