fiddle_fluidsynth 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +138 -0
- data/Rakefile +14 -0
- data/examples/enum.rb +30 -0
- data/examples/example.sf2 +0 -0
- data/examples/ffs_arpeggio.rb +252 -0
- data/examples/ffs_example.rb +47 -0
- data/examples/ffs_fx.rb +200 -0
- data/examples/ffs_metronome.rb +260 -0
- data/examples/ffs_midiplay.rb +122 -0
- data/examples/ffs_simple.rb +45 -0
- data/examples/ffs_test1.rb +41 -0
- data/examples/ffs_test3.rb +50 -0
- data/examples/fiddle-pointer.rb +18 -0
- data/examples/presets-each.rb +66 -0
- data/examples/presets-full_scan.rb +59 -0
- data/examples/settings-each.rb +106 -0
- data/exe/ffs_midiplay.rb +122 -0
- data/lib/fiddle_fluidsynth/audio_output/driver.rb +104 -0
- data/lib/fiddle_fluidsynth/audio_output/file_renderer.rb +84 -0
- data/lib/fiddle_fluidsynth/audio_output.rb +7 -0
- data/lib/fiddle_fluidsynth/command_interface/command_interface.rb +90 -0
- data/lib/fiddle_fluidsynth/command_interface/handler.rb +95 -0
- data/lib/fiddle_fluidsynth/command_interface/server.rb +79 -0
- data/lib/fiddle_fluidsynth/command_interface/shell.rb +76 -0
- data/lib/fiddle_fluidsynth/command_interface.rb +9 -0
- data/lib/fiddle_fluidsynth/core_ext/fiddle.rb +142 -0
- data/lib/fiddle_fluidsynth/core_ext/module.rb +123 -0
- data/lib/fiddle_fluidsynth/fiddle_fluidsynth.rb +172 -0
- data/lib/fiddle_fluidsynth/logging/logging.rb +82 -0
- data/lib/fiddle_fluidsynth/logging.rb +6 -0
- data/lib/fiddle_fluidsynth/midi_input/driver.rb +77 -0
- data/lib/fiddle_fluidsynth/midi_input/events.rb +255 -0
- data/lib/fiddle_fluidsynth/midi_input/midi_input.rb +70 -0
- data/lib/fiddle_fluidsynth/midi_input/player.rb +289 -0
- data/lib/fiddle_fluidsynth/midi_input/router.rb +225 -0
- data/lib/fiddle_fluidsynth/midi_input.rb +11 -0
- data/lib/fiddle_fluidsynth/misc/misc.rb +162 -0
- data/lib/fiddle_fluidsynth/misc.rb +6 -0
- data/lib/fiddle_fluidsynth/sequencer/events.rb +679 -0
- data/lib/fiddle_fluidsynth/sequencer/sequencer.rb +384 -0
- data/lib/fiddle_fluidsynth/sequencer.rb +7 -0
- data/lib/fiddle_fluidsynth/settings/settings.rb +465 -0
- data/lib/fiddle_fluidsynth/settings.rb +6 -0
- data/lib/fiddle_fluidsynth/soundfonts/generators.rb +128 -0
- data/lib/fiddle_fluidsynth/soundfonts/loader.rb +506 -0
- data/lib/fiddle_fluidsynth/soundfonts/modulators.rb +247 -0
- data/lib/fiddle_fluidsynth/soundfonts/soundfonts.rb +64 -0
- data/lib/fiddle_fluidsynth/soundfonts/voices.rb +178 -0
- data/lib/fiddle_fluidsynth/soundfonts.rb +11 -0
- data/lib/fiddle_fluidsynth/synth/audio_rendering.rb +100 -0
- data/lib/fiddle_fluidsynth/synth/effect/chorus.rb +269 -0
- data/lib/fiddle_fluidsynth/synth/effect/iir_filter.rb +81 -0
- data/lib/fiddle_fluidsynth/synth/effect/ladspa.rb +172 -0
- data/lib/fiddle_fluidsynth/synth/effect/reverb.rb +207 -0
- data/lib/fiddle_fluidsynth/synth/effect.rb +10 -0
- data/lib/fiddle_fluidsynth/synth/midi/messages.rb +292 -0
- data/lib/fiddle_fluidsynth/synth/midi/setup.rb +235 -0
- data/lib/fiddle_fluidsynth/synth/midi/tuning.rb +128 -0
- data/lib/fiddle_fluidsynth/synth/midi.rb +9 -0
- data/lib/fiddle_fluidsynth/synth/params/params.rb +200 -0
- data/lib/fiddle_fluidsynth/synth/params.rb +8 -0
- data/lib/fiddle_fluidsynth/synth/soundfont_management.rb +210 -0
- data/lib/fiddle_fluidsynth/synth/synth.rb +114 -0
- data/lib/fiddle_fluidsynth/synth/voice_control.rb +94 -0
- data/lib/fiddle_fluidsynth/synth.rb +18 -0
- data/lib/fiddle_fluidsynth/types/types.rb +131 -0
- data/lib/fiddle_fluidsynth/types.rb +10 -0
- data/lib/fiddle_fluidsynth/util/callback.rb +585 -0
- data/lib/fiddle_fluidsynth/util/interface/settings.rb +689 -0
- data/lib/fiddle_fluidsynth/util/interface/soundfont.rb +115 -0
- data/lib/fiddle_fluidsynth/util/interface/soundfont_preset.rb +69 -0
- data/lib/fiddle_fluidsynth/util/interface/soundfont_sample.rb +61 -0
- data/lib/fiddle_fluidsynth/util/interface.rb +11 -0
- data/lib/fiddle_fluidsynth/util/module_hier.rb +403 -0
- data/lib/fiddle_fluidsynth/util/util.rb +467 -0
- data/lib/fiddle_fluidsynth/util-after.rb +12 -0
- data/lib/fiddle_fluidsynth/util.rb +37 -0
- data/lib/fiddle_fluidsynth/version.rb +10 -0
- data/lib/fiddle_fluidsynth.rb +57 -0
- data/sig/fiddle_fluidsynth.rbs +4 -0
- metadata +128 -0
@@ -0,0 +1,467 @@
|
|
1
|
+
#
|
2
|
+
# filename: fiddle-fluidsynth/util/util.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
#
|
6
|
+
require 'fiddle/import'
|
7
|
+
require 'rbconfig'
|
8
|
+
|
9
|
+
|
10
|
+
#
|
11
|
+
#
|
12
|
+
#
|
13
|
+
class FiddleFluidSynth
|
14
|
+
#
|
15
|
+
SOUNDFONT_NAME_DEFAULT = "default.sf2"
|
16
|
+
|
17
|
+
#
|
18
|
+
module C
|
19
|
+
|
20
|
+
#
|
21
|
+
#
|
22
|
+
#
|
23
|
+
def self.current_platform
|
24
|
+
host_os = RbConfig::CONFIG['host_os']
|
25
|
+
case host_os
|
26
|
+
when /darwin/ then :macos
|
27
|
+
when /linux/ then :linux
|
28
|
+
when /mswin|mingw|cygwin/ then :windows
|
29
|
+
else raise "Unsupported OS: #{host_os}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.lib_path( name )
|
34
|
+
case current_platform
|
35
|
+
when :macos
|
36
|
+
brew_prefix = `brew --prefix`.strip
|
37
|
+
path = File.exist?("#{brew_prefix}/lib/lib#{name}.dylib") ? \
|
38
|
+
"#{brew_prefix}/lib" : "/usr/local/lib"
|
39
|
+
# File.join(path, "lib#{name}.dylib")
|
40
|
+
path
|
41
|
+
when :linux
|
42
|
+
path = `pkg-config --libs-only-L #{name} 2>/dev/null`.sub("-L", "").strip
|
43
|
+
raise "pkg-config couldn't find #{name}" if path.empty?
|
44
|
+
# File.join(path, "lib#{name}.so")
|
45
|
+
path
|
46
|
+
when :windows
|
47
|
+
# DLLは PATH に通ってるか、明示パスで指定
|
48
|
+
path = ENV["LIB_FLUIDSYNTH_PATH"] || "#{name}.dll"
|
49
|
+
raise "Set LIB_FLUIDSYNTH_PATH env var or place " +
|
50
|
+
"#{name}.dll in working dir" unless File.exist?(path)
|
51
|
+
path
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.full_path_for_lib( name )
|
56
|
+
lib_path = lib_path(name)
|
57
|
+
|
58
|
+
case current_platform
|
59
|
+
when :macos
|
60
|
+
File.join(lib_path, "lib#{name}.dylib")
|
61
|
+
when :linux
|
62
|
+
File.join(lib_path, "lib#{name}.so")
|
63
|
+
when :windows
|
64
|
+
# DLLは PATH に通ってるか、明示パスで指定
|
65
|
+
File.join(lib_path, "#{name}.dll")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
#
|
71
|
+
#
|
72
|
+
def self.soundfont_path
|
73
|
+
case current_platform
|
74
|
+
when :macos
|
75
|
+
brew_prefix = `brew --prefix`.strip
|
76
|
+
share_dir = File.exist?("#{brew_prefix}/share/fluid-synth/sf2") ? \
|
77
|
+
"#{brew_prefix}/share/fluid-synth/sf2" : \
|
78
|
+
"/usr/local/share/fluid-synth/sf2"
|
79
|
+
|
80
|
+
share_dir
|
81
|
+
when :linux
|
82
|
+
name = "fluidsynth"
|
83
|
+
path = `pkg-config --libs-only-L #{name} 2>/dev/null`.sub("-L", "").strip
|
84
|
+
raise "pkg-config couldn't find #{name}" if path.empty?
|
85
|
+
path = path + "/../share/fluid-synth/sf2"
|
86
|
+
|
87
|
+
path
|
88
|
+
when :windows
|
89
|
+
# DLLは PATH に通ってるか、明示パスで指定
|
90
|
+
path = ENV["SOUNDFONT_PATH"] || "#{name}.dll"
|
91
|
+
raise "Set LIB_FLUIDSYNTH_PATH env var or place " +
|
92
|
+
"#{name}.dll in working dir" unless File.exist?(path)
|
93
|
+
path
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.full_path_for_soundfont( sf2_filename = SOUNDFONT_NAME_DEFAULT )
|
98
|
+
self.soundfont_path + "/" + sf2_filename
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# begin
|
103
|
+
# lib_fluidsynth = self.lib_path_for('fluidsynth')
|
104
|
+
# dlload lib_fluidsynth
|
105
|
+
# rescue
|
106
|
+
# raise LoadError, "Couldn't find the fluidsynth library."
|
107
|
+
# end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
def self.obtain_soundfont_path
|
113
|
+
C.soundfont_path
|
114
|
+
end
|
115
|
+
def obtain_soundfont_path
|
116
|
+
self.class.obtain_soundfont_path
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.obtain_full_path_for_soundfont( sf2_filename = SOUNDFONT_NAME_DEFAULT )
|
120
|
+
C.full_path_for_soundfont(sf2_filename)
|
121
|
+
end
|
122
|
+
def obtain_full_path_for_soundfont( sf2_filename = SOUNDFONT_NAME_DEFAULT )
|
123
|
+
self.class.obtain_full_path_for_soundfont(sf2_filename)
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
#
|
130
|
+
# ==== References
|
131
|
+
# https://www.fluidsynth.org/api/deprecated.html
|
132
|
+
#
|
133
|
+
class FiddleFluidSynth
|
134
|
+
|
135
|
+
URI_DEPRECATED = "https://www.fluidsynth.org/api/deprecated.html"
|
136
|
+
|
137
|
+
#
|
138
|
+
def self.deprecated_msg( meth )
|
139
|
+
$stderr.puts "(**) #{meth} is deprecated. See #{URI_DEPRECATED}"
|
140
|
+
end
|
141
|
+
def deprecated_msg( meth )
|
142
|
+
self.class.deprecated_msg(meth)
|
143
|
+
end
|
144
|
+
|
145
|
+
#
|
146
|
+
def self.deprecated_msg_instead( instead, meth: )
|
147
|
+
$stderr.puts "(**) #{meth} is deprecated. Use #{instead} instead."
|
148
|
+
end
|
149
|
+
def deprecated_msg_instead( instead, meth: )
|
150
|
+
self.class.deprecated_msg_instead(instead, meth: meth)
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
#
|
158
|
+
#
|
159
|
+
#
|
160
|
+
class FiddleFluidSynth
|
161
|
+
|
162
|
+
#
|
163
|
+
BANK_NUM_MIN = 0
|
164
|
+
BANK_NUM_MAX = 16383
|
165
|
+
BKNUM_RANGE_WHOLE = BANK_NUM_MIN..BANK_NUM_MAX
|
166
|
+
|
167
|
+
PROG_NUM_MIN = 0
|
168
|
+
PROG_NUM_MAX = 127
|
169
|
+
PGNUM_RANGE_WHOLE = PROG_NUM_MIN..PROG_NUM_MAX
|
170
|
+
|
171
|
+
#
|
172
|
+
CHAN_NUM_MIN = 0
|
173
|
+
# CHAN_NUM_MAX = # MIDI channel count -1
|
174
|
+
|
175
|
+
KEY_NUM_MIN = 0
|
176
|
+
KEY_NUM_MAX = 127
|
177
|
+
KEY_RANGE_WHOLE = KEY_NUM_MIN..KEY_NUM_MAX
|
178
|
+
|
179
|
+
VEL_NUM_MIN = 0
|
180
|
+
VEL_NUM_MAX = 127
|
181
|
+
VEL_RANGE_WHOLE = VEL_NUM_MIN..VEL_NUM_MAX
|
182
|
+
|
183
|
+
#
|
184
|
+
def self.bknum_range_whole; BKNUM_RANGE_WHOLE; end
|
185
|
+
def self.pgnum_range_whole; PGNUM_RANGE_WHOLE; end
|
186
|
+
def self.key_range_whole; KEY_RANGE_WHOLE; end
|
187
|
+
def self.velc_range_whole; VEL_RANGE_WHOLE; end
|
188
|
+
class <<self
|
189
|
+
alias bank_range_whole bknum_range_whole
|
190
|
+
alias prog_range_whole pgnum_range_whole
|
191
|
+
alias vel_range_whole velc_range_whole
|
192
|
+
end
|
193
|
+
|
194
|
+
# for instance methods.
|
195
|
+
[:bknum_range_whole, :bank_range_whole,
|
196
|
+
:pgnum_range_whole, :prog_range_whole,
|
197
|
+
:key_range_whole,
|
198
|
+
:velc_range_whole,].each do |meth|
|
199
|
+
define_method(meth){ self.class.send(meth) }
|
200
|
+
end
|
201
|
+
alias vel_range_whole velc_range_whole
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
#
|
207
|
+
#
|
208
|
+
#
|
209
|
+
class FiddleFluidSynth
|
210
|
+
|
211
|
+
#
|
212
|
+
AUDIO_DRIVER_LIST = [
|
213
|
+
'alsa', 'oss', 'jack', 'portaudio', 'sndmgr', 'coreaudio',
|
214
|
+
'Direct Sound']
|
215
|
+
|
216
|
+
#
|
217
|
+
def audio_driver_prepare( driver = nil,
|
218
|
+
settings: self.settings, synth: self.synth,
|
219
|
+
new2_f: false, cb_ptr: nil )
|
220
|
+
|
221
|
+
#
|
222
|
+
if self.audio_driver && !(self.audio_driver.null?)
|
223
|
+
$stderr.puts "(**) audio driver has already been set." +
|
224
|
+
" currently multiple drivers setting is NOT supported." +
|
225
|
+
" So #{__method__} ignore this call..."
|
226
|
+
else
|
227
|
+
|
228
|
+
### set the driver name into the settings if it is given.
|
229
|
+
if !(driver.to_s == "")
|
230
|
+
raise "NOT supported driver: #{driver}." +
|
231
|
+
" Choose one of #{AUDIO_DRIVER_LIST}" unless \
|
232
|
+
AUDIO_DRIVER_LIST.include?(driver)
|
233
|
+
|
234
|
+
#
|
235
|
+
self.settings.audio_driver = driver
|
236
|
+
end
|
237
|
+
|
238
|
+
### create audio driver instance.
|
239
|
+
@audio_driver = if !(new2_f) && cb_ptr.nil?
|
240
|
+
self.audio_driver_new(
|
241
|
+
settings: settings, synth: synth)
|
242
|
+
elsif new2_f || cb_ptr
|
243
|
+
self.audio_driver_new2(
|
244
|
+
settings: settings, audio_func: cb_ptr)
|
245
|
+
else
|
246
|
+
raise "(**) Failed to prepare the audio driver."
|
247
|
+
end
|
248
|
+
|
249
|
+
if @audio_driver.nil? || @audio_driver.null?
|
250
|
+
raise "(**) Failed to create the audio driver."
|
251
|
+
end
|
252
|
+
$stderr.puts "(**) Audio driver is set" +
|
253
|
+
" (0x#{@audio_driver.to_i.to_s(16)}:#{@audio_driver.class})."
|
254
|
+
|
255
|
+
end
|
256
|
+
@audio_driver
|
257
|
+
end
|
258
|
+
|
259
|
+
#
|
260
|
+
def start( driver = nil )
|
261
|
+
self.audio_driver_prepare(driver)
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
|
267
|
+
# Settings.
|
268
|
+
#
|
269
|
+
#
|
270
|
+
class FiddleFluidSynth
|
271
|
+
|
272
|
+
#
|
273
|
+
def self.settings_item_to_meth_name( item )
|
274
|
+
Interface::Settings.item_to_meth_name(item)
|
275
|
+
end
|
276
|
+
|
277
|
+
# #settings_get_type().
|
278
|
+
#
|
279
|
+
#
|
280
|
+
def self.setting_type_is_notype?( type )
|
281
|
+
type == FiddleFluidSynth::Enum_fluid_types_enum::FLUID_NO_TYPE
|
282
|
+
end
|
283
|
+
|
284
|
+
def self.setting_type_is_num?( type )
|
285
|
+
type == FiddleFluidSynth::Enum_fluid_types_enum::FLUID_NUM_TYPE
|
286
|
+
end
|
287
|
+
|
288
|
+
def self.setting_type_is_int?( type )
|
289
|
+
type == FiddleFluidSynth::Enum_fluid_types_enum::FLUID_INT_TYPE
|
290
|
+
end
|
291
|
+
|
292
|
+
def self.setting_type_is_str?( type )
|
293
|
+
type == FiddleFluidSynth::Enum_fluid_types_enum::FLUID_STR_TYPE
|
294
|
+
end
|
295
|
+
|
296
|
+
def self.setting_type_is_set?( type )
|
297
|
+
type == FiddleFluidSynth::Enum_fluid_types_enum::FLUID_SET_TYPE
|
298
|
+
end
|
299
|
+
[
|
300
|
+
:setting_type_is_notype?,
|
301
|
+
:setting_type_is_num?,
|
302
|
+
:setting_type_is_int?,
|
303
|
+
:setting_type_is_str?,
|
304
|
+
:setting_type_is_set?,
|
305
|
+
].each do |_meth|
|
306
|
+
define_method(_meth){|type| self.class.send(__method__, type) }
|
307
|
+
end
|
308
|
+
|
309
|
+
|
310
|
+
# settings_get_hints().
|
311
|
+
#
|
312
|
+
#
|
313
|
+
def self.setting_hints_is_bounded_above?( hints )
|
314
|
+
ret = hints & FLUID_HINT_BOUNDED_ABOVE
|
315
|
+
ret != 0
|
316
|
+
end
|
317
|
+
def self.setting_hints_is_bounded_below?( hints )
|
318
|
+
ret = hints & FLUID_HINT_BOUNDED_BELOW
|
319
|
+
ret != 0
|
320
|
+
end
|
321
|
+
def self.setting_hints_is_optionlist?( hints )
|
322
|
+
ret = hints & FLUID_HINT_OPTIONLIST
|
323
|
+
ret != 0
|
324
|
+
end
|
325
|
+
def self.setting_hints_is_toggled?( hints )
|
326
|
+
ret = hints & FLUID_HINT_TOGGLED
|
327
|
+
ret != 0
|
328
|
+
end
|
329
|
+
[
|
330
|
+
:setting_hints_is_bounded_above?,
|
331
|
+
:setting_hints_is_bounded_below?,
|
332
|
+
:setting_hints_is_optionlist?,
|
333
|
+
:setting_hints_is_toggled?,
|
334
|
+
].each do |_meth|
|
335
|
+
define_method(_meth){|hints| self.class.send(__method__, hints) }
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
|
341
|
+
# SoundFont.
|
342
|
+
#
|
343
|
+
#
|
344
|
+
class FiddleFluidSynth
|
345
|
+
def sfonts( synth = self.synth )
|
346
|
+
ret = self.sfid_ary.map{|_sfid|
|
347
|
+
self.synth_get_sfont_by_id(synth, id: _sfid)
|
348
|
+
}
|
349
|
+
ret
|
350
|
+
end
|
351
|
+
def sfont( debug_f: false )
|
352
|
+
ret = self.sfonts.first
|
353
|
+
$stderr.puts "{#{__method__}} ret: #{ret.class}" if debug_f
|
354
|
+
ret
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
|
359
|
+
#
|
360
|
+
#
|
361
|
+
#
|
362
|
+
class FiddleFluidSynth
|
363
|
+
|
364
|
+
# from: synth/midi/message.rb
|
365
|
+
#
|
366
|
+
#
|
367
|
+
|
368
|
+
#
|
369
|
+
def noteon( ch, key, vel, synth = self.synth )
|
370
|
+
self.synth_noteon(synth, ch: ch, key: key, vel: vel)
|
371
|
+
end
|
372
|
+
|
373
|
+
def noteoff( ch, key, synth = self.synth )
|
374
|
+
self.synth_noteoff(synth, ch: ch, key: key)
|
375
|
+
end
|
376
|
+
|
377
|
+
def pitch_bend( ch, val, synth = self.synth )
|
378
|
+
# C.fluid_synth_pitch_bend(@synth, ch, val + 8192)
|
379
|
+
self.synth_pitch_bend(synth, ch: ch, val: val)
|
380
|
+
end
|
381
|
+
|
382
|
+
# control change.
|
383
|
+
def control_change( ch, ctrlnum, val, synth = self.synth )
|
384
|
+
self.synth_cc(synth, ch: ch, num: ctrlnum, val: val)
|
385
|
+
end
|
386
|
+
alias cc control_change
|
387
|
+
|
388
|
+
### program.
|
389
|
+
|
390
|
+
# TODO. remove?
|
391
|
+
def program_select( ch: ,
|
392
|
+
bknum: , prenum: , sfid: self.sfid_latest,
|
393
|
+
synth: self.synth )
|
394
|
+
self.synth_program_select(synth, ch: ch,
|
395
|
+
sfid: sfid, bknum: bknum, prenum: prenum)
|
396
|
+
end
|
397
|
+
|
398
|
+
def program_change( ch, pgnum, synth = self.synth )
|
399
|
+
# C.fluid_synth_program_change(synth, ch, pgnum)
|
400
|
+
self.synth_program_change(synth, ch: ch, pgnum: pgnum)
|
401
|
+
end
|
402
|
+
|
403
|
+
def program_reset( synth = self.synth )
|
404
|
+
# C.fluid_synth_program_reset(synth)
|
405
|
+
self.synth_program_reset(synth)
|
406
|
+
end
|
407
|
+
|
408
|
+
#
|
409
|
+
def sfont_select( ch, sfid, synth = self.synth )
|
410
|
+
# C.fluid_synth_sfont_select(synth, ch, sfid)
|
411
|
+
self.synth_sfont_select(synth, ch: ch, sfid: sfid)
|
412
|
+
end
|
413
|
+
|
414
|
+
def bank_select( ch, bknum, synth = self.synth )
|
415
|
+
# C.fluid_synth_bank_select(synth, ch, bknum)
|
416
|
+
self.synth_bank_select(synth, ch: ch, bknum: bknum)
|
417
|
+
end
|
418
|
+
|
419
|
+
# synth/midi/message.rb
|
420
|
+
#
|
421
|
+
#
|
422
|
+
def system_reset( synth = self.synth )
|
423
|
+
# C.fluid_synth_system_reset(synth)
|
424
|
+
self.synth_system_reset(synth)
|
425
|
+
end
|
426
|
+
|
427
|
+
# midi_input/player.rb
|
428
|
+
#
|
429
|
+
# TODO. args. player=self.player, file: file)
|
430
|
+
# def player_file( file, player: self.player )
|
431
|
+
def player_file( file, player: self.player )
|
432
|
+
self.player_add(player, file: file)
|
433
|
+
self.player_play(player)
|
434
|
+
end
|
435
|
+
alias play_file player_file
|
436
|
+
|
437
|
+
|
438
|
+
# in midi_input/player.rb
|
439
|
+
#
|
440
|
+
# def player_status( player = self.player )
|
441
|
+
# ret = C.fluid_player_get_status(player)
|
442
|
+
# ret
|
443
|
+
# end
|
444
|
+
|
445
|
+
#
|
446
|
+
def __player_is_done?( player: , status: )
|
447
|
+
tmp = self.player_status(player)
|
448
|
+
ret = (tmp == status)
|
449
|
+
ret
|
450
|
+
end
|
451
|
+
def player_is_ready?( player = self.player )
|
452
|
+
self.__player_is_done?(player: player, status: FLUID_PLAYER_READY)
|
453
|
+
end
|
454
|
+
def player_is_playing?( player = self.player )
|
455
|
+
self.__player_is_done?(player: player, status: FLUID_PLAYER_PLAYING)
|
456
|
+
end
|
457
|
+
def player_is_stopping?( player = self.player )
|
458
|
+
self.__player_is_done?(player: player, status: FLUID_PLAYER_STOPPING)
|
459
|
+
end
|
460
|
+
def player_is_done?( player = self.player )
|
461
|
+
self.__player_is_done?(player: player, status: FLUID_PLAYER_DONE)
|
462
|
+
end
|
463
|
+
|
464
|
+
end
|
465
|
+
|
466
|
+
|
467
|
+
#### endof filename: fiddle-fluidsynth/util/util.rb
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# filename: fiddle-fluidsynth/util.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
|
6
|
+
#
|
7
|
+
#
|
8
|
+
#
|
9
|
+
class FiddleFluidSynth
|
10
|
+
module C
|
11
|
+
|
12
|
+
#
|
13
|
+
module Interface
|
14
|
+
module Settings; end
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
module Interface
|
19
|
+
module AudioOutputDriver; end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
#
|
27
|
+
#
|
28
|
+
#
|
29
|
+
require_relative "./util/util"
|
30
|
+
require_relative "./util/callback"
|
31
|
+
require_relative "./util/module_hier"
|
32
|
+
|
33
|
+
# in util-after.rb
|
34
|
+
# require_relative "./util/settings"
|
35
|
+
|
36
|
+
|
37
|
+
#### endof filename: fiddle-fluidsynth/util.rb
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# filename: fiddle_fluidsynth.rb
|
5
|
+
#
|
6
|
+
|
7
|
+
#
|
8
|
+
#
|
9
|
+
#
|
10
|
+
require 'fiddle/import'
|
11
|
+
|
12
|
+
#
|
13
|
+
require_relative "fiddle_fluidsynth/core_ext/fiddle"
|
14
|
+
require_relative "fiddle_fluidsynth/core_ext/module"
|
15
|
+
|
16
|
+
#
|
17
|
+
#
|
18
|
+
#
|
19
|
+
class FiddleFluidSynth
|
20
|
+
FFS = FiddleFluidSynth
|
21
|
+
module C
|
22
|
+
extend Fiddle::Importer
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
require_relative "fiddle_fluidsynth/version"
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
#
|
32
|
+
#
|
33
|
+
#
|
34
|
+
require_relative "fiddle_fluidsynth/util"
|
35
|
+
require_relative "fiddle_fluidsynth/fiddle_fluidsynth"
|
36
|
+
|
37
|
+
#
|
38
|
+
require_relative "fiddle_fluidsynth/types"
|
39
|
+
|
40
|
+
#
|
41
|
+
require_relative "fiddle_fluidsynth/audio_output"
|
42
|
+
require_relative "fiddle_fluidsynth/command_interface"
|
43
|
+
require_relative "fiddle_fluidsynth/logging"
|
44
|
+
require_relative "fiddle_fluidsynth/midi_input"
|
45
|
+
require_relative "fiddle_fluidsynth/sequencer"
|
46
|
+
require_relative "fiddle_fluidsynth/misc"
|
47
|
+
require_relative "fiddle_fluidsynth/settings"
|
48
|
+
require_relative "fiddle_fluidsynth/soundfonts"
|
49
|
+
require_relative "fiddle_fluidsynth/synth"
|
50
|
+
|
51
|
+
#
|
52
|
+
#
|
53
|
+
#
|
54
|
+
require_relative "fiddle_fluidsynth/util-after"
|
55
|
+
|
56
|
+
|
57
|
+
#### endof filename: fiddle_fluidsynth.rb
|