class MIDIFX::Filter
Use the Filter
superclass when you need a multi-band filter
Attributes
bandwidth[R]
name[R]
property[R]
reject[R]
Public Class Methods
new(property, bandwidth, options = {})
click to toggle source
# File lib/midi-fx/filter.rb, line 8 def initialize(property, bandwidth, options = {}) @bandwidth = [bandwidth].flatten @property = property @reject = options[:reject] || false @name = options[:name] end
Public Instance Methods
process(message)
click to toggle source
# File lib/midi-fx/filter.rb, line 15 def process(message) val = message.send(@property) result = @bandwidth.map do |bw| case bw when Range then val >= bw.min && val <= bw.max ? message : nil when Numeric then val == bw ? message : nil end end result.include?(message) ^ @reject ? message : nil end