Macro rmididings::Process[][src]

macro_rules! Process {
    ( $f:expr ) => { ... };
}
Expand description

Process the incoming event using a custom function, returning a patch.

Any other processing will be stalled until function returns, so this should only be used with functions that don’t block.

Examples


let filter = Process!(|ev: &Event| -> Box<dyn FilterTrait> {
    match ev {
        Event::NoteOff(ev) => Box::new(NoteOn(ev.note + 1, 40)),
        _ => Box::new(Pass()),
    }
});

let mut evs = EventStream::from(NoteOffEvent(0,0,60));
filter.run(&mut evs);
assert_eq!(evs, NoteOnEvent(0,0,61,40));