aboutsummaryrefslogtreecommitdiff
path: root/raylib/src/external/qoaplay.c
diff options
context:
space:
mode:
authorUneven Prankster <unevenprankster@protonmail.com>2023-11-16 21:12:27 -0300
committerUneven Prankster <unevenprankster@protonmail.com>2023-11-16 21:12:27 -0300
commit2bbf92ad5ae7708bf18ac7ef333e9a979d8d1bde (patch)
treec9d22bb0d73d9cc0c8586e4d31c93a561ea8e910 /raylib/src/external/qoaplay.c
parent1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 (diff)
Working so hard like a soldiermain
Can't afford a thing on TV
Diffstat (limited to 'raylib/src/external/qoaplay.c')
-rw-r--r--raylib/src/external/qoaplay.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/raylib/src/external/qoaplay.c b/raylib/src/external/qoaplay.c
index 7f937f4..cc4d8c6 100644
--- a/raylib/src/external/qoaplay.c
+++ b/raylib/src/external/qoaplay.c
@@ -36,7 +36,7 @@
// QOA streaming data descriptor
typedef struct {
qoa_desc info; // QOA descriptor data
-
+
FILE *file; // QOA file to read, if NULL, using memory buffer -> file_data
unsigned char *file_data; // QOA file data on memory
unsigned int file_data_size; // QOA file data on memory size
@@ -68,7 +68,7 @@ void qoaplay_close(qoaplay_desc *qoa_ctx);
void qoaplay_rewind(qoaplay_desc *qoa_ctx);
void qoaplay_seek_frame(qoaplay_desc *qoa_ctx, int frame);
-unsigned int qoaplay_decode(qoaplay_desc *qoa_ctx, float *sample_data, int num_samples);
+unsigned int qoaplay_decode(qoaplay_desc *qoa_ctx, float *sample_data, int num_samples, int loop_point);
unsigned int qoaplay_decode_frame(qoaplay_desc *qoa_ctx);
double qoaplay_get_duration(qoaplay_desc *qoa_ctx);
double qoaplay_get_time(qoaplay_desc *qoa_ctx);
@@ -107,7 +107,7 @@ qoaplay_desc *qoaplay_open(const char *path)
unsigned int sample_data_size = qoa.channels*QOA_FRAME_LEN*sizeof(short)*2;
qoaplay_desc *qoa_ctx = QOA_MALLOC(sizeof(qoaplay_desc) + buffer_size + sample_data_size);
memset(qoa_ctx, 0, sizeof(qoaplay_desc));
-
+
qoa_ctx->file = file;
qoa_ctx->file_data = NULL;
qoa_ctx->file_data_size = 0;
@@ -209,7 +209,7 @@ void qoaplay_rewind(qoaplay_desc *qoa_ctx)
}
// Decode required QOA frames
-unsigned int qoaplay_decode(qoaplay_desc *qoa_ctx, float *sample_data, int num_samples)
+unsigned int qoaplay_decode(qoaplay_desc *qoa_ctx, float *sample_data, int num_samples, int loop_point)
{
int src_index = qoa_ctx->sample_data_pos*qoa_ctx->info.channels;
int dst_index = 0;
@@ -222,7 +222,8 @@ unsigned int qoaplay_decode(qoaplay_desc *qoa_ctx, float *sample_data, int num_s
if (!qoaplay_decode_frame(qoa_ctx))
{
// Loop to the beginning
- qoaplay_rewind(qoa_ctx);
+ //qoaplay_rewind(qoa_ctx);
+ qoaplay_seek_frame(qoa_ctx, loop_point);
qoaplay_decode_frame(qoa_ctx);
}