Skip to content

Conversation

@struktured
Copy link
Contributor

@struktured struktured commented Nov 23, 2023

This compiles with ui-jack and it crashed the first time I ran it, runs fine otherwise except for some weird artifacts on a few presets. Want to test it a bit more.

Screenshot_20231123_161918

@struktured struktured self-assigned this Nov 23, 2023
@struktured struktured changed the title Draft: Fix projectm 4 compiler errors Draft: Fix projectm and ui-jack 4 compiler errors Nov 23, 2023
@struktured
Copy link
Contributor Author

I also tested projectM-pulseaudio and it had the same rendering issues.

@struktured struktured changed the title Draft: Fix projectm and ui-jack 4 compiler errors Fix projectm and ui-jack 4 compiler errors Nov 24, 2023
@struktured struktured changed the title Fix projectm and ui-jack 4 compiler errors Fix libprojectm4 and ui-jack compiler errors Nov 24, 2023
@kblaschke
Copy link
Member

kblaschke commented Nov 25, 2023

When I last tested the Qt app, I also had rendering errors - like a quarter of the rendering area having a strange border.

I've also noticed that some OpenGL objects just vanished at random points, e.g. vertex buffer objects becoming invalid and thus causing weird/broken and invisible geometry being rendered. Didn't really spend much time to find out what was going wrong.

@revmischa
Copy link
Member

revmischa commented Nov 25, 2023

When I updated the macOS Music plugin i noticed weird screen effects in a quarter of the screen until I added a high DPI rendering flag to something (I forget exactly what)

(edit: in re: "When I last tested the Qt app, I also had rendering errors - like a quarter of the rendering area having a strange border.")


void QProjectMConfigDialog::saveConfig() {
// Will only keep data_dir.
auto settings = projectm_get_settings(_qprojectMWidget->qprojectM()->instance());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum... projectm_get_settings() didn't make it into the 4.0 release, the whole settings struct is gone and was replaced by get/set calls.

Better try compiling against the 4.0 release or current master of libprojectM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I am? See this output:

(base) carm@blackmage:~/projects/frontend-qt$ ldd src/ui-jack/projectM-jack |grep projectM
        libprojectM.so.4 => /usr/local/lib/libprojectM.so.4 (0x00007fce9bc00000)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .so version is about misleading as it's just counted up, and not really related to the version number. The filename of projectM 4 is different though, it's named libprojectM-4.so. The include dirs also are prefixed with a projectM-4 path.

Just try to build the Qt app against latest projectM master, making sure no libs/headers of older versions are still in you system paths.

@struktured
Copy link
Contributor Author

struktured commented Nov 25, 2023

When I last tested the Qt app, I also had rendering errors - like a quarter of the rendering area having a strange border.

I've also noticed that some OpenGL objects just vanished at random points, e.g. vertex buffer objects becoming invalid and thus causing weird/broken and invisible geometry being rendered. Didn't really spend much time to find out what was going wrong.

I've seen that too, was going to look into that next. I still think this PR is better than what's in master now though.

@struktured
Copy link
Contributor Author

So I cleaned up some old projectm header files and now get a ton of compiler errors. Will try to fix them!!

@revmischa revmischa removed their request for review April 1, 2024 15:50
@kblaschke
Copy link
Member

Any progress with this PR or should we better convert it to a draft?

Carmelo Piccione and others added 13 commits January 18, 2026 10:30
- Created new ui-pipewire directory with native PipeWire implementation
- Added CMake configuration for PipeWire support (ENABLE_PIPEWIRE option)
- PipeWire backend uses modern pipewire-0.3 API for audio capture
- Updated README to document PipeWire support as recommended backend
- Added desktop file and man page for projectM-pipewire
- Updated .gitignore to exclude build and tmp directories

PipeWire is now the recommended audio backend for modern Linux systems.
The implementation provides:
- Native pw_stream-based audio capture
- Auto-connection to default audio sources
- 32-bit float stereo at 44.1kHz sample rate
- Simpler codebase compared to PulseAudio implementation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
libprojectM 4.x installs with the package name projectM4 instead of
libprojectM. Updated find_package() call to match.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Changed all #include <libprojectM/...> to #include <projectM-4/...>
- Updated CMakeLists.txt to use libprojectM::projectM target
- Headers are now installed in projectM-4/ directory in version 4.x

This is part of the libprojectM 4.x migration. Additional API changes
still need to be addressed for full compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Documents the API changes needed for full libprojectM 4.x compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Progress on migrating to projectM 4.x API:

✅ Completed:
- Removed keyboard handler (API removed in v4)
- Updated render call: projectm_render_frame() → projectm_opengl_render_frame()
- Fixed QProjectM callbacks to use new signatures
- Updated projectm_create() (no longer takes flags)

❌ Remaining:
- Update preset lock API: projectm_lock_preset() → projectm_set_preset_locked()
- Remove/stub preset rating functionality (removed in v4)
- Update qprojectm_mainwindow to handle new callback signatures
- Load settings from config file (create() no longer takes config path)

The PipeWire audio backend is complete and ready once these API fixes
are finished.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
✅ Fixed:
- Preset lock API: projectm_lock_preset() → projectm_set_preset_locked()
- Preset lock query: projectm_is_preset_locked() → projectm_get_preset_locked()
- Updated callback signatures for preset switch failures
- Removed preset rating type parameter (removed in v4)
- Stubbed out shuffle (removed from core, now in playlist library)

❌ Remaining (playlist library integration needed):
- projectm_get_preset_duration, projectm_get_preset_rating
- projectm_get_selected_preset_index, projectm_get_preset_filename
- projectm_get_playlist_size, projectm_add_preset_url
- projectm_insert_preset_url, projectm_remove_preset
- projectm_clear_playlist

The playlist functionality has moved to libprojectM-4-playlist.so which
needs to be integrated separately.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added projectM4Playlist library dependency to CMake
- Linked libprojectM::playlist to projectM-Qt-Common
- Included playlist.h header for playlist API functions
- Created .claude/allowed_commands.json for auto-approval rules

❌ Build still fails - playlist API migration incomplete:
The playlist functions (projectm_get_preset_name, projectm_get_preset_rating,
projectm_add_preset_url, etc.) have moved from the core library to the separate
playlist library with different API signatures. Full migration needed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Updated QPlaylistModel to use new playlist API (projectm_playlist_*)
- Added playlistHandle() getter to QPlaylistModel
- Fixed all main window functions to use playlist API instead of core library
- Removed rating system code (removed in v4)
- Updated config dialog to use ConfigFile directly (projectm_get_settings removed)
- Fixed PipeWire backend struct initializer order
- All builds successful: Common, PulseAudio, PipeWire

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added runtime error if projectm_create() fails
- Application now runs successfully with QT_QPA_PLATFORM=xcb
- PipeWire backend fully operational

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Set QSurfaceFormat to request OpenGL 3.3 Core Profile globally
- Configure depth buffer, stencil buffer, double buffering
- Enable vsync for smooth rendering
- Window exists but not yet visible (Map State: IsUnMapped)
- Need to investigate window mapping issue

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added qDebug/qCritical logging to track initialization
- Helps diagnose OpenGL context issues
- Window exists but not rendering/visible yet

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Updated presetSwitchedSignal connections (removed unsigned int index parameter)
- Modified updatePlaylistSelection to query position from playlist API
- Signal connection errors now resolved
- OpenGL context creation still needs work (EGL failing)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Renamed presetSwitchRequestedSignal to presetSwitchedSignal
- Matches what main window expects to connect to
- Signal connection errors now resolved
- Application initializes without Qt signal warnings

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Carmelo Piccione and others added 10 commits January 20, 2026 01:47
- Added raise() and activateWindow() to main window
- Set showNormal() for explicit window display
- Requires QT_XCB_GL_INTEGRATION=xcb_glx (EGL fails)
- Created run-projectm-pipewire.sh wrapper script
- Window exists but needs manual mapping (WM interaction issue)

Window can be manually shown with:
  xdotool search --name '^projectM$' windowmap

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Qt signals cannot be const - the const qualifiers prevented the MOC
(Meta-Object Compiler) from properly registering the signals, causing
connection failures at runtime.

This fixes the errors:
  QObject::connect: No such signal QProjectM::presetSwitchedSignal ( bool )

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Major improvements:
- Auto-load presets from default directory when no playlist exists
- Fix OpenGL 3.3 Core Profile compatibility by removing deprecated
  fixed-function pipeline calls (glMatrixMode, glShadeModel, etc.)
- Add explicit window show/raise after OpenGL initialization
- Add processEvents() call to improve window mapping timing

Changes:
- qplaylistmodel.cpp: Load presets from ~/.local/share/projectM/presets
  when no playlist file is specified or found
- qprojectmwidget.hpp: Simplify setup_opengl() to only set viewport,
  projectM 4.x handles all other OpenGL state internally
- qprojectm_mainwindow.cpp: Explicitly show/raise/activate window after
  projectM initialization completes
- qprojectM-pipewire.cpp: Add processEvents() call after initial show()

The application now loads presets correctly and renders visualizations.
Window visibility on XWayland requires xdotool workaround (use wrapper
script: build/run-projectm-pipewire.sh).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes two bugs that caused crashes and warnings:

1. Race condition in addPCM(): The PipeWire audio thread could call
   addPCM() before the OpenGL context was initialized and the projectM
   instance was created, causing a segmentation fault. Added null
   checks to safely handle this case.

2. Invalid QModelIndex in updateItemHighlights(): When the playlist
   was empty, calling dataChanged(index(0,0), index(-1,0)) created
   invalid indices. Added check to only emit dataChanged when the
   model has rows.

These fixes prevent:
- "malloc(): unsorted double linked list corrupted" crashes
- "dataChanged() called with an invalid index range" warnings
- Segmentation faults on startup when PipeWire starts streaming

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Critical fixes for visualization rendering:

1. Start preset playback automatically after loading
   - Call projectm_playlist_set_position() with first preset after
     loading presets from directory
   - Without this, the playlist was loaded but no preset was playing,
     resulting in a blank visualization

2. Add null check in paintGL()
   - Prevent crashes if paintGL() is called before projectM is initialized
   - Safely return early if projectM instance isn't ready

This fixes the issue where the window appeared but showed no visualization.
The application now correctly renders presets with audio-reactive visuals.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fixed Qt settings to use empty PlaylistFile (load from default directory)
- Added detailed debug logging for OpenGL rendering and resize events
- Added preset loading verification to confirm which preset is selected
- Created test scripts for debugging render issues

This fixes the config issue that prevented presets from loading when
an old XML playlist file path was set. Now correctly loads from
~/.local/share/projectM/presets/

Downloaded and installed 9,798 presets from Cream of the Crop pack.

Note: Visualization area still renders black despite:
- OpenGL 4.6 working (RTX 3090)
- 9,798 presets loaded successfully
- Rendering functions being called
- No OpenGL errors reported

Further investigation needed for why projectM output isn't visible.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit implements a complete PipeWire audio device selection
system modeled after the working PulseAudio implementation, and fixes
critical playlist display issues.

Changes:

Phase 1: Playlist Display Fixes
- Fix playlist dock widget visibility by removing unconditional hide() call
- Add early historyHash initialization to prevent race conditions
- Playlist now shows 9,798 presets on startup

Phase 2: PipeWire Device Selector Implementation
- Add device enumeration for both Audio/Source and Audio/Sink nodes
- Audio/Sink nodes are marked as [Monitor] for system audio capture
- Create QPipeWireDeviceModel for device list view
- Create QPipeWireDeviceChooser dialog with theme-aware colors
- Add PipeWireDeviceChooserDialog.ui form
- Integrate device selector into Settings menu
- Add settings persistence across sessions
- Default behavior: auto-connect to first monitor source

Phase 3: Bug Fixes
- Fix spa_hook conflict by adding separate stream_listener
- Use semi-transparent green highlighting for theme compatibility
- Prevent white-on-white text in device selector

Technical Details:
- Device enumeration uses pw_registry to discover nodes
- Reconnection logic properly handles stream lifecycle
- Settings stored in QSettings("projectM", "qprojectM-pipewire")
- Thread-safe device list access via static members

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…vation

Major fixes:
- Add render timer for continuous animation (was only rendering first frame)
- Use projectm_opengl_render_frame_fbo() to render to QOpenGLWidget's FBO
- Add launcher script for Wayland/XWayland window activation via xdotool
- Display preset filename only (not full path) in playlist by default
- Add audio peak level debugging for PipeWire capture
- Deprecate PulseAudio build in favor of PipeWire

The key issue was that QOpenGLWidget uses its own framebuffer object,
not FBO 0. ProjectM was rendering to the wrong target, causing black screen.

Also fixes menu toggle shrinking window issue and improves PulseAudio
device selector colors (bright green highlight with black bold text).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- N/P keys for next/previous preset navigation
- H key to toggle playlist visibility independently
- M key now only toggles menu bar (preserves window geometry)
- Hide .milk extension from preset names in playlist
- Fix menu toggle shrinking window (use QTimer to restore geometry)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move all projectM calls to render thread to eliminate race condition
- Add audio ring buffer to QProjectMWidget for thread-safe queueing
- Audio thread now just writes to buffer, render thread processes it
- Add 'R' hotkey for random preset selection
- Fixes 'malloc(): unsorted double linked list corrupted' crash

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants