Exemplo n.º 1
0
        public static CCBSoundEffect ActionWithSoundFile(string file, float pitch, float pan, float gain)
        {
            CCBSoundEffect pRet = new CCBSoundEffect();

            pRet.InitWithSoundFile(file, pitch, pan, gain);
            return(pRet);
        }
Exemplo n.º 2
0
        public override object Copy(ICCCopyable pZone)
        {
            CCBSoundEffect pRet;

            if (pZone != null)
            {
                pRet = (CCBSoundEffect)(pZone);
            }
            else
            {
                pRet  = new CCBSoundEffect();
                pZone = (pRet);
            }

            pRet.InitWithSoundFile(_soundFile, _pitch, _pan, _gain);
            base.Copy(pZone);
            return(pRet);
        }
Exemplo n.º 3
0
        public Object ActionForSoundChannel(CCBSequenceProperty channel)
        {
            float lastKeyframeTime = 0;

            var actions      = new List <CCFiniteTimeAction>();
            var keyframes    = channel.Keyframes;
            int numKeyframes = keyframes.Count;

            for (int i = 0; i < numKeyframes; ++i)
            {
                CCBKeyframe keyframe = keyframes[i];
                float       timeSinceLastKeyframe = keyframe.Time - lastKeyframeTime;
                lastKeyframeTime = keyframe.Time;
                if (timeSinceLastKeyframe > 0)
                {
                    actions.Add(new CCDelayTime(timeSinceLastKeyframe));
                }

                var    keyVal    = (List <CCBValue>)keyframe.Value;
                string soundFile = keyVal[0].GetStringValue();

                float pitch, pan, gain;

                pitch = float.Parse(keyVal[1].GetStringValue());

                pan = float.Parse(keyVal[2].GetStringValue());

                gain = float.Parse(keyVal[3].GetStringValue());

                actions.Add(CCBSoundEffect.ActionWithSoundFile(soundFile, pitch, pan, gain));
            }

            if (actions.Count < 1)
            {
                return(null);
            }

            return(new CCSequence(actions.ToArray()));
        }
Exemplo n.º 4
0
        public override object Copy(ICCCopyable pZone)
        {
            CCBSoundEffect pRet;

            if (pZone != null)
            {
                pRet = (CCBSoundEffect)(pZone);
            }
            else
            {
                pRet = new CCBSoundEffect();
                pZone = (pRet);
            }

            pRet.InitWithSoundFile(_soundFile, _pitch, _pan, _gain);
            base.Copy(pZone);
            return pRet;
        }
Exemplo n.º 5
0
 public static CCBSoundEffect ActionWithSoundFile(string file, float pitch, float pan, float gain)
 {
     CCBSoundEffect pRet = new CCBSoundEffect();
     pRet.InitWithSoundFile(file, pitch, pan, gain);
     return pRet;
 }