Add switch timeout config option

This commit is contained in:
Dale Whinham committed 2021-03-19 23:53:26 +00:00
1 parent cf216c35e0
commit 8594ea5dc9
4 files changed
+18 -3

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- The number of seconds to wait before a SoundFont begins loading after using the switch button can now be adjusted (new configuration file option).
### Changed
- Update to circle-stdlib v15.6/Circle Step 43.3.
+1
View File
@@ -59,6 +59,7 @@ BEGIN_SECTION(control)
CFG(scheme, TControlScheme, ControlScheme, TControlScheme::None )
CFG(encoder_type, TEncoderType, ControlEncoderType, TEncoderType::Full )
CFG(mister, bool, ControlMister, false )
CFG(switch_timeout, int, ControlSwitchTimeout, 3 )
END_SECTION
BEGIN_SECTION(mt32emu)
+9
View File
@@ -178,6 +178,15 @@ encoder_type = full
# Values: on, off*
mister = off
# Set the timeout for switching SoundFonts (seconds).
#
# When switching SoundFonts using the physical button, there is a short delay
# before loading begins. This option allows you to set the number of seconds to
# wait before loading.
#
# Values: 0-3600 (3*)
switch_timeout = 3
# -----------------------------------------------------------------------------
# MT-32 emulator options
# -----------------------------------------------------------------------------
+4 -3
View File
@@ -37,7 +37,6 @@ constexpr u32 LCDUpdatePeriodMillis = 16;
constexpr u32 MisterUpdatePeriodMillis = 50;
constexpr u32 LEDTimeoutMillis = 50;
constexpr u32 ActiveSenseTimeoutMillis = 330;
constexpr u32 DeferredSoundFontSwitchTimeoutMillis = 1000;
constexpr float Sample16BitMax = (1 << 16 - 1) - 1;
constexpr float Sample24BitMax = (1 << 24 - 1) - 1;
@@ -267,7 +266,9 @@ bool CMT32Pi::Initialize(bool bSerialMIDIAvailable)
void CMT32Pi::MainTask()
{
CConfig* const pConfig = CConfig::Get();
CLogger* const pLogger = CLogger::Get();
pLogger->Write(MT32PiName, LogNotice, "Main task on Core 0 starting up");
Awaken();
@@ -308,7 +309,7 @@ void CMT32Pi::MainTask()
CPower::Update();
// Check for deferred SoundFont switch
if (m_bDeferredSoundFontSwitchFlag && (ticks - m_nDeferredSoundFontSwitchTime) >= MSEC2HZ(DeferredSoundFontSwitchTimeoutMillis))
if (m_bDeferredSoundFontSwitchFlag && (ticks - m_nDeferredSoundFontSwitchTime) >= static_cast<unsigned int>(pConfig->ControlSwitchTimeout) * HZ)
{
SwitchSoundFont(m_nDeferredSoundFontSwitchIndex);
m_bDeferredSoundFontSwitchFlag = false;
@@ -318,7 +319,7 @@ void CMT32Pi::MainTask()
}
// Check for USB PnP events
if (CConfig::Get()->MIDIUSB && m_pUSBHCI->UpdatePlugAndPlay())
if (pConfig->MIDIUSB && m_pUSBHCI->UpdatePlugAndPlay())
{
if (!m_pUSBMIDIDevice && (m_pUSBMIDIDevice = static_cast<CUSBMIDIDevice*>(CDeviceNameService::Get()->GetDevice("umidi1", FALSE))))
{