Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package portmidi for openSUSE:Factory checked in at 2022-05-10 15:11:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/portmidi (Old) and /work/SRC/openSUSE:Factory/.portmidi.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "portmidi" Tue May 10 15:11:57 2022 rev:4 rq:975941 version:2.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/portmidi/portmidi.changes 2022-01-04 19:38:18.757994664 +0100 +++ /work/SRC/openSUSE:Factory/.portmidi.new.1538/portmidi.changes 2022-05-10 15:12:07.187584364 +0200 @@ -1,0 +2,11 @@ +Mon May 9 18:20:07 UTC 2022 - Christophe Giboudeaux <[email protected]> + +- Update to 2.0.3 + * This version allows multiple hardware devices to have the same + name. +- Add upstream changes: + * 0001-Adding-missing-file-to-repo.patch + * 0001-changing-path-to-pm_common-directory-in-file-pm_comm.patch + * 0001-Add-missing-return-type.patch + +------------------------------------------------------------------- Old: ---- portmidi-2.0.2.tar.gz New: ---- 0001-Add-missing-return-type.patch 0001-Adding-missing-file-to-repo.patch 0001-changing-path-to-pm_common-directory-in-file-pm_comm.patch portmidi-2.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ portmidi.spec ++++++ --- /var/tmp/diff_new_pack.p9hghe/_old 2022-05-10 15:12:07.723585039 +0200 +++ /var/tmp/diff_new_pack.p9hghe/_new 2022-05-10 15:12:07.731585049 +0200 @@ -24,13 +24,17 @@ %define soname 2 Name: portmidi -Version: 2.0.2 +Version: 2.0.3 Release: 0 Summary: Real-time MIDI input/output audio tools License: MIT Group: Productivity/Multimedia/Sound/Midi URL: https://github.com/PortMidi/portmidi Source: https://github.com/PortMidi/portmidi/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM -- post-2.0.3 fixes +Patch0: 0001-Add-missing-return-type.patch +Patch1: 0001-changing-path-to-pm_common-directory-in-file-pm_comm.patch +Patch2: 0001-Adding-missing-file-to-repo.patch BuildRequires: alsa-devel >= 0.9 BuildRequires: cmake >= 3.21 BuildRequires: gcc-c++ @@ -118,6 +122,7 @@ %{_bindir}/portmidi-midithru %{_bindir}/portmidi-mm %{_bindir}/portmidi-multivirtual +%{_bindir}/portmidi-pmlist %{_bindir}/portmidi-qtest %{_bindir}/portmidi-recvvirtual %{_bindir}/portmidi-sendvirtual ++++++ 0001-Add-missing-return-type.patch ++++++ >From e8f8c1f98fc1e3934f88b1dd295edcebff777b7c Mon Sep 17 00:00:00 2001 From: nidefawl <[email protected]> Date: Sun, 8 May 2022 05:39:44 +0200 Subject: [PATCH] Add missing return type --- pm_win/pmwinmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pm_win/pmwinmm.c b/pm_win/pmwinmm.c index aebc97c..579d4bb 100755 --- a/pm_win/pmwinmm.c +++ b/pm_win/pmwinmm.c @@ -253,7 +253,7 @@ static unsigned int winmm_check_host_error(PmInternal *midi) } -static improve_winerr(int pm_hosterror, char *message) +static void improve_winerr(int pm_hosterror, char *message) { if (pm_hosterror == MMSYSERR_NOMEM) { /* add explanation to Window's confusing error message */ -- 2.36.0 ++++++ 0001-Adding-missing-file-to-repo.patch ++++++ >From 753dd2417b29e11e084ed4e03ca1cf359c6e07b5 Mon Sep 17 00:00:00 2001 From: "Roger B. Dannenberg" <[email protected]> Date: Tue, 1 Mar 2022 16:56:40 -0500 Subject: [PATCH] Adding missing file to repo --- pm_test/pmlist.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pm_test/pmlist.c diff --git a/pm_test/pmlist.c b/pm_test/pmlist.c new file mode 100644 index 0000000..5e3d1db --- /dev/null +++ b/pm_test/pmlist.c @@ -0,0 +1,63 @@ +/* pmlist.c -- list portmidi devices and numbers + * + * This program lists devices. When you type return, it + * restarts portmidi and lists devices again. It is mainly + * a test for shutting down and restarting. + * + * Roger B. Dannenberg, Feb 2022 + */ + +#include "portmidi.h" +#include "porttime.h" +#include "stdlib.h" +#include "stdio.h" +#include "string.h" +#include "assert.h" + +#define DEVICE_INFO NULL +#define DRIVER_INFO NULL +#define TIME_START Pt_Start(1, 0, 0) /* timer started w/millisecond accuracy */ + +#define STRING_MAX 80 /* used for console input */ + +void show_usage() +{ + printf("Usage: pmlist [-h]\n -h means help.\n" + " Type return to rescan and list devices, q<ret> to quit\n"); +} + + +int main(int argc, char *argv[]) +{ + if (argc > 1) { + show_usage(); + exit(0); + } + + while (1) { + char input[STRING_MAX]; + const char *deflt; + const char *in_or_out; + int default_in, default_out, i; + + // Pm_Initialize(); + /* list device information */ + default_in = Pm_GetDefaultInputDeviceID(); + default_out = Pm_GetDefaultOutputDeviceID(); + for (i = 0; i < Pm_CountDevices(); i++) { + const PmDeviceInfo *info = Pm_GetDeviceInfo(i); + printf("%d: %s, %s", i, info->interf, info->name); + deflt = ""; + if (i == default_out || i == default_in) { + deflt = "default "; + } + in_or_out = (info->input ? "input" : "output"); + printf(" (%s%s)\n", deflt, in_or_out); + } + if (fgets(input, STRING_MAX, stdin) && input[0] == 'q') { + return 0; + } + Pm_Terminate(); + } + return 0; +} -- 2.36.0 ++++++ 0001-changing-path-to-pm_common-directory-in-file-pm_comm.patch ++++++ >From e5e733711aea97993c419183f02e973fd27a13ef Mon Sep 17 00:00:00 2001 From: Antoine <[email protected]> Date: Thu, 14 Apr 2022 09:43:35 +0200 Subject: [PATCH] changing path to pm_common directory in file pm_commom/CMakeLists.txt so that project compiles --- pm_common/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pm_common/CMakeLists.txt b/pm_common/CMakeLists.txt index 8c55f1f..79f1045 100644 --- a/pm_common/CMakeLists.txt +++ b/pm_common/CMakeLists.txt @@ -47,7 +47,7 @@ set_target_properties(portmidi PROPERTIES "MultiThreaded$<$<CONFIG:Debug>:Debug>${MSVCRT_DLL}" WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_include_directories(portmidi PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/pm_common> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) -- 2.36.0 ++++++ portmidi-2.0.2.tar.gz -> portmidi-2.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/.github/workflows/build.yml new/portmidi-2.0.3/.github/workflows/build.yml --- old/portmidi-2.0.2/.github/workflows/build.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/portmidi-2.0.3/.github/workflows/build.yml 2022-02-22 02:54:37.000000000 +0100 @@ -0,0 +1,47 @@ +name: build + +on: + push: + pull_request: + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - name: Ubuntu + os: ubuntu-latest + install_dir: ~/portmidi + cmake_extras: -DCMAKE_BUILD_TYPE=RelWithDebInfo + - name: macOS + os: macos-latest + install_dir: ~/portmidi + cmake_extras: -DCMAKE_BUILD_TYPE=RelWithDebInfo + - name: Windows + os: windows-latest + install_dir: C:\portmidi + cmake_config: --config RelWithDebInfo + + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + - name: "[Ubuntu] Install dependencies" + run: sudo apt install -y libasound2-dev + if: runner.os == 'Linux' + - name: Configure + run: cmake -D CMAKE_INSTALL_PREFIX=${{ matrix.install_dir }} ${{ matrix.cmake_extras }} -S . -B build + - name: Build + run: cmake --build build ${{ matrix.cmake_config }} + env: + CMAKE_BUILD_PARALLEL_LEVEL: 2 + - name: Install + run: cmake --install . ${{ matrix.cmake_config }} + working-directory: build + - name: Upload Build Artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.name }} portmidi build + path: ${{ matrix.install_dir }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/CHANGELOG.txt new/portmidi-2.0.3/CHANGELOG.txt --- old/portmidi-2.0.2/CHANGELOG.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/CHANGELOG.txt 2022-02-22 02:54:37.000000000 +0100 @@ -1,5 +1,8 @@ /* CHANGELOG FOR PORTMIDI * + * 21Feb22 v2.0.3 Roger Dannenberg + * - this version allows multiple hardware devices to have the same name. + * * 03Jan22 v2.0.2 Roger Dannenberg * - many changes for CMake including install support * - bare-bones Java and PmDefaults support. It runs, but no diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/CMakeLists.txt new/portmidi-2.0.3/CMakeLists.txt --- old/portmidi-2.0.2/CMakeLists.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/CMakeLists.txt 2022-02-22 02:54:37.000000000 +0100 @@ -6,12 +6,13 @@ # (ALSA::ALSA new in 3.12 and used in pm_common/CMakeLists.txt) # Some Java stuff failed on 3.17 but works with 3.20+ +cmake_policy(SET CMP0091 NEW) # enables MSVC_RUNTIME_LIBRARY target property + # Previously, PortMidi versions were simply SVN commit version numbers. # Versions are now in the form x.y.z -# Changed 1.0 to 2.0 because API is extended with virtual ports - +# Changed 1.0 to 2.0 because API is extended with virtual ports: set(SOVERSION "2") -set(VERSION "2.0.2") +set(VERSION "2.0.3") project(portmidi VERSION "${VERSION}" DESCRIPTION "Cross-Platform MIDI IO") @@ -21,6 +22,18 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(PM_USE_STATIC_RUNTIME + "Use MSVC static runtime. Only applies when BUILD_SHARED_LIBS is OFF" + ON) + +# MSVCRT_DLL is used to construct the MSVC_RUNTIME_LIBRARY property +# (see pm_common/CMakeLists.txt and pm_test/CMakeLists.txt) +if(PM_USE_STATIC_RUNTIME AND NOT BUILD_SHARED_LIBS) + set(MSVCRT_DLL "") +else() + set(MSVCRT_DLL "DLL") +endif() + # Always build with position-independent code (-fPIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -36,12 +49,13 @@ # credit: http://cliutils.gitlab.io/modern-cmake/chapters/features.html set(DEFAULT_BUILD_TYPE "Release") if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") + message(STATUS + "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() # where to put libraries? Everything goes here in this directory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/README.txt new/portmidi-2.0.3/README.txt --- old/portmidi-2.0.2/README.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/README.txt 2022-02-22 02:54:37.000000000 +0100 @@ -79,3 +79,10 @@ The Windows version (and perhaps others) also offers a DEBUG compile-time option. See README_WIN.txt. + +RELEASE + +To make a new release, update VERSION variable in CMakeLists.txt. + +Update CHANGELOG.txt. What's new? + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/packaging/portmidi.pc.in new/portmidi-2.0.3/packaging/portmidi.pc.in --- old/portmidi-2.0.2/packaging/portmidi.pc.in 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/packaging/portmidi.pc.in 2022-02-22 02:54:37.000000000 +0100 @@ -8,3 +8,4 @@ Version: @CMAKE_PROJECT_VERSION@ Cflags: -I${includedir} Libs: -L${libdir} -l@CMAKE_PROJECT_NAME@ +Requires.private: @PKGCONFIG_REQUIRES_PRIVATE@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_common/CMakeLists.txt new/portmidi-2.0.3/pm_common/CMakeLists.txt --- old/portmidi-2.0.2/pm_common/CMakeLists.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_common/CMakeLists.txt 2022-02-22 02:54:37.000000000 +0100 @@ -37,10 +37,14 @@ ${PMDIR}/pm_common/pmutil.c ${PMDIR}/porttime/porttime.c) add_library(portmidi ${PM_LIB_PUBLIC_SRC}) + +# MSVCRT_DLL is "DLL" for shared runtime library, and "" for static: set_target_properties(portmidi PROPERTIES VERSION ${LIBRARY_VERSION} SOVERSION ${LIBRARY_SOVERSION} OUTPUT_NAME "${PM_ACTUAL_LIB_NAME}" + MSVC_RUNTIME_LIBRARY + "MultiThreaded$<$<CONFIG:Debug>:Debug>${MSVCRT_DLL}" WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_include_directories(portmidi PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/pm_common> @@ -109,6 +113,7 @@ list(APPEND PM_LIB_PRIVATE_SRC ${PMDIR}/pm_linux/pmlinuxalsa.c) set(PM_NEEDED_LIBS ${CMAKE_THREAD_LIBS_INIT} ${ALSA_LIBRARIES} PARENT_SCOPE) target_link_libraries(portmidi PRIVATE Threads::Threads ALSA::ALSA) + set(PKGCONFIG_REQUIRES_PRIVATE "alsa" PARENT_SCOPE) else() message(WARNING "No PMALSA, so PortMidi will not use ALSA, " "and will not find or open MIDI devices.") @@ -122,11 +127,11 @@ ${PMDIR}/pm_win/pmwinmm.c) set(PM_NEEDED_LIBS winmm PARENT_SCOPE) target_link_libraries(portmidi PRIVATE winmm) - if(NOT BUILD_SHARED_LIBS) +# if(NOT BUILD_SHARED_LIBS AND PM_USE_STATIC_RUNTIME) # /MDd is multithread debug DLL, /MTd is multithread debug # /MD is multithread DLL, /MT is multithread. Change to static: - include(../pm_win/static.cmake) - endif() +# include(../pm_win/static.cmake) +# endif() else() message(FATAL_ERROR "Operating system not supported.") endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_common/portmidi.c new/portmidi-2.0.3/pm_common/portmidi.c --- old/portmidi-2.0.2/pm_common/portmidi.c 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_common/portmidi.c 2022-02-22 02:54:37.000000000 +0100 @@ -162,13 +162,21 @@ /* pm_add_device -- describe interface/device pair to library * * This is called at intialization time, once for each - * interface (e.g. DirectSound) and device (e.g. SoundBlaster 1) - * interf assumed to be static memory, so it is NOT COPIED and + * interface (e.g. DirectSound) and device (e.g. SoundBlaster 1). + * This is also called when user creates a virtual device. + * + * Normally, increasing integer indices are returned. If the device + * is virtual, a linear search is performed to ensure that the name + * is unique. If the name is already taken, the call will fail and + * no device is added. + * + * interf is assumed to be static memory, so it is NOT COPIED and * NOT FREED. * name is owned by caller, COPIED if needed, and FREED by PortMidi. * Caller is resposible for freeing name when pm_add_device returns. * - * returns pmInvalidDeviceId if device memory is exceeded + * returns pmInvalidDeviceId if device memory is exceeded or a virtual + * device would take the name of an existing device. * otherwise returns index (portmidi device_id) of the added device */ PmError pm_add_device(char *interf, const char *name, int is_input, @@ -177,7 +185,11 @@ interf, name, is_input, descriptor, dictionary); */ int device_id; PmDeviceInfo *d; - for (device_id = 0; device_id < pm_descriptor_len; device_id++) { + /* if virtual, search for duplicate name or unused ID; otherwise, + * just add a new device at the next integer available: + */ + for (device_id = (is_virtual ? 0 : pm_descriptor_len); + device_id < pm_descriptor_len; device_id++) { d = &pm_descriptors[device_id].pub; d->structVersion = 200; if (strcmp(d->interf, interf) == 0 && strcmp(d->name, name) == 0) { @@ -186,9 +198,8 @@ if (pm_descriptors[device_id].deleted && is_input == d->input) { /* here, we know d->is_virtual because only virtual devices * can be deleted, and we know is_virtual because we are - * beyond initialization (otherwise we could not have - * created/deleted a virtual device) and after intialization, - * pm_add_device() is only called with is_virtual == TRUE */ + * in this loop. + */ pm_free((void *) d->name); /* reuse this device entry */ d->name = NULL; break; @@ -196,14 +207,13 @@ * the same direction (input or output) as the existing device. * Note that virtual inputs appear to others as outputs and * vice versa. - * The direction of the new device to others is "output" if - * (is_virtual == is_input), i.e., virtual inputs and - * non-virtual outputs appear to others as outputs. The existing - * device appears to others as "output" if + * The direction of the new virtual device to others is "output" + * if is_input, i.e., virtual inputs appear to others as outputs. + * The existing device appears to others as "output" if * (d->is_virtual == d->input) by the same logic. + * The compare will detect if device directions are the same: */ - } else if ((is_virtual == is_input) == - (d->is_virtual == d->input)) { + } else if (is_input == (d->is_virtual == d->input)) { return pmNameConflict; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_common/portmidi.h new/portmidi-2.0.3/pm_common/portmidi.h --- old/portmidi-2.0.2/pm_common/portmidi.h 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_common/portmidi.h 2022-02-22 02:54:37.000000000 +0100 @@ -132,6 +132,23 @@ Pm_Initialize() is the library initialization function - call this before using the library. + *NOTE:* PortMidi scans for available devices when #Pm_Initialize + is called. To observe subsequent changes in the available + devices, you must shut down PortMidi by calling #Pm_Terminate and + then restart by calling #Pm_Initialize again. *IMPORTANT*: On + MacOS, #Pm_Initialize *must* always be called on the same + thread. Otherwise, changes in the available MIDI devices will + *not* be seen by PortMidi. As an example, if you start PortMidi in + a thread for processing MIDI, do not try to rescan devices by + calling #Pm_Initialize in a GUI thread. Instead, start PortMidi + the first time and every time in the GUI thread. Alternatively, + let the GUI request a restart in the MIDI thread. (These + restrictions only apply to macOS.) Speaking of threads, on all + platforms, you are allowed to call #Pm_Initialize in one thread, + yet send MIDI or poll for incoming MIDI in another + thread. However, PortMidi is not "thread safe," which means you + cannot allow threads to call PortMidi functions concurrently. + @return pmNoError. PortMidi is designed to support multiple interfaces (such as ALSA, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_java/CMakeLists.txt new/portmidi-2.0.3/pm_java/CMakeLists.txt --- old/portmidi-2.0.2/pm_java/CMakeLists.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_java/CMakeLists.txt 2022-02-22 02:54:37.000000000 +0100 @@ -20,28 +20,14 @@ project(pmdefaults NONE) include(UseJava) - if(UNIX) - # There seems to be a bug in CMake - Linux complains if NAMESPACE is - # missing, but Windows does not make a working VS solution if NAMESPACE - # is present, so this "add_jar" call is almost duplicated: here for - # Linux/macOS and below for Windows... - add_jar(pmdefaults + add_jar(pmdefaults SOURCES pmdefaults/PmDefaults.java pmdefaults/PmDefaultsFrame.java jportmidi/JPortMidi.java jportmidi/JPortMidiApi.java jportmidi/JPortMidiException.java RESOURCES NAMESPACE "." pmdefaults/portmusic_logo.png MANIFEST pmdefaults/manifest.txt OUTPUT_DIR pmdefaults) - elseif(WIN32) - add_jar(pmdefaults - SOURCES pmdefaults/PmDefaults.java pmdefaults/PmDefaultsFrame.java - jportmidi/JPortMidi.java jportmidi/JPortMidiApi.java - jportmidi/JPortMidiException.java - # NAMESPACE did not seem to work on Windows - omitting it may - # cause out-of-source-tree builds to fail: - RESOURCES pmdefaults/portmusic_logo.png - MANIFEST pmdefaults/manifest.txt - OUTPUT_DIR pmdefaults) + if(WIN32) set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../jre/lib/i386/client/libjvm.so) endif() add_dependencies(pmdefaults pmjni) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_java/jportmidi/JPortMidi.java new/portmidi-2.0.3/pm_java/jportmidi/JPortMidi.java --- old/portmidi-2.0.2/pm_java/jportmidi/JPortMidi.java 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_java/jportmidi/JPortMidi.java 2022-02-22 02:54:37.000000000 +0100 @@ -77,7 +77,9 @@ throw new JPortMidiException(pmStreamOpen, "RefreshDeviceLists called while stream is open"); } + if (trace) System.out.println("Pm_Terminate"); checkError(pm.Pm_Terminate()); + if (trace) System.out.println("Pm_Initialize"); checkError(pm.Pm_Initialize()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_java/pmdefaults/PmDefaults.java new/portmidi-2.0.3/pm_java/pmdefaults/PmDefaults.java --- old/portmidi-2.0.2/pm_java/pmdefaults/PmDefaults.java 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_java/pmdefaults/PmDefaults.java 2022-02-22 02:54:37.000000000 +0100 @@ -1,11 +1,15 @@ // PmDefaults -- a small application to set PortMIDI default input/output package pmdefaults; +import javax.swing.SwingUtilities; public class PmDefaults { public static void main(String[] args) { System.out.println("starting main"); - new PmDefaultsFrame("PortMIDI Setup"); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + new PmDefaultsFrame("PortMIDI Setup"); + } + }); } } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_mac/README_MAC.txt new/portmidi-2.0.3/pm_mac/README_MAC.txt --- old/portmidi-2.0.2/pm_mac/README_MAC.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_mac/README_MAC.txt 2022-02-22 02:54:37.000000000 +0100 @@ -2,165 +2,75 @@ Roger Dannenberg 20 nov 2009 revised 20 Sep 2010 for Xcode 4.3.2 and CMake 2.8.8 +revised Jan 2022 for the PortMidi/portmidi repo on github.com -To build PortMidi for Mac OS X, you must install Xcode and -CMake. +This documents how I build PortMidi for macOS. It's not the only way, +and command-line/scripting enthusiasts will say it's not even a good +way. Feel free to contribute your approach if you are willing to +describe it carefully and test it. + +Install Xcode and the CMake application, CMake.app. I use the GUI +version of CMake which makes it easy to see/edit variables and +options. + +==== USING CMAKE ==== + +Run CMake.app and select your portmidi repo working directory as the +location for source and build. (Yes, I use so called "in-tree" +builds -- it doesn't hurt, but I don't think it is necessary.) + +Default settings should all be fine, but select options under BUILD if +you wish: + +BUILD_NATIVE_JAVA_INTERFACE and BUILD_PMDEFAULTS to build a Java-based +GUI for setting default MIDI devices. (Otherwise, calls to +Pm_DefaultInputDevice() and Pm_DefaultOutputDevice() will not be +useful, but maybe you are not going to use these anyway -- up to you.) + +BUILD_PORTMIDI_TESTS to create some test programs. Of particular +interest are test/mm, a handy command-line MIDI Input Monitor, and +test/testio, a simple command-line program to send or receive some +MIDI notes in case you need a quick test: What devices do I have? Does +this input work? Does this output work? + +I disable BUILD_SHARED_LIBS and always link statically: Static linking only +adds about 40KB to any application and then you don't have to worry +about versions, instally, copying or finding the dynamic link library, +etc. + +To make sure you link statically, I rename the library to +libportmidi_static.a. To do this, set PM_STATIC_LIB_NAME (in CMake, +under the "PM" group) to "portmidi_static", and of course your +application will have to specify portmidi_static as the library to +link to. + +If you are building simple command-line applications, you might want +to enable PM_CHECK_ERRORS. If you do, then calls into the PortMidi +library will print error messages and exit in the event of an error +(such as trying to open a device that does not exist). This saves you +from having to check for errors everytime you call a library function +or getting confused when errors are detected but not reported. For +high-quality applications, do NOT enable PM_CHECK_ERRORS -- any +failure could immediately abort your whole application, which is not +very friendly to users. + +Click on Configure (maybe a couple of times). + +Click on Generate and make an Xcode project. + +Open portmidi/portmidi.xcodeproj with Xcode and build what you +need. The simplest thing is to build the ALL_BUILD target. Be careful +to specify a Debug or Release depending on what you want. "ALL_BUILD" +is a misnomer -- it only builds the version you select. + +PmDefaults is minimally supported and may be removed in 2023 unless we +hear from users. To run it, +(1) make sure java runs from the command line. +(2) run the following command in an open Terminal: + cd portmidi/pm_java/pmdefaults + ./pmdefaults + +Feel free to write a short script that cd's to your pmdefaults +directory and runs pmdefaults, and put that script somewhere on your +path so you can type it anywhere. -CMake can build either command-line Makefiles or Xcode projects. -These approaches are described in separate sections below. - -==== CLEANING UP ==== -(Skip this for now, but later you might want start from a clean -slate.) - -Start in the portmedia/portmidi directory. - -make -f pm_mac/Makefile.osx clean - -will remove .o, CMakeFiles, and other intermediate files. - -Using "cleaner" instead of "clean" will also remove jni-related -intermediate files. - -Using "cleanest" instead of "clean" or "cleaner" will also remove -application binaries and the portmidi libraries. (It will not -uninstall anything, however.) - -==== USING CMAKE (AND COMMAND LINE TOOLS) ==== - -Start in the portmedia/portmidi directory. - -make -f pm_mac/Makefile.osx - -(Begin note: make will invoke cmake to build a Makefile and then make to -build portmidi. This extra level allows you to correctly build -both Release and Debug versions. Release is the default, so to get -the Debug version, use: - -make -f pm_mac/Makefile.osx configuration=Debug -) - -Release version executables and libraries are now in - portmedia/portmidi/Release - -Debug version executables and libraries are created in - portmedia/portmidi/Debug -The Debug versions are compiled with PM_CHECK_ERRORS which -prints an error message and aborts when an error code is returned -by PortMidi functions. This is useful for small command line -applications. Otherwise, you should check and handle error returns -in your program. - -You can install portmidi as follows: - -cd Release; sudo make install - -This will install /usr/local/include/{portmidi.h, porttime.h} -and /usr/local/lib/{libportmidi.dylib, libportmidi_s.a, libpmjni.dylib} - -You should now make the pmdefaults.app: - -make -f pm_mac/Makefile.osx pmdefaults - -NOTE: pmdefaults.app will be in pm_mac/Release/. - -Please copy pmdefaults.app to your Applications folder or wherever -you would normally expect to find it. - -==== USING CMAKE TO BUILD Xcode PROJECT ==== - -Before you can use Xcode, you need a portmidi.xcodeproj file, -and this is created with CMake. - -CMake builds a location-dependent Xcode project, so unfortunately -it is not easy to provide an Xcode project that is ready to use. -Therefore, you should make your own. Once you have it, you can -use it almost like any other Xcode project, and you will not have -to go back to CMake. - -(1) Install CMake if you do not have it already. - -(2) Open portmedia/portmidi/CMakeLists.txt with CMake - -(3) Use Configure and Generate buttons -- for CMAKE_OSX_SYSROOT, use - /Developer/SDKs/MacOSX10.6.sdk (rather than 10.7) - -(4) This creates portmedia/portmidi/portmidi.xcodeproj. - -Note: You will also use pm_mac/pm_mac.xcodeproj, which -is not generated by CMake. - -(5) Open portmidi/portmidi.xcodeproj with Xcode and -build what you need. The simplest thing is to build the -ALL_BUILD target. The default will be to build the Debug -version, but you may want to change this to Release. - -NOTE: ALL_BUILD may report errors. Try simply building again -or rebuilding specific targets that fail until they build -without errors. There appears to be a race condition or -missing dependencies in the build system. - -The Debug version is compiled with PM_CHECK_ERRORS, and the -Release version is not. PM_CHECK_ERRORS will print an error -message and exit your program if any error is returned from -a call into PortMidi. - -CMake (currently) also creates MinSizRel and RelWithDebInfo -versions, but only because I cannot figure out how to disable -them. - -You will probably want the application PmDefaults, which sets -default MIDI In and Out devices for PortMidi. You may also -want to build a Java application using PortMidi. Since I have -not figured out how to use CMake to make an OS X Java application, -use pm_mac/pm_mac.xcodeproj as follows: - -(6) open pm_mac/pm_mac.xcodeproj - -(7) pm_java/pmjni/portmidi_JportmidiApi.h is needed -by libpmjni.jnilib, the Java native interface library. Since -portmidi_JportmidiApi.h is included with PortMidi, you can skip -to step 8, but if you really want to rebuild everything from -scratch, build the JPortMidiHeaders project first, and continue -with step 8: - -(8) If you did not build libpmjni.dylib using portmidi.xcodeproj, -do it now. (It depends on portmidi_JportmidiApi.h, and the -PmDefaults project depends on libpmjni.dylib.) - -(9) Returning to pm_mac.xcodeproj, build the PmDefaults program. - -(10) If you wish, copy pm_mac/build/Deployment/PmDefaults.app to -your applications folder. - -(11) If you want to install libportmidi.dylib, first make it with -Xcode, then - sudo make -f pm_mac/Makefile.osx install -This command will install /usr/local/include/{porttime.h, portmidi.h} -and /usr/local/lib/libportmidi.dylib -Note that the "install" function of xcode creates portmidi/Release -and does not install the library to /usr/local/lib, so please use -the command line installer. - - -CHANGELOG - -20-Sep-2010 Roger B. Dannenberg - Adapted to Xcode 3.2.4 -20-Nov-2009 Roger B. Dannenberg - Added some install instructions -26-Sep-2009 Roger B. Dannenberg - More changes for using CMake, Makefiles, XCode -20-Sep-2009 Roger B. Dannenberg - Modifications for using CMake -14-Sep-2009 Roger B. Dannenberg - Modifications for using CMake -17-Jan-2007 Roger B. Dannenberg - Explicit instructions for Xcode -15-Jan-2007 Roger B. Dannenberg - Changed instructions because of changes to Makefile.osx -07-Oct-2006 Roger B. Dannenberg - Added directions for xcodebuild -29-aug-2006 Roger B. Dannenberg - Updated this documentation. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_mac/pmmacosxcm.c new/portmidi-2.0.3/pm_mac/pmmacosxcm.c --- old/portmidi-2.0.2/pm_mac/pmmacosxcm.c 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_mac/pmmacosxcm.c 2022-02-22 02:54:37.000000000 +0100 @@ -1167,6 +1167,20 @@ */ void cm_notify(const MIDINotification *msg, void *refCon) { + /* for debugging, trace change notifications: + const char *descr[] = { + "undefined (0)", + "kMIDIMsgSetupChanged", + "kMIDIMsgObjectAdded", + "kMIDIMsgObjectRemoved", + "kMIDIMsgPropertyChanged", + "kMIDIMsgThruConnectionsChanged", + "kMIDIMsgSerialPortOwnerChanged", + "kMIDIMsgIOError"}; + + printf("MIDI Notify, messageID %d (%s)\n", (int) msg->messageID, + descr[(int) msg->messageID]); + */ return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_test/CMakeLists.txt new/portmidi-2.0.3/pm_test/CMakeLists.txt --- old/portmidi-2.0.2/pm_test/CMakeLists.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_test/CMakeLists.txt 2022-02-22 02:54:37.000000000 +0100 @@ -6,17 +6,19 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) endif(APPLE) -if(WIN32) - if(NOT BUILD_SHARED_LIBS) +# if(WIN32) +# if(NOT BUILD_SHARED_LIBS) # /MDd is multithread debug DLL, /MTd is multithread debug # /MD is multithread DLL, /MT is multithread. Change to static: - include(../pm_win/static.cmake) - endif() -endif(WIN32) +# include(../pm_win/static.cmake) +# endif() +# endif(WIN32) macro(add_test name) add_executable(${name} ${name}.c) target_link_libraries(${name} PRIVATE portmidi) + set_property(TARGET ${name} PROPERTY MSVC_RUNTIME_LIBRARY + "MultiThreaded$<$<CONFIG:Debug>:Debug>${MSVCRT_DLL}") endmacro(add_test) add_test(testio) @@ -27,13 +29,14 @@ add_test(mm) add_test(midiclock) add_test(qtest) -add_test(fast) +add_test(fast) add_test(fastrcv) if(WIN32) # windows does not implement Pm_CreateVirtualInput or Pm_CreateVirtualOutput else(WIN32) -add_test(recvvirtual) -add_test(sendvirtual) -add_test(multivirtual) -add_test(virttest) +add_test(recvvirtual) +add_test(sendvirtual) +add_test(multivirtual) +add_test(virttest) +add_test(pmlist) endif(WIN32) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/portmidi-2.0.2/pm_test/README.txt new/portmidi-2.0.3/pm_test/README.txt --- old/portmidi-2.0.2/pm_test/README.txt 2022-01-03 20:38:58.000000000 +0100 +++ new/portmidi-2.0.3/pm_test/README.txt 2022-02-22 02:54:37.000000000 +0100 @@ -362,6 +362,13 @@ [In the device list, default devices are marked. They should match the devices selected with pmdefaults.] ^C to quit. +33. pmlist + ./pmlist [check the output] + [plug in or remove a device] + >> [type RETURN] + [check for changes in device list] + >>q +
