Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Skini.h

00001 #ifndef STK_SKINI_H
00002 #define STK_SKINI_H
00003 
00004 #include "Stk.h"
00005 #include <vector>
00006 #include <string>
00007 #include <fstream>
00008 
00009 namespace stk {
00010 
00011 /***************************************************/
00036 /***************************************************/
00037 
00038 class Skini : public Stk
00039 {
00040  public:
00041 
00043   struct Message { 
00044     long type;                         
00045     long channel;                      
00046     StkFloat time;                     
00047     std::vector<StkFloat> floatValues; 
00048     std::vector<long> intValues;       
00049     std::string remainder;             
00051     // Default constructor.
00052     Message()
00053       :type(0), channel(0), time(0.0), floatValues(2), intValues(2) {}
00054   };
00055 
00057   Skini();
00058 
00060   ~Skini();
00061 
00063 
00067   bool setFile( std::string fileName );
00068 
00070 
00076   long nextMessage( Skini::Message& message );
00077 
00079 
00083   long parseString( std::string& line, Skini::Message& message );
00084 
00086   static std::string whatsThisType(long type);
00087 
00089   static std::string whatsThisController(long number);
00090 
00091  protected:
00092 
00093   void tokenize( const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters );
00094 
00095   std::ifstream file_;
00096 };
00097 
00098 static const double Midi2Pitch[129] = {
00099 8.18,8.66,9.18,9.72,10.30,10.91,11.56,12.25,
00100 12.98,13.75,14.57,15.43,16.35,17.32,18.35,19.45,
00101 20.60,21.83,23.12,24.50,25.96,27.50,29.14,30.87,
00102 32.70,34.65,36.71,38.89,41.20,43.65,46.25,49.00,
00103 51.91,55.00,58.27,61.74,65.41,69.30,73.42,77.78,
00104 82.41,87.31,92.50,98.00,103.83,110.00,116.54,123.47,
00105 130.81,138.59,146.83,155.56,164.81,174.61,185.00,196.00,
00106 207.65,220.00,233.08,246.94,261.63,277.18,293.66,311.13,
00107 329.63,349.23,369.99,392.00,415.30,440.00,466.16,493.88,
00108 523.25,554.37,587.33,622.25,659.26,698.46,739.99,783.99,
00109 830.61,880.00,932.33,987.77,1046.50,1108.73,1174.66,1244.51,
00110 1318.51,1396.91,1479.98,1567.98,1661.22,1760.00,1864.66,1975.53,
00111 2093.00,2217.46,2349.32,2489.02,2637.02,2793.83,2959.96,3135.96,
00112 3322.44,3520.00,3729.31,3951.07,4186.01,4434.92,4698.64,4978.03,
00113 5274.04,5587.65,5919.91,6271.93,6644.88,7040.00,7458.62,7902.13,
00114 8372.02,8869.84,9397.27,9956.06,10548.08,11175.30,11839.82,12543.85,
00115 13289.75};
00116 
00117 } // stk namespace
00118 
00119 #endif
00120 
00121 

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.