| 94 | class VolumeControl : public Control::Discrete |
---|
| 95 | { |
---|
| 96 | public: |
---|
| 97 | VolumeControl(FocusriteEAP* eap, std::string name, size_t offset, int bitshift) |
---|
| 98 | : Control::Discrete(eap, name) |
---|
| 99 | , m_eap(eap) |
---|
| 100 | , m_offset(offset) |
---|
| 101 | , m_bitshift(bitshift) |
---|
| 102 | { |
---|
| 103 | quadlet_t tmp; |
---|
| 104 | m_eap->readApplicationReg(m_offset, &tmp); |
---|
| 105 | m_value = - ((tmp>>m_bitshift)&0xff); |
---|
| 106 | printf("%s: %i -> %i\n", name.c_str(), tmp, m_value); |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | int getValue(int) { return getValue(); } |
---|
| 110 | bool setValue(int, int n) { return setValue(n); } |
---|
| 111 | |
---|
| 112 | int getMinimum() { return -255; } |
---|
| 113 | int getMaximum() { return 0; } |
---|
| 114 | |
---|
| 115 | int getValue() { return m_value; } |
---|
| 116 | bool setValue(int n) { |
---|
| 117 | if (n == m_value) |
---|
| 118 | return true; |
---|
| 119 | m_value = n; |
---|
| 120 | return m_eap->writeApplicationReg(m_offset, (-n)<<m_bitshift); |
---|
| 121 | } |
---|
| 122 | private: |
---|
| 123 | FocusriteEAP* m_eap; |
---|
| 124 | size_t m_offset; |
---|
| 125 | int m_bitshift; |
---|
| 126 | int m_value; |
---|
| 127 | }; |
---|
| 128 | |
---|
100 | | m_mute = new Switch(m_eap, "Mute", 0x0C, 1); |
---|
101 | | addElement(m_mute); |
---|
102 | | m_dim = new Switch(m_eap, "Dim", 0x10, 1); |
---|
103 | | addElement(m_dim); |
---|
| 136 | Control::Container* grp_globalmute = new Control::Container(m_eap, "GlobalMute"); |
---|
| 137 | addElement(grp_globalmute); |
---|
| 138 | m_mute = new Switch(m_eap, "State", 0x0C, 1); |
---|
| 139 | grp_globalmute->addElement(m_mute); |
---|
| 140 | |
---|
| 141 | Control::Container* grp_globaldim = new Control::Container(m_eap, "GlobalDim"); |
---|
| 142 | addElement(grp_globaldim); |
---|
| 143 | m_dim = new Switch(m_eap, "State", 0x10, 1); |
---|
| 144 | grp_globaldim->addElement(m_dim); |
---|
| 145 | m_dimlevel = m_eap->getDimPoti("Level"); |
---|
| 146 | grp_globaldim->addElement(m_dimlevel); |
---|
| 147 | |
---|
| 148 | Control::Container* grp_mono = new Control::Container(m_eap, "Mono"); |
---|
| 149 | addElement(grp_mono); |
---|
| 150 | |
---|
| 151 | Control::Container* grp_globalvolume = new Control::Container(m_eap, "GlobalVolume"); |
---|
| 152 | addElement(grp_globalvolume); |
---|
| 153 | m_monitorlevel = m_eap->getMonitorPoti("Level"); |
---|
| 154 | grp_globalvolume->addElement(m_monitorlevel); |
---|
| 155 | |
---|
| 156 | Control::Container* grp_perchannel = new Control::Container(m_eap, "PerChannel"); |
---|
| 157 | addElement(grp_perchannel); |
---|
| 158 | |
---|
120 | | addElement(s); |
---|
121 | | m_mono.push_back(s); |
---|
122 | | } |
---|
123 | | m_monitorlevel = m_eap->getMonitorPoti("MonitorLevel"); |
---|
124 | | addElement(m_monitorlevel); |
---|
125 | | m_dimlevel = m_eap->getDimPoti("DimLevel"); |
---|
126 | | addElement(m_dimlevel); |
---|
| 173 | grp_mono->addElement(s); |
---|
| 174 | //m_mono.push_back(s); |
---|
| 175 | |
---|
| 176 | stream.str(std::string()); |
---|
| 177 | stream << "AffectsCh" << i*2; |
---|
| 178 | s = new Switch(m_eap, stream.str(), 0x28+i*4, 1); |
---|
| 179 | grp_globalvolume->addElement(s); |
---|
| 180 | stream.str(std::string()); |
---|
| 181 | stream << "AffectsCh" << i*2+1; |
---|
| 182 | s = new Switch(m_eap, stream.str(), 0x28+i*4, 2); |
---|
| 183 | grp_globalvolume->addElement(s); |
---|
| 184 | |
---|
| 185 | stream.str(std::string()); |
---|
| 186 | stream << "Mute" << i*2; |
---|
| 187 | s = new Switch(m_eap, stream.str(), 0x28+i*4, 4); |
---|
| 188 | grp_perchannel->addElement(s); |
---|
| 189 | stream.str(std::string()); |
---|
| 190 | stream << "Mute" << i*2+1; |
---|
| 191 | s = new Switch(m_eap, stream.str(), 0x28+i*4, 8); |
---|
| 192 | grp_perchannel->addElement(s); |
---|
| 193 | |
---|
| 194 | stream.str(std::string()); |
---|
| 195 | stream << "Volume" << i*2; |
---|
| 196 | VolumeControl* vol = new VolumeControl(m_eap, stream.str(), 0x14+i*4, 0); |
---|
| 197 | grp_perchannel->addElement(vol); |
---|
| 198 | stream.str(std::string()); |
---|
| 199 | stream << "Volume" << i*2+1; |
---|
| 200 | vol = new VolumeControl(m_eap, stream.str(), 0x14+i*4, 8); |
---|
| 201 | grp_perchannel->addElement(vol); |
---|
| 202 | } |
---|