- changed MIDI sources so that they do not have to include i_musicinterns.h anymore.

They were already clean of unwanted external references, but including this file made it hard to keep it that way.
This also moves a few useful definitions around to less 'dirty' headers.
This commit is contained in:
Christoph Oelckers 2019-09-25 21:47:33 +02:00
parent b8824b572f
commit c3f26422df
13 changed files with 60 additions and 57 deletions

View file

@ -372,12 +372,4 @@ enum
#define BLINKTHRESHOLD (4*32) #define BLINKTHRESHOLD (4*32)
#ifndef MAKE_ID
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((uint32_t)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
#else
#define MAKE_ID(a,b,c,d) ((uint32_t)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
#endif
#endif
#endif // __DOOMDEF_H__ #endif // __DOOMDEF_H__

View file

@ -232,11 +232,6 @@ inline float RAD2DEG(float deg)
} }
template <typename T, size_t N>
char ( &_ArraySizeHelper( T (&array)[N] ))[N];
#define countof( array ) (sizeof( _ArraySizeHelper( array ) ))
// Auto-registration sections for GCC. // Auto-registration sections for GCC.
// Apparently, you cannot do string concatenation inside section attributes. // Apparently, you cannot do string concatenation inside section attributes.
#ifdef __MACH__ #ifdef __MACH__

View file

@ -67,8 +67,8 @@ const uint32_t *FWarpTexture::GetPixelsBgra()
resizeMult = 1; resizeMult = 1;
auto otherpix = FSoftwareTexture::GetPixelsBgra(); auto otherpix = FSoftwareTexture::GetPixelsBgra();
WarpedPixelsRgba.Resize(GetWidth() * GetHeight() * resizeMult * resizeMult * 4 / 3 + 1); WarpedPixelsRgba.Resize(unsigned(GetWidth() * GetHeight() * resizeMult * resizeMult * 4 / 3 + 1));
WarpBuffer(WarpedPixelsRgba.Data(), otherpix, GetWidth() * resizeMult, GetHeight() * resizeMult, WidthOffsetMultiplier, HeightOffsetMultiplier, time, mTexture->shaderspeed, bWarped); WarpBuffer(WarpedPixelsRgba.Data(), otherpix, int(GetWidth() * resizeMult), int(GetHeight() * resizeMult), WidthOffsetMultiplier, HeightOffsetMultiplier, time, mTexture->shaderspeed, bWarped);
GenerateBgraMipmapsFast(); GenerateBgraMipmapsFast();
FreeAllSpans(); FreeAllSpans();
GenTime[2] = time; GenTime[2] = time;
@ -88,8 +88,8 @@ const uint8_t *FWarpTexture::GetPixels(int index)
resizeMult = 1; resizeMult = 1;
const uint8_t *otherpix = FSoftwareTexture::GetPixels(index); const uint8_t *otherpix = FSoftwareTexture::GetPixels(index);
WarpedPixels[index].Resize(GetWidth() * GetHeight() * resizeMult * resizeMult); WarpedPixels[index].Resize(unsigned(GetWidth() * GetHeight() * resizeMult * resizeMult));
WarpBuffer(WarpedPixels[index].Data(), otherpix, GetWidth() * resizeMult, GetHeight() * resizeMult, WidthOffsetMultiplier, HeightOffsetMultiplier, time, mTexture->shaderspeed, bWarped); WarpBuffer(WarpedPixels[index].Data(), otherpix, int(GetWidth() * resizeMult), int(GetHeight() * resizeMult), WidthOffsetMultiplier, HeightOffsetMultiplier, time, mTexture->shaderspeed, bWarped);
FreeAllSpans(); FreeAllSpans();
GenTime[index] = time; GenTime[index] = time;
} }

View file

@ -34,7 +34,7 @@
*/ */
#include "i_musicinterns.h" #include "midisource.h"
char MIDI_EventLengths[7] = { 2, 2, 2, 2, 1, 1, 2 }; char MIDI_EventLengths[7] = { 2, 2, 2, 2, 1, 1, 2 };

View file

@ -10,10 +10,14 @@
#include <stdint.h> #include <stdint.h>
#include <functional> #include <functional>
#include "files.h"
#include "mus2midi.h"
#include "mididefs.h"
extern char MIDI_EventLengths[7]; extern char MIDI_EventLengths[7];
extern char MIDI_CommonLengths[15]; extern char MIDI_CommonLengths[15];
// base class for the different MIDI sources -------------------------------------- // base class for the different MIDI sources --------------------------------------
class MIDISource class MIDISource

View file

@ -34,7 +34,8 @@
// HEADER FILES ------------------------------------------------------------ // HEADER FILES ------------------------------------------------------------
#include "i_musicinterns.h" #include "midisource.h"
#include "basictypes.h"
#include "templates.h" #include "templates.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -33,7 +33,7 @@
// HEADER FILES ------------------------------------------------------------ // HEADER FILES ------------------------------------------------------------
#include "i_musicinterns.h" #include "midisource.h"
#include "templates.h" #include "templates.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -37,7 +37,7 @@
// HEADER FILES ------------------------------------------------------------ // HEADER FILES ------------------------------------------------------------
#include "i_musicinterns.h" #include "midisource.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -34,7 +34,8 @@
// HEADER FILES ------------------------------------------------------------ // HEADER FILES ------------------------------------------------------------
#include "i_musicinterns.h" #include "midisource.h"
#include "basictypes.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -128,7 +129,7 @@ XMISong::XMISong (FileReader &reader)
memset(Songs, 0, sizeof(*Songs) * NumSongs); memset(Songs, 0, sizeof(*Songs) * NumSongs);
FindXMIDforms(&MusHeader[0], MusHeader.Size(), Songs); FindXMIDforms(&MusHeader[0], MusHeader.Size(), Songs);
CurrSong = Songs; CurrSong = Songs;
DPrintf(DMSG_SPAMMY, "XMI song count: %d\n", NumSongs); //DPrintf(DMSG_SPAMMY, "XMI song count: %d\n", NumSongs);
} }
//========================================================================== //==========================================================================

View file

@ -26,29 +26,6 @@ struct MidiHeader
MidiHeader *lpNext; MidiHeader *lpNext;
}; };
// These constants must match the corresponding values of the Windows headers
// to avoid readjustment in the native Windows device's playback functions
// and should not be changed.
enum
{
MIDIDEV_MIDIPORT = 1,
MIDIDEV_SYNTH,
MIDIDEV_SQSYNTH,
MIDIDEV_FMSYNTH,
MIDIDEV_MAPPER,
MIDIDEV_WAVETABLE,
MIDIDEV_SWSYNTH
};
enum : uint8_t
{
MEVENT_TEMPO = 1,
MEVENT_NOP = 2,
MEVENT_LONGMSG = 128,
};
#define MEVENT_EVENTTYPE(x) ((uint8_t)((x) >> 24))
#define MEVENT_EVENTPARM(x) ((x) & 0xffffff)
class MIDIStreamer; class MIDIStreamer;
@ -205,11 +182,6 @@ protected:
// Base class for streaming MUS and MIDI files ------------------------------ // Base class for streaming MUS and MIDI files ------------------------------
enum
{
MAX_MIDI_EVENTS = 128
};
class MIDIStreamer : public MusInfo class MIDIStreamer : public MusInfo
{ {
public: public:

View file

@ -0,0 +1,31 @@
#pragma once
enum
{
MAX_MIDI_EVENTS = 128
};
inline constexpr uint8_t MEVENT_EVENTTYPE(uint32_t x) { return ((uint8_t)((x) >> 24)); }
inline constexpr uint32_t MEVENT_EVENTPARM(uint32_t x) { return ((x) & 0xffffff); }
// These constants must match the corresponding values of the Windows headers
// to avoid readjustment in the native Windows device's playback functions
// and should not be changed.
enum
{
MIDIDEV_MIDIPORT = 1,
MIDIDEV_SYNTH,
MIDIDEV_SQSYNTH,
MIDIDEV_FMSYNTH,
MIDIDEV_MAPPER,
MIDIDEV_WAVETABLE,
MIDIDEV_SWSYNTH
};
enum : uint8_t
{
MEVENT_TEMPO = 1,
MEVENT_NOP = 2,
MEVENT_LONGMSG = 128,
};

View file

@ -36,5 +36,18 @@ typedef uint32_t angle_t;
#define GCCNOWARN #define GCCNOWARN
#endif #endif
template <typename T, size_t N>
char(&_ArraySizeHelper(T(&array)[N]))[N];
#define countof( array ) (sizeof( _ArraySizeHelper( array ) ))
#ifndef MAKE_ID
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((uint32_t)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
#else
#define MAKE_ID(a,b,c,d) ((uint32_t)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
#endif
#endif
#endif #endif

View file

@ -68,12 +68,6 @@
// Maximum number of files that might appear in a crash report. // Maximum number of files that might appear in a crash report.
#define MAX_FILES 5 #define MAX_FILES 5
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
#else
#define MAKE_ID(a,b,c,d) ((d)|((c)<<8)|((b)<<16)|((a)<<24))
#endif
#define ZIP_LOCALFILE MAKE_ID('P','K',3,4) #define ZIP_LOCALFILE MAKE_ID('P','K',3,4)
#define ZIP_CENTRALFILE MAKE_ID('P','K',1,2) #define ZIP_CENTRALFILE MAKE_ID('P','K',1,2)
#define ZIP_ENDOFDIR MAKE_ID('P','K',5,6) #define ZIP_ENDOFDIR MAKE_ID('P','K',5,6)