| 1 |
/* |
| 2 |
* Copyright (C) 2018-2022 Rerrah |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person |
| 5 |
* obtaining a copy of this software and associated documentation |
| 6 |
* files (the "Software"), to deal in the Software without |
| 7 |
* restriction, including without limitation the rights to use, |
| 8 |
* copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 |
* copies of the Software, and to permit persons to whom the |
| 10 |
* Software is furnished to do so, subject to the following |
| 11 |
* conditions: |
| 12 |
* |
| 13 |
* The above copyright notice and this permission notice shall be |
| 14 |
* included in all copies or substantial portions of the Software. |
| 15 |
* |
| 16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 18 |
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 20 |
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 21 |
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 23 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 24 |
*/ |
| 25 |
|
| 26 |
#include "instrument_editor_manager.hpp" |
| 27 |
#include <utility> |
| 28 |
#include <stdexcept> |
| 29 |
#include <QApplication> |
| 30 |
#include "instrument.hpp" |
| 31 |
#include "gui/instrument_editor/fm_instrument_editor.hpp" |
| 32 |
#include "gui/instrument_editor/ssg_instrument_editor.hpp" |
| 33 |
#include "gui/instrument_editor/adpcm_instrument_editor.hpp" |
| 34 |
#include "gui/instrument_editor/adpcm_drumkit_editor.hpp" |
| 35 |
|
| 36 |
InstrumentEditorManager::InstrumentEditorManager() |
| 37 |
: typeIndices_ { |
| 38 |
{ InstrumentType::FM, {} }, |
| 39 |
{ InstrumentType::SSG, {} }, |
| 40 |
{ InstrumentType::ADPCM, {} }, |
| 41 |
{ InstrumentType::Drumkit, {} }, |
| 42 |
} |
| 43 |
{ |
| 44 |
} |
| 45 |
|
| 46 |
InstrumentEditorManager::~InstrumentEditorManager() |
| 47 |
{ |
| 48 |
removeAll(); |
| 49 |
} |
| 50 |
|
| 51 |
void InstrumentEditorManager::updateByConfiguration() |
| 52 |
{ |
| 53 |
const auto& cTypeIdcs = typeIndices_; |
| 54 |
for (const auto& idcs : cTypeIdcs) { |
| 55 |
for (auto idx : idcs) { |
| 56 |
if (auto& editor = editors_[idx]) editor->updateByConfigurationChange(); |
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
bool InstrumentEditorManager::add(int index, InstrumentEditor* editor) |
| 62 |
{ |
| 63 |
if (!assertIndex(index)) return false; |
| 64 |
|
| 65 |
typeIndices_[editor->getInstrumentType()].insert(index); |
| 66 |
editors_[index] = editor; |
| 67 |
// Editor is deleted automatically in closed. |
| 68 |
editor->setAttribute(Qt::WA_DeleteOnClose); |
| 69 |
|
| 70 |
// Parameter numbers update in MainWindow |
| 71 |
|
| 72 |
return true; |
| 73 |
} |
| 74 |
|
| 75 |
void InstrumentEditorManager::swap(int index1, int index2) |
| 76 |
{ |
| 77 |
if (!assertIndex(index1) || !assertIndex(index2)) return; |
| 78 |
|
| 79 |
if (editors_[index1]) { |
| 80 |
InstrumentType typeA = editors_[index1]->getInstrumentType(); |
| 81 |
typeIndices_[typeA].remove(index1); |
| 82 |
if (editors_[index2]) { |
| 83 |
InstrumentType typeB = editors_[index2]->getInstrumentType(); |
| 84 |
typeIndices_[typeB].remove(index2); |
| 85 |
std::swap(editors_[index1], editors_[index2]); |
| 86 |
editors_[index1]->setInstrumentNumber(index1); |
| 87 |
typeIndices_[typeB].insert(index1); |
| 88 |
} |
| 89 |
else { |
| 90 |
editors_[index2] = editors_[index1]; |
| 91 |
editors_[index1] = nullptr; |
| 92 |
} |
| 93 |
editors_[index2]->setInstrumentNumber(index2); |
| 94 |
typeIndices_[typeA].insert(index2); |
| 95 |
} |
| 96 |
else { |
| 97 |
if (editors_[index2]) { |
| 98 |
InstrumentType typeB = editors_[index2]->getInstrumentType(); |
| 99 |
typeIndices_[typeB].remove(index2); |
| 100 |
editors_[index1] = editors_[index2]; |
| 101 |
editors_[index2] = nullptr; |
| 102 |
editors_[index1]->setInstrumentNumber(index1); |
| 103 |
typeIndices_[typeB].insert(index1); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
onInstrumentFMEnvelopeNumberChanged(); |
| 108 |
onInstrumentFMLFONumberChanged(); |
| 109 |
onInstrumentFMOperatorSequenceNumberChanged(); |
| 110 |
onInstrumentFMArpeggioNumberChanged(); |
| 111 |
onInstrumentFMPitchNumberChanged(); |
| 112 |
|
| 113 |
onInstrumentSSGWaveformNumberChanged(); |
| 114 |
onInstrumentSSGEnvelopeNumberChanged(); |
| 115 |
onInstrumentSSGToneNoiseNumberChanged(); |
| 116 |
onInstrumentSSGArpeggioNumberChanged(); |
| 117 |
onInstrumentSSGPitchNumberChanged(); |
| 118 |
|
| 119 |
onInstrumentADPCMSampleNumberChanged(); |
| 120 |
onInstrumentADPCMEnvelopeNumberChanged(); |
| 121 |
onInstrumentADPCMArpeggioNumberChanged(); |
| 122 |
onInstrumentADPCMPitchNumberChanged(); |
| 123 |
|
| 124 |
onInstrumentADPCMSampleNumberChanged(); |
| 125 |
} |
| 126 |
|
| 127 |
bool InstrumentEditorManager::remove(int index) |
| 128 |
{ |
| 129 |
if (!assertIndex(index)) return false; |
| 130 |
|
| 131 |
if (editors_[index]) { |
| 132 |
editors_[index]->close(); |
| 133 |
} |
| 134 |
|
| 135 |
onInstrumentFMEnvelopeNumberChanged(); |
| 136 |
onInstrumentFMLFONumberChanged(); |
| 137 |
onInstrumentFMOperatorSequenceNumberChanged(); |
| 138 |
onInstrumentFMArpeggioNumberChanged(); |
| 139 |
onInstrumentFMPitchNumberChanged(); |
| 140 |
|
| 141 |
onInstrumentSSGWaveformNumberChanged(); |
| 142 |
onInstrumentSSGEnvelopeNumberChanged(); |
| 143 |
onInstrumentSSGToneNoiseNumberChanged(); |
| 144 |
onInstrumentSSGArpeggioNumberChanged(); |
| 145 |
onInstrumentSSGPitchNumberChanged(); |
| 146 |
|
| 147 |
onInstrumentADPCMSampleNumberChanged(); |
| 148 |
onInstrumentADPCMEnvelopeNumberChanged(); |
| 149 |
onInstrumentADPCMArpeggioNumberChanged(); |
| 150 |
onInstrumentADPCMPitchNumberChanged(); |
| 151 |
|
| 152 |
onInstrumentADPCMSampleNumberChanged(); |
| 153 |
|
| 154 |
return true; |
| 155 |
} |
| 156 |
|
| 157 |
void InstrumentEditorManager::showEditor(int index) |
| 158 |
{ |
| 159 |
if (!assertIndex(index)) return; |
| 160 |
|
| 161 |
auto& editor = editors_[index]; |
| 162 |
if (!editor) return; |
| 163 |
|
| 164 |
if (editor->isVisible()) { |
| 165 |
editor->activateWindow(); |
| 166 |
} |
| 167 |
else { |
| 168 |
editor->show(); |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
void InstrumentEditorManager::removeAll() |
| 173 |
{ |
| 174 |
for (const auto& editor : editors_) { |
| 175 |
if (!editor) continue; |
| 176 |
if (!editor->close()) delete editor.data(); |
| 177 |
} |
| 178 |
} |
| 179 |
|
| 180 |
bool InstrumentEditorManager::hasShownEditor(int index) const |
| 181 |
{ |
| 182 |
return (assertIndex(index) && !editors_[index].isNull()); |
| 183 |
} |
| 184 |
|
| 185 |
int InstrumentEditorManager::getActivatedEditorIndex() const |
| 186 |
{ |
| 187 |
const QWidget* win = QApplication::activeWindow(); |
| 188 |
const auto& cTypeIdcs = typeIndices_; |
| 189 |
for (const auto& idcs : cTypeIdcs) { |
| 190 |
for (auto idx : idcs) { |
| 191 |
if (editors_[idx] == win) return idx; |
| 192 |
} |
| 193 |
} |
| 194 |
return -1; |
| 195 |
} |
| 196 |
|
| 197 |
/********** Slots **********/ |
| 198 |
void InstrumentEditorManager::onInstrumentNameChanged(int instNum) |
| 199 |
{ |
| 200 |
if (!assertIndex(instNum)) return; |
| 201 |
if (auto& editor = editors_[instNum]) |
| 202 |
{ |
| 203 |
editor->updateWindowTitle(); |
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
void InstrumentEditorManager::onInstrumentFMEnvelopeParameterChanged(int envNum, int fromInstNum) |
| 208 |
{ |
| 209 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM, fromInstNum); |
| 210 |
for (auto idx : idcs) { |
| 211 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 212 |
editor->onEnvelopeParameterChanged(envNum); |
| 213 |
} |
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
void InstrumentEditorManager::onInstrumentFMEnvelopeNumberChanged() |
| 218 |
{ |
| 219 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM); |
| 220 |
for (auto idx : idcs) { |
| 221 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 222 |
editor->onEnvelopeNumberChanged(); |
| 223 |
} |
| 224 |
} |
| 225 |
} |
| 226 |
|
| 227 |
void InstrumentEditorManager::onInstrumentFMLFOParameterChanged(int lfoNum, int fromInstNum) |
| 228 |
{ |
| 229 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM, fromInstNum); |
| 230 |
for (auto idx : idcs) { |
| 231 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 232 |
editor->onLFOParameterChanged(lfoNum); |
| 233 |
} |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
void InstrumentEditorManager::onInstrumentFMLFONumberChanged() |
| 238 |
{ |
| 239 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM); |
| 240 |
for (auto idx : idcs) { |
| 241 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 242 |
editor->onLFONumberChanged(); |
| 243 |
} |
| 244 |
} |
| 245 |
} |
| 246 |
|
| 247 |
void InstrumentEditorManager::onInstrumentFMOperatorSequenceParameterChanged(FMEnvelopeParameter param, int opSeqNum, int fromInstNum) |
| 248 |
{ |
| 249 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM, fromInstNum); |
| 250 |
for (auto idx : idcs) { |
| 251 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 252 |
editor->onOperatorSequenceParameterChanged(param, opSeqNum); |
| 253 |
} |
| 254 |
} |
| 255 |
} |
| 256 |
|
| 257 |
void InstrumentEditorManager::onInstrumentFMOperatorSequenceNumberChanged() |
| 258 |
{ |
| 259 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM); |
| 260 |
for (auto idx : idcs) { |
| 261 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 262 |
editor->onOperatorSequenceNumberChanged(); |
| 263 |
} |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
void InstrumentEditorManager::onInstrumentFMArpeggioParameterChanged(int arpNum, int fromInstNum) |
| 268 |
{ |
| 269 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM, fromInstNum); |
| 270 |
for (auto idx : idcs) { |
| 271 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 272 |
editor->onArpeggioParameterChanged(arpNum); |
| 273 |
} |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
void InstrumentEditorManager::onInstrumentFMArpeggioNumberChanged() |
| 278 |
{ |
| 279 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM); |
| 280 |
for (auto idx : idcs) { |
| 281 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 282 |
editor->onArpeggioNumberChanged(); |
| 283 |
} |
| 284 |
} |
| 285 |
} |
| 286 |
|
| 287 |
void InstrumentEditorManager::onInstrumentFMPitchParameterChanged(int ptNum, int fromInstNum) |
| 288 |
{ |
| 289 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM, fromInstNum); |
| 290 |
for (auto idx : idcs) { |
| 291 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 292 |
editor->onPitchParameterChanged(ptNum); |
| 293 |
} |
| 294 |
} |
| 295 |
} |
| 296 |
|
| 297 |
void InstrumentEditorManager::onInstrumentFMPitchNumberChanged() |
| 298 |
{ |
| 299 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::FM); |
| 300 |
for (auto idx : idcs) { |
| 301 |
if (auto editor = qobject_cast<FmInstrumentEditor*>(editors_[idx])) { |
| 302 |
editor->onPitchNumberChanged(); |
| 303 |
} |
| 304 |
} |
| 305 |
} |
| 306 |
|
| 307 |
void InstrumentEditorManager::onInstrumentSSGWaveformParameterChanged(int wfNum, int fromInstNum) |
| 308 |
{ |
| 309 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG, fromInstNum); |
| 310 |
for (auto idx : idcs) { |
| 311 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 312 |
editor->onWaveformParameterChanged(wfNum); |
| 313 |
} |
| 314 |
} |
| 315 |
} |
| 316 |
|
| 317 |
void InstrumentEditorManager::onInstrumentSSGWaveformNumberChanged() |
| 318 |
{ |
| 319 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG); |
| 320 |
for (auto idx : idcs) { |
| 321 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 322 |
editor->onWaveformNumberChanged(); |
| 323 |
} |
| 324 |
} |
| 325 |
} |
| 326 |
|
| 327 |
void InstrumentEditorManager::onInstrumentSSGToneNoiseParameterChanged(int tnNum, int fromInstNum) |
| 328 |
{ |
| 329 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG, fromInstNum); |
| 330 |
for (auto idx : idcs) { |
| 331 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 332 |
editor->onToneNoiseParameterChanged(tnNum); |
| 333 |
} |
| 334 |
} |
| 335 |
} |
| 336 |
|
| 337 |
void InstrumentEditorManager::onInstrumentSSGToneNoiseNumberChanged() |
| 338 |
{ |
| 339 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG); |
| 340 |
for (auto idx : idcs) { |
| 341 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 342 |
editor->onToneNoiseNumberChanged(); |
| 343 |
} |
| 344 |
} |
| 345 |
} |
| 346 |
|
| 347 |
void InstrumentEditorManager::onInstrumentSSGEnvelopeParameterChanged(int envNum, int fromInstNum) |
| 348 |
{ |
| 349 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG, fromInstNum); |
| 350 |
for (auto idx : idcs) { |
| 351 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 352 |
editor->onEnvelopeParameterChanged(envNum); |
| 353 |
} |
| 354 |
} |
| 355 |
} |
| 356 |
|
| 357 |
void InstrumentEditorManager::onInstrumentSSGEnvelopeNumberChanged() |
| 358 |
{ |
| 359 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG); |
| 360 |
for (auto idx : idcs) { |
| 361 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 362 |
editor->onEnvelopeNumberChanged(); |
| 363 |
} |
| 364 |
} |
| 365 |
} |
| 366 |
|
| 367 |
void InstrumentEditorManager::onInstrumentSSGArpeggioParameterChanged(int arpNum, int fromInstNum) |
| 368 |
{ |
| 369 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG, fromInstNum); |
| 370 |
for (auto idx : idcs) { |
| 371 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 372 |
editor->onArpeggioParameterChanged(arpNum); |
| 373 |
} |
| 374 |
} |
| 375 |
} |
| 376 |
|
| 377 |
void InstrumentEditorManager::onInstrumentSSGArpeggioNumberChanged() |
| 378 |
{ |
| 379 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG); |
| 380 |
for (auto idx : idcs) { |
| 381 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 382 |
editor->onArpeggioNumberChanged(); |
| 383 |
} |
| 384 |
} |
| 385 |
} |
| 386 |
|
| 387 |
void InstrumentEditorManager::onInstrumentSSGPitchParameterChanged(int ptNum, int fromInstNum) |
| 388 |
{ |
| 389 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG, fromInstNum); |
| 390 |
for (auto idx : idcs) { |
| 391 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 392 |
editor->onPitchParameterChanged(ptNum); |
| 393 |
} |
| 394 |
} |
| 395 |
} |
| 396 |
|
| 397 |
void InstrumentEditorManager::onInstrumentSSGPitchNumberChanged() |
| 398 |
{ |
| 399 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::SSG); |
| 400 |
for (auto idx : idcs) { |
| 401 |
if (auto editor = qobject_cast<SsgInstrumentEditor*>(editors_[idx])) { |
| 402 |
editor->onPitchNumberChanged(); |
| 403 |
} |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
void InstrumentEditorManager::onInstrumentADPCMSampleParameterChanged(int sampNum, int fromInstNum) |
| 408 |
{ |
| 409 |
Q_UNUSED(fromInstNum) // Update all adpcm editor to change sample memory viewer and sample viewer |
| 410 |
|
| 411 |
const auto idcsAdpcm = getIndicesForParameterUpdating(InstrumentType::ADPCM); |
| 412 |
for (auto idx : idcsAdpcm) { |
| 413 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 414 |
editor->onSampleParameterChanged(sampNum); |
| 415 |
} |
| 416 |
} |
| 417 |
|
| 418 |
const auto idcsKit = getIndicesForParameterUpdating(InstrumentType::Drumkit); |
| 419 |
for (auto idx : idcsKit) { |
| 420 |
if (auto editor = qobject_cast<AdpcmDrumkitEditor*>(editors_[idx])) { |
| 421 |
editor->onSampleParameterChanged(sampNum); |
| 422 |
} |
| 423 |
} |
| 424 |
} |
| 425 |
|
| 426 |
void InstrumentEditorManager::onInstrumentADPCMSampleNumberChanged() |
| 427 |
{ |
| 428 |
const auto idcsAdpcm = getIndicesForParameterUpdating(InstrumentType::ADPCM); |
| 429 |
for (auto idx : idcsAdpcm) { |
| 430 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 431 |
editor->onSampleNumberChanged(); |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
const auto idcsKit = getIndicesForParameterUpdating(InstrumentType::Drumkit); |
| 436 |
for (auto idx : idcsKit) { |
| 437 |
if (auto editor = qobject_cast<AdpcmDrumkitEditor*>(editors_[idx])) { |
| 438 |
editor->onSampleNumberChanged(); |
| 439 |
} |
| 440 |
} |
| 441 |
} |
| 442 |
|
| 443 |
void InstrumentEditorManager::onInstrumentADPCMSampleMemoryUpdated() |
| 444 |
{ |
| 445 |
const auto idcsAdpcm = getIndicesForParameterUpdating(InstrumentType::ADPCM); |
| 446 |
for (auto idx : idcsAdpcm) { |
| 447 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 448 |
editor->onSampleMemoryUpdated(); |
| 449 |
} |
| 450 |
} |
| 451 |
|
| 452 |
const auto idcsKit = getIndicesForParameterUpdating(InstrumentType::Drumkit); |
| 453 |
for (auto idx : idcsKit) { |
| 454 |
if (auto editor = qobject_cast<AdpcmDrumkitEditor*>(editors_[idx])) { |
| 455 |
editor->onSampleMemoryUpdated(); |
| 456 |
} |
| 457 |
} |
| 458 |
} |
| 459 |
|
| 460 |
void InstrumentEditorManager::onInstrumentADPCMEnvelopeParameterChanged(int envNum, int fromInstNum) |
| 461 |
{ |
| 462 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::ADPCM, fromInstNum); |
| 463 |
for (auto idx : idcs) { |
| 464 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 465 |
editor->onEnvelopeParameterChanged(envNum); |
| 466 |
} |
| 467 |
} |
| 468 |
} |
| 469 |
|
| 470 |
void InstrumentEditorManager::onInstrumentADPCMEnvelopeNumberChanged() |
| 471 |
{ |
| 472 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::ADPCM); |
| 473 |
for (auto idx : idcs) { |
| 474 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 475 |
editor->onEnvelopeNumberChanged(); |
| 476 |
} |
| 477 |
} |
| 478 |
} |
| 479 |
|
| 480 |
void InstrumentEditorManager::onInstrumentADPCMArpeggioParameterChanged(int arpNum, int fromInstNum) |
| 481 |
{ |
| 482 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::ADPCM, fromInstNum); |
| 483 |
for (auto idx : idcs) { |
| 484 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 485 |
editor->onArpeggioParameterChanged(arpNum); |
| 486 |
} |
| 487 |
} |
| 488 |
} |
| 489 |
|
| 490 |
void InstrumentEditorManager::onInstrumentADPCMArpeggioNumberChanged() |
| 491 |
{ |
| 492 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::ADPCM); |
| 493 |
for (auto idx : idcs) { |
| 494 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 495 |
editor->onArpeggioNumberChanged(); |
| 496 |
} |
| 497 |
} |
| 498 |
} |
| 499 |
|
| 500 |
void InstrumentEditorManager::onInstrumentADPCMPitchParameterChanged(int ptNum, int fromInstNum) |
| 501 |
{ |
| 502 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::ADPCM, fromInstNum); |
| 503 |
for (auto idx : idcs) { |
| 504 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 505 |
editor->onPitchParameterChanged(ptNum); |
| 506 |
} |
| 507 |
} |
| 508 |
} |
| 509 |
|
| 510 |
void InstrumentEditorManager::onInstrumentADPCMPitchNumberChanged() |
| 511 |
{ |
| 512 |
const auto idcs = getIndicesForParameterUpdating(InstrumentType::ADPCM); |
| 513 |
for (auto idx : idcs) { |
| 514 |
if (auto editor = qobject_cast<AdpcmInstrumentEditor*>(editors_[idx])) { |
| 515 |
editor->onPitchNumberChanged(); |
| 516 |
} |
| 517 |
} |
| 518 |
} |