From 6700a2a93dc865f0a2490ce1ee8a3fbdbdbc0d1a Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 9 Jun 2017 06:39:52 +0000 Subject: [PATCH] libxmp-lite: Changes to build as C++: Structs within other structs cannot be referred to by just the innermost name, and the using keyword does not work either. Split them out into the top level. git-svn-id: https://svn.eduke32.com/eduke32@6161 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/libxmp-lite/include/libxmp-lite/xmp.h | 86 ++++++++++---------- source/libxmp-lite/src/common.h | 47 ++++++----- 2 files changed, 71 insertions(+), 62 deletions(-) diff --git a/source/libxmp-lite/include/libxmp-lite/xmp.h b/source/libxmp-lite/include/libxmp-lite/xmp.h index 101f8912a..47609e3a3 100644 --- a/source/libxmp-lite/include/libxmp-lite/xmp.h +++ b/source/libxmp-lite/include/libxmp-lite/xmp.h @@ -171,6 +171,36 @@ struct xmp_envelope { short data[XMP_MAX_ENV_POINTS * 2]; }; +struct xmp_subinstrument { + int vol; /* Default volume */ + int gvl; /* Global volume */ + int pan; /* Pan */ + int xpo; /* Transpose */ + int fin; /* Finetune */ + int vwf; /* Vibrato waveform */ + int vde; /* Vibrato depth */ + int vra; /* Vibrato rate */ + int vsw; /* Vibrato sweep */ + int rvv; /* Random volume/pan variation (IT) */ + int sid; /* Sample number */ +#define XMP_INST_NNA_CUT 0x00 +#define XMP_INST_NNA_CONT 0x01 +#define XMP_INST_NNA_OFF 0x02 +#define XMP_INST_NNA_FADE 0x03 + int nna; /* New note action */ +#define XMP_INST_DCT_OFF 0x00 +#define XMP_INST_DCT_NOTE 0x01 +#define XMP_INST_DCT_SMP 0x02 +#define XMP_INST_DCT_INST 0x03 + int dct; /* Duplicate check type */ +#define XMP_INST_DCA_CUT XMP_INST_NNA_CUT +#define XMP_INST_DCA_OFF XMP_INST_NNA_OFF +#define XMP_INST_DCA_FADE XMP_INST_NNA_FADE + int dca; /* Duplicate check action */ + int ifc; /* Initial filter cutoff */ + int ifr; /* Initial filter resonance */ +}; + struct xmp_instrument { char name[32]; /* Instrument name */ int vol; /* Instrument volume */ @@ -185,35 +215,7 @@ struct xmp_instrument { signed char xpo; /* Instrument transpose for each key */ } map[XMP_MAX_KEYS]; - struct xmp_subinstrument { - int vol; /* Default volume */ - int gvl; /* Global volume */ - int pan; /* Pan */ - int xpo; /* Transpose */ - int fin; /* Finetune */ - int vwf; /* Vibrato waveform */ - int vde; /* Vibrato depth */ - int vra; /* Vibrato rate */ - int vsw; /* Vibrato sweep */ - int rvv; /* Random volume/pan variation (IT) */ - int sid; /* Sample number */ -#define XMP_INST_NNA_CUT 0x00 -#define XMP_INST_NNA_CONT 0x01 -#define XMP_INST_NNA_OFF 0x02 -#define XMP_INST_NNA_FADE 0x03 - int nna; /* New note action */ -#define XMP_INST_DCT_OFF 0x00 -#define XMP_INST_DCT_NOTE 0x01 -#define XMP_INST_DCT_SMP 0x02 -#define XMP_INST_DCT_INST 0x03 - int dct; /* Duplicate check type */ -#define XMP_INST_DCA_CUT XMP_INST_NNA_CUT -#define XMP_INST_DCA_OFF XMP_INST_NNA_OFF -#define XMP_INST_DCA_FADE XMP_INST_NNA_FADE - int dca; /* Duplicate check action */ - int ifc; /* Initial filter cutoff */ - int ifr; /* Initial filter resonance */ - } *sub; + struct xmp_subinstrument *sub; void *extra; /* Extra fields */ }; @@ -276,6 +278,19 @@ struct xmp_module_info { struct xmp_sequence *seq_data; /* Pointer to sequence data */ }; +struct xmp_channel_info { /* Current channel information */ + unsigned int period; /* Sample period (* 4096) */ + unsigned int position; /* Sample position */ + short pitchbend; /* Linear bend from base note*/ + unsigned char note; /* Current base note number */ + unsigned char instrument; /* Current instrument number */ + unsigned char sample; /* Current sample number */ + unsigned char volume; /* Current volume */ + unsigned char pan; /* Current stereo pan */ + unsigned char reserved; /* Reserved */ + struct xmp_event event; /* Current track event */ +}; + struct xmp_frame_info { /* Current frame information */ int pos; /* Current position */ int pattern; /* Current pattern */ @@ -296,18 +311,7 @@ struct xmp_frame_info { /* Current frame information */ int virt_used; /* Used virtual channels */ int sequence; /* Current sequence */ - struct xmp_channel_info { /* Current channel information */ - unsigned int period; /* Sample period (* 4096) */ - unsigned int position; /* Sample position */ - short pitchbend; /* Linear bend from base note*/ - unsigned char note; /* Current base note number */ - unsigned char instrument; /* Current instrument number */ - unsigned char sample; /* Current sample number */ - unsigned char volume; /* Current volume */ - unsigned char pan; /* Current stereo pan */ - unsigned char reserved; /* Reserved */ - struct xmp_event event; /* Current track event */ - } channel_info[XMP_MAX_CHANNELS]; + struct xmp_channel_info channel_info[XMP_MAX_CHANNELS]; }; diff --git a/source/libxmp-lite/src/common.h b/source/libxmp-lite/src/common.h index de5f11e85..7bb5b84f0 100644 --- a/source/libxmp-lite/src/common.h +++ b/source/libxmp-lite/src/common.h @@ -295,6 +295,30 @@ struct module_data { #endif }; +struct pattern_loop { + int start; + int count; +}; + +struct flow_control { + int pbreak; + int jump; + int delay; + int jumpline; + int loop_chn; + + struct pattern_loop *loop; + + int num_rows; + int end_point; + int rowdelay; /* For IT pattern row delay */ + int rowdelay_set; +}; + +struct virt_channel { + int count; + int map; +}; struct player_data { int ord; @@ -318,23 +342,7 @@ struct player_data { int master_vol; /* Music volume */ int gvol; - struct flow_control { - int pbreak; - int jump; - int delay; - int jumpline; - int loop_chn; - - struct pattern_loop { - int start; - int count; - } *loop; - - int num_rows; - int end_point; - int rowdelay; /* For IT pattern row delay */ - int rowdelay_set; - } flow; + struct flow_control flow; struct { int time; /* replay time in ms */ @@ -354,10 +362,7 @@ struct player_data { int virt_used; /* Number of voices currently in use */ int maxvoc; /* Number of sound card voices */ - struct virt_channel { - int count; - int map; - } *virt_channel; + struct virt_channel *virt_channel; struct mixer_voice *voice_array; } virt;