Exemplo n.º 1
0
        /// <summary>
        /// Reads tags from a File.
        /// </summary>
        public static TagReader Read(string FileName)
        {
            Bass.Init();

            var h = Bass.CreateStream(FileName, Flags: BassFlags.Prescan);

            TagReader result = null;

            if (h != 0)
            {
                result = Read(h);

                Bass.StreamFree(h);
            }
            else
            {
                h = Bass.MusicLoad(FileName, Flags: BassFlags.Prescan);

                if (h != 0)
                {
                    result = Read(h);

                    Bass.MusicFree(h);
                }
            }

            if (!string.IsNullOrWhiteSpace(result?.Title))
            {
                result.Title = System.IO.Path.GetFileNameWithoutExtension(FileName);
            }

            return(result);
        }
Exemplo n.º 2
0
 public void FreeStream()
 {
     try
     {
         if (_handle != 0)
         {
             _Length = 0;
             // Position = -1;
             Bass.StreamFree(_handle);
             Bass.ChannelStop(_handle); // (StreamFree) Stop Playback.
             Bass.MusicFree(_handle);
             _handle = 0;
         }
     }
     catch { }
 }
Exemplo n.º 3
0
 public override void Dispose()
 {
     Bass.MusicFree(Handle);
 }