예제 #1
0
        public void TestOpenWithDefaultOK()
        {
            //Console.WriteLine(System.IO.Path.GetFullPath("."));
            //Tryed to absolute point at plugin folder to understand if the error was due to releative path issue.
            Out123 handle = new Out123("C:\\_fdf\\projects\\workspace_aiv\\LEZ39_20180322\\aiv-mpg123_git\\Aiv.Mpg123.Tests\\bin\\Debug\\plugins");

            handle.Open();
            Assert.AreEqual(Out123.Errors.OK, handle.LastErrorString());
        }
예제 #2
0
        static void Main(string[] args)
        {
            foreach (string decoder in Mpg123.Decoders)
            {
                Console.WriteLine(decoder);
            }

            Out123 out123 = new Out123();

            out123.Open();

            Mpg123 mpg123 = new Mpg123();

            mpg123.Open("Assets/bensound-epic.mp3");

            int offset = 0;

            while (true)
            {
                byte[]        data  = null;
                uint          size  = 0;
                Mpg123.Errors error = mpg123.DecodeFrame(ref offset, ref data, ref size);
                if (error == Mpg123.Errors.NEW_FORMAT)
                {
                    long rate     = 0;
                    int  channels = 0;
                    int  encoding = 0;
                    mpg123.GetFormat(ref rate, ref channels, ref encoding);
                    out123.Start(rate, channels, encoding);
                }
                else if (error == Mpg123.Errors.OK)
                {
                    out123.Play(data);
                }
            }

            Console.ReadLine();
        }
예제 #3
0
        public void TestOpenWithDefaultOK()
        {
            Out123 handle = new Out123("invalid-plugin-path");

            Assert.That(() => handle.Open(), Throws.TypeOf <Out123.ErrorException>());
        }