diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 21 | ||||
| -rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 2 | ||||
| -rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 7 | ||||
| -rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 22 | ||||
| -rw-r--r-- | drivers/gles3/shaders/scene.glsl | 23 | ||||
| -rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 170 | ||||
| -rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.h | 11 | ||||
| -rw-r--r-- | drivers/rtaudio/audio_driver_rtaudio.cpp | 2 | ||||
| -rw-r--r-- | drivers/unix/SCsub | 2 | ||||
| -rw-r--r-- | drivers/unix/dir_access_unix.cpp | 94 | ||||
| -rw-r--r-- | drivers/unix/file_access_unix.cpp | 9 | ||||
| -rw-r--r-- | drivers/unix/file_access_unix.h | 2 | ||||
| -rw-r--r-- | drivers/unix/socket_helpers.h | 1 | ||||
| -rw-r--r-- | drivers/wasapi/audio_driver_wasapi.cpp | 8 |
14 files changed, 309 insertions, 65 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 84f29facf4..5d62d2f5a0 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -576,6 +576,15 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur Rect2 src_rect = (rect->flags & CANVAS_RECT_REGION) ? Rect2(rect->source.position * texpixel_size, rect->source.size * texpixel_size) : Rect2(0, 0, 1, 1); Rect2 dst_rect = Rect2(rect->rect.position, rect->rect.size); + if (dst_rect.size.width < 0) { + dst_rect.position.x += dst_rect.size.width; + dst_rect.size.width *= -1; + } + if (dst_rect.size.height < 0) { + dst_rect.position.y += dst_rect.size.height; + dst_rect.size.height *= -1; + } + if (rect->flags & CANVAS_RECT_FLIP_H) { src_rect.size.x *= -1; } @@ -602,8 +611,18 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur } } else { + Rect2 dst_rect = Rect2(rect->rect.position, rect->rect.size); - state.canvas_shader.set_uniform(CanvasShaderGLES3::DST_RECT, Color(rect->rect.position.x, rect->rect.position.y, rect->rect.size.x, rect->rect.size.y)); + if (dst_rect.size.width < 0) { + dst_rect.position.x += dst_rect.size.width; + dst_rect.size.width *= -1; + } + if (dst_rect.size.height < 0) { + dst_rect.position.y += dst_rect.size.height; + dst_rect.size.height *= -1; + } + + state.canvas_shader.set_uniform(CanvasShaderGLES3::DST_RECT, Color(dst_rect.position.x, dst_rect.position.y, dst_rect.size.x, dst_rect.size.y)); state.canvas_shader.set_uniform(CanvasShaderGLES3::SRC_RECT, Color(0, 0, 1, 1)); state.canvas_shader.set_uniform(CanvasShaderGLES3::CLIP_RECT_UV, false); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index b3fd6fa2a0..8669c42a7a 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -806,7 +806,7 @@ public: void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform &p_view_transform, const CameraMatrix &p_projection, GLuint p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add, bool p_directional_shadows); - _FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_passs); + _FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass); _FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ba380bab7b..b99817fb12 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -595,7 +595,6 @@ RID RasterizerStorageGLES3::texture_create() { void RasterizerStorageGLES3::texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags) { - int components; GLenum format; GLenum internal_format; GLenum type; @@ -777,8 +776,6 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p int tsize = 0; - int block = Image::get_format_block_size(img->get_format()); - for (int i = 0; i < mipmaps; i++) { int size, ofs; @@ -789,10 +786,6 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p if (texture->compressed) { glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - //this is not needed, as compressed takes the regular size, even if blocks extend it - //int bw = (w % block != 0) ? w + (block - w % block) : w; - //int bh = (h % block != 0) ? h + (block - h % block) : h; - int bw = w; int bh = h; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 419decce29..5401c8266a 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -441,12 +441,12 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener if (!bnode->single_statement) { code += _mktab(p_level - 1) + "{\n"; } - + for (int i = 0; i < bnode->statements.size(); i++) { String scode = _dump_node_code(bnode->statements[i], p_level, r_gen_code, p_actions, p_default_actions); - if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement ) { + if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement) { code += scode; //use directly } else { code += _mktab(p_level) + scode + ";\n"; @@ -461,20 +461,20 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener SL::VariableDeclarationNode *vdnode = (SL::VariableDeclarationNode *)p_node; String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype); - for(int i=0;i<vdnode->declarations.size();i++) { - if (i>0) { - declaration+=","; + for (int i = 0; i < vdnode->declarations.size(); i++) { + if (i > 0) { + declaration += ","; } else { - declaration+=" "; + declaration += " "; } - declaration += _mkid(vdnode->declarations[i].name); + declaration += _mkid(vdnode->declarations[i].name); if (vdnode->declarations[i].initializer) { - declaration+="="; - declaration+=_dump_node_code(vdnode->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions); + declaration += "="; + declaration += _dump_node_code(vdnode->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions); } } - code+=declaration; + code += declaration; } break; case SL::Node::TYPE_VARIABLE: { SL::VariableNode *vnode = (SL::VariableNode *)p_node; @@ -623,7 +623,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener String left = _dump_node_code(cfnode->blocks[0], p_level, r_gen_code, p_actions, p_default_actions); String middle = _dump_node_code(cfnode->expressions[0], p_level, r_gen_code, p_actions, p_default_actions); String right = _dump_node_code(cfnode->expressions[1], p_level, r_gen_code, p_actions, p_default_actions); - code += _mktab(p_level) + "for (" +left+";"+middle+";"+right+")\n"; + code += _mktab(p_level) + "for (" + left + ";" + middle + ";" + right + ")\n"; code += _dump_node_code(cfnode->blocks[1], p_level + 1, r_gen_code, p_actions, p_default_actions); } else if (cfnode->flow_op == SL::FLOW_OP_RETURN) { diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 73268c1914..5f83033293 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -935,17 +935,26 @@ LIGHT_SHADER_CODE #elif defined(DIFFUSE_BURLEY) { - float NdotL = dot(L, N); - float NdotV = dot(N, V); - float VdotH = dot(N, normalize(L+V)); + + + vec3 H = normalize(V + L); + float NoL = max(0.0,dot(N, L)); + float VoH = max(0.0,dot(L, H)); + float NoV = max(0.0,dot(N, V)); + + float FD90 = 0.5 + 2.0 * VoH * VoH * roughness; + float FdV = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoV, 5.0 ); + float FdL = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoL, 5.0 ); + light_amount = ( (1.0 / M_PI) * FdV * FdL ); +/* float energyBias = mix(roughness, 0.0, 0.5); float energyFactor = mix(roughness, 1.0, 1.0 / 1.51); - float fd90 = energyBias + 2.0 * VdotH * VdotH * roughness; + float fd90 = energyBias + 2.0 * VoH * VoH * roughness; float f0 = 1.0; - float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NdotL, 5.0); - float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NdotV, 5.0); + float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NoL, 5.0); + float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NoV, 5.0); - light_amount = lightScatter * viewScatter * energyFactor; + light_amount = lightScatter * viewScatter * energyFactor;*/ } #else //lambert diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 1798c84d85..e4c8641a3b 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -31,23 +31,144 @@ #ifdef PULSEAUDIO_ENABLED -#include <pulse/error.h> +#include <pulse/pulseaudio.h> #include "os/os.h" #include "project_settings.h" +void pa_state_cb(pa_context *c, void *userdata) { + pa_context_state_t state; + int *pa_ready = (int *)userdata; + + state = pa_context_get_state(c); + switch (state) { + case PA_CONTEXT_FAILED: + case PA_CONTEXT_TERMINATED: + *pa_ready = 2; + break; + + case PA_CONTEXT_READY: + *pa_ready = 1; + break; + } +} + +void sink_info_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata) { + unsigned int *channels = (unsigned int *)userdata; + + // If eol is set to a positive number, you're at the end of the list + if (eol > 0) { + return; + } + + *channels = l->channel_map.channels; +} + +void server_info_cb(pa_context *c, const pa_server_info *i, void *userdata) { + char *default_output = (char *)userdata; + + strncpy(default_output, i->default_sink_name, 1024); +} + +static unsigned int detect_channels() { + + pa_mainloop *pa_ml; + pa_mainloop_api *pa_mlapi; + pa_operation *pa_op; + pa_context *pa_ctx; + + int state = 0; + int pa_ready = 0; + + char default_output[1024]; + unsigned int channels = 2; + + pa_ml = pa_mainloop_new(); + pa_mlapi = pa_mainloop_get_api(pa_ml); + pa_ctx = pa_context_new(pa_mlapi, "Godot"); + + int ret = pa_context_connect(pa_ctx, NULL, PA_CONTEXT_NOFLAGS, NULL); + if (ret < 0) { + pa_context_unref(pa_ctx); + pa_mainloop_free(pa_ml); + + return 2; + } + + pa_context_set_state_callback(pa_ctx, pa_state_cb, &pa_ready); + + // Wait until the pa server is ready + while (pa_ready == 0) { + pa_mainloop_iterate(pa_ml, 1, NULL); + } + + // Check if there was an error connecting to the pa server + if (pa_ready == 2) { + pa_context_disconnect(pa_ctx); + pa_context_unref(pa_ctx); + pa_mainloop_free(pa_ml); + + return 2; + } + + // Get the default output device name + pa_op = pa_context_get_server_info(pa_ctx, &server_info_cb, (void *)default_output); + if (pa_op) { + while (pa_operation_get_state(pa_op) == PA_OPERATION_RUNNING) { + ret = pa_mainloop_iterate(pa_ml, 1, NULL); + if (ret < 0) { + ERR_PRINT("pa_mainloop_iterate error"); + } + } + + pa_operation_unref(pa_op); + + // Now using the device name get the amount of channels + pa_op = pa_context_get_sink_info_by_name(pa_ctx, default_output, &sink_info_cb, (void *)&channels); + if (pa_op) { + while (pa_operation_get_state(pa_op) == PA_OPERATION_RUNNING) { + ret = pa_mainloop_iterate(pa_ml, 1, NULL); + if (ret < 0) { + ERR_PRINT("pa_mainloop_iterate error"); + } + } + + pa_operation_unref(pa_op); + } else { + ERR_PRINT("pa_context_get_sink_info_by_name error"); + } + } else { + ERR_PRINT("pa_context_get_server_info error"); + } + + pa_context_disconnect(pa_ctx); + pa_context_unref(pa_ctx); + pa_mainloop_free(pa_ml); + + return channels; +} + Error AudioDriverPulseAudio::init() { active = false; thread_exited = false; exit_thread = false; - pcm_open = false; - samples_in = NULL; - samples_out = NULL; mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE); - speaker_mode = SPEAKER_MODE_STEREO; - channels = 2; + channels = detect_channels(); + + switch (channels) { + case 2: // Stereo + case 4: // Surround 3.1 + case 6: // Surround 5.1 + case 8: // Surround 7.1 + break; + + default: + ERR_PRINTS("PulseAudio: Unsupported number of channels: " + itos(channels)); + ERR_FAIL_V(ERR_CANT_OPEN); + break; + } pa_sample_spec spec; spec.format = PA_SAMPLE_S16LE; @@ -59,7 +180,8 @@ Error AudioDriverPulseAudio::init() { buffer_size = buffer_frames * channels; if (OS::get_singleton()->is_stdout_verbose()) { - print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); + print_line("PulseAudio: detected " + itos(channels) + " channels"); + print_line("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); } pa_buffer_attr attr; @@ -86,8 +208,8 @@ Error AudioDriverPulseAudio::init() { ERR_FAIL_COND_V(pulse == NULL, ERR_CANT_OPEN); } - samples_in = memnew_arr(int32_t, buffer_size); - samples_out = memnew_arr(int16_t, buffer_size); + samples_in.resize(buffer_size); + samples_out.resize(buffer_size); mutex = Mutex::create(); thread = Thread::create(AudioDriverPulseAudio::thread_func, this); @@ -119,7 +241,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { } else { ad->lock(); - ad->audio_server_process(ad->buffer_frames, ad->samples_in); + ad->audio_server_process(ad->buffer_frames, ad->samples_in.ptr()); ad->unlock(); @@ -132,7 +254,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { int error_code; int byte_size = ad->buffer_size * sizeof(int16_t); - if (pa_simple_write(ad->pulse, ad->samples_out, byte_size, &error_code) < 0) { + if (pa_simple_write(ad->pulse, ad->samples_out.ptr(), byte_size, &error_code) < 0) { // can't recover here fprintf(stderr, "PulseAudio failed and can't recover: %s\n", pa_strerror(error_code)); ad->active = false; @@ -156,7 +278,7 @@ int AudioDriverPulseAudio::get_mix_rate() const { AudioDriver::SpeakerMode AudioDriverPulseAudio::get_speaker_mode() const { - return speaker_mode; + return get_speaker_mode_by_total_channels(channels); } void AudioDriverPulseAudio::lock() { @@ -186,16 +308,6 @@ void AudioDriverPulseAudio::finish() { pulse = NULL; } - if (samples_in) { - memdelete_arr(samples_in); - samples_in = NULL; - } - - if (samples_out) { - memdelete_arr(samples_out); - samples_out = NULL; - } - memdelete(thread); if (mutex) { memdelete(mutex); @@ -207,11 +319,21 @@ void AudioDriverPulseAudio::finish() { AudioDriverPulseAudio::AudioDriverPulseAudio() { - samples_in = NULL; - samples_out = NULL; mutex = NULL; thread = NULL; pulse = NULL; + + samples_in.clear(); + samples_out.clear(); + + mix_rate = 0; + buffer_size = 0; + channels = 0; + + active = false; + thread_exited = false; + exit_thread = false; + latency = 0; buffer_frames = 0; buffer_size = 0; diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h index 9ae0b7e50c..3ede684496 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.h +++ b/drivers/pulseaudio/audio_driver_pulseaudio.h @@ -43,14 +43,10 @@ class AudioDriverPulseAudio : public AudioDriver { pa_simple *pulse; - int32_t *samples_in; - int16_t *samples_out; - - static void thread_func(void *p_udata); + Vector<int32_t> samples_in; + Vector<int16_t> samples_out; unsigned int mix_rate; - SpeakerMode speaker_mode; - unsigned int buffer_frames; unsigned int buffer_size; int channels; @@ -58,10 +54,11 @@ class AudioDriverPulseAudio : public AudioDriver { bool active; bool thread_exited; mutable bool exit_thread; - bool pcm_open; float latency; + static void thread_func(void *p_udata); + public: const char *get_name() const { return "PulseAudio"; diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index ae5fdd28b6..a184c9e9cf 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -143,7 +143,7 @@ Error AudioDriverRtAudio::init() { } } - return OK; + return active ? OK : ERR_UNAVAILABLE; } int AudioDriverRtAudio::get_mix_rate() const { diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub index 5ced44dfda..c560e1289f 100644 --- a/drivers/unix/SCsub +++ b/drivers/unix/SCsub @@ -14,4 +14,6 @@ f.close() env.add_source_files(env.drivers_sources, "*.cpp") +env["check_c_headers"] = [ [ "mntent.h", "HAVE_MNTENT" ] ] + Export('env') diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 6b8038c3ef..e7054e11a3 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -35,10 +35,17 @@ #include <sys/statvfs.h> #endif +#include "core/list.h" #include "os/memory.h" #include "print_string.h" #include <errno.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_MNTENT +#include <mntent.h> +#endif DirAccess *DirAccessUnix::create_fs() { @@ -176,13 +183,96 @@ void DirAccessUnix::list_dir_end() { _cisdir = false; } +#if defined(HAVE_MNTENT) && defined(X11_ENABLED) +static bool _filter_drive(struct mntent *mnt) { + // Ignore devices that don't point to /dev + if (strncmp(mnt->mnt_fsname, "/dev", 4) != 0) { + return false; + } + + // Accept devices mounted at common locations + if (strncmp(mnt->mnt_dir, "/media", 6) == 0 || + strncmp(mnt->mnt_dir, "/mnt", 4) == 0 || + strncmp(mnt->mnt_dir, "/home", 5) == 0 || + strncmp(mnt->mnt_dir, "/run/media", 10) == 0) { + return true; + } + + // Ignore everything else + return false; +} +#endif + +static void _get_drives(List<String> *list) { + +#if defined(HAVE_MNTENT) && defined(X11_ENABLED) + // Check /etc/mtab for the list of mounted partitions + FILE *mtab = setmntent("/etc/mtab", "r"); + if (mtab) { + struct mntent mnt; + char strings[4096]; + + while (getmntent_r(mtab, &mnt, strings, sizeof(strings))) { + if (mnt.mnt_dir != NULL && _filter_drive(&mnt)) { + // Avoid duplicates + if (!list->find(mnt.mnt_dir)) { + list->push_back(mnt.mnt_dir); + } + } + } + + endmntent(mtab); + } +#endif + + // Add $HOME + const char *home = getenv("HOME"); + if (home) { + // Only add if it's not a duplicate + if (!list->find(home)) { + list->push_back(home); + } + + // Check $HOME/.config/gtk-3.0/bookmarks + char path[1024]; + snprintf(path, 1024, "%s/.config/gtk-3.0/bookmarks", home); + FILE *fd = fopen(path, "r"); + if (fd) { + char string[1024]; + while (fgets(string, 1024, fd)) { + // Parse only file:// links + if (strncmp(string, "file://", 7) == 0) { + // Strip any unwanted edges on the strings and push_back if it's not a duplicate + String fpath = String(string + 7).strip_edges(); + if (!list->find(fpath)) { + list->push_back(fpath); + } + } + } + + fclose(fd); + } + } + + list->sort(); +} + int DirAccessUnix::get_drive_count() { - return 0; + List<String> list; + _get_drives(&list); + + return list.size(); } + String DirAccessUnix::get_drive(int p_drive) { - return ""; + List<String> list; + _get_drives(&list); + + ERR_FAIL_INDEX_V(p_drive, list.size(), ""); + + return list[p_drive]; } Error DirAccessUnix::make_dir(String p_dir) { diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 80565c5b02..e19bc738cb 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -274,6 +274,15 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) { }; } +Error FileAccessUnix::_chmod(const String &p_path, int p_mod) { + int err = chmod(p_path.utf8().get_data(), p_mod); + if (!err) { + return OK; + } + + return FAILED; +} + FileAccess *FileAccessUnix::create_libc() { return memnew(FileAccessUnix); diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h index 6e5110431f..c5ab8821be 100644 --- a/drivers/unix/file_access_unix.h +++ b/drivers/unix/file_access_unix.h @@ -78,6 +78,8 @@ public: virtual uint64_t _get_modified_time(const String &p_file); + virtual Error _chmod(const String &p_path, int p_mod); + FileAccessUnix(); virtual ~FileAccessUnix(); }; diff --git a/drivers/unix/socket_helpers.h b/drivers/unix/socket_helpers.h index 3fc0144294..0995e5236f 100644 --- a/drivers/unix/socket_helpers.h +++ b/drivers/unix/socket_helpers.h @@ -64,7 +64,6 @@ static size_t _set_sockaddr(struct sockaddr_storage *p_addr, const IP_Address &p // IPv4 socket with IPv6 address ERR_FAIL_COND_V(!p_ip.is_ipv4(), 0); - uint32_t ipv4 = *((uint32_t *)p_ip.get_ipv4()); struct sockaddr_in *addr4 = (struct sockaddr_in *)p_addr; addr4->sin_family = AF_INET; addr4->sin_port = htons(p_port); // short, network byte order diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 29d1e5deed..eb86491dec 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -67,12 +67,13 @@ Error AudioDriverWASAPI::init_device() { switch (channels) { case 2: // Stereo + case 4: // Surround 3.1 case 6: // Surround 5.1 case 8: // Surround 7.1 break; default: - ERR_PRINT("WASAPI: Unsupported number of channels"); + ERR_PRINTS("WASAPI: Unsupported number of channels: " + itos(channels)); ERR_FAIL_V(ERR_CANT_OPEN); break; } @@ -119,7 +120,8 @@ Error AudioDriverWASAPI::init_device() { samples_in.resize(buffer_size); if (OS::get_singleton()->is_stdout_verbose()) { - print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); + print_line("WASAPI: detected " + itos(channels) + " channels"); + print_line("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); } return OK; @@ -185,7 +187,7 @@ int AudioDriverWASAPI::get_mix_rate() const { AudioDriver::SpeakerMode AudioDriverWASAPI::get_speaker_mode() const { - return SPEAKER_MODE_STEREO; + return get_speaker_mode_by_total_channels(channels); } void AudioDriverWASAPI::thread_func(void *p_udata) { |