<commit_before>"use strict";

walContext.Filters = function( wCtx ) {
	this.wCtx = wCtx;
	this.nodes = [];

	this.nodeIn = wCtx.ctx.createGain();
	this.nodeOut = wCtx.ctx.createGain();
	this.nodeIn.connect( this.nodeOut );
};

walContext.Filters.prototype = {
	pushBack: function( node ) {
		if ( this.nodes.length > 0 ) {
			this.nodes[ this.nodes.length - 1 ].disconnect( this.nodeOut );
			this.nodes[ this.nodes.length - 1 ].connect( node );
		} else {
			this.nodeIn.disconnect( this.nodeOut );	
			this.nodeIn.connect( node );
		}
		node.connect( this.nodeOut );
		this.nodes.push( node );
	},
	popBack: function() {
		var poped = this.nodes.pop();
		if ( poped ) {
			poped.disconnect( this.nodeOut );
			if ( this.nodes.length === 0 ) {
				this.nodeIn.disconnect( poped );
				this.nodeIn.connect( this.nodeOut );
			} else {
				this.nodes[ this.nodes.length - 1 ].disconnect( poped );
				this.nodes[ this.nodes.length - 1 ].connect( this.nodeOut );
			}
		}
		return poped;
	},
	popAll: function() {
		if ( this.nodes.length > 0 ) {
			var poped = this.nodes;
			this.nodeIn.disconnect( this.nodes[ 0 ] );
			poped[ poped.length - 1 ].disconnect( this.nodeOut );
			this.nodeIn.connect( this.nodeOut );
			this.nodes = [];
			return poped;
		}
		return null;
	},
	connect: function( node ) {
		node = node.nodeIn || node;
		this.nodeOut.connect( node );
		this.connectedTo = node;
	},
	disconnect: function() {
		this.nodeOut.disconnect( this.connectedTo );
		this.connectedTo = null;
	},
	gain: function( vol ) {
		if ( !arguments.length ) {
			return this.gainNode.gain.value;
		}
		this.gainNode.gain.value = vol;<commit_msg>Filters : We doesn't specify the node when we use audioNode.connect(); Filters : add pushFront and popFront<commit_after>"use strict";

walContext.Filters = function( wCtx ) {
	this.wCtx = wCtx;
	this.nodes = [];

	this.nodeIn = wCtx.ctx.createGain();
	this.nodeOut = wCtx.ctx.createGain();
	this.nodeIn.connect( this.nodeOut );
};

walContext.Filters.prototype = {
	pushBack: function( node ) {
		if ( this.nodes.length > 0 ) {
			this.nodes[ this.nodes.length - 1 ].disconnect();
			this.nodes[ this.nodes.length - 1 ].connect( node );
		} else {
			this.nodeIn.disconnect();
			this.nodeIn.connect( node );
		}
		node.connect( this.nodeOut );
		this.nodes.push( node );
	},
	pushFront: function( node ) {
		if ( this.nodes.length === 0 ) {
			this.pushBack( node );
		} else {
			this.nodeIn.disconnect();
			this.nodeIn.connect( node );
			this.nodes.unshift( node );
			node.connect( this.nodes[ 1 ] );
		}
	},
	popBack: function() {
		var poped = this.nodes.length ? this.nodes.pop() : null;
		if ( poped ) {
			poped.disconnect();
			if ( this.nodes.length === 0 ) {
				this.nodeIn.disconnect();
				this.nodeIn.connect( this.nodeOut );
			} else {
				this.nodes[ this.nodes.length - 1 ].disconnect();
				this.nodes[ this.nodes.length - 1 ].connect( this.nodeOut );
			}
		}
		return poped;
	},
	popFront: function() {
		var poped;

		if ( !this.nodes.length ) {
			poped = null;
		} else if ( this.nodes.length === 1 ) {
			poped = this.popBack();
		} else {
			this.nodeIn.disconnect();
			this.nodes[ 0 ].disconnect();
			poped = this.nodes.shift();
			this.nodeIn.connect( this.nodes[ 0 ] );
		}
		return poped;
	},
	popAll: function() {
		if ( this.nodes.length > 0 ) {
			var poped = this.nodes;
			this.nodeIn.disconnect();
			poped[ poped.length - 1 ].disconnect();
			this.nodeIn.connect( this.nodeOut );
			this.nodes = [];
			return poped;
		}
		return null;
	},
	connect: function( node ) {
		node = node.nodeIn || node;
		this.nodeOut.connect( node );
		this.connectedTo = node;
	},
	disconnect: function() {
		this.nodeOut.disconnect();
		this.connectedTo = null;
	},
	gain: function( vol ) {
		if ( !arguments.length ) {
			return this.gainNode.gain.value;
		}
		this.gainNode.gain.value = vol;
{'fraction_non_alphanumeric': 0.1650686706400622, 'fraction_numerical': 0.005700958797615963, 'mean_word_length': 2.97119341563786, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3571964', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1418, 'n_words': 283}