本文整理汇总了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);
}
示例2: Open_ShouldThrowExceptionOnNullPath
public void Open_ShouldThrowExceptionOnNullPath()
{
var api = new LibsndfileApi();
var info = new LibsndfileInfo();
api.Open(null, LibsndfileMode.Read, ref info);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}