aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/SMFWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SMFWriter.cpp')
-rw-r--r--src/engine/SMFWriter.cpp10
1 files changed, 5 insertions, 5 deletions
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 <http://www.gnu.org/licenses/>.
*/
-#include <glib.h>
+#include <arpa/inet.h>
#include <stdint.h>
#include <stdio.h>
@@ -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);