1#![allow(dead_code)]
2#![allow(clippy::module_inception)]
3
4pub mod engine;
5pub mod language;
6pub mod shared;
7pub mod utils;
8
9#[cfg(feature = "plugin")]
11pub mod plugin {
12 pub use crate::engine::plugin::bindings::*;
18
19 pub use crate::{export_plugin, export_plugin_with_state, simple_oscillator_plugin};
21}
22
23#[cfg(all(feature = "cli", not(target_arch = "wasm32")))]
25pub mod platform;
26
27#[cfg(all(feature = "cli", not(target_arch = "wasm32")))]
28pub mod services;
29
30#[cfg(all(feature = "cli", not(target_arch = "wasm32")))]
31pub mod tools;
32
33#[cfg(all(feature = "cli", not(target_arch = "wasm32")))]
34pub mod workspace;
35
36#[cfg(all(target_arch = "wasm32", feature = "wasm"))]
38pub mod web;
39
40#[cfg(all(target_arch = "wasm32", not(feature = "wasm")))]
42pub mod web {
43 pub mod registry {
47 pub mod samples {
48 pub fn get_sample(_name: &str) -> Option<Vec<f32>> {
49 None
50 }
51 }
52 pub mod debug {
53 pub fn log(_msg: &str) {}
54 pub fn is_debug_errors_enabled() -> bool {
55 false
56 }
57 pub fn push_parse_error_from_parts(
58 _source: String,
59 _line: usize,
60 _column: usize,
61 _length: usize,
62 _message: String,
63 _severity: String,
64 ) {}
65 }
66 pub mod banks {
67 use std::collections::HashMap;
68 pub static REGISTERED_BANKS: once_cell::sync::Lazy<std::sync::Mutex<HashMap<String, String>>> =
69 once_cell::sync::Lazy::new(|| std::sync::Mutex::new(HashMap::new()));
70 }
71 pub mod playhead {
72 #[derive(Default)]
73 pub struct PlayheadEvent {
74 pub kind: String,
75 pub event_type: String,
76 pub midi: Vec<u8>,
77 pub time: f32,
78 pub velocity: f32,
79 pub synth_id: String,
80 pub pitch: u8,
81 pub sample: Option<String>,
82 }
83 pub fn push_event(_event: PlayheadEvent) {}
84 }
85 }
86}
87
88#[cfg(all(target_arch = "wasm32", not(feature = "wasm")))]
90pub mod web_sys {
91 pub mod console {
93 pub fn log_1(_msg: &str) {}
94 pub fn warn_1(_msg: &str) {}
95 }
96}
97
98#[cfg(all(target_arch = "wasm32", not(any(feature = "wasm", feature = "cli"))))]
100pub mod midly {
101 pub struct Header;
103 pub enum Format { SingleTrack }
104 pub enum Timing { Metrical(u16) }
105
106 #[derive(Debug, Clone)]
107 pub struct TrackEvent {
108 pub delta: u28,
109 pub kind: TrackEventKind,
110 }
111
112 #[derive(Debug, Clone)]
113 pub struct u28(pub u32);
114 impl From<u32> for u28 {
115 fn from(v: u32) -> Self { u28(v) }
116 }
117
118 #[derive(Debug, Clone)]
119 pub struct u24(pub u32);
120 impl From<u32> for u24 {
121 fn from(v: u32) -> Self { u24(v) }
122 }
123
124 #[derive(Debug, Clone)]
125 pub struct u7(pub u8);
126 impl From<u8> for u7 {
127 fn from(v: u8) -> Self { u7(v) }
128 }
129
130 #[derive(Debug, Clone)]
131 pub struct u4(pub u8);
132 impl From<u8> for u4 {
133 fn from(v: u8) -> Self { u4(v) }
134 }
135
136 #[derive(Debug, Clone)]
137 pub enum MetaMessage {
138 Tempo(u24),
139 EndOfTrack
140 }
141
142 #[derive(Debug, Clone)]
143 pub enum TrackEventKind {
144 Meta(MetaMessage),
145 Midi { channel: u4, message: MidiMessage }
146 }
147
148 #[derive(Debug, Clone)]
149 pub enum MidiMessage {
150 NoteOn { key: u7, vel: u7 },
151 NoteOff { key: u7, vel: u7 }
152 }
153
154 pub struct Track(Vec<TrackEvent>);
155 impl From<Vec<TrackEvent>> for Track {
156 fn from(events: Vec<TrackEvent>) -> Self { Track(events) }
157 }
158
159 pub struct Smf {
160 pub tracks: Vec<Track>,
161 }
162
163 impl Header {
164 pub fn new(_format: Format, _timing: Timing) -> Self { Header }
165 }
166
167 impl Smf {
168 pub fn new(_header: Header) -> Self {
169 Smf { tracks: Vec::new() }
170 }
171 pub fn write<W: std::io::Write>(&self, _writer: &mut W) -> std::io::Result<()> {
172 Ok(())
173 }
174 }
175}