예제 #1
0
 def tick(self):
     if self.volume_changed:
         self.volume_changed = False
         self.client.call(
             requests.SetVolume(
                 list(self.audio_sources.values())[0], self.levels[0]))
         self.client.call(
             requests.SetVolume(
                 list(self.audio_sources.values())[1], self.levels[1]))
예제 #2
0
파일: obs.py 프로젝트: jubeatWwW/GDeck
 def DecVolume(self, *args):
     v = float(self.GetVolume(args[0]))
     if v >= 0.1:
         v -= 0.1
     elif v > 0:
         v = 0
     return self.ws.call(requests.SetVolume(args[0], v))
예제 #3
0
파일: obs.py 프로젝트: jubeatWwW/GDeck
 def IncVolume(self, *args):
     v = float(self.GetVolume(args[0]))
     if v <= 0.9:
         v += 0.1
     elif v < 1.0:
         v = 1.0
     return self.ws.call(requests.SetVolume(args[0], v))
예제 #4
0
    def audio_fade_out(self, name, transition_time=2):
        volume = self.get_audio_volume(name)
        if transition_time > 0:
            steps = volume / transition_time / 10
        else:
            steps = volume

        for i in range((transition_time * 10) + 1):
            res_volume = volume - ((i + 1) * steps)
            self._call(requests.SetVolume(name, res_volume, False))
            sleep(0.1)

        return self.audio_mute(name) and self.get_audio_volume(name) == 0
예제 #5
0
 def Sources_SetVolume(self, volume, SourceName="", *args, **kwargs): #Not tested
     try:
         volume = volume / 127
         minvolume = 0
         maxvolume = 1
         if "MinVolume" in kwargs:
         	minvolume = kwargs["MinVolume"]
         if "MaxVolume" in kwargs:
         	maxvolume = kwargs["MaxVolume"]
         volume = minvolume + volume * (maxvolume - minvolume)
         self.ws.call(requests.SetVolume(SourceName, volume))
         PrintWithTime(f"Set volume of source {SourceName} to {volume}")
     except Exception as e:
         PrintWithTime(f"Couldn't set volume of source {SourceName} to {volume}. Error : {e}")
예제 #6
0
    def audio_fade_in(self, name, transition_time=2):
        if not self.audio_unmute(name):
            return False

        volume = self.get_audio_volume(name)
        if transition_time > 0:
            steps = (1 - volume) / transition_time / 10
        else:
            steps = (1 - volume)

        for i in range((transition_time * 10) + 1):
            res_volume = volume + ((i + 1) * steps)
            self._call(requests.SetVolume(name, res_volume, False))
            sleep(0.1)

        return self.get_audio_volume(name) > 0.95
예제 #7
0
def SetSourceVolume(Action, Value, ws):
    if "SourceName" in Action:
        if Value == None:
            if "SourceVolume" in Action:
                Value = Action["SourceVolume"]
            else:
                Value = 0
        elif "MaxValue" in Action:
            if "MinValue" in Action:
                Value = (Action["MaxValue"] -
                         Action["MinValue"]) / 127 * Value + Action["MinValue"]
            else:
                Value = Action["MaxValue"] / 127 * Value
        try:
            ws.call(requests.SetVolume(Action["SourceName"], Value))
        except:
            print("Couldn't set source volume: " + str(Value * 100) + "%")
        else:
            PrintWithTime("Source volume was changed to " + str(Value * 100) +
                          "%")
    else:
        print("No SourceName argument in action config")
예제 #8
0
 def SetSourceVolume(self, SourceName, volume):
     try:
         self.ws.call(requests.SetVolume(SourceName, volume))
     except Exception as e:
         print(e)
예제 #9
0
 def set_volume(self, name, val):
     self.connection.call(requests.SetVolume(name, val))
예제 #10
0
 def change_volume_m(self, value):
     volume = float(value) / 100
     self.ws.call(
         requests.SetVolume(source=self.aud_sources.getMic1(),
                            volume=volume))
예제 #11
0
    def setVolume(self, source, vol):
        mapvol = map_scale(vol, 0, 127, 0, 1)

        deviceID, control, value
        self.ws.call(requests.SetVolume(source, mapvol))