Move from 100% C to mix of C/C++ to match Audacious 3.6 API
This commit is contained in:
parent
41e6b092e2
commit
9c55e48f43
2
HISTORY
2
HISTORY
|
@ -8,3 +8,5 @@ In October 2003 I've found this plugin and I thought it was really
|
||||||
beautiful so I decided to improve it by adding MMX support and
|
beautiful so I decided to improve it by adding MMX support and
|
||||||
created a project in Sourceforge.
|
created a project in Sourceforge.
|
||||||
In 2013 the project was moved into Github.
|
In 2013 the project was moved into Github.
|
||||||
|
In 2016 code moved from 100% C to mix of C / C++ to match Audacious
|
||||||
|
3.6 API.
|
||||||
|
|
19
configure.ac
19
configure.ac
|
@ -1,7 +1,7 @@
|
||||||
## Process this file with autoconf to produce a configure script.
|
## Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ(2.61)
|
AC_PREREQ(2.61)
|
||||||
AC_INIT([Infinity plugin],[0.8.0beta2],[dprotti@users.sourceforge.net],[infinity-plugin-4-audacious])
|
AC_INIT([Infinity plugin],[0.9.0alpha],[dprotti@users.sourceforge.net],[infinity-plugin-4-audacious])
|
||||||
AM_INIT_AUTOMAKE([1.9.0 dist-bzip2])
|
AM_INIT_AUTOMAKE([1.9.0 dist-bzip2])
|
||||||
|
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
@ -12,7 +12,7 @@ AC_PREFIX_PROGRAM(audacious)
|
||||||
AC_CANONICAL_TARGET
|
AC_CANONICAL_TARGET
|
||||||
|
|
||||||
# Check for programs.
|
# Check for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CXX
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
AC_DISABLE_STATIC
|
AC_DISABLE_STATIC
|
||||||
|
@ -121,6 +121,7 @@ INF_CFLAGS_EXTRA=''
|
||||||
|
|
||||||
if test x"$GCC" = xyes; then
|
if test x"$GCC" = xyes; then
|
||||||
INF_CFLAGS_EXTRA="${INF_CFLAGS_EXTRA} -Wall -Wimplicit -Wunused -Wmissing-prototypes"
|
INF_CFLAGS_EXTRA="${INF_CFLAGS_EXTRA} -Wall -Wimplicit -Wunused -Wmissing-prototypes"
|
||||||
|
CXXFLAGS="${CXXFLAGS} -std=c++11"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([vectorization],
|
AC_ARG_ENABLE([vectorization],
|
||||||
|
@ -166,6 +167,19 @@ fi
|
||||||
|
|
||||||
AC_SUBST(INF_CFLAGS_EXTRA)
|
AC_SUBST(INF_CFLAGS_EXTRA)
|
||||||
|
|
||||||
|
dnl Prevent symbol collisions
|
||||||
|
dnl =========================
|
||||||
|
if test "x$HAVE_MSWINDOWS" = "xyes" ; then
|
||||||
|
EXPORT="__declspec(dllexport)"
|
||||||
|
elif test "x$GCC" = "xyes" ; then
|
||||||
|
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
|
||||||
|
EXPORT="__attribute__((visibility(\"default\")))"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([Unknown syntax for EXPORT keyword])
|
||||||
|
fi
|
||||||
|
AC_DEFINE_UNQUOTED([EXPORT], [$EXPORT], [Compiler syntax for export of public symbols])
|
||||||
|
|
||||||
AC_CHECK_FILE("${prefix}/lib/x86_64-linux-gnu/libSDL.so",
|
AC_CHECK_FILE("${prefix}/lib/x86_64-linux-gnu/libSDL.so",
|
||||||
# Ubuntu on AMD64 puts libraries into x86_64-linux-gnu/
|
# Ubuntu on AMD64 puts libraries into x86_64-linux-gnu/
|
||||||
libdir="${libdir}/x86_64-linux-gnu/audacious/Visualization",
|
libdir="${libdir}/x86_64-linux-gnu/audacious/Visualization",
|
||||||
|
@ -189,6 +203,7 @@ Infinity Plugin for the Audacious Player -- version $VERSION
|
||||||
Install path : ${libdir}
|
Install path : ${libdir}
|
||||||
Compiler : ${CC}
|
Compiler : ${CC}
|
||||||
CFLAGS : ${INF_CFLAGS_EXTRA} ${CFLAGS}
|
CFLAGS : ${INF_CFLAGS_EXTRA} ${CFLAGS}
|
||||||
|
CXXFLAGS : ${CXXFLAGS}
|
||||||
Debug enabled : ${debug}
|
Debug enabled : ${debug}
|
||||||
MMX Extensions support : ${mmx}
|
MMX Extensions support : ${mmx}
|
||||||
"
|
"
|
||||||
|
|
|
@ -10,14 +10,17 @@ infinity_datadir = @datadir@
|
||||||
localedir = $(infinity_datadir)/locale
|
localedir = $(infinity_datadir)/locale
|
||||||
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||||
|
|
||||||
AM_CFLAGS = @CFLAGS@ @AUDACIOUS_CFLAGS@ @AUDCLIENT_CFLAGS@ @SDL_CFLAGS@ @GTK_CFLAGS@\
|
COMMON_FLAGS = @AUDACIOUS_CFLAGS@ @AUDCLIENT_CFLAGS@ @SDL_CFLAGS@ @GTK_CFLAGS@\
|
||||||
@GLIB_CFLAGS@ @DBUSGLIB1_CFLAGS@ $(INF_CFLAGS_EXTRA) -DDATADIR='"$(datadir)"'
|
@GLIB_CFLAGS@ @DBUSGLIB1_CFLAGS@ $(INF_CFLAGS_EXTRA) -DDATADIR='"$(datadir)"'
|
||||||
|
|
||||||
libinfinite_la_LDFLAGS = -export-dynamic -avoid-version
|
AM_CFLAGS = @CFLAGS@ $(COMMON_FLAGS)
|
||||||
|
AM_CXXFLAGS = @CXXFLAGS@ $(COMMON_FLAGS)
|
||||||
|
|
||||||
|
libinfinite_la_LDFLAGS = ${CXX}
|
||||||
libinfinite_la_LIBADD = @AUDACIOUS_LIBS@ @AUDCLIENT_LIBS@ @SDL_LIBS@ @GTK_LIBS@ @GLIB_LIBS@ @DBUSGLIB1_LIBS@
|
libinfinite_la_LIBADD = @AUDACIOUS_LIBS@ @AUDCLIENT_LIBS@ @SDL_LIBS@ @GTK_LIBS@ @GLIB_LIBS@ @DBUSGLIB1_LIBS@
|
||||||
libinfinite_la_SOURCES = \
|
libinfinite_la_SOURCES = \
|
||||||
main.c \
|
main.cc \
|
||||||
renderer.c renderer.h\
|
renderer.cc renderer.h\
|
||||||
compute.c compute.h \
|
compute.c compute.h \
|
||||||
display.c display.h \
|
display.c display.h \
|
||||||
infconfig.c infconfig.h\
|
infconfig.c infconfig.h\
|
||||||
|
|
|
@ -21,59 +21,54 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <audacious/plugin.h>
|
#include <libaudcore/plugin.h>
|
||||||
|
#include <libaudcore/preferences.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "infconfig.h"
|
#include "infconfig.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
}
|
||||||
|
|
||||||
static const char infinity_about[] =
|
static const char about_text[] =
|
||||||
N_("Infinity Visualization Plugin for Audacious\n\n"
|
N_("Infinity Visualization Plugin for Audacious\n\n"
|
||||||
"Version " PACKAGE_VERSION "\n\n"
|
"Version " PACKAGE_VERSION "\n\n"
|
||||||
"https://github.com/dprotti/infinity-plugin");
|
"https://github.com/dprotti/infinity-plugin");
|
||||||
|
|
||||||
static bool_t plugin_init(void);
|
static const PreferencesWidget prefs_widgets[] = {
|
||||||
static void plugin_close(void);
|
WidgetLabel ("<b>Coming soon...</b>")
|
||||||
static void clear(void);
|
};
|
||||||
|
|
||||||
/*
|
static const PluginPreferences preferences = {{prefs_widgets}};
|
||||||
* Registers plugin with Audacious.
|
|
||||||
*/
|
|
||||||
AUD_VIS_PLUGIN(
|
|
||||||
.name = "Infinity",
|
|
||||||
.init = plugin_init,
|
|
||||||
.cleanup = plugin_close,
|
|
||||||
.take_message = NULL,
|
|
||||||
.about = NULL,
|
|
||||||
.about_text = infinity_about,
|
|
||||||
.configure = config_plugin_config_window,
|
|
||||||
//.playback_stop = NULL,
|
|
||||||
|
|
||||||
/* reset internal state and clear display */
|
class InfinityPlugin : VisPlugin {
|
||||||
.clear = clear,
|
|
||||||
|
|
||||||
/* 512 frames of a single-channel PCM signal */
|
public:
|
||||||
.render_mono_pcm = NULL,
|
static constexpr PluginInfo info = {
|
||||||
|
N_("Infinity"),
|
||||||
|
PACKAGE,
|
||||||
|
about_text,
|
||||||
|
& preferences
|
||||||
|
};
|
||||||
|
|
||||||
/* 512 frames of an interleaved multi-channel PCM signal */
|
constexpr InfinityPlugin () : VisPlugin (info, Visualizer::MultiPCM) {}
|
||||||
.render_multi_pcm = renderer_render_multi_pcm,
|
|
||||||
|
|
||||||
/* intensity of frequencies 1/512, 2/512, ..., 256/512 of sample rate */
|
bool init ();
|
||||||
.render_freq = NULL,
|
void cleanup ();
|
||||||
|
|
||||||
/* GtkWidget * (* get_widget) (void); */
|
//void * get_gtk_widget ();
|
||||||
.get_widget = NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
static void clear(void)
|
void clear ();
|
||||||
{
|
void render_multi_pcm (const float * pcm, int channels);
|
||||||
g_message("TODO implement clear()");
|
};
|
||||||
}
|
|
||||||
|
|
||||||
static bool_t plugin_init(void)
|
|
||||||
|
EXPORT InfinityPlugin aud_plugin_instance;
|
||||||
|
|
||||||
|
bool InfinityPlugin::init(void)
|
||||||
{
|
{
|
||||||
#if ENABLE_NLS
|
#if ENABLE_NLS
|
||||||
(void)setlocale(LC_MESSAGES, "");
|
(void)setlocale(LC_MESSAGES, "");
|
||||||
|
@ -99,8 +94,18 @@ static bool_t plugin_init(void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void plugin_close(void)
|
void InfinityPlugin::clear ()
|
||||||
{
|
{
|
||||||
|
g_message("TODO implement clear()");
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfinityPlugin::cleanup(void)
|
||||||
|
{
|
||||||
|
g_message("cleanup()");
|
||||||
config_plugin_save_prefs();
|
config_plugin_save_prefs();
|
||||||
renderer_finish();
|
renderer_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InfinityPlugin::render_multi_pcm (const float * pcm, int channels) {
|
||||||
|
renderer_render_multi_pcm(pcm, channels);
|
||||||
|
}
|
|
@ -20,10 +20,10 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
|
|
||||||
#include <audacious/audctrl.h>
|
#include <libaudcore/playlist.h>
|
||||||
#include <audacious/playlist.h>
|
#include <libaudcore/drct.h>
|
||||||
#include <audacious/drct.h>
|
|
||||||
|
|
||||||
|
#include <audacious/audctrl.h>
|
||||||
#include <audacious/dbus.h>
|
#include <audacious/dbus.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
#include <SDL/SDL_thread.h>
|
#include <SDL/SDL_thread.h>
|
||||||
/*#include <SDL/SDL_syswm.h>*/
|
/*#include <SDL/SDL_syswm.h>*/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
#if MMX_DETECTION
|
#if MMX_DETECTION
|
||||||
#include "cputest.h"
|
#include "cputest.h"
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#define wrap(a) (a < 0 ? 0 : (a > 255 ? 255 : a))
|
#define wrap(a) (a < 0 ? 0 : (a > 255 ? 255 : a))
|
||||||
#define next_effect() (t_last_effect++)
|
#define next_effect() (t_last_effect++)
|
||||||
|
@ -92,15 +94,15 @@ static void set_title(void);
|
||||||
void renderer_init(void)
|
void renderer_init(void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gint32 try;
|
gint32 _try;
|
||||||
|
|
||||||
if (initializing) {
|
if (initializing) {
|
||||||
g_warning(_("We are already initializing"));
|
g_warning(_("We are already initializing"));
|
||||||
try = 0;
|
_try = 0;
|
||||||
while (initializing) {
|
while (initializing) {
|
||||||
g_usleep(1000000);
|
g_usleep(1000000);
|
||||||
(void)sleep(1);
|
(void)sleep(1);
|
||||||
if (try++ > 10)
|
if (_try++ > 10)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,14 +156,14 @@ void renderer_init(void)
|
||||||
|
|
||||||
void renderer_finish(void)
|
void renderer_finish(void)
|
||||||
{
|
{
|
||||||
gint32 try;
|
gint32 _try;
|
||||||
|
|
||||||
if (initializing) {
|
if (initializing) {
|
||||||
g_warning(_("The plugin have not yet initialized"));
|
g_warning(_("The plugin have not yet initialized"));
|
||||||
try = 0;
|
_try = 0;
|
||||||
while (initializing) {
|
while (initializing) {
|
||||||
g_usleep(1000000);
|
g_usleep(1000000);
|
||||||
if (try++ > 10)
|
if (_try++ > 10)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,14 +261,14 @@ static void check_events()
|
||||||
if (aud_drct_get_playing() && aud_drct_get_ready()) {
|
if (aud_drct_get_playing() && aud_drct_get_ready()) {
|
||||||
if (current_title)
|
if (current_title)
|
||||||
g_free(current_title);
|
g_free(current_title);
|
||||||
current_title = g_strdup(aud_playlist_entry_get_title(aud_playlist_get_playing(), aud_playlist_get_position(aud_playlist_get_playing()), FALSE));
|
String title = aud_playlist_get_title(aud_playlist_get_playing());
|
||||||
set_title();
|
current_title = g_strdup(title.to_raw());
|
||||||
} else {
|
} else {
|
||||||
if (current_title)
|
if (current_title)
|
||||||
g_free(current_title);
|
g_free(current_title);
|
||||||
current_title = g_strdup("Infinity");
|
current_title = g_strdup("Infinity");
|
||||||
set_title();
|
|
||||||
}
|
}
|
||||||
|
set_title();
|
||||||
g_timer_reset(title_timer);
|
g_timer_reset(title_timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,12 +327,12 @@ static void check_events()
|
||||||
aud_drct_seek(aud_drct_get_time() - 5000);
|
aud_drct_seek(aud_drct_get_time() - 5000);
|
||||||
break;
|
break;
|
||||||
case SDLK_UP:
|
case SDLK_UP:
|
||||||
aud_drct_get_volume_main(&volume);
|
volume = aud_drct_get_volume_main();
|
||||||
g_message(_("Increasing volume to %d"), volume + 5);
|
g_message(_("Increasing volume to %d"), volume + 5);
|
||||||
aud_drct_set_volume_main(volume + 5);
|
aud_drct_set_volume_main(volume + 5);
|
||||||
break;
|
break;
|
||||||
case SDLK_DOWN:
|
case SDLK_DOWN:
|
||||||
aud_drct_get_volume_main(&volume);
|
volume = aud_drct_get_volume_main();
|
||||||
g_message(_("Decreasing volume to %d"), volume - 5);
|
g_message(_("Decreasing volume to %d"), volume - 5);
|
||||||
aud_drct_set_volume_main(volume - 5);
|
aud_drct_set_volume_main(volume - 5);
|
||||||
break;
|
break;
|
Loading…
Reference in New Issue