• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Reintegrate projectM Visualizer

    Scheduled Pinned Locked Moved
    Development
    6
    91
    9.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Gustavo L ConteG
      Gustavo L Conte @jonas
      last edited by

      @jonas When i do this:

      int current_preset_ = projectm_playlist_get_position(projectm_playlist_instance_);
      qLog(Debug) << "Rendering frame for preset: " << current_preset_;
      projectm_set_window_size(projectm_instance_, static_cast<size_t>(width * pixel_ratio_), static_cast<size_t>(height * pixel_ratio_));
      projectm_opengl_render_frame(projectm_instance_);
      

      and then set lets say, 5 seconds interval, selecting all presets

      it DOES increment the index printed 😞

      16:22:06.329 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.346 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.362 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.380 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.396 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.413 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.429 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.446 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.463 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.480 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.496 DEBUG ProjectMVisualization:205        Rendering frame for preset:  4
      16:22:06.513 DEBUG ProjectMVisualization:205        Rendering frame for preset:  5
      16:22:06.530 DEBUG ProjectMVisualization:205        Rendering frame for preset:  5
      16:22:06.546 DEBUG ProjectMVisualization:205        Rendering frame for preset:  5
      16:22:06.563 DEBUG ProjectMVisualization:205        Rendering frame for preset:  5
      16:22:06.580 DEBUG ProjectMVisualization:205        Rendering frame for preset:  5
      16:22:06.596 DEBUG ProjectMVisualization:205        Rendering frame for preset:  5
      
      1 Reply Last reply Reply Quote 0
      • jonasJ
        jonas @Gustavo L Conte
        last edited by

        @Gustavo-L-Conte said in Reintegrate projectM Visualizer:

        export QT_QUICK_BACKEND=software
        
        export LIBGL_ALWAYS_SOFTWARE=1
        

        Setting these variables didn't do anything, but I've managed to make it crash less often by reinstalling the nvidia driver.

        If you pull the latest changes from the visualisations branch I've fixed loading saved presets, the IndexOfPreset function was also broken with projectM 4.

        Gustavo L ConteG 2 Replies Last reply Reply Quote 1
        • Gustavo L ConteG
          Gustavo L Conte @jonas
          last edited by Gustavo L Conte

          @jonas said in Reintegrate projectM Visualizer:

          LIBGL_ALWAYS_SOFTWARE

          just finishing building 😄

          these are MEsa variables:

          https://docs.mesa3d.org/envvars.html

          1 Reply Last reply Reply Quote 0
          • Gustavo L ConteG
            Gustavo L Conte @jonas
            last edited by Gustavo L Conte

            @jonas I did not notice any difference running the app... except now it honours the selected presets. ( I think it "forgets" in previous versions, never understood what was going on)

            Still no output, but here's a thing I saw:

            [Visualizations]
            duration=30
            geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0%\0\0\x6P\0\0\x3\x39\0\0\0\0\0\0\0%\0\0\x6P\0\0\x3\x39\0\0\0\0\0\0\0\0\a\x80\0\0\0\0\0\0\0%\0\0\x6P\0\0\x3\x39)
            mode=1
            preset_paths=/usr/share//projectM/presets/Aderrasi - Agitator.milk, /usr/share//projectM/presets/Aderrasi - Aimless (Gravity Directive Mix).milk, /usr/share//projectM/presets/Aderrasi - Aimless (Spirogravity Mix).milk, /usr/share//projectM/presets/Aderrasi - Airhandler (Menagerie Mix).milk, /usr/share//projectM/presets/Aderrasi - Airs (Windy Mix).milk, /usr/share//projectM/presets/Aderrasi - Airs.milk, /usr/share//projectM/presets/Aderrasi - Anchorpulse (Pulse Of A Ghast II Mix).milk, /usr/share//projectM/presets/Aderrasi - Anchorpulse (Verified Mix).milk, /usr/share//projectM/presets/Aderrasi - Anomalous Material Science (Pure Splinter Mix).milk, /usr/share//projectM/presets/Aderrasi - Antidote (Aqualung Mix).milk,
            

            This is my config file, is it supposed to be missing double quotes in the filenames?

            jonasJ 1 Reply Last reply Reply Quote 0
            • jonasJ
              jonas @Gustavo L Conte
              last edited by

              QOpenGLFunctions::glGetError() returns GL_INVALID_ENUM (0x0501)

              Gustavo L ConteG 1 Reply Last reply Reply Quote 0
              • Gustavo L ConteG
                Gustavo L Conte @jonas
                last edited by

                @jonas I saw this error code too before, at the time I tought we had to make OpenGL ES context but I never tried that

                jonasJ 1 Reply Last reply Reply Quote 0
                • jonasJ
                  jonas @Gustavo L Conte
                  last edited by

                  With ProjectM3 I do not get that error code, but on some presets I get GL_INVALID_OPERATION.

                  Gustavo L ConteG 1 Reply Last reply Reply Quote 0
                  • Gustavo L ConteG
                    Gustavo L Conte @jonas
                    last edited by

                    @jonas
                    ProjectMGUI::initialize
                    (SDL2 frontend)

                    _projectMWrapper = &projectMWrapper;
                        _renderingWindow = renderingWindow.GetRenderingWindow();
                        _glContext = renderingWindow.GetGlContext();
                    
                        ImGui_ImplSDL2_InitForOpenGL(_renderingWindow, _glContext);
                        ImGui_ImplOpenGL3_Init("#version 130");
                    
                        UpdateFontSize();
                    

                    by settiing this version part could do the trick maybe?

                    jonasJ 1 Reply Last reply Reply Quote 0
                    • jonasJ
                      jonas @Gustavo L Conte
                      last edited by

                      @Gustavo-L-Conte

                      But that code is using ImGui?

                      I actually got some presets from the original pack (https://github.com/projectM-visualizer/presets-projectm-classic) to work with ProjectM version 4 now using Qt 5 and QGLWidget. The ones starting with "Martin", but a few others too. No crashes either.
                      With Qt 6 and QOpenGLWidget, none of them work, and I also see crashes.

                      Gustavo L ConteG 2 Replies Last reply Reply Quote 0
                      • Gustavo L ConteG
                        Gustavo L Conte @jonas
                        last edited by

                        @jonas I did the version stuff in the initializeGL, tested with qLog if it was setting the version, it did, and it didnt change anything.....

                        I'm thinking now, maybe these crashes could be some sort of related to overhead? It would be a shot in the dark again, but maybe increase the intervals? in the timer formulae

                        1 Reply Last reply Reply Quote 0
                        • Gustavo L ConteG
                          Gustavo L Conte @jonas
                          last edited by Gustavo L Conte

                          @jonas said in Reintegrate projectM Visualizer:

                          @Gustavo-L-Conte

                          I actually got some presets from the original pack (https://github.com/projectM-visualizer/presets-projectm-classic) to work with ProjectM version 4 now using Qt 5 and QGLWidget. The ones starting with "Martin", but a few others too. No crashes either.
                          With Qt 6 and QOpenGLWidget, none of them work, and I also see crashes.

                          tomorrow I'm going to clone the classic presets... if the ones I was using arent already, I got from steam and/or ubuntu packages;

                          I was able to make qt6 work with v3 today, remember? I believe using visualizations2 branch.
                          Had to force QStringLiterals all over the place to make it run, but perphaps with your fixes today it wont be necessary anymore. It was mainly paths: fontfile, preset, texture, etc;

                          Its good try to test with the same suite of presets, obviously.

                          Its very nice that you advanced making v4 work at all! I need to rest, but tomorrow I'm going to test both visualizations latest and visualizations2 if necessary.

                          tkssssss nice job

                          Screenshot from 2024-06-30 00-56-06.png
                          qt6 llibprojectM v3 with visualizations2 branch

                          I found another "hint" for the puzzle, on the qt frontend of projectM repo

                          void resizeGL ( int w, int h ) override
                          		{
                          			// Setup viewport, projection etc
                          			setup_opengl ( w,h );
                          			projectm_set_window_size(m_projectM->instance(), static_cast<size_t>(w), static_cast<size_t>(h));
                          		}
                          		
                          		void setup_opengl ( int w, int h )
                          		{
                          
                          			/* Our shading model--Gouraud (smooth). */
                          			glShadeModel ( GL_SMOOTH );
                          			/* Culling. */
                          			//    glCullFace( GL_BACK );
                          			//    glFrontFace( GL_CCW );
                          			//    glEnable( GL_CULL_FACE );
                          			/* Set the clear color. */
                          			glClearColor ( 0, 0, 0, 0 );
                          			/* Setup our viewport. */
                          			glViewport ( 0, 0, w, h );
                          			/*
                          					* Change to the projection matrix and set
                          					* our viewing volume.
                          			*/
                          			glMatrixMode ( GL_TEXTURE );
                          			glLoadIdentity();
                          
                          			//    gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height);
                          			glMatrixMode ( GL_PROJECTION );
                          			glLoadIdentity();
                          
                          			//    glFrustum(0.0, height, 0.0,width,10,40);
                          			glMatrixMode ( GL_MODELVIEW );
                          			glLoadIdentity();
                          
                          			glDrawBuffer ( GL_BACK );
                          			glReadBuffer ( GL_BACK );
                          			glEnable ( GL_BLEND );
                          
                          			glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
                          			// glBlendFunc(GL_SRC_ALPHA, GL_ONE);
                          			glEnable ( GL_LINE_SMOOTH );
                          			glEnable ( GL_POINT_SMOOTH );
                          			glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
                          //   glClear(GL_COLOR_BUFFER_BIT);
                          
                          			// glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0);
                          			//glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize);
                          			glLineStipple ( 2, 0xAAAA );
                          		}
                          

                          https://github.com/projectM-visualizer/frontend-qt/blob/master/src/common/qprojectmwidget.hpp

                          Hope it helps; we can use QOpenGLFunctions.h for that procedure. Maybe this is just whats missing for us now in terms of black/blank screen............................

                          Gustavo L ConteG 1 Reply Last reply Reply Quote 0
                          • Gustavo L ConteG
                            Gustavo L Conte @Gustavo L Conte
                            last edited by

                            @Gustavo-L-Conte said in Reintegrate projectM Visualizer:

                            /* Our shading model--Gouraud (smooth). /
                            glShadeModel ( GL_SMOOTH );
                            /
                            Culling. /
                            // glCullFace( GL_BACK );
                            // glFrontFace( GL_CCW );
                            // glEnable( GL_CULL_FACE );
                            /
                            Set the clear color. /
                            glClearColor ( 0, 0, 0, 0 );
                            /
                            Setup our viewport. /
                            glViewport ( 0, 0, w, h );
                            /

                            * Change to the projection matrix and set
                            * our viewing volume.
                            */
                            glMatrixMode ( GL_TEXTURE );
                            glLoadIdentity();

                              	//    gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height);
                              	glMatrixMode ( GL_PROJECTION );
                              	glLoadIdentity();
                            
                              	//    glFrustum(0.0, height, 0.0,width,10,40);
                              	glMatrixMode ( GL_MODELVIEW );
                              	glLoadIdentity();
                            
                              	glDrawBuffer ( GL_BACK );
                              	glReadBuffer ( GL_BACK );
                              	glEnable ( GL_BLEND );
                            
                              	glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
                              	// glBlendFunc(GL_SRC_ALPHA, GL_ONE);
                              	glEnable ( GL_LINE_SMOOTH );
                              	glEnable ( GL_POINT_SMOOTH );
                              	glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
                            

                            // glClear(GL_COLOR_BUFFER_BIT);

                              	// glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0);
                              	//glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize);
                              	glLineStipple ( 2, 0xAAAA );
                            

                            after making lotsa tests with this idea of "preparing" opengl I've decided to debug the preset loading, it seems something is wrong with the "current" preset, it never starts. I did some serious qLog debugging messages, it appears that it loads the presets correctly but the playlist never starts, not even the M logo. 😞 tomorrow I'll try to understand this better....

                            jonasJ 1 Reply Last reply Reply Quote 0
                            • jonasJ
                              jonas @Gustavo L Conte
                              last edited by

                              @Gustavo-L-Conte

                              I've made a much more minimal test project here for debugging:
                              https://github.com/jonaski/ProjectMTest

                              Gustavo L ConteG 1 Reply Last reply Reply Quote 1
                              • Gustavo L ConteG
                                Gustavo L Conte @jonas
                                last edited by

                                @jonas said in Reintegrate projectM Visualizer:

                                @Gustavo-L-Conte

                                I've made a much more minimal test project here for debugging:
                                https://github.com/jonaski/ProjectMTest

                                Awesome idea! Without v4, I always get these errors both in Strawberry and also now in the testproject:

                                ~/ProjectMTest/build$ ./projectmtest 
                                No Textures Loaded from "/usr"/share/projectM/textures
                                Could not open font file:
                                

                                What I'm doing to bypass it is kinda bizarre.

                                mkdir -p \"/usr\"/share/projectM
                                

                                for the first error, then I copy stuff to that bizarre new local dir.

                                For the fonts, I just force the filename to some ttf in /fonts with QStringLiteral and .toStdString(); in the settings s structure, vars are menuFontURL and titleFontURL

                                I really do not understand where this double quotes come from, neither why I'm having to set the fonts filename by hand. Do you think maybe v3 is trying to read from a config file i do not have?

                                Gustavo L ConteG 1 Reply Last reply Reply Quote 0
                                • Gustavo L ConteG
                                  Gustavo L Conte @Gustavo L Conte
                                  last edited by Gustavo L Conte

                                  its hard-coded on my lib from Ubuntu package

                                  I'll see if it fixes by recompiling it by hand

                                  ~/ProjectMTest/build$ strings /usr/lib/libprojectM.so | xargs -0 | grep \"/usr
                                  

                                  Smooth Preset DuHard Cut SensitiAspect CorrectioEaster Egg ParamSoft Cut Ratingsidle://Geiss & Sperl - Feedback (projectM idle Hle HDR mix).milkSmooth Transitionsition Duration

                                  "/usr"/share/proprojectM/presets "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansaVuSansMono.ttf"

                                  edit: I'm so stupid, the ubuntu package is v2 not v3 LoL just realized it now

                                  Gustavo L ConteG 1 Reply Last reply Reply Quote 0
                                  • Gustavo L ConteG
                                    Gustavo L Conte @Gustavo L Conte
                                    last edited by Gustavo L Conte

                                    Okey, got libprojectM v2.10 and v3.12 from sourceforge and...

                                    Looks like v 3.12 works like a charm in the test program. Didn't need to do anything, out-of-the-box. Some presets seem "idle" maybe because they are not fed by any data? there is no ConsumeBuffer right?

                                    about v2.10 compiled by hand: it gave some trouble to compile, had to fix some stuff in the source for it to compile,also fiddle with src/CMakeLists.txt to avoid trying to detect things we dont need in this context. Amazing:

                                    ~/ProjectMTest/build$ ./projectmtest 
                                    No Textures Loaded from "/usr"/share/projectM/textures
                                    Could not open font file:
                                    

                                    Something is really messed up with that v2.10, not just in Ubuntu now I see

                                    ~/ProjectMTest/build$ ls -la /usr/lib/libprojectM.so.2
                                    lrwxrwxrwx 1 root root 20 jun 30 21:29 /usr/lib/libprojectM.so.2 -> libprojectM.so.2.1.0
                                    ~/ProjectMTest/build$ date
                                    dom 30 jun 2024 21:31:32 -03
                                    ~/ProjectMTest/build$ strings /usr/lib/libprojectM.so.2 | grep usr\/share
                                    "/usr/share/projectM/fonts/Vera.ttf"
                                    "/usr/share/projectM/fonts/VeraMono.ttf"
                                    ~/ProjectMTest/build$ strings /usr/lib/libprojectM.so.2 | grep usr\"\/share
                                    "/usr"/share/projectM/presets
                                    "/usr"/share/projectM/textures
                                    

                                    edit: Found the reason!
                                    in v2.10 It defines the path here,
                                    line 279 src/libprojectM/Renderer/TextureManager.cpp

                                    void TextureManager::loadTextureDir()
                                    {
                                            std::string dirname = CMAKE_INSTALL_PREFIX  "/share/projectM/textures";
                                    

                                    the CMAKE_INSTALL_PREFIX is being set with the double quotes, probably some REGEX replace on cmake

                                    Gustavo L ConteG 1 Reply Last reply Reply Quote 0
                                    • Gustavo L ConteG
                                      Gustavo L Conte @Gustavo L Conte
                                      last edited by Gustavo L Conte

                                      I'm testing libprojectM v3.12 with qt6 and visualizations2 branch, seems to work pretty good!

                                      I'm using the cream of the cream presets pack on their repo. Some are probably breaking indeed. But no segfaults!!!

                                      but i think its not consuming the buffer.... most presets doesnt seem to interact with the song 😞

                                      Gustavo L ConteG 1 Reply Last reply Reply Quote 0
                                      • Gustavo L ConteG
                                        Gustavo L Conte @Gustavo L Conte
                                        last edited by

                                        b7c2074f-e6ea-4ad8-9fbf-f775585c28b8-image.png

                                        Because of suspecting the presets are not interacting with the song, I did code a few lines that change the behaviour of instead use ConsumeBuffer from gstreamer, to acquire data from the monitor pulse/pipewire source of the audio card; it then sends this recorded buffer to projectM. honestly i did not notice much difference, this can be a little subjective, but maybe it does work. If any one is interested I can put the code somewhere..

                                        1 Reply Last reply Reply Quote 0
                                        • Gustavo L ConteG
                                          Gustavo L Conte
                                          last edited by

                                            if (projectm_) {
                                              int samples_per_channel = map.size / sizeof(int) / 2; 
                                              qDebug() << "Samples per channel:" << samples_per_channel;
                                              const float *data = reinterpret_cast<float*>(map.data);
                                              qDebug() << "First 10 data samples:" << QVector<float>(data, data + 10);
                                              projectm_->pcm()->addPCMfloat_2ch(data, samples_per_channel);
                                            }
                                          

                                          I'm messing around here, but maybe I've made some progress in the issue of the buffer not being properly consumed. The basic idea here is prevent samples per channel to become negative, in my point of view this should never happen. I also changed to the float version of the AddPCM function. Still, not all presets seem to work, but i.e. "Geiss - Drop Shadow 1.milk" shows that its interacting with the music. It's very important to focus in the presets that give information, thats one I recommend. I also recommend the ones that make a waveform, they are the best for debuging.

                                          I used to see a triangle kinda half the screen but after these changes the presets that are broken render a white screen. LoL

                                          I'm using v3.12 projectM, qt6 with visualizations2 branch. The other branch is very CPU intensive, maybe because of resets (if you turn resets on in visualization2 same high load cpu happens), dunno if this happens with NVIDIA.

                                          Gotta rest, cya guys

                                          1 Reply Last reply Reply Quote 0
                                          • Gustavo L ConteG
                                            Gustavo L Conte
                                            last edited by

                                            Here's a very simple milkdrop preset to test and compare running it inside Strawberry ( libprojectM v3.12 + Qt6 ) against the projectMSDL official visualizer. The results are pretty disappointing, since on the SDL app, it renders as expected, while on Strawberry the screen just flashes (at least the right color)

                                            😞 😞 😞

                                            [settings]
                                            presetAuthor=Gustavo L  Conte
                                            presetName=000 Simplest Waveform for Strawberry Music Player debug
                                            
                                            [init]
                                            # Initialization code here
                                            nWaveMode=2  # Use the waveform mode 2, which is lines
                                            wave_r=0.0
                                            wave_g=1.0
                                            wave_b=0.0
                                            wave_a=1.0
                                            nWaveDots=0
                                            nWaveThick=1
                                            bAdditiveWaves=0
                                            
                                            [per_frame_1]
                                            # Per-frame equations
                                            wave_r = 0.0;
                                            wave_g = 1.0;
                                            wave_b = 0.0;
                                            wave_a = 1.0;
                                            
                                            [waveform]
                                            # Waveform equations
                                            x = sample;  # Directly map the sample values to the x-coordinate
                                            y = value1;  # Use the waveform's y-coordinate as given
                                            red = 0.0;
                                            green = 1.0;
                                            blue = 0.0;
                                            alpha = 1.0;
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB | Contributors