summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-05-13 15:04:37 +0200
committerRĂ©mi Verschelde <rverschelde@gmail.com>2022-05-16 10:37:48 +0200
commit746dddc0673d7261f19b1e056e90e6e3a49ef33a (patch)
tree434b526eb286850ebccc6d2c998a7d90fdb8b5e2 /servers/audio
parent396def9b66c476f7834604adb7136ca903ed01be (diff)
Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_stream.h4
-rw-r--r--servers/audio/effects/audio_effect_eq.cpp8
-rw-r--r--servers/audio/effects/audio_effect_eq.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 9800707849..8851e1419b 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -125,7 +125,7 @@ class AudioStreamMicrophone : public AudioStream {
GDCLASS(AudioStreamMicrophone, AudioStream);
friend class AudioStreamPlaybackMicrophone;
- Set<AudioStreamPlaybackMicrophone *> playbacks;
+ RBSet<AudioStreamPlaybackMicrophone *> playbacks;
protected:
static void _bind_methods();
@@ -192,7 +192,7 @@ private:
float weight;
};
- Set<AudioStreamPlaybackRandomizer *> playbacks;
+ RBSet<AudioStreamPlaybackRandomizer *> playbacks;
Vector<PoolEntry> audio_stream_pool;
float random_pitch_scale = 1.1f;
float random_volume_offset_db = 5.0f;
diff --git a/servers/audio/effects/audio_effect_eq.cpp b/servers/audio/effects/audio_effect_eq.cpp
index cc317031d4..b7c373479a 100644
--- a/servers/audio/effects/audio_effect_eq.cpp
+++ b/servers/audio/effects/audio_effect_eq.cpp
@@ -90,9 +90,9 @@ int AudioEffectEQ::get_band_count() const {
}
bool AudioEffectEQ::_set(const StringName &p_name, const Variant &p_value) {
- const Map<StringName, int>::Element *E = prop_band_map.find(p_name);
+ HashMap<StringName, int>::ConstIterator E = prop_band_map.find(p_name);
if (E) {
- set_band_gain_db(E->get(), p_value);
+ set_band_gain_db(E->value, p_value);
return true;
}
@@ -100,9 +100,9 @@ bool AudioEffectEQ::_set(const StringName &p_name, const Variant &p_value) {
}
bool AudioEffectEQ::_get(const StringName &p_name, Variant &r_ret) const {
- const Map<StringName, int>::Element *E = prop_band_map.find(p_name);
+ HashMap<StringName, int>::ConstIterator E = prop_band_map.find(p_name);
if (E) {
- r_ret = get_band_gain_db(E->get());
+ r_ret = get_band_gain_db(E->value);
return true;
}
diff --git a/servers/audio/effects/audio_effect_eq.h b/servers/audio/effects/audio_effect_eq.h
index 252f931e6c..9b0560223f 100644
--- a/servers/audio/effects/audio_effect_eq.h
+++ b/servers/audio/effects/audio_effect_eq.h
@@ -55,7 +55,7 @@ class AudioEffectEQ : public AudioEffect {
EQ eq;
Vector<float> gain;
- Map<StringName, int> prop_band_map;
+ HashMap<StringName, int> prop_band_map;
Vector<String> band_names;
protected: