summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDave Palais <active.hat0408@fastmail.com>2022-09-22 08:54:15 -0500
committerGenei Shouko <date.aa2@gmail.com>2022-09-26 13:52:54 -0500
commit0c46068af0e9f077d3d68fe1dc647f99a55d7824 (patch)
treefce4c5b0e3ed2770386baa9468e714b71722468b /modules
parent8e14f9ba21725a9445f3979742f2fc87c8a7b463 (diff)
Change time parameters and variables to double type
Addresses #65313
Diffstat (limited to 'modules')
-rw-r--r--modules/minimp3/audio_stream_mp3.cpp14
-rw-r--r--modules/minimp3/audio_stream_mp3.h12
-rw-r--r--modules/theora/video_stream_theora.cpp12
-rw-r--r--modules/theora/video_stream_theora.h10
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp14
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h12
6 files changed, 37 insertions, 37 deletions
diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp
index 98bcdea8f4..acb92b25e1 100644
--- a/modules/minimp3/audio_stream_mp3.cpp
+++ b/modules/minimp3/audio_stream_mp3.cpp
@@ -104,7 +104,7 @@ float AudioStreamPlaybackMP3::get_stream_sampling_rate() {
return mp3_stream->sample_rate;
}
-void AudioStreamPlaybackMP3::start(float p_from_pos) {
+void AudioStreamPlaybackMP3::start(double p_from_pos) {
active = true;
seek(p_from_pos);
loops = 0;
@@ -123,11 +123,11 @@ int AudioStreamPlaybackMP3::get_loop_count() const {
return loops;
}
-float AudioStreamPlaybackMP3::get_playback_position() const {
- return float(frames_mixed) / mp3_stream->sample_rate;
+double AudioStreamPlaybackMP3::get_playback_position() const {
+ return double(frames_mixed) / mp3_stream->sample_rate;
}
-void AudioStreamPlaybackMP3::seek(float p_time) {
+void AudioStreamPlaybackMP3::seek(double p_time) {
if (!active) {
return;
}
@@ -217,15 +217,15 @@ bool AudioStreamMP3::has_loop() const {
return loop;
}
-void AudioStreamMP3::set_loop_offset(float p_seconds) {
+void AudioStreamMP3::set_loop_offset(double p_seconds) {
loop_offset = p_seconds;
}
-float AudioStreamMP3::get_loop_offset() const {
+double AudioStreamMP3::get_loop_offset() const {
return loop_offset;
}
-float AudioStreamMP3::get_length() const {
+double AudioStreamMP3::get_length() const {
return length;
}
diff --git a/modules/minimp3/audio_stream_mp3.h b/modules/minimp3/audio_stream_mp3.h
index 428ac1240e..c34c1dc5fa 100644
--- a/modules/minimp3/audio_stream_mp3.h
+++ b/modules/minimp3/audio_stream_mp3.h
@@ -61,14 +61,14 @@ protected:
virtual float get_stream_sampling_rate() override;
public:
- virtual void start(float p_from_pos = 0.0) override;
+ virtual void start(double p_from_pos = 0.0) override;
virtual void stop() override;
virtual bool is_playing() const override;
virtual int get_loop_count() const override; //times it looped
- virtual float get_playback_position() const override;
- virtual void seek(float p_time) override;
+ virtual double get_playback_position() const override;
+ virtual void seek(double p_time) override;
virtual void tag_used_streams() override;
@@ -104,8 +104,8 @@ public:
void set_loop(bool p_enable);
virtual bool has_loop() const override;
- void set_loop_offset(float p_seconds);
- float get_loop_offset() const;
+ void set_loop_offset(double p_seconds);
+ double get_loop_offset() const;
void set_bpm(double p_bpm);
virtual double get_bpm() const override;
@@ -122,7 +122,7 @@ public:
void set_data(const Vector<uint8_t> &p_data);
Vector<uint8_t> get_data() const;
- virtual float get_length() const override;
+ virtual double get_length() const override;
virtual bool is_monophonic() const override;
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index c4462ba687..cbeb073ee5 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -357,7 +357,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
audio_frames_wrote = 0;
};
-float VideoStreamPlaybackTheora::get_time() const {
+double VideoStreamPlaybackTheora::get_time() const {
// FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
// systematically return 0. Now that it gives a proper latency, it broke this
// code where the delay compensation likely never really worked.
@@ -368,7 +368,7 @@ Ref<Texture2D> VideoStreamPlaybackTheora::get_texture() const {
return texture;
}
-void VideoStreamPlaybackTheora::update(float p_delta) {
+void VideoStreamPlaybackTheora::update(double p_delta) {
if (file.is_null()) {
return;
}
@@ -529,7 +529,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
//printf("frame at %f not ready (time %f), ready %i\n", (float)videobuf_time, get_time(), videobuf_ready);
}
- float tdiff = videobuf_time - get_time();
+ double tdiff = videobuf_time - get_time();
/*If we have lots of extra time, increase the post-processing level.*/
if (tdiff > ti.fps_denominator * 0.25 / ti.fps_numerator) {
pp_inc = pp_level < pp_level_max ? 1 : 0;
@@ -581,7 +581,7 @@ bool VideoStreamPlaybackTheora::has_loop() const {
return false;
};
-float VideoStreamPlaybackTheora::get_length() const {
+double VideoStreamPlaybackTheora::get_length() const {
return 0;
};
@@ -593,11 +593,11 @@ int VideoStreamPlaybackTheora::get_loop_count() const {
return 0;
};
-float VideoStreamPlaybackTheora::get_playback_position() const {
+double VideoStreamPlaybackTheora::get_playback_position() const {
return get_time();
};
-void VideoStreamPlaybackTheora::seek(float p_time) {
+void VideoStreamPlaybackTheora::seek(double p_time) {
WARN_PRINT_ONCE("Seeking in Theora videos is not implemented yet (it's only supported for GDExtension-provided video streams).");
}
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 00d799dc24..3efb653651 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -64,7 +64,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
int buffer_data();
int queue_page(ogg_page *page);
void video_write();
- float get_time() const;
+ double get_time() const;
bool theora_eos = false;
bool vorbis_eos = false;
@@ -136,19 +136,19 @@ public:
virtual void set_loop(bool p_enable) override;
virtual bool has_loop() const override;
- virtual float get_length() const override;
+ virtual double get_length() const override;
virtual String get_stream_name() const;
virtual int get_loop_count() const;
- virtual float get_playback_position() const override;
- virtual void seek(float p_time) override;
+ virtual double get_playback_position() const override;
+ virtual void seek(double p_time) override;
void set_file(const String &p_file);
virtual Ref<Texture2D> get_texture() const override;
- virtual void update(float p_delta) override;
+ virtual void update(double p_delta) override;
virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata) override;
virtual int get_channels() const override;
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 8315eea614..bd220df104 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -223,7 +223,7 @@ bool AudioStreamPlaybackOggVorbis::_alloc_vorbis() {
return true;
}
-void AudioStreamPlaybackOggVorbis::start(float p_from_pos) {
+void AudioStreamPlaybackOggVorbis::start(double p_from_pos) {
ERR_FAIL_COND(!ready);
loop_fade_remaining = FADE_SIZE;
active = true;
@@ -244,15 +244,15 @@ int AudioStreamPlaybackOggVorbis::get_loop_count() const {
return loops;
}
-float AudioStreamPlaybackOggVorbis::get_playback_position() const {
- return float(frames_mixed) / vorbis_data->get_sampling_rate();
+double AudioStreamPlaybackOggVorbis::get_playback_position() const {
+ return double(frames_mixed) / (double)vorbis_data->get_sampling_rate();
}
void AudioStreamPlaybackOggVorbis::tag_used_streams() {
vorbis_stream->tag_used(get_playback_position());
}
-void AudioStreamPlaybackOggVorbis::seek(float p_time) {
+void AudioStreamPlaybackOggVorbis::seek(double p_time) {
ERR_FAIL_COND(!ready);
ERR_FAIL_COND(vorbis_stream.is_null());
if (!active) {
@@ -462,15 +462,15 @@ bool AudioStreamOggVorbis::has_loop() const {
return loop;
}
-void AudioStreamOggVorbis::set_loop_offset(float p_seconds) {
+void AudioStreamOggVorbis::set_loop_offset(double p_seconds) {
loop_offset = p_seconds;
}
-float AudioStreamOggVorbis::get_loop_offset() const {
+double AudioStreamOggVorbis::get_loop_offset() const {
return loop_offset;
}
-float AudioStreamOggVorbis::get_length() const {
+double AudioStreamOggVorbis::get_length() const {
ERR_FAIL_COND_V(packet_sequence.is_null(), 0);
return packet_sequence->get_length();
}
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 0350e1f761..3aa99971be 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -83,14 +83,14 @@ protected:
virtual float get_stream_sampling_rate() override;
public:
- virtual void start(float p_from_pos = 0.0) override;
+ virtual void start(double p_from_pos = 0.0) override;
virtual void stop() override;
virtual bool is_playing() const override;
virtual int get_loop_count() const override; //times it looped
- virtual float get_playback_position() const override;
- virtual void seek(float p_time) override;
+ virtual double get_playback_position() const override;
+ virtual void seek(double p_time) override;
virtual void tag_used_streams() override;
@@ -127,8 +127,8 @@ public:
void set_loop(bool p_enable);
virtual bool has_loop() const override;
- void set_loop_offset(float p_seconds);
- float get_loop_offset() const;
+ void set_loop_offset(double p_seconds);
+ double get_loop_offset() const;
void set_bpm(double p_bpm);
virtual double get_bpm() const override;
@@ -145,7 +145,7 @@ public:
void set_packet_sequence(Ref<OggPacketSequence> p_packet_sequence);
Ref<OggPacketSequence> get_packet_sequence() const;
- virtual float get_length() const override; //if supported, otherwise return 0
+ virtual double get_length() const override; //if supported, otherwise return 0
virtual bool is_monophonic() const override;