Mercurial > hg > easaier-soundaccess
changeset 276:a9af42a93073
New property box for time stretching
some labels updated
author | benoitrigolleau |
---|---|
date | Wed, 15 Oct 2008 16:18:18 +0000 |
parents | acfbbd2fea47 |
children | 960531792d88 |
files | base/PropertyContainer.cpp base/PropertyContainer.h data/fileio/SparqlResultsReader.cpp data/fileio/SparqlResultsReader.h data/svdata.vcproj sv/filter/EqualizerFilter.cpp sv/filter/TimeStretchFilter.cpp sv/filter/TimeStretchFilter.h sv/main/EasaierSessionManager.cpp sv/main/MainWindow.cpp sv/main/MainWindow.h widgets/LabelForTimeStrechFilter.cpp widgets/LabelForTimeStrechFilter.h widgets/PropertyBox.cpp widgets/QueryResultsWidget.cpp widgets/QueryResultsWidget.h widgets/SpeechRecognitionUI.cpp widgets/svwidgets.vcproj |
diffstat | 18 files changed, 397 insertions(+), 275 deletions(-) [+] |
line wrap: on
line diff
--- a/base/PropertyContainer.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/base/PropertyContainer.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -165,6 +165,7 @@ break; case RangeProperty: + case RangePropertyWithLabel: if (isDouble) { RangeMapper *mapper = getNewPropertyRangeMapper(name); if (mapper) { @@ -175,6 +176,7 @@ } break; + case ValueProperty: { int min, max;
--- a/base/PropertyContainer.h Thu Jul 03 10:17:46 2008 +0000 +++ b/base/PropertyContainer.h Wed Oct 15 16:18:18 2008 +0000 @@ -40,6 +40,7 @@ enum PropertyType { ToggleProperty, // on or off RangeProperty, // range of integers + RangePropertyWithLabel, // range of integers ValueProperty, // range of integers given string labels ColourProperty, // colours, get/set as qRgb UnitsProperty, // unit from UnitDatabase, get/set unit id
--- a/data/fileio/SparqlResultsReader.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/data/fileio/SparqlResultsReader.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -15,16 +15,17 @@ #include <iostream> -SparqlResultsReader::SparqlResultsReader(QueryResultsWidget* resultsWidget) : - m_resultsWidget(resultsWidget) -{} +SparqlResultsReader::SparqlResultsReader() +{ + m_handler = new SparqlResultsHandler; +} bool SparqlResultsReader::parse(const QString & filename) { - SparqlResultsHandler handler(m_resultsWidget); QXmlSimpleReader reader; - reader.setContentHandler(&handler); - reader.setErrorHandler(&handler); + + reader.setContentHandler(m_handler); + reader.setErrorHandler(m_handler); QFile file(filename); @@ -35,143 +36,13 @@ QXmlInputSource xmlInputSource(&file); if (reader.parse(xmlInputSource)) { - m_resultsWidget->displayResult(); return true; } return false; } -SparqlResultsHandler::SparqlResultsHandler(QueryResultsWidget* resultsWidget) : QXmlDefaultHandler(), - m_resultsWidget(resultsWidget), - m_inBinding(false), - m_curBindingName("") -{} - -bool SparqlResultsHandler::startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes) -{ - - QString name = qName.toLower(); - - bool ok = false; - - // Valid element names: - // - // sparql - // head - // variable - // results - // result - // binding - - if (name == "sparql") { - - // nothing needed - ok = true; - - } else if (name == "head") { - - // nothing needed - ok = true; - - } else if (name == "variable") { - - // nothing needed - ok = true; - - } else if (name == "results") { - - // nothing needed - ok = true; - - } else if (name == "result") { - - m_resultsWidget->newResult(); - ok = true; - - } else if (name == "binding") { - - m_curBindingName = attributes.value("name"); - ok = true; - - } else if ( (name == "uri") || (name == "literal") ) { - m_inBinding = true; - ok = true; - } - - if (!ok) { - std::cerr << "WARNING: SparqlResultsHandler-XML: Failed to completely process element \"" - << name.toLocal8Bit().data() << "\"" << std::endl; - } - - return true; +SparqlResultsHandler* SparqlResultsReader::getHandler(){ + return m_handler; } -bool SparqlResultsHandler::endElement(const QString &namespaceURI, const QString &localName, - const QString &qName) -{ - QString name = qName.toLower(); - - if ( (name == "uri") || (name == "literal") ) - { - m_inBinding = false; - m_curBindingName = ""; - - } else if (name == "result") - { - /*m_resultsWidget->addInfo("composer", m_composer); - m_resultsWidget->addInfo("arranger", m_arranger); - m_composer.clear(); - m_arranger.clear(); - m_composer.append(" -"); - m_arranger.append(" -");*/ - - m_resultsWidget->saveCurResult(); - } - - return true; -} - -bool SparqlResultsHandler::characters(const QString &str) -{ - if (m_inBinding) - { - /*if (m_curBindingName.contains("composer")) - { - m_composer.append(" " + str); - } - else if (m_curBindingName.contains("arranger")) - { - m_arranger.append(" " + str); - } - else - {*/ - m_resultsWidget->addInfo(m_curBindingName, str); - //} - } - - return true; -} - -bool SparqlResultsHandler::error(const QXmlParseException &exception) -{ - QString errorString; - errorString += QString("ERROR: SparqlResultsHandler-XML: %1 at line %2, column %3") - .arg(exception.message()) - .arg(exception.lineNumber()) - .arg(exception.columnNumber()); - std::cerr << errorString.toLocal8Bit().data() << std::endl; - return QXmlDefaultHandler::error(exception); -} - -bool SparqlResultsHandler::fatalError(const QXmlParseException &exception) -{ - QString errorString; - errorString += QString("FATAL ERROR: SparqlResultsHandler-XML: %1 at line %2, column %3") - .arg(exception.message()) - .arg(exception.lineNumber()) - .arg(exception.columnNumber()); - std::cerr << errorString.toLocal8Bit().data() << std::endl; - return QXmlDefaultHandler::fatalError(exception); -}
--- a/data/fileio/SparqlResultsReader.h Thu Jul 03 10:17:46 2008 +0000 +++ b/data/fileio/SparqlResultsReader.h Wed Oct 15 16:18:18 2008 +0000 @@ -15,45 +15,21 @@ #define _SPARQL_RESULTS_READER_H_ #include <QXmlDefaultHandler> - -#include "widgets/QueryResultsWidget.h" +#include "SparqlResultsHandler.h" class SparqlResultsReader { public: - SparqlResultsReader(QueryResultsWidget* resultsWidget); + SparqlResultsReader(); virtual ~SparqlResultsReader(){} bool parse(const QString & filename); + + SparqlResultsHandler* getHandler(); -private: - - QueryResultsWidget *m_resultsWidget; +protected : + SparqlResultsHandler* m_handler; }; -class SparqlResultsHandler : public QXmlDefaultHandler -{ -public: - SparqlResultsHandler(QueryResultsWidget* resultsWidget); - - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, const QString &localName, - const QString &qName); - bool characters(const QString &str); - bool error(const QXmlParseException &exception); - bool fatalError(const QXmlParseException &exception); - - -private: - - QueryResultsWidget *m_resultsWidget; - - bool m_inBinding; - QString m_curBindingName; - - QString m_composer; - QString m_arranger; -}; #endif
--- a/data/svdata.vcproj Thu Jul 03 10:17:46 2008 +0000 +++ b/data/svdata.vcproj Wed Oct 15 16:18:18 2008 +0000 @@ -320,6 +320,10 @@ > </File> <File + RelativePath=".\fileio\FileParserThread.cpp" + > + </File> + <File RelativePath="fileio\FileReadThread.cpp" > </File> @@ -392,6 +396,10 @@ > </File> <File + RelativePath=".\fileio\SparqlResultsHandler.cpp" + > + </File> + <File RelativePath=".\fileio\SparqlResultsReader.cpp" > </File> @@ -507,6 +515,39 @@ <File RelativePath=".\fileio\SparqlResultsReader.h" > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine="" + AdditionalDependencies="" + Outputs="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine="" + AdditionalDependencies="" + Outputs="" + /> + </FileConfiguration> + <FileConfiguration + Name="Static_Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="" + CommandLine="" + AdditionalDependencies="" + Outputs="" + /> + </FileConfiguration> </File> <File RelativePath="model\SparseModel.h" @@ -881,6 +922,43 @@ </FileConfiguration> </File> <File + RelativePath=".\fileio\FileParserThread.h" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DBUILD_DEBUG -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Static_Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_STATIC -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + </File> + <File RelativePath=".\fileio\FileReadThread.h" > <FileConfiguration @@ -1251,6 +1329,21 @@ </FileConfiguration> </File> <File + RelativePath=".\fileio\SparqlResultsHandler.h" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DBUILD_DEBUG -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + </File> + <File RelativePath=".\model\WaveFileModel.h" > <FileConfiguration @@ -1367,6 +1460,10 @@ > </File> <File + RelativePath=".\tmp_moc\moc_FileParserThread.cpp" + > + </File> + <File RelativePath="tmp_moc\moc_FileReadThread.cpp" > </File> @@ -1407,6 +1504,10 @@ > </File> <File + RelativePath=".\tmp_moc\moc_SparqlResultsHandler.cpp" + > + </File> + <File RelativePath="tmp_moc\moc_WaveFileModel.cpp" > </File>
--- a/sv/filter/EqualizerFilter.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/sv/filter/EqualizerFilter.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -39,7 +39,7 @@ m_gainband[i] = 0; } - setObjectName("Equalizer"); + setObjectName("Audio Equalizer"); m_curve = (float *) calloc(m_resolution, sizeof(float));
--- a/sv/filter/TimeStretchFilter.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/sv/filter/TimeStretchFilter.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -33,6 +33,7 @@ TimeStretchFilter::TimeStretchFilter() : PropertyContainer(), m_transcheck(true), m_peakcheck(false), + m_freezecheck(false), m_interpfactor(1), m_tmaxfactor(2), m_pmaxfactor(2) @@ -62,6 +63,7 @@ list.push_back("Enable"); list.push_back("Transdetect"); list.push_back("Peaklock"); + list.push_back("TimeFreeze"); return list; } @@ -72,16 +74,18 @@ //if (name == "Bypass") return tr("Bypass Processing"); if (name == "Transdetect") return tr("Transient Detection"); if (name == "Peaklock") return tr("Peak Locking"); + if (name == "TimeFreeze") return tr("Time Freeze"); return ""; } TimeStretchFilter::PropertyType TimeStretchFilter::getPropertyType(const PropertyName &name) const { - if (name == "Time") return RangeProperty; - if (name == "Pitch") return RangeProperty; + if (name == "Time") return RangePropertyWithLabel; + if (name == "Pitch") return RangePropertyWithLabel; if (name == "Enable") return InvalidProperty; if (name == "Transdetect") return ToggleProperty; if (name == "Peaklock") return ToggleProperty; + if (name == "TimeFreeze") return ToggleProperty; return InvalidProperty; } @@ -92,27 +96,17 @@ int val = 0; if (name == "Time") { - if (min) *min = -100; - if (max) *max = 100; - if (deflt) *deflt = 0; - if (hopfactor > 1) - val = (hopfactor-1)/(m_tmaxfactor-1)*100.0; - else if (hopfactor < 1) - val = (1/hopfactor - 1)*(1-m_tmaxfactor)*100.0; - else if (hopfactor == 1) - val = 0; + if (min) *min = 50; + if (max) *max = 200; + if (deflt) *deflt = 100; + val = hopfactor*100.0; } if (name == "Pitch") { - if (min) *min = -100; - if (max) *max = 100; - if (deflt) *deflt = 0; - if (m_interpfactor > 1) - val = (m_interpfactor-1)/(m_pmaxfactor-1)*100.0; - else if (m_interpfactor < 1) - val = (1/m_interpfactor - 1)*(1-m_pmaxfactor)*100.0; - else if (m_interpfactor == 1) - val = 0; + if (min) *min = 50; + if (max) *max = 200; + if (deflt) *deflt = 100; + val = m_interpfactor*100.0; } if (name == "Enable") { @@ -129,6 +123,10 @@ if (deflt) *deflt = 0; val = (m_peakcheck ? 1 : 0); } + if (name == "TimeFreeze") { + if (deflt) *deflt = 0; + val = (m_freezecheck ? 1 : 0); + } #ifdef DEBUG_FILTERS std::cerr << "TimeStretchFilter::getPropertyRangeAndValue = " << val << std::endl; #endif @@ -150,28 +148,12 @@ void TimeStretchFilter::setProperty(const PropertyName &name, int value) { if (name == "Time") { - if (value > 0){ - hopfactor=1.0+((m_tmaxfactor-1)*(((float)value)/100.0)); - } - if (value < 0){ - hopfactor=1.0/(1.0+((m_tmaxfactor-1)*(-((float)value)/100.0))); - } - if(value == 0){ - hopfactor=1; - } + hopfactor = ((float)value)/100.0; if (isEnabled()) emit playSpeedChanged(hopfactor); } else if (name == "Pitch") { - if (value > 0){ - m_interpfactor=1.0+((m_pmaxfactor-1)*(((float)value)/100.0)); - } - if (value < 0){ - m_interpfactor=1.0/(1.0+((m_pmaxfactor-1)*(-((float)value)/100.0))); - } - if(value == 0){ - m_interpfactor=1; - } + m_interpfactor = ((float)value)/100.0; } else if (name == "Enable"){ if (value > 0) { @@ -186,6 +168,8 @@ m_transcheck = (value > 0) ? true : false; } else if (name == "Peaklock"){ m_peakcheck = (value > 0) ? true : false; + } else if (name == "TimeFreeze"){ + m_freezecheck = (value > 0) ? true : false; } #ifdef DEBUG_FILTERS std::cerr << "TimeStretchFilter::hopfactor = " << hopfactor << std::endl;
--- a/sv/filter/TimeStretchFilter.h Thu Jul 03 10:17:46 2008 +0000 +++ b/sv/filter/TimeStretchFilter.h Wed Oct 15 16:18:18 2008 +0000 @@ -49,6 +49,8 @@ inline bool bypass() {return !m_enabled;} inline bool transcheck() {return m_transcheck;} inline bool peakcheck() {return m_peakcheck;} + inline bool freezecheck() {return m_freezecheck;} + inline bool isEnabled() {return m_enabled;} @@ -66,6 +68,7 @@ bool m_transcheck; bool m_peakcheck; + bool m_freezecheck; float m_tmaxfactor; float m_pmaxfactor;
--- a/sv/main/EasaierSessionManager.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/sv/main/EasaierSessionManager.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -43,6 +43,8 @@ #include "widgets/SpeechFileHandler.h" #include <QMessageBox> +#include "data/fileio/FileParserThread.h" + EasaierSessionManager::EasaierSessionManager(HttpClient* httpClient) : QObject(), m_fileName(""), m_httpClient(httpClient), @@ -347,14 +349,22 @@ } case LoadedFile::QUERY_RESULTS : { - QueryResultsWidget* resultsWidget = MainWindow::instance()->getQueryResultsWidget(); + /*QueryResultsWidget* resultsWidget = MainWindow::instance()->getQueryResultsWidget(); resultsWidget->reset(); if (resultsWidget) { - SparqlResultsReader reader(resultsWidget); - read = reader.parse(filename); - } + SparqlResultsReader rd; + connect(rd.getHandler(), SIGNAL(newResultDetected ()), MainWindow::instance(),SLOT(createNewResultItem()),Qt::QueuedConnection); + connect(rd.getHandler(), SIGNAL(newInfoResultDetected(QString,QString)), MainWindow::instance(),SLOT(addInfoIntoResultItem(QString,QString)),Qt::QueuedConnection); + connect(rd.getHandler(), SIGNAL(endOfResultDetected ()), MainWindow::instance(),SLOT(saveCurrentResultItem()),Qt::QueuedConnection); //Qt::DirectConnection + connect(rd.getHandler(), SIGNAL(endOfDocumentDetected ()), MainWindow::instance(),SLOT(displayResultList()),Qt::QueuedConnection); + + read = rd.parse(filename); + }*/ + FileParserThread *myThread = new FileParserThread(filename); + myThread->start(); + read = true; break; } case LoadedFile::RELATED_MEDIA_LIST : @@ -649,5 +659,4 @@ QApplication::setOverrideCursor( Qt::WaitCursor ); loadFile(*payload, filename, LoadedFile::VOCAL_QUERY, postFilePath); - } \ No newline at end of file
--- a/sv/main/MainWindow.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/sv/main/MainWindow.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -300,7 +300,7 @@ m_toolBox->addItem("Layers", new QWidget); m_filterPropertyStack = new RealTimeFilterPropertyStack(); - m_toolBox->addItem("Real-time filters",m_filterPropertyStack); + m_toolBox->addItem("Real-time Audio Tools",m_filterPropertyStack); connect(m_filterPropertyStack, SIGNAL(contextHelpChanged(const QString &)), this, SLOT(contextHelpChanged(const QString &))); @@ -5538,6 +5538,7 @@ } m_qtabwidget->setCurrentIndex(Info); + emit (addAudioSourceInfo(info)); } void MainWindow::queryDatabase() @@ -5587,6 +5588,7 @@ void MainWindow::setSDLInitSize(int w, int h){ m_sdlWidget->setInitSize(w,h); } + void MainWindow::audioFileLoaded() { if (m_curSender) @@ -5613,3 +5615,23 @@ { return getMainModel()->getSampleRate(); } + +void MainWindow::createNewResultItem(){ + m_resultsWidget->newResult(); +} + +void MainWindow::addInfoIntoResultItem(QString curBindingName,QString str){ + m_resultsWidget->addInfo(curBindingName, str); +} + +void MainWindow::saveCurrentResultItem(){ + m_resultsWidget->saveCurResult(); +} + +void MainWindow::displayResultList(){ + m_resultsWidget->displayResult(); +} + +Document* MainWindow::getDocument(){ + return m_document; +} \ No newline at end of file
--- a/sv/main/MainWindow.h Thu Jul 03 10:17:46 2008 +0000 +++ b/sv/main/MainWindow.h Wed Oct 15 16:18:18 2008 +0000 @@ -110,6 +110,7 @@ SpeechRecognitionUI* getSpeechRecognitionUI(); + Document* getDocument(); FileOpenStatus openSomeFile(QString path, AudioFileOpenMode = AskUser); FileOpenStatus openAudioFile(QString path, AudioFileOpenMode = AskUser); @@ -172,9 +173,14 @@ void canPlaySelection(bool); void canSave(bool); void newCurrentPane(Pane *pane); + void addAudioSourceInfo(AudioSourceInfoModel *); public slots: //void preferenceChanged(PropertyContainer::PropertyName); + void createNewResultItem(); + void addInfoIntoResultItem(QString,QString); + void saveCurrentResultItem(); + void displayResultList(); protected slots: void openSpeechQuery(); @@ -328,6 +334,8 @@ void lockWindow(); void unlockWindow(); + + protected: SpeechRecognitionUI *m_speechRecognitionUI; WaitingWidget *m_waitwidget;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/LabelForTimeStrechFilter.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -0,0 +1,49 @@ +#include "LabelForTimeStrechFilter.h" +#include "../sv/main/MainWindow.h" +#include <cmath> + + +LabelForTimeStrechFilter::LabelForTimeStrechFilter(QWidget *parent){ + m_audioSourceInfoModel=0; + MainWindow *mainW = MainWindow::instance(); + connect(mainW, SIGNAL(addAudioSourceInfo(AudioSourceInfoModel *)), + this, SLOT(audioSourceInfoAdded(AudioSourceInfoModel *))); + +} + +LabelForTimeStrechFilter::~LabelForTimeStrechFilter(){ + +} + +void LabelForTimeStrechFilter::setType(int type){ + m_type = type; +} + +void LabelForTimeStrechFilter::setValue(int value){ + float val = (float)value; + QString text; + + if(m_type==0){ + text = "N/A"; + if(m_audioSourceInfoModel!=0){ + QStringList *list = m_audioSourceInfoModel->getInfo("bpm"); + if(list!=0 && list->size()>0){ + float tempo = list->at(0).toFloat(); + val = tempo*(val/100.0); + text= QString::number((int)(val+0.5)); + } + } + } + else if(m_type==1){ + val = (log(val/100.0)/log(2.0))/0.08333333; + text = QString::number(val); + } + + QLabel::setText(text); + m_oldValue = value; +} + +void LabelForTimeStrechFilter::audioSourceInfoAdded(AudioSourceInfoModel * audioModel){ + m_audioSourceInfoModel = audioModel; + setValue(m_oldValue); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/LabelForTimeStrechFilter.h Wed Oct 15 16:18:18 2008 +0000 @@ -0,0 +1,28 @@ +#ifndef LABEL_FOR_TIME_STRECH_FILTER_H +#define LABEL_FOR_TIME_STRECH_FILTER_H + +#include <QLabel> +#include "../sv/main/MainWindow.h" + +class LabelForTimeStrechFilter : public QLabel +{ + Q_OBJECT + +public: + LabelForTimeStrechFilter(QWidget *parent=0); + ~LabelForTimeStrechFilter(); + void setType(int); + +public slots: + void setValue(int); + void audioSourceInfoAdded(AudioSourceInfoModel *); + +private : + int m_type; + AudioSourceInfoModel *m_audioSourceInfoModel; + int m_oldValue; + +}; + + +#endif \ No newline at end of file
--- a/widgets/PropertyBox.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/widgets/PropertyBox.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -38,6 +38,8 @@ #include "NotifyingComboBox.h" #include "Plotter.h" +#include "LabelForTimeStrechFilter.h" + #include <QGridLayout> #include <QHBoxLayout> #include <QVBoxLayout> @@ -45,6 +47,9 @@ #include <QLabel> #include <QFrame> #include <QApplication> +#include <QSpinBox> +#include <QLCDNumber> + #include <cassert> #include <iostream> @@ -408,6 +413,7 @@ break; }*/ case PropertyContainer::RangeProperty: + case PropertyContainer::RangePropertyWithLabel: { Slider *slider; @@ -445,6 +451,25 @@ slider->setFixedHeight(32); m_layout->addWidget(slider, row, 1); } + //HoTFIX to add a dynamique label for the TimeStrechFilter + if(type==PropertyContainer::RangePropertyWithLabel){ + if(propertyLabel=="Time"){ + m_layout->addWidget(new QLabel("% "), row, 2); + m_layout->addWidget(new QLabel(tr("Tempo")), row, 3); + LabelForTimeStrechFilter* lab = new LabelForTimeStrechFilter(); + lab->setType(0); + connect(slider,SIGNAL(valueChanged(int)),lab,SLOT(setValue(int))); + m_layout->addWidget(lab,row,4); + }else if(propertyLabel=="Pitch"){ + m_layout->addWidget(new QLabel("% "), row, 2); + m_layout->addWidget(new QLabel(tr("Semitones")), row, 3); + LabelForTimeStrechFilter* lab = new LabelForTimeStrechFilter(); + lab->setType(1); + connect(slider,SIGNAL(valueChanged(int)),lab,SLOT(setValue(int))); + m_layout->addWidget(lab,row,4); + } + } + // </HoTFIX> m_propertyControllers[name] = slider; }
--- a/widgets/QueryResultsWidget.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/widgets/QueryResultsWidget.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -21,8 +21,11 @@ #include "sv/main/MainWindow.h" +#include <windows.h> + int rank = 1; + QueryResultsWidget::QueryResultsWidget() : QWidget(), m_currentRow(0) { @@ -41,6 +44,8 @@ mainLayout->addWidget(m_scrollArea); setLayout(mainLayout); + + connect(this,SIGNAL(pleaseAddResult(QString,QString,QString,int,QString)),this,SLOT(addResultWidget(QString,QString,QString,int,QString))); } QueryResultsWidget::~QueryResultsWidget() @@ -106,66 +111,55 @@ void QueryResultsWidget::saveCurResult() { - m_allresults.push_back(m_curResult); + //m_currentRow = 0; + int type = 0; + + std::vector<Info>::iterator iterOnInfo; + QString author = ""; + QString title = ""; + QString uri = ""; + QString confidence = "1"; + + for (iterOnInfo = (*m_curResult).begin(); iterOnInfo != (*m_curResult).end(); iterOnInfo++) + { + if ((*iterOnInfo).name == "signal") + { + uri = (*iterOnInfo).value; + //uri = uri.right(uri.length() - uri.lastIndexOf("#") - 1); + } + } + + for (iterOnInfo = (*m_curResult).begin(); iterOnInfo != (*m_curResult).end(); iterOnInfo++) + { + if ((*iterOnInfo).name != "signal") + { + //if((*iterOnInfo).name == "composer"){ + if((*iterOnInfo).name == "author"){ + author = (*iterOnInfo).value; + } + //if ((*iterOnInfo).name == "performance_title") + if ((*iterOnInfo).name == "title") + { + title += (*iterOnInfo).value; + } + if ((*iterOnInfo).name == "confidence") + { + confidence = (*iterOnInfo).value; + } + } + } + + //Sleep(5000); + //emit pleaseAddResult(author,title,uri,type,confidence); + addResultWidget(author,title,uri,type,confidence); + + m_currentRow=m_currentRow+3; + rank++; m_curResult = new std::vector<Info>; - } void QueryResultsWidget::displayResult() { - m_currentRow = 0; - rank = 1; - addTop(); - int type = 0; - - std::vector<std::vector<Info>*>::iterator iterOnResults; - int size = m_allresults.size(); - - for (iterOnResults = m_allresults.begin(); iterOnResults != m_allresults.end();iterOnResults++) - { - std::vector<Info>* onInfo = *iterOnResults; - std::vector<Info>::iterator iterOnInfo; - QString author = ""; - QString title = ""; - QString uri = ""; - QString confidence = "1"; - - for (iterOnInfo = (*onInfo).begin(); iterOnInfo != (*onInfo).end(); iterOnInfo++) - { - if ((*iterOnInfo).name == "signal") - { - uri = (*iterOnInfo).value; - //uri = uri.right(uri.length() - uri.lastIndexOf("#") - 1); - } - } - - for (iterOnInfo = (*onInfo).begin(); iterOnInfo != (*onInfo).end(); iterOnInfo++) - { - if ((*iterOnInfo).name != "signal") - { - //if((*iterOnInfo).name == "composer"){ - if((*iterOnInfo).name == "author"){ - author = (*iterOnInfo).value; - } - //if ((*iterOnInfo).name == "performance_title") - if ((*iterOnInfo).name == "title") - { - title += (*iterOnInfo).value; - } - if ((*iterOnInfo).name == "confidence") - { - confidence = (*iterOnInfo).value; - } - } - } - if (author == "Django") - type = 2; - addResultWidget(author,title,uri,type,confidence); - m_currentRow=m_currentRow+3; - rank++; - - } - addFoot(); } @@ -180,7 +174,7 @@ //add the type QLabel *labelIcon = new QLabel(); labelIcon->setMaximumWidth(25); - labelIcon->setMinimumWidth(25); + labelIcon->setMinimumWidth(25);// QString pixmapName; switch(type){ case 0: @@ -274,6 +268,7 @@ hLine->setMinimumHeight(1); m_resultsLayout->setRowMinimumHeight(m_currentRow+2,1); m_resultsLayout->addWidget(hLine,m_currentRow+2,1,1,12); + }
--- a/widgets/QueryResultsWidget.h Thu Jul 03 10:17:46 2008 +0000 +++ b/widgets/QueryResultsWidget.h Wed Oct 15 16:18:18 2008 +0000 @@ -34,13 +34,18 @@ void reset(); +signals : + void pleaseAddResult(QString,QString,QString,int,QString); + +protected slots : + void addResultWidget(QString author,QString title, QString uri, int type, QString confidence); + + protected: void addTop(); void addFoot(); - void addResultWidget(QString author,QString title, QString uri, int type, QString confidence); - - + QScrollArea * m_scrollArea; QGridLayout *m_resultsLayout; @@ -56,5 +61,4 @@ }; - #endif \ No newline at end of file
--- a/widgets/SpeechRecognitionUI.cpp Thu Jul 03 10:17:46 2008 +0000 +++ b/widgets/SpeechRecognitionUI.cpp Wed Oct 15 16:18:18 2008 +0000 @@ -10,7 +10,6 @@ - SpeechRecognitionUI::SpeechRecognitionUI(QWidget *parent) : QWidget(parent){ _audioRecorder = new AudioRecording();
--- a/widgets/svwidgets.vcproj Thu Jul 03 10:17:46 2008 +0000 +++ b/widgets/svwidgets.vcproj Wed Oct 15 16:18:18 2008 +0000 @@ -320,6 +320,10 @@ > </File> <File + RelativePath=".\LabelForTimeStrechFilter.cpp" + > + </File> + <File RelativePath="LayerTree.cpp" > </File> @@ -617,7 +621,7 @@ <Tool Name="VCCustomBuildTool" Description="MOC $(InputFileName)" - CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_STATIC -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_STATIC -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp
" AdditionalDependencies="$(QTDIR)\bin\moc.exe" Outputs="tmp_moc\moc_$(InputName).cpp" /> @@ -1105,6 +1109,43 @@ </FileConfiguration> </File> <File + RelativePath=".\LabelForTimeStrechFilter.h" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DBUILD_DEBUG -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Static_Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC $(InputFileName)" + CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_STATIC -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtCore" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtGui" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include\QtXml" -I "$(QTDIR)\include" -I "." -I ".." -I "$(QTDIR)\include\ActiveQt" -I "tmp_moc" -I "." -I"$(QTDIR)\mkspecs\win32-msvc2005" $(InputPath) -o tmp_moc\moc_$(InputName).cpp" + AdditionalDependencies="$(QTDIR)\bin\moc.exe" + Outputs="tmp_moc\moc_$(InputName).cpp" + /> + </FileConfiguration> + </File> + <File RelativePath="LayerTree.h" > <FileConfiguration @@ -2498,6 +2539,10 @@ > </File> <File + RelativePath=".\tmp_moc\moc_LabelForTimeStrechFilter.cpp" + > + </File> + <File RelativePath="tmp_moc\moc_LayerTree.cpp" > </File>