Skip to content

Commit

Permalink
Merge pull request #155 from Devoxin/fix/filterhotswap
Browse files Browse the repository at this point in the history
Small adjustments to Equalizer stuff
  • Loading branch information
freyacodes authored Oct 29, 2018
2 parents 21f135d + 555e1a5 commit 8d37af5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Using the player equalizer
]
}
```
There are 16 bands (0-15) that can be changed.
There are 15 bands (0-14) that can be changed.
`gain` is the multiplier for the given band. The default value is 0. Valid values range from -0.25 to 1.0,
where -0.25 means the given band is completely muted, and 0.25 means it is doubled. Modifying the gain could
also change the volume of the output.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public Supplier<AudioPlayerManager> audioPlayerManagerSupplier(AudioSourcesConfi
if (sources.isHttp()) audioPlayerManager.registerSourceManager(new HttpAudioSourceManager());
if (sources.isLocal()) audioPlayerManager.registerSourceManager(new LocalAudioSourceManager());

audioPlayerManager.getConfiguration().setFilterHotSwapEnabled(true);

return audioPlayerManager;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void setVolume(int volume) {
}

public void setBandGain(int band, float gain) {
log.debug("Setting band {}'s gain to {}", band, gain);
equalizerFactory.setGain(band, gain);

if (gain == 0.0f) {
Expand All @@ -110,7 +111,7 @@ public void setBandGain(int band, float gain) {
this.player.setFilterFactory(null);
this.isEqualizerApplied = false;
}
} else {
} else if (!this.isEqualizerApplied) {
this.player.setFilterFactory(equalizerFactory);
this.isEqualizerApplied = true;
}
Expand Down

0 comments on commit 8d37af5

Please sign in to comment.