Skip to content

Commit

Permalink
Merge pull request #4 from milkytracker/master
Browse files Browse the repository at this point in the history
Merge new commits from main branch
  • Loading branch information
MBeijer authored Nov 17, 2017
2 parents ef2ae05 + d9c2773 commit 6588cb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
12 changes: 4 additions & 8 deletions cmake/FindRTMIDI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ find_library(
if(PC_RTMIDI_VERSION)
set(RTMIDI_VERSION_STRING ${PC_RTMIDI_VERSION})
elseif(RTMIDI_INCLUDE_DIR AND EXISTS "${RTMIDI_INCLUDE_DIR}/RtMidi.h")
file(
STRINGS "${RTMIDI_INCLUDE_DIR}/RtMidi.h" RTMIDI_VERSION_LINE
REGEX "^// RtMidi: Version .*$"
)
string(
REGEX REPLACE "^.*Version (.*)$" "\\1" RTMIDI_VERSION_STRING
${RTMIDI_VERSION_LINE}
)
file(STRINGS "${RTMIDI_INCLUDE_DIR}/RtMidi.h" RTMIDI_VERSION_LINE
REGEX "^#define RTMIDI_VERSION \".*\".*$")
string(REGEX REPLACE "^#define RTMIDI_VERSION \"(.*)\".*$" "\\1" RTMIDI_VERSION_STRING
${RTMIDI_VERSION_LINE})
unset(RTMIDI_VERSION_LINE)
endif()

Expand Down
14 changes: 7 additions & 7 deletions src/milkyplay/ExporterXM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,8 @@ mp_sint32 XModule::saveProtrackerModule(const SYSCHAR* fileName)
#ifdef MILKYTRACKER
bool TXMPattern::saveExtendedPattern(const SYSCHAR* fileName) const
{
// Note: For FT2 compatibility, .XP files are fixed at 32 channels.
// TODO: Create a version 2 format for variable channel counts
TWorkBuffers workBuffers;

// ------ start ---------------------------------
Expand All @@ -2134,13 +2136,13 @@ bool TXMPattern::saveExtendedPattern(const SYSCHAR* fileName) const
f.writeWord(0x1);
f.writeWord(rows);

mp_sint32 len = rows * channum * 5;
mp_sint32 len = rows * 32 * 5;

mp_ubyte* srcPattern = new mp_ubyte[len];

memset(srcPattern, 0, len);

convertPattern(NULL, this, srcPattern, channum, workBuffers, false);
convertPattern(NULL, this, srcPattern, 32, workBuffers, false);

f.write(srcPattern, 1, len);

Expand All @@ -2165,14 +2167,12 @@ bool TXMPattern::saveExtendedTrack(const SYSCHAR* fileName, mp_uint32 channel) c
f.writeWord(0x1);
f.writeWord(rows);

mp_sint32 len = rows * channum * 5;
mp_sint32 len = rows * 5;

mp_ubyte* srcPattern = new mp_ubyte[len];
mp_ubyte* srcPattern = new mp_ubyte[rows * channum * 5];
mp_ubyte* dstPattern = new mp_ubyte[len];

memset(srcPattern, 0, len);

convertPattern(NULL, this, srcPattern, channum, workBuffers, false);
convertPattern(NULL, this, srcPattern, channum, workBuffers, false);

for (mp_sint32 r = 0; r < rows; r++)
{
Expand Down

0 comments on commit 6588cb0

Please sign in to comment.