Example #1
0
        public void Load(WaveForm waveForm, int height, WavImagesHash hash)
        {
            var hasImage = images.TryGetValue(waveForm, out var pack);

            if (!hasImage)
            {
                pack = new WavImagesPack();
            }
            images.TryAdd(waveForm, pack);

            if (!waveForm.IsEnabled)
            {
                ClearWavformImages(waveForm);
                pack.IsLoading = false;
                pack.IsLoaded  = false;
                Console.WriteLine($"ImagesLibrary: failed to load image {hash.Recline}");
                OnImageLoaded(waveForm);
                return;
            }

            if (hash.Equals(waveForm.ImageHash) && pack.IsLoaded)
            {
                Console.WriteLine($"ImagesLibrary: image is already loaded {hash.Recline}");
                OnImageLoaded(waveForm);
                return;
            }
            if (!hash.Equals(waveForm.ImageHash))
            {
                ClearWavformImages(waveForm);
                images.TryAdd(waveForm, pack);
            }

            pack.IsLoading = true;
            pack.IsLoaded  = false;

            Console.WriteLine($"ImagesLibrary: started load image {hash.Recline}");
            LoadWaveForm(pack, waveForm, height, Settings.UserScaleY);
            LoadFrq(pack, waveForm, height);
            LoadSpectrum(pack, waveForm, ViewOptions);
            Console.WriteLine($"ImagesLibrary: finished load imag {hash.Recline}");

            pack.IsLoading = false;
            pack.IsLoaded  = true;

            OnImageLoaded(waveForm);
        }
Example #2
0
        public void RequestLoadSpectrum(WaveForm waveForm, int height, WavImagesHash hash)
        {
            if (!waveForm.IsEnabled)
            {
                ClearWavformImages(waveForm);
                Console.WriteLine($"ImagesLibrary: failed to load spectrum {hash.Recline}");
                OnImageLoaded(waveForm);
                return;
            }

            Console.WriteLine($"ImagesLibrary: started load spectrum {hash.Recline}");
            images.TryGetValue(waveForm, out var pack);
            if (pack == null)
            {
                throw new Exception();
            }
            LoadSpectrum(pack, waveForm, ViewOptions);

            Console.WriteLine($"ImagesLibrary: finished load spectrum {hash.Recline}");
            OnImageLoaded(waveForm);
        }
Example #3
0
        public bool Equals(WavImagesHash other)
        {
            if (other == null)
            {
                return(false);
            }
            if (this.Reclist != other.Reclist)
            {
                return(false);
            }
            if (this.Voicebank != other.Voicebank)
            {
                return(false);
            }
            if (this.UserScaleX != other.UserScaleX)
            {
                return(false);
            }
            if (this.UserScaleY != other.UserScaleY)
            {
                return(false);
            }
            if (this.Recline != other.Recline)
            {
                return(false);
            }
            if (this.Suffix != other.Suffix)
            {
                return(false);
            }
            if (this.Prefix != other.Prefix)
            {
                return(false);
            }

            return(true);
        }
 public ProjectLineContainer(ProjectLine projectLine, ImagesLibrary imagesLibrary, WavPlayer wavPlayer, string sampleName, WavImagesHash hash, int number)
 {
     ProjectLine        = projectLine;
     Number             = number;
     this.imagesLibrary = imagesLibrary;
     this.wavPlayer     = wavPlayer;
     this.hash          = hash;
     if (!string.IsNullOrEmpty(ProjectLine?.Recline?.Description))
     {
         viewName = $"{ProjectLine?.Recline?.Description} [{ProjectLine?.Recline?.Name}]";
     }
     else
     {
         viewName = ProjectLine?.Recline?.Name.Replace("_", " ");
     }
     WaveForm    = new WaveForm(sampleName);
     IsCompleted = ProjectLine.IsCompleted;
     IsEnabled   = ProjectLine.IsEnabled;
 }