Introduction


MIDI Player for SansGUI is a utility program that plays MIDI files and displays their channel data in the SansGUI Modeling and Simulation Environment. In addition to having some fun, we wrote this program to demonstrate simultaneous execution of both external and in-process simulators in SansGUI so that they can work in coordination. After the following Quick Start and Operation Details sections, we will explain some of the Program Elements from the user's point of view.

Quick Start

If you have not installed SansGUI and MIDI Player for SansGUI software from the distribution, please follow the instructions in the Welcome section. Here, we assume that you have SansGUI version 1.1 or later and the MIDI Player utility program installed and ready to go. Follow the steps below to get a quick start:

generate/runbar.jpg

You should see the pitch information of the MIDI data being plotted in strip charts. The screen should look like the title image in the Welcome section. When the music ends, both programs will stop. If you would like to play the music again, you can start it by running the external program. If you want to stop the music while it is being played, simply click on the command window that has the external MIDI Player running and type in Ctrl-C. The in-process program will detect the interruption and will stop automatically.

It does not really matter when you click on the Plot Results button on the Run toolbar. SansGUI activates the Plot Results function button whenever there are attributes logged and selected for plotting. You can click on it to display the Plot Results Dialog before playing the MIDI music, before starting the in-process program to fetch the MIDI data, or while the music is playing and the data in the Result View is scrolling.

Operation Details

The input parameters of the Piano.sgp Project Model are stored in a myMIDI reference object derived from the Collection.MIDI class. Every MIDI Player Project Model file should have a unique reference object derived from such class that all the channel components (parts) can refer to it.

generate/midicoll.jpg

By default, the Piano.sgp Project Model looks up MIDI data from channel 0 and channel 1. You can create more parts to look up data from more MIDI channels. Each channel part contains an input attribute, Channel Number, being used to fetch its channel data from the MIDI events. The Ch16.sgp Project Model has been created to show how to access channel 0 through 15.

The reason for creating S-1 through S-4 subclasses is that MIDI Player allows data to be plotted to up to four strip charts. If you would like to plot multiple data curves into the same strip, simply create the parts from the same S-n subclass. Again, please load Ch16.sgp to see more details.

Program Elements

Generate/introduction.gif

 

This MIDI Player utility program consists of two executable elements:

When you run the external program in SansGUI, it writes out a textual model file that contains all the necessary information, including the values of the attributes in the myMIDI object described previously, for the MIDI player to read. The in-process program is tightly coupled with SansGUI for data access and display.

Notes for Developers

Please see the Developer's Corner section for implementation details of this program.

MIDI Player Class Summary

 

Icon

Class

Description

generate/icomidi.jpg

Collection.MIDI

Class containing common parameters shared by the external process and in-process programs for playing MIDI files.

generate/icobasech.jpg

Base.Channel

Abstract class to implement common behavior for the S-1 to S-4 subclasses below.

generate/icochannel.jpg

Base.Channel.S-1..4

Component class for creating MIDI channels to receive data from the external process program.

generate/icocycle.jpg

SimControl.Cycle.MIDIplay

MIDI player control for the in-process program.

generate/icoxproc.jpg

SimControl.XProc.MIDIplay

MIDI player control for the external process program.

 



Welcome to MIDI Player for SansGUI Welcome to MIDI Player for SansGUI Developer's Corner

MIDI Player for SansGUI Version 1.0

Copyright 2002-2003 ProtoDesign, Inc. All rights reserved.

http://protodesign-inc.com