<commit_before>/* 
 * ScratchX extension for WebAudio Oscillator
 * 
 * yokobond <<EMAIL>>
 */

(function (ext) {
    var audioctx;
    if (typeof (webkitAudioContext) !== "undefined") {
        audioctx = new webkitAudioContext();
    }
    else if (typeof (AudioContext) !== "undefined") {
        audioctx = new AudioContext();
    }

    function Oscillator(waveType, freqValue, gainValue) {
        this.oscillator = audioctx.createOscillator();
        this.gain = audioctx.createGain();
        this.oscillator.connect(this.gain);
        this.gain.connect(audioctx.destination);
        this.oscillator.type = waveType || 'sine';
        this.oscillator.frequency.value = freqValue || 440;
        this.gain.value = gainValue || 0.5;
    }

    Oscillator.prototype.setType = function (type) {
        this.oscillator.type = type;
        return this;
    }

    Oscillator.prototype.setFrequency = function (freqValue) {
        this.oscillator.frequency.value = freqValue;
        return this;
    }

    Oscillator.prototype.setGain = function (gainValue) {
        this.oscillator.gain.gain.value = gainValue;
        return this;
    }

    Oscillator.prototype.start = function () {
        this.oscillator.oscillator.start();
        return this;
    }

    Oscillator.prototype.stop = function () {
        this.oscillator.oscillator.stop();
        return this;
    }

    var osc;<commit_msg>Fixed Oscillator start()/stop() to work. <commit_after>/* 
 * ScratchX extension for WebAudio Oscillator
 * 
 * yokobond <<EMAIL>>
 */

(function (ext) {
    var audioctx;
    if (typeof (webkitAudioContext) !== "undefined") {
        audioctx = new webkitAudioContext();
    }
    else if (typeof (AudioContext) !== "undefined") {
        audioctx = new AudioContext();
    }

    function Oscillator(waveType, freqValue, gainValue) {
        this.oscillator = audioctx.createOscillator();
        this.gain = audioctx.createGain();
        this.oscillator.connect(this.gain);
        this.gain.connect(audioctx.destination);
        this.oscillator.type = waveType || 'sine';
        this.oscillator.frequency.value = freqValue || 440;
        this.gain.value = gainValue || 0.5;
    }

    Oscillator.prototype.setType = function (type) {
        this.oscillator.type = type;
        return this;
    }

    Oscillator.prototype.setFrequency = function (freqValue) {
        this.oscillator.frequency.value = freqValue;
        return this;
    }

    Oscillator.prototype.setGain = function (gainValue) {
        this.oscillator.gain.gain.value = gainValue;
        return this;
    }

    Oscillator.prototype.start = function () {
        this.oscillator.start();
        return this;
    }

    Oscillator.prototype.stop = function () {
        this.oscillator.stop();
        return this;
    }

    var osc;
{'fraction_non_alphanumeric': 0.12101910828025478, 'fraction_numerical': 0.003538570417551309, 'mean_word_length': 2.472972972972973, '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': '723845', 'n_tokens_mistral': 907, 'n_tokens_neox': 860, 'n_words': 162}