<commit_before>pc.extend(pc.fw, function () {
    var AudioListenerComponentSystem = function (context, manager) {
        context.systems.add("audiolistener", this);
        
        this.manager = manager;
        this.current = null;
    };        
    AudioListenerComponentSystem = pc.inherits(AudioListenerComponentSystem, pc.fw.ComponentSystem);
        
    AudioListenerComponentSystem.prototype.createComponent = function (entity, data) {
        var componentData = new pc.fw.AudioListenerComponentData();

        data = data || {};
        this.initialiseComponent(entity, componentData, data, []);

        this.setCurrentListener(entity);   

        return componentData;
    };

    AudioListenerComponentSystem.prototype.update = function (dt) {
        if (this.current) {
            var wtm = this.current.getWorldTransform();
            var pos = pc.math.mat4.getTranslation(wtm);
            this.manager.listener.setPosition(pos);
            this.manager.listener.setOrientation(wtm);
        }
    };
    
    AudioListenerComponentSystem.prototype.setCurrentListener = function (entity) {
        if (this.hasComponent(entity)) {
            this.current = entity;
            var pos = pc.math.mat4.getTranslation(this.current.getWorldTransform());
            this.manager.listener.setPosition(pos);
        }
    };

    return {
        AudioListenerComponentSystem : AudioListenerComponentSystem 
    };
}());
<commit_msg>Small optimization to audio listener component to avoid generating garbage.<commit_after>pc.extend(pc.fw, function () {
    var AudioListenerComponentSystem = function (context, manager) {
        context.systems.add("audiolistener", this);
        
        this.manager = manager;
        this.current = null;
        this.worldPos = pc.math.vec3.create();
    };        
    AudioListenerComponentSystem = pc.inherits(AudioListenerComponentSystem, pc.fw.ComponentSystem);
        
    AudioListenerComponentSystem.prototype.createComponent = function (entity, data) {
        var componentData = new pc.fw.AudioListenerComponentData();

        data = data || {};
        this.initialiseComponent(entity, componentData, data, []);

        this.setCurrentListener(entity);   

        return componentData;
    };

    AudioListenerComponentSystem.prototype.update = function (dt) {
        if (this.current) {
            var wtm = this.current.getWorldTransform();
            this.current.getWorldPosition(this.worldPos);
            this.manager.listener.setPosition(this.worldPos);
            this.manager.listener.setOrientation(wtm);
        }
    };
    
    AudioListenerComponentSystem.prototype.setCurrentListener = function (entity) {
        if (this.hasComponent(entity)) {
            this.current = entity;
            this.current.getWorldPosition(this.worldPos);
            this.manager.listener.setPosition(this.worldPos);
        }
    };

    return {
        AudioListenerComponentSystem : AudioListenerComponentSystem 
    };
}());

{'fraction_non_alphanumeric': 0.1023571197933484, 'fraction_numerical': 0.0009686793671294801, 'mean_word_length': 2.385792349726776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3834860', 'n_tokens_mistral': 801, 'n_tokens_neox': 765, 'n_words': 125}