/// <summary> /// Initializes a new instance of the SongPositionPointer class with /// the specified system common message and pulses per quarter note. /// </summary> /// <param name="ppqn"> /// Pulses per quarter note resolution. /// </param> /// <param name="message"> /// The system common message to use for initialization. /// </param> /// <exception cref="ArgumentException"> /// If the specified message is not a song position pointer message or /// the pulses per quarter note value is invalid. /// </exception> public SongPositionPointer(int ppqn, SysCommonMessage message) { // Enforce preconditions. if (ppqn < TickGenerator.PpqnMin || ppqn % TickGenerator.PpqnMin != 0) { throw new ArgumentException( "Pulses per quarter note invalid value.", "ppqn"); } else if (message.Type != SysCommonType.SongPositionPointer) { throw new ArgumentException( "Not song position pointer message.", "message"); } this.message = (SysCommonMessage)message.Clone(); tickScale = ppqn / TickGenerator.PpqnMin; }
/// <summary> /// Initializes a new instance of the SongPositionPointer class with /// the specified system common message and pulses per quarter note. /// </summary> /// <param name="ppqn"> /// Pulses per quarter note resolution. /// </param> /// <param name="message"> /// The system common message to use for initialization. /// </param> /// <exception cref="ArgumentException"> /// If the specified message is not a song position pointer message or /// the pulses per quarter note value is invalid. /// </exception> public SongPositionPointer(int ppqn, SysCommonMessage message) { // Enforce preconditions. if(ppqn < TickGenerator.PpqnMin || ppqn % TickGenerator.PpqnMin != 0) throw new ArgumentException( "Pulses per quarter note invalid value.", "ppqn"); else if(message.Type != SysCommonType.SongPositionPointer) throw new ArgumentException( "Not song position pointer message.", "message"); this.message = (SysCommonMessage)message.Clone(); tickScale = ppqn / TickGenerator.PpqnMin; }
/// <summary> /// Returns a clone of the adapted song position pointer message. /// </summary> /// <returns> /// A clone of the adapted song position pointer message. /// </returns> public SysCommonMessage ToMessage() { return((SysCommonMessage)message.Clone()); }