0
0

I have a couple of problems with FMOD CE 3.6 in eMbedded Visual Basic 3.0 and I was hopeing someone could help me out.
First, when I declare the FMOD functions like:
[code:9hpcm2vp]
Public Declare Function FSOUND_Init Lib "fmod.dll" Alias "_FSOUND_Init@12" (ByVal mixrate As Long, ByVal maxchannels As Long, ByVal Flags As Long) As Byte
Public Declare Function FSOUND_Close Lib "fmod.dll" Alias "_FSOUND_Close@0" () As Long[/code:9hpcm2vp]

The declares work perfectly fine in the Pocket PC 2000 emulator but not on a a real Pocket PC 2002 PDA. However if I remove the Alias ” ” then it won’t work in Pocket PC 2000 Emu but works fine on Pocket PC 2002. How do I get it to work on both?

My next question is does FSOUND_Stream_OpenFile work in CE??
Here is my code:
[code:9hpcm2vp]Dim strm As Long
CommonDialog1.ShowOpen
Dim FilePath As String
FilePath = CommonDialog1.filename
strm = FSOUND_Stream_OpenFile(FilePath, FSOUND_16BITS Or FSOUND_UNSIGNED, 0)
If strm = 0 Then
MsgBox FSOUND_GetErrorString(FSOUND_GetError), vbCritical + vbOKOnly, “Open Stream”
Exit Sub
End If
If FSOUND_Stream_Play(FSOUND_FREE, strm) < 0 Then
MsgBox FSOUND_GetErrorString(FSOUND_GetError), vbCritical + vbOKOnly, “Play Stream”
End If[/code:9hpcm2vp]

FSOUND_Stream_OpenFile ALWAYS returns 0 with the ErrorString that the file is not found. I’ve tried manually typing in the location and different files but it doesn’t work. (BTW: I have already called FSOUND_Init and it works fine.) Here are my declare if anyone sees something wrong with this:

[code:9hpcm2vp]
Declare Function FSOUND_Stream_OpenFile Lib “fmodce.dll” (ByVal filename As String, ByVal mode As Long, ByVal memlength As Long) As Long[/code:9hpcm2vp]

HELP!

Eric (pceric@holly.colostate.edu)

  • You must to post comments
0
0

Something like this should get you going….

For the declares you need to specify the correct dll name on ce, which is fmodce.dll and remove the alias.

i.e.

Declare Function FSOUND_Stream_OpenFile Lib “fmodce.dll” (ByVal filename As String, ByVal mode As Long, ByVal memlength As Long) As Long

To open a stream you need to convert the filename string into the correct format:

Declares:

Public Declare Function WideCharToMultiByte Lib “coredll.dll” (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As String, ByVal cchWideChar As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long

Public Const CP_ACP = 0

Code snippet:
Dim sANSI As String ‘Variables are always declared as variants in EVB
Dim szbuf As Long ‘So the type names here are just for show

‘Get the length of the buffer we will need
szbuf = WideCharToMultiByte(CP_ACP, 0, sFilename, -1, sANSI, 0, “”, 0)

‘Allocate memory for the buffer by creating an empty string of the right size
sANSI = Space(szbuf)

‘Convert the UNICODE string into an ANSI string
Call WideCharToMultiByte(CP_ACP, 0, sFilename, -1, sANSI, szbuf, “”, 0)

‘Open the streaming file
AnnStream = FSOUND_Stream_OpenFile(sANSI, FSOUND_2D, 0)

If AnnStream <> 0 Then
AnnChannel = FSOUND_Stream_Play(FSOUND_FREE, AnnStream)
End If

Mase 8)

  • You must to post comments
0
0

Thanks Mase, didn’t realize I needed to convert it from UNICODE to ANSI.

However I didn’t catch why my delares don’t work for both Pocket PC 2000 and Pocket PC 2002.

Your example:
[quote:3jh5lsfp]Declare Function FSOUND_Stream_OpenFile Lib “fmodce.dll” (ByVal filename As String, ByVal mode As Long, ByVal memlength As Long) As Long
[/quote:3jh5lsfp]

This statement will not work under eMbedded Visual Basic 3.0 and the emulator. It says ‘Unable to load function FSOUND_Stream_OpenFile’.
However if I load it into my iPAQ with Pocket PC 2002 it works fine.

However if I Delare it with an alias such as:
Declare Function FSOUND_Stream_OpenFile Lib “fmodce.dll” Alias “_FSOUND_Stream_OpenFile@12” (ByVal filename As String, ByVal mode As Long, ByVal memlength As Long) As Long

It works great under eVB emu but not on my iPAQ (same error message)
The fmodce.dll gets loaded, as I don’t get an error message telling me it couldn’t load the .dll file.

Eric

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.