Renamed AudioDriver audio_input_* vars to input_*
This commit is contained in:
@ -134,18 +134,18 @@ void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_fr
|
||||
|
||||
AudioDriver::get_singleton()->lock();
|
||||
|
||||
Vector<int32_t> buf = AudioDriver::get_singleton()->get_audio_input_buffer();
|
||||
unsigned int audio_input_size = AudioDriver::get_singleton()->get_audio_input_size();
|
||||
Vector<int32_t> buf = AudioDriver::get_singleton()->get_input_buffer();
|
||||
unsigned int input_size = AudioDriver::get_singleton()->get_input_size();
|
||||
|
||||
// p_frames is multipled by two since an AudioFrame is stereo
|
||||
if ((p_frames * 2) > audio_input_size) {
|
||||
if ((p_frames * 2) > 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 (audio_input_size >= input_ofs) {
|
||||
if (input_size >= input_ofs) {
|
||||
float l = (buf[input_ofs++] >> 16) / 32768.f;
|
||||
if (input_ofs >= buf.size()) {
|
||||
input_ofs = 0;
|
||||
|
||||
@ -80,6 +80,17 @@ double AudioDriver::get_mix_time() const {
|
||||
return total;
|
||||
}
|
||||
|
||||
void AudioDriver::input_buffer_write(int32_t sample) {
|
||||
|
||||
input_buffer.write[input_position++] = sample;
|
||||
if (input_position >= input_buffer.size()) {
|
||||
input_position = 0;
|
||||
}
|
||||
if (input_size < input_buffer.size()) {
|
||||
input_size++;
|
||||
}
|
||||
}
|
||||
|
||||
AudioDriver::SpeakerMode AudioDriver::get_speaker_mode_by_total_channels(int p_channels) const {
|
||||
switch (p_channels) {
|
||||
case 4: return SPEAKER_SURROUND_31;
|
||||
|
||||
@ -53,12 +53,13 @@ class AudioDriver {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
Vector<int32_t> audio_input_buffer;
|
||||
unsigned int audio_input_position;
|
||||
unsigned int audio_input_size;
|
||||
Vector<int32_t> input_buffer;
|
||||
unsigned int input_position;
|
||||
unsigned int input_size;
|
||||
|
||||
void audio_server_process(int p_frames, int32_t *p_buffer, bool p_update_mix_time = true);
|
||||
void update_mix_time(int p_frames);
|
||||
void input_buffer_write(int32_t sample);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
_FORCE_INLINE_ void start_counting_ticks() { prof_ticks = OS::get_singleton()->get_ticks_usec(); }
|
||||
@ -108,9 +109,9 @@ public:
|
||||
SpeakerMode get_speaker_mode_by_total_channels(int p_channels) const;
|
||||
int get_total_channels_by_speaker_mode(SpeakerMode) const;
|
||||
|
||||
Vector<int32_t> get_audio_input_buffer() { return audio_input_buffer; }
|
||||
unsigned int get_audio_input_position() { return audio_input_position; }
|
||||
unsigned int get_audio_input_size() { return audio_input_size; }
|
||||
Vector<int32_t> get_input_buffer() { return input_buffer; }
|
||||
unsigned int get_input_position() { return input_position; }
|
||||
unsigned int get_input_size() { return input_size; }
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
uint64_t get_profiling_time() const { return prof_time; }
|
||||
|
||||
Reference in New Issue
Block a user