Class VolumeControl

java.lang.Object
one.pkg.tinyutils.sounds.VolumeControl

public class VolumeControl extends Object
  • Constructor Details

    • VolumeControl

      public VolumeControl()
  • Method Details

    • getAllVolumeServices

      public List<VolumeControl.VolumeServiceInfo> getAllVolumeServices()
      Get all available volume service information
    • getAllVolumes

      public List<VolumeControl.VolumeInfo> getAllVolumes()
      Gets the volume level for all available volume services
    • setAllVolumes

      public int setAllVolumes(float volume)
      Sets the volume level for all available volume services
      Parameters:
      volume - volume value, range from 0.0 to 1.0
      Returns:
      number of services successfully set
    • getCurrentVolumeService

      public Optional<VolumeControl.VolumeServiceInfo> getCurrentVolumeService()
    • getCurrentVolume

      public Optional<VolumeControl.VolumeInfo> getCurrentVolume()
      Get the volume level of the current volume service
    • setCurrentVolume

      public boolean setCurrentVolume(float volume)
      Sets the volume level for the current volume service
      Parameters:
      volume - volume level, range from 0.0 to 1.0
      Returns:
      whether the setting was successful
    • switchToVolumeService

      public boolean switchToVolumeService(int serviceIndex)
      Switch the current volume service to another volume service. Note: This only changes the mixer used by this wrapper class, not the default audio device of the operating system.
      Parameters:
      serviceIndex - service index
      Returns:
      whether the switch succeeded
    • switchToVolumeServiceByName

      public boolean switchToVolumeServiceByName(String serviceName)
      Switch volume service by name
      Parameters:
      serviceName - service name
      Returns:
      whether the switch succeeded
    • resetCurrentService

      public void resetCurrentService()