예제 #1
0
        public MyInMemoryWave(MySoundData cue, string path, MyWaveBank owner, bool streamed = false)
        {
            using (var stream = MyFileSystem.OpenRead(path))
            {
                m_owner      = owner;
                m_path       = path;
                m_stream     = new SoundStream(stream);
                m_waveFormat = m_stream.Format;
                m_buffer     = new AudioBuffer
                {
                    Stream     = m_stream.ToDataStream(),
                    AudioBytes = (int)m_stream.Length,
                    Flags      = BufferFlags.None
                };

                if (cue.Loopable)
                {
                    m_buffer.LoopCount = AudioBuffer.LoopInfinite;
                }

                m_stream.Close();

                Streamed = streamed;
            }
        }
예제 #2
0
        private void InitWaveBank()
        {
            m_waveBank = new MyWaveBank();
            foreach (var cue in m_cues)
            {
                if (cue.Value.Waves == null)
                {
                    continue;
                }

                foreach (var wave in cue.Value.Waves)
                {
                    m_waveBank.Add(cue.Value, wave);
                }
            }
        }
예제 #3
0
        public MyInMemoryWave(MySoundData cue, string path, MyWaveBank owner, bool streamed = false)
        {
            using (var stream = MyFileSystem.OpenRead(path))
            {
                m_owner = owner;
                m_path = path;
                m_stream = new SoundStream(stream);
                m_waveFormat = m_stream.Format;
                m_buffer = new AudioBuffer
                {
                    Stream = m_stream.ToDataStream(),
                    AudioBytes = (int)m_stream.Length,
                    Flags = BufferFlags.None
                };

                if (cue.Loopable)
                    m_buffer.LoopCount = AudioBuffer.LoopInfinite;

                m_stream.Close();

                Streamed = streamed;
            }
        }