diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 2 | ||||
| -rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 25 |
2 files changed, 20 insertions, 7 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 1feb2c224e..8a070313f8 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -625,6 +625,8 @@ void RasterizerStorageGLES3::texture_replace(RID p_texture, RID p_by_texture) { for (int n = 0; n < tex_from->images.size(); n++) { texture_set_data(p_texture, tex_from->images[n], n); } + + free(p_by_texture); } bool RasterizerStorageGLES3::_is_main_thread() { diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 2488439738..1233f0f632 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -34,6 +34,7 @@ #include "core/config/project_settings.h" #include "core/os/os.h" +#include "core/version.h" #ifdef ALSAMIDI_ENABLED #include "drivers/alsa/asound-so_wrap.h" @@ -293,7 +294,17 @@ Error AudioDriverPulseAudio::init() { pa_ml = pa_mainloop_new(); ERR_FAIL_COND_V(pa_ml == nullptr, ERR_CANT_OPEN); - pa_ctx = pa_context_new(pa_mainloop_get_api(pa_ml), "Godot"); + String context_name; + if (Engine::get_singleton()->is_editor_hint()) { + context_name = VERSION_NAME " Editor"; + } else { + context_name = GLOBAL_GET("application/config/name"); + if (context_name.is_empty()) { + context_name = VERSION_NAME " Project"; + } + } + + pa_ctx = pa_context_new(pa_mainloop_get_api(pa_ml), context_name.utf8().ptr()); ERR_FAIL_COND_V(pa_ctx == nullptr, ERR_CANT_OPEN); pa_ready = 0; @@ -382,15 +393,15 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { ad->start_counting_ticks(); if (!ad->active) { - for (unsigned int i = 0; i < ad->pa_buffer_size; i++) { - ad->samples_out.write[i] = 0; - } + ad->samples_out.fill(0); } else { ad->audio_server_process(ad->buffer_frames, ad->samples_in.ptrw()); + int16_t *out_ptr = ad->samples_out.ptrw(); + if (ad->channels == ad->pa_map.channels) { for (unsigned int i = 0; i < ad->pa_buffer_size; i++) { - ad->samples_out.write[i] = ad->samples_in[i] >> 16; + out_ptr[i] = ad->samples_in[i] >> 16; } } else { // Uneven amount of channels @@ -399,11 +410,11 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { for (unsigned int i = 0; i < ad->buffer_frames; i++) { for (int j = 0; j < ad->pa_map.channels - 1; j++) { - ad->samples_out.write[out_idx++] = ad->samples_in[in_idx++] >> 16; + out_ptr[out_idx++] = ad->samples_in[in_idx++] >> 16; } uint32_t l = ad->samples_in[in_idx++] >> 16; uint32_t r = ad->samples_in[in_idx++] >> 16; - ad->samples_out.write[out_idx++] = (l + r) / 2; + out_ptr[out_idx++] = (l + r) / 2; } } } |