"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SoundSystem = void 0;
const EventHandler_1 = require("modloader64_api/EventHandler");
class SoundSystem {
    native;
    constructor() {
        this.native = require('@sound/sfml_audio');
    }
    get listener() {
        return this.native.Listener;
    }
    loadSound(file) {
        let buf = new this.native.SoundBuffer();
        buf.loadFromFile(file);
        let snd = new this.native.Sound(buf);
        EventHandler_1.bus.emit("LOAD_SOUND" /* AudioAPIEvents.LOAD_SOUND */, snd);
        return snd;
    }
    initSound(buf) {
        let b = new this.native.SoundBuffer();
        b.loadFromMemory(buf);
        let snd = new this.native.Sound(b);
        EventHandler_1.bus.emit("LOAD_SOUND" /* AudioAPIEvents.LOAD_SOUND */, snd);
        return snd;
    }
    loadMusic(file) {
        let mus = new this.native.Music();
        mus.openFromFile(file);
        EventHandler_1.bus.emit("LOAD_SOUND" /* AudioAPIEvents.LOAD_SOUND */, mus);
        return mus;
    }
    initMusic(buf) {
        let mus = new this.native.Music();
        mus.openFromMemory(buf);
        EventHandler_1.bus.emit("LOAD_SOUND" /* AudioAPIEvents.LOAD_SOUND */, mus);
        return mus;
    }
}
exports.SoundSystem = SoundSystem;
//# sourceMappingURL=SoundSystem.js.map