Skip to content

Commit

Permalink
Update the download link for ct.zig
Browse files Browse the repository at this point in the history
Also add a bit of documentation on how instruments
can be modified.
  • Loading branch information
jturcotte authored Oct 13, 2024
1 parent d350093 commit 793848f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions instruments/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// After modifying the instruments Zig source code, you must re-compile the WebAssembly file that can be executed by Chiptrack.
// This file instructs the Zig compiler how to compile it and for this you need
// - The Zig 0.13 compiler, available at https://ziglang.org/download/
// - ct.zig, the Chiptrack instruments support module, available at https://raw.githubusercontent.com/jturcotte/chiptrack/v0.3/instruments/ct.zig
// - ct.zig, the Chiptrack instruments support module, available at https://raw.githubusercontent.com/jturcotte/chiptrack/v0.4/instruments/ct.zig
// - wasm2wat in your PATH, available at https://github.com/WebAssembly/wabt/releases
//
// Then to rebuild the instruments .wat file from modified source code:
Expand All @@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void {
b.option(bool, "wat", "Compile the instruments to WAT (Web Assembly Text Format) instead of binary WASM. Chiptrack can load either format but this is better for GitHub gist uploads and requires wasm2wat in PATH (default: true).") orelse true;

if (std.fs.cwd().access(ct_zig_path, .{}) == std.fs.Dir.AccessError.FileNotFound)
@panic("ct.zig was not found but is necessary to build. You can download it from https://raw.githubusercontent.com/jturcotte/chiptrack/v0.3/instruments/ct.zig .");
@panic("ct.zig was not found but is necessary to build. You can download it from https://raw.githubusercontent.com/jturcotte/chiptrack/v0.4/instruments/ct.zig .");

// Listing the module here also allows editors like VSCode with Zig language support to discover it and provide code completion.
const ct_module = b.addModule("ct", .{ .root_source_file = .{ .cwd_relative = ct_zig_path } });
Expand Down
10 changes: 10 additions & 0 deletions instruments/default-instruments.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// Copyright © 2024 Jocelyn Turcotte <turcotte.j@gmail.com>
// SPDX-License-Identifier: CC0-1.0
//
// This is the source file used to compile default-instruments.wat, which is loaded by new songs in Chiptrack.
//
// This file and the corresponding WAT file is then copied with a new song the first time it is saved.
// To change the instruments used by a song, you must edit its instruments.zig file and recompile it to its .wat form.
// See build.zig on instruction on how to make any modifications you make to that file available to The
// synthesizer module.
//
// The main() function at the end is responsible for registering instruments available in this file.
// See registerInstrument() in ct.zig for information on what can be added to an instrument struct.

const std = @import("std");
const math = std.math;
Expand Down

0 comments on commit 793848f

Please sign in to comment.