From d49875c6421a4cbf69b7d0619e848dde20935449 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 14 Apr 2025 19:04:47 +0200 Subject: [PATCH] setOperatorMute --- src/minidexed.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 4d9a53c..39c792e 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -2,7 +2,7 @@ // minidexed.cpp // // MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi -// Copyright (C) 2022 The MiniDexed Team +// Copyright (C) 2022-25 The MiniDexed Team // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -2184,3 +2184,18 @@ unsigned CMiniDexed::getModController (unsigned controller, unsigned parameter, } } + +void CMiniDexed::setOperatorMute(uint8_t operatorIndex, unsigned nTG) { + if (nTG >= CConfig::AllToneGenerators || operatorIndex >= 6) { + LOGERR("Invalid tone generator or operator index: TG=%u, Operator=%u", nTG, operatorIndex); + return; + } + + // Toggle the operator mask for the specified operator + m_uchOPMask[nTG] ^= (1 << operatorIndex); + + LOGDBG("Operator %u mute toggled for TG %u. New mask: 0x%02X", operatorIndex, nTG, m_uchOPMask[nTG]); + + // Apply the updated operator mask to the tone generator + m_pTG[nTG]->SetOperatorMask(m_uchOPMask[nTG]); +}