Hi Ian,
Thank you for getting back to me.
Yes, I was already doing `BASS_FX_GetVersion()` earlier in the code.
But because I keep getting the error, `
Value cannot be null` when doing `
BASS_FXSetParameters`, that is why I tried `BASS_PluginLoad()`, just to be sure that the
.so file was indeed there.
And it is, the file is there.
The thing is,
when I do NOT do `BASS_FXSetParameters`, the mp3 plays fine.
But when I apply it, I get the error.
MY INIT CODE: // Apply global settings
try
{
BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 3000); // increasing the device buffer length, default is 30ms
BASS_SetConfig(BASSConfig.BASS_CONFIG_DEV_BUFFER, 30); // increasing the device buffer length, default is 30ms
BASS_SetConfig(BASSConfig.BASS_CONFIG_FLOATDSP, true); // Pass 32-bit floating-point sample data to all DSP functions.
Debug.Log("BASS_SetConfig succeeded.");
}
catch (Exception ex)
{
Debug.LogError($"BASS_SetConfig: {ex.Message}");
}
// Initialize the BASS library
if (!BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, IntPtr.Zero))
{
Debug.Log("BASS initialized successfully.");
// Check BASS version
if ((BASS_GetVersion() & 0xFFFF0000) != (BASSVERSION << 16))
{
Debug.LogError($"BASS version mismatch: {BASS_ErrorGetCode()}");
return;
}
// Check BASS_FX version
if ((BASS_FX_GetVersion() & 0xFFFF0000) != (BASSFXVERSION << 16))
{
Debug.LogError($"BASS_FX version mismatch: {BASS_ErrorGetCode()}");
return;
}
Debug.Log("BASS and BASS_FX versions match and are loaded.");
}
else
{
Debug.LogError($"Failed to initialize BASS: {BASS_ErrorGetCode()}");
}
AND ELSEWHERE, PlayMp3 method: FxHandleReverb = BASS_ChannelSetFX(mp3StreamHandle, BASSFXType.BASS_FX_BFX_FREEVERB, 1);
BASS_BFX_FREEVERB reverbParams = new BASS_BFX_FREEVERB
{
fDryMix = 1f,
fWetMix = 1.5f
};
reverbParams.fRoomSize = 0.50f;
reverbParams.fDamp = 0.5f;
reverbParams.fWidth = 1.0f;
if (reverbParams == null)
{
Debug.LogError("Reverb parameters are null.");
yield return 0;
}
try
{
if (!BASS_FXSetParameters(FxHandleReverb, reverbParams))
{
throw new Exception($"Failed to set BASS FX Reverb parameters. Error code: {BASS_ErrorGetCode()}");
}
}
catch (Exception ex)
{
Debug.LogError($"Exception while setting BASS FX Reverb parameters: {ex.Message}");
}
THE ERROR I GET:12-09 10:16:31.938 789 1362 E Unity : Exception while setting BASS FX Reverb parameters: Value cannot be null.
12-09 10:16:31.938 789 1362 E Unity : Parameter name: obj
12-09 10:16:31.938 789 1362 E Unity : UnityEngine.Logger:Log(LogType, Object)Here is the full logging in my PlayMp3 method:12-09 10:16:31.923 789 1362 I Unity : doReverb is enabled. Starting reverb effect setup.
12-09 10:16:31.924 789 1362 I Unity : Removing existing reverb effect. FxHandleReverb: -2147483643
12-09 10:16:31.928 789 1362 I Unity : Reverb effect removed: False
12-09 10:16:31.929 789 1362 I Unity : Stream handle: -2147483639
12-09 10:16:31.931 789 1362 I Unity : New FxHandleReverb: -2147483638
12-09 10:16:31.932 789 1362 I Unity : FxHandleReverb: -2147483638
12-09 10:16:31.933 789 1362 I Unity : Setting reverb preset values.
12-09 10:16:31.934 789 1362 I Unity : Reverb preset values applied. RoomSize: 1
12-09 10:16:31.935 789 1362 I Unity : Reverb settings - Damp: 0.5, Width: 1
12-09 10:16:31.936 789 1362 I Unity : Applying reverb parameters using BASS_FXSetParameters.
12-09 10:16:31.938 789 1362 E Unity : Exception while setting BASS FX Reverb parameters: Value cannot be null.12-09 10:16:31.939 789 1362 I Unity : FxVolume: 1
12-09 10:16:31.940 789 1362 I Unity : FxPitch: 0
12-09 10:16:31.941 789 1362 I Unity : FxTempo: 0
12-09 10:16:31.942 789 1362 I Unity : FxTempo PREVENT_CLICK: 0
12-09 10:16:31.954 789 1362 I Unity : Playing: /storage/emulated/0/Android/data/com.***.***app/files/63d3b8f5-31d3-44fb-8447-96fe966f7bcf.mp3
12-09 10:16:31.957 789 1362 I Unity : streamHandleMp3: -2147483639
12-09 10:16:34.980 789 1362 I Unity : Stopping active Shoutcast stream.
I am not sure why this is happening?
Thanks for your help.