summaryrefslogtreecommitdiff
path: root/servers/audio_server.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio_server.h')
-rw-r--r--servers/audio_server.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 258fd1d9b0..2663a0f968 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -38,6 +38,8 @@
#include "variant.h"
class AudioDriverDummy;
+class AudioStream;
+class AudioStreamSample;
class AudioDriver {
@@ -51,8 +53,13 @@ class AudioDriver {
#endif
protected:
+ 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(); }
@@ -91,11 +98,21 @@ public:
virtual void unlock() = 0;
virtual void finish() = 0;
+ virtual Error capture_start() { return FAILED; }
+ virtual Error capture_stop() { return FAILED; }
+ virtual void capture_set_device(const String &p_name) {}
+ virtual String capture_get_device() { return "Default"; }
+ virtual Array capture_get_device_list(); // TODO: convert this and get_device_list to PoolStringArray
+
virtual float get_latency() { return 0; }
SpeakerMode get_speaker_mode_by_total_channels(int p_channels) const;
int get_total_channels_by_speaker_mode(SpeakerMode) const;
+ 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; }
void reset_profiling_time() { prof_time = 0; }
@@ -222,6 +239,18 @@ private:
void _mix_step();
+#if 0
+ struct AudioInBlock {
+
+ Ref<AudioStreamSample> audio_stream;
+ int current_position;
+ bool loops;
+ };
+
+ Map<StringName, AudioInBlock *> audio_in_block_map;
+ Vector<AudioInBlock *> audio_in_blocks;
+#endif
+
struct CallbackItem {
AudioCallback callback;
@@ -335,8 +364,11 @@ public:
String get_device();
void set_device(String device);
- float get_output_latency() { return output_latency; }
+ Array capture_get_device_list();
+ String capture_get_device();
+ void capture_set_device(const String &p_name);
+ float get_output_latency() { return output_latency; }
AudioServer();
virtual ~AudioServer();
};