Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- src/javazoom/jl/player/Player.java 2008-11-16 17:34:07.000000000 +0100
- +++ src/javazoom/jl/player/Player.java 2018-07-29 23:45:42.383258868 +0200
- @@ -136,6 +136,20 @@
- }
- return ret;
- }
- +
- + public boolean setGain(float newGain) {
- + if (audio instanceof JavaSoundAudioDevice) {
- + System.out.println("InstanceOf");
- + JavaSoundAudioDevice jsAudio = (JavaSoundAudioDevice) audio;
- + try {
- + jsAudio.write(null, 0, 0);
- + } catch (JavaLayerException ex) {
- + ex.printStackTrace();
- + }
- + return jsAudio.setLineGain(newGain);
- + }
- + return false;
- + }
- /**
- * Cloases this player. Any audio currently playing is stopped
- --- src/javazoom/jl/player/JavaSoundAudioDevice.java 2008-11-16 17:34:07.000000000 +0100
- +++ src/javazoom/jl/player/JavaSoundAudioDevice.java 2018-07-29 23:44:22.769057955 +0200
- @@ -85,6 +85,19 @@
- setOpen(true);
- }
- }
- +
- + public boolean setLineGain(float gain)
- + {
- + System.out.println("Vor Source");
- + if (source != null) {
- + System.out.println("Nach Source");
- + FloatControl volControl = (FloatControl) source.getControl(FloatControl.Type.MASTER_GAIN);
- + float newGain = Math.min(Math.max(gain, volControl.getMinimum()), volControl.getMaximum());
- + volControl.setValue(newGain);
- + return true;
- + }
- + return false;
- + }
- protected void openImpl()
- throws JavaLayerException
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement