0
0

I am using FMOD for the first time this week. I’m amazed at its real value that it has. I just wish I had found it earlier. I’m working in C# .NET but would like to update an old VB6 program with FMOD but everytime I go to FMOD_SYSTEM_CREATESTREAM or FMOD_SYSTEM_CREATESOUND I get an error returned of invalid parameter. I’ve tried changing all parameters but am having no luck. This is the same error that all of the SampleVB apps give me as well. Can someone just point me in the right direction? I have included code that I have in the VB6 test form I am using as a proof of concept right now. Thanks in advance for any pointers!!

[code:30paouqn]Option Explicit

Private m_lngSystem As Long
Private m_lngChannel As Long
Private m_lngSound As Long

Private Sub m_objCloseFMODButton_Click()
Call FMOD_System_Release(m_lngSystem)
End Sub

Private Sub m_objFMODInitButton_Click()
Dim lngResult As Long
Dim lngVersion As Long

lngResult = FMOD_System_Create(m_lngSystem)
Call ERRCheck(lngResult)

lngResult = FMOD_System_GetVersion(m_lngSystem, lngVersion)
ERRCheck (lngResult)

If lngVersion <> FMOD_VERSION Then
    MsgBox "Error!  You are using an old version of FMOD " & Hex$(lngVersion) & ". " & _
           "This program requires " & Hex$(FMOD_VERSION)
End If

lngResult = FMOD_System_Init(m_lngSystem, 1, FMOD_INIT_NORMAL, 0)
ERRCheck (lngResult)

End Sub

Private Sub m_objPlayFileButton_Click()
Dim lngResult As FMOD_RESULT

lngResult = FMOD_System_CreateSound(m_lngSystem, "C:\Greatest.wav", FMOD_SOFTWARE Or FMOD_2D, m_lngSound)

‘ERROR OCCURS ON THIS CHECK!! ERROR 37 – INVALID PARAMETER.

Call ERRCheck(lngResult)
Exit Sub

lngResult = FMOD_System_PlaySound(m_lngSystem, FMOD_CHANNEL_FREE, m_lngSound, False, m_lngChannel)
Call ERRCheck(lngResult)
Exit Sub

End Sub

Private Sub m_objStopSoundButton_Click()
Dim lngResult As Long

lngResult = FMOD_Channel_Stop(m_lngChannel)
Call ERRCheck(lngResult)

End Sub

Public Sub ERRCheck(ByVal lngResult As Long)
If (lngResult <> 0) Then
MsgBox lngResult & "::" & fmod_errors.FMOD_ErrorString(lngResult)
End If
End Sub[/code:30paouqn]

  • You must to post comments
0
0

The basic files are not updated for the latest fmodex versions (FMOD_CREATESOUNDEXINFO has grown, and passing a smaller one results in this error);

Either update it, or, if you don’t need this structure to be passed (as I guess), update fmodex.bas this way:

change FMOD_System_CreateSound and FMOD_System_CreateStream declarations to:
Public Declare Function FMOD_System_CreateSoundEx Lib "fmodex.dll" Alias "FMOD_System_CreateSound" (ByVal system As Long, ByVal Name_or_data As String, ByVal Mode As FMOD_MODE, ByVal exinfo As Long, ByRef Sound As Long) As FMOD_RESULT
Public Declare Function FMOD_System_CreateStreamEx Lib "fmodex.dll" Alias "FMOD_System_CreateStream" (ByVal system As Long, ByVal Name_or_data As String, ByVal Mode As FMOD_MODE, ByVal exinfo As Long, ByRef Sound As Long) As FMOD_RESULT

And update the functions:

‘ WRAPPED FMODEX CREATESOUND FUNCTIONS
Public Function FMOD_System_CreateSound(ByVal system As Long, ByVal Name_or_data As String, ByVal Mode As FMOD_MODE, ByRef Sound As Long) As FMOD_RESULT
Dim result As FMOD_RESULT

result = FMOD_System_CreateSoundEx(system, Name_or_data, Mode, 0&amp;, Sound)

FMOD_System_CreateSound = result

End Function

Public Function FMOD_System_CreateStream(ByVal system As Long, ByVal Name_or_data As String, ByVal Mode As FMOD_MODE, ByRef Sound As Long) As FMOD_RESULT
Dim result As FMOD_RESULT

result = FMOD_System_CreateStreamEx(system, Name_or_data, Mode, 0&amp;, Sound)

FMOD_System_CreateStream = result

End Function

  • You must to post comments
0
0

Thanks for this find, we’ll update the VB headers for the next release.

  • You must to post comments
0
0

Controller – [b:1ac0dal3]THANKS A TON![/b:1ac0dal3] Your find was the exact issue. I had tried many work arounds to this issue, including a piece of the final result, but I never went back through the module to check where the functions were being declared! You have just saved me a ton of work in having to go and use some other backend for my software.

Brett – thanks for getting those files updated. I’m sure that support for VB6 is dying as the softare community, in large part, continues to go the way of .NET. There are still some uses for the language out there! Seldom as they are – they exists!

Thanks again everyone for working on this! Extremely helpful and the response time was phenominal!

  • You must to post comments
0
0

Im new programing under Visual Basic 6, Im from Delphi and Python style, but in this case, I need make some change in a old program maded by a guy.
I started trying examples from Zip, but I was too frustrated cos It wont run.
VB6 its a nice RAD, but, I think I cant change my Python.
Thanks again.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.