Experimental microphone support.
This commit is contained in:
parent
6afabc0335
commit
f85062495c
23 changed files with 1058 additions and 27 deletions
|
|
@ -94,6 +94,66 @@ public:
|
|||
virtual float get_length() const = 0; //if supported, otherwise return 0
|
||||
};
|
||||
|
||||
// Microphone
|
||||
|
||||
class AudioStreamPlaybackMicrophone;
|
||||
|
||||
class AudioStreamMicrophone : public AudioStream {
|
||||
|
||||
GDCLASS(AudioStreamMicrophone, AudioStream)
|
||||
friend class AudioStreamPlaybackMicrophone;
|
||||
|
||||
Set<AudioStreamPlaybackMicrophone *> playbacks;
|
||||
StringName microphone_name;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Ref<AudioStreamPlayback> instance_playback();
|
||||
virtual String get_stream_name() const;
|
||||
|
||||
void set_microphone_name(const String &p_name);
|
||||
StringName get_microphone_name() const;
|
||||
|
||||
virtual float get_length() const; //if supported, otherwise return 0
|
||||
|
||||
AudioStreamMicrophone();
|
||||
};
|
||||
|
||||
class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
|
||||
|
||||
GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback)
|
||||
friend class AudioStreamMicrophone;
|
||||
|
||||
bool active;
|
||||
uint64_t internal_mic_offset;
|
||||
|
||||
Ref<AudioStreamMicrophone> microphone;
|
||||
AudioDriver::MicrophoneReciever *reciever;
|
||||
|
||||
protected:
|
||||
virtual void _mix_internal(AudioFrame *p_buffer, int p_frames);
|
||||
virtual float get_stream_sampling_rate();
|
||||
|
||||
public:
|
||||
virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
|
||||
|
||||
virtual void start(float p_from_pos = 0.0);
|
||||
virtual void stop();
|
||||
virtual bool is_playing() const;
|
||||
|
||||
virtual int get_loop_count() const; //times it looped
|
||||
|
||||
virtual float get_playback_position() const;
|
||||
virtual void seek(float p_time);
|
||||
|
||||
~AudioStreamPlaybackMicrophone();
|
||||
AudioStreamPlaybackMicrophone();
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
class AudioStreamPlaybackRandomPitch;
|
||||
|
||||
class AudioStreamRandomPitch : public AudioStream {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue