Package one.pkg.tinyutils.sounds
Class VolumeControl
java.lang.Object
one.pkg.tinyutils.sounds.VolumeControl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the volume level for all available volume servicesGet all available volume service informationGet the volume level of the current volume servicevoidintsetAllVolumes(float volume) Sets the volume level for all available volume servicesbooleansetCurrentVolume(float volume) Sets the volume level for the current volume servicebooleanswitchToVolumeService(int serviceIndex) Switch the current volume service to another volume service.booleanswitchToVolumeServiceByName(String serviceName) Switch volume service by name
-
Constructor Details
-
VolumeControl
public VolumeControl()
-
-
Method Details
-
getAllVolumeServices
Get all available volume service information -
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
-
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
Switch volume service by name- Parameters:
serviceName- service name- Returns:
- whether the switch succeeded
-
resetCurrentService
public void resetCurrentService()
-