Author Topic: BASS_ChannelPlay crashes application when using tempo stream  (Read 488 times)

Tanner

  • Guest
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?
Code: [Select]
        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)
...

Ian @ un4seen

  • Administrator
  • Posts: 26222
Those are very old BASS and BASS_FX versions. Please try replacing them with the latest versions from the BASS webpage and see if you still have the problem then. If it does still happen, is that with a particular file/format or all?

Tanner

  • Guest
The format I’m trying to use is mp3. As for updating, would I just download and replace the DLLs? Not sure how that works since I’m trying to run this in java. I’m using the latest download of the Java port NativeBass.

Ian @ un4seen

  • Administrator
  • Posts: 26222
Yes, newer 2.4.x releases are back-compatible with older ones, so you can simply replace the DLLs.

Tanner

  • Guest
I was able to replace the bass and bass_fx dll and get a tempo stream to play audio. Thanks.