Skip to content
Snippets Groups Projects
Commit ebe1c35e authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Added commandline option to set dump path for audio data

- raw audio data to analyze it further with 'Nootini'
parent 21017f7f
No related branches found
No related tags found
No related merge requests found
Pipeline #3125 skipped
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
// #include "tmidiout.h" // #include "tmidiout.h"
#include "trtaudioout.h" #include "trtaudioout.h"
#include "trtaudioin.h" #include "trtaudioin.h"
#include <QtCore/qfileinfo.h>
#endif #endif
#include <tnootkaqml.h> #include <tnootkaqml.h>
#include "ttickcolors.h" #include "ttickcolors.h"
...@@ -75,6 +76,10 @@ Tsound::~Tsound() ...@@ -75,6 +76,10 @@ Tsound::~Tsound()
deleteSniffer(); deleteSniffer();
deletePlayer(); deletePlayer();
m_instance = nullptr; m_instance = nullptr;
#if !defined (Q_OS_ANDROID)
if (!m_dumpPath.isEmpty())
GLOB->A->dumpPath.clear();
#endif
} }
//################################################################################################# //#################################################################################################
...@@ -538,6 +543,15 @@ void Tsound::setTouchHandling(bool th) { ...@@ -538,6 +543,15 @@ void Tsound::setTouchHandling(bool th) {
#if !defined (Q_OS_ANDROID) #if !defined (Q_OS_ANDROID)
void Tsound::changeDumpPath(const QString& path) {
if (QFileInfo(path).exists()) {
m_dumpPath = path;
GLOB->A->dumpPath = path;
} else
qDebug() << "[Tsound] dump path" << path << "does not exist!";
}
void Tsound::setDumpFileName(const QString& fName) { void Tsound::setDumpFileName(const QString& fName) {
if (sniffer && !GLOB->A->dumpPath.isEmpty()) if (sniffer && !GLOB->A->dumpPath.isEmpty())
sniffer->setDumpFileName(fName); sniffer->setDumpFileName(fName);
......
...@@ -216,6 +216,13 @@ public: ...@@ -216,6 +216,13 @@ public:
Q_INVOKABLE void setVol(int v); Q_INVOKABLE void setVol(int v);
Q_INVOKABLE void setTouchHandling(bool th); Q_INVOKABLE void setTouchHandling(bool th);
#else #else
/**
* This method handles command line option.
* If set, it will clear out dump path of Nootka settings,
* of course, only if the path was set there.
* But command line path will not be stored in settings.
*/
void changeDumpPath(const QString& path);
void setDumpFileName(const QString& fName); void setDumpFileName(const QString& fName);
#endif #endif
...@@ -276,6 +283,8 @@ private: ...@@ -276,6 +283,8 @@ private:
#if defined (Q_OS_ANDROID) #if defined (Q_OS_ANDROID)
int m_maxVol; /**< Maximal volume of Android device */ int m_maxVol; /**< Maximal volume of Android device */
int m_currVol; /**< Current volume of Android device */ int m_currVol; /**< Current volume of Android device */
#else
QString m_dumpPath;
#endif #endif
private: private:
......
...@@ -246,6 +246,11 @@ int main(int argc, char *argv[]) ...@@ -246,6 +246,11 @@ int main(int argc, char *argv[])
if (argc > 1) { if (argc > 1) {
QCommandLineParser cmd; QCommandLineParser cmd;
auto helpOpt = cmd.addHelpOption(); auto helpOpt = cmd.addHelpOption();
QCommandLineOption dumpOpt(QStringList() << QStringLiteral("dump-dir") << QStringLiteral("d"),
QStringLiteral("Full path to directory where audio data used to pitch detection will be dumped.\n"
"Dumped files can be further analyzed with 'nootini' option.\n"),
QStringLiteral("existing dir"));
cmd.addOption(dumpOpt);
QCommandLineOption nootiniOpt(QStringList() << QStringLiteral("nootini") << QStringLiteral("n"), QCommandLineOption nootiniOpt(QStringList() << QStringLiteral("nootini") << QStringLiteral("n"),
QStringLiteral("Launch Nootka in audio analyze mode. Nootini: (Nootka + Tartini)\n")); QStringLiteral("Launch Nootka in audio analyze mode. Nootini: (Nootka + Tartini)\n"));
cmd.addOption(nootiniOpt); cmd.addOption(nootiniOpt);
...@@ -273,7 +278,9 @@ int main(int argc, char *argv[]) ...@@ -273,7 +278,9 @@ int main(int argc, char *argv[])
if (cmd.isSet(helpOpt)) if (cmd.isSet(helpOpt))
cmd.showHelp(); cmd.showHelp();
if (cmd.isSet(nootiniOpt)) { if (cmd.isSet(dumpOpt))
SOUND->changeDumpPath(cmd.value(dumpOpt));
else if (cmd.isSet(nootiniOpt)) {
qmlRegisterType<TaudioAnalyzeItem>("Nootka.Main", 1, 0, "TaudioAnalyzeItem"); qmlRegisterType<TaudioAnalyzeItem>("Nootka.Main", 1, 0, "TaudioAnalyzeItem");
QMetaObject::invokeMethod(e->rootObjects().first(), "audioAnalyze"); QMetaObject::invokeMethod(e->rootObjects().first(), "audioAnalyze");
if (cmd.isSet(instrOpt)) { if (cmd.isSet(instrOpt)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment