Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

loading OGG music from file?

$
0
0

@alexribeirodesa wrote:

hello,

I'm working in a project that I need to load the musics from a file in another computer (let's call it as a server)... so the admin can add and remove the musics he want when he want... so as far I know use the default monogame content pileline stuff isn't a option... :frowning:

what I've done so far, I loaded wav files with success with this:

FileStream fileStream = null;
fileStream = new FileStream("//path_to_file/teste.wav", FileMode.Open);

byte[] data = new byte[fileStream.Length];
fileStream.Read(data, 0, data.Length);

Stream stream = new MemoryStream(data);

effect = SoundEffect.FromStream(stream);
fileStream.Dispose();

effect.Play();

ok, it's works, it's play the music, but wav file is HUGE!!!
issue, the same code didn't play the OGG file (err: Specified stream is not a wave file) :frowning: there any way to do that with MG in a easy way, or I will need to decode the ogg first then play it??

in another topic, a MG dev (I've forgot who) said about a XACT file, that MG support it every platform, this is a great option too if there a easy way to convert from wav, mp3 or ogg to in a easy way, using something like ffmpeg...

I'm developing the application on windows but the final will run in linux arm (aka RPIZero)

thanks :smiley:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles