Made saving captured audio optional. While it probably will never take a long time to save the buffer, show the capture saving is active in the info label
This commit is contained in:
parent
6a9f9cb1e9
commit
e6a614c5f5
@ -292,6 +292,10 @@ void PaulstretchpluginAudioProcessorEditor::executeModalMenuAction(int menuid, i
|
||||
{
|
||||
toggleBool(processor.m_load_file_with_state);
|
||||
}
|
||||
if (r == 9)
|
||||
{
|
||||
toggleBool(processor.m_save_captured_audio);
|
||||
}
|
||||
if (r == 3)
|
||||
{
|
||||
showAbout();
|
||||
@ -470,6 +474,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
|
||||
infotext += " " + String(m_wavecomponent.m_image_init_count) + " " + String(m_wavecomponent.m_image_update_count)+ " ";
|
||||
if (processor.m_offline_render_state >= 0 && processor.m_offline_render_state <= 100)
|
||||
infotext += String(processor.m_offline_render_state)+"%";
|
||||
if (processor.m_capture_save_state == 1)
|
||||
infotext += "Saving captured audio...";
|
||||
m_info_label.setText(infotext, dontSendNotification);
|
||||
|
||||
}
|
||||
@ -559,6 +565,7 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
||||
m_settings_menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays);
|
||||
m_settings_menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
|
||||
m_settings_menu.addItem(8, "Mute audio while capturing", true, processor.m_mute_while_capturing);
|
||||
m_settings_menu.addItem(9, "Save captured audio to disk", true, processor.m_save_captured_audio);
|
||||
int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
|
||||
PopupMenu capturelenmenu;
|
||||
|
||||
|
@ -319,6 +319,7 @@ public:
|
||||
void chooseFile();
|
||||
void showRenderDialog();
|
||||
void executeModalMenuAction(int menuid, int actionid);
|
||||
|
||||
private:
|
||||
PaulstretchpluginAudioProcessor& processor;
|
||||
uptrvec<ParameterComponent> m_parcomps;
|
||||
|
@ -260,8 +260,9 @@ ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool
|
||||
else
|
||||
paramtree.setProperty("prebufamount", -1, nullptr);
|
||||
paramtree.setProperty("loadfilewithstate", m_load_file_with_state, nullptr);
|
||||
storeToTreeProperties(paramtree, nullptr, "playwhenhostrunning", m_play_when_host_plays, "capturewhenhostrunning", m_capture_when_host_plays);
|
||||
storeToTreeProperties(paramtree, nullptr, "mutewhilecapturing", m_mute_while_capturing);
|
||||
storeToTreeProperties(paramtree, nullptr, "playwhenhostrunning", m_play_when_host_plays,
|
||||
"capturewhenhostrunning", m_capture_when_host_plays,"savecapturedaudio",m_save_captured_audio,
|
||||
"mutewhilecapturing",m_mute_while_capturing);
|
||||
}
|
||||
storeToTreeProperties(paramtree, nullptr, "tabaindex", m_cur_tab_index);
|
||||
storeToTreeProperties(paramtree, nullptr, "waveviewrange", m_wave_view_range);
|
||||
@ -280,7 +281,8 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree)
|
||||
m_free_filter_envelope->restoreState(freefilterstate);
|
||||
m_load_file_with_state = tree.getProperty("loadfilewithstate", true);
|
||||
getFromTreeProperties(tree, "playwhenhostrunning", m_play_when_host_plays,
|
||||
"capturewhenhostrunning", m_capture_when_host_plays,"mutewhilecapturing",m_mute_while_capturing);
|
||||
"capturewhenhostrunning", m_capture_when_host_plays,"mutewhilecapturing",m_mute_while_capturing,
|
||||
"savecapturedaudio",m_save_captured_audio);
|
||||
getFromTreeProperties(tree, "tabaindex", m_cur_tab_index);
|
||||
if (tree.hasProperty("numspectralstagesb"))
|
||||
{
|
||||
@ -495,6 +497,7 @@ void PaulstretchpluginAudioProcessor::saveCaptureBuffer()
|
||||
outfile.create();
|
||||
if (outfile.existsAsFile())
|
||||
{
|
||||
m_capture_save_state = 1;
|
||||
auto outstream = outfile.createOutputStream();
|
||||
auto writer = unique_from_raw(wavformat.createWriterFor(outstream, getSampleRateChecked(),
|
||||
inchans, 32, {}, 0));
|
||||
@ -515,6 +518,7 @@ void PaulstretchpluginAudioProcessor::saveCaptureBuffer()
|
||||
}
|
||||
else
|
||||
Logger::writeToLog("Could not create output file");
|
||||
m_capture_save_state = 0;
|
||||
};
|
||||
m_threadpool->addJob(task);
|
||||
}
|
||||
@ -990,7 +994,10 @@ void PaulstretchpluginAudioProcessor::finishRecording(int lenrecording)
|
||||
m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer, getSampleRateChecked(), lenrecording);
|
||||
*getFloatParameter(cpi_soundstart) = 0.0f;
|
||||
*getFloatParameter(cpi_soundend) = jlimit<double>(0.01, 1.0, 1.0 / lenrecording * m_rec_count);
|
||||
saveCaptureBuffer();
|
||||
if (m_save_captured_audio == true)
|
||||
{
|
||||
saveCaptureBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
||||
|
@ -205,6 +205,7 @@ public:
|
||||
String offlineRender(File outputfile);
|
||||
std::atomic<int> m_offline_render_state{ -1 };
|
||||
std::atomic<bool> m_offline_render_cancel_requested{ false };
|
||||
std::atomic<int> m_capture_save_state{ 0 };
|
||||
bool m_state_dirty = false;
|
||||
std::unique_ptr<AudioThumbnail> m_thumb;
|
||||
bool m_show_technical_info = false;
|
||||
@ -225,6 +226,7 @@ public:
|
||||
float opt) override;
|
||||
int m_cur_tab_index = 0;
|
||||
bool m_is_recording = false;
|
||||
bool m_save_captured_audio = true;
|
||||
private:
|
||||
bool m_prebuffering_inited = false;
|
||||
AudioBuffer<float> m_recbuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user