-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit. Embedded the standard VSXuWidget into tomahawk. still…
… takes audio from pulseaudio.
- Loading branch information
1 parent
e3f6e61
commit ca369de
Showing
10 changed files
with
275 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Find VSXU - JSON handling library for Qt | ||
# | ||
# This module defines | ||
# VSXU_FOUND - whether the qsjon library was found | ||
# VSXU_LIBRARIES - the vsxu library | ||
# VSXU_INCLUDE_DIRS - the include path of the vsxu library | ||
# | ||
|
||
if (VSXU_INCLUDE_DIRS AND VSXU_LIBRARIES) | ||
|
||
# Already in cache | ||
set (VSXU_FOUND TRUE) | ||
|
||
else (VSXU_INCLUDE_DIRS AND VSXU_LIBRARIES) | ||
|
||
if (NOT WIN32) | ||
# use pkg-config to get the values of VSXU_INCLUDE_DIRS | ||
# and VSXU_LIBRARY_DIRS to add as hints to the find commands. | ||
include (FindPkgConfig) | ||
pkg_check_modules (VSXU REQUIRED libvsxu) | ||
endif (NOT WIN32) | ||
|
||
find_library (VSXU_LIBRARIES | ||
NAMES | ||
libvsxu_engine | ||
PATHS | ||
${VSXU_LIBRARY_DIRS} | ||
${LIB_INSTALL_DIR} | ||
${KDE4_LIB_DIR} | ||
) | ||
|
||
find_path (VSXU_INCLUDE_DIRS | ||
NAMES | ||
vsxu_platform.h | ||
PATHS | ||
${VSXU_INCLUDE_DIRS} | ||
${INCLUDE_INSTALL_DIR} | ||
${KDE4_INCLUDE_DIR} | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(VSXu DEFAULT_MSG VSXU_LIBRARIES VSXU_INCLUDE_DIRS) | ||
|
||
if ( UNIX AND NOT APPLE ) | ||
set ( VSXU_LIBRARIES "${VSXU_LIBRARIES} ${VSXU_LDFLAGS}" CACHE INTERNAL "") | ||
endif () | ||
|
||
endif (VSXU_INCLUDE_DIRS AND VSXU_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#include <QDebug> | ||
|
||
#include "VSXuWidget.h" | ||
|
||
VSXuWidget::VSXuWidget(QWidget *parent): | ||
QGLWidget(parent), | ||
m_isActive(true) | ||
{ | ||
setWindowTitle("Vovoid VSXu"); | ||
m_timer = new QTimer(this); | ||
connect (m_timer , SIGNAL(timeout()), this, SLOT(update())); | ||
} | ||
|
||
void VSXuWidget::injectSound(float soundData[]) | ||
{ | ||
/* uncomment for manual sound injection | ||
for (unsigned long i = 0; i < 512; i++) | ||
{ | ||
sound_wave_test[i] = (float)(rand()%65535-32768)*(1.0f/32768.0f); | ||
} | ||
for (unsigned long i = 0; i < 512; i++) | ||
{ | ||
sound_freq_test[i] = (float)(rand()%65535)*(1.0f/65535.0f); | ||
} | ||
manager->set_sound_freq(&sound_freq_test[0]); | ||
manager->set_sound_wave(&sound_wave_test[0]); | ||
*/ | ||
|
||
updateGL(); | ||
} | ||
|
||
void VSXuWidget::initializeGL() | ||
{ | ||
m_manager = manager_factory(); | ||
// init manager with the shared path and sound input type. | ||
// manual sound injection: manager->init( path.c_str() , "media_player"); | ||
m_manager->init(0 , "pulseaudio"); | ||
|
||
std::vector<std::string> files = m_manager->get_visual_filenames(); | ||
|
||
qDebug()<<files.size(); | ||
for(int i = 0 ; i < files.size(); i++){ | ||
m_visuals.push_back(QString::fromStdString(files[i])); | ||
} | ||
qDebug()<<m_visuals; | ||
|
||
glEnable(GL_BLEND); | ||
glEnable(GL_POLYGON_SMOOTH); | ||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
glClearColor(0, 0, 0, 0); | ||
|
||
glViewport( 0, 0, width(), height()); | ||
|
||
if (context()->format().hasOpenGL()) | ||
qDebug()<<"You have a Valid OpenGL Context"; | ||
if (context()->format().sampleBuffers()) | ||
qDebug()<<"You have Sample Buffers"; | ||
m_timer->start(20); | ||
} | ||
|
||
|
||
void VSXuWidget::paintGL() | ||
{ | ||
if (m_isActive){ | ||
glViewport(0, 0, m_width, m_height); | ||
glMatrixMode(GL_PROJECTION); | ||
glLoadIdentity(); | ||
gluOrtho2D(0, m_width, 0, m_height); // set origin to bottom left corner | ||
glMatrixMode(GL_MODELVIEW); | ||
glLoadIdentity(); | ||
|
||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||
if (m_manager) | ||
m_manager->render(); | ||
} | ||
} | ||
|
||
|
||
VSXuWidget::~VSXuWidget() | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef VSXuWidget_H | ||
#define VSXuWidget_H | ||
|
||
#include <vsx_manager.h> | ||
#include <QGLWidget> | ||
#include <QTimer> | ||
#include <QStringList> | ||
|
||
class VSXuWidget : public QGLWidget | ||
{ | ||
Q_OBJECT | ||
private: | ||
vsx_manager_abs* m_manager; | ||
QTimer *m_timer; // A Timer to frequently update the display | ||
|
||
QStringList m_visuals; | ||
int m_width,m_height; | ||
bool m_isActive; // To Save the CPU when we aren't using VSXu. | ||
|
||
protected: | ||
void initializeGL(); | ||
void resizeGL(int w, int h){ | ||
m_width = w; | ||
m_height = h; | ||
} | ||
void paintGL(); | ||
|
||
public: | ||
VSXuWidget(QWidget *parent = NULL); | ||
~VSXuWidget(); | ||
void injectSound(float soundData[]); | ||
}; | ||
|
||
#endif // VSXuWidget_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Creates a Now Playing page as a place holder for Music Visuals. | ||
Copyright (C) 2012 Dinesh <saidinesh5@gmail.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 3 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, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <QVBoxLayout> | ||
#include <QPushButton> | ||
#include "nowplayingpage.h" | ||
|
||
NowPlayingPage::NowPlayingPage(QWidget* parent): | ||
QWidget(parent) | ||
{ | ||
QVBoxLayout *layout = new QVBoxLayout; | ||
m_VSXuWidget = new VSXuWidget; | ||
layout->addWidget(m_VSXuWidget); | ||
setLayout(layout); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Creates a Now Playing page as a place holder for Music Visuals. | ||
Copyright (C) 2012 Dinesh <saidinesh5@gmail.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 3 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, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
#ifndef NOWPLAYINGPAGE_H | ||
#define NOWPLAYINGPAGE_H | ||
|
||
#include <viewpage.h> | ||
#include <QWidget> | ||
#include "VSXuWidget.h" | ||
|
||
class NowPlayingPage : public QWidget,public Tomahawk::ViewPage | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
NowPlayingPage( QWidget *parent = 0 ); | ||
virtual bool jumpToCurrentTrack() { return false; } | ||
virtual QString description() const { return QString("VSXu Music Visualizer"); } | ||
virtual QString title() const{ return QString("Vovoid VSXu Ultra"); } | ||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } | ||
virtual QWidget* widget(){ return this; } | ||
|
||
private: | ||
VSXuWidget *m_VSXuWidget; | ||
|
||
}; | ||
|
||
#endif // NOWPLAYINGPAGE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters