summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/SCsub2
-rw-r--r--servers/audio/audio_driver_dummy.cpp4
-rw-r--r--servers/audio/audio_effect.h4
-rw-r--r--servers/audio/audio_filter_sw.h2
-rw-r--r--servers/audio/audio_rb_resampler.cpp25
-rw-r--r--servers/audio/audio_rb_resampler.h4
-rw-r--r--servers/audio/audio_stream.cpp124
-rw-r--r--servers/audio/audio_stream.h59
-rw-r--r--servers/audio/effects/SCsub2
-rw-r--r--servers/audio/effects/audio_effect_chorus.cpp2
-rw-r--r--servers/audio/effects/audio_effect_delay.cpp2
-rw-r--r--servers/audio/effects/audio_effect_distortion.cpp2
-rw-r--r--servers/audio/effects/audio_effect_filter.h13
-rw-r--r--servers/audio/effects/audio_effect_phaser.cpp2
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp8
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.h2
-rw-r--r--servers/audio/effects/audio_effect_record.cpp4
-rw-r--r--servers/audio/effects/audio_effect_record.h13
-rw-r--r--servers/audio/effects/eq.cpp4
-rw-r--r--servers/audio/effects/eq.h4
-rw-r--r--servers/audio/effects/reverb.cpp26
-rw-r--r--servers/audio/effects/reverb.h6
-rw-r--r--servers/audio/reverb_sw.cpp24
-rw-r--r--servers/audio/reverb_sw.h6
-rw-r--r--servers/audio/voice_rb_sw.h2
25 files changed, 255 insertions, 91 deletions
diff --git a/servers/audio/SCsub b/servers/audio/SCsub
index afaffcfe93..3c18c18043 100644
--- a/servers/audio/SCsub
+++ b/servers/audio/SCsub
@@ -4,6 +4,4 @@ Import('env')
env.add_source_files(env.servers_sources, "*.cpp")
-Export('env')
-
SConscript("effects/SCsub")
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index be36c3b748..512ff5da7b 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -30,8 +30,8 @@
#include "audio_driver_dummy.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
Error AudioDriverDummy::init() {
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h
index b950e824c0..bbabedbc30 100644
--- a/servers/audio/audio_effect.h
+++ b/servers/audio/audio_effect.h
@@ -31,8 +31,8 @@
#ifndef AUDIOEFFECT_H
#define AUDIOEFFECT_H
-#include "audio_frame.h"
-#include "resource.h"
+#include "core/math/audio_frame.h"
+#include "core/resource.h"
class AudioEffectInstance : public Reference {
GDCLASS(AudioEffectInstance, Reference)
diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h
index 4174f9bd51..d137ed8ff9 100644
--- a/servers/audio/audio_filter_sw.h
+++ b/servers/audio/audio_filter_sw.h
@@ -31,7 +31,7 @@
#ifndef AUDIO_FILTER_SW_H
#define AUDIO_FILTER_SW_H
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
class AudioFilterSW {
public:
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 3414351681..d9b3579812 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -30,7 +30,7 @@
#include "audio_rb_resampler.h"
#include "core/math/math_funcs.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "servers/audio_server.h"
int AudioRBResampler::get_channel_count() const {
@@ -79,42 +79,27 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i
p_dest[i] = AudioFrame(v0, v1);
}
- // For now, channels higher than stereo are almost ignored
+ // This will probably never be used, but added anyway
if (C == 4) {
float v0 = rb[(pos << 2) + 0];
float v1 = rb[(pos << 2) + 1];
- float v2 = rb[(pos << 2) + 2];
- float v3 = rb[(pos << 2) + 3];
float v0n = rb[(pos_next << 2) + 0];
float v1n = rb[(pos_next << 2) + 1];
- float v2n = rb[(pos_next << 2) + 2];
- float v3n = rb[(pos_next << 2) + 3];
-
v0 += (v0n - v0) * frac;
v1 += (v1n - v1) * frac;
- v2 += (v2n - v2) * frac;
- v3 += (v3n - v3) * frac;
p_dest[i] = AudioFrame(v0, v1);
}
if (C == 6) {
- // FIXME: Lot of unused assignments here, but it seems like intermediate calculations
- // should be done as for C == 2 (C == 4 also has some unused assignments).
float v0 = rb[(pos * 6) + 0];
float v1 = rb[(pos * 6) + 1];
- float v2 = rb[(pos * 6) + 2];
- float v3 = rb[(pos * 6) + 3];
- float v4 = rb[(pos * 6) + 4];
- float v5 = rb[(pos * 6) + 5];
float v0n = rb[(pos_next * 6) + 0];
float v1n = rb[(pos_next * 6) + 1];
- float v2n = rb[(pos_next * 6) + 2];
- float v3n = rb[(pos_next * 6) + 3];
- float v4n = rb[(pos_next * 6) + 4];
- float v5n = rb[(pos_next * 6) + 5];
+ v0 += (v0n - v0) * frac;
+ v1 += (v1n - v1) * frac;
p_dest[i] = AudioFrame(v0, v1);
}
}
@@ -153,7 +138,7 @@ bool AudioRBResampler::mix(AudioFrame *p_dest, int p_frames) {
}
// Fill zeros (silence) for the rest of frames
- for (uint32_t i = target_todo; i < p_frames; i++) {
+ for (int i = target_todo; i < p_frames; i++) {
p_dest[i] = AudioFrame(0, 0);
}
}
diff --git a/servers/audio/audio_rb_resampler.h b/servers/audio/audio_rb_resampler.h
index 6ef79c93fa..b21c480fc4 100644
--- a/servers/audio/audio_rb_resampler.h
+++ b/servers/audio/audio_rb_resampler.h
@@ -31,9 +31,9 @@
#ifndef AUDIO_RB_RESAMPLER_H
#define AUDIO_RB_RESAMPLER_H
-#include "os/memory.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
#include "servers/audio_server.h"
-#include "typedefs.h"
struct AudioRBResampler {
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 113f23f8f2..02a0bed964 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "audio_stream.h"
+#include "core/os/os.h"
//////////////////////////////
@@ -99,6 +100,129 @@ void AudioStream::_bind_methods() {
////////////////////////////////
+Ref<AudioStreamPlayback> AudioStreamMicrophone::instance_playback() {
+ Ref<AudioStreamPlaybackMicrophone> playback;
+ playback.instance();
+
+ playbacks.insert(playback.ptr());
+
+ playback->microphone = Ref<AudioStreamMicrophone>((AudioStreamMicrophone *)this);
+ playback->active = false;
+
+ return playback;
+}
+
+String AudioStreamMicrophone::get_stream_name() const {
+
+ //if (audio_stream.is_valid()) {
+ //return "Random: " + audio_stream->get_name();
+ //}
+ return "Microphone";
+}
+
+float AudioStreamMicrophone::get_length() const {
+ return 0;
+}
+
+void AudioStreamMicrophone::_bind_methods() {
+}
+
+AudioStreamMicrophone::AudioStreamMicrophone() {
+}
+
+void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_frames) {
+
+ AudioDriver::get_singleton()->lock();
+
+ Vector<int32_t> buf = AudioDriver::get_singleton()->get_input_buffer();
+ unsigned int input_size = AudioDriver::get_singleton()->get_input_size();
+ int mix_rate = AudioDriver::get_singleton()->get_mix_rate();
+ int playback_delay = MIN(((50 * mix_rate) / 1000) * 2, buf.size() >> 1);
+#ifdef DEBUG_ENABLED
+ unsigned int input_position = AudioDriver::get_singleton()->get_input_position();
+#endif
+
+ if (playback_delay > input_size) {
+ for (int i = 0; i < p_frames; i++) {
+ p_buffer[i] = AudioFrame(0.0f, 0.0f);
+ }
+ input_ofs = 0;
+ } else {
+ for (int i = 0; i < p_frames; i++) {
+ if (input_size > input_ofs) {
+ float l = (buf[input_ofs++] >> 16) / 32768.f;
+ if (input_ofs >= buf.size()) {
+ input_ofs = 0;
+ }
+ float r = (buf[input_ofs++] >> 16) / 32768.f;
+ if (input_ofs >= buf.size()) {
+ input_ofs = 0;
+ }
+
+ p_buffer[i] = AudioFrame(l, r);
+ } else {
+ p_buffer[i] = AudioFrame(0.0f, 0.0f);
+ }
+ }
+ }
+
+#ifdef DEBUG_ENABLED
+ if (input_ofs > input_position && (input_ofs - input_position) < (p_frames * 2)) {
+ print_verbose(String(get_class_name()) + " buffer underrun: input_position=" + itos(input_position) + " input_ofs=" + itos(input_ofs) + " input_size=" + itos(input_size));
+ }
+#endif
+
+ AudioDriver::get_singleton()->unlock();
+}
+
+void AudioStreamPlaybackMicrophone::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
+ AudioStreamPlaybackResampled::mix(p_buffer, p_rate_scale, p_frames);
+}
+
+float AudioStreamPlaybackMicrophone::get_stream_sampling_rate() {
+ return AudioDriver::get_singleton()->get_mix_rate();
+}
+
+void AudioStreamPlaybackMicrophone::start(float p_from_pos) {
+ input_ofs = 0;
+
+ AudioDriver::get_singleton()->capture_start();
+
+ active = true;
+ _begin_resample();
+}
+
+void AudioStreamPlaybackMicrophone::stop() {
+ AudioDriver::get_singleton()->capture_stop();
+ active = false;
+}
+
+bool AudioStreamPlaybackMicrophone::is_playing() const {
+ return active;
+}
+
+int AudioStreamPlaybackMicrophone::get_loop_count() const {
+ return 0;
+}
+
+float AudioStreamPlaybackMicrophone::get_playback_position() const {
+ return 0;
+}
+
+void AudioStreamPlaybackMicrophone::seek(float p_time) {
+ return; // Can't seek a microphone input
+}
+
+AudioStreamPlaybackMicrophone::~AudioStreamPlaybackMicrophone() {
+ microphone->playbacks.erase(this);
+ stop();
+}
+
+AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() {
+}
+
+////////////////////////////////
+
void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_stream) {
audio_stream = p_audio_stream;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 3312ce1ff6..f6ed45cc9c 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -31,8 +31,8 @@
#ifndef AUDIO_STREAM_H
#define AUDIO_STREAM_H
-#include "image.h"
-#include "resource.h"
+#include "core/image.h"
+#include "core/resource.h"
#include "servers/audio/audio_filter_sw.h"
#include "servers/audio_server.h"
@@ -94,6 +94,61 @@ public:
virtual float get_length() const = 0; //if supported, otherwise return 0
};
+// Microphone
+
+class AudioStreamPlaybackMicrophone;
+
+class AudioStreamMicrophone : public AudioStream {
+
+ GDCLASS(AudioStreamMicrophone, AudioStream)
+ friend class AudioStreamPlaybackMicrophone;
+
+ Set<AudioStreamPlaybackMicrophone *> playbacks;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual Ref<AudioStreamPlayback> instance_playback();
+ virtual String get_stream_name() const;
+
+ virtual float get_length() const; //if supported, otherwise return 0
+
+ AudioStreamMicrophone();
+};
+
+class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
+
+ GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback)
+ friend class AudioStreamMicrophone;
+
+ bool active;
+ unsigned int input_ofs;
+
+ Ref<AudioStreamMicrophone> microphone;
+
+protected:
+ virtual void _mix_internal(AudioFrame *p_buffer, int p_frames);
+ virtual float get_stream_sampling_rate();
+
+public:
+ virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
+
+ virtual void start(float p_from_pos = 0.0);
+ virtual void stop();
+ virtual bool is_playing() const;
+
+ virtual int get_loop_count() const; //times it looped
+
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
+
+ ~AudioStreamPlaybackMicrophone();
+ AudioStreamPlaybackMicrophone();
+};
+
+//
+
class AudioStreamPlaybackRandomPitch;
class AudioStreamRandomPitch : public AudioStream {
diff --git a/servers/audio/effects/SCsub b/servers/audio/effects/SCsub
index ccc76e823f..d730144861 100644
--- a/servers/audio/effects/SCsub
+++ b/servers/audio/effects/SCsub
@@ -3,5 +3,3 @@
Import('env')
env.add_source_files(env.servers_sources, "*.cpp")
-
-Export('env')
diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp
index fd9e3311e7..3c88d050f6 100644
--- a/servers/audio/effects/audio_effect_chorus.cpp
+++ b/servers/audio/effects/audio_effect_chorus.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_chorus.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectChorusInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_delay.cpp b/servers/audio/effects/audio_effect_delay.cpp
index e3af898afa..abc10ee096 100644
--- a/servers/audio/effects/audio_effect_delay.cpp
+++ b/servers/audio/effects/audio_effect_delay.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_delay.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectDelayInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_distortion.cpp b/servers/audio/effects/audio_effect_distortion.cpp
index c9ac0db644..0422083363 100644
--- a/servers/audio/effects/audio_effect_distortion.cpp
+++ b/servers/audio/effects/audio_effect_distortion.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_distortion.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_filter.h b/servers/audio/effects/audio_effect_filter.h
index 11978882bc..e8f12e5efa 100644
--- a/servers/audio/effects/audio_effect_filter.h
+++ b/servers/audio/effects/audio_effect_filter.h
@@ -96,6 +96,11 @@ VARIANT_ENUM_CAST(AudioEffectFilter::FilterDB)
class AudioEffectLowPassFilter : public AudioEffectFilter {
GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter)
+
+ void _validate_property(PropertyInfo &property) const {
+ if (property.name == "gain") property.usage = 0;
+ }
+
public:
AudioEffectLowPassFilter() :
AudioEffectFilter(AudioFilterSW::LOWPASS) {}
@@ -103,6 +108,10 @@ public:
class AudioEffectHighPassFilter : public AudioEffectFilter {
GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter)
+ void _validate_property(PropertyInfo &property) const {
+ if (property.name == "gain") property.usage = 0;
+ }
+
public:
AudioEffectHighPassFilter() :
AudioEffectFilter(AudioFilterSW::HIGHPASS) {}
@@ -110,6 +119,10 @@ public:
class AudioEffectBandPassFilter : public AudioEffectFilter {
GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter)
+ void _validate_property(PropertyInfo &property) const {
+ if (property.name == "gain") property.usage = 0;
+ }
+
public:
AudioEffectBandPassFilter() :
AudioEffectFilter(AudioFilterSW::BANDPASS) {}
diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp
index c0a9bd773d..3151111ec8 100644
--- a/servers/audio/effects/audio_effect_phaser.cpp
+++ b/servers/audio/effects/audio_effect_phaser.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "audio_effect_phaser.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index ddd0a0db6b..f5ca8f2da4 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -30,7 +30,7 @@
#include "audio_effect_pitch_shift.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include "servers/audio_server.h"
/* Thirdparty code, so disable clang-format with Godot style */
@@ -305,9 +305,9 @@ Ref<AudioEffectInstance> AudioEffectPitchShift::instance() {
return ins;
}
-void AudioEffectPitchShift::set_pitch_scale(float p_adjust) {
-
- pitch_scale = p_adjust;
+void AudioEffectPitchShift::set_pitch_scale(float p_pitch_scale) {
+ ERR_FAIL_COND(p_pitch_scale <= 0.0);
+ pitch_scale = p_pitch_scale;
}
float AudioEffectPitchShift::get_pitch_scale() const {
diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h
index f1c78d752f..78f92a0261 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.h
+++ b/servers/audio/effects/audio_effect_pitch_shift.h
@@ -100,7 +100,7 @@ protected:
public:
Ref<AudioEffectInstance> instance();
- void set_pitch_scale(float p_adjust);
+ void set_pitch_scale(float p_pitch_scale);
float get_pitch_scale() const;
AudioEffectPitchShift();
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index 74a6838d1a..a0094f66b8 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -44,7 +44,7 @@ void AudioEffectRecordInstance::process(const AudioFrame *p_src_frames, AudioFra
}
}
-bool AudioEffectRecordInstance::process_silence() {
+bool AudioEffectRecordInstance::process_silence() const {
return true;
}
@@ -233,7 +233,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
w[i * 2 + 1] = rr[i];
}
} else {
- ERR_EXPLAIN("format not implemented");
+ ERR_PRINT("Format not implemented.");
}
Ref<AudioStreamSample> sample;
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h
index e4f5ba8a23..4b8ee2bcdd 100644
--- a/servers/audio/effects/audio_effect_record.h
+++ b/servers/audio/effects/audio_effect_record.h
@@ -31,11 +31,11 @@
#ifndef AUDIOEFFECTRECORD_H
#define AUDIOEFFECTRECORD_H
+#include "core/io/marshalls.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "core/os/thread.h"
#include "editor/import/resource_importer_wav.h"
-#include "io/marshalls.h"
-#include "os/file_access.h"
-#include "os/os.h"
#include "scene/resources/audio_stream_sample.h"
#include "servers/audio/audio_effect.h"
#include "servers/audio_server.h"
@@ -49,7 +49,7 @@ class AudioEffectRecordInstance : public AudioEffectInstance {
bool is_recording;
Thread *io_thread;
- bool thread_active = false;
+ bool thread_active;
Vector<AudioFrame> ring_buffer;
Vector<float> recording_data;
@@ -66,7 +66,10 @@ class AudioEffectRecordInstance : public AudioEffectInstance {
public:
void init();
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count);
- virtual bool process_silence();
+ virtual bool process_silence() const;
+
+ AudioEffectRecordInstance() :
+ thread_active(false) {}
};
class AudioEffectRecord : public AudioEffect {
diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp
index b15fc7ecf4..70ac70a5a8 100644
--- a/servers/audio/effects/eq.cpp
+++ b/servers/audio/effects/eq.cpp
@@ -31,8 +31,8 @@
// Author: reduzio@gmail.com (C) 2006
#include "eq.h"
-#include "error_macros.h"
-#include "math_funcs.h"
+#include "core/error_macros.h"
+#include "core/math/math_funcs.h"
#include <math.h>
#define POW2(v) ((v) * (v))
diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h
index 5c654529c3..c06f1f8bf8 100644
--- a/servers/audio/effects/eq.h
+++ b/servers/audio/effects/eq.h
@@ -33,8 +33,8 @@
#ifndef EQ_FILTER_H
#define EQ_FILTER_H
-#include "typedefs.h"
-#include "vector.h"
+#include "core/typedefs.h"
+#include "core/vector.h"
/**
@author Juan Linietsky
diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp
index 5e31202e58..b032c91da2 100644
--- a/servers/audio/effects/reverb.cpp
+++ b/servers/audio/effects/reverb.cpp
@@ -31,27 +31,27 @@
// Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006
#include "reverb.h"
-#include "math_funcs.h"
+#include "core/math/math_funcs.h"
#include <math.h>
const float Reverb::comb_tunings[MAX_COMBS] = {
//freeverb comb tunings
- 0.025306122448979593,
- 0.026938775510204082,
- 0.028956916099773241,
- 0.03074829931972789,
- 0.032244897959183672,
- 0.03380952380952381,
- 0.035306122448979592,
- 0.036666666666666667
+ 0.025306122448979593f,
+ 0.026938775510204082f,
+ 0.028956916099773241f,
+ 0.03074829931972789f,
+ 0.032244897959183672f,
+ 0.03380952380952381f,
+ 0.035306122448979592f,
+ 0.036666666666666667f
};
const float Reverb::allpass_tunings[MAX_ALLPASS] = {
//freeverb allpass tunings
- 0.0051020408163265302,
- 0.007732426303854875,
- 0.01,
- 0.012607709750566893
+ 0.0051020408163265302f,
+ 0.007732426303854875f,
+ 0.01f,
+ 0.012607709750566893f
};
void Reverb::process(float *p_src, float *p_dst, int p_frames) {
diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h
index c3d3873dcd..03cf197456 100644
--- a/servers/audio/effects/reverb.h
+++ b/servers/audio/effects/reverb.h
@@ -33,9 +33,9 @@
#ifndef REVERB_H
#define REVERB_H
-#include "audio_frame.h"
-#include "os/memory.h"
-#include "typedefs.h"
+#include "core/math/audio_frame.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
class Reverb {
public:
diff --git a/servers/audio/reverb_sw.cpp b/servers/audio/reverb_sw.cpp
index 52e7699deb..d078da38b4 100644
--- a/servers/audio/reverb_sw.cpp
+++ b/servers/audio/reverb_sw.cpp
@@ -29,33 +29,21 @@
/*************************************************************************/
#include "reverb_sw.h"
-#include "print_string.h"
-#include "stdlib.h"
+
+#include "core/print_string.h"
+
+#include <stdlib.h>
+
#define SETMIN(x, y) (x) = MIN((x), (y))
+
#define rangeloop(c, min, max) \
for ((c) = (min); (c) < (max); (c)++)
#define ABSDIFF(x, y) \
(((x) < (y)) ? ((y) - (x)) : ((x) - (y)))
-#ifdef bleh_MSC_VER
-
-#if _MSC_VER >= 1400
-_FORCE_INLINE_ int32_tMULSHIFT_S32(
- int32_t Factor1,
- int32_t Factor2,
- uint8_t Bits) {
-
- return __ll_rshift(
- __emul(Factor1, Factor2),
- Bits);
-}
-#endif
-
-#else
#define MULSHIFT_S32(Factor1, Factor2, Bits) \
((int)(((int64_t)(Factor1) * (Factor2)) >> (Bits)))
-#endif
struct ReverbParamsSW {
unsigned int BufferSize; // Required buffer size
diff --git a/servers/audio/reverb_sw.h b/servers/audio/reverb_sw.h
index 15f9a43183..01977d1f61 100644
--- a/servers/audio/reverb_sw.h
+++ b/servers/audio/reverb_sw.h
@@ -31,10 +31,10 @@
#ifndef REVERB_SW_H
#define REVERB_SW_H
-#include "os/memory.h"
-#include "typedefs.h"
+#include "core/os/memory.h"
+#include "core/typedefs.h"
-class ReverbParamsSW;
+struct ReverbParamsSW;
class ReverbSW {
public:
diff --git a/servers/audio/voice_rb_sw.h b/servers/audio/voice_rb_sw.h
index 42045428a8..fc02cc1827 100644
--- a/servers/audio/voice_rb_sw.h
+++ b/servers/audio/voice_rb_sw.h
@@ -31,7 +31,7 @@
#ifndef VOICE_RB_SW_H
#define VOICE_RB_SW_H
-#include "os/os.h"
+#include "core/os/os.h"
#include "servers/audio_server.h"
class VoiceRBSW {
public: