void RecThread::run() { emit logging("<RecThread> Starting..."); emit setVolumeRange(QVariant(m_audioInfo->getMaxAmplitude())); isRun = true; // inputAudio = new QAudioInput(m_format, this); inputAudio->reset(); QDir(QDir::currentPath()).mkdir("wav"); QString fname = "wav"+QString(QDir::separator())+"record_" + QDate::currentDate().toString("dd_MM_yy") + "_" + QTime::currentTime().toString("hh_mm_ss_zzz") + ".wav"; m_audioInfo->setTmpFileName(fname); m_file = new WavPcmFile(fname, m_format, this); if(m_file->open()) { emit logging("<RecThread> Start recoding"); inputAudio->start(m_audioInfo->start(m_file)); } else { emit logging("<RecThread> Error open file"); emit logging("<RecThread> Error info: " + m_file->errorString()); } checkRecording(); }
void InputPlugin::listDllFiles() { //========================== CFileFind cFileFind; CString searchFile; BOOL found; BOOL foundMatch; // match with the ini config bool canRecord; CString temp; int i; int matchIndex; //========================== searchFile = _T(".\\*.dll"); found = cFileFind.FindFile(searchFile); foundMatch = FALSE; i = 0; matchIndex = 0; canRecord = false; if(!found) { MessageBox(_T("No valid dlls found.")); return; } while(found) { found = cFileFind.FindNextFile(); if(checkDllFile(cFileFind.GetFilePath())) { m_cboxInputPlugin.AddString(cFileFind.GetFileName()); if(cFileFind.GetFileName() == config.plugin) { m_cboxInputPlugin.SetCurSel(i); foundMatch = TRUE; matchIndex = i; canRecord = checkRecording(cFileFind.GetFilePath()); } i++; } } m_cboxInputPlugin.SetCurSel(matchIndex); m_cboxInputPlugin.GetLBText(matchIndex,temp); temp = _T(".\\") + temp; loadDll(temp); enableWindows(canRecord); }
void RecThread::checkRecording() { if(isRun){ QTimer::singleShot(1, this, SLOT(checkRecording())); return; } emit logging("<RecThread> Stop recoding"); // Stops the recording inputAudio->stop(); m_audioInfo->stop(); m_file->close(); emit needToStop(); }
void InputPlugin::OnCbnSelchangeInputPlugin() { //====================== int cursorSelection; CString file; bool validFile; bool canRecord; //====================== unloadDll(); cursorSelection = m_cboxInputPlugin.GetCurSel(); m_cboxInputPlugin.GetLBText(m_cboxInputPlugin.GetCurSel(),file); file = _T(".\\") + file; validFile = checkDllFile(file); canRecord = checkRecording(file); if(!validFile) MessageBox(_T("Invalid dll file"),_T("Error"),0); loadDll(file); enableWindows(canRecord); }