0
0

I have been trying to play a song from a byte array now(format .xm). since I’m playing from a byte array I need an CREATESOUNDEXINFO object reference as a parameter. I have tried specifying different thing on the CREATESOUNDEXINFO object I have made, but I still get the same error from createsound; ERR_INVALID_PARAM.

Can anyone tell me what to do with the CREATESOUNDEXINFO object or something to be able to play from a byte[] array?

btw I’m using Visual studio .net and coding in C#

  • You must to post comments
0
0

Hi,

You should take a look at the "loadfrommemory" c# example included in the SDK.

  • You must to post comments
0
0

Here’s C# code that I use to load a sound file from a memory resource:
[code:1e1ry7lr] private void Load()
{
if (sound == null)
{
System.IO.Stream fmodrc = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType().Name + ".bin");
byte[] buf = new byte[fmodrc.Length];
fmodrc.Read(buf, 0, (int)fmodrc.Length);
fmodrc.Close();
FMOD.CREATESOUNDEXINFO sndinf = new FMOD.CREATESOUNDEXINFO();
sndinf.cbsize = System.Runtime.InteropServices.Marshal.SizeOf(sndinf);
sndinf.length = (uint)buf.Length;
ERRCHECK(system.createSound(buf, FMOD.MODE.OPENMEMORY, ref sndinf, ref sound));
}
}
[/code:1e1ry7lr]

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.