/// <summary> /// Releases any BASS resources being held by the player. /// </summary> private void Release() { if (stream != 0) { if (!BASSNative.StreamFree(stream)) { throw new BASSException(); } stream = 0; } if (sample != 0) { if (!BASSNative.SampleFree(sample)) { throw new BASSException(); } sample = 0; } channel = 0; promoted = false; playing = null; }
/// <summary> /// Initializes a new instance of the BASSSong class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="file">The path to the file from which to stream the song.</param> public BASSSong(UltravioletContext uv, String file) : base(uv) { Contract.RequireNotEmpty(file, nameof(file)); this.file = file; var stream = CreateStream(BASSNative.BASS_STREAM_DECODE); tags = new SongTagCollection(); ReadTagsFromStream(stream); var duration = BASSUtil.GetDurationInSeconds(stream); if (!BASSNative.StreamFree(stream)) { throw new BASSException(); } this.duration = TimeSpan.FromSeconds(duration); }
/// <summary> /// Releases the memory associated with the underlying stream object. /// </summary> private Boolean StopInternal() { if (stream == 0) { return(false); } if (!BASSNative.StreamFree(stream)) { throw new BASSException(); } stream = 0; syncLoopDelegate = null; syncLoop = 0; syncEndDelegate = null; syncEnd = 0; return(true); }