0
0

Ok, I’ve searched forums and help file and can’t figure something out. How do I play an OGG file from memory? I am using .NET and here is what I have:

Dim tmpBytes() As Byte
Dim tmpInfo As New FMOD.CREATESOUNDEXINFO

tmpBytes = ‘… here i fill in from a stream the actual file
tmpInfo.length = tmpBytes.Length

_FMod.createStream(tmpBytes, FMOD.MODE.OPENMEMORY, tmpInfo, _bgmTrackStream)
_FMod.playSound(FMOD.CHANNELINDEX.FREE, _bgmTrackStream, False, _bgmChannel)

But when I run this, I get invalid param error on both of the calls. The tmpBytes array holds the ogg file.

Can anyone please let me know what I am doing wrong? P.S. Yes, I did initialize the fmod system and it does play when streamed from the file. It is just not working for loading from memory.

I am using VS2003 VB.NET 1.1. Thank you in advance.

  • You must to post comments
0
0

Ok, so I have added the cbsize in there (in the docs, it sais only length needs to be filled in.) But I do not explicitly set any other paremeters, so my statement now looks like:

Dim tmpInfo As New FMOD.CREATESOUNDEXINFO
tmpInfo.length = Convert.ToUInt32(tmpBytes.Length)
tmpInfo.suggestedsoundtype = FMOD.SOUND_TYPE.OGGVORBIS
tmpInfo.cbsize = System.Runtime.InteropServices.Marshal.SizeOf(tmpInfo)

But now the create stream throws ERR_FORMAT and the playsound still throws ERR_INVALID_PARA.

I have checked my tmpBytes and it does have OGG file data.

  • You must to post comments
0
0

Ok ok, I have now changed the file to an MP3 file and it does load, it give OK to both functions, but I only hear 1/2 second of sound and then it cuts off. Do I need to have a function called to keep the sound playing every so often? I thought in Win32 we did not need to call updatesound anymore.

P.S. The OGG file in question plays fine when streamed from HDD, but does not play through memory.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.