当前位置: 首页>>代码示例>>C#>>正文


C# Pitch.Equals方法代码示例

本文整理汇总了C#中Pitch.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Pitch.Equals方法的具体用法?C# Pitch.Equals怎么用?C# Pitch.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pitch的用法示例。


在下文中一共展示了Pitch.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: nui_SkeletonFrameReady


//.........这里部分代码省略.........
                            && (rightHandPos.Y < shoulderCenterPos.Y) && (leftHandPos.Y < shoulderCenterPos.Y) && (distance(rightHandPos, leftHandPos) > 50.0))
                        {
                            this.soundOut.SendPercussion(Percussion.CrashCymbal1, this.soundVelocity);
                            this.soundOut.SendPercussion(Percussion.CrashCymbal2, this.soundVelocity);
                        }
                            //raise right hand and play a really high note
                        else if ((distance(headPos, rightHandPos) > 150.0) && (rightHandPos.X > kinectColorOut.Width / 2)
                            && (rightHandPos.Y < headPos.Y))
                        {
                            this.soundOut.SendNoteOn(Channel.Channel1, Pitch.A6, this.soundVelocity);
                        }
                        //both hands on hips is a cowbell
                        else if ((distance(hipLeftPos, leftHandPos) < 150.0) && (distance(hipRightPos, rightHandPos) < 150.0))
                        {
                            this.soundOut.SendPercussion(Percussion.Cowbell, this.soundVelocity);
                        }
                        //right hand on hip is a bass drum
                        else if (distance(hipRightPos, rightHandPos) < 50.0)
                        {
                            this.soundOut.SendPercussion(Percussion.BassDrum1, this.soundVelocity);
                            this.soundOut.SendPercussion(Percussion.BassDrum2, this.soundVelocity);
                        }
                        else if ((distance(kneeLeftPos, leftHandPos) < 50.0))// && (distance(kneeRightPos, rightHandPos) < 50.0))
                        {
                            if (!(this.beat1.IsRunning))
                            {
                                Console.Out.WriteLine("starting beat!");
                                //this.beat1.Schedule(new NoteOnOffMessage(this.soundOut, Channel.Channel10, (Pitch)(Percussion.BassDrum1), this.soundVelocity, 0.5F, this.beat1, 12.5F));
                                this.beat1.Start();
                                Console.Out.WriteLine("started!");
                            }
                        }
                        else
                        {
                            if (this.pianoUp.IsRunning)
                            {
                                this.pianoUp.Stop();
                            }
                            this.pianoUp.Reset();

                            if (this.pianoDown.IsRunning)
                            {
                                this.pianoDown.Stop();
                            }
                            this.pianoDown.Reset();

                        }
                    }

                    foreach (Joint noteJoint in this.jointsOnList)
                    {
                        //Console.Out.WriteLine(noteJoint.ID.ToString());

                        if (!(bool)multNoteCheck.IsChecked)
                        {
                            this.soundOut.SilenceAllNotes();
                        }

                        double xreg = (double)noteJoint.Position.X;
                        double yreg = (double)noteJoint.Position.Y;
                        Tuple<int, int> pitchreg = coordToRegion(xreg, yreg);

                        //Console.Out.WriteLine(pitchreg.ToString());

                        if (dictType == RegionToPitchDictType.Piano)
                        {
                            this.soundOut.SendNoteOff(Channel.Channel1, pitchToPlay, this.soundVelocity);
                        }

                        //only play the sound if the key is contained in the dictionary
                        if (regionToPitch.ContainsKey(pitchreg))
                        {
                            if (!(regionToPitch[pitchreg].Equals(pitchToPlay)))
                            {
                                pitchToPlay = regionToPitch[pitchreg];

                                //make sure the pitch is not "zero"
                                if (!(pitchToPlay.Equals(Pitch.GSharpNeg1)))
                                {
                                    if (dictType != RegionToPitchDictType.GestureMusic)
                                    {
                                        this.soundOut.SendNoteOn(Channel.Channel1, pitchToPlay, this.soundVelocity);
                                    }
                                    //Console.Out.WriteLine(pitchToPlay.ToString());
                                }
                            }
                            else
                            {
                                //make sure the pitch is not "zero"
                                if (!(pitchToPlay.Equals(Pitch.GSharpNeg1)))
                                {
                                    this.soundOut.SendControlChange(Channel.Channel1, Midi.Control.SustainPedal, this.soundVelocity);
                                }
                            }

                        }
                    }
                }
            }
        }
开发者ID:mprat,项目名称:Kinectophone,代码行数:101,代码来源:MainWindow.xaml.cs


注:本文中的Pitch.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。