You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
| 2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
| 2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
| 2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
| 2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
| 2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
| 2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
| 2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
| 2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
| 2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
| 2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
| 2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
| 2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
| 2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
| 2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
| 2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
| 2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
| 2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(203) |
Sep
(148) |
Oct
(109) |
Nov
(191) |
Dec
(209) |
| 2026 |
Jan
(127) |
Feb
(123) |
Mar
(160) |
Apr
(141) |
May
(45) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sag...@us...> - 2010-02-20 19:20:46
|
Revision: 501
http://modplug.svn.sourceforge.net/modplug/?rev=501&view=rev
Author: saga-games
Date: 2010-02-20 19:20:37 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
[Fix] Treeview: Insert/Duplicate sequence actions didn't set the document modified. Grey out those two actions if no additional sequences can be added.
[Imp] Orderlist: Sequence menu also allows to insert empty sequences now.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-20 16:32:10 UTC (rev 500)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-20 19:20:37 UTC (rev 501)
@@ -60,7 +60,7 @@
ON_COMMAND(ID_ORDERLIST_COPY, OnDuplicatePattern)
ON_COMMAND(ID_PATTERNCOPY, OnPatternCopy)
ON_COMMAND(ID_PATTERNPASTE, OnPatternPaste)
- ON_COMMAND_RANGE(ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, OnSelectSequence)
+ ON_COMMAND_RANGE(ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, OnSelectSequence)
ON_MESSAGE(WM_MOD_DRAGONDROPPING, OnDragonDropping)
ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest)
ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg)
@@ -1070,9 +1070,12 @@
AppendMenu(menuSequence, flags, ID_SEQUENCE_ITEM + i, str);
}
if (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES)
- AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("Create new sequence"));
+ {
+ AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("Duplicate current sequence"));
+ AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("Create empty sequence"));
+ }
if (pSndFile->Order.GetNumSequences() > 1)
- AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("Delete current sequence"));
+ AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, TEXT("Delete current sequence"));
}
}
AppendMenu(hMenu, MF_SEPARATOR, NULL, "");
@@ -1366,7 +1369,7 @@
BEGIN_CRITICAL();
CMainFrame::GetMainFrame()->ResetNotificationBuffer();
CSoundFile& rSf = *m_pModDoc->GetSoundFile();
- if (nSeq == MAX_SEQUENCES + 1)
+ if (nSeq == MAX_SEQUENCES + 2)
{
CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), rSf.Order.m_sName);
CString str;
@@ -1379,8 +1382,8 @@
return;
}
}
- else if (nSeq == MAX_SEQUENCES)
- rSf.Order.AddSequence();
+ else if (nSeq == MAX_SEQUENCES || nSeq == MAX_SEQUENCES + 1)
+ rSf.Order.AddSequence((nSeq == MAX_SEQUENCES));
else if (nSeq < rSf.Order.GetNumSequences())
rSf.Order.SetSequence(nSeq);
ORDERINDEX nPosCandidate = rSf.Order.GetLengthTailTrimmed() - 1;
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2010-02-20 16:32:10 UTC (rev 500)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-02-20 19:20:37 UTC (rev 501)
@@ -2333,8 +2333,8 @@
{
AppendMenu(hMenu, MF_STRING, ID_MODTREE_SWITCHTO, "&Switch to Seqeuence");
}
- AppendMenu(hMenu, MF_STRING, ID_MODTREE_INSERT, "&Insert Sequence");
- AppendMenu(hMenu, MF_STRING, ID_MODTREE_DUPLICATE, "D&uplicate Sequence");
+ AppendMenu(hMenu, MF_STRING | (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES ? 0 : MF_GRAYED), ID_MODTREE_INSERT, "&Insert Sequence");
+ AppendMenu(hMenu, MF_STRING | (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES ? 0 : MF_GRAYED), ID_MODTREE_DUPLICATE , "D&uplicate Sequence");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_REMOVE, "&Delete Sequence");
}
break;
@@ -2867,6 +2867,7 @@
{
pSndFile->Order.SetSequence((SEQUENCEINDEX)modItemID);
pSndFile->Order.AddSequence(true);
+ pModDoc->SetModified();
UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SEQNAMES|HINT_MODSEQUENCE);
pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES|HINT_MODSEQUENCE);
}
@@ -2889,6 +2890,7 @@
if (pModDoc && pSndFile && ((modItemType == MODITEM_SEQUENCE) || (modItemType == MODITEM_HDR_ORDERS)))
{
pSndFile->Order.AddSequence(false);
+ pModDoc->SetModified();
UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SEQNAMES|HINT_MODSEQUENCE);
pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES|HINT_MODSEQUENCE);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-20 16:32:19
|
Revision: 500
http://modplug.svn.sourceforge.net/modplug/?rev=500&view=rev
Author: saga-games
Date: 2010-02-20 16:32:10 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
[Fix] Comments Tab: When editing sample / instrument names, they are limited properly now.
[Fix] Orderlist Editor: Fixed possible logical error when moving orders (don't think that anything happened due to the && vs. ||, though)
[Imp] Playback: When PT1x flag is activated, Amiga note range limits are automatically taken into account.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/view_com.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-17 20:38:04 UTC (rev 499)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-20 16:32:10 UTC (rev 500)
@@ -897,7 +897,7 @@
// drop before or after the selection
bool bMoveBack = !(m_nDragOrder < (UINT)m_nDropPos);
// don't do anything if drop position is inside the selection
- if(m_nDropPos >= selection.nOrdLo && m_nDropPos <= selection.nOrdHi || m_nDragOrder == m_nDropPos) return;
+ if((m_nDropPos >= selection.nOrdLo && m_nDropPos <= selection.nOrdHi) || m_nDragOrder == m_nDropPos) return;
// drag one order or multiple orders?
bool bMultiSelection = (selection.nOrdLo != selection.nOrdHi);
@@ -922,7 +922,7 @@
SetCurSel((bMoveBack && (!bSelection)) ? m_nDropPos - 1 : m_nDropPos);
} else
{
- SetCurSel(((m_nDragOrder < (UINT)m_nDropPos) && (!bSelection)) ? m_nDropPos - 1 : m_nDropPos);
+ SetCurSel(((m_nDragOrder < m_nDropPos) && (!bSelection)) ? m_nDropPos - 1 : m_nDropPos);
}
m_pModDoc->SetModified();
}
Modified: trunk/OpenMPT/mptrack/view_com.cpp
===================================================================
--- trunk/OpenMPT/mptrack/view_com.cpp 2010-02-17 20:38:04 UTC (rev 499)
+++ trunk/OpenMPT/mptrack/view_com.cpp 2010-02-20 16:32:10 UTC (rev 500)
@@ -486,25 +486,30 @@
UINT iItem = plvItem->iItem;
CSoundFile *pSndFile = pModDoc->GetSoundFile();
lstrcpyn(s, plvItem->pszText, sizeof(s));
- for (UINT i=strlen(s); i<sizeof(s); i++) s[i] = 0;
+
+ size_t maxStrLen = (m_nListId == IDC_LIST_SAMPLES) ? pSndFile->GetModSpecifications().sampleNameLengthMax : pSndFile->GetModSpecifications().instrNameLengthMax;
+
+ for (size_t i = min(maxStrLen, strlen(s)); i < sizeof(s); i++)
+ s[i] = 0;
+
if (m_nListId == IDC_LIST_SAMPLES)
{
if (iItem < pSndFile->m_nSamples)
{
- s[31] = 0;
- memcpy(pSndFile->m_szNames[iItem+1], s, 32);
+ memcpy(pSndFile->m_szNames[iItem + 1], s, sizeof(pSndFile->m_szNames[iItem + 1]));
+ SetNullTerminator(pSndFile->m_szNames[iItem + 1]);
// 05/01/05 : ericus replaced "<< 24" by "<< 20" : 4000 samples -> 12bits [see Moddoc.h]
- pModDoc->UpdateAllViews(this, ((iItem+1) << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this);
+ pModDoc->UpdateAllViews(this, ((iItem + 1) << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this);
}
} else
if (m_nListId == IDC_LIST_INSTRUMENTS)
{
- if ((iItem < pSndFile->m_nInstruments) && (pSndFile->Instruments[iItem+1]))
+ if ((iItem < pSndFile->m_nInstruments) && (pSndFile->Instruments[iItem + 1]))
{
MODINSTRUMENT *pIns = pSndFile->Instruments[iItem+1];
- s[31] = 0;
- memcpy(pIns->name, s, 32);
- pModDoc->UpdateAllViews(this, ((iItem+1) << HINT_SHIFT_INS) | (HINT_INSNAMES|HINT_INSTRUMENT), this);
+ memcpy(pIns->name, s, sizeof(pIns->name));
+ SetNullTerminator(pIns->name);
+ pModDoc->UpdateAllViews(this, ((iItem + 1) << HINT_SHIFT_INS) | (HINT_INSNAMES|HINT_INSTRUMENT), this);
}
} else
{
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-02-17 20:38:04 UTC (rev 499)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-02-20 16:32:10 UTC (rev 500)
@@ -1259,7 +1259,7 @@
}
// Preserve Amiga freq limits
- if (m_dwSongFlags & SONG_AMIGALIMITS)
+ if (m_dwSongFlags & (SONG_AMIGALIMITS|SONG_PT1XMODE))
period = CLAMP(period, 113 * 4, 856 * 4);
// Pitch/Filter Envelope
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-17 20:38:13
|
Revision: 499
http://modplug.svn.sourceforge.net/modplug/?rev=499&view=rev
Author: saga-games
Date: 2010-02-17 20:38:04 +0000 (Wed, 17 Feb 2010)
Log Message:
-----------
[New] Sample Editor: Shift+New = Clone sample slot
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-02-17 14:49:47 UTC (rev 498)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-02-17 20:38:04 UTC (rev 499)
@@ -883,11 +883,27 @@
void CCtrlSamples::OnSampleNew()
//------------------------------
{
- LONG smp = m_pModDoc->InsertSample(TRUE);
+ bool bDuplicate = CMainFrame::GetInputHandler()->ShiftPressed();
+
+ SAMPLEINDEX smp = m_pModDoc->InsertSample(true);
if (smp != SAMPLEINDEX_INVALID)
{
+ SAMPLEINDEX nOldSmp = m_nSample;
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
SetCurrentSample(smp);
+
+ if(bDuplicate && nOldSmp >= 1 && nOldSmp < MAX_SAMPLES)
+ {
+ m_pModDoc->GetSampleUndo()->PrepareUndo(smp, sundo_replace);
+ memcpy(&m_pSndFile->Samples[smp], &m_pSndFile->Samples[nOldSmp], sizeof(MODSAMPLE));
+ strcpy(m_pSndFile->m_szNames[smp], m_pSndFile->m_szNames[nOldSmp]);
+ // clone sample.
+ if((m_pSndFile->Samples[smp].pSample = CSoundFile::AllocateSample(m_pSndFile->Samples[nOldSmp].GetSampleSizeInBytes())) != nullptr)
+ {
+ memcpy(m_pSndFile->Samples[smp].pSample, m_pSndFile->Samples[nOldSmp].pSample, m_pSndFile->Samples[nOldSmp].GetSampleSizeInBytes());
+ }
+ }
+
// 05/01/05 : ericus replaced "m_nSample << 24" by "m_nSample << 20" : 4000 samples -> 12bits [see Moddoc.h]
m_pModDoc->UpdateAllViews(NULL, (smp << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES);
if ((pSndFile->m_nInstruments) && (!m_pModDoc->FindSampleParent(smp)))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-17 14:49:57
|
Revision: 498
http://modplug.svn.sourceforge.net/modplug/?rev=498&view=rev
Author: saga-games
Date: 2010-02-17 14:49:47 +0000 (Wed, 17 Feb 2010)
Log Message:
-----------
[Imp] Sample Editor: When enabling (sustain) loop and no loop points are set yet, automatically set loop to full sample length.
[Ref] Added some useful stuff from SchismTracker to the code that will be necessary for further backports.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/modcommand.h
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-02-17 09:10:14 UTC (rev 497)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-02-17 14:49:47 UTC (rev 498)
@@ -2540,6 +2540,7 @@
if ((IsLocked()) || (!m_pSndFile)) return;
int n = m_ComboLoopType.GetCurSel();
MODSAMPLE *pSmp = &m_pSndFile->Samples[m_nSample];
+ bool wasDisabled = (pSmp->uFlags & CHN_LOOP) == 0;
switch(n)
{
case 0: // Off
@@ -2553,6 +2554,12 @@
pSmp->uFlags |= CHN_LOOP|CHN_PINGPONGLOOP;
break;
}
+ // set loop points if theren't any
+ if(wasDisabled && ((pSmp->uFlags & CHN_LOOP) != 0) && (pSmp->nLoopStart == pSmp->nLoopEnd) && (pSmp->nLoopStart == 0))
+ {
+ pSmp->nLoopEnd = pSmp->nLength;
+ m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
+ }
m_pModDoc->AdjustEndOfSample(m_nSample);
m_pModDoc->SetModified();
}
@@ -2608,6 +2615,7 @@
if ((IsLocked()) || (!m_pSndFile)) return;
int n = m_ComboSustainType.GetCurSel();
MODSAMPLE *pSmp = &m_pSndFile->Samples[m_nSample];
+ bool wasDisabled = (pSmp->uFlags & CHN_SUSTAINLOOP) == 0;
switch(n)
{
case 0: // Off
@@ -2621,6 +2629,12 @@
pSmp->uFlags |= CHN_SUSTAINLOOP|CHN_PINGPONGSUSTAIN;
break;
}
+ // set sustain loop points if theren't any
+ if(wasDisabled && ((pSmp->uFlags & CHN_SUSTAINLOOP) != 0) && (pSmp->nSustainStart == pSmp->nSustainEnd) && (pSmp->nSustainStart == 0))
+ {
+ pSmp->nSustainEnd = pSmp->nLength;
+ m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL);
+ }
m_pModDoc->SetModified();
}
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-02-17 09:10:14 UTC (rev 497)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-02-17 14:49:47 UTC (rev 498)
@@ -3776,4 +3776,53 @@
if(CSoundFile::GetModSpecifications(nNewType).HasVolCommand(m->volcmd) == false)
m->volcmd = CMD_NONE;
+}
+
+
+// "importance" of every FX command. Table is used for importing from formats with multiple effect colums
+// and is approximately the same as in SchismTracker.
+uint16 CSoundFile::GetEffectWeight(MODCOMMAND::COMMAND cmd)
+//---------------------------------------------------------
+{
+ switch(cmd)
+ {
+ case CMD_PATTERNBREAK: return 288;
+ case CMD_POSITIONJUMP: return 280;
+ case CMD_SPEED: return 272;
+ case CMD_TEMPO: return 264;
+ case CMD_GLOBALVOLUME: return 256;
+ case CMD_GLOBALVOLSLIDE: return 248;
+ case CMD_CHANNELVOLUME: return 240;
+ case CMD_CHANNELVOLSLIDE: return 232;
+ case CMD_TONEPORTAVOL: return 224;
+ case CMD_TONEPORTAMENTO: return 216;
+ case CMD_ARPEGGIO: return 208;
+ case CMD_RETRIG: return 200;
+ case CMD_TREMOR: return 192;
+ case CMD_OFFSET: return 184;
+ case CMD_VOLUME: return 176;
+ case CMD_VIBRATOVOL: return 168;
+ case CMD_VOLUMESLIDE: return 160;
+ case CMD_PORTAMENTODOWN: return 152;
+ case CMD_PORTAMENTOUP: return 133;
+ case CMD_NOTESLIDEDOWN: return 136;
+ case CMD_NOTESLIDEUP: return 128;
+ case CMD_PANNING8: return 120;
+ case CMD_PANNINGSLIDE: return 112;
+ case CMD_SMOOTHMIDI: return 104;
+ case CMD_MIDI: return 96;
+ case CMD_MODCMDEX: return 88;
+ case CMD_S3MCMDEX: return 80;
+ case CMD_PANBRELLO: return 72;
+ case CMD_XFINEPORTAUPDOWN: return 64;
+ case CMD_VIBRATO: return 56;
+ case CMD_FINEVIBRATO: return 48;
+ case CMD_TREMOLO: return 40;
+ case CMD_KEYOFF: return 32;
+ case CMD_SETENVPOSITION: return 24;
+ case CMD_VELOCITY: return 16;
+ case CMD_XPARAM: return 8;
+ case CMD_NONE:
+ default: return 0;
+ }
}
\ No newline at end of file
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-02-17 09:10:14 UTC (rev 497)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-02-17 14:49:47 UTC (rev 498)
@@ -964,6 +964,11 @@
void HandlePatternTransitionEvents();
void BuildDefaultInstrument();
long GetSampleOffset();
+
+public:
+ // "importance" of every FX command. Table is used for importing from formats with multiple effect colums
+ // and is approximately the same as in SchismTracker.
+ static uint16 CSoundFile::GetEffectWeight(MODCOMMAND::COMMAND cmd);
};
#pragma warning(default : 4324) //structure was padded due to __declspec(align())
Modified: trunk/OpenMPT/soundlib/modcommand.h
===================================================================
--- trunk/OpenMPT/soundlib/modcommand.h 2010-02-17 09:10:14 UTC (rev 497)
+++ trunk/OpenMPT/soundlib/modcommand.h 2010-02-17 14:49:47 UTC (rev 498)
@@ -59,6 +59,17 @@
// Returns true if and only if note is NOTE_PC or NOTE_PCS.
bool IsPcNote() const {return note == NOTE_PC || note == NOTE_PCS;}
+ // Swap volume and effect column (doesn't do any conversion as it's mainly for importing formats with multiple effect columns, so beware!)
+ void SwapEffects()
+ {
+ VOLCMD vcold = volcmd;
+ VOL vold = vol;
+ volcmd = command;
+ vol = param;
+ command = vcold;
+ param = vold;
+ }
+
public:
BYTE note;
BYTE instr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-17 09:10:23
|
Revision: 497
http://modplug.svn.sourceforge.net/modplug/?rev=497&view=rev
Author: saga-games
Date: 2010-02-17 09:10:14 +0000 (Wed, 17 Feb 2010)
Log Message:
-----------
[Fix] IT Compatibility: Default Vibrato/Tremolo/Panbrello values to sine if out of range (e.g. S35)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-02-15 21:55:55 UTC (rev 496)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-02-17 09:10:14 UTC (rev 497)
@@ -2570,7 +2570,7 @@
// EDx: Note Delay
// EEx: Pattern Delay
case 0xF0:
- if((m_nType & MOD_TYPE_MOD) != 0) // MOD: Invert Loop
+ if(GetType() == MOD_TYPE_MOD) // MOD: Invert Loop
{
pChn->nEFxSpeed = param;
if(m_dwSongFlags & SONG_FIRSTTICK) InvertLoop(pChn);
@@ -2607,7 +2607,10 @@
pChn->nVibratoType = param & 0x03;
} else
{
- if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nVibratoType = param & 0x07;
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ pChn->nVibratoType = (param < 0x04) ? param : 0;
+ else
+ pChn->nVibratoType = param & 0x07;
}
break;
// S4x: Set Tremolo Waveform
@@ -2616,11 +2619,18 @@
pChn->nTremoloType = param & 0x03;
} else
{
- if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nTremoloType = param & 0x07;
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ pChn->nTremoloType = (param < 0x04) ? param : 0;
+ else
+ pChn->nTremoloType = param & 0x07;
}
break;
// S5x: Set Panbrello Waveform
- case 0x50: if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nPanbrelloType = param & 0x07; break;
+ case 0x50: if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ pChn->nPanbrelloType = (param < 0x04) ? param : 0;
+ else
+ pChn->nPanbrelloType = param & 0x07;
+ break;
// S6x: Pattern Delay for x frames
case 0x60: m_nFrameDelay = param; break;
// S7x: Envelope Control / Instrument Control
@@ -3290,7 +3300,11 @@
bool bResetEnv = false;
if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))
{
- if ((pChn->nRowInstr) && (param < 0x100)) { InstrumentChange(pChn, pChn->nRowInstr, FALSE, FALSE); bResetEnv = true; }
+ if ((pChn->nRowInstr) && (param < 0x100))
+ {
+ InstrumentChange(pChn, pChn->nRowInstr, FALSE, FALSE);
+ bResetEnv = true;
+ }
if (param < 0x100) bResetEnv = true;
}
NoteChange(nChn, nNote, IsCompatibleMode(TRK_IMPULSETRACKER) ? true : false, bResetEnv);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-15 21:56:04
|
Revision: 496
http://modplug.svn.sourceforge.net/modplug/?rev=496&view=rev
Author: saga-games
Date: 2010-02-15 21:55:55 +0000 (Mon, 15 Feb 2010)
Log Message:
-----------
[Fix] S3M compatibility: Slightly better handling of vibrato/tremolo waveform types (although the ST3 help screen says that continuous vibrato/tremolo is possible, it does actually not work.)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-02-15 21:05:01 UTC (rev 495)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-02-15 21:55:55 UTC (rev 496)
@@ -734,8 +734,17 @@
pChn->nPos = 0;
pChn->nPosLo = 0;
// Handle "retrigger" waveform type
- if (pChn->nVibratoType < 4) pChn->nVibratoPos = ((!IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER)) && (m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS))) ? 0x10 : 0;
- if(!IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER) && pChn->nTremoloType < 4) pChn->nTremoloPos = 0;
+ if (pChn->nVibratoType < 4)
+ {
+ if(!IsCompatibleMode(TRK_IMPULSETRACKER) && (GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS)))
+ pChn->nVibratoPos = 0x10;
+ else
+ pChn->nVibratoPos = 0;
+ }
+ if(!IsCompatibleMode(TRK_IMPULSETRACKER) && pChn->nTremoloType < 4)
+ {
+ pChn->nTremoloPos = 0;
+ }
}
if (pChn->nPos >= pChn->nLength) pChn->nPos = pChn->nLoopStart;
}
@@ -2592,11 +2601,25 @@
pChn->nFineTune = MOD2XMFineTune(param);
if (pChn->nPeriod) pChn->nPeriod = GetPeriodFromNote(pChn->nNote, pChn->nFineTune, pChn->nC5Speed);
break;
- // S3x: Set Vibrato WaveForm
- case 0x30: if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nVibratoType = param & 0x07; break;
- // S4x: Set Tremolo WaveForm
- case 0x40: if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nTremoloType = param & 0x07; break;
- // S5x: Set Panbrello WaveForm
+ // S3x: Set Vibrato Waveform
+ case 0x30: if(GetType() == MOD_TYPE_S3M)
+ {
+ pChn->nVibratoType = param & 0x03;
+ } else
+ {
+ if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nVibratoType = param & 0x07;
+ }
+ break;
+ // S4x: Set Tremolo Waveform
+ case 0x40: if(GetType() == MOD_TYPE_S3M)
+ {
+ pChn->nTremoloType = param & 0x03;
+ } else
+ {
+ if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nTremoloType = param & 0x07;
+ }
+ break;
+ // S5x: Set Panbrello Waveform
case 0x50: if(((param & 0x0F) < 0x04) || !IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nPanbrelloType = param & 0x07; break;
// S6x: Pattern Delay for x frames
case 0x60: m_nFrameDelay = param; break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2010-02-15 21:05:10
|
Revision: 495
http://modplug.svn.sourceforge.net/modplug/?rev=495&view=rev
Author: relabsoluness
Date: 2010-02-15 21:05:01 +0000 (Mon, 15 Feb 2010)
Log Message:
-----------
[Fix] Pattern Editor: status bar change done in r485 is now applied also when using hex-display.
[Fix] VST: Returned host CanDo-values were wrong (since pre RC1 era).
[Mod] ITP: Removed 'terminate loading on newer version'-functionality introduced in r493.
[Mod] Version: Changed version to 1.18.00.01
[Mod] Misc: Some minor changes.
[Svn] TortoiseSVN setting logminsize is now defined to prevent commits with empty log message.
Instrument extension handling:
[Mod] 'dF..' extension uses the old(pre 1.18.00.00) format again.
[Mod] Limit envpoints to 32 on saving if possible.
[Fix] Loading PFLG, AFLG and VFLG entries was broken (since they were introduced?).
[Fix] 'dF..' conversion was faulty (introduced in r483).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Sampleio.cpp
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Property Changed:
----------------
trunk/OpenMPT/
Property changes on: trunk/OpenMPT
___________________________________________________________________
Added: tsvn:logminsize
+ 10
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-15 21:05:01 UTC (rev 495)
@@ -698,7 +698,7 @@
s[0] = 0;
if(CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY)
{
- wsprintf(s, "Position %02Xh of %02Xh", m_nScrollPos, pSndFile->Order.GetLengthFirstEmpty());
+ wsprintf(s, "Position %02Xh of %02Xh", m_nScrollPos, pSndFile->Order.GetLengthTailTrimmed());
}
else
{
@@ -709,7 +709,7 @@
if (m_nScrollPos < pSndFile->Order.GetLength())
{
- UINT nPat = pSndFile->Order[m_nScrollPos];
+ PATTERNINDEX nPat = pSndFile->Order[m_nScrollPos];
if ((nPat < pSndFile->Patterns.Size()) && (nPat < pSndFile->m_nPatternNames))
{
CHAR szpat[40] = "";
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-02-15 21:05:01 UTC (rev 495)
@@ -645,6 +645,13 @@
Log("VST plugin to host: Eff: 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt);
#endif
+ enum HostCanDo
+ {
+ HostDoNotKnow = 0,
+ HostCanDo = 1,
+ HostCanNotDo = -1
+ };
+
switch(opcode)
{
// Called when plugin param is changed via gui
@@ -929,14 +936,14 @@
//"asyncProcessing",
//"offline",
//"supportShell"
- if (!(strcmp((char*)ptr,"sendVstEvents")==0 ||
+ if ((strcmp((char*)ptr,"sendVstEvents")==0 ||
strcmp((char*)ptr,"sendVstMidiEvent")==0 ||
strcmp((char*)ptr,"sendVstTimeInfo")==0 ||
strcmp((char*)ptr,"supplyIdle")==0 ||
strcmp((char*)ptr,"sizeWindow")==0))
- return 1;
+ return HostCanDo;
else
- return -1;
+ return HostCanNotDo;
//
case audioMasterGetLanguage:
return kVstLangEnglish;
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/mptrack/version.h 2010-02-15 21:05:01 UTC (rev 495)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 18
#define VER_MINOR 00
-#define VER_MINORMINOR 00
+#define VER_MINORMINOR 01
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-15 21:05:01 UTC (rev 495)
@@ -457,9 +457,6 @@
version = id;
streamPos += sizeof(DWORD);
- if(version > ITP_VERSION)
- return false;
-
m_nType = MOD_TYPE_IT;
// Song name
@@ -850,11 +847,6 @@
default:
ptr += sizeof(__int32); // jump field code
ReadExtendedInstrumentProperty(Instruments[i], fcode, ptr, lpStream + dwMemLength);
- // fix old instrument flags which got broken in OpenMPT 1.17.03.03 due to refactoring (rev 415).
- if(version == 0x00000101 && fcode == 'dF..')
- {
- ConvertOldExtendedFlagFormat(Instruments[i]);
- }
break;
}
}
@@ -3526,7 +3518,7 @@
fwrite(&size, 1, sizeof(__int16), f);
fwrite(&m_dwCreatedWithVersion, 1, size, f);
- code = 'LSWV'; //write m_dwCreatedWithVersion
+ code = 'LSWV'; //write m_dwLastSavedWithVersion
fwrite(&code, 1, sizeof(__int32), f);
size = sizeof(m_dwLastSavedWithVersion);
fwrite(&size, 1, sizeof(__int16), f);
Modified: trunk/OpenMPT/soundlib/Sampleio.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-02-15 21:05:01 UTC (rev 495)
@@ -2021,6 +2021,9 @@
if(fadr && code != 'K[..') // copy field data in instrument's header
memcpy(fadr,ptr,size); // (except for keyboard mapping)
ptr += size; // jump field
+
+ if (code == 'dF..' && fadr != nullptr) // 'dF..' field requires additional processing.
+ ConvertReadExtendedFlags(pIns);
}
@@ -2056,8 +2059,6 @@
// Seek for supported extended settings header
if( code == 'MPTX' )
{
- bool newFormat = false; // new flag format (separate flags for envelopes)
- bool hasFlags = false; // do we really need to convert the flags?
pData += sizeof(code); // jump extension header code
while( (uintptr_t)(pData - pDataStart) <= nMemLength - 4)
@@ -2065,39 +2066,31 @@
memcpy(&code, pData, sizeof(code)); // read field code
pData += sizeof(code); // jump field code
ReadExtendedInstrumentProperty(pIns, code, pData, pEnd);
- if(code == 'VFLG')
- newFormat = true;
- if(code == 'dF..')
- hasFlags = true;
}
- if(!newFormat && hasFlags)
- {
- ConvertOldExtendedFlagFormat(pIns);
- }
}
}
-void ConvertOldExtendedFlagFormat(MODINSTRUMENT *pIns)
-//----------------------------------------------------
+void ConvertReadExtendedFlags(MODINSTRUMENT *pIns)
+//------------------------------------------------
{
- DWORD dwOldFlags = pIns->dwFlags;
+ const DWORD dwOldFlags = pIns->dwFlags;
pIns->dwFlags = pIns->VolEnv.dwFlags = pIns->PanEnv.dwFlags = pIns->PitchEnv.dwFlags = 0;
- if(dwOldFlags & 0x0001) pIns->VolEnv.dwFlags |= ENV_ENABLED;
- if(dwOldFlags & 0x0002) pIns->VolEnv.dwFlags |= ENV_SUSTAIN;
- if(dwOldFlags & 0x0004) pIns->VolEnv.dwFlags |= ENV_LOOP;
- if(dwOldFlags & 0x0008) pIns->PanEnv.dwFlags |= ENV_ENABLED;
- if(dwOldFlags & 0x0010) pIns->PanEnv.dwFlags |= ENV_SUSTAIN;
- if(dwOldFlags & 0x0020) pIns->PanEnv.dwFlags |= ENV_LOOP;
- if(dwOldFlags & 0x0040) pIns->PitchEnv.dwFlags |= ENV_ENABLED;
- if(dwOldFlags & 0x0080) pIns->PitchEnv.dwFlags |= ENV_SUSTAIN;
- if(dwOldFlags & 0x0100) pIns->VolEnv.dwFlags |= ENV_LOOP;
- if(dwOldFlags & 0x0200) pIns->dwFlags |= INS_SETPANNING;
- if(dwOldFlags & 0x0400) pIns->PitchEnv.dwFlags |= ENV_FILTER;
- if(dwOldFlags & 0x0800) pIns->VolEnv.dwFlags |= ENV_CARRY;
- if(dwOldFlags & 0x1000) pIns->PanEnv.dwFlags |= ENV_CARRY;
- if(dwOldFlags & 0x2000) pIns->PitchEnv.dwFlags |= ENV_CARRY;
- if(dwOldFlags & 0x4000) pIns->dwFlags |= INS_MUTE;
+ if(dwOldFlags & dFdd_VOLUME) pIns->VolEnv.dwFlags |= ENV_ENABLED;
+ if(dwOldFlags & dFdd_VOLSUSTAIN) pIns->VolEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwOldFlags & dFdd_VOLLOOP) pIns->VolEnv.dwFlags |= ENV_LOOP;
+ if(dwOldFlags & dFdd_PANNING) pIns->PanEnv.dwFlags |= ENV_ENABLED;
+ if(dwOldFlags & dFdd_PANSUSTAIN) pIns->PanEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwOldFlags & dFdd_PANLOOP) pIns->PanEnv.dwFlags |= ENV_LOOP;
+ if(dwOldFlags & dFdd_PITCH) pIns->PitchEnv.dwFlags |= ENV_ENABLED;
+ if(dwOldFlags & dFdd_PITCHSUSTAIN) pIns->PitchEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwOldFlags & dFdd_PITCHLOOP) pIns->PitchEnv.dwFlags |= ENV_LOOP;
+ if(dwOldFlags & dFdd_SETPANNING) pIns->dwFlags |= INS_SETPANNING;
+ if(dwOldFlags & dFdd_FILTER) pIns->PitchEnv.dwFlags |= ENV_FILTER;
+ if(dwOldFlags & dFdd_VOLCARRY) pIns->VolEnv.dwFlags |= ENV_CARRY;
+ if(dwOldFlags & dFdd_PANCARRY) pIns->PanEnv.dwFlags |= ENV_CARRY;
+ if(dwOldFlags & dFdd_PITCHCARRY) pIns->PitchEnv.dwFlags |= ENV_CARRY;
+ if(dwOldFlags & dFdd_MUTE) pIns->dwFlags |= INS_MUTE;
}
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2010-02-15 21:05:01 UTC (rev 495)
@@ -167,10 +167,30 @@
#define ENV_CARRY 0x08 // env carry
#define ENV_FILTER 0x10 // filter env enabled (this has to be combined with ENV_ENABLED in the pitch envelope's flags)
+
+// Flags of 'dF..' datafield in extended instrument properties.
+#define dFdd_VOLUME 0x0001
+#define dFdd_VOLSUSTAIN 0x0002
+#define dFdd_VOLLOOP 0x0004
+#define dFdd_PANNING 0x0008
+#define dFdd_PANSUSTAIN 0x0010
+#define dFdd_PANLOOP 0x0020
+#define dFdd_PITCH 0x0040
+#define dFdd_PITCHSUSTAIN 0x0080
+#define dFdd_PITCHLOOP 0x0100
+#define dFdd_SETPANNING 0x0200
+#define dFdd_FILTER 0x0400
+#define dFdd_VOLCARRY 0x0800
+#define dFdd_PANCARRY 0x1000
+#define dFdd_PITCHCARRY 0x2000
+#define dFdd_MUTE 0x4000
+
+
// instrument-specific flags
#define INS_SETPANNING 0x01 // panning enabled
-#define INS_MUTE 0x02 // instrumentd is muted
+#define INS_MUTE 0x02 // instrument is muted
+
// envelope types in instrument editor
enum enmEnvelopeTypes
{
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-02-15 21:05:01 UTC (rev 495)
@@ -153,7 +153,7 @@
IFC. nIFC;
IFR. nIFR;
K[. Keyboard[128];
-LSWV [EXT] nPlugMixMode
+LSWV [EXT] Last Saved With Version
MB.. wMidiBank;
MC.. nMidiChannel;
MDK. nMidiDrumKey;
@@ -219,6 +219,7 @@
// Convenient macro to help WRITE_HEADER declaration for single type members ONLY (non-array)
// --------------------------------------------------------------------------------------------
#define WRITE_MPTHEADER_sized_member(name,type,code) \
+static_assert(sizeof(input->name) >= sizeof(type), "");\
fcode = #@code;\
fwrite(& fcode , 1 , sizeof( __int32 ) , file);\
fsize = sizeof( type );\
@@ -229,19 +230,55 @@
// Convenient macro to help WRITE_HEADER declaration for array members ONLY
// --------------------------------------------------------------------------------------------
#define WRITE_MPTHEADER_array_member(name,type,code,arraysize) \
+ASSERT(sizeof(input->name) >= sizeof(type) * arraysize);\
fcode = #@code;\
fwrite(& fcode , 1 , sizeof( __int32 ) , file);\
fsize = sizeof( type ) * arraysize;\
fwrite(& fsize , 1 , sizeof( __int16 ) , file);\
fwrite(&input-> name , 1 , fsize , file);
+namespace {
+// Create 'dF..' entry.
+DWORD CreateExtensionFlags(const MODINSTRUMENT& ins)
+//--------------------------------------------------
+{
+ DWORD dwFlags = 0;
+ if (ins.VolEnv.dwFlags & ENV_ENABLED) dwFlags |= dFdd_VOLUME;
+ if (ins.VolEnv.dwFlags & ENV_SUSTAIN) dwFlags |= dFdd_VOLSUSTAIN;
+ if (ins.VolEnv.dwFlags & ENV_LOOP) dwFlags |= dFdd_VOLLOOP;
+ if (ins.PanEnv.dwFlags & ENV_ENABLED) dwFlags |= dFdd_PANNING;
+ if (ins.PanEnv.dwFlags & ENV_SUSTAIN) dwFlags |= dFdd_PANSUSTAIN;
+ if (ins.PanEnv.dwFlags & ENV_LOOP) dwFlags |= dFdd_PANLOOP;
+ if (ins.PitchEnv.dwFlags & ENV_ENABLED) dwFlags |= dFdd_PITCH;
+ if (ins.PitchEnv.dwFlags & ENV_SUSTAIN) dwFlags |= dFdd_PITCHSUSTAIN;
+ if (ins.PitchEnv.dwFlags & ENV_LOOP) dwFlags |= dFdd_PITCHLOOP;
+ if (ins.dwFlags & INS_SETPANNING) dwFlags |= dFdd_SETPANNING;
+ if (ins.PitchEnv.dwFlags & ENV_FILTER) dwFlags |= dFdd_FILTER;
+ if (ins.VolEnv.dwFlags & ENV_CARRY) dwFlags |= dFdd_VOLCARRY;
+ if (ins.PanEnv.dwFlags & ENV_CARRY) dwFlags |= dFdd_PANCARRY;
+ if (ins.PitchEnv.dwFlags & ENV_CARRY) dwFlags |= dFdd_PITCHCARRY;
+ if (ins.dwFlags & INS_MUTE) dwFlags |= dFdd_MUTE;
+ return dwFlags;
+}
+} // unnamed namespace.
+
// Write (in 'file') 'input' MODINSTRUMENT with 'code' & 'size' extra field infos for each member
void WriteInstrumentHeaderStruct(MODINSTRUMENT * input, FILE * file)
{
__int32 fcode;
__int16 fsize;
WRITE_MPTHEADER_sized_member( nFadeOut , UINT , FO.. )
-WRITE_MPTHEADER_sized_member( dwFlags , DWORD , dF.. )
+
+{ // dwFlags needs to be constructed so write it manually.
+ //WRITE_MPTHEADER_sized_member( dwFlags , DWORD , dF.. )
+ const DWORD dwFlags = CreateExtensionFlags(*input);
+ fcode = 'dF..';
+ fwrite(&fcode, 1, sizeof(int32), file);
+ fsize = sizeof(dwFlags);
+ fwrite(&fsize, 1, sizeof(int16), file);
+ fwrite(&dwFlags, 1, fsize, file);
+}
+
WRITE_MPTHEADER_sized_member( nGlobalVol , UINT , GV.. )
WRITE_MPTHEADER_sized_member( nPan , UINT , P... )
WRITE_MPTHEADER_sized_member( VolEnv.nNodes , UINT , VE.. )
@@ -272,12 +309,12 @@
WRITE_MPTHEADER_sized_member( nMidiDrumKey , BYTE , MDK. )
WRITE_MPTHEADER_sized_member( nPPS , signed char , PPS. )
WRITE_MPTHEADER_sized_member( nPPC , unsigned char , PPC. )
-WRITE_MPTHEADER_array_member( VolEnv.Ticks , WORD , VP[. , MAX_ENVPOINTS )
-WRITE_MPTHEADER_array_member( PanEnv.Ticks , WORD , PP[. , MAX_ENVPOINTS )
-WRITE_MPTHEADER_array_member( PitchEnv.Ticks , WORD , PiP[ , MAX_ENVPOINTS )
-WRITE_MPTHEADER_array_member( VolEnv.Values , BYTE , VE[. , MAX_ENVPOINTS )
-WRITE_MPTHEADER_array_member( PanEnv.Values , BYTE , PE[. , MAX_ENVPOINTS )
-WRITE_MPTHEADER_array_member( PitchEnv.Values , BYTE , PiE[ , MAX_ENVPOINTS )
+WRITE_MPTHEADER_array_member( VolEnv.Ticks , WORD , VP[. , ((input->VolEnv.nNodes > 32) ? MAX_ENVPOINTS : 32))
+WRITE_MPTHEADER_array_member( PanEnv.Ticks , WORD , PP[. , ((input->PanEnv.nNodes > 32) ? MAX_ENVPOINTS : 32))
+WRITE_MPTHEADER_array_member( PitchEnv.Ticks , WORD , PiP[ , ((input->PitchEnv.nNodes > 32) ? MAX_ENVPOINTS : 32))
+WRITE_MPTHEADER_array_member( VolEnv.Values , BYTE , VE[. , ((input->VolEnv.nNodes > 32) ? MAX_ENVPOINTS : 32))
+WRITE_MPTHEADER_array_member( PanEnv.Values , BYTE , PE[. , ((input->PanEnv.nNodes > 32) ? MAX_ENVPOINTS : 32))
+WRITE_MPTHEADER_array_member( PitchEnv.Values , BYTE , PiE[ , ((input->PitchEnv.nNodes > 32) ? MAX_ENVPOINTS : 32))
WRITE_MPTHEADER_array_member( NoteMap , BYTE , NM[. , 128 )
WRITE_MPTHEADER_array_member( Keyboard , WORD , K[.. , 128 )
WRITE_MPTHEADER_array_member( name , CHAR , n[.. , 32 )
@@ -376,9 +413,9 @@
GET_MPTHEADER_sized_member( PitchEnv.nReleaseNode , BYTE , PERN )
GET_MPTHEADER_sized_member( PanEnv.nReleaseNode , BYTE , AERN )
GET_MPTHEADER_sized_member( VolEnv.nReleaseNode , BYTE , VERN )
-GET_MPTHEADER_sized_member( PitchEnv.dwFlags , BYTE , PFLG )
-GET_MPTHEADER_sized_member( PanEnv.dwFlags , BYTE , AFLG )
-GET_MPTHEADER_sized_member( VolEnv.dwFlags , BYTE , VFLG )
+GET_MPTHEADER_sized_member( PitchEnv.dwFlags , DWORD , PFLG )
+GET_MPTHEADER_sized_member( PanEnv.dwFlags , DWORD , AFLG )
+GET_MPTHEADER_sized_member( VolEnv.dwFlags , DWORD , VFLG )
}
return pointer;
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-02-14 15:02:53 UTC (rev 494)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-02-15 21:05:01 UTC (rev 495)
@@ -1193,8 +1193,8 @@
// Read extended instrument properties from 'pDataStart' to instrument 'pIns'.
void ReadExtendedInstrumentProperties(MODINSTRUMENT* pIns, const LPCBYTE pDataStart, const size_t nMemLength);
-// Convert old instrument flag format, where all flags used to be stored in one single flag. Now, some flags are stored in envelope-specific flag fields.
-void ConvertOldExtendedFlagFormat(MODINSTRUMENT* pIns);
+// Convert instrument flags which were read from 'dF..' extension to proper internal representation.
+void ConvertReadExtendedFlags(MODINSTRUMENT* pIns);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-14 15:03:04
|
Revision: 494
http://modplug.svn.sourceforge.net/modplug/?rev=494&view=rev
Author: saga-games
Date: 2010-02-14 15:02:53 +0000 (Sun, 14 Feb 2010)
Log Message:
-----------
[Fix] ITP / J2B loader: Sample slot limits were not checked properly.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/IT_DEFS.H
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/load_j2b.cpp
Modified: trunk/OpenMPT/soundlib/IT_DEFS.H
===================================================================
--- trunk/OpenMPT/soundlib/IT_DEFS.H 2010-02-14 00:22:40 UTC (rev 493)
+++ trunk/OpenMPT/soundlib/IT_DEFS.H 2010-02-14 15:02:53 UTC (rev 494)
@@ -140,7 +140,8 @@
extern BYTE autovibit2xm[8];
extern BYTE autovibxm2it[8];
-#define ITP_VERSION 0x00000102 // v1.02
+#define ITP_VERSION 0x00000102 // v1.02
+#define ITP_FILE_ID 0x2e697470 // .itp ASCII
enum IT_ReaderBitMasks {
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-14 00:22:40 UTC (rev 493)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-14 15:02:53 UTC (rev 494)
@@ -450,8 +450,7 @@
// Check file ID
memcpy(&id,lpStream+streamPos,sizeof(DWORD));
- if(id != 0x2e697470) return false; // .itp
- m_nType = MOD_TYPE_IT;
+ if(id != ITP_FILE_ID) return false;
streamPos += sizeof(DWORD);
memcpy(&id,lpStream+streamPos,sizeof(DWORD));
@@ -461,6 +460,8 @@
if(version > ITP_VERSION)
return false;
+ m_nType = MOD_TYPE_IT;
+
// Song name
// name string length
@@ -736,6 +737,9 @@
nsmp = id;
streamPos += sizeof(DWORD);
+ if(nsmp < 1 || nsmp >= MAX_SAMPLES)
+ return false;
+
// Sample struct
memcpy(&pis,lpStream+streamPos,sizeof(ITSAMPLESTRUCT));
streamPos += sizeof(ITSAMPLESTRUCT);
@@ -1554,7 +1558,7 @@
// File ID
- DWORD id = 0x2e697470; // .itp ASCII
+ DWORD id = ITP_FILE_ID;
fwrite(&id, 1, sizeof(id), f);
id = ITP_VERSION;
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2010-02-14 00:22:40 UTC (rev 493)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2010-02-14 15:02:53 UTC (rev 494)
@@ -339,7 +339,7 @@
dwMemPos += sizeof(AMFFCHUNK_INSTRUMENT);
SAMPLEINDEX nSmp = inschunk->sample + 1;
- if(nSmp > MAX_SAMPLES)
+ if(nSmp >= MAX_SAMPLES)
break;
m_nSamples = max(m_nSamples, nSmp);
@@ -398,7 +398,7 @@
dwMemPos += dwHeadlen;
SAMPLEINDEX nSmp = instheadchunk->sample + 1;
- if(nSmp > MAX_SAMPLES)
+ if(nSmp >= MAX_SAMPLES)
break;
m_nSamples = max(m_nSamples, nSmp);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-14 01:10:46
|
Revision: 493
http://modplug.svn.sourceforge.net/modplug/?rev=493&view=rev
Author: saga-games
Date: 2010-02-14 00:22:40 +0000 (Sun, 14 Feb 2010)
Log Message:
-----------
[Mod] Added dialog resources for Sample Generator
[Ref] Mostly cosmetic changes to ITP and GDM loader as well as tagging code
Modified Paths:
--------------
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/mptrack/tagging.cpp
trunk/OpenMPT/mptrack/tagging.h
trunk/OpenMPT/soundlib/IT_DEFS.H
trunk/OpenMPT/soundlib/Load_gdm.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2010-02-14 00:22:40 UTC (rev 493)
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// German (Germany) resources
+// Deutsch (Deutschland) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
@@ -99,7 +99,50 @@
LTEXT "Enabling instrument, volume or octave change will enable the keyboard split feature. These options are applied to the lower section of the keyboard.",IDC_STATIC,6,78,174,24
END
+IDD_SAMPLE_GENERATOR DIALOGEX 0, 0, 304, 191
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Sample Generator"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Mathematical Formula",IDC_STATIC,6,6,294,30
+ EDITTEXT IDC_EDIT_FORMULA,12,18,270,12,ES_AUTOHSCROLL
+ PUSHBUTTON "6",IDC_BUTTON_SHOW_EXPRESSIONS,282,18,12,12
+ GROUPBOX "Sample Parameters",IDC_STATIC,6,42,294,48
+ LTEXT "Sample Length:",IDC_STATIC,12,56,60,8
+ EDITTEXT IDC_EDIT_SAMPLE_LENGTH,108,54,42,12,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "Sample Frequency:",IDC_STATIC,12,74,66,8
+ EDITTEXT IDC_EDIT_SAMPLE_FREQ,108,72,42,12,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "Sample Length in Seconds:",IDC_STATIC,156,56,90,8
+ EDITTEXT IDC_EDIT_SAMPLE_LENGTH_SEC,252,54,42,12,ES_AUTOHSCROLL
+ LTEXT "Size: 9999 KB",IDC_STATIC_SMPSIZE_KB,156,72,138,12
+ GROUPBOX "Clipping Options",IDC_STATIC,6,96,294,66
+ CONTROL "Normalize - All values are accepted and normalized.",IDC_RADIO_SMPCLIP3,
+ "Button",BS_AUTORADIOBUTTON,12,114,270,12
+ CONTROL "Clip - Values in [-1,1] are accepted, other values are clipped.",IDC_RADIO_SMPCLIP1,
+ "Button",BS_AUTORADIOBUTTON,12,126,270,12
+ CONTROL "Overflow - Values in [-1,1] are accepted, other values are wrapped around.",IDC_RADIO_SMPCLIP2,
+ "Button",BS_AUTORADIOBUTTON,12,138,270,12
+ DEFPUSHBUTTON "OK",IDOK,192,168,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,246,168,50,14
+ PUSHBUTTON "Presets...",IDC_BUTTON_SAMPLEGEN_PRESETS,6,168,50,14
+END
+IDD_SAMPLE_GENERATOR_PRESETS DIALOGEX 0, 0, 316, 101
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Sample Generator Presets"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,258,78,50,14
+ LISTBOX IDC_LIST_SAMPLEGEN_PRESETS,6,6,108,90,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT_PRESET_NAME,120,18,186,12,ES_AUTOHSCROLL
+ LTEXT "Name:",IDC_STATIC,120,6,186,8
+ EDITTEXT IDC_EDIT_PRESET_EXPR,120,54,186,12,ES_AUTOHSCROLL
+ LTEXT "Expression:",IDC_STATIC,120,42,186,8
+ PUSHBUTTON "Remove",IDC_BUTTON_REMOVE,120,78,50,14
+ PUSHBUTTON "Add",IDC_BUTTON_ADD,174,78,50,14
+END
+
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -139,15 +182,31 @@
TOPMARGIN, 7
BOTTOMMARGIN, 130
END
+
+ IDD_SAMPLE_GENERATOR, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 297
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 184
+ END
+
+ IDD_SAMPLE_GENERATOR_PRESETS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 309
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 94
+ END
END
#endif // APSTUDIO_INVOKED
-#endif // German (Germany) resources
+#endif // Deutsch (Deutschland) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// Englisch (USA) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
@@ -467,7 +526,7 @@
END
IDD_CONTROL_SAMPLES DIALOGEX 0, 0, 544, 106
-STYLE DS_SETFONT | WS_CHILD
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,4,4,55,17
@@ -2311,12 +2370,12 @@
IDS_SOUNDTOUCH_LOADFAILURE "Unable to load OpenMPT_soundtouch_i16.dll."
END
-#endif // English (U.S.) resources
+#endif // Englisch (USA) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+// Englisch (GB) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
@@ -2685,7 +2744,7 @@
//
IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc"
-#endif // English (U.K.) resources
+#endif // Englisch (GB) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/mptrack/resource.h 2010-02-14 00:22:40 UTC (rev 493)
@@ -132,6 +132,8 @@
#define IDD_CLEANUP_SONG 521
#define IDD_CHANNEL_NAME 522
#define IDD_KEYBOARD_SPLIT 523
+#define IDD_SAMPLE_GENERATOR 524
+#define IDD_SAMPLE_GENERATOR_PRESETS 525
#define IDC_BUTTON1 1001
#define IDC_BUTTON2 1002
#define IDC_BUTTON3 1003
@@ -930,6 +932,22 @@
#define IDC_STATIC_CHANNEL_NAME 2410
#define IDC_EDIT_CHANNEL_NAME 2411
#define IDC_STATIC_PATTERNNAME 2412
+#define IDC_EDIT_SAMPLE_LENGTH 2413
+#define IDC_EDIT_SAMPLE_FREQ 2414
+#define IDC_EDIT_FORMULA 2415
+#define IDC_EDIT_SAMPLE_LENGTH2 2416
+#define IDC_EDIT_SAMPLE_LENGTH_SEC 2416
+#define IDC_RADIO_SMPCLIP1 2417
+#define IDC_RADIO_SMPCLIP2 2418
+#define IDC_RADIO_SMPCLIP3 2419
+#define IDC_STATIC_SMPSIZE_KB 2420
+#define IDC_BUTTON_SHOW_EXPRESSIONS 2421
+#define IDC_SAMPLEGEN_PRESETS 2422
+#define IDC_BUTTON_SAMPLEGEN_PRESETS 2422
+#define IDC_EDIT_PRESET_NAME 2423
+#define IDC_EDIT_PRESET_EXPR 2424
+#define IDC_LIST_SAMPLEGEN_PRESETS 2425
+#define IDC_CHECK_UNDO 2426
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1178,7 +1196,10 @@
#define ID_EDIT_SPLITKEYBOARDSETTINGS 59240
#define ID_EDIT_PASTESPECIAL 59241
#define ID_CHANGE_PCNOTE_PARAM 59242
-#define ID_MODTREE_CLOSE 60243
+#define ID_MODTREE_CLOSE 60243
+#define ID_SAMPLE_GENERATOR_MENU 60244
+#define ID_SAMPLE_GENERATOR_PRESET_MENU 60344
+#define ID_SAMPLE_GENERATE 60445
// Next default values for new objects
//
@@ -1186,8 +1207,8 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 526
-#define _APS_NEXT_COMMAND_VALUE 60244
-#define _APS_NEXT_CONTROL_VALUE 2426
+#define _APS_NEXT_COMMAND_VALUE 60446
+#define _APS_NEXT_CONTROL_VALUE 2427
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
Modified: trunk/OpenMPT/mptrack/tagging.cpp
===================================================================
--- trunk/OpenMPT/mptrack/tagging.cpp 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/mptrack/tagging.cpp 2010-02-14 00:22:40 UTC (rev 493)
@@ -13,6 +13,7 @@
// CFileTagging - helper class for writing tags
CFileTagging::CFileTagging()
+//--------------------------
{
encoder = "OpenMPT " MPT_VERSION_STR;
}
@@ -23,10 +24,11 @@
// Convert Integer to Synchsafe Integer (see ID3v2.4 specs)
// Basically, it's a BigEndian integer, but the MSB of all bytes is 0.
// Thus, a 32-bit integer turns into a 28-bit integer.
-UINT32 CFileTagging::intToSynchsafe(UINT32 iIn)
+uint32 CFileTagging::intToSynchsafe(uint32 iIn)
+//---------------------------------------------
{
iIn = LittleEndian(iIn);
- UINT32 iOut = 0, iSteps = 0;
+ uint32 iOut = 0, iSteps = 0;
do {
iOut |= (iIn & 0x7F) << iSteps;
iSteps += 8;
@@ -36,6 +38,7 @@
// Write Tags
void CFileTagging::WriteID3v2Tags(FILE *f)
+//----------------------------------------
{
if(!f) return;
@@ -81,6 +84,7 @@
// Write a ID3v2 frame
void CFileTagging::WriteID3v2Frame(char cFrameID[4], string sFramecontent, FILE *f)
+//---------------------------------------------------------------------------------
{
if(!strcmp(cFrameID, "") || sFramecontent.empty() || !f) return;
@@ -108,6 +112,7 @@
// Write RIFF tags
void CFileTagging::WriteWaveTags(WAVEDATAHEADER *wdh, WAVEFILEHEADER *wfh, FILE *f)
+//---------------------------------------------------------------------------------
{
if(!f || !wdh || !wfh) return;
Modified: trunk/OpenMPT/mptrack/tagging.h
===================================================================
--- trunk/OpenMPT/mptrack/tagging.h 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/mptrack/tagging.h 2010-02-14 00:22:40 UTC (rev 493)
@@ -58,18 +58,18 @@
typedef struct _TAGID3v2HEADER
{
- BYTE signature[3];
- BYTE version[2];
- BYTE flags;
- UINT32 size;
+ uint8 signature[3];
+ uint8 version[2];
+ uint8 flags;
+ uint32 size;
// Total: 10 bytes
} TAGID3v2HEADER;
typedef struct _TAGID3v2FRAME
{
- UINT32 frameid;
- UINT32 size;
- UINT16 flags;
+ uint32 frameid;
+ uint32 size;
+ uint16 flags;
// Total: 10 bytes
} TAGID3v2FRAME;
@@ -106,11 +106,11 @@
private:
// Convert Integer to Synchsafe Integer (see ID3v2.4 specs)
- UINT32 intToSynchsafe(UINT32 in);
+ uint32 intToSynchsafe(UINT32 in);
// Write a frame
void WriteID3v2Frame(char cFrameID[4], string sFramecontent, FILE *f);
// Size of our tag
- UINT32 totalID3v2Size;
+ uint32 totalID3v2Size;
};
#pragma pack()
Modified: trunk/OpenMPT/soundlib/IT_DEFS.H
===================================================================
--- trunk/OpenMPT/soundlib/IT_DEFS.H 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/soundlib/IT_DEFS.H 2010-02-14 00:22:40 UTC (rev 493)
@@ -140,19 +140,19 @@
extern BYTE autovibit2xm[8];
extern BYTE autovibxm2it[8];
-#endif
+#define ITP_VERSION 0x00000102 // v1.02
-//plastiq.manyChannels
enum IT_ReaderBitMasks {
- // pattern row parsing, the channel data is read to obtain
- // number of channels active in the pattern. These bit masks are
- // to blank out sections of the byte of data being read.
+ // pattern row parsing, the channel data is read to obtain
+ // number of channels active in the pattern. These bit masks are
+ // to blank out sections of the byte of data being read.
- IT_bitmask_patternChanField_c = 0x7f,
- IT_bitmask_patternChanMask_c = 0x3f,
- IT_bitmask_patternChanEnabled_c = 0x80,
- IT_bitmask_patternChanUsed_c = 0x0f
+ IT_bitmask_patternChanField_c = 0x7f,
+ IT_bitmask_patternChanMask_c = 0x3f,
+ IT_bitmask_patternChanEnabled_c = 0x80,
+ IT_bitmask_patternChanUsed_c = 0x0f
};
-//end plastiq.manyChannels
\ No newline at end of file
+
+#endif
\ No newline at end of file
Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_gdm.cpp 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2010-02-14 00:22:40 UTC (rev 493)
@@ -19,57 +19,63 @@
typedef struct _GDMHEADER
{
- DWORD ID; // ID: 'GDM\xFE'
- CHAR SongTitle[32]; // Music's title
- CHAR SongMusician[32]; // Name of music's composer
- CHAR DOSEOF[3]; // 13, 10, 26
- DWORD ID2; // ID: 'GMFS'
- BYTE FormMajorVer; // Format major version
- BYTE FormMinorVer; // Format minor version
- UINT16 TrackID; // Composing Tracker ID code (00 = 2GDM)
- BYTE TrackMajorVer; // Tracker's major version
- BYTE TrackMinorVer; // Tracker's minor version
- BYTE PanMap[32]; // 0-Left to 15-Right, 255-N/U
- BYTE MastVol; // Range: 0...64
- BYTE Tempo; // Initial music tempo (6)
- BYTE BPM; // Initial music BPM (125)
- UINT16 FormOrigin; // Original format ID:
+ uint32 ID; // ID: 'GDM\xFE'
+ char SongTitle[32]; // Music's title
+ char SongMusician[32]; // Name of music's composer
+ char DOSEOF[3]; // 13, 10, 26
+ uint32 ID2; // ID: 'GMFS'
+ uint8 FormMajorVer; // Format major version
+ uint8 FormMinorVer; // Format minor version
+ uint16 TrackID; // Composing Tracker ID code (00 = 2GDM)
+ uint8 TrackMajorVer; // Tracker's major version
+ uint8 TrackMinorVer; // Tracker's minor version
+ uint8 PanMap[32]; // 0-Left to 15-Right, 255-N/U
+ uint8 MastVol; // Range: 0...64
+ uint8 Tempo; // Initial music tempo (6)
+ uint8 BPM; // Initial music BPM (125)
+ uint16 FormOrigin; // Original format ID:
// 1-MOD, 2-MTM, 3-S3M, 4-669, 5-FAR, 6-ULT, 7-STM, 8-MED
// (versions of 2GDM prior to v1.15 won't set this correctly)
- UINT32 OrdOffset;
- BYTE NOO; // Number of orders in module - 1
- UINT32 PatOffset;
- BYTE NOP; // Number of patterns in module - 1
- UINT32 SamHeadOffset;
- UINT32 SamOffset;
- BYTE NOS; // Number of samples in module - 1
- UINT32 MTOffset; // Offset of song message
- UINT32 MTLength;
- UINT32 SSOffset; // Offset of scrolly script (huh?)
- UINT16 SSLength;
- UINT32 TGOffset; // Offset of text graphic (huh?)
- UINT16 TGLength;
+ uint32 OrdOffset;
+ uint8 NOO; // Number of orders in module - 1
+ uint32 PatOffset;
+ uint8 NOP; // Number of patterns in module - 1
+ uint32 SamHeadOffset;
+ uint32 SamOffset;
+ uint8 NOS; // Number of samples in module - 1
+ uint32 MTOffset; // Offset of song message
+ uint32 MTLength;
+ uint32 SSOffset; // Offset of scrolly script (huh?)
+ uint16 SSLength;
+ uint32 TGOffset; // Offset of text graphic (huh?)
+ uint16 TGLength;
} GDMHEADER, *PGDMHEADER;
typedef struct _GDMSAMPLEHEADER
{
- CHAR SamName[32]; // sample's name
- CHAR FileName[12]; // sample's filename
- BYTE EmsHandle; // useless
- UINT32 Length; // length in bytes
- UINT32 LoopBegin; // loop start in samples
- UINT32 LoopEnd; // loop end in samples
- BYTE Flags; // misc. flags
- UINT16 C4Hertz; // frequency
- BYTE Volume; // default volume
- BYTE Pan; // default pan
+ char SamName[32]; // sample's name
+ char FileName[12]; // sample's filename
+ uint8 EmsHandle; // useless
+ uint32 Length; // length in bytes
+ uint32 LoopBegin; // loop start in samples
+ uint32 LoopEnd; // loop end in samples
+ uint8 Flags; // misc. flags
+ uint16 C4Hertz; // frequency
+ uint8 Volume; // default volume
+ uint8 Pan; // default pan
} GDMSAMPLEHEADER, *PGDMSAMPLEHEADER;
#pragma pack()
+#define GDMHeader_Origin_Count 8
+static MODTYPE GDMHeader_Origin[GDMHeader_Origin_Count] =
+{
+ MOD_TYPE_NONE, MOD_TYPE_MOD, MOD_TYPE_S3M, MOD_TYPE_669, MOD_TYPE_FAR, MOD_TYPE_ULT, MOD_TYPE_STM, MOD_TYPE_MED
+};
+
bool CSoundFile::ReadGDM(const LPCBYTE lpStream, const DWORD dwMemLength)
-//-----------------------------------------------------------
+//-----------------------------------------------------------------------
{
if ((!lpStream) || (dwMemLength < sizeof(GDMHEADER))) return false;
@@ -82,11 +88,13 @@
// there are no other format versions...
if(pHeader->FormMajorVer != 1 || pHeader->FormMinorVer != 0)
- {
- ::MessageBox(0, TEXT("GDM file seems to be valid, but this format version is currently not supported."), TEXT("OpenMPT GDM import"), MB_ICONERROR);
return false;
- }
+ // 1-MOD, 2-MTM, 3-S3M, 4-669, 5-FAR, 6-ULT, 7-STM, 8-MED
+ m_nType = GDMHeader_Origin[pHeader->FormOrigin % GDMHeader_Origin_Count];
+ if(m_nType == MOD_TYPE_NONE)
+ return false;
+
// interesting question: Is TrackID, TrackMajorVer, TrackMinorVer relevant? The only TrackID should be 0 - 2GDM.exe, so the answer would be no.
// song name
@@ -121,43 +129,10 @@
m_nSamplePreAmp = 48; // dito
m_nVSTiVolume = 48; // dito
- // 1-MOD, 2-MTM, 3-S3M, 4-669, 5-FAR, 6-ULT, 7-STM, 8-MED
-
- switch(LittleEndianW(pHeader->FormOrigin))
- {
- case 1:
- m_nType = MOD_TYPE_MOD;
- break;
- case 2:
- m_nType = MOD_TYPE_MTM;
- break;
- case 3:
- m_nType = MOD_TYPE_S3M;
- break;
- case 4:
- m_nType = MOD_TYPE_669;
- break;
- case 5:
- m_nType = MOD_TYPE_FAR;
- break;
- case 6:
- m_nType = MOD_TYPE_ULT;
- break;
- case 7:
- m_nType = MOD_TYPE_STM;
- break;
- case 8:
- m_nType = MOD_TYPE_MED;
- break;
- default:
- ::MessageBox(0, TEXT("GDM file seems to be valid, but the original format is currently not supported.\nThis should not happen."), TEXT("OpenMPT GDM import"), MB_ICONERROR);
- return false;
- break;
- }
- UINT32 iSampleOffset = LittleEndian(pHeader->SamOffset),
+ uint32 iSampleOffset = LittleEndian(pHeader->SamOffset),
iPatternsOffset = LittleEndian(pHeader->PatOffset);
- const UINT32 iOrdOffset = LittleEndian(pHeader->OrdOffset), iSamHeadOffset = LittleEndian(pHeader->SamHeadOffset),
+ const uint32 iOrdOffset = LittleEndian(pHeader->OrdOffset), iSamHeadOffset = LittleEndian(pHeader->SamHeadOffset),
iMTOffset = LittleEndian(pHeader->MTOffset), iMTLength = LittleEndian(pHeader->MTLength),
iSSOffset = LittleEndian(pHeader->SSOffset), iSSLength = LittleEndianW(pHeader->SSLength),
iTGOffset = LittleEndian(pHeader->TGOffset), iTGLength = LittleEndianW(pHeader->TGLength);
@@ -243,24 +218,16 @@
if(pSample->Flags & 0x02) // 16 bit
{
if(pSample->Flags & 0x20) // stereo
- {
iSampleFormat = RS_PCM16U; // should be RS_STPCM16U but that breaks the sample reader
- }
else
- {
iSampleFormat = RS_PCM16U;
- }
}
else // 8 bit
{
if(pSample->Flags & 0x20) // stereo
- {
iSampleFormat = RS_PCM8U; // should be RS_STPCM8U - dito
- }
else
- {
iSampleFormat = RS_PCM8U;
- }
}
// according to zilym, LZW support has never been finished, so this is also practically useless. Just ignore the flag.
@@ -283,7 +250,7 @@
{
if(iPatternsOffset + 2 > dwMemLength) break;
- UINT16 iPatternLength = LittleEndianW(*(UINT16 *)(lpStream + iPatternsOffset)); // pattern length including the two "length" bytes
+ uint16 iPatternLength = LittleEndianW(*(uint16 *)(lpStream + iPatternsOffset)); // pattern length including the two "length" bytes
if(iPatternLength > dwMemLength || iPatternsOffset > dwMemLength - iPatternLength) break;
if(Patterns.Insert(iPat, 64))
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-13 19:58:05 UTC (rev 492)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-14 00:22:40 UTC (rev 493)
@@ -458,6 +458,9 @@
version = id;
streamPos += sizeof(DWORD);
+ if(version > ITP_VERSION)
+ return false;
+
// Song name
// name string length
@@ -1554,7 +1557,7 @@
DWORD id = 0x2e697470; // .itp ASCII
fwrite(&id, 1, sizeof(id), f);
- id = 0x00000102; // v1.02
+ id = ITP_VERSION;
fwrite(&id, 1, sizeof(id), f);
// Song name
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-13 19:58:12
|
Revision: 492
http://modplug.svn.sourceforge.net/modplug/?rev=492&view=rev
Author: saga-games
Date: 2010-02-13 19:58:05 +0000 (Sat, 13 Feb 2010)
Log Message:
-----------
(fix from SchismTracker)
[Fix] IT Loader: Ignore stereo sample flag when loading old IT files (older than IT 2.14) since IT id not reset this flag when importing stereo samples back then.
[New] Code for detecting MPT hacks in files (is not complete yet)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_it.cpp
Added Paths:
-----------
trunk/OpenMPT/mptrack/MPTHacks.cpp
Added: trunk/OpenMPT/mptrack/MPTHacks.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MPTHacks.cpp (rev 0)
+++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2010-02-13 19:58:05 UTC (rev 492)
@@ -0,0 +1,340 @@
+/*
+ * MPTHacks.cpp
+ * ------------
+ * Purpose: Find out if MOD/XM/S3M/IT modules have MPT-specific hacks and fix them.
+ * Notes : This is not finished yet.
+ * Authors: OpenMPT Devs
+ */
+
+#include "stdafx.h"
+#include "Moddoc.h"
+
+/* TODO:
+stereo/16bit samples (only XM? maybe S3M? many new IT trackers support stereo samples)
+out-of range sample pre-amp
+song flags and properties (just look at the song properties window)
++++/--- orders in XM/MOD sequence
+comments in XM files
+AUTOFIX actions!
+
+maybe two options in program: convert to mptm / remove hacks from file!
+*/
+
+// Functor for fixing hacked patterns
+struct FixHackedPatterns
+//======================
+{
+ FixHackedPatterns(const CModSpecifications *originalSpecs, MODTYPE type, bool autofix, bool *foundHacks)
+ {
+ this->originalSpecs = originalSpecs;
+ this->type = type;
+ this->autofix = autofix;
+ this->foundHacks = foundHacks;
+ *foundHacks = false;
+ }
+
+ void operator()(MODCOMMAND& m)
+ {
+ // definitely not perfect yet. :)
+ // Probably missing: Some extended effect parameters
+ if(!originalSpecs->HasNote(m.note))
+ {
+ *foundHacks = true;
+ if(autofix)
+ m.note = NOTE_NONE;
+ }
+
+ if(!originalSpecs->HasCommand(m.command))
+ {
+ *foundHacks = true;
+ if(autofix)
+ m.command = CMD_NONE;
+ }
+
+ if(!originalSpecs->HasVolCommand(m.volcmd))
+ {
+ *foundHacks = true;
+ if(autofix)
+ m.volcmd = VOLCMD_NONE;
+ }
+
+ if(type == MOD_TYPE_XM) // modplug XM extensions
+ {
+ if(m.command == CMD_XFINEPORTAUPDOWN && m.param >= 0x30)
+ {
+ *foundHacks = true;
+ if(autofix)
+ m.command = CMD_NONE;
+ }
+ } else if(type == MOD_TYPE_IT) // modplug IT extensions
+ {
+ if(m.command == CMD_S3MCMDEX && (m.param & 0x90) != 0 && m.param != 0x91)
+ {
+ *foundHacks = true;
+ if(autofix)
+ m.command = CMD_NONE;
+ }
+
+ }
+ }
+
+ const CModSpecifications *originalSpecs;
+ MODTYPE type;
+ bool autofix;
+ bool *foundHacks;
+};
+
+// Go through the module to find out if it contains any hacks introduced by (Open)MPT
+bool CModDoc::HasMPTHacks(bool autofix)
+//-------------------------------------
+{
+ const CModSpecifications *originalSpecs = &m_SndFile.GetModSpecifications();
+ // retrieve original (not hacked) specs.
+ switch(m_SndFile.GetType())
+ {
+ case MOD_TYPE_MOD:
+ originalSpecs = &ModSpecs::mod;
+ break;
+ case MOD_TYPE_XM:
+ originalSpecs = &ModSpecs::xm;
+ break;
+ case MOD_TYPE_S3M:
+ originalSpecs = &ModSpecs::s3m;
+ break;
+ case MOD_TYPE_IT:
+ originalSpecs = &ModSpecs::it;
+ break;
+ }
+
+ bool foundHacks = false, foundHere = false;
+ ClearLog();
+
+ // Check for plugins
+ foundHere = false;
+ for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++)
+ {
+ if(m_SndFile.m_MixPlugins[i].pMixPlugin != nullptr || m_SndFile.m_MixPlugins[i].Info.dwPluginId1 || m_SndFile.m_MixPlugins[i].Info.dwPluginId2)
+ {
+ foundHere = foundHacks = true;
+ break;
+ }
+ // REQUIRES AUTOFIX
+ }
+ if(foundHere)
+ AddToLog("Found VST plugins\n");
+
+ // Pattern count
+ if(m_SndFile.GetNumPatterns() > originalSpecs->patternsMax)
+ {
+ AddToLog("Found too many patterns\n");
+ foundHacks = true;
+ // REQUIRES AUTOFIX
+ }
+
+ // Check for too big/small patterns
+ foundHere = false;
+ for(PATTERNINDEX i = 0; i < m_SndFile.Patterns.Size(); i++)
+ {
+ if(m_SndFile.Patterns.IsValidPat(i))
+ {
+ if(m_SndFile.Patterns[i].GetNumRows() > originalSpecs->patternRowsMax || m_SndFile.Patterns[i].GetNumRows() < originalSpecs->patternRowsMin)
+ {
+ foundHacks = foundHere = true;
+ break;
+ }
+ // REQUIRES AUTOFIX
+ }
+ }
+ if(foundHere)
+ AddToLog("Found incompatible pattern lengths\n");
+
+ // Check for invalid pattern commands
+ foundHere = false;
+ m_SndFile.Patterns.ForEachModCommand(FixHackedPatterns(originalSpecs, m_SndFile.GetType(), autofix, &foundHere));
+ if(foundHere)
+ AddToLog("Found invalid pattern commands\n");
+
+ // Check for pattern names
+ foundHere = false;
+ for(PATTERNINDEX i = 0; i < m_SndFile.Patterns.Size(); i++)
+ {
+ if(m_SndFile.Patterns.IsValidPat(i))
+ {
+ TCHAR tempname[MAX_PATTERNNAME];
+ MemsetZero(tempname);
+ m_SndFile.GetPatternName(i, tempname, sizeof(tempname));
+ if(strcmp(tempname, "") != 0)
+ {
+ foundHere = foundHacks = true;
+ if(autofix)
+ m_SndFile.SetPatternName(i, "");
+ else
+ break;
+ }
+ }
+ }
+ if(foundHere)
+ AddToLog("Found pattern names\n");
+
+ // Check for too many channels
+ if(m_SndFile.GetNumChannels() > originalSpecs->channelsMax || m_SndFile.GetNumChannels() < originalSpecs->channelsMin)
+ {
+ AddToLog("Found incompatible channel count\n");
+ foundHacks = true;
+ // REQUIRES AUTOFIX
+ }
+
+ // Check for channel names
+ foundHere = false;
+ for(CHANNELINDEX i = 0; i < m_SndFile.GetNumChannels(); i++)
+ {
+ if(strcmp(m_SndFile.ChnSettings[i].szName, "") != 0)
+ {
+ foundHere = foundHacks = true;
+ if(autofix)
+ MemsetZero(m_SndFile.ChnSettings[i].szName);
+ else
+ break;
+ }
+ }
+ if(foundHere)
+ AddToLog("Found channel names\n");
+
+ // Check for too many samples
+ if(m_SndFile.GetNumSamples() > originalSpecs->samplesMax)
+ {
+ AddToLog("Found too many samples\n");
+ foundHacks = true;
+ // REQUIRES AUTOFIX
+ }
+
+ // Check for too many instruments
+ if(m_SndFile.GetNumInstruments() > originalSpecs->instrumentsMax)
+ {
+ AddToLog("Found too many instruments\n");
+ foundHacks = true;
+ // REQUIRES AUTOFIX
+ }
+
+ // Check for instrument extensions
+ foundHere = false;
+ for(INSTRUMENTINDEX i = 1; i <= m_SndFile.GetNumInstruments(); i++)
+ {
+ MODINSTRUMENT *instr = m_SndFile.Instruments[i];
+ if(instr == nullptr) continue;
+
+ if(instr->nFilterMode != FLTMODE_UNCHANGED || instr->nVolRamp != 0 || instr->nResampling != SRCMODE_DEFAULT ||
+ instr->nCutSwing != 0 || instr->nResSwing != 0 || instr->nMixPlug != 0 || instr->wPitchToTempoLock != 0 ||
+ instr->nDCT == DCT_PLUGIN ||
+ instr->VolEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET ||
+ instr->PanEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET ||
+ instr->PitchEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET
+ )
+ {
+ foundHere = foundHacks = true;
+ if(autofix)
+ {
+ instr->nFilterMode = FLTMODE_UNCHANGED;
+ instr->nVolRamp = 0;
+ instr->nResampling = SRCMODE_DEFAULT;
+ instr->nCutSwing = 0;
+ instr->nResSwing = 0;
+ instr->nMixPlug = 0;
+ instr->wPitchToTempoLock = 0;
+ if(instr->nDCT == DCT_PLUGIN) instr->nDCT = DCT_NONE;
+ instr->VolEnv.nReleaseNode = instr->PanEnv.nReleaseNode = instr->PitchEnv.nReleaseNode = ENV_RELEASE_NODE_UNSET;
+ }
+ }
+
+ }
+ if(foundHere)
+ AddToLog("Found MPT instrument extensions\n");
+
+ // Check for too many orders
+ if(m_SndFile.Order.GetLengthTailTrimmed() > originalSpecs->ordersMax)
+ {
+ AddToLog("Found too many orders\n");
+ foundHacks = true;
+ // REQUIRES AUTOFIX
+ }
+
+ // Check for invalid default tempo
+ if(m_SndFile.m_nDefaultTempo > originalSpecs->tempoMax || m_SndFile.m_nDefaultTempo < originalSpecs->tempoMin)
+ {
+ AddToLog("Found incompatible default tempo\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.m_nDefaultTempo = CLAMP(m_SndFile.m_nDefaultTempo, originalSpecs->tempoMin, originalSpecs->tempoMax);
+ }
+
+ // Check for invalid default speed
+ if(m_SndFile.m_nDefaultSpeed > originalSpecs->speedMax || m_SndFile.m_nDefaultSpeed < originalSpecs->speedMin)
+ {
+ AddToLog("Found incompatible default speed\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.m_nDefaultSpeed = CLAMP(m_SndFile.m_nDefaultSpeed, originalSpecs->speedMin, originalSpecs->speedMax);
+ }
+
+ // Check for invalid rows per beat / measure values
+ if(m_SndFile.m_nRowsPerBeat >= originalSpecs->patternRowsMax || m_SndFile.m_nRowsPerMeasure >= originalSpecs->patternRowsMax)
+ {
+ AddToLog("Found incompatible rows per beat / measure\n");
+ foundHacks = true;
+ if(autofix)
+ {
+ m_SndFile.m_nRowsPerBeat = CLAMP(m_SndFile.m_nRowsPerBeat, 1, (originalSpecs->patternRowsMax - 1));
+ m_SndFile.m_nRowsPerMeasure = CLAMP(m_SndFile.m_nRowsPerMeasure, m_SndFile.m_nRowsPerBeat, (originalSpecs->patternRowsMax - 1));
+ }
+ }
+
+ // Check for new tempo modes
+ if(m_SndFile.m_nTempoMode != tempo_mode_classic)
+ {
+ AddToLog("Found incompatible tempo mode\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.m_nTempoMode = tempo_mode_classic;
+ }
+
+ // Check for extended filter range flag
+ if(m_SndFile.m_dwSongFlags & SONG_EXFILTERRANGE)
+ {
+ AddToLog("Found extended filter range\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.m_dwSongFlags &= ~SONG_EXFILTERRANGE;
+ }
+
+ // Embedded MIDI configuration in XM files
+ if((m_SndFile.m_dwSongFlags & SONG_EMBEDMIDICFG) != 0 && m_SndFile.GetType() == MOD_TYPE_XM)
+ {
+ AddToLog("Found embedded MIDI macros\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.m_dwSongFlags &= ~SONG_EMBEDMIDICFG;
+ }
+
+ // Player flags
+ if(!m_SndFile.GetModFlag(MSF_COMPATIBLE_PLAY))
+ {
+ AddToLog("Compatible play is deactivated\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true);
+ }
+
+ // Check for restart position where it should not be
+ if(m_SndFile.m_nRestartPos > 0 && !originalSpecs->hasRestartPos)
+ {
+ AddToLog("Found restart position\n");
+ foundHacks = true;
+ if(autofix)
+ m_SndFile.m_nRestartPos = 0;
+ }
+
+ if(autofix && foundHacks)
+ SetModified();
+
+ return foundHacks;
+}
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-13 13:15:18 UTC (rev 491)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-13 19:58:05 UTC (rev 492)
@@ -1261,18 +1261,18 @@
pSmp->nLength = pis->length;
if (pSmp->nLength > MAX_SAMPLE_LENGTH) pSmp->nLength = MAX_SAMPLE_LENGTH;
UINT flags = (pis->cvt & 1) ? RS_PCM8S : RS_PCM8U;
- if (pis->flags & 2)
+ if (pis->flags & 2) // 16-bit
{
flags += 5;
- if (pis->flags & 4) flags |= RSF_STEREO;
+ if (pis->flags & 4 && pifh->cwtv >= 0x214) flags |= RSF_STEREO; // some old version of IT didn't clear the stereo flag when importing samples. Luckily, all other trackers are identifying as IT 2.14+, so let's check for old IT versions.
pSmp->uFlags |= CHN_16BIT;
- // IT 2.14 16-bit packed sample ?
+ // IT 2.14 16-bit packed sample?
if (pis->flags & 8) flags = ((pifh->cmwt >= 0x215) && (pis->cvt & 4)) ? RS_IT21516 : RS_IT21416;
- } else
+ } else // 8-bit
{
- if (pis->flags & 4) flags |= RSF_STEREO;
+ if (pis->flags & 4 && pifh->cwtv >= 0x214) flags |= RSF_STEREO; // some old version of IT didn't clear the stereo flag when importing samples. Luckily, all other trackers are identifying as IT 2.14+, so let's check for old IT versions.
if (pis->cvt == 0xFF) flags = RS_ADPCM4; else
- // IT 2.14 8-bit packed sample ?
+ // IT 2.14 8-bit packed sample?
if (pis->flags & 8) flags = ((pifh->cmwt >= 0x215) && (pis->cvt & 4)) ? RS_IT2158 : RS_IT2148;
}
// -> CODE#0027
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-13 13:15:27
|
Revision: 491
http://modplug.svn.sourceforge.net/modplug/?rev=491&view=rev
Author: saga-games
Date: 2010-02-13 13:15:18 +0000 (Sat, 13 Feb 2010)
Log Message:
-----------
[Fix] Pattern Editor: Don't enable or disable "follow song" checkbox to its default setting all the time when updating other parts of the dialog
[Fix] Mod Specs: Updated maximum IT pattern length (unhacked specs)
[New] Added Sample Generator sourcecode. It's not finished yet so it's not included in the project.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Added Paths:
-----------
trunk/OpenMPT/mptrack/SampleGenerator.cpp
trunk/OpenMPT/mptrack/SampleGenerator.h
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-02-10 18:21:42 UTC (rev 490)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-02-13 13:15:18 UTC (rev 491)
@@ -264,7 +264,7 @@
m_ToolBar.UpdateStyle();
// -> CODE#0007
// -> DESC="uncheck follow song checkbox by default"
- CheckDlgButton(IDC_PATTERN_FOLLOWSONG, (CMainFrame::m_dwPatternSetup & PATTERN_FOLLOWSONGOFF) ? MF_UNCHECKED : MF_CHECKED);
+ //CheckDlgButton(IDC_PATTERN_FOLLOWSONG, (CMainFrame::m_dwPatternSetup & PATTERN_FOLLOWSONGOFF) ? MF_UNCHECKED : MF_CHECKED);
m_ToolBar.SetState(ID_OVERFLOWPASTE, ((CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED);
// -! BEHAVIOUR_CHANGE#0007
}
Added: trunk/OpenMPT/mptrack/SampleGenerator.cpp
===================================================================
--- trunk/OpenMPT/mptrack/SampleGenerator.cpp (rev 0)
+++ trunk/OpenMPT/mptrack/SampleGenerator.cpp 2010-02-13 13:15:18 UTC (rev 491)
@@ -0,0 +1,761 @@
+/*
+ * SampleGenerator.cpp
+ * -------------------
+ * Purpose: Generate samples from math formulas using muParser
+ * Notes : (currently none)
+ * Authors: OpenMPT Devs
+ */
+
+
+#include "stdafx.h"
+#include "SampleGenerator.h"
+#include "modsmp_ctrl.h"
+
+int CSampleGenerator::sample_frequency = 44100;
+int CSampleGenerator::sample_length = CSampleGenerator::sample_frequency;
+mu::string_type CSampleGenerator::expression = _T("sin(xp * _pi)");
+smpgen_clip_methods CSampleGenerator::sample_clipping = smpgen_normalize;
+
+mu::value_type *CSampleGenerator::sample_buffer = nullptr;
+size_t CSampleGenerator::samples_written = 0;
+
+
+CSampleGenerator::CSampleGenerator()
+//----------------------------------
+{
+
+ // Setup function callbacks
+ muParser.DefineFun(_T("clip"), &ClipCallback, false);
+ muParser.DefineFun(_T("pwm"), &PWMCallback, false);
+ muParser.DefineFun(_T("rnd"), &RndCallback, false);
+ muParser.DefineFun(_T("smp"), &SampleDataCallback, false);
+ muParser.DefineFun(_T("tri"), &TriangleCallback, false);
+
+ // Setup binary operator callbacks
+ muParser.DefineOprt(_T("mod"), &ModuloCallback, 0);
+
+ //muParser.DefineConst("pi", (mu::value_type)PARSER_CONST_PI);
+
+}
+
+
+// Open the smpgen dialog
+bool CSampleGenerator::ShowDialog()
+//---------------------------------
+{
+ bool isDone = false, result = false;
+ while(!isDone)
+ {
+ CSmpGenDialog dlg(sample_frequency, sample_length, sample_clipping, expression);
+ dlg.DoModal();
+
+ // pressed "OK" button?
+ if(dlg.CanApply())
+ {
+ sample_frequency = dlg.GetFrequency();
+ sample_length = dlg.GetLength();
+ sample_clipping = dlg.GetClipping();
+ expression = dlg.GetExpression();
+ isDone = CanRenderSample();
+ if(isDone) isDone = TestExpression(); // show dialog again if the formular can't be parsed.
+ result = true;
+ } else
+ {
+ isDone = true; // just quit.
+ result = false;
+ }
+ }
+ return result;
+}
+
+
+// Check if the currently select expression can be parsed by muParser.
+bool CSampleGenerator::TestExpression()
+//-------------------------------------
+{
+ // reset helper variables
+ samples_written = 0;
+ sample_buffer = nullptr;
+
+ muParser.SetExpr(expression);
+ mu::value_type x = 0;
+ muParser.DefineVar(_T("x"), &x);
+ muParser.DefineVar(_T("xp"), &x);
+ muParser.DefineVar(_T("len"), &x);
+ muParser.DefineVar(_T("lens"), &x);
+ muParser.DefineVar(_T("freq"), &x);
+
+ try
+ {
+ muParser.Eval();
+ }
+ catch (mu::Parser::exception_type &e)
+ {
+ ShowError(&e);
+ return false;
+ }
+ return true;
+}
+
+
+// Check if sample parameters are valid.
+bool CSampleGenerator::CanRenderSample()
+//--------------------------------------
+{
+ if(sample_frequency < SMPGEN_MINFREQ || sample_frequency > SMPGEN_MAXFREQ || sample_length < SMPGEN_MINLENGTH || sample_length > SMPGEN_MAXLENGTH) return false;
+ return true;
+}
+
+
+// Actual render loop.
+bool CSampleGenerator::RenderSample(CSoundFile *pSndFile, SAMPLEINDEX nSample)
+//----------------------------------------------------------------------------
+{
+ if(!CanRenderSample() || !TestExpression() || (pSndFile == nullptr) || (nSample < 1) || (nSample > pSndFile->m_nSamples)) return false;
+
+ // allocate a new buffer
+ sample_buffer = (mu::value_type *)malloc(sample_length * sizeof(mu::value_type));
+ if(sample_buffer == nullptr) return false;
+ memset(sample_buffer, 0, sample_length * sizeof(mu::value_type));
+
+ mu::value_type x = 0, xp = 0;
+ mu::value_type v_len = sample_length, v_freq = sample_frequency, v_lens = v_len / v_freq;
+ muParser.DefineVar(_T("x"), &x);
+ muParser.DefineVar(_T("xp"), &xp);
+ muParser.DefineVar(_T("len"), &v_len);
+ muParser.DefineVar(_T("lens"), &v_lens);
+ muParser.DefineVar(_T("freq"), &v_freq);
+
+ bool success = true;
+ mu::value_type minmax = 0;
+
+ for(size_t i = 0; i < (size_t)sample_length; i++)
+ {
+ samples_written = i;
+ x = (mu::value_type)i;
+ xp = x * 100 / sample_length;
+
+ try
+ {
+ sample_buffer[i] = muParser.Eval();
+ }
+ catch (mu::Parser::exception_type &e)
+ {
+ // let's just ignore div by zero errors (note: this error code is currently unused (muParser 1.30))
+ if(e.GetCode() != mu::ecDIV_BY_ZERO)
+ {
+ ShowError(&e);
+ success = false;
+ break;
+ }
+ sample_buffer[i] = 0;
+ }
+ // new maximum value?
+ if(abs(sample_buffer[i]) > minmax) minmax = abs(sample_buffer[i]);
+
+ }
+
+ if(success)
+ {
+ MODSAMPLE *pModSample = &pSndFile->Samples[nSample];
+
+ BEGIN_CRITICAL();
+
+ // first, save some memory... (leads to crashes)
+ //CSoundFile::FreeSample(pModSample->pSample);
+ //pModSample->pSample = nullptr;
+
+ if(minmax == 0) minmax = 1; // avoid division by 0
+
+ // convert sample to 16-bit (or whateve rhas been specified)
+ int16 *pSample = (sampling_type *)CSoundFile::AllocateSample((sample_length + 4) * SMPGEN_MIXBYTES);
+ for(size_t i = 0; i < (size_t)sample_length; i++)
+ {
+ switch(sample_clipping)
+ {
+ case smpgen_clip: sample_buffer[i] = CLAMP(sample_buffer[i], -1, 1); break; // option 1: clip
+ case smpgen_normalize: sample_buffer[i] /= minmax; break; // option 3: normalize
+ }
+
+ pSample[i] = (sampling_type)(sample_buffer[i] * sample_maxvalue);
+ }
+
+ // set new sample proprerties
+ pModSample->nC5Speed = sample_frequency;
+ CSoundFile::FrequencyToTranspose(pModSample);
+ pModSample->uFlags |= CHN_16BIT; // has to be adjusted if SMPGEN_MIXBYTES changes!
+ pModSample->uFlags &= ~(CHN_STEREO|CHN_SUSTAINLOOP|CHN_PINGPONGSUSTAIN);
+ pModSample->nLoopStart = 0;
+ pModSample->nLoopEnd = sample_length;
+ pModSample->nSustainStart = pModSample->nSustainEnd = 0;
+ if(sample_length / sample_frequency < 5) // arbitrary limit for automatic sample loop (5 seconds)
+ pModSample->uFlags |= CHN_LOOP;
+ else
+ pModSample->uFlags &= ~(CHN_LOOP|CHN_PINGPONGLOOP);
+
+ ctrlSmp::ReplaceSample(*pModSample, (LPSTR)pSample, sample_length, pSndFile);
+
+ END_CRITICAL();
+ }
+
+ free(sample_buffer);
+ sample_buffer = nullptr;
+
+ return success;
+}
+
+
+// Callback function to access sample data
+mu::value_type CSampleGenerator::SampleDataCallback(mu::value_type v)
+//-------------------------------------------------------------------
+{
+ if(sample_buffer == nullptr) return 0;
+ v = CLAMP(v, 0, samples_written);
+ size_t pos = static_cast<size_t>(v);
+ return sample_buffer[pos];
+}
+
+
+void CSampleGenerator::ShowError(mu::Parser::exception_type *e)
+//-------------------------------------------------------------
+{
+ std::string errmsg;
+ errmsg = "The expression\n " + e->GetExpr() + "\ncontains an error ";
+ if(!e->GetToken().empty())
+ errmsg += "in the token\n " + e->GetToken() + "\n";
+ errmsg += "at position " + Stringify(e->GetPos()) + ".\nThe error message was: " + e->GetMsg();
+ ::MessageBox(0, errmsg.c_str(), _T("muParser Sample Generator"), 0);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Sample Generator Dialog implementation
+
+#define MAX_SAMPLEGEN_EXPRESSIONS 61
+
+BEGIN_MESSAGE_MAP(CSmpGenDialog, CDialog)
+ ON_EN_CHANGE(IDC_EDIT_SAMPLE_LENGTH, OnSampleLengthChanged)
+ ON_EN_CHANGE(IDC_EDIT_SAMPLE_LENGTH_SEC, OnSampleSecondsChanged)
+ ON_EN_CHANGE(IDC_EDIT_SAMPLE_FREQ, OnSampleFreqChanged)
+ ON_EN_CHANGE(IDC_EDIT_FORMULA, OnExpressionChanged)
+ ON_COMMAND(IDC_BUTTON_SHOW_EXPRESSIONS, OnShowExpressions)
+ ON_COMMAND(IDC_BUTTON_SAMPLEGEN_PRESETS, OnShowPresets)
+ ON_COMMAND_RANGE(ID_SAMPLE_GENERATOR_MENU, ID_SAMPLE_GENERATOR_MENU + MAX_SAMPLEGEN_EXPRESSIONS - 1, OnInsertExpression)
+ ON_COMMAND_RANGE(ID_SAMPLE_GENERATOR_PRESET_MENU, ID_SAMPLE_GENERATOR_PRESET_MENU + MAX_SAMPLEGEN_PRESETS + 1, OnSelectPreset)
+END_MESSAGE_MAP()
+
+
+// List of all possible expression for expression menu
+const samplegen_expression menu_descriptions[MAX_SAMPLEGEN_EXPRESSIONS] =
+{
+ //-------------------------------------
+ {"Variables", ""},
+ //-------------------------------------
+ {"Current position (sampling point)", "x"},
+ {"Current position (percentage)", "xp"},
+ {"Sample length", "len"},
+ {"Sample length (seconds)", "lens"},
+ {"Sampling frequency", "freq"},
+ //-------------------------------------
+ {"Constants", ""},
+ //-------------------------------------
+ {"Pi", "_pi"},
+ {"e", "_e"},
+ //-------------------------------------
+ {"Trigonometric functions", ""},
+ //-------------------------------------
+ {"Sine", "sin(x)"},
+ {"Cosine", "cos(x)"},
+ {"Tangens", "tan(x)"},
+ {"Arcus Sine", "asin(x)"},
+ {"Arcus Cosine", "acos(x)"},
+ {"Arcus Tangens", "atan(x)"},
+ {"Hyperbolic Sine", "sinh(x)"},
+ {"Hyperbolic Cosine", "cosh(x)"},
+ {"Hyperbolic Tangens", "tanh(x)"},
+ {"Hyperbolic Arcus Sine", "asinh(x)"},
+ {"Hyperbolic Arcus Cosine", "acosh(x)"},
+ {"Hyperbolic Arcus Tangens", "atanh(x)"},
+ //-------------------------------------
+ {"Log, Exp, Root", ""},
+ //-------------------------------------
+ {"Logarithm (base 2)", "log2(x)"},
+ {"Logarithm (base 10)", "log(x)"},
+ {"Natural Logarithm (base e)", "ln(x)"},
+ {"e^x", "exp(x)"},
+ {"Square Root", "sqrt(x)"},
+ //-------------------------------------
+ {"Sign and rounding", ""},
+ //-------------------------------------
+ {"Sign", "sign(x)"},
+ {"Absolute value", "abs(x)"},
+ {"Round to nearest integer", "rint(x)"},
+ //-------------------------------------
+ {"Sets", ""},
+ //-------------------------------------
+ {"Minimum", "min(x, y, ...)"},
+ {"Maximum", "max(x, y, ...)"},
+ {"Sum", "sum(x, y, ...)"},
+ {"Mean value", "avg(x, y, ...)"},
+ //-------------------------------------
+ {"Misc functions", ""},
+ //-------------------------------------
+ {"Pulse generator", "pwm(position, duty%, width)"},
+ {"Triangle", "tri(position, width)"},
+ {"Random value between 0 and x", "rnd(x)"},
+ {"Access previous sampling point", "smp(position)"},
+ {"Clip between values", "clip(value, minclip, maxclip)"},
+ {"If...Then...Else", "if(condition, statement1, statement2)"},
+ //-------------------------------------
+ {"Operators", ""},
+ //-------------------------------------
+ {"Assignment", "x = y"},
+ {"Logical And", "x abd y"},
+ {"Logical Or", "x or y"},
+ {"Logical Xor", "x xor y"},
+ {"Less or equal", "x <= y"},
+ {"Greater or equal", "x >= y"},
+ {"Not equal", "x != y"},
+ {"Equal", "x == y"},
+ {"Greater than", "x > y"},
+ {"Less than", "x < y"},
+ {"Addition", "x + y"},
+ {"Subtraction", "x - y"},
+ {"Multiplication", "x * y"},
+ {"Division", "x / y"},
+ {"x^y", "x ^ y"},
+ {"Modulo", "x mod y"},
+};
+
+
+BOOL CSmpGenDialog::OnInitDialog()
+//--------------------------------
+{
+ CDialog::OnInitDialog();
+ RecalcParameters(false, true);
+ SetDlgItemText(IDC_EDIT_FORMULA, expression.c_str());
+
+ int check = IDC_RADIO_SMPCLIP1;
+ switch(sample_clipping)
+ {
+ case smpgen_clip: check = IDC_RADIO_SMPCLIP1; break;
+ case smpgen_overflow: check = IDC_RADIO_SMPCLIP2; break;
+ case smpgen_normalize: check = IDC_RADIO_SMPCLIP3; break;
+ }
+ CheckRadioButton(IDC_RADIO_SMPCLIP1, IDC_RADIO_SMPCLIP3, check);
+
+ if(presets.GetNumPresets() == 0)
+ {
+ CreateDefaultPresets();
+ }
+
+ // Create font for "dropdown" button (Marlett system font)
+ hButtonFont = CreateFont(14, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, TEXT("Marlett"));
+ ::SendMessage(GetDlgItem(IDC_BUTTON_SHOW_EXPRESSIONS)->m_hWnd, WM_SETFONT, (WPARAM)hButtonFont, MAKELPARAM(TRUE, 0));
+
+ return TRUE;
+}
+
+
+void CSmpGenDialog::OnOK()
+//------------------------
+{
+ CDialog::OnOK();
+ apply = true;
+
+ int check = GetCheckedRadioButton(IDC_RADIO_SMPCLIP1, IDC_RADIO_SMPCLIP3);
+ switch(check)
+ {
+ case IDC_RADIO_SMPCLIP1: sample_clipping = smpgen_clip; break;
+ case IDC_RADIO_SMPCLIP2: sample_clipping = smpgen_overflow; break;
+ case IDC_RADIO_SMPCLIP3: sample_clipping = smpgen_normalize; break;
+ }
+
+ DeleteObject(hButtonFont);
+}
+
+
+void CSmpGenDialog::OnCancel()
+//----------------------------
+{
+ CDialog::OnCancel();
+ apply = false;
+}
+
+
+// User changed formula
+void CSmpGenDialog::OnExpressionChanged()
+//---------------------------------------
+{
+ CString result;
+ GetDlgItemText(IDC_EDIT_FORMULA, result);
+ expression = result;
+}
+
+
+// User changed sample length field
+void CSmpGenDialog::OnSampleLengthChanged()
+//-----------------------------------------
+{
+ int temp_length = GetDlgItemInt(IDC_EDIT_SAMPLE_LENGTH);
+ if(temp_length >= SMPGEN_MINLENGTH && temp_length <= SMPGEN_MAXLENGTH)
+ {
+ sample_length = temp_length;
+ RecalcParameters(false);
+ }
+}
+
+
+// User changed sample length (seconds) field
+void CSmpGenDialog::OnSampleSecondsChanged()
+//------------------------------------------
+{
+ CString str;
+ GetDlgItemText(IDC_EDIT_SAMPLE_LENGTH_SEC, str);
+ double temp_seconds = atof(str);
+ if(temp_seconds > 0)
+ {
+ sample_seconds = temp_seconds;
+ RecalcParameters(true);
+ }
+}
+
+
+// User changed sample frequency field
+void CSmpGenDialog::OnSampleFreqChanged()
+//---------------------------------------
+{
+ int temp_freq = GetDlgItemInt(IDC_EDIT_SAMPLE_FREQ);
+ if(temp_freq >= SMPGEN_MINFREQ && temp_freq <= SMPGEN_MAXFREQ)
+ {
+ sample_frequency = temp_freq;
+ RecalcParameters(false);
+ }
+}
+
+
+// Show all expressions that can be input
+void CSmpGenDialog::OnShowExpressions()
+//-------------------------------------
+{
+ HMENU hMenu = ::CreatePopupMenu(), hSubMenu = NULL;
+ if(!hMenu) return;
+
+ for(int i = 0; i < MAX_SAMPLEGEN_EXPRESSIONS; i++)
+ {
+ if(menu_descriptions[i].expression == "")
+ {
+ // add sub menu
+ if(hSubMenu != NULL) ::DestroyMenu(hSubMenu);
+ hSubMenu = ::CreatePopupMenu();
+
+ AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hSubMenu, menu_descriptions[i].description.c_str());
+ } else
+ {
+ // add sub menu entry (formula)
+ AppendMenu(hSubMenu, MF_STRING, ID_SAMPLE_GENERATOR_MENU + i, menu_descriptions[i].description.c_str());
+ }
+ }
+
+ // place popup menu below button
+ RECT button;
+ GetDlgItem(IDC_BUTTON_SHOW_EXPRESSIONS)->GetWindowRect(&button);
+ ::TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, button.left, button.bottom, 0, m_hWnd, NULL);
+ ::DestroyMenu(hMenu);
+ ::DestroyMenu(hSubMenu);
+}
+
+
+// Show all expression presets
+void CSmpGenDialog::OnShowPresets()
+//---------------------------------
+{
+ HMENU hMenu = ::CreatePopupMenu();
+ if(!hMenu) return;
+
+ bool prestsExist = false;
+ for(size_t i = 0; i < presets.GetNumPresets(); i++)
+ {
+ if(presets.GetPreset(i)->expression != "")
+ {
+ AppendMenu(hMenu, MF_STRING, ID_SAMPLE_GENERATOR_PRESET_MENU + i, presets.GetPreset(i)->description.c_str());
+ prestsExist = true;
+ }
+ }
+
+ if(prestsExist) AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+
+ AppendMenu(hMenu, MF_STRING, ID_SAMPLE_GENERATOR_PRESET_MENU + MAX_SAMPLEGEN_PRESETS, _TEXT("Manage..."));
+
+ CString result;
+ GetDlgItemText(IDC_EDIT_FORMULA, result);
+ if((!result.IsEmpty()) && (presets.GetNumPresets() < MAX_SAMPLEGEN_PRESETS))
+ {
+ AppendMenu(hMenu, MF_STRING, ID_SAMPLE_GENERATOR_PRESET_MENU + MAX_SAMPLEGEN_PRESETS + 1, _TEXT("Add current..."));
+ }
+
+ // place popup menu below button
+ RECT button;
+ GetDlgItem(IDC_BUTTON_SAMPLEGEN_PRESETS)->GetWindowRect(&button);
+ ::TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, button.left, button.bottom, 0, m_hWnd, NULL);
+ ::DestroyMenu(hMenu);
+}
+
+
+
+// Insert expression from context menu
+void CSmpGenDialog::OnInsertExpression(UINT nId)
+//----------------------------------------------
+{
+ if((nId < ID_SAMPLE_GENERATOR_MENU) || (nId >= ID_SAMPLE_GENERATOR_MENU + MAX_SAMPLEGEN_EXPRESSIONS)) return;
+
+ expression += " " + menu_descriptions[nId - ID_SAMPLE_GENERATOR_MENU].expression;
+
+ SetDlgItemText(IDC_EDIT_FORMULA, expression.c_str());
+}
+
+
+// Select a preset (or manage them, or add one)
+void CSmpGenDialog::OnSelectPreset(UINT nId)
+//------------------------------------------
+{
+ if((nId < ID_SAMPLE_GENERATOR_PRESET_MENU) || (nId >= ID_SAMPLE_GENERATOR_PRESET_MENU + MAX_SAMPLEGEN_PRESETS + 2)) return;
+
+ if(nId - ID_SAMPLE_GENERATOR_PRESET_MENU >= MAX_SAMPLEGEN_PRESETS)
+ {
+ // add...
+ if((nId - ID_SAMPLE_GENERATOR_PRESET_MENU == MAX_SAMPLEGEN_PRESETS + 1))
+ {
+ samplegen_expression newPreset;
+ newPreset.description = newPreset.expression = expression;
+ presets.AddPreset(newPreset);
+ // call preset manager now.
+ }
+
+ // manage...
+ CSmpGenPresetDlg dlg(&presets);
+ dlg.DoModal();
+ } else
+ {
+ expression = presets.GetPreset(nId - ID_SAMPLE_GENERATOR_PRESET_MENU)->expression;
+ SetDlgItemText(IDC_EDIT_FORMULA, expression.c_str());
+ }
+
+}
+
+
+// Update input fields, depending on what has been chagned
+void CSmpGenDialog::RecalcParameters(bool secondsChanged, bool forceRefresh)
+//--------------------------------------------------------------------------
+{
+ static bool isLocked = false;
+ if(isLocked) return;
+ isLocked = true; // avoid deadlock
+
+ if(secondsChanged)
+ {
+ // seconds changed => recalc length
+ sample_length = (int)(sample_seconds * sample_frequency);
+ if(sample_length < SMPGEN_MINLENGTH || sample_length > SMPGEN_MAXLENGTH) sample_length = SMPGEN_MAXLENGTH;
+ } else
+ {
+ // length/freq changed => recalc seconds
+ sample_seconds = ((double)sample_length) / ((double)sample_frequency);
+ }
+
+ if(secondsChanged || forceRefresh) SetDlgItemInt(IDC_EDIT_SAMPLE_LENGTH, sample_length);
+ if(secondsChanged || forceRefresh) SetDlgItemInt(IDC_EDIT_SAMPLE_FREQ, sample_frequency);
+ CString str;
+ str.Format("%.4f", sample_seconds);
+ if(!secondsChanged || forceRefresh) SetDlgItemText(IDC_EDIT_SAMPLE_LENGTH_SEC, str);
+
+ int smpsize = sample_length * SMPGEN_MIXBYTES;
+ if(smpsize < 1024)
+ {
+ str.Format("Sample Size: %d Bytes", smpsize);
+ } else if((smpsize >> 10) < 1024)
+ {
+ str.Format("Sample Size: %d KB", smpsize >> 10);
+ } else
+ {
+ str.Format("Sample Size: %d MB", smpsize >> 20);
+ }
+ SetDlgItemText(IDC_STATIC_SMPSIZE_KB, str);
+
+ isLocked = false;
+}
+
+
+// Create a set of default formla presets
+void CSmpGenDialog::CreateDefaultPresets()
+//----------------------------------------
+{
+ samplegen_expression preset;
+
+ preset.description = "A440";
+ preset.expression = "sin(xp * _pi / 50 * 440 * len / freq)";
+ presets.AddPreset(preset);
+
+ preset.description = "Noisy Saw";
+ preset.expression = "(x mod 800) / 800 - 0.5 + rnd (0.1)";
+ presets.AddPreset(preset);
+
+ preset.description = "PWM Filter";
+ preset.expression = "pwm(x, 50 + sin(xp * _pi / 100) * 40, 100) + tri(x, 50)";
+ presets.AddPreset(preset);
+
+ preset.description = "Fat PWM Pad";
+ preset.expression = "pwm(x, xp, 500) + pwm(x, abs(50 - xp), 1000)";
+ presets.AddPreset(preset);
+
+ preset.description = "Dual Square";
+ preset.expression = "if((x mod 100) < 50, (x mod 200), -x mod 200)";
+ presets.AddPreset(preset);
+
+ preset.description = "Noise Hit";
+ preset.expression = "exp(-xp) * (rnd(x) - x / 2)";
+ presets.AddPreset(preset);
+
+ preset.description = "Laser";
+ preset.expression = "sin(xp * _pi * 100 /(xp ^ 2)) * 100 / sqrt(xp)";
+
+ presets.AddPreset(preset);
+ preset.description = "Twinkle, Twinkle...";
+ preset.expression = "sin(xp * _pi * 100 / xp) * 100 / sqrt(xp)";
+
+ preset.description = "FM Tom";
+ preset.expression = "sin(xp * _pi * 2 + (xp / 5 - 50) ^ 2) * exp(-xp / 10)";
+ presets.AddPreset(preset);
+
+ preset.description = "FM Warp";
+ preset.expression = "sin(_pi * xp / 2 * (1 + (1 + sin(_pi * xp / 4 * 50)) / 4)) * exp(-(xp / 8) * .6)";
+ presets.AddPreset(preset);
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// Sample Generator Preset Dialog implementation
+
+
+BEGIN_MESSAGE_MAP(CSmpGenPresetDlg, CDialog)
+ ON_COMMAND(IDC_BUTTON_ADD, OnAddPreset)
+ ON_COMMAND(IDC_BUTTON_REMOVE, OnRemovePreset)
+ ON_EN_CHANGE(IDC_EDIT_PRESET_NAME, OnTextChanged)
+ ON_EN_CHANGE(IDC_EDIT_PRESET_EXPR, OnExpressionChanged)
+ ON_LBN_SELCHANGE(IDC_LIST_SAMPLEGEN_PRESETS, OnListSelChange)
+END_MESSAGE_MAP()
+
+
+BOOL CSmpGenPresetDlg::OnInitDialog()
+//-----------------------------------
+{
+ CDialog::OnInitDialog();
+
+ RefreshList();
+
+ return TRUE;
+}
+
+
+void CSmpGenPresetDlg::OnOK()
+//---------------------------
+{
+ // remove empty presets
+ for(size_t i = 0; i < presets->GetNumPresets(); i++)
+ {
+ if(presets->GetPreset(i)->expression.empty())
+ {
+ presets->RemovePreset(i);
+ }
+ }
+ CDialog::OnOK();
+}
+
+
+void CSmpGenPresetDlg::OnListSelChange()
+//--------------------------------------
+{
+ currentItem = ((CListBox *)GetDlgItem(IDC_LIST_SAMPLEGEN_PRESETS))->GetCurSel() + 1;
+ if(currentItem == 0 || currentItem > presets->GetNumPresets()) return;
+ samplegen_expression *preset = presets->GetPreset(currentItem - 1);
+ if(preset == nullptr) return;
+ SetDlgItemText(IDC_EDIT_PRESET_NAME, preset->description.c_str());
+ SetDlgItemText(IDC_EDIT_PRESET_EXPR, preset->expression.c_str());
+}
+
+
+void CSmpGenPresetDlg::OnTextChanged()
+//------------------------------------
+{
+ if(currentItem == 0 || currentItem > presets->GetNumPresets()) return;
+ CString result;
+ GetDlgItemText(IDC_EDIT_PRESET_NAME, result);
+
+ samplegen_expression *preset = presets->GetPreset(currentItem - 1);
+ if(preset == nullptr) return;
+ preset->description = result;
+
+ CListBox *clist = (CListBox *)GetDlgItem(IDC_LIST_SAMPLEGEN_PRESETS);
+ clist->DeleteString(currentItem - 1);
+ clist->InsertString(currentItem - 1, (preset->description).c_str());
+ clist->SetCurSel(currentItem - 1);
+}
+
+
+void CSmpGenPresetDlg::OnExpressionChanged()
+//------------------------------------------
+{
+ if(currentItem == 0 || currentItem > presets->GetNumPresets()) return;
+ CString result;
+ GetDlgItemText(IDC_EDIT_PRESET_EXPR, result);
+
+ samplegen_expression *preset = presets->GetPreset(currentItem - 1);
+ if(preset != nullptr) preset->expression = result;
+
+}
+
+
+void CSmpGenPresetDlg::OnAddPreset()
+//----------------------------------
+{
+ samplegen_expression newPreset;
+ newPreset.description = "New Preset";
+ newPreset.expression = "";
+ if(presets->AddPreset(newPreset))
+ {
+ currentItem = presets->GetNumPresets();
+ RefreshList();
+ }
+}
+
+
+void CSmpGenPresetDlg::OnRemovePreset()
+//-------------------------------------
+{
+ if(currentItem == 0 || currentItem > presets->GetNumPresets()) return;
+ if(presets->RemovePreset(currentItem - 1))
+ RefreshList();
+}
+
+
+void CSmpGenPresetDlg::RefreshList()
+//----------------------------------
+{
+ CListBox *clist = (CListBox *)GetDlgItem(IDC_LIST_SAMPLEGEN_PRESETS);
+ clist->SetRedraw(FALSE); //disable lisbox refreshes during fill to avoid flicker
+ clist->ResetContent();
+ for(size_t i = 0; i < presets->GetNumPresets(); i++)
+ {
+ samplegen_expression *preset = presets->GetPreset(i);
+ if(preset != nullptr)
+ clist->AddString((preset->description).c_str());
+ }
+ clist->SetRedraw(TRUE); //re-enable lisbox refreshes
+ if(currentItem == 0 || currentItem > presets->GetNumPresets())
+ {
+ currentItem = presets->GetNumPresets();
+ }
+ if(currentItem != 0) clist->SetCurSel(currentItem - 1);
+ OnListSelChange();
+}
Added: trunk/OpenMPT/mptrack/SampleGenerator.h
===================================================================
--- trunk/OpenMPT/mptrack/SampleGenerator.h (rev 0)
+++ trunk/OpenMPT/mptrack/SampleGenerator.h 2010-02-13 13:15:18 UTC (rev 491)
@@ -0,0 +1,207 @@
+/*
+ * SampleGenerator.h
+ * -----------------
+ * Purpose: Header file for sample generator
+ * Notes : (currently none)
+ * Authors: OpenMPT Devs
+ */
+
+#pragma once
+#include "mptrack.h"
+#include "Mainfrm.h"
+#include "Sndfile.h"
+#include "../muParser/include/muParser.h"
+
+// sample length
+#define SMPGEN_MINLENGTH 1
+#define SMPGEN_MAXLENGTH MAX_SAMPLE_LENGTH
+// sample frequency
+#define SMPGEN_MINFREQ 1
+#define SMPGEN_MAXFREQ 96000
+// 16-bit sample quality - when changing this, also change CSampleGenerator::sampling_type and 16-bit flags in SampleGenerator.cpp!
+#define SMPGEN_MIXBYTES 2
+
+enum smpgen_clip_methods
+{
+ smpgen_clip,
+ smpgen_overflow,
+ smpgen_normalize,
+};
+
+//====================
+class CSampleGenerator
+//====================
+{
+protected:
+
+ // sample parameters
+ static int sample_frequency;
+ static int sample_length;
+ static mu::string_type expression;
+ static smpgen_clip_methods sample_clipping;
+
+ // rendering helper variables (they're here for the callback functions)
+ static mu::value_type *sample_buffer;
+ static size_t samples_written;
+
+ typedef int16 sampling_type; // has to match SMPGEN_MIXBYTES!
+ static const sampling_type sample_maxvalue = (1 << ((SMPGEN_MIXBYTES << 3) - 1)) - 1;
+
+ // muParser object for parsing the expression
+ mu::Parser muParser;
+
+ // Rendering callback functions
+ // functions
+ static mu::value_type ClipCallback(mu::value_type val, mu::value_type min, mu::value_type max) { return CLAMP(val, min, max); };
+ static mu::value_type PWMCallback(mu::value_type pos, mu::value_type duty, mu::value_type width) { if((int)width == 0) return 0; else return (((int)pos % (int)width) < ((duty / 100) * width)) ? 1 : -1; };
+ static mu::value_type RndCallback(mu::value_type v) { return v*std::rand()/(mu::value_type)(RAND_MAX+1.0); }
+ static mu::value_type SampleDataCallback(mu::value_type v);
+ static mu::value_type TriangleCallback(mu::value_type pos, mu::value_type width) { if((int)width == 0) return 0; else return abs(((int)pos % (int)(width)) - width / 2) / (width / 4) - 1; };
+
+ // binary operators
+ static mu::value_type ModuloCallback(mu::value_type x, mu::value_type y) { if((int)y == 0) return 0; else return ((int)x) % ((int)y); };
+
+ void ShowError(mu::Parser::exception_type *e);
+
+public:
+
+ bool ShowDialog();
+ bool TestExpression();
+ bool CanRenderSample();
+ bool RenderSample(CSoundFile *pSndFile, SAMPLEINDEX nSample);
+
+ CSampleGenerator();
+
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+// Sample Generator Formula Preset implementation
+
+
+struct samplegen_expression
+{
+ std::string description; // e.g. "Pulse"
+ mu::string_type expression; // e.g. "pwm(x,y,z)" - empty if this is a sub menu
+};
+#define MAX_SAMPLEGEN_PRESETS 100
+
+
+//==================
+class CSmpGenPresets
+//==================
+{
+protected:
+ vector<samplegen_expression> presets;
+
+public:
+ bool AddPreset(samplegen_expression new_preset) { if(GetNumPresets() >= MAX_SAMPLEGEN_PRESETS) return false; presets.push_back(new_preset); return true;};
+ bool RemovePreset(size_t which) { if(which < GetNumPresets()) { presets.erase(presets.begin() + which); return true; } else return false; };
+ samplegen_expression *GetPreset(size_t which) { if(which < GetNumPresets()) return &presets[which]; else return nullptr; };
+ size_t GetNumPresets() { return presets.size(); };
+ void Clear() { presets.clear(); };
+
+ CSmpGenPresets() { Clear(); }
+ ~CSmpGenPresets() { Clear(); }
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+// Sample Generator Dialog implementation
+
+
+//=================================
+class CSmpGenDialog: public CDialog
+//=================================
+{
+protected:
+
+ // sample parameters
+ int sample_frequency;
+ int sample_length;
+ double sample_seconds;
+ mu::string_type expression;
+ smpgen_clip_methods sample_clipping;
+ // pressed "OK"?
+ bool apply;
+ // preset slots
+ CSmpGenPresets presets;
+
+ HFONT hButtonFont; // "Marlett" font for "dropdown" button
+
+ void RecalcParameters(bool secondsChanged, bool forceRefresh = false);
+
+ // function presets
+ void CreateDefaultPresets();
+
+public:
+
+ int GetFrequency() { return sample_frequency; };
+ int GetLength() { return sample_length; };
+ smpgen_clip_methods GetClipping() { return sample_clipping; }
+ mu::string_type GetExpression() { return expression; };
+ bool CanApply() { return apply; };
+
+ CSmpGenDialog(int freq, int len, smpgen_clip_methods clipping, mu::string_type expr):CDialog(IDD_SAMPLE_GENERATOR, CMainFrame::GetMainFrame())
+ {
+ sample_frequency = freq;
+ sample_length = len;
+ sample_clipping = clipping;
+ expression = expr;
+ apply = false;
+ }
+
+protected:
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+ virtual void OnCancel();
+
+ afx_msg void OnSampleLengthChanged();
+ afx_msg void OnSampleSecondsChanged();
+ afx_msg void OnSampleFreqChanged();
+ afx_msg void OnExpressionChanged();
+ afx_msg void OnShowExpressions();
+ afx_msg void OnShowPresets();
+ afx_msg void OnInsertExpression(UINT nId);
+ afx_msg void OnSelectPreset(UINT nId);
+
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+// Sample Generator Preset Dialog implementation
+
+
+//====================================
+class CSmpGenPresetDlg: public CDialog
+//====================================
+{
+protected:
+ CSmpGenPresets *presets;
+ size_t currentItem; // first item is actually 1!
+
+ void RefreshList();
+
+public:
+ CSmpGenPresetDlg(CSmpGenPresets *pPresets):CDialog(IDD_SAMPLE_GENERATOR_PRESETS, CMainFrame::GetMainFrame())
+ {
+ presets = pPresets;
+ currentItem = 0;
+ }
+
+protected:
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ afx_msg void OnListSelChange();
+
+ afx_msg void OnTextChanged();
+ afx_msg void OnExpressionChanged();
+
+ afx_msg void OnAddPreset();
+ afx_msg void OnRemovePreset();
+
+ DECLARE_MESSAGE_MAP()
+};
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2010-02-10 18:21:42 UTC (rev 490)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-02-13 13:15:18 UTC (rev 491)
@@ -331,7 +331,7 @@
32, //Min tempo
255, //Max tempo
1, //Min pattern rows
- 256, //Max pattern rows
+ 200, //Max pattern rows
25, //Max mod name length
25, //Max sample name length
12, //Max sample filename length
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-10 18:21:48
|
Revision: 490
http://modplug.svn.sourceforge.net/modplug/?rev=490&view=rev
Author: saga-games
Date: 2010-02-10 18:21:42 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
[Fix] IT Saver: Set unused channels' panning positions to 0xA0 like IT does (appears to fix a problem in IT's GUI)
[Fix] IT Saver: Fixed IT sample flags which could potentionally cause IT to screw up on loading/saving MPT-made modules with samples that are not used by an instrument.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_it.cpp
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-09 20:21:38 UTC (rev 489)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-10 18:21:42 UTC (rev 490)
@@ -1880,7 +1880,7 @@
header.sep = 128; // pan separation
dwHdrPos = sizeof(header) + header.ordnum;
// Channel Pan and Volume
- memset(header.chnpan, 0xFF, 64);
+ memset(header.chnpan, 0xA0, 64);
memset(header.chnvol, 64, 64);
for (UINT ich=0; ich</*m_nChannels*/64; ich++) //Header only has room for settings for 64 chans...
{
@@ -2286,25 +2286,45 @@
memcpy(itss.name, m_szNames[nsmp], 26);
itss.id = 0x53504D49;
itss.gvl = (BYTE)psmp->nGlobalVol;
- if (m_nInstruments)
+
+ UINT flags = RS_PCM8S;
+ if(psmp->nLength && psmp->pSample)
{
- for (UINT iu=1; iu<=m_nInstruments; iu++) if (Instruments[iu])
+ itss.flags = 0x01;
+ if (psmp->uFlags & CHN_LOOP) itss.flags |= 0x10;
+ if (psmp->uFlags & CHN_SUSTAINLOOP) itss.flags |= 0x20;
+ if (psmp->uFlags & CHN_PINGPONGLOOP) itss.flags |= 0x40;
+ if (psmp->uFlags & CHN_PINGPONGSUSTAIN) itss.flags |= 0x80;
+#ifndef NO_PACKING
+ if (nPacking)
{
- MODINSTRUMENT *pIns = Instruments[iu];
- for (UINT ju=0; ju<128; ju++) if (pIns->Keyboard[ju] == nsmp)
+ if ((!(psmp->uFlags & (CHN_16BIT|CHN_STEREO)))
+ && (CanPackSample(psmp->pSample, psmp->nLength, nPacking)))
{
- itss.flags = 0x01;
- break;
+ flags = RS_ADPCM4;
+ itss.cvt = 0xFF;
}
+ } else
+#endif // NO_PACKING
+ {
+ if (psmp->uFlags & CHN_STEREO)
+ {
+ flags = RS_STPCM8S;
+ itss.flags |= 0x04;
+ }
+ if (psmp->uFlags & CHN_16BIT)
+ {
+ itss.flags |= 0x02;
+ flags = (psmp->uFlags & CHN_STEREO) ? RS_STPCM16S : RS_PCM16S;
+ }
}
- } else
+ itss.cvt = 0x01;
+ }
+ else
{
- itss.flags = 0x01;
+ itss.flags = 0x00;
}
- if (psmp->uFlags & CHN_LOOP) itss.flags |= 0x10;
- if (psmp->uFlags & CHN_SUSTAINLOOP) itss.flags |= 0x20;
- if (psmp->uFlags & CHN_PINGPONGLOOP) itss.flags |= 0x40;
- if (psmp->uFlags & CHN_PINGPONGSUSTAIN) itss.flags |= 0x80;
+
itss.C5Speed = psmp->nC5Speed;
if (!itss.C5Speed) itss.C5Speed = 8363;
itss.length = psmp->nLength;
@@ -2319,34 +2339,8 @@
itss.vid = min(psmp->nVibDepth, 32);
itss.vir = min(psmp->nVibSweep, 255); //(psmp->nVibSweep < 64) ? psmp->nVibSweep * 4 : 255;
if (psmp->uFlags & CHN_PANNING) itss.dfp |= 0x80;
- if ((psmp->pSample) && (psmp->nLength)) itss.cvt = 0x01;
- UINT flags = RS_PCM8S;
-#ifndef NO_PACKING
- if (nPacking)
- {
- if ((!(psmp->uFlags & (CHN_16BIT|CHN_STEREO)))
- && (CanPackSample(psmp->pSample, psmp->nLength, nPacking)))
- {
- flags = RS_ADPCM4;
- itss.cvt = 0xFF;
- }
- } else
-#endif // NO_PACKING
- {
- if (psmp->uFlags & CHN_STEREO)
- {
- flags = RS_STPCM8S;
- itss.flags |= 0x04;
- }
- if (psmp->uFlags & CHN_16BIT)
- {
- itss.flags |= 0x02;
- flags = (psmp->uFlags & CHN_STEREO) ? RS_STPCM16S : RS_PCM16S;
- }
- }
+
itss.samplepointer = dwPos;
- if (!(psmp->pSample) || !(psmp->nLength))
- itss.flags = 0;
fseek(f, smppos[nsmp-1], SEEK_SET);
fwrite(&itss, 1, sizeof(ITSAMPLESTRUCT), f);
fseek(f, dwPos, SEEK_SET);
@@ -2489,7 +2483,7 @@
header.sep = 128; // pan separation
dwHdrPos = sizeof(header) + header.ordnum;
// Channel Pan and Volume
- memset(header.chnpan, 0xFF, 64);
+ memset(header.chnpan, 0xA0, 64);
memset(header.chnvol, 64, 64);
for (UINT ich=0; ich</*m_nChannels*/64; ich++) //Header only has room for settings for 64 chans...
{
@@ -2882,25 +2876,34 @@
SetNullTerminator(itss.name);
itss.id = 0x53504D49;
itss.gvl = (BYTE)psmp->nGlobalVol;
- if (m_nInstruments)
+
+ UINT flags = RS_PCM8S;
+ if(psmp->nLength && psmp->pSample)
{
- for (UINT iu=1; iu<=m_nInstruments; iu++) if (Instruments[iu])
+ itss.flags = 0x01;
+ if (psmp->uFlags & CHN_LOOP) itss.flags |= 0x10;
+ if (psmp->uFlags & CHN_SUSTAINLOOP) itss.flags |= 0x20;
+ if (psmp->uFlags & CHN_PINGPONGLOOP) itss.flags |= 0x40;
+ if (psmp->uFlags & CHN_PINGPONGSUSTAIN) itss.flags |= 0x80;
+
+ if (psmp->uFlags & CHN_STEREO)
{
- MODINSTRUMENT *pIns = Instruments[iu];
- for (UINT ju=0; ju<128; ju++) if (pIns->Keyboard[ju] == nsmp)
- {
- itss.flags = 0x01;
- break;
- }
+ flags = RS_STPCM8S;
+ itss.flags |= 0x04;
}
- } else
+ if (psmp->uFlags & CHN_16BIT)
+ {
+ itss.flags |= 0x02;
+ flags = (psmp->uFlags & CHN_STEREO) ? RS_STPCM16S : RS_PCM16S;
+ }
+
+ itss.cvt = 0x01;
+ }
+ else
{
- itss.flags = 0x01;
+ itss.flags = 0x00;
}
- if (psmp->uFlags & CHN_LOOP) itss.flags |= 0x10;
- if (psmp->uFlags & CHN_SUSTAINLOOP) itss.flags |= 0x20;
- if (psmp->uFlags & CHN_PINGPONGLOOP) itss.flags |= 0x40;
- if (psmp->uFlags & CHN_PINGPONGSUSTAIN) itss.flags |= 0x80;
+
itss.C5Speed = psmp->nC5Speed;
if (!itss.C5Speed) itss.C5Speed = 8363;
itss.length = psmp->nLength;
@@ -2915,21 +2918,8 @@
itss.vid = min(psmp->nVibDepth, 32);
itss.vir = min(psmp->nVibSweep, 255);
if (psmp->uFlags & CHN_PANNING) itss.dfp |= 0x80;
- if ((psmp->pSample) && (psmp->nLength)) itss.cvt = 0x01;
- UINT flags = RS_PCM8S;
- if (psmp->uFlags & CHN_STEREO)
- {
- flags = RS_STPCM8S;
- itss.flags |= 0x04;
- }
- if (psmp->uFlags & CHN_16BIT)
- {
- itss.flags |= 0x02;
- flags = (psmp->uFlags & CHN_STEREO) ? RS_STPCM16S : RS_PCM16S;
- }
+
itss.samplepointer = dwPos;
- if (!(psmp->pSample) || !(psmp->nLength))
- itss.flags = 0;
fseek(f, smppos[nsmp-1], SEEK_SET);
fwrite(&itss, 1, sizeof(ITSAMPLESTRUCT), f);
fseek(f, dwPos, SEEK_SET);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-09 20:21:49
|
Revision: 489
http://modplug.svn.sourceforge.net/modplug/?rev=489&view=rev
Author: saga-games
Date: 2010-02-09 20:21:38 +0000 (Tue, 09 Feb 2010)
Log Message:
-----------
[Fix] Pattern Editor: In Note Properties, the waveform display for S[345]x (and equivalent MOD/XM effeects) was not always fully visible ("continue" addition was cut off)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-02-08 21:41:59 UTC (rev 488)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-02-09 20:21:38 UTC (rev 489)
@@ -2678,10 +2678,10 @@
case 0x01: strcpy(s, "ramp down"); break;
case 0x02: strcpy(s, "square wave"); break;
case 0x03: strcpy(s, "random"); break;
- case 0x04: strcpy(s, "sine wave (continue)"); break;
- case 0x05: strcpy(s, "ramp down (continue)"); break;
- case 0x06: strcpy(s, "square wave (continue)"); break;
- case 0x07: strcpy(s, "random (continue)"); break;
+ case 0x04: strcpy(s, "sine wave (cont.)"); break;
+ case 0x05: strcpy(s, "ramp down (cont.)"); break;
+ case 0x06: strcpy(s, "square wave (cont.)"); break;
+ case 0x07: strcpy(s, "random (cont.)"); break;
default: strcpy(s, "ignore"); break;
}
break;
@@ -2737,10 +2737,10 @@
case 0x02: case 0x0A: strcpy(s, "square wave"); break;
case 0x03: case 0x0B: strcpy(s, "square wave"); break;
- case 0x04: case 0x0C: strcpy(s, "sine wave (continue)"); break;
- case 0x05: case 0x0D: strcpy(s, "ramp down (continue)"); break;
- case 0x06: case 0x0E: strcpy(s, "square wave (continue)"); break;
- case 0x07: case 0x0F: strcpy(s, "square wave (continue)"); break;
+ case 0x04: case 0x0C: strcpy(s, "sine wave (cont.)"); break;
+ case 0x05: case 0x0D: strcpy(s, "ramp down (cont.)"); break;
+ case 0x06: case 0x0E: strcpy(s, "square wave (cont.)"); break;
+ case 0x07: case 0x0F: strcpy(s, "square wave (cont.)"); break;
}
break;
case 0x60: // pattern loop
@@ -3516,4 +3516,3 @@
}
return displayName;
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-08 21:42:08
|
Revision: 488
http://modplug.svn.sourceforge.net/modplug/?rev=488&view=rev
Author: saga-games
Date: 2010-02-08 21:41:59 +0000 (Mon, 08 Feb 2010)
Log Message:
-----------
[Fix] Pattern Editor: When working with multiple sequences, switching to the pattern editor for the first time automatically marked the document as modified.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-02-07 18:32:14 UTC (rev 487)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-02-08 21:41:59 UTC (rev 488)
@@ -1255,7 +1255,11 @@
{
SEQUENCEINDEX newSeq = (SEQUENCEINDEX)GetDlgItemInt(IDC_EDIT_SEQNUM);
- if (newSeq >= MAX_SEQUENCES)
+ // avoid reloading the order list and thus setting the document modified
+ if(newSeq == m_pSndFile->Order.GetCurrentSequenceIndex())
+ return;
+
+ if (newSeq >= MAX_SEQUENCES)
{
newSeq = MAX_SEQUENCES - 1;
SetDlgItemInt(IDC_EDIT_SEQNUM, MAX_SEQUENCES - 1, FALSE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-07 18:32:23
|
Revision: 487
http://modplug.svn.sourceforge.net/modplug/?rev=487&view=rev
Author: saga-games
Date: 2010-02-07 18:32:14 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
[Imp] General Tab: Disabled tempo slider for MOD files (it was just confusing)
[Imp] General Tab: Disabled global volume slider for MOD files, instead enabled the sample pre-amp slider (so it is also possible to make output louder)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_gen.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2010-02-07 15:33:33 UTC (rev 486)
+++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2010-02-07 18:32:14 UTC (rev 487)
@@ -207,19 +207,21 @@
const BOOL bIsNotMOD_S3M = ((bIsNotMOD) && (m_pSndFile->GetType() != MOD_TYPE_S3M));
m_EditTempo.EnableWindow(bIsNotMOD);
m_SpinTempo.EnableWindow(bIsNotMOD);
+ m_SliderTempo.EnableWindow(bIsNotMOD);
m_EditSpeed.EnableWindow(bIsNotMOD);
m_SpinSpeed.EnableWindow(bIsNotMOD);
+ m_SliderGlobalVol.EnableWindow(bIsNotMOD);
m_EditGlobalVol.EnableWindow(bIsNotMOD);
m_SpinGlobalVol.EnableWindow(bIsNotMOD);
m_EditSamplePA.EnableWindow(bIsNotMOD);
m_SpinSamplePA.EnableWindow(bIsNotMOD);
- m_SliderSamplePreAmp.EnableWindow(bIsNotMOD);
+ //m_SliderSamplePreAmp.EnableWindow(bIsNotMOD);
m_SliderVSTiVol.EnableWindow(bIsNotMOD_S3M);
m_EditVSTiVol.EnableWindow(bIsNotMOD_S3M);
m_SpinVSTiVol.EnableWindow(bIsNotMOD_S3M);
m_EditRestartPos.EnableWindow(specs.hasRestartPos ? TRUE : FALSE);
- //Note: Global volume slider is not disabled for MOD
+ //Note: Sample volume slider is not disabled for MOD
//on purpose(can be used to control play volume)
// MOD Type
@@ -274,8 +276,7 @@
if ((tempo >= m_pSndFile->GetModSpecifications().tempoMin) && (tempo <= m_pSndFile->GetModSpecifications().tempoMax) && (tempo != m_pSndFile->m_nDefaultTempo)) {
m_pSndFile->m_nDefaultTempo = tempo;
m_pSndFile->m_nMusicTempo = tempo;
- if(m_pSndFile->GetType() != MOD_TYPE_MOD)
- m_pModDoc->SetModified();
+ m_pModDoc->SetModified();
m_pModDoc->UpdateAllViews(NULL, HINT_MODGENERAL, this);
}
@@ -286,8 +287,7 @@
if ((gv >= 0) && (gv <= MAX_SLIDER_GLOBAL_VOL) && (gv != m_pSndFile->m_nDefaultGlobalVolume)) {
m_pSndFile->m_nGlobalVolume = gv;
m_pSndFile->m_nDefaultGlobalVolume = gv;
- if(m_pSndFile->GetType() != MOD_TYPE_MOD)
- m_pModDoc->SetModified();
+ m_pModDoc->SetModified();
m_pModDoc->UpdateAllViews(NULL, HINT_MODGENERAL, this);
}
@@ -297,7 +297,8 @@
int spa = MAX_SLIDER_SAMPLE_VOL - m_SliderSamplePreAmp.GetPos();
if ((spa >= 0) && (spa <= MAX_SLIDER_SAMPLE_VOL) && (spa != m_pSndFile->m_nSamplePreAmp)) {
m_pSndFile->m_nSamplePreAmp = spa;
- m_pModDoc->SetModified();
+ if(m_pSndFile->GetType() != MOD_TYPE_MOD)
+ m_pModDoc->SetModified();
m_pModDoc->UpdateAllViews(NULL, HINT_MODGENERAL, this);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-07 15:33:51
|
Revision: 486
http://modplug.svn.sourceforge.net/modplug/?rev=486&view=rev
Author: saga-games
Date: 2010-02-07 15:33:33 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-02-07 13:23:29 UTC (rev 485)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-02-07 15:33:33 UTC (rev 486)
@@ -775,6 +775,7 @@
CModControlDlg::OnInitDialog();
m_bInitialized = FALSE;
if ((!m_pModDoc) || (!m_pSndFile)) return TRUE;
+
m_NoteMap.Init(this);
m_ToolBar.Init();
m_ToolBar.AddButton(IDC_INSTRUMENT_NEW, TIMAGE_INSTR_NEW);
@@ -783,8 +784,6 @@
m_ToolBar.AddButton(IDC_INSTRUMENT_PLAY, TIMAGE_PREVIEW);
m_SpinInstrument.SetRange(0, 0);
m_SpinInstrument.EnableWindow(FALSE);
- m_EditName.SetLimitText(32);
- m_EditFileName.SetLimitText(20);
// NNA
m_ComboNNA.AddString("Note Cut");
m_ComboNNA.AddString("Continue");
@@ -1030,6 +1029,12 @@
if (!m_bInitialized) dwHintMask |= HINT_MODTYPE;
if (dwHintMask & HINT_MODTYPE)
{
+ const CModSpecifications *specs = &m_pSndFile->GetModSpecifications();
+
+ // Limit text fields
+ m_EditName.SetLimitText(specs->instrNameLengthMax);
+ m_EditFileName.SetLimitText(specs->instrFilenameLengthMax);
+
BOOL bITandMPT = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE;
//rewbs.instroVSTi
BOOL bITandXM = (((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) || (m_pSndFile->m_nType == MOD_TYPE_XM)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE;
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-02-07 13:23:29 UTC (rev 485)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2010-02-07 15:33:33 UTC (rev 486)
@@ -183,6 +183,7 @@
CModControlDlg::OnInitDialog();
if (!m_pSndFile) return TRUE;
m_bInitialized = FALSE;
+
// Zoom Selection
m_ComboZoom.AddString("Auto");
m_ComboZoom.AddString("1:1");
@@ -212,8 +213,6 @@
m_ToolBar2.AddButton(IDC_SAMPLE_INVERT, TIMAGE_SAMPLE_INVERT);
m_ToolBar2.AddButton(IDC_SAMPLE_SIGN_UNSIGN, TIMAGE_SAMPLE_UNSIGN);
// Setup Controls
- m_EditName.SetLimitText(32);
- m_EditFileName.SetLimitText(22);
m_SpinVolume.SetRange(0, 64);
m_SpinGlobalVol.SetRange(0, 64);
//rewbs.fix36944
@@ -241,7 +240,7 @@
m_SpinVibRate.SetRange(0, 64);
}
- for (UINT i=BASENOTE_MIN; i<BASENOTE_MAX; i++)
+ for (UINT i = BASENOTE_MIN; i < BASENOTE_MAX; i++)
{
CHAR s[32];
wsprintf(s, "%s%d", szNoteNames[i%12], i/12);
@@ -543,6 +542,12 @@
// Updating Ranges
if (dwHintMask & HINT_MODTYPE)
{
+ const CModSpecifications *specs = &m_pSndFile->GetModSpecifications();
+
+ // Limit text fields
+ m_EditName.SetLimitText(specs->sampleNameLengthMax);
+ m_EditFileName.SetLimitText(specs->sampleFilenameLengthMax);
+
BOOL b;
// Loop Type
m_ComboLoopType.ResetContent();
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2010-02-07 13:23:29 UTC (rev 485)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-02-07 15:33:33 UTC (rev 486)
@@ -30,7 +30,11 @@
TEMPO tempoMax;
ROWINDEX patternRowsMin;
ROWINDEX patternRowsMax;
- uint16 modNameLengthMax; //Meaning 'usable letters', possible null character is not included.
+ uint16 modNameLengthMax; //Meaning 'usable letters', possible null character is not included.
+ uint16 sampleNameLengthMax; //Dito
+ uint16 sampleFilenameLengthMax; //Dito
+ uint16 instrNameLengthMax; //Dito
+ uint16 instrFilenameLengthMax; //Dito
SAMPLEINDEX samplesMax;
INSTRUMENTINDEX instrumentsMax;
BYTE defaultMixLevels;
@@ -71,6 +75,10 @@
1, //Min pattern rows
1024, //Max pattern rows
25, //Max mod name length
+ 26, //Max sample name length
+ 12, //Max sample filename length
+ 26, //Max instrument name length
+ 12, //Max instrument filename length
4000, //SamplesMax
256, //instrumentMax
mixLevels_117RC3, //defaultMixLevels
@@ -100,12 +108,16 @@
64, //Pattern max.
128, //Order max.
4, //Channel min
- 4, //Channel max
+ 32, //Channel max
32, //Min tempo
255, //Max tempo
64, //Min pattern rows
64, //Max pattern rows
20, //Max mod name length
+ 22, //Max sample name length
+ 0, //Max sample filename length
+ 0, //Max instrument name length
+ 0, //Max instrument filename length
31, //SamplesMax
0, //instrumentMax
mixLevels_original, //defaultMixLevels
@@ -139,6 +151,10 @@
64, //Min pattern rows
64, //Max pattern rows
20, //Max mod name length
+ 22, //Max sample name length
+ 0, //Max sample filename length
+ 0, //Max instrument name length
+ 0, //Max instrument filename length
31, //SamplesMax
0, //instrumentMax
mixLevels_original, //defaultMixLevels
@@ -171,6 +187,10 @@
1, //Min pattern rows
256, //Max pattern rows
20, //Max mod name length
+ 22, //Max sample name length
+ 0, //Max sample filename length
+ 22, //Max instrument name length
+ 0, //Max instrument filename length
31, //SamplesMax (actually 16 per instrument)
128, //instrumentMax
mixLevels_original, //defaultMixLevels
@@ -204,6 +224,10 @@
1, //Min pattern rows
1024, //Max pattern rows
20, //Max mod name length
+ 22, //Max sample name length
+ 0, //Max sample filename length
+ 22, //Max instrument name length
+ 0, //Max instrument filename length
4000, //SamplesMax
256, //instrumentMax
mixLevels_117RC3, //defaultMixLevels
@@ -236,6 +260,10 @@
64, //Min pattern rows
64, //Max pattern rows
27, //Max mod name length
+ 27, //Max sample name length
+ 12, //Max sample filename length
+ 0, //Max instrument name length
+ 0, //Max instrument filename length
99, //SamplesMax
0, //instrumentMax
mixLevels_original, //defaultMixLevels
@@ -269,6 +297,10 @@
64, //Min pattern rows
64, //Max pattern rows
27, //Max mod name length
+ 27, //Max sample name length
+ 12, //Max sample filename length
+ 0, //Max instrument name length
+ 0, //Max instrument filename length
99, //SamplesMax
0, //instrumentMax
mixLevels_original, //defaultMixLevels
@@ -301,6 +333,10 @@
1, //Min pattern rows
256, //Max pattern rows
25, //Max mod name length
+ 25, //Max sample name length
+ 12, //Max sample filename length
+ 25, //Max instrument name length
+ 12, //Max instrument filename length
99, //SamplesMax
99, //instrumentMax
mixLevels_original, //defaultMixLevels
@@ -333,6 +369,10 @@
1, //Min pattern rows
1024, //Max pattern rows
25, //Max mod name length
+ 25, //Max sample name length
+ 12, //Max sample filename length
+ 25, //Max instrument name length
+ 12, //Max instrument filename length
4000, //SamplesMax
256, //instrumentMax
mixLevels_117RC3, //defaultMixLevels
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-07 13:23:41
|
Revision: 485
http://modplug.svn.sourceforge.net/modplug/?rev=485&view=rev
Author: saga-games
Date: 2010-02-07 13:23:29 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
[Fix] Pattern Editor: The status bar ("Position x of y") only the showed order length for the first subtune if subtunes were separated by an "---" order item.
[Fix] Instrument IO: Flags from old ITI/XI files should also be loaded correctly now.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Sampleio.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-06 17:43:04 UTC (rev 484)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-07 13:23:29 UTC (rev 485)
@@ -702,7 +702,7 @@
}
else
{
- const ORDERINDEX nLength = pSndFile->Order.GetLengthFirstEmpty();
+ const ORDERINDEX nLength = pSndFile->Order.GetLengthTailTrimmed();
wsprintf(s, "Position %d of %d (%02Xh of %02Xh)",
m_nScrollPos, nLength, m_nScrollPos, nLength);
}
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-06 17:43:04 UTC (rev 484)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-07 13:23:29 UTC (rev 485)
@@ -846,24 +846,7 @@
// fix old instrument flags which got broken in OpenMPT 1.17.03.03 due to refactoring (rev 415).
if(version == 0x00000101 && fcode == 'dF..')
{
- DWORD dwFlags = Instruments[i]->dwFlags; // more convenient
- DWORD dwNewFlags = 0;
- if(dwFlags & 0x0001) Instruments[i]->VolEnv.dwFlags |= ENV_ENABLED;
- if(dwFlags & 0x0002) Instruments[i]->VolEnv.dwFlags |= ENV_SUSTAIN;
- if(dwFlags & 0x0004) Instruments[i]->VolEnv.dwFlags |= ENV_LOOP;
- if(dwFlags & 0x0008) Instruments[i]->PanEnv.dwFlags |= ENV_ENABLED;
- if(dwFlags & 0x0010) Instruments[i]->PanEnv.dwFlags |= ENV_SUSTAIN;
- if(dwFlags & 0x0020) Instruments[i]->PanEnv.dwFlags |= ENV_LOOP;
- if(dwFlags & 0x0040) Instruments[i]->PitchEnv.dwFlags |= ENV_ENABLED;
- if(dwFlags & 0x0080) Instruments[i]->PitchEnv.dwFlags |= ENV_SUSTAIN;
- if(dwFlags & 0x0100) Instruments[i]->VolEnv.dwFlags |= ENV_LOOP;
- if(dwFlags & 0x0200) dwNewFlags |= INS_SETPANNING;
- if(dwFlags & 0x0400) Instruments[i]->PitchEnv.dwFlags |= ENV_FILTER;
- if(dwFlags & 0x0800) Instruments[i]->VolEnv.dwFlags |= ENV_CARRY;
- if(dwFlags & 0x1000) Instruments[i]->PanEnv.dwFlags |= ENV_CARRY;
- if(dwFlags & 0x2000) Instruments[i]->PitchEnv.dwFlags |= ENV_CARRY;
- if(dwFlags & 0x4000) dwNewFlags |= INS_MUTE;
- Instruments[i]->dwFlags = dwNewFlags;
+ ConvertOldExtendedFlagFormat(Instruments[i]);
}
break;
}
Modified: trunk/OpenMPT/soundlib/Sampleio.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-02-06 17:43:04 UTC (rev 484)
+++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-02-07 13:23:29 UTC (rev 485)
@@ -2056,6 +2056,8 @@
// Seek for supported extended settings header
if( code == 'MPTX' )
{
+ bool newFormat = false; // new flag format (separate flags for envelopes)
+ bool hasFlags = false; // do we really need to convert the flags?
pData += sizeof(code); // jump extension header code
while( (uintptr_t)(pData - pDataStart) <= nMemLength - 4)
@@ -2063,11 +2065,42 @@
memcpy(&code, pData, sizeof(code)); // read field code
pData += sizeof(code); // jump field code
ReadExtendedInstrumentProperty(pIns, code, pData, pEnd);
+ if(code == 'VFLG')
+ newFormat = true;
+ if(code == 'dF..')
+ hasFlags = true;
}
+ if(!newFormat && hasFlags)
+ {
+ ConvertOldExtendedFlagFormat(pIns);
+ }
}
}
+void ConvertOldExtendedFlagFormat(MODINSTRUMENT *pIns)
+//----------------------------------------------------
+{
+ DWORD dwOldFlags = pIns->dwFlags;
+ pIns->dwFlags = pIns->VolEnv.dwFlags = pIns->PanEnv.dwFlags = pIns->PitchEnv.dwFlags = 0;
+ if(dwOldFlags & 0x0001) pIns->VolEnv.dwFlags |= ENV_ENABLED;
+ if(dwOldFlags & 0x0002) pIns->VolEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwOldFlags & 0x0004) pIns->VolEnv.dwFlags |= ENV_LOOP;
+ if(dwOldFlags & 0x0008) pIns->PanEnv.dwFlags |= ENV_ENABLED;
+ if(dwOldFlags & 0x0010) pIns->PanEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwOldFlags & 0x0020) pIns->PanEnv.dwFlags |= ENV_LOOP;
+ if(dwOldFlags & 0x0040) pIns->PitchEnv.dwFlags |= ENV_ENABLED;
+ if(dwOldFlags & 0x0080) pIns->PitchEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwOldFlags & 0x0100) pIns->VolEnv.dwFlags |= ENV_LOOP;
+ if(dwOldFlags & 0x0200) pIns->dwFlags |= INS_SETPANNING;
+ if(dwOldFlags & 0x0400) pIns->PitchEnv.dwFlags |= ENV_FILTER;
+ if(dwOldFlags & 0x0800) pIns->VolEnv.dwFlags |= ENV_CARRY;
+ if(dwOldFlags & 0x1000) pIns->PanEnv.dwFlags |= ENV_CARRY;
+ if(dwOldFlags & 0x2000) pIns->PitchEnv.dwFlags |= ENV_CARRY;
+ if(dwOldFlags & 0x4000) pIns->dwFlags |= INS_MUTE;
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////
// 8SVX Samples
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-02-06 17:43:04 UTC (rev 484)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-02-07 13:23:29 UTC (rev 485)
@@ -1193,5 +1193,8 @@
// Read extended instrument properties from 'pDataStart' to instrument 'pIns'.
void ReadExtendedInstrumentProperties(MODINSTRUMENT* pIns, const LPCBYTE pDataStart, const size_t nMemLength);
+// Convert old instrument flag format, where all flags used to be stored in one single flag. Now, some flags are stored in envelope-specific flag fields.
+void ConvertOldExtendedFlagFormat(MODINSTRUMENT* pIns);
+
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-06 17:44:02
|
Revision: 484
http://modplug.svn.sourceforge.net/modplug/?rev=484&view=rev
Author: saga-games
Date: 2010-02-06 17:43:04 +0000 (Sat, 06 Feb 2010)
Log Message:
-----------
[Fix] Mod Saving: If a mod had loop points set, but loop disabled, they were still saved in the .MOD file, resulting in the loop being enabled automatically.
[Fix] Pattern Editor: Instead of turning "Follow Song" off, the Find/Replace dialog toggled it.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Load_mod.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-02-05 20:39:08 UTC (rev 483)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2010-02-06 17:43:04 UTC (rev 484)
@@ -451,8 +451,16 @@
//rewbs.customKeys
case CTRLMSG_PAT_FOLLOWSONG:
- CheckDlgButton(IDC_PATTERN_FOLLOWSONG, !IsDlgButtonChecked(IDC_PATTERN_FOLLOWSONG));
- OnFollowSong();
+ // parameters: 0 = turn off, 1 = toggle
+ {
+ UINT state = FALSE;
+ if(lParam == 1) // toggle
+ {
+ state = !IsDlgButtonChecked(IDC_PATTERN_FOLLOWSONG);
+ }
+ CheckDlgButton(IDC_PATTERN_FOLLOWSONG, state);
+ OnFollowSong();
+ }
break;
case CTRLMSG_PAT_LOOP:
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-05 20:39:08 UTC (rev 483)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-02-06 17:43:04 UTC (rev 484)
@@ -446,7 +446,7 @@
case kcChangeLoopStatus:
m_pParent->OnModCtrlMsg(CTRLMSG_PAT_LOOP, -1); return wParam;
case kcToggleFollowSong:
- m_pParent->OnModCtrlMsg(CTRLMSG_PAT_FOLLOWSONG, 0); return wParam;
+ m_pParent->OnModCtrlMsg(CTRLMSG_PAT_FOLLOWSONG, 1); return wParam;
case kcChannelUnmuteAll:
case kcUnmuteAllChnOnPatTransition:
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-05 20:39:08 UTC (rev 483)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-06 17:43:04 UTC (rev 484)
@@ -3614,7 +3614,7 @@
case kcEditPushForwardPaste: OnEditPushForwardPaste(); return wParam;
case kcEditSelectAll: OnEditSelectAll(); return wParam;
case kcTogglePluginEditor: TogglePluginEditor((m_dwCursor & 0xFFFF) >> 3); return wParam;
- case kcToggleFollowSong: SendCtrlMessage(CTRLMSG_PAT_FOLLOWSONG); return wParam;
+ case kcToggleFollowSong: SendCtrlMessage(CTRLMSG_PAT_FOLLOWSONG, 1); return wParam;
case kcChangeLoopStatus: SendCtrlMessage(CTRLMSG_PAT_LOOP, -1); return wParam;
case kcNewPattern: SendCtrlMessage(CTRLMSG_PAT_NEWPATTERN); return wParam;
case kcDuplicatePattern: SendCtrlMessage(CTRLMSG_PAT_DUPPATTERN); return wParam;
@@ -4106,7 +4106,7 @@
void CViewPattern::TempEnterNote(int note, bool oldStyle, int vol)
-//--------------------------------------------------------------------------------
+//----------------------------------------------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
CModDoc *pModDoc = GetDocument();
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2010-02-05 20:39:08 UTC (rev 483)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2010-02-06 17:43:04 UTC (rev 484)
@@ -494,9 +494,14 @@
if (pSmp->RelativeTone > 0) bTab[24] = 0x07; else
bTab[24] = (BYTE)XM2MODFineTune(pSmp->nFineTune);
bTab[25] = pSmp->nVolume >> 2;
- bTab[26] = pSmp->nLoopStart >> 9;
- bTab[27] = pSmp->nLoopStart >> 1;
- UINT replen = pSmp->nLoopEnd - pSmp->nLoopStart;
+ UINT repstart = 0, replen = 2;
+ if(pSmp->uFlags & CHN_LOOP)
+ {
+ repstart = pSmp->nLoopStart;
+ replen = pSmp->nLoopEnd - pSmp->nLoopStart;
+ }
+ bTab[26] = repstart >> 9;
+ bTab[27] = repstart >> 1;
if(replen < 2) // ensure PT will load it properly
replen = 2;
bTab[28] = replen >> 9;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-05 20:39:21
|
Revision: 483
http://modplug.svn.sourceforge.net/modplug/?rev=483&view=rev
Author: saga-games
Date: 2010-02-05 20:39:08 +0000 (Fri, 05 Feb 2010)
Log Message:
-----------
[Fix] ITP Loader: Instruments flags in ITP files with embedded instrument headers were loaded wrong since revision 415. Still have to come up with a solution for the same problem with ITI and XI files.
Revision Links:
--------------
http://modplug.svn.sourceforge.net/modplug/?rev=415&view=rev
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_it.cpp
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-05 18:17:51 UTC (rev 482)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-05 20:39:08 UTC (rev 483)
@@ -827,21 +827,45 @@
i = 1;
// parse file
- while( uintptr_t(ptr - lpStream) <= dwMemLength - 4 && i <= m_nInstruments ){
+ while( uintptr_t(ptr - lpStream) <= dwMemLength - 4 && i <= m_nInstruments )
+ {
fcode = (*((__int32 *)ptr)); // read field code
- switch( fcode ){
+ switch( fcode )
+ {
case 'MPTS': goto mpts; //:) // reached end of instrument headers
case 'SEP@': case 'MPTX':
ptr += sizeof(__int32); // jump code
i++; // switch to next instrument
- break;
+ break;
default:
ptr += sizeof(__int32); // jump field code
ReadExtendedInstrumentProperty(Instruments[i], fcode, ptr, lpStream + dwMemLength);
- break;
+ // fix old instrument flags which got broken in OpenMPT 1.17.03.03 due to refactoring (rev 415).
+ if(version == 0x00000101 && fcode == 'dF..')
+ {
+ DWORD dwFlags = Instruments[i]->dwFlags; // more convenient
+ DWORD dwNewFlags = 0;
+ if(dwFlags & 0x0001) Instruments[i]->VolEnv.dwFlags |= ENV_ENABLED;
+ if(dwFlags & 0x0002) Instruments[i]->VolEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwFlags & 0x0004) Instruments[i]->VolEnv.dwFlags |= ENV_LOOP;
+ if(dwFlags & 0x0008) Instruments[i]->PanEnv.dwFlags |= ENV_ENABLED;
+ if(dwFlags & 0x0010) Instruments[i]->PanEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwFlags & 0x0020) Instruments[i]->PanEnv.dwFlags |= ENV_LOOP;
+ if(dwFlags & 0x0040) Instruments[i]->PitchEnv.dwFlags |= ENV_ENABLED;
+ if(dwFlags & 0x0080) Instruments[i]->PitchEnv.dwFlags |= ENV_SUSTAIN;
+ if(dwFlags & 0x0100) Instruments[i]->VolEnv.dwFlags |= ENV_LOOP;
+ if(dwFlags & 0x0200) dwNewFlags |= INS_SETPANNING;
+ if(dwFlags & 0x0400) Instruments[i]->PitchEnv.dwFlags |= ENV_FILTER;
+ if(dwFlags & 0x0800) Instruments[i]->VolEnv.dwFlags |= ENV_CARRY;
+ if(dwFlags & 0x1000) Instruments[i]->PanEnv.dwFlags |= ENV_CARRY;
+ if(dwFlags & 0x2000) Instruments[i]->PitchEnv.dwFlags |= ENV_CARRY;
+ if(dwFlags & 0x4000) dwNewFlags |= INS_MUTE;
+ Instruments[i]->dwFlags = dwNewFlags;
+ }
+ break;
}
}
}
@@ -1547,7 +1571,7 @@
DWORD id = 0x2e697470; // .itp ASCII
fwrite(&id, 1, sizeof(id), f);
- id = 0x00000101; // v1.01
+ id = 0x00000102; // v1.02
fwrite(&id, 1, sizeof(id), f);
// Song name
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-02-05 18:18:00
|
Revision: 482
http://modplug.svn.sourceforge.net/modplug/?rev=482&view=rev
Author: saga-games
Date: 2010-02-05 18:17:51 +0000 (Fri, 05 Feb 2010)
Log Message:
-----------
[Imp] PSM Loader: Better handling of SC0 effect
[Imp] IT Saver: Compatibility export saves stereo samples again, as other tracker like Schism also support this.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Load_psm.cpp
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-01-27 20:27:41 UTC (rev 481)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-02-05 18:17:51 UTC (rev 482)
@@ -2910,10 +2910,15 @@
if (psmp->uFlags & CHN_PANNING) itss.dfp |= 0x80;
if ((psmp->pSample) && (psmp->nLength)) itss.cvt = 0x01;
UINT flags = RS_PCM8S;
+ if (psmp->uFlags & CHN_STEREO)
+ {
+ flags = RS_STPCM8S;
+ itss.flags |= 0x04;
+ }
if (psmp->uFlags & CHN_16BIT)
{
itss.flags |= 0x02;
- flags = RS_PCM16S;
+ flags = (psmp->uFlags & CHN_STEREO) ? RS_STPCM16S : RS_PCM16S;
}
itss.samplepointer = dwPos;
if (!(psmp->pSample) || !(psmp->nLength))
Modified: trunk/OpenMPT/soundlib/Load_psm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_psm.cpp 2010-01-27 20:27:41 UTC (rev 481)
+++ trunk/OpenMPT/soundlib/Load_psm.cpp 2010-02-05 18:17:51 UTC (rev 482)
@@ -1131,7 +1131,17 @@
break;
case 0x2A: // note cut
command = CMD_S3MCMDEX;
- if(param == 0) param = 1;
+ if(param == 0) // in S3M mode, SC0 is ignored, so we convert it to a note cut.
+ {
+ if(row_data->note == NOTE_NONE)
+ {
+ row_data->note = NOTE_NOTECUT;
+ command = CMD_NONE;
+ } else
+ {
+ param = 1;
+ }
+ }
param |= 0xC0;
break;
case 0x2B: // note delay
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-01-27 20:27:49
|
Revision: 481
http://modplug.svn.sourceforge.net/modplug/?rev=481&view=rev
Author: saga-games
Date: 2010-01-27 20:27:41 +0000 (Wed, 27 Jan 2010)
Log Message:
-----------
[Imp] Mod Conversion: Don't show warning about restart position if it is actually not set (only applies to S3M format)
[Fix] PSM16 Loader: Fix for note cut on tick 0 (warbot tune from Silverball)
[Imp] Improved HasNote function in Mod Specs
[Fix] Corrected original XM specs.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/soundlib/Load_psm.cpp
trunk/OpenMPT/soundlib/mod_specifications.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2010-01-26 21:25:38 UTC (rev 480)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2010-01-27 20:27:41 UTC (rev 481)
@@ -345,7 +345,7 @@
}
// Is the "restart position" value allowed in this format?
- if(CSoundFile::GetModSpecifications(nNewType).hasRestartPos == false)
+ if(m_SndFile.m_nRestartPos > 0 && !CSoundFile::GetModSpecifications(nNewType).hasRestartPos)
{
m_SndFile.m_nRestartPos = 0;
AddToLog("WARNING: Restart position is not support by the new format.\n");
Modified: trunk/OpenMPT/soundlib/Load_psm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_psm.cpp 2010-01-26 21:25:38 UTC (rev 480)
+++ trunk/OpenMPT/soundlib/Load_psm.cpp 2010-01-27 20:27:41 UTC (rev 481)
@@ -360,7 +360,7 @@
default: // How the hell should this happen? I've listened through almost all existing (original) PSM files. :)
CString s;
- s.Format("Please report to the OpenMPT team: Unknown chunk %d found at position %d (in the OPLH chunk of this PSM file)", lpStream[dwSettingsOffset], dwSettingsOffset);
+ s.Format("Report to the OpenMPT team: Unknown chunk %d found at position %d (in the OPLH chunk of this PSM file)", lpStream[dwSettingsOffset], dwSettingsOffset);
MessageBox(NULL, s, TEXT("OpenMPT PSM import"), MB_ICONERROR);
// anyway, in such cases, we have to quit as we don't know how big the chunk really is.
return false;
@@ -1131,6 +1131,7 @@
break;
case 0x2A: // note cut
command = CMD_S3MCMDEX;
+ if(param == 0) param = 1;
param |= 0xC0;
break;
case 0x2B: // note delay
Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.cpp 2010-01-26 21:25:38 UTC (rev 480)
+++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2010-01-27 20:27:41 UTC (rev 481)
@@ -17,7 +17,8 @@
return hasNoteFade;
else
return (memcmp(fileExtension, ModSpecs::mptm.fileExtension, 4) == 0);
- }
+ } else if(note == NOTE_NONE)
+ return true;
return false;
}
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2010-01-26 21:25:38 UTC (rev 480)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-01-27 20:27:41 UTC (rev 481)
@@ -52,7 +52,7 @@
const CModSpecifications mptm =
{
/*
- TODO: Proper, less arbitrarily chosen, values here.
+ TODO: Proper, less arbitrarily chosen values here.
NOTE: If changing limits, see whether:
-savefile format and GUI methods can handle new values(might not be a small task :).
*/
@@ -78,7 +78,7 @@
1, //Min Speed
255, //Max Speed
true, //Has song comments
- 240, //Envelope point count
+ MAX_ENVPOINTS, //Envelope point count
" JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#", // Supported Effects
" vpcdabuhlrgfe:o", // Supported Volume Column commands
true, // Has "+++" pattern
@@ -171,15 +171,15 @@
1, //Min pattern rows
256, //Max pattern rows
20, //Max mod name length
- 31, //SamplesMax
- 200, //instrumentMax
+ 31, //SamplesMax (actually 16 per instrument)
+ 128, //instrumentMax
mixLevels_original, //defaultMixLevels
0, //Max MIDI mapping directives
1, //Min Speed
31, //Max Speed
false, //No song comments
12, //Envelope point count
- " 0123456789ABCDRFFTE???GHK?YXPLZ\\:#", // Supported Effects
+ " 0123456789ABCDRFFTE???GHK??XPL????", // Supported Effects
" vpcdabuhlrg????", // Supported Volume Column commands
false, // Doesn't have "+++" pattern
true, // Has restart position (order)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-01-26 21:25:48
|
Revision: 480
http://modplug.svn.sourceforge.net/modplug/?rev=480&view=rev
Author: saga-games
Date: 2010-01-26 21:25:38 +0000 (Tue, 26 Jan 2010)
Log Message:
-----------
[Mod] Further corrections to History.txt
Modified Paths:
--------------
trunk/OpenMPT/packageTemplate/History.txt
Modified: trunk/OpenMPT/packageTemplate/History.txt
===================================================================
--- trunk/OpenMPT/packageTemplate/History.txt 2010-01-25 22:42:20 UTC (rev 479)
+++ trunk/OpenMPT/packageTemplate/History.txt 2010-01-26 21:25:38 UTC (rev 480)
@@ -26,7 +26,7 @@
Pattern tab::Pattern editing
+ <Jojo> New paste mode "push forward paste", which resembles the default paste behaviour of Impulse Tracker. Includes new shortcut.
- + <Jojo> The "paste flood" command pastes the clipboard content again and again until it hits the bottom of the pattern (overflow paste will be disabled automatically if paste flood is used, for obvious reasons).
+ + <Jojo> New paste mode "paste flood" pastes the clipboard content again and again until it hits the bottom of the pattern (overflow paste will be disabled automatically if paste flood is used, for obvious reasons).
^ <Jojo> When using the MPTM format, plugin param changes are written to the pattern as PC Notes (instead of smooth midi macros).
^ <Jojo> Assume that the clipboard pattern format is IT (instead of MOD) if no information about the format is available.
^ <Jojo> Pattern c&p: convert pasted commands if necessary.
@@ -36,7 +36,6 @@
/ <Jojo> It is impossible to enter something into the volume column in MOD format now.
/ <Jojo> When interpolating PC notes, the plugin number and note type won't get overriden if the note type is already PC or PCs.
. <re> Pattern c&p: Mix paste should behave better with parameter control notes.
- . <Jojo> PC note handling was missing in OnClearSelection, so it was possible to delete the "effect column" (parameter value) only partly
. <Jojo> Amplify acted VERY weird when it was applied on an instrument that's not assigned to any sample. Should be a bit better now.
. <Jojo> Amplify doesn't use volume column in MOD format anymore.
. <Jojo> When recording live from the keyboard, SDx shouldn't exceed the song speed anymore.
@@ -73,7 +72,6 @@
^ <Jojo> When sample is 8-bit, it will automatically be converted to 16-bit when applying time stretching / pitch shifting.
^ <Jojo> Can now enter insanely high values into sample frequency input field (as they are supported by Impulse Tracker), allow only 65536 Hz for S3M files.
/ <Jojo> Removed time stretcher's / pitch shifter's preview function as it's unnecessary now.
- . <Jojo> When going down close to 0 Hz in the sample editor, the sample freq wrapped around to the maximum value.
. <Jojo> Insert Silence: Loop points were not updated when adding silence at the beginning of the sample
. <re> Actions such as time stretching and undo could trigger sample play.
@@ -95,6 +93,7 @@
Treeview
+ <Jojo> Show sequences in song treeview. Sequences can be inserted, duplicated and deleted by right-clicking the sequence items.
+ <Jojo> Clicking on a mod item (i.e. a filename node) switches to the corresponding window.
+ + <Jojo> Added right-click options for mod items.
+ <Jojo> Display playing samples / instruments (only those that are assigned to a sample) using green triangles. Can be enabled from setup screen.
+ <Jojo> Muted samples and instruments are shown with a different icon.
^ <Jojo> Can now dragondrop orders, even between sequences.
@@ -121,7 +120,7 @@
^ <Jojo> Remove sample vibrato and sustain loops for MOD / S3M.
Playback (see also format-specific changes below)
- ^ <Jojo> Added some more standard playback frequencies (176KHz, 192KHz).
+ ^ <Jojo> Added some more standard playback frequencies (176KHz, 192KHz) to setup.
. <Jojo> When jumping around in a module, high offset value is also memorized.
IT::Saving
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-01-25 22:42:29
|
Revision: 479
http://modplug.svn.sourceforge.net/modplug/?rev=479&view=rev
Author: saga-games
Date: 2010-01-25 22:42:20 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
[Imp] Installer: Small improvment to VST scanning (don't write "NumPlugins" key if no plugins have been found).
[Mod] Changed history (.txt)
Modified Paths:
--------------
trunk/OpenMPT/installer/vst_scan.iss
trunk/OpenMPT/packageTemplate/History.txt
Modified: trunk/OpenMPT/installer/vst_scan.iss
===================================================================
--- trunk/OpenMPT/installer/vst_scan.iss 2010-01-25 19:38:07 UTC (rev 478)
+++ trunk/OpenMPT/installer/vst_scan.iss 2010-01-25 22:42:20 UTC (rev 479)
@@ -13,6 +13,7 @@
bExitSetup: Boolean;
INIFile: String;
VSTPluginNumber: Integer;
+ OldVSTPluginNumber: Integer;
procedure ProcessDirectory (RootDir: String; Progress: Boolean);
var
@@ -75,37 +76,41 @@
if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
begin
- // Get the right INI path.
- if(IsTaskSelected('portable')) then
- begin
- INIFile := ExpandConstant('{app}\mptrack.ini');
- end else
- begin
- INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
+ // Get the right INI path.
+ if(IsTaskSelected('portable')) then
+ begin
+ INIFile := ExpandConstant('{app}\mptrack.ini');
+ end else
+ begin
+ INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
+ end;
+ VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
+ OldVSTPluginNumber := VSTPluginNumber;
+
+ // The folder to scan.
+ Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
+ RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
+ // The progress page.
+ ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
+ CustomMessage ('ProgressCaption'));
+ ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
+ ProgressPage.SetProgress(0, 0);
+ ProgressPage.Show;
+ // Make the Cancel button visible during the operation.
+ ;WizardForm.CancelButton.Visible := TRUE;
+ // Scan the folder.
+ ProcessDirectory (Dir, TRUE);
+ // Hide the progress page.
+ try
+ finally
+ ProgressPage.Hide;
+ end;
+
+ // Update INI key
+
+ if(VSTPluginNumber <> OldVSTPluginNumber) then
+ begin
+ SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
+ end;
end;
- VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
-
- // The folder to scan.
- Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
- RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
- // The progress page.
- ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
- CustomMessage ('ProgressCaption'));
- ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
- ProgressPage.SetProgress(0, 0);
- ProgressPage.Show;
- // Make the Cancel button visible during the operation.
- ;WizardForm.CancelButton.Visible := TRUE;
- // Scan the folder.
- ProcessDirectory (Dir, TRUE);
- // Hide the progress page.
- try
- finally
- ProgressPage.Hide;
- end;
-
- // Update INI key
- SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
- end;
end;
-
Modified: trunk/OpenMPT/packageTemplate/History.txt
===================================================================
--- trunk/OpenMPT/packageTemplate/History.txt 2010-01-25 19:38:07 UTC (rev 478)
+++ trunk/OpenMPT/packageTemplate/History.txt 2010-01-25 22:42:20 UTC (rev 479)
@@ -44,7 +44,6 @@
. <Jojo> PC notes are now deleted properly (last column).
. <Jojo> Copying only the param column of PC notes overwrote the value column when pasting them.
. <Jojo> Entering Note Fade notes didn't work the "old style" way.
- . <Jojo> PC note handling was missing in OnClearSelection, so it was possible to delete the effect column only partly.
Pattern tab::GUI
+ <Jojo> Channel rename dialog in channel header context menu.
@@ -144,7 +143,7 @@
S3M
. <Jojo> ST3 compatibility: Only allow waveforms 0 to 3 for S3x / S4x / S5x.
- . <Jojo> The S3M format actually knows muted channels. This was not taking into account before.
+ . <Jojo> The S3M format actually knows muted channels. This was not taken into account before.
XM::Loading
^ <Jojo> Allow to load modules with an empty order list (as they are, in fact, valid XM files).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-01-25 19:38:16
|
Revision: 478
http://modplug.svn.sourceforge.net/modplug/?rev=478&view=rev
Author: saga-games
Date: 2010-01-25 19:38:07 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
[Fix] Installer: The VST plugin scanner apparently broke the "Exit Setup" string. Furthermore, it wrote a wrong key in the mptrack.ini file.
Modified Paths:
--------------
trunk/OpenMPT/installer/vst_scan.iss
Modified: trunk/OpenMPT/installer/vst_scan.iss
===================================================================
--- trunk/OpenMPT/installer/vst_scan.iss 2010-01-25 19:22:19 UTC (rev 477)
+++ trunk/OpenMPT/installer/vst_scan.iss 2010-01-25 19:38:07 UTC (rev 478)
@@ -7,86 +7,73 @@
[Code]
var
- ProgressPage: TOutputProgressWizardPage;
- ProgressValue: Integer;
- ArrayLen: LongInt;
- bExitSetup: Boolean;
- INIFile: String;
- VSTPluginNumber: Integer;
+ ProgressPage: TOutputProgressWizardPage;
+ ProgressValue: Integer;
+ ArrayLen: LongInt;
+ bExitSetup: Boolean;
+ INIFile: String;
+ VSTPluginNumber: Integer;
procedure ProcessDirectory (RootDir: String; Progress: Boolean);
var
- NewRoot: String;
- FilePath: String;
- FindRec: TFindRec;
+ NewRoot: String;
+ FilePath: String;
+ FindRec: TFindRec;
begin
- if bExitSetup then
- Exit;
- NewRoot := AddBackSlash (RootDir);
- if FindFirst (NewRoot + '*', FindRec) then
- begin
- try
- repeat
- if (FindRec.Name <> '.') AND (FindRec.Name <> '..') then
- begin
- FilePath := NewRoot + FindRec.Name;
- if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
- ProcessDirectory (FilePath, Progress)
- else
- begin
- // Start action -->
- // .
- // Add your custom code here.
- // FilePath contains the file name
- // including its full path name.
- // Try not to call a function for every file
- // as this could take a very long time.
- // .
- // <-- End action.
- SetIniString('VST Plugins', 'Plugin' + IntToStr(VSTPluginNumber), FilePath, INIFile);
- VSTPluginNumber := VSTPluginNumber +1;
-
- ArrayLen := ArrayLen + 1;
- if (Progress) then
- begin
- if (ArrayLen mod 1000) = (ArrayLen / 1000) then
- begin
- ProgressValue := ProgressValue + 1;
- if ProgressValue = 100 then
- ProgressValue := 0;
- ProgressPage.SetProgress (ProgressValue, 100);
- end;
- end;
- end;
- end;
- if (bExitSetup) then
- Exit;
- until NOT FindNext (FindRec);
- finally
- FindClose(FindRec);
- end;
- end;
+ if bExitSetup then
+ Exit;
+ NewRoot := AddBackSlash (RootDir);
+ if FindFirst (NewRoot + '*', FindRec) then
+ begin
+ try
+ repeat
+ if (FindRec.Name <> '.') AND (FindRec.Name <> '..') then
+ begin
+ FilePath := NewRoot + FindRec.Name;
+ if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
+ ProcessDirectory (FilePath, Progress)
+ else
+ begin
+ // Start action -->
+ // .
+ // Add your custom code here.
+ // FilePath contains the file name
+ // including its full path name.
+ // Try not to call a function for every file
+ // as this could take a very long time.
+ // .
+ SetIniString('VST Plugins', 'Plugin' + IntToStr(VSTPluginNumber), FilePath, INIFile);
+ VSTPluginNumber := VSTPluginNumber +1;
+ // <-- End action.
+
+ ArrayLen := ArrayLen + 1;
+ if (Progress) then
+ begin
+ if (ArrayLen mod 1000) = (ArrayLen / 1000) then
+ begin
+ ProgressValue := ProgressValue + 1;
+ if ProgressValue = 100 then
+ ProgressValue := 0;
+ ProgressPage.SetProgress (ProgressValue, 100);
+ end;
+ end;
+ end;
+ end;
+ if (bExitSetup) then
+ Exit;
+ until NOT FindNext (FindRec);
+ finally
+ FindClose(FindRec);
+ end;
+ end;
end;
-function MessageBox (hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
- external 'Mes...@us... stdcall';
-
-procedure CancelButtonClick (CurPageID: Integer; var Cancel, Confirm: Boolean);
-begin
- Confirm := FALSE;
- if (MessageBox (0, SetupMessage (msgExitSetupMessage),
- SetupMessage (msgExitSetupTitle), 4 + 32) = 6) then
- begin
- bExitSetup := TRUE;
- end;
-end;
-
procedure CurStepChanged (CurStep: TSetupStep);
var
- Dir: String;
+ Dir: String;
begin
- if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
- begin
+ if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
+ begin
// Get the right INI path.
if(IsTaskSelected('portable')) then
@@ -96,29 +83,29 @@
begin
INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
end;
- VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugin', 0, 0, 0, INIFile);
+ VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
- // The folder to scan.
+ // The folder to scan.
Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
- // The progress page.
- ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
- CustomMessage ('ProgressCaption'));
- ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
- ProgressPage.SetProgress(0, 0);
- ProgressPage.Show;
- // Make the Cancel button visible during the operation.
- ;WizardForm.CancelButton.Visible := TRUE;
- // Scan the folder.
- ProcessDirectory (Dir, TRUE);
- // Hide the progress page.
- try
- finally
- ProgressPage.Hide;
- end;
+ // The progress page.
+ ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
+ CustomMessage ('ProgressCaption'));
+ ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
+ ProgressPage.SetProgress(0, 0);
+ ProgressPage.Show;
+ // Make the Cancel button visible during the operation.
+ ;WizardForm.CancelButton.Visible := TRUE;
+ // Scan the folder.
+ ProcessDirectory (Dir, TRUE);
+ // Hide the progress page.
+ try
+ finally
+ ProgressPage.Hide;
+ end;
// Update INI key
- SetIniInt('VST Plugins', 'NumPlugin', VSTPluginNumber, INIFile);
+ SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
end;
end;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-01-25 19:22:29
|
Revision: 477
http://modplug.svn.sourceforge.net/modplug/?rev=477&view=rev
Author: saga-games
Date: 2010-01-25 19:22:19 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
[Mod] Installer: Using a GUID for AppId
[New] Installer: Scan for previously installed VST Plugins
Modified Paths:
--------------
trunk/OpenMPT/installer/install.iss
Added Paths:
-----------
trunk/OpenMPT/installer/vst_scan.iss
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2010-01-25 16:38:56 UTC (rev 476)
+++ trunk/OpenMPT/installer/install.iss 2010-01-25 19:22:19 UTC (rev 477)
@@ -4,7 +4,7 @@
; http://sagagames.de/
[Setup]
-AppId=OpenMPT
+AppId={{67903736-E9BB-4664-B148-F62BCAB4FA42}
AppVerName=OpenMPT 1.18
AppVersion=1.18.00.00
AppName=OpenMPT
@@ -29,11 +29,12 @@
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "portable"; Description: "Use program directory to store configuration in"; GroupDescription: "Options:"; Flags: unchecked
+Name: "vst_scan"; Description: "Scan for previously installed VST plugins"; GroupDescription: "Options:"; Flags: unchecked
; file associations - put this below all other [tasks]!
#include "filetypes.iss"
[Languages]
-Name: "en"; MessagesFile: "compiler:Default.isl"
+Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
; you may want to change the base paths here
@@ -139,3 +140,4 @@
end;
end;
+#include "vst_scan.iss"
Added: trunk/OpenMPT/installer/vst_scan.iss
===================================================================
--- trunk/OpenMPT/installer/vst_scan.iss (rev 0)
+++ trunk/OpenMPT/installer/vst_scan.iss 2010-01-25 19:22:19 UTC (rev 477)
@@ -0,0 +1,124 @@
+[CustomMessages]
+english.ProgressTitle=Searching
+english.ProgressCaption=Searching for VST plugins
+english.ProgressText=Searching for plugin files...
+
+; http://www.vincenzo.net/isxkb/index.php?title=Search_for_a_file
+
+[Code]
+var
+ ProgressPage: TOutputProgressWizardPage;
+ ProgressValue: Integer;
+ ArrayLen: LongInt;
+ bExitSetup: Boolean;
+ INIFile: String;
+ VSTPluginNumber: Integer;
+
+procedure ProcessDirectory (RootDir: String; Progress: Boolean);
+var
+ NewRoot: String;
+ FilePath: String;
+ FindRec: TFindRec;
+begin
+ if bExitSetup then
+ Exit;
+ NewRoot := AddBackSlash (RootDir);
+ if FindFirst (NewRoot + '*', FindRec) then
+ begin
+ try
+ repeat
+ if (FindRec.Name <> '.') AND (FindRec.Name <> '..') then
+ begin
+ FilePath := NewRoot + FindRec.Name;
+ if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
+ ProcessDirectory (FilePath, Progress)
+ else
+ begin
+ // Start action -->
+ // .
+ // Add your custom code here.
+ // FilePath contains the file name
+ // including its full path name.
+ // Try not to call a function for every file
+ // as this could take a very long time.
+ // .
+ // <-- End action.
+ SetIniString('VST Plugins', 'Plugin' + IntToStr(VSTPluginNumber), FilePath, INIFile);
+ VSTPluginNumber := VSTPluginNumber +1;
+
+ ArrayLen := ArrayLen + 1;
+ if (Progress) then
+ begin
+ if (ArrayLen mod 1000) = (ArrayLen / 1000) then
+ begin
+ ProgressValue := ProgressValue + 1;
+ if ProgressValue = 100 then
+ ProgressValue := 0;
+ ProgressPage.SetProgress (ProgressValue, 100);
+ end;
+ end;
+ end;
+ end;
+ if (bExitSetup) then
+ Exit;
+ until NOT FindNext (FindRec);
+ finally
+ FindClose(FindRec);
+ end;
+ end;
+end;
+
+function MessageBox (hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
+ external 'Mes...@us... stdcall';
+
+procedure CancelButtonClick (CurPageID: Integer; var Cancel, Confirm: Boolean);
+begin
+ Confirm := FALSE;
+ if (MessageBox (0, SetupMessage (msgExitSetupMessage),
+ SetupMessage (msgExitSetupTitle), 4 + 32) = 6) then
+ begin
+ bExitSetup := TRUE;
+ end;
+end;
+
+procedure CurStepChanged (CurStep: TSetupStep);
+var
+ Dir: String;
+begin
+ if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
+ begin
+
+ // Get the right INI path.
+ if(IsTaskSelected('portable')) then
+ begin
+ INIFile := ExpandConstant('{app}\mptrack.ini');
+ end else
+ begin
+ INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
+ end;
+ VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugin', 0, 0, 0, INIFile);
+
+ // The folder to scan.
+ Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
+ RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
+ // The progress page.
+ ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
+ CustomMessage ('ProgressCaption'));
+ ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
+ ProgressPage.SetProgress(0, 0);
+ ProgressPage.Show;
+ // Make the Cancel button visible during the operation.
+ ;WizardForm.CancelButton.Visible := TRUE;
+ // Scan the folder.
+ ProcessDirectory (Dir, TRUE);
+ // Hide the progress page.
+ try
+ finally
+ ProgressPage.Hide;
+ end;
+
+ // Update INI key
+ SetIniInt('VST Plugins', 'NumPlugin', VSTPluginNumber, INIFile);
+ end;
+end;
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|