From bdb40c647884a6bf0342e2f95b38e6096d8ee622 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 24 Jun 2022 23:37:59 +0200 Subject: Add property hints to MovieWriter settings - Rename audio mix rate setting as the suffix is now part of the property hint. This is also more consistent with existing mix rate project settings. - Improve the MovieWriter class reference. - Tweak warning message about audio possibly going out of sync. --- servers/movie_writer/movie_writer.cpp | 10 ++++++---- servers/movie_writer/movie_writer_mjpeg.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'servers/movie_writer') diff --git a/servers/movie_writer/movie_writer.cpp b/servers/movie_writer/movie_writer.cpp index ac60dc3b9a..8560d92aa2 100644 --- a/servers/movie_writer/movie_writer.cpp +++ b/servers/movie_writer/movie_writer.cpp @@ -107,7 +107,7 @@ void MovieWriter::begin(const Size2i &p_movie_size, uint32_t p_fps, const String AudioDriverDummy::get_dummy_singleton()->set_speaker_mode(AudioDriver::SpeakerMode(get_audio_speaker_mode())); fps = p_fps; if ((mix_rate % fps) != 0) { - WARN_PRINT("Audio mix rate (" + itos(mix_rate) + ") can not be divided by fps (" + itos(fps) + "). Audio may go out of sync over time."); + WARN_PRINT("MovieWriter's audio mix rate (" + itos(mix_rate) + ") can not be divided by the recording FPS (" + itos(fps) + "). Audio may go out of sync over time."); } audio_channels = AudioDriverDummy::get_dummy_singleton()->get_channels(); @@ -128,15 +128,17 @@ void MovieWriter::_bind_methods() { GDVIRTUAL_BIND(_write_frame, "frame_image", "audio_frame_block") GDVIRTUAL_BIND(_write_end) - GLOBAL_DEF("editor/movie_writer/mix_rate_hz", 48000); + GLOBAL_DEF("editor/movie_writer/mix_rate", 48000); + ProjectSettings::get_singleton()->set_custom_property_info("editor/movie_writer/mix_rate", PropertyInfo(Variant::INT, "editor/movie_writer/mix_rate", PROPERTY_HINT_RANGE, "8000,192000,1,suffix:Hz")); GLOBAL_DEF("editor/movie_writer/speaker_mode", 0); ProjectSettings::get_singleton()->set_custom_property_info("editor/movie_writer/speaker_mode", PropertyInfo(Variant::INT, "editor/movie_writer/speaker_mode", PROPERTY_HINT_ENUM, "Stereo,3.1,5.1,7.1")); GLOBAL_DEF("editor/movie_writer/mjpeg_quality", 0.75); + ProjectSettings::get_singleton()->set_custom_property_info("editor/movie_writer/mjpeg_quality", PropertyInfo(Variant::FLOAT, "editor/movie_writer/mjpeg_quality", PROPERTY_HINT_RANGE, "0.01,1.0,0.01")); // used by the editor GLOBAL_DEF_BASIC("editor/movie_writer/movie_file", ""); GLOBAL_DEF_BASIC("editor/movie_writer/disable_vsync", false); GLOBAL_DEF_BASIC("editor/movie_writer/fps", 60); - ProjectSettings::get_singleton()->set_custom_property_info("editor/movie_writer/fps", PropertyInfo(Variant::INT, "editor/movie_writer/fps", PROPERTY_HINT_RANGE, "1,300,1")); + ProjectSettings::get_singleton()->set_custom_property_info("editor/movie_writer/fps", PropertyInfo(Variant::INT, "editor/movie_writer/fps", PROPERTY_HINT_RANGE, "1,300,1,suffix:FPS")); } void MovieWriter::set_extensions_hint() { @@ -301,6 +303,6 @@ void MovieWriterPNGWAV::write_end() { } MovieWriterPNGWAV::MovieWriterPNGWAV() { - mix_rate = GLOBAL_GET("editor/movie_writer/mix_rate_hz"); + mix_rate = GLOBAL_GET("editor/movie_writer/mix_rate"); speaker_mode = AudioServer::SpeakerMode(int(GLOBAL_GET("editor/movie_writer/speaker_mode"))); } diff --git a/servers/movie_writer/movie_writer_mjpeg.cpp b/servers/movie_writer/movie_writer_mjpeg.cpp index b0c65e768d..7d9e6e3b87 100644 --- a/servers/movie_writer/movie_writer_mjpeg.cpp +++ b/servers/movie_writer/movie_writer_mjpeg.cpp @@ -257,7 +257,7 @@ void MovieWriterMJPEG::write_end() { } MovieWriterMJPEG::MovieWriterMJPEG() { - mix_rate = GLOBAL_GET("editor/movie_writer/mix_rate_hz"); + mix_rate = GLOBAL_GET("editor/movie_writer/mix_rate"); speaker_mode = AudioServer::SpeakerMode(int(GLOBAL_GET("editor/movie_writer/speaker_mode"))); quality = GLOBAL_GET("editor/movie_writer/mjpeg_quality"); } -- cgit v1.2.3