示例#1
0
 public void SetSourceReverb(IALSource source, IALReverb reverb)
 {
     AL10.alSource3i(
         (source as OpenALSource).Handle,
         EFX.AL_AUXILIARY_SEND_FILTER,
         (int)(reverb as OpenALReverb).SlotHandle,
         0,
         0
         );
 }
示例#2
0
        public void SetSourceReverb(IALSource source, IALReverb reverb)
        {
            AL10.alSource3i(
                (source as OpenALSource).Handle,
                EFX.AL_AUXILIARY_SEND_FILTER,
                (int)(reverb as OpenALReverb).SlotHandle,
                0,
                0
                );
#if VERBOSE_AL_DEBUGGING
            CheckALError();
#endif
        }
示例#3
0
 internal void INTERNAL_applyEffect(DSPEffect effectSlotHandle)
 {
     INTERNAL_alEffectSlot = effectSlotHandle.Handle;
     if (INTERNAL_alSource != 0)
     {
         AL10.alSource3i(
             INTERNAL_alSource,
             EFX.AL_AUXILIARY_SEND_FILTER,
             (int)INTERNAL_alEffectSlot,
             0,
             0
             );
     }
 }
示例#4
0
        public virtual void Play()
        {
            if (State != SoundState.Stopped && INTERNAL_alSource != 0)             // FIXME: alSource check part of timer hack!
            {
                // FIXME: Is this XNA4 behavior?
                Stop();
            }

            if (INTERNAL_delayMS != 0 && !INTERNAL_timer.IsRunning)
            {
                INTERNAL_timer.Start();
            }
            if (INTERNAL_timer.ElapsedMilliseconds < INTERNAL_delayMS)
            {
                return;                 // We'll be back...
            }
            INTERNAL_timer.Stop();
            INTERNAL_timer.Reset();

            if (INTERNAL_alSource != 0)
            {
                // The sound has stopped, but hasn't cleaned up yet...
                AL10.alSourceStop(INTERNAL_alSource);
                AL10.alDeleteSources((IntPtr)1, ref INTERNAL_alSource);
                INTERNAL_alSource = 0;
            }

            AL10.alGenSources((IntPtr)1, out INTERNAL_alSource);
            if (INTERNAL_alSource == 0)
            {
                System.Console.WriteLine("WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.");
                return;
            }

            // Attach the buffer to this source
            AL10.alSourcei(
                INTERNAL_alSource,
                AL10.AL_BUFFER,
                (int)INTERNAL_parentEffect.INTERNAL_buffer
                );

            // Apply Pan/Position
            if (INTERNAL_positionalAudio)
            {
                INTERNAL_positionalAudio = false;
                AL10.alSource3f(
                    INTERNAL_alSource,
                    AL10.AL_POSITION,
                    position.X,
                    position.Y,
                    position.Z
                    );
            }
            else
            {
                Pan = Pan;
            }

            // Reassign Properties, in case the AL properties need to be applied.
            Volume   = Volume;
            IsLooped = IsLooped;
            Pitch    = Pitch;

            // Apply EFX
            if (INTERNAL_alEffectSlot != 0)
            {
                AL10.alSource3i(
                    INTERNAL_alSource,
                    EFX.AL_AUXILIARY_SEND_FILTER,
                    (int)INTERNAL_alEffectSlot,
                    0,
                    0
                    );
            }

            AL10.alSourcePlay(INTERNAL_alSource);
        }