0
0

Hi,

I have a problem that i can not solve, about the simple fact to load and play a .mod file from a programm developped in VB.Net

what happen is that when i call the FMUSIC_PlaySong() function,
i don’t get an error code, but an exception is thrown : System.NullReferenceException

Here is rougly what i have :
declaration :
Public Declare Function FMUSIC_LoadSong Lib “fmod.dll” Alias “_FMUSIC_LoadSong@4” (ByVal name As String) As Long
Public Declare Function FMUSIC_PlaySong Lib “fmod.dll” Alias “_FMUSIC_PlaySong@4” (ByVal module1 As Long) As Byte
Public Declare Function FSOUND_Init Lib “fmod.dll” Alias “_FSOUND_Init@12” (ByVal mixrate As Long, ByVal maxchannels As Long, ByVal flags As FSOUND_INITMODES) As Byte

and then if i simply call :
Dim songHandle As Long
result = FSOUND_Init(44100, 32, 0)
songHandle = FMUSIC_LoadSong(“d:\enter.mod”)
result = FMUSIC_PlaySong(songHandle) -> System.NullReference exception thrown here

of course, in my real code, i test the return values, and they are all ok

I never used this DLL, but can’t understand what is going on. Does the dll relay on any other thing that could be missing on my system ?

If this could help : i was before using another .dll to play .mod files. But recently, we had the same exception happening when playing the file!! What a surprise when i found out that i have the same exception using fmod.dll

Thanks for any help, and sorry if it is a stupid question

  • You must to post comments
0
0

and then if i simply call :
Dim songHandle As Long
result = FSOUND_Init(44100, 32, 0)
songHandle = FMUSIC_LoadSong(“d:\enter.mod”)
result = FMUSIC_PlaySong(songHandle) -> System.NullReference exception thrown here

I’m thinking it’s because “result” isn’t declared, or is it somewhere else? Also, you shouldn’t be using 64-bit Longs, use an Integer which is 32-bit.

VB6:
Long = 32-Bit
Integer = 16-Bit

VB.NET:
Long = 64-Bit
Integer = 32-Bit

  • You must to post comments
0
0

yes, i finally found a way to make it work, and i think you are right, my problem was about long/int declaration, thanks

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.