Browse Source

Workaround a bug in Juce/MacOS file dialog stuff. Show error messages in GUI.

tags/v100_p5
xenakios 7 years ago
parent
commit
45dccb830d
4 changed files with 18 additions and 6 deletions
  1. +10
    -3
      Source/PluginEditor.cpp
  2. +1
    -1
      Source/PluginEditor.h
  3. +6
    -1
      Source/PluginProcessor.cpp
  4. +1
    -1
      Source/PluginProcessor.h

+ 10
- 3
Source/PluginEditor.cpp View File

@@ -103,7 +103,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
m_wavecomponent.setRecordingPosition(processor.getRecordingPositionPercent());
} else
m_wavecomponent.setRecordingPosition(-1.0);
String infotext = String(processor.getPreBufferingPercent(), 1) + " " + String(processor.getStretchSource()->m_param_change_count);
String infotext = String(processor.getPreBufferingPercent(), 1) + " " + String(processor.getStretchSource()->m_param_change_count)+" "+m_last_err;
m_info_label.setText(infotext, dontSendNotification);
}
if (id == 2)
@@ -161,10 +161,17 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile()
#endif
FileChooser myChooser("Please select audio file...",
initialloc,
"*.wav");
"*.wav",true);
if (myChooser.browseForFileToOpen())
{
processor.setAudioFile(myChooser.getResult());
File resu = myChooser.getResult();
String pathname = resu.getFullPathName();
if (pathname.startsWith("/localhost"))
{
pathname = pathname.substring(10);
resu = File(pathname);
}
m_last_err = processor.setAudioFile(resu);
if (processor.getAudioFile() != File())
{
m_wavecomponent.setAudioFile(processor.getAudioFile());


+ 1
- 1
Source/PluginEditor.h View File

@@ -330,7 +330,7 @@ private:
Label m_info_label;
SpectralChainEditor m_spec_order_ed;
void chooseFile();
String m_last_err;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
};


+ 6
- 1
Source/PluginProcessor.cpp View File

@@ -478,7 +478,11 @@ double PaulstretchpluginAudioProcessor::getRecordingPositionPercent()

String PaulstretchpluginAudioProcessor::setAudioFile(File f)
{
auto ai = unique_from_raw(m_afm->createReaderFor(f));
//if (f==File())
// return String();
//if (f==m_current_file && f.getLastModificationTime()==m_current_file_date)
// return String();
auto ai = unique_from_raw(m_afm->createReaderFor(f));
if (ai != nullptr)
{
if (ai->numChannels > 32)
@@ -494,6 +498,7 @@ String PaulstretchpluginAudioProcessor::setAudioFile(File f)
ScopedLock locker(m_cs);
m_stretch_source->setAudioFile(f);
m_current_file = f;
m_current_file_date = m_current_file.getLastModificationTime();
m_using_memory_buffer = false;
return String();
//MessageManager::callAsync([cb, file]() { cb(String()); });


+ 1
- 1
Source/PluginProcessor.h View File

@@ -111,7 +111,7 @@ private:
int m_cur_num_out_chans = 2;
CriticalSection m_cs;
File m_current_file;
Time m_current_file_date;

TimeSliceThread m_bufferingthread;
std::unique_ptr<StretchAudioSource> m_stretch_source;


Loading…
Cancel
Save