Skip to content

Commit

Permalink
Fixed C++98 and C90 warnings, also CLang rpath warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Dec 16, 2018
1 parent 657c48c commit 4d4367f
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 129 deletions.
2 changes: 1 addition & 1 deletion examples/sdl2_audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(NOT WIN32)
endif()

if(TARGET ADLMIDI_shared)
set_target_properties(adlmidi_sdl2_demo PROPERTIES COMPILE_FLAGS "-Wl,-rpath='$$ORIGIN/../lib'")
set_target_properties(adlmidi_sdl2_demo PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
endif()

install(TARGETS adlmidi_sdl2_demo
Expand Down
242 changes: 119 additions & 123 deletions include/adlmidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,125 @@ enum ADL_BankAccessFlags
ADLMIDI_Bank_CreateRt = 1|2
};

typedef struct ADL_Instrument ADL_Instrument;

/* ======== Instrument structures ======== */

/**
* @brief Version of the instrument data format
*/
enum
{
ADLMIDI_InstrumentVersion = 0
};

/**
* @brief Instrument flags
*/
typedef enum ADL_InstrumentFlags
{
/*! Is two-operator single-voice instrument (no flags) */
ADLMIDI_Ins_2op = 0x00,
/*! Is true four-operator instrument */
ADLMIDI_Ins_4op = 0x01,
/*! Is pseudo four-operator (two 2-operator voices) instrument */
ADLMIDI_Ins_Pseudo4op = 0x02,
/*! Is a blank instrument entry */
ADLMIDI_Ins_IsBlank = 0x04,

/*! RythmMode flags mask */
ADLMIDI_Ins_RhythmModeMask = 0x38,

/*! Mask of the flags range */
ADLMIDI_Ins_ALL_MASK = 0x07
} ADL_InstrumentFlags;

/**
* @brief Rhythm-mode drum type
*/
typedef enum ADL_RhythmMode
{
/*! RythmMode: BassDrum */
ADLMIDI_RM_BassDrum = 0x08,
/*! RythmMode: Snare */
ADLMIDI_RM_Snare = 0x10,
/*! RythmMode: TomTom */
ADLMIDI_RM_TomTom = 0x18,
/*! RythmMode: Cymbal */
ADLMIDI_RM_Cymbal = 0x20,
/*! RythmMode: HiHat */
ADLMIDI_RM_HiHat = 0x28
} ADL_RhythmMode;


/**
* @brief Operator structure, part of Instrument structure
*/
typedef struct ADL_Operator
{
/*! AM/Vib/Env/Ksr/FMult characteristics */
ADL_UInt8 avekf_20;
/*! Key Scale Level / Total level register data */
ADL_UInt8 ksl_l_40;
/*! Attack / Decay */
ADL_UInt8 atdec_60;
/*! Systain and Release register data */
ADL_UInt8 susrel_80;
/*! Wave form */
ADL_UInt8 waveform_E0;
} ADL_Operator;

/**
* @brief Instrument structure
*/
typedef struct ADL_Instrument
{
/*! Version of the instrument object */
int version;
/*! MIDI note key (half-tone) offset for an instrument (or a first voice in pseudo-4-op mode) */
ADL_SInt16 note_offset1;
/*! MIDI note key (half-tone) offset for a second voice in pseudo-4-op mode */
ADL_SInt16 note_offset2;
/*! MIDI note velocity offset (taken from Apogee TMB format) */
ADL_SInt8 midi_velocity_offset;
/*! Second voice detune level (taken from DMX OP2) */
ADL_SInt8 second_voice_detune;
/*! Percussion MIDI base tone number at which this drum will be played */
ADL_UInt8 percussion_key_number;
/**
* @var inst_flags
* @brief Instrument flags
*
* Enums: #ADL_InstrumentFlags and #ADL_RhythmMode
*
* Bitwise flags bit map:
* ```
* [0EEEDCBA]
* A) 0x00 - 2-operator mode
* B) 0x01 - 4-operator mode
* C) 0x02 - pseudo-4-operator (two 2-operator voices) mode
* D) 0x04 - is 'blank' instrument (instrument which has no sound)
* E) 0x38 - Reserved for rhythm-mode percussion type number (three bits number)
* -> 0x00 - Melodic or Generic drum (rhythm-mode is disabled)
* -> 0x08 - is Bass drum
* -> 0x10 - is Snare
* -> 0x18 - is Tom-tom
* -> 0x20 - is Cymbal
* -> 0x28 - is Hi-hat
* 0) Reserved / Unused
* ```
*/
ADL_UInt8 inst_flags;
/*! Feedback&Connection register for first and second operators */
ADL_UInt8 fb_conn1_C0;
/*! Feedback&Connection register for third and fourth operators */
ADL_UInt8 fb_conn2_C0;
/*! Operators register data */
ADL_Operator operators[4];
/*! Millisecond delay of sounding while key is on */
ADL_UInt16 delay_on_ms;
/*! Millisecond delay of sounding after key off */
ADL_UInt16 delay_off_ms;
} ADL_Instrument;



Expand Down Expand Up @@ -1117,128 +1235,6 @@ extern ADLMIDI_DECLSPEC void adl_setDebugMessageHook(struct ADL_MIDIPlayer *devi
*/
extern ADLMIDI_DECLSPEC int adl_describeChannels(struct ADL_MIDIPlayer *device, char *text, char *attr, size_t size);




/* ======== Instrument structures ======== */

/**
* @brief Version of the instrument data format
*/
enum
{
ADLMIDI_InstrumentVersion = 0
};

/**
* @brief Instrument flags
*/
typedef enum ADL_InstrumentFlags
{
/*! Is two-operator single-voice instrument (no flags) */
ADLMIDI_Ins_2op = 0x00,
/*! Is true four-operator instrument */
ADLMIDI_Ins_4op = 0x01,
/*! Is pseudo four-operator (two 2-operator voices) instrument */
ADLMIDI_Ins_Pseudo4op = 0x02,
/*! Is a blank instrument entry */
ADLMIDI_Ins_IsBlank = 0x04,

/*! RythmMode flags mask */
ADLMIDI_Ins_RhythmModeMask = 0x38,

/*! Mask of the flags range */
ADLMIDI_Ins_ALL_MASK = 0x07
} ADL_InstrumentFlags;

/**
* @brief Rhythm-mode drum type
*/
typedef enum ADL_RhythmMode
{
/*! RythmMode: BassDrum */
ADLMIDI_RM_BassDrum = 0x08,
/*! RythmMode: Snare */
ADLMIDI_RM_Snare = 0x10,
/*! RythmMode: TomTom */
ADLMIDI_RM_TomTom = 0x18,
/*! RythmMode: Cymbal */
ADLMIDI_RM_Cymbal = 0x20,
/*! RythmMode: HiHat */
ADLMIDI_RM_HiHat = 0x28
} ADL_RhythmMode;


/**
* @brief Operator structure, part of Instrument structure
*/
typedef struct ADL_Operator
{
/*! AM/Vib/Env/Ksr/FMult characteristics */
ADL_UInt8 avekf_20;
/*! Key Scale Level / Total level register data */
ADL_UInt8 ksl_l_40;
/*! Attack / Decay */
ADL_UInt8 atdec_60;
/*! Systain and Release register data */
ADL_UInt8 susrel_80;
/*! Wave form */
ADL_UInt8 waveform_E0;
} ADL_Operator;

/**
* @brief Instrument structure
*/
typedef struct ADL_Instrument
{
/*! Version of the instrument object */
int version;
/*! MIDI note key (half-tone) offset for an instrument (or a first voice in pseudo-4-op mode) */
ADL_SInt16 note_offset1;
/*! MIDI note key (half-tone) offset for a second voice in pseudo-4-op mode */
ADL_SInt16 note_offset2;
/*! MIDI note velocity offset (taken from Apogee TMB format) */
ADL_SInt8 midi_velocity_offset;
/*! Second voice detune level (taken from DMX OP2) */
ADL_SInt8 second_voice_detune;
/*! Percussion MIDI base tone number at which this drum will be played */
ADL_UInt8 percussion_key_number;
/**
* @var inst_flags
* @brief Instrument flags
*
* Enums: #ADL_InstrumentFlags and #ADL_RhythmMode
*
* Bitwise flags bit map:
* ```
* [0EEEDCBA]
* A) 0x00 - 2-operator mode
* B) 0x01 - 4-operator mode
* C) 0x02 - pseudo-4-operator (two 2-operator voices) mode
* D) 0x04 - is 'blank' instrument (instrument which has no sound)
* E) 0x38 - Reserved for rhythm-mode percussion type number (three bits number)
* -> 0x00 - Melodic or Generic drum (rhythm-mode is disabled)
* -> 0x08 - is Bass drum
* -> 0x10 - is Snare
* -> 0x18 - is Tom-tom
* -> 0x20 - is Cymbal
* -> 0x28 - is Hi-hat
* 0) Reserved / Unused
* ```
*/
ADL_UInt8 inst_flags;
/*! Feedback&Connection register for first and second operators */
ADL_UInt8 fb_conn1_C0;
/*! Feedback&Connection register for third and fourth operators */
ADL_UInt8 fb_conn2_C0;
/*! Operators register data */
ADL_Operator operators[4];
/*! Millisecond delay of sounding while key is on */
ADL_UInt16 delay_on_ms;
/*! Millisecond delay of sounding after key off */
ADL_UInt16 delay_off_ms;
} ADL_Instrument;

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/adlmidi_midiplay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class MIDIplay

//! Active notes in the channel
pl_list<NoteInfo> activenotes;
typedef typename pl_list<NoteInfo>::iterator notes_iterator;
typedef typename pl_list<NoteInfo>::const_iterator const_notes_iterator;
typedef pl_list<NoteInfo>::iterator notes_iterator;
typedef pl_list<NoteInfo>::const_iterator const_notes_iterator;

notes_iterator find_activenote(unsigned note)
{
Expand Down Expand Up @@ -405,8 +405,8 @@ class MIDIplay
MIDIchannel::NoteInfo::Phys recent_ins;

pl_list<LocationData> users;
typedef typename pl_list<LocationData>::iterator users_iterator;
typedef typename pl_list<LocationData>::const_iterator const_users_iterator;
typedef pl_list<LocationData>::iterator users_iterator;
typedef pl_list<LocationData>::const_iterator const_users_iterator;

users_iterator find_user(const Location &loc)
{
Expand Down
2 changes: 1 addition & 1 deletion utils/adlmidi-2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if(MSVC)
endif()

if(TARGET ADLMIDI_shared AND NOT MSVC)
set_target_properties(adlmidi2 PROPERTIES COMPILE_FLAGS "-Wl,-rpath='$$ORIGIN/../lib'")
set_target_properties(adlmidi2 PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
endif()

install(TARGETS adlmidi2
Expand Down
4 changes: 4 additions & 0 deletions utils/midiplay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ if(ADLMIDI_DOS)
set_target_properties(adlmidiplay PROPERTIES OUTPUT_NAME adlmidi)
endif()

if(TARGET ADLMIDI_shared)
set_target_properties(adlmidiplay PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
endif()

install(TARGETS adlmidiplay
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

0 comments on commit 4d4367f

Please sign in to comment.