summaryrefslogtreecommitdiff
path: root/scene/resources/audio_stream_sample.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/audio_stream_sample.h')
-rw-r--r--scene/resources/audio_stream_sample.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index 53e628c0e4..d5d1ae79c0 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -31,16 +31,15 @@
#include "servers/audio/audio_stream.h"
-
class AudioStreamSample;
class AudioStreamPlaybackSample : public AudioStreamPlayback {
- GDCLASS( AudioStreamPlaybackSample, AudioStreamPlayback )
+ GDCLASS(AudioStreamPlaybackSample, AudioStreamPlayback)
enum {
- MIX_FRAC_BITS=13,
- MIX_FRAC_LEN=(1<<MIX_FRAC_BITS),
- MIX_FRAC_MASK=MIX_FRAC_LEN-1,
+ MIX_FRAC_BITS = 13,
+ MIX_FRAC_LEN = (1 << MIX_FRAC_BITS),
+ MIX_FRAC_MASK = MIX_FRAC_LEN - 1,
};
struct IMA_ADPCM_State {
@@ -59,14 +58,14 @@ class AudioStreamPlaybackSample : public AudioStreamPlayback {
int64_t offset;
int sign;
bool active;
-friend class AudioStreamSample;
+ friend class AudioStreamSample;
Ref<AudioStreamSample> base;
- template<class Depth,bool is_stereo,bool is_ima_adpcm>
- void do_resample(const Depth* p_src, AudioFrame *p_dst,int64_t &offset,int32_t &increment,uint32_t amount,IMA_ADPCM_State *ima_adpcm);
-public:
+ template <class Depth, bool is_stereo, bool is_ima_adpcm>
+ void do_resample(const Depth *p_src, AudioFrame *p_dst, int64_t &offset, int32_t &increment, uint32_t amount, IMA_ADPCM_State *ima_adpcm);
- virtual void start(float p_from_pos=0.0);
+public:
+ virtual void start(float p_from_pos = 0.0);
virtual void stop();
virtual bool is_playing() const;
@@ -75,20 +74,18 @@ public:
virtual float get_pos() const;
virtual void seek_pos(float p_time);
- virtual void mix(AudioFrame* p_buffer,float p_rate_scale,int p_frames);
+ virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
virtual float get_length() const; //if supported, otherwise return 0
-
AudioStreamPlaybackSample();
};
class AudioStreamSample : public AudioStream {
- GDCLASS(AudioStreamSample,AudioStream)
+ GDCLASS(AudioStreamSample, AudioStream)
RES_BASE_EXTENSION("smp")
public:
-
enum Format {
FORMAT_8_BITS,
FORMAT_16_BITS,
@@ -101,12 +98,11 @@ public:
LOOP_PING_PONG
};
-
private:
-friend class AudioStreamPlaybackSample;
+ friend class AudioStreamPlaybackSample;
enum {
- DATA_PAD=16 //padding for interpolation
+ DATA_PAD = 16 //padding for interpolation
};
Format format;
@@ -117,9 +113,10 @@ friend class AudioStreamPlaybackSample;
int mix_rate;
void *data;
uint32_t data_bytes;
-protected:
+protected:
static void _bind_methods();
+
public:
void set_format(Format p_format);
Format get_format() const;
@@ -139,10 +136,9 @@ public:
void set_stereo(bool p_enable);
bool is_stereo() const;
- void set_data(const PoolVector<uint8_t>& p_data);
+ void set_data(const PoolVector<uint8_t> &p_data);
PoolVector<uint8_t> get_data() const;
-
virtual Ref<AudioStreamPlayback> instance_playback();
virtual String get_stream_name() const;