예제 #1
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();
 }
예제 #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();
 }
예제 #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);
        }
예제 #4
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();
         }
     }
 }
예제 #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();
         }
     }
 }
예제 #6
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;
        }