|
1 | 1 | #include "SourceIO.h"
|
2 | 2 | #include "SourceManager.h"
|
3 | 3 | #include "SourceInternalPool.h"
|
| 4 | +#include "../uiCallback/UICallback.h" |
4 | 5 | #include "../misc/PlayPosition.h"
|
5 | 6 | #include "../misc/AudioLock.h"
|
6 | 7 | #include "../Utils.h"
|
@@ -59,7 +60,17 @@ void SourceIO::run() {
|
59 | 60 | if (!SourceInternalPool::getInstance()->find(path)) {
|
60 | 61 | /** Load Audio Data */
|
61 | 62 | auto [sampleRate, buffer, metaData, bitDepth] = SourceIO::loadAudio(file);
|
62 |
| - if (sampleRate <= 0) { continue; } |
| 63 | + if (sampleRate <= 0) { |
| 64 | + /** Failed */ |
| 65 | + juce::MessageManager::callAsync( |
| 66 | + [path] { |
| 67 | + UICallbackAPI<const juce::String&, const juce::String&>::invoke( |
| 68 | + UICallbackType::ErrorAlert, "Read Audio", |
| 69 | + "Can't read audio file: " + path); |
| 70 | + } |
| 71 | + ); |
| 72 | + continue; |
| 73 | + } |
63 | 74 |
|
64 | 75 | /** Set Data */
|
65 | 76 | juce::MessageManager::callAsync(
|
@@ -133,7 +144,17 @@ void SourceIO::run() {
|
133 | 144 | if (!SourceInternalPool::getInstance()->find(path)) {
|
134 | 145 | /** Load MIDI Data */
|
135 | 146 | auto [valid, data] = SourceIO::loadMIDI(file);
|
136 |
| - if (!valid) { continue; } |
| 147 | + if (!valid) { |
| 148 | + /** Failed */ |
| 149 | + juce::MessageManager::callAsync( |
| 150 | + [path] { |
| 151 | + UICallbackAPI<const juce::String&, const juce::String&>::invoke( |
| 152 | + UICallbackType::ErrorAlert, "Read MIDI", |
| 153 | + "Can't read MIDI file: " + path); |
| 154 | + } |
| 155 | + ); |
| 156 | + continue; |
| 157 | + } |
137 | 158 |
|
138 | 159 | /** Split Data */
|
139 | 160 | auto [tempo, buffer] = SourceIO::splitMIDI(data);
|
|
0 commit comments