Allow cancelling offline render
This commit is contained in:
parent
ba067f7d4a
commit
d76ac6118a
@ -360,8 +360,9 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
|||||||
menu.addItem(6, "Dump preset to clipboard", true, false);
|
menu.addItem(6, "Dump preset to clipboard", true, false);
|
||||||
#endif
|
#endif
|
||||||
menu.addItem(7, "Show technical info", true, processor.m_show_technical_info);
|
menu.addItem(7, "Show technical info", true, processor.m_show_technical_info);
|
||||||
menu.addItem(8, "Offline render...",
|
if (processor.m_offline_render_state==-1 || processor.m_offline_render_state == 200)
|
||||||
processor.m_offline_render_state == 200 || processor.m_offline_render_state == -1, false);
|
menu.addItem(8, "Offline render...", true, false);
|
||||||
|
else menu.addItem(9, "Cancel render", true, false);
|
||||||
int r = menu.show();
|
int r = menu.show();
|
||||||
if (r >= 200 && r < 210)
|
if (r >= 200 && r < 210)
|
||||||
{
|
{
|
||||||
@ -423,6 +424,10 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
|||||||
{
|
{
|
||||||
processor.offlineRender(File("C:\\MusicAudio\\sourcesamples\\paultesmaus\\plugin_offline_test\\out.wav"));
|
processor.offlineRender(File("C:\\MusicAudio\\sourcesamples\\paultesmaus\\plugin_offline_test\\out.wav"));
|
||||||
}
|
}
|
||||||
|
if (r == 9)
|
||||||
|
{
|
||||||
|
processor.m_offline_render_cancel_requested = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveformComponent::WaveformComponent(AudioFormatManager* afm, AudioThumbnail* thumb)
|
WaveformComponent::WaveformComponent(AudioFormatManager* afm, AudioThumbnail* thumb)
|
||||||
|
@ -453,12 +453,15 @@ String PaulstretchpluginAudioProcessor::offlineRender(File outputfile)
|
|||||||
auto rendertask = [ss,writer,blocksize,numoutchans, outsr, this]()
|
auto rendertask = [ss,writer,blocksize,numoutchans, outsr, this]()
|
||||||
{
|
{
|
||||||
AudioBuffer<float> renderbuffer(numoutchans, blocksize);
|
AudioBuffer<float> renderbuffer(numoutchans, blocksize);
|
||||||
int64_t outlen = 50 * outsr;
|
int64_t outlen = 250 * outsr;
|
||||||
int64_t outcounter = 0;
|
int64_t outcounter = 0;
|
||||||
AudioSourceChannelInfo asci(renderbuffer);
|
AudioSourceChannelInfo asci(renderbuffer);
|
||||||
m_offline_render_state = 0;
|
m_offline_render_state = 0;
|
||||||
|
m_offline_render_cancel_requested = false;
|
||||||
while (outcounter < outlen)
|
while (outcounter < outlen)
|
||||||
{
|
{
|
||||||
|
if (m_offline_render_cancel_requested == true)
|
||||||
|
break;
|
||||||
ss->getNextAudioBlock(asci);
|
ss->getNextAudioBlock(asci);
|
||||||
writer->writeFromAudioSampleBuffer(renderbuffer, 0, blocksize);
|
writer->writeFromAudioSampleBuffer(renderbuffer, 0, blocksize);
|
||||||
outcounter += blocksize;
|
outcounter += blocksize;
|
||||||
|
@ -163,6 +163,7 @@ public:
|
|||||||
void setStateFromTree(ValueTree tree);
|
void setStateFromTree(ValueTree tree);
|
||||||
String offlineRender(File outputfile);
|
String offlineRender(File outputfile);
|
||||||
std::atomic<int> m_offline_render_state{ -1 };
|
std::atomic<int> m_offline_render_state{ -1 };
|
||||||
|
std::atomic<bool> m_offline_render_cancel_requested{ false };
|
||||||
bool m_state_dirty = false;
|
bool m_state_dirty = false;
|
||||||
std::unique_ptr<AudioThumbnail> m_thumb;
|
std::unique_ptr<AudioThumbnail> m_thumb;
|
||||||
bool m_show_technical_info = false;
|
bool m_show_technical_info = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user