summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-18 11:27:04 +0100
committerGitHub <noreply@github.com>2020-02-18 11:27:04 +0100
commitef5891091bceef2800b4fae4cd85af219e791467 (patch)
tree8d58cca8cae2c34d408450cfb5ceb198543147b7 /servers/audio
parentc7faf2e16b684f3dd0246dbdb662b1826dd24571 (diff)
parent3205a92ad872f918c8322cdcd1434c231a1fd251 (diff)
Merge pull request #36311 from reduz/poolvector-deprecation
Convert all references and instances of PoolVector to Vector
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/effects/audio_effect_record.cpp16
-rw-r--r--servers/audio/effects/audio_stream_generator.cpp6
-rw-r--r--servers/audio/effects/audio_stream_generator.h2
3 files changed, 12 insertions, 12 deletions
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<AudioStreamSample> AudioEffectRecord::get_recording() const {
AudioStreamSample::Format dst_format = format;
bool stereo = true; //forcing mono is not implemented
- PoolVector<uint8_t> dst_data;
+ Vector<uint8_t> 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<AudioStreamSample> 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<uint8_t>::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<AudioStreamSample> 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<uint8_t>::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<AudioStreamSample> AudioEffectRecord::get_recording() const {
right.set(i, current_instance->recording_data[i * 2 + 1]);
}
- PoolVector<uint8_t> bleft;
- PoolVector<uint8_t> bright;
+ Vector<uint8_t> bleft;
+ Vector<uint8_t> bright;
ResourceImporterWAV::_compress_ima_adpcm(left, bleft);
ResourceImporterWAV::_compress_ima_adpcm(right, bright);
@@ -261,9 +261,9 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
int dl = bleft.size();
dst_data.resize(dl * 2);
- PoolVector<uint8_t>::Write w = dst_data.write();
- PoolVector<uint8_t>::Read rl = bleft.read();
- PoolVector<uint8_t>::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;