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 
00099 static const double Midi2Pitch[129] = {
00100   8.176, 8.662, 9.177, 9.723, 10.301, 10.913, 11.562, 12.25,
00101   12.978, 13.75, 14.568, 15.434, 16.352, 17.324, 18.354, 19.445,
00102   20.602, 21.827, 23.125, 24.50, 25.957, 27.50, 29.135, 30.868,
00103   32.703, 34.648, 36.708, 38.891, 41.203, 43.654, 46.249, 49.0,
00104   51.913, 55.0, 58.271, 61.735, 65.406, 69.296, 73.416, 77.782,
00105   82.407, 87.307, 92.499, 97.999, 103.826, 110.0, 116.541, 123.471,
00106   130.813, 138.591, 146.832, 155.563, 164.814, 174.614, 184.997, 195.998,
00107   207.652, 220.0, 233.082, 246.942, 261.626, 277.183, 293.665, 311.127,
00108   329.628, 349.228, 369.994, 391.995, 415.305, 440.0, 466.164, 493.883,
00109   523.251, 554.365, 587.33, 622.254, 659.255, 698.456, 739.989, 783.991,
00110   830.609, 880.0, 932.328, 987.767, 1046.502, 1108.731, 1174.659, 1244.508,
00111   1318.51, 1396.913, 1479.978, 1567.982, 1661.219, 1760.0, 1864.655, 1975.533,
00112   2093.005, 2217.461, 2349.318, 2489.016, 2637.02, 2793.826, 2959.955, 3135.963,
00113   3322.438, 3520.0, 3729.31, 3951.066, 4186.009, 4434.922, 4698.636, 4978.032,
00114   5274.041, 5587.652, 5919.911, 6271.927, 6644.875, 7040.0, 7458.62, 7902.133,
00115   8372.018, 8869.844, 9397.273, 9956.063, 10548.082, 11175.303, 11839.822, 12543.854,
00116   13289.75};
00117 
00118 } // stk namespace
00119 
00120 #endif
00121 
00122 

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