Skip to content

Commit a645c16

Browse files
authored
Merge pull request #366 from Dn-Programming-Core-Management/app-emu-module-nsf_driver-dev
Module, driver, and UI bugfixes
2 parents c20d476 + cbc6ccd commit a645c16

21 files changed

+154
-210
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Dn-help/*
4343
# this should be automatically generated at build
4444
hlp/HTMLDefines.h
4545

46+
# generated headers
47+
/Source/drivers/*.h
48+
/Source/drivers/asm/build/*
49+
4650
## Ignore Visual Studio temporary files, build results, and
4751
## files generated by popular Visual Studio add-ons.
4852
##
@@ -441,6 +445,3 @@ FodyWeavers.xsd
441445

442446
# JetBrains Rider
443447
*.sln.iml
444-
445-
# generated headers
446-
/Source/drivers/*.h

Dn-help

Source/APU/N163.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,16 @@ uint8_t CN163::Read(uint16_t Address, bool &Mapped)
8484
void CN163::Process(uint32_t Time, Blip_Buffer& Output)
8585
{
8686
// Mix level will dynamically change based on number of channels
87-
if (!m_UseSurveyMix) {
88-
int channels = m_N163.GetNumberOfChannels();
87+
auto channels = m_N163.GetNumberOfChannels();
88+
auto scale = m_bUseLinearMixing ? (channels + 1) : 1;
89+
90+
if (m_UseSurveyMix) {
91+
m_SynthN163.volume(m_Attenuation, 225 * scale);
92+
}
93+
else {
8994
double N163_volume = (channels == 0) ? 1.3f : (1.5f + float(channels) / 1.5f);
9095
N163_volume *= m_Attenuation;
91-
m_SynthN163.volume(N163_volume * 1.1, 1600);
96+
m_SynthN163.volume(N163_volume * 1.1, 1600 * scale);
9297
}
9398

9499
uint32_t now = 0;
@@ -199,9 +204,8 @@ void CN163::UpdateMixLevel(double v, bool UseSurveyMix)
199204
{
200205
m_Attenuation = v;
201206
m_UseSurveyMix = UseSurveyMix;
202-
if (UseSurveyMix)
203-
m_SynthN163.volume(m_Attenuation, 225);
204-
// Legacy mixing recalculates chip levels at runtime
207+
// Recalculate chip levels at runtime; this is dependent on the amount of
208+
// N163 channels at execution.
205209
}
206210

207211
void CN163::Log(uint16_t Address, uint8_t Value) // // //

Source/APU/mesen/Namco163Audio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Namco163Audio
131131
for (int i = 7, min = 7 - GetNumberOfChannels(); i >= min; i--) {
132132
summedOutput += _channelOutput[i];
133133
}
134-
summedOutput /= (GetNumberOfChannels() + 1);
134+
// Adjust the volume range on the blip_synth!
135135
return (_mixLinear ? summedOutput : _channelOutput[_currentChannel]);
136136
}
137137

Source/AboutDlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ BOOL CAboutDlg::OnInitDialog()
168168
_T("- Sunsoft 5B information in manual by forple\r\n") // // !!
169169
_T("- Additional manual information by Persune\r\n") // // !!
170170
_T("- Toolbar icons are made by ilkke\r\n")
171-
_T("- Dn-FT icon design by Pale Moon\r\n") // // !!
171+
_T("- Dn-FT icon design by Sun Rays\r\n") // // !!
172172
_T("- DPCM import resampler by Jarhmander\r\n")
173173
_T("- DPCM sample bit order reverser mod by Persune\r\n") // // !!
174174
_T("- Module text import/export by rainwarrior")); // // //

Source/Channels2A03.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,11 @@ bool CTriangleChan::HandleEffect(effect_t EffNum, unsigned char EffParam)
354354
m_bResetEnvelope = true;
355355
}
356356
else {
357-
m_bEnvelopeLoop = true;
357+
// Avoid touching the envelope loop flag if under a retrigger effect
358+
if (!m_bRetrigger)
359+
m_bEnvelopeLoop = true;
358360
return CChannelHandler2A03::HandleEffect(EffNum, EffParam); // true
359361
}
360-
m_bRetrigger = false;
361362
break;
362363
case EF_RETRIGGER:
363364
if (EffParam > 0x7f)

Source/Compiler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const int CCompiler::FLAG_LINEARPITCH = 1 << 2; // // //
116116

117117

118118
// chan_id_t to ft_channel_enable index
119+
// TODO: utilize WriteChannelMap() ?
119120
const size_t CH_MAP[] = {
120121
0, 1, 2, 3, 27, // 2A03
121122
6, 7, 8, // VRC6

Source/FamiTrackerDoc.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,6 @@ BOOL CFamiTrackerDoc::SaveDocument(LPCTSTR lpszPathName) const
807807
bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
808808
{
809809
static const int DEFAULT_BLOCK_VERSION[] = { // // // TODO: use version info
810-
#ifdef TRANSPOSE_FDS
811810
// internal
812811
6, // Parameters
813812
1, // Song Info
@@ -816,21 +815,14 @@ bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
816815
6, // Instruments
817816
6, // Sequences
818817
3, // Frames
819-
5, // Patterns
820-
1, // DSamples
821-
1, // Comments
818+
// Patterns
819+
#ifdef TRANSPOSE_FDS
820+
5,
822821
#else
823-
6, // Parameters
824-
1, // Song Info
825-
0, // Tuning
826-
3, // Header
827-
6, // Instruments
828-
6, // Sequences
829-
3, // Frames
830-
4, // Patterns
822+
4,
823+
#endif
831824
1, // DSamples
832825
1, // Comments
833-
#endif
834826
// expansion
835827
6, // SequencesVRC6
836828
1, // SequencesN163

Source/InstrumentEditDlg.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void CInstrumentEditDlg::ClearPanels()
165165
m_iInstrument = -1;
166166
}
167167

168-
void CInstrumentEditDlg::SetCurrentInstrument(int Index)
168+
void CInstrumentEditDlg::SetCurrentInstrument(int Index, bool Focus)
169169
{
170170
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
171171
std::shared_ptr<CInstrument> pInstrument = pDoc->GetInstrument(Index);
@@ -220,6 +220,7 @@ void CInstrumentEditDlg::SetCurrentInstrument(int Index)
220220
for (int i = 0; i < PANEL_COUNT; ++i) {
221221
if (m_pPanels[i] != NULL) {
222222
m_pPanels[i]->SelectInstrument(pInstrument);
223+
if (Focus) m_pPanels[i]->SetFocus();
223224
}
224225
}
225226

Source/InstrumentEditDlg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CInstrumentEditDlg : public CDialog
3434
virtual ~CInstrumentEditDlg();
3535

3636
void ChangeNoteState(int Note);
37-
void SetCurrentInstrument(int Index);
37+
void SetCurrentInstrument(int Index, bool Focus = true);
3838
float GetRefreshRate() const; // // //
3939
void SetRefreshRate(float Rate); // // //
4040
bool IsOpened() const;

0 commit comments

Comments
 (0)