feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -31,7 +31,6 @@
|
|||
#include "audio_stream_interactive.h"
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
AudioStreamInteractive::AudioStreamInteractive() {
|
||||
}
|
||||
|
|
@ -484,8 +483,6 @@ void AudioStreamInteractive::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_clip_auto_advance_next_clip", "clip_index", "auto_advance_next_clip"), &AudioStreamInteractive::set_clip_auto_advance_next_clip);
|
||||
ClassDB::bind_method(D_METHOD("get_clip_auto_advance_next_clip", "clip_index"), &AudioStreamInteractive::get_clip_auto_advance_next_clip);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "initial_clip", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT), "set_initial_clip", "get_initial_clip");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "clip_count", PROPERTY_HINT_RANGE, "1," + itos(MAX_CLIPS), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ARRAY, "Clips,clip_,page_size=999,unfoldable,numbered,swap_method=_inspector_array_swap_clip,add_button_text=" + String(RTR("Add Clip"))), "set_clip_count", "get_clip_count");
|
||||
for (int i = 0; i < MAX_CLIPS; i++) {
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::STRING_NAME, "clip_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_clip_name", "get_clip_name", i);
|
||||
|
|
@ -494,6 +491,9 @@ void AudioStreamInteractive::_bind_methods() {
|
|||
ADD_PROPERTYI(PropertyInfo(Variant::INT, "clip_" + itos(i) + "/next_clip", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_clip_auto_advance_next_clip", "get_clip_auto_advance_next_clip", i);
|
||||
}
|
||||
|
||||
// Needs to be registered after `clip_*` properties, as it depends on them.
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "initial_clip", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT), "set_initial_clip", "get_initial_clip");
|
||||
|
||||
// TRANSITIONS
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_transition", "from_clip", "to_clip", "from_time", "to_time", "fade_mode", "fade_beats", "use_filler_clip", "filler_clip", "hold_previous"), &AudioStreamInteractive::add_transition, DEFVAL(false), DEFVAL(-1), DEFVAL(false));
|
||||
|
|
@ -592,7 +592,7 @@ void AudioStreamPlaybackInteractive::start(double p_from_pos) {
|
|||
if (current < 0 || current >= stream->clip_count) {
|
||||
return; // No playback possible.
|
||||
}
|
||||
if (!states[current].playback.is_valid()) {
|
||||
if (states[current].playback.is_null()) {
|
||||
return; //no playback possible
|
||||
}
|
||||
active = true;
|
||||
|
|
@ -691,9 +691,14 @@ void AudioStreamPlaybackInteractive::_queue(int p_to_clip_index, bool p_is_auto_
|
|||
src_fade_wait = beat_sec - remainder;
|
||||
} break;
|
||||
case AudioStreamInteractive::TRANSITION_FROM_TIME_NEXT_BAR: {
|
||||
float bar_sec = beat_sec * from_state.stream->get_bar_beats();
|
||||
float remainder = Math::fmod(current_pos, bar_sec);
|
||||
src_fade_wait = bar_sec - remainder;
|
||||
if (from_state.stream->get_bar_beats() > 0) {
|
||||
float bar_sec = beat_sec * from_state.stream->get_bar_beats();
|
||||
float remainder = Math::fmod(current_pos, bar_sec);
|
||||
src_fade_wait = bar_sec - remainder;
|
||||
} else {
|
||||
// Stream does not have a number of beats per bar - avoid NaN, and play immediately.
|
||||
src_fade_wait = 0;
|
||||
}
|
||||
} break;
|
||||
case AudioStreamInteractive::TRANSITION_FROM_TIME_END: {
|
||||
float end = from_state.stream->get_beat_count() > 0 ? float(from_state.stream->get_beat_count() * beat_sec) : from_state.stream->get_length();
|
||||
|
|
@ -777,7 +782,7 @@ void AudioStreamPlaybackInteractive::_queue(int p_to_clip_index, bool p_is_auto_
|
|||
|
||||
if (stream->clips[p_to_clip_index].auto_advance == AudioStreamInteractive::AUTO_ADVANCE_ENABLED) {
|
||||
int next_clip = stream->clips[p_to_clip_index].auto_advance_next_clip;
|
||||
if (next_clip >= 0 && next_clip < (int)stream->clip_count && states[next_clip].playback.is_valid() && next_clip != p_to_clip_index && next_clip != playback_current && (!transition.use_filler_clip || next_clip != transition.filler_clip)) {
|
||||
if (next_clip >= 0 && next_clip < (int)stream->clip_count && states[next_clip].playback.is_valid() && next_clip != p_to_clip_index && (!transition.use_filler_clip || next_clip != transition.filler_clip)) {
|
||||
auto_advance_to = next_clip;
|
||||
}
|
||||
}
|
||||
|
|
@ -905,7 +910,9 @@ void AudioStreamPlaybackInteractive::_mix_internal_state(int p_state_idx, int p_
|
|||
// time to start!
|
||||
from_frame = state.fade_wait * mix_rate;
|
||||
state.fade_wait = 0;
|
||||
queue_next = state.auto_advance;
|
||||
if (state.fade_speed == 0.0) {
|
||||
queue_next = state.auto_advance;
|
||||
}
|
||||
playback_current = p_state_idx;
|
||||
state.first_mix = false;
|
||||
} else {
|
||||
|
|
@ -919,7 +926,6 @@ void AudioStreamPlaybackInteractive::_mix_internal_state(int p_state_idx, int p_
|
|||
state.playback->mix(temp_buffer + from_frame, 1.0, p_frames - from_frame);
|
||||
|
||||
double frame_fade_inc = state.fade_speed * frame_inc;
|
||||
|
||||
for (int i = from_frame; i < p_frames; i++) {
|
||||
if (state.fade_wait) {
|
||||
// This is for fade out of existing stream;
|
||||
|
|
@ -933,6 +939,7 @@ void AudioStreamPlaybackInteractive::_mix_internal_state(int p_state_idx, int p_
|
|||
state.fade_speed = 0.0;
|
||||
frame_fade_inc = 0.0;
|
||||
state.fade_volume = 1.0;
|
||||
queue_next = state.auto_advance;
|
||||
}
|
||||
} else if (frame_fade_inc < 0.0) {
|
||||
state.fade_volume += frame_fade_inc;
|
||||
|
|
@ -1011,6 +1018,10 @@ void AudioStreamPlaybackInteractive::switch_to_clip(int p_index) {
|
|||
switch_request = p_index;
|
||||
}
|
||||
|
||||
int AudioStreamPlaybackInteractive::get_current_clip_index() const {
|
||||
return playback_current;
|
||||
}
|
||||
|
||||
int AudioStreamPlaybackInteractive::get_loop_count() const {
|
||||
return 0; // Looping not supported
|
||||
}
|
||||
|
|
@ -1026,4 +1037,5 @@ bool AudioStreamPlaybackInteractive::is_playing() const {
|
|||
void AudioStreamPlaybackInteractive::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("switch_to_clip_by_name", "clip_name"), &AudioStreamPlaybackInteractive::switch_to_clip_by_name);
|
||||
ClassDB::bind_method(D_METHOD("switch_to_clip", "clip_index"), &AudioStreamPlaybackInteractive::switch_to_clip);
|
||||
ClassDB::bind_method(D_METHOD("get_current_clip_index"), &AudioStreamPlaybackInteractive::get_current_clip_index);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue