Macro command_writers_and_readers
macro_rules! command_writers_and_readers {
($($field_name:ident: $type:ty),*$(,)?) => { ... };
}
Available on crate feature
dep_kira
only.Expand description
Creates a set of command writers and readers and a constructor for them.
You’ll only need to use this if you’re making your own implementation of
Sound
, Effect
,
or Modulator
.
§Example
This macro call…
ⓘ
command_writers_and_readers! {
set_phase: f64,
set_frequency: ValueChangeCommand<f64>,
}
…will produce this code:
ⓘ
pub(crate) struct CommandWriters {
set_phase: kira::command::CommandWriter<f64>,
set_frequency: kira::command::CommandWriter<ValueChangeCommand<f64>>,
}
pub(crate) struct CommandReaders {
set_phase: kira::command::CommandReader<f64>,
set_frequency: kira::command::CommandReader<ValueChangeCommand<f64>>,
}
#[must_use]
pub(crate) fn command_writers_and_readers() -> (CommandWriters, CommandReaders) {
let (set_phase_writer, set_phase_reader) = kira::command::command_writer_and_reader();
let (set_frequency_writer, set_frequency_reader) = kira::command::command_writer_and_reader();
let command_writers = CommandWriters {
set_phase: set_phase_writer,
set_frequency: set_frequency_writer,
};
let command_readers = CommandReaders {
set_phase: set_phase_reader,
set_frequency: set_frequency_reader,
};
(command_writers, command_readers)
}