diff --git a/src/SoundFingerprinting.Tests/Integration/FingerprintCommandBuilderIntTest.cs b/src/SoundFingerprinting.Tests/Integration/FingerprintCommandBuilderIntTest.cs index 365edb79..edc3b1da 100644 --- a/src/SoundFingerprinting.Tests/Integration/FingerprintCommandBuilderIntTest.cs +++ b/src/SoundFingerprinting.Tests/Integration/FingerprintCommandBuilderIntTest.cs @@ -107,7 +107,7 @@ public async Task CreateFingerprintsFromFileAndFromAudioSamplesAndGetTheSameResu .From(samples) .Hash(); - AssertHashDatasAreTheSame(h1, h2); + AssertHashDataIsTheSame(h1, h2); } [Test] @@ -147,7 +147,7 @@ public async Task CreateFingerprintsWithTheSameFingerprintCommandTest() var (h1, _) = await fingerprintCommand.Hash(); var (h2, _) = await fingerprintCommand.Hash(); - AssertHashDatasAreTheSame(h1, h2); + AssertHashDataIsTheSame(h1, h2); } [Test] @@ -289,9 +289,9 @@ public async Task ShouldCreateSameFingerprintsDuringDifferentParallelRuns() .UsingServices(audioService) .Hash(); - AssertHashDatasAreTheSame(hashDatas1, hashDatas2); - AssertHashDatasAreTheSame(hashDatas2, hashDatas3); - AssertHashDatasAreTheSame(hashDatas3, hashDatas4); + AssertHashDataIsTheSame(hashDatas1, hashDatas2); + AssertHashDataIsTheSame(hashDatas2, hashDatas3); + AssertHashDataIsTheSame(hashDatas3, hashDatas4); } [Test] diff --git a/src/SoundFingerprinting.Tests/Integration/IntegrationWithSampleFilesTest.cs b/src/SoundFingerprinting.Tests/Integration/IntegrationWithSampleFilesTest.cs index f829e0e6..ed7b3127 100644 --- a/src/SoundFingerprinting.Tests/Integration/IntegrationWithSampleFilesTest.cs +++ b/src/SoundFingerprinting.Tests/Integration/IntegrationWithSampleFilesTest.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; - using System.Runtime.Serialization.Formatters.Binary; - using Audio; using Data; using ProtoBuf; @@ -13,11 +11,11 @@ public abstract class IntegrationWithSampleFilesTest : AbstractTest { - protected readonly string pathToSamples = Path.Combine(TestContext.CurrentContext.TestDirectory, "chopinsamples.bin"); + private readonly string pathToSamples = Path.Combine(TestContext.CurrentContext.TestDirectory, "chopinsamples.bin"); protected readonly string PathToWav = Path.Combine(TestContext.CurrentContext.TestDirectory, "chopin_short.wav"); - protected void AssertHashDatasAreTheSame(Hashes h1, Hashes h2) + protected static void AssertHashDataIsTheSame(Hashes h1, Hashes h2) { var firstHashes = h1.ToList(); var secondHashes = h2.ToList(); @@ -36,7 +34,7 @@ protected void AssertHashDatasAreTheSame(Hashes h1, Hashes h2) } } - protected TagInfo GetTagInfo() + protected static TagInfo GetTagInfo() { return new TagInfo { diff --git a/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs b/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs index b7d16022..3dcfba6b 100644 --- a/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs +++ b/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs @@ -11,5 +11,5 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("4cac962e-ebc5-4006-a1e0-7ffb3e2483c2")] -[assembly: AssemblyVersion("9.4.0.101")] -[assembly: AssemblyInformationalVersion("9.4.0.101")] +[assembly: AssemblyVersion("9.4.2.100")] +[assembly: AssemblyInformationalVersion("9.4.2.100")] diff --git a/src/SoundFingerprinting.Tests/Unit/Utils/FastFingerprintDescriptorTest.cs b/src/SoundFingerprinting.Tests/Unit/Utils/FastFingerprintDescriptorTest.cs index 9b7d2cc3..1648afe6 100644 --- a/src/SoundFingerprinting.Tests/Unit/Utils/FastFingerprintDescriptorTest.cs +++ b/src/SoundFingerprinting.Tests/Unit/Utils/FastFingerprintDescriptorTest.cs @@ -47,7 +47,7 @@ public async Task ShouldCreateExactlyTheSameFingerprints() .From(audioSamples) .Hash(); - AssertHashDatasAreTheSame(h1, h2); + AssertHashDataIsTheSame(h1, h2); } } diff --git a/src/SoundFingerprinting/Command/IUsingRealtimeQueryServices.cs b/src/SoundFingerprinting/Command/IUsingRealtimeQueryServices.cs index a06c340f..142ca504 100644 --- a/src/SoundFingerprinting/Command/IUsingRealtimeQueryServices.cs +++ b/src/SoundFingerprinting/Command/IUsingRealtimeQueryServices.cs @@ -12,40 +12,40 @@ public interface IUsingRealtimeQueryServices : IRealtimeQueryCommand /// /// Sets the model service that will be used as the data source during query. /// - /// ModelService to query. + /// ModelService to query. /// Realtime command. - IRealtimeQueryCommand UsingServices(IModelService modelService); + IRealtimeQueryCommand UsingServices(IQueryService queryService); /// /// Sets the model service that will query the datasource, as well as the audio service that will read content to fingerprint. /// - /// ModelService to query. + /// ModelService to query. /// AudioService to use for file processing. /// Realtime command. - IRealtimeQueryCommand UsingServices(IModelService modelService, IAudioService audioService); + IRealtimeQueryCommand UsingServices(IQueryService queryService, IAudioService audioService); /// /// Sets the model service that will query the datasource, as well as the media service that will read content to fingerprint. /// - /// ModelService to query. + /// ModelService to query. /// MediaService to use for file processing. /// Realtime command. - IRealtimeQueryCommand UsingServices(IModelService modelService, IMediaService mediaService); + IRealtimeQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService); /// /// Sets the model service that will query the datasource, as well as the video service that will read content to fingerprint. /// - /// ModelService to query. + /// ModelService to query. /// VideoService to use for file processing. /// Realtime command. - IRealtimeQueryCommand UsingServices(IModelService modelService, IVideoService videoService); + IRealtimeQueryCommand UsingServices(IQueryService queryService, IVideoService videoService); /// /// Sets the model service that will query the datasource, as well as the realtime media service used to create fingerprints directly from a given URL. /// - /// ModelService to query. + /// ModelService to query. /// Realtime media service to use. /// Realtime command. - IRealtimeQueryCommand UsingServices(IModelService modelService, IRealtimeMediaService realtimeMediaService); + IRealtimeQueryCommand UsingServices(IQueryService queryService, IRealtimeMediaService realtimeMediaService); } } \ No newline at end of file diff --git a/src/SoundFingerprinting/Command/RealtimeQueryCommand.cs b/src/SoundFingerprinting/Command/RealtimeQueryCommand.cs index b9d55df5..c139b028 100644 --- a/src/SoundFingerprinting/Command/RealtimeQueryCommand.cs +++ b/src/SoundFingerprinting/Command/RealtimeQueryCommand.cs @@ -31,7 +31,7 @@ public sealed class RealtimeQueryCommand : IRealtimeSource, IWithRealtimeQueryCo private Func> realtimeCollection; private RealtimeQueryConfiguration configuration; private IRealtimeMediaService? realtimeMediaService; - private IModelService? modelService; + private IQueryService? queryService; private IMediaService? mediaService; private IVideoService? videoService; private IAudioService audioService; @@ -135,41 +135,41 @@ public async Task Query(CancellationToken cancellationToken) } } - /// - public IRealtimeQueryCommand UsingServices(IModelService service) + /// + public IRealtimeQueryCommand UsingServices(IQueryService service) { - modelService = service; + queryService = service; return this; } - /// - public IRealtimeQueryCommand UsingServices(IModelService modelService, IAudioService audioService) + /// + public IRealtimeQueryCommand UsingServices(IQueryService modelService, IAudioService audioService) { - this.modelService = modelService; + this.queryService = modelService; this.audioService = audioService; return this; } - /// - public IRealtimeQueryCommand UsingServices(IModelService modelService, IMediaService mediaService) + /// + public IRealtimeQueryCommand UsingServices(IQueryService modelService, IMediaService mediaService) { - this.modelService = modelService; + this.queryService = modelService; this.mediaService = mediaService; return this; } - /// - public IRealtimeQueryCommand UsingServices(IModelService modelService, IVideoService videoService) + /// + public IRealtimeQueryCommand UsingServices(IQueryService modelService, IVideoService videoService) { - this.modelService = modelService; + this.queryService = modelService; this.videoService = videoService; return this; } - /// - public IRealtimeQueryCommand UsingServices(IModelService modelService, IRealtimeMediaService realtimeMediaService) + /// + public IRealtimeQueryCommand UsingServices(IQueryService modelService, IRealtimeMediaService realtimeMediaService) { - this.modelService = modelService; + this.queryService = modelService; this.realtimeMediaService = realtimeMediaService; return this; } @@ -354,7 +354,7 @@ private void HandleQueryFailure(AVHashes? hashes, Exception e) } /// - /// Queries local or remote with gathered from offline storage. + /// Queries local or remote with gathered from offline storage. /// /// Cancellation token. /// Async enumerable with . @@ -373,7 +373,7 @@ private async IAsyncEnumerable QueryFromOfflineStorage([Enumerato } /// - /// Tries querying associated . + /// Tries querying associated . /// /// An instance of . /// Realtime aggregator. @@ -491,7 +491,7 @@ private async Task GetAvQueryResult(AVHashes hashes) .BuildQueryCommand() .From(hashes) .WithQueryConfig(configuration.QueryConfiguration) - .UsingServices(modelService) + .UsingServices(queryService) .Query(); var avQueryResult = queryResultInterceptor(queryResult); queryLength += (hashes.Audio?.DurationInSeconds + hashes.Audio?.TimeOffset ?? hashes.Video?.DurationInSeconds) ?? 0; diff --git a/src/SoundFingerprinting/Properties/AssemblyInfo.cs b/src/SoundFingerprinting/Properties/AssemblyInfo.cs index a60b095c..c067e08d 100644 --- a/src/SoundFingerprinting/Properties/AssemblyInfo.cs +++ b/src/SoundFingerprinting/Properties/AssemblyInfo.cs @@ -19,5 +19,5 @@ [assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW")] [assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW.Tests")] -[assembly: AssemblyVersion("9.4.0.101")] -[assembly: AssemblyInformationalVersion("9.4.0.101")] +[assembly: AssemblyVersion("9.4.2.100")] +[assembly: AssemblyInformationalVersion("9.4.2.100")] diff --git a/src/SoundFingerprinting/SoundFingerprinting.csproj b/src/SoundFingerprinting/SoundFingerprinting.csproj index 3e726a41..2355ce2d 100644 --- a/src/SoundFingerprinting/SoundFingerprinting.csproj +++ b/src/SoundFingerprinting/SoundFingerprinting.csproj @@ -4,14 +4,14 @@ true false enable - 9.4.0 + 9.4.2 Sergiu Ciumac SoundFingerprinting is a C# framework that implements an efficient algorithm of audio fingerprinting and identification. Designed for developers, enthusiasts, researchers in the fields of audio processing, data mining, digital signal processing. https://github.com/addictedcs/soundfingerprinting https://github.com/AddictedCS/soundfingerprinting git - Version 9.4.0 + Version 9.4.2 - Contains an important improvement to QueryCommand, allowing a much faster lookup for the use-cases when the track and the query are very long and almost identical. - The improvement is rooted in the idea of returning Candidates from the IModelService instead of list of SubFingerprints. This provided knowledge on which hashed fingerprint matched with the query. - To further improve the API design, methods related to the correct functioning of the QueryCommand were extracted into IQueryService interface (from which IModelService derives).