/// <summary>
 /// Initializes a new OpenALAudioBuffer class.
 /// </summary>
 public OpenALAudioBuffer(OpenALAudioFormat format, OpenALDevice device)
 {
     Format = format;
     Owner = device;
     _locker = new object();
     _audioMixer = new AudioMixer();
     PlaybackState = PlaybackState.Stopped;
     _source = Owner.SourcePool.RequestSource();
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new OpenALAudioBuffer class.
 /// </summary>
 public OpenALAudioBuffer(OpenALAudioFormat format, OpenALDevice device)
 {
     Format        = format;
     Owner         = device;
     _locker       = new object();
     _audioMixer   = new AudioMixer();
     PlaybackState = PlaybackState.Stopped;
     _source       = Owner.SourcePool.RequestSource();
 }
Beispiel #3
0
        /// <summary>
        /// Requests a Source from the source pool.
        /// </summary>
        /// <returns>OpenALSource.</returns>
        public OpenALSource RequestSource()
        {
            _context.MakeCurrent();
            var sources = new uint[1];

            OpenAL.alGenSources(1, sources);

            var source = new OpenALSource(sources[0]);

            _sources.Add(source);
            return(source);
        }
 /// <summary>
 /// Frees a source.
 /// </summary>
 /// <param name="source">The OpenALSource.</param>
 public void FreeSource(OpenALSource source)
 {
     if (_sources.Contains(source))
     {
         _sources.Remove(source);
         if (source.SourceId != 0)
         {
             _context.MakeCurrent();
             var sources = new uint[1];
             sources[0] = source.SourceId;
             OpenAL.alDeleteSources(1, sources);
             source.Reset();
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// Frees a source.
 /// </summary>
 /// <param name="source">The OpenALSource.</param>
 public void FreeSource(OpenALSource source)
 {
     if (_sources.Contains(source))
     {
         _sources.Remove(source);
         if (source.SourceId != 0)
         {
             _context.MakeCurrent();
             var sources = new uint[1];
             sources[0] = source.SourceId;
             OpenAL.alDeleteSources(1, sources);
             source.Reset();
         }
     }
 }
        /// <summary>
        /// Requests a Source from the source pool.
        /// </summary>
        /// <returns>OpenALSource.</returns>
        public OpenALSource RequestSource()
        {
            _context.MakeCurrent();
            var sources = new uint[1];
            OpenAL.alGenSources(1, sources);

            var source = new OpenALSource(sources[0]);
            _sources.Add(source);
            return source;
        }