Commit 09372be2 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Finish libsound refactoring.

Creation of library and moving of files was only done half.
parent f4812890
......@@ -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
......
add_subdirectory(src)
###
# Copyright 2014 Andreas Cord-Landwehr <cordlandwehr@kde.org>
#
# 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
qtgstreamerbackend.cpp
soundbackendinterface.cpp
)
kde4_add_library(artikulatesound SHARED ${sound_LIB_SRCS})
target_link_libraries(
artikulatesound
LINK_PRIVATE
${PHONON_LIBS}
${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}
)
......@@ -19,18 +19,11 @@
*/
#include "capturedevicecontroller.h"
#include "libsound/soundbackends/soundbackendinterface.h"
#include "soundbackendinterface.h"
#include "qtgstreamerbackend.h"
#include <config.h>
#if QTMOBILITY_FOUND
#include "soundbackends/qtmultimediabackend.h"
#endif
#if QTGSTREAMER_FOUND
#include "libsound/soundbackends/qtgstreamerbackend.h"
#endif
#include <settings.h>
#include <QUrl>
#include <QStringList>
#include <KDebug>
/**
......@@ -64,29 +57,13 @@ public:
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";
Q_ASSERT(m_backends.count() > 0);
return m_backends.first();
}
......
......@@ -21,7 +21,7 @@
#ifndef CAPTUREDEVICECONTROLLER_H
#define CAPTUREDEVICECONTROLLER_H
#include "artikulatecore_export.h"
#include "libsound_export.h"
#include <QObject>
......@@ -33,7 +33,7 @@ class KUrl;
*
* This singelton class provides a controller for the sound capture device.
*/
class ARTIKULATELIB_EXPORT CaptureDeviceController : public QObject
class LIBSOUND_EXPORT CaptureDeviceController : public QObject
{
Q_OBJECT
......
/*
* Copyright 2014 Andreas Cord-Landwehr <cordlandwehr@kde.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef LIBSOUND_EXPORT_H
#define LIBSOUND_EXPORT_H
// needed for KDE_EXPORT and KDE_IMPORT macros
#include <kdemacros.h>
#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
......@@ -19,9 +19,7 @@
*/
#include "outputdevicecontroller.h"
#include <settings.h>
#include <QUrl>
#include <KUrl>
#include <KDebug>
/**
......@@ -43,7 +41,7 @@ public:
{
// use this value only for initialization, will be modified in another thread / another
// static Settings object
m_volume = Settings::audioOutputVolume();
//m_volume = Settings::audioOutputVolume(); //TODO currently not use anywhere
}
~OutputDeviceControllerPrivate()
......@@ -104,7 +102,7 @@ void OutputDeviceController::play(const QString& filePath)
void OutputDeviceController::play(const KUrl &filePath)
{
d->m_mediaObject->setCurrentSource(filePath);
d->m_audioOutput->setVolumeDecibel(d->m_volume);
// d->m_audioOutput->setVolumeDecibel(d->m_volume);
d->m_mediaObject->play();
}
......
......@@ -21,7 +21,7 @@
#ifndef OUTPUTDEVICECONTROLLER_H
#define OUTPUTDEVICECONTROLLER_H
#include "artikulatecore_export.h"
#include "libsound_export.h"
#include <QObject>
#include <Phonon/AudioOutput>
......@@ -35,7 +35,7 @@ class KUrl;
*
* This singelton class provides a controller for the sound output device.
*/
class ARTIKULATELIB_EXPORT OutputDeviceController : public QObject
class LIBSOUND_EXPORT OutputDeviceController : public QObject
{
Q_OBJECT
......
......@@ -19,7 +19,6 @@
*/
#include "qtgstreamerbackend.h"
#include "settings.h"
#include <QGlib/Error>
#include <QGlib/Connect>
......
......@@ -22,7 +22,7 @@
#define SOUNDBACKENDINTERFACE_H
#include <QObject>
#include "core/capturedevicecontroller.h"
#include "capturedevicecontroller.h"
class SoundBackendInterface : public QObject
{
......
......@@ -27,7 +27,6 @@ set(ARTIKULATE_VERSION_MINOR 3)
set(ARTIKULATE_VERSION_PATCH 50)
find_package(KDeclarative REQUIRED)
find_package(QtGStreamer REQUIRED)
# set config files after packages are searched
configure_file("${artikulate_SOURCE_DIR}/version.h.cmake" "${artikulate_BINARY_DIR}/version.h" @ONLY)
......@@ -55,57 +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
libsound/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}
)
include_directories(
${QTGSTREAMER_INCLUDE_DIR}
)
set(artikulateCore_SRCS
${artikulateCore_SRCS}
libsound/soundbackends/qtgstreamerbackend.cpp
)
set(artikulateCoreTargetLibs
${artikulateCoreTargetLibs}
${QTGLIB_LIBRARIES}
${QTGSTREAMER_LIBRARIES}
)
set(artikulateeTargetLibs
${artikulateTargetLibs}
${QTGLIB_LIBRARIES}
${QTGSTREAMER_LIBRARIES}
)
# compile UI files
kde4_add_ui_files(artikulateCore_SRCS
ui/newcoursedialog.ui
......@@ -115,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
......@@ -127,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
......@@ -166,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})
......
......@@ -19,8 +19,8 @@
*/
#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"
......
......@@ -19,7 +19,7 @@
*/
#include "player.h"
#include "outputdevicecontroller.h"
#include "libsound/src/outputdevicecontroller.h"
#include <QList>
#include <KDebug>
......
......@@ -19,7 +19,7 @@
*/
#include "recorder.h"
#include "capturedevicecontroller.h"
#include "libsound/src/capturedevicecontroller.h"
#include <QList>
#include <KDebug>
......
......@@ -23,7 +23,7 @@
#include "trainingsession.h"
#include "phrase.h"
#include "unit.h"
#include "core/outputdevicecontroller.h"
#include "libsound/src/outputdevicecontroller.h"
#include <QList>
#include <QHash>
......
......@@ -19,8 +19,8 @@
*/
#include "sounddevicedialogpage.h"
#include <core/capturedevicecontroller.h>
#include <core/outputdevicecontroller.h>
#include "libsound/src/capturedevicecontroller.h"
#include "libsound/src/outputdevicecontroller.h"
#include "settings.h"
#include <KLocale>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment