Esempio n. 1
0
        protected override string GenerateString(Settings settings, SoundModule module)
        {
            int    len = Length[0];
            string str = string.Empty;

            Settings.NoteRest nrSettings = settings.noteRest;

            if (nrSettings.UnuseTiedRest || nrSettings.TieStyle == 0 ||
                (!CommandRelation.HasFlag(MMLCommandRelation.TieBefore) || CommandRelation.HasFlag(MMLCommandRelation.PrevControl)))
            {
                str += "r";
            }
            str += len.ToString();

            int dotlen = 0;

            for (int i = 1; i < Length.Count; i++)
            {
                if (len * 2 == Length[i] && nrSettings.DotEnable &&
                    (nrSettings.DotLength == 0 || dotlen < nrSettings.DotLength))
                {
                    str += ".";
                    dotlen++;
                }
                else
                {
                    if (nrSettings.UnuseTiedRest)     // No Tie
                    {
                        str = str + "r" + Length[i];
                    }
                    else
                    {
                        if (nrSettings.TieStyle == 0)       // Tie and Name
                        {
                            str = str + "&" + "r" + Length[i];
                        }
                        else       // Tie only
                        {
                            str = str + "^" + Length[i];
                        }
                    }
                    dotlen = 0;
                }
                len = Length[i];
            }

            if (!nrSettings.UnuseTiedRest && CommandRelation.HasFlag(MMLCommandRelation.TieAfter) && !CommandRelation.HasFlag(MMLCommandRelation.NextControl))
            {
                if (nrSettings.TieStyle == 0)
                {
                    str += "&";
                }
                else
                {
                    str += "^";
                }
            }

            return(str);
        }
Esempio n. 2
0
        protected override string GenerateString(Settings settings, SoundModule module)
        {
            int    len = Length[0];
            string str = string.Empty;

            Settings.NoteRest nrSettings = settings.noteRest;

            if (nrSettings.TieStyle == 0 ||
                (!CommandRelation.HasFlag(MMLCommandRelation.TieBefore) || CommandRelation.HasFlag(MMLCommandRelation.PrevControl)))
            {
                str += Name;
            }
            str += len.ToString();

            int dotlen = 0;

            for (int i = 1; i < Length.Count; i++)
            {
                if (len * 2 == Length[i] && nrSettings.DotEnable &&
                    (nrSettings.DotLength == 0 || dotlen < nrSettings.DotLength))
                {
                    str += ".";
                    dotlen++;
                }
                else
                {
                    if (nrSettings.TieStyle == 0)       // Tie and Name
                    {
                        str = str + nrSettings.TieCommandCustom + Name + Length[i];
                    }
                    else       // Tie only
                    {
                        str = str + nrSettings.TieCommandCustom + Length[i];
                    }
                    dotlen = 0;
                }
                len = Length[i];
            }

            if (CommandRelation.HasFlag(MMLCommandRelation.TieAfter))
            {
                str += nrSettings.TieCommandCustom;
            }

            return(str);
        }