Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions configs/schema
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"type": "integer",
"description": "Any track number greater than this will not be processed"
},
"use_render_track_field":{
"type": "boolean",
"description": "Wether or not to only render tracks that have the field \"render_track\" set to true"
},
"tracks": {
"type": "array",
"minItems": 1,
Expand All @@ -64,6 +68,7 @@
"properties": {
"track_number": { "type": "integer" },
"title": { "type": "string" },
"render_track":{"type":"boolean"},
"sub_channels": {
"type": "array",
"description": "Files which will be mixed together to form the input to the parent track",
Expand Down
17 changes: 17 additions & 0 deletions msupcm++/AudioTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,31 @@ AudioTrack::AudioTrack(): AudioBase()
{
m_track_number = 0;
m_title.clear();
m_render_track = false;
}


AudioTrack::AudioTrack(std::fstring_t in): AudioBase(in)
{
m_track_number = 0;
m_title.clear();
m_render_track = false;
}


AudioTrack::AudioTrack(std::fstring_t in, std::fstring_t out): AudioBase(in, out)
{
m_track_number = 0;
m_title.clear();
m_render_track = false;
}


AudioTrack::AudioTrack(int argc, char** argv) : AudioBase()
{
m_track_number = 0;
m_title.clear();
m_render_track = false;

for (int i = 0; i < argc; ++i)
{
Expand All @@ -55,6 +59,7 @@ AudioTrack::AudioTrack(const AudioTrack& a)
{
m_track_number = 0;
m_title.clear();
m_render_track = false;
*this = a;
}

Expand Down Expand Up @@ -84,6 +89,7 @@ AudioTrack& AudioTrack::operator=(const AudioTrack& a)

m_track_number = a.m_track_number;
m_title = a.m_title;
m_render_track = a.m_render_track;

return *this;
}
Expand Down Expand Up @@ -123,6 +129,7 @@ void AudioTrack::clear()

m_track_number = 0;
m_title.clear();
m_render_track = false;
}


Expand Down Expand Up @@ -179,3 +186,13 @@ std::wstring& AudioTrack::title()
{
return m_title;
}

bool AudioTrack::renderTrack() const
{
return m_render_track;
}

bool& msu::AudioTrack::renderTrack()
{
return m_render_track;
}
4 changes: 4 additions & 0 deletions msupcm++/AudioTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ namespace msu
const std::wstring& title() const;
std::wstring& title();

bool renderTrack() const;
bool& renderTrack();

protected:
int m_track_number;
std::wstring m_title;
bool m_render_track;
};
}
21 changes: 17 additions & 4 deletions msupcm++/AudioTrackList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@ void AudioTrackList::render()
std::wcout << std::endl;
}

for (AudioTrack track : m_tracks)
if (config.use_render_track_field())
{
if ((track.trackNumber() >= config.first_track()) &&
(config.last_track() < 0 || track.trackNumber() <= config.last_track()))
for (AudioTrack track : m_tracks)
{
track.render();
if (track.renderTrack())
{
track.render();
}
}
}
else
{
for (AudioTrack track : m_tracks)
{
if ((track.trackNumber() >= config.first_track()) &&
(config.last_track() < 0 || track.trackNumber() <= config.last_track()))
{
track.render();
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions msupcm++/GlobalConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ unsigned int GlobalConfig::m_verbosity = 2;
bool GlobalConfig::m_keep_temps = false;
int GlobalConfig::m_first_track = -1;
int GlobalConfig::m_last_track = -1;
bool GlobalConfig::m_use_render_track_field = false;

std::wstring& GlobalConfig::game()
{
Expand Down Expand Up @@ -86,3 +87,8 @@ int& GlobalConfig::last_track()
{
return m_last_track;
}

bool& GlobalConfig::use_render_track_field()
{
return m_use_render_track_field;
}
2 changes: 2 additions & 0 deletions msupcm++/GlobalConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace msu
static bool& keep_temps();
static int& first_track();
static int& last_track();
static bool& use_render_track_field();

private:
static std::wstring m_game;
Expand All @@ -36,5 +37,6 @@ namespace msu
static bool m_keep_temps;
static int m_first_track;
static int m_last_track;
static bool m_use_render_track_field;
} config;
}
10 changes: 9 additions & 1 deletion msupcm++/TrackParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ namespace msu {

j["track_number"] = a.trackNumber();
j["title"] = a.title();
j["render_track"] = a.renderTrack();
}


Expand All @@ -92,7 +93,8 @@ namespace msu {
{ "verbosity", config.verbosity() },
{ "keep_temps", config.keep_temps() },
{ "first_track", config.first_track() },
{ "last_track", config.last_track() }
{ "last_track", config.last_track() },
{ "use_render_track_field", config.use_render_track_field() }
};

for (auto i = a.tracks().begin(); i != a.tracks().end(); ++i)
Expand Down Expand Up @@ -260,6 +262,9 @@ namespace msu {
if (j.find("title") != j.end())
a.title() = utf8_to_wstring.from_bytes(j["title"].get<std::string>().c_str());

if (j.find("render_track") != j.end())
a.renderTrack() = j["render_track"].get<bool>();

if (a.outFile().empty())
#ifdef WIN32
a.outFile() = config.output_prefix() + L"-" + std::to_wstring(a.trackNumber()) + L".pcm";
Expand Down Expand Up @@ -335,6 +340,9 @@ namespace msu {
if (j.find("last_track") != j.end())
config.last_track() = j["last_track"].get<int>();

if (j.find("use_render_track_field") != j.end())
config.use_render_track_field() = j["use_render_track_field"].get<bool>();

if (j.find("tracks") != j.end())
{
for (auto i = j["tracks"].begin(); i != j["tracks"].end(); ++i)
Expand Down