<commit_before>var util = require('util');

var log = require('../util/log');
var MathUtil = require('../util/math-util');
var Target = require('../engine/target');

/**
 * Rendered target: instance of a sprite (clone), or the stage.
 * @param {!Sprite} sprite Reference to the parent sprite.
 * @param {Runtime} runtime Reference to the runtime.
 * @constructor
 */
var RenderedTarget = function (sprite, runtime) {
    Target.call(this, sprite.blocks);
    this.runtime = runtime;
    /**
     * Reference to the sprite that this is a render of.
     * @type {!Sprite}
     */
    this.sprite = sprite;
    /**
     * Reference to the global renderer for this VM, if one exists.
     * @type {?RenderWebGLWorker}
     */
    this.renderer = null;
    if (this.runtime) {
        this.renderer = this.runtime.renderer;
    }
    /**
     * ID of the drawable for this rendered target,
     * returned by the renderer, if rendered.
     * @type {?Number}
     */
    this.drawableID = null;

    /**
     * Map of current graphic effect values.
     * @type {!Object.<string, number>}
     */
    this.effects = {
        color: 0,
        fisheye: 0,
        whirl: 0,
        pixelate: 0,
        mosaic: 0,
        brightness: 0,
        ghost: 0
    };

    /**
     * Map of current audio effect values.
     * @type {!Object.<string, number>}
     */
    this.audioEffects = {
        pitch: 0,
        pan: 0,
        echo: 0,
        reverb: 0,
        fuzz: 0.,
        robot: 0
    };
};
util.inherits(RenderedTarget, Target);

/**
 * Create a drawable with the this.renderer.
 */
RenderedTarget.prototype.initDrawable = function () {
    if (this.renderer) {
        this.drawableID = this.renderer.createDrawable();
    }
    // If we're a clone, start the hats.
    if (!this.isOriginal) {
        this.runtime.startHats(
            'control_start_as_clone', null, this
        );
    }

    /**
    * Audio player
    */
    this.audioPlayer = null;
    if (this.runtime && this.runtime.audioEngine) {
        if (this.isOriginal) {
            this.sprite.audioPlayer = this.runtime.audioEngine.createPlayer();
            this.sprite.audioPlayer.loadSounds(this.sprite.sounds);
        }
        this.audioPlayer = this.sprite.audioPlayer;
    }
};

/**
 * Whether this represents an "original" non-clone rendered-target for a sprite,
 * i.e., created by the editor and not clone blocks.
 * @type {boolean}
 */
RenderedTarget.prototype.isOriginal = true;

/**
 * Whether this rendered target represents the Scratch stage.
 * @type {boolean}
 */
RenderedTarget.prototype.isStage = false;

/**
 * Scratch X coordinate. Currently should range from -240 to 240.
 * @type {Number}
 */
RenderedTarget.prototype.x = 0;<commit_msg>audio engine loads all sounds<commit_after>var util = require('util');

var log = require('../util/log');
var MathUtil = require('../util/math-util');
var Target = require('../engine/target');

/**
 * Rendered target: instance of a sprite (clone), or the stage.
 * @param {!Sprite} sprite Reference to the parent sprite.
 * @param {Runtime} runtime Reference to the runtime.
 * @constructor
 */
var RenderedTarget = function (sprite, runtime) {
    Target.call(this, sprite.blocks);
    this.runtime = runtime;
    /**
     * Reference to the sprite that this is a render of.
     * @type {!Sprite}
     */
    this.sprite = sprite;
    /**
     * Reference to the global renderer for this VM, if one exists.
     * @type {?RenderWebGLWorker}
     */
    this.renderer = null;
    if (this.runtime) {
        this.renderer = this.runtime.renderer;
    }
    /**
     * ID of the drawable for this rendered target,
     * returned by the renderer, if rendered.
     * @type {?Number}
     */
    this.drawableID = null;

    /**
     * Map of current graphic effect values.
     * @type {!Object.<string, number>}
     */
    this.effects = {
        color: 0,
        fisheye: 0,
        whirl: 0,
        pixelate: 0,
        mosaic: 0,
        brightness: 0,
        ghost: 0
    };

    /**
     * Map of current audio effect values.
     * @type {!Object.<string, number>}
     */
    this.audioEffects = {
        pitch: 0,
        pan: 0,
        echo: 0,
        reverb: 0,
        fuzz: 0.,
        robot: 0
    };
};
util.inherits(RenderedTarget, Target);

/**
 * Create a drawable with the this.renderer.
 */
RenderedTarget.prototype.initDrawable = function () {
    if (this.renderer) {
        this.drawableID = this.renderer.createDrawable();
    }
    // If we're a clone, start the hats.
    if (!this.isOriginal) {
        this.runtime.startHats(
            'control_start_as_clone', null, this
        );
    }

    /**
    * Audio player
    */
    this.audioPlayer = null;
    if (this.runtime && this.runtime.audioEngine) {
        if (this.isOriginal) {
            this.runtime.audioEngine.loadSounds(this.sprite.sounds);
        }
        this.audioPlayer = this.runtime.audioEngine.createPlayer();
    }
};

/**
 * Whether this represents an "original" non-clone rendered-target for a sprite,
 * i.e., created by the editor and not clone blocks.
 * @type {boolean}
 */
RenderedTarget.prototype.isOriginal = true;

/**
 * Whether this rendered target represents the Scratch stage.
 * @type {boolean}
 */
RenderedTarget.prototype.isStage = false;

/**
 * Scratch X coordinate. Currently should range from -240 to 240.
 * @type {Number}
 */
RenderedTarget.prototype.x = 0;
{'fraction_non_alphanumeric': 0.13139492086860508, 'fraction_numerical': 0.00736105999263894, 'mean_word_length': 2.2740963855421685, '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': '1185580', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1664, 'n_words': 469}