diff --git a/drivers/SCsub b/drivers/SCsub index 24f511a..7a6b950 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -17,11 +17,6 @@ if env["platform"] == "windows": if env["xaudio2"]: SConscript("xaudio2/SCsub") -# Midi drivers -SConscript("alsamidi/SCsub") -SConscript("coremidi/SCsub") -SConscript("winmidi/SCsub") - # Graphics drivers if env["platform"] != "server": SConscript("gles2/SCsub") diff --git a/drivers/coremidi/SCsub b/drivers/coremidi/SCsub deleted file mode 100644 index 4e1b5f2..0000000 --- a/drivers/coremidi/SCsub +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -Import("env") - -# Driver source files -env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp deleted file mode 100644 index eb13f40..0000000 --- a/drivers/coremidi/midi_driver_coremidi.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/*************************************************************************/ -/* midi_driver_coremidi.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifdef COREMIDI_ENABLED - -#include "midi_driver_coremidi.h" - -#include "core/string/print_string.h" - -#include -#include - -void MIDIDriverCoreMidi::read(const MIDIPacketList *packet_list, void *read_proc_ref_con, void *src_conn_ref_con) { - MIDIPacket *packet = const_cast(packet_list->packet); - for (UInt32 i = 0; i < packet_list->numPackets; i++) { - receive_input_packet(packet->timeStamp, packet->data, packet->length); - packet = MIDIPacketNext(packet); - } -} - -Error MIDIDriverCoreMidi::open() { - CFStringRef name = CFStringCreateWithCString(NULL, "Pandemonium", kCFStringEncodingASCII); - OSStatus result = MIDIClientCreate(name, NULL, NULL, &client); - CFRelease(name); - if (result != noErr) { - ERR_PRINT("MIDIClientCreate failed, code: " + itos(result)); - return ERR_CANT_OPEN; - } - - result = MIDIInputPortCreate(client, CFSTR("Pandemonium Input"), MIDIDriverCoreMidi::read, (void *)this, &port_in); - if (result != noErr) { - ERR_PRINT("MIDIInputPortCreate failed, code: " + itos(result)); - return ERR_CANT_OPEN; - } - - int sources = MIDIGetNumberOfSources(); - for (int i = 0; i < sources; i++) { - MIDIEndpointRef source = MIDIGetSource(i); - if (source) { - MIDIPortConnectSource(port_in, source, (void *)this); - connected_sources.insert(i, source); - } - } - - return OK; -} - -void MIDIDriverCoreMidi::close() { - for (int i = 0; i < connected_sources.size(); i++) { - MIDIEndpointRef source = connected_sources[i]; - MIDIPortDisconnectSource(port_in, source); - } - connected_sources.clear(); - - if (port_in != 0) { - MIDIPortDispose(port_in); - port_in = 0; - } - - if (client != 0) { - MIDIClientDispose(client); - client = 0; - } -} - -PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() { - PoolStringArray list; - - for (int i = 0; i < connected_sources.size(); i++) { - MIDIEndpointRef source = connected_sources[i]; - CFStringRef ref = NULL; - char name[256]; - - MIDIObjectGetStringProperty(source, kMIDIPropertyDisplayName, &ref); - CFStringGetCString(ref, name, sizeof(name), kCFStringEncodingUTF8); - CFRelease(ref); - - list.push_back(name); - } - - return list; -} - -MIDIDriverCoreMidi::MIDIDriverCoreMidi() : - client(0) { -} - -MIDIDriverCoreMidi::~MIDIDriverCoreMidi() { - close(); -} - -#endif // COREMIDI_ENABLED diff --git a/drivers/coremidi/midi_driver_coremidi.h b/drivers/coremidi/midi_driver_coremidi.h deleted file mode 100644 index 5d6488c..0000000 --- a/drivers/coremidi/midi_driver_coremidi.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef MIDI_DRIVER_COREMIDI_H -#define MIDI_DRIVER_COREMIDI_H -/*************************************************************************/ -/* midi_driver_coremidi.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifdef COREMIDI_ENABLED - -#include "core/os/midi_driver.h" -#include "core/containers/vector.h" - -#include -#include - -class MIDIDriverCoreMidi : public MIDIDriver { - MIDIClientRef client; - MIDIPortRef port_in; - - Vector connected_sources; - - static void read(const MIDIPacketList *packet_list, void *read_proc_ref_con, void *src_conn_ref_con); - -public: - virtual Error open(); - virtual void close(); - - PoolStringArray get_connected_inputs(); - - MIDIDriverCoreMidi(); - virtual ~MIDIDriverCoreMidi(); -}; - -#endif // MIDI_DRIVER_COREMIDI_H -#endif // COREMIDI_ENABLED diff --git a/drivers/winmidi/SCsub b/drivers/winmidi/SCsub deleted file mode 100644 index 4e1b5f2..0000000 --- a/drivers/winmidi/SCsub +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -Import("env") - -# Driver source files -env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/winmidi/midi_driver_winmidi.cpp b/drivers/winmidi/midi_driver_winmidi.cpp deleted file mode 100644 index 8b3e236..0000000 --- a/drivers/winmidi/midi_driver_winmidi.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************/ -/* midi_driver_winmidi.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifdef WINMIDI_ENABLED - -#include "midi_driver_winmidi.h" - -#include "core/string/print_string.h" - -void MIDIDriverWinMidi::read(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { - if (wMsg == MIM_DATA) { - receive_input_packet((uint64_t)dwParam2, (uint8_t *)&dwParam1, 3); - } -} - -Error MIDIDriverWinMidi::open() { - for (UINT i = 0; i < midiInGetNumDevs(); i++) { - HMIDIIN midi_in; - - MMRESULT res = midiInOpen(&midi_in, i, (DWORD_PTR)read, (DWORD_PTR)this, CALLBACK_FUNCTION); - if (res == MMSYSERR_NOERROR) { - midiInStart(midi_in); - connected_sources.insert(i, midi_in); - } else { - char err[256]; - midiInGetErrorText(res, err, 256); - ERR_PRINT("midiInOpen error: " + String(err)); - - MIDIINCAPS caps; - res = midiInGetDevCaps(i, &caps, sizeof(MIDIINCAPS)); - if (res == MMSYSERR_NOERROR) { - ERR_PRINT("Can't open MIDI device \"" + String(caps.szPname) + "\", is it being used by another application?"); - } - } - } - - return OK; -} - -PoolStringArray MIDIDriverWinMidi::get_connected_inputs() { - PoolStringArray list; - - for (int i = 0; i < connected_sources.size(); i++) { - HMIDIIN midi_in = connected_sources[i]; - UINT id = 0; - MMRESULT res = midiInGetID(midi_in, &id); - if (res == MMSYSERR_NOERROR) { - MIDIINCAPS caps; - res = midiInGetDevCaps(i, &caps, sizeof(MIDIINCAPS)); - if (res == MMSYSERR_NOERROR) { - list.push_back(caps.szPname); - } - } - } - - return list; -} - -void MIDIDriverWinMidi::close() { - for (int i = 0; i < connected_sources.size(); i++) { - HMIDIIN midi_in = connected_sources[i]; - midiInStop(midi_in); - midiInClose(midi_in); - } - connected_sources.clear(); -} - -MIDIDriverWinMidi::MIDIDriverWinMidi() { -} - -MIDIDriverWinMidi::~MIDIDriverWinMidi() { - close(); -} - -#endif // WINMIDI_ENABLED diff --git a/drivers/winmidi/midi_driver_winmidi.h b/drivers/winmidi/midi_driver_winmidi.h deleted file mode 100644 index e961c96..0000000 --- a/drivers/winmidi/midi_driver_winmidi.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef MIDI_DRIVER_WINMIDI_H -#define MIDI_DRIVER_WINMIDI_H -/*************************************************************************/ -/* midi_driver_winmidi.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifdef WINMIDI_ENABLED - -#include "core/os/midi_driver.h" -#include "core/containers/vector.h" - -#include -#define WIN32_LEAN_AND_MEAN -#include - -#include - -class MIDIDriverWinMidi : public MIDIDriver { - Vector connected_sources; - - static void CALLBACK read(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2); - -public: - virtual Error open(); - virtual void close(); - - virtual PoolStringArray get_connected_inputs(); - - MIDIDriverWinMidi(); - virtual ~MIDIDriverWinMidi(); -}; - -#endif // MIDI_DRIVER_WINMIDI_H -#endif // WINMIDI_ENABLED diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 9526654..4e27fa4 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -184,7 +184,6 @@ def configure(env): "GLES_ENABLED", "APPLE_STYLE_KEYS", "COREAUDIO_ENABLED", - "COREMIDI_ENABLED", "GL_SILENCE_DEPRECATION", ] ) diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 47fbe00..b7cae67 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -35,7 +35,6 @@ #include "core/input/input.h" #include "crash_handler_osx.h" #include "drivers/coreaudio/audio_driver_coreaudio.h" -#include "drivers/coremidi/midi_driver_coremidi.h" #include "drivers/unix/os_unix.h" #include "joypad_osx.h" #include "main/input_default.h" @@ -90,9 +89,6 @@ public: #ifdef COREAUDIO_ENABLED AudioDriverCoreAudio audio_driver; #endif -#ifdef COREMIDI_ENABLED - MIDIDriverCoreMidi midi_driver; -#endif InputDefault *input; JoypadOSX *joypad_osx; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index d165668..698a51d 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1810,10 +1810,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a } void OS_OSX::finalize() { -#ifdef COREMIDI_ENABLED - midi_driver.close(); -#endif - CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL); CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index c522d7f..9a60b3e 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -236,7 +236,6 @@ def configure_msvc(env, manual_msvc_config): "WINDOWS_ENABLED", "OPENGL_ENABLED", "WASAPI_ENABLED", - "WINMIDI_ENABLED", "TYPED_METHOD_BIND", "WIN32", "MSVC", @@ -424,7 +423,7 @@ def configure_mingw(env): env.Append(CCFLAGS=["-mwindows"]) env.Append(LINKFLAGS=["-Wl,--nxcompat"]) # DEP protection. Not enabling ASLR for now, Mono crashes. - env.Append(CPPDEFINES=["WINDOWS_ENABLED", "OPENGL_ENABLED", "WASAPI_ENABLED", "WINMIDI_ENABLED"]) + env.Append(CPPDEFINES=["WINDOWS_ENABLED", "OPENGL_ENABLED", "WASAPI_ENABLED" ]) env.Append(CPPDEFINES=[("WINVER", env["target_win_version"]), ("_WIN32_WINNT", env["target_win_version"])]) env.Append( LIBS=[ diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 8d861a6..af0d1d2 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1735,10 +1735,6 @@ void OS_Windows::set_main_loop(MainLoop *p_main_loop) { } void OS_Windows::finalize() { -#ifdef WINMIDI_ENABLED - driver_midi.close(); -#endif - if (main_loop) memdelete(main_loop); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index b54a4ae..9e98b8b 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -37,7 +37,6 @@ #include "crash_handler_windows.h" #include "drivers/unix/ip_unix.h" #include "drivers/wasapi/audio_driver_wasapi.h" -#include "drivers/winmidi/midi_driver_winmidi.h" #include "key_mapping_windows.h" #include "main/input_default.h" #include "power_windows.h" @@ -380,9 +379,6 @@ class OS_Windows : public OS { #ifdef XAUDIO2_ENABLED AudioDriverXAudio2 driver_xaudio2; #endif -#ifdef WINMIDI_ENABLED - MIDIDriverWinMidi driver_midi; -#endif CrashHandler crash_handler;