aboutsummaryrefslogtreecommitdiffstats
path: root/medley_new/src/lib/projectM/cwrapper/projectM-cwrapper.h
blob: 125b12531e142e5d2c09a30796fe205bb5985d19 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#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
#define PROJECTM_VERSION_2_00_00 2000000 // 2.00.00 = 2.0

// version of projectM to wrap (see PROJECTM_VERSION)
#ifndef PROJECTM_VERSION_INT
#define PROJECTM_VERSION_INT PROJECTM_VERSION_2_00_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