52 if (files.size() != 1)
55 String file = files[0];
56 StringArray wildcards;
58 for (
const String& wildcard : wildcards) {
59 if (file.matchesWildcard(wildcard,
true))
74 void filesDropped(
const StringArray& files,
int x,
int y)
override {
75 if (files.size() == 0)
80 for (
Listener* listener : listeners_)
81 listener->audioFileLoaded(file);
116 std::vector<Listener*> listeners_;
A listener interface for classes interested in receiving audio file load events.
Definition audio_file_drop_source.h:26
virtual void audioFileLoaded(const File &file)=0
Called when an audio file is successfully dropped and recognized.
virtual ~Listener()
Definition audio_file_drop_source.h:28
A helper class for handling drag-and-drop of audio files into a JUCE component.
Definition audio_file_drop_source.h:19
String getExtensions()
Gets a wildcard pattern representing all supported audio formats.
Definition audio_file_drop_source.h:103
virtual void audioFileLoaded(const File &file)=0
Called internally when a recognized audio file is dropped. Must be implemented by subclasses.
void filesDropped(const StringArray &files, int x, int y) override
Called when files are dropped onto the component.
Definition audio_file_drop_source.h:74
bool isInterestedInFileDrag(const StringArray &files) override
Checks if the drag operation includes exactly one file and if it matches supported audio formats.
Definition audio_file_drop_source.h:51
void addListener(Listener *listener)
Adds a listener to receive audio file load notifications.
Definition audio_file_drop_source.h:96
AudioFileDropSource()
Constructs an AudioFileDropSource and registers basic audio formats.
Definition audio_file_drop_source.h:41
AudioFormatManager & formatManager()
Provides access to the underlying AudioFormatManager.
Definition audio_file_drop_source.h:110
AudioFormatManager format_manager_
Manages and recognizes different audio file formats.
Definition audio_file_drop_source.h:113