Exemplo n.º 1
0
        private void Write(MetaMessage message)
        {
            trackData.Add((byte)message.Status);
            trackData.Add((byte)message.MetaType);

            WriteVariableLengthValue(message.Length);

            trackData.AddRange(message.GetBytes());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the TimeSignatureBuilder with the specified MetaMessage.
        /// </summary>
        /// <param name="message">
        /// The MetaMessage to use for initializing the TimeSignatureBuilder. 
        /// </param>
        /// <exception cref="ArgumentException">
        /// If the specified MetaMessage is not a time signature type.
        /// </exception>
        public void Initialize(MetaMessage message)
        {
            #region Require

            if(message.MetaType != MetaType.TimeSignature)
            {
                throw new ArgumentException("Wrong meta event type.", "message");
            }

            #endregion

            data = message.GetBytes();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes the MetaMessageTextBuilder with the specified MetaMessage.
        /// </summary>
        /// <param name="message">
        /// The MetaMessage to use for initializing the MetaMessageTextBuilder.
        /// </param>
        /// <exception cref="ArgumentException">
        /// If the MetaMessage is not a text based type.
        /// </exception>
        public void Initialize(MetaMessage message)
        {
            #region Require

            if(!IsTextType(message.MetaType))
            {
                throw new ArgumentException("Not text based meta message.",
                    "message");
            }

            #endregion

            ASCIIEncoding encoding = new ASCIIEncoding();

            text = encoding.GetString(message.GetBytes());
            this.type = message.MetaType;
        }