当前位置: 首页>>代码示例>>C#>>正文


C# LibsndfileApi.Open方法代码示例

本文整理汇总了C#中LibsndfileApi.Open方法的典型用法代码示例。如果您正苦于以下问题:C# LibsndfileApi.Open方法的具体用法?C# LibsndfileApi.Open怎么用?C# LibsndfileApi.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibsndfileApi的用法示例。


在下文中一共展示了LibsndfileApi.Open方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Open_ShouldThrowExceptionOnEmptyPath

        public void Open_ShouldThrowExceptionOnEmptyPath()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            api.Open(string.Empty, LibsndfileMode.Read, ref info);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:OpenTests.cs

示例2: Open_ShouldThrowExceptionOnNullPath

        public void Open_ShouldThrowExceptionOnNullPath()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            api.Open(null, LibsndfileMode.Read, ref info);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:7,代码来源:OpenTests.cs

示例3: Open_ShouldReturnZeroHandleOnEmptyFileHandle

        public void Open_ShouldReturnZeroHandleOnEmptyFileHandle()
        {
            var info = new LibsndfileInfo();

            var mock = new Mock<ILibsndfileApi>();
            mock.Setup(x => x.Open(It.IsAny<string>(), It.IsAny<LibsndfileMode>(), ref info)).Returns(IntPtr.Zero);

            var api = new LibsndfileApi(mock.Object);
            var retval = api.Open("junk.txt", LibsndfileMode.Read, ref info);

            Assert.AreEqual(IntPtr.Zero, retval);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:12,代码来源:OpenTests.cs

示例4: OpenWav_ReadWriteModeReturnsValidHandle

        public void OpenWav_ReadWriteModeReturnsValidHandle()
        {
            var api = new LibsndfileApi();
            var info = TestConfiguration.GetValidWavFileInfo();

            Assert.That(File.Exists(TestConfiguration.ValidWavFile));

            var open = api.Open(TestConfiguration.ValidWavFile, LibsndfileMode.Rdwr, ref info);
            Assert.That(open != IntPtr.Zero);

            var close = api.Close(open);
            Assert.That(close == LibsndfileError.NoError);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:13,代码来源:OpenTests.cs

示例5: CalcMaxAllChannels_ReturnsValidData

        public void CalcMaxAllChannels_ReturnsValidData()
        {
            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            var sndfile = api.Open(TestConfiguration.ValidWavFile, LibsndfileMode.Read, ref info);
            Assert.That(sndfile != IntPtr.Zero);

            var max = api.Commands.CalcMaxAllChannels(sndfile, info.Channels);
            Assert.That(max != null);
            Assert.That(max.Length == info.Channels);

            var close = api.Close(sndfile);
            Assert.That(close == LibsndfileError.NoError);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:15,代码来源:CalcMaxAllChannelsTests.cs

示例6: OpenWav_WriteModeReturnsValidHandle

        public void OpenWav_WriteModeReturnsValidHandle()
        {
            var api = new LibsndfileApi();
            var info = TestConfiguration.GetValidWavFileInfo();
            var filename = string.Format("tmp_{0}", TestConfiguration.ValidWavFile);

            var open = api.Open(filename, LibsndfileMode.Write, ref info);
            Assert.That(open != IntPtr.Zero);
            Assert.That(File.Exists(filename));

            var close = api.Close(open);
            Assert.That(close == LibsndfileError.NoError);

            File.Delete(filename);
            Assert.That(!File.Exists(filename));
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:16,代码来源:OpenTests.cs

示例7: ReadFramesShort_ReturnsValidData

        public void ReadFramesShort_ReturnsValidData()
        {
            const long Items = 50;

            var api = new LibsndfileApi();
            var info = new LibsndfileInfo();

            var open = api.Open(TestConfiguration.ValidWavFile, LibsndfileMode.Read, ref info);
            Assert.That(open != IntPtr.Zero);

            var buffer = new short[Items];
            var read = api.ReadFrames(open, buffer, Items);
            Assert.That(Items == read);
            Assert.That(buffer != null);
            Assert.That(buffer.Length == Items);

            var close = api.Close(open);
            Assert.That(close == LibsndfileError.NoError);
        }
开发者ID:xVir,项目名称:NLibsndfile,代码行数:19,代码来源:ReadFramesTests.cs


注:本文中的LibsndfileApi.Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。