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
|
||||
created a project in Sourceforge.
|
||||
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.
|
||||
|
||||
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])
|
||||
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
@ -12,7 +12,7 @@ AC_PREFIX_PROGRAM(audacious)
|
|||
AC_CANONICAL_TARGET
|
||||
|
||||
# Check for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_DISABLE_STATIC
|
||||
|
@ -121,6 +121,7 @@ INF_CFLAGS_EXTRA=''
|
|||
|
||||
if test x"$GCC" = xyes; then
|
||||
INF_CFLAGS_EXTRA="${INF_CFLAGS_EXTRA} -Wall -Wimplicit -Wunused -Wmissing-prototypes"
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++11"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([vectorization],
|
||||
|
@ -166,6 +167,19 @@ fi
|
|||
|
||||
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",
|
||||
# Ubuntu on AMD64 puts libraries into x86_64-linux-gnu/
|
||||
libdir="${libdir}/x86_64-linux-gnu/audacious/Visualization",
|
||||
|
@ -189,6 +203,7 @@ Infinity Plugin for the Audacious Player -- version $VERSION
|
|||
Install path : ${libdir}
|
||||
Compiler : ${CC}
|
||||
CFLAGS : ${INF_CFLAGS_EXTRA} ${CFLAGS}
|
||||
CXXFLAGS : ${CXXFLAGS}
|
||||
Debug enabled : ${debug}
|
||||
MMX Extensions support : ${mmx}
|
||||
"
|
||||
|
|
|
@ -10,14 +10,17 @@ infinity_datadir = @datadir@
|
|||
localedir = $(infinity_datadir)/locale
|
||||
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)"'
|
||||
|
||||
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_SOURCES = \
|
||||
main.c \
|
||||
renderer.c renderer.h\
|
||||
main.cc \
|
||||
renderer.cc renderer.h\
|
||||
compute.c compute.h \
|
||||
display.c display.h \
|
||||
infconfig.c infconfig.h\
|
||||
|
|
|
@ -21,59 +21,54 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <audacious/plugin.h>
|
||||
#include <libaudcore/plugin.h>
|
||||
#include <libaudcore/preferences.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
extern "C" {
|
||||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
#include "infconfig.h"
|
||||
#include "renderer.h"
|
||||
}
|
||||
|
||||
static const char infinity_about[] =
|
||||
static const char about_text[] =
|
||||
N_("Infinity Visualization Plugin for Audacious\n\n"
|
||||
"Version " PACKAGE_VERSION "\n\n"
|
||||
"https://github.com/dprotti/infinity-plugin");
|
||||
|
||||
static bool_t plugin_init(void);
|
||||
static void plugin_close(void);
|
||||
static void clear(void);
|
||||
static const PreferencesWidget prefs_widgets[] = {
|
||||
WidgetLabel ("<b>Coming soon...</b>")
|
||||
};
|
||||
|
||||
/*
|
||||
* 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,
|
||||
static const PluginPreferences preferences = {{prefs_widgets}};
|
||||
|
||||
/* reset internal state and clear display */
|
||||
.clear = clear,
|
||||
class InfinityPlugin : VisPlugin {
|
||||
|
||||
/* 512 frames of a single-channel PCM signal */
|
||||
.render_mono_pcm = NULL,
|
||||
public:
|
||||
static constexpr PluginInfo info = {
|
||||
N_("Infinity"),
|
||||
PACKAGE,
|
||||
about_text,
|
||||
& preferences
|
||||
};
|
||||
|
||||
/* 512 frames of an interleaved multi-channel PCM signal */
|
||||
.render_multi_pcm = renderer_render_multi_pcm,
|
||||
constexpr InfinityPlugin () : VisPlugin (info, Visualizer::MultiPCM) {}
|
||||
|
||||
/* intensity of frequencies 1/512, 2/512, ..., 256/512 of sample rate */
|
||||
.render_freq = NULL,
|
||||
bool init ();
|
||||
void cleanup ();
|
||||
|
||||
/* GtkWidget * (* get_widget) (void); */
|
||||
.get_widget = NULL
|
||||
);
|
||||
//void * get_gtk_widget ();
|
||||
|
||||
static void clear(void)
|
||||
{
|
||||
g_message("TODO implement clear()");
|
||||
}
|
||||
void clear ();
|
||||
void render_multi_pcm (const float * pcm, int channels);
|
||||
};
|
||||
|
||||
static bool_t plugin_init(void)
|
||||
|
||||
EXPORT InfinityPlugin aud_plugin_instance;
|
||||
|
||||
bool InfinityPlugin::init(void)
|
||||
{
|
||||
#if ENABLE_NLS
|
||||
(void)setlocale(LC_MESSAGES, "");
|
||||
|
@ -99,8 +94,18 @@ static bool_t plugin_init(void)
|
|||
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();
|
||||
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 <dbus/dbus.h>
|
||||
|
||||
#include <audacious/audctrl.h>
|
||||
#include <audacious/playlist.h>
|
||||
#include <audacious/drct.h>
|
||||
#include <libaudcore/playlist.h>
|
||||
#include <libaudcore/drct.h>
|
||||
|
||||
#include <audacious/audctrl.h>
|
||||
#include <audacious/dbus.h>
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include <SDL/SDL_thread.h>
|
||||
/*#include <SDL/SDL_syswm.h>*/
|
||||
|
||||
extern "C" {
|
||||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
#include "renderer.h"
|
||||
|
@ -41,6 +42,7 @@
|
|||
#if MMX_DETECTION
|
||||
#include "cputest.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
#define wrap(a) (a < 0 ? 0 : (a > 255 ? 255 : a))
|
||||
#define next_effect() (t_last_effect++)
|
||||
|
@ -92,15 +94,15 @@ static void set_title(void);
|
|||
void renderer_init(void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gint32 try;
|
||||
gint32 _try;
|
||||
|
||||
if (initializing) {
|
||||
g_warning(_("We are already initializing"));
|
||||
try = 0;
|
||||
_try = 0;
|
||||
while (initializing) {
|
||||
g_usleep(1000000);
|
||||
(void)sleep(1);
|
||||
if (try++ > 10)
|
||||
if (_try++ > 10)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -154,14 +156,14 @@ void renderer_init(void)
|
|||
|
||||
void renderer_finish(void)
|
||||
{
|
||||
gint32 try;
|
||||
gint32 _try;
|
||||
|
||||
if (initializing) {
|
||||
g_warning(_("The plugin have not yet initialized"));
|
||||
try = 0;
|
||||
_try = 0;
|
||||
while (initializing) {
|
||||
g_usleep(1000000);
|
||||
if (try++ > 10)
|
||||
if (_try++ > 10)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -259,14 +261,14 @@ static void check_events()
|
|||
if (aud_drct_get_playing() && aud_drct_get_ready()) {
|
||||
if (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));
|
||||
set_title();
|
||||
String title = aud_playlist_get_title(aud_playlist_get_playing());
|
||||
current_title = g_strdup(title.to_raw());
|
||||
} else {
|
||||
if (current_title)
|
||||
g_free(current_title);
|
||||
current_title = g_strdup("Infinity");
|
||||
set_title();
|
||||
}
|
||||
set_title();
|
||||
g_timer_reset(title_timer);
|
||||
}
|
||||
}
|
||||
|
@ -325,12 +327,12 @@ static void check_events()
|
|||
aud_drct_seek(aud_drct_get_time() - 5000);
|
||||
break;
|
||||
case SDLK_UP:
|
||||
aud_drct_get_volume_main(&volume);
|
||||
volume = aud_drct_get_volume_main();
|
||||
g_message(_("Increasing volume to %d"), volume + 5);
|
||||
aud_drct_set_volume_main(volume + 5);
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
aud_drct_get_volume_main(&volume);
|
||||
volume = aud_drct_get_volume_main();
|
||||
g_message(_("Decreasing volume to %d"), volume - 5);
|
||||
aud_drct_set_volume_main(volume - 5);
|
||||
break;
|
Loading…
Reference in New Issue