KeyboardDiagram.h

KeyboardDiagram.h

/*
   File:      KeyboardDiagram.h

   Contains:   xxx put contents here xxx

   Written by:   xxx put writers here xxx

   Copyright:   © 1994-1996 by Apple Computer, Inc., all rights reserved.

   Change History (most recent first):

       <9>    6/13/96   dvb      Sanitize.
       <8>    3/29/96   dvb      Moveable octave marker.
       <7>   11/14/95   dvb      Conditionally, use public interfaces.
       <6>    7/31/95   dvb      shift and control key
       <5>    7/12/95   dvb      tracking routin
      <4+> include keyboard tracking routine
       <4>    24-3-95   dvb      name collision
       <3>    17-3-95   dvb      final C note
       <2>    2/14/94   dvb      Velocity Vector
       <1>     2/4/94   dvb      first checked in

*/




#include 


#ifdef UsePublicMusicInterfaces
   #include 
   #include "PPCEnv.h"
#else
   #include "NoteAllocatorComponent.h"
   #include "QTEnv.h"
#endif

typedef struct
   {
   short octaveCount;
   Boolean hiC;            /* if true, contains key for the high C note */
   short lowKey;
   short keyCount;
   Boolean mod;
   short modOffset;
   Rect r;
   short **whiteKey;            /* resource nonsense */
   short **keyRight;
   unsigned char keyVel[128];
   Boolean gray;

   short wkRes,bkRes,pict1Res,pict2Res;   /* res ID's */

   Point basePoint;            /* base point if pitch bending */
   Point lastP;
   short lastKey;               /* last note played & highlighted, when doing live tracking */
   short lastKeyR;               /* last key started, for volume incrementing, when doing live tracking */
   short lastVel;               /* last volume pressed */
   short lastMods;               /* to sense change of sustain state */
   } KeyboardDiagram;

#define kKeyWidth 9
#define kKeyHeight 31

void InitializeKeyboard(KeyboardDiagram *kd,Rect *r,short lowKey,
      short wkRes,short bkRes,short pict1Res,short pict2Res);
void TerminateKeyboard(KeyboardDiagram *kd);

void SetKeyboardTopLeft(KeyboardDiagram *kd,short top, short left);

void DrawKeyboardPiece(KeyboardDiagram *kd, short octave);
void DrawKeyboardDropShadow(KeyboardDiagram *kd);
void DrawKeyboard(KeyboardDiagram *kd);
void SetKeyboardGray(KeyboardDiagram *kd,Boolean gray);
void PaintKeyboardKey(KeyboardDiagram *kd,short pitch,short gray);   /* 0-255, gray; -1, invert; -2, forecolor */
void PaintKeyboardVector(KeyboardDiagram *kd,unsigned char *keyVel);
void kdGoGray(void);

short GetKeyboardKey(KeyboardDiagram *kd,Point p);

short SetKeyboardLowKey(KeyboardDiagram *kd,short lowKey);

short ClickKeyboard(KeyboardDiagram *kd,Point p,short mods,
      NoteAllocator na,NoteChannel nc);

PM.6/13/96 - 2:45.PM