Пример #1
0
        /// <summary>
        /// Gets name of tone and add it to Tones list at once.
        /// </summary>
        /// <param name="arrTone"></param>
        /// <param name="it"></param>
        /// <returns></returns>
        private string GetToneName(string arrTone, List <Tone2014> it)
        {
            string       ToneName = "";
            const string Default  = "Default";

            if (!String.IsNullOrEmpty(arrTone))
            {
                var matchedTone = it.SingleOrDefault(t => t.Name == arrTone);
                if (ReferenceEquals(matchedTone, null))
                {
                    return(ToneName);
                }

                if (matchedTone.GearList.IsNull())
                {
                    ToneName = Default;
                }
                else
                {
                    if (!Tones.Contains(matchedTone))
                    {
                        Tones.Add(matchedTone);
                    }
                    ToneName = arrTone;
                }
            }
            return(ToneName);
        }
        /// <summary>
        /// Gets name of tone and add it to Tones list at once.
        /// </summary>
        /// <param name="arrTone"></param>
        /// <param name="it"></param>
        /// <returns></returns>
        private string GetToneName(string arrTone, List <Tone2014> it)
        {
            string       ToneName = "";
            const string Default  = "Default";

            if (!String.IsNullOrEmpty(arrTone))
            {
                // recognize that ToneBase name alpha case mismatches do exist and process it
                // take the first if there are multiple matches so error is not thrown
                var matchedTone = it.FirstOrDefault(t => t.Name.ToLower() == arrTone.ToLower());
                if (ReferenceEquals(matchedTone, null))
                {
                    return(ToneName);
                }

                if (matchedTone.GearList.IsNull())
                {
                    ToneName = Default;
                }
                else
                {
                    if (!Tones.Contains(matchedTone))
                    {
                        Tones.Add(matchedTone);
                    }
                    ToneName = arrTone;
                }
            }
            return(ToneName);
        }
Пример #3
0
        public void Write(BinaryWriter w)
        {
            BPMs.Write(w);
            Phrases.Write(w);
            Chords.Write(w);
            ChordNotes.Write(w);
            Vocals.Write(w);

            if (Vocals.Count > 0)
            {
                SymbolsHeader.Write(w);
                SymbolsTexture.Write(w);
                SymbolsDefinition.Write(w);
            }

            PhraseIterations.Write(w);
            PhraseExtraInfo.Write(w);
            NLD.Write(w);
            Actions.Write(w);
            Events.Write(w);
            Tones.Write(w);
            DNAs.Write(w);
            Sections.Write(w);
            Arrangements.Write(w);
            Meta.Write(w);
        }
Пример #4
0
 protected virtual bool ValidateType(ref HairFurColors featherCol, ref Tones wingTone, ref Tones wingBoneTone, bool correctInvalidData)
 {
     featherCol   = HairFurColors.NO_HAIR_FUR;
     wingTone     = Tones.NOT_APPLICABLE;
     wingBoneTone = Tones.NOT_APPLICABLE;
     return(true);
 }
Пример #5
0
        public Note(byte oct, Tones t)
        {
            Octave = oct;
            Tone = t;

            Id = 12 + Octave*12 + (int) Tone;
        }
        public Note(byte oct, Tones t)
        {
            Octave = oct;
            Tone   = t;

            Id = 12 + Octave * 12 + (int)Tone;
        }
Пример #7
0
        public static void PlaySound(Tones tone)
        {
            try
            {
                SoundPlayer audio;
                switch (tone)
                {
                case Tones.error1:
                    audio = new SoundPlayer(AudioResource.error);
                    break;

                case Tones.error2:
                    audio = new SoundPlayer(AudioResource.errorBeep2);
                    break;

                default:
                    audio = new SoundPlayer(AudioResource.error);
                    break;
                }

                audio.Play();
                audio.Dispose();
                //SoundPlayer soundPlayer = new SoundPlayer(stream);
                //soundPlayer.PlaySync();
            }
            catch (Exception e) //We have to catch the exception here, or the IDE can crash
            {
                System.Windows.Forms.MessageBox.Show("error finding resource. " + e.StackTrace);
                Console.WriteLine(e.Message);
            }
        }
 public Note(Tones tone, int pitch, Intonation intonation)
 {
     this.tone       = tone;
     this.pitch      = pitch;
     this.intonation = intonation;
     this.connected  = false;
 }
Пример #9
0
        private float CellToFrequency(Cell cell)
        {
            var distance = Math.Sqrt(Math.Pow(cell.Row, 2) + Math.Pow(cell.Col, 2));
            var total    = Math.Sqrt(Math.Pow(_maze.Rows, 2) + Math.Pow(_maze.Cols, 2));
            var freq     = Tones.CalculateFrequency(distance, total);

            return((float)freq);
        }
Пример #10
0
 public virtual Tones getClawTone(Tones primaryTone, Tones secondaryTone)
 {
     if (canTone())
     {
         return(primaryTone);
     }
     return(Tones.NOT_APPLICABLE);
 }
Пример #11
0
        public int PlayTone(byte octave, Tones tone, int strength = 127) //Воспроизводим желаемую ноту (напр. "C#5").
        {
            int note = 12 + octave * 12 + (int)tone;                     // 12 полутонов в октаве, начинаем считать с 1-й октавы

            if (!_playingTones.Contains(note))
            {
                _midiOut.Send(MidiMessage.StartNote(note, strength, Chanel).RawData); // воспроизводим ноту на основном канале
                _playingTones.Add(note);
            }

            return(note);
        }
Пример #12
0
        private void WriteNote(WaveStreamWriter streamWriter, string name, int durationBefore, int duration, int amplitude)
        {
            Tone tone = Tones.Item(name);

            if (durationBefore > 0)
            {
                streamWriter.WriteSilenceChunk(durationBefore);
            }

            streamWriter.WriteChunk(SampleHelper.MakeBassChunk2(duration, tone.Frequency, amplitude, 2));
            //streamWriter.WriteOscillator(new Oscillator(WaveType.Sine, duration, tone.Frequency, amplitude, 2));
        }
Пример #13
0
 public void setContent(string content)
 {
     Tones.Clear();
     string[] tones = content.Split('-');
     tones = tones.Take(tones.Count() - 1).ToArray();
     if (tones.Count() > 0)
     {
         Beat = tones[0];
         for (int i = 1; i <= tones.Count() - 2; i += 2)
         {
             Tone t = new Tone(tones[i], tones[i + 1]);
             Tones.Add(t);
         }
     }
 }
Пример #14
0
 internal static Tones GetValidTone(Tones overrideTone, Tones primary, Tones secondary, Tones fallback)
 {
     if (!Tones.IsNullOrEmpty(overrideTone))
     {
         return(overrideTone);
     }
     else if (!Tones.IsNullOrEmpty(secondary))
     {
         return(secondary);
     }
     else if (!Tones.IsNullOrEmpty(primary))
     {
         return(primary);
     }
     else
     {
         return(fallback);
     }
 }
        public override Note create(string noteSpecifier)
        {
            bool   connected  = noteSpecifier.Contains("~");
            var    intonation = getIntonation(noteSpecifier);
            Length length     = calculateDuration(noteSpecifier);

            int higherPitch = noteSpecifier.Count(f => f == '\'');
            int lowerPitch  = noteSpecifier.Count(f => f == ',');

            Tones tone = getTone(noteSpecifier);

            Octave += higherPitch;
            Octave -= lowerPitch;
            var totalPitch = 4 + Octave;

            return(new Note(tone, totalPitch, intonation)
            {
                dot = noteSpecifier.EndsWith("."), length = length, connected = connected
            });
        }
Пример #16
0
        private static string ChangeSkinColorText(Creature target, Tones oldSkinTone)
        {
            StringBuilder sb = new StringBuilder();

            bool skinPlural;

            if (target.body.skinActive)
            {
                sb.Append("Your " + target.body.primarySkin.LongDescription(out skinPlural));
            }
            else
            {
                skinPlural = false;
                sb.Append("The skin under your " + target.body.LongEpidermisDescription());
            }

            sb.Append((skinPlural ? "begin to lose their" : "begins to lose its") + " color, fading out until you're as white as an albino. Then, starting at the crown of your head," +
                      " a reddish hue rolls down your body in a wave, turning you completely " + target.body.primarySkin.tone.AsString() + ".");

            return(sb.ToString());
        }
Пример #17
0
 public void AddTonalTalkPointToCurrentLine(Tones tone, bool doesContinue)
 {
     try
     {
         var cursorPos = GetCurrentCursorPosition();
         var filePath  = GetActiveDocumentPath();
         //Toggling Talkpoint
         RemoveIfTalkpointsExists(filePath, cursorPos);
         if (CheckIfBreakpointExists(filePath, cursorPos))
         {
             RemoveBreakpoints(filePath, cursorPos);
             return;
         }
         Talkpoint talkpoint = new ToneTalkpoint(filePath, cursorPos, doesContinue, tone);
         AddTalkPoint(talkpoint);
     }
     catch (Exception exp)   //We have to catch the exception here, or the IDE can crash
     {
         Debug.WriteLine(exp.StackTrace);
     }
 }
Пример #18
0
        public Pinyin(string input)
        {
            Original = input.Replace("u:", "v");

            Regex pattern = new Regex("^([a-zA-Z]+)([1-5])$");
            Match match = pattern.Match(Original);
            if (match.Success)
            {
                Syllable = match.Groups[1].Value;
                Tone = (Tones)int.Parse(match.Groups[2].Value);
                return;
            }

            pattern = new Regex("^([a-zA-Z]+)$"); // TODO: this could be more discerning
            match = pattern.Match(Original);
            if (match.Success)
            {
                Syllable = match.Groups[1].Value;
                return;
            }

            throw new FormatException(String.Format("Invalid Pinyin: '{0}'", Original));
        }
Пример #19
0
 public override Tones getClawTone(Tones primaryTone, Tones secondaryTone)
 {
     //do some magic to the tone to make it imp claw compatible
     return(primaryTone);
 }
Пример #20
0
 public void StopPlaying(byte octave, Tones tone)
 {
     StopPlaying(12 + octave * 12 + (int)tone);
 }
Пример #21
0
        protected internal override string DoTransformation(Creature target, out bool isBadEnd)
        {
            isBadEnd = false;

            //by default, this is 2 rolls at 50%, so a 25% chance of 0 additional tfs, 50% chance of 1 additional tf, 25% chance of 2 additional tfs.
            //also takes into consideration any perks that increase or decrease tf effectiveness. if you need to roll out your own, feel free to do so.
            int changeCount      = GenerateChangeCount(target, new int[] { 2, 2 }, 2);
            int remainingChanges = changeCount;

            StringBuilder sb = new StringBuilder();

            //For all of these, any text regarding the transformation should be instead abstracted out as an abstract string function. append the result of this abstract function
            //to the string builder declared above (aka sb.Append(FunctionCall(variables));) string builder is just a fancy way of telling the compiler that you'll be creating a
            //long string, piece by piece, so don't do any crazy optimizations first.

            //the initial text for starting the transformation. feel free to add additional variables to this if needed.
            sb.Append(InitialTransformationText(target));

            //Add any free changes here - these can occur even if the change count is 0. these include things such as change in stats (intelligence, etc)
            //change in height, hips, and/or butt, or other similar stats.

            //this will handle the edge case where the change count starts out as 0.
            if (remainingChanges <= 0)
            {
                return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
            }

            //Any transformation related changes go here. these typically cost 1 change. these can be anything from body parts to gender (which technically also changes body parts,
            //but w/e). You are required to make sure you return as soon as you've applied changeCount changes, but a single line of code can be applied at the end of a change to do
            //this for you.

            //paste this line after any tf is applied, and it will: automatically decrement the remaining changes count. if it becomes 0 or less, apply the total number of changes
            //underwent to the target's change count (if applicable) and then return the StringBuilder content.
            //if (--remainingChanges <= 0) return ApplyChangesAndReturn(target, sb, changeCount - remainingChanges);


            //STATS
            if (target.relativeSensitivity > 25 && Utils.Rand(3) < 2)
            {
                target.ChangeSensitivity((-1 - Utils.Rand(3)));
            }
            //Increase strength 1-2 points (Up to 50) (60 for tiger)
            if (((target.relativeStrength < 60 && isTigerShark) || target.relativeStrength < 50) && Utils.Rand(3) == 0)
            {
                target.ChangeStrength(1 + Utils.Rand(2));
            }
            //Increase Speed 1-3 points (Up to 75) (100 for tigers)
            if (((target.relativeSpeed < 100 && isTigerShark) || target.relativeSpeed < 75) && Utils.Rand(3) == 0)
            {
                target.ChangeSpeed(1 + Utils.Rand(3));
            }
            //Reduce sensitivity 1-3 Points (Down to 25 points)

            //Increase Libido 2-4 points (Up to 75 points) (100 for tigers)
            if (((target.relativeLibido < 100 && isTigerShark) || target.relativeLibido < 75) && Utils.Rand(3) == 0)
            {
                target.ChangeLibido((1 + Utils.Rand(3)));
            }
            //Decrease intellect 1-3 points (Down to 40 points)
            if (target.relativeIntelligence > 40 && Utils.Rand(3) == 0)
            {
                target.ChangeIntelligence(-(1 + Utils.Rand(3)));
            }
            //Smexual stuff!
            //-TIGGERSHARK ONLY: Grow a c**t (guaranteed if no gender)
            if (isTigerShark && (target.gender == 0 || (!target.hasVagina && Utils.Rand(3) == 0)))
            {
                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
                //(balls)
                //(dick)
                //(neither)
                target.genitals.AddVagina();
                target.ChangeSensitivity(10);
            }
            //WANG GROWTH - TIGGERSHARK ONLY
            if (isTigerShark && (!target.hasCock) && Utils.Rand(3) == 0)
            {
                //Genderless:
                //Female:
                if (target.balls.count == 0)
                {
                    target.balls.GrowBalls();
                }
                target.genitals.AddCock(CockType.defaultValue, 7, 1.4);

                target.DeltaCreatureStats(lib: 4, sens: 5, lus: 20);
                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //(Requires the target having two testicles)
            if (isTigerShark && (target.balls.count == 0 || target.balls.count == 2) && target.hasCock && Utils.Rand(3) == 0)
            {
                if (target.balls.count == 2)
                {
                    target.balls.AddBalls(2);
                }
                else if (target.balls.count == 0)
                {
                    target.balls.GrowBalls();
                }
                target.DeltaCreatureStats(lib: 2, sens: 3, lus: 10);
                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //-Remove extra breast rows
            if (target.breasts.Count > 1 && Utils.Rand(3) == 0 && !hyperHappy)
            {
                target.RemoveExtraBreastRows();
            }
            //Neck restore
            if (target.neck.type != NeckType.HUMANOID && Utils.Rand(4) == 0)
            {
                target.RestoreNeck();
            }
            //Rear body restore
            if (!target.back.isDefault && Utils.Rand(5) == 0)
            {
                target.RestoreBack();
            }
            //Ovi perk loss
            if (target.womb.canRemoveOviposition && Utils.Rand(5) == 0)
            {
                target.womb.ClearOviposition();
                sb.Append(ClearOvipositionText(target));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //Transformations:
            //Mouth TF
            if (target.face.type != FaceType.SHARK && Utils.Rand(3) == 0)
            {
                FaceData oldData = target.face.AsReadOnlyData();
                target.UpdateFace(FaceType.SHARK);
                sb.Append(UpdateFaceText(target, oldData));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //Remove odd eyes
            if (Utils.Rand(5) == 0 && target.eyes.type != EyeType.HUMAN)
            {
                EyeData oldData = target.eyes.AsReadOnlyData();
                target.RestoreEyes();
                sb.Append(RestoredEyesText(target, oldData));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //Tail TF
            if (target.tail.type != TailType.SHARK && Utils.Rand(3) == 0)
            {
                TailData oldData = target.tail.AsReadOnlyData();
                target.UpdateTail(TailType.SHARK);
                sb.Append(UpdateTailText(target, oldData));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //Gills TF
            if (target.gills.type != GillType.FISH && target.tail.type == TailType.SHARK && target.face.type == FaceType.SHARK && Utils.Rand(3) == 0)
            {
                GillData oldData = target.gills.AsReadOnlyData();
                target.UpdateGills(GillType.FISH);
                sb.Append(UpdateGillsText(target, oldData));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //Hair
            if (target.hair.hairColor != HairFurColors.SILVER && Utils.Rand(4) == 0)
            {
                target.hair.SetHairColor(HairFurColors.SILVER);

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //Skin
            //MOD NOTE: F**K. A TWO TONED SKIN TONE. F**K F**K F**K.
            //MOD NOTE (continued): tigershark skin tone is hacked in. it's a hack. it's an ugly as f**k hack and i need a shower now. but it'll work. i really, really, really
            //dont want to add a new body type for tigersharks, and i am not adding a fur color equivalent for tones for literally just tigersharks.
            if (((target.body.primarySkin.tone != Tones.GRAY && target.body.primarySkin.tone != Tones.TIGERSHARK) || target.body.type != BodyType.HUMANOID) && Utils.Rand(7) == 0)
            {
                Tones       targetTone    = isTigerShark ? Tones.TIGERSHARK : Tones.GRAY;
                SkinTexture targetTexture = SkinTexture.ROUGH;
                //getGame().rathazul.addMixologyXP(20);

                BodyData oldData = target.body.AsReadOnlyData();
                target.UpdateBody(BodyType.HUMANOID, targetTone, targetTexture);
                sb.Append(UpdateBodyText(target, oldData));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }
            //FINZ R WINGS
            if ((target.wings.type != WingType.NONE || target.back.type != BackType.SHARK_FIN) && Utils.Rand(3) == 0)
            {
                target.UpdateBack(BackType.SHARK_FIN);
                WingData oldData = target.wings.AsReadOnlyData();
                target.RestoreWings();
                sb.Append(RestoredWingsText(target, oldData));

                if (--remainingChanges <= 0)
                {
                    return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
                }
            }

            //this is the fallthrough that occurs when a tf item goes through all the changes, but does not proc enough of them to exit early. it will apply however many changes
            //occurred, then return the contents of the stringbuilder.
            return(ApplyChangesAndReturn(target, sb, changeCount - remainingChanges));
        }
Пример #22
0
 public char MapToCharacter(Tones tone)
 {
     return(toneList[tone]);
 }
Пример #23
0
 internal override void UpdateColorOnTransform(ref HairFurColors featherColor, ref Tones wingTone, ref Tones wingBoneTone, in BodyData bodyData)
Пример #24
0
 public NagaSilkDress(Tones color) : base(ArmorType.CLOTHING)
 {
     dressColor = color;
 }
Пример #25
0
        internal static bool Validate(ref WingType wingType, ref HairFurColors featherCol, ref Tones wingTone, ref Tones wingBoneTone, bool correctInvalidData)
        {
            bool valid = true;

            if (!wings.Contains(wingType))
            {
                if (!correctInvalidData)
                {
                    return(false);
                }
                wingType = NONE;
                valid    = false;
            }
            return(valid & wingType.ValidateType(ref featherCol, ref wingTone, ref wingBoneTone, correctInvalidData));
        }
Пример #26
0
 public ToneTalkpoint(string filePath, CursorPos position, bool doesContinue, Tones tone) : base(filePath, position, doesContinue)
 {
     this.talkpointTone = tone;
     this.isCustomTone  = false;
 }
Пример #27
0
 public void StopPlaying(byte octave, Tones tone)
 {
     StopPlaying(12 + octave*12 + (int) tone);
 }
Пример #28
0
        public int PlayTone(byte octave, Tones tone, int strength = 127)
        {
            int note = 12 + octave*12 + (int) tone; // 12 полутонов в октаве, начинаем считать с 0-й октавы (есть еще и -1-ая)

            if (!_playingTones.Contains(note))
            {
                _midiOut.Send(MidiMessage.StartNote(note, strength, Chanel).RawData); // воспроизводим ноту на канале 0
                _playingTones.Add(note);
            }

            return note;
        }
Пример #29
0
 internal static Tones GetValidTone(Tones overrideTone, Tones primary, Tones fallback)
 {
     return(GetValidTone(overrideTone, primary, null, fallback));
 }
Пример #30
0
 public static extern bool Beep(Tones tone);
Пример #31
0
 public HandData(Hands source) : base(GetID(source), GetBehavior(source))
 {
     this.clawTone = source.clawTone;
 }
Пример #32
0
            public void SendEvent(MidiEvent me, int tick)
            {
                if (me is NoteEvent)
                {
                    var value = Tones.TakeWhile(t => !(t == null || t.RealTick >= t.Gate || (t.Channel == me.Channel && t.NoteNum == (me as NoteEvent).Note))).Count();


                    if (value != Tones.Length)
                    {
                        _tonePtr = value;
                    }
                    else
                    {
                        (Tone, int)value2 = Tones.Select((t, i) => (t, i)).Where(ti => ti.Item1 != null).OrderBy((ti) => ti.Item1.StartTick).FirstOrDefault();
                        if (value2.Item1 != null)
                        {
                            _tonePtr = value2.Item2;
                        }
                    }
                    Tones[_tonePtr] = new Tone(me as NoteEvent)
                    {
                        StartTick = tick, Tick = tick
                    };
                    AudioTimers[_tonePtr].Reset();

                    _tonePtr = (_tonePtr + 1) % Tones.Length;
                }
                else if (me is ControlEvent)
                {
                    var c  = (ControlEvent)me;
                    var cc = c.ControlNo;
                    switch (cc)
                    {
                    case ControlChangeType.Volume:
                        Channel.Volume = c.Data;
                        break;

                    case ControlChangeType.Panpot:
                        Channel.Panpot = c.Data;
                        break;

                    case ControlChangeType.Expression:
                        Channel.Expression = c.Data;
                        break;

                    case ControlChangeType.DataMsb:
                        Rpns[2] = c.Data;
                        switch (Rpns[1])
                        {
                        case 0:
                            Channel.BendRange = Rpns[2];
                            break;

                        case 2:
                            Channel.NoteShift = (short)(Rpns[2] - 64);
                            break;
                        }
                        break;

                    case ControlChangeType.DataLsb:
                        Rpns[3] = c.Data;
                        if (Rpns[1] == 1)
                        {
                            Channel.Tweak = (short)((Rpns[2] << 7) + Rpns[3] - 8192);
                        }
                        break;

                    case ControlChangeType.Rpnlsb:
                        Rpns[1] = c.Data;
                        break;

                    case ControlChangeType.Rpnmsb:
                        Rpns[0] = c.Data;
                        break;

                    case ControlChangeType.HoldPedal:
                        break;

                    case ControlChangeType.Reverb:
                        break;

                    case ControlChangeType.Chorus:
                        break;

                    case ControlChangeType.Delay:
                        break;

                    case ControlChangeType.AllSoundOff:
                        break;

                    case ControlChangeType.ResetAllController:
                        break;

                    case ControlChangeType.AllNoteOff:
                        break;

                    case ControlChangeType.Mono:
                        break;

                    case ControlChangeType.Poly:
                        break;

                    case ControlChangeType.BankMsb:
                        break;

                    case ControlChangeType.BankLsb:
                        break;

                    case ControlChangeType.Modulation:
                        break;

                    default:
                        break;
                    }
                }
                else if (me is PitchEvent)
                {
                    var p = (PitchEvent)me;
                    Channel.Pitchbend = p.Bend;
                }
                else if (me is ProgramEvent)
                {
                    var pg = (ProgramEvent)me;
                    ProgramChange = pg.ProgramNo;
                }
            }
Пример #33
0
    //-----------------------------------------------------------------------------------
    //  Losing Song method - Plays song if user loses
    //       params:  none
    //       return:  none
    //-----------------------------------------------------------------------------------
    private static void LosingSong()
    {
        while (!gameOver)
        {
            /* Play 7/8 of first measure */
            for (int i = 1; i < 5; i++)
            {
                /* Play 8th note */
                Tones.SoftToneWrite(SPEAKER, 392);

                /* Delay */
                try
                {
                    WiringPi.Timing.delay(120);
                }
                catch (System.OverflowException)
                {}

                /* Rest for 8th note */
                if (i != 4)
                {
                    Tones.SoftToneWrite(SPEAKER, 0);

                    try
                    {
                        WiringPi.Timing.delay(120);
                    }
                    catch (System.OverflowException)
                    {}
                }
            }

            /* Play dotted 16th note */
            Tones.SoftToneWrite(SPEAKER, 440);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(90);
            }
            catch (System.OverflowException)
            {}

            /* Brief pause to end of measure */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(30);
            }
            catch (System.OverflowException)
            {}

            /* Play 7/8 of second measure */
            for (int i = 1; i < 5; i++)
            {
                /* Play 8th note */
                Tones.SoftToneWrite(SPEAKER, 370);

                /* Delay */
                try
                {
                    WiringPi.Timing.delay(120);
                }
                catch (System.OverflowException)
                {}

                /* Rest for 8th note */
                if (i != 4)
                {
                    Tones.SoftToneWrite(SPEAKER, 0);

                    try
                    {
                        WiringPi.Timing.delay(120);
                    }
                    catch (System.OverflowException)
                    {}
                }
            }

            /* Play dotted 16th note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(90);
            }
            catch (System.OverflowException)
            {}

            /* Brief pause to end of measure */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(30);
            }
            catch (System.OverflowException)
            {}

            /* Play 7/8 of third measure */
            for (int i = 1; i < 5; i++)
            {
                /* Play 8th note */
                Tones.SoftToneWrite(SPEAKER, 247);

                /* Delay */
                try
                {
                    WiringPi.Timing.delay(120);
                }
                catch (System.OverflowException)
                {}

                /* Rest for 8th note */
                if (i != 4)
                {
                    Tones.SoftToneWrite(SPEAKER, 0);

                    try
                    {
                        WiringPi.Timing.delay(120);
                    }
                    catch (System.OverflowException)
                    {}
                }
            }

            /* Play dotted 16th note */
            Tones.SoftToneWrite(SPEAKER, 277);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(90);
            }
            catch (System.OverflowException)
            {}

            /* Brief pause to end of measure */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(30);
            }
            catch (System.OverflowException)
            {}

            /* Play 7/8 of fourth measure */
            for (int i = 1; i < 5; i++)
            {
                /* Play 8th note */
                Tones.SoftToneWrite(SPEAKER, 233);

                /* Delay */
                try
                {
                    WiringPi.Timing.delay(120);
                }
                catch (System.OverflowException)
                {}

                /* Rest for 8th note */
                if (i != 4)
                {
                    Tones.SoftToneWrite(SPEAKER, 0);

                    try
                    {
                        WiringPi.Timing.delay(120);
                    }
                    catch (System.OverflowException)
                    {}
                }
            }

            /* Play dotted 16th note */
            Tones.SoftToneWrite(SPEAKER, 277);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(90);
            }
            catch (System.OverflowException)
            {}

            /* Brief pause to end of measure */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(30);
            }
            catch (System.OverflowException)
            {}
        }
    }
Пример #34
0
    //-----------------------------------------------------------------------------------
    //  Winning Song method - Plays song if user wins
    //       params:  none
    //       return:  none
    //-----------------------------------------------------------------------------------
    private static void WinningSong()
    {
        while (!gameOver)
        {
            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 370);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 370);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 294);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 247);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 247);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 415);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 415);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 440);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 494);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 440);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 440);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 440);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 294);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 370);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 370);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(273);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 370);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 370);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Play note */
            Tones.SoftToneWrite(SPEAKER, 330);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}

            /* Rest */
            Tones.SoftToneWrite(SPEAKER, 0);

            /* Delay */
            try
            {
                WiringPi.Timing.delay(91);
            }
            catch (System.OverflowException)
            {}
        }
    }