Exemplo n.º 1
0
        public override AudioProperties GetAudioProperties()
        {
            var mt = new Mp3Tools(File.FullName);
            var ap = new AudioProperties
            {
                Duration       = mt.Duration.TotalMilliseconds,
                AverageBitRate = mt.AverageBitRate,
                MaximumBitRate = mt.MaximumBitRate,
                MinimumBitRate = mt.MinimumBitRate,
                BitsPerSample  = mt.BitsPerSample,
                SampleRate     = mt.SampleRate,
                Mode           = mt.Channels == 1 ? ChannelMode.Mono : ChannelMode.Stereo
            };

            return(ap);
        }
Exemplo n.º 2
0
        private void AddToTrack(MusicSource destination, Track track, MusicFile mf, FileInfo vbrFi)
        {
            //var vbrFi = new FileInfo(vbrFile);
            var mp3tools  = new Mp3Tools(vbrFi.FullName);
            var musicFile = new MusicFile
            {
                Style                = mf.Style,
                DiskRoot             = destination.DiskRoot,
                StylePath            = mf.StylePath,
                OpusPath             = mf.OpusPath,
                File                 = vbrFi.FullName,
                FileLength           = vbrFi.Length,
                FileLastWriteTimeUtc = vbrFi.LastWriteTimeUtc,
                Uid              = Guid.NewGuid().ToString(),
                Musician         = mf.Musician,
                MusicianType     = mf.MusicianType,
                OpusType         = mf.OpusType,
                IsMultiPart      = mf.IsMultiPart,
                OpusName         = mf.OpusName,
                PartName         = mf.PartName,
                PartNumber       = mf.PartNumber,
                Encoding         = EncodingType.mp3,
                Mode             = mf.Mode,
                Duration         = mp3tools.Duration.TotalMilliseconds,
                BitsPerSample    = mp3tools.BitsPerSample,
                SampleRate       = mp3tools.SampleRate,
                MinimumBitRate   = mp3tools.MinimumBitRate,
                MaximumBitRate   = mp3tools.MaximumBitRate,
                AverageBitRate   = mp3tools.AverageBitRate,
                IsGenerated      = true,
                LastCataloguedAt = DateTimeOffset.Now,
                ParsingStage     = MusicFileParsingStage.Catalogued,
                Mood             = mf.Mood,
                Track            = track,
            };

            track.MusicFiles.Add(musicFile);
        }