comparison CollidoscopeApp/include/Config.h @ 2:dd889fff8423

added some comments
author Fiore Martin <f.martin@qmul.ac.uk>
date Mon, 11 Jul 2016 17:03:40 +0200
parents 02467299402e
children 75b744078d66
comparison
equal deleted inserted replaced
1:b5bcad8e7803 2:dd889fff8423
4 #include <array> 4 #include <array>
5 #include "cinder/Color.h" 5 #include "cinder/Color.h"
6 #include "cinder/Xml.h" 6 #include "cinder/Xml.h"
7 7
8 8
9 /**
10 * Configuration class gathers in one place all the values recided at runtime
11 *
12 * Reading the configuration from an XML file is partially implemented but not used at the moment
13 *
14 */
9 class Config 15 class Config
10 { 16 {
11 public: 17 public:
12 18
13 Config(); 19 Config();
19 /* load values for internal field from configuration file. Throws ci::Exception */ 25 /* load values for internal field from configuration file. Throws ci::Exception */
20 void loadFromFile( std::string&& path ); 26 void loadFromFile( std::string&& path );
21 27
22 std::string getInputDeviceKey() const 28 std::string getInputDeviceKey() const
23 { 29 {
24 return mAudioInputDeviceKey; // Komplete 1/2 30 return mAudioInputDeviceKey;
25 //return "{0.0.1.00000000}.{a043bc8c-1dd1-4c94-82b4-ad8320cac5a5}"; // Komplete 3/4
26 //return "{0.0.1.00000000}.{828b681b-cc0c-44e1-93c9-5f1f46f5926f}"; // Realtek
27 } 31 }
28 32
33 /**
34 * Returns number of chunks in a wave
35 */
29 std::size_t getNumChunks() const 36 std::size_t getNumChunks() const
30 { 37 {
31 return mNumChunks; 38 return mNumChunks;
32 } 39 }
33 40
34 /* return wave lenght in seconds */ 41 /** returns wave lenght in seconds */
35 double getWaveLen() const 42 double getWaveLen() const
36 { 43 {
37 return mWaveLen; 44 return mWaveLen;
38 } 45 }
39 46
47 /**
48 * Returns wave's selection color
49 */
40 ci::Color getWaveSelectionColor(size_t waveIdx) const 50 ci::Color getWaveSelectionColor(size_t waveIdx) const
41 { 51 {
42 if (waveIdx == 0){ 52 if (waveIdx == 0){
43 return cinder::Color(243.0f / 255.0f, 6.0f / 255.0f, 62.0f / 255.0f); 53 return cinder::Color(243.0f / 255.0f, 6.0f / 255.0f, 62.0f / 255.0f);
44 } 54 }
45 else{ 55 else{
46 return cinder::Color(255.0f / 255.0f, 204.0f / 255.0f, 0.0f / 255.0f); 56 return cinder::Color(255.0f / 255.0f, 204.0f / 255.0f, 0.0f / 255.0f);
47 } 57 }
48 } 58 }
49 59
60 /**
61 * The size of the ring buffer used to trigger a visual cursor from the audio thread when a new grain is created
62 */
50 std::size_t getCursorTriggerMessageBufSize() const 63 std::size_t getCursorTriggerMessageBufSize() const
51 { 64 {
52 return 512; 65 return 512;
53 } 66 }
54 67
55 // returns the index of the wave associated to the MIDI channel passed as argument 68 /** returns the index of the wave associated to the MIDI channel passed as argument */
56 size_t getWaveForMIDIChannel( unsigned char channelIdx ) 69 size_t getWaveForMIDIChannel( unsigned char channelIdx )
57 { 70 {
58 return channelIdx; 71 return channelIdx;
59 /*for ( int i = 0; i < NUM_WAVES; i++ ){
60 if ( channelIdx == mMidiChannels[i] )
61 return i;
62 }*/
63 } 72 }
64 73
65 double getMaxGrainDurationCoeff() const 74 double getMaxGrainDurationCoeff() const
66 { 75 {
67 return 8.0; 76 return 8.0;
80 size_t getMaxKeyboardVoices() const 89 size_t getMaxKeyboardVoices() const
81 { 90 {
82 return 6; 91 return 6;
83 } 92 }
84 93
94 /**
95 * Returns the maximum size of a wave selection in number of chunks.
96 */
85 size_t getMaxSelectionNumChunks() const 97 size_t getMaxSelectionNumChunks() const
86 { 98 {
87 return 37; 99 return 37;
88 } 100 }
89 101
102 /**
103 * The value returned is used when creating the oscilloscope.
104 * The oscilloscope represents the audio output buffer graphically. However it doesn't need to be as refined as the
105 * audio wave and it's downsampled using the following formula : number of oscilloscope points = size o audio output buffer / getOscilloscopeNumPointsDivider()
106 */
90 size_t getOscilloscopeNumPointsDivider() const 107 size_t getOscilloscopeNumPointsDivider() const
91 { 108 {
92 return 4; 109 return 4;
93 } 110 }
94 111