Skip to content

Commit

Permalink
Env -> FTEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed May 17, 2018
1 parent 02e89ba commit 7890766
Show file tree
Hide file tree
Showing 60 changed files with 471 additions and 473 deletions.
2 changes: 1 addition & 1 deletion 0CC-FamiTracker.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<RootNamespace>0CC-FamiTracker</RootNamespace>
<Keyword>MFCProj</Keyword>
<ProjectName>0CC-FamiTracker</ProjectName>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release 64|Win32'" Label="Configuration">
Expand Down
2 changes: 1 addition & 1 deletion 0ccft-ext/testMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CStdoutLog : public CCompilerLog {

int main() try {
CFamiTrackerModule modfile;
modfile.SetChannelMap(Env.GetSoundChipService()->MakeChannelMap(sound_chip_t::APU, 0));
modfile.SetChannelMap(FTEnv.GetSoundChipService()->MakeChannelMap(sound_chip_t::APU, 0));

Kraid { }(modfile);

Expand Down
2 changes: 1 addition & 1 deletion Source/APU/APU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CAPU::CAPU(IAudioCallback *pCallback) : // // //
{
constexpr std::uint8_t INSTANCE_ID = 0u;

auto *pSCS = Env.GetSoundChipService();
auto *pSCS = FTEnv.GetSoundChipService();
pSCS->ForeachType([&] (sound_chip_t c) {
m_pSoundChips.push_back(pSCS->MakeSoundChipDriver(c, *m_pMixer, INSTANCE_ID));
});
Expand Down
4 changes: 2 additions & 2 deletions Source/Accelerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ bool CAccelerator::IsKeyUsed(int nChar) const // // //
void CAccelerator::SaveShortcuts(CSettings *pSettings) const
{
// Save values
auto *App = Env.GetMainApp(); // // //
auto *App = FTEnv.GetMainApp(); // // //
for (const auto &x : m_pEntriesTable) // // //
App->WriteProfileInt(SHORTCUTS_SECTION, x.name, (x.mod << 8) | x.key);
}

void CAccelerator::LoadShortcuts(CSettings *pSettings)
{
auto *App = Env.GetMainApp(); // // //
auto *App = FTEnv.GetMainApp(); // // //

// Set up names and default values
LoadDefaults();
Expand Down
2 changes: 1 addition & 1 deletion Source/ChannelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ int CChannelHandler::LimitVolume(int Volume) const // // //
return 0;

Volume = std::clamp(Volume, 0, m_iMaxVolume);
if (Volume == 0 && !Env.GetSettings()->General.bCutVolume && m_iInstVolume > 0 && m_iVolume > 0) // // //
if (Volume == 0 && !FTEnv.GetSettings()->General.bCutVolume && m_iInstVolume > 0 && m_iVolume > 0) // // //
return 1;
return Volume;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Channels2A03.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void CDPCMChan::RefreshChannel()
m_pAPU->Write(0x4015, 0x0F);

#ifndef FT0CC_EXT_BUILD
if (!Env.GetSettings()->General.bNoDPCMReset || Env.GetSoundGenerator()->IsPlaying()) // // //
if (!FTEnv.GetSettings()->General.bNoDPCMReset || FTEnv.GetSoundGenerator()->IsPlaying()) // // //
#endif
m_pAPU->Write(0x4011, 0); // regain full volume for TN

Expand Down
6 changes: 3 additions & 3 deletions Source/ChannelsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ BOOL CChannelsDlg::OnInitDialog()
m_cAddedChannels.GetClientRect(rect);
m_cAddedChannels.InsertColumn(0, L"Name", 0, rect.Width());

auto *pSCS = Env.GetSoundChipService(); // // //
auto *pSCS = FTEnv.GetSoundChipService(); // // //
pSCS->ForeachType([&] (sound_chip_t ch) {
HTREEITEM hItem = m_cAvailableTree.InsertItem(conv::to_wide(pSCS->GetChipFullName(ch)).data());
m_cAvailableTree.SetItemData(hItem, value_cast(ch));
Expand Down Expand Up @@ -154,7 +154,7 @@ void CChannelsDlg::OnDblClickAdded(NMHDR *pNMHDR, LRESULT *result)
}

void CChannelsDlg::InsertChannel(HTREEITEM hItem) {
auto *pSCS = Env.GetSoundChipService(); // // //
auto *pSCS = FTEnv.GetSoundChipService(); // // //

if (HTREEITEM hParentItem = m_cAvailableTree.GetParentItem(hItem)) {
auto iData = m_cAvailableTree.GetItemData(hItem);
Expand All @@ -175,7 +175,7 @@ void CChannelsDlg::InsertChannel(HTREEITEM hItem) {
}

void CChannelsDlg::RemoveChannel(int nId) { // // //
auto *pSCS = Env.GetSoundChipService(); // // //
auto *pSCS = FTEnv.GetSoundChipService(); // // //
DWORD_PTR iData = m_cAddedChannels.GetItemData(nId);
const auto &ChanID = stChannelID::FromInteger(iData);

Expand Down
2 changes: 1 addition & 1 deletion Source/ChannelsFDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void CChannelHandlerFDS::HandleRelease()

int CChannelHandlerFDS::CalculateVolume() const // // //
{
if (!Env.GetSettings()->General.bFDSOldVolume) // // // match NSF setting
if (!FTEnv.GetSettings()->General.bFDSOldVolume) // // // match NSF setting
return LimitVolume(((m_iInstVolume + 1) * ((m_iVolume >> VOL_COLUMN_SHIFT) + 1) - 1) / 16 - GetTremolo());
return CChannelHandler::CalculateVolume();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/ChannelsVRC6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int CVRC6Sawtooth::CalculateVolume() const // // //
use_64_steps = pHandler->IsDutyIgnored();

if (use_64_steps) {
if (!Env.GetSettings()->General.bFDSOldVolume) // // // match NSF setting
if (!FTEnv.GetSettings()->General.bFDSOldVolume) // // // match NSF setting
return LimitVolume(((m_iInstVolume + 1) * ((m_iVolume >> VOL_COLUMN_SHIFT) + 1) - 1) / 16 - GetTremolo());
return CChannelHandler::CalculateVolume();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/ChunkRenderText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void CChunkRenderText::StoreChunks(const std::vector<std::shared_ptr<CChunk>> &C

// Write strings to file
WriteFileString("; 0CC-FamiTracker exported music data: ");
WriteFileString(Env.GetDocumentTitle()); // // //
WriteFileString(FTEnv.GetDocumentTitle()); // // //
WriteFileString("\n;\n\n");

// Module header
Expand Down
6 changes: 3 additions & 3 deletions Source/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ std::vector<unsigned char> CCompiler::LoadDriver(const driver_t &Driver, unsigne

if (m_pModule->GetSoundChipSet().IsMultiChip()) { // // // special processing for multichip
int ptr = FT_UPDATE_EXT_ADR;
Env.GetSoundChipService()->ForeachType([&] (sound_chip_t chip) {
FTEnv.GetSoundChipService()->ForeachType([&] (sound_chip_t chip) {
if (chip != sound_chip_t::APU) {
Assert(Data[ptr] == 0x20); // jsr
if (!m_pModule->HasExpansionChip(chip)) {
Expand All @@ -516,7 +516,7 @@ std::vector<unsigned char> CCompiler::LoadDriver(const driver_t &Driver, unsigne
}
});

auto full = Env.GetSoundChipService()->MakeFullOrder().Canonicalize();
auto full = FTEnv.GetSoundChipService()->MakeFullOrder().Canonicalize();
full.RemoveChannel(mmc5_subindex_t::pcm);

for (std::size_t i = 0, n = full.GetChannelCount(); i < n; ++i)
Expand Down Expand Up @@ -1196,7 +1196,7 @@ void CCompiler::CreateInstrumentList()
}

// Returns number of bytes
const auto &compiler = Env.GetInstrumentService()->GetChunkCompiler(pInstrument->GetType()); // // //
const auto &compiler = FTEnv.GetInstrumentService()->GetChunkCompiler(pInstrument->GetType()); // // //
iTotalSize += compiler.CompileChunk(*pInstrument, Chunk, iIndex);

// // // Check if FDS
Expand Down
24 changes: 12 additions & 12 deletions Source/ConfigMIDI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ BOOL CConfigMIDI::OnInitDialog()
{
CPropertyPage::OnInitDialog();

CMIDI *pMIDI = Env.GetMIDI(); // // //
CMIDI *pMIDI = FTEnv.GetMIDI(); // // //
int NumDev, i;
CStringW Text;

Expand Down Expand Up @@ -89,11 +89,11 @@ BOOL CConfigMIDI::OnInitDialog()
pInDevices->SetCurSel(pMIDI->GetInputDevice());
pOutDevices->SetCurSel(pMIDI->GetOutputDevice());

CheckDlgButton(IDC_MASTER_SYNC, Env.GetSettings()->Midi.bMidiMasterSync ? 1 : 0);
CheckDlgButton(IDC_KEY_RELEASE, Env.GetSettings()->Midi.bMidiKeyRelease ? 1 : 0);
CheckDlgButton(IDC_CHANMAP, Env.GetSettings()->Midi.bMidiChannelMap ? 1 : 0);
CheckDlgButton(IDC_VELOCITY, Env.GetSettings()->Midi.bMidiVelocity ? 1 : 0);
CheckDlgButton(IDC_ARPEGGIATE, Env.GetSettings()->Midi.bMidiArpeggio ? 1 : 0);
CheckDlgButton(IDC_MASTER_SYNC, FTEnv.GetSettings()->Midi.bMidiMasterSync ? 1 : 0);
CheckDlgButton(IDC_KEY_RELEASE, FTEnv.GetSettings()->Midi.bMidiKeyRelease ? 1 : 0);
CheckDlgButton(IDC_CHANMAP, FTEnv.GetSettings()->Midi.bMidiChannelMap ? 1 : 0);
CheckDlgButton(IDC_VELOCITY, FTEnv.GetSettings()->Midi.bMidiVelocity ? 1 : 0);
CheckDlgButton(IDC_ARPEGGIATE, FTEnv.GetSettings()->Midi.bMidiArpeggio ? 1 : 0);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
Expand All @@ -103,16 +103,16 @@ BOOL CConfigMIDI::OnApply()
{
CComboBox *pInDevices = static_cast<CComboBox*>(GetDlgItem(IDC_INDEVICES));
CComboBox *pOutDevices = static_cast<CComboBox*>(GetDlgItem(IDC_OUTDEVICES));
CMIDI *pMIDI = Env.GetMIDI();
CMIDI *pMIDI = FTEnv.GetMIDI();

pMIDI->SetInputDevice(pInDevices->GetCurSel(), IsDlgButtonChecked(IDC_MASTER_SYNC) != 0);
pMIDI->SetOutputDevice(pOutDevices->GetCurSel());

Env.GetSettings()->Midi.bMidiMasterSync = IsDlgButtonChecked(IDC_MASTER_SYNC) == 1;
Env.GetSettings()->Midi.bMidiKeyRelease = IsDlgButtonChecked(IDC_KEY_RELEASE) == 1;
Env.GetSettings()->Midi.bMidiChannelMap = IsDlgButtonChecked(IDC_CHANMAP) == 1;
Env.GetSettings()->Midi.bMidiVelocity = IsDlgButtonChecked(IDC_VELOCITY) == 1;
Env.GetSettings()->Midi.bMidiArpeggio = IsDlgButtonChecked(IDC_ARPEGGIATE) == 1;
FTEnv.GetSettings()->Midi.bMidiMasterSync = IsDlgButtonChecked(IDC_MASTER_SYNC) == 1;
FTEnv.GetSettings()->Midi.bMidiKeyRelease = IsDlgButtonChecked(IDC_KEY_RELEASE) == 1;
FTEnv.GetSettings()->Midi.bMidiChannelMap = IsDlgButtonChecked(IDC_CHANMAP) == 1;
FTEnv.GetSettings()->Midi.bMidiVelocity = IsDlgButtonChecked(IDC_VELOCITY) == 1;
FTEnv.GetSettings()->Midi.bMidiArpeggio = IsDlgButtonChecked(IDC_ARPEGGIATE) == 1;

return CPropertyPage::OnApply();
}
Expand Down
6 changes: 3 additions & 3 deletions Source/ConfigMixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const int CConfigMixer::LEVEL_SCALE = 10; // 0.1 dB resolution

BOOL CConfigMixer::OnInitDialog()
{
const CSettings *pSettings = Env.GetSettings();
const CSettings *pSettings = FTEnv.GetSettings();

m_iLevelAPU1 = -pSettings->ChipLevels.iLevelAPU1;
m_iLevelAPU2 = -pSettings->ChipLevels.iLevelAPU2;
Expand Down Expand Up @@ -95,7 +95,7 @@ BOOL CConfigMixer::OnInitDialog()

BOOL CConfigMixer::OnApply()
{
CSettings *pSettings = Env.GetSettings();
CSettings *pSettings = FTEnv.GetSettings();

pSettings->ChipLevels.iLevelAPU1 = -m_iLevelAPU1;
pSettings->ChipLevels.iLevelAPU2 = -m_iLevelAPU2;
Expand All @@ -106,7 +106,7 @@ BOOL CConfigMixer::OnApply()
pSettings->ChipLevels.iLevelN163 = -m_iLevelN163;
pSettings->ChipLevels.iLevelS5B = -m_iLevelS5B;

Env.GetSoundGenerator()->LoadSoundConfig(); // // //
FTEnv.GetSoundGenerator()->LoadSoundConfig(); // // //

return CPropertyPage::OnApply();
}
Expand Down
8 changes: 4 additions & 4 deletions Source/ConfigSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ BOOL CConfigSound::OnInitDialog()
pTrebleSliderDamping->SetRange(0, 90);
pVolumeSlider->SetRange(0, 100);

const CSettings *pSettings = Env.GetSettings();
const CSettings *pSettings = FTEnv.GetSettings();

// Read settings
switch (pSettings->Sound.iSampleRate) {
Expand All @@ -102,7 +102,7 @@ BOOL CConfigSound::OnInitDialog()

UpdateTexts();

CDSound *pDSound = Env.GetSoundGenerator()->GetSoundInterface();
CDSound *pDSound = FTEnv.GetSoundGenerator()->GetSoundInterface();
const int iCount = pDSound->GetDeviceCount();

for (int i = 0; i < iCount; ++i)
Expand All @@ -128,7 +128,7 @@ BOOL CConfigSound::OnApply()
CComboBox *pSampleSize = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_SIZE));
CSliderCtrl *pBufSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BUF_LENGTH));

auto *pSettings = Env.GetSettings(); // // //
auto *pSettings = FTEnv.GetSettings(); // // //

switch (pSampleRate->GetCurSel()) {
case 0: pSettings->Sound.iSampleRate = 11025; break;
Expand All @@ -152,7 +152,7 @@ BOOL CConfigSound::OnApply()

pSettings->Sound.iDevice = pDevices->GetCurSel();

Env.GetSoundGenerator()->LoadSoundConfig(); // // //
FTEnv.GetSoundGenerator()->LoadSoundConfig(); // // //

return CPropertyPage::OnApply();
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ConfigVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ BOOL CConfigVersion::OnInitDialog()
{
CPropertyPage::OnInitDialog();

m_iModuleErrorLevel = value_cast(Env.GetSettings()->Version.iErrorLevel);
m_iModuleErrorLevel = value_cast(FTEnv.GetSettings()->Version.iErrorLevel);

m_cSliderErrorLevel.SubclassDlgItem(IDC_SLIDER_VERSION_ERRORLEVEL, this);
m_cSliderErrorLevel.SetRange(MODULE_ERROR_NONE, MODULE_ERROR_STRICT);
Expand All @@ -90,7 +90,7 @@ BOOL CConfigVersion::OnApply()
return false;
}
#endif
Env.GetSettings()->Version.iErrorLevel = enum_cast<module_error_level_t>(m_iModuleErrorLevel);
FTEnv.GetSettings()->Version.iErrorLevel = enum_cast<module_error_level_t>(m_iModuleErrorLevel);

return CPropertyPage::OnApply();
}
Expand Down
4 changes: 2 additions & 2 deletions Source/CreateWaveDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void CCreateWaveDlg::OnBnClickedBegin()
EndDialog(0);

// Ask for file location
auto initPath = Env.GetSettings()->GetPath(PATH_WAV);
auto initPath = FTEnv.GetSettings()->GetPath(PATH_WAV);
auto path = GetSavePath(FileName, initPath.c_str(), IDS_FILTER_WAV, L"*.wav"); // // //
if (!path)
return;
Expand Down Expand Up @@ -168,7 +168,7 @@ BOOL CCreateWaveDlg::OnInitDialog()
const CChannelOrder &order = pModule->GetChannelOrder(); // CFamiTrackerView::GetView()->GetSongView()->

order.ForeachChannel([&] (stChannelID i) {
m_ctlChannelList.AddString(conv::to_wide(Env.GetSoundChipService()->GetChannelFullName(i)).data()); // // //
m_ctlChannelList.AddString(conv::to_wide(FTEnv.GetSoundChipService()->GetChannelFullName(i)).data()); // // //
m_ctlChannelList.SetCheck(order.GetChannelIndex(i), 1);
});

Expand Down
10 changes: 5 additions & 5 deletions Source/ExportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ void CExportDialog::WithFile(const fs::path &initFName, F f) { // // //
template <typename F>
void CExportDialog::WithFile(const fs::path &initFName, const CStringW &filterName, const CStringW &filterExt, F f) {
// CStringW title = CFamiTrackerDoc::GetDoc()->GetFileTitle();
// CStringW initPath = Env.GetSettings()->GetPath(PATH_NSF).c_str();
if (auto path = GetSavePath(initFName, Env.GetSettings()->GetPath(PATH_NSF).c_str(), filterName, filterExt)) { // // //
// CStringW initPath = FTEnv.GetSettings()->GetPath(PATH_NSF).c_str();
if (auto path = GetSavePath(initFName, FTEnv.GetSettings()->GetPath(PATH_NSF).c_str(), filterName, filterExt)) { // // //
if (auto file = OpenFile(*path)) {
f(*file);
Env.GetSettings()->SetPath(path->parent_path(), PATH_NSF);
FTEnv.GetSettings()->SetPath(path->parent_path(), PATH_NSF);
}
}
}
Expand Down Expand Up @@ -267,7 +267,7 @@ void CExportDialog::CreateNES()

void CExportDialog::CreateBIN()
{
if (auto path = GetSavePath("music.bin", Env.GetSettings()->GetPath(PATH_NSF).c_str(), DEFAULT_FILTERS[m_iExportOption][0], DEFAULT_FILTERS[m_iExportOption][1])) { // // //
if (auto path = GetSavePath("music.bin", FTEnv.GetSettings()->GetPath(PATH_NSF).c_str(), DEFAULT_FILTERS[m_iExportOption][0], DEFAULT_FILTERS[m_iExportOption][1])) { // // //
if (auto BINFile = OpenFile(*path)) {
const fs::path DEFAULT_SAMPLE_NAME = "samples.bin"; // // //
fs::path samplePath = path->parent_path() / DEFAULT_SAMPLE_NAME;
Expand All @@ -290,7 +290,7 @@ void CExportDialog::CreateBIN()

CCompiler Compiler(*pDoc->GetModule(), std::make_unique<CEditLog>(GetDlgItem(IDC_OUTPUT)));
Compiler.ExportBIN(*BINFile, *DPCMFile);
Env.GetSettings()->SetPath(path->parent_path(), PATH_NSF);
FTEnv.GetSettings()->SetPath(path->parent_path(), PATH_NSF);
}
}
}
Expand Down
Loading

0 comments on commit 7890766

Please sign in to comment.