Beispiel #1
0
        public void PlayCue(
            string name,
            AudioListener listener,
            AudioEmitter emitter
            )
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }
            if (emitter == null)
            {
                throw new ArgumentNullException("emitter");
            }

            ushort cue = FAudio.FACTSoundBank_GetCueIndex(
                handle,
                name
                );

            if (cue == FAudio.FACTINDEX_INVALID)
            {
                throw new InvalidOperationException(
                          "Invalid cue name!"
                          );
            }

            emitter.emitterData.ChannelCount        = dspSettings.SrcChannelCount;
            emitter.emitterData.CurveDistanceScaler = float.MaxValue;
            FAudio.FACT3DCalculate(
                engine.handle3D,
                ref listener.listenerData,
                ref emitter.emitterData,
                ref dspSettings
                );
            FAudio.FACTSoundBank_Play3D(
                handle,
                cue,
                0,
                0,
                ref dspSettings,
                IntPtr.Zero
                );
        }