Add support for 4-pin range sensors, the velocity sensor, and LED status.

FossilOrigin-Name: ab34614152b3a25488aa4b55c45ec4a6f625bde42cd794209464825bb7654040
This commit is contained in:
Mahlon E. Smith 2023-05-12 05:46:35 +00:00
parent 07b2d81523
commit 5a4fcbae87
4 changed files with 124 additions and 43 deletions

View file

@ -48,11 +48,13 @@ class FluidSynth
end
### Instance a new fluidsynth interface.
###
def initialize( host=DEFAULT_HOST, port=DEFAULT_PORT )
@host = host
@port = port
@lastnote = nil
@velocity = 80
@velocity = 0
end
# The TCP socket to fluidsynth.
@ -96,6 +98,14 @@ class FluidSynth
end
### Select a loaded soundfont and instrument by index.
### (Always using channel 0.)
###
def instrument( font_idx, instrument_idx )
self.send "select 0 #{font_idx} 0 #{instrument_idx}"
end
### Turn glide (portamento) on or off. Val is an integer that
### represents 128ms. 4 == 512ms.
###
@ -132,13 +142,6 @@ class FluidSynth
end
### Selects an instrument +index+ within the currently loaded sf2 for channel 0.
###
def instrument( index )
self.send "select 0 1 0 #{index}"
end
### Loads a resource (sf2, etc) from +path+.
###
def load( path )