<commit_before>"use strict";

( function() {

function gswaBufferSample() {
	this.bufferSources = [];
};

gswaBufferSample.prototype = {
	setContext: function( ctx ) {
		this.ctx = ctx;
	},
	setDataFromAudioBuffer: function( audioBuffer ) {
		this.buffer = audioBuffer;
		this.duration = audioBuffer.duration;
		return audioBuffer;
	},
	setDataFromAudioData: function( audioData ) {
		return this.ctx.decodeAudioData( audioData )
			.then( this.setDataFromAudioBuffer.bind( this ) );
	},
	setDataFromBlob: function( blob ) {
		var that = this,
			reader = new FileReader();

		return new Promise( function( resolve, reject ) {
			reader.onloadend = function() {
				resolve( that.setDataFromAudioData( reader.result ) );
			};
			reader.readAsArrayBuffer( blob );
		} );
	},
	setDataFromURL: function( url ) {
		return fetch( url )
			.then( function( res ) {
				return res.arrayBuffer();
			} )
			.then( this.setDataFromAudioData );
	},
	connect: function( node ) {
		this.connectedTo = node;
		this.bufferSources.forEach( function( bsrc ) {
			bsrc.connect( node );
		} );
	},
	disconnect: function() {
		this.connectedTo = null;
		this.bufferSources.forEach( function( bsrc ) {
			bsrc.disconnect();
		} );
	},
	start: function( when, offset, duration ) {
		var bSource, ctx = this.ctx, buf = this.buffer;

		if ( ctx && buf ) {
			bSource = ctx.createBufferSource();
			bSource.buffer = buf;
			bSource.onended = _removeSource.bind( this, bSource );
			bSource.connect( this.connectedTo );
			this.bufferSources.push( bSource );
			bSource.start( when || 0, offset || 0,
				arguments.length > 2 ? duration : this.duration );
			return bSource;
		}
	},
	stop: function() {<commit_msg>gswaBufferSample: fixes, a bind forgot and the constructor was private<commit_after>"use strict";

( function() {

window.gswaBufferSample = function() {
	this.bufferSources = [];
};

gswaBufferSample.prototype = {
	setContext: function( ctx ) {
		this.ctx = ctx;
	},
	setDataFromAudioBuffer: function( audioBuffer ) {
		this.buffer = audioBuffer;
		this.duration = audioBuffer.duration;
		return audioBuffer;
	},
	setDataFromAudioData: function( audioData ) {
		return this.ctx.decodeAudioData( audioData )
			.then( this.setDataFromAudioBuffer.bind( this ) );
	},
	setDataFromBlob: function( blob ) {
		var that = this,
			reader = new FileReader();

		return new Promise( function( resolve, reject ) {
			reader.onloadend = function() {
				resolve( that.setDataFromAudioData( reader.result ) );
			};
			reader.readAsArrayBuffer( blob );
		} );
	},
	setDataFromURL: function( url ) {
		return fetch( url )
			.then( function( res ) {
				return res.arrayBuffer();
			} )
			.then( this.setDataFromAudioData.bind( this ) );
	},
	connect: function( node ) {
		this.connectedTo = node;
		this.bufferSources.forEach( function( bsrc ) {
			bsrc.connect( node );
		} );
	},
	disconnect: function() {
		this.connectedTo = null;
		this.bufferSources.forEach( function( bsrc ) {
			bsrc.disconnect();
		} );
	},
	start: function( when, offset, duration ) {
		var bSource, ctx = this.ctx, buf = this.buffer;

		if ( ctx && buf ) {
			bSource = ctx.createBufferSource();
			bSource.buffer = buf;
			bSource.onended = _removeSource.bind( this, bSource );
			bSource.connect( this.connectedTo );
			this.bufferSources.push( bSource );
			bSource.start( when || 0, offset || 0,
				arguments.length > 2 ? duration : this.duration );
			return bSource;
		}
	},
	stop: function() {
{'fraction_non_alphanumeric': 0.1384793292859208, 'fraction_numerical': 0.0017346053772766695, 'mean_word_length': 3.594953519256308, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7425842', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1131, 'n_words': 254}