Hi guys,
So, I’m building an audio game for WP8.1 and I’m hitting some brick walls. I can load MP3 files at runtime absolutely fine on other more desktop-y platforms (using mpg123) but it it’s throwing this error when I run it on my phone:
It’s thrown at the first instance of mpg123 being used (mpg123_init()) and google tells me that this is something along the lines of an incompatibility between the code in the dll (unmanaged C++ x86… or something) and the processor (ARM).
I’m fairly new to this and I am completely stumped. I’ve looked at other MP3 decoders that claim to have ARM compatibility but they go way, way over my head. The only reason I can use mpg123 at all is because it came with a C# wrapper.
Is there a way around this? A fix? An alternative?
Thanks =)
You need to get a plugin compiled for Windows Phone 8.1, looking at this plugin, it’s obvious it’s not compatible with Windows Phone 8.1… Try searching the internet for mp3 plugin for Windows Store Apps, also try checking this forum - Microsoft Q&A | Microsoft Learn
Also there is such thing as BackgroundAudioPlayer - Background audio overview for Windows Phone 8 | Microsoft Learn which might help, but it will require some knowledge to make it work
Hi,
as Tomas mentioned, your native DLL is not compiled for Windows Phone 8.1. Now, you have a couple of options:
- Recompile the DLL from source yourself - might require some C/C++ knowledge;
- Find a plugin that’s compatible with Windows Phone;
- Use Windows Phone 8.1 API - might be the most straightforward, though not really crossplatform way.
What exactly do you need to do with MP3s? Just replay them? Decompress and extract raw PCM? Do something else?
Hi Tomas, Tautvydas,
All I want to do is read the FFT data from the current playing track. This plugin I have I think decodes the MP3 into raw bits which I could create an audio clip from at runtime and then use AudioSource.GetSpectrumData(). As far as I can tell the source isn’t available for mpg123 so option number 1 isn’t happening. There’s a plugin called MP3Sharp which uses the memory stream so I’m looking into porting that to a WP8.1 compatible plugin. I wish there was an easier way but it doesn’t look like it, does it…
I found this online, looks like it’s fairly straightforward to do if you don’t mind doing it in a platform specific way:
It’s in VB, but should be fairly simple to convert that to C#.
Yeah, that definitely seems like the right direction. Thank you, Tautvydas.
I’ve ported the entire thing to the best of my ability but I’ve hit a brick wall. I’m not sure if I should ask for help on it here as it is not a Unity issue at this point. I’ll have a look around, perhaps post on Stack Overflow. I’ll post back here if I get it working. I’m surprised no one else has tried doing this yet (with Unity on W8/WP8, I mean).
Waheey! Successfully ported it to C# for windows apps. The next hurdle is sending that data to Unity… jesus. I need to open up the file picker for WP8.1 for this to work (for memory’s sake it would make sense to do it this way rather than create a file picker in Unity) but I’m getting an error to do with threading… yay. This is a new issue entirely so I’ll change the title and update the first post tomorrow.