home *** CD-ROM | disk | FTP | other *** search
/ PC Musician 2000 / PC_Musician_2000.iso / PCMUSIC / NOTATION / SILENCE / VOICMANG.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-18  |  2.6 KB  |  70 lines

  1. /******************************************/
  2. /*  Simple Voice Manager (Mangler)        */
  3. /*  for ToolKit96, 1996 Perry R. Cook     */
  4. /*  Princeton University                  */
  5. /*                                        */
  6. /*  Make one of these by telling it the   */
  7. /*  maximum number of voices you'll want, */
  8. /*  and also what flavor instrument       */
  9. /*  group it will be mangling.  Pipe TSIDI*/
  10. /*  messages into it and it will return   */
  11. /*  the mixed channel signal each tick.   */
  12. /*  For multi-channel (multi-timbral),    */
  13. /*  make one for each channel and mix     */
  14. /*  their outputs.                        */
  15. /*                                        */
  16. /*  Each note on returns a unique tag,    */
  17. /*  (credits to the NeXT MusicKit here),  */
  18. /*  so you can send control changes to    */
  19. /*  unique instances of instruments       */
  20. /*  within an ensemble.                   */
  21. /*                                        */
  22. /*  TSIDI (ToolKit Synthesis Instrument   */
  23. /*  Digital Interfaceis like MIDI, but    */
  24. /*  allows for floating point control     */
  25. /*  changes, note numbers, etc. Example:  */
  26. /*  noteOn(1,60.01,111.132) plays a sharp */      
  27. /*  middle C with a velocity of 111.132   */
  28. /*                                        */
  29. /******************************************/
  30.  
  31. #include "Object.h"
  32.  
  33. #if !defined(__VoicMang_h)
  34. #define __VoicMang_h
  35.  
  36. #include "Instrmnt.h"
  37.  
  38. #define __VMang_MAX_ 8
  39.  
  40. class VoicMang : public Object
  41. {
  42.   protected:  
  43.     char InstrumentType[16];              // Instrument Flavor
  44.     int  max_voices;                                
  45.     long newTag;                          // Unique NoteOn tag counter
  46.     Instrmnt *instrument[__VMang_MAX_];   // The actual Instruments
  47.     long voicesOn[__VMang_MAX_];          // Tags of Sounding Notes
  48.     int  notesOn[__VMang_MAX_];           // Note Numbers On
  49.     long mute_time;                       // Instrument time to shut up
  50.     MY_FLOAT freqBases[__VMang_MAX_];     // Indiv. Pitch Bend Multipliers
  51.     MY_FLOAT frequencies[__VMang_MAX_];   // Indiv. Sounding Frequencies
  52.     MY_FLOAT pitch_bend;                  // Channel Pitch Bend Mult.
  53.   public:
  54.     VoicMang(int maxVoices, char *instrType);
  55.     ~VoicMang();
  56.     long noteOn(MY_FLOAT noteNum, MY_FLOAT amp);
  57.     long noteOnF(MY_FLOAT freq, MY_FLOAT amp);
  58.     void noteOff(long tag, MY_FLOAT amp);
  59.     int noteOffN(int note_num, MY_FLOAT amp);
  60.     long oldestVoice();
  61.     void kill(long tag);
  62.     void controlChange(int number, MY_FLOAT value);
  63.     void controlChange(long tag, int number, MY_FLOAT value);
  64.     void pitchBend(MY_FLOAT value);
  65.     void pitchBend(long tag, MY_FLOAT value);
  66.     MY_FLOAT tick();
  67. };
  68.  
  69. #endif
  70.