Esempio n. 1
0
        /// <summary>
        ///     Create a sample stream from an MP3/MP2/MP1/OGG or WAV file.
        /// </summary>
        /// <param name="mem">BassStream file from memory</param>
        /// <param name="filename">Filename or memory location</param>
        /// <param name="offset">File offset of the stream data</param>
        /// <param name="length">File length (0=use whole file)</param>
        /// <param name="flags">StreamFlags</param>
        /// <returns></returns>
        public BassStream LoadStream(bool mem, string filename, int offset,
            int length, StreamFlags flags)
        {
            if (_disposed)
                throw new ObjectDisposedException("BASSEngine");

            IntPtr handle = _CreateStreamFile(Helper.Bool2Int(mem), Marshal.StringToHGlobalAnsi(filename),
                offset, length, (int) flags);
            if (handle == IntPtr.Zero) throw new BASSException();
            var output = new BassStream(handle);
            output.Owner = this;
            return output;
        }
Esempio n. 2
0
        //not properly implemented yet
        /// <summary>
        ///     Create a user sample stream.
        /// </summary>
        /// <param name="freq">BassStream playback rate</param>
        /// <param name="flags">StreamFlags</param>
        /// <param name="proc">StreamCallBack delegate</param>
        /// <param name="user">The "user" value passed to the callback function</param>
        /// <returns></returns>
        private BassStream CreateStream(int freq, StreamFlags flags, StreamCallBack proc, int user)
        {
            if (_disposed)
                throw new ObjectDisposedException("BASSEngine");

            IntPtr handle = _CreateStream(freq, (int) flags, proc, user);
            if (handle == IntPtr.Zero) throw new BASSException();
            var output = new BassStream(handle);
            output.Owner = this;
            return output;
        }
Esempio n. 3
0
        /// <summary>
        ///     Create a sample stream from an MP3/MP2/MP1/OGG or WAV file on the internet.
        /// </summary>
        /// <param name="url">The URL (beginning with "http://" or "ftp://")</param>
        /// <param name="offset">File offset of start streaming from</param>
        /// <param name="flags">StreamFlags</param>
        /// <param name="savefile">Filename to save the streamed file as locally (""=don//t save)</param>
        /// <returns></returns>
        public BassStream CreateStreamFromURL(string url, int offset, StreamFlags flags, string savefile)
        {
            if (_disposed)
                throw new ObjectDisposedException("BASSEngine");

            IntPtr handle = _CreateStreamURL(url, offset, (int) flags, savefile);
            if (handle == IntPtr.Zero) throw new BASSException();
            var output = new BassStream(handle);
            output.Owner = this;
            return output;
        }