aboutsummaryrefslogtreecommitdiff
path: root/src/wopl
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-09-03 08:35:43 +0200
committerJP Cimalando <jpcima@users.noreply.github.com>2018-09-03 08:39:54 +0200
commit273841b7b2442d1909ae8d0233b7097426a1d16c (patch)
tree6e1ef697e208386e2eabab75699c19c138ffe893 /src/wopl
parentce26aee47eba23d1b55a5840f79772c78fd69595 (diff)
downloadlibADLMIDI-273841b7b2442d1909ae8d0233b7097426a1d16c.tar.gz
libADLMIDI-273841b7b2442d1909ae8d0233b7097426a1d16c.tar.bz2
libADLMIDI-273841b7b2442d1909ae8d0233b7097426a1d16c.zip
wopl: bug fix and test
Diffstat (limited to 'src/wopl')
-rw-r--r--src/wopl/wopl_file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wopl/wopl_file.c b/src/wopl/wopl_file.c
index 25b75be..f018cbc 100644
--- a/src/wopl/wopl_file.c
+++ b/src/wopl/wopl_file.c
@@ -353,6 +353,8 @@ int WOPL_LoadInstFromMem(WOPIFile *file, void *mem, size_t length)
GO_FORWARD(2);
}
+ file->version = version;
+
{/* is drum flag */
if(length < 1)
return WOPL_ERR_UNEXPECTED_ENDING;
@@ -434,11 +436,13 @@ size_t WOPL_CalculateInstFileSize(WOPIFile *file, uint16_t version)
* is percussive instrument
*/
- if(version >= 3)
- ins_size = WOPL_INST_SIZE_V3;
+ if(version > 2)
+ /* Skip sounding delays are not part of single-instrument file
+ * two sizes of uint16_t will be subtracted */
+ ins_size = WOPL_INST_SIZE_V3 - (sizeof(uint16_t) * 2);
else
ins_size = WOPL_INST_SIZE_V2;
- final_size += ins_size * 128;
+ final_size += ins_size;
return final_size;
}