Exemplo n.º 1
0
 /// <summary>
 ///   Deserializes workflow markup into an pitch object
 /// </summary>
 /// <param name = "xml">string workflow markup to deserialize</param>
 /// <param name = "obj">Output pitch object</param>
 /// <param name = "exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out Pitch obj, out Exception exception)
 {
     exception = null;
     obj = default(Pitch);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///   Deserializes xml markup from file into an pitch object
 /// </summary>
 /// <param name = "fileName">string xml file to load and deserialize</param>
 /// <param name = "obj">Output pitch object</param>
 /// <param name = "exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out Pitch obj, out Exception exception)
 {
     exception = null;
     obj       = default(Pitch);
     try
     {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 ///   Deserializes workflow markup into an pitch object
 /// </summary>
 /// <param name = "xml">string workflow markup to deserialize</param>
 /// <param name = "obj">Output pitch object</param>
 /// <param name = "exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out Pitch obj, out Exception exception)
 {
     exception = null;
     obj       = default(Pitch);
     try
     {
         obj = Deserialize(xml);
         return(true);
     }
     catch (Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
 public int Compare(musicxml30.Types.Pitch x, musicxml30.Types.Pitch y)
 {
     return(CompareStatic(x, y));
 }
Exemplo n.º 5
0
 public static bool Deserialize(string xml, out Pitch obj)
 {
     Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
Exemplo n.º 6
0
 public static bool LoadFromFile(string fileName, out Pitch obj)
 {
     Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
Exemplo n.º 7
0
 /// <summary>
 ///   Deserializes xml markup from file into an pitch object
 /// </summary>
 /// <param name = "fileName">string xml file to load and deserialize</param>
 /// <param name = "obj">Output pitch object</param>
 /// <param name = "exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out Pitch obj, out Exception exception)
 {
     exception = null;
     obj = default(Pitch);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
        /// <summary>
        /// Determine if there should be a line through the note head because it is off the staff
        /// </summary>
        /// <param name="pitch">The pitch to check for a line</param>
        /// <param name="clefSign">The clef that is affecting the staff</param>
        /// <returns>True if there should be a line, false otherwise</returns>
        private static bool LineThroughNoteHead(Pitch pitch, ClefSign clefSign)
        {
            Pitch bottomOfStaff = null;
            Pitch topOfStaff = null;

            switch(clefSign)
            {
                case ClefSign.G:
                    bottomOfStaff = Constants.Note.TrebelDefaults.BOTTOM_OF_STAFF;
                    topOfStaff = Constants.Note.TrebelDefaults.TOP_OF_STAFF;
                    break;
                case ClefSign.F:
                    //todo: F values
                    break;
                case ClefSign.C:
                    //todo: C values
                    break;
                    //todo: all clefs
            }
            if(bottomOfStaff == null || topOfStaff == null)
                return false;

            int bottomCompare = PitchComparer.CompareStatic(pitch, bottomOfStaff);
            int topCompare = PitchComparer.CompareStatic(pitch, topOfStaff);

            return ((bottomCompare < 0 && bottomCompare%2 == 0) ||
                    topCompare > 0 && topCompare%2 == 0);
        }
Exemplo n.º 9
0
        public static bool LoadFromFile(string fileName, out Pitch obj)
        {
            Exception exception = null;

            return(LoadFromFile(fileName, out obj, out exception));
        }
Exemplo n.º 10
0
        public static bool Deserialize(string xml, out Pitch obj)
        {
            Exception exception = null;

            return(Deserialize(xml, out obj, out exception));
        }