summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/effects/audio_effect_record.cpp20
-rw-r--r--servers/audio/effects/audio_effect_record.h10
2 files changed, 15 insertions, 15 deletions
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index a6553e1431..fff6dbc32a 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -199,16 +199,16 @@ bool AudioEffectRecord::is_recording_active() const {
return recording_active;
}
-void AudioEffectRecord::set_format(AudioStreamSample::Format p_format) {
+void AudioEffectRecord::set_format(AudioStreamWAV::Format p_format) {
format = p_format;
}
-AudioStreamSample::Format AudioEffectRecord::get_format() const {
+AudioStreamWAV::Format AudioEffectRecord::get_format() const {
return format;
}
-Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
- AudioStreamSample::Format dst_format = format;
+Ref<AudioStreamWAV> AudioEffectRecord::get_recording() const {
+ AudioStreamWAV::Format dst_format = format;
bool stereo = true; //forcing mono is not implemented
Vector<uint8_t> dst_data;
@@ -216,7 +216,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
ERR_FAIL_COND_V(current_instance.is_null(), nullptr);
ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, nullptr);
- if (dst_format == AudioStreamSample::FORMAT_8_BITS) {
+ if (dst_format == AudioStreamWAV::FORMAT_8_BITS) {
int data_size = current_instance->recording_data.size();
dst_data.resize(data_size);
uint8_t *w = dst_data.ptrw();
@@ -225,7 +225,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
int8_t v = CLAMP(current_instance->recording_data[i] * 128, -128, 127);
w[i] = v;
}
- } else if (dst_format == AudioStreamSample::FORMAT_16_BITS) {
+ } else if (dst_format == AudioStreamWAV::FORMAT_16_BITS) {
int data_size = current_instance->recording_data.size();
dst_data.resize(data_size * 2);
uint8_t *w = dst_data.ptrw();
@@ -234,7 +234,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
int16_t v = CLAMP(current_instance->recording_data[i] * 32768, -32768, 32767);
encode_uint16(v, &w[i * 2]);
}
- } else if (dst_format == AudioStreamSample::FORMAT_IMA_ADPCM) {
+ } else if (dst_format == AudioStreamWAV::FORMAT_IMA_ADPCM) {
//byte interleave
Vector<float> left;
Vector<float> right;
@@ -273,12 +273,12 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
ERR_PRINT("Format not implemented.");
}
- Ref<AudioStreamSample> sample;
+ Ref<AudioStreamWAV> sample;
sample.instantiate();
sample->set_data(dst_data);
sample->set_format(dst_format);
sample->set_mix_rate(AudioServer::get_singleton()->get_mix_rate());
- sample->set_loop_mode(AudioStreamSample::LOOP_DISABLED);
+ sample->set_loop_mode(AudioStreamWAV::LOOP_DISABLED);
sample->set_loop_begin(0);
sample->set_loop_end(0);
sample->set_stereo(stereo);
@@ -297,6 +297,6 @@ void AudioEffectRecord::_bind_methods() {
}
AudioEffectRecord::AudioEffectRecord() {
- format = AudioStreamSample::FORMAT_16_BITS;
+ format = AudioStreamWAV::FORMAT_16_BITS;
recording_active = false;
}
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h
index 8a6247e27a..8cdf5f6c2d 100644
--- a/servers/audio/effects/audio_effect_record.h
+++ b/servers/audio/effects/audio_effect_record.h
@@ -35,7 +35,7 @@
#include "core/io/marshalls.h"
#include "core/os/os.h"
#include "core/os/thread.h"
-#include "scene/resources/audio_stream_sample.h"
+#include "scene/resources/audio_stream_wav.h"
#include "servers/audio/audio_effect.h"
#include "servers/audio_server.h"
@@ -85,7 +85,7 @@ class AudioEffectRecord : public AudioEffect {
bool recording_active;
Ref<AudioEffectRecordInstance> current_instance;
- AudioStreamSample::Format format;
+ AudioStreamWAV::Format format;
void ensure_thread_stopped();
@@ -96,9 +96,9 @@ public:
Ref<AudioEffectInstance> instantiate() override;
void set_recording_active(bool p_record);
bool is_recording_active() const;
- void set_format(AudioStreamSample::Format p_format);
- AudioStreamSample::Format get_format() const;
- Ref<AudioStreamSample> get_recording() const;
+ void set_format(AudioStreamWAV::Format p_format);
+ AudioStreamWAV::Format get_format() const;
+ Ref<AudioStreamWAV> get_recording() const;
AudioEffectRecord();
};