summaryrefslogtreecommitdiffstats
path: root/kttsd/players/akodeplayer
diff options
context:
space:
mode:
Diffstat (limited to 'kttsd/players/akodeplayer')
-rw-r--r--kttsd/players/akodeplayer/Makefile.am28
-rw-r--r--kttsd/players/akodeplayer/README19
-rw-r--r--kttsd/players/akodeplayer/akodeplayer.cpp179
-rw-r--r--kttsd/players/akodeplayer/akodeplayer.h67
-rw-r--r--kttsd/players/akodeplayer/akodeplugin.cpp29
-rw-r--r--kttsd/players/akodeplayer/kttsd_akodeplugin.desktop89
6 files changed, 411 insertions, 0 deletions
diff --git a/kttsd/players/akodeplayer/Makefile.am b/kttsd/players/akodeplayer/Makefile.am
new file mode 100644
index 0000000..f5039f6
--- /dev/null
+++ b/kttsd/players/akodeplayer/Makefile.am
@@ -0,0 +1,28 @@
+INCLUDES = \
+ -I$(top_srcdir)/kttsd/libkttsd -I$(top_builddir)/kttsd/libkttsd \
+ $(akode_includes) \
+ $(all_includes)
+
+# Let automoc handle all of the metsource files (moc).
+METASOURCES = AUTO
+
+#########################################################################
+# LIBRARY SECTION
+#########################################################################
+# This is the library that gets installed. It's name is used for all
+# of the other Makefile.am variables.
+kde_module_LTLIBRARIES = libkttsd_akodeplugin.la
+
+libkttsd_akodeplugin_la_SOURCES = \
+ akodeplugin.cpp \
+ akodeplayer.cpp
+libkttsd_akodeplugin_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries) -no-undefined
+libkttsd_akodeplugin_la_LIBADD = $(top_builddir)/kttsd/libkttsd/libkttsd.la $(akode_libs)
+
+# Header files that should not be installed.
+noinst_HEADERS = \
+ akodeplayer.h
+
+# This library is installed as a plugin.
+services_DATA = kttsd_akodeplugin.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/kttsd/players/akodeplayer/README b/kttsd/players/akodeplayer/README
new file mode 100644
index 0000000..a45864f
--- /dev/null
+++ b/kttsd/players/akodeplayer/README
@@ -0,0 +1,19 @@
+This is an aKode audio plugin for KTTS.
+
+There are two problems right now (19 Jun 2005) that prevent this from being usable
+for KTTS:
+
+1. There was a bug in aKode that prevents it from playing .wav files. Carewolf
+ applied a patch on 13 Jun 2005 to decoderpluginhandler.cpp for this,
+ so you may need to update your kdemultimedia modules.
+
+2. aKode doesn't instantly stop when calling pause() or stop().
+ See bug:107135.
+
+If you want to try this plugin, add --enable-kttsd-akode to ./configure command.
+
+If the problems above aren't addressed, this plugin should probably be removed
+from KTTS.
+
+-- Gary Cramblitt (PhantomsDad)
+
diff --git a/kttsd/players/akodeplayer/akodeplayer.cpp b/kttsd/players/akodeplayer/akodeplayer.cpp
new file mode 100644
index 0000000..de88773
--- /dev/null
+++ b/kttsd/players/akodeplayer/akodeplayer.cpp
@@ -0,0 +1,179 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.com
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <config.h>
+
+#include <kdebug.h>
+
+#include <qfile.h>
+
+#include "akode/player.h"
+#include "akode/decoder.h"
+
+#include "akodeplayer.h"
+
+using namespace aKode;
+
+////////////////////////////////////////////////////////////////////////////////
+// public methods
+////////////////////////////////////////////////////////////////////////////////
+
+aKodePlayer::aKodePlayer(QObject* parent, const char* name, const QStringList& args) :
+ Player(parent, name, args),
+ m_player(0)
+{}
+
+aKodePlayer::~aKodePlayer()
+{
+ delete m_player;
+}
+
+//void aKodePlayer::play(const FileHandle &file)
+void aKodePlayer::startPlay(const QString &file)
+{
+ kdDebug() << k_funcinfo << endl;
+
+ if (file.isNull()) { // null FileHandle file means unpause
+ if (paused())
+ // m_player->resume();
+ m_player->play();
+ else
+ stop();
+ return;
+ }
+
+ // QString filename = file.absFilePath();
+
+ kdDebug() << "Opening: " << file << endl;
+
+ if (m_player)
+ m_player->stop();
+ else {
+ m_player = new aKode::Player();
+ if (!m_player->open(m_sinkName.ascii())) {
+ kdDebug() << k_funcinfo << "Unable to open aKode " << m_sinkName << " sink. "
+ << "Falling back to auto." << endl;
+ m_player->open("auto");
+ }
+ }
+
+ if (m_player->load(QFile::encodeName(file)))
+ m_player->play();
+
+}
+
+void aKodePlayer::pause()
+{
+ if (m_player)
+ m_player->pause();
+}
+
+void aKodePlayer::stop()
+{
+ if (m_player) {
+ m_player->stop();
+ m_player->unload();
+ }
+}
+
+void aKodePlayer::setVolume(float volume)
+{
+ if (m_player)
+ m_player->setVolume(volume);
+}
+
+float aKodePlayer::volume() const
+{
+ if (m_player)
+ return m_player->volume();
+ // 1.0 is full volume
+ return 1.0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+// m_player status functions
+/////////////////////////////////////////////////////////////////////////////////
+
+bool aKodePlayer::playing() const
+{
+ if (m_player && m_player->decoder())
+ return !m_player->decoder()->eof();
+ else
+ return false;
+}
+
+bool aKodePlayer::paused() const
+{
+ return m_player && (m_player->state() == aKode::Player::Paused);
+}
+
+int aKodePlayer::totalTime() const
+{
+ if (m_player) {
+ Decoder *d = m_player->decoder();
+ if (d)
+ return d->length() / 1000;
+ }
+ return -1;
+}
+
+int aKodePlayer::currentTime() const
+{
+ if (m_player) {
+ Decoder *d = m_player->decoder();
+ if (d)
+ return d->position() / 1000;
+ }
+ return -1;
+}
+
+int aKodePlayer::position() const
+{
+ if (m_player) {
+ Decoder *d = m_player->decoder();
+ if (d && d->length())
+ return (d->position()*1000)/(d->length());
+ else
+ return -1;
+ }
+ else
+ return -1;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+// m_player seek functions
+/////////////////////////////////////////////////////////////////////////////////
+
+void aKodePlayer::seek(int seekTime)
+{
+ // seek time in seconds?
+ if (m_player)
+ m_player->decoder()->seek(seekTime*1000);
+}
+
+void aKodePlayer::seekPosition(int position)
+{
+ // position unit is 1/1000th
+ if (m_player)
+ m_player->decoder()->seek((position * m_player->decoder()->length())/1000);
+}
+
+QStringList aKodePlayer::getPluginList( const QCString& /*classname*/ )
+{
+ return QStringList::split("|", "auto|polyp|alsa|jack|oss");
+}
+
+void aKodePlayer::setSinkName(const QString& sinkName) { m_sinkName = sinkName; }
+
+#include "akodeplayer.moc"
diff --git a/kttsd/players/akodeplayer/akodeplayer.h b/kttsd/players/akodeplayer/akodeplayer.h
new file mode 100644
index 0000000..bbfb3ea
--- /dev/null
+++ b/kttsd/players/akodeplayer/akodeplayer.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.com
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef AKODEPLAYER_H
+#define AKODEPLAYER_H
+
+#include <config.h>
+#include "kdeexportfix.h"
+
+#include <qstring.h>
+
+#include "player.h"
+#include <kdemacros.h>
+namespace aKode {
+ class File;
+ class Player;
+}
+
+class KDE_EXPORT aKodePlayer : public Player
+{
+ Q_OBJECT
+
+public:
+ aKodePlayer(QObject* parent = 0, const char* name = 0, const QStringList& args=QStringList());
+ virtual ~aKodePlayer();
+
+ // virtual void play(const FileHandle &file = FileHandle::null());
+ virtual void startPlay(const QString &file);
+
+ virtual void setVolume(float volume = 1.0);
+ virtual float volume() const;
+
+ virtual bool playing() const;
+ virtual bool paused() const;
+
+ virtual int totalTime() const;
+ virtual int currentTime() const;
+ virtual int position() const;
+
+ virtual void seek(int seekTime);
+ virtual void seekPosition(int position);
+
+ virtual QStringList getPluginList( const QCString& classname );
+ virtual void setSinkName(const QString &sinkName);
+
+public slots:
+ void pause();
+ void stop();
+
+private:
+ aKode::Player *m_player;
+ QString m_sinkName;
+};
+
+#endif
diff --git a/kttsd/players/akodeplayer/akodeplugin.cpp b/kttsd/players/akodeplayer/akodeplugin.cpp
new file mode 100644
index 0000000..9ef0deb
--- /dev/null
+++ b/kttsd/players/akodeplayer/akodeplugin.cpp
@@ -0,0 +1,29 @@
+/***************************************************** vim:set ts=4 sw=4 sts=4:
+ Generating the factories so aKode can be used as an audio plug in.
+ -------------------
+ Copyright:
+ (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net>
+ -------------------
+ Original author: Gary Cramblitt <garycramblitt@comcast.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ ******************************************************************************/
+
+#include <kgenericfactory.h>
+
+#include "akodeplayer.h"
+
+K_EXPORT_COMPONENT_FACTORY( libkttsd_akodeplugin, KGenericFactory<aKodePlayer>("kttsd_akode") );
+
diff --git a/kttsd/players/akodeplayer/kttsd_akodeplugin.desktop b/kttsd/players/akodeplayer/kttsd_akodeplugin.desktop
new file mode 100644
index 0000000..cc2c4bf
--- /dev/null
+++ b/kttsd/players/akodeplayer/kttsd_akodeplugin.desktop
@@ -0,0 +1,89 @@
+[Desktop Entry]
+Name=KTTSD aKode Plugin
+Name[br]=Lugent aKode evit KTTSD
+Name[bs]=KTTSD aKode dodatak
+Name[ca]=Connector aKode pel KTTSD
+Name[cs]=KTTSD aKode modul
+Name[da]=KTTSD aKode-plugin
+Name[de]=KTTSD aKode-Modul
+Name[el]=KTTSD πρόσθετο aKode
+Name[es]=Complemento aKode de KTTSD
+Name[et]=KTTSD aKode plugin
+Name[eu]=KTTSD-ren aKode plugina
+Name[fa]=وصلۀ KTTSD aKode
+Name[fi]=KTTSD aKode -liitännäinen
+Name[fr]=Module aKode pour KTTSD
+Name[ga]=Breiseán KTTSD aKode
+Name[gl]=Plugin aKode de KTTSD
+Name[he]=תוסף aKode עבור KTTSD
+Name[hu]=KTTSD aKode hangmodul
+Name[is]=KTTSD aKode íforrit
+Name[it]=Plugin per aKode di KTTSD
+Name[ja]=KTTSD aKode プラグイン
+Name[ka]=KTTSD aKode მოდული
+Name[km]= កម្មវិធី​ជំនួយ​ aKode សម្រាប់ KTTSD
+Name[mk]=aKode-приклучок за KTTSD
+Name[nb]=Programtillegg for KTTSD aKode
+Name[nds]=aKode-Moduul för KTTSD
+Name[ne]=KTTSD aKode प्लगइन
+Name[nl]=KTTSD aKode-plugin
+Name[pa]=KTTSD aKode ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka aKode KTTSD
+Name[pt]='Plugin' aKode do KTTSD
+Name[pt_BR]=Plug-in aKode para o KTTSD
+Name[ru]=Модуль aKode для KTTSD
+Name[sk]=Modul KTTSD aKode
+Name[sl]=Vstavek KTTSD za aKode
+Name[sr]=aKode прикључак за KTTSD
+Name[sr@Latn]=aKode priključak za KTTSD
+Name[sv]=KTTSD-insticksprogram för aKode
+Name[tg]=Модули KTTSD aKode
+Name[tr]=KTTSD aKode Eklentisi
+Name[uk]=Втулок aKode для KTTSD
+Name[vi]=Trình bổ sung KTTSD aKode
+Name[zh_TW]=KTTSD aKode 外掛程式
+Comment=KTTSD aKode audio plugin
+Comment[bg]=Аудио приставка на KTTSD за aKode
+Comment[br]=Lugent klevet aKode evit KTTSD
+Comment[ca]=Connector d'àudio aKode pel KTTSD
+Comment[cs]=KTTSD aKode zvukový modul
+Comment[da]=KTTSD aKode lyd-plugin
+Comment[de]=KTTSD aKode-Audio-Modul
+Comment[el]=KTTSD πρόσθετο ήχου aKode
+Comment[es]=Complemento de audio aKode de KTTSD
+Comment[et]=KTTSD aKode audioplugin
+Comment[eu]=KTTSD-ren aKode audio-plugina
+Comment[fa]=وصلۀ صوتی KTTSD aKode
+Comment[fi]=KTTSD aKode ääniliitännäinen
+Comment[fr]=Module audio aKode pour KTTSD
+Comment[ga]=Breiseán fuaime KTTSD aKode
+Comment[gl]=Plugin de áudio aKode para KTTSD
+Comment[hu]=KTTSD aKode hangmodul
+Comment[is]=KTTSD aKode hljóð íforrit
+Comment[it]=Plugin audio per aKode di KTTSD
+Comment[ja]=KTTSD aKode オーディオプラグイン
+Comment[ka]=KTTSD aKode აუდიო მოდული
+Comment[km]=កម្មវិធី​ជំនួយ​អូឌីយ៉ូ aKode សម្រាប់ KTTSD
+Comment[mk]=aKode-аудиоприклучок за KTTSD
+Comment[nb]=aKodes lyd-programtillegg for KTTSD
+Comment[nds]=aKode-Audiomoduul för KTTSD
+Comment[ne]=KTTSD aKode अडियो प्लगइन
+Comment[nl]=KTTSD aKode geluidsplugin
+Comment[pa]=KTTSD aKode ਆਡੀਓ ਪਲੱਗਿੰਨ
+Comment[pl]=Wtyczka dźwięku aKode dla KTTSD
+Comment[pt]='Plugin' de áudio aKode do KTTSD
+Comment[pt_BR]=Plug-in de áudio KTTSD aKode
+Comment[ru]=Модуль вывода звука KTTSD через aKode
+Comment[sk]=Modul KTTSD aKode audio
+Comment[sl]=Vstavek KTTSD za zvok v aKode
+Comment[sr]=aKode аудио прикључак за KTTSD
+Comment[sr@Latn]=aKode audio priključak za KTTSD
+Comment[sv]=KTTSD-ljudinsticksprogram för aKode
+Comment[tg]=Модули KTTSD aKode барои аудио
+Comment[tr]=KTTSD aRts ses eklentisi
+Comment[uk]=Втулок аудіо aKode для KTTSD
+Comment[vi]=Trình bổ sung âm thanh KTTSD aKode
+Comment[zh_TW]=KTTSd aKode 語音外掛程式
+Type=Service
+ServiceTypes=KTTSD/AudioPlugin
+X-KDE-Library=libkttsd_akodeplugin