Channel
An abstract MIDI channel component class to implement common attributes and behavior of its subclasses.
Because this class is abstract, the users will not be able to create any object from it; therefore, no part can be created from it, either. The users will create channel components (objects and parts) from the subclasses of this class.
Channel Number (iNumber): the channel number of this component. It will be used to match the channel numbers of the MIDI events in the MIDI Message Object below.
MIDI Message Object (rRef): the reference object where the MIDI event data come from. You need to create one object from the Collection.MIDI class in a Project Model and enter the name of the object in this field.
Evaluation (SG_xEval): looks into the MIDI channel and data in the MIDI message reference object and records the data in the part derived from one of the subclasses (S-n) whenever the channel numbers match. If they don't match, the MIDI event is not for this channel and the function simply returns.
Against object encapsulation rules, the above Evaluation function accesses the MIDI Data attribute not defined here but in the subclasses (see below). This is very dangerous in most programming practices because the in-process DLL will crash with an access violation whenever the function manipulates an instance that is created from this class. SansGUI provides developers with a safe guard, which is to set this class abstract so that no instance of this class can be created by the user. Why do we allow this in the first place? Because we can implement the common function in this parent class and the subclass functions can simply call this parent class function. In this particular case, we are sure that all subclasses have the MIDI Data attribute. Why didn't we put MIDI Data attribute in this class? Because the MIDI Data attributes in the subclasses have different measuring units.
To examine the abstract class setting, double click on the Base.Channel class to obtain the class definition in a Class Properties dialog.
Although this class uses the default SansGUI port definition for component classes, in which the ports are implicitly defined without connection restriction, any links created in the Project Models are simply ignored by the MIDI Player program.
Classes S-1, S-2, S-3, and S-4 are component classes for creating MIDI channels in a Project Model. They are subclasses of the Base.Channel class.
Create a component (part) in the Canvas View to represent a MIDI channel. Enter a channel number that matches a channel in the MIDI file to be played so that the data associated with the particular channel will be recorded in the component (part). If the data curves are to be plotted in different strips, derive the components from objects of different S-n classes; otherwise, group them into the same S-n class.
In addition to the class attributes inherited from class Base.Channel, the S-1 through S-4 classes contains an attribute:
MIDI Data (iData): to store the MIDI data from the current MIDI event in the reference object when the channel number matches the one in the MIDI event.
Artificial measuring units, Strip-1 through Strip-4, are assigned to the MIDI Data attributes in the S-1 through S-4 classes. With these different units, the user can create channel components from the classes in such a way that data curves from the same class will be plotted in the same strip while those from different classes will be plotted separately.
Evaluation (SG_xEval): calls the Evaluation function in the parent class for the common behavior, which is to fetch the MIDI data from the reference object if the channel number matches the one in the MIDI event.
Although there are measuring unit differences in classes S-1 through S-4, the code in the Evaluation function stays the same. The units are introduced mainly for SansGUI charting purposes.
Same as the parent class, Base.Channel, described above.
For details of the MIDI Message Object, see Class Collection.MIDI for its descriptions.
Consult the Developer's Corner section for how the program modules work.
MIDI Player for SansGUI Version 1.0
Copyright © 2002-2003 ProtoDesign, Inc. All rights reserved.