-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move Plugin, Processor, and Editor into modules
- Loading branch information
Showing
13 changed files
with
87 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,11 @@ | ||
use std::io::{self, Read, Write}; | ||
|
||
pub mod block; | ||
pub mod buffers; | ||
pub mod bus; | ||
pub mod editor; | ||
pub mod events; | ||
pub mod format; | ||
pub mod params; | ||
pub mod parent; | ||
pub mod plugin; | ||
pub mod process; | ||
|
||
mod sync; | ||
mod util; | ||
|
||
use block::Block; | ||
use bus::{BusInfo, Layout}; | ||
use params::{ParamId, ParamInfo, ParamValue}; | ||
use parent::Parent; | ||
|
||
pub struct PluginInfo { | ||
pub name: String, | ||
pub version: String, | ||
pub vendor: String, | ||
pub url: String, | ||
pub email: String, | ||
pub buses: Vec<BusInfo>, | ||
pub layouts: Vec<Layout>, | ||
pub params: Vec<ParamInfo>, | ||
} | ||
|
||
pub struct Host {} | ||
|
||
pub trait Plugin: Send + Sized + 'static { | ||
type Processor: Processor; | ||
type Editor: Editor; | ||
|
||
fn info() -> PluginInfo; | ||
fn new(host: Host) -> Self; | ||
fn set_param(&mut self, id: ParamId, value: ParamValue); | ||
fn get_param(&self, id: ParamId) -> ParamValue; | ||
fn save(&self, output: &mut impl Write) -> io::Result<()>; | ||
fn load(&mut self, input: &mut impl Read) -> io::Result<()>; | ||
fn processor(&self, config: Config) -> Self::Processor; | ||
fn editor(&self, parent: Parent) -> Self::Editor; | ||
|
||
#[allow(unused_variables)] | ||
fn latency(&self, config: &Config) -> u64 { | ||
0 | ||
} | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct Config { | ||
pub layout: Layout, | ||
pub sample_rate: f64, | ||
pub max_buffer_size: usize, | ||
} | ||
|
||
pub trait Processor: Send + Sized + 'static { | ||
fn set_param(&mut self, id: ParamId, value: ParamValue); | ||
fn reset(&mut self); | ||
fn process(&mut self, block: Block); | ||
} | ||
|
||
pub struct Size { | ||
pub width: f64, | ||
pub height: f64, | ||
} | ||
|
||
pub trait Editor: Sized + 'static { | ||
fn exists() -> bool { | ||
true | ||
} | ||
|
||
fn size(&self) -> Size; | ||
fn set_param(&mut self, id: ParamId, value: ParamValue); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::io::{self, Read, Write}; | ||
|
||
use crate::bus::{BusInfo, Layout}; | ||
use crate::editor::{Editor, Parent}; | ||
use crate::params::{ParamId, ParamInfo, ParamValue}; | ||
use crate::process::{Config, Processor}; | ||
|
||
pub struct PluginInfo { | ||
pub name: String, | ||
pub version: String, | ||
pub vendor: String, | ||
pub url: String, | ||
pub email: String, | ||
pub buses: Vec<BusInfo>, | ||
pub layouts: Vec<Layout>, | ||
pub params: Vec<ParamInfo>, | ||
} | ||
|
||
pub struct Host {} | ||
|
||
pub trait Plugin: Send + Sized + 'static { | ||
type Processor: Processor; | ||
type Editor: Editor; | ||
|
||
fn info() -> PluginInfo; | ||
fn new(host: Host) -> Self; | ||
fn set_param(&mut self, id: ParamId, value: ParamValue); | ||
fn get_param(&self, id: ParamId) -> ParamValue; | ||
fn save(&self, output: &mut impl Write) -> io::Result<()>; | ||
fn load(&mut self, input: &mut impl Read) -> io::Result<()>; | ||
fn processor(&self, config: Config) -> Self::Processor; | ||
fn editor(&self, parent: Parent) -> Self::Editor; | ||
|
||
#[allow(unused_variables)] | ||
fn latency(&self, config: &Config) -> u64 { | ||
0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters