-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files existing in official 0.4.6 source code
- Loading branch information
0 parents
commit 5e25e01
Showing
180 changed files
with
24,966 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
#ignore thumbnails created by windows | ||
Thumbs.db | ||
#Ignore files build by Visual Studio | ||
*.obj | ||
*.exe | ||
*.pdb | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.cache | ||
*.ilk | ||
*.log | ||
[Bb]in | ||
[Dd]ebug*/ | ||
*.lib | ||
*.sbr | ||
obj/ | ||
[Rr]elease*/ | ||
_ReSharper*/ | ||
[Tt]est[Rr]esult* | ||
#0CC-FT | ||
ipch/** | ||
Texts/** | ||
hlp/** | ||
*.bin | ||
*.lnk | ||
*.tlog | ||
*.chm | ||
*.lastbuildstate | ||
FamiTracker.opensdf | ||
FamiTracker.sdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
REGEDIT | ||
; This .REG file may be used by your SETUP program. | ||
; If a SETUP program is not available, the entries below will be | ||
; registered in your InitInstance automatically with a call to | ||
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll. | ||
|
||
HKEY_CLASSES_ROOT\.ftm = "FamiTracker module" | ||
HKEY_CLASSES_ROOT\FamiTracker.Document\shell\open\command = FamiTracker.EXE %1 | ||
HKEY_CLASSES_ROOT\FamiTracker.Document\shell\open\ddeexec = [open("%1")] | ||
HKEY_CLASSES_ROOT\FamiTracker.Document\shell\open\ddeexec\application = FamiTracker | ||
; note: the application is optional | ||
; (it defaults to the app name in "command") | ||
HKEY_CLASSES_ROOT\FamiTracker.Document = FamiTracker Module | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* YM2413 VOICE */ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x61, 0x61, 0x1e, 0x17, 0xf0, 0x7f, 0x07, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x13, 0x41, 0x0f, 0x0d, 0xce, 0xd2, 0x43, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x03, 0x01, 0x99, 0x04, 0xff, 0xc3, 0x03, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x21, 0x61, 0x1b, 0x07, 0xaf, 0x63, 0x40, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x22, 0x21, 0x1e, 0x06, 0xf0, 0x76, 0x08, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x31, 0x22, 0x16, 0x05, 0x90, 0x71, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x21, 0x61, 0x1d, 0x07, 0x82, 0x81, 0x10, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x23, 0x21, 0x2d, 0x16, 0xc0, 0x70, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x61, 0x21, 0x1b, 0x06, 0x64, 0x65, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x61, 0x61, 0x0c, 0x18, 0x85, 0xa0, 0x79, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x23, 0x21, 0x87, 0x11, 0xf0, 0xa4, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x97, 0xe1, 0x28, 0x07, 0xff, 0xf3, 0x02, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x61, 0x10, 0x0c, 0x05, 0xf2, 0xc4, 0x40, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x01, 0x01, 0x56, 0x03, 0xb4, 0xb2, 0x23, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x61, 0x41, 0x89, 0x03, 0xf1, 0xf4, 0xf0, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x04, 0x21, 0x28, 0x00, 0xdf, 0xf8, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x23, 0x22, 0x00, 0x00, 0xd8, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x25, 0x18, 0x00, 0x00, 0xf8, 0xda, 0xf8, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
** FamiTracker - NES/Famicom sound tracker | ||
** Copyright (C) 2005-2014 Jonathan Liss | ||
** | ||
** This program is free software; you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation; either version 2 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
** Library General Public License for more details. To obtain a | ||
** copy of the GNU Library General Public License, write to the Free | ||
** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
** | ||
** Any permitted reproduction of these routines, in whole or in part, | ||
** must bear this legend. | ||
*/ | ||
|
||
#ifndef CHANNEL_H | ||
#define CHANNEL_H | ||
|
||
class CMixer; | ||
|
||
// | ||
// This class is used to derive the audio channels | ||
// | ||
|
||
class CChannel { | ||
public: | ||
CChannel(CMixer *pMixer, int ID, int Chip) : | ||
m_pMixer(pMixer), | ||
m_iChanId(ID), | ||
m_iChip(Chip), | ||
m_iTime(0), | ||
m_iLastValue(0) | ||
{ | ||
} | ||
|
||
// Begin a new audio frame | ||
inline void EndFrame() { | ||
m_iTime = 0; | ||
} | ||
|
||
inline uint16 GetPeriod() const { | ||
return m_iPeriod; | ||
} | ||
|
||
protected: | ||
inline virtual void Mix(int32 Value) { | ||
if (m_iLastValue != Value) { | ||
m_pMixer->AddValue(m_iChanId, m_iChip, Value, Value, m_iTime); | ||
m_iLastValue = Value; | ||
} | ||
}; | ||
|
||
protected: | ||
CMixer *m_pMixer; // The mixer | ||
|
||
uint32 m_iTime; // Cycle counter, resets every new frame | ||
int32 m_iLastValue; // Last value sent to mixer | ||
uint16 m_iChanId; // This channels unique ID | ||
uint16 m_iChip; // Chip | ||
|
||
// Variables used by channels | ||
uint8 m_iControlReg; | ||
uint8 m_iEnabled; | ||
uint16 m_iPeriod; | ||
uint16 m_iLengthCounter; | ||
uint32 m_iCounter; | ||
}; | ||
|
||
class CExChannel { | ||
public: | ||
CExChannel(CMixer *pMixer, uint8 Chip, uint8 ID) : | ||
m_pMixer(pMixer), | ||
m_iChip(Chip), | ||
m_iChanId(ID), | ||
m_iTime(0), | ||
m_iLastValue(0) | ||
{ | ||
} | ||
|
||
virtual inline void EndFrame() { | ||
m_iTime = 0; | ||
} | ||
|
||
protected: | ||
inline void Mix(int32 Value) { | ||
int32 Delta = Value - m_iLastValue; | ||
if (Delta) | ||
m_pMixer->AddValue(m_iChanId, m_iChip, Delta, Value, m_iTime); | ||
m_iLastValue = Value; | ||
} | ||
|
||
protected: | ||
CMixer *m_pMixer; | ||
|
||
uint32 m_iTime; // Cycle counter, resets every new frame | ||
uint8 m_iChip; | ||
uint8 m_iChanId; | ||
int32 m_iLastValue; // Last value sent to mixer | ||
}; | ||
|
||
#endif /* CHANNEL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
/* | ||
** FamiTracker - NES/Famicom sound tracker | ||
** Copyright (C) 2005-2014 Jonathan Liss | ||
** | ||
** This program is free software; you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation; either version 2 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
** Library General Public License for more details. To obtain a | ||
** copy of the GNU Library General Public License, write to the Free | ||
** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
** | ||
** Any permitted reproduction of these routines, in whole or in part, | ||
** must bear this legend. | ||
*/ | ||
|
||
#include "APU.h" | ||
#include "DPCM.h" | ||
|
||
const uint16 CDPCM::DMC_PERIODS_NTSC[] = { | ||
428, 380, 340, 320, 286, 254, 226, 214, 190, 160, 142, 128, 106, 84, 72, 54 | ||
}; | ||
|
||
const uint16 CDPCM::DMC_PERIODS_PAL[] = { | ||
398, 354, 316, 298, 276, 236, 210, 198, 176, 148, 132, 118, 98, 78, 66, 50 | ||
}; | ||
|
||
CDPCM::CDPCM(CMixer *pMixer, CSampleMem *pSampleMem, int ID) : CChannel(pMixer, ID, SNDCHIP_NONE), m_pSampleMem(pSampleMem) | ||
{ | ||
PERIOD_TABLE = DMC_PERIODS_NTSC; | ||
|
||
Reset(); | ||
} | ||
|
||
CDPCM::~CDPCM() | ||
{ | ||
} | ||
|
||
void CDPCM::Reset() | ||
{ | ||
m_iCounter = m_iPeriod = DMC_PERIODS_NTSC[0]; | ||
|
||
m_iBitDivider = m_iShiftReg = 0; | ||
m_iDMA_LoadReg = 0; | ||
m_iDMA_LengthReg = 0; | ||
m_iDMA_Address = 0; | ||
m_iDMA_BytesRemaining = 0; | ||
|
||
m_bTriggeredIRQ = m_bSampleFilled = false; | ||
|
||
// loaded with 0 on power-up. | ||
m_iDeltaCounter = 0; | ||
|
||
EndFrame(); | ||
} | ||
|
||
void CDPCM::Write(uint16 Address, uint8 Value) | ||
{ | ||
switch (Address) { | ||
case 0x00: | ||
m_iPlayMode = Value & 0xC0; | ||
m_iPeriod = PERIOD_TABLE[Value & 0x0F]; | ||
if ((Value & 0x80) == 0x00) | ||
m_bTriggeredIRQ = false; | ||
break; | ||
case 0x01: | ||
m_iDeltaCounter = Value & 0x7F; | ||
Mix(m_iDeltaCounter); | ||
break; | ||
case 0x02: | ||
m_iDMA_LoadReg = Value; | ||
break; | ||
case 0x03: | ||
m_iDMA_LengthReg = Value; | ||
break; | ||
} | ||
} | ||
|
||
void CDPCM::WriteControl(uint8 Value) | ||
{ | ||
if ((Value & 1) == 1) { | ||
if (m_iDMA_BytesRemaining == 0) | ||
Reload(); | ||
} | ||
else { | ||
m_iDMA_BytesRemaining = 0; | ||
} | ||
|
||
m_bTriggeredIRQ = false; | ||
} | ||
|
||
uint8 CDPCM::ReadControl() const | ||
{ | ||
return (m_iDMA_BytesRemaining > 0) ? 1 : 0; | ||
} | ||
|
||
uint8 CDPCM::DidIRQ() const | ||
{ | ||
return m_bTriggeredIRQ ? 1 : 0; | ||
} | ||
|
||
void CDPCM::Reload() | ||
{ | ||
m_iDMA_Address = (m_iDMA_LoadReg << 6) | 0x4000; | ||
m_iDMA_BytesRemaining = (m_iDMA_LengthReg << 4) + 1; | ||
} | ||
|
||
void CDPCM::Process(uint32 Time) | ||
{ | ||
while (Time >= m_iCounter) { | ||
Time -= m_iCounter; | ||
m_iTime += m_iCounter; | ||
m_iCounter = m_iPeriod; | ||
|
||
// DMA reader | ||
// Check if a new byte should be fetched | ||
if (!m_bSampleFilled && (m_iDMA_BytesRemaining > 0)) { | ||
|
||
m_iSampleBuffer = m_pSampleMem->Read(m_iDMA_Address | 0x8000); | ||
// m_pEmulator->ConsumeCycles(4); | ||
m_iDMA_Address = (m_iDMA_Address + 1) & 0x7FFF; | ||
--m_iDMA_BytesRemaining; | ||
m_bSampleFilled = true; | ||
|
||
if (!m_iDMA_BytesRemaining) { | ||
switch (m_iPlayMode) { | ||
case 0x00: // Stop | ||
break; | ||
case 0x40: // Loop | ||
case 0xC0: | ||
Reload(); | ||
break; | ||
case 0x80: // Stop and do IRQ (not when an NSF is playing) | ||
m_bTriggeredIRQ = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
// Output unit | ||
if (!m_iBitDivider) { | ||
// Begin new output cycle | ||
m_iBitDivider = 8; | ||
if (m_bSampleFilled) { | ||
m_iShiftReg = m_iSampleBuffer; | ||
m_bSampleFilled = false; | ||
m_bSilenceFlag = false; | ||
} | ||
else { | ||
m_bSilenceFlag = true; | ||
} | ||
} | ||
|
||
if (!m_bSilenceFlag) { | ||
if ((m_iShiftReg & 1) == 1) { | ||
if (m_iDeltaCounter < 126) | ||
m_iDeltaCounter += 2; | ||
} | ||
else { | ||
if (m_iDeltaCounter > 1) | ||
m_iDeltaCounter -= 2; | ||
} | ||
} | ||
|
||
m_iShiftReg >>= 1; | ||
--m_iBitDivider; | ||
|
||
Mix(m_iDeltaCounter); | ||
} | ||
|
||
m_iCounter -= Time; | ||
m_iTime += Time; | ||
} |
Oops, something went wrong.