Skip to content

Commit 9d3bbea

Browse files
author
Justin Frankel
committed
reaper_plugin.h updates for C compat/warning fixes
1 parent 25e52b4 commit 9d3bbea

File tree

2 files changed

+60
-38
lines changed

2 files changed

+60
-38
lines changed

reaper-plugins/reaper_plugin.h

+30-19
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ enum
315315
};
316316
// &0xFFFF0000 is for receiver use
317317

318+
#ifdef __cplusplus
319+
318320
#ifndef _WDL_PROJECTSTATECONTEXT_DEFINED_
319321
#define _REAPER_PLUGIN_PROJECTSTATECONTEXT_DEFINED_
320322
class ProjectStateContext // this is also defined in WDL, need to keep these interfaces identical
@@ -383,6 +385,8 @@ class MIDI_eventlist
383385
virtual ~MIDI_eventlist() { }
384386
};
385387

388+
#endif // __cplusplus
389+
386390
typedef struct _MIDI_eventprops
387391
{
388392
double ppqpos;
@@ -420,6 +424,8 @@ typedef struct _PCM_source_transfer_t
420424
double force_bpm;
421425
} PCM_source_transfer_t;
422426

427+
#ifdef __cplusplus
428+
423429
class REAPER_PeakGet_Interface;
424430

425431
typedef struct _PCM_source_peaktransfer_t
@@ -481,7 +487,7 @@ typedef struct _PCM_source_peaktransfer_t
481487

482488

483489
// used to update MIDI sources with new events during recording
484-
typedef struct
490+
typedef struct _REAPER_midi_realtime_write_struct_t
485491
{
486492
double global_time;
487493
double global_item_time;
@@ -543,7 +549,7 @@ class PCM_source
543549
virtual int Extended(int call, void *parm1, void *parm2, void *parm3) { return 0; } // return 0 if unsupported
544550
};
545551

546-
typedef struct
552+
typedef struct _REAPER_cue
547553
{
548554
int m_id; // ignored for PCM_SINK_EXT_ADDCUE, populated for PCM_SOURCE_EXT_ENUMCUES
549555
double m_time;
@@ -554,15 +560,15 @@ typedef struct
554560
char resvd[124]; // future expansion -- should be 0
555561
} REAPER_cue;
556562

557-
typedef struct
563+
typedef struct _REAPER_slice
558564
{
559565
PCM_source* m_sliceSrc;
560566
double m_beatSnapOffset;
561567
int flag; // &1=only return beatsnapoffset, not slicesrc
562568
char resvd[124]; // future expansion -- should be 0
563569
} REAPER_slice;
564570

565-
typedef struct
571+
typedef struct _REAPER_inline_positioninfo
566572
{
567573
double draw_start_time; // project time at pixel start of draw
568574
int draw_start_y; // if y-scroll is partway into the item, positive pixel value
@@ -577,7 +583,7 @@ typedef struct
577583
} REAPER_inline_positioninfo;
578584

579585

580-
typedef struct
586+
typedef struct _REAPER_tempochg
581587
{
582588
double timepos, qnpos, bpm;
583589
int tsnum, tsdenom;
@@ -707,7 +713,7 @@ enum { RAWMIDI_NOTESONLY=1, RAWMIDI_UNFILTERED=2 };
707713
#define PCM_SOURCE_EXT_GETLAPPING 0xC0100 // parm1 = ReaSample buffer, parm2=(INT_PTR)maxlap, returns size of lapping returned. usually not supported. special purpose.
708714

709715
// register with Register("pcmsrc",&struct ... and unregister with "-pcmsrc"
710-
typedef struct {
716+
typedef struct _REAPER_pcmsrc_register_t {
711717
PCM_source *(*CreateFromType)(const char *type, int priority); // priority is 0-7, 0 is highest
712718
PCM_source *(*CreateFromFile)(const char *filename, int priority); // if priority is 5-7, and the file isn't found, open it in an offline state anyway, thanks
713719

@@ -770,7 +776,7 @@ class ISimpleMediaDecoder
770776
**** PCM sink API
771777
***************************************************************************************/
772778

773-
typedef struct
779+
typedef struct _REAPER_midi_quantize_mode_t
774780
{
775781
bool doquant;
776782
char movemode; // 0=default(l/r), -1=left only, 1=right only
@@ -819,7 +825,7 @@ class PCM_sink
819825
#define PCM_SINK_EXT_SETCURBLOCKTIME 0x80007 // parm1 = (double *) project position -- called before each WriteDoubles etc
820826
#define PCM_SINK_EXT_IS_VIDEO 0x80008
821827

822-
typedef struct // register using "pcmsink"
828+
typedef struct _REAPER_pcmsink_register_t // register using "pcmsink"
823829
{
824830
unsigned int (*GetFmt)(const char **desc);
825831

@@ -829,7 +835,7 @@ typedef struct // register using "pcmsink"
829835

830836
} pcmsink_register_t;
831837

832-
typedef struct // register using "pcmsink_ext"
838+
typedef struct _REAPER_pcmsink_register_ext_t // register using "pcmsink_ext"
833839
{
834840
pcmsink_register_t sink;
835841

@@ -946,6 +952,9 @@ class REAPER_PeakBuild_Interface
946952
#define REAPER_PEAKRES_MUL_MAX 1.0 // recommended for plug-ins, when 1.5pix/peak, switch to hi res source. this may be configurable someday via some sneakiness
947953

948954

955+
#endif // __cplusplus
956+
957+
949958

950959
/*
951960
** accelerator_register_t allows you to register ("accelerator") a record which lets you get a place in the
@@ -975,7 +984,7 @@ typedef struct accelerator_register_t
975984
** for actions, the related callback should be registered with "hookcommand2"
976985
*/
977986

978-
typedef struct
987+
typedef struct _REAPER_custom_action_register_t
979988
{
980989
int uniqueSectionId; // 0/100=main/main alt, 32063=media explorer, 32060=midi editor, 32061=midi event list editor, 32062=midi inline editor, etc
981990
const char* idStr; // must be unique across all sections for actions, NULL for reascripts (automatically generated)
@@ -990,7 +999,7 @@ typedef struct
990999
** key to bind.
9911000
*/
9921001

993-
typedef struct
1002+
typedef struct _REAPER_gaccel_register_t
9941003
{
9951004
ACCEL accel; // key flags/etc represent default values (user may customize)
9961005
const char *desc; // description (for user customizability)
@@ -1001,7 +1010,7 @@ typedef struct
10011010
** (a "help" plugin could register help text for Reaper built-in actions)
10021011
*/
10031012

1004-
typedef struct
1013+
typedef struct _REAPER_action_help_t
10051014
{
10061015
const char* action_desc;
10071016
const char* action_help;
@@ -1052,7 +1061,7 @@ because these menus can be customized and item order can change.
10521061
** editor_register_t lets you integrate editors for "open in external editor" for files directly.
10531062
*/
10541063

1055-
typedef struct // register with "editor"
1064+
typedef struct _REAPER_editor_register_t // register with "editor"
10561065
{
10571066
int (*editFile)(const char *filename, HWND parent, int trackidx); // return TRUE if handled for this file
10581067
const char *(*wouldHandle)(const char *filename); // return your editor's description string
@@ -1065,7 +1074,7 @@ typedef struct // register with "editor"
10651074
**
10661075
** Implemented as a your-format->RPP converter, allowing you to generate directly to a ProjectStateContext
10671076
*/
1068-
typedef struct // register with "projectimport"
1077+
typedef struct _REAPER_project_import_register_t // register with "projectimport"
10691078
{
10701079
bool (*WantProjectFile)(const char *fn); // is this our file?
10711080
const char *(*EnumFileExtensions)(int i, char **descptr); // call increasing i until returns NULL. if descptr's output is NULL, use last description
@@ -1135,13 +1144,13 @@ typedef struct audio_hook_register_t
11351144

11361145
struct KbdAccel;
11371146

1138-
typedef struct
1147+
typedef struct _REAPER_KbdCmd
11391148
{
11401149
DWORD cmd; // action command ID
11411150
const char *text; // description of action
11421151
} KbdCmd;
11431152

1144-
typedef struct
1153+
typedef struct _REAPER_KbdKeyBindingInfo
11451154
{
11461155
int key; // key identifier
11471156
int cmd; // action command ID
@@ -1150,7 +1159,7 @@ typedef struct
11501159

11511160

11521161

1153-
typedef struct
1162+
typedef struct _REAPER_KbdSectionInfo
11541163
{
11551164
int uniqueID; // 0=main, < 0x10000000 for cockos use only plzkthx
11561165
const char *name; // section name
@@ -1179,7 +1188,7 @@ typedef struct
11791188

11801189

11811190

1182-
typedef struct
1191+
typedef struct _REAPER_preview_register_t
11831192
{
11841193
/*
11851194
** Note: you must initialize/deinitialize the cs/mutex (depending on OS) manually, and use it if accessing most parameters while the preview is active.
@@ -1284,6 +1293,7 @@ typedef LRESULT (*screensetNewCallbackFunc)(int action, const char *id, void *pa
12841293
**
12851294
*/
12861295

1296+
#ifdef __cplusplus
12871297

12881298
class midi_Output
12891299
{
@@ -1398,7 +1408,7 @@ class IReaperControlSurface
13981408
#define CSURF_EXT_SUPPORTS_EXTENDED_TOUCH 0x00080001 // returns nonzero if GetTouchState can take isPan=2 for width, etc
13991409
#define CSURF_EXT_MIDI_DEVICE_REMAP 0x00010099 // parm1 = isout, parm2 = old idx, parm3 = new idx
14001410

1401-
typedef struct
1411+
typedef struct _REAPER_reaper_csurf_reg_t
14021412
{
14031413
const char *type_string; // simple unique string with only A-Z, 0-9, no spaces or other chars
14041414
const char *desc_string; // human readable description
@@ -1409,6 +1419,7 @@ typedef struct
14091419

14101420
// note you can also add a control surface behind the scenes with "csurf_inst" (IReaperControlSurface*)instance
14111421

1422+
#endif // __cplusplus
14121423

14131424

14141425
#ifndef UNDO_STATE_ALL

0 commit comments

Comments
 (0)