diff options
author | Wohlstand <admin@wohlnet.ru> | 2020-02-22 13:04:39 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2020-02-22 13:04:39 +0300 |
commit | 6ae9ca1265f8249af680f366b5a56934c7b2d7bb (patch) | |
tree | db29afc329050729852bfcc86b8b3419ad74ea15 /utils | |
parent | b92112685b1d1ba0ae376069bc42d61300a97fa1 (diff) | |
parent | 58c5becbdfd451b4181661a5ff2d3e556e4e8501 (diff) | |
download | libADLMIDI-6ae9ca1265f8249af680f366b5a56934c7b2d7bb.tar.gz libADLMIDI-6ae9ca1265f8249af680f366b5a56934c7b2d7bb.tar.bz2 libADLMIDI-6ae9ca1265f8249af680f366b5a56934c7b2d7bb.zip |
Merge branch 'master' into wip-new-embedded-banks
Diffstat (limited to 'utils')
-rw-r--r-- | utils/gen_adldata/ini/ini_processing.cpp | 2 | ||||
-rw-r--r-- | utils/gen_adldata/ini/ini_processing.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/ini/ini_processing_variant.h | 2 | ||||
-rw-r--r-- | utils/midiplay/adlmidiplay.cpp | 2 | ||||
-rw-r--r-- | utils/midiplay/audio.h | 2 | ||||
-rw-r--r-- | utils/midiplay/audio_sdl.c | 2 | ||||
-rw-r--r-- | utils/midiplay/audio_winmm.c | 2 | ||||
-rw-r--r-- | utils/mus2mid/CMakeLists.txt | 7 | ||||
-rw-r--r-- | utils/mus2mid/mus2mid.cpp | 74 | ||||
-rwxr-xr-x | utils/update-copyright.sh | 8 | ||||
-rw-r--r-- | utils/vlc_codec/libadlmidi.c | 2 |
11 files changed, 97 insertions, 8 deletions
diff --git a/utils/gen_adldata/ini/ini_processing.cpp b/utils/gen_adldata/ini/ini_processing.cpp index d43fb47..4336170 100644 --- a/utils/gen_adldata/ini/ini_processing.cpp +++ b/utils/gen_adldata/ini/ini_processing.cpp @@ -1,7 +1,7 @@ /* * INI Processor - a small library which allows you parsing INI-files * - * Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), diff --git a/utils/gen_adldata/ini/ini_processing.h b/utils/gen_adldata/ini/ini_processing.h index c51f586..bd15e17 100644 --- a/utils/gen_adldata/ini/ini_processing.h +++ b/utils/gen_adldata/ini/ini_processing.h @@ -1,7 +1,7 @@ /* * INI Processor - a small library which allows you parsing INI-files * - * Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), diff --git a/utils/gen_adldata/ini/ini_processing_variant.h b/utils/gen_adldata/ini/ini_processing_variant.h index b89be8b..289ec66 100644 --- a/utils/gen_adldata/ini/ini_processing_variant.h +++ b/utils/gen_adldata/ini/ini_processing_variant.h @@ -1,7 +1,7 @@ /* * INI Processor - a small library which allows you parsing INI-files * - * Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), diff --git a/utils/midiplay/adlmidiplay.cpp b/utils/midiplay/adlmidiplay.cpp index bbf1dbf..0cb314e 100644 --- a/utils/midiplay/adlmidiplay.cpp +++ b/utils/midiplay/adlmidiplay.cpp @@ -3,7 +3,7 @@ * a Software MIDI synthesizer library with OPL3 emulation * * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <bisqwit@iki.fi> - * ADLMIDI Library API: Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * ADLMIDI Library API: Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: * http://iki.fi/bisqwit/source/adlmidi.html diff --git a/utils/midiplay/audio.h b/utils/midiplay/audio.h index 9e6c2b2..567465a 100644 --- a/utils/midiplay/audio.h +++ b/utils/midiplay/audio.h @@ -3,7 +3,7 @@ * a Software MIDI synthesizer library with OPL3 emulation * * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <bisqwit@iki.fi> - * ADLMIDI Library API: Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * ADLMIDI Library API: Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: * http://iki.fi/bisqwit/source/adlmidi.html diff --git a/utils/midiplay/audio_sdl.c b/utils/midiplay/audio_sdl.c index 02a9ee6..bd03d6e 100644 --- a/utils/midiplay/audio_sdl.c +++ b/utils/midiplay/audio_sdl.c @@ -3,7 +3,7 @@ * a Software MIDI synthesizer library with OPL3 emulation * * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <bisqwit@iki.fi> - * ADLMIDI Library API: Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * ADLMIDI Library API: Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: * http://iki.fi/bisqwit/source/adlmidi.html diff --git a/utils/midiplay/audio_winmm.c b/utils/midiplay/audio_winmm.c index e0aca93..afe712d 100644 --- a/utils/midiplay/audio_winmm.c +++ b/utils/midiplay/audio_winmm.c @@ -3,7 +3,7 @@ * a Software MIDI synthesizer library with OPL3 emulation * * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <bisqwit@iki.fi> - * ADLMIDI Library API: Copyright (c) 2015-2019 Vitaly Novichkov <admin@wohlnet.ru> + * ADLMIDI Library API: Copyright (c) 2015-2020 Vitaly Novichkov <admin@wohlnet.ru> * * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: * http://iki.fi/bisqwit/source/adlmidi.html diff --git a/utils/mus2mid/CMakeLists.txt b/utils/mus2mid/CMakeLists.txt new file mode 100644 index 0000000..6430dd4 --- /dev/null +++ b/utils/mus2mid/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(mus2mid mus2mid.cpp) +# TODO: Use own library +target_include_directories(mus2mid PRIVATE ${PROJECT_SOURCE_DIR}/src) + +install(TARGETS mus2mid + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + diff --git a/utils/mus2mid/mus2mid.cpp b/utils/mus2mid/mus2mid.cpp new file mode 100644 index 0000000..f737f8c --- /dev/null +++ b/utils/mus2mid/mus2mid.cpp @@ -0,0 +1,74 @@ + +#include "cvt_mus2mid.hpp" +#include <stdio.h> +#include <sys/stat.h> +#if !defined(_WIN32) +#include <unistd.h> +#else +#include <io.h> +#define fileno(fd) _fileno(fd) +#define isatty(fd) _isatty(fd) +#endif + +int main(int argc, char *argv[]) +{ + if(argc != 2) + { + fprintf(stderr, "Usage: mus2mid <midi-file>\n"); + return 1; + } + + const char *filename = argv[1]; + + FILE *fh = fopen(filename, "rb"); + if(!fh) + { + fprintf(stderr, "Error opening file.\n"); + return 1; + } + + struct stat st; + if(fstat(fileno(fh), &st) != 0) + { + fprintf(stderr, "Error reading file status.\n"); + return 1; + } + + size_t insize = (size_t)st.st_size; + if(insize > 8 * 1024 * 1024) + { + fprintf(stderr, "File too large.\n"); + return 1; + } + + uint8_t *filedata = new uint8_t[insize]; + if(fread(filedata, 1, insize, fh) != insize) + { + fprintf(stderr, "Error reading file data.\n"); + return 1; + } + + uint8_t *xmidata = NULL; + uint32_t xmisize = 0; + if(Convert_mus2midi(filedata, static_cast<uint32_t>(insize), &xmidata, &xmisize, 0) < 0) + { + fprintf(stderr, "Error converting MUS to SMF.\n"); + return 1; + } + + FILE *out = stdout; + if(isatty(fileno(out))) + { + fprintf(stderr, "Not writing SMF data on the text terminal.\n"); + } + else + { + if (fwrite(xmidata, 1, xmisize, out) != xmisize || fflush(out) != 0) + { + fprintf(stderr, "Error writing SMF data.\n"); + return 1; + } + } + + return 0; +} diff --git a/utils/update-copyright.sh b/utils/update-copyright.sh new file mode 100755 index 0000000..6ff0dee --- /dev/null +++ b/utils/update-copyright.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +find . -type f -exec grep -Il "Copyright" {} \; \ +| grep -v \.git \ +| while read file; \ +do \ + LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Vitaly Novichkov\)/\1`date +%Y`\2/" "$file"; \ +done diff --git a/utils/vlc_codec/libadlmidi.c b/utils/vlc_codec/libadlmidi.c index 77341b0..3d5e5fe 100644 --- a/utils/vlc_codec/libadlmidi.c +++ b/utils/vlc_codec/libadlmidi.c @@ -1,7 +1,7 @@ /***************************************************************************** * libadlmidi.c: Software MIDI synthesizer using OPL3 Synth emulation ***************************************************************************** - * Copyright © 2015-2018 Vitaly Novichkov + * Copyright © 2015-2020 Vitaly Novichkov * $Id$ * * This program is free software: you can redistribute it and/or modify |