Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.
Layout:
engine/ MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
models) + image codec; the minimal rp/ headers the audio HAL needs
game/ reconstructed BT logic + surviving-original BT source + fwd shims
+ WinMain launcher
content/ full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
docs/ format specs + reconstruction ledgers
reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
tools/ MP console emulator + map/resource scanners
One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1558 lines
38 KiB
C++
1558 lines
38 KiB
C++
#pragma once
|
|
|
|
#include "watcher.h"
|
|
#include "audio.h"
|
|
#include "simulate.h"
|
|
#include "objstrm.h"
|
|
#include "controls.h"
|
|
#include "motion.h"
|
|
|
|
//##########################################################################
|
|
//######################## AudioIdleWatcher ##########################
|
|
//##########################################################################
|
|
|
|
class AudioIdleWatcher:
|
|
public Component
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor, Destructor, Testing
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioIdleWatcher(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
void
|
|
AudioIdleWatcherX(
|
|
AudioComponent *audio_component,
|
|
Entity *entity
|
|
);
|
|
~AudioIdleWatcher();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ReleaseLinkHandler
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
ReleaseLinkHandler(
|
|
Socket *socket,
|
|
Plug *plug
|
|
);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Execute
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
Execute();
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Protected data
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
SlotOf<AudioComponent*>
|
|
audioComponentSocket;
|
|
};
|
|
|
|
//##########################################################################
|
|
//########################### AudioWatcherOf #########################
|
|
//##########################################################################
|
|
|
|
template <class T> class AudioWatcherOf:
|
|
public AttributeWatcherOf<T>
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor, Destructor, Testing
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioWatcherOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioWatcherOf();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//--------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// ReleaseLinkHandler
|
|
//--------------------------------------------------------------------
|
|
//
|
|
void
|
|
ReleaseLinkHandler(
|
|
Socket *socket,
|
|
Plug *plug
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Protected data
|
|
//--------------------------------------------------------------------
|
|
//
|
|
SlotOf<AudioComponent*>
|
|
audioComponentSocket;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~ AudioWatcherOf templates ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioWatcherOf<T>::AudioWatcherOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
):
|
|
AttributeWatcherOf<T>(stream, entity),
|
|
audioComponentSocket(this)
|
|
{
|
|
//
|
|
// Get audio component
|
|
//
|
|
AudioComponent *audio_component;
|
|
PlugStream_ReadObjectIDAndFindPlug(stream, &audio_component);
|
|
Check(audio_component);
|
|
audioComponentSocket.Add(audio_component);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioWatcherOf<T>::~AudioWatcherOf()
|
|
{
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioWatcherOf<T>::BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
)
|
|
{
|
|
AttributeWatcherOf<T>::BuildFromPage(
|
|
stream, name_list, class_ID, object_ID
|
|
);
|
|
|
|
//
|
|
// Store audio_component object ID
|
|
//
|
|
CString audio_component_name("audio_component");
|
|
PlugStream_FindEntryAndWriteObjectID(
|
|
stream, name_list, audio_component_name
|
|
);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> Logical
|
|
AudioWatcherOf<T>::TestInstance() const
|
|
{
|
|
AttributeWatcherOf<T>::TestInstance();
|
|
Check(&audioComponentSocket);
|
|
return True;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioWatcherOf<T>::ReleaseLinkHandler(
|
|
Socket *socket,
|
|
Plug *plug
|
|
)
|
|
{
|
|
if (socket == &audioComponentSocket)
|
|
{
|
|
Check(&audioComponentSocket);
|
|
Check(socket);
|
|
Unregister_Object(this);
|
|
delete this;
|
|
}
|
|
else
|
|
{
|
|
AttributeWatcherOf<T>::ReleaseLinkHandler(socket, plug);
|
|
}
|
|
}
|
|
|
|
//##########################################################################
|
|
//########################### AudioTriggerOf #########################
|
|
//##########################################################################
|
|
|
|
template <class T> class AudioTriggerOf:
|
|
public AudioWatcherOf<T>
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioTriggerOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioTriggerOf();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//--------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// SendNotificationOfChange
|
|
//--------------------------------------------------------------------
|
|
//
|
|
void
|
|
SendNotificationOfChange();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//--------------------------------------------------------------------
|
|
//
|
|
virtual AudioControlValue
|
|
ExtractInterestingValue(const T *attribute_ptr);
|
|
|
|
private:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Private data
|
|
//--------------------------------------------------------------------
|
|
//
|
|
Scalar
|
|
attributeValueThreshold;
|
|
Logical
|
|
inverseTrigger;
|
|
AudioControlID
|
|
controlIDOn,
|
|
controlIDOff;
|
|
AudioControlValue
|
|
controlValueOn,
|
|
controlValueOff;
|
|
Logical
|
|
triggerOn;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioTriggerOf templates ~~~~~~~~~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioTriggerOf<T>::AudioTriggerOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
):
|
|
AudioWatcherOf<T>(stream, entity)
|
|
{
|
|
Check(simulation);
|
|
simulation->AddAudioWatcher(this);
|
|
|
|
//
|
|
// Get other fields
|
|
//
|
|
MemoryStream_Read(stream, &attributeValueThreshold);
|
|
MemoryStream_Read(stream, &inverseTrigger);
|
|
|
|
MemoryStream_Read(stream, &controlIDOn);
|
|
MemoryStream_Read(stream, &controlIDOff);
|
|
|
|
MemoryStream_Read(stream, &controlValueOn);
|
|
MemoryStream_Read(stream, &controlValueOff);
|
|
|
|
triggerOn = False;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioTriggerOf<T>::~AudioTriggerOf()
|
|
{
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioTriggerOf<T>::BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
)
|
|
{
|
|
AudioWatcherOf<T>::BuildFromPage(stream, name_list, class_ID, object_ID);
|
|
|
|
//
|
|
// Store other fields
|
|
//
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, attribute_value_threshold
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Logical, inverse_trigger
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Enumeration, control_ID_on
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Enumeration, control_ID_off
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, control_value_on
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, control_value_off
|
|
);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioTriggerOf<T>::SendNotificationOfChange()
|
|
{
|
|
//
|
|
// Get current value
|
|
//
|
|
T *attribute_ptr = GetCurrentPointer();
|
|
Check_Pointer(attribute_ptr);
|
|
Scalar current_value = ExtractInterestingValue(attribute_ptr);
|
|
|
|
if (triggerOn)
|
|
{
|
|
if (
|
|
(!inverseTrigger && current_value <= attributeValueThreshold) ||
|
|
(inverseTrigger && current_value >= attributeValueThreshold)
|
|
)
|
|
{
|
|
Check(&audioComponentSocket);
|
|
Check(audioComponentSocket.GetCurrent());
|
|
#if 1
|
|
audioComponentSocket.GetCurrent()->ReceiveControl(
|
|
controlIDOff,
|
|
controlValueOff
|
|
);
|
|
#else
|
|
audioComponentSocket.GetCurrent()->PostReceiveControl(
|
|
controlIDOff,
|
|
controlValueOff
|
|
);
|
|
#endif
|
|
triggerOn = False;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (
|
|
(!inverseTrigger && current_value > attributeValueThreshold) ||
|
|
(inverseTrigger && current_value < attributeValueThreshold)
|
|
)
|
|
{
|
|
Check(&audioComponentSocket);
|
|
Check(audioComponentSocket.GetCurrent());
|
|
#if 1
|
|
audioComponentSocket.GetCurrent()->ReceiveControl(
|
|
controlIDOn,
|
|
controlValueOn
|
|
);
|
|
#else
|
|
audioComponentSocket.GetCurrent()->PostReceiveControl(
|
|
controlIDOn,
|
|
controlValueOn
|
|
);
|
|
#endif
|
|
triggerOn = True;
|
|
}
|
|
}
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> AudioControlValue
|
|
AudioTriggerOf<T>::ExtractInterestingValue(const T*)
|
|
{
|
|
Fail("AudioTriggerOf<T>::ExtractInterestingValue - Should never reach here");
|
|
return 0;
|
|
}
|
|
|
|
//##########################################################################
|
|
//########################### AudioScaleOf ###########################
|
|
//##########################################################################
|
|
|
|
template <class T> class AudioScaleOf:
|
|
public AudioWatcherOf<T>
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor, Destructor
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioScaleOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioScaleOf();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//--------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// SendNotificationOfChange
|
|
//--------------------------------------------------------------------
|
|
//
|
|
void
|
|
SendNotificationOfChange();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//--------------------------------------------------------------------
|
|
//
|
|
virtual AudioControlValue
|
|
ExtractInterestingValue(const T *attribute_ptr);
|
|
|
|
private:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Private data
|
|
//--------------------------------------------------------------------
|
|
//
|
|
Scalar
|
|
attributeValueBoundary1,
|
|
attributeValueBoundary2;
|
|
AudioControlID
|
|
controlID;
|
|
AudioControlValue
|
|
controlValueBoundary1,
|
|
controlValueBoundary2;
|
|
Scalar
|
|
exponent;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioScaleOf templates ~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioScaleOf<T>::AudioScaleOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
):
|
|
AudioWatcherOf<T>(stream, entity)
|
|
{
|
|
//
|
|
// Get audio component
|
|
//
|
|
AudioComponent *audio_component = audioComponentSocket.GetCurrent();
|
|
Check(audio_component);
|
|
audio_component->AddWatcher(this);
|
|
|
|
//
|
|
// Get other fields
|
|
//
|
|
MemoryStream_Read(stream, &attributeValueBoundary1);
|
|
MemoryStream_Read(stream, &attributeValueBoundary2);
|
|
|
|
MemoryStream_Read(stream, &controlID);
|
|
|
|
MemoryStream_Read(stream, &controlValueBoundary1);
|
|
MemoryStream_Read(stream, &controlValueBoundary2);
|
|
MemoryStream_Read(stream, &exponent);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioScaleOf<T>::~AudioScaleOf()
|
|
{
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioScaleOf<T>::BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
)
|
|
{
|
|
AudioWatcherOf<T>::BuildFromPage(stream, name_list, class_ID, object_ID);
|
|
|
|
//
|
|
// Store other fields
|
|
//
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Scalar, attribute_value_boundary1
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Scalar, attribute_value_boundary2
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Enumeration, control_ID
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, control_value_boundary1
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, control_value_boundary2
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Scalar, exponent
|
|
);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioScaleOf<T>::SendNotificationOfChange()
|
|
{
|
|
//
|
|
// Get current value
|
|
//
|
|
T *attribute_ptr = GetCurrentPointer();
|
|
Check_Pointer(attribute_ptr);
|
|
Scalar current_value = ExtractInterestingValue(attribute_ptr);
|
|
|
|
//
|
|
// Clamp value within range
|
|
//
|
|
Scalar min_attribute_boundary =
|
|
Min(attributeValueBoundary1, attributeValueBoundary2);
|
|
Scalar max_attribute_boundary =
|
|
Max(attributeValueBoundary1, attributeValueBoundary2);
|
|
|
|
Clamp(current_value, min_attribute_boundary, max_attribute_boundary);
|
|
Verify(
|
|
current_value >= min_attribute_boundary &&
|
|
current_value <= max_attribute_boundary
|
|
);
|
|
|
|
//
|
|
// Calculate scale
|
|
//
|
|
Verify(!Small_Enough(attributeValueBoundary2 - attributeValueBoundary1));
|
|
Scalar current_scale =
|
|
(current_value - attributeValueBoundary1) /
|
|
(attributeValueBoundary2 - attributeValueBoundary1);
|
|
Verify(current_scale >= -1.0f && current_scale <= 1.0f);
|
|
|
|
//
|
|
// Apply exponent
|
|
//
|
|
if (exponent != 1.0f)
|
|
{
|
|
Scalar old_scale = current_scale; // HACK - for debugging
|
|
|
|
current_scale = pow(old_scale, exponent);
|
|
|
|
#if DEBUG_LEVEL>0
|
|
if (!(current_scale >= -1.0f && current_scale <= 1.0f))
|
|
{
|
|
Dump(old_scale);
|
|
Dump(exponent);
|
|
Dump(current_scale);
|
|
}
|
|
#endif
|
|
}
|
|
Verify(current_scale >= -1.0f && current_scale <= 1.0f);
|
|
|
|
//
|
|
// Calculate control value
|
|
//
|
|
AudioControlValue control_value =
|
|
current_scale * (controlValueBoundary2 - controlValueBoundary1) +
|
|
controlValueBoundary1;
|
|
|
|
#if DEBUG_LEVEL>0
|
|
AudioControlValue min_control_boundary =
|
|
Min(controlValueBoundary1, controlValueBoundary2);
|
|
AudioControlValue max_control_boundary =
|
|
Max(controlValueBoundary1, controlValueBoundary2);
|
|
|
|
Verify(
|
|
control_value >= min_control_boundary &&
|
|
control_value <= max_control_boundary
|
|
);
|
|
#endif
|
|
|
|
Check(&audioComponentSocket);
|
|
Check(audioComponentSocket.GetCurrent());
|
|
audioComponentSocket.GetCurrent()->ReceiveControl(
|
|
controlID,
|
|
control_value
|
|
);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> AudioControlValue
|
|
AudioScaleOf<T>::ExtractInterestingValue(const T*)
|
|
{
|
|
Fail("AudioScaleOf<T>::ExtractInterestingValue - Should never reach here");
|
|
return 0;
|
|
}
|
|
|
|
//##########################################################################
|
|
//########################## AudioMatchOf ############################
|
|
//##########################################################################
|
|
|
|
template <class T> class AudioMatchOf:
|
|
public AudioWatcherOf<T>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioMatchOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioMatchOf();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// SendNotificationOfChange
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
SendNotificationOfChange();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
virtual int
|
|
ExtractInterestingValue(const T *attribute_ptr);
|
|
|
|
private:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Private data
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
int
|
|
attributeMatchValue;
|
|
AudioControlID
|
|
controlID;
|
|
AudioControlValue
|
|
controlValue;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioMatchOf templates ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioMatchOf<T>::AudioMatchOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
):
|
|
AudioWatcherOf<T>(stream, entity)
|
|
{
|
|
Check(simulation);
|
|
simulation->AddAudioWatcher(this);
|
|
|
|
//
|
|
// Get other fields
|
|
//
|
|
MemoryStream_Read(stream, &attributeMatchValue);
|
|
MemoryStream_Read(stream, &controlID);
|
|
MemoryStream_Read(stream, &controlValue);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioMatchOf<T>::~AudioMatchOf()
|
|
{
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioMatchOf<T>::BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
)
|
|
{
|
|
AudioWatcherOf<T>::BuildFromPage(stream, name_list, class_ID, object_ID);
|
|
|
|
//
|
|
// Store other fields
|
|
//
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, int, attribute_match_value
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Enumeration, control_ID
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, control_value
|
|
);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioMatchOf<T>::SendNotificationOfChange()
|
|
{
|
|
//
|
|
// Get current value
|
|
//
|
|
T *attribute_ptr = GetCurrentPointer();
|
|
Check_Pointer(attribute_ptr);
|
|
int current_value = ExtractInterestingValue(attribute_ptr);
|
|
|
|
if (current_value == attributeMatchValue)
|
|
{
|
|
Check(&audioComponentSocket);
|
|
Check(audioComponentSocket.GetCurrent());
|
|
#if 1
|
|
audioComponentSocket.GetCurrent()->ReceiveControl(
|
|
controlID,
|
|
controlValue
|
|
);
|
|
#else
|
|
audioComponentSocket.GetCurrent()->PostReceiveControl(
|
|
controlID,
|
|
controlValue
|
|
);
|
|
#endif
|
|
}
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> int
|
|
AudioMatchOf<T>::ExtractInterestingValue(const T*)
|
|
{
|
|
Fail("AudioMatchOf<T>::ExtractInterestingValue - Should never reach here");
|
|
return 0;
|
|
}
|
|
|
|
//##########################################################################
|
|
//########################## AudioDeltaOf ############################
|
|
//##########################################################################
|
|
|
|
template <class T> class AudioDeltaOf:
|
|
public AudioWatcherOf<T>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioDeltaOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioDeltaOf();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// SendNotificationOfChange
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
SendNotificationOfChange();
|
|
|
|
private:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Private data
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
T
|
|
lastValue;
|
|
T
|
|
deltaTrigger;
|
|
AudioControlID
|
|
controlID;
|
|
AudioControlValue
|
|
controlValue;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioDeltaOf templates ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioDeltaOf<T>::AudioDeltaOf(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
):
|
|
AudioWatcherOf<T>(stream, entity)
|
|
{
|
|
Check(simulation);
|
|
simulation->AddAudioWatcher(this);
|
|
|
|
MemoryStream_Read(stream, &controlID);
|
|
MemoryStream_Read(stream, &controlValue);
|
|
MemoryStream_Read(stream, &deltaTrigger);
|
|
|
|
lastValue = GetCurrentValue();
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T>
|
|
AudioDeltaOf<T>::~AudioDeltaOf()
|
|
{
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioDeltaOf<T>::BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
)
|
|
{
|
|
AudioWatcherOf<T>::BuildFromPage(stream, name_list, class_ID, object_ID);
|
|
|
|
//
|
|
// control_ID, control_value
|
|
//
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, Enumeration, control_ID
|
|
);
|
|
MEM_STRM_WRITE_ENTRY(
|
|
*stream, name_list, AudioControlValue, control_value
|
|
);
|
|
|
|
//
|
|
// delta_value
|
|
//
|
|
T delta_trigger = SMALL;
|
|
|
|
if (name_list->FindData("delta_trigger") != NULL)
|
|
{
|
|
Convert_From_Ascii(
|
|
(const char *)name_list->FindData("delta_trigger"),
|
|
&delta_trigger
|
|
);
|
|
}
|
|
MemoryStream_Write(stream, &delta_trigger);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
template <class T> void
|
|
AudioDeltaOf<T>::SendNotificationOfChange()
|
|
{
|
|
T *attribute_ptr;
|
|
T delta_change;
|
|
|
|
attribute_ptr = GetCurrentPointer();
|
|
Check_Pointer(attribute_ptr);
|
|
delta_change = *attribute_ptr - lastValue;
|
|
|
|
if (Abs(delta_change) >= deltaTrigger)
|
|
{
|
|
lastValue = *attribute_ptr;
|
|
|
|
Check(&audioComponentSocket);
|
|
Check(audioComponentSocket.GetCurrent());
|
|
#if 1
|
|
audioComponentSocket.GetCurrent()->ReceiveControl(
|
|
controlID,
|
|
controlValue
|
|
);
|
|
#else
|
|
audioComponentSocket.GetCurrent()->PostReceiveControl(
|
|
controlID,
|
|
controlValue
|
|
);
|
|
#endif
|
|
}
|
|
}
|
|
|
|
//##########################################################################
|
|
//########################### AudioMotionTrigger #####################
|
|
//##########################################################################
|
|
|
|
enum MotionType
|
|
{
|
|
LinearMotionType = 0,
|
|
AngularMotionType = 1
|
|
};
|
|
|
|
inline MemoryStream&
|
|
MemoryStream_Read(
|
|
MemoryStream *stream,
|
|
MotionType *ptr
|
|
)
|
|
{return stream->ReadBytes(ptr, sizeof(*ptr));}
|
|
inline MemoryStream&
|
|
MemoryStream_Write(
|
|
MemoryStream *stream,
|
|
const MotionType *ptr
|
|
)
|
|
{return stream->WriteBytes(ptr, sizeof(*ptr));}
|
|
|
|
enum MotionValue
|
|
{
|
|
XMotionValue = 0,
|
|
YMotionValue = 1,
|
|
ZMotionValue = 2,
|
|
LengthMotionValue = 3
|
|
};
|
|
|
|
inline MemoryStream&
|
|
MemoryStream_Read(
|
|
MemoryStream *stream,
|
|
MotionValue *ptr
|
|
)
|
|
{return stream->ReadBytes(ptr, sizeof(*ptr));}
|
|
inline MemoryStream&
|
|
MemoryStream_Write(
|
|
MemoryStream *stream,
|
|
const MotionValue *ptr
|
|
)
|
|
{return stream->WriteBytes(ptr, sizeof(*ptr));}
|
|
|
|
class AudioMotionTrigger:
|
|
public AudioTriggerOf<Motion>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioMotionTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioMotionTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const Motion *attribute_ptr);
|
|
|
|
private:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// DumpValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
DumpValue(const Motion *attribute_ptr);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Private data
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
MotionType
|
|
motionType;
|
|
MotionValue
|
|
motionValue;
|
|
};
|
|
|
|
//##########################################################################
|
|
//########################### AudioMotionScale #######################
|
|
//##########################################################################
|
|
|
|
class AudioMotionScale:
|
|
public AudioScaleOf<Motion>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioMotionScale(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioMotionScale();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const Motion *attribute_ptr);
|
|
|
|
private:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// DumpValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
DumpValue(const Motion *attribute_ptr);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Private data
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
MotionType
|
|
motionType;
|
|
MotionValue
|
|
motionValue;
|
|
};
|
|
|
|
//##########################################################################
|
|
//########################### AudioHingeScale #########################
|
|
//##########################################################################
|
|
|
|
class AudioHingeScale:
|
|
public AudioScaleOf<Hinge>
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor, Destructor, Testing
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioHingeScale(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioHingeScale();
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const Hinge *attribute_ptr);
|
|
|
|
private:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// DumpValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
DumpValue(const Hinge *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//########################### AudioScalarTrigger #####################
|
|
//##########################################################################
|
|
|
|
class AudioScalarTrigger:
|
|
public AudioTriggerOf<Scalar>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioScalarTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioScalarTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const Scalar *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//###################### AudioScalarDeltaTrigger #####################
|
|
//##########################################################################
|
|
|
|
class AudioScalarDeltaTrigger:
|
|
public AudioDeltaOf<Scalar>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioScalarDeltaTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioScalarDeltaTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
};
|
|
|
|
//##########################################################################
|
|
//########################### AudioScalarScale ########################
|
|
//##########################################################################
|
|
|
|
class AudioScalarScale:
|
|
public AudioScaleOf<Scalar>
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor, Destructor, Testing
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioScalarScale(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioScalarScale();
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const Scalar *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//######################## AudioLogicalTrigger #######################
|
|
//##########################################################################
|
|
|
|
class AudioLogicalTrigger:
|
|
public AudioMatchOf<Logical>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioLogicalTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioLogicalTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
int
|
|
ExtractInterestingValue(const Logical *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//###################### AudioEnumerationTrigger #####################
|
|
//##########################################################################
|
|
|
|
class AudioEnumerationTrigger:
|
|
public AudioMatchOf<Enumeration>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioEnumerationTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioEnumerationTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
int
|
|
ExtractInterestingValue(const Enumeration *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//################### AudioEnumerationDeltaTrigger ###################
|
|
//##########################################################################
|
|
|
|
class AudioEnumerationDeltaTrigger:
|
|
public AudioDeltaOf<Enumeration>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioEnumerationDeltaTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioEnumerationDeltaTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
};
|
|
|
|
//##########################################################################
|
|
//####################### AudioIntegerTrigger ########################
|
|
//##########################################################################
|
|
|
|
class AudioIntegerTrigger:
|
|
public AudioTriggerOf<int>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioIntegerTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioIntegerTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const int *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//################### AudioControlsButtonTrigger #####################
|
|
//##########################################################################
|
|
|
|
class AudioControlsButtonTrigger:
|
|
public AudioTriggerOf<ControlsButton>
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Constructor
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioControlsButtonTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioControlsButtonTrigger();
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// ExtractInterestingValue
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
AudioControlValue
|
|
ExtractInterestingValue(const ControlsButton *attribute_ptr);
|
|
};
|
|
|
|
//##########################################################################
|
|
//######################## AudioStateWatcher #########################
|
|
//##########################################################################
|
|
|
|
class AudioStateWatcher:
|
|
public AudioWatcherOf<StateIndicator>
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Destructor
|
|
//--------------------------------------------------------------------
|
|
//
|
|
~AudioStateWatcher();
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioStateWatcher(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// SendNotificationOfChange
|
|
//--------------------------------------------------------------------
|
|
//
|
|
void
|
|
SendNotificationOfChange();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// StateChanged
|
|
//--------------------------------------------------------------------
|
|
//
|
|
virtual void
|
|
StateChanged(
|
|
Enumeration old_state,
|
|
Enumeration new_state
|
|
);
|
|
};
|
|
|
|
//##########################################################################
|
|
//########################### AudioStateTrigger ######################
|
|
//##########################################################################
|
|
|
|
class AudioStateTrigger:
|
|
public AudioStateWatcher
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructor, Destructor
|
|
//--------------------------------------------------------------------
|
|
//
|
|
AudioStateTrigger(
|
|
PlugStream *stream,
|
|
Entity *entity
|
|
);
|
|
~AudioStateTrigger();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//--------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
protected:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// StateChanged
|
|
//--------------------------------------------------------------------
|
|
//
|
|
void
|
|
StateChanged(
|
|
Enumeration old_state,
|
|
Enumeration new_state
|
|
);
|
|
|
|
private:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Private data
|
|
//--------------------------------------------------------------------
|
|
//
|
|
Enumeration
|
|
triggerState;
|
|
Logical
|
|
inverseTrigger;
|
|
AudioControlID
|
|
controlID;
|
|
AudioControlValue
|
|
controlValue;
|
|
Logical
|
|
excludeTransition;
|
|
Enumeration
|
|
excludeState;
|
|
};
|