|
@@ -49,7 +49,7 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fra
|
|
|
//end of file!
|
|
|
if (vorbis_stream->loop) {
|
|
|
//loop
|
|
|
- seek_pos(0);
|
|
|
+ seek_pos(vorbis_stream->loop_offset);
|
|
|
loops++;
|
|
|
} else {
|
|
|
for (int i = mixed; i < p_frames; i++) {
|
|
@@ -227,6 +227,14 @@ bool AudioStreamOGGVorbis::has_loop() const {
|
|
|
return loop;
|
|
|
}
|
|
|
|
|
|
+void AudioStreamOGGVorbis::set_loop_offset(float p_seconds) {
|
|
|
+ loop_offset = p_seconds;
|
|
|
+}
|
|
|
+
|
|
|
+float AudioStreamOGGVorbis::get_loop_offset() const {
|
|
|
+ return loop_offset;
|
|
|
+}
|
|
|
+
|
|
|
void AudioStreamOGGVorbis::_bind_methods() {
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamOGGVorbis::set_data);
|
|
@@ -235,8 +243,12 @@ void AudioStreamOGGVorbis::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOGGVorbis::set_loop);
|
|
|
ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOGGVorbis::has_loop);
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset);
|
|
|
+ ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset);
|
|
|
+
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop", "has_loop");
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop_offset", "get_loop_offset");
|
|
|
}
|
|
|
|
|
|
AudioStreamOGGVorbis::AudioStreamOGGVorbis() {
|
|
@@ -245,6 +257,7 @@ AudioStreamOGGVorbis::AudioStreamOGGVorbis() {
|
|
|
length = 0;
|
|
|
sample_rate = 1;
|
|
|
channels = 1;
|
|
|
+ loop_offset = 0;
|
|
|
decode_mem_size = 0;
|
|
|
loop = false;
|
|
|
}
|