示例#1
0
        private void QueueBuffer(object source, EventArgs ea)
        {
            // The original method refers to Int64 Vorbisfile.ov_read(IntPtr, IntPtr, Int32, Int32, Int32, Int32, Int32 ByRef),
            // which has been changed in newer FNA releases. The last parameter is now out, not ref.

            int pos = 0;
            int read;

            do
            {
                int current_section;
                read = (int)Vorbisfile.ov_read(vorbisFile, bufferPtr + pos, 4096, 0, 2, 1, out current_section);
                pos += read;
            }while (read > 0 && pos < 187904);

            if (pos != 0)
            {
                soundEffect.SubmitBuffer(vorbisBuffer, 0, pos);
                return;
            }

            if (IsLooped)
            {
                Vorbisfile.ov_time_seek(vorbisFile, 0.0);
                QueueBuffer(source, ea);
                return;
            }

            hitEof = true;
            soundEffect.BufferNeeded -= OnBufferNeeded;
        }
示例#2
0
        internal void Stop()
        {
            PlayCount = 0;

#if !NO_STREAM_THREAD
            exitThread = true;
            if (songThread != null && Thread.CurrentThread != songThread)
            {
                songThread.Join();
            }
#endif

            soundStream.Stop();
            soundStream.BufferNeeded -= QueueBuffer;
            Vorbisfile.ov_time_seek(vorbisFile, 0.0);
        }
示例#3
0
        internal void Stop()
        {
            PlayCount = 0;

            if (!DISABLE_THREADS)
            {
                exitThread = true;
                if (songThread != null && Thread.CurrentThread != songThread)
                {
                    songThread.Join();
                    songThread = null;
                }
            }

            timer.Stop();
            timer.Reset();

            if (!IsDisposed)
            {
                soundStream.Stop();
                soundStream.BufferNeeded -= QueueBuffer;
                Vorbisfile.ov_time_seek(vorbisFile, 0.0);
            }
        }