Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dn-help
15 changes: 10 additions & 5 deletions Source/APU/N163.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,17 @@ uint8_t CN163::Read(uint16_t Address, bool &Mapped)
void CN163::Process(uint32_t Time, Blip_Buffer& Output)
{
// Mix level will dynamically change based on number of channels
if (!m_UseSurveyMix) {
if (m_UseSurveyMix) {
auto channels = m_N163.GetNumberOfChannels();
auto scale = m_bUseLinearMixing ? (channels + 1) : 1;
m_SynthN163.volume(m_Attenuation, 225 * scale);
}
else {
int channels = m_N163.GetNumberOfChannels();
auto scale = m_bUseLinearMixing ? (channels + 1) : 1;
double N163_volume = (channels == 0) ? 1.3f : (1.5f + float(channels) / 1.5f);
N163_volume *= m_Attenuation;
m_SynthN163.volume(N163_volume * 1.1, 1600);
m_SynthN163.volume(N163_volume * 1.1, 1600 * scale);
}

uint32_t now = 0;
Expand Down Expand Up @@ -199,9 +205,8 @@ void CN163::UpdateMixLevel(double v, bool UseSurveyMix)
{
m_Attenuation = v;
m_UseSurveyMix = UseSurveyMix;
if (UseSurveyMix)
m_SynthN163.volume(m_Attenuation, 225);
// Legacy mixing recalculates chip levels at runtime
// Recalculate chip levels at runtime; this is dependent on the amount of
// N163 channels at execution.
}

void CN163::Log(uint16_t Address, uint8_t Value) // // //
Expand Down
2 changes: 1 addition & 1 deletion Source/APU/mesen/Namco163Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Namco163Audio
for (int i = 7, min = 7 - GetNumberOfChannels(); i >= min; i--) {
summedOutput += _channelOutput[i];
}
summedOutput /= (GetNumberOfChannels() + 1);
// Adjust the volume range on the blip_synth!
return (_mixLinear ? summedOutput : _channelOutput[_currentChannel]);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/AboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ BOOL CAboutDlg::OnInitDialog()
_T("- Sunsoft 5B information in manual by forple\r\n") // // !!
_T("- Additional manual information by Persune\r\n") // // !!
_T("- Toolbar icons are made by ilkke\r\n")
_T("- Dn-FT icon design by Pale Moon\r\n") // // !!
_T("- Dn-FT icon design by Sun Rays\r\n") // // !!
_T("- DPCM import resampler by Jarhmander\r\n")
_T("- DPCM sample bit order reverser mod by Persune\r\n") // // !!
_T("- Module text import/export by rainwarrior")); // // //
Expand Down
5 changes: 3 additions & 2 deletions Source/Channels2A03.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,11 @@ bool CTriangleChan::HandleEffect(effect_t EffNum, unsigned char EffParam)
m_bResetEnvelope = true;
}
else {
m_bEnvelopeLoop = true;
// Avoid touching the envelope loop flag if under a retrigger effect
if (!m_bRetrigger)
m_bEnvelopeLoop = true;
return CChannelHandler2A03::HandleEffect(EffNum, EffParam); // true
}
m_bRetrigger = false;
break;
case EF_RETRIGGER:
if (EffParam > 0x7f)
Expand Down
1 change: 1 addition & 0 deletions Source/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const int CCompiler::FLAG_LINEARPITCH = 1 << 2; // // //


// chan_id_t to ft_channel_enable index
// TODO: utilize WriteChannelMap() ?
const size_t CH_MAP[] = {
0, 1, 2, 3, 27, // 2A03
6, 7, 8, // VRC6
Expand Down
18 changes: 5 additions & 13 deletions Source/FamiTrackerDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ BOOL CFamiTrackerDoc::SaveDocument(LPCTSTR lpszPathName) const
bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
{
static const int DEFAULT_BLOCK_VERSION[] = { // // // TODO: use version info
#ifdef TRANSPOSE_FDS
// internal
6, // Parameters
1, // Song Info
Expand All @@ -816,21 +815,14 @@ bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const
6, // Instruments
6, // Sequences
3, // Frames
5, // Patterns
1, // DSamples
1, // Comments
// Patterns
#ifdef TRANSPOSE_FDS
5,
#else
6, // Parameters
1, // Song Info
0, // Tuning
3, // Header
6, // Instruments
6, // Sequences
3, // Frames
4, // Patterns
4,
#endif
1, // DSamples
1, // Comments
#endif
// expansion
6, // SequencesVRC6
1, // SequencesN163
Expand Down
3 changes: 2 additions & 1 deletion Source/InstrumentEditDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void CInstrumentEditDlg::ClearPanels()
m_iInstrument = -1;
}

void CInstrumentEditDlg::SetCurrentInstrument(int Index)
void CInstrumentEditDlg::SetCurrentInstrument(int Index, bool Focus)
{
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
std::shared_ptr<CInstrument> pInstrument = pDoc->GetInstrument(Index);
Expand Down Expand Up @@ -220,6 +220,7 @@ void CInstrumentEditDlg::SetCurrentInstrument(int Index)
for (int i = 0; i < PANEL_COUNT; ++i) {
if (m_pPanels[i] != NULL) {
m_pPanels[i]->SelectInstrument(pInstrument);
if (Focus) m_pPanels[i]->SetFocus();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/InstrumentEditDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CInstrumentEditDlg : public CDialog
virtual ~CInstrumentEditDlg();

void ChangeNoteState(int Note);
void SetCurrentInstrument(int Index);
void SetCurrentInstrument(int Index, bool Focus = true);
float GetRefreshRate() const; // // //
void SetRefreshRate(float Rate); // // //
bool IsOpened() const;
Expand Down
2 changes: 0 additions & 2 deletions Source/InstrumentEditorSeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ void CInstrumentEditorSeq::SelectInstrument(std::shared_ptr<CInstrument> pInst)
SetDlgItemInt(IDC_SEQ_INDEX, m_pInstrument->GetSeqIndex(m_iSelectedSetting = Sel));

SelectSequence(m_pInstrument->GetSeqIndex(m_iSelectedSetting), m_iSelectedSetting);

SetFocus();
}

void CInstrumentEditorSeq::SelectSequence(int Sequence, int Type)
Expand Down
3 changes: 2 additions & 1 deletion Source/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,8 @@ void CMainFrame::SelectInstrument(int Index)

// Update instrument editor
if (m_wndInstEdit.IsOpened())
m_wndInstEdit.SetCurrentInstrument(Index);
// Do not shift focus when selecting the instrument due to a instrument column edit
m_wndInstEdit.SetCurrentInstrument(Index, false);
}
else {
// Remove selection
Expand Down
14 changes: 4 additions & 10 deletions Source/drivers/asm/apu.s
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,11 @@ ft_update_2a03:
beq @KillTriangle
lda var_ch_Note + APU_TRI
beq @KillTriangle
lda var_ch_LengthCounter + APU_TRI ;;; ;; ;
and #%00000111
beq :++ ; branch if no length counter and no linear counter
: lda var_Linear_Counter
and #$7F
bpl :++ ; always
: lda var_Triangle_Trill ; still write linear counter if we have retriggering enabled
bne :--

; linear counter is already processed at this point
lda var_Linear_Counter
ora #$80 ; ;; ;;;
: sta $4008
sta $4008

@EndTriangleVolume:
; Period table isn't limited to $7FF anymore
lda var_ch_PeriodCalcHi + APU_TRI
Expand Down
Loading