Ejemplo n.º 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;
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
        public void Play()
        {
            if (IsPlaying || IsStopping)
            {
                throw new InvalidOperationException("Cue already playing!");
            }

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

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

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

            if (!INTERNAL_calculateNextSound())
            {
                return;
            }

            INTERNAL_activeSound.InitializeClips();

            IsPrepared = false;
        }