AutoAlloc<BaseSound>
sound;
if
(!sound)
return
false
;
if
(!sound->
Load
(fn))
return
false
;
GeSndInfo
sndinfo(sound);
AutoAlloc<GePlaySnd>
playsound;
if
(!playsound)
return
false
;
playsound->
Open
(sound);
playsound->
Scrub
(0, sndinfo.GetLength().Get());
while
(playsound->
IsPlaying
())
{
GePrint
(
"pos: "
+
String::FloatToString
(playsound->
GetPositionEstimate
()));
}
playsound->
关闭
();
构造函数 & 析构函数文档编制
◆
GePlaySnd()
◆
~GePlaySnd()
成员函数文档编制
◆
Alloc()
Allocates a
GePlaySnd
instance. Destroy the allocated
GePlaySnd
instance with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated
GePlaySnd
instance, or
nullptr
if the allocation failed.
◆
Free()
Destructs
GePlaySnd
instances allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in,out]
|
data
|
The
GePlaySnd
instance to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
Open()
[1/2]
The audio data referenced by the
BaseSound
will be kept in memory until
Close()
is called.
-
参数
-
[in]
|
snd
|
The sound to use for playback. The caller owns the pointed sound.
|
-
返回
-
true
if successful, otherwise
false
.
◆
Open()
[2/2]
Opens an audio device with multiple BaseSounds that will be mixed. The audio data referenced by the BaseSounds will be kept in memory until
Close()
is called.
-
参数
-
[in]
|
stream_cnt
|
The number of sounds to be mixed.
|
[in]
|
streams
|
The array with the sounds.
|
[in]
|
start_offsets
|
The array with start time offsets in seconds (this is the audible sound data when
StartAt(0)
is called).
|
[in]
|
max_length
|
The maximum length of the audio data in seconds (relative to
StartAt(0)
).
|
-
返回
-
true
if successful, otherwise
false
.
◆
Close()
Closes the audio device.
-
注意
-
If the sounds used for
Open()
have been deleted in the meantime, their audio data will be released.
◆
StartAt()
Starts audio output.
-
参数
-
[in]
|
start
|
The position relative to the start of the audio data in seconds.
|
◆
Scrub()
-
参数
-
[in]
|
start
|
The position relative to the start of the audio data in seconds.
|
[in]
|
duration
|
The scrub duration in seconds after which the audio device will be stopped.
|
◆
Stop()
Stops audio output.
◆
IsPlaying()
Checks if the audio device is running
-
返回
-
true
if if audio is playing, otherwise
false
.
◆
GetPositionEstimate()
Float64
GetPositionEstimate
|
(
|
void
|
|
)
|
|
Gets an estimate audio position.
-
返回
-
The currently audible position in seconds.
◆
SetScale()
Sets the playback time scale.
-
参数
-
[in]
|
scale
|
The playback scale value:
1.0
means real time,
2.0
means twice as fast,
0.5
means half the speed,
0.0
is invalid.
|
◆
GetScale()
Gets the current playback time scale.
-
返回
-
The playback scale value:
1.0
means real time,
2.0
means twice as fast,
0.5
means half the speed,
0.0
is invalid.
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
定义:
c4d_string.h:529
Manages file and path names.
定义:
c4d_file.h:93
void Scrub(Float64 start, Float64 duration)
void GePrint(const maxon::String &str)
Float64 GetPositionEstimate(void)
Bool Load(const Filename &fn)
Bool Open(const BaseSound *snd)
Bool FileSelect(FILESELECTTYPE type, FILESELECT flags, const maxon::String &title, const maxon::String &force_suffix=maxon::String())