summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ptformat/ptfformat.cc21
-rw-r--r--libs/ptformat/ptfformat.h3
2 files changed, 21 insertions, 3 deletions
diff --git a/libs/ptformat/ptfformat.cc b/libs/ptformat/ptfformat.cc
index a92f7e18cb..71c7d479cf 100644
--- a/libs/ptformat/ptfformat.cc
+++ b/libs/ptformat/ptfformat.cc
@@ -76,13 +76,27 @@ hexdump(uint8_t *data, int len)
}
}
-PTFFormat::PTFFormat() : version(0), product(NULL) {
+PTFFormat::PTFFormat() : version(0), product(NULL), ptfunxored(NULL) {
}
PTFFormat::~PTFFormat() {
+ cleanup();
+}
+
+void
+PTFFormat::cleanup(void) {
if (ptfunxored) {
free(ptfunxored);
+ ptfunxored = NULL;
}
+ audiofiles.clear();
+ regions.clear();
+ midiregions.clear();
+ compounds.clear();
+ tracks.clear();
+ miditracks.clear();
+ version = 0;
+ product = NULL;
}
int64_t
@@ -236,7 +250,10 @@ PTFFormat::unxor(std::string path) {
-1 could not parse pt session
*/
int
-PTFFormat::load(std::string path, int64_t targetsr) {
+PTFFormat::load(std::string ptf, int64_t targetsr) {
+ cleanup();
+ path = ptf;
+
if (unxor(path))
return -1;
diff --git a/libs/ptformat/ptfformat.h b/libs/ptformat/ptfformat.h
index 189fc0fef2..933d2be56e 100644
--- a/libs/ptformat/ptfformat.h
+++ b/libs/ptformat/ptfformat.h
@@ -147,7 +147,7 @@ public:
int64_t targetrate;
uint8_t version;
uint8_t *product;
-
+ std::string path;
unsigned char c0;
unsigned char c1;
@@ -163,6 +163,7 @@ private:
bool parse_version();
uint8_t gen_xor_delta(uint8_t xor_value, uint8_t mul, bool negative);
void setrates(void);
+ void cleanup(void);
void parse5header(void);
void parse7header(void);
void parse8header(void);