Пример #1
0
        public SwavStream(SWAR.Wave wave)
        {
            m_Wave       = wave;
            m_WaveFormat = new WaveFormat(wave.m_SampleRate,
                                          wave.m_WaveType == SWAR.WaveType.PCM8 ? 8 : 16, 1);
            m_Position = 0;

            if (m_Wave.m_WaveType == SWAR.WaveType.ADPCM)
            {
                m_CurrPcm16Val = (short)m_Wave.m_TheWave.Read16(0);
                m_CurrIndex    = m_Wave.m_TheWave.Read16(2);
                m_Position     = 4;

                if (m_Wave.m_Loop)
                {
                    byte[] buffer = new byte[4 * (m_Wave.m_LoopStart - 4)];
                    Read(buffer, 0, (int)(4 * (m_Wave.m_LoopStart - 4)));
                    m_LoopStartPcm16Val = m_CurrPcm16Val;
                    m_LoopStartIndex    = m_CurrIndex;

                    //restore the starting state
                    m_CurrPcm16Val = (short)m_Wave.m_TheWave.Read16(0);
                    m_CurrIndex    = m_Wave.m_TheWave.Read16(2);
                    m_Position     = 4;
                }
            }

            m_Resampled = new WdlResamplingSampleProvider(this, 44100);
        }
Пример #2
0
 public void PlaySound(SWAR.Wave wave)
 {
     PlaySound(wave.m_TheTrueWave);
 }