hciImprov Examples: hciTemplate


The hciTemplate program is an empty program which is to be filled in by a programmer working with MIDI sensor data.

An hciImprov program requires that six functions be defined:

1) void description(void);
This function is called by the improv interface whenever a capital "D" is pressed on the computer keyboard. Put a description of the program and how to use it here.

2) void initialization(void);
This function is called by the improv interface once at the start of the program. Put items here which need to be initialized at the beginning of the program.

3) void finishup(void);
This function is called by the improv interface whenever the program is exited. Put items here which need to be taken care of when the program is finished.

4) void mainloopalgorithms(void);
This function is called by the improv interface continuously while the program is running. The global variable t_time which stores the current time is set just before this function is called and remains constant while in this functions.

5) void mididata(int intime, int command, int p1, int p2);
This function is called by the improv interface whenever a MIDI message comes from MIDI input. Put commands here which will be executed when a MIDI message arrives from the sensors.
    intime arrival time of the MIDI message
    command command byte of the MIDI message
    p1 first parameter of the MIDI message
    p2 second parameter of the MIDI message


6) void keyboardchar(int key);
This function is called by the improv interface whenever a key is pressed on the computer keyboard. Put commands here which will be executed when a key is pressed on the computer keyboard.

Here is the shortest possible template without comments and with empty function definitions:

#include "hciImprov.h"      

void description(void) { } 
void initialization(void) { }
void finishup(void) { }
void mainloopalgorithms(void) { }
void mididata(int intime, int command, int p1, int p2) { }
void keyboardchar(int key) { }