use nih_plug::prelude::*; use std::sync::Arc; use ui::Emulator; mod ui; const WIDTH: u32 = 320; const HEIGHT: u32 = 240; #[derive(Params, Default)] struct EmuParams {} #[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"; 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(), }]; type SysExMessage = (); type BackgroundTask = (); fn params(&self) -> Arc { Arc::new(EmuParams::default()) } fn process( &mut self, _buffer: &mut Buffer, _: &mut AuxiliaryBuffers, _: &mut impl ProcessContext, ) -> ProcessStatus { ProcessStatus::Normal } fn editor(&self, _: AsyncExecutor) -> Option> { Some(Box::new(Emulator::new())) } fn initialize( &mut self, _audio_io_layout: &AudioIOLayout, _buffer_config: &BufferConfig, _context: &mut impl InitContext, ) -> bool { true } } impl Vst3Plugin for GameboyEmu { const VST3_CLASS_ID: [u8; 16] = *b"alexjankagbemula"; const VST3_SUBCATEGORIES: &'static [Vst3SubCategory] = &[Vst3SubCategory::Distortion, Vst3SubCategory::Dynamics]; } nih_export_vst3!(GameboyEmu);