Skip to content

Commit 632bd72

Browse files
committed
Add Shiru's changes
as requested by shiru: https://www.patreon.com/posts/sneventracker-56702174
1 parent f2d886d commit 632bd72

File tree

10 files changed

+118
-43
lines changed

10 files changed

+118
-43
lines changed

CHANGES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log
22

3+
### Version 0.2.3
4+
5+
- Game Gear panning is now controlled with `N01` to the left, `N02` to center, `N03` to the right.
6+
- This has the side effect of breaking stereo functionality with modules made in previous SnevenTracker versions.
7+
- Added a new noise reset enable effect, `NE2`, allowing the noise to be reset every frame.
8+
9+
- When a C-# (Copy) note is placed in the noise channel, inputting a note on Channel 3 will allow you to hear what the noise channel will sound like.
10+
- VGM export has been updated and reworked to function similarly to WAV export. The old method of exporting VGMs are still there, however.
11+
- Special thanks to Shiru for the changes made for this update.
12+
313
### Version 0.2.2
414

515
- Overloaded `NE0` / `NE1` for noise reset enable effect

FamiTracker.rc

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#undef APSTUDIO_READONLY_SYMBOLS
1414

1515
/////////////////////////////////////////////////////////////////////////////
16-
// English (United States) resources
16+
// ���������� (���) resources
1717

1818
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
1919
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -112,7 +112,7 @@ BEGIN
112112
MENUITEM "Save &As...", ID_FILE_SAVE_AS
113113
MENUITEM SEPARATOR
114114
MENUITEM "&Create NSF...\tCtrl+E", ID_FILE_CREATE_NSF
115-
MENUITEM "Create WAV...", ID_FILE_CREATEWAV
115+
MENUITEM "Create WAV/VGM...", ID_FILE_CREATEWAV
116116
MENUITEM SEPARATOR
117117
MENUITEM "Import text...", ID_FILE_IMPORTTEXT
118118
MENUITEM "Export text...", ID_FILE_EXPORTTEXT
@@ -705,29 +705,30 @@ CAPTION "About SnevenTracker"
705705
FONT 8, "MS Shell Dlg", 0, 0, 0x1
706706
BEGIN
707707
LTEXT "Copyright (C) 2016 HertzDevil",IDC_ABOUT3,54,92,167,11
708-
DEFPUSHBUTTON "OK",IDOK,228,64,50,16,WS_GROUP
708+
DEFPUSHBUTTON "OK",IDOK,228,68,50,16,WS_GROUP
709709
LTEXT "E-mail:",IDC_STATIC,54,108,24,10
710710
LTEXT "This software is licensed under the GNU General Public\n License. Source is available on the Github repository.",IDC_STATIC,54,167,224,17
711-
ICON IDR_MAINFRAME,IDC_STATIC,7,63,21,20,SS_REALSIZEIMAGE
711+
ICON IDR_MAINFRAME,IDC_STATIC,7,63,20,20,SS_REALSIZEIMAGE
712712
LTEXT "Contributions:",IDC_STATIC,54,191,224,9
713713
LTEXT "All comments and feedback are welcome\nGreets to everyone who has contributed with bug reports and suggestions!",IDC_STATIC,54,137,224,26
714714
LTEXT "nicetas.c@gmail.com",IDC_MAIL,84,108,70,10,SS_NOTIFY
715715
LTEXT "http://hertzdevil.info",IDC_WEBPAGE,84,121,95,9,SS_NOTIFY
716716
LTEXT "Web:",IDC_STATIC,54,121,24,9
717-
LTEXT "Libraries:",IDC_STATIC,54,268,224,8
718-
LTEXT "- Blip_buffer 0.4.0 is Copyright (C) blargg (http://www.slack.net/~ant/nes-emu/)\n",IDC_STATIC,54,282,224,16
719-
LTEXT "- Fast Fourier Transform code is (C) Reliable Software",IDC_STATIC,54,301,224,8
720-
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,54,278,211,1
721-
LTEXT "- Icon is made by Kuhneghetz",IDC_STATIC,54,216,224,9
722-
LTEXT "- Toolbar icons are made by ilkke",IDC_STATIC,54,227,224,9
717+
LTEXT "Libraries:",IDC_STATIC,54,272,224,8
718+
LTEXT "- Blip_buffer 0.4.0 is Copyright (C) blargg (http://www.slack.net/~ant/nes-emu/)\n",IDC_STATIC,54,286,224,16
719+
LTEXT "- Fast Fourier Transform code is (C) Reliable Software",IDC_STATIC,54,305,224,8
720+
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,54,282,211,1
721+
LTEXT "- Icon is made by Kuhneghetz",IDC_STATIC,54,215,224,9
722+
LTEXT "- Toolbar icons are made by ilkke",IDC_STATIC,54,226,224,9
723723
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,54,201,211,1
724724
LTEXT "A SN76489 music tracker",IDC_ABOUT2,54,76,167,11,SS_NOPREFIX
725-
LTEXT "- Module text import/export by rainwarrior",IDC_STATIC,54,238,224,9
725+
LTEXT "- Module text import/export by rainwarrior",IDC_STATIC,54,237,224,9
726726
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,49,287,1
727-
LTEXT "A SN76489 music tracker",IDC_ABOUT1,54,58,167,11,SS_NOPREFIX
727+
LTEXT "A SN76489 music tracker",IDC_ABOUT1,54,58,224,11,SS_NOPREFIX
728728
CONTROL "",IDC_HEAD,"Static",SS_OWNERDRAW,0,0,287,49
729729
LTEXT "- Original software by jsr",IDC_STATIC,54,205,224,9
730-
LTEXT "- vgm_cmp VGM compressor by Valley Bell",IDC_STATIC,54,249,224,9
730+
LTEXT "- vgm_cmp VGM compressor by Valley Bell",IDC_STATIC,54,248,224,9
731+
LTEXT "- patched for stereo, noise mode, VGM export by shiru8bit",IDC_STATIC,54,259,224,9
731732
END
732733

733734
IDD_MAINFRAME DIALOGEX 0, 0, 413, 126
@@ -948,7 +949,7 @@ END
948949

949950
IDD_CREATEWAV DIALOGEX 0, 0, 151, 208
950951
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
951-
CAPTION "Create wave file"
952+
CAPTION "Create WAV or VGM file"
952953
FONT 8, "MS Shell Dlg", 400, 0, 0x1
953954
BEGIN
954955
DEFPUSHBUTTON "Begin",IDC_BEGIN,37,187,52,14
@@ -1695,12 +1696,12 @@ BEGIN
16951696
ID_EDIT_VOLUMEMASK "Disables insertion of values in the volume column"
16961697
END
16971698

1698-
#endif // English (United States) resources
1699+
#endif // ���������� (���) resources
16991700
/////////////////////////////////////////////////////////////////////////////
17001701

17011702

17021703
/////////////////////////////////////////////////////////////////////////////
1703-
// Swedish (Sweden) resources
1704+
// �������� (������) resources
17041705

17051706
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE)
17061707
LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH
@@ -1741,7 +1742,7 @@ END
17411742

17421743
#endif // APSTUDIO_INVOKED
17431744

1744-
#endif // Swedish (Sweden) resources
1745+
#endif // �������� (������) resources
17451746
/////////////////////////////////////////////////////////////////////////////
17461747

17471748

Source/AboutDlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ BOOL CAboutDlg::OnInitDialog()
152152
AfxFormatString1(aboutString, IDS_ABOUT_VERSION_FORMAT, str);
153153
#endif
154154

155-
SetDlgItemText(IDC_ABOUT1, aboutString);
155+
SetDlgItemText(IDC_ABOUT1, aboutString+".fix1");
156156

157157
m_pMail = new CLinkLabel(LINK_MAIL);
158158
m_pWeb = new CLinkLabel(LINK_WEB);

Source/ChannelsSN7.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ void CChannelHandlerSN7::HandleCustomEffects(int EffNum, int EffParam)
7171
// Custom effects
7272
switch (EffNum) {
7373
case EF_SN_CONTROL: // // //
74-
if (EffParam >= 0x00 && EffParam <= 0x1F) {
75-
SetStereo(EffParam && EffParam <= 0x10, EffParam >= 0x10);
76-
break;
77-
}
74+
//if (EffParam >= 0x00 && EffParam <= 0x1F) {
75+
// SetStereo(EffParam && EffParam <= 0x10, EffParam >= 0x10);
76+
if (EffParam == 0x00 || EffParam == 2) SetStereo(true, true); //sh8bit
77+
if (EffParam == 0x01) SetStereo(true, false);
78+
if (EffParam == 0x03) SetStereo(false,true);
79+
// break;
80+
//}
7881
break;
7982
case EF_DUTY_CYCLE:
8083
m_iDefaultDuty = m_iDutyPeriod = EffParam;
@@ -281,7 +284,7 @@ void CNoiseChan::RefreshChannel()
281284
char NoiseMode = !(m_iDutyPeriod & 0x01); // // //
282285

283286
int newCtrl = (NoiseMode << 2) | Period; // // //
284-
if ((m_bTrigger && m_bNoiseReset) || newCtrl != m_iLastCtrl) {
287+
if ((m_bTrigger && m_bNoiseReset == 1) || (m_bNoiseReset == 2) || newCtrl != m_iLastCtrl) { //sh8bit
285288
WriteRegister(0x06, newCtrl);
286289
m_iLastCtrl = newCtrl;
287290
}
@@ -295,8 +298,9 @@ void CNoiseChan::HandleCustomEffects(int EffNum, int EffParam)
295298
switch (EffNum) {
296299
case EF_SN_CONTROL:
297300
switch (EffParam) {
298-
case 0xE0: m_bNoiseReset = false; return;
299-
case 0xE1: m_bNoiseReset = m_bTrigger = true; return;
301+
case 0xE0: m_bNoiseReset = 0; return;
302+
case 0xE1: m_bNoiseReset = 1; m_bTrigger = true; return; //sh8bit
303+
case 0xE2: m_bNoiseReset = 2; return; //sh8bit
300304
}
301305
}
302306

Source/ChannelsSN7.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class CNoiseChan : public CChannelHandlerSN7 {
8282

8383
private:
8484
int m_iLastCtrl; // // //
85-
bool m_bNoiseReset; // // //
85+
int m_bNoiseReset; // // // sh8bit: 0 no reset, 1 once at effect, 2 every frame until effect disabled
8686
bool m_bTrigger; // // // 0CC-FT has this built-in
8787
};
8888

Source/CreateWaveDlg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ void CCreateWaveDlg::OnBnClickedBegin()
104104
}
105105

106106
CWavProgressDlg ProgressDlg;
107-
CString fileFilter = LoadDefaultFilter(IDS_FILTER_WAV, _T(".wav"));
108-
CFileDialog SaveDialog(FALSE, _T("wav"), FileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, fileFilter);
107+
CString fileFilter = _T("VGM file (*.vgm)|*.vgm|")+LoadDefaultFilter(IDS_FILTER_WAV, _T(".wav")); //sh8bit
108+
CFileDialog SaveDialog(FALSE, _T("vgm"), FileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, fileFilter);
109109

110110
// Close this dialog
111111
EndDialog(0);

Source/FamiTrackerView.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,26 @@ void CFamiTrackerView::PlayNote(unsigned int Channel, unsigned int Note, unsigne
16981698

16991699
theApp.GetSoundGenerator()->QueueNote(Channel, NoteData, NOTE_PRIO_2);
17001700

1701+
if (Channel >= 2) //sh8bit
1702+
{
1703+
CFamiTrackerDoc *pDoc = GetDocument();
1704+
stChanNote ChanNote;
1705+
int Track = static_cast<CMainFrame*>(GetParentFrame())->GetSelectedTrack();
1706+
int Frame = m_pPatternEditor->GetFrame();
1707+
int Row = m_pPatternEditor->GetRow();
1708+
1709+
if (Channel == 2)
1710+
{
1711+
pDoc->GetNoteData(Track, Frame, 3, Row, &ChanNote);
1712+
theApp.GetSoundGenerator()->QueueNote(3, ChanNote, NOTE_PRIO_1);
1713+
}
1714+
if (Channel == 3)
1715+
{
1716+
pDoc->GetNoteData(Track, Frame, 2, Row, &ChanNote);
1717+
theApp.GetSoundGenerator()->QueueNote(2, ChanNote, NOTE_PRIO_1);
1718+
}
1719+
}
1720+
17011721
if (theApp.GetSettings()->General.bPreviewFullRow) {
17021722
CFamiTrackerDoc *pDoc = GetDocument();
17031723
stChanNote ChanNote;
@@ -1749,6 +1769,26 @@ void CFamiTrackerView::HaltNote(unsigned int Channel)
17491769

17501770
theApp.GetSoundGenerator()->QueueNote(Channel, NoteData, NOTE_PRIO_2);
17511771

1772+
if (Channel >= 2) //sh8bit
1773+
{
1774+
CFamiTrackerDoc *pDoc = GetDocument();
1775+
stChanNote ChanNote;
1776+
int Track = static_cast<CMainFrame*>(GetParentFrame())->GetSelectedTrack();
1777+
int Frame = m_pPatternEditor->GetFrame();
1778+
int Row = m_pPatternEditor->GetRow();
1779+
1780+
if (Channel == 2)
1781+
{
1782+
NoteData.Note = HALT;
1783+
theApp.GetSoundGenerator()->QueueNote(3, NoteData, NOTE_PRIO_1);
1784+
}
1785+
if (Channel == 3)
1786+
{
1787+
NoteData.Note = HALT;
1788+
theApp.GetSoundGenerator()->QueueNote(2, NoteData, NOTE_PRIO_1);
1789+
}
1790+
}
1791+
17521792
if (theApp.GetSettings()->General.bPreviewFullRow) {
17531793
CFamiTrackerDoc *pDoc = GetDocument();
17541794
int Channels = pDoc->GetChannelCount();

Source/PatternData.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323

2424
// Channel note struct, holds the data for each row in patterns
2525
struct stChanNote {
26-
unsigned char Note;
27-
unsigned char Octave;
28-
unsigned char Vol;
29-
unsigned char Instrument;
30-
unsigned char EffNumber[MAX_EFFECT_COLUMNS];
31-
unsigned char EffParam[MAX_EFFECT_COLUMNS];
32-
33-
static const stChanNote BLANK;
26+
unsigned char Note = 0;
27+
unsigned char Octave = 0;
28+
unsigned char Vol = MAX_VOLUME;
29+
unsigned char Instrument = MAX_INSTRUMENTS;
30+
unsigned char EffNumber[MAX_EFFECT_COLUMNS] = { EF_NONE,EF_NONE,EF_NONE,EF_NONE };
31+
unsigned char EffParam[MAX_EFFECT_COLUMNS] = { 0,0,0,0 };
32+
33+
//static const stChanNote BLANK;
3434
};
3535

36-
const stChanNote stChanNote::BLANK = {0, 0, MAX_VOLUME, MAX_INSTRUMENTS, {EF_NONE, EF_NONE, EF_NONE, EF_NONE}, {0, 0, 0, 0}};
36+
//const stChanNote stChanNote::BLANK = {0, 0, MAX_VOLUME, MAX_INSTRUMENTS, {EF_NONE, EF_NONE, EF_NONE, EF_NONE}, {0, 0, 0, 0}};
3737

3838
// TODO rename to CTrack perhaps?
3939

Source/SoundGen.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ bool CSoundGen::PlayBuffer()
667667
{
668668
if (m_bRendering) {
669669
// Output to file
670-
m_wfWaveFile.WriteWave(m_pAccumBuffer, m_iBufSizeBytes);
670+
if(m_bRenderingWave) m_wfWaveFile.WriteWave(m_pAccumBuffer, m_iBufSizeBytes); //sh8bit
671671
m_iBufferPtr = 0;
672672
}
673673
else {
@@ -1360,12 +1360,23 @@ bool CSoundGen::RenderToFile(LPTSTR pFile, render_end_t SongEndType, int SongEnd
13601360
m_iRenderEndParam = m_pDocument->ScanActualLength(Track, m_iRenderEndParam, m_iRenderRowCount);
13611361
}
13621362

1363-
if (!m_wfWaveFile.OpenFile(pFile, theApp.GetSettings()->Sound.iSampleRate, theApp.GetSettings()->Sound.iSampleSize, 2)) { // // //
1364-
AfxMessageBox(IDS_FILE_OPEN_ERROR);
1365-
return false;
1363+
m_bRenderingWave = true;
1364+
1365+
if (_stricmp(PathFindExtensionA(pFile), ".vgm") == 0) m_bRenderingWave = false;
1366+
1367+
if (m_bRenderingWave) //sh8bit
1368+
{
1369+
if (!m_wfWaveFile.OpenFile(pFile, theApp.GetSettings()->Sound.iSampleRate, theApp.GetSettings()->Sound.iSampleSize, 2)) { // // //
1370+
AfxMessageBox(IDS_FILE_OPEN_ERROR);
1371+
return false;
1372+
}
13661373
}
13671374
else
1368-
PostThreadMessage(WM_USER_START_RENDER, 0, 0);
1375+
{
1376+
VGMStartLogging(pFile);
1377+
}
1378+
1379+
PostThreadMessage(WM_USER_START_RENDER, 0, 0);
13691380

13701381
return true;
13711382
}
@@ -1383,7 +1394,15 @@ void CSoundGen::StopRendering()
13831394
m_bRendering = false;
13841395
m_iPlayFrame = 0;
13851396
m_iPlayRow = 0;
1386-
m_wfWaveFile.CloseFile();
1397+
1398+
if (m_bRenderingWave) //sh8bit
1399+
{
1400+
m_wfWaveFile.CloseFile();
1401+
}
1402+
else
1403+
{
1404+
VGMStopLogging();
1405+
}
13871406

13881407
MakeSilent();
13891408
ResetBuffer();

Source/SoundGen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ class CSoundGen : public CWinThread, IAudioCallback
336336

337337
// Rendering
338338
bool m_bRendering;
339+
bool m_bRenderingWave; //sh8bit
339340
bool m_bRequestRenderStop;
340341
render_end_t m_iRenderEndWhen;
341342
unsigned int m_iRenderEndParam;

0 commit comments

Comments
 (0)