2023-03-05 20:18:06 +11:00
|
|
|
use nih_plug::prelude::*;
|
2023-03-04 09:15:25 +11:00
|
|
|
use std::sync::Arc;
|
2023-03-05 20:18:06 +11:00
|
|
|
use ui::Emulator;
|
2023-03-04 09:15:25 +11:00
|
|
|
|
2023-03-05 20:18:06 +11:00
|
|
|
mod ui;
|
|
|
|
|
|
|
|
const WIDTH: u32 = 320;
|
|
|
|
const HEIGHT: u32 = 240;
|
|
|
|
|
|
|
|
#[derive(Params, Default)]
|
|
|
|
struct EmuParams {}
|
2023-03-04 09:15:25 +11:00
|
|
|
|
|
|
|
#[derive(Default)]
|
|
|
|
struct GameboyEmu {}
|
|
|
|
|
|
|
|
impl Plugin for GameboyEmu {
|
|
|
|
const NAME: &'static str = "Gameboy";
|
|
|
|
|
|
|
|
const VENDOR: &'static str = "Alex Janka";
|
|
|
|
|
|
|
|
const URL: &'static str = "alexjanka.com";
|
|
|
|
|
|
|
|
const EMAIL: &'static str = "alex@alexjanka.com";
|
|
|
|
|
|
|
|
const VERSION: &'static str = "0.1";
|
|
|
|
|
2023-03-05 20:18:06 +11:00
|
|
|
const AUDIO_IO_LAYOUTS: &'static [AudioIOLayout] = &[AudioIOLayout {
|
|
|
|
main_input_channels: NonZeroU32::new(2),
|
|
|
|
main_output_channels: NonZeroU32::new(2),
|
|
|
|
|
|
|
|
aux_input_ports: &[],
|
|
|
|
aux_output_ports: &[],
|
|
|
|
|
|
|
|
// Individual ports and the layout as a whole can be named here. By default these names
|
|
|
|
// are generated as needed. This layout will be called 'Stereo', while the other one is
|
|
|
|
// given the name 'Mono' based no the number of input and output channels.
|
|
|
|
names: PortNames::const_default(),
|
|
|
|
}];
|
2023-03-04 09:15:25 +11:00
|
|
|
|
|
|
|
type SysExMessage = ();
|
|
|
|
|
|
|
|
type BackgroundTask = ();
|
|
|
|
|
|
|
|
fn params(&self) -> Arc<dyn Params> {
|
2023-03-05 20:18:06 +11:00
|
|
|
Arc::new(EmuParams::default())
|
2023-03-04 09:15:25 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
fn process(
|
|
|
|
&mut self,
|
2023-03-05 20:18:06 +11:00
|
|
|
_buffer: &mut Buffer,
|
|
|
|
_: &mut AuxiliaryBuffers,
|
|
|
|
_: &mut impl ProcessContext<Self>,
|
2023-03-04 09:15:25 +11:00
|
|
|
) -> ProcessStatus {
|
2023-03-05 20:18:06 +11:00
|
|
|
ProcessStatus::Normal
|
2023-03-04 09:15:25 +11:00
|
|
|
}
|
|
|
|
|
2023-03-05 20:18:06 +11:00
|
|
|
fn editor(&self, _: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
|
|
|
Some(Box::new(Emulator::new()))
|
|
|
|
}
|
2023-03-04 09:15:25 +11:00
|
|
|
|
2023-03-05 20:18:06 +11:00
|
|
|
fn initialize(
|
|
|
|
&mut self,
|
|
|
|
_audio_io_layout: &AudioIOLayout,
|
|
|
|
_buffer_config: &BufferConfig,
|
|
|
|
_context: &mut impl InitContext<Self>,
|
|
|
|
) -> bool {
|
|
|
|
true
|
|
|
|
}
|
2023-03-04 09:15:25 +11:00
|
|
|
}
|
|
|
|
|
2023-03-05 20:18:06 +11:00
|
|
|
impl Vst3Plugin for GameboyEmu {
|
|
|
|
const VST3_CLASS_ID: [u8; 16] = *b"alexjankagbemula";
|
2023-03-04 09:15:25 +11:00
|
|
|
|
2023-03-05 20:18:06 +11:00
|
|
|
const VST3_SUBCATEGORIES: &'static [Vst3SubCategory] =
|
|
|
|
&[Vst3SubCategory::Distortion, Vst3SubCategory::Dynamics];
|
2023-03-04 09:15:25 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
nih_export_vst3!(GameboyEmu);
|