diff options
-rw-r--r-- | libs/ardour/ardour/session.h | 3 | ||||
-rw-r--r-- | libs/ardour/import_pt.cc | 2 | ||||
-rw-r--r-- | libs/ardour/wscript | 2 | ||||
-rw-r--r-- | libs/ptformat/ptfformat.cc | 2 | ||||
-rw-r--r-- | libs/ptformat/ptfformat.h | 188 | ||||
-rw-r--r-- | libs/ptformat/wscript | 18 |
6 files changed, 17 insertions, 198 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a1e9a60c3a..7ac889f8f5 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -41,7 +41,8 @@ #include <glibmm/threads.h> #include <ltc.h> -#include <ptformat/ptfformat.h> + +#include "ptformat/ptfformat.h" #include "pbd/error.h" #include "pbd/event_loop.h" diff --git a/libs/ardour/import_pt.cc b/libs/ardour/import_pt.cc index bfb75e33c8..d668326a7e 100644 --- a/libs/ardour/import_pt.cc +++ b/libs/ardour/import_pt.cc @@ -48,7 +48,7 @@ #include "ardour/session.h" #include "pbd/memento_command.h" -#include <ptformat/ptfformat.h> +#include "ptformat/ptfformat.h" #include "pbd/i18n.h" diff --git a/libs/ardour/wscript b/libs/ardour/wscript index ffc6827334..7766d8467a 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -408,7 +408,7 @@ def build(bld): if bld.is_defined('USE_EXTERNAL_LIBS'): obj.uselib.extend(['VAMPSDK', 'LIBLTC', 'LIBFLUIDSYNTH']) else: - obj.use.extend(['librubberband', 'libltc_includes', 'libltc', 'libfluidsynth_includes', 'libfluidsynth']) + obj.use.extend(['librubberband', 'libltc_includes', 'libltc', 'libfluidsynth_includes', 'libfluidsynth', 'libptformat']) obj.vnum = LIBARDOUR_LIB_VERSION obj.install_path = bld.env['LIBDIR'] diff --git a/libs/ptformat/ptfformat.cc b/libs/ptformat/ptfformat.cc index 774142cad7..7d1708ca47 100644 --- a/libs/ptformat/ptfformat.cc +++ b/libs/ptformat/ptfformat.cc @@ -28,7 +28,7 @@ #include <glib/gstdio.h> -#include "ptfformat.h" +#include "ptformat/ptfformat.h" #if 0 #define verbose_printf(...) printf(__VA_ARGS__) diff --git a/libs/ptformat/ptfformat.h b/libs/ptformat/ptfformat.h deleted file mode 100644 index 933d2be56e..0000000000 --- a/libs/ptformat/ptfformat.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * libptformat - a library to read ProTools sessions - * - * Copyright (C) 2015 Damien Zammit - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ -#ifndef PTFFORMAT_H -#define PTFFORMAT_H - -#include <string> -#include <cstring> -#include <algorithm> -#include <vector> -#include <stdint.h> -#include "ptformat/visibility.h" - -class LIBPTFORMAT_API PTFFormat { -public: - PTFFormat(); - ~PTFFormat(); - - /* Return values: 0 success - -1 could not parse pt session - */ - int load(std::string path, int64_t targetsr); - - /* Return values: 0 success - -1 could not decrypt pt session - */ - int unxor(std::string path); - - struct wav_t { - std::string filename; - uint16_t index; - - int64_t posabsolute; - int64_t length; - - bool operator <(const struct wav_t& other) const { - return (strcasecmp(this->filename.c_str(), - other.filename.c_str()) < 0); - } - - bool operator ==(const struct wav_t& other) const { - return (this->filename == other.filename || - this->index == other.index); - } - - }; - - struct midi_ev_t { - uint64_t pos; - uint64_t length; - uint8_t note; - uint8_t velocity; - }; - - typedef struct region { - std::string name; - uint16_t index; - int64_t startpos; - int64_t sampleoffset; - int64_t length; - wav_t wave; - std::vector<midi_ev_t> midi; - - bool operator ==(const struct region& other) { - return (this->index == other.index); - } - - bool operator <(const struct region& other) const { - return (strcasecmp(this->name.c_str(), - other.name.c_str()) < 0); - } - } region_t; - - typedef struct compound { - uint16_t curr_index; - uint16_t unknown1; - uint16_t level; - uint16_t ontopof_index; - uint16_t next_index; - std::string name; - } compound_t; - - typedef struct track { - std::string name; - uint16_t index; - uint8_t playlist; - region_t reg; - - bool operator ==(const struct track& other) { - return (this->name == other.name); - } - } track_t; - - std::vector<wav_t> audiofiles; - std::vector<region_t> regions; - std::vector<region_t> midiregions; - std::vector<compound_t> compounds; - std::vector<track_t> tracks; - std::vector<track_t> miditracks; - - static bool regionexistsin(std::vector<region_t> reg, uint16_t index) { - std::vector<region_t>::iterator begin = reg.begin(); - std::vector<region_t>::iterator finish = reg.end(); - std::vector<region_t>::iterator found; - - wav_t w = { std::string(""), 0, 0, 0 }; - std::vector<midi_ev_t> m; - region_t r = { std::string(""), index, 0, 0, 0, w, m}; - - if ((found = std::find(begin, finish, r)) != finish) { - return true; - } - return false; - } - - static bool wavexistsin(std::vector<wav_t> wv, uint16_t index) { - std::vector<wav_t>::iterator begin = wv.begin(); - std::vector<wav_t>::iterator finish = wv.end(); - std::vector<wav_t>::iterator found; - - wav_t w = { std::string(""), index, 0, 0 }; - - if ((found = std::find(begin, finish, w)) != finish) { - return true; - } - return false; - } - - int64_t sessionrate; - int64_t targetrate; - uint8_t version; - uint8_t *product; - std::string path; - - unsigned char c0; - unsigned char c1; - unsigned char *ptfunxored; - uint64_t len; - -private: - bool jumpback(uint32_t *currpos, unsigned char *buf, const uint32_t maxoffset, const unsigned char *needle, const uint32_t needlelen); - bool jumpto(uint32_t *currpos, unsigned char *buf, const uint32_t maxoffset, const unsigned char *needle, const uint32_t needlelen); - bool foundin(std::string haystack, std::string needle); - int64_t foundat(unsigned char *haystack, uint64_t n, const char *needle); - int parse(void); - 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); - void parse9header(void); - void parse10header(void); - void parserest5(void); - void parserest89(void); - void parserest12(void); - void parseaudio5(void); - void parseaudio(void); - void parsemidi(void); - void parsemidi12(void); - void resort(std::vector<wav_t>& ws); - void resort(std::vector<region_t>& rs); - void filter(std::vector<region_t>& rs); - std::vector<wav_t> actualwavs; - float ratefactor; - std::string extension; -}; - - -#endif diff --git a/libs/ptformat/wscript b/libs/ptformat/wscript index 77f70b90e8..b638e92558 100644 --- a/libs/ptformat/wscript +++ b/libs/ptformat/wscript @@ -14,6 +14,7 @@ LIBPTFORMAT_LIB_VERSION = '0.0.0' # Variables for 'waf dist' APPNAME = 'libptformat' VERSION = LIBPTFORMAT_VERSION +I18N_PACKAGE = 'libptformat' # Mandatory variables top = '.' @@ -28,17 +29,22 @@ def configure(conf): def build(bld): # Library - obj = bld(features = 'cxx cxxshlib') - obj.source = 'ptfformat.cc' - obj.export_includes = ['.'] + if bld.is_defined ('INTERNAL_SHARED_LIBS'): + obj = bld.shlib (features = 'cxx cxxshlib', source = [ 'ptfformat.cc' ]) + obj.defines = [ 'LIBPTFORMAT_DLL_EXPORTS=1' ] + else: + obj = bld.stdlib (source = [ 'ptfformat.cc' ]) + obj.cxxflags = [ bld.env['compiler_flags_dict']['pic'] ] + obj.cflags = [ bld.env['compiler_flags_dict']['pic'] ] + + obj.export_includes = ['.'] obj.includes = ['.'] obj.name = 'libptformat' obj.target = 'ptformat' obj.use = 'libpbd' - autowaf.ensure_visible_symbols (obj, True) obj.vnum = LIBPTFORMAT_LIB_VERSION obj.install_path = bld.env['LIBDIR'] - obj.defines = [ 'LIBPTFORMAT_DLL_EXPORTS' ] - + obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ] + def shutdown(): autowaf.shutdown() |