diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch) | |
tree | 2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/tyler/tyler.cpp | |
download | tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/tyler/tyler.cpp')
-rw-r--r-- | noatun-plugins/tyler/tyler.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/noatun-plugins/tyler/tyler.cpp b/noatun-plugins/tyler/tyler.cpp new file mode 100644 index 0000000..7990ae2 --- /dev/null +++ b/noatun-plugins/tyler/tyler.cpp @@ -0,0 +1,72 @@ +// Copyright (C) 2001 Charles Samuels <charles@kde.org> +// Copyright (C) 2001 Neil Stevens <neil@qualityassistant.com> + +#include "tyler.h" + +#include <noatun/conversion.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kprocess.h> +#include <kstandarddirs.h> +#include <noatun/app.h> +#include <kdebug.h> + +extern "C" Plugin *create_plugin() +{ + KGlobal::locale()->insertCatalogue("tyler"); + return new Tyler(); +} + +const int Tyler::bufferSize = 512; + +Tyler::Tyler() + : QObject() + , StereoScope(25) + , Plugin() +{ + setSamples(bufferSize*2); + mBuffer = new char[bufferSize * 16 * 2]; +} + +Tyler::~Tyler() +{ + delete [] mBuffer; +} + +void Tyler::init() +{ + process << KStandardDirs::findExe("noatuntyler.bin"); + connect(&process, SIGNAL(processExited(KProcess *)), this, SLOT(processExited(KProcess *))); + + // Note that process.start() will fail if findExe fails, so there's no real need + // for two separate checks. + if(!process.start(KProcess::NotifyOnExit, (KProcess::Communication)(KProcess::Stdin | KProcess::Stdout))) + { + KMessageBox::error(0, i18n("Unable to start noatuntyler.bin. Check your installation.")); + unload(); + } + else + start(); + +} + +void Tyler::scopeEvent(float *left, float *right, int size) +{ + if(process.isRunning()) + { + Conversion::convertMonoFloatTo16le((unsigned long)size, right, + (unsigned char*)mBuffer); + + Conversion::convertMonoFloatTo16le((unsigned long)size, left, + ((unsigned char*)mBuffer)+bufferSize*2); + process.writeStdin((char *)mBuffer, bufferSize*2*2); + } +} + +void Tyler::processExited(KProcess *) +{ + unload(); +} + +#include "tyler.moc" |