#include <c4d_basesound.h>
Cinema 4D sound object.
- Note
- Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
|
Bool | Init (Int sample_cnt, Float frequency, Int32 channel_cnt) |
|
void | FlushAll () |
|
BaseBitmap * | GetBitmap (Int32 width, Int32 height, const BaseTime &start, const BaseTime &stop) |
|
BaseBitmap * | GetBitmap (Int32 width, Int32 height, const BaseTime &start, const BaseTime &stop, const Vector &draw_col, const Vector &back_col) |
|
GeListHead * | GetMarkerRoot () |
|
void | GetSoundInfo (GeSndInfo *info) const |
|
|
Int32 | GetType () const |
|
Int32 | GetRealType () const |
|
Int32 | GetDiskType () const |
|
Bool | IsInstanceOf (Int32 id) const |
|
Int32 | GetClassification () const |
|
Bool | Message (Int32 type, void *data=nullptr) |
|
Bool | MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data) |
|
C4DAtom * | GetClone (COPYFLAGS flags, AliasTrans *trn) |
|
Bool | CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn) |
|
Bool | Read (HyperFile *hf, Int32 id, Int32 level) |
|
Bool | Write (HyperFile *hf) |
|
Bool | ReadObject (HyperFile *hf, Bool readheader) |
|
Bool | WriteObject (HyperFile *hf) |
|
Bool | GetDescription (Description *description, DESCFLAGS_DESC flags) |
|
Bool | GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags) |
|
Bool | SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags) |
|
DynamicDescription * | GetDynamicDescription () |
|
Bool | GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc) |
|
Bool | TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at) |
|
UInt32 | GetDirty (DIRTYFLAGS flags) const |
|
void | SetDirty (DIRTYFLAGS flags) |
|
UInt32 | GetHDirty (HDIRTYFLAGS mask) const |
|
void | SetHDirty (HDIRTYFLAGS mask) |
|
◆ BaseSound()
◆ ~BaseSound()
◆ Alloc()
Allocates a sound object. Destroy the allocated sound object with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
- Returns
- The allocated sound object, or nullptr if the allocation failed.
◆ Free()
Destructs sound objects allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.
- Parameters
-
[in] | v | The sound object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
◆ GetClone()
Creates a copy of a BaseSound object.
- Returns
- The cloned sound object, or nullptr if failed. The caller owns the pointed sound object.
◆ GetClonePart()
Clones a part of the sound object.
- Parameters
-
[in] | start | The start time of the cloned part. |
[in] | stop | The end time of the cloned part. |
[in] | reverse | true to revert the cloned part. |
- Returns
- The cloned part of the sound object, or nullptr if failed. The caller owns the pointed sound object.
◆ CopyTo()
Copy the settings from the object to another BaseSound object.
- Parameters
-
[out] | dest | The sound object to copy to. The caller owns the pointed sound object. |
- Returns
- true if successful, otherwise false.
◆ Init()
Creates a sound object and allocates memory for it from the given parameters.
- Parameters
-
[in] | sample_cnt | The number of samples. |
[in] | frequency | The sample frequency. |
[in] | channel_cnt | The number of sound channels. |
- Returns
- true if successful, otherwise false.
◆ FlushAll()
Frees all resources allocated for the sound object and sets the state to the same as after Alloc().
◆ GetBitmap() [1/2]
Gets the bitmap with the graph of the sound.
- Parameters
-
[in] | width | The number of pixels wide to create the bitmap. |
[in] | height | The number of pixels high to create the bitmap. |
[in] | start | The starting time for the leftmost position in the graph. |
[in] | stop | The end time that should be displayed at the rightmost position in the graph. |
- Returns
- The bitmap of the sounds graph, or nullptr if failed. The caller owns the pointed bitmap.
◆ GetBitmap() [2/2]
Gets the bitmap with the graph of the sound.
- Parameters
-
[in] | width | The number of pixels wide to create the bitmap. |
[in] | height | The number of pixels high to create the bitmap. |
[in] | start | The starting time for the leftmost position in the graph. |
[in] | stop | The end time that should be displayed at the rightmost position in the graph. |
[in] | draw_col | The draw color. |
[in] | back_col | The background color. |
- Returns
- The bitmap of the sounds graph, or nullptr if failed. The caller owns the pointed bitmap.
◆ GetMarkerRoot()
◆ GetSoundInfo()
Retrieves the sound information data of the sound object.
- Parameters
-
[out] | info | Assigned the sound information. The caller owns the pointed sound information. |
◆ Load()
Loads an audio file.
- Note
- Currently only the WAV file format is supported.
- Parameters
-
[in] | fn | The name of the file to load. |
- Returns
- true if successful, otherwise false.
◆ Save()
Saves a sound to an audio file.
- Note
- Currently only the WAV file format is supported.
- Parameters
-
[in] | fn | The name of the file to save. |
- Returns
- true if successful, otherwise false.
◆ GetSampleEx()
Retrieves a sample at a given sample offset.
- Note
- If the sound is mono then SDataEx::r will be set to the same value as SDataEx::l.
If the sound is 8-bit then the samples will be scaled to 16-bit so the values are always in the range -32768 to +32767.
- Parameters
-
[in] | i | The sample position to get the sample from. |
[out] | data | Assigned the sample data. The caller owns the pointed sample data. |
◆ SetSampleEx()
Sets a sample at a given position in the sound.
- Note
- If the sound is mono then the sample is set to the average value of the left and right samples set in SDataEx, (SDataEx::l+ SDataEx::r)/2.
If the sound is 8-bit then the values will be scaled from the 16-bit values set in SDataEx.
- Parameters
-
[in] | i | The sample position to set. |
[in] | data | The sample data to put into the sound. |
◆ WriteIt()
Writes the sound to a hyper file.
- Parameters
-
[in] | hf | The hyper file to write to. The caller owns the pointed hyper file. |
- Returns
- true if successful, otherwise false.
◆ ReadIt()
Reads the sound from a hyper file.
- Parameters
-
[in] | hf | The hyper file to read from. The caller owns the pointed hyper file. |
[in] | level | The disklevel of the sound to read. |
- Returns
- true if successful, otherwise false.