 |
Gorgon Game Engine
|
Go to the documentation of this file.
8 #include "../Containers/Wave.h"
63 data = std::move(wave);
112 bool load(std::shared_ptr<Reader>
reader,
unsigned long size,
bool forceload);
unsigned long GetBytes() const
Returns the size of the wave in bytes.
Definition: Wave.h:410
void Assume(Containers::Wave &wave)
Assumes the contents of the given wave as wave data.
Definition: Sound.h:62
bool lateloading
Whether to load this sound during initial loading.
Definition: Sound.h:133
virtual ~Sound()
Destructor.
Definition: Sound.h:24
This class stores animations as a part of itself so that it can be moved around as a value rather tha...
Definition: Storage.h:21
SizeController GetController() const override
Returns the size controller.
Definition: ScalableObject.h:181
This class allows control over a sizable object.
Definition: Graphics.h:161
constexpr Type File
File.
Definition: GID.h:84
void Initialize()
Definition: Resource.cpp:18
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
void SetCompression(GID::Type compression)
Changes the compression type of this resource.
Definition: Sound.h:102
constexpr Type ScalableObject_Props
Definition: GID.h:248
A_ * GetBase() const
Returns the base component. Could return nullptr.
Definition: ScalableObject.h:176
Tiling
Controls how a direction is tiled.
Definition: Graphics.h:164
Definition: TextureAnimation.h:137
std::ostream & GetStream()
This should be last resort, use if the actual stream is needed.
Definition: Writer.h:96
void SetChannels(std::vector< Audio::Channel > channels)
Sets the channel assignment to this wave data.
Definition: Wave.h:434
std::vector< Channel > StandardChannels(int channelcount)
Definition: Basic.h:39
basic_TextureAnimationProvider< Bitmap, basic_TextureAnimation, basic_AnimationFrame< Bitmap > > BitmapAnimationProvider
Definition: TextureAnimation.h:520
constexpr Type Null
Null resource.
Definition: GID.h:105
int bits
Number of bits per sample.
Definition: Sound.h:141
IScalableObjectProvider & MoveOutProvider() override
This function moves this animation provider into a new provider.
Definition: ScalableObject.cpp:209
void SaveAnimation(Writer &writer, const Graphics::RectangularAnimationProvider &object)
Saves a given generic rectangular animation as resource.
Definition: Resource.cpp:22
static ScalableObject * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a tinted object resource from the file.
Definition: ScalableObject.cpp:34
constexpr Type Sound_Props
Definition: GID.h:220
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
static void SaveThis(Writer &writer, const Graphics::Bitmap &bmp, GID::Type type=GID::Image)
This function can be used to save a bitmap as image resource without modifying it.
Definition: Image.cpp:171
static void SaveThis(Writer &writer, const Graphics::IStackedObjectProvider &provider)
Definition: StackedObject.cpp:151
static void SaveThis(Writer &writer, const Graphics::ILineProvider &provider)
Definition: Line.cpp:175
static void SaveThis(Writer &writer, const Graphics::BitmapAnimationProvider &anim, GID::Type type=GID::Animation, std::function< void(Writer &writer)> extra={})
Saves the given animation as a resource.
Definition: Animation.cpp:100
FLAC Flac
Definition: FLAC.cpp:419
float Get(unsigned long p, unsigned ch) const
Allows access to individual members.
Definition: Wave.h:395
Sound()
Default constructor.
Definition: Sound.h:21
void Destroy()
Destroys this wave by setting its size to 0 and freeing the memory used by its data.
Definition: Wave.h:346
Audio::Channel GetChannelType(int channel) const
Returns the type of the channel at the given index.
Definition: Wave.h:425
constexpr Type Image
Image resource.
Definition: GID.h:149
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
Interface for RectangleProviders.
Definition: Rectangle.h:12
bool load(std::shared_ptr< Reader > reader, unsigned long size, bool forceload)
Loads the sound from the data stream.
Definition: Sound.cpp:38
For ease of use in resource system.
Definition: ScalableObject.h:11
@ UnsupportedCompression
If the compression type in the file is not supported.
Definition: Reader.h:46
Placement
Defines how an object is placed in a 2D axis system.
Definition: Graphics.h:79
void WriteUInt32(unsigned long value)
Writes a 32-bit unsigned integer to the stream.
Definition: Writer.h:158
void Decode(std::istream &input, Containers::Wave &wave)
Decodes given FLAC compressed data and fills a wave container.
Definition: FLAC.cpp:342
static void InitializeLoaders()
This function will initialize data loaders.
Definition: DataItems.cpp:9
For ease of use in resource system.
Definition: TintedObject.h:11
static void SaveThis(Writer &writer, const Graphics::IMaskedObjectProvider &provider)
Definition: MaskedObject.cpp:141
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
int GetBits() const
Definition: Sound.h:68
constexpr Type Sound_Wave
Definition: GID.h:221
bool IsLoaded() const
Returns whether the sound data is loaded.
Definition: Sound.h:46
Wave Duplicate() const
Duplicates this wave, essentially performing the work of copy constructor.
Definition: Wave.h:214
void save(Writer &writer) const override
Definition: ScalableObject.cpp:133
This object creates a scalable object from a graphic object.
Definition: ScalableObject.h:122
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
constexpr Type FLAC
LZMA compression.
Definition: GID.h:122
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: ScalableObject.cpp:205
void SetBase(A_ *value)
Sets the base provider, ownership semantics will not be changed.
Definition: ScalableObject.h:191
bool IsPCM() const
Returns if the wave data will be saved as PCM data.
Definition: Sound.h:82
void SetSampleRate(unsigned rate)
Sets the number samples per second.
Definition: Wave.h:456
void save(Writer &writer) const override
Definition: Sound.cpp:159
Collection is a container for reference typed objects.
Definition: Collection.h:21
void WriteArray(const T_ *data, unsigned long size)
Writes an array to the file.
Definition: Writer.h:288
constexpr Type None
Empty, different from Null resource.
Definition: GID.h:81
Interface for LineProviders.
Definition: Line.h:12
This object contains an bitmap image.
Definition: Bitmap.h:25
void SetBits(int bits)
Sets the number of bits per sample.
Definition: Sound.h:75
constexpr Type Animation
Definition: GID.h:187
This class is the base for all Gorgon Resources.
Definition: Base.h:20
static Sound * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a sound resource from the given file.
Definition: Sound.cpp:7
bool pcm
Definition: Sound.h:135
For ease of use in resource system.
Definition: StackedObject.h:10
Containers::Wave & GetWave()
Definition: Sound.h:33
void Resize(unsigned long size, std::vector< Audio::Channel > channels)
Resizes the wave to the given size and channels.
Definition: Wave.h:225
basic_ScalableObjectProvider< RectangularAnimationProvider > ScalableObjectProvider
Definition: ScalableObject.h:275
Tiling Horizontal
Horizontal tiling mode.
Definition: Graphics.h:470
Placement Place
Placement method.
Definition: Graphics.h:476
bool isloaded
Whether this sound is loaded or not.
Definition: Sound.h:127
long GetCount() const
Returns number of elements.
Definition: Collection.h:236
Containers::Wave data
Sound data.
Definition: Sound.h:138
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
constexpr Type Sound_Fmt
Definition: GID.h:224
This is a tinted object resource.
Definition: ScalableObject.h:16
static void SaveThis(Writer &writer, const Graphics::IScalableObjectProvider &provider)
Definition: ScalableObject.cpp:152
unsigned GetChannelCount() const
Returns the number of channels that this wave data has.
Definition: Wave.h:420
void checkfmt() const
Checks if the format of the file is well-formed.
Definition: Sound.cpp:222
void Destroy()
Destroys the data stored in the sound.
Definition: Sound.h:38
void SetPCM(bool pcm)
Set whether the wave data should be saved in PCM format.
Definition: Sound.h:88
This class represents a loading error.
Definition: Reader.h:16
constexpr Type Sound_Cmp_Wave
Definition: GID.h:222
const Containers::Wave & GetWave() const
Definition: Sound.h:29
unsigned char Byte
Represents smallest cell in memory.
Definition: Types.h:9
Channel
Names for channels.
Definition: Basic.h:16
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
This class provides rectangular animations.
Definition: Animations.h:48
constexpr Type Sound_Channels
Definition: GID.h:225
Gorgon::Animation::basic_Storage< RectangularAnimationProvider > RectangularAnimationStorage
Definition: Animations.h:374
void WriteInt16(int value)
Writes a 16-bit integer to the stream.
Definition: Writer.h:167
static void SaveThis(Writer &writer, const Graphics::ITintedObjectProvider &provider)
Definition: TintedObject.cpp:147
GID::Type GetCompression() const
Returns the compression type of this resource.
Definition: Sound.h:95
GID::Type compression
Compression mode of this sound resource.
Definition: Sound.h:130
basic_ScalableObjectProvider< BitmapAnimationProvider > ScalableBitmapAnimationProvider
Definition: ScalableObject.h:278
For ease of use in resource system.
Definition: MaskedObject.h:10
void Encode(const Containers::Wave &input, std::ostream &output, int bps=16)
Encodes the given wave data to FLAC compressed data.
Definition: FLAC.cpp:291
void WriteBool(bool value)
Writes a boolean value. In resource 1.0, booleans are stored as 32bit integers.
Definition: Writer.h:220
Type to store GID information.
Definition: GID.h:23
This class is a container for wave data.
Definition: Wave.h:17
Containers::Collection< Base > children
Child objects that this resource object have.
Definition: Base.h:162
void Assign(const Containers::Wave &wave)
Assigns the sound to the copy of the given data.
Definition: Sound.h:54
static void SaveThis(Writer &writer, const Graphics::IRectangleProvider &provider)
Definition: Rectangle.cpp:250
void WriteEnum32(E_ value)
Writes an enumeration as 32-bit integer to the stream.
Definition: Writer.h:140
virtual GID::Type GetGID() const override
04010000h (Extended, Sound)
Definition: Sound.h:27
float * RawData()
Returns the raw data pointer.
Definition: Wave.h:365
void WriteUInt8(Byte value)
Writes an 8-bit unsigned integer to the stream.
Definition: Writer.h:194
void WriteGID(GID::Type value)
Writes a GID to the given stream.
Definition: Writer.h:303
std::shared_ptr< Reader > reader
Used to handle late loading.
Definition: Sound.h:124
unsigned long entrypoint
Entry point of this resource within the physical file.
Definition: Sound.h:121
bool Load()
Loads the sound from the disk. If sound is already loaded, this function will return true.
Definition: Sound.cpp:18
static void SaveThis(Writer &writer)
Definition: Null.cpp:14
unsigned long GetSize() const
Returns the size of the wave.
Definition: Wave.h:405
unsigned GetSampleRate() const
Returns the number of samples per second.
Definition: Wave.h:451
constexpr Type Sound
Definition: GID.h:219
Tiling Vertical
Vertical tiling mode.
Definition: Graphics.h:473
ScalableObject()
Creates a new empty tinted object.
Definition: ScalableObject.h:43
This is sound resource.
Definition: Sound.h:17
constexpr Type ScalableObject
Definition: GID.h:247