You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
MiniDexed/src/performanceconfig.h

211 lines
8.3 KiB

//
// performanceconfig.h
//
// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi
// Copyright (C) 2022 The MiniDexed Team
//
// Original author of this class:
// R. Stange <rsta2@o2online.de>
//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _performanceconfig_h
#define _performanceconfig_h
#include "config.h"
#include <fatfs/ff.h>
#include <Properties/propertiesfatfsfile.h>
#define NUM_VOICE_PARAM 156
#define NUM_PERFORMANCES 128
#define NUM_PERFORMANCE_BANKS 128
class CPerformanceConfig // Performance configuration
{
public:
CPerformanceConfig (FATFS *pFileSystem);
~CPerformanceConfig (void);
bool Init (unsigned nToneGenerators);
bool Load (void);
bool Save (void);
// TG#
unsigned GetBankNumber (unsigned nTG) const; // 0 .. 127
unsigned GetVoiceNumber (unsigned nTG) const; // 0 .. 31
unsigned GetMIDIChannel (unsigned nTG) const; // 0 .. 15, omni, off
unsigned GetVolume (unsigned nTG) const; // 0 .. 127
unsigned GetPan (unsigned nTG) const; // 0 .. 127
int GetDetune (unsigned nTG) const; // -99 .. 99
unsigned GetCutoff (unsigned nTG) const; // 0 .. 99
unsigned GetResonance (unsigned nTG) const; // 0 .. 99
unsigned GetNoteLimitLow (unsigned nTG) const; // 0 .. 127
unsigned GetNoteLimitHigh (unsigned nTG) const; // 0 .. 127
int GetNoteShift (unsigned nTG) const; // -24 .. 24
unsigned GetReverbSend (unsigned nTG) const; // 0 .. 127
unsigned GetPitchBendRange (unsigned nTG) const; // 0 .. 12
unsigned GetPitchBendStep (unsigned nTG) const; // 0 .. 12
unsigned GetPortamentoMode (unsigned nTG) const; // 0 .. 1
unsigned GetPortamentoGlissando (unsigned nTG) const; // 0 .. 1
unsigned GetPortamentoTime (unsigned nTG) const; // 0 .. 99
bool GetMonoMode (unsigned nTG) const; // 0 .. 1
unsigned GetModulationWheelRange (unsigned nTG) const; // 0 .. 99
unsigned GetModulationWheelTarget (unsigned nTG) const; // 0 .. 7
unsigned GetFootControlRange (unsigned nTG) const; // 0 .. 99
unsigned GetFootControlTarget (unsigned nTG) const; // 0 .. 7
unsigned GetBreathControlRange (unsigned nTG) const; // 0 .. 99
unsigned GetBreathControlTarget (unsigned nTG) const; // 0 .. 7
unsigned GetAftertouchRange (unsigned nTG) const; // 0 .. 99
unsigned GetAftertouchTarget (unsigned nTG) const; // 0 .. 7
void SetBankNumber (unsigned nValue, unsigned nTG);
void SetVoiceNumber (unsigned nValue, unsigned nTG);
void SetMIDIChannel (unsigned nValue, unsigned nTG);
void SetVolume (unsigned nValue, unsigned nTG);
void SetPan (unsigned nValue, unsigned nTG);
void SetDetune (int nValue, unsigned nTG);
void SetCutoff (unsigned nValue, unsigned nTG);
void SetResonance (unsigned nValue, unsigned nTG);
void SetNoteLimitLow (unsigned nValue, unsigned nTG);
void SetNoteLimitHigh (unsigned nValue, unsigned nTG);
void SetNoteShift (int nValue, unsigned nTG);
void SetReverbSend (unsigned nValue, unsigned nTG);
void SetPitchBendRange (unsigned nValue, unsigned nTG);
void SetPitchBendStep (unsigned nValue, unsigned nTG);
void SetPortamentoMode (unsigned nValue, unsigned nTG);
void SetPortamentoGlissando (unsigned nValue, unsigned nTG);
void SetPortamentoTime (unsigned nValue, unsigned nTG);
void SetVoiceDataToTxt (const uint8_t *pData, unsigned nTG);
uint8_t *GetVoiceDataFromTxt (unsigned nTG);
void SetMonoMode (bool bOKValue, unsigned nTG);
void SetModulationWheelRange (unsigned nValue, unsigned nTG);
void SetModulationWheelTarget (unsigned nValue, unsigned nTG);
void SetFootControlRange (unsigned nValue, unsigned nTG);
void SetFootControlTarget (unsigned nValue, unsigned nTG);
void SetBreathControlRange (unsigned nValue, unsigned nTG);
void SetBreathControlTarget (unsigned nValue, unsigned nTG);
void SetAftertouchRange (unsigned nValue, unsigned nTG);
void SetAftertouchTarget (unsigned nValue, unsigned nTG);
// Effects
bool GetCompressorEnable (void) const;
bool GetReverbEnable (void) const;
unsigned GetReverbSize (void) const; // 0 .. 99
unsigned GetReverbHighDamp (void) const; // 0 .. 99
unsigned GetReverbLowDamp (void) const; // 0 .. 99
unsigned GetReverbLowPass (void) const; // 0 .. 99
unsigned GetReverbDiffusion (void) const; // 0 .. 99
unsigned GetReverbLevel (void) const; // 0 .. 99
void SetCompressorEnable (bool bValue);
void SetReverbEnable (bool bValue);
void SetReverbSize (unsigned nValue);
void SetReverbHighDamp (unsigned nValue);
void SetReverbLowDamp (unsigned nValue);
void SetReverbLowPass (unsigned nValue);
void SetReverbDiffusion (unsigned nValue);
void SetReverbLevel (unsigned nValue);
bool VoiceDataFilled(unsigned nTG);
bool ListPerformances();
//std::string m_DirName;
void SetNewPerformance (unsigned nID);
unsigned FindFirstPerformance (void);
std::string GetPerformanceFileName(unsigned nID);
std::string GetPerformanceFullFilePath(unsigned nID);
std::string GetPerformanceName(unsigned nID);
unsigned GetLastPerformance();
unsigned GetLastPerformanceBank();
void SetActualPerformanceID(unsigned nID);
unsigned GetActualPerformanceID();
void SetActualPerformanceBankID(unsigned nBankID);
unsigned GetActualPerformanceBankID();
bool CreateNewPerformanceFile(void);
bool GetInternalFolderOk();
std::string GetNewPerformanceDefaultName(void);
void SetNewPerformanceName(const std::string &Name);
bool DeletePerformance(unsigned nID);
bool CheckFreePerformanceSlot(void);
std::string AddPerformanceBankDirName(unsigned nBankID);
bool IsValidPerformance(unsigned nID);
bool ListPerformanceBanks(void);
void SetNewPerformanceBank(unsigned nBankID);
unsigned GetPerformanceBank(void);
std::string GetPerformanceBankName(unsigned nBankID);
bool IsValidPerformanceBank(unsigned nBankID);
private:
struct TPerf {
unsigned nBankNumber[CConfig::AllToneGenerators];
unsigned nVoiceNumber[CConfig::AllToneGenerators];
unsigned nMIDIChannel[CConfig::AllToneGenerators];
unsigned nVolume[CConfig::AllToneGenerators];
unsigned nPan[CConfig::AllToneGenerators];
int nDetune[CConfig::AllToneGenerators];
unsigned nCutoff[CConfig::AllToneGenerators];
unsigned nResonance[CConfig::AllToneGenerators];
unsigned nNoteLimitLow[CConfig::AllToneGenerators];
unsigned nNoteLimitHigh[CConfig::AllToneGenerators];
int nNoteShift[CConfig::AllToneGenerators];
int nReverbSend[CConfig::AllToneGenerators];
unsigned nPitchBendRange[CConfig::AllToneGenerators];
unsigned nPitchBendStep[CConfig::AllToneGenerators];
unsigned nPortamentoMode[CConfig::AllToneGenerators];
unsigned nPortamentoGlissando[CConfig::AllToneGenerators];
unsigned nPortamentoTime[CConfig::AllToneGenerators];
std::string nVoiceDataTxt[CConfig::AllToneGenerators];
bool bMonoMode[CConfig::AllToneGenerators];
unsigned nModulationWheelRange[CConfig::AllToneGenerators];
unsigned nModulationWheelTarget[CConfig::AllToneGenerators];
unsigned nFootControlRange[CConfig::AllToneGenerators];
unsigned nFootControlTarget[CConfig::AllToneGenerators];
unsigned nBreathControlRange[CConfig::AllToneGenerators];
unsigned nBreathControlTarget[CConfig::AllToneGenerators];
unsigned nAftertouchRange[CConfig::AllToneGenerators];
unsigned nAftertouchTarget[CConfig::AllToneGenerators];
bool bCompressorEnable;
bool bReverbEnable;
unsigned nReverbSize;
unsigned nReverbHighDamp;
unsigned nReverbLowDamp;
unsigned nReverbLowPass;
unsigned nReverbDiffusion;
unsigned nReverbLevel;
};
unsigned m_nToneGenerators;
unsigned m_nLastPerformance;
unsigned m_nActualPerformance = 0;
unsigned m_nActualPerformanceBank = 0;
unsigned m_nPerformanceBank;
unsigned m_nLastPerformanceBank;
bool m_bPerformanceDirectoryExists;
//unsigned nMenuSelectedPerformance = 0;
std::string m_PerformanceFileName[NUM_PERFORMANCES];
std::string m_PerformanceBankName[NUM_PERFORMANCE_BANKS];
FATFS *m_pFileSystem;
std::string NewPerformanceName="";
TPerf *m_pPerfBank[NUM_PERFORMANCES];
};
#endif