Skip to content

Commit

Permalink
remove Gesture API
Browse files Browse the repository at this point in the history
Expose begin/end_gesture and set_param directly via the Host struct.  An
RAII Gesture API can be built on top of it in the future.
  • Loading branch information
micahrj committed Apr 29, 2024
1 parent 93b9aba commit 16c7621
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,15 @@ impl Host {
Host { inner }
}

pub fn edit_param(&self, id: ParamId) -> Gesture {
pub fn begin_gesture(&self, id: ParamId) {
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);
pub fn end_gesture(&self, id: ParamId) {
self.inner.end_gesture(id);
}
}

impl Drop for Gesture {
fn drop(&mut self) {
self.inner.end_gesture(self.id);
pub fn set_param(&self, id: ParamId, value: ParamValue) {
self.inner.set_param(id, value);
}
}

0 comments on commit 16c7621

Please sign in to comment.