From 953d8d34bdecd0a5e669966ed95034c6fa155410 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Mar 2005 00:30:29 +0100 Subject: [PATCH] Read combined blocks of additional data correctly --- ptb.c | 21 +++++++++------------ ptb.h | 15 ++++++++++++++- tests/Makefile | 4 ++-- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ptb.c b/ptb.c index befc185..a13e8fe 100644 --- a/ptb.c +++ b/ptb.c @@ -324,6 +324,7 @@ void ptb_debug(const char *fmt, ...) va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); + fputc('\n', stderr); } static int ptb_read_items(struct ptbf *bf, const char *assumed_type, struct ptb_list **result) { @@ -802,6 +803,7 @@ static int handle_CStaff (struct ptbf *bf, const char *section, struct ptb_list static int handle_CPosition (struct ptbf *bf, const char *section, struct ptb_list **dest) { struct ptb_position *position = GET_ITEM(bf, dest, struct ptb_position); + int i; ptb_data(bf, &position->offset, 1); ptb_data(bf, &position->properties, 2); @@ -824,19 +826,14 @@ static int handle_CPosition (struct ptbf *bf, const char *section, struct ptb_li & ~POSITION_FERMENTA_FERMENTA); ptb_data(bf, &position->length, 1); - ptb_data(bf, &position->conn_to_next, 1); + ptb_data(bf, &position->nr_additional_data, 1); + + position->additional = malloc_p(struct ptb_position_additional, position->nr_additional_data); - /* FIXME - if(position->conn_to_next) { - ptb_debug("Conn to next!: %02x", position->conn_to_next); - ptb_data_unknown(bf, 4*position->conn_to_next); - }*/ - if(position->conn_to_next) { - uint8_t covers, start, end; - ptb_debug("Conn to next: %02x", position->conn_to_next); - ptb_data(bf, &start, 1); - ptb_data(bf, &end, 1); - ptb_data(bf, &covers, 1); + for (i = 0; i < position->nr_additional_data; i++) { + ptb_data(bf, &position->additional[i].start_volume, 1); + ptb_data(bf, &position->additional[i].end_volume, 1); + ptb_data(bf, &position->additional[i].duration, 1); ptb_data_unknown(bf, 1); } diff --git a/ptb.h b/ptb.h index fce680a..9c29ada 100644 --- a/ptb.h +++ b/ptb.h @@ -224,10 +224,23 @@ struct ptb_position { #define POSITION_FERMENTA_TRIPLET_1 0x20 #define POSITION_FERMENTA_TRIPLET_2 0x40 #define POSITION_FERMENTA_TRIPLET_3 0x80 - uint8_t conn_to_next; + + uint8_t nr_additional_data; + struct ptb_position_additional + { + uint8_t start_volume; + uint8_t end_volume; + uint8_t duration; /* Number of following positions */ + uint8_t properties; +#define POSITION_ADDITIONAL_VOLUMESWELL 0x61 +#define POSITION_ADDITIONAL_TREMOLOBAR 0x63 + } *additional; + struct ptb_linedata *linedatas; }; + + #define STAFF_TYPE_BASS_KEY 0x10 struct ptb_staff { diff --git a/tests/Makefile b/tests/Makefile index bfda3e7..d886879 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -16,10 +16,10 @@ PTB_TESTFILES = $(wildcard *.ptb) ../gp2ly "$<" %.pdf: %.ly - lilypond-snapshot --pdf "$<" + lilypond-snapshot --pdf "$*" %.png: %.ly - lilypond-snapshot --png "$<" + lilypond-snapshot --png "$*" %.ptb.2: %.ptb ../ptb2ptb "$<" -- 2.34.1