package vermilion;

import java.util.ArrayList;

/**
 * This class is used to pass information between the composer and the
 * router during audio generation. It simply wraps an integer which tells
 * the framework how many samples should be generated before checking again
 * for events, and an object array which can store data for passing events.
 * The Router and Composer are coupled in that they must agree on a format
 * for feeding events from the Composer to the Router during audio generation.
 * NB Audio generation takes place constantly, the Composer is the only part
 * of the system with a concept of 'playback'.
 */
public class EventCollection
{
    /**
     * The number of samples until the next event at the time when we
     * return this batch of events. Normally this will be much larger
     * than the default generation interval, however we still place
     * events at the closest sample using this mechanism.
     */
    public int samplesUntilNextEvent = 0;

    /**
     * A place where a composer may pass events to a router during 'playback'.
     * The two must agree on the format of the events passed, the framework
     * does not care.
     */
    public ArrayList<Object> events = null;

    /**
     * The constructor simply accepts both parts of the structure as
     * arguments.
     * @param eventList The batch of events that occur at this sample.
     * @param numSamples The number of samples until the next event.
     */
    public EventCollection(ArrayList<Object> eventList, int numSamples)
    {
        events = eventList;
        samplesUntilNextEvent = numSamples;
    }
}
