|
|
|
//
|
|
|
|
// config.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 _config_h
|
|
|
|
#define _config_h
|
|
|
|
|
|
|
|
#include <fatfs/ff.h>
|
|
|
|
#include <Properties/propertiesfatfsfile.h>
|
|
|
|
#include <circle/sysconfig.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class CConfig // Configuration for MiniDexed
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
#ifndef ARM_ALLOW_MULTI_CORE
|
|
|
|
static const unsigned ToneGenerators = 1;
|
|
|
|
#else
|
|
|
|
static const unsigned TGsCore1 = 2; // process 2 TGs on core 1
|
|
|
|
static const unsigned TGsCore23 = 3; // process 3 TGs on core 2 and 3 each
|
|
|
|
static const unsigned ToneGenerators = TGsCore1 + 2*TGsCore23;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if RASPPI == 1
|
|
|
|
static const unsigned MaxNotes = 8; // polyphony
|
|
|
|
#else
|
|
|
|
static const unsigned MaxNotes = 16;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const unsigned MaxChunkSize = 4096;
|
|
|
|
|
|
|
|
#if RASPPI <= 3
|
|
|
|
static const unsigned MaxUSBMIDIDevices = 2;
|
|
|
|
#else
|
|
|
|
static const unsigned MaxUSBMIDIDevices = 4;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const unsigned LCDColumns = 16; // HD44780 LCD
|
|
|
|
static const unsigned LCDRows = 2;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CConfig (FATFS *pFileSystem);
|
|
|
|
~CConfig (void);
|
|
|
|
|
|
|
|
void Load (void);
|
|
|
|
|
|
|
|
// Sound device
|
|
|
|
const char *GetSoundDevice (void) const;
|
|
|
|
unsigned GetSampleRate (void) const;
|
|
|
|
unsigned GetChunkSize (void) const;
|
|
|
|
unsigned GetDACI2CAddress (void) const; // 0 for auto probing
|
|
|
|
bool GetChannelsSwapped (void) const;
|
|
|
|
|
|
|
|
// MIDI
|
|
|
|
unsigned GetMIDIBaudRate (void) const;
|
|
|
|
const char *GetMIDIThruIn (void) const; // "" if not specified
|
|
|
|
const char *GetMIDIThruOut (void) const; // "" if not specified
|
|
|
|
|
|
|
|
// HD44780 LCD
|
|
|
|
// GPIO pin numbers are chip numbers, not header positions
|
|
|
|
bool GetLCDEnabled (void) const;
|
|
|
|
unsigned GetLCDPinEnable (void) const;
|
|
|
|
unsigned GetLCDPinRegisterSelect (void) const;
|
|
|
|
unsigned GetLCDPinReadWrite (void) const; // set to 0 if not connected
|
|
|
|
unsigned GetLCDPinData4 (void) const;
|
|
|
|
unsigned GetLCDPinData5 (void) const;
|
|
|
|
unsigned GetLCDPinData6 (void) const;
|
|
|
|
unsigned GetLCDPinData7 (void) const;
|
|
|
|
|
|
|
|
// KY-040 Rotary Encoder
|
|
|
|
// GPIO pin numbers are chip numbers, not header positions
|
|
|
|
bool GetEncoderEnabled (void) const;
|
|
|
|
unsigned GetEncoderPinClock (void) const;
|
|
|
|
unsigned GetEncoderPinData (void) const;
|
|
|
|
unsigned GetEncoderPinSwitch (void) const;
|
|
|
|
|
|
|
|
// Debug
|
|
|
|
bool GetMIDIDumpEnabled (void) const;
|
|
|
|
bool GetProfileEnabled (void) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CPropertiesFatFsFile m_Properties;
|
|
|
|
|
|
|
|
std::string m_SoundDevice;
|
|
|
|
unsigned m_nSampleRate;
|
|
|
|
unsigned m_nChunkSize;
|
|
|
|
unsigned m_nDACI2CAddress;
|
|
|
|
bool m_bChannelsSwapped;
|
|
|
|
|
|
|
|
unsigned m_nMIDIBaudRate;
|
|
|
|
std::string m_MIDIThruIn;
|
|
|
|
std::string m_MIDIThruOut;
|
|
|
|
|
|
|
|
bool m_bLCDEnabled;
|
|
|
|
unsigned m_nLCDPinEnable;
|
|
|
|
unsigned m_nLCDPinRegisterSelect;
|
|
|
|
unsigned m_nLCDPinReadWrite;
|
|
|
|
unsigned m_nLCDPinData4;
|
|
|
|
unsigned m_nLCDPinData5;
|
|
|
|
unsigned m_nLCDPinData6;
|
|
|
|
unsigned m_nLCDPinData7;
|
|
|
|
|
|
|
|
bool m_bEncoderEnabled;
|
|
|
|
unsigned m_nEncoderPinClock;
|
|
|
|
unsigned m_nEncoderPinData;
|
|
|
|
unsigned m_nEncoderPinSwitch;
|
|
|
|
|
|
|
|
bool m_bMIDIDumpEnabled;
|
|
|
|
bool m_bProfileEnabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|