<commit_before>package com.stickycoding.Rokon;

import java.io.IOException;

import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;

/**
 * RokonMusic plays one sound file, continuously or otherwise.
 * It is suitable for background music, and should not be used for
 * sound effects in game.
 * 
 * MediaPlayer is used.
 * 
 * @author Richard
 */
public class RokonMusic {
	
	private static MediaPlayer _mediaPlayer;
	
	/**
	 * Begins playing a sound file in the background
	 * @param filename path to a sound file in the /assets/ folder of your APK
	 * @param continuous TRUE if the sound is to loop indefinately
	 */
	public static void play(String filename, boolean continuous) {
		if(_mediaPlayer != null)
			_mediaPlayer.release();
		try {
			_mediaPlayer = new MediaPlayer();
			AssetFileDescriptor afd = Rokon.getRokon().getActivity().getAssets().openFd(filename);
			_mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
			_mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
			_mediaPlayer.prepare();
			_mediaPlayer.start();
		} catch (IOException e) {
			Debug.print("CANNOT FIND " + filename + " IN ASSETS");
			e.printStackTrace();
		}
	}
	
	public static boolean isContinuous() {
		return _mediaPlayer.isLooping();
	}
	
	public static boolean isPlaying() {
		return _mediaPlayer.isPlaying();<commit_msg>Fix for continuous music playback<commit_after>package com.stickycoding.Rokon;

import java.io.IOException;

import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;

/**
 * RokonMusic plays one sound file, continuously or otherwise.
 * It is suitable for background music, and should not be used for
 * sound effects in game.
 * 
 * MediaPlayer is used.
 * 
 * @author Richard
 */
public class RokonMusic {
	
	private static MediaPlayer _mediaPlayer;
	
	/**
	 * Begins playing a sound file in the background
	 * @param filename path to a sound file in the /assets/ folder of your APK
	 * @param continuous TRUE if the sound is to loop indefinately
	 */
	public static void play(String filename, boolean continuous) {
		if(_mediaPlayer != null)
			_mediaPlayer.release();
		try {
			_mediaPlayer = new MediaPlayer();
			if(continuous)
				setContinuous(true);
			AssetFileDescriptor afd = Rokon.getRokon().getActivity().getAssets().openFd(filename);
			_mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
			_mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
			_mediaPlayer.prepare();
			_mediaPlayer.start();
		} catch (IOException e) {
			Debug.print("CANNOT FIND " + filename + " IN ASSETS");
			e.printStackTrace();
		}
	}
	
	public static boolean isContinuous() {
		return _mediaPlayer.isLooping();
	}
	
	public static boolean isPlaying() {
		return _mediaPlayer.isPlaying();
{'fraction_non_alphanumeric': 0.10113129928008227, 'fraction_numerical': 0.0, 'mean_word_length': 4.3837638376383765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5515181', 'n_tokens_mistral': 928, 'n_tokens_neox': 834, 'n_words': 249}