|
From: <rel...@us...> - 2007-04-01 00:28:21
|
Revision: 177
http://svn.sourceforge.net/modplug/?rev=177&view=rev
Author: relabsoluness
Date: 2007-03-31 17:28:16 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
. v1.17.02.46 (Still in progress, no binaries)
<Relabs> . No longer possible to enter a tunename which is longer than the maximum length that can be stored to an IT-file(yet to be fixed for other formats).
<Relabs> . When opening instruments, load dialog didn't remember its previous path.
<Relabs> / Changed the way channels are reset when jumping between patterns in orderlist.
<Relabs> / Added version number to the mainframe title.
<Relabs> ./ Changed the way panning is treated(sndmix.cpp, lines around 1620) since I think for example that the behavior of panbrello had changed for RC2 plugin levels in rev. 174. Please correct if it's wrong now.
<Relabs> / Serialization related tweaking(tuning related). MPTm/tuning files created with this version (likely) won't open in the tuning-branch('RC3') version.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_gen.cpp
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/Node.h
trunk/OpenMPT/mptrack/Stdafx.h
trunk/OpenMPT/mptrack/TuningDialog.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/misc_util.cpp
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/serialization_utils.cpp
trunk/OpenMPT/mptrack/serialization_utils.h
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Load_s3m.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
trunk/OpenMPT/soundlib/tuning.cpp
trunk/OpenMPT/soundlib/tuningCollection.cpp
trunk/OpenMPT/soundlib/tuning_template.h
trunk/OpenMPT/soundlib/tuningcollection.h
Added Paths:
-----------
trunk/OpenMPT/mptrack/typedefs.h
Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -80,7 +80,11 @@
{
CModControlDlg::OnInitDialog();
// Song Title
- m_EditTitle.SetLimitText(31);
+ if(m_pSndFile)
+ m_EditTitle.SetLimitText(m_pSndFile->GetModNameLengthMax());
+ else
+ m_EditTitle.SetLimitText(31);
+
// -> CODE#0016
// -> DESC="default tempo update"
// m_SpinTempo.SetRange(32, 255); // 255 bpm max
@@ -98,7 +102,6 @@
m_SliderSamplePreAmp.SetRange(0, MAX_SLIDER_SAMPLE_VOL);
-
// -! BEHAVIOUR_CHANGE#0016
m_ComboResampling.AddString("None");
m_ComboResampling.AddString("Linear");
@@ -299,14 +302,14 @@
void CCtrlGeneral::OnTitleChanged()
//---------------------------------
{
- CHAR s[80];
+ CHAR s[35];
if ((!m_pSndFile) || (!m_EditTitle.m_hWnd) || (!m_EditTitle.GetModify())) return;
memset(s, 0, sizeof(s));
m_EditTitle.GetWindowText(s, sizeof(s));
- s[31] = 0;
+ s[25] = 0;
if (strcmp(m_pSndFile->m_szNames[0], s))
{
- memcpy(m_pSndFile->m_szNames[0], s, 32);
+ memcpy(m_pSndFile->m_szNames[0], s, 26);
if (m_pModDoc)
{
m_EditTitle.SetModify(FALSE);
@@ -723,5 +726,3 @@
SelectObject(hdc, oldpen);
m_nDisplayedVu = m_nVuMeter;
}
-
-
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -1262,9 +1262,10 @@
if (penv)
{
CHAR szPath[_MAX_PATH], szNewPath[_MAX_PATH];
- _splitpath(lpszFileName, szPath, szNewPath, szName, szExt);
+ _splitpath(lpszFileName, szNewPath, szPath, szName, szExt);
strcat(szNewPath, szPath);
strcpy(CMainFrame::m_szCurInsDir, szNewPath);
+
if (!penv->name[0])
{
szName[31] = 0;
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -207,6 +207,7 @@
pSndFile->m_nCurrentPattern = pSndFile->m_nNextPattern = m_nScrollPos;
pMainFrm->ResetNotificationBuffer(); //rewbs.toCheck
pSndFile->m_nNextRow = 0;
+ pSndFile->ResetChannelSettings(CHNRESET_BASIC);
END_CRITICAL();
} else
if (m_pParent->GetFollowSong())
@@ -216,6 +217,8 @@
pSndFile->m_nCurrentPattern = m_nScrollPos;
pSndFile->SetCurrentOrder(m_nScrollPos);
pSndFile->m_dwSongFlags |= dwPaused;
+ pSndFile->ResetChannelSettings(CHNRESET_BASIC);
+
//if (!(dwPaused & SONG_PATTERNLOOP)) pSndFile->GetLength(TRUE);
//Relabs.note: Commented above line for it seems to cause
//significant slowdown when changing patterns without
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -113,8 +113,8 @@
END_MESSAGE_MAP()
// Static
-static gdwLastLowLatencyTime = 0;
-static gdwLastMixActiveTime = 0;
+static int gdwLastLowLatencyTime = 0;
+static int gdwLastMixActiveTime = 0;
static DWORD gsdwTotalSamples = 0;
static DWORD gdwPlayLatency = 0;
@@ -443,6 +443,7 @@
}
void CMainFrame::LoadRegistrySettings()
+//-------------------------------------
{
HKEY key;
@@ -600,6 +601,16 @@
{
CHAR s[256];
+ //Adding version number to the frame title
+ CString title = GetTitle();
+ #ifdef DEBUG
+ title += CString(" DEBUG");
+ #endif
+ title += CString(" ") + GetFullVersionString();
+ SetTitle(title);
+ OnUpdateFrameTitle(false);
+
+
// Load Chords
theApp.LoadChords(Chords);
// Check for valid sound device
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -1042,6 +1042,7 @@
}
BOOL CModDoc::NoFxChannel(UINT nChn, BOOL bNoFx, BOOL updateMix)
+//--------------------------------------------------------------
{
if (nChn >= m_SndFile.m_nChannels) return FALSE;
if (m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) SetModified();
@@ -2791,6 +2792,7 @@
void CModDoc::OnPatternRestart()
+//------------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
CChildFrame *pChildFrm = (CChildFrame *) GetChildFrame();
@@ -2811,6 +2813,12 @@
CModDoc *pModPlaying = pMainFrm->GetModPlaying();
BEGIN_CRITICAL();
+
+ m_SndFile.SetCurrentPos(0);
+ //Relabs.note: Dirty hack to try to make replay pattern to be
+ //more like 'play song from start' - a little clean up for
+ //these playback calls would be nice (March 2007).
+
// Cut instruments/samples
for (UINT i=0; i<MAX_CHANNELS; i++)
{
@@ -2842,6 +2850,7 @@
}
void CModDoc::OnPatternPlay()
+//---------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
CChildFrame *pChildFrm = (CChildFrame *) GetChildFrame();
@@ -2890,6 +2899,7 @@
}
void CModDoc::OnPatternPlayNoLoop()
+//---------------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
CChildFrame *pChildFrm = (CChildFrame *) GetChildFrame();
@@ -3115,4 +3125,4 @@
if (bShowLog) ShowLog("Conversion Status", CMainFrame::GetMainFrame());
SetModified();
}
-}
\ No newline at end of file
+}
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -520,10 +520,8 @@
{
if ((m[i].note) || (m[i].instr) || (m[i].volcmd) || (m[i].command)) goto NotEmpty;
}
- BEGIN_CRITICAL();
m_SndFile.Patterns.Remove(ipat);
nPatRemoved++;
- END_CRITICAL();
NotEmpty:
;
}
@@ -2054,3 +2052,4 @@
return nPattern;
}
+
Modified: trunk/OpenMPT/mptrack/Node.h
===================================================================
--- trunk/OpenMPT/mptrack/Node.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Node.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -20,7 +20,7 @@
virtual CString GetLabel() = 0;
virtual HPEN GetBorderPen() = 0;
- ConnectInput(int input, CNode sourceNode, int sourceNodeOutput);
+ int ConnectInput(int input, CNode sourceNode, int sourceNodeOutput);
protected:
int x,y;
Modified: trunk/OpenMPT/mptrack/Stdafx.h
===================================================================
--- trunk/OpenMPT/mptrack/Stdafx.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/Stdafx.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -69,6 +69,8 @@
void Log(LPCSTR format,...);
+#include "typedefs.h"
+
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TuningDialog.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -1249,6 +1249,7 @@
}
else
{
+ MessageBox("Saving succesful.");
m_ModifiedTCs[m_pActiveTuningCollection] = false;
}
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -3472,6 +3472,8 @@
}
}
+
+#ifdef TRADITIONAL_MODCOMMAND
void CViewPattern::TempEnterFX(int c)
//-----------------------------------
{
@@ -3522,7 +3524,53 @@
}
} // end if mainframe & moddoc exist
}
+#else
+void CViewPattern::TempEnterFX(int e /*EFFECT_ID eID*/)
+//-----------------------------------
+{
+ CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
+ CModDoc *pModDoc = GetDocument();
+ CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : NULL;
+ if(!pSndFile || !pMainFrm)
+ return;
+
+ EFFECT_ID eID = e;
+
+ const ROWINDEX r = m_nRow;
+ const CHANNELINDEX c = GetChanFromCursor(m_dwCursor);
+ const MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(r, c);
+ MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite
+
+ PrepareUndo(m_dwBeginSel, m_dwEndSel);
+
+ //Checking whether to use the param of previous effect.
+ if (eID)
+ {
+ if ((eID == m_cmdOld.GetEffect()) && (!p->GetEffectParam()) && (!p->GetEffect()))
+ pSndFile->Patterns[m_nPattern].SetModCommandEffectParam(r, c, m_cmdOld.GetEffectParam());
+ else
+ m_cmdOld.SetEffectParam(0);
+
+ m_cmdOld.SetEffectByID(eID);
+ }
+ pSndFile->Patterns[m_nPattern].SetModCommandEffect(r, c, eID);
+
+ if (IsEditingEnabled_bmsg())
+ {
+ DWORD sel = (m_nRow << 16) | m_dwCursor;
+ SetCurSel(sel, sel);
+ sel &= ~7;
+ if(oldcmd != *p)
+ {
+ pModDoc->SetModified();
+ InvalidateArea(sel, sel+5);
+ UpdateIndicator();
+ }
+ }
+}
+#endif
+
void CViewPattern::TempEnterFXparam(int v)
//----------------------------------------
{
@@ -4793,3 +4841,5 @@
return false;
}
+
+
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -785,8 +785,8 @@
CComboBox *combo;
CDialog::OnInitDialog();
combo = (CComboBox *)GetDlgItem(IDC_COMBO1);
- CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
- if ((m_pModDoc) && (m_nPattern < pSndFile->Patterns.Size()) && (combo))
+ CSoundFile *pSndFile = (m_pModDoc) ? m_pModDoc->GetSoundFile() : NULL;
+ if ((pSndFile) && (m_nPattern < pSndFile->Patterns.Size()) && (combo))
{
CHAR s[256];
UINT nrows = pSndFile->PatternSize[m_nPattern];
@@ -794,17 +794,14 @@
// -> CODE#0008
// -> DESC="#define to set pattern size"
// for (UINT irow=32; irow<=256; irow++)
- for (UINT irow=32; irow<=MAX_PATTERN_ROWS; irow++)
+// for (UINT irow=32; irow<=MAX_PATTERN_ROWS; irow++)
+ for (UINT irow=pSndFile->GetRowMin(); irow<=pSndFile->GetRowMax(); irow++)
// -! BEHAVIOUR_CHANGE#0008
{
wsprintf(s, "%d", irow);
combo->AddString(s);
}
- if (nrows < 32)
- {
- wsprintf(s, "%d", nrows);
- combo->SetWindowText(s);
- } else combo->SetCurSel(nrows-32);
+ combo->SetCurSel(nrows-pSndFile->GetRowMin());
wsprintf(s, "Pattern #%d:\x0d\x0a %d rows (%dK)",
m_nPattern,
pSndFile->PatternSize[m_nPattern],
@@ -1272,36 +1269,75 @@
BEGIN_MESSAGE_MAP(CPageEditEffect, CPageEditCommand)
ON_WM_HSCROLL()
ON_CBN_SELCHANGE(IDC_COMBO1, OnCommandChanged)
+ ON_CBN_SELCHANGE(IDC_COMBO2, OnCommand2Changed)
END_MESSAGE_MAP()
void CPageEditEffect::UpdateDialog()
//----------------------------------
{
- CHAR s[128];
- CComboBox *combo;
- CSoundFile *pSndFile;
-
- if ((!m_pModDoc) || (!m_bInitialized)) return;
- pSndFile = m_pModDoc->GetSoundFile();
- if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL)
- {
- UINT numfx = m_pModDoc->GetNumEffects();
- UINT fxndx = m_pModDoc->GetIndexFromEffect(m_nCommand, m_nParam);
- combo->ResetContent();
- combo->SetItemData(combo->AddString(" None"), (DWORD)-1);
- if (!m_nCommand) combo->SetCurSel(0);
- for (UINT i=0; i<numfx; i++)
+ #ifdef TRADITIONAL_MODCOMMAND
+ CHAR s[128];
+ CComboBox *combo;
+ CSoundFile *pSndFile;
+
+ if ((!m_pModDoc) || (!m_bInitialized)) return;
+ pSndFile = m_pModDoc->GetSoundFile();
+ if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL)
{
- if (m_pModDoc->GetEffectInfo(i, s, TRUE))
+ UINT numfx = m_pModDoc->GetNumEffects();
+ UINT fxndx = m_pModDoc->GetIndexFromEffect(m_nCommand, m_nParam);
+ combo->ResetContent();
+ combo->SetItemData(combo->AddString(" None"), (DWORD)-1);
+ if (!m_nCommand) combo->SetCurSel(0);
+ for (UINT i=0; i<numfx; i++)
{
- int k = combo->AddString(s);
- combo->SetItemData(k, i);
- if (i == fxndx) combo->SetCurSel(k);
+ if (m_pModDoc->GetEffectInfo(i, s, TRUE))
+ {
+ int k = combo->AddString(s);
+ combo->SetItemData(k, i);
+ if (i == fxndx) combo->SetCurSel(k);
+ }
}
}
- }
- UpdateRange(FALSE);
+ UpdateRange(FALSE);
+ #else //Modcommand testing
+ CHAR s[128];
+ CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1);
+ CComboBox *combo2 = (CComboBox *)GetDlgItem(IDC_COMBO2);
+ CSoundFile *pSndFile;
+
+ if ((!m_pModDoc) || (!m_bInitialized)) return;
+ pSndFile = m_pModDoc->GetSoundFile();
+ if (combo && combo2)
+ {
+ combo->ResetContent();
+ combo2->ResetContent();
+ combo->SetItemData(combo->AddString(" None"), (DWORD)-1);
+ combo2->SetItemData(combo2->AddString(" None"), (DWORD)-1);
+
+ UINT numfx = m_pModDoc->GetNumEffects();
+ const UINT fxndx1 = m_pModDoc->GetIndexFromEffect(m_pModcommand->GetEffect(0), m_pModcommand->GetEffectParam(0));
+ const UINT fxndx2 = m_pModDoc->GetIndexFromEffect(m_pModcommand->GetEffect(1), m_pModcommand->GetEffectParam(1));
+
+ if(!m_pModcommand->GetEffect(0)) combo->SetCurSel(0);
+ if(!m_pModcommand->GetEffect(1)) combo2->SetCurSel(0);
+
+ for (UINT i=0; i<numfx; i++)
+ {
+ if (m_pModDoc->GetEffectInfo(i, s, TRUE))
+ {
+ int k = combo->AddString(s);
+ combo->SetItemData(k, i);
+ int k2 = combo2->AddString(s);
+ combo2->SetItemData(k2, i);
+ if (i == fxndx1) combo->SetCurSel(k);
+ if (i == fxndx2) combo2->SetCurSel(k2);
+ }
+ }
+ }
+ UpdateRange(FALSE);
+ #endif
}
Modified: trunk/OpenMPT/mptrack/misc_util.cpp
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/misc_util.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -1,44 +1,2 @@
#include "stdafx.h"
#include "misc_util.h"
-
-
-bool StringToBinaryStream(ostream& outStream, const string& str)
-//----------------------------------------------------
-{
- if(!outStream.good()) return true;
- size_t size = str.size();
- outStream.write(reinterpret_cast<char*>(&size), sizeof(size));
- outStream << str;
- if(outStream.good())
- return false;
- else
- return true;
-
-}
-
-bool StringFromBinaryStream(istream& inStrm, string& str, const size_t maxSize)
-//---------------------------------------------------------
-{
- if(!inStrm.good()) return true;
- size_t strSize;
- inStrm.read(reinterpret_cast<char*>(&strSize), sizeof(strSize));
-
- if(strSize > maxSize)
- return true;
-
- str.resize(strSize);
-
- //Inefficiently reading to temporary buffer first and
- //then setting that to the string.
- char* buffer = new char[strSize+1];
- inStrm.read(buffer, strSize);
- buffer[strSize] = '\0';
- str = buffer;
- delete[] buffer; buffer = 0;
-
-
- if(inStrm.good())
- return false;
- else
- return true;
-}
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/misc_util.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -4,21 +4,20 @@
#include <vector>
#include <sstream>
#include <string>
+#include <limits>
using namespace std;
-const UINT STRINGMAXSIZE = 1000;
-const UINT VECTORMAXSIZE = 1000;
-//Default sizelimits to string/vector load methods.
-//Size limits are there to prevent corrupted streams from
-//causing e.g. program to try to load of vector of size 2 000 000 000.
+#include "typedefs.h"
-template<class T>
+template<class T, class SIZETYPE>
bool VectorToBinaryStream(ostream& outStrm, const vector<T>& v)
//------------------------------------------------------------
{
if(!outStrm.good()) return true;
- size_t s = v.size();
+ if((std::numeric_limits<SIZETYPE>::max)() < v.size()) return true;
+
+ SIZETYPE s = static_cast<SIZETYPE>(v.size());
outStrm.write(reinterpret_cast<const char*>(&s), sizeof(s));
vector<T>::const_iterator iter = v.begin();
for(iter; iter != v.end(); iter++)
@@ -30,19 +29,20 @@
return true;
}
-template<class T>
-bool VectorFromBinaryStream(istream& inStrm, vector<T>& v, const size_t maxSize = VECTORMAXSIZE)
+
+template<class T, class SIZETYPE>
+bool VectorFromBinaryStream(istream& inStrm, vector<T>& v, const SIZETYPE maxSize = (std::numeric_limits<SIZETYPE>::max)())
//---------------------------------------------------------
{
if(!inStrm.good()) return true;
- size_t size;
+
+ SIZETYPE size;
inStrm.read(reinterpret_cast<char*>(&size), sizeof(size));
if(size > maxSize)
return true;
v.resize(size);
- ASSERT(v.size() == size);
for(size_t i = 0; i<size; i++)
{
inStrm.read(reinterpret_cast<char*>(&v[i]), sizeof(T));
@@ -53,10 +53,49 @@
return true;
}
-bool StringToBinaryStream(ostream& outStream, const string& str);
-bool StringFromBinaryStream(istream& inStrm, string& str, const size_t maxSize = STRINGMAXSIZE);
+template<class SIZETYPE>
+bool StringToBinaryStream(ostream& outStream, const string& str)
+//--------------------------------------------------------------
+{
+ if(!outStream.good()) return true;
+ if((std::numeric_limits<SIZETYPE>::max)() < str.size()) return true;
+ SIZETYPE size = static_cast<SIZETYPE>(str.size());
+ outStream.write(reinterpret_cast<char*>(&size), sizeof(size));
+ outStream << str;
+ if(outStream.good())
+ return false;
+ else
+ return true;
+}
+
+
+template<class SIZETYPE>
+bool StringFromBinaryStream(istream& inStrm, string& str, const SIZETYPE maxSize = (std::numeric_limits<SIZETYPE>::max)())
+//--------------------------------------------------------------------------------------------
+{
+ if(!inStrm.good()) return true;
+
+ SIZETYPE strSize;
+ inStrm.read(reinterpret_cast<char*>(&strSize), sizeof(strSize));
+
+ if(strSize > maxSize)
+ return true;
+
+ str.resize(strSize);
+
+ //Copying string from stream one character at a time.
+ for(SIZETYPE i = 0; i<strSize; i++)
+ inStrm.read(&str[i], 1);
+
+ if(inStrm.good())
+ return false;
+ else
+ return true;
+}
+
+
template<class T>
inline string Stringify(const T& x)
//--------------------------
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2007-04-01 00:28:16 UTC (rev 177)
@@ -1269,6 +1269,12 @@
CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,104,15,114,12
LTEXT "Effect Type:",IDC_STATIC,0,4,55,8
+ LTEXT "Value:",IDC_TEXT2,183,1,35,8,NOT WS_VISIBLE
+ COMBOBOX IDC_COMBO2,78,0,16,83,CBS_DROPDOWNLIST | CBS_SORT | NOT
+ WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,134,0,43,12
+ LTEXT "Effect Type:",IDC_STATIC,54,1,19,8,NOT WS_VISIBLE
END
IDD_SAMPLE_AMPLIFY DIALOGEX 0, 0, 175, 66
Modified: trunk/OpenMPT/mptrack/serialization_utils.cpp
===================================================================
--- trunk/OpenMPT/mptrack/serialization_utils.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/serialization_utils.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -1,37 +1,7 @@
#include "stdafx.h"
#include "serialization_utils.h"
-#include "misc_util.h"
-bool ReadTuningMap(istream& fin, map<WORD, string>& shortToTNameMap, const size_t maxNum)
-//----------------------------------------
-{
- typedef map<WORD, string> MAP;
- typedef MAP::iterator MAP_ITER;
- size_t numTuning = 0;
- fin.read(reinterpret_cast<char*>(&numTuning), sizeof(numTuning));
- if(numTuning > maxNum)
- {
- fin.setstate(ios::failbit);
- return true;
- }
- for(size_t i = 0; i<numTuning; i++)
- {
- string temp;
- unsigned short ui;
- if(StringFromBinaryStream(fin, temp))
- {
- fin.setstate(ios::failbit);
- return true;
- }
- fin.read(reinterpret_cast<char*>(&ui), sizeof(ui));
- shortToTNameMap[ui] = temp;
- }
- if(fin.good())
- return false;
- else
- return true;
-}
Modified: trunk/OpenMPT/mptrack/serialization_utils.h
===================================================================
--- trunk/OpenMPT/mptrack/serialization_utils.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/mptrack/serialization_utils.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -5,13 +5,49 @@
#include <string>
#include <map>
#include <fstream>
+#include "misc_util.h"
+
+
using namespace std;
const size_t MAX_TUNING_NUM_DEFAULT = 1000;
-bool ReadTuningMap(istream&, map<WORD, string>&, const size_t maxNum = MAX_TUNING_NUM_DEFAULT);
+template<class TUNNUMTYPE, class STRSIZETYPE>
+bool ReadTuningMap(istream& fin, map<WORD, string>& shortToTNameMap, const size_t maxNum = MAX_TUNING_NUM_DEFAULT)
+//----------------------------------------------------------------------------------------
+{
+ //In first versions: SIZETYPE1 == SIZETYPE2 == size_t == uint64.
+ typedef map<WORD, string> MAP;
+ typedef MAP::iterator MAP_ITER;
+ TUNNUMTYPE numTuning = 0;
+ fin.read(reinterpret_cast<char*>(&numTuning), sizeof(numTuning));
+ if(numTuning > maxNum)
+ {
+ fin.setstate(ios::failbit);
+ return true;
+ }
+ for(size_t i = 0; i<numTuning; i++)
+ {
+ string temp;
+ uint16 ui;
+ if(StringFromBinaryStream<STRSIZETYPE>(fin, temp))
+ {
+ fin.setstate(ios::failbit);
+ return true;
+ }
+
+ fin.read(reinterpret_cast<char*>(&ui), sizeof(ui));
+ shortToTNameMap[ui] = temp;
+ }
+ if(fin.good())
+ return false;
+ else
+ return true;
+}
+
+
enum //Serialization Message
{
SM_UNKNOWN = 0,
@@ -19,7 +55,7 @@
};
//==============================================
-class CCharStreamBufFrom : public std::streambuf
+class CCharBufferStreamIn : public std::streambuf
//==============================================
{
private:
@@ -29,7 +65,7 @@
return rv;
}
public:
- CCharStreamBufFrom() {}
+ CCharBufferStreamIn() {}
protected:
streambuf* setbuf(char_type* buffer, std::streamsize count)
Added: trunk/OpenMPT/mptrack/typedefs.h
===================================================================
--- trunk/OpenMPT/mptrack/typedefs.h (rev 0)
+++ trunk/OpenMPT/mptrack/typedefs.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -0,0 +1,19 @@
+#ifndef TYPEDEFS_H
+#define TYPEDEFS_H
+
+#ifdef WIN32
+ typedef __int8 int8;
+ typedef __int16 int16;
+ typedef __int32 int32;
+ typedef __int64 int64;
+
+ typedef unsigned __int8 uint8;
+ typedef unsigned __int16 uint16;
+ typedef unsigned __int32 uint32;
+ typedef size_t uint64;
+
+ typedef float float32;
+
+#endif
+
+#endif
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -3252,12 +3252,13 @@
while ((header.patnum > 0) && (!Patterns[header.patnum-1])) header.patnum--;
//VERSION
- //header.cwtv = 0x888; // We don't use these version info fields any more.
- header.cwtv = 0x88B; // But now they are in use again :)
+ header.cwtv = 0x88C; // Used in OMPT-hack versioning.
header.cmwt = 0x888; // Might come up as "Impulse Tracker 8" file in XMPlay. :)
/*
Version history:
+ 0x88B -> 0x88C: Changed type in which tuning number is printed
+ to file: size_t -> uint16.
0x88A -> 0x88B: Changed order-to-pattern-index table type from BYTE-array to vector<UINT>.
*/
@@ -3836,7 +3837,7 @@
//...and write the map with tuning names replacing
//the addresses.
- const size_t tuningMapSize = tNameToShort_Map.size();
+ const uint16 tuningMapSize = tNameToShort_Map.size();
fout.write(reinterpret_cast<const char*>(&tuningMapSize), sizeof(tuningMapSize));
if(tuningMapSize == 0)
{
@@ -3847,9 +3848,9 @@
for(TNTS_MAP_ITER iter = tNameToShort_Map.begin(); iter != tNameToShort_Map.end(); iter++)
{
if(iter->first)
- StringToBinaryStream(fout, iter->first->GetName());
+ StringToBinaryStream<uint8>(fout, iter->first->GetName());
else //Case: Using original IT tuning.
- StringToBinaryStream(fout, "->MPT_ORIGINAL_IT<-");
+ StringToBinaryStream<uint8>(fout, "->MPT_ORIGINAL_IT<-");
fout.write(reinterpret_cast<const char*>(&(iter->second)), sizeof(iter->second));
}
@@ -4469,7 +4470,9 @@
//START - mpt specific:
//Using member cwtv on pifh as the version number.
- if(pifh->cwtv > 0x889)
+ const uint16 version = pifh->cwtv;
+ try{
+ if(version > 0x889)
{
const char* const cpcMPTStart = reinterpret_cast<const char*>(lpStream + mptStartPos);
@@ -4483,21 +4486,23 @@
//std::streambuf which can be used in the istream
//methods. So this was new to me, and checking this
//might be a good idea.
- CCharStreamBufFrom cbs;
+ CCharBufferStreamIn cbs;
cbs.pubsetbuf((char*)cpcMPTStart, dwMemLength-mptStartPos);
istream fin(&cbs);
if(m_TuningsTuneSpecific.UnSerializeBinary(fin))
{
- ::MessageBox(NULL, "Error occured - loading failed while trying to load tune specific tunings.", 0, MB_OK);
- return FALSE;
+ throw(exception("Error occured - loading failed while trying to load tune specific tunings."));
}
//2. Reading tuning id <-> tuning name map.
typedef map<WORD, string> MAP;
typedef MAP::iterator MAP_ITER;
MAP shortToTNameMap;
- ReadTuningMap(fin, shortToTNameMap);
+ if(version < 0x88C)
+ ReadTuningMap<uint64, uint64>(fin, shortToTNameMap);
+ else
+ ReadTuningMap<uint16, uint8>(fin, shortToTNameMap);
//Read & set tunings for instruments
list<string> notFoundTunings;
@@ -4556,6 +4561,12 @@
//End read&set instrument tunings
} //version condition(MPT)
+ } //try block ends
+ catch(exception& e)
+ {
+ ::MessageBox(0, e.what(), "", MB_ICONERROR);
+ return TRUE; //Return value to be revised.
+ }
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -143,13 +143,13 @@
case CMD_GLOBALVOLSLIDE: command = 'W'; break;
case CMD_PANNING8:
command = 'X';
- if ((bIT) && (m_nType != MOD_TYPE_IT) && (m_nType != MOD_TYPE_XM))
+ if ((bIT) && (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) && (m_nType != MOD_TYPE_XM))
{
if (param == 0xA4) { command = 'S'; param = 0x91; } else
if (param <= 0x80) { param <<= 1; if (param > 255) param = 255; } else
command = param = 0;
} else
- if ((!bIT) && ((m_nType == MOD_TYPE_IT) || (m_nType == MOD_TYPE_XM)))
+ if ((!bIT) && ((m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) || (m_nType == MOD_TYPE_XM)))
{
param >>= 1;
}
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -349,7 +349,7 @@
GET_MPTHEADER_sized_member( nCutSwing , BYTE , CS.. )
GET_MPTHEADER_sized_member( nResSwing , BYTE , RS.. )
GET_MPTHEADER_sized_member( nFilterMode , BYTE , FM.. )
-GET_MPTHEADER_sized_member( wPitchToTempoLock , WORD , PTTL , )
+GET_MPTHEADER_sized_member( wPitchToTempoLock , WORD , PTTL )
GET_MPTHEADER_sized_member( nPitchEnvReleaseNode, BYTE , PERN )
GET_MPTHEADER_sized_member( nPanEnvReleaseNode , BYTE , AERN )
GET_MPTHEADER_sized_member( nVolEnvReleaseNode , BYTE , VERN )
@@ -1033,51 +1033,13 @@
//---------------------------------------
{
UINT i, nPattern;
+ BYTE resetMask = (!nPos) ? CHNRESET_TOTAL : CHNRESET_MOST;
for (i=0; i<MAX_CHANNELS; i++)
- {
- Chn[i].nNote = Chn[i].nNewNote = Chn[i].nNewIns = 0;
- Chn[i].pInstrument = NULL;
- Chn[i].pHeader = NULL;
- Chn[i].nPortamentoDest = 0;
- Chn[i].nCommand = 0;
- Chn[i].nPatternLoopCount = 0;
- Chn[i].nPatternLoop = 0;
- Chn[i].nFadeOutVol = 0;
- Chn[i].dwFlags |= CHN_KEYOFF|CHN_NOTEFADE;
- Chn[i].nTremorCount = 0;
- }
+ ResetChannelSettings(i, resetMask);
+
if (!nPos)
{
- for (i=0; i<MAX_CHANNELS; i++)
- {
- Chn[i].nPeriod = 0;
- Chn[i].nPos = Chn[i].nLength = 0;
- Chn[i].nLoopStart = 0;
- Chn[i].nLoopEnd = 0;
- Chn[i].nROfs = Chn[i].nLOfs = 0;
- Chn[i].pSample = NULL;
- Chn[i].pInstrument = NULL;
- Chn[i].pHeader = NULL;
- Chn[i].nCutOff = 0x7F;
- Chn[i].nResonance = 0;
- Chn[i].nFilterMode = 0;
- Chn[i].nLeftVol = Chn[i].nRightVol = 0;
- Chn[i].nNewLeftVol = Chn[i].nNewRightVol = 0;
- Chn[i].nLeftRamp = Chn[i].nRightRamp = 0;
- Chn[i].nVolume = 256;
- if (i < MAX_BASECHANNELS)
- {
- Chn[i].dwFlags = ChnSettings[i].dwFlags;
- Chn[i].nPan = ChnSettings[i].nPan;
- Chn[i].nGlobalVol = ChnSettings[i].nVolume;
- } else
- {
- Chn[i].dwFlags = 0;
- Chn[i].nPan = 128;
- Chn[i].nGlobalVol = 64;
- }
- }
m_nGlobalVolume = m_nDefaultGlobalVolume;
m_nMusicSpeed = m_nDefaultSpeed;
m_nMusicTempo = m_nDefaultTempo;
@@ -1382,10 +1344,11 @@
if(nch > MAX_BASECHANNELS) return true;
+ ResetChannelSettings(nch, CHNRESET_TOTAL);
+
ChnSettings[nch].nPan = 128;
ChnSettings[nch].nVolume = 64;
ChnSettings[nch].dwFlags = 0;
- ChnSettings[nch].dwFlags &= ~CHN_MUTE; //Unmuting
ChnSettings[nch].nMixPlugin = 0;
ChnSettings[nch].szName[0] = 0;
@@ -1401,8 +1364,74 @@
return false;
}
+void CSoundFile::ResetChannelSettings(CHANNELINDEX i, BYTE resetMask)
+//-------------------------------------------------------
+{
+ //Relabs.Hack
+ if(i >= MAX_CHANNELS) return;
+
+ if(resetMask & CHNRESET_BASIC)
+ {
+ if(i < MAX_BASECHANNELS)
+ {
+ //Chn[i].dwFlags = ChnSettings[i].dwFlags;
+ Chn[i].nPan = ChnSettings[i].nPan;
+ Chn[i].nGlobalVol = ChnSettings[i].nVolume;
+ }
+ else
+ {
+ Chn[i].dwFlags = 0;
+ Chn[i].nPan = 128;
+ Chn[i].nGlobalVol = 64;
+ }
+
+ }
+ if(resetMask == CHNRESET_BASIC) return;
+ if(resetMask & CHNRESET_MOST)
+ {
+ Chn[i].nNote = Chn[i].nNewNote = Chn[i].nNewIns = 0;
+ Chn[i].pInstrument = NULL;
+ Chn[i].pHeader = NULL;
+ Chn[i].nPortamentoDest = 0;
+ Chn[i].nCommand = 0;
+ Chn[i].nPatternLoopCount = 0;
+ Chn[i].nPatternLoop = 0;
+ Chn[i].nFadeOutVol = 0;
+ Chn[i].dwFlags |= CHN_KEYOFF|CHN_NOTEFADE;
+ Chn[i].nTremorCount = 0;
+ }
+ if(resetMask == CHNRESET_MOST) return;
+ if(resetMask & CHNRESET_TOTAL)
+ {
+ Chn[i].nPeriod = 0;
+ Chn[i].nPos = Chn[i].nLength = 0;
+ Chn[i].nLoopStart = 0;
+ Chn[i].nLoopEnd = 0;
+ Chn[i].nROfs = Chn[i].nLOfs = 0;
+ Chn[i].pSample = NULL;
+ Chn[i].pInstrument = NULL;
+ Chn[i].pHeader = NULL;
+ Chn[i].nCutOff = 0x7F;
+ Chn[i].nResonance = 0;
+ Chn[i].nFilterMode = 0;
+ Chn[i].nLeftVol = Chn[i].nRightVol = 0;
+ Chn[i].nNewLeftVol = Chn[i].nNewRightVol = 0;
+ Chn[i].nLeftRamp = Chn[i].nRightRamp = 0;
+ Chn[i].nVolume = 256;
+ }
+}
+
+void CSoundFile::ResetChannelSettings(BYTE resetMask)
+//-------------------------------------
+{
+ for(CHANNELINDEX i = 0; i<GetNumChannels(); i++)
+ ResetChannelSettings(i, resetMask);
+}
+
+
+
CHANNELINDEX CSoundFile::ReArrangeChannels(const std::vector<CHANNELINDEX>& newOrder)
//-------------------------------------------------------------------
{
@@ -2799,9 +2828,47 @@
WORD CSoundFile::GetTempoMin() const {return 32;}
WORD CSoundFile::GetTempoMax() const {return 512;}
-ROWINDEX CSoundFile::GetRowMax() const {return MAX_PATTERN_ROWS;}
-ROWINDEX CSoundFile::GetRowMin() const {return 2;}
+ROWINDEX CSoundFile::GetRowMax() const
+//------------------------------------
+{
+ switch(m_nType)
+ {
+ case MOD_TYPE_MPT:
+ return MPTM_SPECS.patternRowsMax;
+ case MOD_TYPE_MOD:
+ return MOD_SPECS.patternRowsMax;
+ case MOD_TYPE_XM:
+ return XM_SPECS.patternRowsMax;
+ case MOD_TYPE_IT:
+ return IT_SPECS.patternRowsMax;
+ case MOD_TYPE_S3M:
+ return S3M_SPECS.patternRowsMax;
+ default:
+ return MAX_PATTERN_ROWS;
+ }
+}
+ROWINDEX CSoundFile::GetRowMin() const
+//------------------------------------
+{
+ switch(m_nType)
+ {
+ case MOD_TYPE_MPT:
+ return MPTM_SPECS.patternRowsMin;
+ case MOD_TYPE_MOD:
+ return MOD_SPECS.patternRowsMin;
+ case MOD_TYPE_XM:
+ return XM_SPECS.patternRowsMin;
+ case MOD_TYPE_IT:
+ return IT_SPECS.patternRowsMin;
+ case MOD_TYPE_S3M:
+ return S3M_SPECS.patternRowsMin;
+ default:
+ return 2;
+ }
+}
+
+
CHANNELINDEX CSoundFile::GetNumChannelMax() const
//-----------------------------------
{
@@ -2833,3 +2900,30 @@
replace(Order.begin(), Order.end(), oldIgnoreIndex, Patterns.GetIgnoreIndex());
}
+#ifndef TRADITIONAL_MODCOMMAND
+void CSoundFile::OnSetEffect(MODCOMMAND& mc, EFFECT_ID eID)
+//---------------------------------------------------------
+{
+ // Check for MOD/XM Speed/Tempo command
+ if(
+ (GetModType() & (MOD_TYPE_MOD|MOD_TYPE_XM)) &&
+ (eID == CMD_SPEED || eID == CMD_TEMPO)
+ )
+ {
+ UINT maxspd = (GetModType() == MOD_TYPE_XM) ? 0x1F : 0x20;
+ mc.SetEffectByID((mc.GetEffectParam() <= maxspd) ? CMD_SPEED : CMD_TEMPO);
+ }
+ else
+ {
+ mc.SetEffectByID(eID);
+ }
+}
+
+
+void CSoundFile::OnSetEffectParam(MODCOMMAND& mc, EFFECT_PARAM eParam)
+//---------------------------------------------------------
+{
+ mc.SetEffectParam(eParam);
+}
+
+#endif
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -604,7 +604,11 @@
//<----
} MODCHANNEL;
+#define CHNRESET_BASIC 1
+#define CHNRESET_MOST 3
+#define CHNRESET_TOTAL 255
+
typedef struct _MODCHANNELSETTINGS
{
UINT nPan;
@@ -802,6 +806,8 @@
CHANNELINDEX GetNumChannelMax() const;
CHANNELINDEX GetNumChannelMin() const;
+ size_t GetModNameLengthMax() {return 25;}
+
public: //Misc
void ChangeModTypeTo(const int& newType);
//
@@ -933,10 +939,12 @@
BOOL Create(LPCBYTE lpStream, CModDoc *pModDoc, DWORD dwMemLength=0);
BOOL Destroy();
UINT GetType() const { return m_nType; }
+
+ //Return the number of channels in the pattern. In 1.17.02.45
+ //it returned the number of channels with volume != 0
UINT GetNumChannels() const {return m_nChannels;}
- //Return the number of channels in the pattern. In 1.17.02.45
- //it returned the number of channels with volume != 0
+
BOOL SetMasterVolume(UINT vol, BOOL bAdjustAGC=FALSE);
UINT GetMasterVolume() const { return m_nMasterVolume; }
UINT GetNumPatterns() const;
@@ -978,6 +986,17 @@
CHANNELINDEX ReArrangeChannels(const std::vector<CHANNELINDEX>& fromToArray);
bool MoveChannel(UINT chn_from, UINT chn_to);
bool SetChannelSettingsToDefault(UINT nch);
+
+
+ //Sets default channels settings from MODCHANNELSETTINGS to current
+ //channel settings. Flag can be used to tell whether to completely
+ //reset channels, not only a few settings(for maintaining old behavior).
+ void ResetChannelSettings(CHANNELINDEX chn, BYTE resetStyle);
+
+ //For all channels.
+ void ResetChannelSettings(BYTE resetStyle);
+
+
// Module Loaders
BOOL ReadXM(LPCBYTE lpStream, DWORD dwMemLength);
BOOL ReadS3M(LPCBYTE lpStream, DWORD dwMemLength);
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -1619,6 +1619,9 @@
}
if (m_pConfig->getTreatPanLikeBalance()) {
+ pChn->nNewLeftVol = (realvol * pan) >> 8;
+ pChn->nNewRightVol = (realvol * (256 - pan)) >> 8;
+ } else {
if (pan < 128) {
pChn->nNewLeftVol = (realvol * pan) >> 8;
pChn->nNewRightVol = (realvol * 128) >> 8;
@@ -1626,9 +1629,6 @@
pChn->nNewLeftVol = (realvol * 128) >> 8;
pChn->nNewRightVol = (realvol * (256 - pan)) >> 8;
}
- } else {
- pChn->nNewLeftVol = (realvol * pan) >> 8;
- pChn->nNewRightVol = (realvol * (256 - pan)) >> 8;
}
} else {
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -18,7 +18,7 @@
UINT tempoMax;
UINT patternRowsMin;
UINT patternRowsMax;
- UINT modNameLengthMax;
+ UINT modNameLengthMax; //Meaning 'usable letters', possible null character is not included.
UINT samplesMax;
UINT instrumentsMax;
};
@@ -50,32 +50,87 @@
512, //Max tempo
2, //Min pattern rows
1024, //Max pattern rows
- 100, //Max mod name length
+ 256, //Max mod name length
4000, //SamplesMax
256, //instrumentMax
};
-/*
-const CModSpecifications MOD_TYPE_MOD =
+
+const CModSpecifications MOD_SPECS =
{
- "mod",
-
+ //TODO: Set correct values.
+ "mod", //File extension
+ 64, //Pattern max.
+ 128, //Order max.
+ 4, //Channel min
+ 4, //Channel max
+ 32, //Min tempo
+ 256, //Max tempo
+ 64, //Min pattern rows
+ 64, //Max pattern rows
+ 25, //Max mod name length
+ 31, //SamplesMax
+ 0, //instrumentMax
};
-const CModSpecifications MOD_TYPE_XM =
+
+const CModSpecifications XM_SPECS =
{
- "xm",
+ //TODO: Set correct values.
+ "xm", //File extension
+ 64, //Pattern max.
+ 128, //Order max.
+ 4, //Channel min
+ 64, //Channel max
+ 32, //Min tempo
+ 256, //Max tempo
+ 4, //Min pattern rows
+ 256, //Max pattern rows
+ 25, //Max mod name length
+ 31, //SamplesMax
+ 256, //instrumentMax
};
-const CModSpecifications MOD_TYPE_IT =
+const CModSpecifications S3M_SPECS =
{
- "it",
+ //TODO: Set correct values.
+ "s3m", //File extension
+ 240, //Pattern max.
+ 256, //Order max.
+ 4, //Channel min
+ 32, //Channel max
+ 32, //Min tempo
+ 256, //Max tempo
+ 64, //Min pattern rows
+ 64, //Max pattern rows
+ 25, //Max mod name length
+ 31, //SamplesMax
+ 0, //instrumentMax
};
-*/
+const CModSpecifications IT_SPECS =
+{
+ //TODO: Set correct values.
+ "it", //File extension
+ 240, //Pattern max.
+ 256, //Order max.
+ 4, //Channel min
+ 64, //Channel max
+ 32, //Min tempo
+ 256, //Max tempo
+ 4, //Min pattern rows
+ 256, //Max pattern rows
+ 25, //Max mod name length(in ittech.txt: "0000: \xB3'I'\xB3'M'\xB3'P'\xB3'M'\xB3 Song Name, max 26 characters, includes NULL \xB3")
+ 256, //SamplesMax
+ 256, //instrumentMax
+};
+
+
+
+
#endif
Modified: trunk/OpenMPT/soundlib/tuning.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuning.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/tuning.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -8,8 +8,14 @@
//CTuningRTi-statics
const CTuning::SERIALIZATION_MARKER CTuningRTI::s_SerializationBeginMarker("CTRTI_B.");
const CTuning::SERIALIZATION_MARKER CTuningRTI::s_SerializationEndMarker("CTRTI_E.");
-const CTuning::SERIALIZATION_VERSION CTuningRTI::s_SerializationVersion(2);
+const CTuning::SERIALIZATION_VERSION CTuningRTI::s_SerializationVersion(3);
+/*
+Version changes:
+ 2->3: The type for the size_type in the serialisation changed
+ from default(size_t, uint64) to unsigned STEPTYPE. (March 2007)
+*/
+
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
@@ -178,11 +184,12 @@
if(CTuning::SerializeBinary(outStrm) == SERIALIZATION_FAILURE) return SERIALIZATION_FAILURE;
//Main Ratios
- if(VectorToBinaryStream(outStrm, m_RatioTable))
+ if(VectorToBinaryStream<RATIOTYPE, USTEPTYPE>(outStrm, m_RatioTable))
return SERIALIZATION_FAILURE;
+
//Fine ratios
- if(VectorToBinaryStream(outStrm, m_RatioTableFine))
+ if(VectorToBinaryStream<RATIOTYPE, UFINESTEPTYPE>(outStrm, m_RatioTableFine))
return SERIALIZATION_FAILURE;
//m_StepMin
@@ -235,7 +242,7 @@
//Version
inStrm.read(reinterpret_cast<char*>(&version), sizeof(version));
- if(version != 1 && version != s_SerializationVersion)
+ if(version > s_SerializationVersion)
return SERIALIZATION_FAILURE;
//Baseclass Unserialization
@@ -243,14 +250,31 @@
return SERIALIZATION_FAILURE;
//Ratiotable
- if(VectorFromBinaryStream(inStrm, m_RatioTable))
- return SERIALIZATION_FAILURE;
+ if(version < 3)
+ {
+ if(VectorFromBinaryStream<RATIOTYPE, uint64>(inStrm, m_RatioTable))
+ return SERIALIZATION_FAILURE;
+ }
+ else //Version >= 3
+ {
+ if(VectorFromBinaryStream<RATIOTYPE, USTEPTYPE>(inStrm, m_RatioTable))
+ return SERIALIZATION_FAILURE;
+ }
+
//Ratiotable fine
if(version > 1)
{
- if(VectorFromBinaryStream(inStrm, m_RatioTableFine))
- return SERIALIZATION_FAILURE;
+ if(version < 3)
+ {
+ if(VectorFromBinaryStream<RATIOTYPE, uint64>(inStrm, m_RatioTableFine))
+ return SERIALIZATION_FAILURE;
+ }
+ else //Version >= 3
+ {
+ if(VectorFromBinaryStream<RATIOTYPE, UFINESTEPTYPE>(inStrm, m_RatioTableFine))
+ return SERIALIZATION_FAILURE;
+ }
}
Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuningCollection.cpp 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2007-04-01 00:28:16 UTC (rev 177)
@@ -5,8 +5,15 @@
//Serializations statics:
const CTuningCollection::SERIALIZATION_MARKER CTuningCollection::s_SerializationBeginMarker = 0x54435348; //ascii of TCSH(TuningCollectionSerialisationHeader) in hex.
const CTuningCollection::SERIALIZATION_MARKER CTuningCollection::s_SerializationEndMarker = 0x54435346; //ascii of TCSF(TuningCollectionSerialisationFooter) in hex.
-const CTuningCollection::SERIALIZATION_MARKER CTuningCollection::s_SerializationVersion = 1;
+const CTuningCollection::SERIALIZATION_MARKER CTuningCollection::s_SerializationVersion = 2;
+/*
+Version history:
+ 1->2: Sizetypes of string serialisation from size_t(uint64)
+ to uint8. (March 2007)
+*/
+
+
const CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::SERIALIZATION_SUCCESS = false;
const CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::SERIALIZATION_FAILURE = true;
@@ -29,6 +36,7 @@
CTuningCollection::CTuningCollection(const string& name) : m_Name(name)
//------------------------------------
{
+ if(m_Name.size() > GetNameLengthMax()) m_Name.resize(GetNameLengthMax());
m_EditMask.set();
}
@@ -132,7 +140,7 @@
outStrm.write(reinterpret_cast<const char*>(&s_SerializationVersion), sizeof(s_SerializationVersion));
//3. Name
- if(StringToBinaryStream(outStrm, m_Name))
+ if(StringToBinaryStream<uint8>(outStrm, m_Name))
return SERIALIZATION_FAILURE;
//4. Edit mask
@@ -202,11 +210,19 @@
//2. Serialization version
inStrm.read(reinterpret_cast<char*>(&version), sizeof(version));
- if(version != s_SerializationVersion) return SERIALIZATION_FAILURE;
+ if(version > s_SerializationVersion) return SERIALIZATION_FAILURE;
//3. Name
- if(StringFromBinaryStream(inStrm, m_Name))
- return SERIALIZATION_FAILURE;
+ if(version < 2)
+ {
+ if(StringFromBinaryStream<uint64>(inStrm, m_Name))
+ return SERIALIZATION_FAILURE;
+ }
+ else
+ {
+ if(StringFromBinaryStream<uint8>(inStrm, m_Name))
+ return SERIALIZATION_FAILURE;
+ }
//4. Editmask
__int16 em = 0;
Modified: trunk/OpenMPT/soundlib/tuning_template.h
===================================================================
--- trunk/OpenMPT/soundlib/tuning_template.h 2007-03-14 01:04:11 UTC (rev 176)
+++ trunk/OpenMPT/soundlib/tuning_template.h 2007-04-01 00:28:16 UTC (rev 177)
@@ -68,7 +68,9 @@
*/
//Class defining tuning which is fundamentally based on discrete steps.
-template<class TSTEPTYPE = short int, class TRATIOTYPE = float, class TFINESTEPTYPE = TSTEPTYPE>
+template<class TSTEPTYPE = short int, class TUSTEPTYPE = unsigned short int,
+ class TRATIOTYPE = float,
+ class TFINESTEPTYPE = TSTEPTYPE, class TUFINESTEPTYPE = TUSTEPTYPE>
class CTuningBase
{
//STEPTYPE: Some type that has properties that of 'ordinary' signed and discrete figures.
@@ -81,8 +83,10 @@
public:
//BEING TYPEDEFS:
typedef TSTEPTYPE STEPTYPE;
+ typedef TUSTEPTYPE USTEPTYPE; //Unsigned steptype
typedef TRATIOTYPE RATIOTYPE;
typedef TFINESTEPTYPE FINESTEPTYPE;
+ typedef TUFINESTEPTYPE UFINESTEPTYPE; //Unsigned finesteptype
typedef std::exception TUNINGEXCEPTION;
@@ -103,6 +107,7 @@
typedef std::string NOTESTR;
typedef std::map<STEPTYPE, NOTESTR> NOTENAMEMAP;
+ typedef USTEPTYPE SIZETYPE;
typedef typename NOTENAMEMAP::iterator NNM_ITER;
typedef typename NOTENAMEMAP::const_iterator NNM_CITER;
@@ -277,7 +282,8 @@
CTuningBase& operator=(const CTuningBase&);
CTuningBase(const CTuningBase&);
//When copying tunings, the name must not be exact copy
- //since it is to be unique for every tuning.
+ //since it is to be unique for every tuning, or maybe some
+ //better identification could be introduced.
CTUNINGTYPE GetType() const {return m_TuningType;}
@@ -288,7 +294,7 @@
//BEGIN PRIVATE METHODS
private:
SERIALIZATION_RETURN_TYPE NotenameMapToBinary(ostream&) const;
- SERIALIZATION_RETURN_TYPE NotenameMapFromBinary(istream&);
+ SERIALIZATION_RETURN_TYPE NotenameMapFromBinary(istream&, const SERIALIZATION_VERSION);
bool SetType(const CTUNINGTYPE& tt)
{
@@ -342,63 +348,64 @@
//Specialising tuning for ompt.
-typedef short int MPT_TUNING_STEPTYPE;
-typedef float MPT_TUNING_RATIOTYPE;
-typedef MPT_TUNING_STEPTYPE MPT_TUNING_FINESTEPTYPE;
+typedef CTuningBase<int16, uint16, float32, int16, uint16> CTuning;
-typedef CTuningBase<MPT_TUNING_STEPTYPE, MPT_TUNING_RATIOTYPE, MPT_TUNING_FINESTEPTYPE> CTuning;
-
const CTuning::SERIALIZATION_MARKER CTuning::s_SerializationBeginMarker("CT<sfs>B");
const CTuning::SERIALIZATION_MARKER CTuning::s_SerializationEndMarker("CT<sfs>E");
//<sfs> <-> Short Float Short
-template<class A, class B, class C>
-const CTuningBase<>::SERIALIZATION_MARKER CTuningBase<A, B, C>::s_SerializationBeginMarker("CTB<ABC>");
+template<class A, class B, class C, class D, class E>
+const CTuningBase<>::SERIALIZATION_MARKER CTuningBase<A, B, C, D, E>::s_SerializationBeginMarker("CTB<ABC>");
-template<class A, class B, class C>
-const CTuningBase<>::SERIALIZATION_MARKER CTuningBase<A, B, C>::s_SerializationEndMarker("CTB<ABC>");
+template<class A, class B, class C, class D, class E>
+const CTuningBase<>::SERIALIZATION_MARKER CTuningBase<A, B, C, D, E>::s_SerializationEndMarker("CTB<ABC>");
-template<class A, class B, class C>
-const CTuningBase<>::SERIALIZATION_VERSION CTuningBase<A, B, C>::s_SerializationVersion(3);
+template<class A, class B, class C, class D, class E>
+const CTuningBase<>::SERIALIZATION_VERSION CTuningBase<A, B, C, D, E>::s_SerializationVersion(4);
+/*
+Version history:
+ 3->4: Changed sizetypes in serialisation from size_t(uint64) to
+ smaller types (uint8, USTEPTYPE) (March 2007)
+*/
-template<class A, class B, class C>
-const CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<A, B, C>::SERIALIZATION_SUCCESS = false;
+template<class A, class B, class C, class D, class E>
+const CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<A, B, C, D, E>::SERIALIZATION_SUCCESS = false;
-template<class A, class B, class C>
-const CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<A, B, C>::SERIALIZATION_FAILURE = true;
+template<class A, class B, class C, class D, class E>
+const CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<A, B, C, D, E>::SERIALIZATION_FAILURE = true;
-template<class A, class B, class C>
-const string CTuningBase<A, B, C>::s_FileExtension = ".tun";
+template<class A, class B, class C, class D, class E>
+const string CTuningBase<A, B, C, D, E>::s_FileExtension = ".tun";
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_MAINRATIOS = 0x1; //1b
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_NOTENAME = 0x2; //10b
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_TYPE = 0x4; //100b
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_NAME = 0x8; //1000b
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_FINETUNE = 0x10; //10000b
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_ALLOWALL = 0xFFFF; //All editing allowed.
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_EDITMASK = 0x8000; //Whether to allow modifications to editmask.
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_CONST = 0x8000; //All editing except changing const status disable.
-template<class A, class B, class C>
-const CTuning::CEDITMASK CTuningBase<A, B, C>::EM_CONST_STRICT = 0; //All bits are zero.
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_MAINRATIOS = 0x1; //1b
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_NOTENAME = 0x2; //10b
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_TYPE = 0x4; //100b
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_NAME = 0x8; //1000b
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_FINETUNE = 0x10; //10000b
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_ALLOWALL = 0xFFFF; //All editing allowed.
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_EDITMASK = 0x8000; //Whether to allow modifications to editmask.
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_CONST = 0x8000; //All editing except changing const status disable.
+template<class A, class B, class C, class D, class E>
+const CTuning::CEDITMASK CTuningBase<A, B, C, D, E>::EM_CONST_STRICT = 0; //All bits are zero.
-template<class A, class B, class C>
-const CTuning::CTUNINGTYPE CTuningBase<A, B, C>::TT_GENERAL = 0; //0...00b
-template<class A, class B, class C>
-const CTuning::CTUNINGTYPE CTuningBase<A, B, C>::TT_RATIOPERIODIC = 1; //0...10b
-template<class A, class B, class C>
-const CTuning::CTUNINGTYPE CTuningBase<A, B, C>::TT_TET = 3; //0...11b
+template<class A, class B, class C, class D, class E>
+const CTuning::CTUNINGTYPE CTuningBase<A, B, C, D, E>::TT_GENERAL = 0; //0...00b
+template<class A, class B, class C, class D, class E>
+const CTuning::CTUNINGTYPE CTuningBase<A, B, C, D, E>::TT_RATIOPERIODIC = 1; //0...10b
+template<class A, class B, class C, class D, class E>
+const CTuning::CTUNINGTYPE CTuningBase<A, B, C, D, E>::TT_TET = 3; //0...11b
-template<class A, class B, class C>
-CTuningBase<A,B,C>& CTuningBase<A,B,C>::operator =(const CTuningBase& pt)
+template<class A, class B, class C, class D, class E>
+CTuningBase<A,B,C,D,E>& CTuningBase<A,B,C,D,E>::operator =(const CTuningBase& pt)
//-----------------------------------------------------------------------
{
if(!MayEdit(EM_ALLOWALL))
@@ -437,15 +444,15 @@
return *this;
}
-template<class A, class B, class C>
-CTuningBase<A,B,C>::CTuningBase(const CTuningBase& pt)
+template<class A, class B, class C, class D, class E>
+CTuningBase<A,B,C,D,E>::CTuningBase(const CTuningBase& pt)
//-----------------------------------------------------------------------
{
*this = pt;
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::SetRatio(const STEPTYPE& s, const RATIOTYPE& r)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::SetRatio(const STEPTYPE& s, const RATIOTYPE& r)
//-----------------------------------------------------------------
{
if(MayEdit(EM_MAINRATIOS))
@@ -461,8 +468,8 @@
}
-template<class A, class B, class C>
-string CTuningBase<A,B,C>::GetTuningTypeStr(const CTUNINGTYPE& tt)
+template<class A, class B, class C, class D, class E>
+string CTuningBase<A,B,C,D,E>::GetTuningTypeStr(const CTUNINGTYPE& tt)
//----------------------------------------------------------------
{
if(tt == TT_GENERAL)
@@ -476,8 +483,8 @@
-template<class A, class B, class C>
-CTuningBase<>::NOTESTR CTuningBase<A,B,C>::GetNoteName(const STEPTYPE& x) const
+template<class A, class B, class C, class D, class E>
+CTuningBase<>::NOTESTR CTuningBase<A,B,C,D,E>::GetNoteName(const STEPTYPE& x) const
//-----------------------------------------------------------------------
{
NNM_CITER i = m_NoteNameMap.find(x);
@@ -488,8 +495,8 @@
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::DoesTypeInclude(const CTUNINGTYPE& type) const
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::DoesTypeInclude(const CTUNINGTYPE& type) const
//-----------------------------------------------------------------------------
{
if(type == TT_GENERAL)
@@ -508,8 +515,8 @@
return false;
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::SetNoteName(const STEPTYPE& n, const string& str)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::SetNoteName(const STEPTYPE& n, const string& str)
//-----------------------------------------------------------------------
{
if(MayEdit(EM_NOTENAME))
@@ -520,8 +527,8 @@
return true;
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::ClearNoteName(const STEPTYPE& n, const bool eraseAll)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::ClearNoteName(const STEPTYPE& n, const bool eraseAll)
//-------------------------------------------------------
{
if(MayEdit(EM_NOTENAME))
@@ -545,8 +552,8 @@
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::Multiply(const RATIOTYPE& r)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::Multiply(const RATIOTYPE& r)
//---------------------------------------------------
{
if(r <= 0 || !MayEdit(EM_MAINRATIOS))
@@ -563,8 +570,8 @@
return false;
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::CreateRatioPeriodic(const STEPTYPE& s, const RATIOTYPE& r)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::CreateRatioPeriodic(const STEPTYPE& s, const RATIOTYPE& r)
//-------------------------------------------------------------
{
if(s < 1 || r <= 0)
@@ -577,8 +584,8 @@
return CreateRatioPeriodic(v, r);
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::CreateRatioPeriodic(const vector<RATIOTYPE>& v, const RATIOTYPE& r)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::CreateRatioPeriodic(const vector<RATIOTYPE>& v, const RATIOTYPE& r)
//------------------------------------------------------------------------------------------
{
if(MayEdit(EM_MAINRATIOS) &&
@@ -599,8 +606,8 @@
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::CreateTET(const STEPTYPE& s, const RATIOTYPE& r)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::CreateTET(const STEPTYPE& s, const RATIOTYPE& r)
//-------------------------------------------------------------------
{
if(MayEdit(EM_MAINRATIOS) &&
@@ -621,8 +628,8 @@
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::ChangePeriod(const STEPTYPE& s)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::ChangePeriod(const STEPTYPE& s)
//---------------------------------------------------
{
if(!MayEdit(EM_MAINRATIOS) || s < 1)
@@ -638,8 +645,8 @@
}
-template<class A, class B, class C>
-bool CTuningBase<A,B,C>::ChangePeriodRatio(const RATIOTYPE& r)
+template<class A, class B, class C, class D, class E>
+bool CTuningBase<A,B,C,D,E>::ChangePeriodRatio(const RATIOTYPE& r)
//---------------------------------------------------
{
if(!MayEdit(EM_MAINRATIOS) || r <= 0)
@@ -655,8 +662,8 @@
}
-template<class TSTEPTYPE, class TRATIOTYPE, class TFINESTEPTYPE>
-CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<TSTEPTYPE, TRATIOTYPE, TFINESTEPTYPE>::SerializeBinary(ostream& outStrm, const int mode) const
+template<class A, class B, class C, class D, class E>
+CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<A, B, C, D, E>::SerializeBinary(ostream& outStrm, const int mode) const
//------------------------------------------------------------------------------------------------------------------------------
{
//Writing the tuning name here.
@@ -667,7 +674,7 @@
outStrm.write(reinterpret_cast<const char*>(&s_SerializationVersion), sizeof(s_SerializationVersion));
//Tuning name
- if(StringToBinaryStream(outStrm, m_TuningName)) return SERIALIZATION_FAILURE;
+ if(StringToBinaryStream<uint8>(outStrm, m_TuningName)) return SERIALIZATION_FAILURE;
//Const mask
const __int16 cm = static_cast<__int16>(m_EditMask.to_ulong());
@@ -693,8 +700,8 @@
}
-template<class TSTEPTYPE, class TRATIOTYPE, class TFINESTEPTYPE>
-CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<TSTEPTYPE, TRATIOTYPE, TFINESTEPTYPE>::UnSerializeBinary(istream& inStrm, const int mode)
+template<class A, class B, class C, class D, class E>
+CTuningBase<>::SERIALIZATION_RETURN_TYPE CTuningBase<A,B,C,D,E>::UnSerializeBinary(istream& inStrm,...
[truncated message content] |