Skip to content

Commit

Permalink
Use raw indices for cue files
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanreg committed Sep 16, 2023
1 parent fb54b06 commit 575f097
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cue_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void cyanrip_cue_track(cyanrip_ctx *ctx, cyanrip_track *t)
t->dropped_pregap_start == CDIO_INVALID_LSN &&
t->merged_pregap_end == CDIO_INVALID_LSN) {
for (int Z = 0; Z < ctx->settings.outputs_num; Z++)
fprintf(ctx->cuefile[Z], " TRACK %02d AUDIO\n", t->number);
fprintf(ctx->cuefile[Z], " TRACK %02d AUDIO\n", t->index);

CLOG(" TITLE \"%s\"\n", t->meta, "title");
CLOG(" PERFORMER \"%s\"\n", t->meta, "artist");
Expand Down
4 changes: 3 additions & 1 deletion src/cyanrip_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static int cyanrip_ctx_init(cyanrip_ctx **s, cyanrip_settings *settings)
for (int i = 0; i < ctx->nb_cd_tracks; i++) {
cyanrip_track *t = &ctx->tracks[i];

t->index = i + 1;
t->number = t->cd_track_number = i + first_track_nb;
t->track_is_data = !cdio_cddap_track_audiop(ctx->drive, t->number);
t->pregap_lsn = cdio_get_track_pregap_lsn(ctx->cdio, t->number);
Expand Down Expand Up @@ -1006,10 +1007,11 @@ static void setup_track_offsets_and_report(cyanrip_ctx *ctx)
setup_track_lsn(ctx, t);
}

/* Setup next/previous pointers */
/* Setup next/previous pointers and redo track indices */
for (int i = 0; i < ctx->nb_tracks; i++) {
cyanrip_track *t = &ctx->tracks[i];

t->index = i + 1;
t->pt = i ? &ctx->tracks[i - 1] : NULL;
t->nt = i != (ctx->nb_tracks - 1) ? &ctx->tracks[i + 1] : NULL;
}
Expand Down
1 change: 1 addition & 0 deletions src/cyanrip_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ typedef struct cyanrip_track {
int cd_track_number; /* Actual track on the CD, may be 0 */
AVDictionary *meta; /* Disc's AVDictionary gets copied here */
int total_repeats; /* How many times the track was re-ripped */
int index + 1; /* Array position + 1 */

int track_is_data;
int preemphasis;
Expand Down

0 comments on commit 575f097

Please sign in to comment.