From 3e93218e458feb0e263eea7cadf5c91ca48a2a7e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 14 Oct 2015 21:44:21 +0000 Subject: Remove glib dependency from engine git-svn-id: http://svn.drobilla.net/lad/trunk/machina@5768 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/SMFDriver.cpp | 2 -- src/engine/SMFReader.cpp | 11 +++++------ src/engine/SMFWriter.cpp | 10 +++++----- src/engine/wscript | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/engine/SMFDriver.cpp b/src/engine/SMFDriver.cpp index a822e7e..3dc51e2 100644 --- a/src/engine/SMFDriver.cpp +++ b/src/engine/SMFDriver.cpp @@ -17,8 +17,6 @@ #include #include -#include - #include "machina/Context.hpp" #include "machina/Machine.hpp" #include "machina/types.hpp" diff --git a/src/engine/SMFReader.cpp b/src/engine/SMFReader.cpp index 5df636d..d71dca4 100644 --- a/src/engine/SMFReader.cpp +++ b/src/engine/SMFReader.cpp @@ -14,13 +14,12 @@ along with Raul. If not, see . */ +#include #include #include #include #include -#include - #include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "SMFReader.hpp" @@ -118,17 +117,17 @@ SMFReader::open(const std::string& filename) fseek(_fd, 8, SEEK_SET); uint16_t type_be = 0; fread(&type_be, 2, 1, _fd); - _type = GUINT16_FROM_BE(type_be); + _type = ntohs(type_be); // Read number of tracks (bytes 10..11) uint16_t num_tracks_be = 0; fread(&num_tracks_be, 2, 1, _fd); - _num_tracks = GUINT16_FROM_BE(num_tracks_be); + _num_tracks = ntohs(num_tracks_be); // Read PPQN (bytes 12..13) uint16_t ppqn_be = 0; fread(&ppqn_be, 2, 1, _fd); - _ppqn = GUINT16_FROM_BE(ppqn_be); + _ppqn = ntohs(ppqn_be); // TODO: Absolute (SMPTE seconds) time support if ((_ppqn & 0x8000) != 0) { @@ -175,7 +174,7 @@ SMFReader::seek_to_track(unsigned track) throw (std::logic_error) uint32_t chunk_size_be; fread(&chunk_size_be, 4, 1, _fd); - chunk_size = GUINT32_FROM_BE(chunk_size_be); + chunk_size = ntohl(chunk_size_be); if (track_pos == track) { break; diff --git a/src/engine/SMFWriter.cpp b/src/engine/SMFWriter.cpp index 9d18d46..d3f79b6 100644 --- a/src/engine/SMFWriter.cpp +++ b/src/engine/SMFWriter.cpp @@ -14,7 +14,7 @@ along with Machina. If not, see . */ -#include +#include #include #include @@ -162,9 +162,9 @@ SMFWriter::write_header() { std::cout << "SMF Flushing header\n"; - const uint16_t type = GUINT16_TO_BE(0); // SMF Type 0 (single track) - const uint16_t ntracks = GUINT16_TO_BE(1); // Number of tracks (always 1 for Type 0) - const uint16_t division = GUINT16_TO_BE(_unit.ppt()); // PPQN + const uint16_t type = htons(0); // SMF Type 0 (single track) + const uint16_t ntracks = htons(1); // Number of tracks (always 1 for Type 0) + const uint16_t division = htons(_unit.ppt()); // PPQN char data[6]; memcpy(data, &type, 2); @@ -194,7 +194,7 @@ SMFWriter::write_footer() void SMFWriter::write_chunk_header(const char id[4], uint32_t length) { - const uint32_t length_be = GUINT32_TO_BE(length); + const uint32_t length_be = htonl(length); fwrite(id, 1, 4, _fd); fwrite(&length_be, 4, 1, _fd); diff --git a/src/engine/wscript b/src/engine/wscript index e1fc1ab..c12bd9f 100644 --- a/src/engine/wscript +++ b/src/engine/wscript @@ -34,7 +34,7 @@ def build(bld): obj.includes = ['.', '..', '../..'] obj.name = 'libmachina_engine' obj.target = 'machina_engine' - core_libs = 'RAUL GLIBMM GTHREAD RAUL SERD SORD JACK LV2' + core_libs = 'RAUL SERD SORD JACK LV2' if bld.env.HAVE_EUGENE: core_libs += ' EUGENE ' autowaf.use_lib(bld, obj, core_libs) -- cgit v1.2.1