summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp12
-rw-r--r--drivers/alsa/audio_driver_alsa.h12
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp15
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.h20
-rw-r--r--drivers/coremidi/midi_driver_coremidi.cpp4
-rw-r--r--drivers/coremidi/midi_driver_coremidi.h2
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp25
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.h36
-rw-r--r--drivers/unix/file_access_unix.cpp7
-rw-r--r--drivers/unix/file_access_unix.h8
-rw-r--r--drivers/unix/net_socket_posix.cpp4
-rw-r--r--drivers/unix/net_socket_posix.h4
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp20
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h51
-rw-r--r--drivers/windows/file_access_windows.cpp9
-rw-r--r--drivers/windows/file_access_windows.h15
-rw-r--r--drivers/windows/thread_windows.cpp7
-rw-r--r--drivers/windows/thread_windows.h6
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp8
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.h8
20 files changed, 89 insertions, 184 deletions
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 48e694dd3a..e394222d3a 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -331,14 +331,4 @@ void AudioDriverALSA::finish() {
finish_device();
}
-AudioDriverALSA::AudioDriverALSA() :
- thread(nullptr),
- pcm_handle(nullptr),
- device_name("Default"),
- new_device("Default") {
-}
-
-AudioDriverALSA::~AudioDriverALSA() {
-}
-
-#endif
+#endif // ALSA_ENABLED
diff --git a/drivers/alsa/audio_driver_alsa.h b/drivers/alsa/audio_driver_alsa.h
index 50bd9e853d..d437993901 100644
--- a/drivers/alsa/audio_driver_alsa.h
+++ b/drivers/alsa/audio_driver_alsa.h
@@ -41,13 +41,13 @@
class AudioDriverALSA : public AudioDriver {
- Thread *thread;
+ Thread *thread = nullptr;
Mutex mutex;
- snd_pcm_t *pcm_handle;
+ snd_pcm_t *pcm_handle = nullptr;
- String device_name;
- String new_device;
+ String device_name = "Default";
+ String new_device = "Default";
Vector<int32_t> samples_in;
Vector<int16_t> samples_out;
@@ -85,8 +85,8 @@ public:
virtual void unlock();
virtual void finish();
- AudioDriverALSA();
- ~AudioDriverALSA();
+ AudioDriverALSA() {}
+ ~AudioDriverALSA() {}
};
#endif // AUDIO_DRIVER_ALSA_H
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 21c3649445..76d2d13dfe 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -676,19 +676,8 @@ String AudioDriverCoreAudio::capture_get_device() {
#endif
-AudioDriverCoreAudio::AudioDriverCoreAudio() :
- audio_unit(nullptr),
- input_unit(nullptr),
- active(false),
- device_name("Default"),
- capture_device_name("Default"),
- mix_rate(0),
- channels(2),
- capture_channels(2),
- buffer_frames(0) {
+AudioDriverCoreAudio::AudioDriverCoreAudio() {
samples_in.clear();
}
-AudioDriverCoreAudio::~AudioDriverCoreAudio(){};
-
-#endif
+#endif // COREAUDIO_ENABLED
diff --git a/drivers/coreaudio/audio_driver_coreaudio.h b/drivers/coreaudio/audio_driver_coreaudio.h
index fb9473e230..89dd52181f 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.h
+++ b/drivers/coreaudio/audio_driver_coreaudio.h
@@ -42,19 +42,19 @@
class AudioDriverCoreAudio : public AudioDriver {
- AudioComponentInstance audio_unit;
- AudioComponentInstance input_unit;
+ AudioComponentInstance audio_unit = nullptr;
+ AudioComponentInstance input_unit = nullptr;
- bool active;
+ bool active = false;
Mutex mutex;
- String device_name;
- String capture_device_name;
+ String device_name = "Default";
+ String capture_device_name = "Default";
- int mix_rate;
- unsigned int channels;
- unsigned int capture_channels;
- unsigned int buffer_frames;
+ int mix_rate = 0;
+ unsigned int channels = 2;
+ unsigned int capture_channels = 2;
+ unsigned int buffer_frames = 0;
Vector<int32_t> samples_in;
Vector<int16_t> input_buf;
@@ -118,7 +118,7 @@ public:
#endif
AudioDriverCoreAudio();
- ~AudioDriverCoreAudio();
+ ~AudioDriverCoreAudio() {}
};
#endif
diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp
index 2cd322813b..f155b4accc 100644
--- a/drivers/coremidi/midi_driver_coremidi.cpp
+++ b/drivers/coremidi/midi_driver_coremidi.cpp
@@ -112,9 +112,7 @@ PackedStringArray MIDIDriverCoreMidi::get_connected_inputs() {
return list;
}
-MIDIDriverCoreMidi::MIDIDriverCoreMidi() :
- client(0) {
-}
+MIDIDriverCoreMidi::MIDIDriverCoreMidi() {}
MIDIDriverCoreMidi::~MIDIDriverCoreMidi() {
close();
diff --git a/drivers/coremidi/midi_driver_coremidi.h b/drivers/coremidi/midi_driver_coremidi.h
index e8b4481c20..68de7a11fb 100644
--- a/drivers/coremidi/midi_driver_coremidi.h
+++ b/drivers/coremidi/midi_driver_coremidi.h
@@ -41,7 +41,7 @@
class MIDIDriverCoreMidi : public MIDIDriver {
- MIDIClientRef client;
+ MIDIClientRef client = 0;
MIDIPortRef port_in;
Vector<MIDIEndpointRef> connected_sources;
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 8a47f6cf96..b16408f727 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -793,30 +793,9 @@ String AudioDriverPulseAudio::capture_get_device() {
return name;
}
-AudioDriverPulseAudio::AudioDriverPulseAudio() :
- thread(nullptr),
- pa_ml(nullptr),
- pa_ctx(nullptr),
- pa_str(nullptr),
- pa_rec_str(nullptr),
- device_name("Default"),
- new_device("Default"),
- default_device(""),
- mix_rate(0),
- buffer_frames(0),
- pa_buffer_size(0),
- channels(0),
- pa_ready(0),
- pa_status(0),
- active(false),
- thread_exited(false),
- exit_thread(false),
- latency(0) {
+AudioDriverPulseAudio::AudioDriverPulseAudio() {
samples_in.clear();
samples_out.clear();
}
-AudioDriverPulseAudio::~AudioDriverPulseAudio() {
-}
-
-#endif
+#endif // PULSEAUDIO_ENABLED
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h
index 1ece332a8a..ab55a15076 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.h
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.h
@@ -41,18 +41,18 @@
class AudioDriverPulseAudio : public AudioDriver {
- Thread *thread;
+ Thread *thread = nullptr;
Mutex mutex;
- pa_mainloop *pa_ml;
- pa_context *pa_ctx;
- pa_stream *pa_str;
- pa_stream *pa_rec_str;
+ pa_mainloop *pa_ml = nullptr;
+ pa_context *pa_ctx = nullptr;
+ pa_stream *pa_str = nullptr;
+ pa_stream *pa_rec_str = nullptr;
pa_channel_map pa_map;
pa_channel_map pa_rec_map;
- String device_name;
- String new_device;
+ String device_name = "Default";
+ String new_device = "Default";
String default_device;
String capture_device_name;
@@ -62,20 +62,20 @@ class AudioDriverPulseAudio : public AudioDriver {
Vector<int32_t> samples_in;
Vector<int16_t> samples_out;
- unsigned int mix_rate;
- unsigned int buffer_frames;
- unsigned int pa_buffer_size;
- int channels;
- int pa_ready;
- int pa_status;
+ unsigned int mix_rate = 0;
+ unsigned int buffer_frames = 0;
+ unsigned int pa_buffer_size = 0;
+ int channels = 0;
+ int pa_ready = 0;
+ int pa_status = 0;
Array pa_devices;
Array pa_rec_devices;
- bool active;
- bool thread_exited;
- mutable bool exit_thread;
+ bool active = false;
+ bool thread_exited = false;
+ mutable bool exit_thread = false;
- float latency;
+ float latency = 0;
static void pa_state_cb(pa_context *c, void *userdata);
static void pa_sink_info_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata);
@@ -122,7 +122,7 @@ public:
virtual Error capture_stop();
AudioDriverPulseAudio();
- ~AudioDriverPulseAudio();
+ ~AudioDriverPulseAudio() {}
};
#endif // AUDIO_DRIVER_PULSEAUDIO_H
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 4aa408a1f0..54a585c6fd 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -354,14 +354,7 @@ FileAccess *FileAccessUnix::create_libc() {
CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
-FileAccessUnix::FileAccessUnix() :
- f(nullptr),
- flags(0),
- last_error(OK) {
-}
-
FileAccessUnix::~FileAccessUnix() {
-
close();
}
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 8116f72345..1dd080914d 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -42,10 +42,10 @@ typedef void (*CloseNotificationFunc)(const String &p_file, int p_flags);
class FileAccessUnix : public FileAccess {
- FILE *f;
- int flags;
+ FILE *f = nullptr;
+ int flags = 0;
void check_errors() const;
- mutable Error last_error;
+ mutable Error last_error = OK;
String save_path;
String path;
String path_src;
@@ -84,7 +84,7 @@ public:
virtual uint32_t _get_unix_permissions(const String &p_file);
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
- FileAccessUnix();
+ FileAccessUnix() {}
virtual ~FileAccessUnix();
};
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index 7c6543c3a2..81ea20e5da 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -173,9 +173,7 @@ void NetSocketPosix::cleanup() {
}
NetSocketPosix::NetSocketPosix() :
- _sock(SOCK_EMPTY),
- _ip_type(IP::TYPE_NONE),
- _is_stream(false) {
+ _sock(SOCK_EMPTY) {
}
NetSocketPosix::~NetSocketPosix() {
diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h
index 0a19967265..2e767eef92 100644
--- a/drivers/unix/net_socket_posix.h
+++ b/drivers/unix/net_socket_posix.h
@@ -48,8 +48,8 @@ class NetSocketPosix : public NetSocket {
private:
SOCKET_TYPE _sock;
- IP::Type _ip_type;
- bool _is_stream;
+ IP::Type _ip_type = IP::TYPE_NONE;
+ bool _is_stream = false;
enum NetError {
ERR_NET_WOULD_BLOCK,
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index ab2976f02c..1fc01ce76e 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -69,13 +69,11 @@ static bool default_render_device_changed = false;
static bool default_capture_device_changed = false;
class CMMNotificationClient : public IMMNotificationClient {
- LONG _cRef;
- IMMDeviceEnumerator *_pEnumerator;
+ LONG _cRef = 1;
+ IMMDeviceEnumerator *_pEnumerator = nullptr;
public:
- CMMNotificationClient() :
- _cRef(1),
- _pEnumerator(nullptr) {}
+ CMMNotificationClient() {}
virtual ~CMMNotificationClient() {
if ((_pEnumerator) != nullptr) {
(_pEnumerator)->Release();
@@ -854,17 +852,7 @@ String AudioDriverWASAPI::capture_get_device() {
}
AudioDriverWASAPI::AudioDriverWASAPI() {
-
- thread = nullptr;
-
samples_in.clear();
-
- channels = 0;
- mix_rate = 0;
- buffer_frames = 0;
-
- thread_exited = false;
- exit_thread = false;
}
-#endif
+#endif // WASAPI_ENABLED
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index 01a4666812..2fcf8936fa 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -45,47 +45,36 @@ class AudioDriverWASAPI : public AudioDriver {
class AudioDeviceWASAPI {
public:
- IAudioClient *audio_client;
- IAudioRenderClient *render_client;
- IAudioCaptureClient *capture_client;
- bool active;
-
- WORD format_tag;
- WORD bits_per_sample;
- unsigned int channels;
- unsigned int frame_size;
-
- String device_name;
- String new_device;
-
- AudioDeviceWASAPI() :
- audio_client(nullptr),
- render_client(nullptr),
- capture_client(nullptr),
- active(false),
- format_tag(0),
- bits_per_sample(0),
- channels(0),
- frame_size(0),
- device_name("Default"),
- new_device("Default") {
- }
+ IAudioClient *audio_client = nullptr;
+ IAudioRenderClient *render_client = nullptr;
+ IAudioCaptureClient *capture_client = nullptr;
+ bool active = false;
+
+ WORD format_tag = 0;
+ WORD bits_per_sample = 0;
+ unsigned int channels = 0;
+ unsigned int frame_size = 0;
+
+ String device_name = "Default";
+ String new_device = "Default";
+
+ AudioDeviceWASAPI() {}
};
AudioDeviceWASAPI audio_input;
AudioDeviceWASAPI audio_output;
Mutex mutex;
- Thread *thread;
+ Thread *thread = nullptr;
Vector<int32_t> samples_in;
- unsigned int channels;
- int mix_rate;
- int buffer_frames;
+ unsigned int channels = 0;
+ int mix_rate = 0;
+ int buffer_frames = 0;
- bool thread_exited;
- mutable bool exit_thread;
+ bool thread_exited = false;
+ mutable bool exit_thread = false;
static _FORCE_INLINE_ void write_sample(WORD format_tag, int bits_per_sample, BYTE *buffer, int i, int32_t sample);
static _FORCE_INLINE_ int32_t read_sample(WORD format_tag, int bits_per_sample, BYTE *buffer, int i);
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 69078b3326..f1326abb7b 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -353,15 +353,8 @@ Error FileAccessWindows::_set_unix_permissions(const String &p_file, uint32_t p_
return ERR_UNAVAILABLE;
}
-FileAccessWindows::FileAccessWindows() :
- f(nullptr),
- flags(0),
- prev_op(0),
- last_error(OK) {
-}
FileAccessWindows::~FileAccessWindows() {
-
close();
}
-#endif
+#endif // WINDOWS_ENABLED
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 28d4375878..34a7e400a0 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -40,11 +40,11 @@
class FileAccessWindows : public FileAccess {
- FILE *f;
- int flags;
+ FILE *f = nullptr;
+ int flags = 0;
void check_errors() const;
- mutable int prev_op;
- mutable Error last_error;
+ mutable int prev_op = 0;
+ mutable Error last_error = OK;
String path;
String path_src;
String save_path;
@@ -79,9 +79,10 @@ public:
virtual uint32_t _get_unix_permissions(const String &p_file);
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
- FileAccessWindows();
+ FileAccessWindows() {}
virtual ~FileAccessWindows();
};
-#endif
-#endif
+#endif // WINDOWS_ENABLED
+
+#endif // FILE_ACCESS_WINDOWS_H
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index aea2db2603..c36437d891 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -90,11 +90,4 @@ void ThreadWindows::make_default() {
wait_to_finish_func = wait_to_finish_func_windows;
}
-ThreadWindows::ThreadWindows() :
- handle(nullptr) {
-}
-
-ThreadWindows::~ThreadWindows() {
-}
-
#endif
diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h
index 669956cd32..93de4c6e8c 100644
--- a/drivers/windows/thread_windows.h
+++ b/drivers/windows/thread_windows.h
@@ -43,7 +43,7 @@ class ThreadWindows : public Thread {
ThreadCreateCallback callback;
void *user;
ID id;
- HANDLE handle;
+ HANDLE handle = nullptr;
static Thread *create_thread_windows();
@@ -53,14 +53,14 @@ class ThreadWindows : public Thread {
static ID get_thread_id_func_windows();
static void wait_to_finish_func_windows(Thread *p_thread);
- ThreadWindows();
+ ThreadWindows() {}
public:
virtual ID get_id() const;
static void make_default();
- ~ThreadWindows();
+ ~ThreadWindows() {}
};
#endif
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index 120bfa2b36..d12ebf8d94 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -196,15 +196,9 @@ void AudioDriverXAudio2::finish() {
thread = nullptr;
}
-AudioDriverXAudio2::AudioDriverXAudio2() :
- thread(nullptr),
- current_buffer(0) {
- wave_format = { 0 };
+AudioDriverXAudio2::AudioDriverXAudio2() {
for (int i = 0; i < AUDIO_BUFFERS; i++) {
xaudio_buffer[i] = { 0 };
samples_out[i] = 0;
}
}
-
-AudioDriverXAudio2::~AudioDriverXAudio2() {
-}
diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h
index eb4a6d6e95..9182fa4172 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.h
+++ b/drivers/xaudio2/audio_driver_xaudio2.h
@@ -64,7 +64,7 @@ class AudioDriverXAudio2 : public AudioDriver {
void STDMETHODCALLTYPE OnVoiceError(void *pBufferContext, HRESULT Error) {}
};
- Thread *thread;
+ Thread *thread = nullptr;
Mutex mutex;
int32_t *samples_in;
@@ -83,9 +83,9 @@ class AudioDriverXAudio2 : public AudioDriver {
mutable bool exit_thread;
bool pcm_open;
- WAVEFORMATEX wave_format;
+ WAVEFORMATEX wave_format = { 0 };
Microsoft::WRL::ComPtr<IXAudio2> xaudio;
- int current_buffer;
+ int current_buffer = 0;
IXAudio2MasteringVoice *mastering_voice;
XAUDIO2_BUFFER xaudio_buffer[AUDIO_BUFFERS];
IXAudio2SourceVoice *source_voice;
@@ -104,7 +104,7 @@ public:
virtual void finish();
AudioDriverXAudio2();
- ~AudioDriverXAudio2();
+ ~AudioDriverXAudio2() {}
};
#endif