예제 #1
0
def increase_volume(p, l):
    """ Increases the master volume """
    current_volume = volume.get_current_volume()

    if current_volume - MIN_VOLUME < 2:
        new_volume = -15  # If the volume is very low then we increase it by ~ half, just my personal preference
    elif current_volume < MAX_VOLUME:
        new_volume = current_volume + 5

    if current_volume == MAX_VOLUME:
        return

    if new_volume > MAX_VOLUME:
        new_volume = MAX_VOLUME
    elif new_volume < MIN_VOLUME:
        new_volume = MIN_VOLUME

    print("Current volume:", current_volume)
    print("New volume:", new_volume)

    volume.set_volume(new_volume)
예제 #2
0
def reduce_volume(p, l):
    """ Reduces the system master volume """
    current_volume = volume.get_current_volume()

    if current_volume > 0 or current_volume == 0:
        new_volume = -15  # If the volume is full then we reduce it by ~ half, just my personal preference
    elif current_volume < 0:
        new_volume = current_volume - 5

    if current_volume == MIN_VOLUME:
        return

    if new_volume > MAX_VOLUME:
        new_volume = MAX_VOLUME
    elif new_volume < MIN_VOLUME:
        new_volume = MIN_VOLUME

    print("Current volume:", current_volume)
    print("New volume:", new_volume)

    volume.set_volume(new_volume)
예제 #3
0
def mute_pc(p, l):
    """ Sets the system volume to the minimum """
    global previous_volume
    respond("PC muted", say_wait=True)
    previous_volume = volume.get_current_volume()
    volume.set_volume(volume.get_volume_range()[0])