Niek / obs-web

OBS-web - the easiest way to control OBS remotely
http://obs-web.niek.tv
GNU General Public License v3.0
1.14k stars 132 forks source link

[Feature Request] Audio Volume Control #373

Open AlexFreik opened 5 months ago

AlexFreik commented 5 months ago

Hello! Sometimes when we're playing music we want to slowly fade it out before transitioning to next scene. Is there any plans to impliment some kind of Audio Mixer via GetInputVolume and SetInputVolume?

Screenshot 2024-05-04 at 12 35 27
bilogic commented 5 months ago

I can't recall how I did it previously with obs-web, but it was an old version. And I still need this too, will update here or with a PR once I find it.

bilogic commented 5 months ago

I hacked it like this in App.svelte and it's really old, setScene() no longer exists in the latest version

  async function setScene(e) {
    let newscene = await e.currentTarget.textContent;
    let i = 0;
    let full_volume = -16.5;
    full_volume = -100; // 0%
    full_volume = -20; // 10%
    full_volume = -16.5; // 15%
    full_volume = 0; // 100%

    if (currentScene == 'Break - Music' || currentScene == 'Break - MTV') {
      for (i = full_volume; i > -100; i -= 1) {
        sendCommand('SetVolume', { volume: i, useDecibel: true, source: 'Lounge Music' });
        sendCommand('SetVolume', { volume: i, useDecibel: true, source: 'MTV' });
        await new Promise((r) => setTimeout(r, 20));
      }
      sendCommand('SetMute', { mute: false, source: 'BM800' });
    }

    if (newscene == 'Break - Music' || newscene == 'Break - MTV') {
      i = full_volume;
      sendCommand('SetVolume', { volume: i, useDecibel: true, source: 'Lounge Music' });
      sendCommand('SetVolume', { volume: i, useDecibel: true, source: 'MTV' });
      sendCommand('SetMute', { mute: true, source: 'BM800' });
    }

    sendCommand('SetCurrentScene', { 'scene-name': newscene });
  }
bilogic commented 5 months ago

All the volume control seems to gone SetVolume, SetMute seems to be gone