Exemplo n.º 1
0
        /// <summary>
        /// Handles tick events generated by the tick generator.
        /// </summary>
        /// <param name="sender">
        /// The tick generator responsible for the event.
        /// </param>
        /// <param name="e">
        /// Holds information about the Tick event.
        /// </param>
        private void tickGen_Tick(object sender, TickEventArgs e)
        {
            // Keep track of position.
            position += e.Ticks;

            // Keep track of the current tick tounc.
            currTicks += e.Ticks;

            // While the end of the track has not been reached and the
            // current tick count is greater than or equal to the tick count
            // for the next Midi event.
            while (currIndex < mergedTrack.Count &&
                   currTicks >= mergedTrack[currIndex].Ticks)
            {
                // Visit the message.
                mergedTrack[currIndex].Message.Accept(this);

                // Remove the ticks from the Midi event from the current tick
                // count.
                currTicks -= mergedTrack[currIndex].Ticks;

                // Move to next message in the merged track.
                currIndex++;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles tick events generated by the tick generator.
        /// </summary>
        /// <param name="sender">
        /// The tick generator responsible for the event.
        /// </param>
        /// <param name="e">
        /// Holds information about the Tick event.
        /// </param>
        private void tickGen_Tick(object sender, TickEventArgs e)
        {
            // Keep track of position.
            position += e.Ticks;

            // Keep track of the current tick tounc.
            currTicks += e.Ticks;

            // While the end of the track has not been reached and the 
            // current tick count is greater than or equal to the tick count 
            // for the next Midi event.
            while(currIndex < mergedTrack.Count && 
                currTicks >= mergedTrack[currIndex].Ticks)
            {
                // Visit the message.
                mergedTrack[currIndex].Message.Accept(this);

                // Remove the ticks from the Midi event from the current tick
                // count.
                currTicks -= mergedTrack[currIndex].Ticks;

                // Move to next message in the merged track.
                currIndex++;
            }  
        }