403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/clients/client2/arni-solutions.de/web/slots/js/engine/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client2/arni-solutions.de/web/slots/js/engine/AudioEngine.js
/* Reel Royale – AudioEngine
   Komplett synthetisch (Web Audio API). Kein einziges Audio-Asset nötig. */
export class AudioEngine {
  constructor() {
    this.ctx = null;
    this.master = null;
    this.musicGain = null;
    this.sfxGain = null;
    this.muted = false;
    this.volume = 0.55;
    this.musicTimer = null;
    this.musicKey = null;
    this._step = 0;
  }

  init() {
    if (this.ctx) { if (this.ctx.state === 'suspended') this.ctx.resume(); return; }
    const AC = window.AudioContext || window.webkitAudioContext;
    if (!AC) return;
    this.ctx = new AC();
    this.master = this.ctx.createGain();
    this.master.gain.value = this.muted ? 0 : this.volume;
    this.master.connect(this.ctx.destination);
    this.musicGain = this.ctx.createGain(); this.musicGain.gain.value = 0.32; this.musicGain.connect(this.master);
    this.sfxGain = this.ctx.createGain(); this.sfxGain.gain.value = 1; this.sfxGain.connect(this.master);
  }

  setVolume(v) {
    this.volume = Math.max(0, Math.min(1, v));
    if (this.master && !this.muted) this.master.gain.setTargetAtTime(this.volume, this.ctx.currentTime, 0.05);
  }
  toggleMute() {
    this.muted = !this.muted;
    if (this.master) this.master.gain.setTargetAtTime(this.muted ? 0 : this.volume, this.ctx.currentTime, 0.04);
    return this.muted;
  }

  _tone(freq, dur, { type = 'sine', gain = 0.25, delay = 0, dest = null, slide = null } = {}) {
    if (!this.ctx) return;
    const t0 = this.ctx.currentTime + delay;
    const osc = this.ctx.createOscillator();
    const g = this.ctx.createGain();
    osc.type = type;
    osc.frequency.setValueAtTime(freq, t0);
    if (slide) osc.frequency.exponentialRampToValueAtTime(slide, t0 + dur);
    g.gain.setValueAtTime(0.0001, t0);
    g.gain.exponentialRampToValueAtTime(gain, t0 + 0.012);
    g.gain.exponentialRampToValueAtTime(0.0001, t0 + dur);
    osc.connect(g); g.connect(dest || this.sfxGain);
    osc.start(t0); osc.stop(t0 + dur + 0.03);
  }
  _noise(dur, { gain = 0.18, delay = 0, hp = 800 } = {}) {
    if (!this.ctx) return;
    const t0 = this.ctx.currentTime + delay;
    const n = Math.floor(this.ctx.sampleRate * dur);
    const buf = this.ctx.createBuffer(1, n, this.ctx.sampleRate);
    const d = buf.getChannelData(0);
    for (let i = 0; i < n; i++) d[i] = (Math.random() * 2 - 1) * (1 - i / n);
    const src = this.ctx.createBufferSource(); src.buffer = buf;
    const f = this.ctx.createBiquadFilter(); f.type = 'highpass'; f.frequency.value = hp;
    const g = this.ctx.createGain(); g.gain.value = gain;
    src.connect(f); f.connect(g); g.connect(this.sfxGain);
    src.start(t0);
  }

  play(name) {
    if (!this.ctx) return;
    switch (name) {
      case 'reelStart': this._tone(150, 0.1, { type: 'square', gain: 0.12, slide: 90 }); break;
      case 'reelStop': this._tone(220, 0.06, { type: 'triangle', gain: 0.14, slide: 140 }); this._noise(0.05, { gain: 0.06, hp: 1200 }); break;
      case 'hover': this._tone(660, 0.04, { type: 'sine', gain: 0.05 }); break;
      case 'click': this._tone(420, 0.05, { type: 'square', gain: 0.1, slide: 300 }); break;
      case 'win': [523, 659, 784].forEach((f, i) => this._tone(f, 0.12, { type: 'triangle', gain: 0.16, delay: i * 0.07 })); break;
      case 'collect': this._tone(880, 0.08, { type: 'sine', gain: 0.16, slide: 1320 }); break;
      case 'coin': this._tone(1200, 0.06, { type: 'square', gain: 0.08, slide: 1800 }); break;
      case 'freespin': [392, 494, 587, 784].forEach((f, i) => this._tone(f, 0.16, { type: 'sine', gain: 0.18, delay: i * 0.09 })); break;
      case 'bonus': [330, 440, 550, 660, 880].forEach((f, i) => this._tone(f, 0.2, { type: 'sawtooth', gain: 0.12, delay: i * 0.08 })); break;
      case 'bigwin':
        [523, 659, 784, 1046, 1318].forEach((f, i) => this._tone(f, 0.26, { type: 'triangle', gain: 0.2, delay: i * 0.1 }));
        this._noise(0.4, { gain: 0.05, hp: 600 }); break;
      // ---- Roulette ----
      case 'chip': this._tone(900, 0.04, { type: 'square', gain: 0.09, slide: 600 }); this._noise(0.03, { gain: 0.05, hp: 2000 }); break;
      case 'chipOff': this._tone(500, 0.05, { type: 'square', gain: 0.07, slide: 260 }); break;
      case 'rlStart': this._tone(120, 0.5, { type: 'sawtooth', gain: 0.06, slide: 320 }); break;
      case 'ballRoll': this._noise(0.03, { gain: 0.04, hp: 3000 }); break;
      case 'ballDrop': this._tone(700, 0.05, { type: 'square', gain: 0.1, slide: 180 }); this._noise(0.08, { gain: 0.08, hp: 1500 }); break;
      // ---- Anticipation (2 Scatter, letzte Walze) ----
      case 'anticipate': this._tone(330, 0.7, { type: 'sawtooth', gain: 0.07, slide: 880 }); this._tone(660, 0.7, { type: 'sine', gain: 0.04, slide: 1400, delay: 0.05 }); break;
    }
  }

  // ---- Hintergrundmusik: einfache thematische Arpeggio-Schleife ----
  startMusic(key) {
    if (!this.ctx) return;
    if (this.musicKey === key && this.musicTimer) return;
    this.stopMusic();
    this.musicKey = key;
    this._step = 0;
    const scales = {
      egypt:   [196, 233, 261, 311, 349, 392],
      flamenco:[220, 261, 293, 349, 415, 440],
      calm:    [196, 246, 293, 329, 392, 493],
      outdoor: [174, 220, 261, 293, 349, 392],
      tribal:  [165, 196, 220, 261, 293, 329],
      mythic:  [207, 246, 277, 329, 369, 415],
    };
    const scale = scales[key] || scales.calm;
    const tick = () => {
      const s = this._step++;
      const note = scale[s % scale.length];
      this._tone(note, 0.5, { type: 'sine', gain: 0.10, dest: this.musicGain });
      if (s % 4 === 0) this._tone(note / 2, 0.9, { type: 'triangle', gain: 0.07, dest: this.musicGain });
      if (s % 8 === 6) this._tone(note * 2, 0.3, { type: 'sine', gain: 0.05, dest: this.musicGain });
    };
    tick();
    this.musicTimer = setInterval(tick, 480);
  }
  stopMusic() {
    if (this.musicTimer) { clearInterval(this.musicTimer); this.musicTimer = null; }
    this.musicKey = null;
  }
  setMusicMood(free) {
    if (this.musicGain) this.musicGain.gain.setTargetAtTime(free ? 0.5 : 0.32, this.ctx.currentTime, 0.3);
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit