Files
RP412/MUNGA/AUDWGT.h
T
CydandClaude Opus 4.8 4abbf8879f Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet',
built on the MUNGA engine and its L4 (Win32/DirectX) platform layer:

- MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend
- RP / RP_L4: Red Planet game logic and Win32 application
- DivLoader, Setup1: asset loader and installer project
- lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies

Removed stale Subversion metadata and added .gitignore/.gitattributes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 07:59:51 -05:00

129 lines
3.1 KiB
C++

#pragma once
#include "style.h"
#include "audio.h"
//##########################################################################
//######################## AudioWeighting ############################
//##########################################################################
class AudioWeighting SIGNATURED
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction, and Testing
//
public:
AudioWeighting();
AudioWeighting(const AudioWeighting&);
AudioWeighting(AudioSourcePriority audio_priority, AudioControlValue audio_volume);
AudioWeighting& operator=(const AudioWeighting&);
Logical TestInstance() const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Logical Operators
//
public:
Logical operator<(const AudioWeighting&) const;
Logical operator<=(const AudioWeighting&) const;
Logical operator>(const AudioWeighting&) const;
Logical operator>=(const AudioWeighting&) const;
Logical operator==(const AudioWeighting&) const;
Logical operator!=(const AudioWeighting&) const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Public Constants
//
public:
static const AudioWeighting Null;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private Data
//
private:
Scalar weight;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioWeighting inlines ~~~~~~~~~~~~~~~~~~~~~~~
inline AudioWeighting::AudioWeighting():
weight(0.0f)
{
}
inline AudioWeighting::AudioWeighting(const AudioWeighting &audio_weighting):
weight(audio_weighting.weight)
{
}
inline AudioWeighting::AudioWeighting(
AudioSourcePriority audio_priority,
AudioControlValue audio_volume
)
{
Verify(
(Enumeration)audio_priority >= 0 &&
(Enumeration)audio_priority < AUDIO_SOURCE_PRIORITY_COUNT
);
Verify(
(Enumeration)audio_priority >= (Enumeration)MinAudioSourcePriority &&
(Enumeration)audio_priority <= (Enumeration)MaxAudioSourcePriority
);
Verify(
audio_volume >= 0.0f &&
audio_volume <= 1.0f
);
weight = 0.0f -(Scalar)audio_priority - audio_volume;
}
inline AudioWeighting&
AudioWeighting::operator=(const AudioWeighting &audio_weighting)
{
Check(this);
weight = audio_weighting.weight;
return *this;
}
inline Logical
AudioWeighting::operator<(const AudioWeighting &audio_weighting) const
{
Check(this);
return weight < audio_weighting.weight;
}
inline Logical
AudioWeighting::operator<=(const AudioWeighting &audio_weighting) const
{
Check(this);
return weight <= audio_weighting.weight;
}
inline Logical
AudioWeighting::operator>(const AudioWeighting &audio_weighting) const
{
Check(this);
return weight > audio_weighting.weight;
}
inline Logical
AudioWeighting::operator>=(const AudioWeighting &audio_weighting) const
{
Check(this);
return weight >= audio_weighting.weight;
}
inline Logical
AudioWeighting::operator==(const AudioWeighting &audio_weighting) const
{
Check(this);
return Close_Enough(weight, audio_weighting.weight, 0.01f);
}
inline Logical
AudioWeighting::operator!=(const AudioWeighting &audio_weighting) const
{
Check(this);
return !Close_Enough(weight, audio_weighting.weight, 0.01f);
}