Exemple #1
0
        public OpenALCustomPlayback(ICustomAudioSource source, int channels, int sampleRate)
        {
            m_audioSource = source;
            m_channels    = channels;
            m_sampleRate  = sampleRate;
            m_volume      = 1.0f;
            m_lock        = new object();
            m_stopped     = false;

            // Create the buffers
            m_buffers = new uint[NUM_BUFFERS];
            for (int i = 0; i < m_buffers.Length; ++i)
            {
                AL.GenBuffer(out m_buffers[i]);
                App.CheckOpenALError();
                if (OpenALAudio.Instance.XRam.IsInitialized)
                {
                    OpenALAudio.Instance.XRam.SetBufferMode(1, ref m_buffers[i], XRamExtension.XRamStorage.Hardware);
                }
            }

            // Create the source
            AL.GenSource(out m_source);
            UpdateVolume();
            App.CheckOpenALError();

            // Start the background thread
            var thread = new Thread(Run);

            thread.Start();
        }
Exemple #2
0
 public ICustomPlayback PlayCustom(ICustomAudioSource source, int channels, int sampleRate)
 {
     for (int i = 0; i < m_custom.Length; ++i)
     {
         var playback = m_custom[i];
         if (playback == null || playback.Stopped)
         {
             if (playback != null)
             {
                 playback.Dispose();
             }
             m_custom[i] = new OpenALCustomPlayback(source, channels, sampleRate);
             return(m_custom[i]);
         }
     }
     return(null);
 }
Exemple #3
0
 public ICustomPlayback PlayCustom(ICustomAudioSource source, int channels, int sampleRate)
 {
     return(null);
 }