-
首页
-
C4D R23.110 C++ SDK
BaseSound Class Reference
#include <c4d_basesound.h>
详细描述
Cinema 4D
sound object.
-
注意
-
Has to be created with
Alloc()
and destroyed with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
杂项
|
Bool
|
Init
(
Int
sample_cnt,
Float
frequency,
Int32
channel_cnt)
|
void
|
FlushAll
(void)
|
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
向量
&draw_col, const
向量
&back_col)
|
GeListHead
*
|
GetMarkerRoot
(void)
|
void
|
GetSoundInfo
(
GeSndInfo
*info) const
|
Additional Inherited Members
|
Int32
|
GetType
() const
|
Int32
|
GetRealType
() const
|
Int32
|
GetDiskType
() const
|
Bool
|
IsInstanceOf
(
Int32
id) const
|
Int32
|
GetClassification
() const
|
Bool
|
消息
(
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
|
读取
(
HyperFile
*hf,
Int32
id,
Int32
level)
|
Bool
|
Write
(
HyperFile
*hf)
|
Bool
|
ReadObject
(
HyperFile
*hf,
Bool
readheader)
|
Bool
|
WriteObject
(
HyperFile
*hf)
|
Bool
|
GetDescription
(
描述
*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()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated sound object, or
nullptr
if the allocation failed.
◆
Free()
Destructs sound objects allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[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
对象。
-
返回
-
The cloned sound object, or
nullptr
if failed. The caller owns the pointed sound object.
◆
GetClonePart()
Clones a part of the sound object.
-
参数
-
[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.
|
-
返回
-
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
对象。
-
参数
-
[out]
|
dest
|
The sound object to copy to. The caller owns the pointed sound object.
|
-
返回
-
true
if successful, otherwise
false
.
◆
Init()
Creates a sound object and allocates memory for it from the given parameters.
-
参数
-
[in]
|
sample_cnt
|
The number of samples.
|
[in]
|
frequency
|
The sample frequency.
|
[in]
|
channel_cnt
|
The number of sound channels.
|
-
返回
-
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.
-
参数
-
[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.
|
-
返回
-
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.
-
参数
-
[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.
|
-
返回
-
The bitmap of the sounds graph, or
nullptr
if failed. The caller owns the pointed bitmap.
◆
GetMarkerRoot()
Private
.
◆
GetSoundInfo()
Retrieves the sound information data of the sound object.
-
参数
-
[out]
|
info
|
Assigned the sound information. The caller owns the pointed sound information.
|
◆
Load()
Loads an audio file.
-
注意
-
Currently only the
WAV
file format is supported.
-
参数
-
[in]
|
fn
|
The name of the file to load.
|
-
返回
-
true
if successful, otherwise
false
.
◆
Save()
Saves a sound to an audio file.
-
注意
-
Currently only the
WAV
file format is supported.
-
参数
-
[in]
|
fn
|
The name of the file to save.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetSampleEx()
Retrieves a sample at a given sample offset.
-
注意
-
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
.
-
参数
-
[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.
-
注意
-
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
.
-
参数
-
[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.
-
参数
-
[in]
|
hf
|
The hyper file to write to. The caller owns the pointed hyper file.
|
-
返回
-
true
if successful, otherwise
false
.
◆
ReadIt()
Reads the sound from a hyper file.
-
参数
-
[in]
|
hf
|
The hyper file to read from. The caller owns the pointed hyper file.
|
[in]
|
level
|
The disklevel of the sound to read.
|
-
返回
-
true
if successful, otherwise
false
.