| 155 | } |
| 156 | |
| 157 | void SourceAudioManager::stopRecording() |
| 158 | { |
| 159 | { |
| 160 | ScopedLock sl(mWriterLock); |
| 161 | mIsRecording.store(false); |
| 162 | } |
| 163 | |
| 164 | mThreadedWriter.reset(); |
| 165 | mThreadedWriterDown.reset(); |
| 166 | |
| 167 | mWriterThread.stopThread(1000); |
| 168 | mWriterThreadDown.stopThread(1000); |
| 169 | |
| 170 | bool success = AudioUtils::loadAudioFile(mSourceFile, mSourceAudio, mSourceAudioSampleRate); |
| 171 | jassert(mSourceAudioSampleRate == mSampleRate); |
| 172 | |
| 173 | // Should def not happen |
| 174 | if (!success) { |
| 175 | mProcessor->clear(); |
| 176 | NativeMessageBox::showMessageBoxAsync( |
| 177 | MessageBoxIconType::NoIcon, "Could not load the recorded audio sample.", ""); |
| 178 | return; |
| 179 | } |
| 180 | |
| 181 | double dummy_sr; |
| 182 | success = AudioUtils::loadAudioFile(mRecordedFileDown, mDownsampledSourceAudio, dummy_sr); |
| 183 | jassert(dummy_sr == BASIC_PITCH_SAMPLE_RATE); |
| 184 | |
| 185 | // Should def not happen |
| 186 | if (!success) { |
| 187 | mProcessor->clear(); |
| 188 | NativeMessageBox::showMessageBoxAsync( |
| 189 | MessageBoxIconType::NoIcon, "Could not load the recorded audio sample.", ""); |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | auto& tree = mProcessor->getValueTree(); |
| 194 | tree.setPropertyExcludingListener(this, NnId::SourceAudioNativeSrPathId, mSourceFile.getFullPathName(), nullptr); |
| 195 | |
| 196 | mProcessor->getTranscriptionManager()->setLaunchNewTranscription(); |
| 197 | } |
| 198 | |
| 199 | bool SourceAudioManager::onFileDrop(const File& inFile) |
| 200 | { |
no test coverage detected