-
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.
- Loading branch information
Showing
7 changed files
with
66 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
use crate::plugin::HostInner; | ||
use crate::host::HostInner; | ||
use crate::params::{ParamId, ParamValue}; | ||
|
||
pub struct ClapHost {} | ||
|
||
impl HostInner for ClapHost {} | ||
impl HostInner for ClapHost { | ||
fn begin_gesture(&self, id: ParamId) {} | ||
fn end_gesture(&self, id: ParamId) {} | ||
fn set_param(&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
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,5 +1,10 @@ | ||
use crate::plugin::HostInner; | ||
use crate::host::HostInner; | ||
use crate::params::{ParamId, ParamValue}; | ||
|
||
pub struct Vst3Host {} | ||
|
||
impl HostInner for Vst3Host {} | ||
impl HostInner for Vst3Host { | ||
fn begin_gesture(&self, id: ParamId) {} | ||
fn end_gesture(&self, id: ParamId) {} | ||
fn set_param(&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,46 @@ | ||
use std::sync::Arc; | ||
|
||
use crate::params::{ParamId, ParamInfo, ParamValue}; | ||
|
||
pub trait HostInner { | ||
fn begin_gesture(&self, id: ParamId); | ||
fn end_gesture(&self, id: ParamId); | ||
fn set_param(&self, id: ParamId, value: ParamValue); | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct Host { | ||
inner: Arc<dyn HostInner + Send + Sync>, | ||
} | ||
|
||
impl Host { | ||
pub fn from_inner(inner: Arc<dyn HostInner + Send + Sync>) -> Host { | ||
Host { inner } | ||
} | ||
|
||
pub fn edit_param(&self, id: ParamId) -> Gesture { | ||
self.inner.begin_gesture(id); | ||
|
||
Gesture { | ||
inner: Arc::clone(&self.inner), | ||
id, | ||
} | ||
} | ||
} | ||
|
||
pub struct Gesture { | ||
inner: Arc<dyn HostInner + Send + Sync>, | ||
id: ParamId, | ||
} | ||
|
||
impl Gesture { | ||
pub fn set_value(&self, value: ParamValue) { | ||
self.inner.set_param(self.id, value); | ||
} | ||
} | ||
|
||
impl Drop for Gesture { | ||
fn drop(&mut self) { | ||
self.inner.end_gesture(self.id); | ||
} | ||
} |
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