pub struct NoteExpressionEvent { /* private fields */ }Expand description
A note expression event.
Note Expressions are well named modifications of a voice targeted to
voices using Pckns. Note Expressions are delivered
as sample accurate events and should be applied at the sample when received.
Note expressions are a statement of value, not cumulative. A Pan event of 0 followed by 1
followed by 0.5 would pan hard left, hard right, and center. They are intended as
an offset from the non-note-expression voice default. A voice which had a volume of
-20dB absent note expressions which received a +4dB note expression would move the
voice to -16dB.
A plugin which receives a note expression at the same sample as a NoteOnEvent
should apply that expression to all generated samples. A plugin which receives
a note expression after a NoteOnEvent event should initiate the voice with default
values and then apply the note expression when received. A plugin may make a choice
to smooth note expression streams.
Implementations§
Source§impl NoteExpressionEvent
impl NoteExpressionEvent
Sourcepub const fn new(
time: u32,
pckn: Pckn,
expression_type: NoteExpressionType,
value: f64,
) -> NoteExpressionEvent
pub const fn new( time: u32, pckn: Pckn, expression_type: NoteExpressionType, value: f64, ) -> NoteExpressionEvent
Creates a new NoteExpressionEvent from a time stamp, a Pckn target, an NoteExpressionType and
a raw value.
Sourcepub const fn expression_type(&self) -> Option<NoteExpressionType>
pub const fn expression_type(&self) -> Option<NoteExpressionType>
Returns the NoteExpressionType of this event.
This returns None if the expression type is not supported.
Sourcepub const fn set_expression_type(&mut self, expression_type: NoteExpressionType)
pub const fn set_expression_type(&mut self, expression_type: NoteExpressionType)
Sets the NoteExpressionType of this event.
Sourcepub const fn with_expression_type(
self,
expression_type: NoteExpressionType,
) -> NoteExpressionEvent
pub const fn with_expression_type( self, expression_type: NoteExpressionType, ) -> NoteExpressionEvent
Builds a NoteExpressionEvent with the given NoteExpressionType, and returns it.
This is useful to use in a builder-style pattern.
Sourcepub const fn with_value(self, value: f64) -> NoteExpressionEvent
pub const fn with_value(self, value: f64) -> NoteExpressionEvent
Builds a NoteExpressionEvent with the given raw expression value, and returns it.
This is useful to use in a builder-style pattern.
Sourcepub const fn as_raw(&self) -> &clap_event_note_expression
pub const fn as_raw(&self) -> &clap_event_note_expression
Returns a shared reference to the underlying raw, C-FFI compatible event struct.
Sourcepub const unsafe fn as_raw_mut(&mut self) -> &mut clap_event_note_expression
pub const unsafe fn as_raw_mut(&mut self) -> &mut clap_event_note_expression
Returns an exclusive, mutable reference to the raw, C-FFI compatible event struct.
§Safety
This method allows mutating the event header’s fields, most notably type_, size and
space_id.
Modifying those fields may trigger Undefined Behavior, as it can make other readers of this event treat it as a type or size that it is actually not.
Sourcepub const fn from_raw(raw: &clap_event_note_expression) -> NoteExpressionEvent
pub const fn from_raw(raw: &clap_event_note_expression) -> NoteExpressionEvent
Creates a new event of this type from a reference to a raw, C-FFI compatible event struct.
§Panics
This method will panic if the given event struct’s header doesn’t actually match the expected event type.
Sourcepub const fn from_raw_ref(
raw: &clap_event_note_expression,
) -> &NoteExpressionEvent
pub const fn from_raw_ref( raw: &clap_event_note_expression, ) -> &NoteExpressionEvent
Creates a reference to an event of this type from a reference to a raw, C-FFI compatible event struct.
§Panics
This method will panic if the given event struct’s header doesn’t actually match the expected event type.
Sourcepub const fn from_raw_mut(
raw: &mut clap_event_note_expression,
) -> &mut NoteExpressionEvent
pub const fn from_raw_mut( raw: &mut clap_event_note_expression, ) -> &mut NoteExpressionEvent
Creates a mutable reference to a note event of this type from a reference to a raw, C-FFI compatible event struct.
§Panics
This method will panic if the given event struct’s header doesn’t actually match the expected note event type.
Sourcepub const fn pckn(&self) -> Pckn
pub const fn pckn(&self) -> Pckn
The Pckn tuple indicating which note(s) this note event targets.
Sourcepub const fn with_pckn(self, pckn: Pckn) -> NoteExpressionEvent
pub const fn with_pckn(self, pckn: Pckn) -> NoteExpressionEvent
Sets the Pckn tuple for this event.
This method takes and returns ownership of the event, allowing it to be used in a builder-style pattern.
Sourcepub const fn port_index(&self) -> Match<u16>
pub const fn port_index(&self) -> Match<u16>
The index of the note port this event targets.
This returns Match::All if this event targets all possible note ports.
Sourcepub const fn set_port_index(&mut self, port_index: Match<u16>)
pub const fn set_port_index(&mut self, port_index: Match<u16>)
Sets the index of the note port this event targets.
Use Match::All to target all possible note ports.
Sourcepub const fn with_port_index(
self,
port_index: Match<u16>,
) -> NoteExpressionEvent
pub const fn with_port_index( self, port_index: Match<u16>, ) -> NoteExpressionEvent
Sets the index of the note port this event targets.
Use Match::All to target all possible note ports.
This method takes and returns ownership of the event, allowing it to be used in a builder-style pattern.
Sourcepub const fn channel(&self) -> Match<u16>
pub const fn channel(&self) -> Match<u16>
The note channel this event targets (0-15).
This returns Match::All if this event targets all possible note channels.
Sourcepub const fn set_channel(&mut self, channel: Match<u16>)
pub const fn set_channel(&mut self, channel: Match<u16>)
Sets the note channel this event targets (0-15).
Use Match::All to target all possible channels.
Sourcepub const fn with_channel(self, channel: Match<u16>) -> NoteExpressionEvent
pub const fn with_channel(self, channel: Match<u16>) -> NoteExpressionEvent
Sets the note channel this event targets (0-15).
Use Match::All to target all possible channels.
This method takes and returns ownership of the event, allowing it to be used in a builder-style pattern.
Sourcepub const fn key(&self) -> Match<u16>
pub const fn key(&self) -> Match<u16>
The key of the note(s) this event targets (0-127).
This returns Match::All if this event targets all possible note keys.
Sourcepub const fn set_key(&mut self, key: Match<u16>)
pub const fn set_key(&mut self, key: Match<u16>)
Sets the key of the note(s) this event targets (0-127).
Use Match::All to target all possible note keys.
Sourcepub const fn with_key(self, key: Match<u16>) -> NoteExpressionEvent
pub const fn with_key(self, key: Match<u16>) -> NoteExpressionEvent
Sets the key of the note(s) this event targets (0-127).
Use Match::All to target all possible note keys.
This method takes and returns ownership of the event, allowing it to be used in a builder-style pattern.
Sourcepub const fn note_id(&self) -> Match<u32>
pub const fn note_id(&self) -> Match<u32>
The specific ID of the Note this event targets.
This returns Match::All if this event doesn’t target a specific note, or doesn’t
provide a Note ID.
Sourcepub const fn set_note_id(&mut self, note_id: Match<u32>)
pub const fn set_note_id(&mut self, note_id: Match<u32>)
Sets the specific ID of the Note this event targets.
Use Match::All to not target a single specific note in particular.
Sourcepub const fn with_note_id(self, note_id: Match<u32>) -> NoteExpressionEvent
pub const fn with_note_id(self, note_id: Match<u32>) -> NoteExpressionEvent
Sets the specific ID of the Note this event targets.
Use Match::All to not target a single specific note in particular.
This method takes and returns ownership of the event, allowing it to be used in a builder-style pattern.
Trait Implementations§
Source§impl AsRef<UnknownEvent> for NoteExpressionEvent
impl AsRef<UnknownEvent> for NoteExpressionEvent
Source§fn as_ref(&self) -> &UnknownEvent
fn as_ref(&self) -> &UnknownEvent
Source§impl Clone for NoteExpressionEvent
impl Clone for NoteExpressionEvent
Source§fn clone(&self) -> NoteExpressionEvent
fn clone(&self) -> NoteExpressionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NoteExpressionEvent
Source§impl Debug for NoteExpressionEvent
impl Debug for NoteExpressionEvent
Source§impl Event for NoteExpressionEvent
impl Event for NoteExpressionEvent
Source§const TYPE_ID: u16 = CLAP_EVENT_NOTE_EXPRESSION
const TYPE_ID: u16 = CLAP_EVENT_NOTE_EXPRESSION
Source§type EventSpace<'a> = CoreEventSpace<'a>
type EventSpace<'a> = CoreEventSpace<'a>
Source§fn flags(&self) -> EventFlags
fn flags(&self) -> EventFlags
EventFlags of this event.Source§fn set_flags(&mut self, flags: EventFlags)
fn set_flags(&mut self, flags: EventFlags)
EventFlags of this event.Source§fn with_flags(self, flags: EventFlags) -> Self
fn with_flags(self, flags: EventFlags) -> Self
EventFlags, and returns it. Read moreSource§fn with_time(self, time: u32) -> Self
fn with_time(self, time: u32) -> Self
Source§fn header(&self) -> &EventHeader<Self>
fn header(&self) -> &EventHeader<Self>
Source§fn header_mut(&mut self) -> &mut EventHeader<Self>
fn header_mut(&mut self) -> &mut EventHeader<Self>
Source§fn as_unknown(&self) -> &UnknownEvent
fn as_unknown(&self) -> &UnknownEvent
UnknownEvent.