<commit_before>@:keep class BaseSound {

	public var isSpriteSound:Bool;
	public var url:String;
	public var spriteName:String;
	public var rate:Float;

	var _options:WaudSoundOptions;
	var _isLoaded:Bool;
	var _isPlaying:Bool;
	var _muted:Bool;
	var _duration:Float;
	var _b64:EReg;

	public function new(sndUrl:String, ?options:WaudSoundOptions = null) {
		_b64 = ~/(^data:audio).*(;base64,)/i;
		if (sndUrl == null || sndUrl == "") {
			trace("invalid sound url");
			return;
		}
		if (Waud.audioManager == null) {
			trace("initialise Waud using Waud.init() before loading sounds");
			return;
		}

		isSpriteSound = false;
		url = sndUrl;
		_isLoaded = false;
		_isPlaying = false;
		_muted = false;
		_duration = 0;
		if (options == null) options = {};

		options.autoplay = (options.autoplay != null) ? options.autoplay : Waud.defaults.autoplay;
		options.autostop = (options.autostop != null) ? options.autostop : Waud.defaults.autostop;
		options.webaudio = (options.webaudio != null) ? options.webaudio : Waud.defaults.webaudio;
		options.preload = (options.preload != null) ? options.preload : Waud.defaults.preload;
		options.loop = (options.loop != null) ? options.loop : Waud.defaults.loop;
		options.volume = (options.volume != null && options.volume >= 0 && options.volume <= 1) ? options.volume : Waud.defaults.volume;
		options.playbackRate = (options.playbackRate != null && options.playbackRate >= 0 && options.playbackRate <= 4) ? options.playbackRate : Waud.defaults.playbackRate;
		options.onload = (options.onload != null) ? options.onload : Waud.defaults.onload;
		options.onend = (options.onend != null) ? options.onend : Waud.defaults.onend;
		options.onerror = (options.onerror != null) ? options.onerror : Waud.defaults.onerror;

		rate = options.playbackRate;

		_options = options;
	}

	public function isReady():Bool {
		return _isLoaded;
	}
}<commit_msg>fixe code climate issue<commit_after>@:keep class BaseSound {

	public var isSpriteSound:Bool;
	public var url:String;
	public var spriteName:String;
	public var rate:Float;

	var _options:WaudSoundOptions;
	var _isLoaded:Bool;
	var _isPlaying:Bool;
	var _muted:Bool;
	var _duration:Float;
	var _b64:EReg;

	public function new(sndUrl:String, ?options:WaudSoundOptions = null) {
		_b64 = ~/(^data:audio).*(;base64,)/i;
		if (sndUrl == null || sndUrl == "") {
			trace("invalid sound url");
			return;
		}
		if (Waud.audioManager == null) {
			trace("initialise Waud using Waud.init() before loading sounds");
			return;
		}

		isSpriteSound = false;
		url = sndUrl;
		_isLoaded = false;
		_isPlaying = false;
		_muted = false;
		_duration = 0;
		if (options == null) options = {};

		options.autoplay = (options.autoplay != null) ? options.autoplay : Waud.defaults.autoplay;
		options.autostop = (options.autostop != null) ? options.autostop : Waud.defaults.autostop;
		options.webaudio = (options.webaudio != null) ? options.webaudio : Waud.defaults.webaudio;
		options.preload = (options.preload != null) ? options.preload : Waud.defaults.preload;
		options.loop = (options.loop != null) ? options.loop : Waud.defaults.loop;
		options.onload = (options.onload != null) ? options.onload : Waud.defaults.onload;
		options.onend = (options.onend != null) ? options.onend : Waud.defaults.onend;
		options.onerror = (options.onerror != null) ? options.onerror : Waud.defaults.onerror;
		if (options.volume == null || options.volume < 0 || options.volume > 1) options.volume = Waud.defaults.volume;
		if (options.playbackRate == null || options.playbackRate <= 0 || options.playbackRate >= 4) options.playbackRate = Waud.defaults.playbackRate;

		rate = options.playbackRate;

		_options = options;
	}

	public function isReady():Bool {
		return _isLoaded;
	}
}
{'fraction_non_alphanumeric': 0.13995726495726496, 'fraction_numerical': 0.005876068376068376, 'mean_word_length': 4.28954802259887, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1628720', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1269, 'n_words': 275}