diff options
Diffstat (limited to 'servers/audio/audio_stream.cpp')
-rw-r--r-- | servers/audio/audio_stream.cpp | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 46e674fd9b..b7e3f8964b 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -36,7 +36,6 @@ ////////////////////////////// void AudioStreamPlaybackResampled::_begin_resample() { - //clear cubic interpolation history internal_buffer[0] = AudioFrame(0.0, 0.0); internal_buffer[1] = AudioFrame(0.0, 0.0); @@ -48,14 +47,12 @@ void AudioStreamPlaybackResampled::_begin_resample() { } void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) { - float target_rate = AudioServer::get_singleton()->get_mix_rate(); float global_rate_scale = AudioServer::get_singleton()->get_global_rate_scale(); uint64_t mix_increment = uint64_t(((get_stream_sampling_rate() * p_rate_scale) / double(target_rate * global_rate_scale)) * double(FP_LEN)); for (int i = 0; i < p_frames; i++) { - uint32_t idx = CUBIC_INTERP_HISTORY + uint32_t(mix_offset >> FP_BITS); //standard cubic interpolation (great quality/performance ratio) //this used to be moved to a LUT for greater performance, but nowadays CPU speed is generally faster than memory. @@ -76,7 +73,6 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, mix_offset += mix_increment; while ((mix_offset >> FP_BITS) >= INTERNAL_BUFFER_LEN) { - internal_buffer[0] = internal_buffer[INTERNAL_BUFFER_LEN + 0]; internal_buffer[1] = internal_buffer[INTERNAL_BUFFER_LEN + 1]; internal_buffer[2] = internal_buffer[INTERNAL_BUFFER_LEN + 2]; @@ -97,7 +93,6 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, //////////////////////////////// void AudioStream::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_length"), &AudioStream::get_length); } @@ -116,7 +111,6 @@ Ref<AudioStreamPlayback> AudioStreamMicrophone::instance_playback() { } String AudioStreamMicrophone::get_stream_name() const { - //if (audio_stream.is_valid()) { //return "Random: " + audio_stream->get_name(); //} @@ -134,7 +128,6 @@ AudioStreamMicrophone::AudioStreamMicrophone() { } void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_frames) { - AudioDriver::get_singleton()->lock(); Vector<int32_t> buf = AudioDriver::get_singleton()->get_input_buffer(); @@ -187,7 +180,6 @@ float AudioStreamPlaybackMicrophone::get_stream_sampling_rate() { } void AudioStreamPlaybackMicrophone::start(float p_from_pos) { - if (active) { return; } @@ -239,7 +231,6 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() { //////////////////////////////// void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_stream) { - audio_stream = p_audio_stream; if (audio_stream.is_valid()) { for (Set<AudioStreamPlaybackRandomPitch *>::Element *E = playbacks.front(); E; E = E->next()) { @@ -249,12 +240,10 @@ void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_st } Ref<AudioStream> AudioStreamRandomPitch::get_audio_stream() const { - return audio_stream; } void AudioStreamRandomPitch::set_random_pitch(float p_pitch) { - if (p_pitch < 1) p_pitch = 1; random_pitch = p_pitch; @@ -276,7 +265,6 @@ Ref<AudioStreamPlayback> AudioStreamRandomPitch::instance_playback() { } String AudioStreamRandomPitch::get_stream_name() const { - if (audio_stream.is_valid()) { return "Random: " + audio_stream->get_name(); } @@ -292,7 +280,6 @@ float AudioStreamRandomPitch::get_length() const { } void AudioStreamRandomPitch::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_audio_stream", "stream"), &AudioStreamRandomPitch::set_audio_stream); ClassDB::bind_method(D_METHOD("get_audio_stream"), &AudioStreamRandomPitch::get_audio_stream); |