Skip to content

Commit

Permalink
Prepare for v1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
hikari-no-yume committed Dec 1, 2023
1 parent 8120947 commit 23daa0e
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/release-out
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
[package]
name = "SoundPalette"
version = "0.1.0"
version = "1.0.0"
edition = "2021"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the source code for SoundPalette, a tool for editing MIDI System Exclusi

※ SoundPalette is not a product of, affiliated with or endorsed by Roland Corporation.

Currently supports:
Currently supports (as of v1.0.0):

* All Roland SC-7 exclusive messages.
* Most Roland GS messages supported by Roland SC-55 and Roland SC-55mkII. (Notable absences: drum map editing and voice/partial reserves.)
Expand All @@ -17,7 +17,7 @@ Future plans:

Here are some things SoundPalette can do:

**Use it directly in your browser**. No download or install necessary.
**Use it directly in your browser**. No download or install necessary. Try it out at <https://hikari.noyu.me/etc/SoundPalette/>! You can also download a release if you want, but it's a bit tricky to use as you may have to run a local web server.

![Screenshot of the “SysEx sketchpad” area of SoundPalette](screenshot-sketchpad.png)

Expand Down
15 changes: 12 additions & 3 deletions htdocs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
</style>

<h1><span>Sound</span><span>Palette</span> <span>MIDI SysEx Generator</span></h1>

<p>SoundPalette vX.Y.Z by <a href="https://hikari.noyu.me/">hikari_no_yume</a>. This is open source software, and you can download and redistribute it as you please. Please see <a href="https://github.com/hikari-no-yume/SoundPalette">the GitHub repository</a> for more information about the project.</p>

<p id=disclaimer>※ SoundPalette is not a product of, affiliated with or endorsed by Roland Corporation.</p>

<noscript>SoundPalette is a SysEx editing tool. This is a web app that relies on WebAssembly and JavaScript. You appear to have these disabled, so you won't be able to use it.</noscript>
Expand Down Expand Up @@ -370,11 +373,15 @@ <h1><span>Sound</span><span>Palette</span> <span>MIDI SysEx Generator</span></h1
(new Uint8Array(destBuf, destPtr, size)).set(new Uint8Array(srcBuf, srcPtr, size))
}

function decodeUtf8At(bytesPtr, bytesLen) {
return (new TextDecoder).decode(new Uint8Array(mem.buffer, bytesPtr, bytesLen));
}

function decodeAndClearString(stringPtr) {
let bytesPtr = lib.SoundPalette_string_ptr(stringPtr);
let bytesLen = lib.SoundPalette_string_len(stringPtr);

let decoded = (new TextDecoder).decode(new Uint8Array(mem.buffer, bytesPtr, bytesLen));
let decoded = decodeUtf8At(bytesPtr, bytesLen);

lib.SoundPalette_string_clear(stringPtr);

Expand Down Expand Up @@ -435,11 +442,13 @@ <h1><span>Sound</span><span>Palette</span> <span>MIDI SysEx Generator</span></h1
lib = instance.exports;
mem = instance.exports.memory;

let version = decodeUtf8At(lib.SoundPalette_version_ptr(), lib.SoundPalette_version_len());

let fileInput = document.getElementById('file');
fileInput.disabled = false;
fileInput.value = ''; // clear any cached value
let logTextarea = document.getElementById('log');
logTextarea.textContent = 'SoundPalette system ready. Please load a file.';
logTextarea.textContent = 'SoundPalette v' + version + ' system ready. Please load a file.';

let tableZone = document.getElementById('table-zone');

Expand Down Expand Up @@ -473,7 +482,7 @@ <h1><span>Sound</span><span>Palette</span> <span>MIDI SysEx Generator</span></h1
let sketchpadInputTextarea = document.getElementById('sketchpad-input');
sketchpadInputTextarea.disabled = false;
let sketchpadLogTextarea = document.getElementById('sketchpad-log');
sketchpadLogTextarea.textContent = 'SoundPalette system ready. Please enter a SysEx.';
sketchpadLogTextarea.textContent = 'SoundPalette v' + version + ' system ready. Please enter a SysEx.';

let sketchpadCheckButton = document.getElementById('sketchpad-check');
sketchpadCheckButton.disabled = false;
Expand Down
14 changes: 14 additions & 0 deletions make-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -ex
rm -rf release-out
mkdir release-out
cargo clean

VERSION=$(cargo run --release --quiet -- --version)

cargo build --target wasm32-unknown-unknown --lib --release
# Include version number in filename because WebAssembly caching in Firefox
# doesn't seem to respect 304 Not Modified :(
cp target/wasm32-unknown-unknown/release/libSoundPalette.wasm release-out/libSoundPalette-v${VERSION}.wasm
cat htdocs/index.html | sed -e 's/vX\.Y\.Z/v'"$VERSION"'/g' -e 's/libSoundPalette\.wasm/libSoundPalette-v'"$VERSION"'.wasm/g' > release-out/index.html
zip -j release-out/SoundPalette-v"$VERSION".zip release-out/*
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ pub mod midi;
pub mod sysex;
pub mod ui;
pub mod wasm_ffi;

pub const VERSION: &str = env!("CARGO_PKG_VERSION");
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Options:
--help
Print this help text.
--version
Get the version number.
-o <path>
Writes MIDI in SMF format 0 to <path>. The output MIDI file
should be more or less equivalent to the input MIDI file: the
Expand All @@ -56,6 +59,10 @@ fn main() -> Result<(), Box<dyn Error>> {
if arg == "-h" || arg == "--help" {
eprintln!("{}", USAGE);
return Ok(());
} else if arg == "--version" {
// This exists for make-release.sh's use and has to go to stdout.
println!("{}", libSoundPalette::VERSION);
return Ok(());
} else if arg == "-o" {
if out_path.is_some() {
return Err("Only one output path can be specified".into());
Expand Down
12 changes: 12 additions & 0 deletions src/wasm_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
//! Functions exported from the WebAssembly library and related FFI utilities
//! live here.
/// Get pointer to the UTF-8 bytes of the version number string.
#[export_name = "SoundPalette_version_ptr"]
pub extern "C" fn version_ptr() -> *const u8 {
crate::VERSION.as_ptr()
}

/// Get the number if UTF-8 bytes in the version number string.
#[export_name = "SoundPalette_version_len"]
pub extern "C" fn version_len() -> usize {
crate::VERSION.len()
}

/// Allocate `size` bytes of memory and return a pointer to it. The caller
/// is responsible for releasing it with [bytes_free]. The memory is not
/// initialized.
Expand Down

0 comments on commit 23daa0e

Please sign in to comment.