Skip to content

Commit 07fb2ba

Browse files
author
erroreyes
committed
First commit
1 parent 89f081a commit 07fb2ba

File tree

8 files changed

+438
-0
lines changed

8 files changed

+438
-0
lines changed

.cargo/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[alias]
2+
xtask = "run --package xtask --release --"

Cargo.toml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[package]
2+
name = "crrshrr"
3+
version = "0.1.0"
4+
edition = "2021"
5+
authors = ["LASHLIGHT <[email protected]>"]
6+
license = "GPL-3.0-or-later"
7+
homepage = ""
8+
description = "A simple bit crusher."
9+
10+
[workspace]
11+
members = ["xtask"]
12+
13+
[lib]
14+
crate-type = ["cdylib"]
15+
16+
[dependencies]
17+
# Remove the `assert_process_allocs` feature to allow allocations on the audio
18+
# thread in debug builds.
19+
nih_plug = { git = "https://github.com/robbert-vdh/nih-plug.git", features = ["assert_process_allocs"] }
20+
# Uncomment the below line to disable the on-by-default VST3 feature to remove
21+
# the GPL compatibility requirement
22+
# nih_plug = { git = "https://github.com/robbert-vdh/nih-plug.git", default_features = false, features = ["assert_process_allocs"] }
23+
rand = "0.8.5"
24+
# nih_plug_vizia = { path = "../nih-plug/nih_plug_vizia" }
25+
nih_plug_vizia = { git = "https://github.com/robbert-vdh/nih-plug.git" }
26+
27+
# [profile.release]
28+
# lto = "thin"
29+
# strip = "symbols"
30+
31+
# [profile.profiling]
32+
# inherits = "release"
33+
# debug = true
34+
# strip = "none"

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# crrshrr
2+
3+
## Building
4+
5+
After installing [Rust](https://rustup.rs/), you can compile crrshrr as follows:
6+
7+
```shell
8+
cargo xtask bundle crrshrr --release
9+
```

bundler.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This provides metadata for NIH-plug's `cargo xtask bundle <foo>` plugin
2+
# bundler. This file's syntax is as follows:
3+
#
4+
# [package_name]
5+
# name = "Human Readable Plugin Name" # defaults to <package_name>
6+
7+
[crrshrr]
8+
name = "crrshrr"

src/editor.rs

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// use nih_plug::prelude::{util, Editor};
2+
use nih_plug::prelude::Editor;
3+
use nih_plug_vizia::vizia::prelude::*;
4+
use nih_plug_vizia::widgets::*;
5+
use nih_plug_vizia::*;
6+
use std::sync::Arc;
7+
8+
use crate::CrrshrrParams;
9+
10+
#[derive(Lens)]
11+
struct Data {
12+
params: Arc<CrrshrrParams>,
13+
}
14+
15+
impl Model for Data {}
16+
17+
pub(crate) fn default_state() -> Arc<ViziaState> {
18+
ViziaState::new(|| (200, 300))
19+
}
20+
21+
pub(crate) fn create(
22+
params: Arc<CrrshrrParams>,
23+
editor_state: Arc<ViziaState>,
24+
) -> Option<Box<dyn Editor>> {
25+
create_vizia_editor(editor_state, ViziaTheming::Custom, move |cx, _| {
26+
assets::register_noto_sans_light(cx);
27+
assets::register_noto_sans_thin(cx);
28+
29+
Data {
30+
params: params.clone(),
31+
}
32+
.build(cx);
33+
34+
ResizeHandle::new(cx);
35+
36+
VStack::new(cx, |cx| {
37+
Label::new(cx, "CRRSHRR")
38+
.font_family(vec![ FamilyOwned::Name(String::from(
39+
assets::NOTO_SANS_THIN,
40+
))])
41+
.font_size(30.0)
42+
.height(Pixels(50.0))
43+
.child_top(Stretch(1.0))
44+
.child_bottom(Pixels(0.0))
45+
.color(Color::white());
46+
47+
Label::new(cx, "BITS").color(Color::white());
48+
ParamSlider::new(cx, Data::params, |params| &params.bits)
49+
.background_color(Color::white());
50+
51+
Label::new(cx, "RATE").color(Color::white());
52+
ParamSlider::new(cx, Data::params, |params| &params.rate)
53+
.background_color(Color::white());
54+
55+
Label::new(cx, "RAND").color(Color::white());
56+
ParamSlider::new(cx, Data::params, |params| &params.rand)
57+
.background_color(Color::white());
58+
59+
Label::new(cx, "RAND RATE").color(Color::white());
60+
ParamSlider::new(cx, Data::params, |params| &params.rand_rate)
61+
.background_color(Color::white());
62+
63+
Label::new(cx, "NOISE").color(Color::white());
64+
ParamSlider::new(cx, Data::params, |params| &params.noise)
65+
.background_color(Color::white());
66+
})
67+
.row_between(Pixels(0.0))
68+
.child_left(Stretch(1.0))
69+
.child_right(Stretch(1.0))
70+
.background_color(Color::rgb(0x00, 0x00, 0x00));
71+
})
72+
}

0 commit comments

Comments
 (0)