#ifndef _KBMAIN_H_
#define _KBMAIN_H_
#include "kbId.h"
#include "sound.h"
#include <fstream.h>
#define MAXDEVNUM 16
#define CMDLENCTOP 400
class IfFactory;
class IfMain;
class KbTrack;
class KbPart;
class KbNote;
class KbExtensionManager;
/**
* This is the main kooBase class. main() will create exactly one object
* of this class and a factory for the presentation as a parameter. If you want
* to change the presentation, change the factory in the file main.C.
* @short The kooBase main class
* @author Jan Wuerthner
* @version 0.95
* @see IfMain
* @see QtMain
* @see TxMain
*/
class KbMain : public KbId
{
private:
IfFactory * ifFactory;
IfMain * ifMain;
KbTrack * track;
DeviceManager * midi;
KbExtensionManager * extMan;
int snap;
int tempo;
int meter0;
int meter1;
int m0; // dummy
int m1; // dummy
char * devices[MAXDEVNUM];
int position;
int bars;
int beats;
int ticks;
double timeF; // dummy
int ticksPerBar; // dummy
int ticksPerBeat; // dummy
int timeWI; // dummy
int selX1;
int selX2;
// KbMidi midi;
// play:
int midiOff;
bool playWait;
int playTicks;
int playTicksPB;
int playBeats;
int stop;
int stopTK;
int stopTk;
int numScr;
int left;
int right;
int rightPosition;
KbTrack * t[128];
KbPart * cPart[128];
int tOff[128];
int stp[128];
int relVol[128];
int totVol;
bool mute[128];
KbNote * sus[256];
int susCh[256];
int susOut[256];
int susPos[256];
int susTr[256];
int pp;
int pp1;
int kk;
int susp;
int fout;
int pid;
int fdToChild[2];
int fdToParent[2];
int partShow;
// char bufCtoP[CMDLENCTOP + 1];
// ssize_t ctop_read;
int fback;
int led[128]; // attention: QtMain has also got a led array of the same dimension!
int count;
int shift;
char help[120];
bool beepFlag;
bool beepMidi;
int beepCount;
int preBeats;
int clickInst;
int clickVol;
int clickVol1;
int i;
int answer;
bool cycle;
// bool beepFlag;
// bool beepMidi;
// int clickInst;
// int clickVol;
// int preBeats;
// bool playWait;
public:
// int led[128];
/**
* Constructor. fac refers to the factory interface. The kb... classes do not own presentations
* of their contents, especially no graphical presentations! The presentations will be
* attached via this interface. E.g. QtFactory is derived from IfFactory
* and creates the QtMain-object, QtTrack-objects , QtPart-objects, etc.
* @param fac the factory that creates the presentation specific objects.
* @param argc command line arguments.
* @param argv command line arguments.
*/
KbMain( IfFactory * fac, int argc, char ** argv );
/**
* adjust right border
*/
void adjustRightBorder();
/**
* @return the factory interface.
*/
IfFactory * gFactory();
/**
* @return the main interface.
*/
IfMain * gInterface();
/**
* returns the (n+1)īth track. This might be zero! Further tracks are connected to the first track via next-chain.
*/
KbTrack * gTrack(int n=0);
/**
* sets the first track. This is for internal use, e.g. when the first track gets deleted!
*/
void sTrack(KbTrack * t);
/**
* This adds a track to the track-chain.
* @return a pointer to the new track.
*/
KbTrack * addTrack();
/**
* @return the name of the device descibed by the device number i.
* @param i the device number.
* @see #findDevices
*/
char * gDevice(int i);
/**
* @return the current snap-value, which holds the midi-ticks used for quantization and other truncation.
* @see #sSnap
*/
int gSnap();
/**
* @return the current tempo value, midi data is played and recorded.
* @see #sTempo
*/
int gTempo();
/**
* This returns the current meter.
* @param i call with i=0 to obtain the numerator, and with i=1 to obtain the nominator
* @return the numerator, nominator resp.
* @see #sMeter
*/
int gMeter(int i);
/**
* This sets the snap value, which holds the midi-ticks used for quantization and other truncation.
* @param s the snap value.
* @see #gSnap
*/
void sSnap(int s);
/**
* This sets the tempo value.
* @param t the tempo
* @see #gTempo
*/
void sTempo(int t);
/**
* This sets the meter.
* @param i call with i=0 to set the nominator to m, call with i=1 to set the numerator to m.
* @param m the nominator, numerator resp.
*/
void sMeter(int i,int m);
/**
* returns the time position (in ticks)
*/
int gPos();
/**
* returns the left locator (in ticks)
*/
int gLeftSel();
/**
* returns the right locator (in ticks)
*/
int gRightSel();
/**
* returns the left locator (in bars)
*/
int gLeftBar();
/**
* returns the right locator (in bars)
*/
int gRightBar();
/**
* sets the left locator
*/
void sLeftSel(int p=-1);
/**
* sets the right locator
*/
void sRightSel(int p=-1);
/**
* toggles the cycle flag
*/
void togCycle();
/**
* sets the position
* either call with one parameter describing the position in ticks
* or call with bar, beat and ticks
*/
void sPos(int p, int b=-1, int t=-1);
/**
* same as sPos(int p, int b=-1, int t=-1), but returns and does not set the position!
*/
int gPosOf(int p, int b, int t);
/**
* returns the playWait variable, which is TRUE, if the playroutine shall wait for an acoustic signal before playing
*/
bool gPlayWait();
/**
* does not set the position, and meter.
* calculates (updates) bar, beat and tick values from position.
* @param pos the position
* @param t0 meter numerator
* @param t1 meter nominator
*/
void BBT(int pos, int t0=0, int t0=0);
/**
* returns the bar value.
* @param pos if not -1: runs BBT(pos) first
*/
int gBar(int pos=-1, int t0=0, int t1=0);
/**
* returns the beat valuee.
* @param pos if not -1: runs BBT(pos) first
*/
int gBeat(int pos=-1, int t0=0, int t1=0);
/**
* returns the beat valuee.
* @param pos if not -1: runs BBT(pos) first
*/
int gTick(int pos=-1, int t0=0, int t1=0);
/**
* plays a song
* @param tracki the track number to be played
* @param off the offset (in midi ticks)
* @param delt the number of midi ticks that are to be played
*/
void play(int tracki=-1, int off=0, int delt=0);
/**
* stops playing
*/
void stopAll();
void hit(int out, int ch, int freq, int vol);
void muteTrack(int);
void waitForClap();
void myBeep();
void playEvent(int);
void answerParent();
// void playListen(); -> class QtMain
int gFback();
// DeviceManager * gMidi();
int gRightPosition();
void sRightPosition(int p);
void getMidi(ifstream *);
void getKooBase(ifstream *);
void saveMidi(ofstream *);
void saveKooBase(ofstream *);
void clear();
bool gBeepFlag();
bool gBeepMidi();
int gClickInst();
int gClickVol();
int gPreBeats();
//bool gPlayWait();
void sBeepFlag(bool b);
void sBeepMidi(bool b);
void sClickInst(int i);
void sClickVol(int i);
void sPreBeats(int i);
void sPlayWait(bool b);
KbExtensionManager * extManager();
};
#endif
Documentation generated by wuerthne@clouseau on Sat Feb 20 16:41:13 MST 1999