61{
63
65 {
67 return 1;
68 }
69
70 const std::string inputFile =
argv[1];
71 auto duration = 0.;
72 try
73 {
74 duration = std::stod(
argv[2]);
75 }
76 catch (std::invalid_argument& e)
77 {
78 std::cout <<
"Invalid duration: " <<
argv[2] << std::endl;
80 return 1;
81 }
82
84 if (!tagger)
85 {
86 std::cout << "Failed to open file: " << inputFile << std::endl;
87 return 1;
88 }
89
90 enum class Mode
91 {
92 Unknown,
93 MuseHub,
94 SoundForge,
95 };
96 const Mode mode = std::string {
"MuseHub" } ==
argv[3] ? Mode::MuseHub :
97 std::string {
"SoundForge" } ==
argv[3] ?
98 Mode::SoundForge :
99 Mode::Unknown;
100 if (mode == Mode::Unknown)
101 {
102 std::cout <<
"Unknown mode: " <<
argv[3] << std::endl;
104 return 1;
105 }
106
107 const auto isOneShot =
argc >= 5 && std::string {
"one-shot" } ==
argv[4];
108 if (isOneShot)
109 tagger.AddAcidizerTags(Test::AcidizerTags::OneShot {});
110 else if (mode == Mode::MuseHub)
111 try
112 {
113 const auto bpm = std::stod(
argv[4]);
114 tagger.AddAcidizerTags(Test::AcidizerTags::Loop { bpm });
115 tagger.AddDistributorInfo("Muse Hub");
116 }
117 catch (std::invalid_argument& e)
118 {
119 std::cout <<
"Invalid BPM: " <<
argv[4] << std::endl;
121 return 1;
122 }
123 else
124 try
125 {
126 const auto numBeats = std::stoi(
argv[4]);
128 }
129 catch (std::invalid_argument& e)
130 {
131 std::cout <<
"Invalid number of beats: " <<
argv[5] << std::endl;
133 return 1;
134 }
135
136 return 0;
137}
When adding tags, the allocated memory must be preserved until the file is closed....
UTILITY_API const char *const * argv
A copy of argv; responsibility of application startup to assign it.
UTILITY_API int argc
A copy of argc; responsibility of application startup to assign it.
void PrintHelp(const char *const *argv)