From 7c468023afd5e5759cd7c3827b318fc580443b9c089ad80e933d5f45691c2cd7 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 10 Jul 2014 12:55:56 +0000 Subject: [PATCH] Accepting request 240098 from KDE:Distro:Factory ------------------------------------------------------------------- Tue Jun 24 19:46:59 UTC 2014 - hrvoje.senjan@gmail.com - Added gst1.patch, to support qt-gstreamer 1.0 API; applied for Factory only - Drop icons.patch, not needed anymore ------------------------------------------------------------------- Sun Jun 8 19:05:16 UTC 2014 - tittiatcoke@gmail.com - Update to 4.13.2 * KDE 4.13 release * See http://www.kde.org/announcements/announce-4.13.2.php ------------------------------------------------------------------- Fri May 9 17:13:53 UTC 2014 - tittiatcoke@gmail.com - Update to 4.13.1 * KDE 4.13.1 bug fix release * See http://www.kde.org/announcements/announce-4.13.1.php OBS-URL: https://build.opensuse.org/request/show/240098 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/artikulate?expand=0&rev=4 --- artikulate-4.13.0.tar.xz | 3 - artikulate-4.13.2.tar.xz | 3 + artikulate.changes | 20 + artikulate.spec | 15 +- gst1.patch | 2609 ++++++++++++++++++++++++++++++++++++++ icons.patch | 11 - 6 files changed, 2643 insertions(+), 18 deletions(-) delete mode 100644 artikulate-4.13.0.tar.xz create mode 100644 artikulate-4.13.2.tar.xz create mode 100644 gst1.patch delete mode 100644 icons.patch diff --git a/artikulate-4.13.0.tar.xz b/artikulate-4.13.0.tar.xz deleted file mode 100644 index fcde0a2..0000000 --- a/artikulate-4.13.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:800d85d8b204613c3f5aa3e54369f0f449217e4d982a6817bfda8120186b3b0f -size 3918772 diff --git a/artikulate-4.13.2.tar.xz b/artikulate-4.13.2.tar.xz new file mode 100644 index 0000000..abe37b0 --- /dev/null +++ b/artikulate-4.13.2.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37323a2e6a86eaee14240f9caf5d8be4e1f2ee7179d8cdd5d379f29fceaf8112 +size 3918724 diff --git a/artikulate.changes b/artikulate.changes index f2ae8f3..783e73f 100644 --- a/artikulate.changes +++ b/artikulate.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Tue Jun 24 19:46:59 UTC 2014 - hrvoje.senjan@gmail.com + +- Added gst1.patch, to support qt-gstreamer 1.0 API; applied for Factory only +- Drop icons.patch, not needed anymore + +------------------------------------------------------------------- +Sun Jun 8 19:05:16 UTC 2014 - tittiatcoke@gmail.com + +- Update to 4.13.2 + * KDE 4.13 release + * See http://www.kde.org/announcements/announce-4.13.2.php + +------------------------------------------------------------------- +Fri May 9 17:13:53 UTC 2014 - tittiatcoke@gmail.com + +- Update to 4.13.1 + * KDE 4.13.1 bug fix release + * See http://www.kde.org/announcements/announce-4.13.1.php + ------------------------------------------------------------------- Fri Apr 11 17:21:54 UTC 2014 - tittiatcoke@gmail.com diff --git a/artikulate.spec b/artikulate.spec index 0fbf998..b6abad2 100644 --- a/artikulate.spec +++ b/artikulate.spec @@ -17,16 +17,20 @@ Name: artikulate -Version: 4.13.0 +Version: 4.13.2 Release: 0 Summary: Pronunciation Self-Teaching License: LGPL-3.0+ and GPL-2.0 and BSD-3-Clause Group: Amusements/Teaching/Other Url: http://edu.kde.org Source0: %{name}-%{version}.tar.xz -# PATCH-FIX-UPSTREAM icons.patch -- install icons to hicolor namespace -Patch0: icons.patch +# PATCH-FIX-UPSTREAM gst1.patch +Patch1: gst1.patch +%if 0%{?suse_version} > 1310 +BuildRequires: gstreamer-plugins-qt-devel +%else BuildRequires: gstreamer-0_10-plugins-qt-devel +%endif BuildRequires: libkde4-devel >= 4.10 BuildRequires: update-desktop-files BuildRequires: xz @@ -40,7 +44,9 @@ Improve your pronunciation by listening to native speakers. %prep %setup -q -%patch0 -p1 +%if 0%{?suse_version} > 1310 +%patch1 -p1 +%endif %build %cmake_kde4 -d build @@ -62,6 +68,7 @@ Improve your pronunciation by listening to native speakers. %{_kde4_bindir}/artikulate %{_kde4_libdir}/libartikulatelearnerprofile.so.* %{_kde4_libdir}/libartikulatecore.so.* +%{_kde4_libdir}/libartikulatesound.so.* %{_kde4_appsdir}/artikulate/ %{_kde4_applicationsdir}/artikulate.desktop %{_kde4_htmldir}/en/artikulate/ diff --git a/gst1.patch b/gst1.patch new file mode 100644 index 0000000..630343b --- /dev/null +++ b/gst1.patch @@ -0,0 +1,2609 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f709a1d..b1f4858 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -44,7 +44,7 @@ add_subdirectory(src) + add_subdirectory(sounds) + add_subdirectory(images) + add_subdirectory(icons) +- ++add_subdirectory(libsound) + add_subdirectory(liblearnerprofile) + + # Build Tests if KDE_TEST is on +diff --git a/liblearnerprofile/src/profilemanager.cpp b/liblearnerprofile/src/profilemanager.cpp +index bb9c148..51bfd34 100644 +--- a/liblearnerprofile/src/profilemanager.cpp ++++ b/liblearnerprofile/src/profilemanager.cpp +@@ -26,7 +26,6 @@ + #include + #include + #include +-#include + #include + + using namespace LearnerProfile; +diff --git a/libsound/CMakeLists.txt b/libsound/CMakeLists.txt +new file mode 100644 +index 0000000..4b43d67 +--- /dev/null ++++ b/libsound/CMakeLists.txt +@@ -0,0 +1,2 @@ ++ ++add_subdirectory(src) +diff --git a/libsound/src/CMakeLists.txt b/libsound/src/CMakeLists.txt +new file mode 100644 +index 0000000..8efbd5c +--- /dev/null ++++ b/libsound/src/CMakeLists.txt +@@ -0,0 +1,60 @@ ++### ++# Copyright 2014 Andreas Cord-Landwehr ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions ++# are met: ++# ++# 1. Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# 2. Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# ++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++### ++ ++find_package(QtGStreamer REQUIRED) ++ ++include_directories( ++ ${QTGSTREAMER_INCLUDE_DIR} ++) ++ ++set(sound_LIB_SRCS ++ capturedevicecontroller.cpp ++ outputdevicecontroller.cpp ++ qtgstreamercapturebackend.cpp ++ qtgstreameroutputbackend.cpp ++) ++ ++kde4_add_library(artikulatesound SHARED ${sound_LIB_SRCS}) ++ ++target_link_libraries( ++ artikulatesound ++ LINK_PRIVATE ++ ${QTGLIB_LIBRARIES} ++ ${QTGLIB_LIBRARY} ++ ${QTGSTREAMER_LIBRARIES} ++ ${KDE4_KDECORE_LIBS} ++) ++ ++set_target_properties( ++ artikulatesound ++ PROPERTIES ++ VERSION ${GENERIC_LIB_VERSION} ++ SOVERSION ${GENERIC_LIB_SOVERSION} ++) ++ ++install( ++ TARGETS artikulatesound ++ ${INSTALL_TARGETS_DEFAULT_ARGS} ++) +diff --git a/libsound/src/capturedevicecontroller.cpp b/libsound/src/capturedevicecontroller.cpp +new file mode 100644 +index 0000000..15a8d53 +--- /dev/null ++++ b/libsound/src/capturedevicecontroller.cpp +@@ -0,0 +1,113 @@ ++/* ++ * Copyright 2013-2014 Andreas Cord-Landwehr ++ * ++ * 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) version 3 or any later version ++ * accepted by the membership of KDE e.V. (or its successor approved ++ * by the membership of KDE e.V.), which shall act as a proxy ++ * defined in Section 14 of version 3 of the license. ++ * ++ * 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, see . ++ */ ++ ++#include "capturedevicecontroller.h" ++#include "qtgstreamercapturebackend.h" ++#include ++#include ++#include ++#include ++ ++/** ++ * \class CaptureDeviceControllerPrivate ++ * \internal ++ * ++ * This is the private data class for \see CaptureDeviceController. ++ * Note that -- even if the CaptureDeviceController is contructed before its first call -- all ++ * devices get only configured by first instantiation of CaptureDeviceController with a call ++ * to CaptureDeviceControllerPrivate::lazyInit(), called in CaptureDeviceController::self(). ++ */ ++class CaptureDeviceControllerPrivate ++{ ++public: ++ CaptureDeviceControllerPrivate(QObject *parent) ++ : m_parent(parent) ++ , m_initialized(false) ++ { ++ } ++ ++ ~CaptureDeviceControllerPrivate() ++ { ++ delete m_backend; ++ m_backend = 0; ++ } ++ ++ void lazyInit() ++ { ++ if (m_initialized) { ++ return; ++ } ++ m_backend = new QtGStreamerCaptureBackend(); ++ m_initialized = true; ++ } ++ ++ QtGStreamerCaptureBackend * backend() const ++ { ++ Q_ASSERT(m_backend); ++ return m_backend; ++ } ++ ++ QObject *m_parent; ++ QtGStreamerCaptureBackend *m_backend; ++ bool m_initialized; ++}; ++ ++CaptureDeviceController::CaptureDeviceController() ++ : d(new CaptureDeviceControllerPrivate(this)) ++{ ++} ++ ++CaptureDeviceController::~CaptureDeviceController() ++{ ++} ++ ++CaptureDeviceController & CaptureDeviceController::self() ++{ ++ static CaptureDeviceController instance; ++ instance.d->lazyInit(); ++ return instance; ++} ++ ++void CaptureDeviceController::startCapture(const QString &filePath) ++{ ++ d->backend()->startCapture(filePath); ++ emit captureStarted(); ++} ++ ++void CaptureDeviceController::stopCapture() ++{ ++ d->backend()->stopCapture(); ++ emit captureStopped(); ++} ++ ++void CaptureDeviceController::setDevice(const QString &deviceIdentifier) ++{ ++ d->backend()->setDevice(deviceIdentifier); ++} ++ ++QList< QString > CaptureDeviceController::devices() const ++{ ++ return d->backend()->devices(); ++} ++ ++CaptureDeviceController::State CaptureDeviceController::state() const ++{ ++ return d->backend()->captureState(); ++} +diff --git a/libsound/src/capturedevicecontroller.h b/libsound/src/capturedevicecontroller.h +new file mode 100644 +index 0000000..3d49acf +--- /dev/null ++++ b/libsound/src/capturedevicecontroller.h +@@ -0,0 +1,89 @@ ++/* ++ * Copyright 2013 Andreas Cord-Landwehr ++ * ++ * 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) version 3 or any later version ++ * accepted by the membership of KDE e.V. (or its successor approved ++ * by the membership of KDE e.V.), which shall act as a proxy ++ * defined in Section 14 of version 3 of the license. ++ * ++ * 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, see . ++ */ ++ ++#ifndef CAPTUREDEVICECONTROLLER_H ++#define CAPTUREDEVICECONTROLLER_H ++ ++#include "libsound_export.h" ++ ++#include ++ ++class CaptureDeviceControllerPrivate; ++class KUrl; ++ ++/** ++ * \class CaptureDeviceController ++ * ++ * This singelton class provides a controller for the sound capture device. ++ */ ++class LIBSOUND_EXPORT CaptureDeviceController : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ enum State ++ { ++ StoppedState, ++ RecordingState, ++ PausedState ++ }; ++ ++ /** ++ * Returns self reference to the controller. First call of this method initializes ++ * capture device controller. ++ * ++ * \return self reference ++ */ ++ static CaptureDeviceController & self(); ++ ++ void startCapture(const QString &filePath); ++ CaptureDeviceController::State state() const; ++ void stopCapture(); ++ void setDevice(const QString &deviceIdentifier); ++ ++ /** ++ * \return list of available capture devices ++ */ ++ QList devices() const; ++ ++public Q_SLOTS: ++ ++ ++Q_SIGNALS: ++ void captureStarted(); ++ void captureStopped(); ++ ++private: ++ Q_DISABLE_COPY(CaptureDeviceController) ++ /** ++ * \internal ++ * Private constructor, \ref self(). ++ */ ++ CaptureDeviceController(); ++ ++ /** ++ * Private destructor. ++ */ ++ ~CaptureDeviceController(); ++ ++ const QScopedPointer d; ++}; ++ ++#endif +diff --git a/libsound/src/libsound_export.h b/libsound/src/libsound_export.h +new file mode 100644 +index 0000000..b342dcc +--- /dev/null ++++ b/libsound/src/libsound_export.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright 2014 Andreas Cord-Landwehr ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) version 3, or any ++ * later version accepted by the membership of KDE e.V. (or its ++ * successor approved by the membership of KDE e.V.), which shall ++ * act as a proxy defined in Section 6 of version 3 of the license. ++ * ++ * This library 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 ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library. If not, see . ++ */ ++ ++#ifndef LIBSOUND_EXPORT_H ++#define LIBSOUND_EXPORT_H ++ ++// needed for KDE_EXPORT and KDE_IMPORT macros ++#include ++ ++#ifndef LIBSOUND_EXPORT ++# if defined(MAKE_LIBSOUND_LIB) ++ // We are building this library ++# define LIBSOUND_EXPORT KDE_EXPORT ++# else ++ // We are using this library ++# define LIBSOUND_EXPORT KDE_IMPORT ++# endif ++#endif ++ ++# ifndef LIBSOUND_EXPORT_DEPRECATED ++# define LIBSOUND_EXPORT_DEPRECATED KDE_DEPRECATED LIBSOUND_EXPORT ++# endif ++ ++#endif +diff --git a/libsound/src/outputdevicecontroller.cpp b/libsound/src/outputdevicecontroller.cpp +new file mode 100644 +index 0000000..4b6335a +--- /dev/null ++++ b/libsound/src/outputdevicecontroller.cpp +@@ -0,0 +1,149 @@ ++/* ++ * Copyright 2013-2014 Andreas Cord-Landwehr ++ * ++ * 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) version 3 or any later version ++ * accepted by the membership of KDE e.V. (or its successor approved ++ * by the membership of KDE e.V.), which shall act as a proxy ++ * defined in Section 14 of version 3 of the license. ++ * ++ * 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, see . ++ */ ++ ++#include "outputdevicecontroller.h" ++#include "qtgstreameroutputbackend.h" ++#include ++#include ++ ++/** ++ * \class OutputDeviceControllerPrivate ++ * \internal ++ * ++ * This is the private data class for \see OutputDeviceController. ++ * Note that -- even if the OutputDeviceController is contructed before its first call -- all ++ * devices get only configured by first instantiation of OutputDeviceController with a call ++ * to OutputDeviceControllerPrivate::lazyInit(), called in OutputDeviceController::self(). ++ */ ++class OutputDeviceControllerPrivate ++{ ++public: ++ OutputDeviceControllerPrivate(OutputDeviceController *parent) ++ : m_parent(parent) ++ , m_backend(0) ++ , m_initialized(false) ++ { ++ m_backend = new QtGStreamerOutputBackend(); ++ } ++ ++ ~OutputDeviceControllerPrivate() ++ { ++ delete m_backend; ++ } ++ ++ void lazyInit() ++ { ++ if (m_initialized) { ++ return; ++ } ++ m_backend = new QtGStreamerOutputBackend(); ++ m_parent->connect(m_backend, SIGNAL(stateChanged()), m_parent, SLOT(emitChangedState())); ++ m_volume = m_backend->volume(); ++ m_initialized = true; ++ } ++ ++ QtGStreamerOutputBackend * backend() const ++ { ++ Q_ASSERT(m_backend); ++ return m_backend; ++ } ++ ++ OutputDeviceController *m_parent; ++ QtGStreamerOutputBackend *m_backend; ++ int m_volume; // volume as cubic value ++ bool m_initialized; ++}; ++ ++OutputDeviceController::OutputDeviceController() ++ : d(new OutputDeviceControllerPrivate(this)) ++{ ++ ++} ++ ++OutputDeviceController::~OutputDeviceController() ++{ ++} ++ ++OutputDeviceController & OutputDeviceController::self() ++{ ++ static OutputDeviceController instance; ++ instance.d->lazyInit(); ++ return instance; ++} ++ ++void OutputDeviceController::play(const QString& filePath) ++{ ++ d->backend()->setUri(filePath); ++ d->backend()->setVolume(d->m_volume); ++ d->backend()->play(); ++ emit started(); ++} ++ ++void OutputDeviceController::play(const KUrl &filePath) ++{ ++ play(filePath.toLocalFile()); ++} ++ ++void OutputDeviceController::stop() ++{ ++ d->backend()->stop(); ++ emit stopped(); ++} ++ ++OutputDeviceController::State OutputDeviceController::state() const ++{ ++ switch (d->backend()->state()) { ++ case QGst::StateNull: ++ return OutputDeviceController::StoppedState; ++ break; ++ case QGst::StatePaused: ++ return OutputDeviceController::PlayingState; ++ break; ++ case QGst::StatePlaying: ++ return OutputDeviceController::PlayingState; ++ break; ++ default: ++ return OutputDeviceController::StoppedState; ++ } ++} ++ ++void OutputDeviceController::setVolume(int volume) ++{ ++ // backend only accepts volume, when there is a pipeline ++ // store value here and set it when playing ++ d->m_volume = volume; ++} ++ ++int OutputDeviceController::volume() const ++{ ++ return d->backend()->volume(); ++} ++ ++void OutputDeviceController::emitChangedState() ++{ ++ if (state() == OutputDeviceController::StoppedState) { ++ emit stopped(); ++ return; ++ } ++ if (state() == OutputDeviceController::PlayingState) { ++ emit started(); ++ return; ++ } ++} +diff --git a/libsound/src/outputdevicecontroller.h b/libsound/src/outputdevicecontroller.h +new file mode 100644 +index 0000000..82d5031 +--- /dev/null ++++ b/libsound/src/outputdevicecontroller.h +@@ -0,0 +1,86 @@ ++/* ++ * Copyright 2013 Andreas Cord-Landwehr ++ * ++ * 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) version 3 or any later version ++ * accepted by the membership of KDE e.V. (or its successor approved ++ * by the membership of KDE e.V.), which shall act as a proxy ++ * defined in Section 14 of version 3 of the license. ++ * ++ * 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, see . ++ */ ++ ++#ifndef OUTPUTDEVICECONTROLLER_H ++#define OUTPUTDEVICECONTROLLER_H ++ ++#include "libsound_export.h" ++#include ++ ++class OutputDeviceControllerPrivate; ++class KUrl; ++ ++/** ++ * \class OutputDeviceController ++ * ++ * This singelton class provides a controller for the sound output device. ++ */ ++class LIBSOUND_EXPORT OutputDeviceController : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ enum State ++ { ++ StoppedState, ++ PlayingState, ++ PausedState ++ }; ++ ++ /** ++ * Returns self reference to the controller. First call of this method initializes ++ * output device controller. ++ * ++ * \return self reference ++ */ ++ static OutputDeviceController & self(); ++ ++ void play(const QString &filePath); ++ void play(const KUrl &filePath); ++ OutputDeviceController::State state() const; ++ void stop(); ++ QString currentSource() const; ++ void setVolume(int volume); ++ int volume() const; ++ ++public Q_SLOTS: ++ void emitChangedState(); ++ ++Q_SIGNALS: ++ void started(); ++ void stopped(); ++ ++private: ++ Q_DISABLE_COPY(OutputDeviceController) ++ /** ++ * \internal ++ * Private constructor, \ref self(). ++ */ ++ OutputDeviceController(); ++ ++ /** ++ * Private destructor. ++ */ ++ ~OutputDeviceController(); ++ ++ const QScopedPointer d; ++}; ++ ++#endif +diff --git a/libsound/src/qtgstreamercapturebackend.cpp b/libsound/src/qtgstreamercapturebackend.cpp +new file mode 100644 +index 0000000..fd34fb1 +--- /dev/null ++++ b/libsound/src/qtgstreamercapturebackend.cpp +@@ -0,0 +1,186 @@ ++/* ++ * Copyright 2013-2014 Andreas Cord-Landwehr ++ * ++ * 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) version 3 or any later version ++ * accepted by the membership of KDE e.V. (or its successor approved ++ * by the membership of KDE e.V.), which shall act as a proxy ++ * defined in Section 14 of version 3 of the license. ++ * ++ * 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, see . ++ */ ++ ++#include "qtgstreamercapturebackend.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++QtGStreamerCaptureBackend::QtGStreamerCaptureBackend() ++{ ++ QGst::init(); ++ ++ //setup the device list ++ QGst::ElementPtr src = QGst::ElementFactory::make("autoaudiosrc"); ++ ++ if (!src) { ++ kError() << "Failed to create element \"autoaudiosrc\". Make sure you have " ++ << "gstreamer-plugins-good installed"; ++ return; ++ } ++ ++ m_availableDevices.insert("", i18nc("default sound device", "Default")); ++} ++ ++QtGStreamerCaptureBackend::~QtGStreamerCaptureBackend() ++{ ++ m_pipeline.clear(); ++} ++ ++CaptureDeviceController::State QtGStreamerCaptureBackend::captureState() ++{ ++ if (!m_pipeline) { ++ return CaptureDeviceController::StoppedState; ++ } ++ ++ switch (m_pipeline->currentState()) { ++ case QGst::StateNull: ++ return CaptureDeviceController::StoppedState; ++ break; ++ case QGst::StatePaused: ++ return CaptureDeviceController::RecordingState; ++ break; ++ case QGst::StatePlaying: ++ return CaptureDeviceController::RecordingState; ++ break; ++ default: ++ return CaptureDeviceController::StoppedState; ++ } ++} ++ ++QGst::BinPtr QtGStreamerCaptureBackend::createAudioSrcBin() ++{ ++ QGst::BinPtr audioBin; ++ ++ try { ++ audioBin = QGst::Bin::fromDescription("autoaudiosrc name=\"audiosrc\" ! audioconvert ! " ++ "audioresample ! audiorate ! vorbisenc name=enc quality=0.6 ! queue"); ++ } catch (const QGlib::Error &error) { ++ kError() << "Failed to create audio source bin:" << error; ++ return QGst::BinPtr(); ++ } ++ QGst::ElementPtr src = audioBin->getElementByName("audiosrc"); ++ //autoaudiosrc creates the actual source in the READY state ++ ++ src->setState(QGst::StateReady); ++ return audioBin; ++} ++ ++void QtGStreamerCaptureBackend::onBusMessage(const QGst::MessagePtr & message) ++{ ++ switch (message->type()) { ++ case QGst::MessageEos: ++ //got end-of-stream - stop the pipeline ++ kDebug() << "EOS signal received, stopping pipeline"; ++ stopPipeline(); ++ break; ++ case QGst::MessageError: ++ //check if the pipeline exists before destroying it, ++ //since we could get multiple error messages ++ if (m_pipeline) { ++ stopPipeline(); ++ } ++ kError() << "Pipeline Error:" ++ << message.staticCast()->error().message(); ++ break; ++ default: ++ break; ++ } ++} ++ ++void QtGStreamerCaptureBackend::startCapture(const QString &filePath) ++{ ++ // clear pipeline if still existing ++ if (m_pipeline) { ++ kWarning() << "removing forgotten pipeline"; ++ //send an end-of-stream event to flush metadata and cause an EosMessage to be delivered ++ m_pipeline->sendEvent(QGst::EosEvent::create()); ++ } ++ ++ QGst::BinPtr audioSrcBin = createAudioSrcBin(); ++ QGst::ElementPtr mux = QGst::ElementFactory::make("oggmux"); ++ QGst::ElementPtr sink = QGst::ElementFactory::make("filesink"); ++ ++ if (!audioSrcBin || !mux || !sink) { ++ kError() << "One or more elements could not be created. " ++ << "Verify that you have all the necessary element plugins installed."; ++ return; ++ } ++ ++ // set output path ++ sink->setProperty("location", filePath); ++ ++ m_pipeline = QGst::Pipeline::create(); ++ m_pipeline->add(audioSrcBin, mux, sink); ++ ++ //link elements ++ QGst::PadPtr audioPad = mux->getRequestPad("audio_%u"); ++ audioSrcBin->getStaticPad("src")->link(audioPad); ++ ++ mux->link(sink); ++ ++ //connect the bus ++ m_pipeline->bus()->addSignalWatch(); ++ QGlib::connect(m_pipeline->bus(), "message", this, &QtGStreamerCaptureBackend::onBusMessage); ++ m_pipeline->setState(QGst::StatePlaying); ++} ++ ++void QtGStreamerCaptureBackend::stopCapture() ++{ ++ if (m_pipeline) { //pipeline exists - destroy it ++ //send an end-of-stream event to flush metadata and cause an EosMessage to be delivered ++ m_pipeline->sendEvent(QGst::EosEvent::create()); ++ } ++} ++ ++void QtGStreamerCaptureBackend::stopPipeline() ++{ ++ if (!m_pipeline) { ++ kWarning() << "Stopping non-existing pipeline, aborting"; ++ return; ++ } ++ m_pipeline->setState(QGst::StateNull); ++ m_pipeline.clear(); ++} ++ ++QStringList QtGStreamerCaptureBackend::devices() const ++{ ++ //TODO qtgstreamer backend currently only provides access to default backend, ++ // reenable selection by using Gst::Device ++ ++ return m_availableDevices.values(); ++} ++ ++void QtGStreamerCaptureBackend::setDevice(const QString& deviceIdentifier) ++{ ++ //TODO add sanity check ++ m_device = deviceIdentifier; ++} +diff --git a/libsound/src/qtgstreamercapturebackend.h b/libsound/src/qtgstreamercapturebackend.h +new file mode 100644 +index 0000000..e170fb3 +--- /dev/null ++++ b/libsound/src/qtgstreamercapturebackend.h +@@ -0,0 +1,57 @@ ++/* ++ * Copyright 2013 Andreas Cord-Landwehr ++ * ++ * 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) version 3 or any later version ++ * accepted by the membership of KDE e.V. (or its successor approved ++ * by the membership of KDE e.V.), which shall act as a proxy ++ * defined in Section 14 of version 3 of the license. ++ * ++ * 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, see . ++ */ ++ ++#ifndef QTGSTREAMERCAPTUREBACKEND_H ++#define QTGSTREAMERCAPTUREBACKEND_H ++ ++#include "capturedevicecontroller.h" ++ ++#include ++ ++#include ++#include ++ ++class QtGStreamerCaptureBackend : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ QtGStreamerCaptureBackend(); ++ ++ ~QtGStreamerCaptureBackend(); ++ ++ void startCapture(const QString &filePath); ++ void stopCapture(); ++ CaptureDeviceController::State captureState(); ++ ++ QStringList devices() const; ++ void setDevice(const QString &deviceIdentifier); ++ ++private: ++ void onBusMessage(const QGst::MessagePtr &message); ++ void stopPipeline(); ++ QGst::BinPtr createAudioSrcBin(); ++ QGst::PipelinePtr m_pipeline; ++ QString m_device; ++ QMap m_availableDevices; //!> (identifier,human readable name) ++}; ++ ++ ++#endif +diff --git a/libsound/src/qtgstreameroutputbackend.cpp b/libsound/src/qtgstreameroutputbackend.cpp +new file mode 100644 +index 0000000..1cb6692 +--- /dev/null ++++ b/libsound/src/qtgstreameroutputbackend.cpp +@@ -0,0 +1,211 @@ ++/* ++ * Copyright 2010 Marco Ballesio ++ * Copyright 2011 Collabora Ltd. ++ * @author George Kiagiadakis ++ * Copyright 2014 Andreas Cord-Landwehr ++ * ++ * This library is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published ++ * by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include "qtgstreameroutputbackend.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++QtGStreamerOutputBackend::QtGStreamerOutputBackend() ++{ ++ QGst::init(); ++} ++ ++QtGStreamerOutputBackend::~QtGStreamerOutputBackend() ++{ ++ m_pipeline.clear(); ++} ++ ++void QtGStreamerOutputBackend::setUri(const QString & uri) ++{ ++ QString realUri = uri; ++ ++ //if uri is not a real uri, assume it is a file path ++ if (realUri.indexOf("://") < 0) { ++ realUri = QUrl::fromLocalFile(realUri).toEncoded(); ++ } ++ ++ if (!m_pipeline) { ++ m_pipeline = QGst::ElementFactory::make("playbin").dynamicCast(); ++ if (m_pipeline) { ++ //watch the bus for messages ++ QGst::BusPtr bus = m_pipeline->bus(); ++ bus->addSignalWatch(); ++ QGlib::connect(bus, "message", this, &QtGStreamerOutputBackend::onBusMessage); ++ } else { ++ qCritical() << "Failed to create the pipeline"; ++ } ++ } ++ ++ if (m_pipeline) { ++ m_pipeline->setProperty("uri", realUri); ++ } ++} ++ ++QTime QtGStreamerOutputBackend::position() const ++{ ++ if (m_pipeline) { ++ //here we query the pipeline about its position ++ //and we request that the result is returned in time format ++ QGst::PositionQueryPtr query = QGst::PositionQuery::create(QGst::FormatTime); ++ m_pipeline->query(query); ++ return QGst::ClockTime(query->position()).toTime(); ++ } else { ++ return QTime(0,0); ++ } ++} ++ ++void QtGStreamerOutputBackend::setPosition(const QTime & pos) ++{ ++ QGst::SeekEventPtr evt = QGst::SeekEvent::create( ++ 1.0, QGst::FormatTime, QGst::SeekFlagFlush, ++ QGst::SeekTypeSet, QGst::ClockTime::fromTime(pos), ++ QGst::SeekTypeNone, QGst::ClockTime::None ++ ); ++ ++ m_pipeline->sendEvent(evt); ++} ++ ++int QtGStreamerOutputBackend::volume() const ++{ ++ if (m_pipeline) { ++ QGst::StreamVolumePtr svp = ++ m_pipeline.dynamicCast(); ++ ++ if (svp) { ++ return svp->volume(QGst::StreamVolumeFormatCubic) * 10; ++ } ++ } ++ ++ return 0; ++} ++ ++void QtGStreamerOutputBackend::setVolume(int volume) ++{ ++ if (m_pipeline) { ++ QGst::StreamVolumePtr svp = ++ m_pipeline.dynamicCast(); ++ ++ if(svp) { ++ svp->setVolume((double)volume / 10, QGst::StreamVolumeFormatCubic); ++ } ++ } ++} ++ ++QTime QtGStreamerOutputBackend::length() const ++{ ++ if (m_pipeline) { ++ //here we query the pipeline about the content's duration ++ //and we request that the result is returned in time format ++ QGst::DurationQueryPtr query = QGst::DurationQuery::create(QGst::FormatTime); ++ m_pipeline->query(query); ++ return QGst::ClockTime(query->duration()).toTime(); ++ } else { ++ return QTime(0,0); ++ } ++} ++ ++QGst::State QtGStreamerOutputBackend::state() const ++{ ++ return m_pipeline ? m_pipeline->currentState() : QGst::StateNull; ++} ++ ++void QtGStreamerOutputBackend::play() ++{ ++ if (m_pipeline) { ++ m_pipeline->setState(QGst::StatePlaying); ++ } ++} ++ ++void QtGStreamerOutputBackend::pause() ++{ ++ if (m_pipeline) { ++ m_pipeline->setState(QGst::StatePaused); ++ } ++} ++ ++void QtGStreamerOutputBackend::stop() ++{ ++ if (m_pipeline) { ++ m_pipeline->setState(QGst::StateNull); ++ ++ //once the pipeline stops, the bus is flushed so we will ++ //not receive any StateChangedMessage about this. ++ //so, to inform the ui, we have to emit this signal manually. ++ Q_EMIT stateChanged(); ++ } ++ //TODO this is a temporary fix: ++ // the pipeline should not be cleared after every stop, but only when the backend is destructed ++ // or specifically resetted. Cause of the problem, both QtGStreamerOutputBackend is globally static ++ // object and can be destructed _after_ the also globally static object QGlib::Private::ConnectionsStore ++ // is destroyed. With calling QGst::Pipeline destructor by destructing QtGStreamerOutputBackend, ++ // we get a crash. ++ m_pipeline.clear(); ++} ++ ++void QtGStreamerOutputBackend::onBusMessage(const QGst::MessagePtr &message) ++{ ++ switch (message->type()) { ++ case QGst::MessageEos: //End of stream. We reached the end of the file. ++ stop(); ++ break; ++ case QGst::MessageError: //Some error occurred. ++ qCritical() << message.staticCast()->error(); ++ stop(); ++ break; ++ case QGst::MessageStateChanged: //The element in message->source() has changed state ++ if (message->source() == m_pipeline) { ++ handlePipelineStateChange(message.staticCast()); ++ } ++ break; ++ default: ++ break; ++ } ++} ++ ++void QtGStreamerOutputBackend::handlePipelineStateChange(const QGst::StateChangedMessagePtr &scm) ++{ ++ switch (scm->newState()) { ++ case QGst::StatePlaying: ++ //start the timer when the pipeline starts playing ++ m_positionTimer.start(100); ++ break; ++ case QGst::StatePaused: ++ //stop the timer when the pipeline pauses ++ if(scm->oldState() == QGst::StatePlaying) { ++ m_positionTimer.stop(); ++ } ++ break; ++ default: ++ break; ++ } ++ ++ Q_EMIT stateChanged(); ++} +diff --git a/libsound/src/qtgstreameroutputbackend.h b/libsound/src/qtgstreameroutputbackend.h +new file mode 100644 +index 0000000..cdec4a1 +--- /dev/null ++++ b/libsound/src/qtgstreameroutputbackend.h +@@ -0,0 +1,69 @@ ++/* ++ * Copyright 2010 Marco Ballesio ++ * Copyright 2011 Collabora Ltd. ++ * @author George Kiagiadakis ++ * Copyright 2014 Andreas Cord-Landwehr ++ * ++ * This library is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published ++ * by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef QTGSTREAMEROUTPUTBACKEND_H ++#define QTGSTREAMEROUTPUTBACKEND_H ++ ++#include "capturedevicecontroller.h" ++#include ++#include ++#include ++#include ++ ++class QtGStreamerOutputBackend : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ QtGStreamerOutputBackend(); ++ ~QtGStreamerOutputBackend(); ++ ++ void setUri(const QString & uri); ++ ++ QTime position() const; ++ void setPosition(const QTime & pos); ++ /** ++ * volume as cubic value ++ */ ++ int volume() const; ++ ++ QTime length() const; ++ QGst::State state() const; ++ ++public Q_SLOTS: ++ void play(); ++ void pause(); ++ void stop(); ++ void setVolume(int volume); ++ ++Q_SIGNALS: ++ void positionChanged(); ++ void stateChanged(); ++ ++private: ++ void onBusMessage(const QGst::MessagePtr &message); ++ void handlePipelineStateChange(const QGst::StateChangedMessagePtr &scm); ++ ++ QGst::PipelinePtr m_pipeline; ++ QTimer m_positionTimer; ++}; ++ ++ ++#endif +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 2d71577..c7fa83e 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -24,31 +24,14 @@ + ### + set(ARTIKULATE_VERSION_MAJOR 0) + set(ARTIKULATE_VERSION_MINOR 3) +-set(ARTIKULATE_VERSION_PATCH 2) ++set(ARTIKULATE_VERSION_PATCH 50) + + find_package(KDeclarative REQUIRED) +-find_package(QtMobility COMPONENTS MultimediaKit QUIET) +-find_package(QtGStreamer QUIET) +- +-# print information about built recording backends +-message("----------------------------------") +-message("Building following recording backends:") +-if (QTGSTREAMER_FOUND) +- message(" * QtGStreamer recording backend") +-endif(QTGSTREAMER_FOUND) +-if (QTMOBILITY_FOUND) +- message(" * QtMultimedia recording backend (default)") +-endif(QTMOBILITY_FOUND) +-if (NOT QTGSTREAMER_FOUND AND NOT QTMOBILITY_FOUND) +- message(FATAL_ERROR "No recording backend built: either QtGStreamer or QtMultimedia are required.") +-endif() +-message("----------------------------------") + + # set config files after packages are searched + configure_file("${artikulate_SOURCE_DIR}/version.h.cmake" "${artikulate_BINARY_DIR}/version.h" @ONLY) + configure_file("${artikulate_SOURCE_DIR}/config.h.cmake" "${artikulate_BINARY_DIR}/config.h" @ONLY) + +- + add_subdirectory(qml) + + # set include directories +@@ -56,6 +39,7 @@ include_directories( + ${QT_INCLUDE} + ${KDE4_INCLUDES} + ${CMAKE_CURRENT_BINARY_DIR} ++ ${artikulate_SOURCE_DIR} + ) + + # set the source code files from which Artikulate is compiled +@@ -70,79 +54,15 @@ set(artikulateCore_SRCS + core/profile.cpp + core/skeleton.cpp + core/trainingsession.cpp +- core/capturedevicecontroller.cpp +- core/outputdevicecontroller.cpp + core/resources/resourceinterface.cpp + core/resources/languageresource.cpp + core/resources/courseresource.cpp + core/resources/skeletonresource.cpp + core/player.cpp + core/recorder.cpp +- core/soundbackends/soundbackendinterface.cpp + ui/newcoursedialog.cpp + ) + +-set( +- artikulateCoreTargetLibs +- ${KDECLARATIVE_LIBRARIES} +- ${KDE4_KIO_LIBS} +- ${QT_QTDECLARATIVE_LIBRARY} +- ${QT_QTXMLPATTERNS_LIBRARY} +- ${QT_QTSQL_LIBRARY} +- ${PHONON_LIBS} +-) +- +-set( +- artikulateTargetLibs +- artikulatecore +- artikulatelearnerprofile +- ${KDECLARATIVE_LIBRARIES} +- ${KDE4_PLASMA_LIBS} +- ${KDE4_KIO_LIBS} +- ${QT_QTDECLARATIVE_LIBRARY} +- ${KDE4_KNEWSTUFF3_LIBS} +-) +- +-# select backend and add files +-if (QTMOBILITY_FOUND) +- include_directories( +- ${QTMOBILITY_INCLUDE_DIR} +- ${QTMOBILITY_MULTIMEDIAKIT_INCLUDE_DIR} +- ) +- set(artikulateCore_SRCS +- ${artikulateCore_SRCS} +- core/soundbackends/qtmultimediabackend.cpp +- ) +- set(artikulateCoreTargetLibs +- ${artikulateCoreTargetLibs} +- ${QTMOBILITY_MULTIMEDIAKIT_LIBRARY} +- ) +- set(artikulateeTargetLibs +- ${artikulateTargetLibs} +- ${QTMOBILITY_MULTIMEDIAKIT_LIBRARY} +- ) +-endif(QTMOBILITY_FOUND) +- +-if(QTGSTREAMER_FOUND) +- include_directories( +- ${QTGSTREAMER_INCLUDE_DIR} +- ) +- set(artikulateCore_SRCS +- ${artikulateCore_SRCS} +- core/soundbackends/qtgstreamerbackend.cpp +- ) +- set(artikulateCoreTargetLibs +- ${artikulateCoreTargetLibs} +- ${QTGLIB_LIBRARIES} +- ${QTGSTREAMER_LIBRARIES} +- ) +- set(artikulateeTargetLibs +- ${artikulateTargetLibs} +- ${QTGLIB_LIBRARIES} +- ${QTGSTREAMER_LIBRARIES} +- ) +-endif(QTGSTREAMER_FOUND) +- + # compile UI files + kde4_add_ui_files(artikulateCore_SRCS + ui/newcoursedialog.ui +@@ -152,7 +72,12 @@ kde4_add_library(artikulatecore SHARED ${artikulateCore_SRCS}) + target_link_libraries(artikulatecore + LINK_PRIVATE + artikulatelearnerprofile +- ${artikulateCoreTargetLibs} ++ artikulatesound ++ ${KDECLARATIVE_LIBRARIES} ++ ${KDE4_KIO_LIBS} ++ ${QT_QTDECLARATIVE_LIBRARY} ++ ${QT_QTXMLPATTERNS_LIBRARY} ++ ${QT_QTSQL_LIBRARY} + ) + set_target_properties( + artikulatecore +@@ -164,7 +89,7 @@ install( + TARGETS artikulatecore + DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS} + ) +-install( FILES artikulate.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) ++install(FILES artikulate.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) + + # set the source code files from which Artikulate is compiled + set(artikulate_SRCS +@@ -203,7 +128,13 @@ kde4_add_executable(artikulate ${artikulate_SRCS}) + target_link_libraries(artikulate + LINK_PRIVATE + artikulatelearnerprofile +- ${artikulateTargetLibs} ++ artikulatesound ++ artikulatecore ++ ${KDECLARATIVE_LIBRARIES} ++ ${KDE4_PLASMA_LIBS} ++ ${KDE4_KIO_LIBS} ++ ${QT_QTDECLARATIVE_LIBRARY} ++ ${KDE4_KNEWSTUFF3_LIBS} + ) + + install(FILES artikulate.kcfg DESTINATION ${KCFG_INSTALL_DIR}) +diff --git a/src/artikulate.kcfg b/src/artikulate.kcfg +index f9b97e9..a6cdbdf 100644 +--- a/src/artikulate.kcfg ++++ b/src/artikulate.kcfg +@@ -18,11 +18,11 @@ + + + +- 90 ++ 10 + + + +- 90 ++ 10 + + + +diff --git a/src/core/capturedevicecontroller.cpp b/src/core/capturedevicecontroller.cpp +deleted file mode 100644 +index 710ce97..0000000 +--- a/src/core/capturedevicecontroller.cpp ++++ /dev/null +@@ -1,139 +0,0 @@ +-/* +- * Copyright 2013-2014 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#include "capturedevicecontroller.h" +-#include "soundbackends/soundbackendinterface.h" +-#include +- +-#if QTMOBILITY_FOUND +- #include "soundbackends/qtmultimediabackend.h" +-#endif +-#if QTGSTREAMER_FOUND +- #include "soundbackends/qtgstreamerbackend.h" +-#endif +- +-#include +-#include +-#include +- +-/** +- * \class CaptureDeviceControllerPrivate +- * \internal +- * +- * This is the private data class for \see CaptureDeviceController. +- * Note that -- even if the CaptureDeviceController is contructed before its first call -- all +- * devices get only configured by first instantiation of CaptureDeviceController with a call +- * to CaptureDeviceControllerPrivate::lazyInit(), called in CaptureDeviceController::self(). +- */ +-class CaptureDeviceControllerPrivate +-{ +-public: +- CaptureDeviceControllerPrivate(QObject *parent) +- : m_parent(parent) +- , m_initialized(false) +- { +- } +- +- ~CaptureDeviceControllerPrivate() +- { +- for (int i = 0; i < m_backends.size(); ++i) { +- m_backends.at(i)->deleteLater(); +- } +- m_backends.clear(); +- } +- +- void lazyInit() +- { +- if (m_initialized) { +- return; +- } +- // add QtMobility as first backend +-#if QTMOBILITY_FOUND +- kDebug() << "initilaize QtMultimediaBackend"; +- m_backends.append(new QtMultimediaBackend()); +-#endif +-#if QTGSTREAMER_FOUND +- kDebug() << "initilaize QtGStreamerBackend"; +- m_backends.append(new QtGStreamerBackend()); +-#endif +- m_initialized = true; +- } +- +- SoundBackendInterface * backend() const +- { +- if (m_backends.isEmpty()) { +- return 0; +- } +- foreach (SoundBackendInterface *backend, m_backends) { +- if (Settings::recordingBackend() == backend->identifier()) { +- return backend; +- } +- } +- kDebug() << "could not understand backend configuration setting, default to first found"; +- return m_backends.first(); +- } +- +- QObject *m_parent; +- QList m_backends; +- bool m_initialized; +-}; +- +-CaptureDeviceController::CaptureDeviceController() +- : d(new CaptureDeviceControllerPrivate(this)) +-{ +-} +- +-CaptureDeviceController::~CaptureDeviceController() +-{ +-} +- +-CaptureDeviceController & CaptureDeviceController::self() +-{ +- static CaptureDeviceController instance; +- instance.d->lazyInit(); +- return instance; +-} +- +-void CaptureDeviceController::startCapture(const QString &filePath) +-{ +- d->backend()->startCapture(filePath); +- emit captureStarted(); +-} +- +-void CaptureDeviceController::stopCapture() +-{ +- d->backend()->stopCapture(); +- emit captureStopped(); +-} +- +-void CaptureDeviceController::setDevice(const QString &deviceIdentifier) +-{ +- d->backend()->setDevice(deviceIdentifier); +-} +- +-QList< QString > CaptureDeviceController::devices() const +-{ +- return d->backend()->devices(); +-} +- +-CaptureDeviceController::State CaptureDeviceController::state() const +-{ +- return d->backend()->captureState(); +-} +diff --git a/src/core/capturedevicecontroller.h b/src/core/capturedevicecontroller.h +deleted file mode 100644 +index 3b1f00a..0000000 +--- a/src/core/capturedevicecontroller.h ++++ /dev/null +@@ -1,89 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#ifndef CAPTUREDEVICECONTROLLER_H +-#define CAPTUREDEVICECONTROLLER_H +- +-#include "artikulatecore_export.h" +- +-#include +- +-class CaptureDeviceControllerPrivate; +-class KUrl; +- +-/** +- * \class CaptureDeviceController +- * +- * This singelton class provides a controller for the sound capture device. +- */ +-class ARTIKULATELIB_EXPORT CaptureDeviceController : public QObject +-{ +- Q_OBJECT +- +-public: +- enum State +- { +- StoppedState, +- RecordingState, +- PausedState +- }; +- +- /** +- * Returns self reference to the controller. First call of this method initializes +- * capture device controller. +- * +- * \return self reference +- */ +- static CaptureDeviceController & self(); +- +- void startCapture(const QString &filePath); +- CaptureDeviceController::State state() const; +- void stopCapture(); +- void setDevice(const QString &deviceIdentifier); +- +- /** +- * \return list of available capture devices +- */ +- QList devices() const; +- +-public Q_SLOTS: +- +- +-Q_SIGNALS: +- void captureStarted(); +- void captureStopped(); +- +-private: +- Q_DISABLE_COPY(CaptureDeviceController) +- /** +- * \internal +- * Private constructor, \ref self(). +- */ +- CaptureDeviceController(); +- +- /** +- * Private destructor. +- */ +- ~CaptureDeviceController(); +- +- const QScopedPointer d; +-}; +- +-#endif +diff --git a/src/core/outputdevicecontroller.cpp b/src/core/outputdevicecontroller.cpp +deleted file mode 100644 +index 9492e11..0000000 +--- a/src/core/outputdevicecontroller.cpp ++++ /dev/null +@@ -1,139 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#include "outputdevicecontroller.h" +-#include +- +-#include +-#include +- +-/** +- * \class OutputDeviceControllerPrivate +- * \internal +- * +- * This is the private data class for \see OutputDeviceController. +- * Note that -- even if the OutputDeviceController is contructed before its first call -- all +- * devices get only configured by first instantiation of OutputDeviceController with a call +- * to OutputDeviceControllerPrivate::lazyInit(), called in OutputDeviceController::self(). +- */ +-class OutputDeviceControllerPrivate +-{ +-public: +- OutputDeviceControllerPrivate(OutputDeviceController *parent) +- : m_parent(parent) +- , m_initialized(false) +- , m_volume(0) +- { +- // use this value only for initialization, will be modified in another thread / another +- // static Settings object +- m_volume = Settings::audioOutputVolume(); +- } +- +- ~OutputDeviceControllerPrivate() +- { +- m_mediaObject->disconnect(); +- m_mediaObject->deleteLater(); +- m_audioOutput->deleteLater(); +- } +- +- bool lazyInit() +- { +- if (m_initialized) { +- return false; +- } +- +- m_audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory); +- m_mediaObject = new Phonon::MediaObject(); +- +- // initialize +- Phonon::createPath(m_mediaObject, m_audioOutput); +- +- m_initialized = true; +- return true; +- } +- +- OutputDeviceController *m_parent; +- bool m_initialized; +- Phonon::AudioOutput *m_audioOutput; +- Phonon::MediaObject *m_mediaObject; +- int m_volume; // output volume in Db +-}; +- +-OutputDeviceController::OutputDeviceController() +- : d(new OutputDeviceControllerPrivate(this)) +-{ +- +-} +- +-OutputDeviceController::~OutputDeviceController() +-{ +-} +- +-OutputDeviceController & OutputDeviceController::self() +-{ +- static OutputDeviceController instance; +- if (instance.d->lazyInit()) { +- connect(instance.d->m_mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), +- &instance, SLOT(updateState())); +- } +- return instance; +-} +- +-void OutputDeviceController::play(const QString& filePath) +-{ +- play(KUrl::fromLocalFile(filePath)); +-} +- +-void OutputDeviceController::play(const KUrl &filePath) +-{ +- d->m_mediaObject->setCurrentSource(filePath); +- d->m_audioOutput->setVolumeDecibel(d->m_volume); +- d->m_mediaObject->play(); +-} +- +-void OutputDeviceController::stop() +-{ +- d->m_mediaObject->stop(); +-} +- +-Phonon::State OutputDeviceController::state() const +-{ +- return d->m_mediaObject->state(); +-} +- +-QString OutputDeviceController::currentSource() const +-{ +- return d->m_mediaObject->currentSource().fileName(); +-} +- +-void OutputDeviceController::updateState() +-{ +- if (d->m_mediaObject->state() == Phonon::StoppedState) { +- emit stopped(); +- } +- if (d->m_mediaObject->state() == Phonon::PlayingState) { +- emit started(); +- } +-} +- +-void OutputDeviceController::setVolume(int volumenDb) +-{ +- d->m_volume = volumenDb; +-} +diff --git a/src/core/outputdevicecontroller.h b/src/core/outputdevicecontroller.h +deleted file mode 100644 +index 547e880..0000000 +--- a/src/core/outputdevicecontroller.h ++++ /dev/null +@@ -1,86 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#ifndef OUTPUTDEVICECONTROLLER_H +-#define OUTPUTDEVICECONTROLLER_H +- +-#include "artikulatecore_export.h" +- +-#include +-#include +-#include +- +-class OutputDeviceControllerPrivate; +-class KUrl; +- +-/** +- * \class OutputDeviceController +- * +- * This singelton class provides a controller for the sound output device. +- */ +-class ARTIKULATELIB_EXPORT OutputDeviceController : public QObject +-{ +- Q_OBJECT +- +-public: +- /** +- * Returns self reference to the controller. First call of this method initializes +- * output device controller. +- * +- * \return self reference +- */ +- static OutputDeviceController & self(); +- +- void play(const QString &filePath); +- void play(const KUrl &filePath); +- Phonon::State state() const; +- void stop(); +- QString currentSource() const; +- /** +- * Set playback volume in decibels. +- */ +- void setVolume(int volumenDb); +- +-public Q_SLOTS: +- +-Q_SIGNALS: +- void started(); +- void stopped(); +- +-private Q_SLOTS: +- void updateState(); +- +-private: +- Q_DISABLE_COPY(OutputDeviceController) +- /** +- * \internal +- * Private constructor, \ref self(). +- */ +- OutputDeviceController(); +- +- /** +- * Private destructor. +- */ +- ~OutputDeviceController(); +- +- const QScopedPointer d; +-}; +- +-#endif +diff --git a/src/core/phrase.cpp b/src/core/phrase.cpp +index dd88433..a57dcb2 100644 +--- a/src/core/phrase.cpp ++++ b/src/core/phrase.cpp +@@ -19,15 +19,12 @@ + */ + + #include "phrase.h" +-#include "capturedevicecontroller.h" +-#include "outputdevicecontroller.h" ++#include "libsound/src/capturedevicecontroller.h" ++#include "libsound/src/outputdevicecontroller.h" + #include "unit.h" + #include "course.h" + #include "settings.h" + +-#include +-#include +- + #include + #include + #include +diff --git a/src/core/player.cpp b/src/core/player.cpp +index 33b2a14..6dd6bea 100644 +--- a/src/core/player.cpp ++++ b/src/core/player.cpp +@@ -19,7 +19,7 @@ + */ + + #include "player.h" +-#include "outputdevicecontroller.h" ++#include "libsound/src/outputdevicecontroller.h" + + #include + #include +@@ -90,13 +90,13 @@ void Player::stop() + + void Player::updateState() + { +- if (OutputDeviceController::self().state() == Phonon::StoppedState ++ if (OutputDeviceController::self().state() == OutputDeviceController::StoppedState + && state() == PlayingState + ) { + m_playbackState = StoppedState; + emit stateChanged(); + } +- if (OutputDeviceController::self().state() == Phonon::PlayingState ++ if (OutputDeviceController::self().state() == OutputDeviceController::PlayingState + && state() != PlayingState + ) { + m_playbackState = PlayingState; +diff --git a/src/core/recorder.cpp b/src/core/recorder.cpp +index 347a6a6..d044a8d 100644 +--- a/src/core/recorder.cpp ++++ b/src/core/recorder.cpp +@@ -19,7 +19,7 @@ + */ + + #include "recorder.h" +-#include "capturedevicecontroller.h" ++#include "libsound/src/capturedevicecontroller.h" + + #include + #include +diff --git a/src/core/soundbackends/qtgstreamerbackend.cpp b/src/core/soundbackends/qtgstreamerbackend.cpp +deleted file mode 100644 +index b094da8..0000000 +--- a/src/core/soundbackends/qtgstreamerbackend.cpp ++++ /dev/null +@@ -1,227 +0,0 @@ +-/* +- * Copyright 2013-2014 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#include "qtgstreamerbackend.h" +-#include "settings.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +- +-QtGStreamerBackend::QtGStreamerBackend() +-{ +- QGst::init(); +- +- //setup the device list +- QGst::ElementPtr src = QGst::ElementFactory::make("autoaudiosrc"); +- +- if (!src) { +- kError() << "Failed to create element \"autoaudiosrc\". Make sure you have " +- << "gstreamer-plugins-good installed"; +- return; +- } +- +- src->setState(QGst::StateReady); +- QGst::ChildProxyPtr childProxy = src.dynamicCast(); +- if (childProxy && childProxy->childrenCount() > 0) { +- //the actual source is the first child +- //this source usually implements the property probe interface +- m_audioProbe = childProxy->childByIndex(0).dynamicCast(); +- } +- //we got a reference to the underlying propertyProbe, so we don't need src anymore. +- src->setState(QGst::StateNull); +- +- //Most sources and sinks have a "device" property which supports probe +- //and probing it returns all the available devices on the system. +- //Here we try to make use of that to list the system's devices +- //and if it fails, we just leave the source to use its default device. +- if (m_audioProbe && m_audioProbe->propertySupportsProbe("device")) { +- //get a list of devices that the element supports +- QList devices = m_audioProbe->probeAndGetValues("device"); +- +- Q_FOREACH(const QGlib::Value & device, devices) { +- //set the element's device to the current device and retrieve its +- //human-readable name through the "device-name" property +- m_audioProbe->setProperty("device", device); +- QString deviceName = m_audioProbe->property("device-name").toString(); +- m_availableDevices.insert(device.toString(), QString("%1 (%2)").arg(deviceName, device.toString())); +- } +- } else { +- m_availableDevices.insert("", i18nc("@item:inlistbox default sound device", "Default")); +- } +-} +- +-QtGStreamerBackend::~QtGStreamerBackend() +-{ +- m_pipeline.clear(); +- m_audioProbe.clear(); +-} +- +-QString QtGStreamerBackend::identifier() +-{ +- return QLatin1String("qtgstreamerbackend"); +-} +- +-CaptureDeviceController::State QtGStreamerBackend::captureState() +-{ +- if (!m_pipeline) { +- return CaptureDeviceController::StoppedState; +- } +- +- switch (m_pipeline->currentState()) { +- case QGst::StateNull: +- return CaptureDeviceController::StoppedState; +- break; +- case QGst::StatePaused: +- return CaptureDeviceController::RecordingState; +- break; +- case QGst::StatePlaying: +- return CaptureDeviceController::RecordingState; +- break; +- default: +- return CaptureDeviceController::StoppedState; +- } +-} +- +-QGst::BinPtr QtGStreamerBackend::createAudioSrcBin() +-{ +- QGst::BinPtr audioBin; +- +- try { +- audioBin = QGst::Bin::fromDescription("autoaudiosrc name=\"audiosrc\" ! audioconvert ! " +- "audioresample ! audiorate ! vorbisenc name=enc quality=0.6 ! queue"); +- } catch (const QGlib::Error &error) { +- kError() << "Failed to create audio source bin:" << error; +- return QGst::BinPtr(); +- } +- +- QGst::ElementPtr src = audioBin->getElementByName("audiosrc"); +- src->setState(QGst::StateReady); +- +- QGst::ChildProxyPtr childProxy = src.dynamicCast(); +- if (childProxy && childProxy->childrenCount() > 0) { +- //the actual source is the first child +- QGst::ObjectPtr realSrc = childProxy->childByIndex(0); +-// realSrc->setProperty("device", ""); //FIXME when setting device pipeline breaks with creation error +- } +- +- return audioBin; +-} +- +-void QtGStreamerBackend::onBusMessage(const QGst::MessagePtr & message) +-{ +- switch (message->type()) { +- case QGst::MessageEos: +- //got end-of-stream - stop the pipeline +- kDebug() << "EOS signal received, stopping pipeline"; +- stopPipeline(); +- break; +- case QGst::MessageError: +- //check if the pipeline exists before destroying it, +- //since we could get multiple error messages +- if (m_pipeline) { +- stopPipeline(); +- } +- kError() << "Pipeline Error:" +- << message.staticCast()->error().message(); +- break; +- default: +- break; +- } +-} +- +-void QtGStreamerBackend::startCapture(const QString &filePath) +-{ +- // clear pipeline if still existing +- if (m_pipeline) { +- kWarning() << "removing forgotten pipeline"; +- //send an end-of-stream event to flush metadata and cause an EosMessage to be delivered +- m_pipeline->sendEvent(QGst::EosEvent::create()); +- } +- +- QGst::BinPtr audioSrcBin = createAudioSrcBin(); +- QGst::ElementPtr mux = QGst::ElementFactory::make("oggmux"); +- QGst::ElementPtr sink = QGst::ElementFactory::make("filesink"); +- +- if (!audioSrcBin || !mux || !sink) { +- kError() << "One or more elements could not be created. " +- << "Verify that you have all the necessary element plugins installed."; +- return; +- } +- +- // set output path +- sink->setProperty("location", filePath); +- +- m_pipeline = QGst::Pipeline::create(); +- m_pipeline->add(audioSrcBin, mux, sink); +- +- //link elements +- QGst::PadPtr audioPad = mux->getRequestPad("sink_%d"); +- audioPad->listProperties().first()->name(); +- audioSrcBin->getStaticPad("src")->link(audioPad); +- +- mux->link(sink); +- +- //connect the bus +- m_pipeline->bus()->addSignalWatch(); +- QGlib::connect(m_pipeline->bus(), "message", this, &QtGStreamerBackend::onBusMessage); +- m_pipeline->setState(QGst::StatePlaying); +-} +- +-void QtGStreamerBackend::stopCapture() +-{ +- if (m_pipeline) { //pipeline exists - destroy it +- //send an end-of-stream event to flush metadata and cause an EosMessage to be delivered +- m_pipeline->sendEvent(QGst::EosEvent::create()); +- } +-} +- +-void QtGStreamerBackend::stopPipeline() +-{ +- if (!m_pipeline) { +- kWarning() << "Stopping non-existing pipeline, aborting"; +- return; +- } +- m_pipeline->setState(QGst::StateNull); +- m_pipeline.clear(); +-} +- +-QStringList QtGStreamerBackend::devices() const +-{ +- //TODO switch to human readable device names +- return m_availableDevices.keys(); +-} +- +-void QtGStreamerBackend::setDevice(const QString& deviceIdentifier) +-{ +- //TODO add sanity check +- m_device = deviceIdentifier; +-} +diff --git a/src/core/soundbackends/qtgstreamerbackend.h b/src/core/soundbackends/qtgstreamerbackend.h +deleted file mode 100644 +index e601a5c..0000000 +--- a/src/core/soundbackends/qtgstreamerbackend.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#ifndef QTGSTREAMERBACKEND_H +-#define QTGSTREAMERBACKEND_H +- +-#include "soundbackendinterface.h" +- +-#include +- +-#include +-#include +-#include +- +-class QtGStreamerBackend : public SoundBackendInterface +-{ +- Q_OBJECT +- +-public: +- QtGStreamerBackend(); +- +- virtual ~QtGStreamerBackend(); +- +- virtual QString identifier(); +- +- virtual void startCapture(const QString &filePath); +- virtual void stopCapture(); +- virtual CaptureDeviceController::State captureState(); +- +- virtual QStringList devices() const; +- virtual void setDevice(const QString &deviceIdentifier); +- +-private: +- void onBusMessage(const QGst::MessagePtr &message); +- void stopPipeline(); +- QGst::BinPtr createAudioSrcBin(); +- +- QGst::PropertyProbePtr m_audioProbe; +- QGst::PipelinePtr m_pipeline; +- QString m_device; +- QMap m_availableDevices; //!> (identifier,human readable name) +-}; +- +- +-#endif +diff --git a/src/core/soundbackends/qtmultimediabackend.cpp b/src/core/soundbackends/qtmultimediabackend.cpp +deleted file mode 100644 +index 8521108..0000000 +--- a/src/core/soundbackends/qtmultimediabackend.cpp ++++ /dev/null +@@ -1,149 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#include "qtmultimediabackend.h" +-#include "settings.h" +- +-#include +-#include +-#include +- +-#include +- +-QtMultimediaBackend::QtMultimediaBackend() +-{ +- // initialize +- m_captureSource = new QAudioCaptureSource(this); +- m_audioInput = new QMediaRecorder(m_captureSource, this); +- +- if (!m_captureSource->isAvailable()) { +- kError() << "Audio capture source not available."; +- } +- +- // capabilities of backend +- kDebug() << "Available devices:"; +- foreach (const QString &device, m_captureSource->audioInputs()) { +- kDebug() << " + " << device; +- } +- kDebug() << "Available codecs:"; +- foreach(const QString &codecName, m_audioInput->supportedAudioCodecs()) { +- kDebug() << " + " << codecName; +- } +- kDebug() << "Available containers:"; +- foreach(const QString &containerName, m_audioInput->supportedContainers()) { +- kDebug() << " + " << containerName; +- } +- +- // set input device +- if (!Settings::audioInputDevice().isEmpty()) { +- setDevice(Settings::audioInputDevice()); +- } else { +- kDebug() << "No audio input setting available, default to first in device list"; +- setDevice(devices().first()); +- } +- +- // check code +- if (!m_audioInput->supportedAudioCodecs().contains("audio/vorbis")) { +- kError() << "Audio codec vorbis/ogg is not available, cannot record sound files."; +- } +-} +- +-QtMultimediaBackend::~QtMultimediaBackend() +-{ +- m_audioInput->deleteLater(); +- m_captureSource->deleteLater(); +-} +- +-QString QtMultimediaBackend::identifier() +-{ +- return QLatin1String("qtmultimediabackend"); +-} +- +-CaptureDeviceController::State QtMultimediaBackend::captureState() +-{ +- switch (m_audioInput->state()) { +- case QMediaRecorder::StoppedState: +- return CaptureDeviceController::StoppedState; +- break; +- case QMediaRecorder::PausedState: +- return CaptureDeviceController::PausedState; +- break; +- case QMediaRecorder::QMediaRecorder::RecordingState: +- return CaptureDeviceController::RecordingState; +- break; +- default: +- return CaptureDeviceController::StoppedState; +- } +-} +- +-void QtMultimediaBackend::startCapture(const QString &filePath) +-{ +- if (m_audioInput->state() == QMediaRecorder::RecordingState) { +- kError() << "Currently recording, aborting record start"; +- return; +- } +- +- kDebug() << "starting capture for " << filePath; +- kDebug() << "selected device " << m_device; +- +- // set output location +- //FIXME for a really strange reason, only the following notation works to get a correct +- // output file; neither QUrl::fromLocalFile, nor the KUrl equivalents are working +- // --> investigate why! +- m_audioInput->setOutputLocation(QUrl(filePath)); +- m_captureSource->setAudioInput(m_device); +- +- QAudioEncoderSettings audioSettings; +- audioSettings.setCodec("audio/vorbis"); +- audioSettings.setSampleRate(0); +- audioSettings.setBitRate(0); +- audioSettings.setQuality(QtMultimediaKit::NormalQuality); +- audioSettings.setEncodingMode(QtMultimediaKit::ConstantQualityEncoding); +- QString container = "ogg"; +- +- m_audioInput->setEncodingSettings(audioSettings, QVideoEncoderSettings(), container); +- m_audioInput->record(); +- if (m_audioInput->error() != QMediaRecorder::NoError) { +- kError() << "QtMultimediaBackend returned error: " << m_audioInput->errorString(); +- } +-} +- +-void QtMultimediaBackend::stopCapture() +-{ +- if (m_audioInput->state() != QMediaRecorder::RecordingState) { +- kError() << "Could not stop capture, was not in recording state."; +- } +- m_audioInput->stop(); +- kDebug() << "capture stopped"; +-} +- +-QStringList QtMultimediaBackend::devices() const +-{ +- return m_captureSource->audioInputs(); +-} +- +-void QtMultimediaBackend::setDevice(const QString &deviceIdentifier) +-{ +- if (!m_captureSource->audioInputs().contains(deviceIdentifier)) { +- kError() << "Audio input device " << deviceIdentifier << " is unknown, aborting."; +- return; +- } +- m_device = deviceIdentifier; +-} +diff --git a/src/core/soundbackends/qtmultimediabackend.h b/src/core/soundbackends/qtmultimediabackend.h +deleted file mode 100644 +index 1ece498..0000000 +--- a/src/core/soundbackends/qtmultimediabackend.h ++++ /dev/null +@@ -1,54 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#ifndef QTMULTIMEDIABACKEND_H +-#define QTMULTIMEDIABACKEND_H +- +-#include "soundbackendinterface.h" +-#include +- +-class QAudioCaptureSource; +- +-class QtMultimediaBackend : public SoundBackendInterface +-{ +- Q_OBJECT +- +-public: +- QtMultimediaBackend(); +- +- virtual ~QtMultimediaBackend(); +- +- virtual QString identifier(); +- +- virtual void startCapture(const QString &filePath); +- virtual void stopCapture(); +- virtual CaptureDeviceController::State captureState(); +- +- virtual QStringList devices() const; +- virtual void setDevice(const QString &deviceIdentifier); +- +-private: +- QMediaRecorder *m_audioInput; +- QAudioCaptureSource *m_captureSource; +- QString m_device; +-}; +- +- +-#endif +diff --git a/src/core/soundbackends/soundbackendinterface.cpp b/src/core/soundbackends/soundbackendinterface.cpp +deleted file mode 100644 +index 0855463..0000000 +--- a/src/core/soundbackends/soundbackendinterface.cpp ++++ /dev/null +@@ -1,36 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +- #include "soundbackendinterface.h" +- +-QString SoundBackendInterface::identifier() +-{ +- return "ERROR_unset"; +-} +- +-SoundBackendInterface::SoundBackendInterface(): QObject() +-{ +- +-} +- +-SoundBackendInterface::~SoundBackendInterface() +-{ +- +-} +diff --git a/src/core/soundbackends/soundbackendinterface.h b/src/core/soundbackends/soundbackendinterface.h +deleted file mode 100644 +index e6f2770..0000000 +--- a/src/core/soundbackends/soundbackendinterface.h ++++ /dev/null +@@ -1,47 +0,0 @@ +-/* +- * Copyright 2013 Andreas Cord-Landwehr +- * +- * 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) version 3 or any later version +- * accepted by the membership of KDE e.V. (or its successor approved +- * by the membership of KDE e.V.), which shall act as a proxy +- * defined in Section 14 of version 3 of the license. +- * +- * 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, see . +- */ +- +-#ifndef SOUNDBACKENDINTERFACE_H +-#define SOUNDBACKENDINTERFACE_H +- +-#include +-#include "../capturedevicecontroller.h" +- +-class SoundBackendInterface : public QObject +-{ +- Q_OBJECT +- +-public: +- SoundBackendInterface(); +- +- virtual ~SoundBackendInterface(); +- +- virtual QString identifier(); +- +- virtual QStringList devices() const = 0; +- virtual void setDevice(const QString &device) = 0; +- +- virtual void startCapture(const QString &filePath) = 0; +- virtual void stopCapture() = 0; +- virtual CaptureDeviceController::State captureState() = 0; +-}; +- +- +-#endif +diff --git a/src/core/trainingsession.cpp b/src/core/trainingsession.cpp +index 4457a19..42b96ad 100644 +--- a/src/core/trainingsession.cpp ++++ b/src/core/trainingsession.cpp +@@ -23,7 +23,7 @@ + #include "trainingsession.h" + #include "phrase.h" + #include "unit.h" +-#include "core/outputdevicecontroller.h" ++#include "libsound/src/outputdevicecontroller.h" + + #include + #include +diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp +index d01779d..023f472 100644 +--- a/src/mainwindow.cpp ++++ b/src/mainwindow.cpp +@@ -28,7 +28,8 @@ + #include "models/languagemodel.h" + #include "settings.h" + #include "liblearnerprofile/src/profilemanager.h" +-#include ++#include "liblearnerprofile/src/learner.h" ++#include "libsound/src/outputdevicecontroller.h" + + #include + #include +@@ -73,6 +74,9 @@ MainWindow::MainWindow() + + setAutoSaveSettings(); + ++ // load saved sound settings ++ OutputDeviceController::self().setVolume(Settings::audioOutputVolume()); ++ + // load resources + m_resourceManager->loadLanguageResources(); + m_resourceManager->loadCourseResources(); +diff --git a/src/ui/sounddevicedialogpage.cpp b/src/ui/sounddevicedialogpage.cpp +index 170b9ad..289f4dd 100644 +--- a/src/ui/sounddevicedialogpage.cpp ++++ b/src/ui/sounddevicedialogpage.cpp +@@ -19,8 +19,8 @@ + */ + + #include "sounddevicedialogpage.h" +-#include +-#include ++#include "libsound/src/capturedevicecontroller.h" ++#include "libsound/src/outputdevicecontroller.h" + #include "settings.h" + + #include +@@ -46,14 +46,15 @@ SoundDeviceDialogPage::SoundDeviceDialogPage() + + // set output volume slider + ui->kcfg_AudioOutputVolume->setTickInterval(0); +- ui->kcfg_AudioOutputVolume->setMinimum(-100); +- ui->kcfg_AudioOutputVolume->setMaximum(11); ++ ui->kcfg_AudioOutputVolume->setMinimum(0); ++ ui->kcfg_AudioOutputVolume->setMaximum(20); + + // devices + QStringList devices = CaptureDeviceController::self().devices(); + for (int i=0; i < devices.length(); ++i) { + ui->kcfg_AudioInputDevice->insertItem(i, devices.at(i), i); + } ++ //TODO Gst::Device will allow selecting devices again with GStreamer 1.4 + + // temporary file for recording test + m_recordTestFile.setSuffix(".ogg"); +@@ -87,14 +88,14 @@ void SoundDeviceDialogPage::saveSettings() + { + Settings::setAudioInputDevice(ui->kcfg_AudioInputDevice->itemText(ui->kcfg_AudioInputDevice->currentIndex())); + // Settings::setAudioInputVolume(ui->kcfg_AudioInputVolume->value()); +- Settings::setAudioOutputVolume(ui->kcfg_AudioOutputVolume->value()); ++ Settings::setAudioOutputVolume((int) ui->kcfg_AudioOutputVolume->value()); + OutputDeviceController::self().setVolume(ui->kcfg_AudioOutputVolume->value()); + Settings::self()->writeConfig(); + } + + void SoundDeviceDialogPage::playTestSound() + { +- if (OutputDeviceController::self().state() == Phonon::PlayingState) { ++ if (OutputDeviceController::self().state() == OutputDeviceController::PlayingState) { + OutputDeviceController::self().stop(); + return; + } +@@ -105,7 +106,7 @@ void SoundDeviceDialogPage::playTestSound() + + void SoundDeviceDialogPage::playRecordedSound() + { +- if (OutputDeviceController::self().state() == Phonon::PlayingState) { ++ if (OutputDeviceController::self().state() == OutputDeviceController::PlayingState) { + OutputDeviceController::self().stop(); + return; + } +@@ -132,10 +133,10 @@ void SoundDeviceDialogPage::updatePlayButtonIcons() + { + // default sound output test + switch (OutputDeviceController::self().state()) { +- case Phonon::PlayingState: ++ case OutputDeviceController::PlayingState: + ui->buttonPlayTestSound->setIcon(KIcon("media-playback-stop")); + break; +- case Phonon::StoppedState: ++ case OutputDeviceController::StoppedState: + ui->buttonPlayTestSound->setIcon(KIcon("media-playback-start")); + break; + default: +@@ -144,10 +145,10 @@ void SoundDeviceDialogPage::updatePlayButtonIcons() + + // recorded sound output test + switch (OutputDeviceController::self().state()) { +- case Phonon::PlayingState: ++ case OutputDeviceController::PlayingState: + ui->buttonPlayRecordedTestSound->setIcon(KIcon("media-playback-stop")); + break; +- case Phonon::StoppedState: ++ case OutputDeviceController::StoppedState: + ui->buttonPlayRecordedTestSound->setIcon(KIcon("media-playback-start")); + break; + default: diff --git a/icons.patch b/icons.patch deleted file mode 100644 index dc1fe3d..0000000 --- a/icons.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt -index e73b209..6f658fc 100644 ---- a/icons/CMakeLists.txt -+++ b/icons/CMakeLists.txt -@@ -23,5 +23,5 @@ - # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ### - --kde4_install_icons(${DATA_INSTALL_DIR}/artikulate/icons) -+kde4_install_icons(${ICON_INSTALL_DIR}) - kde4_update_iconcache()