浏览代码

Merge pull request #58682 from akien-mga/3.4-cherrypicks

Rémi Verschelde 3 年之前
父节点
当前提交
4b1ee744c7

+ 5 - 7
core/io/pck_packer.cpp

@@ -154,13 +154,11 @@ Error PCKPacker::flush(bool p_verbose) {
 		src->close();
 		memdelete(src);
 		count += 1;
-		if (p_verbose && files.size() > 0) {
-			if (count % 100 == 0) {
-				printf("%i/%i (%.2f)\r", count, files.size(), float(count) / files.size() * 100);
-				fflush(stdout);
-			};
-		};
-	};
+		const int file_num = files.size();
+		if (p_verbose && (file_num > 0)) {
+			print_line(vformat("[%d/%d - %d%%] PCKPacker flush: %s -> %s", count, file_num, float(count) / file_num * 100, files[i].src_path, files[i].path));
+		}
+	}
 
 	if (p_verbose) {
 		printf("\n");

+ 17 - 28
core/undo_redo.cpp

@@ -33,6 +33,20 @@
 #include "core/os/os.h"
 #include "core/resource.h"
 
+void UndoRedo::Operation::delete_reference() {
+	if (type != Operation::TYPE_REFERENCE) {
+		return;
+	}
+	if (ref.is_valid()) {
+		ref.unref();
+	} else {
+		Object *obj = ObjectDB::get_instance(object);
+		if (obj) {
+			memdelete(obj);
+		}
+	}
+}
+
 void UndoRedo::_discard_redo() {
 	if (current_action == actions.size() - 1) {
 		return;
@@ -40,16 +54,7 @@ void UndoRedo::_discard_redo() {
 
 	for (int i = current_action + 1; i < actions.size(); i++) {
 		for (List<Operation>::Element *E = actions.write[i].do_ops.front(); E; E = E->next()) {
-			if (E->get().type == Operation::TYPE_REFERENCE) {
-				if (E->get().ref.is_valid()) {
-					E->get().ref.unref();
-				} else {
-					Object *obj = ObjectDB::get_instance(E->get().object);
-					if (obj) {
-						memdelete(obj);
-					}
-				}
-			}
+			E->get().delete_reference();
 		}
 		//ERASE do data
 	}
@@ -72,14 +77,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
 				List<Operation>::Element *E = actions.write[current_action + 1].do_ops.front();
 
 				while (E) {
-					if (E->get().type == Operation::TYPE_REFERENCE) {
-						Object *obj = ObjectDB::get_instance(E->get().object);
-
-						if (obj) {
-							memdelete(obj);
-						}
-					}
-
+					E->get().delete_reference();
 					E = E->next();
 					actions.write[current_action + 1].do_ops.pop_front();
 				}
@@ -224,16 +222,7 @@ void UndoRedo::_pop_history_tail() {
 	}
 
 	for (List<Operation>::Element *E = actions.write[0].undo_ops.front(); E; E = E->next()) {
-		if (E->get().type == Operation::TYPE_REFERENCE) {
-			if (E->get().ref.is_valid()) {
-				E->get().ref.unref();
-			} else {
-				Object *obj = ObjectDB::get_instance(E->get().object);
-				if (obj) {
-					memdelete(obj);
-				}
-			}
-		}
+		E->get().delete_reference();
 	}
 
 	actions.remove(0);

+ 2 - 0
core/undo_redo.h

@@ -64,6 +64,8 @@ private:
 		ObjectID object;
 		String name;
 		Variant args[VARIANT_ARG_MAX];
+
+		void delete_reference();
 	};
 
 	struct Action {

+ 33 - 5
doc/classes/String.xml

@@ -188,7 +188,10 @@
 		<method name="bigrams">
 			<return type="PoolStringArray" />
 			<description>
-				Returns the bigrams (pairs of consecutive letters) of this string.
+				Returns an array containing the bigrams (pairs of consecutive letters) of this string.
+				[codeblock]
+				print("Bigrams".bigrams()) # Prints "[Bi, ig, gr, ra, am, ms]"
+				[/codeblock]
 			</description>
 		</method>
 		<method name="c_escape">
@@ -434,7 +437,14 @@
 		<method name="is_valid_float">
 			<return type="bool" />
 			<description>
-				Returns [code]true[/code] if this string contains a valid float.
+				Returns [code]true[/code] if this string contains a valid float. This is inclusive of integers, and also supports exponents:
+				[codeblock]
+				print("1.7".is_valid_float()) # Prints "true"
+				print("24".is_valid_float()) # Prints "true"
+				print("7e3".is_valid_float()) # Prints "true"
+				print("24".is_valid_float()) # Prints "true"
+				print("Hello".is_valid_float()) # Prints "false"
+				[/codeblock]
 			</description>
 		</method>
 		<method name="is_valid_hex_number">
@@ -454,12 +464,24 @@
 			<return type="bool" />
 			<description>
 				Returns [code]true[/code] if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores ([code]_[/code]) and the first character may not be a digit.
+				[codeblock]
+				print("good_ident_1".is_valid_identifier()) # Prints "true"
+				print("1st_bad_ident".is_valid_identifier()) # Prints "false"
+				print("bad_ident_#2".is_valid_identifier()) # Prints "false"
+				[/codeblock]
 			</description>
 		</method>
 		<method name="is_valid_integer">
 			<return type="bool" />
 			<description>
 				Returns [code]true[/code] if this string contains a valid integer.
+				[codeblock]
+				print("7".is_valid_int()) # Prints "true"
+				print("14.6".is_valid_int()) # Prints "false"
+				print("L".is_valid_int()) # Prints "false"
+				print("+3".is_valid_int()) # Prints "true"
+				print("-12".is_valid_int()) # Prints "true"
+				[/codeblock]
 			</description>
 		</method>
 		<method name="is_valid_ip_address">
@@ -499,14 +521,14 @@
 			<return type="bool" />
 			<argument index="0" name="expr" type="String" />
 			<description>
-				Does a simple case-sensitive expression match, where [code]"*"[/code] matches zero or more arbitrary characters and [code]"?"[/code] matches any single character except a period ([code]"."[/code]).
+				Does a simple case-sensitive expression match, where [code]"*"[/code] matches zero or more arbitrary characters and [code]"?"[/code] matches any single character except a period ([code]"."[/code]). An empty string or empty expression always evaluates to [code]false[/code].
 			</description>
 		</method>
 		<method name="matchn">
 			<return type="bool" />
 			<argument index="0" name="expr" type="String" />
 			<description>
-				Does a simple case-insensitive expression match, where [code]"*"[/code] matches zero or more arbitrary characters and [code]"?"[/code] matches any single character except a period ([code]"."[/code]).
+				Does a simple case-insensitive expression match, where [code]"*"[/code] matches zero or more arbitrary characters and [code]"?"[/code] matches any single character except a period ([code]"."[/code]). An empty string or empty expression always evaluates to [code]false[/code].
 			</description>
 		</method>
 		<method name="md5_buffer">
@@ -683,7 +705,13 @@
 			<return type="float" />
 			<argument index="0" name="text" type="String" />
 			<description>
-				Returns the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
+				Returns the similarity index ([url=https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient]Sorensen-Dice coefficient[/url]) this string compared to another. 1.0 means totally similar and 0.0 means totally dissimilar.
+				[codeblock]
+				print("ABC123".similarity("ABC123")) # Prints "1"
+				print("ABC123".similarity("XYZ456")) # Prints "0"
+				print("ABC123".similarity("123ABC")) # Prints "0.8"
+				print("ABC123".similarity("abc123")) # Prints "0.4"
+				[/codeblock]
 			</description>
 		</method>
 		<method name="simplify_path">

+ 2 - 2
misc/dist/osx_tools.app/Contents/Info.plist

@@ -19,11 +19,11 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>3.4.3</string>
+	<string>3.4.4</string>
 	<key>CFBundleSignature</key>
 	<string>godot</string>
 	<key>CFBundleVersion</key>
-	<string>3.4.3</string>
+	<string>3.4.4</string>
 	<key>NSMicrophoneUsageDescription</key>
 	<string>Microphone access is required to capture audio.</string>
 	<key>NSCameraUsageDescription</key>

+ 1 - 1
misc/dist/windows/godot.iss

@@ -1,5 +1,5 @@
 #define MyAppName "Godot Engine"
-#define MyAppVersion "3.4.3"
+#define MyAppVersion "3.4.4"
 #define MyAppPublisher "Godot Engine contributors"
 #define MyAppURL "https://godotengine.org/"
 #define MyAppExeName "godot.exe"

+ 1 - 3
platform/android/export/export_plugin.cpp

@@ -2204,9 +2204,7 @@ bool EditorExportPlatformAndroid::can_export(const Ref<EditorExportPreset> &p_pr
 		bool godot_google_play_billing_enabled = p_preset->get("plugins/GodotGooglePlayBilling");
 		if (!godot_google_play_billing_enabled) {
 			valid = false;
-			err += TTR("Invalid \"GodotPaymentV3\" module included in the \"android/modules\" project setting (changed in Godot 3.2.2).\n"
-					   "Replace it with the first-party \"GodotGooglePlayBilling\" plugin.\n"
-					   "Note that the singleton was also renamed from \"GodotPayments\" to \"GodotGooglePlayBilling\".");
+			err += TTR("Invalid \"GodotPaymentV3\" module included in the \"android/modules\" project setting (changed in Godot 3.2.2).\nReplace it with the first-party \"GodotGooglePlayBilling\" plugin.\nNote that the singleton was also renamed from \"GodotPayments\" to \"GodotGooglePlayBilling\".");
 			err += "\n";
 		}
 	}

+ 2 - 0
platform/iphone/godot_view.mm

@@ -145,6 +145,8 @@ static const int max_touches = 8;
 
 	[self initTouches];
 
+	self.multipleTouchEnabled = YES;
+
 	// Configure and start accelerometer
 	if (!self.motionManager) {
 		self.motionManager = [[CMMotionManager alloc] init];

+ 8 - 3
scene/2d/joints_2d.cpp

@@ -168,14 +168,17 @@ NodePath Joint2D::get_node_b() const {
 
 void Joint2D::_notification(int p_what) {
 	switch (p_what) {
-		case NOTIFICATION_READY: {
+		case NOTIFICATION_POST_ENTER_TREE: {
+			if (joint.is_valid()) {
+				_disconnect_signals();
+			}
 			_update_joint();
 		} break;
 		case NOTIFICATION_EXIT_TREE: {
 			if (joint.is_valid()) {
 				_disconnect_signals();
-				_update_joint(true);
 			}
+			_update_joint(true);
 		} break;
 	}
 }
@@ -195,7 +198,9 @@ void Joint2D::set_exclude_nodes_from_collision(bool p_enable) {
 	if (exclude_from_collision == p_enable) {
 		return;
 	}
-
+	if (joint.is_valid()) {
+		_disconnect_signals();
+	}
 	_update_joint(true);
 	exclude_from_collision = p_enable;
 	_update_joint();

+ 9 - 2
scene/3d/physics_joint.cpp

@@ -178,14 +178,17 @@ int Joint::get_solver_priority() const {
 
 void Joint::_notification(int p_what) {
 	switch (p_what) {
-		case NOTIFICATION_READY: {
+		case NOTIFICATION_POST_ENTER_TREE: {
+			if (joint.is_valid()) {
+				_disconnect_signals();
+			}
 			_update_joint();
 		} break;
 		case NOTIFICATION_EXIT_TREE: {
 			if (joint.is_valid()) {
 				_disconnect_signals();
-				_update_joint(true);
 			}
+			_update_joint(true);
 		} break;
 	}
 }
@@ -194,6 +197,10 @@ void Joint::set_exclude_nodes_from_collision(bool p_enable) {
 	if (exclude_from_collision == p_enable) {
 		return;
 	}
+	if (joint.is_valid()) {
+		_disconnect_signals();
+	}
+	_update_joint(true);
 	exclude_from_collision = p_enable;
 	_update_joint();
 }

+ 2 - 1
scene/3d/room_manager.cpp

@@ -2040,9 +2040,10 @@ void RoomManager::_flip_portals_recursive(Spatial *p_node) {
 }
 
 void RoomManager::_set_owner_recursive(Node *p_node, Node *p_owner) {
-	if (p_node != p_owner) {
+	if (!p_node->get_owner() && (p_node != p_owner)) {
 		p_node->set_owner(p_owner);
 	}
+
 	for (int n = 0; n < p_node->get_child_count(); n++) {
 		_set_owner_recursive(p_node->get_child(n), p_owner);
 	}

+ 35 - 61
servers/audio/effects/audio_effect_pitch_shift.cpp

@@ -74,7 +74,7 @@
 *
 *****************************************************************************/
 
-void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int64_t fftFrameSize, int64_t osamp, float sampleRate, float *indata, float *outdata,int stride) {
+void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long fftFrameSize, long osamp, float sampleRate, float *indata, float *outdata,int stride) {
 
 
 	/*
@@ -85,32 +85,19 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 	*/
 
 	double magn, phase, tmp, window, real, imag;
-	double freqPerBin, expct, reciprocalFftFrameSize;
-	int64_t i,k, qpd, index, inFifoLatency, stepSize, fftFrameSize2;
+	double freqPerBin, expct;
+	long i,k, qpd, index, inFifoLatency, stepSize, fftFrameSize2;
 
 	/* set up some handy variables */
 	fftFrameSize2 = fftFrameSize/2;
-	reciprocalFftFrameSize = 1./fftFrameSize;
 	stepSize = fftFrameSize/osamp;
-	freqPerBin = reciprocalFftFrameSize * sampleRate;
-	expct = Math_TAU * reciprocalFftFrameSize * stepSize;
+	freqPerBin = sampleRate/(double)fftFrameSize;
+	expct = 2.*Math_PI*(double)stepSize/(double)fftFrameSize;
 	inFifoLatency = fftFrameSize-stepSize;
-	if (gRover == 0) {
-		gRover = inFifoLatency;
-	}
+	if (gRover == 0) { gRover = inFifoLatency;
+}
 
-	// If pitchShift changes clear arrays to prevent some artifacts and quality loss.
-	if (lastPitchShift != pitchShift) {
-		lastPitchShift = pitchShift;
-		memset(gInFIFO, 0, MAX_FRAME_LENGTH * sizeof(float));
-		memset(gOutFIFO, 0, MAX_FRAME_LENGTH * sizeof(float));
-		memset(gFFTworksp, 0, 2 * MAX_FRAME_LENGTH * sizeof(double));
-		memset(gLastPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(double));
-		memset(gSumPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(double));
-		memset(gOutputAccum, 0, 2 * MAX_FRAME_LENGTH * sizeof(double));
-		memset(gAnaFreq, 0, MAX_FRAME_LENGTH * sizeof(double));
-		memset(gAnaMagn, 0, MAX_FRAME_LENGTH * sizeof(double));
-	}
+	/* initialize our static arrays */
 
 	/* main processing loop */
 	for (i = 0; i < numSampsToProcess; i++){
@@ -126,7 +113,7 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 
 			/* do windowing and re,im interleave */
 			for (k = 0; k < fftFrameSize;k++) {
-				window = -.5*cos(Math_TAU * reciprocalFftFrameSize * k)+.5;
+				window = -.5*cos(2.*Math_PI*(double)k/(double)fftFrameSize)+.5;
 				gFFTworksp[2*k] = gInFIFO[k] * window;
 				gFFTworksp[2*k+1] = 0.;
 			}
@@ -138,7 +125,6 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 
 			/* this is the analysis step */
 			for (k = 0; k <= fftFrameSize2; k++) {
-
 				/* de-interlace FFT buffer */
 				real = gFFTworksp[2*k];
 				imag = gFFTworksp[2*k+1];
@@ -156,15 +142,13 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 
 				/* map delta phase into +/- Pi interval */
 				qpd = tmp/Math_PI;
-				if (qpd >= 0) {
-					qpd += qpd&1;
-				} else {
-					qpd -= qpd&1;
-				}
+				if (qpd >= 0) { qpd += qpd&1;
+				} else { qpd -= qpd&1;
+}
 				tmp -= Math_PI*(double)qpd;
 
 				/* get deviation from bin frequency from the +/- Pi interval */
-				tmp = osamp*tmp/Math_TAU;
+				tmp = osamp*tmp/(2.*Math_PI);
 
 				/* compute the k-th partials' true frequency */
 				tmp = (double)k*freqPerBin + tmp*freqPerBin;
@@ -177,8 +161,8 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 
 			/* ***************** PROCESSING ******************* */
 			/* this does the actual pitch shifting */
-			memset(gSynMagn, 0, fftFrameSize*sizeof(double));
-			memset(gSynFreq, 0, fftFrameSize*sizeof(double));
+			memset(gSynMagn, 0, fftFrameSize*sizeof(float));
+			memset(gSynFreq, 0, fftFrameSize*sizeof(float));
 			for (k = 0; k <= fftFrameSize2; k++) {
 				index = k*pitchShift;
 				if (index <= fftFrameSize2) {
@@ -202,7 +186,7 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 				tmp /= freqPerBin;
 
 				/* take osamp into account */
-				tmp = Math_TAU*tmp/osamp;
+				tmp = 2.*Math_PI*tmp/osamp;
 
 				/* add the overlap phase advance back in */
 				tmp += (double)k*expct;
@@ -217,35 +201,33 @@ void SMBPitchShift::PitchShift(float pitchShift, int64_t numSampsToProcess, int6
 			}
 
 			/* zero negative frequencies */
-			for (k = fftFrameSize+2; k < 2*MAX_FRAME_LENGTH; k++) {
-				gFFTworksp[k] = 0.;
-			}
+			for (k = fftFrameSize+2; k < 2*fftFrameSize; k++) { gFFTworksp[k] = 0.;
+}
 
 			/* do inverse transform */
 			smbFft(gFFTworksp, fftFrameSize, 1);
 
 			/* do windowing and add to output accumulator */
 			for(k=0; k < fftFrameSize; k++) {
-				window = -.5*cos(Math_TAU * reciprocalFftFrameSize * k)+.5;
+				window = -.5*cos(2.*Math_PI*(double)k/(double)fftFrameSize)+.5;
 				gOutputAccum[k] += 2.*window*gFFTworksp[2*k]/(fftFrameSize2*osamp);
 			}
-			for (k = 0; k < stepSize; k++) {
-				gOutFIFO[k] = gOutputAccum[k];
-			}
+			for (k = 0; k < stepSize; k++) { gOutFIFO[k] = gOutputAccum[k];
+}
 
 			/* shift accumulator */
-			memmove(gOutputAccum, gOutputAccum+stepSize, fftFrameSize*sizeof(double));
+			memmove(gOutputAccum, gOutputAccum+stepSize, fftFrameSize*sizeof(float));
 
 			/* move input FIFO */
-			for (k = 0; k < inFifoLatency; k++) {
-				gInFIFO[k] = gInFIFO[k+stepSize];
-			}
+			for (k = 0; k < inFifoLatency; k++) { gInFIFO[k] = gInFIFO[k+stepSize];
+}
 		}
 	}
 }
 
 
-void SMBPitchShift::smbFft(double *fftBuffer, int64_t fftFrameSize, int64_t sign)
+
+void SMBPitchShift::smbFft(float *fftBuffer, long fftFrameSize, long sign)
 /*
 	FFT routine, (C)1996 S.M.Bernsee. Sign = -1 is FFT, 1 is iFFT (inverse)
 	Fills fftBuffer[0...2*fftFrameSize-1] with the Fourier transform of the
@@ -258,16 +240,14 @@ void SMBPitchShift::smbFft(double *fftBuffer, int64_t fftFrameSize, int64_t sign
 	of the frequencies of interest is in fftBuffer[0...fftFrameSize].
 */
 {
-	double wr, wi, arg, *p1, *p2, temp;
-	double tr, ti, ur, ui, *p1r, *p1i, *p2r, *p2i;
-	int64_t i, bitm, j, le, le2, k, logN;
-	logN = (int64_t)(log(fftFrameSize) / log(2.) + .5);
+	float wr, wi, arg, *p1, *p2, temp;
+	float tr, ti, ur, ui, *p1r, *p1i, *p2r, *p2i;
+	long i, bitm, j, le, le2, k;
 
 	for (i = 2; i < 2*fftFrameSize-2; i += 2) {
 		for (bitm = 2, j = 0; bitm < 2*fftFrameSize; bitm <<= 1) {
-			if (i & bitm) {
-				j++;
-			}
+			if (i & bitm) { j++;
+}
 			j <<= 1;
 		}
 		if (i < j) {
@@ -277,8 +257,7 @@ void SMBPitchShift::smbFft(double *fftBuffer, int64_t fftFrameSize, int64_t sign
 			*p1 = *p2; *p2 = temp;
 		}
 	}
-
-	for (k = 0, le = 2; k < logN; k++) {
+	for (k = 0, le = 2; k < (long)(log((double)fftFrameSize)/log(2.)+.5); k++) {
 		le <<= 1;
 		le2 = le>>1;
 		ur = 1.0;
@@ -310,14 +289,6 @@ void SMBPitchShift::smbFft(double *fftBuffer, int64_t fftFrameSize, int64_t sign
 void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
 	float sample_rate = AudioServer::get_singleton()->get_mix_rate();
 
-	// For pitch_scale 1.0 it's cheaper to just pass samples without processing them.
-	if (Math::is_equal_approx(base->pitch_scale, 1.0f)) {
-		for (int i = 0; i < p_frame_count; i++) {
-			p_dst_frames[i] = p_src_frames[i];
-		}
-		return;
-	}
-
 	float *in_l = (float *)p_src_frames;
 	float *in_r = in_l + 1;
 
@@ -391,4 +362,7 @@ AudioEffectPitchShift::AudioEffectPitchShift() {
 	pitch_scale = 1.0;
 	oversampling = 4;
 	fft_size = FFT_SIZE_2048;
+	wet = 0.0;
+	dry = 0.0;
+	filter = false;
 }

+ 21 - 20
servers/audio/effects/audio_effect_pitch_shift.h

@@ -40,33 +40,31 @@ class SMBPitchShift {
 
 	float gInFIFO[MAX_FRAME_LENGTH];
 	float gOutFIFO[MAX_FRAME_LENGTH];
-	double gFFTworksp[2 * MAX_FRAME_LENGTH];
-	double gLastPhase[MAX_FRAME_LENGTH / 2 + 1];
-	double gSumPhase[MAX_FRAME_LENGTH / 2 + 1];
-	double gOutputAccum[2 * MAX_FRAME_LENGTH];
-	double gAnaFreq[MAX_FRAME_LENGTH];
-	double gAnaMagn[MAX_FRAME_LENGTH];
-	double gSynFreq[MAX_FRAME_LENGTH];
-	double gSynMagn[MAX_FRAME_LENGTH];
-	int64_t gRover;
-	float lastPitchShift;
-
-	void smbFft(double *fftBuffer, int64_t fftFrameSize, int64_t sign);
+	float gFFTworksp[2 * MAX_FRAME_LENGTH];
+	float gLastPhase[MAX_FRAME_LENGTH / 2 + 1];
+	float gSumPhase[MAX_FRAME_LENGTH / 2 + 1];
+	float gOutputAccum[2 * MAX_FRAME_LENGTH];
+	float gAnaFreq[MAX_FRAME_LENGTH];
+	float gAnaMagn[MAX_FRAME_LENGTH];
+	float gSynFreq[MAX_FRAME_LENGTH];
+	float gSynMagn[MAX_FRAME_LENGTH];
+	long gRover;
+
+	void smbFft(float *fftBuffer, long fftFrameSize, long sign);
 
 public:
-	void PitchShift(float pitchShift, int64_t numSampsToProcess, int64_t fftFrameSize, int64_t osamp, float sampleRate, float *indata, float *outdata, int stride);
+	void PitchShift(float pitchShift, long numSampsToProcess, long fftFrameSize, long osamp, float sampleRate, float *indata, float *outdata, int stride);
 
 	SMBPitchShift() {
 		gRover = 0;
 		memset(gInFIFO, 0, MAX_FRAME_LENGTH * sizeof(float));
 		memset(gOutFIFO, 0, MAX_FRAME_LENGTH * sizeof(float));
-		memset(gFFTworksp, 0, 2 * MAX_FRAME_LENGTH * sizeof(double));
-		memset(gLastPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(double));
-		memset(gSumPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(double));
-		memset(gOutputAccum, 0, 2 * MAX_FRAME_LENGTH * sizeof(double));
-		memset(gAnaFreq, 0, MAX_FRAME_LENGTH * sizeof(double));
-		memset(gAnaMagn, 0, MAX_FRAME_LENGTH * sizeof(double));
-		lastPitchShift = 1.0;
+		memset(gFFTworksp, 0, 2 * MAX_FRAME_LENGTH * sizeof(float));
+		memset(gLastPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(float));
+		memset(gSumPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(float));
+		memset(gOutputAccum, 0, 2 * MAX_FRAME_LENGTH * sizeof(float));
+		memset(gAnaFreq, 0, MAX_FRAME_LENGTH * sizeof(float));
+		memset(gAnaMagn, 0, MAX_FRAME_LENGTH * sizeof(float));
 	}
 };
 
@@ -103,6 +101,9 @@ public:
 	float pitch_scale;
 	int oversampling;
 	FFT_Size fft_size;
+	float wet;
+	float dry;
+	bool filter;
 
 protected:
 	static void _bind_methods();

+ 52 - 54
servers/physics/area_sw.cpp

@@ -199,76 +199,74 @@ void AreaSW::set_monitorable(bool p_monitorable) {
 
 void AreaSW::call_queries() {
 	if (monitor_callback_id && !monitored_bodies.empty()) {
-		Variant res[5];
-		Variant *resptr[5];
-		for (int i = 0; i < 5; i++) {
-			resptr[i] = &res[i];
-		}
-
 		Object *obj = ObjectDB::get_instance(monitor_callback_id);
-		if (!obj) {
-			monitored_bodies.clear();
-			monitor_callback_id = 0;
-			return;
-		}
+		if (obj) {
+			Variant res[5];
+			Variant *resptr[5];
+			for (int i = 0; i < 5; i++) {
+				resptr[i] = &res[i];
+			}
+
+			for (Map<BodyKey, BodyState>::Element *E = monitored_bodies.front(); E;) {
+				if (E->get().state == 0) { // Nothing happened
+					Map<BodyKey, BodyState>::Element *next = E->next();
+					monitored_bodies.erase(E);
+					E = next;
+					continue;
+				}
+
+				res[0] = E->get().state > 0 ? PhysicsServer::AREA_BODY_ADDED : PhysicsServer::AREA_BODY_REMOVED;
+				res[1] = E->key().rid;
+				res[2] = E->key().instance_id;
+				res[3] = E->key().body_shape;
+				res[4] = E->key().area_shape;
 
-		for (Map<BodyKey, BodyState>::Element *E = monitored_bodies.front(); E;) {
-			if (E->get().state == 0) { // Nothing happened
 				Map<BodyKey, BodyState>::Element *next = E->next();
 				monitored_bodies.erase(E);
 				E = next;
-				continue;
-			}
-
-			res[0] = E->get().state > 0 ? PhysicsServer::AREA_BODY_ADDED : PhysicsServer::AREA_BODY_REMOVED;
-			res[1] = E->key().rid;
-			res[2] = E->key().instance_id;
-			res[3] = E->key().body_shape;
-			res[4] = E->key().area_shape;
-
-			Map<BodyKey, BodyState>::Element *next = E->next();
-			monitored_bodies.erase(E);
-			E = next;
 
-			Variant::CallError ce;
-			obj->call(monitor_callback_method, (const Variant **)resptr, 5, ce);
+				Variant::CallError ce;
+				obj->call(monitor_callback_method, (const Variant **)resptr, 5, ce);
+			}
+		} else {
+			monitored_bodies.clear();
+			monitor_callback_id = 0;
 		}
 	}
 
 	if (area_monitor_callback_id && !monitored_areas.empty()) {
-		Variant res[5];
-		Variant *resptr[5];
-		for (int i = 0; i < 5; i++) {
-			resptr[i] = &res[i];
-		}
-
 		Object *obj = ObjectDB::get_instance(area_monitor_callback_id);
-		if (!obj) {
-			monitored_areas.clear();
-			area_monitor_callback_id = 0;
-			return;
-		}
+		if (obj) {
+			Variant res[5];
+			Variant *resptr[5];
+			for (int i = 0; i < 5; i++) {
+				resptr[i] = &res[i];
+			}
+
+			for (Map<BodyKey, BodyState>::Element *E = monitored_areas.front(); E;) {
+				if (E->get().state == 0) { // Nothing happened
+					Map<BodyKey, BodyState>::Element *next = E->next();
+					monitored_areas.erase(E);
+					E = next;
+					continue;
+				}
+
+				res[0] = E->get().state > 0 ? PhysicsServer::AREA_BODY_ADDED : PhysicsServer::AREA_BODY_REMOVED;
+				res[1] = E->key().rid;
+				res[2] = E->key().instance_id;
+				res[3] = E->key().body_shape;
+				res[4] = E->key().area_shape;
 
-		for (Map<BodyKey, BodyState>::Element *E = monitored_areas.front(); E;) {
-			if (E->get().state == 0) { // Nothing happened
 				Map<BodyKey, BodyState>::Element *next = E->next();
 				monitored_areas.erase(E);
 				E = next;
-				continue;
-			}
-
-			res[0] = E->get().state > 0 ? PhysicsServer::AREA_BODY_ADDED : PhysicsServer::AREA_BODY_REMOVED;
-			res[1] = E->key().rid;
-			res[2] = E->key().instance_id;
-			res[3] = E->key().body_shape;
-			res[4] = E->key().area_shape;
-
-			Map<BodyKey, BodyState>::Element *next = E->next();
-			monitored_areas.erase(E);
-			E = next;
 
-			Variant::CallError ce;
-			obj->call(area_monitor_callback_method, (const Variant **)resptr, 5, ce);
+				Variant::CallError ce;
+				obj->call(area_monitor_callback_method, (const Variant **)resptr, 5, ce);
+			}
+		} else {
+			monitored_areas.clear();
+			area_monitor_callback_id = 0;
 		}
 	}
 }

+ 52 - 54
servers/physics_2d/area_2d_sw.cpp

@@ -199,76 +199,74 @@ void Area2DSW::set_monitorable(bool p_monitorable) {
 
 void Area2DSW::call_queries() {
 	if (monitor_callback_id && !monitored_bodies.empty()) {
-		Variant res[5];
-		Variant *resptr[5];
-		for (int i = 0; i < 5; i++) {
-			resptr[i] = &res[i];
-		}
-
 		Object *obj = ObjectDB::get_instance(monitor_callback_id);
-		if (!obj) {
-			monitored_bodies.clear();
-			monitor_callback_id = 0;
-			return;
-		}
+		if (obj) {
+			Variant res[5];
+			Variant *resptr[5];
+			for (int i = 0; i < 5; i++) {
+				resptr[i] = &res[i];
+			}
+
+			for (Map<BodyKey, BodyState>::Element *E = monitored_bodies.front(); E;) {
+				if (E->get().state == 0) { // Nothing happened
+					Map<BodyKey, BodyState>::Element *next = E->next();
+					monitored_bodies.erase(E);
+					E = next;
+					continue;
+				}
+
+				res[0] = E->get().state > 0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
+				res[1] = E->key().rid;
+				res[2] = E->key().instance_id;
+				res[3] = E->key().body_shape;
+				res[4] = E->key().area_shape;
 
-		for (Map<BodyKey, BodyState>::Element *E = monitored_bodies.front(); E;) {
-			if (E->get().state == 0) { // Nothing happened
 				Map<BodyKey, BodyState>::Element *next = E->next();
 				monitored_bodies.erase(E);
 				E = next;
-				continue;
-			}
-
-			res[0] = E->get().state > 0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
-			res[1] = E->key().rid;
-			res[2] = E->key().instance_id;
-			res[3] = E->key().body_shape;
-			res[4] = E->key().area_shape;
-
-			Map<BodyKey, BodyState>::Element *next = E->next();
-			monitored_bodies.erase(E);
-			E = next;
 
-			Variant::CallError ce;
-			obj->call(monitor_callback_method, (const Variant **)resptr, 5, ce);
+				Variant::CallError ce;
+				obj->call(monitor_callback_method, (const Variant **)resptr, 5, ce);
+			}
+		} else {
+			monitored_bodies.clear();
+			monitor_callback_id = 0;
 		}
 	}
 
 	if (area_monitor_callback_id && !monitored_areas.empty()) {
-		Variant res[5];
-		Variant *resptr[5];
-		for (int i = 0; i < 5; i++) {
-			resptr[i] = &res[i];
-		}
-
 		Object *obj = ObjectDB::get_instance(area_monitor_callback_id);
-		if (!obj) {
-			monitored_areas.clear();
-			area_monitor_callback_id = 0;
-			return;
-		}
+		if (obj) {
+			Variant res[5];
+			Variant *resptr[5];
+			for (int i = 0; i < 5; i++) {
+				resptr[i] = &res[i];
+			}
+
+			for (Map<BodyKey, BodyState>::Element *E = monitored_areas.front(); E;) {
+				if (E->get().state == 0) { // Nothing happened
+					Map<BodyKey, BodyState>::Element *next = E->next();
+					monitored_areas.erase(E);
+					E = next;
+					continue;
+				}
+
+				res[0] = E->get().state > 0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
+				res[1] = E->key().rid;
+				res[2] = E->key().instance_id;
+				res[3] = E->key().body_shape;
+				res[4] = E->key().area_shape;
 
-		for (Map<BodyKey, BodyState>::Element *E = monitored_areas.front(); E;) {
-			if (E->get().state == 0) { // Nothing happened
 				Map<BodyKey, BodyState>::Element *next = E->next();
 				monitored_areas.erase(E);
 				E = next;
-				continue;
-			}
-
-			res[0] = E->get().state > 0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
-			res[1] = E->key().rid;
-			res[2] = E->key().instance_id;
-			res[3] = E->key().body_shape;
-			res[4] = E->key().area_shape;
-
-			Map<BodyKey, BodyState>::Element *next = E->next();
-			monitored_areas.erase(E);
-			E = next;
 
-			Variant::CallError ce;
-			obj->call(area_monitor_callback_method, (const Variant **)resptr, 5, ce);
+				Variant::CallError ce;
+				obj->call(area_monitor_callback_method, (const Variant **)resptr, 5, ce);
+			}
+		} else {
+			monitored_areas.clear();
+			area_monitor_callback_id = 0;
 		}
 	}
 }

+ 2 - 2
version.py

@@ -2,8 +2,8 @@ short_name = "godot"
 name = "Godot Engine"
 major = 3
 minor = 4
-patch = 3
-status = "stable"
+patch = 4
+status = "rc"
 module_config = ""
 year = 2022
 website = "https://godotengine.org"