aboutsummaryrefslogtreecommitdiffstats
path: root/ServiceBasedPlugins/src/lib/projectM/cwrapper
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-21 19:25:18 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-21 19:25:18 +0000
commitb38772ffdbcc6bf2189d0e14a9828f911ea44a7d (patch)
tree2101a9210ae02284af56415f65e9f108ebd12163 /ServiceBasedPlugins/src/lib/projectM/cwrapper
parent5d69ab51fd28961fd43b7e7646768b5a6dcbcb25 (diff)
downloadusdx-b38772ffdbcc6bf2189d0e14a9828f911ea44a7d.tar.gz
usdx-b38772ffdbcc6bf2189d0e14a9828f911ea44a7d.tar.xz
usdx-b38772ffdbcc6bf2189d0e14a9828f911ea44a7d.zip
new branch for whiteshark's service and hook based (party) plugins
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1643 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--ServiceBasedPlugins/src/lib/projectM/cwrapper/Makefile.in41
-rw-r--r--ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.cpp104
-rw-r--r--ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.h67
-rw-r--r--ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.sln20
-rw-r--r--ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.vcproj208
5 files changed, 440 insertions, 0 deletions
diff --git a/ServiceBasedPlugins/src/lib/projectM/cwrapper/Makefile.in b/ServiceBasedPlugins/src/lib/projectM/cwrapper/Makefile.in
new file mode 100644
index 00000000..fef3b80b
--- /dev/null
+++ b/ServiceBasedPlugins/src/lib/projectM/cwrapper/Makefile.in
@@ -0,0 +1,41 @@
+#################################################
+# projectM C-wrapper
+# @configure_input@
+#################################################
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+OBJECTS = projectM-cwrapper.o
+LIBRARY = libprojectM-cwrapper.a
+
+CXX = @CXX@
+CXXFLAGS += @CXXFLAGS@
+INCLUDES = -I@libprojectM_INCLUDEDIR@/libprojectM
+DEFINES = -DPROJECTM_VERSION_INT=@libprojectM_VERSION_INT@
+RANLIB = @RANLIB@
+
+.PHONY: all clean distclean strip
+
+all : $(LIBRARY)
+
+$(LIBRARY): $(OBJECTS)
+ ar ruv $(LIBRARY) $(OBJECTS)
+ $(RANLIB) $(LIBRARY)
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $(DEFINES) $(INCLUDES) -c $(<) -o $@
+
+clean :
+ rm -f $(LIBRARY)
+ rm -f $(OBJECTS)
+
+distclean: clean
+ rm -rf Makefile
+
+strip :
+ strip $(LIBRARY)
+ $(RANLIB) $(LIBRARY)
+
diff --git a/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.cpp b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.cpp
new file mode 100644
index 00000000..ebf43554
--- /dev/null
+++ b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.cpp
@@ -0,0 +1,104 @@
+#include "projectM-cwrapper.h"
+
+#define PM_CLASS(pm) ((projectM*)pm)
+
+#if (PROJECTM_VERSION_INT > 1000000)
+#define PM_PCM(pm) (PM_CLASS(pm)->pcm())
+#else
+#define PM_PCM(pm) (PM_CLASS(pm)->pcm)
+#endif
+
+projectM_ptr projectM_create1(char* config_file)
+{
+ return projectM_ptr(new projectM(config_file));
+}
+
+#if (PROJECTM_VERSION_INT < 1000000)
+projectM_ptr projectM_create2(int gx, int gy, int fps, int texsize,
+ int width, int height, char* preset_url,
+ char* title_fonturl, char* title_menuurl)
+{
+ return projectM_ptr(new projectM(gx, gy, fps, texsize, width, height,
+ preset_url, title_fonturl, title_menuurl));}
+#endif
+
+void projectM_resetGL(projectM_ptr pm, int width, int height)
+{
+ PM_CLASS(pm)->projectM_resetGL(width, height);
+}
+
+void projectM_setTitle(projectM_ptr pm, char* title)
+{
+ PM_CLASS(pm)->projectM_setTitle(title);
+}
+
+void projectM_renderFrame(projectM_ptr pm)
+{
+ PM_CLASS(pm)->renderFrame();
+}
+
+unsigned projectM_initRenderToTexture(projectM_ptr pm)
+{
+ return PM_CLASS(pm)->initRenderToTexture();
+}
+
+void projectM_key_handler(projectM_ptr pm, projectMEvent event,
+ projectMKeycode keycode, projectMModifier modifier)
+{
+ PM_CLASS(pm)->key_handler(event, keycode, modifier);
+}
+
+void projectM_free(projectM_ptr pm)
+{
+ delete PM_CLASS(pm);
+}
+
+void PCM_addPCMfloat(projectM_ptr pm, float *PCMdata, int samples)
+{
+ PM_PCM(pm)->addPCMfloat(PCMdata, samples);
+}
+
+void PCM_addPCM16(projectM_ptr pm, short pcm_data[2][512])
+{
+ PM_PCM(pm)->addPCM16(pcm_data);
+}
+
+void PCM_addPCM16Data(projectM_ptr pm, const short* pcm_data, short samples)
+{
+ PM_PCM(pm)->addPCM16Data(pcm_data, samples);
+}
+
+void PCM_addPCM8(projectM_ptr pm, unsigned char pcm_data[2][1024])
+{
+ PM_PCM(pm)->addPCM8(pcm_data);
+}
+
+void PCM_addPCM8_512(projectM_ptr pm, const unsigned char pcm_data[2][512])
+{
+ PM_PCM(pm)->addPCM8_512(pcm_data);
+}
+
+#define COPY_FIELD(c_ptr, s, fld) (c_ptr->fld = s.fld)
+
+#if (PROJECTM_VERSION_INT > 1000000)
+void projectM_settings(projectM_ptr pm, Settings* settings)
+{
+ const projectM::Settings& pmSettings = PM_CLASS(pm)->settings();
+
+ COPY_FIELD(settings, pmSettings, meshX);
+ COPY_FIELD(settings, pmSettings, meshY);
+ COPY_FIELD(settings, pmSettings, fps);
+ COPY_FIELD(settings, pmSettings, textureSize);
+ COPY_FIELD(settings, pmSettings, windowWidth);
+ COPY_FIELD(settings, pmSettings, windowHeight);
+ settings->presetURL = pmSettings.presetURL.c_str();
+ settings->titleFontURL = pmSettings.titleFontURL.c_str();
+ settings->menuFontURL = pmSettings.menuFontURL.c_str();
+ COPY_FIELD(settings, pmSettings, smoothPresetDuration);
+ COPY_FIELD(settings, pmSettings, presetDuration);
+ COPY_FIELD(settings, pmSettings, beatSensitivity);
+ COPY_FIELD(settings, pmSettings, aspectCorrection);
+ COPY_FIELD(settings, pmSettings, easterEgg);
+ COPY_FIELD(settings, pmSettings, shuffleEnabled);
+}
+#endif
diff --git a/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.h b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.h
new file mode 100644
index 00000000..43f36ef4
--- /dev/null
+++ b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.h
@@ -0,0 +1,67 @@
+#ifndef __PROJECTM_CWRAPPER_H__
+#define __PROJECTM_CWRAPPER_H__
+
+#include "projectM.hpp"
+
+// PROJECTM_VERSION define is not very helpful, lets create our own
+#define PROJECTM_VERSION_1_00_00 1000000 // 1.00.00 = 1.0 or 1.01 (same version number for 1.0 and 1.01)
+#define PROJECTM_VERSION_1_10_00 1010000 // 1.10.00 = 1.1 (bigger than 1.2 due to strange versioning)
+#define PROJECTM_VERSION_1_02_00 1002000 // 1.02.00 = 1.2
+
+// version of projectM to wrap (see PROJECTM_VERSION)
+#ifndef PROJECTM_VERSION_INT
+#define PROJECTM_VERSION_INT PROJECTM_VERSION_1_02_00
+#endif
+
+extern "C" {
+
+ #if (PROJECTM_VERSION_INT > 1000000)
+ struct Settings {
+ int meshX;
+ int meshY;
+ int fps;
+ int textureSize;
+ int windowWidth;
+ int windowHeight;
+ const char* presetURL;
+ const char* titleFontURL;
+ const char* menuFontURL;
+ int smoothPresetDuration;
+ int presetDuration;
+ float beatSensitivity;
+ char aspectCorrection;
+ float easterEgg;
+ char shuffleEnabled;
+ };
+ #endif
+
+ typedef void* projectM_ptr;
+
+ DLLEXPORT projectM_ptr projectM_create1(char* config_file);
+ #if (PROJECTM_VERSION_INT < 1000000)
+ DLLEXPORT projectM_ptr projectM_create2(int gx, int gy, int fps, int texsize,
+ int width, int height, char* preset_url,
+ char* title_fonturl, char* title_menuurl);
+ #endif
+
+ DLLEXPORT void projectM_resetGL(projectM_ptr pm, int width, int height);
+ DLLEXPORT void projectM_setTitle(projectM_ptr pm, char* title);
+ DLLEXPORT void projectM_renderFrame(projectM_ptr pm);
+ DLLEXPORT unsigned projectM_initRenderToTexture(projectM_ptr pm);
+ DLLEXPORT void projectM_key_handler(projectM_ptr pm, projectMEvent event,
+ projectMKeycode keycode, projectMModifier modifier);
+
+ DLLEXPORT void projectM_free(projectM_ptr pm);
+
+ DLLEXPORT void PCM_addPCMfloat(projectM_ptr pm, float *PCMdata, int samples);
+ DLLEXPORT void PCM_addPCM16(projectM_ptr pm, short [2][512]);
+ DLLEXPORT void PCM_addPCM16Data(projectM_ptr pm, const short* pcm_data, short samples);
+ DLLEXPORT void PCM_addPCM8(projectM_ptr pm, unsigned char [2][1024]);
+ DLLEXPORT void PCM_addPCM8_512(projectM_ptr pm, const unsigned char [2][512]);
+
+ #if (PROJECTM_VERSION_INT > 1000000)
+ DLLEXPORT void projectM_settings(projectM_ptr pm, Settings* settings);
+ #endif
+}
+
+#endif
diff --git a/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.sln b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.sln
new file mode 100644
index 00000000..e05f79a3
--- /dev/null
+++ b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "projectM-cwrapper", "projectM-cwrapper.vcproj", "{8E653284-12F3-4A90-9D0D-4195557051F7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8E653284-12F3-4A90-9D0D-4195557051F7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8E653284-12F3-4A90-9D0D-4195557051F7}.Debug|Win32.Build.0 = Debug|Win32
+ {8E653284-12F3-4A90-9D0D-4195557051F7}.Release|Win32.ActiveCfg = Release|Win32
+ {8E653284-12F3-4A90-9D0D-4195557051F7}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.vcproj b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.vcproj
new file mode 100644
index 00000000..94e848d7
--- /dev/null
+++ b/ServiceBasedPlugins/src/lib/projectM/cwrapper/projectM-cwrapper.vcproj
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="projectM-cwrapper"
+ ProjectGUID="{8E653284-12F3-4A90-9D0D-4195557051F7}"
+ RootNamespace="projectMcwrapper"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;D:\daten\ultrastar\libprojectM\libprojectM-1.2.0\projectM&quot;;&quot;D:\daten\ultrastar\libprojectM\libs\pthreads\Pre-built.2\include&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PROJECTMCWRAPPER_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libprojectM.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="&quot;D:\daten\ultrastar\libprojectM\libprojectM-1.2.0\projectM\Debug&quot;"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;D:\daten\ultrastar\libprojectM\libprojectM-1.2.0\projectM&quot;;&quot;D:\daten\ultrastar\libprojectM\libs\pthreads\Pre-built.2\include&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PROJECTMCWRAPPER_EXPORTS"
+ ExceptionHandling="1"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libprojectM.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="&quot;D:\daten\ultrastar\libprojectM\libprojectM-1.2.0\projectM\Release&quot;"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\projectM-cwrapper.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\projectM-cwrapper.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Ressourcendateien"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>