From 3205a92ad872f918c8322cdcd1434c231a1fd251 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 17 Feb 2020 18:06:54 -0300 Subject: PoolVector is gone, replaced by Vector Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector`. --- servers/audio/effects/audio_effect_record.cpp | 16 ++++++++-------- servers/audio/effects/audio_stream_generator.cpp | 6 +++--- servers/audio/effects/audio_stream_generator.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'servers/audio') diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index 9be3a2d554..8f0c55ad83 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -215,7 +215,7 @@ Ref AudioEffectRecord::get_recording() const { AudioStreamSample::Format dst_format = format; bool stereo = true; //forcing mono is not implemented - PoolVector dst_data; + Vector dst_data; ERR_FAIL_COND_V(current_instance.is_null(), NULL); ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, NULL); @@ -223,7 +223,7 @@ Ref AudioEffectRecord::get_recording() const { if (dst_format == AudioStreamSample::FORMAT_8_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size); - PoolVector::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); for (int i = 0; i < data_size; i++) { int8_t v = CLAMP(current_instance->recording_data[i] * 128, -128, 127); @@ -232,7 +232,7 @@ Ref AudioEffectRecord::get_recording() const { } else if (dst_format == AudioStreamSample::FORMAT_16_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size * 2); - PoolVector::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); for (int i = 0; i < data_size; i++) { int16_t v = CLAMP(current_instance->recording_data[i] * 32768, -32768, 32767); @@ -252,8 +252,8 @@ Ref AudioEffectRecord::get_recording() const { right.set(i, current_instance->recording_data[i * 2 + 1]); } - PoolVector bleft; - PoolVector bright; + Vector bleft; + Vector bright; ResourceImporterWAV::_compress_ima_adpcm(left, bleft); ResourceImporterWAV::_compress_ima_adpcm(right, bright); @@ -261,9 +261,9 @@ Ref AudioEffectRecord::get_recording() const { int dl = bleft.size(); dst_data.resize(dl * 2); - PoolVector::Write w = dst_data.write(); - PoolVector::Read rl = bleft.read(); - PoolVector::Read rr = bright.read(); + uint8_t *w = dst_data.ptrw(); + const uint8_t *rl = bleft.ptr(); + const uint8_t *rr = bright.ptr(); for (int i = 0; i < dl; i++) { w[i * 2 + 0] = rl[i]; diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index 9e1019afbc..101dcddae7 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -99,17 +99,17 @@ bool AudioStreamGeneratorPlayback::push_frame(const Vector2 &p_frame) { bool AudioStreamGeneratorPlayback::can_push_buffer(int p_frames) const { return buffer.space_left() >= p_frames; } -bool AudioStreamGeneratorPlayback::push_buffer(const PoolVector2Array &p_frames) { +bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frames) { int to_write = p_frames.size(); if (buffer.space_left() < to_write) { return false; } - PoolVector2Array::Read r = p_frames.read(); + const Vector2 *r = p_frames.ptr(); if (sizeof(real_t) == 4) { //write directly - buffer.write((const AudioFrame *)r.ptr(), to_write); + buffer.write((const AudioFrame *)r, to_write); } else { //convert from double AudioFrame buf[2048]; diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h index f1cd73d266..aee3459e17 100644 --- a/servers/audio/effects/audio_stream_generator.h +++ b/servers/audio/effects/audio_stream_generator.h @@ -85,7 +85,7 @@ public: bool push_frame(const Vector2 &p_frame); bool can_push_buffer(int p_frames) const; - bool push_buffer(const PoolVector2Array &p_frames); + bool push_buffer(const PackedVector2Array &p_frames); int get_frames_available() const; int get_skips() const; -- cgit v1.2.3