Skip to content

Commit

Permalink
Update midi_synthesizer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyTNT committed Oct 23, 2024
1 parent d35d412 commit 217476b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions midi_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ def __init__(self, soundfont_path, sample_rate=44100):
fl = fluidsynth.Synth(samplerate=float(sample_rate))
sfid = fl.sfload(soundfont_path)
self.devices = [[fl, sfid, False]]
self.file_lock = Lock()
self.devices_lock = Lock()

def get_fluidsynth(self):
for device in self.devices:
if not device[2]:
device[2] = True
return device
with self.file_lock:
with self.devices_lock:
for device in self.devices:
if not device[2]:
device[2] = True
return device
fl = fluidsynth.Synth(samplerate=float(self.sample_rate))
sfid = fl.sfload(self.soundfont_path)
device = [fl, sfid, True]
self.devices.append(device)
return device
device = [fl, sfid, True]
self.devices.append(device)
return device

def release_fluidsynth(self, device):
device[0].system_reset()
Expand Down

0 comments on commit 217476b

Please sign in to comment.