101 lines
3 KiB
C++
101 lines
3 KiB
C++
#pragma once
|
|
|
|
#include "Inc/Engine.h"
|
|
#include "Util/Dictionary.h"
|
|
#include "Util/DynamicArray.h"
|
|
#include "Util/Memory.h"
|
|
#include "Util/String.h"
|
|
#include "Util/Mutex.h"
|
|
#include "Util/BinaryReader.h"
|
|
#include "Util/BinaryWriter.h"
|
|
#include "Util/XmlReader.h"
|
|
#include "Util/XmlWriter.h"
|
|
|
|
|
|
namespace Soundwich
|
|
{
|
|
class Module;
|
|
class ITracker;
|
|
|
|
class Synth
|
|
{
|
|
public:
|
|
inline void * operator new(size_t size)
|
|
{
|
|
return Util::Alloc( size );
|
|
}
|
|
|
|
inline void operator delete(void* memory)
|
|
{
|
|
Util::Free( memory );
|
|
}
|
|
|
|
typedef Util::StringDictionary< Component* > ComponentDictionary;
|
|
typedef Util::DynamicArray< Component* > ComponentArray;
|
|
typedef Util::DynamicArray< Connection* > ConnectionArray;
|
|
typedef Util::DynamicArray< ComponentArray* > RenderingArray;
|
|
|
|
public:
|
|
Synth( Soundwich::Engine::Impl* engine, const Util::String& name );
|
|
~Synth( );
|
|
|
|
inline const Util::String& GetName( ) const { return _name; }
|
|
|
|
inline Engine::Impl* GetEngine( ) { return _engine; }
|
|
|
|
inline ComponentDictionary& GetComponents( ) { return _components; }
|
|
inline ConnectionArray& GetConnections( ) { return _connections; }
|
|
|
|
// Binary Serialization
|
|
|
|
SoundResult Serialize( Util::BinaryWriter& writer );
|
|
SoundResult Deserialize( Util::BinaryReader& reader );
|
|
|
|
// Xml Serialization
|
|
|
|
SoundResult Serialize( Util::XmlWriter& writer );
|
|
SoundResult Deserialize( Util::XmlReader& reader );
|
|
|
|
// Load / Save
|
|
|
|
SoundResult LoadFromFile( const Util::String& fileName );
|
|
SoundResult LoadFromMemory( void* data, uint32 size );
|
|
SoundResult LoadFromXmlFile( const Util::String& fileName );
|
|
SoundResult LoadFromXmlMemory( const Util::String& xml );
|
|
SoundResult SaveToFile( const Util::String& fileName );
|
|
SoundResult SaveToXmlFile( const Util::String& fileName );
|
|
|
|
void AddTick( Component* component );
|
|
void RemoveTick( Component* component );
|
|
void Tick( flt32 interval );
|
|
|
|
void AddRender( Component* component, int32 depth );
|
|
void RemoveRender( Component* component, int32 depth );
|
|
void Render( );
|
|
|
|
void GetStats( Engine::Stats& stats );
|
|
|
|
void SetDebugLogging( bool enable );
|
|
|
|
//Tracking
|
|
void SwitchTracking( bool enable, const char* exportFilePath);//Switch on/off Tracking
|
|
void StartTrackingActivation();
|
|
void EndTrackingActivation();
|
|
void RecordTrackingConnection( const char* dataType, const char* value, const Soundwich::Component* from, const Soundwich::Component* to, int32 portOut, int32 portIn );
|
|
|
|
void RegisterTracker(ISoundwichTracking* cb);
|
|
void UnregisterTracker(ISoundwichTracking* cb);
|
|
|
|
|
|
private:
|
|
|
|
Engine::Impl* _engine;
|
|
Util::String _name;
|
|
ComponentDictionary _components;
|
|
ConnectionArray _connections;
|
|
ComponentArray _ticking;
|
|
RenderingArray _rendering;
|
|
|
|
ITracker* _tracker;
|
|
};
|
|
}
|