summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/asset_packer.cc9
-rw-r--r--tools/spectool.cc3
-rw-r--r--tools/tracker_compiler.cc30
3 files changed, 24 insertions, 18 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc
index 2de57d0..2b65200 100644
--- a/tools/asset_packer.cc
+++ b/tools/asset_packer.cc
@@ -196,7 +196,8 @@ int main(int argc, char* argv[]) {
fprintf(assets_h_file,
"#include \"util/asset_manager.h\"\n"); // Include here AFTER enum
// definition
- fprintf(assets_h_file, "\n// Accessors to avoid static initialization order issues\n");
+ fprintf(assets_h_file,
+ "\n// Accessors to avoid static initialization order issues\n");
fprintf(assets_h_file, "const struct AssetRecord* GetAssetRecordTable();\n");
fprintf(assets_h_file, "size_t GetAssetCount();\n");
@@ -219,7 +220,8 @@ int main(int argc, char* argv[]) {
fprintf(assets_data_cc_file, "const size_t ASSET_SIZE_%s = %zu;\n",
info.name.c_str(), original_size);
- fprintf(assets_data_cc_file, "alignas(16) static const uint8_t %s[] = {\n ",
+ fprintf(assets_data_cc_file,
+ "alignas(16) static const uint8_t %s[] = {\n ",
info.data_array_name.c_str());
for (size_t i = 0; i < buffer.size(); ++i) {
if (i > 0 && i % 12 == 0)
@@ -251,7 +253,8 @@ int main(int argc, char* argv[]) {
info.func_name_str_name.c_str(), info.params_array_name.c_str(),
info.proc_params.size());
} else {
- fprintf(assets_data_cc_file, "%s, ASSET_SIZE_%s, false, nullptr, nullptr, 0",
+ fprintf(assets_data_cc_file,
+ "%s, ASSET_SIZE_%s, false, nullptr, nullptr, 0",
info.data_array_name.c_str(), info.name.c_str());
}
fprintf(assets_data_cc_file, " },\n");
diff --git a/tools/spectool.cc b/tools/spectool.cc
index a069bfe..1dd4ceb 100644
--- a/tools/spectool.cc
+++ b/tools/spectool.cc
@@ -156,8 +156,7 @@ int play_spec(const char* in_path) {
fread(spec_data.data(), sizeof(float), spec_data.size(), f_in);
fclose(f_in);
- PlatformState platform_state = {};
- platform_init(&platform_state, false, nullptr, nullptr);
+ PlatformState platform_state = platform_init(false, 100, 100);
audio_init();
audio_start();
Spectrogram spec;
diff --git a/tools/tracker_compiler.cc b/tools/tracker_compiler.cc
index 5cecbb8..5669cf9 100644
--- a/tools/tracker_compiler.cc
+++ b/tools/tracker_compiler.cc
@@ -9,8 +9,8 @@
// Enum to differentiate between sample types
enum SampleType {
- GENERATED,
- ASSET
+ GENERATED,
+ ASSET
};
// Convert note name (e.g., "C4", "A#3", "Eb2") to frequency in Hz
@@ -82,7 +82,7 @@ static bool is_note_name(const std::string& name) {
struct Sample {
std::string name;
SampleType type = GENERATED; // Default to GENERATED
- std::string asset_id_name; // Store AssetId name for asset samples
+ std::string asset_id_name; // Store AssetId name for asset samples
// Parameters for generated samples
float freq, dur, amp, attack, harmonic_decay;
@@ -148,13 +148,16 @@ int main(int argc, char** argv) {
if (name.rfind("ASSET_", 0) == 0) {
s.type = ASSET;
s.asset_id_name = name;
- // Parameters for asset samples are ignored, so we don't parse them here.
- // However, we must consume the rest of the line to avoid issues if a comma is present.
+ // Parameters for asset samples are ignored, so we don't parse them
+ // here. However, we must consume the rest of the line to avoid issues
+ // if a comma is present.
std::string dummy;
- while (ss >> dummy) {} // Consume rest of line
+ while (ss >> dummy) {
+ } // Consume rest of line
} else {
s.type = GENERATED;
- // Very simple parsing: freq, dur, amp, attack, harmonics, harmonic_decay
+ // Very simple parsing: freq, dur, amp, attack, harmonics,
+ // harmonic_decay
char comma;
ss >> s.freq >> comma >> s.dur >> comma >> s.amp >> comma >> s.attack >>
comma >> s.harmonics >> comma >> s.harmonic_decay;
@@ -193,10 +196,10 @@ int main(int argc, char** argv) {
s.name = sname;
s.type = GENERATED;
s.freq = note_name_to_freq(sname);
- s.dur = 0.5f; // Default note duration
- s.amp = 1.0f; // Default amplitude
- s.attack = 0.01f; // Default attack
- s.harmonics = 3; // Default harmonics
+ s.dur = 0.5f; // Default note duration
+ s.amp = 1.0f; // Default amplitude
+ s.attack = 0.01f; // Default attack
+ s.harmonics = 3; // Default harmonics
s.harmonic_decay = 0.6f; // Default decay
sample_map[s.name] = samples.size();
samples.push_back(s);
@@ -261,8 +264,9 @@ int main(int argc, char** argv) {
for (const auto& e : p.events) {
// When referencing a sample, we need to get its index or synth_id.
// If it's an asset, the name starts with ASSET_.
- // For now, assume sample_map is used for both generated and asset samples.
- // This will need refinement if asset samples are not in sample_map directly.
+ // For now, assume sample_map is used for both generated and asset
+ // samples. This will need refinement if asset samples are not in
+ // sample_map directly.
fprintf(out_file, " { %.1ff, %d, %.1ff, %.1ff },\n", e.beat,
sample_map[e.sample_name], e.volume, e.pan);
}