0
0

First, I have worked on this for 3 days straight with no success. 😮 I am using c# but would take info in C++ also.

I have loaded a short mp3 file into a BinaryStream
binReader = new BinaryReader(new FileStream(“c:\test.mp3”,System.IO.FileMode.Open));

Stream myMp3Stream=binReader.BaseStream;

This, of course, would be the compressed mp3 file.

Now I want to play the file from the myMp3Stream

If you could give me c# code that would be great.

Please point me in the right direction. My experience at this level of programming is a bit light.

  • You must to post comments
0
0

I think one way to do this is from a user created stream, but you have to feed the audio into fmod from your file buffer. Why stream the file yourself when fmod can handle it quite nicely??

  • You must to post comments
0
0

Ok, I got this working per your information. I have only one issue. I found in the help file:

Loading a file from memory.
Create the sound using the FMOD_OPENMEMORY flag.
Mandatory. Specify ‘length’ for the size of the memory block in bytes.
Other flags are optional.

I put the mp3 compressed data into an array of bytes called outMp3
then I used
createsoundexinfo.length = (uint)outMp3.Length;
Only part of the sample plays. If I double the size of the length the complete sample plays and sometimes repeats part of it depending on the sample played. This is only a 1.5 second sound byte. On a 53 second sound byte it repeats the last few seconds several times before stopping with the above buffer length. If I double the buffer on the 53:31 second sound byte it initially says it is 1:50:75 minutes in length but after a few seoncs adjusts to 53:31

How do you determine the proper length to put into the soundexinfo?

I added a .net wrapper for the FMOD_System_CreateSound function in the fmod.cs and created a new version of the c# createSound to include passing an array of bytes.

  • You must to post comments
0
0

I’ve got exactly the same configuration … I have to read a MP3 which is into a BinaryReader, and i’ve no idea how to do it … So if someone has find the solution, it will be nice to explain it !
Thank you, and sorry for my very bad english 😕 …
See ya !
L.S.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.