예제 #1
0
        public void Play()
        {
            if (IsPlaying)
            {
                throw new InvalidOperationException("Cue already playing!");
            }

            INTERNAL_category.INTERNAL_initCue(this);

            if (GetVariable("NumCueInstances") >= INTERNAL_data.InstanceLimit)
            {
                if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.Fail)
                {
                    return;                     // Just ignore us...
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.Queue)
                {
                    throw new Exception("Cue Queueing not handled!");
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.ReplaceOldest)
                {
                    INTERNAL_category.INTERNAL_removeOldestCue(Name);
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.ReplaceQuietest)
                {
                    INTERNAL_category.INTERNAL_removeQuietestCue(Name);
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.ReplaceLowestPriority)
                {
                    // FIXME: Priority?
                    INTERNAL_category.INTERNAL_removeOldestCue(Name);
                }
            }

            if (!INTERNAL_category.INTERNAL_addCue(this))
            {
                return;
            }

            if (!INTERNAL_calculateNextSound())
            {
                return;
            }

            INTERNAL_setupSounds();

            if (INTERNAL_isPositional)
            {
                foreach (SoundEffectInstance sfi in INTERNAL_instancePool)
                {
                    sfi.Apply3D(
                        INTERNAL_listener,
                        INTERNAL_emitter
                        );
                }
            }

            INTERNAL_queuedPlayback = true;
        }
예제 #2
0
        public void Play()
        {
            if (IsPlaying)
            {
                throw new InvalidOperationException("Cue already playing!");
            }

            INTERNAL_category.INTERNAL_initCue(this);

            if (GetVariable("NumCueInstances") >= INTERNAL_data.InstanceLimit)
            {
                if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.Fail)
                {
                    return;                     // Just ignore us...
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.Queue)
                {
                    throw new Exception("Cue Queueing not handled!");
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.ReplaceOldest)
                {
                    INTERNAL_category.INTERNAL_removeOldestCue(Name);
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.ReplaceQuietest)
                {
                    INTERNAL_category.INTERNAL_removeQuietestCue(Name);
                }
                else if (INTERNAL_data.MaxCueBehavior == MaxInstanceBehavior.ReplaceLowestPriority)
                {
                    // FIXME: Priority?
                    INTERNAL_category.INTERNAL_removeOldestCue(Name);
                }
            }

            if (!INTERNAL_category.INTERNAL_addCue(this))
            {
                return;
            }

            INTERNAL_timer.Start();
            if (INTERNAL_data.FadeInMS > 0)
            {
                INTERNAL_startFadeIn(INTERNAL_data.FadeInMS);
            }

            if (!INTERNAL_calculateNextSound())
            {
                return;
            }

            INTERNAL_activeSound.GatherEvents(INTERNAL_eventList);
            foreach (XACTEvent evt in INTERNAL_eventList)
            {
                INTERNAL_eventPlayed.Add(false);
                INTERNAL_eventLoops.Add(evt, 0);
            }
        }