Closed ghost closed 3 years ago
Also YES I cleaned up all the comments and added spaces to all the comments // comment
rather than //comment
because it was bugging me 🤣
Sorry mispelled correct haha 🍞 I'm so tired. Gotta sleep. The last PR will now display the correct MidiFile resource file and you can load, or quick load that specific resource type 👍
Thanks!
The old functions
load_soundfont
andload_midi
are still there and function as a shorthand to set+load but they simply load the resource then call onset_soundfont
andset_midi
. This means you can safely remove them if you wish as the are purely for convenience at this point. I like em so I'm keeping them :))
I think they can be useful for loading MIDI and SoundFont files in exported projects at runtime. I'd add MidiFile.load()
function and move import code into that (and make import code use MidiFile.load()
), this would be consistent with other classes in Godot such as Image.load()
.
Moreover, current convenient functions may actually lead to confusion/error when a user tries to load anything from outside res://
path, as ResourceLoader
does not handle filesystem paths.
Changes:
MidiFile
MidiFile
has an internalformat
variable and Format enum that is automatically set at import time.VERY IMPORTANT: You will have to re-import all MidiFile data simply select them all and go to Import tab and click Reimport. Because the old formats stored in
.import
do not contain format and MidiPlayer will reject them with incorrect format error.MidiPlayer
MidiPlayer
now has 2 additional variables :soundfont
andmidi
which are bothMidiFile
resources. You can now set them directly:$MidiPlayer.soundfont = preload("res://mysoundfont.sf2")
There are two new methodsset_soundfont
andset_midi
The get methods will now return the MidiFile resource rather than the path. To get the path you would need .name or .path or something like that :)NOTE: It will now throw an error if you try to load the incorrect format. The error is shown in the regular Output window but as red (uses
print_error
).The old functions
load_soundfont
andload_midi
are still there and function as a shorthand to set+load but they simply load the resource then call onset_soundfont
andset_midi
. This means you can safely remove them if you wish as the are purely for convenience at this point. I like em so I'm keeping them :))Docs
All new parameters have been added to the Docs including the Format enum, format member , Midi members , new set/get functionality and so on. I have added more clarification and descriptions. I have incorporated your changes as well from the previous commits. I also added a list of soundfonts that are completely free that you can look for. And also better explained the different concepts regarding midi.
Enjoy:)