public void ReadMonoFromFileTest() { #pragma warning disable 612,618 using (DirectSoundAudioService directSoundAudioService = new DirectSoundAudioService()) #pragma warning restore 612,618 { float[] samples = directSoundAudioService.ReadMonoFromFile(PathToWav, SampleRate); FileInfo info = new FileInfo(PathToWav); long expectedSize = info.Length - WaveHeader; long actualSize = samples.Length * (BitsPerSample / 8); Assert.AreEqual(expectedSize, actualSize); } }
public void CheckFingerprintCreationAlgorithmTest1() { long fileSize = new FileInfo(PathToWav).Length; #pragma warning disable 612,618 using (IAudioService proxy = new DirectSoundAudioService()) { #pragma warning restore 612,618 var workUnitForDirectSound = workUnitBuilder.BuildWorkUnit().On(PathToWav).With(fingerprintingConfiguration); List<bool[]> list = workUnitForDirectSound.GetFingerprintsUsingService(fingerprintingServiceWithDirectSound).Result; // One fingerprint corresponds to a granularity of 8192 samples which is 16384 bytes long expected = fileSize / (8192 * 4); Assert.AreEqual(expected, list.Count); proxy.Dispose(); } }
public void ReadMonoFromFileUsingBothProxiesTest() { string name = MethodBase.GetCurrentMethod().Name; using (BassAudioService bassAudioService = new BassAudioService()) { using (DirectSoundAudioService directSoundAudioService = new DirectSoundAudioService()) { float[] bdata = bassAudioService.ReadMonoFromFile(PathToMp3, 5512); float[] ddata = directSoundAudioService.ReadMonoFromFile(PathToWav, 5512); for (int i = 0; i < bdata.Length; i++) { if ((Math.Abs(bdata[i] - ddata[i]) / int.MaxValue) > 1) { Assert.Fail("Data arrays are different: " + bdata[i] + ":" + ddata[i] + " at " + i); } } Assert.AreEqual(bdata.Length, ddata.Length); } } }