Skip to content

Commit

Permalink
Minor code review
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jul 31, 2021
1 parent b964fc8 commit 8a62fe1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
14 changes: 7 additions & 7 deletions Audio/WAVFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ namespace

struct DLSLoop
{
static const uint32_t LOOP_TYPE_FORWARD = 0x00000000;
static const uint32_t LOOP_TYPE_RELEASE = 0x00000001;
static constexpr uint32_t LOOP_TYPE_FORWARD = 0x00000000;
static constexpr uint32_t LOOP_TYPE_RELEASE = 0x00000001;

uint32_t size;
uint32_t loopType;
Expand All @@ -59,8 +59,8 @@ namespace

struct RIFFDLSSample
{
static const uint32_t OPTIONS_NOTRUNCATION = 0x00000001;
static const uint32_t OPTIONS_NOCOMPRESSION = 0x00000002;
static constexpr uint32_t OPTIONS_NOTRUNCATION = 0x00000001;
static constexpr uint32_t OPTIONS_NOCOMPRESSION = 0x00000002;

uint32_t size;
uint16_t unityNote;
Expand All @@ -72,9 +72,9 @@ namespace

struct MIDILoop
{
static const uint32_t LOOP_TYPE_FORWARD = 0x00000000;
static const uint32_t LOOP_TYPE_ALTERNATING = 0x00000001;
static const uint32_t LOOP_TYPE_BACKWARD = 0x00000002;
static constexpr uint32_t LOOP_TYPE_FORWARD = 0x00000000;
static constexpr uint32_t LOOP_TYPE_ALTERNATING = 0x00000001;
static constexpr uint32_t LOOP_TYPE_BACKWARD = 0x00000002;

uint32_t cuePointId;
uint32_t type;
Expand Down
48 changes: 24 additions & 24 deletions Audio/WaveBankReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ namespace

struct HEADER
{
static const uint32_t SIGNATURE = MAKEFOURCC('W', 'B', 'N', 'D');
static const uint32_t BE_SIGNATURE = MAKEFOURCC('D', 'N', 'B', 'W');
static const uint32_t VERSION = 44;
static constexpr uint32_t SIGNATURE = MAKEFOURCC('W', 'B', 'N', 'D');
static constexpr uint32_t BE_SIGNATURE = MAKEFOURCC('D', 'N', 'B', 'W');
static constexpr uint32_t VERSION = 44;

enum SEGIDX
{
Expand Down Expand Up @@ -101,15 +101,15 @@ namespace

union MINIWAVEFORMAT
{
static const uint32_t TAG_PCM = 0x0;
static const uint32_t TAG_XMA = 0x1;
static const uint32_t TAG_ADPCM = 0x2;
static const uint32_t TAG_WMA = 0x3;
static constexpr uint32_t TAG_PCM = 0x0;
static constexpr uint32_t TAG_XMA = 0x1;
static constexpr uint32_t TAG_ADPCM = 0x2;
static constexpr uint32_t TAG_WMA = 0x3;

static const uint32_t BITDEPTH_8 = 0x0; // PCM only
static const uint32_t BITDEPTH_16 = 0x1; // PCM only
static constexpr uint32_t BITDEPTH_8 = 0x0; // PCM only
static constexpr uint32_t BITDEPTH_16 = 0x1; // PCM only

static const size_t ADPCM_BLOCKALIGN_CONVERSION_OFFSET = 22;
static constexpr size_t ADPCM_BLOCKALIGN_CONVERSION_OFFSET = 22;

struct
{
Expand Down Expand Up @@ -245,17 +245,17 @@ namespace

struct BANKDATA
{
static const size_t BANKNAME_LENGTH = 64;
static constexpr size_t BANKNAME_LENGTH = 64;

static const uint32_t TYPE_BUFFER = 0x00000000;
static const uint32_t TYPE_STREAMING = 0x00000001;
static const uint32_t TYPE_MASK = 0x00000001;
static constexpr uint32_t TYPE_BUFFER = 0x00000000;
static constexpr uint32_t TYPE_STREAMING = 0x00000001;
static constexpr uint32_t TYPE_MASK = 0x00000001;

static const uint32_t FLAGS_ENTRYNAMES = 0x00010000;
static const uint32_t FLAGS_COMPACT = 0x00020000;
static const uint32_t FLAGS_SYNC_DISABLED = 0x00040000;
static const uint32_t FLAGS_SEEKTABLES = 0x00080000;
static const uint32_t FLAGS_MASK = 0x000F0000;
static constexpr uint32_t FLAGS_ENTRYNAMES = 0x00010000;
static constexpr uint32_t FLAGS_COMPACT = 0x00020000;
static constexpr uint32_t FLAGS_SYNC_DISABLED = 0x00040000;
static constexpr uint32_t FLAGS_SEEKTABLES = 0x00080000;
static constexpr uint32_t FLAGS_MASK = 0x000F0000;

uint32_t dwFlags; // Bank flags
uint32_t dwEntryCount; // Number of entries in the bank
Expand All @@ -281,11 +281,11 @@ namespace

struct ENTRY
{
static const uint32_t FLAGS_READAHEAD = 0x00000001; // Enable stream read-ahead
static const uint32_t FLAGS_LOOPCACHE = 0x00000002; // One or more looping sounds use this wave
static const uint32_t FLAGS_REMOVELOOPTAIL = 0x00000004;// Remove data after the end of the loop region
static const uint32_t FLAGS_IGNORELOOP = 0x00000008; // Used internally when the loop region can't be used
static const uint32_t FLAGS_MASK = 0x00000008;
static constexpr uint32_t FLAGS_READAHEAD = 0x00000001; // Enable stream read-ahead
static constexpr uint32_t FLAGS_LOOPCACHE = 0x00000002; // One or more looping sounds use this wave
static constexpr uint32_t FLAGS_REMOVELOOPTAIL = 0x00000004;// Remove data after the end of the loop region
static constexpr uint32_t FLAGS_IGNORELOOP = 0x00000008; // Used internally when the loop region can't be used
static constexpr uint32_t FLAGS_MASK = 0x00000008;

union
{
Expand Down
4 changes: 2 additions & 2 deletions Src/ResourceUploadBatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ namespace
};
#pragma pack(pop)

static const uint32_t Num32BitConstants = static_cast<uint32_t>(sizeof(ConstantData) / sizeof(uint32_t));
static const uint32_t ThreadGroupSize = 8;
static constexpr uint32_t Num32BitConstants = static_cast<uint32_t>(sizeof(ConstantData) / sizeof(uint32_t));
static constexpr uint32_t ThreadGroupSize = 8;

ComPtr<ID3D12RootSignature> rootSignature;
ComPtr<ID3D12PipelineState> generateMipsPSO;
Expand Down
4 changes: 2 additions & 2 deletions Src/SpriteBatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ XM_ALIGNED_STRUCT(16) SpriteBatch::Impl : public AlignedNew<SpriteBatch::Impl>
unsigned int flags;

// Combine values from the public SpriteEffects enum with these internal-only flags.
static const unsigned int SourceInTexels = 4;
static const unsigned int DestSizeInPixels = 8;
static constexpr unsigned int SourceInTexels = 4;
static constexpr unsigned int DestSizeInPixels = 8;

static_assert((SpriteEffects_FlipBoth & (SourceInTexels | DestSizeInPixels)) == 0, "Flag bits must not overlap");
};
Expand Down

0 comments on commit 8a62fe1

Please sign in to comment.