|
From: <sag...@us...> - 2010-07-18 22:40:28
|
Revision: 656
http://modplug.svn.sourceforge.net/modplug/?rev=656&view=rev
Author: saga-games
Date: 2010-07-18 22:40:22 +0000 (Sun, 18 Jul 2010)
Log Message:
-----------
[Imp] Sample Editor: When hovering the relative note and finetune controls, the actual C-5 frequency is now also shown for MOD files. Previously, this only worked for XM files.
[Imp] Sample Editor: Finetune range is now limited from -8 to 7 for MOD files.
[Fix] Sample Editor: When using the spin button next to the finetune or frequency control, the module was not marked as modified.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-07-18 22:00:53 UTC (rev 655)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-07-18 22:40:22 UTC (rev 656)
@@ -504,7 +504,7 @@
case IDC_EDIT5:
case IDC_SPIN5:
case IDC_COMBO_BASENOTE:
- if ((m_pSndFile) && (m_pSndFile->m_nType & MOD_TYPE_XM) && (m_nSample))
+ if ((m_pSndFile) && (m_pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_MOD)) && (m_nSample))
{
MODSAMPLE *pSmp = &m_pSndFile->Samples[m_nSample];
UINT nFreqHz = CSoundFile::TransposeToFrequency(pSmp->RelativeTone, pSmp->nFineTune);
@@ -645,7 +645,10 @@
transp = CSoundFile::FrequencyToTranspose(pSmp->nC5Speed) >> 7;
} else
{
- SetDlgItemInt(IDC_EDIT5, (int)pSmp->nFineTune);
+ int ftune = ((int)pSmp->nFineTune);
+ // MOD finetune range -8 to 7 translates to -128 to 112
+ if(m_pSndFile->m_nType & MOD_TYPE_MOD) ftune >>= 4;
+ SetDlgItemInt(IDC_EDIT5, ftune);
transp = (int)pSmp->RelativeTone;
}
int basenote = 60 - transp;
@@ -2450,6 +2453,8 @@
}
} else
{
+ if(m_pSndFile->m_nType & MOD_TYPE_MOD)
+ n = MOD2XMFineTune(n);
if ((n >= -128) && (n <= 127))
{
m_pSndFile->Samples[m_nSample].nFineTune = (signed char)n;
@@ -2956,11 +2961,21 @@
m_EditFineTune.SetWindowText(s);
} else
{
- LONG d = CLAMP(pSmp->nFineTune + pos * ((m_pSndFile->GetType() & MOD_TYPE_MOD) ? 16 : 1), -128, 127);
- pSmp->nFineTune = (signed char)d;
- wsprintf(s, "%d", d);
- m_EditFineTune.SetWindowText(s);
+ int ftune = (int)pSmp->nFineTune;
+ // MOD finetune range -8 to 7 translates to -128 to 112
+ if(m_pSndFile->GetType() & MOD_TYPE_MOD)
+ {
+ ftune = CLAMP((ftune >> 4) + pos, -8, 7);
+ pSmp->nFineTune = MOD2XMFineTune((signed char)ftune);
+ }
+ else
+ {
+ ftune = CLAMP(ftune + pos, -128, 127);
+ pSmp->nFineTune = (signed char)ftune;
+ }
+ SetDlgItemInt(IDC_EDIT5, ftune, TRUE);
}
+ bRedraw = true;
m_SpinFineTune.SetPos(0);
}
if ((nCode == SB_ENDSCROLL) || (nCode == SB_THUMBPOSITION)) SwitchToView();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|