To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / CollidoscopeApp / include / Config.h @ 0:02467299402e

History | View | Annotate | Download (2.19 KB)

1 0:02467299402e f
#pragma once
2
3
#include <string>
4
#include <array>
5
#include "cinder/Color.h"
6
#include "cinder/Xml.h"
7
8
9
class Config
10
{
11
public:
12
13
    Config();
14
15
    // no copies
16
    Config( const Config &copy ) = delete;
17
    Config & operator=(const Config &copy) = delete;
18
19
    /* load values for internal field from configuration file. Throws ci::Exception */
20
    void loadFromFile( std::string&& path );
21
22
    std::string getInputDeviceKey() const
23
    {
24
        return mAudioInputDeviceKey;  // Komplete 1/2
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
    }
28
29
    std::size_t getNumChunks() const
30
    {
31
        return mNumChunks;
32
    }
33
34
    /* return wave lenght in seconds */
35
    double getWaveLen() const
36
    {
37
        return mWaveLen;
38
    }
39
40
    ci::Color getWaveSelectionColor(size_t waveIdx) const
41
    {
42
        if (waveIdx == 0){
43
            return cinder::Color(243.0f / 255.0f, 6.0f / 255.0f, 62.0f / 255.0f);
44
        }
45
        else{
46
            return cinder::Color(255.0f / 255.0f, 204.0f / 255.0f, 0.0f / 255.0f);
47
        }
48
    }
49
50
    std::size_t getCursorTriggerMessageBufSize() const
51
    {
52
        return 512;
53
    }
54
55
    // returns the index of the wave associated to the MIDI channel passed as argument
56
    size_t getWaveForMIDIChannel( unsigned char channelIdx )
57
    {
58
        return channelIdx;
59
        /*for ( int i = 0; i < NUM_WAVES; i++ ){
60
            if ( channelIdx == mMidiChannels[i] )
61
                return i;
62
        }*/
63
    }
64
65
    double getMaxGrainDurationCoeff() const
66
    {
67
        return 8.0;
68
    }
69
70
    double getMaxFilterCutoffFreq() const
71
    {
72
        return 22050.;
73
    }
74
75
    double getMinFilterCutoffFreq() const
76
    {
77
        return 200.;
78
    }
79
80
    size_t getMaxKeyboardVoices() const
81
    {
82
        return 6;
83
    }
84
85
    size_t getMaxSelectionNumChunks() const
86
    {
87
        return 37;
88
    }
89
90
    size_t getOscilloscopeNumPointsDivider() const
91
    {
92
        return 4;
93
    }
94
95
private:
96
97
    void parseWave( const ci::XmlTree &wave, int id );
98
99
    std::string mAudioInputDeviceKey;
100
    std::size_t mNumChunks;
101
    double mWaveLen;
102
    std::array< size_t, NUM_WAVES > mMidiChannels;
103
104
};