Repository: godotengine/godot (language: cpp)

Issue:
Clip index problem when changing “Initial Clip” value other than 0
### Tested versions

- Reproducible in : v4.3.stable.official [77dcf97d8], v4.4.dev6.official [1f47e4c4e]

### System information

Godot v4.3.stable - Windows 10.0.26100 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 32.0.15.6614) - 11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz (16 Threads)

### Issue description

When trying to change the value of parameter "Initial clip" in an AudioStreamInteractive ressource and launching a scene, an error appear and the clip played is the first clip in the list of clip:
```
"E 0:00:00:0793   set_initial_clip: Index p_clip = 2 is out of bounds (clip_count = 0).
  <C++ Source>   modules/interactive_music/audio_stream_interactive.cpp:89 @ set_initial_clip()
```

### Steps to reproduce

- Open a project
- Create a scene with a root node and an AudioStreamPlayer
- Add an AudioStreamInteractive ressource
- Add clips and stream
- Change the value of “Initial Clip” on any clip except the first in the list
- Launch the scene
- Error appear

### Minimal reproduction project (MRP)

N/A



Discussion / hints:
It seems that when the `AudioStreamInteractive` is initialized it goes through the property `initial_clip` before the actual `clips`. 

When trying to set the value of the initial clip, since no clips have already been initialized the the initial clip is reset to 0.

Changing the order of the properties in the editor corrects the problem. But I'm not sure that's the best way to go.





Fix patch:
diff --git a/modules/interactive_music/audio_stream_interactive.cpp b/modules/interactive_music/audio_stream_interactive.cpp
index 446b7c746757..64288b8fbd23 100644
--- a/modules/interactive_music/audio_stream_interactive.cpp
+++ b/modules/interactive_music/audio_stream_interactive.cpp
@@ -484,8 +484,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 +492,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));


Test patch: