Exemple #1
0
        public void Load()
        {
            int channels;
            int bits;
            int sampleRate;

            var bytes       = _fileLoader.LoadWave(out channels, out bits, out sampleRate);
            var soundFormat = ALHelpers.GetSoundFormat(channels, bits);

            // generate buffer
            _buffers = AL.GenBuffers(1);
            ALHelpers.CheckError();

            // load data to buffer
            AL.BufferData(_buffers[0], soundFormat, bytes, bytes.Length, sampleRate);
            ALHelpers.CheckError();

            // generate source
            _source = AL.GenSource();
            ALHelpers.CheckError();

            // attach source to buffer
            AL.Source(_source, ALSourcei.Buffer, _buffers[0]);
            ALHelpers.CheckError();
        }
Exemple #2
0
 protected AudioEffect(EffectsExtension efx, EfxFilterType type)
 {
     if (efx == null)
     {
         throw new ArgumentNullException("efx");
     }
     Efx      = efx;
     FilterId = efx.GenFilter();
     efx.Filter(FilterId, EfxFilteri.FilterType, (int)type);
     ALHelpers.CheckError();
     Dirty = true;
 }
Exemple #3
0
 public override void BindTo(Sound sound)
 {
     Efx.Filter(FilterId, EfxFilterf.LowpassGainHF, Gain);
     Efx.BindFilterToSource(sound.Source, FilterId);
     ALHelpers.CheckError();
 }