mirror of
https://github.com/dwhinham/mt32-pi.git
synced 2026-10-27 06:21:59 +00:00
1 parent
72c517f495
commit
37c256732a
7 files changed
+6
-61
No files matched your search
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Update to circle-stdlib v15.13/Circle Step 44.5.
|
||||
- Update to libmt32emu v2.6.3.
|
||||
- Update to FluidSynth v2.2.7.
|
||||
- The `i2c_dac_address` and `i2c_dac_init` configuration options have been deprecated and have no longer have any effect. DACs requiring initialization are now automatically detected.
|
||||
|
||||
## [0.11.3] - 2022-04-13
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ BEGIN_SECTION(audio)
|
||||
CFG(output_device, TAudioOutputDevice, AudioOutputDevice, TAudioOutputDevice::PWM )
|
||||
CFG(sample_rate, int, AudioSampleRate, 48000 )
|
||||
CFG(chunk_size, int, AudioChunkSize, 256 )
|
||||
CFG(i2c_dac_address, int, AudioI2CDACAddress, 0x4c, true )
|
||||
CFG(i2c_dac_init, TAudioI2CDACInit, AudioI2CDACInit, TAudioI2CDACInit::None )
|
||||
END_SECTION
|
||||
|
||||
BEGIN_SECTION(control)
|
||||
|
||||
@@ -46,10 +46,6 @@ public:
|
||||
ENUM(HDMI, hdmi) \
|
||||
ENUM(I2S, i2s)
|
||||
|
||||
#define ENUM_AUDIOI2CDACINIT(ENUM) \
|
||||
ENUM(None, none) \
|
||||
ENUM(PCM51xx, pcm51xx)
|
||||
|
||||
#define ENUM_CONTROLSCHEME(ENUM) \
|
||||
ENUM(None, none) \
|
||||
ENUM(SimpleButtons, simple_buttons) \
|
||||
@@ -78,7 +74,6 @@ public:
|
||||
|
||||
CONFIG_ENUM(TSystemDefaultSynth, ENUM_SYSTEMDEFAULTSYNTH);
|
||||
CONFIG_ENUM(TAudioOutputDevice, ENUM_AUDIOOUTPUTDEVICE);
|
||||
CONFIG_ENUM(TAudioI2CDACInit, ENUM_AUDIOI2CDACINIT);
|
||||
CONFIG_ENUM(TControlScheme, ENUM_CONTROLSCHEME);
|
||||
CONFIG_ENUM(TLCDType, ENUM_LCDTYPE);
|
||||
CONFIG_ENUM(TNetworkMode, ENUM_NETWORKMODE);
|
||||
@@ -105,7 +100,6 @@ private:
|
||||
static bool ParseOption(const char *pString, CIPAddress* pOut);
|
||||
static bool ParseOption(const char* pString, TSystemDefaultSynth* pOut);
|
||||
static bool ParseOption(const char* pString, TAudioOutputDevice* pOut);
|
||||
static bool ParseOption(const char* pString, TAudioI2CDACInit* pOut);
|
||||
static bool ParseOption(const char* pString, TMT32EmuResamplerQuality* pOut);
|
||||
static bool ParseOption(const char* pString, TMT32EmuMIDIChannels* pOut);
|
||||
static bool ParseOption(const char* pString, TMT32EmuROMSet* pOut);
|
||||
|
||||
@@ -140,8 +140,6 @@ private:
|
||||
void LEDOn();
|
||||
void LCDLog(TLCDLogType Type, const char* pFormat...);
|
||||
|
||||
bool InitPCM51xx(u8 nAddress);
|
||||
|
||||
CLogger* volatile m_pLogger;
|
||||
CConfig* volatile m_pConfig;
|
||||
|
||||
|
||||
@@ -147,24 +147,6 @@ sample_rate = 48000
|
||||
# Values: 2-2048 (256*)
|
||||
chunk_size = 256
|
||||
|
||||
# Set address (hexadecimal) of I2C DAC control interface.
|
||||
#
|
||||
# This will be used for the initialization sequence (see below) if enabled.
|
||||
# You can find the address of your DAC by using the i2cdetect utility in Linux.
|
||||
#
|
||||
# Values: 00-80 (4c*)
|
||||
i2c_dac_address = 4c
|
||||
|
||||
# Select an initialization sequence for the DAC.
|
||||
#
|
||||
# Some DACs require some initialization commands to be sent via I2C before they
|
||||
# will produce any sound.
|
||||
#
|
||||
# Values: none*, pcm51xx
|
||||
#
|
||||
# pcm51xx: for DACs based on PCM5121 or similar (e.g. PCM5141, PCM5242)
|
||||
i2c_dac_init = none
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Control options
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -59,7 +59,6 @@ const char* FalseStrings[] = {"false", "off", "0"};
|
||||
// Enum string tables
|
||||
CONFIG_ENUM_STRINGS(TSystemDefaultSynth, ENUM_SYSTEMDEFAULTSYNTH);
|
||||
CONFIG_ENUM_STRINGS(TAudioOutputDevice, ENUM_AUDIOOUTPUTDEVICE);
|
||||
CONFIG_ENUM_STRINGS(TAudioI2CDACInit, ENUM_AUDIOI2CDACINIT);
|
||||
CONFIG_ENUM_STRINGS(TMT32EmuResamplerQuality, ENUM_RESAMPLERQUALITY);
|
||||
CONFIG_ENUM_STRINGS(TMT32EmuMIDIChannels, ENUM_MIDICHANNELS);
|
||||
CONFIG_ENUM_STRINGS(TMT32EmuROMSet, ENUM_MT32ROMSET);
|
||||
@@ -259,7 +258,6 @@ bool CConfig::ParseOption(const char* pString, CIPAddress* pOut)
|
||||
// Define template function wrappers for parsing enums
|
||||
CONFIG_ENUM_PARSER(TSystemDefaultSynth);
|
||||
CONFIG_ENUM_PARSER(TAudioOutputDevice);
|
||||
CONFIG_ENUM_PARSER(TAudioI2CDACInit);
|
||||
CONFIG_ENUM_PARSER(TMT32EmuResamplerQuality);
|
||||
CONFIG_ENUM_PARSER(TMT32EmuMIDIChannels);
|
||||
CONFIG_ENUM_PARSER(TMT32EmuROMSet);
|
||||
|
||||
+5
-31
@@ -242,11 +242,12 @@ bool CMT32Pi::Initialize(bool bSerialMIDIAvailable)
|
||||
|
||||
// Pisound provides clock
|
||||
const bool bSlave = m_pPisound != nullptr;
|
||||
m_pSound = new CI2SSoundBaseDevice(m_pInterrupt, m_pConfig->AudioSampleRate, m_pConfig->AudioChunkSize, bSlave);
|
||||
Format = TSoundFormat::SoundFormatSigned24_32;
|
||||
|
||||
if (m_pConfig->AudioI2CDACInit == CConfig::TAudioI2CDACInit::PCM51xx)
|
||||
InitPCM51xx(m_pConfig->AudioI2CDACAddress);
|
||||
// Don't probe if using Pisound
|
||||
CI2CMaster* const pI2CMaster = bSlave ? nullptr : m_pI2CMaster;
|
||||
|
||||
m_pSound = new CI2SSoundBaseDevice(m_pInterrupt, m_pConfig->AudioSampleRate, m_pConfig->AudioChunkSize, bSlave, pI2CMaster);
|
||||
Format = TSoundFormat::SoundFormatSigned24_32;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1224,33 +1225,6 @@ void CMT32Pi::LCDLog(TLCDLogType Type, const char* pFormat...)
|
||||
m_UserInterface.ShowSystemMessage(Buffer, Type == TLCDLogType::Spinner);
|
||||
}
|
||||
|
||||
// TODO: Generic configurable DAC init class
|
||||
bool CMT32Pi::InitPCM51xx(u8 nAddress)
|
||||
{
|
||||
static const u8 InitBytes[][2] =
|
||||
{
|
||||
// Set PLL reference clock to BCK (set SREF to 001b)
|
||||
{ 0x0D, 0x10 },
|
||||
|
||||
// Ignore clock halt detection (set IDCH to 1)
|
||||
{ 0x25, 0x08 },
|
||||
|
||||
// Disable auto mute
|
||||
{ 0x41, 0x04 }
|
||||
};
|
||||
|
||||
for (auto& Command : InitBytes)
|
||||
{
|
||||
if (m_pI2CMaster->Write(nAddress, &Command, sizeof(Command)) != sizeof(Command))
|
||||
{
|
||||
m_pLogger->Write(MT32PiName, LogWarning, "I2C write error (DAC init sequence)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* CMT32Pi::GetNetworkDeviceShortName() const
|
||||
{
|
||||
switch (m_pConfig->NetworkMode)
|
||||
|
||||
Reference in new issue
Block a user