diff options
author | Wohlstand <admin@wohlnet.ru> | 2022-10-17 18:39:08 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2022-10-17 18:39:08 +0300 |
commit | 9fbaa58e87a63749ff1694bdb9f4d1241db98689 (patch) | |
tree | e876a7ea5bed72a36836137f8915eed1fe84edd2 /utils/xmi2mid/xmi2mid.cpp | |
parent | e27764edeb24936ce50da6229a781006e7ebdc75 (diff) | |
download | libADLMIDI-9fbaa58e87a63749ff1694bdb9f4d1241db98689.tar.gz libADLMIDI-9fbaa58e87a63749ff1694bdb9f4d1241db98689.tar.bz2 libADLMIDI-9fbaa58e87a63749ff1694bdb9f4d1241db98689.zip |
Improved the multi-song XMI support
- Allow selecting every individual song of the XMI file
- Allow dynamic song switch without re-opening of a file
- Fixed XMI2MID converter with adding an ability to export every individual song
- Added hooks for loop start and end events
- Added an option to immediately stop the song processing on loop end reaching (needed to perform dynamic song switch at the loop end point)
Diffstat (limited to 'utils/xmi2mid/xmi2mid.cpp')
-rw-r--r-- | utils/xmi2mid/xmi2mid.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/xmi2mid/xmi2mid.cpp b/utils/xmi2mid/xmi2mid.cpp index 65d5858..9442a5e 100644 --- a/utils/xmi2mid/xmi2mid.cpp +++ b/utils/xmi2mid/xmi2mid.cpp @@ -12,14 +12,21 @@ int main(int argc, char *argv[]) { - if(argc != 2) + int songNumber = 0; + + (void)Convert_xmi2midi_multi; /* Shut up the warning */ + + if(argc != 2 && argc != 3) { - fprintf(stderr, "Usage: xmi2mid <midi-file>\n"); + fprintf(stderr, "Usage: xmi2mid <midi-file> [song-number 0...N-1]\n"); return 1; } const char *filename = argv[1]; + if(argc > 2) + songNumber = atoi(argv[2]); + FILE *fh = fopen(filename, "rb"); if(!fh) { @@ -50,7 +57,8 @@ int main(int argc, char *argv[]) uint8_t *xmidata = NULL; uint32_t xmisize = 0; - if(Convert_xmi2midi(filedata, insize, &xmidata, &xmisize, XMIDI_CONVERT_NOCONVERSION) < 0) + + if(Convert_xmi2midi(filedata, insize, &xmidata, &xmisize, XMIDI_CONVERT_NOCONVERSION, songNumber) < 0) { fprintf(stderr, "Error converting XMI to SMF.\n"); return 1; |