Requirements:
I can't seem to find much from Googling about it. Has anyone used something like that?
I'm using C#, and it needs to work on Windows, Linux, and Mac, the latter two with Mono.
I might be willing to use p/invoke, but I'm not especially familiar with native code and it would be tough. If someone can suggest a native library, I'll give it a shot.
ManagedBass is new .NET Cross-Platform wrapper for un4seen Bass library with MIT license. It's not only wrapper - it has also objective API. Take a look at this blog post.
Here's example of playing file using wrapper API:
using ManagedBass;
class Program
{
static void Main()
{
Bass.Init(); // Initialize with default options.
int handle = Bass.CreateStream("YOUR_FILE.mp3");
Bass.ChannelPlay(handle); // Begin Playback.
Console.ReadKey(); // Wait till user presses a Key.
Bass.ChannelStop(handle); // Stop Playback.
Bass.ChannelFree(handle); // Free the Stream.
Bass.Free(); // Free the device.
}
}
Here's the same using objective API:
using ManagedBass;
class Program
{
static void Main()
{
using (var Player = new MediaPlayer()) // Create a Player.
{
Player.Load("YOUR_FILE.mp3"); // Load a file.
Player.Start(); // Begin Playback.
Console.ReadKey();
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With