rpjs/resources/sound_list.js
/**
     * Plays a sound at full volume.
     */
Plays a sound at full volume.
Plays a sound at full volume .
play(name)
    {
        let ctx=this.game.audioContext;
        let source,gain;
        let buffer=this.buffers.get(name);
        if ((buffer===undefined) || (buffer===null)) {
            console.log('Unknown sound: '+name);
            return;
        }
        source=ctx.createBufferSource();
        source.buffer=buffer;
        gain=ctx.createGain();
        gain.gain.value=this.MAIN_VOLUME;
        source.connect(gain);
        gain.connect(ctx.destination);
        source.start(0);
    }
play ( name ) { let ctx = this . game . audioContext ; let source , gain ; let buffer = this . buffers . get ( name ) ; if ( ( buffer === undefined ) || ( buffer === null ) ) { console . log ( 'Unknown sound: ' + name ) ; return ; } source = ctx . createBufferSource ( ) ; source . buffer = buffer ; gain = ctx . createGain ( ) ; gain . gain . value = this . MAIN_VOLUME ; source . connect ( gain ) ; gain . connect ( ctx . destination ) ; source . start ( 0 ) ; }
Plays a sound at full volume.
Plays a sound at full volume .
// just a warning if no music // play sound