Skip to content

Commit

Permalink
SOUND: Use constexpr in XACT
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Jan 11, 2019
1 parent a8ddea9 commit 4f30428
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/sound/xactsoundbank.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ class XACTSoundBank {


protected:
static const uint8 kCategoryNone = 0xFF; ///< No category assigned.
static const uint8 kLayerNone = 0xFF; ///< No layer assigned.
static constexpr uint8 kCategoryNone = 0xFF; ///< No category assigned.
static constexpr uint8 kLayerNone = 0xFF; ///< No layer assigned.

/** Special value to mean "loop forever". */
static const uint16 kLoopCountInfinite = 0xFFFF;
static constexpr uint16 kLoopCountInfinite = 0xFFFF;

static const size_t kWeightMinimum = 0; ///< Absolute lower bound on variation weights.
static const size_t kWeightMaximum = 10000; ///< Absolute upper bound on variation weights
static constexpr size_t kWeightMinimum = 0; ///< Absolute lower bound on variation weights.
static constexpr size_t kWeightMaximum = 10000; ///< Absolute upper bound on variation weights

/** Sound inded to denote silence or stopped. */
static const size_t kSoundSilence = SIZE_MAX;
static constexpr size_t kSoundSilence = SIZE_MAX;

/** The type of an event. */
enum EventType {
Expand Down
12 changes: 6 additions & 6 deletions src/sound/xactsoundbank_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

namespace Sound {

static const size_t k3DDefinitionSize = 40;
static const size_t kCueDefinitionSize = 20;
static const size_t kSoundDefinitionSize = 20;
static const size_t kFadeDefinitionSize = 16;
static constexpr size_t k3DDefinitionSize = 40;
static constexpr size_t kCueDefinitionSize = 20;
static constexpr size_t kSoundDefinitionSize = 20;
static constexpr size_t kFadeDefinitionSize = 16;

enum XSBFlags {
kXSBNoCueNames = 1
Expand Down Expand Up @@ -605,7 +605,7 @@ void XACTSoundBank_Binary::readTracks(Common::SeekableReadStream &xsb, Sound &so

// Complex

static const size_t kTrackDefinitionSize = 4;
static constexpr size_t kTrackDefinitionSize = 4;

for (size_t i = 0; i < count; ++i) {
Track &track = sound.tracks[i];
Expand Down Expand Up @@ -689,7 +689,7 @@ void XACTSoundBank_Binary::readSounds(Common::SeekableReadStream &xsb, uint32 of
}

void XACTSoundBank_Binary::load(Common::SeekableReadStream &xsb) {
static const uint32 kXSBID = MKTAG('S', 'D', 'B', 'K');
static constexpr uint32 kXSBID = MKTAG('S', 'D', 'B', 'K');

const uint32 id = xsb.readUint32BE();
if (id != kXSBID)
Expand Down
2 changes: 1 addition & 1 deletion src/sound/xactwavebank_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct Segment {
};

void XACTWaveBank_Binary::load(Common::SeekableReadStream &xwb) {
static const uint32 kXWBID = MKTAG('W', 'B', 'N', 'D');
static constexpr uint32 kXWBID = MKTAG('W', 'B', 'N', 'D');

const uint32 id = xwb.readUint32BE();
if (id != kXWBID)
Expand Down

0 comments on commit 4f30428

Please sign in to comment.