Skip to content

Commit

Permalink
Use stream when creating sample channels for better audio alteration
Browse files Browse the repository at this point in the history
Fixes an issue where `spinnerspin` samples sound choppy.
  • Loading branch information
Rian8337 committed Nov 13, 2024
1 parent 6e104a5 commit 4f5d5a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions LibBASS/src/main/java/com/un4seen/bass/BASS.java
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ public static class FloatValue {
public static native boolean BASS_SampleGetInfo(int handle, BASS_SAMPLE info);
public static native boolean BASS_SampleSetInfo(int handle, BASS_SAMPLE info);
public static native int BASS_SampleGetChannel(int handle, boolean onlynew);
public static native int BASS_SampleGetChannel(int handle, int flags);
public static native int BASS_SampleGetChannels(int handle, int[] channels);
public static native boolean BASS_SampleStop(int handle);

Expand Down
2 changes: 1 addition & 1 deletion src/ru/nsu/ccfit/zuev/audio/BassSoundProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void play(float volume) {
return;
}

int channel = BASS.BASS_SampleGetChannel(sample, false);
int channel = BASS.BASS_SampleGetChannel(sample, BASS.BASS_SAMCHAN_NEW | BASS.BASS_STREAM_DECODE);
applyAudioEffectsToChannel(channel);
BASS.BASS_ChannelSetAttribute(channel, BASS.BASS_ATTRIB_NOBUFFER, 1);
BASS.BASS_ChannelPlay(channel, false);
Expand Down

0 comments on commit 4f5d5a4

Please sign in to comment.