Skip to content

Commit

Permalink
Bug fixes:
Browse files Browse the repository at this point in the history
- make sure attribute error is thrown and handled when fluidsynth doesn't really load and leaves Synth attribute empty.
- fix error with start_note on OSCPlaybackImplementation when an extra parameter is an Envelope
  • Loading branch information
MarcTheSpark committed Nov 19, 2022
1 parent 84d5547 commit 0ffff6b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion scamp/_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@
# load up a local copy of the fluidsynth dll on Windows or dylib on MacOS)
logging.debug("Trying to load copy of pyfluidsynth from within SCAMP package.")
from ._thirdparty import fluidsynth
# Sometimes fluidsynth seems to load, but it's empty and doesn't have the Synth attribute.
# this line will cause an AttributeError to be thrown and handled in that case
fluidsynth.Synth
logging.debug("Loading of pyfluidsynth succeeded.")
except (ImportError, AttributeError):
logging.debug("Loading of pyfluidsynth failed.")
try:
if playback_settings.try_system_fluidsynth_first:
# second choice: use the use the local, tweaked copy of pyfluidsynth (which will also try to
# second choice: use the local, tweaked copy of pyfluidsynth (which will also try to
# load up a local copy of the fluidsynth dll on Windows or dylib on MacOS)
logging.debug("Trying to copy of pyfluidsynth from within SCAMP package.")
from ._thirdparty import fluidsynth
else:
# second choice: import using an installed version of pyfluidsynth
logging.debug("Trying to load system copy of pyfluidsynth.")
import fluidsynth
fluidsynth.Synth # See note above
logging.debug("Loading of pyfluidsynth succeeded.")
except (ImportError, AttributeError):
# if we're here, it's probably because fluidsynth wasn't installed
Expand Down
2 changes: 1 addition & 1 deletion scamp/_package_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

name = "scamp"

version = "0.9.1"
version = "0.9.1.post4"

author = "Marc Evanstein"

Expand Down
2 changes: 1 addition & 1 deletion scamp/playback_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def start_note(self, note_id: int, pitch: float, volume: float, properties: Note
[note_id, pitch, volume])
self._currently_playing.append(note_id)
for param, value in properties.extra_playback_parameters.items():
self.change_note_parameter(note_id, param, value)
self.change_note_parameter(note_id, param, value.start_level() if hasattr(value, 'start_level') else value)

def end_note(self, note_id: int) -> None:
self.client.send_message("/{}/{}".format(self.message_prefix,
Expand Down

0 comments on commit 0ffff6b

Please sign in to comment.