I'm using the Java port of Bass, NativeBass. I am creating a tempo stream because I eventually want to be able to speed up/down the music with pitch adjusted. I can create a stream using BASS_StreamCreateFile and play it as expected but when I add a call to BASS_TempoCreate, it then causes BASS_ChannelPlay to crash the program. I tried called BASS_ErrorGetCode after each call to BASS library but there is no error codes reported (everything is code 0 BASS_OK).
Here is a minified example I created to reproduce issue. Any ideas on what I'm doing wrong/missing?
BassInit.loadLibraries();
System.out.println("BASS FX loaded: " + BassInit.isPluginFxLoaded());
System.out.println(BassInit.BASSVERSION());
System.out.println("Bass version: " + String.format("0x%08X", BASS_GetVersion()));
System.out.println("Bass FX version: " + String.format("0x%08X", BASS_FX_GetVersion()));
int deviceId = 1;
BASS_Init(deviceId, 44100, 0, null, null);
BASS_SetDevice(deviceId);
int flags = BASS_STREAM_PRESCAN | BASS_STREAM_DECODE;
HSTREAM stream = BASS_StreamCreateFile(false, "res/audio.mp3", 0, 0, flags);
if(stream != null) {
HSTREAM streamfx = BASS_FX_TempoCreate(stream.asInt(), BASS_FX_FREESOURCE);
boolean isPlaying = BASS_ChannelPlay(streamfx.asInt(), false);
System.out.println("play_err: " + BASS_ErrorGetCode() + isPlaying);
final Scanner scanner = new Scanner(System.in);
scanner.nextInt();
BASS_ChannelStop(streamfx.asInt());
BASS_StreamFree(streamfx);
}
BASS_StreamFree(stream);
BASS_Free();
//output
BASS FX loaded: true
516
Bass version: 0x02040802
Bass FX version: 0x02040701
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc393044d3, pid=8760, tid=2828
#
# JRE version: OpenJDK Runtime Environment Corretto-17.0.5.8.1 (17.0.5+8) (build 17.0.5+8-LTS)
...