The Synthesis ToolKit in C++ (STK)

Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

Skini.h
1#ifndef STK_SKINI_H
2#define STK_SKINI_H
3
4#include "Stk.h"
5#include <vector>
6#include <string>
7#include <fstream>
8
9namespace stk {
10
11/***************************************************/
36/***************************************************/
37
38 class Skini : public Stk
39{
40 public:
41
43 struct Message {
44 long type;
45 long channel;
46 StkFloat time;
47 std::vector<StkFloat> floatValues;
48 std::vector<long> intValues;
49 std::string remainder;
50
51 // Default constructor.
52 Message()
53 :type(0), channel(0), time(0.0), floatValues(2), intValues(2) {}
54 };
55
57 Skini();
58
60 ~Skini();
61
63
67 bool setFile( std::string fileName );
68
70
76 long nextMessage( Skini::Message& message );
77
79
83 long parseString( std::string& line, Skini::Message& message );
84
86 static std::string whatsThisType(long type);
87
89 static std::string whatsThisController(long number);
90
91 protected:
92
93 void tokenize( const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters );
94
95 std::ifstream file_;
96};
97
99static const double Midi2Pitch[129] = {
100 8.176, 8.662, 9.177, 9.723, 10.301, 10.913, 11.562, 12.25,
101 12.978, 13.75, 14.568, 15.434, 16.352, 17.324, 18.354, 19.445,
102 20.602, 21.827, 23.125, 24.50, 25.957, 27.50, 29.135, 30.868,
103 32.703, 34.648, 36.708, 38.891, 41.203, 43.654, 46.249, 49.0,
104 51.913, 55.0, 58.271, 61.735, 65.406, 69.296, 73.416, 77.782,
105 82.407, 87.307, 92.499, 97.999, 103.826, 110.0, 116.541, 123.471,
106 130.813, 138.591, 146.832, 155.563, 164.814, 174.614, 184.997, 195.998,
107 207.652, 220.0, 233.082, 246.942, 261.626, 277.183, 293.665, 311.127,
108 329.628, 349.228, 369.994, 391.995, 415.305, 440.0, 466.164, 493.883,
109 523.251, 554.365, 587.33, 622.254, 659.255, 698.456, 739.989, 783.991,
110 830.609, 880.0, 932.328, 987.767, 1046.502, 1108.731, 1174.659, 1244.508,
111 1318.51, 1396.913, 1479.978, 1567.982, 1661.219, 1760.0, 1864.655, 1975.533,
112 2093.005, 2217.461, 2349.318, 2489.016, 2637.02, 2793.826, 2959.955, 3135.963,
113 3322.438, 3520.0, 3729.31, 3951.066, 4186.009, 4434.922, 4698.636, 4978.032,
114 5274.041, 5587.652, 5919.911, 6271.927, 6644.875, 7040.0, 7458.62, 7902.133,
115 8372.018, 8869.844, 9397.273, 9956.063, 10548.082, 11175.303, 11839.822, 12543.854,
116 13289.75};
117
118} // stk namespace
119
120#endif
121
122
stk::Skini::whatsThisController
static std::string whatsThisController(long number)
Return the SKINI controller string for the given controller number.
stk::Skini::setFile
bool setFile(std::string fileName)
Set a SKINI formatted file for reading.
stk::Skini::nextMessage
long nextMessage(Skini::Message &message)
Parse the next file message (if a file is loaded) and return the message type.
stk::Skini::~Skini
~Skini()
Class destructor.
stk::Skini::parseString
long parseString(std::string &line, Skini::Message &message)
Attempt to parse the given string and returning the message type.
stk::Skini::Skini
Skini()
Default constructor.
stk::Skini::whatsThisType
static std::string whatsThisType(long type)
Return the SKINI type string for the given type value.
stk::Stk::Stk
Stk(void)
Default constructor.
stk
The STK namespace.
Definition ADSR.h:6
stk::Skini::Message
A message structure to store and pass parsed SKINI messages.
Definition Skini.h:43
stk::Skini::Message::intValues
std::vector< long > intValues
Definition Skini.h:48
stk::Skini::Message::time
StkFloat time
Definition Skini.h:46
stk::Skini::Message::type
long type
Definition Skini.h:44
stk::Skini::Message::remainder
std::string remainder
Definition Skini.h:49
stk::Skini::Message::channel
long channel
Definition Skini.h:45
stk::Skini::Message::floatValues
std::vector< StkFloat > floatValues
Definition Skini.h:47

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