Exemplo n.º 1
0
        public OpenALAudio()
        {
            Instance = this;

            m_enableSound = true;
            m_soundVolume = 1.0f;
            m_enableMusic = true;
            m_musicVolume = 1.0f;

            // Init context
            m_context = new AudioContext();
            m_xram    = new XRamExtension();

            // Create some sources
            m_sound = new OpenALSoundSource[NUM_SOUND_SOURCES];
            for (int i = 0; i < m_sound.Length; ++i)
            {
                m_sound[i] = new OpenALSoundSource();
            }
            m_music  = new OpenALMusicPlayback[NUM_MUSIC_SOURCES];
            m_custom = new OpenALCustomPlayback[NUM_CUSTOM_SOURCES];

            UpdateSoundVolume();
            UpdateMusicVolume();
            App.CheckOpenALError();
        }
Exemplo n.º 2
0
        public OpenALSoundPlayback(OpenALSoundSource source, OpenALSound sound, bool looping)
        {
            m_source = source;
            m_sound  = sound;

            m_looping  = looping;
            m_rate     = 1.0f;
            m_volume   = 1.0f;
            m_complete = false;

            AL.Source(m_source.ALSource, ALSourcei.Buffer, (int)sound.ALBuffer);
            AL.Source(m_source.ALSource, ALSourceb.Looping, looping);
            App.CheckOpenALError();

            UpdateSpeed();
            UpdateVolume();
        }