开发者

Lib to play audio media in .NET?

开发者 https://www.devze.com 2022-12-19 23:27 出处:网络
I tried fmod.net but got a \'System.BadImageFormatException\' error. I then tried WindowsMediaPla开发者_JS百科yer and have sounds playing. However i am having issues playing a sound when the current o

I tried fmod.net but got a 'System.BadImageFormatException' error. I then tried WindowsMediaPla开发者_JS百科yer and have sounds playing. However i am having issues playing a sound when the current one ends (callback code below. It doesnt seem to like me playing a new song during a state change however i cant find another way to inform me when the song is done) and using this link i was able to get title but not artist, album etc.

What lib can i use to play back sound (mp3, m4a and i would like ogg and aac). I looked up FFMPEG.NET and found a project with no release and another called fflib which seems to do conversions only (and also had the bad image exception). What may i use? or How do i get the title/artist/etc in WMPLib.WindowsMediaPlayer and have it play another song when one ends (i do not want to add a playlist inside of WMP. I'd like to maintain it and just be notified when a song ends to do further actions).

    private void Player_PlayStateChange(int NewState)
    {
        var newState = (WMPLib.WMPPlayState)NewState;
        Console.WriteLine(newState);
        //if (newState == WMPLib.WMPPlayState.wmppsMediaEnded)
        if (newState == WMPLib.WMPPlayState.wmppsStopped)
        {
            next();
        }
    }


The 'System.BadImageFormatException' is caused by using libraries for different platforms. If the library you use is x86, you have to set your target platform to x86, not Any CPU (assume running on x64).


You can use NAudio on Codeplex.


Have you tried Bass.Net?

0

精彩评论

暂无评论...
验证码 换一张
取 消