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
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
Import("env_modules")
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ private:
|
|||
TransitionFromTime from_time = TRANSITION_FROM_TIME_NEXT_BEAT;
|
||||
TransitionToTime to_time = TRANSITION_TO_TIME_START;
|
||||
FadeMode fade_mode = FADE_AUTOMATIC;
|
||||
int fade_beats = 1;
|
||||
float fade_beats = 1;
|
||||
bool use_filler_clip = false;
|
||||
int filler_clip = 0;
|
||||
bool hold_previous = false;
|
||||
|
|
@ -259,6 +259,7 @@ public:
|
|||
|
||||
void switch_to_clip_by_name(const StringName &p_name);
|
||||
void switch_to_clip(int p_index);
|
||||
int get_current_clip_index() const;
|
||||
|
||||
virtual void set_parameter(const StringName &p_name, const Variant &p_value) override;
|
||||
virtual Variant get_parameter(const StringName &p_name) const override;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "audio_stream_playlist.h"
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
Ref<AudioStreamPlayback> AudioStreamPlaylist::instantiate_playback() {
|
||||
Ref<AudioStreamPlaybackPlaylist> playback_playlist;
|
||||
|
|
@ -311,7 +310,7 @@ int AudioStreamPlaybackPlaylist::mix(AudioFrame *p_buffer, float p_rate_scale, i
|
|||
break;
|
||||
}
|
||||
|
||||
if (!playback[play_order[play_index]].is_valid()) {
|
||||
if (playback[play_order[play_index]].is_null()) {
|
||||
todo = to_mix; // Weird error.
|
||||
active = false;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "audio_stream_synchronized.h"
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
AudioStreamSynchronized::AudioStreamSynchronized() {
|
||||
}
|
||||
|
|
@ -99,6 +98,18 @@ int AudioStreamSynchronized::get_beat_count() const {
|
|||
return max_beats;
|
||||
}
|
||||
|
||||
int AudioStreamSynchronized::get_bar_beats() const {
|
||||
for (int i = 0; i < stream_count; i++) {
|
||||
if (audio_streams[i].is_valid()) {
|
||||
int bar_beats = audio_streams[i]->get_bar_beats();
|
||||
if (bar_beats != 0) {
|
||||
return bar_beats;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AudioStreamSynchronized::has_loop() const {
|
||||
for (int i = 0; i < stream_count; i++) {
|
||||
if (audio_streams[i].is_valid()) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ private:
|
|||
public:
|
||||
virtual double get_bpm() const override;
|
||||
virtual int get_beat_count() const override;
|
||||
virtual int get_bar_beats() const override;
|
||||
virtual bool has_loop() const override;
|
||||
void set_stream_count(int p_count);
|
||||
int get_stream_count() const;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
Audio stream that can playback music interactively, combining clips and a transition table.
|
||||
</brief_description>
|
||||
<description>
|
||||
This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and the transition rules via the [method add_transition]. Additionally, this stream export a property parameter to control the playback via [AudioStreamPlayer], [AudioStreamPlayer2D], or [AudioStreamPlayer3D].
|
||||
This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and then the transition rules via the [method add_transition]. Additionally, this stream exports a property parameter to control the playback via [AudioStreamPlayer], [AudioStreamPlayer2D], or [AudioStreamPlayer3D].
|
||||
The way this is used is by filling a number of clips, then configuring the transition table. From there, clips are selected for playback and the music will smoothly go from the current to the new one while using the corresponding transition rule defined in the transition table.
|
||||
</description>
|
||||
<tutorials>
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
<param index="0" name="from_clip" type="int" />
|
||||
<param index="1" name="to_clip" type="int" />
|
||||
<description>
|
||||
Return true if a given transition exists (was added via [method add_transition]).
|
||||
Returns [code]true[/code] if a given transition exists (was added via [method add_transition]).
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_transition_holding_previous" qualifiers="const">
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="get_current_clip_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Return the index of the currently playing clip. You can use this to get the name of the currently playing clip with [method AudioStreamInteractive.get_clip_name].
|
||||
[b]Example:[/b] Get the currently playing clip name from inside an [AudioStreamPlayer] node.
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
var playing_clip_name = stream.get_clip_name(get_stream_playback().get_current_clip_index())
|
||||
[/gdscript]
|
||||
[/codeblocks]
|
||||
</description>
|
||||
</method>
|
||||
<method name="switch_to_clip">
|
||||
<return type="void" />
|
||||
<param index="0" name="clip_index" type="int" />
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
Stream that can be fitted with sub-streams, which will be played in-sync.
|
||||
</brief_description>
|
||||
<description>
|
||||
This is a stream that can be fitted with sub-streams, which will be played in-sync. The streams being at exactly the same time when play is pressed, and will end when the last of them ends. If one of the sub-streams loops, then playback will continue.
|
||||
This is a stream that can be fitted with sub-streams, which will be played in-sync. The streams begin at exactly the same time when play is pressed, and will end when the last of them ends. If one of the sub-streams loops, then playback will continue.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ void EditorInspectorPluginAudioStreamInteractive::_edit(Object *p_object) {
|
|||
void EditorInspectorPluginAudioStreamInteractive::parse_end(Object *p_object) {
|
||||
if (Object::cast_to<AudioStreamInteractive>(p_object)) {
|
||||
Button *button = EditorInspector::create_inspector_action_button(TTR("Edit Transitions"));
|
||||
button->set_icon(audio_stream_interactive_transition_editor->get_editor_theme_icon(SNAME("Blend")));
|
||||
button->set_button_icon(audio_stream_interactive_transition_editor->get_editor_theme_icon(SNAME("Blend")));
|
||||
button->connect(SceneStringName(pressed), callable_mp(this, &EditorInspectorPluginAudioStreamInteractive::_edit).bind(p_object));
|
||||
add_custom_control(button);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class AudioStreamInteractiveEditorPlugin : public EditorPlugin {
|
|||
GDCLASS(AudioStreamInteractiveEditorPlugin, EditorPlugin);
|
||||
|
||||
public:
|
||||
virtual String get_name() const override { return "AudioStreamInteractive"; }
|
||||
virtual String get_plugin_name() const override { return "AudioStreamInteractive"; }
|
||||
|
||||
AudioStreamInteractiveEditorPlugin();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue