Skip to content

Commit

Permalink
Made AudioMixer the default sound system
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Dec 19, 2024
1 parent 50df6b1 commit 82f23e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ configurations {

repositories {
mavenCentral()
maven {
name = "Lenni0451"
url = "https://maven.lenni0451.net/everything"
}
}

dependencies {
include "net.raphimc:NoteBlockLib:2.1.4-SNAPSHOT"
include "net.raphimc:audio-mixer:2.0.0-SNAPSHOT"
include "net.raphimc:NoteBlockLib:2.1.4"
include "net.raphimc:audio-mixer:2.0.0"
include "org.jcraft:jorbis:0.0.17"
include "com.formdev:flatlaf:3.5.4"
include "net.lenni0451.commons:swing:1.6.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static void close() {
private final ListFrame.LoadedSong song;
private final MonitoringSongPlayer songPlayer;
private final Timer updateTimer;
private final JComboBox<String> soundSystemComboBox = new JComboBox<>(new String[]{"OpenAL (best sound quality)", "Un4seen BASS", "AudioMixer (best system compatibility)", "AudioMixer multithreaded (experimental)", "XAudio2 (Windows 10+ only)"});
private final JComboBox<String> soundSystemComboBox = new JComboBox<>(new String[]{"AudioMixer", "OpenAL", "Un4seen BASS", "AudioMixer multithreaded (experimental)", "XAudio2 (Windows 10+ only)"});
private final JSpinner maxSoundsSpinner = new JSpinner(new SpinnerNumberModel(256, 64, 40960, 64));
private final JSlider volumeSlider = new JSlider(0, 100, 50);
private final JButton playStopButton = new JButton("Play");
Expand Down Expand Up @@ -249,13 +249,13 @@ private void initComponents() {

private boolean initSoundSystem() {
final int currentIndex;
if (this.soundSystem instanceof OpenALSoundSystem) {
currentIndex = 0;
} else if (this.soundSystem instanceof BassSoundSystem) {
currentIndex = 1;
} else if (this.soundSystem instanceof MultithreadedAudioMixerSoundSystem) {
if (this.soundSystem instanceof MultithreadedAudioMixerSoundSystem) {
currentIndex = 3;
} else if (this.soundSystem instanceof AudioMixerSoundSystem) {
currentIndex = 0;
} else if (this.soundSystem instanceof OpenALSoundSystem) {
currentIndex = 1;
} else if (this.soundSystem instanceof BassSoundSystem) {
currentIndex = 2;
} else if (this.soundSystem instanceof XAudio2SoundSystem) {
currentIndex = 4;
Expand All @@ -273,11 +273,11 @@ private boolean initSoundSystem() {
final int maxSounds = ((Number) this.maxSoundsSpinner.getValue()).intValue();

if (this.soundSystemComboBox.getSelectedIndex() == 0) {
this.soundSystem = OpenALSoundSystem.createPlayback(soundData, maxSounds);
this.soundSystem = new AudioMixerSoundSystem(soundData, maxSounds, this.songPlayer.getSongView().getSpeed());
} else if (this.soundSystemComboBox.getSelectedIndex() == 1) {
this.soundSystem = BassSoundSystem.createPlayback(soundData, maxSounds);
this.soundSystem = OpenALSoundSystem.createPlayback(soundData, maxSounds);
} else if (this.soundSystemComboBox.getSelectedIndex() == 2) {
this.soundSystem = new AudioMixerSoundSystem(soundData, maxSounds, this.songPlayer.getSongView().getSpeed());
this.soundSystem = BassSoundSystem.createPlayback(soundData, maxSounds);
} else if (this.soundSystemComboBox.getSelectedIndex() == 3) {
this.soundSystem = new MultithreadedAudioMixerSoundSystem(soundData, maxSounds, this.songPlayer.getSongView().getSpeed());
} else if (this.soundSystemComboBox.getSelectedIndex() == 4) {
Expand Down

0 comments on commit 82f23e2

Please sign in to comment.