Skip to content

Commit

Permalink
macos details, WIP
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Oct 11, 2023
1 parent a8bd74b commit d5e0e4a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 10 deletions.
40 changes: 35 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ TARGETS += build/mod-app.app/Contents/MacOS/mod-screenshot
TARGETS += build/mod-app.app/Contents/MacOS/mod-ui
TARGETS += build/mod-app.app/Contents/MacOS/mod
TARGETS += build/mod-app.app/Contents/MacOS/modtools
TARGETS += build/mod-app.app/Contents/PlugIns/bearer/libqgenericbearer.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/generic/libqtuiotouchplugin.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/iconengines/libqsvgicon.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/imageformats/libqsvg.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/platforms/libqcocoa.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/styles/libqmacstyle.dylib
TARGETS += build/mod-app.app/Contents/Resources/default.pedalboard
TARGETS += build/mod-app.app/Contents/Resources/html
else
Expand Down Expand Up @@ -201,14 +207,18 @@ ifneq ($(MACOS),true)
BUNDLES += rt-neural-generic.lv2
endif
# FIXME *.so extension
ifneq ($(MACOS),true)
BUNDLES += tinygain.lv2
endif
BUNDLES += wolf-shaper.lv2

# TODO check
ifneq ($(MACOS),true)
BUNDLES += Harmless.lv2
BUNDLES += Larynx.lv2
BUNDLES += Modulay.lv2
BUNDLES += Shiroverb.lv2
endif


# TODO build fails
Expand Down Expand Up @@ -354,11 +364,7 @@ build/mod-app.app/Contents/Frameworks/Qt%.framework: $(PAWPAW_PREFIX)/lib/Qt%.fr

build/mod-app.app/Contents/MacOS/mod-app: systray/mod-app
@mkdir -p build/mod-app.app/Contents/MacOS
install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" $<
install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<
install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg" $<
install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets" $<
ln -sf $(abspath $<) $@
cp -v $(abspath $<) $@

build/mod-app.app/Contents/MacOS/jackd: $(PAWPAW_PREFIX)/bin/jackd$(APP_EXT)
@mkdir -p build/mod-app.app/Contents/MacOS
Expand Down Expand Up @@ -408,6 +414,30 @@ build/mod-app.app/Contents/MacOS/modtools: mod-ui/modtools
@mkdir -p build/mod-app.app/Contents/MacOS/
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/bearer/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/bearer/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/bearer
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/generic/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/generic/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/generic
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/iconengines/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/iconengines/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/iconengines
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/imageformats/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/imageformats/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/imageformats
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/platforms/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/platforms/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/platforms
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/styles/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/styles/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/styles
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/Resources/default.pedalboard: mod-ui/default.pedalboard
@mkdir -p build/mod-app.app/Contents/Resources
ln -sf $(abspath $<) $@
Expand Down
10 changes: 9 additions & 1 deletion systray/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ else
TARGET = mod-app
endif

ifneq ($(MACOS),true)
ifeq ($(MACOS),true)
LDFLAGS += -framework CoreAudio
else
CXXFLAGS += $(shell pkg-config --cflags portaudio-2.0)
LDFLAGS += $(shell pkg-config --libs portaudio-2.0)
endif
Expand Down Expand Up @@ -80,6 +82,12 @@ clean:
$(TARGET): $(OBJS)
@$(shell mkdir -p $(@D))
$(CXX) $^ $(LDFLAGS) $(QT5_LIBS) -o $@
ifeq ($(MACOS),true)
install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" $@
install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $@
install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg" $@
install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets" $@
endif

main.cpp.o: main.cpp mod-app.hpp qrc_mod-app.hpp ui_mod-app.hpp
$(CXX) $< $(CXXFLAGS) $(QT5_FLAGS) -c -o $@
Expand Down
32 changes: 28 additions & 4 deletions systray/mod-app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,33 @@ class AppWindow : public QMainWindow
#endif

#ifdef Q_OS_MAC
// TODO
const AudioObjectPropertyAddress propAddr = {
.mElement = kAudioObjectPropertyElementWildcard,
.mScope = kAudioObjectPropertyScopeGlobal,
.mSelector = kAudioHardwarePropertyDevices,
};
uint32_t outPropDataSize = 0;
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propAddr, 0, nullptr, &outPropDataSize) == kAudioHardwareNoError)
{
const uint32_t numDevices = outPropDataSize / sizeof(AudioObjectID);

AudioObjectID* const deviceIDs = new AudioObjectID[numDevices];

if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAddr, 0, nullptr, &outPropDataSize, deviceIDs) == kAudioHardwareNoError)
{
for (uint32_t i = 0; i < numDevices; ++i)
{
}
}

printf("-------------------------------------------------------- AudioObjectGetPropertyDataSize %u\n", numDevices);

delete[] deviceIDs;
}
else
{
printf("-------------------------------------------------------- AudioObjectGetPropertyDataSize error\n");
}
#else
if (Pa_Initialize() == paNoError)
{
Expand Down Expand Up @@ -656,11 +682,9 @@ private slots:
printf("----------- %s %d\n", __FUNCTION__, __LINE__);
switch (reason)
{
case QSystemTrayIcon::Trigger:
case QSystemTrayIcon::DoubleClick:
setVisible(!isVisible());
break;
case QSystemTrayIcon::MiddleClick:
setVisible(!isVisible());
break;
default:
break;
Expand Down

0 comments on commit d5e0e4a

Please sign in to comment.