Simplify capture saving logic a bit
This commit is contained in:
		@@ -241,7 +241,6 @@ int PaulstretchpluginAudioProcessor::getPreBufferAmount()
 | 
				
			|||||||
ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool ignorefile)
 | 
					ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool ignorefile)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ValueTree paramtree("paulstretch3pluginstate");
 | 
						ValueTree paramtree("paulstretch3pluginstate");
 | 
				
			||||||
	paramtree.setProperty("captureuuid", m_capture_uuid, nullptr);
 | 
					 | 
				
			||||||
	storeToTreeProperties(paramtree, nullptr, getParameters());
 | 
						storeToTreeProperties(paramtree, nullptr, getParameters());
 | 
				
			||||||
    if (m_current_file != File() && ignorefile == false)
 | 
					    if (m_current_file != File() && ignorefile == false)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -313,15 +312,6 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				setAudioFile(File(fn));
 | 
									setAudioFile(File(fn));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				String captureuuid = tree.getProperty("captureuuid");
 | 
					 | 
				
			||||||
				if (captureuuid.isEmpty() == false)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
					String capturefn = "C:\\Users\\Teemu\\AppData\\Roaming\\PaulXStretch\\audio_captures\\" + captureuuid + ".wav";
 | 
					 | 
				
			||||||
					setAudioFile(File(capturefn));
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		m_state_dirty = true;
 | 
							m_state_dirty = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -509,7 +499,7 @@ void PaulstretchpluginAudioProcessor::saveCaptureBuffer()
 | 
				
			|||||||
			jassert(sourcebuffer->getNumSamples() > 0);
 | 
								jassert(sourcebuffer->getNumSamples() > 0);
 | 
				
			||||||
			Logger::writeToLog("Saving capture to file " + outfn);
 | 
								Logger::writeToLog("Saving capture to file " + outfn);
 | 
				
			||||||
			writer->writeFromAudioSampleBuffer(*sourcebuffer, 0, sourcebuffer->getNumSamples());
 | 
								writer->writeFromAudioSampleBuffer(*sourcebuffer, 0, sourcebuffer->getNumSamples());
 | 
				
			||||||
			m_capture_uuid = uid.toString();
 | 
								m_current_file = outfile;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -265,7 +265,7 @@ private:
 | 
				
			|||||||
	bool m_lastrewind = false;
 | 
						bool m_lastrewind = false;
 | 
				
			||||||
	AudioFilePreviewComponent* m_previewcomponent = nullptr;
 | 
						AudioFilePreviewComponent* m_previewcomponent = nullptr;
 | 
				
			||||||
	void saveCaptureBuffer();
 | 
						void saveCaptureBuffer();
 | 
				
			||||||
	String m_capture_uuid;
 | 
						
 | 
				
			||||||
	//==============================================================================
 | 
						//==============================================================================
 | 
				
			||||||
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
 | 
					    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user