<commit_before>//@fix Write documentation.
function B_PlaySound(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"play sound"));
	var dS=new DropSlot(this);
	for(var i=0;i<Sounds.getSoundCount();i++){
		dS.addOption(Sounds.getSoundName(i),new SelectionData(Sounds.getSoundId(i)));
	}
	this.addPart(dS);
}
B_PlaySound.prototype = Object.create(CommandBlock.prototype);
B_PlaySound.prototype.constructor = B_PlaySound;
B_PlaySound.prototype.startAction=function(){
	var soundData=this.slots[0].getData();
	if(soundData==null){
		return false;
	}
	var soundId=soundData.getValue();
	if(Sounds.checkIdIsValid(soundId)){
		var mem=this.runMem;
		mem.request = "sound/play/"+soundId;
		mem.requestStatus=function(){};
		HtmlServer.sendRequest(mem.request,mem.requestStatus);
		return true; //Still running
	}
	return false;
};
/* Wait for the request to finish. */
B_PlaySound.prototype.updateAction=function(){
	var mem=this.runMem;
	var status=mem.requestStatus;
	if(status.finished==true){
		return false; //Done running
	}
	else{
		return true; //Still running
	}
};

function B_PlaySoundUntilDone(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"play sound until done"));
	var dS=new DropSlot(this);
	for(var i=0;i<Sounds.getSoundCount();i++){
		dS.addOption(Sounds.getSoundName(i),new SelectionData(Sounds.getSoundId(i)));
	}
	this.addPart(dS);
}
B_PlaySoundUntilDone.prototype = Object.create(CommandBlock.prototype);
B_PlaySoundUntilDone.prototype.constructor = B_PlaySoundUntilDone;
B_PlaySoundUntilDone.prototype.startAction=function(){
	var soundData=this.slots[0].getData();
	if(soundData==null){
		return false;
	}
	var soundId=soundData.getValue();
	var soundIndex=Sounds.indexFromId(soundId);
	if(soundIndex>=0){
		var mem=this.runMem;
		mem.soundDuration=Sounds.getSoundDuration(soundIndex);
		mem.timerStarted=false;
		mem.request = "sound/play/"+soundId;
		mem.cancel=false;
		mem.requestStatus=function(){};
		HtmlServer.sendRequest(mem.request,mem.requestStatus);
		return true; //Still running
	}
	return false;
};
/* Wait for the request to finish. */
B_PlaySoundUntilDone.prototype.updateAction=function(){
	var mem=this.runMem;
	if(mem.cancel){
		return false;
	}
	if(!mem.timerStarted){
		var status=mem.requestStatus;
		if(status.finished==true){
			mem.startTime=new Date().getTime();
			mem.timerStarted=true;
		}
		else{
			return true; //Still running
		}
	}
	if(new Date().getTime()>=mem.startTime+mem.soundDuration){
		return false; //Done running
	}
	else{
		return true; //Still running
	}
};
B_PlaySoundUntilDone.prototype.stopAllSounds=function(){
	if(this.runMem!=null) {
		this.runMem.cancel = true;
	}
};


function B_StopAllSounds(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"stop all sounds"));
}
B_StopAllSounds.prototype = Object.create(CommandBlock.prototype);
B_StopAllSounds.prototype.constructor = B_StopAllSounds;
B_StopAllSounds.prototype.startAction=function(){
	var mem=this.runMem;
	mem.request = "sound/stop";
	mem.requestStatus=function(){};
	HtmlServer.sendRequest(mem.request,mem.requestStatus);
	return true; //Still running
};
B_StopAllSounds.prototype.updateAction=function(){
	return !this.runMem.requestStatus.finished;
};


function B_RestForBeats(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"rest for"));
	this.addPart(new NumSlot(this,0.2,true)); //Positive
	this.addPart(new LabelText(this,"beats"));
}
B_RestForBeats.prototype = Object.create(CommandBlock.prototype);
B_RestForBeats.prototype.constructor = B_RestForBeats;
B_RestForBeats.prototype.startAction=function(){
	var mem=this.runMem;
	mem.startTime=new Date().getTime();
	var beats=this.slots[0].getData().getValueWithC(true); //Positive
	mem.delayTime=CodeManager.beatsToMs(beats);
	return true; //Still running
};
B_RestForBeats.prototype.updateAction=function(){
	var mem=this.runMem;
	if(new Date().getTime()>=mem.startTime+mem.delayTime){
		return false; //Done running
	}
	else{
		return true; //Still running
	}
};


function B_PlayNoteForBeats(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"play note"));
	this.addPart(new NumSlot(this,20,true,true)); //Positive integer
	this.addPart(new LabelText(this,"for"));
	this.addPart(new NumSlot(this,0.2,true)); //Positive
	this.addPart(new LabelText(this,"beats"));
}
B_PlayNoteForBeats.prototype = Object.create(CommandBlock.prototype);<commit_msg>Updated tone block so that the default tone is audible<commit_after>//@fix Write documentation.
function B_PlaySound(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"play sound"));
	var dS=new DropSlot(this);
	for(var i=0;i<Sounds.getSoundCount();i++){
		dS.addOption(Sounds.getSoundName(i),new SelectionData(Sounds.getSoundId(i)));
	}
	this.addPart(dS);
}
B_PlaySound.prototype = Object.create(CommandBlock.prototype);
B_PlaySound.prototype.constructor = B_PlaySound;
B_PlaySound.prototype.startAction=function(){
	var soundData=this.slots[0].getData();
	if(soundData==null){
		return false;
	}
	var soundId=soundData.getValue();
	if(Sounds.checkIdIsValid(soundId)){
		var mem=this.runMem;
		mem.request = "sound/play/"+soundId;
		mem.requestStatus=function(){};
		HtmlServer.sendRequest(mem.request,mem.requestStatus);
		return true; //Still running
	}
	return false;
};
/* Wait for the request to finish. */
B_PlaySound.prototype.updateAction=function(){
	var mem=this.runMem;
	var status=mem.requestStatus;
	if(status.finished==true){
		return false; //Done running
	}
	else{
		return true; //Still running
	}
};

function B_PlaySoundUntilDone(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"play sound until done"));
	var dS=new DropSlot(this);
	for(var i=0;i<Sounds.getSoundCount();i++){
		dS.addOption(Sounds.getSoundName(i),new SelectionData(Sounds.getSoundId(i)));
	}
	this.addPart(dS);
}
B_PlaySoundUntilDone.prototype = Object.create(CommandBlock.prototype);
B_PlaySoundUntilDone.prototype.constructor = B_PlaySoundUntilDone;
B_PlaySoundUntilDone.prototype.startAction=function(){
	var soundData=this.slots[0].getData();
	if(soundData==null){
		return false;
	}
	var soundId=soundData.getValue();
	var soundIndex=Sounds.indexFromId(soundId);
	if(soundIndex>=0){
		var mem=this.runMem;
		mem.soundDuration=Sounds.getSoundDuration(soundIndex);
		mem.timerStarted=false;
		mem.request = "sound/play/"+soundId;
		mem.cancel=false;
		mem.requestStatus=function(){};
		HtmlServer.sendRequest(mem.request,mem.requestStatus);
		return true; //Still running
	}
	return false;
};
/* Wait for the request to finish. */
B_PlaySoundUntilDone.prototype.updateAction=function(){
	var mem=this.runMem;
	if(mem.cancel){
		return false;
	}
	if(!mem.timerStarted){
		var status=mem.requestStatus;
		if(status.finished==true){
			mem.startTime=new Date().getTime();
			mem.timerStarted=true;
		}
		else{
			return true; //Still running
		}
	}
	if(new Date().getTime()>=mem.startTime+mem.soundDuration){
		return false; //Done running
	}
	else{
		return true; //Still running
	}
};
B_PlaySoundUntilDone.prototype.stopAllSounds=function(){
	if(this.runMem!=null) {
		this.runMem.cancel = true;
	}
};


function B_StopAllSounds(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"stop all sounds"));
}
B_StopAllSounds.prototype = Object.create(CommandBlock.prototype);
B_StopAllSounds.prototype.constructor = B_StopAllSounds;
B_StopAllSounds.prototype.startAction=function(){
	var mem=this.runMem;
	mem.request = "sound/stop";
	mem.requestStatus=function(){};
	HtmlServer.sendRequest(mem.request,mem.requestStatus);
	return true; //Still running
};
B_StopAllSounds.prototype.updateAction=function(){
	return !this.runMem.requestStatus.finished;
};


function B_RestForBeats(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"rest for"));
	this.addPart(new NumSlot(this,0.2,true)); //Positive
	this.addPart(new LabelText(this,"beats"));
}
B_RestForBeats.prototype = Object.create(CommandBlock.prototype);
B_RestForBeats.prototype.constructor = B_RestForBeats;
B_RestForBeats.prototype.startAction=function(){
	var mem=this.runMem;
	mem.startTime=new Date().getTime();
	var beats=this.slots[0].getData().getValueWithC(true); //Positive
	mem.delayTime=CodeManager.beatsToMs(beats);
	return true; //Still running
};
B_RestForBeats.prototype.updateAction=function(){
	var mem=this.runMem;
	if(new Date().getTime()>=mem.startTime+mem.delayTime){
		return false; //Done running
	}
	else{
		return true; //Still running
	}
};


function B_PlayNoteForBeats(x,y){
	CommandBlock.call(this,x,y,"sound");
	this.addPart(new LabelText(this,"play note"));
	this.addPart(new NumSlot(this,60,true,true)); //Positive integer
	this.addPart(new LabelText(this,"for"));
	this.addPart(new NumSlot(this,1,true)); //Positive
	this.addPart(new LabelText(this,"beats"));
}
B_PlayNoteForBeats.prototype = Object.create(CommandBlock.prototype);
{'fraction_non_alphanumeric': 0.1544878211544878, 'fraction_numerical': 0.0025581136692247805, 'mean_word_length': 6.376538146021329, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '1767178', 'n_tokens_mistral': 3259, 'n_tokens_neox': 3125, 'n_words': 476}