using ManagedBass.Flac;
using ManagedBass;

namespace Harmonia.Core.Engine;

public class MediaPlayer : BaseMediaPlayer
{
    protected override int OnLoad(string FileName)
    {
        string extension = Path.GetExtension(FileName).ToLower();

        switch (extension)
        {
            case ".flac":
                return BassFlac.CreateStream(FileName);
            //case ".opus":
            //    return BassOpus.CreateStream(FileName);
            //case ".wma":
            //    return BassWma.CreateStream(FileName);
            //case ".mid":
            //    return BassMidi.CreateStream(FileName);
            default:
                return base.OnLoad(FileName);
        }
    }

    protected override void InitProperties()
    {
        base.InitProperties();

        ChannelInfo channelInfo = Bass.ChannelGetInfo(Handle);
        Frequency = channelInfo.Frequency;
    }
}